Version Description
17-11-2022 =
Update: Performance Improvement
Download this release
Release Info
Developer | EmranAhmed |
Plugin | WooCommerce Variation Swatches |
Version | 2.0.13 |
Comparing to | |
See all releases |
Code changes from version 2.0.12 to 2.0.13
- README.txt +7 -5
- assets/css/admin.css +1 -1
- assets/css/frontend.css +1 -1
- assets/js/admin.js +1 -1
- assets/js/frontend.js +1 -1
- assets/js/wp-color-picker-alpha.js +1 -1
- includes/class-woo-variation-swatches-cache.php +212 -148
- includes/class-woo-variation-swatches-frontend.php +3 -14
- includes/class-woo-variation-swatches-manage-cache.php +158 -26
- includes/class-woo-variation-swatches-product-page.php +51 -27
- includes/class-woo-variation-swatches.php +12 -2
- languages/woo-variation-swatches.pot +4 -4
- uninstall.php +21 -18
- woo-variation-swatches.php +10 -10
README.txt
CHANGED
@@ -5,8 +5,8 @@ Requires PHP: 7.0
|
|
5 |
Requires at least: 5.6
|
6 |
Tested up to: 6.1
|
7 |
WC requires at least: 5.6
|
8 |
-
WC tested up to: 7.
|
9 |
-
Stable tag: 2.0.
|
10 |
License: GPLv3
|
11 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
12 |
|
@@ -491,9 +491,7 @@ We provide exclusive technical support to our customers. Our plugin has plenty o
|
|
491 |
<ul>
|
492 |
<li><a target="_blank" href="https://wordpress.org/plugins/woo-cart-redirect-to-checkout-page">Add to Cart Redirect for WooCommerce</a></li>
|
493 |
</ul>
|
494 |
-
|
495 |
-
<li><a target="_blank" href="https://wordpress.org/plugins/leo-product-recommendations">WooCommerce Related Product Popup</a></li>
|
496 |
-
</ul>
|
497 |
</blockquote>
|
498 |
|
499 |
|
@@ -616,6 +614,10 @@ And your are ready to go.
|
|
616 |
|
617 |
== Changelog ==
|
618 |
|
|
|
|
|
|
|
|
|
619 |
= 2.0.12 - 31-10-2022 =
|
620 |
|
621 |
* Update: Update Migration Script
|
5 |
Requires at least: 5.6
|
6 |
Tested up to: 6.1
|
7 |
WC requires at least: 5.6
|
8 |
+
WC tested up to: 7.1
|
9 |
+
Stable tag: 2.0.13
|
10 |
License: GPLv3
|
11 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
12 |
|
491 |
<ul>
|
492 |
<li><a target="_blank" href="https://wordpress.org/plugins/woo-cart-redirect-to-checkout-page">Add to Cart Redirect for WooCommerce</a></li>
|
493 |
</ul>
|
494 |
+
|
|
|
|
|
495 |
</blockquote>
|
496 |
|
497 |
|
614 |
|
615 |
== Changelog ==
|
616 |
|
617 |
+
= 2.0.13 - 17-11-2022 =
|
618 |
+
|
619 |
+
* Update: Performance Improvement
|
620 |
+
|
621 |
= 2.0.12 - 31-10-2022 =
|
622 |
|
623 |
* Update: Update Migration Script
|
assets/css/admin.css
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
* Variation Swatches for WooCommerce
|
3 |
*
|
4 |
* Author: Emran Ahmed ( emran.bd.08@gmail.com )
|
5 |
-
* Date: 11/
|
6 |
* Released under the GPLv3 license.
|
7 |
*/
|
8 |
.button.button-danger {
|
2 |
* Variation Swatches for WooCommerce
|
3 |
*
|
4 |
* Author: Emran Ahmed ( emran.bd.08@gmail.com )
|
5 |
+
* Date: 11/17/2022, 7:31:45 PM
|
6 |
* Released under the GPLv3 license.
|
7 |
*/
|
8 |
.button.button-danger {
|
assets/css/frontend.css
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
* Variation Swatches for WooCommerce
|
3 |
*
|
4 |
* Author: Emran Ahmed ( emran.bd.08@gmail.com )
|
5 |
-
* Date: 11/
|
6 |
* Released under the GPLv3 license.
|
7 |
*/
|
8 |
.woo-variation-swatches.wvs-tooltip .radio-variable-item[data-wvstooltip] {
|
2 |
* Variation Swatches for WooCommerce
|
3 |
*
|
4 |
* Author: Emran Ahmed ( emran.bd.08@gmail.com )
|
5 |
+
* Date: 11/17/2022, 7:31:45 PM
|
6 |
* Released under the GPLv3 license.
|
7 |
*/
|
8 |
.woo-variation-swatches.wvs-tooltip .radio-variable-item[data-wvstooltip] {
|
assets/js/admin.js
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
* Variation Swatches for WooCommerce
|
3 |
*
|
4 |
* Author: Emran Ahmed ( emran.bd.08@gmail.com )
|
5 |
-
* Date: 11/
|
6 |
* Released under the GPLv3 license.
|
7 |
*/
|
8 |
/******/ (function() { // webpackBootstrap
|
2 |
* Variation Swatches for WooCommerce
|
3 |
*
|
4 |
* Author: Emran Ahmed ( emran.bd.08@gmail.com )
|
5 |
+
* Date: 11/17/2022, 7:31:45 PM
|
6 |
* Released under the GPLv3 license.
|
7 |
*/
|
8 |
/******/ (function() { // webpackBootstrap
|
assets/js/frontend.js
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
* Variation Swatches for WooCommerce
|
3 |
*
|
4 |
* Author: Emran Ahmed ( emran.bd.08@gmail.com )
|
5 |
-
* Date: 11/
|
6 |
* Released under the GPLv3 license.
|
7 |
*/
|
8 |
/******/ (function() { // webpackBootstrap
|
2 |
* Variation Swatches for WooCommerce
|
3 |
*
|
4 |
* Author: Emran Ahmed ( emran.bd.08@gmail.com )
|
5 |
+
* Date: 11/17/2022, 7:31:45 PM
|
6 |
* Released under the GPLv3 license.
|
7 |
*/
|
8 |
/******/ (function() { // webpackBootstrap
|
assets/js/wp-color-picker-alpha.js
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
* Variation Swatches for WooCommerce
|
3 |
*
|
4 |
* Author: Emran Ahmed ( emran.bd.08@gmail.com )
|
5 |
-
* Date: 11/
|
6 |
* Released under the GPLv3 license.
|
7 |
*/
|
8 |
/******/ (function() { // webpackBootstrap
|
2 |
* Variation Swatches for WooCommerce
|
3 |
*
|
4 |
* Author: Emran Ahmed ( emran.bd.08@gmail.com )
|
5 |
+
* Date: 11/17/2022, 7:31:45 PM
|
6 |
* Released under the GPLv3 license.
|
7 |
*/
|
8 |
/******/ (function() { // webpackBootstrap
|
includes/class-woo-variation-swatches-cache.php
CHANGED
@@ -1,150 +1,214 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
150 |
|
1 |
<?php
|
2 |
+
|
3 |
+
defined( 'ABSPATH' ) || exit;
|
4 |
+
|
5 |
+
|
6 |
+
/**
|
7 |
+
* How to use:
|
8 |
+
*
|
9 |
+
* $cache = new Woo_Variation_Swatches_Cache( 'name', 'group' );
|
10 |
+
* $cache->delete_transient();
|
11 |
+
* $cache->delete_all_transient();
|
12 |
+
* $cache->delete_all_transient_from_db();
|
13 |
+
*
|
14 |
+
* if ( false === ( $results = $cache->get_transient() ) ) {
|
15 |
+
* // It wasn't there, so regenerate the data and save the transient
|
16 |
+
* $results = 'GENERATED DATA';
|
17 |
+
* $cache->set_transient( $results );
|
18 |
+
* }
|
19 |
+
*
|
20 |
+
*
|
21 |
+
* echo $results;
|
22 |
+
*
|
23 |
+
* print_r( Woo_Variation_Swatches_Cache::get_transients() );
|
24 |
+
*/
|
25 |
+
|
26 |
+
|
27 |
+
if ( ! class_exists( 'Woo_Variation_Swatches_Cache' ) ) {
|
28 |
+
class Woo_Variation_Swatches_Cache {
|
29 |
+
|
30 |
+
private $name;
|
31 |
+
private $group_name;
|
32 |
+
static $transients = array();
|
33 |
+
|
34 |
+
public function __construct( $name, $group_name ) {
|
35 |
+
$this->name = $name;
|
36 |
+
$this->group_name = $group_name;
|
37 |
+
|
38 |
+
if ( empty( self::$transients[ $this->group_name ] ) ) {
|
39 |
+
self::$transients[ $this->group_name ] = array( $this->name );
|
40 |
+
} else {
|
41 |
+
self::$transients[ $this->group_name ][] = $this->name;
|
42 |
+
}
|
43 |
+
|
44 |
+
return $this;
|
45 |
+
}
|
46 |
+
|
47 |
+
public static function get_transients() {
|
48 |
+
return self::$transients;
|
49 |
+
}
|
50 |
+
|
51 |
+
public static function delete_transient_group( $group ) {
|
52 |
+
|
53 |
+
$transient_name = $group . '-transient-version';
|
54 |
+
$transient_value = (string) time();
|
55 |
+
|
56 |
+
set_transient( $transient_name, $transient_value );
|
57 |
+
|
58 |
+
return $transient_value;
|
59 |
+
}
|
60 |
+
|
61 |
+
public static function delete_cache_group( $group ) {
|
62 |
+
$prefix_key = 'woo_variation_swatches_';
|
63 |
+
$prefix_string = $prefix_key . $group . '_cache_prefix';
|
64 |
+
wp_cache_set( $prefix_string, microtime(), $group );
|
65 |
+
}
|
66 |
+
|
67 |
+
|
68 |
+
public function get_transient_version( $group ) {
|
69 |
+
$transient_name = $group . '-transient-version';
|
70 |
+
$transient_value = get_transient( $transient_name );
|
71 |
+
|
72 |
+
if ( false === $transient_value ) {
|
73 |
+
$transient_value = (string) time();
|
74 |
+
|
75 |
+
set_transient( $transient_name, $transient_value );
|
76 |
+
}
|
77 |
+
|
78 |
+
return $transient_value;
|
79 |
+
}
|
80 |
+
|
81 |
+
// Transient Cache
|
82 |
+
public function get_transient_group() {
|
83 |
+
return $this->get_transient_version( $this->group_name );
|
84 |
+
}
|
85 |
+
|
86 |
+
public function get_cache_prefix( $group ) {
|
87 |
+
|
88 |
+
$prefix_key = 'woo_variation_swatches_';
|
89 |
+
|
90 |
+
// Get cache key - uses cache key {woo_variation_swatches_products_cache_prefix} to invalidate when needed.
|
91 |
+
$prefix_string = $prefix_key . $group . '_cache_prefix';
|
92 |
+
$prefix = wp_cache_get( $prefix_string, $group );
|
93 |
+
|
94 |
+
if ( false === $prefix ) {
|
95 |
+
$prefix = microtime();
|
96 |
+
wp_cache_set( $prefix_string, $prefix, $group );
|
97 |
+
}
|
98 |
+
|
99 |
+
return $prefix_key . '_cache_' . $prefix . '_';
|
100 |
+
}
|
101 |
+
|
102 |
+
|
103 |
+
public function get_transient_name() {
|
104 |
+
return $this->name;
|
105 |
+
}
|
106 |
+
|
107 |
+
// the name should be 172 characters or less in length
|
108 |
+
public function set_transient( $value, $expiration = 0 ) {
|
109 |
+
|
110 |
+
$transient_version = $this->get_transient_group();
|
111 |
+
$transient_value = array(
|
112 |
+
'version' => $transient_version,
|
113 |
+
'value' => $value,
|
114 |
+
);
|
115 |
+
|
116 |
+
return set_transient( $this->get_transient_name(), $transient_value, $expiration );
|
117 |
+
}
|
118 |
+
|
119 |
+
public function get_transient( $transient = false ) {
|
120 |
+
|
121 |
+
$transient_name = $transient ? $transient : $this->get_transient_name();
|
122 |
+
|
123 |
+
$transient_version = $this->get_transient_group();
|
124 |
+
$transient_value = get_transient( $transient_name );
|
125 |
+
|
126 |
+
if ( isset( $transient_value[ 'value' ], $transient_value[ 'version' ] ) && $transient_value[ 'version' ] === $transient_version ) {
|
127 |
+
return $transient_value[ 'value' ];
|
128 |
+
}
|
129 |
+
|
130 |
+
return false;
|
131 |
+
}
|
132 |
+
|
133 |
+
public function delete_transient( $transient = false ) {
|
134 |
+
|
135 |
+
$transient_name = $transient ? $transient : $this->get_transient_name();
|
136 |
+
|
137 |
+
return delete_transient( $transient_name );
|
138 |
+
}
|
139 |
+
|
140 |
+
public function delete_all_transient( $transient_group = false ) {
|
141 |
+
|
142 |
+
$group_name = $transient_group ? $transient_group : $this->group_name;
|
143 |
+
|
144 |
+
self::delete_transient_group( $group_name );
|
145 |
+
}
|
146 |
+
|
147 |
+
public function delete_all_transient_from_db( $transient_name = false, $transient_group = false ) {
|
148 |
+
|
149 |
+
if ( ! wp_using_ext_object_cache() ) {
|
150 |
+
global $wpdb;
|
151 |
+
|
152 |
+
$name = sprintf( '_transient_%s', ( $transient_name ? $transient_name : $this->name ) );
|
153 |
+
$group = sprintf( '_transient_%s-transient-version', ( $transient_group ? $transient_group : $this->group_name ) );
|
154 |
+
|
155 |
+
// Delete Version
|
156 |
+
$sql_1 = $wpdb->prepare( "DELETE FROM {$wpdb->options} WHERE option_name LIKE %s LIMIT %d;", $group, 100 );
|
157 |
+
$wpdb->query( $sql_1 ); // WPCS: cache ok, db call ok.
|
158 |
+
|
159 |
+
// Delete Name
|
160 |
+
$sql_2 = $wpdb->prepare( "DELETE FROM {$wpdb->options} WHERE option_name LIKE %s LIMIT %d;", $name, 10 );
|
161 |
+
$wpdb->query( $sql_2 ); // WPCS: cache ok, db call ok.
|
162 |
+
|
163 |
+
}
|
164 |
+
}
|
165 |
+
|
166 |
+
// Object cache
|
167 |
+
public function get_cache_key( $name = false ) {
|
168 |
+
return $this->get_cache_prefix( $this->group_name ) . ( $name ? $name : $this->name );
|
169 |
+
}
|
170 |
+
|
171 |
+
public function set_cache( $value, $name = false ) {
|
172 |
+
$cache_key = $this->get_cache_key( $name );
|
173 |
+
wp_cache_set( $cache_key, $value, $this->group_name );
|
174 |
+
}
|
175 |
+
|
176 |
+
public function get_cache( $cache_key = false ) {
|
177 |
+
|
178 |
+
$cache_key = $cache_key ? $cache_key : $this->get_cache_key( $cache_key );
|
179 |
+
|
180 |
+
return wp_cache_get( $cache_key, $this->group_name );
|
181 |
+
}
|
182 |
+
|
183 |
+
public function delete_cache( $cache_key = false ) {
|
184 |
+
|
185 |
+
$cache_key = $cache_key ? $cache_key : $this->get_cache_key( $cache_key );
|
186 |
+
|
187 |
+
return wp_cache_delete( $cache_key, $this->group_name );
|
188 |
+
}
|
189 |
+
|
190 |
+
public function delete_all_cache( $group_name = false ) {
|
191 |
+
|
192 |
+
$group = $group_name ? $group_name : $this->group_name;
|
193 |
+
$prefix_key = 'woo_variation_swatches_';
|
194 |
+
$prefix_string = $prefix_key . $group . '_cache_prefix';
|
195 |
+
|
196 |
+
wp_cache_set( $prefix_string, microtime(), $group );
|
197 |
+
}
|
198 |
+
|
199 |
+
// Support WP 6.1
|
200 |
+
public function delete_group_cache( $group_name = false ) {
|
201 |
+
|
202 |
+
$name = $group_name ? $group_name : $this->group_name;
|
203 |
+
|
204 |
+
if ( ! wp_cache_supports( 'flush_group' ) ) {
|
205 |
+
_doing_it_wrong( __FUNCTION__, __( 'Your object cache implementation does not support flushing individual groups.' ), '6.1.0' );
|
206 |
+
|
207 |
+
return false;
|
208 |
+
}
|
209 |
+
|
210 |
+
wp_cache_flush_group( $name );
|
211 |
+
}
|
212 |
+
}
|
213 |
+
}
|
214 |
|
includes/class-woo-variation-swatches-frontend.php
CHANGED
@@ -24,7 +24,6 @@
|
|
24 |
|
25 |
protected function includes() {
|
26 |
require_once dirname( __FILE__ ) . '/class-woo-variation-swatches-compatibility.php';
|
27 |
-
require_once dirname( __FILE__ ) . '/class-woo-variation-swatches-cache.php';
|
28 |
require_once dirname( __FILE__ ) . '/class-woo-variation-swatches-product-page.php';
|
29 |
}
|
30 |
|
@@ -49,13 +48,7 @@
|
|
49 |
|
50 |
public function get_attribute_taxonomy_by_name( $attribute_name ) {
|
51 |
|
52 |
-
$
|
53 |
-
|
54 |
-
$cache = new Woo_Variation_Swatches_Cache( $cache_name, 'wvs_attribute_taxonomy' );
|
55 |
-
|
56 |
-
if ( isset( $_GET[ 'wvs_clear_transient' ] ) ) {
|
57 |
-
$cache->delete_transient();
|
58 |
-
}
|
59 |
|
60 |
if ( ! taxonomy_exists( $attribute_name ) ) {
|
61 |
return false;
|
@@ -67,13 +60,13 @@
|
|
67 |
return false;
|
68 |
}
|
69 |
|
70 |
-
if ( false === ( $attribute_taxonomy =
|
71 |
|
72 |
global $wpdb;
|
73 |
|
74 |
$attribute_taxonomy = $wpdb->get_row( "SELECT * FROM " . $wpdb->prefix . "woocommerce_attribute_taxonomies WHERE attribute_name='{$attribute_name}'" );
|
75 |
|
76 |
-
|
77 |
}
|
78 |
|
79 |
return apply_filters( 'woo_variation_swatches_get_wc_attribute_taxonomy', $attribute_taxonomy, $attribute_name );
|
@@ -197,10 +190,6 @@
|
|
197 |
$variation_ids = $product->get_children();
|
198 |
$available_variations = array();
|
199 |
|
200 |
-
if ( is_callable( '_prime_post_caches' ) ) {
|
201 |
-
_prime_post_caches( $variation_ids );
|
202 |
-
}
|
203 |
-
|
204 |
foreach ( $variation_ids as $variation_id ) {
|
205 |
|
206 |
$variation = wc_get_product( $variation_id );
|
24 |
|
25 |
protected function includes() {
|
26 |
require_once dirname( __FILE__ ) . '/class-woo-variation-swatches-compatibility.php';
|
|
|
27 |
require_once dirname( __FILE__ ) . '/class-woo-variation-swatches-product-page.php';
|
28 |
}
|
29 |
|
48 |
|
49 |
public function get_attribute_taxonomy_by_name( $attribute_name ) {
|
50 |
|
51 |
+
$transient_key = woo_variation_swatches()->get_cache()->get_key_with_language_suffix( sprintf( 'woo_variation_swatches_cache_attribute_taxonomy__%s', $attribute_name ) );
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
|
53 |
if ( ! taxonomy_exists( $attribute_name ) ) {
|
54 |
return false;
|
60 |
return false;
|
61 |
}
|
62 |
|
63 |
+
if ( false === ( $attribute_taxonomy = get_transient( $transient_key ) ) ) {
|
64 |
|
65 |
global $wpdb;
|
66 |
|
67 |
$attribute_taxonomy = $wpdb->get_row( "SELECT * FROM " . $wpdb->prefix . "woocommerce_attribute_taxonomies WHERE attribute_name='{$attribute_name}'" );
|
68 |
|
69 |
+
set_transient( $transient_key, $attribute_taxonomy );
|
70 |
}
|
71 |
|
72 |
return apply_filters( 'woo_variation_swatches_get_wc_attribute_taxonomy', $attribute_taxonomy, $attribute_name );
|
190 |
$variation_ids = $product->get_children();
|
191 |
$available_variations = array();
|
192 |
|
|
|
|
|
|
|
|
|
193 |
foreach ( $variation_ids as $variation_id ) {
|
194 |
|
195 |
$variation = wc_get_product( $variation_id );
|
includes/class-woo-variation-swatches-manage-cache.php
CHANGED
@@ -28,47 +28,179 @@
|
|
28 |
protected function hooks() {
|
29 |
|
30 |
// Attributes
|
31 |
-
add_action( 'woocommerce_attribute_added', array( $this, '
|
32 |
-
add_action( 'woocommerce_attribute_updated', array( $this, '
|
33 |
-
add_action( 'woocommerce_attribute_deleted', array( $this, '
|
|
|
34 |
// Products
|
35 |
-
add_action( 'woocommerce_save_product_variation', array( $this, '
|
36 |
-
add_action( 'woocommerce_update_product_variation', array( $this, '
|
37 |
-
add_action( 'woocommerce_delete_product_variation', array( $this, '
|
38 |
-
add_action( 'woocommerce_trash_product_variation', array( $this, '
|
39 |
|
40 |
// WooCommerce -> Status -> Tools -> Clear transients
|
41 |
-
add_action( 'woocommerce_delete_product_transients', array( $this, '
|
42 |
-
|
43 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
}
|
45 |
|
46 |
protected function init() {
|
|
|
|
|
|
|
47 |
}
|
48 |
|
49 |
// Start
|
50 |
|
51 |
-
public function
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
|
53 |
do_action( 'litespeed_purge_all', 'Woo Variation Swatches: purge all' );
|
54 |
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
61 |
}
|
62 |
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
72 |
}
|
73 |
}
|
74 |
}
|
28 |
protected function hooks() {
|
29 |
|
30 |
// Attributes
|
31 |
+
add_action( 'woocommerce_attribute_added', array( $this, 'clear_cache_on_attribute_added' ), 10, 2 );
|
32 |
+
add_action( 'woocommerce_attribute_updated', array( $this, 'clear_cache_on_attribute_updated' ), 10, 3 );
|
33 |
+
add_action( 'woocommerce_attribute_deleted', array( $this, 'clear_cache_on_attribute_deleted' ), 10, 3 );
|
34 |
+
|
35 |
// Products
|
36 |
+
add_action( 'woocommerce_save_product_variation', array( $this, 'clear_cache_on_product_modify' ) );
|
37 |
+
add_action( 'woocommerce_update_product_variation', array( $this, 'clear_cache_on_product_modify' ) );
|
38 |
+
add_action( 'woocommerce_delete_product_variation', array( $this, 'clear_cache_on_product_modify' ) );
|
39 |
+
add_action( 'woocommerce_trash_product_variation', array( $this, 'clear_cache_on_product_modify' ) );
|
40 |
|
41 |
// WooCommerce -> Status -> Tools -> Clear transients
|
42 |
+
add_action( 'woocommerce_delete_product_transients', array( $this, 'clear_cache_on_delete_product_transients' ) );
|
43 |
+
|
44 |
+
// Options
|
45 |
+
add_action( 'getwooplugins_settings_saved', array( $this, 'clear_cache_on_settings_modify' ) );
|
46 |
+
add_action( 'getwooplugins_after_delete_options', array( $this, 'clear_cache_on_settings_modify' ) );
|
47 |
+
|
48 |
+
// Product label settings
|
49 |
+
|
50 |
+
add_action( 'woo_variation_swatches_product_settings_update', array( $this, 'clear_cache_on_product_settings_modify' ) );
|
51 |
+
add_action( 'woo_variation_swatches_product_settings_delete', array( $this, 'clear_cache_on_product_settings_modify' ) );
|
52 |
}
|
53 |
|
54 |
protected function init() {
|
55 |
+
if ( function_exists( 'wp_cache_add_global_groups' ) ) {
|
56 |
+
wp_cache_add_global_groups( array( 'woo_variation_swatches' ) );
|
57 |
+
}
|
58 |
}
|
59 |
|
60 |
// Start
|
61 |
|
62 |
+
public function get_key_with_language_suffix( $key ) {
|
63 |
+
|
64 |
+
$default_language = apply_filters( 'wpml_default_language', null );
|
65 |
+
$current_language = apply_filters( 'wpml_current_language', null );
|
66 |
+
|
67 |
+
if ( $current_language === $default_language ) {
|
68 |
+
return $key;
|
69 |
+
}
|
70 |
+
|
71 |
+
return sprintf( '%s_%s', $key, $current_language );
|
72 |
+
}
|
73 |
+
|
74 |
+
// Clear Settings Cache
|
75 |
+
public function clear_cache_on_settings_modify() {
|
76 |
|
77 |
do_action( 'litespeed_purge_all', 'Woo Variation Swatches: purge all' );
|
78 |
|
79 |
+
wp_cache_flush();
|
80 |
+
|
81 |
+
wp_cache_delete( 'global_settings', 'woo_variation_swatches' );
|
82 |
+
$this->delete_last_changed();
|
83 |
+
$this->clear_cache_by_group();
|
84 |
+
}
|
85 |
+
|
86 |
+
// Clear transients Cache
|
87 |
+
public function clear_cache_on_delete_product_transients( $post_id ) {
|
88 |
+
if ( $post_id > 0 ) {
|
89 |
+
|
90 |
+
$cache_group = 'woo_variation_swatches';
|
91 |
+
|
92 |
+
$cache_keys = array(
|
93 |
+
'variation_images_of__%s',
|
94 |
+
'product_settings_of__%s',
|
95 |
+
'variation_attributes_of__%s',
|
96 |
+
'available_variations__%s'
|
97 |
+
);
|
98 |
+
|
99 |
+
foreach ( $cache_keys as $key_template ) {
|
100 |
+
$cache_key = woo_variation_swatches()->get_cache()->get_key_with_language_suffix( sprintf( $key_template, $post_id ) );
|
101 |
+
wp_cache_delete( $cache_key, $cache_group );
|
102 |
+
}
|
103 |
+
|
104 |
+
$cache_key = woo_variation_swatches()->get_cache()->get_key_with_language_suffix( sprintf( 'available_preview_variation__%s', $post_id ) );
|
105 |
+
wp_cache_delete( $cache_key, $cache_group );
|
106 |
}
|
107 |
|
108 |
+
$this->delete_last_changed();
|
109 |
+
$this->clear_cache_by_group();
|
110 |
+
// Clear any cached data that has been removed.
|
111 |
+
wp_cache_flush();
|
112 |
+
}
|
113 |
+
|
114 |
+
// Clear Attributes Cache
|
115 |
+
public function clear_cache_on_attribute_added( $id, $data ) {
|
116 |
+
|
117 |
+
$transient_key = woo_variation_swatches()->get_cache()->get_key_with_language_suffix( sprintf( 'woo_variation_swatches_cache_attribute_taxonomy__%s', $data[ 'attribute_name' ] ) );
|
118 |
+
|
119 |
+
delete_transient( $transient_key );
|
120 |
+
$this->delete_last_changed();
|
121 |
+
$this->clear_cache_by_group();
|
122 |
+
}
|
123 |
+
|
124 |
+
public function clear_cache_on_attribute_updated( $id, $data, $old_slug ) {
|
125 |
+
|
126 |
+
$transient_key = woo_variation_swatches()->get_cache()->get_key_with_language_suffix( sprintf( 'woo_variation_swatches_cache_attribute_taxonomy__%s', $data[ 'attribute_name' ] ) );
|
127 |
+
$transient_key_old = woo_variation_swatches()->get_cache()->get_key_with_language_suffix( sprintf( 'woo_variation_swatches_cache_attribute_taxonomy__%s', $old_slug ) );
|
128 |
+
|
129 |
+
delete_transient( $transient_key );
|
130 |
+
delete_transient( $transient_key_old );
|
131 |
+
$this->delete_last_changed();
|
132 |
+
$this->clear_cache_by_group();
|
133 |
+
}
|
134 |
+
|
135 |
+
public function clear_cache_on_attribute_deleted( $id, $name, $taxonomy ) {
|
136 |
+
|
137 |
+
$transient_key = woo_variation_swatches()->get_cache()->get_key_with_language_suffix( sprintf( 'woo_variation_swatches_cache_attribute_taxonomy__%s', $taxonomy ) );
|
138 |
+
delete_transient( $transient_key );
|
139 |
+
$this->delete_last_changed();
|
140 |
+
$this->clear_cache_by_group();
|
141 |
+
}
|
142 |
+
|
143 |
+
// Clear Product Cache
|
144 |
+
|
145 |
+
public function clear_cache_on_product_modify( $variation_id ) {
|
146 |
+
|
147 |
+
$variation_product = wc_get_product( $variation_id );
|
148 |
+
$product_id = $variation_product->get_parent_id();
|
149 |
+
$cache_group = 'woo_variation_swatches';
|
150 |
+
|
151 |
+
$cache_keys = array(
|
152 |
+
'variation_images_of__%s',
|
153 |
+
'product_settings_of__%s',
|
154 |
+
'variation_attributes_of__%s',
|
155 |
+
'available_variations__%s'
|
156 |
+
);
|
157 |
+
|
158 |
+
foreach ( $cache_keys as $key_template ) {
|
159 |
+
$cache_key = woo_variation_swatches()->get_cache()->get_key_with_language_suffix( sprintf( $key_template, $product_id ) );
|
160 |
+
wp_cache_delete( $cache_key, $cache_group );
|
161 |
+
}
|
162 |
+
|
163 |
+
$cache_key_1 = woo_variation_swatches()->get_cache()->get_key_with_language_suffix( sprintf( 'available_preview_variation__%s', $variation_id ) );
|
164 |
+
wp_cache_delete( $cache_key_1, $cache_group );
|
165 |
+
|
166 |
+
$this->delete_last_changed();
|
167 |
+
$this->clear_cache_by_group();
|
168 |
+
}
|
169 |
+
|
170 |
+
public function clear_cache_on_product_settings_modify( $product_id ) {
|
171 |
+
|
172 |
+
$cache_key = woo_variation_swatches()->get_cache()->get_key_with_language_suffix( sprintf( 'product_settings_of__%s', $product_id ) );
|
173 |
+
$cache_group = 'woo_variation_swatches';
|
174 |
+
|
175 |
+
wp_cache_delete( $cache_key, $cache_group );
|
176 |
+
|
177 |
+
$cache_key_2 = woo_variation_swatches()->get_cache()->get_key_with_language_suffix( sprintf( 'available_variations__%s', $product_id ) );
|
178 |
+
wp_cache_delete( $cache_key_2, $cache_group );
|
179 |
+
|
180 |
+
$cache_key_3 = woo_variation_swatches()->get_cache()->get_key_with_language_suffix( sprintf( 'available_preview_variation__%s', $product_id ) );
|
181 |
+
wp_cache_delete( $cache_key_3, $cache_group );
|
182 |
+
|
183 |
+
$this->delete_last_changed();
|
184 |
+
$this->clear_cache_by_group();
|
185 |
+
}
|
186 |
+
|
187 |
+
public function get_last_changed() {
|
188 |
+
return wp_cache_get_last_changed( 'woo_variation_swatches' );
|
189 |
+
}
|
190 |
+
|
191 |
+
public function delete_last_changed() {
|
192 |
+
wp_cache_delete( 'last_changed', 'woo_variation_swatches' );
|
193 |
+
}
|
194 |
+
|
195 |
+
public function update_last_changed() {
|
196 |
+
wp_cache_set( 'last_changed', microtime(), 'woo_variation_swatches' );
|
197 |
+
}
|
198 |
+
|
199 |
+
public function clear_cache_by_group() {
|
200 |
+
if ( function_exists( 'wp_cache_flush_group' ) ) {
|
201 |
+
if ( wp_cache_supports( 'flush_group' ) ) {
|
202 |
+
wp_cache_flush_group( 'woo_variation_swatches' );
|
203 |
+
}
|
204 |
}
|
205 |
}
|
206 |
}
|
includes/class-woo-variation-swatches-product-page.php
CHANGED
@@ -24,7 +24,6 @@
|
|
24 |
}
|
25 |
|
26 |
protected function includes() {
|
27 |
-
|
28 |
}
|
29 |
|
30 |
protected function hooks() {
|
@@ -448,35 +447,41 @@
|
|
448 |
|
449 |
public function get_available_variation_images( $product ) {
|
450 |
|
451 |
-
$
|
452 |
-
$
|
453 |
-
|
454 |
-
if ( is_callable( '_prime_post_caches' ) ) {
|
455 |
-
_prime_post_caches( $variation_ids );
|
456 |
-
}
|
457 |
|
458 |
-
|
459 |
|
460 |
-
$
|
|
|
461 |
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
470 |
}
|
471 |
|
472 |
-
|
473 |
-
// continue;
|
474 |
-
}
|
475 |
|
476 |
-
|
477 |
}
|
478 |
|
479 |
-
return
|
480 |
}
|
481 |
|
482 |
public function get_variation_by_attribute_name_value( $available_variations, $attribute_name, $attribute_value ) {
|
@@ -576,13 +581,13 @@
|
|
576 |
|
577 |
if ( 'radio' === $attribute_type ) {
|
578 |
|
579 |
-
|
580 |
$attribute_name = $data[ 'attribute_name' ];
|
581 |
$product = $data[ 'product' ];
|
582 |
$attributes = $product->get_variation_attributes();
|
583 |
-
$
|
584 |
-
$
|
585 |
-
$
|
|
|
586 |
|
587 |
/*
|
588 |
* $get_variations = count( $product->get_children() ) <= apply_filters( 'woocommerce_ajax_variation_threshold', 30, $product );
|
@@ -672,6 +677,24 @@
|
|
672 |
return empty( $variation[ 'image_id' ] ) ? $placeholder_image : $variation[ 'image_id' ];
|
673 |
}
|
674 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
675 |
public function get_swatch_data( $args, $term_or_option ) {
|
676 |
|
677 |
$options = $args[ 'options' ];
|
@@ -752,7 +775,8 @@
|
|
752 |
|
753 |
if ( empty( $options ) && ! empty( $product ) && ! empty( $attribute ) ) {
|
754 |
$attributes = $product->get_variation_attributes();
|
755 |
-
$
|
|
|
756 |
}
|
757 |
|
758 |
|
24 |
}
|
25 |
|
26 |
protected function includes() {
|
|
|
27 |
}
|
28 |
|
29 |
protected function hooks() {
|
447 |
|
448 |
public function get_available_variation_images( $product ) {
|
449 |
|
450 |
+
$cache_key = woo_variation_swatches()->get_cache()->get_key_with_language_suffix( sprintf( 'variation_images_of__%s', $product->get_id() ) );
|
451 |
+
$cache_group = 'woo_variation_swatches';
|
|
|
|
|
|
|
|
|
452 |
|
453 |
+
if ( false === ( $variations = wp_cache_get( $cache_key, $cache_group ) ) ) {
|
454 |
|
455 |
+
$variation_ids = $product->get_children();
|
456 |
+
$available_variations = array();
|
457 |
|
458 |
+
foreach ( $variation_ids as $variation_id ) {
|
459 |
+
|
460 |
+
$variation = wc_get_product( $variation_id );
|
461 |
+
|
462 |
+
// Hide out of stock variations if 'Hide out of stock items from the catalog' is checked.
|
463 |
+
if ( ! $variation || ! $variation->exists() || ( 'yes' === get_option( 'woocommerce_hide_out_of_stock_items' ) && ! $variation->is_in_stock() ) ) {
|
464 |
+
continue;
|
465 |
+
}
|
466 |
+
|
467 |
+
// Filter 'woocommerce_hide_invisible_variations' to optionally hide invisible variations (disabled variations and variations with empty price).
|
468 |
+
if ( apply_filters( 'woocommerce_hide_invisible_variations', true, $product->get_id(), $variation ) && ! $variation->variation_is_visible() ) {
|
469 |
+
continue;
|
470 |
+
}
|
471 |
+
|
472 |
+
if ( ! $variation->get_image_id( 'edit' ) > 0 ) {
|
473 |
+
// continue;
|
474 |
+
}
|
475 |
+
|
476 |
+
$available_variations[] = $this->get_available_variation_image( $variation, $product );
|
477 |
}
|
478 |
|
479 |
+
$variations = array_values( array_filter( $available_variations ) );
|
|
|
|
|
480 |
|
481 |
+
wp_cache_set( $cache_key, $variations, $cache_group );
|
482 |
}
|
483 |
|
484 |
+
return $variations;
|
485 |
}
|
486 |
|
487 |
public function get_variation_by_attribute_name_value( $available_variations, $attribute_name, $attribute_value ) {
|
581 |
|
582 |
if ( 'radio' === $attribute_type ) {
|
583 |
|
|
|
584 |
$attribute_name = $data[ 'attribute_name' ];
|
585 |
$product = $data[ 'product' ];
|
586 |
$attributes = $product->get_variation_attributes();
|
587 |
+
// $attributes = $this->get_cached_variation_attributes( $product );
|
588 |
+
$slug = $data[ 'slug' ];
|
589 |
+
$is_selected = wc_string_to_bool( $data[ 'is_selected' ] );
|
590 |
+
$option_name = $data[ 'option_name' ];
|
591 |
|
592 |
/*
|
593 |
* $get_variations = count( $product->get_children() ) <= apply_filters( 'woocommerce_ajax_variation_threshold', 30, $product );
|
677 |
return empty( $variation[ 'image_id' ] ) ? $placeholder_image : $variation[ 'image_id' ];
|
678 |
}
|
679 |
|
680 |
+
// Cached version of $product->get_variation_attributes()
|
681 |
+
public function get_cached_variation_attributes( $product ) {
|
682 |
+
|
683 |
+
$product_id = $product->get_id();
|
684 |
+
|
685 |
+
$cache_key = woo_variation_swatches()->get_cache()->get_key_with_language_suffix( sprintf( 'variation_attributes_of__%s', $product_id ) );
|
686 |
+
$cache_group = 'woo_variation_swatches';
|
687 |
+
|
688 |
+
if ( false === ( $attributes = wp_cache_get( $cache_key, $cache_group ) ) ) {
|
689 |
+
$attributes = $product->get_variation_attributes();
|
690 |
+
|
691 |
+
wp_cache_set( $cache_key, $attributes, $cache_group );
|
692 |
+
}
|
693 |
+
|
694 |
+
return $attributes;
|
695 |
+
|
696 |
+
}
|
697 |
+
|
698 |
public function get_swatch_data( $args, $term_or_option ) {
|
699 |
|
700 |
$options = $args[ 'options' ];
|
775 |
|
776 |
if ( empty( $options ) && ! empty( $product ) && ! empty( $attribute ) ) {
|
777 |
$attributes = $product->get_variation_attributes();
|
778 |
+
// $attributes = $this->get_cached_variation_attributes( $product );
|
779 |
+
$options = $attributes[ $attribute ];
|
780 |
}
|
781 |
|
782 |
|
includes/class-woo-variation-swatches.php
CHANGED
@@ -34,6 +34,9 @@
|
|
34 |
}
|
35 |
|
36 |
public function includes() {
|
|
|
|
|
|
|
37 |
require_once dirname( __FILE__ ) . '/class-woo-variation-swatches-manage-cache.php';
|
38 |
require_once dirname( __FILE__ ) . '/class-woo-variation-swatches-frontend.php';
|
39 |
require_once dirname( __FILE__ ) . '/class-woo-variation-swatches-backend.php';
|
@@ -80,7 +83,14 @@
|
|
80 |
}
|
81 |
|
82 |
public function get_option( $option, $default = null ) {
|
83 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
84 |
|
85 |
if ( current_theme_supports( 'woo_variation_swatches' ) ) {
|
86 |
$theme_support = get_theme_support( 'woo_variation_swatches' );
|
@@ -97,7 +107,7 @@
|
|
97 |
}
|
98 |
|
99 |
public function get_cache() {
|
100 |
-
Woo_Variation_Swatches_Manage_Cache::instance();
|
101 |
}
|
102 |
|
103 |
public function language() {
|
34 |
}
|
35 |
|
36 |
public function includes() {
|
37 |
+
|
38 |
+
// Deprecated file: class-woo-variation-swatches-cache.php
|
39 |
+
require_once dirname( __FILE__ ) . '/class-woo-variation-swatches-cache.php';
|
40 |
require_once dirname( __FILE__ ) . '/class-woo-variation-swatches-manage-cache.php';
|
41 |
require_once dirname( __FILE__ ) . '/class-woo-variation-swatches-frontend.php';
|
42 |
require_once dirname( __FILE__ ) . '/class-woo-variation-swatches-backend.php';
|
83 |
}
|
84 |
|
85 |
public function get_option( $option, $default = null ) {
|
86 |
+
|
87 |
+
$cache_key = $this->get_cache()->get_key_with_language_suffix( 'global_settings' );
|
88 |
+
$cache_group = 'woo_variation_swatches';
|
89 |
+
|
90 |
+
if ( false === ( $options = wp_cache_get( $cache_key, $cache_group ) ) ) {
|
91 |
+
$options = GetWooPlugins_Admin_Settings::get_option( 'woo_variation_swatches' );
|
92 |
+
wp_cache_set( $cache_key, $options, $cache_group );
|
93 |
+
}
|
94 |
|
95 |
if ( current_theme_supports( 'woo_variation_swatches' ) ) {
|
96 |
$theme_support = get_theme_support( 'woo_variation_swatches' );
|
107 |
}
|
108 |
|
109 |
public function get_cache() {
|
110 |
+
return Woo_Variation_Swatches_Manage_Cache::instance();
|
111 |
}
|
112 |
|
113 |
public function language() {
|
languages/woo-variation-swatches.pot
CHANGED
@@ -7,7 +7,7 @@ msgstr ""
|
|
7 |
"Content-Type: text/plain; charset=UTF-8\n"
|
8 |
"Content-Transfer-Encoding: 8bit\n"
|
9 |
"Language-Team: Emran Ahmed <emran.bd.08@gmail.com>\n"
|
10 |
-
"POT-Creation-Date: 2022-11-
|
11 |
"X-Poedit-Basepath: ..\n"
|
12 |
"X-Poedit-KeywordsList: __;_e;_ex:1,2c;_n:1,2;_n_noop:1,2;_nx:1,2,4c;_nx_noop:1,2,3c;_x:1,2c;esc_attr__;esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c\n"
|
13 |
"X-Poedit-SearchPath-0: .\n"
|
@@ -197,11 +197,11 @@ msgstr ""
|
|
197 |
msgid "Unable to use image \"%s\"."
|
198 |
msgstr ""
|
199 |
|
200 |
-
#: ../includes/class-woo-variation-swatches-product-page.php:
|
201 |
msgid "%s left"
|
202 |
msgstr ""
|
203 |
|
204 |
-
#: ../includes/class-woo-variation-swatches-product-page.php:
|
205 |
msgid "Choose an option"
|
206 |
msgstr ""
|
207 |
|
@@ -709,7 +709,7 @@ msgstr ""
|
|
709 |
msgid "Remove image"
|
710 |
msgstr ""
|
711 |
|
712 |
-
#: ../includes/class-woo-variation-swatches.php:
|
713 |
msgid "\"Variation Swatches for WooCommerce\" Plugin try to load \"%s\" but template \"%s\" was not found."
|
714 |
msgstr ""
|
715 |
|
7 |
"Content-Type: text/plain; charset=UTF-8\n"
|
8 |
"Content-Transfer-Encoding: 8bit\n"
|
9 |
"Language-Team: Emran Ahmed <emran.bd.08@gmail.com>\n"
|
10 |
+
"POT-Creation-Date: 2022-11-17 13:31+0000\n"
|
11 |
"X-Poedit-Basepath: ..\n"
|
12 |
"X-Poedit-KeywordsList: __;_e;_ex:1,2c;_n:1,2;_n_noop:1,2;_nx:1,2,4c;_nx_noop:1,2,3c;_x:1,2c;esc_attr__;esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c\n"
|
13 |
"X-Poedit-SearchPath-0: .\n"
|
197 |
msgid "Unable to use image \"%s\"."
|
198 |
msgstr ""
|
199 |
|
200 |
+
#: ../includes/class-woo-variation-swatches-product-page.php:128
|
201 |
msgid "%s left"
|
202 |
msgstr ""
|
203 |
|
204 |
+
#: ../includes/class-woo-variation-swatches-product-page.php:748, ../includes/class-woo-variation-swatches-product-page.php:774
|
205 |
msgid "Choose an option"
|
206 |
msgstr ""
|
207 |
|
709 |
msgid "Remove image"
|
710 |
msgstr ""
|
711 |
|
712 |
+
#: ../includes/class-woo-variation-swatches.php:225
|
713 |
msgid "\"Variation Swatches for WooCommerce\" Plugin try to load \"%s\" but template \"%s\" was not found."
|
714 |
msgstr ""
|
715 |
|
uninstall.php
CHANGED
@@ -1,20 +1,23 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
|
|
|
|
|
|
20 |
|
1 |
<?php
|
2 |
+
/**
|
3 |
+
* Uninstall plugin
|
4 |
+
*/
|
5 |
+
|
6 |
+
// If uninstall not called from WordPress exit
|
7 |
+
defined( 'WP_UNINSTALL_PLUGIN' ) or die( 'Keep Silent' );
|
8 |
+
|
9 |
+
global $wpdb;
|
10 |
+
|
11 |
+
// change to select type when uninstall
|
12 |
+
$table_name = $wpdb->prefix . 'woocommerce_attribute_taxonomies';
|
13 |
+
$query = $wpdb->query( "UPDATE `$table_name` SET `attribute_type` = 'select' WHERE `attribute_type` != 'text'" );
|
14 |
+
$wpdb->query( $query );
|
15 |
+
|
16 |
+
// Remove Option
|
17 |
+
delete_option( 'woo_variation_swatches' );
|
18 |
+
// Site options in Multisite
|
19 |
+
delete_site_option( 'woo_variation_swatches' );
|
20 |
+
|
21 |
+
// Clear any cached data that has been removed.
|
22 |
+
wp_cache_flush();
|
23 |
|
woo-variation-swatches.php
CHANGED
@@ -4,13 +4,13 @@
|
|
4 |
* Plugin URI: https://wordpress.org/plugins/woo-variation-swatches/
|
5 |
* Description: Beautiful colors, images and buttons variation swatches for woocommerce product attributes. Requires WooCommerce 5.6+
|
6 |
* Author: Emran Ahmed
|
7 |
-
* Version: 2.0.
|
8 |
* Domain Path: /languages
|
9 |
* Requires PHP: 7.0
|
10 |
* Requires at least: 5.6
|
11 |
* Tested up to: 6.1
|
12 |
* WC requires at least: 5.6
|
13 |
-
* WC tested up to: 7.
|
14 |
* Text Domain: woo-variation-swatches
|
15 |
* Author URI: https://getwooplugins.com/
|
16 |
*/
|
@@ -18,7 +18,7 @@
|
|
18 |
defined( 'ABSPATH' ) or die( 'Keep Silent' );
|
19 |
|
20 |
if ( ! defined( 'WOO_VARIATION_SWATCHES_PLUGIN_VERSION' ) ) {
|
21 |
-
define( 'WOO_VARIATION_SWATCHES_PLUGIN_VERSION', '2.0.
|
22 |
}
|
23 |
|
24 |
if ( ! defined( 'WOO_VARIATION_SWATCHES_PLUGIN_FILE' ) ) {
|
@@ -35,13 +35,13 @@
|
|
35 |
|
36 |
if ( ! class_exists( 'WooCommerce' ) ) {
|
37 |
$text = esc_html__( 'WooCommerce', 'woo-variation-swatches' );
|
38 |
-
$link = esc_url( add_query_arg(
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
$message = wp_kses( __( "<strong>Variation Swatches for WooCommerce</strong> is an add-on of ", 'woo-variation-swatches' ), array( 'strong' => array() ) );
|
46 |
|
47 |
printf( '<div class="%1$s"><p>%2$s <a class="thickbox open-plugin-details-modal" href="%3$s"><strong>%4$s</strong></a></p></div>', 'notice notice-error', $message, $link, $text );
|
4 |
* Plugin URI: https://wordpress.org/plugins/woo-variation-swatches/
|
5 |
* Description: Beautiful colors, images and buttons variation swatches for woocommerce product attributes. Requires WooCommerce 5.6+
|
6 |
* Author: Emran Ahmed
|
7 |
+
* Version: 2.0.13
|
8 |
* Domain Path: /languages
|
9 |
* Requires PHP: 7.0
|
10 |
* Requires at least: 5.6
|
11 |
* Tested up to: 6.1
|
12 |
* WC requires at least: 5.6
|
13 |
+
* WC tested up to: 7.1
|
14 |
* Text Domain: woo-variation-swatches
|
15 |
* Author URI: https://getwooplugins.com/
|
16 |
*/
|
18 |
defined( 'ABSPATH' ) or die( 'Keep Silent' );
|
19 |
|
20 |
if ( ! defined( 'WOO_VARIATION_SWATCHES_PLUGIN_VERSION' ) ) {
|
21 |
+
define( 'WOO_VARIATION_SWATCHES_PLUGIN_VERSION', '2.0.13' );
|
22 |
}
|
23 |
|
24 |
if ( ! defined( 'WOO_VARIATION_SWATCHES_PLUGIN_FILE' ) ) {
|
35 |
|
36 |
if ( ! class_exists( 'WooCommerce' ) ) {
|
37 |
$text = esc_html__( 'WooCommerce', 'woo-variation-swatches' );
|
38 |
+
$link = esc_url( add_query_arg( array(
|
39 |
+
'tab' => 'plugin-information',
|
40 |
+
'plugin' => 'woocommerce',
|
41 |
+
'TB_iframe' => 'true',
|
42 |
+
'width' => '640',
|
43 |
+
'height' => '500',
|
44 |
+
), admin_url( 'plugin-install.php' ) ) );
|
45 |
$message = wp_kses( __( "<strong>Variation Swatches for WooCommerce</strong> is an add-on of ", 'woo-variation-swatches' ), array( 'strong' => array() ) );
|
46 |
|
47 |
printf( '<div class="%1$s"><p>%2$s <a class="thickbox open-plugin-details-modal" href="%3$s"><strong>%4$s</strong></a></p></div>', 'notice notice-error', $message, $link, $text );
|