Version Description
Download this release
Release Info
Developer | templateinvaders |
Plugin | WooCommerce Wishlist Plugin |
Version | 1.8.13 |
Comparing to | |
See all releases |
Code changes from version 1.8.12 to 1.8.13
- assets/css/admin-form.min.css +1 -1
- assets/css/admin-setup.min.css +1 -1
- assets/css/admin.min.css +1 -1
- assets/css/public.min.css +1 -1
- assets/css/theme.min.css +1 -1
- assets/js/admin.min.js +1 -1
- assets/js/public.min.js +1 -1
- includes/activator.class.php +192 -102
- languages/ti-woocommerce-wishlist.pot +2 -2
- readme.txt +5 -1
- ti-woocommerce-wishlist.php +2 -2
assets/css/admin-form.min.css
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
/*! WooCommerce Wishlist Plugin - version 1.8.
|
2 |
* https://wordpress.org/plugins/ti-woocommerce-wishlist/
|
3 |
* Copyright (c) 2018;
|
4 |
* Licensed GPLv2+ */
|
1 |
+
/*! WooCommerce Wishlist Plugin - version 1.8.13
|
2 |
* https://wordpress.org/plugins/ti-woocommerce-wishlist/
|
3 |
* Copyright (c) 2018;
|
4 |
* Licensed GPLv2+ */
|
assets/css/admin-setup.min.css
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
/*! WooCommerce Wishlist Plugin - version 1.8.
|
2 |
* https://wordpress.org/plugins/ti-woocommerce-wishlist/
|
3 |
* Copyright (c) 2018;
|
4 |
* Licensed GPLv2+ */
|
1 |
+
/*! WooCommerce Wishlist Plugin - version 1.8.13
|
2 |
* https://wordpress.org/plugins/ti-woocommerce-wishlist/
|
3 |
* Copyright (c) 2018;
|
4 |
* Licensed GPLv2+ */
|
assets/css/admin.min.css
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
/*! WooCommerce Wishlist Plugin - version 1.8.
|
2 |
* https://wordpress.org/plugins/ti-woocommerce-wishlist/
|
3 |
* Copyright (c) 2018;
|
4 |
* Licensed GPLv2+ */
|
1 |
+
/*! WooCommerce Wishlist Plugin - version 1.8.13
|
2 |
* https://wordpress.org/plugins/ti-woocommerce-wishlist/
|
3 |
* Copyright (c) 2018;
|
4 |
* Licensed GPLv2+ */
|
assets/css/public.min.css
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
/*! WooCommerce Wishlist Plugin - version 1.8.
|
2 |
* https://wordpress.org/plugins/ti-woocommerce-wishlist/
|
3 |
* Copyright (c) 2018;
|
4 |
* Licensed GPLv2+ */
|
1 |
+
/*! WooCommerce Wishlist Plugin - version 1.8.13
|
2 |
* https://wordpress.org/plugins/ti-woocommerce-wishlist/
|
3 |
* Copyright (c) 2018;
|
4 |
* Licensed GPLv2+ */
|
assets/css/theme.min.css
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
/*! WooCommerce Wishlist Plugin - version 1.8.
|
2 |
* https://wordpress.org/plugins/ti-woocommerce-wishlist/
|
3 |
* Copyright (c) 2018;
|
4 |
* Licensed GPLv2+ */
|
1 |
+
/*! WooCommerce Wishlist Plugin - version 1.8.13
|
2 |
* https://wordpress.org/plugins/ti-woocommerce-wishlist/
|
3 |
* Copyright (c) 2018;
|
4 |
* Licensed GPLv2+ */
|
assets/js/admin.min.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
/*! WooCommerce Wishlist Plugin - version 1.8.
|
2 |
* https://wordpress.org/plugins/ti-woocommerce-wishlist/
|
3 |
* Copyright (c) 2018;
|
4 |
* Licensed GPLv2+ */
|
1 |
+
/*! WooCommerce Wishlist Plugin - version 1.8.13
|
2 |
* https://wordpress.org/plugins/ti-woocommerce-wishlist/
|
3 |
* Copyright (c) 2018;
|
4 |
* Licensed GPLv2+ */
|
assets/js/public.min.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
/*! WooCommerce Wishlist Plugin - version 1.8.
|
2 |
* https://wordpress.org/plugins/ti-woocommerce-wishlist/
|
3 |
* Copyright (c) 2018;
|
4 |
* Licensed GPLv2+ */
|
1 |
+
/*! WooCommerce Wishlist Plugin - version 1.8.13
|
2 |
* https://wordpress.org/plugins/ti-woocommerce-wishlist/
|
3 |
* Copyright (c) 2018;
|
4 |
* Licensed GPLv2+ */
|
includes/activator.class.php
CHANGED
@@ -84,8 +84,10 @@ class TInvWL_Activator {
|
|
84 |
self::database( 'upgrade', $current_version );
|
85 |
self::upgrade_data();
|
86 |
TInvWL_Public_TInvWL::update_rewrite_rules();
|
|
|
87 |
return true;
|
88 |
}
|
|
|
89 |
return false;
|
90 |
}
|
91 |
|
@@ -97,12 +99,12 @@ class TInvWL_Activator {
|
|
97 |
*/
|
98 |
private static function database( $action = 'create', $prev = 'f.0' ) {
|
99 |
|
100 |
-
$activator
|
101 |
-
$lists
|
102 |
unset( $activator );
|
103 |
|
104 |
self::$_prev = $prev;
|
105 |
-
$lists
|
106 |
uasort( $lists, array( __CLASS__, 'sort_database' ) );
|
107 |
|
108 |
$tables = array();
|
@@ -117,8 +119,9 @@ class TInvWL_Activator {
|
|
117 |
/**
|
118 |
* Merge table wit upgrade attributes
|
119 |
*
|
120 |
-
* @param array
|
121 |
* @param string $method Method for get new tables.
|
|
|
122 |
* @return array
|
123 |
*/
|
124 |
public static function merge_database( $tables1, $method ) {
|
@@ -128,8 +131,8 @@ class TInvWL_Activator {
|
|
128 |
continue;
|
129 |
}
|
130 |
if ( array_key_exists( 'upgrade', $table ) ) {
|
131 |
-
$_upgrade
|
132 |
-
$table['upgrade']
|
133 |
$table['upgrade'][ self::pre_database( $method ) ] = $_upgrade;
|
134 |
}
|
135 |
if ( array_key_exists( $name, $tables1 ) ) {
|
@@ -147,6 +150,7 @@ class TInvWL_Activator {
|
|
147 |
$tables1[ $name ] = $table;
|
148 |
}
|
149 |
}
|
|
|
150 |
return $tables1;
|
151 |
}
|
152 |
|
@@ -154,6 +158,7 @@ class TInvWL_Activator {
|
|
154 |
* Filter methods for creating database
|
155 |
*
|
156 |
* @param string $method Method name from this class.
|
|
|
157 |
* @return boolean
|
158 |
*/
|
159 |
public static function filter_database( $method ) {
|
@@ -163,6 +168,7 @@ class TInvWL_Activator {
|
|
163 |
if ( version_compare( self::$_prev, self::pre_database( $method ), 'ge' ) ) {
|
164 |
return false;
|
165 |
}
|
|
|
166 |
return version_compare( self::$_version, self::pre_database( $method ), 'ge' );
|
167 |
}
|
168 |
|
@@ -171,6 +177,7 @@ class TInvWL_Activator {
|
|
171 |
*
|
172 |
* @param string $method1 Method name first from this class.
|
173 |
* @param string $method2 Method name second from this class.
|
|
|
174 |
* @return type
|
175 |
*/
|
176 |
public static function sort_database( $method1, $method2 ) {
|
@@ -181,11 +188,13 @@ class TInvWL_Activator {
|
|
181 |
* Convert method name to version
|
182 |
*
|
183 |
* @param string $method Method name from this class.
|
|
|
184 |
* @return string
|
185 |
*/
|
186 |
public static function pre_database( $method ) {
|
187 |
-
$method
|
188 |
-
$method
|
|
|
189 |
return $method;
|
190 |
}
|
191 |
|
@@ -193,24 +202,25 @@ class TInvWL_Activator {
|
|
193 |
* Creation SQL request for creation table
|
194 |
*
|
195 |
* @param string $name Name Table.
|
196 |
-
* @param array
|
197 |
-
*
|
198 |
-
*
|
199 |
-
*
|
200 |
-
*
|
|
|
201 |
* @return string
|
202 |
*/
|
203 |
public static function table( $name, $table ) {
|
204 |
-
$name
|
205 |
-
$fields
|
206 |
-
$table
|
207 |
-
'charset'
|
208 |
-
'key'
|
209 |
-
'post'
|
210 |
) );
|
211 |
|
212 |
-
$table['charset']
|
213 |
-
$table['charset']
|
214 |
|
215 |
$keys = array_keys( $fields );
|
216 |
if ( ! in_array( $table['key'], $keys ) ) { // @codingStandardsIgnoreLine WordPress.PHP.StrictInArray.MissingTrueStrict
|
@@ -264,6 +274,7 @@ class TInvWL_Activator {
|
|
264 |
$fields = implode( ', ', $fields );
|
265 |
|
266 |
$sql = sprintf( 'CREATE TABLE IF NOT EXISTS `%s` ( %s%s%s) %s; ', $name, $fields, $table['key'], $table['post'], $table['charset'] );
|
|
|
267 |
return $sql;
|
268 |
}
|
269 |
|
@@ -271,12 +282,13 @@ class TInvWL_Activator {
|
|
271 |
* Created SQL field
|
272 |
*
|
273 |
* @param string $name Name field.
|
274 |
-
* @param array
|
275 |
-
*
|
276 |
-
*
|
277 |
-
*
|
278 |
-
*
|
279 |
-
*
|
|
|
280 |
* @return string
|
281 |
*/
|
282 |
public static function field( $name, $newformat ) {
|
@@ -305,6 +317,7 @@ class TInvWL_Activator {
|
|
305 |
|
306 |
array_unshift( $format, '`' . $name . '`' );
|
307 |
$format = array_filter( $format );
|
|
|
308 |
return implode( ' ', $format );
|
309 |
}
|
310 |
|
@@ -312,7 +325,9 @@ class TInvWL_Activator {
|
|
312 |
* Created tables from array
|
313 |
*
|
314 |
* @global wpdb $wpdb
|
|
|
315 |
* @param array $tables Array tables.
|
|
|
316 |
* @return boolean
|
317 |
*/
|
318 |
public static function create( $tables ) {
|
@@ -322,7 +337,7 @@ class TInvWL_Activator {
|
|
322 |
|
323 |
foreach ( $tables as $name => $table ) {
|
324 |
if ( array_key_exists( 'field', $table ) && ! empty( $table['field'] ) ) {
|
325 |
-
$table
|
326 |
$tables[ $name ] = dbDelta( $table );
|
327 |
}
|
328 |
}
|
@@ -336,7 +351,9 @@ class TInvWL_Activator {
|
|
336 |
* Upgrade tables from array
|
337 |
*
|
338 |
* @global wpdb $wpdb
|
|
|
339 |
* @param array $tables Array tables.
|
|
|
340 |
* @return boolean
|
341 |
*/
|
342 |
public static function upgrade( $tables ) {
|
@@ -356,17 +373,20 @@ class TInvWL_Activator {
|
|
356 |
* Get columns for exist table.
|
357 |
*
|
358 |
* @global wpdb $wpdb
|
|
|
359 |
* @param string $name Table name.
|
|
|
360 |
* @return array
|
361 |
*/
|
362 |
public static function upgrade_get_columns( $name ) {
|
363 |
global $wpdb;
|
364 |
|
365 |
$_fields = array();
|
366 |
-
$fields
|
367 |
foreach ( $fields as $field ) {
|
368 |
$_fields[ $field['Field'] ] = $field;
|
369 |
}
|
|
|
370 |
return $_fields;
|
371 |
}
|
372 |
|
@@ -374,13 +394,15 @@ class TInvWL_Activator {
|
|
374 |
* Apply upgrade action
|
375 |
*
|
376 |
* @global wpdb $wpdb
|
|
|
377 |
* @param string $name Name Table.
|
378 |
-
* @param array
|
|
|
379 |
* @return boolean
|
380 |
*/
|
381 |
public static function upgrade_action( $name, $table ) {
|
382 |
|
383 |
-
if ( ! array_key_exists( 'upgrade'
|
384 |
return false;
|
385 |
}
|
386 |
|
@@ -395,8 +417,8 @@ class TInvWL_Activator {
|
|
395 |
$table['field'][ $key ] = $flags;
|
396 |
}
|
397 |
}
|
398 |
-
$name
|
399 |
-
$upgrades
|
400 |
foreach ( $upgrades as $ver_upgrades ) {
|
401 |
foreach ( $ver_upgrades as $upgrade ) {
|
402 |
$action = $upgrade;
|
@@ -424,6 +446,7 @@ class TInvWL_Activator {
|
|
424 |
* Truncate table
|
425 |
*
|
426 |
* @global wpdb $wpdb
|
|
|
427 |
* @param string $name Table name.
|
428 |
*/
|
429 |
public static function upgrade_action_truncate( $name ) {
|
@@ -436,6 +459,7 @@ class TInvWL_Activator {
|
|
436 |
* Drop table
|
437 |
*
|
438 |
* @global wpdb $wpdb
|
|
|
439 |
* @param string $name Table name.
|
440 |
*/
|
441 |
public static function upgrade_action_drop( $name ) {
|
@@ -449,9 +473,11 @@ class TInvWL_Activator {
|
|
449 |
* Rename table
|
450 |
*
|
451 |
* @global wpdb $wpdb
|
|
|
452 |
* @param string $name Table name.
|
453 |
-
* @param array
|
454 |
-
* @param array
|
|
|
455 |
* @return boolean
|
456 |
*/
|
457 |
public static function upgrade_action_rename_table( $name, $table, $upgrade ) {
|
@@ -473,14 +499,15 @@ class TInvWL_Activator {
|
|
473 |
* Update fields table
|
474 |
*
|
475 |
* @global wpdb $wpdb
|
|
|
476 |
* @param string $name Table name.
|
477 |
-
* @param array
|
478 |
*/
|
479 |
public static function upgrade_action_update_fields( $name, $table ) {
|
480 |
global $wpdb;
|
481 |
|
482 |
$_fields = self::upgrade_get_columns( $name );
|
483 |
-
$fields
|
484 |
|
485 |
// Search excess fields.
|
486 |
foreach ( $_fields as $field => $attr ) {
|
@@ -498,7 +525,7 @@ class TInvWL_Activator {
|
|
498 |
$sql = sprintf( 'ALTER TABLE `%s` MODIFY %s;', $name, $attr );
|
499 |
if ( ! array_key_exists( $field, $_fields ) ) {
|
500 |
$_prev_field = empty( $prev_field ) ? '' : " AFTER `{$prev_field}`";
|
501 |
-
$sql
|
502 |
}
|
503 |
$wpdb->query( $sql ); // WPCS: db call ok; no-cache ok; unprepared SQL ok.
|
504 |
|
@@ -511,9 +538,11 @@ class TInvWL_Activator {
|
|
511 |
* Update field table
|
512 |
*
|
513 |
* @global wpdb $wpdb
|
|
|
514 |
* @param string $name Table name.
|
515 |
-
* @param array
|
516 |
-
* @param array
|
|
|
517 |
* @return boolean
|
518 |
*/
|
519 |
public static function upgrade_action_update_field( $name, $table, $upgrade ) {
|
@@ -524,7 +553,7 @@ class TInvWL_Activator {
|
|
524 |
$name_field = $upgrade['field'];
|
525 |
|
526 |
$_fields = self::upgrade_get_columns( $name );
|
527 |
-
$fields
|
528 |
|
529 |
$sql = '';
|
530 |
|
@@ -542,7 +571,7 @@ class TInvWL_Activator {
|
|
542 |
$sql = sprintf( 'ALTER TABLE `%s` MODIFY %s;', $name, $attr );
|
543 |
if ( ! array_key_exists( $name_field, $_fields ) ) {
|
544 |
$_prev_field = empty( $prev_field ) ? '' : " AFTER `{$prev_field}`";
|
545 |
-
$sql
|
546 |
}
|
547 |
} else {
|
548 |
if ( ! array_key_exists( $name_field, $fields ) ) {
|
@@ -559,9 +588,11 @@ class TInvWL_Activator {
|
|
559 |
* Rename field.
|
560 |
*
|
561 |
* @global wpdb $wpdb
|
|
|
562 |
* @param string $name Table name.
|
563 |
-
* @param array
|
564 |
-
* @param array
|
|
|
565 |
* @return boolean
|
566 |
*/
|
567 |
public static function upgrade_action_rename_field( $name, $table, $upgrade ) {
|
@@ -573,7 +604,7 @@ class TInvWL_Activator {
|
|
573 |
$new_field = $upgrade['to'];
|
574 |
|
575 |
$_fields = self::upgrade_get_columns( $name );
|
576 |
-
$fields
|
577 |
|
578 |
if ( ! array_key_exists( $old_field, $_fields ) || ! array_key_exists( $new_field, $fields ) ) {
|
579 |
return false;
|
@@ -588,6 +619,7 @@ class TInvWL_Activator {
|
|
588 |
|
589 |
$sql = sprintf( 'ALTER TABLE `%s` CHANGE `%s` %s;', $name, $old_field, $attr );
|
590 |
$wpdb->query( $sql ); // WPCS: db call ok; no-cache ok; unprepared SQL ok.
|
|
|
591 |
return true;
|
592 |
}
|
593 |
|
@@ -596,9 +628,11 @@ class TInvWL_Activator {
|
|
596 |
* Use sql.
|
597 |
*
|
598 |
* @global wpdb $wpdb
|
|
|
599 |
* @param string $name Table name.
|
600 |
-
* @param array
|
601 |
-
* @param array
|
|
|
602 |
* @return boolean
|
603 |
*/
|
604 |
public static function upgrade_action_sql( $name, $table, $upgrade ) {
|
@@ -615,7 +649,9 @@ class TInvWL_Activator {
|
|
615 |
* Destroy tables from array
|
616 |
*
|
617 |
* @global wpdb $wpdb
|
|
|
618 |
* @param type $tables Array tables.
|
|
|
619 |
* @return boolean
|
620 |
*/
|
621 |
public static function destroy( $tables ) {
|
@@ -623,8 +659,8 @@ class TInvWL_Activator {
|
|
623 |
self::$wpdb_prefix = $wpdb->prefix;
|
624 |
|
625 |
foreach ( $tables as $name => $table ) {
|
626 |
-
$table
|
627 |
-
$sql
|
628 |
$wpdb->query( $sql ); // WPCS: db call ok; no-cache ok; unprepared SQL ok.
|
629 |
}
|
630 |
|
@@ -642,20 +678,20 @@ class TInvWL_Activator {
|
|
642 |
/**
|
643 |
* Array format for fields
|
644 |
*
|
645 |
-
* @param string
|
646 |
-
* @param integer|string
|
647 |
-
* @param boolean
|
648 |
-
* @param integer|string
|
649 |
-
* @param boolean
|
650 |
*/
|
651 |
return array(
|
652 |
-
'first++'
|
653 |
-
'int_0'
|
654 |
-
'int_1'
|
655 |
-
'text'
|
656 |
-
'longtext'
|
657 |
-
'date'
|
658 |
-
'bool'
|
659 |
);
|
660 |
}
|
661 |
|
@@ -667,34 +703,35 @@ class TInvWL_Activator {
|
|
667 |
*/
|
668 |
private static function database_1_0_0() {
|
669 |
$t = array(
|
670 |
-
'status'
|
671 |
-
'type'
|
672 |
-
'key_elem'
|
673 |
-
'key_user'
|
674 |
);
|
|
|
675 |
return array(
|
676 |
-
'lists'
|
677 |
'field' => array(
|
678 |
-
'ID'
|
679 |
-
'author'
|
680 |
-
'date'
|
681 |
-
'title'
|
682 |
-
'status'
|
683 |
-
'type'
|
684 |
-
'share_key'
|
685 |
),
|
686 |
),
|
687 |
-
'items'
|
688 |
'field' => array(
|
689 |
-
'ID'
|
690 |
-
'wishlist_id'
|
691 |
-
'product_id'
|
692 |
-
'variation_id'
|
693 |
-
'author'
|
694 |
-
'date'
|
695 |
-
'quantity'
|
696 |
-
'price'
|
697 |
-
'in_stock'
|
698 |
),
|
699 |
),
|
700 |
);
|
@@ -708,20 +745,73 @@ class TInvWL_Activator {
|
|
708 |
*/
|
709 |
private static function database_1_5_0() {
|
710 |
return array(
|
711 |
-
'items'
|
712 |
-
'field'
|
713 |
-
'ID'
|
714 |
-
'wishlist_id'
|
715 |
-
'product_id'
|
716 |
-
'variation_id'
|
717 |
-
'formdata'
|
718 |
-
'author'
|
719 |
-
'date'
|
720 |
-
'quantity'
|
721 |
-
'price'
|
722 |
-
'in_stock'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
723 |
),
|
724 |
-
'upgrade'
|
725 |
array(
|
726 |
'action' => 'update_fields',
|
727 |
),
|
@@ -734,13 +824,13 @@ class TInvWL_Activator {
|
|
734 |
* Set localisation
|
735 |
*/
|
736 |
private static function set_locale() {
|
737 |
-
$locale
|
738 |
-
$mofile
|
739 |
$mofiles = array();
|
740 |
|
741 |
-
$mofiles[]
|
742 |
-
$mofiles[]
|
743 |
-
$mofiles[]
|
744 |
foreach ( $mofiles as $mofile ) {
|
745 |
if ( file_exists( $mofile ) && load_textdomain( TINVWL_DOMAIN, $mofile ) ) {
|
746 |
return;
|
@@ -776,7 +866,7 @@ class TInvWL_Activator {
|
|
776 |
foreach ( (array) $array as $key => $value ) {
|
777 |
if ( ! array_key_exists( $key, (array) $_array ) ) {
|
778 |
$_array[ $key ] = $value;
|
779 |
-
$need_upgrade
|
780 |
}
|
781 |
}
|
782 |
if ( $need_upgrade ) {
|
84 |
self::database( 'upgrade', $current_version );
|
85 |
self::upgrade_data();
|
86 |
TInvWL_Public_TInvWL::update_rewrite_rules();
|
87 |
+
|
88 |
return true;
|
89 |
}
|
90 |
+
|
91 |
return false;
|
92 |
}
|
93 |
|
99 |
*/
|
100 |
private static function database( $action = 'create', $prev = 'f.0' ) {
|
101 |
|
102 |
+
$activator = new TInvWL_Activator();
|
103 |
+
$lists = get_class_methods( $activator );
|
104 |
unset( $activator );
|
105 |
|
106 |
self::$_prev = $prev;
|
107 |
+
$lists = array_filter( $lists, array( __CLASS__, 'filter_database' ) );
|
108 |
uasort( $lists, array( __CLASS__, 'sort_database' ) );
|
109 |
|
110 |
$tables = array();
|
119 |
/**
|
120 |
* Merge table wit upgrade attributes
|
121 |
*
|
122 |
+
* @param array $tables1 Collecting tables.
|
123 |
* @param string $method Method for get new tables.
|
124 |
+
*
|
125 |
* @return array
|
126 |
*/
|
127 |
public static function merge_database( $tables1, $method ) {
|
131 |
continue;
|
132 |
}
|
133 |
if ( array_key_exists( 'upgrade', $table ) ) {
|
134 |
+
$_upgrade = $table['upgrade'];
|
135 |
+
$table['upgrade'] = array();
|
136 |
$table['upgrade'][ self::pre_database( $method ) ] = $_upgrade;
|
137 |
}
|
138 |
if ( array_key_exists( $name, $tables1 ) ) {
|
150 |
$tables1[ $name ] = $table;
|
151 |
}
|
152 |
}
|
153 |
+
|
154 |
return $tables1;
|
155 |
}
|
156 |
|
158 |
* Filter methods for creating database
|
159 |
*
|
160 |
* @param string $method Method name from this class.
|
161 |
+
*
|
162 |
* @return boolean
|
163 |
*/
|
164 |
public static function filter_database( $method ) {
|
168 |
if ( version_compare( self::$_prev, self::pre_database( $method ), 'ge' ) ) {
|
169 |
return false;
|
170 |
}
|
171 |
+
|
172 |
return version_compare( self::$_version, self::pre_database( $method ), 'ge' );
|
173 |
}
|
174 |
|
177 |
*
|
178 |
* @param string $method1 Method name first from this class.
|
179 |
* @param string $method2 Method name second from this class.
|
180 |
+
*
|
181 |
* @return type
|
182 |
*/
|
183 |
public static function sort_database( $method1, $method2 ) {
|
188 |
* Convert method name to version
|
189 |
*
|
190 |
* @param string $method Method name from this class.
|
191 |
+
*
|
192 |
* @return string
|
193 |
*/
|
194 |
public static function pre_database( $method ) {
|
195 |
+
$method = preg_replace( self::REGEXP, '', $method );
|
196 |
+
$method = str_replace( '_', '.', $method );
|
197 |
+
|
198 |
return $method;
|
199 |
}
|
200 |
|
202 |
* Creation SQL request for creation table
|
203 |
*
|
204 |
* @param string $name Name Table.
|
205 |
+
* @param array $table Structured array table.
|
206 |
+
* array 'field' Array fields.
|
207 |
+
* string 'charset' Charset table.
|
208 |
+
* string 'key' Primary key.
|
209 |
+
* string 'post' Custom elements in format SQL.
|
210 |
+
*
|
211 |
* @return string
|
212 |
*/
|
213 |
public static function table( $name, $table ) {
|
214 |
+
$name = self::$wpdb_prefix . self::$_name . '_' . $name;
|
215 |
+
$fields = $table['field'];
|
216 |
+
$table = filter_var_array( $table, array(
|
217 |
+
'charset' => FILTER_SANITIZE_STRING,
|
218 |
+
'key' => FILTER_SANITIZE_STRING,
|
219 |
+
'post' => FILTER_DEFAULT,
|
220 |
) );
|
221 |
|
222 |
+
$table['charset'] = ( empty( $table['charset'] ) ) ? 'utf8' : $table['charset'];
|
223 |
+
$table['charset'] = sprintf( 'DEFAULT CHARSET=%s', $table['charset'] );
|
224 |
|
225 |
$keys = array_keys( $fields );
|
226 |
if ( ! in_array( $table['key'], $keys ) ) { // @codingStandardsIgnoreLine WordPress.PHP.StrictInArray.MissingTrueStrict
|
274 |
$fields = implode( ', ', $fields );
|
275 |
|
276 |
$sql = sprintf( 'CREATE TABLE IF NOT EXISTS `%s` ( %s%s%s) %s; ', $name, $fields, $table['key'], $table['post'], $table['charset'] );
|
277 |
+
|
278 |
return $sql;
|
279 |
}
|
280 |
|
282 |
* Created SQL field
|
283 |
*
|
284 |
* @param string $name Name field.
|
285 |
+
* @param array $newformat Structure field.
|
286 |
+
* string 0 Data Types column.
|
287 |
+
* integer|string 1 Length or Size column.
|
288 |
+
* boolean 2 is NULL?
|
289 |
+
* integer|string 3 Specifies a default value for a column.
|
290 |
+
* boolean 4 is AUTO_INCREMENT?.
|
291 |
+
*
|
292 |
* @return string
|
293 |
*/
|
294 |
public static function field( $name, $newformat ) {
|
317 |
|
318 |
array_unshift( $format, '`' . $name . '`' );
|
319 |
$format = array_filter( $format );
|
320 |
+
|
321 |
return implode( ' ', $format );
|
322 |
}
|
323 |
|
325 |
* Created tables from array
|
326 |
*
|
327 |
* @global wpdb $wpdb
|
328 |
+
*
|
329 |
* @param array $tables Array tables.
|
330 |
+
*
|
331 |
* @return boolean
|
332 |
*/
|
333 |
public static function create( $tables ) {
|
337 |
|
338 |
foreach ( $tables as $name => $table ) {
|
339 |
if ( array_key_exists( 'field', $table ) && ! empty( $table['field'] ) ) {
|
340 |
+
$table = self::table( $name, $table );
|
341 |
$tables[ $name ] = dbDelta( $table );
|
342 |
}
|
343 |
}
|
351 |
* Upgrade tables from array
|
352 |
*
|
353 |
* @global wpdb $wpdb
|
354 |
+
*
|
355 |
* @param array $tables Array tables.
|
356 |
+
*
|
357 |
* @return boolean
|
358 |
*/
|
359 |
public static function upgrade( $tables ) {
|
373 |
* Get columns for exist table.
|
374 |
*
|
375 |
* @global wpdb $wpdb
|
376 |
+
*
|
377 |
* @param string $name Table name.
|
378 |
+
*
|
379 |
* @return array
|
380 |
*/
|
381 |
public static function upgrade_get_columns( $name ) {
|
382 |
global $wpdb;
|
383 |
|
384 |
$_fields = array();
|
385 |
+
$fields = $wpdb->get_results( "DESCRIBE `{$name}`", ARRAY_A ); // WPCS: db call ok; no-cache ok; unprepared SQL ok.
|
386 |
foreach ( $fields as $field ) {
|
387 |
$_fields[ $field['Field'] ] = $field;
|
388 |
}
|
389 |
+
|
390 |
return $_fields;
|
391 |
}
|
392 |
|
394 |
* Apply upgrade action
|
395 |
*
|
396 |
* @global wpdb $wpdb
|
397 |
+
*
|
398 |
* @param string $name Name Table.
|
399 |
+
* @param array $table Structured array table.
|
400 |
+
*
|
401 |
* @return boolean
|
402 |
*/
|
403 |
public static function upgrade_action( $name, $table ) {
|
404 |
|
405 |
+
if ( ! array_key_exists( 'upgrade', $table ) ) {
|
406 |
return false;
|
407 |
}
|
408 |
|
417 |
$table['field'][ $key ] = $flags;
|
418 |
}
|
419 |
}
|
420 |
+
$name = self::$wpdb_prefix . self::$_name . '_' . $name;
|
421 |
+
$upgrades = (array) $table['upgrade'];
|
422 |
foreach ( $upgrades as $ver_upgrades ) {
|
423 |
foreach ( $ver_upgrades as $upgrade ) {
|
424 |
$action = $upgrade;
|
446 |
* Truncate table
|
447 |
*
|
448 |
* @global wpdb $wpdb
|
449 |
+
*
|
450 |
* @param string $name Table name.
|
451 |
*/
|
452 |
public static function upgrade_action_truncate( $name ) {
|
459 |
* Drop table
|
460 |
*
|
461 |
* @global wpdb $wpdb
|
462 |
+
*
|
463 |
* @param string $name Table name.
|
464 |
*/
|
465 |
public static function upgrade_action_drop( $name ) {
|
473 |
* Rename table
|
474 |
*
|
475 |
* @global wpdb $wpdb
|
476 |
+
*
|
477 |
* @param string $name Table name.
|
478 |
+
* @param array $table Not used.
|
479 |
+
* @param array $upgrade Upgrade fields.
|
480 |
+
*
|
481 |
* @return boolean
|
482 |
*/
|
483 |
public static function upgrade_action_rename_table( $name, $table, $upgrade ) {
|
499 |
* Update fields table
|
500 |
*
|
501 |
* @global wpdb $wpdb
|
502 |
+
*
|
503 |
* @param string $name Table name.
|
504 |
+
* @param array $table Table array.
|
505 |
*/
|
506 |
public static function upgrade_action_update_fields( $name, $table ) {
|
507 |
global $wpdb;
|
508 |
|
509 |
$_fields = self::upgrade_get_columns( $name );
|
510 |
+
$fields = $table['field'];
|
511 |
|
512 |
// Search excess fields.
|
513 |
foreach ( $_fields as $field => $attr ) {
|
525 |
$sql = sprintf( 'ALTER TABLE `%s` MODIFY %s;', $name, $attr );
|
526 |
if ( ! array_key_exists( $field, $_fields ) ) {
|
527 |
$_prev_field = empty( $prev_field ) ? '' : " AFTER `{$prev_field}`";
|
528 |
+
$sql = sprintf( 'ALTER TABLE `%s` ADD %s;', $name, $attr . $_prev_field );
|
529 |
}
|
530 |
$wpdb->query( $sql ); // WPCS: db call ok; no-cache ok; unprepared SQL ok.
|
531 |
|
538 |
* Update field table
|
539 |
*
|
540 |
* @global wpdb $wpdb
|
541 |
+
*
|
542 |
* @param string $name Table name.
|
543 |
+
* @param array $table Table array.
|
544 |
+
* @param array $upgrade Upgrade fields.
|
545 |
+
*
|
546 |
* @return boolean
|
547 |
*/
|
548 |
public static function upgrade_action_update_field( $name, $table, $upgrade ) {
|
553 |
$name_field = $upgrade['field'];
|
554 |
|
555 |
$_fields = self::upgrade_get_columns( $name );
|
556 |
+
$fields = $table['field'];
|
557 |
|
558 |
$sql = '';
|
559 |
|
571 |
$sql = sprintf( 'ALTER TABLE `%s` MODIFY %s;', $name, $attr );
|
572 |
if ( ! array_key_exists( $name_field, $_fields ) ) {
|
573 |
$_prev_field = empty( $prev_field ) ? '' : " AFTER `{$prev_field}`";
|
574 |
+
$sql = sprintf( 'ALTER TABLE `%s` ADD %s;', $name, $attr . $_prev_field );
|
575 |
}
|
576 |
} else {
|
577 |
if ( ! array_key_exists( $name_field, $fields ) ) {
|
588 |
* Rename field.
|
589 |
*
|
590 |
* @global wpdb $wpdb
|
591 |
+
*
|
592 |
* @param string $name Table name.
|
593 |
+
* @param array $table Table array.
|
594 |
+
* @param array $upgrade Upgrade fields.
|
595 |
+
*
|
596 |
* @return boolean
|
597 |
*/
|
598 |
public static function upgrade_action_rename_field( $name, $table, $upgrade ) {
|
604 |
$new_field = $upgrade['to'];
|
605 |
|
606 |
$_fields = self::upgrade_get_columns( $name );
|
607 |
+
$fields = $table['field'];
|
608 |
|
609 |
if ( ! array_key_exists( $old_field, $_fields ) || ! array_key_exists( $new_field, $fields ) ) {
|
610 |
return false;
|
619 |
|
620 |
$sql = sprintf( 'ALTER TABLE `%s` CHANGE `%s` %s;', $name, $old_field, $attr );
|
621 |
$wpdb->query( $sql ); // WPCS: db call ok; no-cache ok; unprepared SQL ok.
|
622 |
+
|
623 |
return true;
|
624 |
}
|
625 |
|
628 |
* Use sql.
|
629 |
*
|
630 |
* @global wpdb $wpdb
|
631 |
+
*
|
632 |
* @param string $name Table name.
|
633 |
+
* @param array $table Not used.
|
634 |
+
* @param array $upgrade Upgrade fields.
|
635 |
+
*
|
636 |
* @return boolean
|
637 |
*/
|
638 |
public static function upgrade_action_sql( $name, $table, $upgrade ) {
|
649 |
* Destroy tables from array
|
650 |
*
|
651 |
* @global wpdb $wpdb
|
652 |
+
*
|
653 |
* @param type $tables Array tables.
|
654 |
+
*
|
655 |
* @return boolean
|
656 |
*/
|
657 |
public static function destroy( $tables ) {
|
659 |
self::$wpdb_prefix = $wpdb->prefix;
|
660 |
|
661 |
foreach ( $tables as $name => $table ) {
|
662 |
+
$table = self::$wpdb_prefix . self::$_name . '_' . $name;
|
663 |
+
$sql = sprintf( 'DROP TABLE IF EXISTS `%s`;', $table );
|
664 |
$wpdb->query( $sql ); // WPCS: db call ok; no-cache ok; unprepared SQL ok.
|
665 |
}
|
666 |
|
678 |
/**
|
679 |
* Array format for fields
|
680 |
*
|
681 |
+
* @param string TYPE
|
682 |
+
* @param integer|string SIZE
|
683 |
+
* @param boolean NULL
|
684 |
+
* @param integer|string DEFAULT
|
685 |
+
* @param boolean AUTO_INCREMENT
|
686 |
*/
|
687 |
return array(
|
688 |
+
'first++' => array( 'BIGINT', null, false, null, true ),
|
689 |
+
'int_0' => array( 'BIGINT', null, false, 0 ),
|
690 |
+
'int_1' => array( 'BIGINT', null, false, 1 ),
|
691 |
+
'text' => array( 'TEXT' ),
|
692 |
+
'longtext' => array( 'LONGTEXT' ),
|
693 |
+
'date' => array( 'DATETIME', null, false, '0000-00-00 00:00:00' ),
|
694 |
+
'bool' => array( 'TINYINT', 1, false, 1 ),
|
695 |
);
|
696 |
}
|
697 |
|
703 |
*/
|
704 |
private static function database_1_0_0() {
|
705 |
$t = array(
|
706 |
+
'status' => array( 'VARCHAR', 20, false, 'public' ),
|
707 |
+
'type' => array( 'VARCHAR', 20, false, 'list' ),
|
708 |
+
'key_elem' => array( 'VARCHAR', 45 ),
|
709 |
+
'key_user' => array( 'TINYINT', 1, false, 7 ),
|
710 |
);
|
711 |
+
|
712 |
return array(
|
713 |
+
'lists' => array(
|
714 |
'field' => array(
|
715 |
+
'ID' => 'first++',
|
716 |
+
'author' => 'int_0',
|
717 |
+
'date' => 'date',
|
718 |
+
'title' => 'text',
|
719 |
+
'status' => $t['status'],
|
720 |
+
'type' => $t['type'],
|
721 |
+
'share_key' => $t['key_elem'],
|
722 |
),
|
723 |
),
|
724 |
+
'items' => array(
|
725 |
'field' => array(
|
726 |
+
'ID' => 'first++',
|
727 |
+
'wishlist_id' => 'int_0',
|
728 |
+
'product_id' => 'int_0',
|
729 |
+
'variation_id' => 'int_0',
|
730 |
+
'author' => 'int_0',
|
731 |
+
'date' => 'date',
|
732 |
+
'quantity' => 'int_1',
|
733 |
+
'price' => $t['key_elem'],
|
734 |
+
'in_stock' => 'bool',
|
735 |
),
|
736 |
),
|
737 |
);
|
745 |
*/
|
746 |
private static function database_1_5_0() {
|
747 |
return array(
|
748 |
+
'items' => array(
|
749 |
+
'field' => array(
|
750 |
+
'ID' => 'first++',
|
751 |
+
'wishlist_id' => 'int_0',
|
752 |
+
'product_id' => 'int_0',
|
753 |
+
'variation_id' => 'int_0',
|
754 |
+
'formdata' => 'text',
|
755 |
+
'author' => 'int_0',
|
756 |
+
'date' => 'date',
|
757 |
+
'quantity' => 'int_1',
|
758 |
+
'price' => array( 'VARCHAR', 255 ),
|
759 |
+
'in_stock' => 'bool',
|
760 |
+
),
|
761 |
+
'upgrade' => array(
|
762 |
+
array(
|
763 |
+
'action' => 'update_fields',
|
764 |
+
),
|
765 |
+
),
|
766 |
+
),
|
767 |
+
);
|
768 |
+
}
|
769 |
+
|
770 |
+
/**
|
771 |
+
* Database
|
772 |
+
*
|
773 |
+
* @since 1.8.13
|
774 |
+
* @return array
|
775 |
+
*/
|
776 |
+
private static function database_1_8_13() {
|
777 |
+
$t = array(
|
778 |
+
'status' => array( 'VARCHAR', 20, false, 'public' ),
|
779 |
+
'type' => array( 'VARCHAR', 20, false, 'list' ),
|
780 |
+
'key_elem' => array( 'VARCHAR', 45 ),
|
781 |
+
'key_user' => array( 'TINYINT', 1, false, 7 ),
|
782 |
+
);
|
783 |
+
|
784 |
+
return array(
|
785 |
+
'lists' => array(
|
786 |
+
'field' => array(
|
787 |
+
'ID' => 'first++',
|
788 |
+
'author' => 'int_0',
|
789 |
+
'date' => 'date',
|
790 |
+
'title' => 'text',
|
791 |
+
'status' => $t['status'],
|
792 |
+
'type' => $t['type'],
|
793 |
+
'share_key' => $t['key_elem'],
|
794 |
+
),
|
795 |
+
'upgrade' => array(
|
796 |
+
array(
|
797 |
+
'action' => 'update_fields',
|
798 |
+
),
|
799 |
+
),
|
800 |
+
),
|
801 |
+
'items' => array(
|
802 |
+
'field' => array(
|
803 |
+
'ID' => 'first++',
|
804 |
+
'wishlist_id' => 'int_0',
|
805 |
+
'product_id' => 'int_0',
|
806 |
+
'variation_id' => 'int_0',
|
807 |
+
'formdata' => 'text',
|
808 |
+
'author' => 'int_0',
|
809 |
+
'date' => 'date',
|
810 |
+
'quantity' => 'int_1',
|
811 |
+
'price' => array( 'VARCHAR', 255 ),
|
812 |
+
'in_stock' => 'bool',
|
813 |
),
|
814 |
+
'upgrade' => array(
|
815 |
array(
|
816 |
'action' => 'update_fields',
|
817 |
),
|
824 |
* Set localisation
|
825 |
*/
|
826 |
private static function set_locale() {
|
827 |
+
$locale = apply_filters( 'plugin_locale', get_locale(), TINVWL_DOMAIN );
|
828 |
+
$mofile = sprintf( '%1$s-%2$s.mo', TINVWL_DOMAIN, $locale );
|
829 |
$mofiles = array();
|
830 |
|
831 |
+
$mofiles[] = WP_LANG_DIR . DIRECTORY_SEPARATOR . basename( TINVWL_PATH ) . DIRECTORY_SEPARATOR . $mofile;
|
832 |
+
$mofiles[] = WP_LANG_DIR . DIRECTORY_SEPARATOR . 'plugins' . DIRECTORY_SEPARATOR . $mofile;
|
833 |
+
$mofiles[] = TINVWL_PATH . 'languages' . DIRECTORY_SEPARATOR . $mofile;
|
834 |
foreach ( $mofiles as $mofile ) {
|
835 |
if ( file_exists( $mofile ) && load_textdomain( TINVWL_DOMAIN, $mofile ) ) {
|
836 |
return;
|
866 |
foreach ( (array) $array as $key => $value ) {
|
867 |
if ( ! array_key_exists( $key, (array) $_array ) ) {
|
868 |
$_array[ $key ] = $value;
|
869 |
+
$need_upgrade = true;
|
870 |
}
|
871 |
}
|
872 |
if ( $need_upgrade ) {
|
languages/ti-woocommerce-wishlist.pot
CHANGED
@@ -2,10 +2,10 @@
|
|
2 |
# This file is distributed under the GPL-2.0+.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
-
"Project-Id-Version: WooCommerce Wishlist Plugin 1.8.
|
6 |
"Report-Msgid-Bugs-To: "
|
7 |
"https://wordpress.org/support/plugin/ti-woocommerce-wishlist\n"
|
8 |
-
"POT-Creation-Date: 2018-08-
|
9 |
"MIME-Version: 1.0\n"
|
10 |
"Content-Type: text/plain; charset=utf-8\n"
|
11 |
"Content-Transfer-Encoding: 8bit\n"
|
2 |
# This file is distributed under the GPL-2.0+.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
+
"Project-Id-Version: WooCommerce Wishlist Plugin 1.8.13\n"
|
6 |
"Report-Msgid-Bugs-To: "
|
7 |
"https://wordpress.org/support/plugin/ti-woocommerce-wishlist\n"
|
8 |
+
"POT-Creation-Date: 2018-08-25 11:04:32+00:00\n"
|
9 |
"MIME-Version: 1.0\n"
|
10 |
"Content-Type: text/plain; charset=utf-8\n"
|
11 |
"Content-Transfer-Encoding: 8bit\n"
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: https://templateinvaders.com/?utm_source=wordpressorg&utm_content=d
|
|
4 |
Tags: wishlist, woocommerce, woocommerce wishlist, e-commerce, ecommerce
|
5 |
Requires at least: 4.5
|
6 |
Tested up to: 4.9
|
7 |
-
Stable tag: 1.8.
|
8 |
License: GPLv3
|
9 |
License URI: https://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
@@ -130,6 +130,10 @@ If you get stuck, you can ask for help in the [Plugin Forum](https://wordpress.o
|
|
130 |
|
131 |
|
132 |
== Changelog ==
|
|
|
|
|
|
|
|
|
133 |
= 1.8.12 =
|
134 |
*Release Date - 16 August 2018*
|
135 |
* Fixed PHP fatal error on plugin activation
|
4 |
Tags: wishlist, woocommerce, woocommerce wishlist, e-commerce, ecommerce
|
5 |
Requires at least: 4.5
|
6 |
Tested up to: 4.9
|
7 |
+
Stable tag: 1.8.13
|
8 |
License: GPLv3
|
9 |
License URI: https://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
130 |
|
131 |
|
132 |
== Changelog ==
|
133 |
+
= 1.8.12 =
|
134 |
+
*Release Date - 25 August 2018*
|
135 |
+
* Fixed database fields type issue
|
136 |
+
|
137 |
= 1.8.12 =
|
138 |
*Release Date - 16 August 2018*
|
139 |
* Fixed PHP fatal error on plugin activation
|
ti-woocommerce-wishlist.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
* Plugin Name: WooCommerce Wishlist Plugin
|
5 |
* Plugin URI: https://wordpress.org/plugins/ti-woocommerce-wishlist/
|
6 |
* Description: Wishlist functionality for your WooCommerce store.
|
7 |
-
* Version: 1.8.
|
8 |
* Requires at least: 4.5
|
9 |
* Tested up to: 4.9
|
10 |
* WC requires at least: 2.6
|
@@ -41,7 +41,7 @@ if ( ! defined( 'TINVWL_DOMAIN' ) ) {
|
|
41 |
}
|
42 |
|
43 |
if ( ! defined( 'TINVWL_FVERSION' ) ) {
|
44 |
-
define( 'TINVWL_FVERSION', '1.8.
|
45 |
}
|
46 |
|
47 |
if ( ! defined( 'TINVWL_LOAD_FREE' ) ) {
|
4 |
* Plugin Name: WooCommerce Wishlist Plugin
|
5 |
* Plugin URI: https://wordpress.org/plugins/ti-woocommerce-wishlist/
|
6 |
* Description: Wishlist functionality for your WooCommerce store.
|
7 |
+
* Version: 1.8.13
|
8 |
* Requires at least: 4.5
|
9 |
* Tested up to: 4.9
|
10 |
* WC requires at least: 2.6
|
41 |
}
|
42 |
|
43 |
if ( ! defined( 'TINVWL_FVERSION' ) ) {
|
44 |
+
define( 'TINVWL_FVERSION', '1.8.13' );
|
45 |
}
|
46 |
|
47 |
if ( ! defined( 'TINVWL_LOAD_FREE' ) ) {
|