set_basename( true, __FILE__ ); } else { if ( ! function_exists( 'affloc_fs' ) ) { function affloc_fs() { global $affloc_fs; if ( ! isset( $affloc_fs ) ) { require_once dirname( __FILE__ ) . '/vendor/freemius/start.php'; $affloc_fs = fs_dynamic_init( array( 'id' => '25997', 'slug' => 'affloc', 'type' => 'plugin', 'public_key' => 'pk_83d26f485070dac797b9ce38b58d5', 'is_premium' => false, 'premium_suffix' => 'Pro', 'has_premium_version' => true, 'has_addons' => false, 'has_paid_plans' => true, 'is_org_compliant' => true, 'menu' => array( 'slug' => 'aff-localization', 'support' => false, ), ) ); } return $affloc_fs; } affloc_fs(); do_action( 'affloc_fs_loaded' ); } define( 'AFFLOC_VERSION', '0.2.0' ); define( 'AFFLOC_PATH', plugin_dir_path( __FILE__ ) ); define( 'AFFLOC_URL', plugin_dir_url( __FILE__ ) ); require_once AFFLOC_PATH . 'inc/class-db.php'; require_once AFFLOC_PATH . 'inc/class-admin.php'; require_once AFFLOC_PATH . 'inc/class-shortcode.php'; function affloc_init() { new Affloc_DB(); new Affloc_Admin(); new Affloc_Shortcode(); $installed_ver = get_option( 'affloc_db_version' ); if ( $installed_ver !== AFFLOC_VERSION ) { Affloc_DB::create_table(); update_option( 'affloc_db_version', AFFLOC_VERSION ); } } add_action( 'plugins_loaded', 'affloc_init' ); register_activation_hook( __FILE__, array( 'Affloc_DB', 'create_table' ) ); register_uninstall_hook( __FILE__, 'affloc_uninstall' ); function affloc_uninstall() { if ( ! current_user_can( 'activate_plugins' ) ) { return; } global $wpdb; $wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}aff_links" ); // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared, WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.DirectDatabaseQuery.SchemaChange delete_option( 'affloc_db_version' ); delete_option( 'affloc_settings' ); } }