Import Products from any XML or CSV to WooCommerce - Version 1.3.1

Version Description

  • improvement: compatibility with PHP 7.x
Download this release

Release Info

Developer soflyy
Plugin Icon 128x128 Import Products from any XML or CSV to WooCommerce
Version 1.3.1
Comparing to
See all releases

Code changes from version 1.3.0 to 1.3.1

Files changed (2) hide show
  1. plugin.php +15 -14
  2. readme.txt +4 -1
plugin.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: WP All Import - WooCommerce Add-On
4
  Plugin URI: http://www.wpallimport.com/
5
  Description: An extremely easy, drag & drop importer to import WooCommerce simple products. A paid upgrade is available for premium support and support for Variable, Grouped, and External/Affiliate products
6
- Version: 1.3.0
7
  Author: Soflyy
8
  */
9
  /**
@@ -24,7 +24,7 @@ define('PMWI_ROOT_URL', rtrim(plugin_dir_url(__FILE__), '/'));
24
  */
25
  define('PMWI_PREFIX', 'pmwi_');
26
 
27
- define('PMWI_FREE_VERSION', '1.3.0');
28
 
29
  define('PMWI_EDITION', 'free');
30
 
@@ -155,11 +155,8 @@ final class PMWI_Plugin {
155
 
156
  // create/update required database tables
157
 
158
- // regirster autoloading method
159
- if (function_exists('__autoload') and ! in_array('__autoload', spl_autoload_functions())) { // make sure old way of autoloading classes is not broken
160
- spl_autoload_register('__autoload');
161
- }
162
- spl_autoload_register(array($this, '__autoload'));
163
 
164
  // register helpers
165
  if (is_dir(self::ROOT_DIR . '/helpers')) foreach (PMWI_Helper::safe_glob(self::ROOT_DIR . '/helpers/*.php', PMWI_Helper::GLOB_RECURSE | PMWI_Helper::GLOB_PATH) as $filePath) {
@@ -175,7 +172,7 @@ final class PMWI_Plugin {
175
  update_option($option_name, $this->options);
176
  $this->options = get_option(get_class($this) . '_Options');
177
 
178
- register_activation_hook(self::FILE, array($this, '__activation'));
179
 
180
  // register action handlers
181
  if (is_dir(self::ROOT_DIR . '/actions')) if (is_dir(self::ROOT_DIR . '/actions')) foreach (PMWI_Helper::safe_glob(self::ROOT_DIR . '/actions/*.php', PMWI_Helper::GLOB_RECURSE | PMWI_Helper::GLOB_PATH) as $filePath) {
@@ -210,7 +207,7 @@ final class PMWI_Plugin {
210
  }
211
 
212
  // register admin page pre-dispatcher
213
- add_action('admin_init', array($this, '__adminInit'));
214
  add_action('init', array($this, 'init'));
215
 
216
  }
@@ -238,7 +235,7 @@ final class PMWI_Plugin {
238
  /**
239
  * pre-dispatching logic for admin page controllers
240
  */
241
- public function __adminInit() {
242
  $input = new PMWI_Input();
243
  $page = strtolower($input->getpost('page', ''));
244
  if (preg_match('%^' . preg_quote(str_replace('_', '-', self::PREFIX), '%') . '([\w-]+)$%', $page)) {
@@ -257,7 +254,7 @@ final class PMWI_Plugin {
257
  */
258
  public function shortcodeDispatcher($args, $content, $tag) {
259
 
260
- $controllerName = self::PREFIX . preg_replace('%(^|_).%e', 'strtoupper("$0")', $tag); // capitalize first letters of class name parts and add prefix
261
  $controller = new $controllerName();
262
  if ( ! $controller instanceof PMWI_Controller) {
263
  throw new Exception("Shortcode `$tag` matches to a wrong controller type.");
@@ -267,6 +264,10 @@ final class PMWI_Plugin {
267
  return ob_get_clean();
268
  }
269
 
 
 
 
 
270
  /**
271
  * Dispatch admin page: call corresponding controller based on get parameter `page`
272
  * The method is called twice: 1st time as handler `parse_header` action and then as admin menu item handler
@@ -290,7 +291,7 @@ final class PMWI_Plugin {
290
  throw new Exception('There is no previousely buffered content to display.');
291
  }
292
  } else {
293
- $controllerName = preg_replace('%(^' . preg_quote(self::PREFIX, '%') . '|_).%e', 'strtoupper("$0")', str_replace('-', '_', $page)); // capitalize prefix and first letters of class name parts
294
  $actionName = str_replace('-', '_', $action);
295
  if (method_exists($controllerName, $actionName)) {
296
 
@@ -352,7 +353,7 @@ final class PMWI_Plugin {
352
  * @param string $className
353
  * @return bool
354
  */
355
- public function __autoload($className) {
356
  $is_prefix = false;
357
  $filePath = str_replace('_', '/', preg_replace('%^' . preg_quote(self::PREFIX, '%') . '%', '', strtolower($className), 1, $is_prefix)) . '.php';
358
  if ( ! $is_prefix) { // also check file with original letter case
@@ -410,7 +411,7 @@ final class PMWI_Plugin {
410
  /**
411
  * Plugin activation logic
412
  */
413
- public function __activation() {
414
 
415
  // uncaught exception doesn't prevent plugin from being activated, therefore replace it with fatal error so it does
416
  set_exception_handler(create_function('$e', 'trigger_error($e->getMessage(), E_USER_ERROR);'));
3
  Plugin Name: WP All Import - WooCommerce Add-On
4
  Plugin URI: http://www.wpallimport.com/
5
  Description: An extremely easy, drag & drop importer to import WooCommerce simple products. A paid upgrade is available for premium support and support for Variable, Grouped, and External/Affiliate products
6
+ Version: 1.3.1
7
  Author: Soflyy
8
  */
9
  /**
24
  */
25
  define('PMWI_PREFIX', 'pmwi_');
26
 
27
+ define('PMWI_FREE_VERSION', '1.3.1');
28
 
29
  define('PMWI_EDITION', 'free');
30
 
155
 
156
  // create/update required database tables
157
 
158
+ // register autoloading method
159
+ spl_autoload_register(array($this, 'autoload'));
 
 
 
160
 
161
  // register helpers
162
  if (is_dir(self::ROOT_DIR . '/helpers')) foreach (PMWI_Helper::safe_glob(self::ROOT_DIR . '/helpers/*.php', PMWI_Helper::GLOB_RECURSE | PMWI_Helper::GLOB_PATH) as $filePath) {
172
  update_option($option_name, $this->options);
173
  $this->options = get_option(get_class($this) . '_Options');
174
 
175
+ register_activation_hook(self::FILE, array($this, 'activation'));
176
 
177
  // register action handlers
178
  if (is_dir(self::ROOT_DIR . '/actions')) if (is_dir(self::ROOT_DIR . '/actions')) foreach (PMWI_Helper::safe_glob(self::ROOT_DIR . '/actions/*.php', PMWI_Helper::GLOB_RECURSE | PMWI_Helper::GLOB_PATH) as $filePath) {
207
  }
208
 
209
  // register admin page pre-dispatcher
210
+ add_action('admin_init', array($this, 'adminInit'));
211
  add_action('init', array($this, 'init'));
212
 
213
  }
235
  /**
236
  * pre-dispatching logic for admin page controllers
237
  */
238
+ public function adminInit() {
239
  $input = new PMWI_Input();
240
  $page = strtolower($input->getpost('page', ''));
241
  if (preg_match('%^' . preg_quote(str_replace('_', '-', self::PREFIX), '%') . '([\w-]+)$%', $page)) {
254
  */
255
  public function shortcodeDispatcher($args, $content, $tag) {
256
 
257
+ $controllerName = self::PREFIX . preg_replace_callback('%(^|_).%', array($this, "replace_callback"), $tag);// capitalize first letters of class name parts and add prefix
258
  $controller = new $controllerName();
259
  if ( ! $controller instanceof PMWI_Controller) {
260
  throw new Exception("Shortcode `$tag` matches to a wrong controller type.");
264
  return ob_get_clean();
265
  }
266
 
267
+ public function replace_callback($matches){
268
+ return strtoupper($matches[0]);
269
+ }
270
+
271
  /**
272
  * Dispatch admin page: call corresponding controller based on get parameter `page`
273
  * The method is called twice: 1st time as handler `parse_header` action and then as admin menu item handler
291
  throw new Exception('There is no previousely buffered content to display.');
292
  }
293
  } else {
294
+ $controllerName = preg_replace_callback('%(^' . preg_quote(self::PREFIX, '%') . '|_).%', array($this, "replace_callback"),str_replace('-', '_', $page));
295
  $actionName = str_replace('-', '_', $action);
296
  if (method_exists($controllerName, $actionName)) {
297
 
353
  * @param string $className
354
  * @return bool
355
  */
356
+ public function autoload($className) {
357
  $is_prefix = false;
358
  $filePath = str_replace('_', '/', preg_replace('%^' . preg_quote(self::PREFIX, '%') . '%', '', strtolower($className), 1, $is_prefix)) . '.php';
359
  if ( ! $is_prefix) { // also check file with original letter case
411
  /**
412
  * Plugin activation logic
413
  */
414
+ public function activation() {
415
 
416
  // uncaught exception doesn't prevent plugin from being activated, therefore replace it with fatal error so it does
417
  set_exception_handler(create_function('$e', 'trigger_error($e->getMessage(), E_USER_ERROR);'));
readme.txt CHANGED
@@ -2,7 +2,7 @@
2
  Contributors: soflyy, wpallimport
3
  Requires at least: 4.1
4
  Tested up to: 4.7
5
- Stable tag: 1.3.0
6
  License: GPLv2 or later
7
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
8
  Tags: woocommerce xml import, woocommerce csv import, woocommerce, import, xml, csv, wp all import, csv import, import csv, xml import, import xml, woocommerce csv importer, woocommerce xml importer, csv importer, csv import suite
@@ -83,6 +83,9 @@ The WooCommerce add-on will appear in the Step 4 of WP All Import.
83
 
84
  == Changelog ==
85
 
 
 
 
86
  = 1.3.0 =
87
  * improvement: updated post types dropdown
88
 
2
  Contributors: soflyy, wpallimport
3
  Requires at least: 4.1
4
  Tested up to: 4.7
5
+ Stable tag: 1.3.1
6
  License: GPLv2 or later
7
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
8
  Tags: woocommerce xml import, woocommerce csv import, woocommerce, import, xml, csv, wp all import, csv import, import csv, xml import, import xml, woocommerce csv importer, woocommerce xml importer, csv importer, csv import suite
83
 
84
  == Changelog ==
85
 
86
+ = 1.3.1 =
87
+ * improvement: compatibility with PHP 7.x
88
+
89
  = 1.3.0 =
90
  * improvement: updated post types dropdown
91