function pmxi_admin_notices() { // notify user if history folder is not writable $uploads = wp_upload_dir(); if (!@is_dir($uploads['basedir'] . '/wpallimport_history') or !@is_writable($uploads['basedir'] . '/wpallimport_history')) { ?> <div class="error"><p> <?php printf(__('<b>%s Plugin</b>: History folder %s must be writable for the plugin to function properly. Please deactivate the plugin, set proper permissions to the folder and activate the plugin again.', 'pmxi_plugin'), PMXI_Plugin::getInstance()->getName(), $uploads['basedir'] . '/wpallimport_history'); ?> </p></div> <?php } // notify user if (!PMXI_Plugin::getInstance()->getOption('dismiss') and strpos($_SERVER['REQUEST_URI'], 'pmxi-admin') !== false) { ?> <div class="updated"><p> <?php printf(__('Welcome to WP All Import. We hope you like it. Please send all support requests and feedback to <a href="mailto:support@soflyy.com">support@soflyy.com</a>.<br/><br/><a href="javascript:void(0);" id="dismiss">dismiss</a>', 'pmxi_plugin')); ?> </p></div> <?php } if (class_exists('PMWI_Plugin') and (defined('PMWI_VERSION') and version_compare(PMWI_VERSION, '1.2.8') <= 0 and PMWI_EDITION == 'paid' or defined('PMWI_FREE_VERSION') and version_compare(PMWI_FREE_VERSION, '1.1.1') <= 0 and PMWI_EDITION == 'free')) { ?> <div class="error"><p> <?php printf(__('<b>%s Plugin</b>: Please update your WP All Import WooCommerce add-on to the latest version</a>', 'pmwi_plugin'), PMWI_Plugin::getInstance()->getName()); ?> </p></div> <?php if (defined('PMWI_EDITION') and PMWI_EDITION == 'paid') { deactivate_plugins(PMWI_ROOT_DIR . '/plugin.php'); } else { deactivate_plugins(PMWI_FREE_ROOT_DIR . '/plugin.php'); } } $input = new PMXI_Input(); $messages = $input->get('pmxi_nt', array()); if ($messages) { is_array($messages) or $messages = array($messages); foreach ($messages as $type => $m) { in_array((string) $type, array('updated', 'error')) or $type = 'updated'; ?> <div class="<?php echo $type; ?> "><p><?php echo $m; ?> </p></div> <?php } } }
function pmwi_admin_notices() { // notify user if history folder is not writable if (!class_exists('Woocommerce')) { ?> <div class="error"><p> <?php printf(__('<b>%s Plugin</b>: WooCommerce must be installed.', 'pmwi_plugin'), PMWI_Plugin::getInstance()->getName()); ?> </p></div> <?php deactivate_plugins(PMWI_FREE_ROOT_DIR . '/plugin.php'); } if (!class_exists('PMXI_Plugin')) { ?> <div class="error"><p> <?php printf(__('<b>%s Plugin</b>: WP All Import must be installed. Free edition of WP All Import at <a href="http://wordpress.org/plugins/wp-all-import/" target="_blank">http://wordpress.org/plugins/wp-all-import/</a> and the paid edition at <a href="http://www.wpallimport.com/">http://www.wpallimport.com/</a>', 'pmwi_plugin'), PMWI_Plugin::getInstance()->getName()); ?> </p></div> <?php deactivate_plugins(PMWI_FREE_ROOT_DIR . '/plugin.php'); } if (class_exists('PMXI_Plugin') and ((version_compare(PMXI_VERSION, '3.3.6') <= 0 or version_compare(PMXI_VERSION, '4.0.0') >= 0) and PMXI_EDITION == 'paid' or version_compare(PMXI_VERSION, '3.1.1') <= 0 and PMXI_EDITION == 'free')) { ?> <div class="error"><p> <?php printf(__('<b>%s Plugin</b>: Please update your WP All Import to the latest version', 'pmwi_plugin'), PMWI_Plugin::getInstance()->getName()); ?> </p></div> <?php deactivate_plugins(PMWI_FREE_ROOT_DIR . '/plugin.php'); } $input = new PMWI_Input(); $messages = $input->get('PMWI_nt', array()); if ($messages) { is_array($messages) or $messages = array($messages); foreach ($messages as $type => $m) { in_array((string) $type, array('updated', 'error')) or $type = 'updated'; ?> <div class="<?php echo $type; ?> "><p><?php echo $m; ?> </p></div> <?php } } }
/** * @see Controller::render() */ protected function render($viewPath = NULL) { // assume template file name depending on calling function if (is_null($viewPath)) { $trace = debug_backtrace(); $viewPath = str_replace('_', '/', preg_replace('%^' . preg_quote(PMWI_Plugin::PREFIX, '%') . '%', '', strtolower($trace[1]['class']))) . '/' . $trace[1]['function']; } // render contextual help automatically $viewHelpPath = $viewPath; // append file extension if not specified if (!preg_match('%\\.php$%', $viewHelpPath)) { $viewHelpPath .= '.php'; } $viewHelpPath = preg_replace('%\\.php$%', '-help.php', $viewHelpPath); $fileHelpPath = PMWI_Plugin::ROOT_DIR . '/views/' . $viewHelpPath; if (is_file($fileHelpPath)) { // there is help file defined ob_start(); include $fileHelpPath; add_contextual_help(PMWI_Plugin::getInstance()->getAdminCurrentScreen()->id, ob_get_clean()); } parent::render($viewPath); }
function pmxi_admin_notices() { // notify user if history folder is not writable $uploads = wp_upload_dir(); // compare woocommerce add-on version if (class_exists('PMWI_Plugin') and (defined('PMWI_VERSION') and version_compare(PMWI_VERSION, '2.1.4') < 0 and PMWI_EDITION == 'paid' or defined('PMWI_FREE_VERSION') and version_compare(PMWI_FREE_VERSION, '1.2.2') < 0 and PMWI_EDITION == 'free')) { ?> <div class="error"><p> <?php printf(__('<b>%s Plugin</b>: Please update your WP All Import WooCommerce add-on to the latest version', 'pmwi_plugin'), PMWI_Plugin::getInstance()->getName()); ?> </p></div> <?php if (defined('PMWI_EDITION') and PMWI_EDITION == 'paid') { deactivate_plugins(PMWI_ROOT_DIR . '/wpai-woocommerce-add-on.php'); } else { if (defined('PMWI_FREE_ROOT_DIR')) { deactivate_plugins(PMWI_FREE_ROOT_DIR . '/plugin.php'); } else { deactivate_plugins(PMWI_ROOT_DIR . '/plugin.php'); } } } // compare ACF add-on if (class_exists('PMAI_Plugin') and defined('PMAI_VERSION') and version_compare(PMAI_VERSION, '3.0.0-beta1') < 0 and PMAI_EDITION == 'paid') { ?> <div class="error"><p> <?php printf(__('<b>%s Plugin</b>: Please update your WP All Import ACF add-on to the latest version', 'pmwi_plugin'), PMAI_Plugin::getInstance()->getName()); ?> </p></div> <?php if (defined('PMAI_EDITION') and PMAI_EDITION == 'paid') { deactivate_plugins(PMAI_ROOT_DIR . '/wpai-acf-add-on.php'); } } // compare Linkcloak add-on if (class_exists('PMLCA_Plugin') and defined('PMLCA_VERSION') and version_compare(PMLCA_VERSION, '1.0.0-beta1') < 0 and PMLCA_EDITION == 'paid') { ?> <div class="error"><p> <?php printf(__('<b>%s Plugin</b>: Please update your WP All Import Linkcloak add-on to the latest version', 'pmwi_plugin'), PMLCA_Plugin::getInstance()->getName()); ?> </p></div> <?php if (defined('PMLCA_EDITION') and PMLCA_EDITION == 'paid') { deactivate_plugins(PMLCA_ROOT_DIR . '/wpai-linkcloak-add-on.php'); } } // compare User add-on if (class_exists('PMUI_Plugin') and defined('PMUI_VERSION') and version_compare(PMUI_VERSION, '1.0.0-beta1') < 0 and PMUI_EDITION == 'paid') { ?> <div class="error"><p> <?php printf(__('<b>%s Plugin</b>: Please update your WP All Import User add-on to the latest version', 'pmwi_plugin'), PMUI_Plugin::getInstance()->getName()); ?> </p></div> <?php if (defined('PMUI_EDITION') and PMUI_EDITION == 'paid') { deactivate_plugins(PMUI_ROOT_DIR . '/wpai-user-add-on.php'); } } // compare WPML add-on if (class_exists('PMLI_Plugin') and defined('PMLI_VERSION') and version_compare(PMLI_VERSION, '1.0.0-beta1') < 0 and PMLI_EDITION == 'paid') { ?> <div class="error"><p> <?php printf(__('<b>%s Plugin</b>: Please update your WP All Import WPML add-on to the latest version', 'pmwi_plugin'), PMLI_Plugin::getInstance()->getName()); ?> </p></div> <?php if (defined('PMLI_EDITION') and PMLI_EDITION == 'paid') { deactivate_plugins(PMLI_ROOT_DIR . '/plugin.php'); } } $input = new PMXI_Input(); $messages = $input->get('pmxi_nt', array()); if ($messages) { is_array($messages) or $messages = array($messages); foreach ($messages as $type => $m) { in_array((string) $type, array('updated', 'error')) or $type = 'updated'; ?> <div class="<?php echo $type; ?> "><p><?php echo $m; ?> </p></div> <?php } } $warnings = $input->get('warnings', array()); if ($warnings) { is_array($warnings) or $warnings = explode(',', $warnings); foreach ($warnings as $code) { switch ($code) { case 1: $m = __('<strong>Warning:</strong> your title is blank.', 'pmxi_plugin'); break; case 2: $m = __('<strong>Warning:</strong> your content is blank.', 'pmxi_plugin'); break; case 3: $m = __('<strong>Warning:</strong> You must <a href="http://www.wpallimport.com/upgrade-to-pro/?utm_source=free-plugin&utm_medium=in-plugin&utm_campaign=images" target="_blank">upgrade to the Pro edition of WP All Import</a> to import images. The settings you configured in the images section will be ignored.', 'pmxi_plugin'); break; case 4: $m = __('<strong>Warning:</strong> You must <a href="http://www.wpallimport.com/upgrade-to-pro/?utm_source=free-plugin&utm_medium=in-plugin&utm_campaign=custom-fields" target="_blank">upgrade to the Pro edition of WP All Import</a> to import data to Custom Fields. The settings you configured in the Custom Fields section will be ignored.', 'pmxi_plugin'); break; default: $m = false; break; } if ($m) { ?> <div class="error"><p><?php echo $m; ?> </p></div> <?php } } } wp_all_import_addon_notifications(); }
public function __construct() { parent::__construct(); $this->setTable(PMWI_Plugin::getInstance()->getTablePrefix() . 'imports'); }
/** * Plugin activation logic */ public function __activation() { // uncaught exception doesn't prevent plugin from being activated, therefore replace it with fatal error so it does set_exception_handler(create_function('$e', 'trigger_error($e->getMessage(), E_USER_ERROR);')); // create plugin options $option_name = get_class($this) . '_Options'; $options_default = PMWI_Config::createFromFile(self::ROOT_DIR . '/config/options.php')->toArray(); update_option($option_name, $options_default); } public function plugin_row_meta($links, $file) { if ($file == plugin_basename(__FILE__)) { $row_meta = array('pro' => '<a href="http://www.wpallimport.com/woocommerce-product-import/" target="_blank" title="' . esc_attr(__('WP All Import - WooCommerce Add-On Pro Version', 'wpai_woocommerce_addon_plugin')) . '">' . __('Pro Version', 'wpai_woocommerce_addon_plugin') . '</a>'); return array_merge($links, $row_meta); } return (array) $links; } /** * Method returns default import options, main utility of the method is to avoid warnings when new * option is introduced but already registered imports don't have it */ public static function get_default_import_options() { return array('is_multiple_product_type' => 'yes', 'multiple_product_type' => 'simple', 'single_product_type' => '', 'is_product_virtual' => 'no', 'single_product_virtual' => '', 'is_product_downloadable' => 'no', 'single_product_downloadable' => '', 'is_product_enabled' => 'yes', 'single_product_enabled' => '', 'is_product_featured' => 'no', 'single_product_featured' => '', 'is_product_visibility' => 'visible', 'single_product_visibility' => '', 'single_product_sku' => '', 'single_product_url' => '', 'single_product_button_text' => '', 'single_product_regular_price' => '', 'single_product_sale_price' => '', 'single_product_files' => '', 'single_product_files_names' => '', 'single_product_download_limit' => '', 'single_product_download_expiry' => '', 'single_product_download_type' => '', 'is_multiple_product_tax_status' => 'yes', 'multiple_product_tax_status' => 'none', 'single_product_tax_status' => '', 'is_multiple_product_tax_class' => 'yes', 'multiple_product_tax_class' => '', 'single_product_tax_class' => '', 'is_product_manage_stock' => 'no', 'single_product_manage_stock' => '', 'single_product_stock_qty' => '', 'product_stock_status' => 'auto', 'single_product_stock_status' => '', 'product_allow_backorders' => 'no', 'single_product_allow_backorders' => '', 'product_sold_individually' => 'no', 'single_product_sold_individually' => '', 'single_product_weight' => '', 'single_product_length' => '', 'single_product_width' => '', 'single_product_height' => '', 'is_multiple_product_shipping_class' => 'yes', 'multiple_product_shipping_class' => '', 'single_product_shipping_class' => '', 'is_multiple_grouping_product' => 'yes', 'multiple_grouping_product' => '', 'single_grouping_product' => '', 'single_product_up_sells' => '', 'single_product_cross_sells' => '', 'attribute_name' => array(), 'attribute_value' => array(), 'in_variations' => array(), 'is_visible' => array(), 'is_taxonomy' => array(), 'create_taxonomy_in_not_exists' => array(), 'is_advanced' => array(), 'advanced_in_variations' => array(), 'advanced_in_variations_xpath' => array(), 'advanced_is_visible' => array(), 'advanced_is_visible_xpath' => array(), 'advanced_is_taxonomy' => array(), 'advanced_is_taxonomy_xpath' => array(), 'advanced_is_create_terms' => array(), 'advanced_is_create_terms_xpath' => array(), 'single_product_purchase_note' => '', 'single_product_menu_order' => 0, 'is_product_enable_reviews' => 'no', 'single_product_enable_reviews' => '', 'single_product_id' => '', 'single_product_parent_id' => '', 'single_product_id_first_is_parent_id' => '', 'single_product_id_first_is_parent_title' => '', 'single_product_id_first_is_variation' => '', '_virtual' => 0, '_downloadable' => 0, 'is_regular_price_shedule' => 0, 'single_sale_price_dates_from' => 'now', 'single_sale_price_dates_to' => 'now', 'product_files_delim' => ',', 'product_files_names_delim' => ',', 'matching_parent' => 'auto', 'parent_indicator' => 'custom field', 'custom_parent_indicator_name' => '', 'custom_parent_indicator_value' => '', 'missing_records_stock_status' => 0, 'variations_xpath' => '', '_variable_virtual' => '', '_variable_downloadable' => '', 'variable_stock' => '', 'variable_regular_price' => '', 'variable_sale_price' => '', 'is_variable_sale_price_shedule' => 0, 'variable_sale_price_dates_from' => '', 'variable_sale_price_dates_to' => '', 'variable_weight' => '', 'variable_length' => '', 'variable_width' => '', 'variable_height' => '', 'variable_shipping_class' => '', 'variable_tax_class' => '', 'variable_file_paths' => '', 'variable_file_names' => '', 'variable_download_limit' => '', 'variable_download_expiry' => '', 'is_variable_product_virtual' => 'no', 'is_variable_product_manage_stock' => 'no', 'is_multiple_variable_product_shipping_class' => 'yes', 'multiple_variable_product_shipping_class' => '', 'single_variable_product_shipping_class' => '', 'is_multiple_variable_product_tax_class' => 'yes', 'multiple_variable_product_tax_class' => 'parent', 'single_variable_product_tax_class' => '', 'variable_stock_status' => 'instock', 'single_variable_stock_status' => '', 'variable_allow_backorders' => 'no', 'single_variable_allow_backorders' => '', 'is_variable_product_downloadable' => 'no', 'single_variable_product_downloadable' => '', 'variable_attribute_name' => array(), 'variable_attribute_value' => array(), 'variable_in_variations' => array(), 'variable_is_visible' => array(), 'variable_is_taxonomy' => array(), 'variable_create_taxonomy_in_not_exists' => array(), 'variable_product_files_delim' => ',', 'variable_product_files_names_delim' => ',', 'variable_image' => '', 'variable_sku' => '', 'is_variable_product_enabled' => 'yes', 'single_variable_product_enabled' => '', 'link_all_variations' => 0, 'variable_stock_use_parent' => 0, 'variable_regular_price_use_parent' => 0, 'variable_sale_price_use_parent' => 0, 'variable_sale_dates_use_parent' => 0, 'variable_weight_use_parent' => 0, 'single_variable_product_virtual' => '', 'single_variable_product_virtual_use_parent' => 0, 'single_variable_product_manage_stock' => '', 'single_variable_product_manage_stock_use_parent' => 0, 'variable_dimensions_use_parent' => 0, 'variable_image_use_parent' => 0, 'single_variable_product_shipping_class_use_parent' => 0, 'single_variable_product_tax_class_use_parent' => 0, 'single_variable_product_downloadable_use_parent' => 0, 'variable_download_limit_use_parent' => 0, 'variable_download_expiry_use_parent' => 0, 'single_product_variation_description' => '', 'variable_description' => '', 'variable_description_use_parent' => 0, 'first_is_parent' => 'yes', 'single_product_whosale_price' => '', 'variable_whosale_price' => '', 'variable_whosale_price_use_parent' => 0, 'disable_auto_sku_generation' => 0, 'is_default_attributes' => 0, 'default_attributes_type' => 'first', 'disable_sku_matching' => 1, 'disable_prepare_price' => 1, 'prepare_price_to_woo_format' => 0, 'convert_decimal_separator' => 1, 'grouping_indicator' => 'xpath', 'custom_grouping_indicator_name' => '', 'custom_grouping_indicator_value' => '', 'is_update_product_type' => 1, 'make_simple_product' => 1, 'variable_sku_add_parent' => 0, 'set_parent_stock' => 0, 'single_product_regular_price_adjust' => '', 'single_product_regular_price_adjust_type' => '%', 'single_product_sale_price_adjust' => '', 'single_product_sale_price_adjust_type' => '%', 'is_update_attributes' => 1, 'update_attributes_logic' => 'full_update', 'attributes_list' => array(), 'attributes_only_list' => array(), 'attributes_except_list' => array(), 'is_variation_product_manage_stock' => 'no', 'single_variation_product_manage_stock' => '', 'variation_stock' => '', 'variation_stock_status' => 'auto', 'put_variation_image_to_gallery' => 0, 'single_variation_stock_status' => ''); } } PMWI_Plugin::getInstance();
function pmxi_admin_notices() { // notify user if history folder is not writable $uploads = wp_upload_dir(); // compare woocommerce add-on version if (class_exists('PMWI_Plugin') and (defined('PMWI_VERSION') and version_compare(PMWI_VERSION, '2.1.3 RC5') < 0 and PMWI_EDITION == 'paid' or defined('PMWI_FREE_VERSION') and version_compare(PMWI_FREE_VERSION, '1.2.1') <= 0 and PMWI_EDITION == 'free')) { ?> <div class="error"><p> <?php printf(__('<b>%s Plugin</b>: Please update your WP All Import WooCommerce add-on to the latest version', 'pmwi_plugin'), PMWI_Plugin::getInstance()->getName()); ?> </p></div> <?php if (defined('PMWI_EDITION') and PMWI_EDITION == 'paid') { deactivate_plugins(PMWI_ROOT_DIR . '/wpai-woocommerce-add-on.php'); } else { if (defined('PMWI_FREE_ROOT_DIR')) { deactivate_plugins(PMWI_FREE_ROOT_DIR . '/plugin.php'); } else { deactivate_plugins(PMWI_ROOT_DIR . '/plugin.php'); } } } // compare ACF add-on if (class_exists('PMAI_Plugin') and defined('PMAI_VERSION') and version_compare(PMAI_VERSION, '3.0.0-beta1') < 0 and PMAI_EDITION == 'paid') { ?> <div class="error"><p> <?php printf(__('<b>%s Plugin</b>: Please update your WP All Import ACF add-on to the latest version', 'pmwi_plugin'), PMAI_Plugin::getInstance()->getName()); ?> </p></div> <?php if (defined('PMAI_EDITION') and PMAI_EDITION == 'paid') { deactivate_plugins(PMAI_ROOT_DIR . '/wpai-acf-add-on.php'); } } // compare Linkcloak add-on if (class_exists('PMLCA_Plugin') and defined('PMLCA_VERSION') and version_compare(PMLCA_VERSION, '1.0.0-beta1') < 0 and PMLCA_EDITION == 'paid') { ?> <div class="error"><p> <?php printf(__('<b>%s Plugin</b>: Please update your WP All Import Linkcloak add-on to the latest version', 'pmwi_plugin'), PMLCA_Plugin::getInstance()->getName()); ?> </p></div> <?php if (defined('PMLCA_EDITION') and PMLCA_EDITION == 'paid') { deactivate_plugins(PMLCA_ROOT_DIR . '/wpai-linkcloak-add-on.php'); } } // compare User add-on if (class_exists('PMUI_Plugin') and defined('PMUI_VERSION') and version_compare(PMUI_VERSION, '1.0.0-beta1') < 0 and PMUI_EDITION == 'paid') { ?> <div class="error"><p> <?php printf(__('<b>%s Plugin</b>: Please update your WP All Import User add-on to the latest version', 'pmwi_plugin'), PMUI_Plugin::getInstance()->getName()); ?> </p></div> <?php if (defined('PMUI_EDITION') and PMUI_EDITION == 'paid') { deactivate_plugins(PMUI_ROOT_DIR . '/wpai-user-add-on.php'); } } // compare WPML add-on if (class_exists('PMLI_Plugin') and defined('PMLI_VERSION') and version_compare(PMLI_VERSION, '1.0.0-beta1') < 0 and PMLI_EDITION == 'paid') { ?> <div class="error"><p> <?php printf(__('<b>%s Plugin</b>: The WPML Add-On Plugin is no longer compatible with this version of WP All Import - please contact support@wpallimport.com and we will supply the latest version of WP All Import that is compatible with the WPML Add-On.', 'pmwi_plugin'), PMLI_Plugin::getInstance()->getName()); ?> </p></div> <?php if (defined('PMLI_EDITION') and PMLI_EDITION == 'paid') { deactivate_plugins(PMLI_ROOT_DIR . '/plugin.php'); } } $input = new PMXI_Input(); $messages = $input->get('pmxi_nt', array()); if ($messages) { is_array($messages) or $messages = array($messages); foreach ($messages as $type => $m) { in_array((string) $type, array('updated', 'error')) or $type = 'updated'; ?> <div class="<?php echo $type; ?> "><p><?php echo $m; ?> </p></div> <?php } } $warnings = $input->get('warnings', array()); if ($warnings) { is_array($warnings) or $warnings = explode(',', $warnings); foreach ($warnings as $code) { switch ($code) { case 1: $m = __('<strong>Warning:</strong> your title is blank.', 'wp_all_import_plugin'); break; case 2: $m = __('<strong>Warning:</strong> your content is blank.', 'wp_all_import_plugin'); break; default: $m = false; break; } if ($m) { ?> <div class="error"><p><?php echo $m; ?> </p></div> <?php } } } wp_all_import_addon_notifications(); }