6.0.0] * * @return bool */ function wpfm_pro_compatibility() { if ( wpfm_get_plugin_version( WPFM_PRO ) ) { return ( wpfm_get_plugin_version( WPFM_PRO ) >= WPFM_PRO_REQUIRED_VERSION ); } return false; } /** * Check if WPFM ETSY is compatible with new ui [version > 6.0.0] * * @return bool */ function wpfm_etsy_compatibility() { if ( wpfm_get_plugin_version( WPFM_ETSY ) ) { return ( wpfm_get_plugin_version( WPFM_ETSY ) >= WPFM_ETSY_REQUIRED_VERSION ); } return false; } /** * Gets plugin version * * @param $file * @return mixed|string */ function wpfm_get_plugin_version( $file ) { $plugin_file = WP_PLUGIN_DIR . $file; if ( file_exists( $plugin_file ) && function_exists( 'get_file_data' ) ) { $plugin_data = get_file_data( $plugin_file, array('Version' => 'Version'), false ); if ( $plugin_data && is_array( $plugin_data ) && isset( $plugin_data[ 'Version' ] ) ) { return $plugin_data[ 'Version' ]; } } return false; } /** * Run dependency check and abort if required. **/ function rex_check_dependency(){ $wpfm_pro_abs = WP_PLUGIN_DIR . WPFM_PRO; $wpfm_etsy_abs = WP_PLUGIN_DIR . WPFM_ETSY; if ( ! rex_is_woocommerce_active() ) { add_action( 'admin_init', 'rex_product_feed_deactivate' ); add_action( 'admin_notices', 'rex_product_feed_admin_notice' ); } if ( ( file_exists( $wpfm_pro_abs ) && ! wpfm_pro_compatibility() ) || ( file_exists( $wpfm_etsy_abs ) && ! wpfm_etsy_compatibility() ) ) { add_action( 'admin_notices', 'wpfm_pro_update_notice' ); } } /** * Prints a notice to update WPFM Pro [version > 6.7.5] */ function wpfm_pro_update_notice() { $wpfm_pro_abs = WP_PLUGIN_DIR . WPFM_PRO; $wpfm_etsy_abs = WP_PLUGIN_DIR . WPFM_ETSY; $wpfm_pro = file_exists( $wpfm_pro_abs ) && ! wpfm_pro_compatibility() ? 'WooCommerce Product Feed Manager Pro' : ''; $wpfm_etsy = file_exists( $wpfm_etsy_abs ) && ! wpfm_etsy_compatibility() ? 'WooCommerce Product Feed Manager - Etsy Addon' : ''; $and = file_exists( $wpfm_pro_abs ) && ! wpfm_pro_compatibility() && file_exists( $wpfm_etsy_abs ) && ! wpfm_etsy_compatibility() ? ' and ' : ''; $message = __( 'It looks like you have an older version of ' . $wpfm_pro . $and . $wpfm_etsy . '. Please update ' . $wpfm_pro . $and . $wpfm_etsy . ' to the latest version to use Pro features properly.', 'rex-product-feed' ); ?>

WooCcommerce Product Feed Manager has been deactivated. Please install and activate WooCoommerce before activating this plugin.

'; $activate = filter_input( INPUT_GET, 'activate', FILTER_SANITIZE_STRING ); if ( $activate ){ unset( $_GET['activate'] ); } } /** * Force deactivate the plugin. **/ function rex_product_feed_deactivate() { deactivate_plugins( plugin_basename( __FILE__ ) ); } /** * The code that runs during plugin activation. * This action is documented in includes/class-rex-product-feed-activator.php */ function activate_rex_product_feed() { require_once plugin_dir_path( __FILE__ ) . 'includes/class-rex-product-feed-activator.php'; if ( !rex_is_woocommerce_active() ) { // Stop activation redirect and show error wp_die('Sorry, but this plugin requires the WooCommerce Plugin to be installed and active.
« Return to Plugins'); } else{ Rex_Product_Feed_Activator::activate(); } } /** * The code that runs during plugin deactivation. * This action is documented in includes/class-rex-product-feed-deactivator.php */ function deactivate_rex_product_feed() { require_once plugin_dir_path( __FILE__ ) . 'includes/class-rex-product-feed-deactivator.php'; Rex_Product_Feed_Deactivator::deactivate(); } register_activation_hook( __FILE__, 'activate_rex_product_feed' ); register_deactivation_hook( __FILE__, 'deactivate_rex_product_feed' ); /** * The core plugin class that is used to define internationalization, * admin-specific hooks, and public-facing site hooks. */ require plugin_dir_path( __FILE__ ) . 'includes/class-rex-product-feed.php'; require plugin_dir_path( __FILE__ ) . 'includes/helper.php'; function wpfm_plugin_redirect() { if (get_option('rex_wpfm_plugin_do_activation_redirect', false)) { delete_option('rex_wpfm_plugin_do_activation_redirect'); $url = "admin.php?page=bwfm-dashboard"; $url = filter_var( $url, FILTER_SANITIZE_URL ); exit( wp_redirect( $url ) ); } } /** * Begins execution of the plugin. * * Since everything within the plugin is registered via hooks, * then kicking off the plugin from this point in the file does * not affect the page life cycle. * * @since 1.0.0 */ function run_rex_product_feed() { $plugin = new Rex_Product_Feed(); $plugin->run(); rex_check_dependency(); } run_rex_product_feed(); /** * Initialize the tracker * * @return void */ function appsero_init_tracker_bwfm() { $client = new Appsero\Client( '5fab4a18-aaf4-4565-816a-47858011d96f', 'Product Feed Manager for WooCommerce', __FILE__ ); // Active insights $client->insights()->init(); } appsero_init_tracker_bwfm(); /** * is_edit_page * function to check if the current page is a post edit page * * @param string $new_edit what page to check for accepts new - new post page ,edit - edit post page, null for either * @return boolean */ function is_edit_page($new_edit = null){ global $pagenow; if (!is_admin()) return false; if($new_edit == "edit") return in_array( $pagenow, array( 'post.php', ) ); elseif($new_edit == "new") //check for new post page return in_array( $pagenow, array( 'post-new.php' ) ); else return in_array( $pagenow, array( 'post.php', 'post-new.php' ) ); } /** * @param $pages * @return mixed */ function wpfm_top_pages_modify($pages) { global $typenow; if ( ( is_edit_page('edit') && "product-feed" === $typenow ) || ( is_edit_page('new') && "product-feed" === $typenow ) ){ unset( $pages[0] ); unset( $pages[1] ); } return $pages; } add_filter('themify_top_pages', 'wpfm_top_pages_modify' ); function wpfm_plugin_major_update_message( $data, $response ) { if( isset( $data['upgrade_notice'] ) ) { printf( '
%s
', wpautop( $data['upgrade_notice'] ) ); } } add_action( 'in_plugin_update_message-best-woocommerce-feed/rex-product-feed.php', 'wpfm_plugin_major_update_message', 10, 2 ); function rex_feed_redirect_after_activation( $plugin ) { if ( $plugin === plugin_basename( __FILE__ ) ) { $query_args = [ 'page' => 'setup-wizard', 'plugin_activated' => 1 ]; $url = add_query_arg( urlencode_deep( $query_args ), esc_url( admin_url( 'admin.php' ) ) ); exit( wp_redirect( $url ) ); } } add_action( 'activated_plugin', 'rex_feed_redirect_after_activation' );