Version Description
Release Date - 14 December 2017
- Fixed an issue when empty wishlist is created once a guest visits the shop page
- Added new option "Require Login" that disallows guests to add products to a Wishlist until they sign-in
- Improved Wishlist Products Counter functionality
Download this release
Release Info
Developer | templateinvaders |
Plugin | WooCommerce Wishlist Plugin |
Version | 1.5.14 |
Comparing to | |
See all releases |
Code changes from version 1.5.13 to 1.5.14
- admin/settings/general.class.php +57 -38
- admin/tinvwl.class.php +473 -496
- asset/js/admin.js +339 -324
- asset/js/admin.min.js +1 -1
- asset/js/public.js +68 -11
- asset/js/public.min.js +1 -1
- includes/notice.helper.php +2 -2
- includes/tinvwl.class.php +150 -150
- includes/view.helper.php +391 -391
- languages/ti-woocommerce-wishlist.pot +141 -107
- public/addtowishlist.class.php +609 -594
- public/tinvwl.class.php +2 -2
- public/topwishlist.class.php +12 -9
- public/wishlist/view.class.php +11 -0
- readme.txt +41 -34
- templates/ti-addedtowishlist-dialogbox.php +3 -0
- templates/ti-wishlist-product-counter.php +1 -1
- ti-woocommerce-wishlist.php +2 -2
- tinv-wishlists-function.php +5 -2
admin/settings/general.class.php
CHANGED
@@ -71,6 +71,24 @@ class TInvWL_Admin_Settings_General extends TInvWL_Admin_BaseSection {
|
|
71 |
'options' => $page_list,
|
72 |
'validate' => FILTER_VALIDATE_INT,
|
73 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
74 |
array(
|
75 |
'type' => 'checkboxonoff',
|
76 |
'name' => 'link_in_myaccount',
|
@@ -97,13 +115,13 @@ class TInvWL_Admin_Settings_General extends TInvWL_Admin_BaseSection {
|
|
97 |
'text' => __( 'Remove product from Wishlist on second click', 'ti-woocommerce-wishlist' ),
|
98 |
'std' => false,
|
99 |
'extra' => array(
|
100 |
-
'tiwl-show'
|
101 |
-
'tiwl-hide'
|
102 |
),
|
103 |
),
|
104 |
array(
|
105 |
-
'type'
|
106 |
-
'id'
|
107 |
),
|
108 |
array(
|
109 |
'type' => 'checkboxonoff',
|
@@ -113,6 +131,7 @@ class TInvWL_Admin_Settings_General extends TInvWL_Admin_BaseSection {
|
|
113 |
'std' => true,
|
114 |
'extra' => array(
|
115 |
'tiwl-show' => '.tiwl-button-show-notice',
|
|
|
116 |
),
|
117 |
),
|
118 |
array(
|
@@ -138,12 +157,12 @@ class TInvWL_Admin_Settings_General extends TInvWL_Admin_BaseSection {
|
|
138 |
'class' => 'tiwl-button-show-notice',
|
139 |
),
|
140 |
array(
|
141 |
-
'type'
|
142 |
-
'name'
|
143 |
-
'text'
|
144 |
-
'desc'
|
145 |
-
'std'
|
146 |
-
'class'
|
147 |
),
|
148 |
array(
|
149 |
'type' => 'text',
|
@@ -282,11 +301,11 @@ class TInvWL_Admin_Settings_General extends TInvWL_Admin_BaseSection {
|
|
282 |
'std' => 'Add to Wishlist',
|
283 |
),
|
284 |
array(
|
285 |
-
'type'
|
286 |
-
'name'
|
287 |
-
'text'
|
288 |
-
'std'
|
289 |
-
'class'
|
290 |
),
|
291 |
),
|
292 |
),
|
@@ -317,12 +336,12 @@ class TInvWL_Admin_Settings_General extends TInvWL_Admin_BaseSection {
|
|
317 |
'text' => __( 'Button position', 'ti-woocommerce-wishlist' ),
|
318 |
'std' => 'after',
|
319 |
'options' => array(
|
320 |
-
'after'
|
321 |
-
'before'
|
322 |
-
'above_thumb'
|
323 |
-
'shortcode'
|
324 |
),
|
325 |
-
'desc'
|
326 |
),
|
327 |
array(
|
328 |
'type' => 'select',
|
@@ -382,11 +401,11 @@ class TInvWL_Admin_Settings_General extends TInvWL_Admin_BaseSection {
|
|
382 |
'std' => 'Add to Wishlist',
|
383 |
),
|
384 |
array(
|
385 |
-
'type'
|
386 |
-
'name'
|
387 |
-
'text'
|
388 |
-
'std'
|
389 |
-
'class'
|
390 |
),
|
391 |
),
|
392 |
),
|
@@ -542,21 +561,21 @@ class TInvWL_Admin_Settings_General extends TInvWL_Admin_BaseSection {
|
|
542 |
'std' => 'Share on',
|
543 |
),
|
544 |
array(
|
545 |
-
'type'
|
546 |
-
'name'
|
547 |
-
'text'
|
548 |
-
'options'
|
549 |
-
'dark'
|
550 |
-
'white'
|
551 |
),
|
552 |
-
'validate'
|
553 |
),
|
554 |
),
|
555 |
),
|
556 |
array(
|
557 |
'id' => 'topline',
|
558 |
'title' => __( 'Wishlist Products Counter', 'ti-woocommerce-wishlist' ),
|
559 |
-
'desc'
|
560 |
'show_names' => true,
|
561 |
'fields' => array(
|
562 |
array(
|
@@ -570,7 +589,7 @@ class TInvWL_Admin_Settings_General extends TInvWL_Admin_BaseSection {
|
|
570 |
'heart-plus' => __( 'Heart+', 'ti-woocommerce-wishlist' ),
|
571 |
'custom' => __( 'Custom', 'ti-woocommerce-wishlist' ),
|
572 |
),
|
573 |
-
'desc'
|
574 |
'extra' => array(
|
575 |
'tiwl-show' => '.tiwl-dropdown-icon-custom',
|
576 |
'tiwl-hide' => '.tiwl-dropdown-icon-style',
|
@@ -631,10 +650,10 @@ class TInvWL_Admin_Settings_General extends TInvWL_Admin_BaseSection {
|
|
631 |
'extra' => array( 'class' => 'tinvwl-btn split status-btn-ok' ),
|
632 |
),
|
633 |
array(
|
634 |
-
'type'
|
635 |
-
'name'
|
636 |
-
'std'
|
637 |
-
'extra'
|
638 |
),
|
639 |
array(
|
640 |
'type' => 'button_submit_quick',
|
71 |
'options' => $page_list,
|
72 |
'validate' => FILTER_VALIDATE_INT,
|
73 |
),
|
74 |
+
array(
|
75 |
+
'type' => 'checkboxonoff',
|
76 |
+
'name' => 'require_login',
|
77 |
+
'text' => __( 'Require Login', '*ti-woocommerce-wishlist' ),
|
78 |
+
'desc' => __( 'Disallows guests to use Wishlist functionality until they sign-in.', 'ti-woocommerce-wishlist' ),
|
79 |
+
'std' => false,
|
80 |
+
'extra' => array(
|
81 |
+
'tiwl-show' => '.tiwl-general-redirect-require-login',
|
82 |
+
),
|
83 |
+
),
|
84 |
+
array(
|
85 |
+
'type' => 'checkboxonoff',
|
86 |
+
'name' => 'redirect_require_login',
|
87 |
+
'text' => __( 'Redirect to Login Page', '*ti-woocommerce-wishlist' ),
|
88 |
+
'desc' => '<span class="tiwl-button-show-notice-warning-popup"><strong>' . __( 'Currently this option could not be changed because "Show successful notice in popup" is disabled. Guests will be redirected automatically to a login page.', 'ti-woocommerce-wishlist' ) . '</strong></span><span class="tiwl-button-show-notice">' . __( 'If enabled, guests will be redirected to a login page once clicking the "Add to Wishlist" button or "Wishlist Products Counter" link. Otherwise a popup with login required notice will appear.', 'ti-woocommerce-wishlist' ) . '</span>',
|
89 |
+
'std' => false,
|
90 |
+
'class' => 'tiwl-general-redirect-require-login',
|
91 |
+
),
|
92 |
array(
|
93 |
'type' => 'checkboxonoff',
|
94 |
'name' => 'link_in_myaccount',
|
115 |
'text' => __( 'Remove product from Wishlist on second click', 'ti-woocommerce-wishlist' ),
|
116 |
'std' => false,
|
117 |
'extra' => array(
|
118 |
+
'tiwl-show' => '.tiwl-general-simple-flow>td, .tiwl-button-simple-flow',
|
119 |
+
'tiwl-hide' => '.tiwl-general-simple-flow-hide>td',
|
120 |
),
|
121 |
),
|
122 |
array(
|
123 |
+
'type' => 'group',
|
124 |
+
'id' => 'show_notice',
|
125 |
),
|
126 |
array(
|
127 |
'type' => 'checkboxonoff',
|
131 |
'std' => true,
|
132 |
'extra' => array(
|
133 |
'tiwl-show' => '.tiwl-button-show-notice',
|
134 |
+
'tiwl-hide' => '.tiwl-button-show-notice-warning-popup',
|
135 |
),
|
136 |
),
|
137 |
array(
|
157 |
'class' => 'tiwl-button-show-notice',
|
158 |
),
|
159 |
array(
|
160 |
+
'type' => 'text',
|
161 |
+
'name' => 'text_already_in',
|
162 |
+
'text' => __( '"Product already in Wishlist" Text', 'ti-woocommerce-wishlist' ),
|
163 |
+
'desc' => __( 'This notification will be shown if user will try to add a product that is already in the wishlist.', 'ti-woocommerce-wishlist' ),
|
164 |
+
'std' => 'Product already in Wishlist',
|
165 |
+
'class' => 'tiwl-button-show-notice tiwl-general-simple-flow-hide',
|
166 |
),
|
167 |
array(
|
168 |
'type' => 'text',
|
301 |
'std' => 'Add to Wishlist',
|
302 |
),
|
303 |
array(
|
304 |
+
'type' => 'text',
|
305 |
+
'name' => 'text_remove',
|
306 |
+
'text' => __( '"Remove from Wishlist" Button Text', 'ti-woocommerce-wishlist' ),
|
307 |
+
'std' => 'Remove from Wishlist',
|
308 |
+
'class' => 'tiwl-button-simple-flow',
|
309 |
),
|
310 |
),
|
311 |
),
|
336 |
'text' => __( 'Button position', 'ti-woocommerce-wishlist' ),
|
337 |
'std' => 'after',
|
338 |
'options' => array(
|
339 |
+
'after' => __( 'After "Add to Cart" button', 'ti-woocommerce-wishlist' ),
|
340 |
+
'before' => __( 'Before "Add to Cart" button', 'ti-woocommerce-wishlist' ),
|
341 |
+
'above_thumb' => __( 'Above Thumbnail', 'ti-woocommerce-wishlist' ),
|
342 |
+
'shortcode' => __( 'Custom position with code', 'ti-woocommerce-wishlist' ),
|
343 |
),
|
344 |
+
'desc' => __( 'Note: if "Custom position with code" option is applied, the "Add to Wishlist" button should be added into template using <code>do_shortcode()</code> function like this:<br /><code>do_shortcode("[ti_wishlists_addtowishlist loop=yes]")</code>', 'ti-woocommerce-wishlist' ),
|
345 |
),
|
346 |
array(
|
347 |
'type' => 'select',
|
401 |
'std' => 'Add to Wishlist',
|
402 |
),
|
403 |
array(
|
404 |
+
'type' => 'text',
|
405 |
+
'name' => 'text_remove',
|
406 |
+
'text' => __( '"Remove from Wishlist" Button Text', 'ti-woocommerce-wishlist' ),
|
407 |
+
'std' => 'Remove from Wishlist',
|
408 |
+
'class' => 'tiwl-button-simple-flow',
|
409 |
),
|
410 |
),
|
411 |
),
|
561 |
'std' => 'Share on',
|
562 |
),
|
563 |
array(
|
564 |
+
'type' => 'select',
|
565 |
+
'name' => 'icon_style',
|
566 |
+
'text' => __( 'Social Icons Color', 'ti-woocommerce-wishlist' ),
|
567 |
+
'options' => array(
|
568 |
+
'dark' => __( 'Dark', 'ti-woocommerce-wishlist' ),
|
569 |
+
'white' => __( 'White', 'ti-woocommerce-wishlist' ),
|
570 |
),
|
571 |
+
'validate' => FILTER_DEFAULT,
|
572 |
),
|
573 |
),
|
574 |
),
|
575 |
array(
|
576 |
'id' => 'topline',
|
577 |
'title' => __( 'Wishlist Products Counter', 'ti-woocommerce-wishlist' ),
|
578 |
+
'desc' => sprintf( __( 'Add this shortcode <code>[ti_wishlist_products_counter]</code> anywhere into a page content to show Wishlist Counter.<br/><br/>It can be also added as a widget <code>Wishlist Products Counter</code> under the <a href="%s">Appearance -> Widgets</a> section.', 'ti-woocommerce-wishlist' ), esc_url( admin_url( 'widgets.php' ) ) ),
|
579 |
'show_names' => true,
|
580 |
'fields' => array(
|
581 |
array(
|
589 |
'heart-plus' => __( 'Heart+', 'ti-woocommerce-wishlist' ),
|
590 |
'custom' => __( 'Custom', 'ti-woocommerce-wishlist' ),
|
591 |
),
|
592 |
+
'desc' => __( 'You can choose from our predefined icons or upload your custom icon. Custom icon size is limited to 16x16 px.', 'ti-woocommerce-wishlist' ),
|
593 |
'extra' => array(
|
594 |
'tiwl-show' => '.tiwl-dropdown-icon-custom',
|
595 |
'tiwl-hide' => '.tiwl-dropdown-icon-style',
|
650 |
'extra' => array( 'class' => 'tinvwl-btn split status-btn-ok' ),
|
651 |
),
|
652 |
array(
|
653 |
+
'type' => 'button_submit',
|
654 |
+
'name' => 'setting_reset',
|
655 |
+
'std' => '<span><i class="fa fa-times"></i></span>' . __( 'Reset', 'ti-woocommerce-wishlist' ),
|
656 |
+
'extra' => array( 'class' => 'tinvwl-btn split status-btn-ok tinvwl-confirm-reset' ),
|
657 |
),
|
658 |
array(
|
659 |
'type' => 'button_submit_quick',
|
admin/tinvwl.class.php
CHANGED
@@ -1,496 +1,473 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Admin pages class
|
4 |
-
*
|
5 |
-
* @since 1.0.0
|
6 |
-
* @package TInvWishlist\Admin
|
7 |
-
*/
|
8 |
-
|
9 |
-
// If this file is called directly, abort.
|
10 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
11 |
-
die;
|
12 |
-
}
|
13 |
-
|
14 |
-
/**
|
15 |
-
* Admin pages class
|
16 |
-
*/
|
17 |
-
class TInvWL_Admin_TInvWL extends TInvWL_Admin_Base {
|
18 |
-
|
19 |
-
/**
|
20 |
-
* Constructor
|
21 |
-
*
|
22 |
-
* @param string $plugin_name Plugin name.
|
23 |
-
* @param string $version Plugin version.
|
24 |
-
*/
|
25 |
-
function __construct( $plugin_name, $version ) {
|
26 |
-
$this->_n = $plugin_name;
|
27 |
-
$this->_v = $version;
|
28 |
-
}
|
29 |
-
|
30 |
-
/**
|
31 |
-
* Load functions.
|
32 |
-
* Create Wishlist and Product class.
|
33 |
-
* Load settings classes.
|
34 |
-
*/
|
35 |
-
function load_function() {
|
36 |
-
TII18n();
|
37 |
-
TInvWL_Notice::instance()->add_notice( 'rating', '<p>' . __( 'Woo-Ha! It has been a month since the first wishlist was created with <strong>WooCommerce WishList plugin</strong>!', 'ti-woocommerce-wishlist' ) . '</p><p>' . __( 'What do you think about our plugin?', 'ti-woocommerce-wishlist' ) . '</p><p>' . __( 'Share your love with us.', 'ti-woocommerce-wishlist' ) . '</p>' )->add_trigger( 'admin_init', 'tinvwl_rating_notice_trigger_30' );
|
38 |
-
$this->load_settings();
|
39 |
-
|
40 |
-
$this->define_hooks();
|
41 |
-
}
|
42 |
-
|
43 |
-
/**
|
44 |
-
* Load settings classes.
|
45 |
-
*
|
46 |
-
* @return boolean
|
47 |
-
*/
|
48 |
-
function load_settings() {
|
49 |
-
$dir = TINVWL_PATH . 'admin/settings/';
|
50 |
-
if ( ! file_exists( $dir ) || ! is_dir( $dir ) ) {
|
51 |
-
return false;
|
52 |
-
}
|
53 |
-
$files = scandir( $dir );
|
54 |
-
foreach ( $files as $value ) {
|
55 |
-
if ( preg_match( '/\.class\.php$/i', $value ) ) {
|
56 |
-
$file = preg_replace( '/\.class\.php$/i', '', $value );
|
57 |
-
$class = 'TInvWL_Admin_Settings_' . ucfirst( $file );
|
58 |
-
$settings = new $class( $this->_n, $this->_v );
|
59 |
-
}
|
60 |
-
}
|
61 |
-
|
62 |
-
return true;
|
63 |
-
}
|
64 |
-
|
65 |
-
/**
|
66 |
-
* Define hooks
|
67 |
-
*/
|
68 |
-
function define_hooks() {
|
69 |
-
add_action( 'admin_menu', array( $this, 'action_menu' ) );
|
70 |
-
if ( 'skip' === filter_input( INPUT_GET, $this->_n . '-wizard' ) ) {
|
71 |
-
update_option( $this->_n . '_wizard', true );
|
72 |
-
}
|
73 |
-
if ( ! get_option( $this->_n . '_wizard' ) ) {
|
74 |
-
add_action( 'admin_notices', array( $this, 'wizard_run_admin_notice' ) );
|
75 |
-
} elseif ( ! tinv_get_option( 'page', 'wishlist' ) ) {
|
76 |
-
add_action( 'admin_notices', array( $this, 'empty_page_admin_notice' ) );
|
77 |
-
}
|
78 |
-
add_action( 'woocommerce_system_status_report', array( $this, 'system_report_templates' ) );
|
79 |
-
|
80 |
-
add_action( 'switch_theme', array( $this, 'admin_notice_outdated_templates' ) );
|
81 |
-
add_action( 'tinvwl_updated', array( $this, 'admin_notice_outdated_templates' ) );
|
82 |
-
add_action( 'wp_ajax_' . $this->_n . '_checker_hook', array( $this, 'validation_template' ) );
|
83 |
-
add_action( 'switch_theme', array( $this, 'clear_notice_validation_template' ) );
|
84 |
-
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts_validate_template' ) );
|
85 |
-
add_action( 'tinvwl_admin_promo_footer', array( $this, 'promo_footer' ) );
|
86 |
-
add_action( 'tinvwl_remove_without_author_wishlist', array( $this, '
|
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 |
-
esc_html__( '
|
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 |
-
add_action( 'admin_enqueue_scripts', array( $this, '
|
147 |
-
|
148 |
-
add_filter( '
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
wp_enqueue_style(
|
159 |
-
wp_enqueue_style( $this->_n, TINVWL_URL . 'asset/css/
|
160 |
-
wp_enqueue_style( $this->_n . '-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
$
|
169 |
-
|
170 |
-
|
171 |
-
'
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
$
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
"
|
187 |
-
"Plugin
|
188 |
-
|
189 |
-
};
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
*
|
209 |
-
*
|
210 |
-
*
|
211 |
-
*
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
*
|
222 |
-
*
|
223 |
-
*
|
224 |
-
*
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
$
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
$theme =
|
293 |
-
|
294 |
-
|
295 |
-
tinv_update_option( 'template_checker', '',
|
296 |
-
tinv_update_option( 'template_checker', '
|
297 |
-
tinv_update_option( 'template_checker', '
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
$types
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
'
|
308 |
-
|
309 |
-
) )
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
'
|
318 |
-
|
319 |
-
) )
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
'
|
343 |
-
'
|
344 |
-
|
345 |
-
);
|
346 |
-
$tch
|
347 |
-
$tch->add_action( $tags );
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
$
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
'
|
361 |
-
'
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
'
|
367 |
-
'
|
368 |
-
'
|
369 |
-
|
370 |
-
|
371 |
-
'
|
372 |
-
'
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
$
|
380 |
-
$
|
381 |
-
|
382 |
-
|
383 |
-
'
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
'
|
388 |
-
|
389 |
-
),
|
390 |
-
|
391 |
-
) )
|
392 |
-
|
393 |
-
$result
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
$types
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
*
|
434 |
-
*
|
435 |
-
* @param
|
436 |
-
*
|
437 |
-
*
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
$time
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
$
|
464 |
-
|
465 |
-
'
|
466 |
-
'
|
467 |
-
|
468 |
-
)
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
) );
|
475 |
-
if ( empty( $products ) ) {
|
476 |
-
$wl->remove( $wishlist['ID'] );
|
477 |
-
}
|
478 |
-
}
|
479 |
-
}
|
480 |
-
|
481 |
-
/**
|
482 |
-
* Removing old wishlist without a user older than 34 days
|
483 |
-
*/
|
484 |
-
public function remove_old_wishlists() {
|
485 |
-
$wl = new TInvWL_Wishlist();
|
486 |
-
$wishlists = $wl->get( array(
|
487 |
-
'author' => 0,
|
488 |
-
'type' => 'default',
|
489 |
-
'sql' => 'SELECT * FROM {table} {where} AND `date` < DATE_SUB( CURDATE(), INTERVAL 34 DAY)',
|
490 |
-
) );
|
491 |
-
foreach ( $wishlists as $wishlist ) {
|
492 |
-
$wl->remove( $wishlist['ID'] );
|
493 |
-
}
|
494 |
-
}
|
495 |
-
|
496 |
-
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Admin pages class
|
4 |
+
*
|
5 |
+
* @since 1.0.0
|
6 |
+
* @package TInvWishlist\Admin
|
7 |
+
*/
|
8 |
+
|
9 |
+
// If this file is called directly, abort.
|
10 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
11 |
+
die;
|
12 |
+
}
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Admin pages class
|
16 |
+
*/
|
17 |
+
class TInvWL_Admin_TInvWL extends TInvWL_Admin_Base {
|
18 |
+
|
19 |
+
/**
|
20 |
+
* Constructor
|
21 |
+
*
|
22 |
+
* @param string $plugin_name Plugin name.
|
23 |
+
* @param string $version Plugin version.
|
24 |
+
*/
|
25 |
+
function __construct( $plugin_name, $version ) {
|
26 |
+
$this->_n = $plugin_name;
|
27 |
+
$this->_v = $version;
|
28 |
+
}
|
29 |
+
|
30 |
+
/**
|
31 |
+
* Load functions.
|
32 |
+
* Create Wishlist and Product class.
|
33 |
+
* Load settings classes.
|
34 |
+
*/
|
35 |
+
function load_function() {
|
36 |
+
TII18n();
|
37 |
+
TInvWL_Notice::instance()->add_notice( 'rating', '<p>' . __( 'Woo-Ha! It has been a month since the first wishlist was created with <strong>WooCommerce WishList plugin</strong>!', 'ti-woocommerce-wishlist' ) . '</p><p>' . __( 'What do you think about our plugin?', 'ti-woocommerce-wishlist' ) . '</p><p>' . __( 'Share your love with us.', 'ti-woocommerce-wishlist' ) . '</p>' )->add_trigger( 'admin_init', 'tinvwl_rating_notice_trigger_30' );
|
38 |
+
$this->load_settings();
|
39 |
+
|
40 |
+
$this->define_hooks();
|
41 |
+
}
|
42 |
+
|
43 |
+
/**
|
44 |
+
* Load settings classes.
|
45 |
+
*
|
46 |
+
* @return boolean
|
47 |
+
*/
|
48 |
+
function load_settings() {
|
49 |
+
$dir = TINVWL_PATH . 'admin/settings/';
|
50 |
+
if ( ! file_exists( $dir ) || ! is_dir( $dir ) ) {
|
51 |
+
return false;
|
52 |
+
}
|
53 |
+
$files = scandir( $dir );
|
54 |
+
foreach ( $files as $value ) {
|
55 |
+
if ( preg_match( '/\.class\.php$/i', $value ) ) {
|
56 |
+
$file = preg_replace( '/\.class\.php$/i', '', $value );
|
57 |
+
$class = 'TInvWL_Admin_Settings_' . ucfirst( $file );
|
58 |
+
$settings = new $class( $this->_n, $this->_v );
|
59 |
+
}
|
60 |
+
}
|
61 |
+
|
62 |
+
return true;
|
63 |
+
}
|
64 |
+
|
65 |
+
/**
|
66 |
+
* Define hooks
|
67 |
+
*/
|
68 |
+
function define_hooks() {
|
69 |
+
add_action( 'admin_menu', array( $this, 'action_menu' ) );
|
70 |
+
if ( 'skip' === filter_input( INPUT_GET, $this->_n . '-wizard' ) ) {
|
71 |
+
update_option( $this->_n . '_wizard', true );
|
72 |
+
}
|
73 |
+
if ( ! get_option( $this->_n . '_wizard' ) ) {
|
74 |
+
add_action( 'admin_notices', array( $this, 'wizard_run_admin_notice' ) );
|
75 |
+
} elseif ( ! tinv_get_option( 'page', 'wishlist' ) ) {
|
76 |
+
add_action( 'admin_notices', array( $this, 'empty_page_admin_notice' ) );
|
77 |
+
}
|
78 |
+
add_action( 'woocommerce_system_status_report', array( $this, 'system_report_templates' ) );
|
79 |
+
|
80 |
+
add_action( 'switch_theme', array( $this, 'admin_notice_outdated_templates' ) );
|
81 |
+
add_action( 'tinvwl_updated', array( $this, 'admin_notice_outdated_templates' ) );
|
82 |
+
add_action( 'wp_ajax_' . $this->_n . '_checker_hook', array( $this, 'validation_template' ) );
|
83 |
+
add_action( 'switch_theme', array( $this, 'clear_notice_validation_template' ) );
|
84 |
+
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts_validate_template' ) );
|
85 |
+
add_action( 'tinvwl_admin_promo_footer', array( $this, 'promo_footer' ) );
|
86 |
+
add_action( 'tinvwl_remove_without_author_wishlist', array( $this, 'remove_old_wishlists' ) );
|
87 |
+
$this->scheduled_remove_wishlist();
|
88 |
+
}
|
89 |
+
|
90 |
+
/**
|
91 |
+
* Error notice if wizard didn't run.
|
92 |
+
*/
|
93 |
+
function wizard_run_admin_notice() {
|
94 |
+
printf( '<div class="notice notice-error"><p>%1$s</p><p><a href="%2$s" class="button-primary">%3$s</a> <a href="%4$s" class="button-secondary">%5$s</a></p></div>',
|
95 |
+
__( '<strong>Welcome to WooCommerce Wishlist Plugin<strong> – You‘re almost ready to start :)', 'ti-woocommerce-wishlist' ), // @codingStandardsIgnoreLine WordPress.XSS.EscapeOutput.OutputNotEscaped
|
96 |
+
esc_url( admin_url( 'index.php?page=tinvwl-wizard' ) ),
|
97 |
+
esc_html__( 'Run the Setup Wizard', 'ti-woocommerce-wishlist' ),
|
98 |
+
esc_url( admin_url( 'index.php?page=' . $this->_n . '&' . $this->_n . '-wizard=skip' ) ),
|
99 |
+
esc_html__( 'Skip Setup', 'ti-woocommerce-wishlist' )
|
100 |
+
);
|
101 |
+
}
|
102 |
+
|
103 |
+
/**
|
104 |
+
* Error notice if wishlist page not set.
|
105 |
+
*/
|
106 |
+
function empty_page_admin_notice() {
|
107 |
+
printf( '<div class="notice notice-error is-dismissible" style="position: relative;"><p>%1$s <a href="%2$s">%3$s</a>%4$s<a href="%5$s">%6$s</a></p><button type="button" class="notice-dismiss"><span class="screen-reader-text">' . __( 'Dismiss' ) . '</span></button></div>', // @codingStandardsIgnoreLine WordPress.XSS.EscapeOutput.OutputNotEscaped
|
108 |
+
esc_html__( 'Link to Wishlists does not work!', 'ti-woocommerce-wishlist' ),
|
109 |
+
esc_url( $this->admin_url( '' ) . '#general' ),
|
110 |
+
esc_html__( 'Please apply the Wishlist page', 'ti-woocommerce-wishlist' ),
|
111 |
+
esc_html__( ' or ', 'ti-woocommerce-wishlist' ),
|
112 |
+
esc_url( admin_url( 'index.php?page=tinvwl-wizard' ) ),
|
113 |
+
esc_html__( 'Run the Setup Wizard', 'ti-woocommerce-wishlist' )
|
114 |
+
);
|
115 |
+
}
|
116 |
+
|
117 |
+
/**
|
118 |
+
* Creation mune and sub-menu
|
119 |
+
*/
|
120 |
+
function action_menu() {
|
121 |
+
$page = add_menu_page( 'TI Wishlist', 'TI Wishlist', 'manage_options', $this->_n, null, TINVWL_URL . 'asset/img/icon_menu.png', 56 );
|
122 |
+
add_action( "load-$page", array( $this, 'onload' ) );
|
123 |
+
$menu = apply_filters( $this->_n . '_admin_menu', array() );
|
124 |
+
foreach ( $menu as $item ) {
|
125 |
+
if ( ! array_key_exists( 'page_title', $item ) ) {
|
126 |
+
$item['page_title'] = $item['title'];
|
127 |
+
}
|
128 |
+
if ( ! array_key_exists( 'parent', $item ) ) {
|
129 |
+
$item['parent'] = $this->_n;
|
130 |
+
}
|
131 |
+
if ( ! array_key_exists( 'capability', $item ) ) {
|
132 |
+
$item['capability'] = 'manage_options';
|
133 |
+
}
|
134 |
+
$item['slug'] = implode( '-', array_filter( array( $this->_n, $item['slug'] ) ) );
|
135 |
+
|
136 |
+
$page = add_submenu_page( $item['parent'], $item['page_title'], $item['title'], $item['capability'], $item['slug'], $item['method'] );
|
137 |
+
add_action( "load-$page", array( $this, 'onload' ) );
|
138 |
+
}
|
139 |
+
}
|
140 |
+
|
141 |
+
/**
|
142 |
+
* Load style and javascript
|
143 |
+
*/
|
144 |
+
function onload() {
|
145 |
+
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_styles' ) );
|
146 |
+
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
|
147 |
+
add_filter( 'admin_footer_text', array( $this, 'footer_admin' ) );
|
148 |
+
add_filter( 'screen_options_show_screen', array( $this, 'screen_options_hide_screen' ), 10, 2 );
|
149 |
+
|
150 |
+
add_filter( $this->_n . '_view_panelstatus', array( $this, 'status_panel' ), 9999 );
|
151 |
+
}
|
152 |
+
|
153 |
+
/**
|
154 |
+
* Load style
|
155 |
+
*/
|
156 |
+
function enqueue_styles() {
|
157 |
+
wp_enqueue_style( 'gfonts', ( is_ssl() ? 'https' : 'http' ) . '://fonts.googleapis.com/css?family=Open+Sans:400,600,700,800', '', null, 'all' );
|
158 |
+
wp_enqueue_style( $this->_n, TINVWL_URL . 'asset/css/admin.css', array(), $this->_v, 'all' );
|
159 |
+
wp_enqueue_style( $this->_n . '-font-awesome', TINVWL_URL . 'asset/css/font-awesome.min.css', array(), $this->_v, 'all' );
|
160 |
+
wp_enqueue_style( $this->_n . '-form', TINVWL_URL . 'asset/css/admin-form.css', array(), $this->_v, 'all' );
|
161 |
+
}
|
162 |
+
|
163 |
+
/**
|
164 |
+
* Load javascript
|
165 |
+
*/
|
166 |
+
function enqueue_scripts() {
|
167 |
+
$suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
|
168 |
+
wp_enqueue_script( $this->_n . '-bootstrap', TINVWL_URL . 'asset/js/bootstrap' . $suffix . '.js', array( 'jquery' ), $this->_v, 'all' );
|
169 |
+
wp_register_script( $this->_n, TINVWL_URL . 'asset/js/admin' . $suffix . '.js', array(
|
170 |
+
'jquery',
|
171 |
+
'wp-color-picker'
|
172 |
+
), $this->_v, 'all' );
|
173 |
+
wp_localize_script( $this->_n, 'tinvwl_comfirm', array(
|
174 |
+
'text_comfirm_reset' => __( 'Are you sure you want to reset the settings?', 'ti-woocommerce-wishlist' ),
|
175 |
+
) );
|
176 |
+
wp_enqueue_script( $this->_n );
|
177 |
+
|
178 |
+
$user_id = get_current_user_id();
|
179 |
+
$user_info = get_userdata( $user_id );
|
180 |
+
|
181 |
+
wp_add_inline_script( $this->_n, 'window.intercomSettings = {
|
182 |
+
app_id: "zyh6v0pc",
|
183 |
+
email: "' . $user_info->user_email . '",
|
184 |
+
name: "' . $user_info->user_nicename . '",
|
185 |
+
"Website": "' . get_site_url() . '",
|
186 |
+
"Plugin name": "WooCommerce Wishlist Plugin",
|
187 |
+
"Plugin version":"' . TINVWL_FVERSION . '",
|
188 |
+
};
|
189 |
+
(function(){var w=window;var ic=w.Intercom;if(typeof ic==="function"){ic("reattach_activator");ic("update",intercomSettings);}else{var d=document;var i=function(){i.c(arguments)};i.q=[];i.c=function(args){i.q.push(args)};w.Intercom=i;function l(){var s=d.createElement("script");s.type="text/javascript";s.async=true;s.src="https://widget.intercom.io/widget/zyh6v0pc";var x=d.getElementsByTagName("script")[0];x.parentNode.insertBefore(s,x);}if(w.attachEvent){w.attachEvent("onload",l);}else{w.addEventListener("load",l,false);}}})()' );
|
190 |
+
}
|
191 |
+
|
192 |
+
/**
|
193 |
+
* Add plugin footer copywriting
|
194 |
+
*/
|
195 |
+
function footer_admin() {
|
196 |
+
do_action( 'tinvwl_admin_promo_footer' );
|
197 |
+
}
|
198 |
+
|
199 |
+
/**
|
200 |
+
* Promo in footer for wishlist
|
201 |
+
*/
|
202 |
+
function promo_footer() {
|
203 |
+
echo 'Made with <i class="fa fa-heart"></i> by <a href="https://templateinvaders.com/?utm_source=' . TINVWL_UTM_SOURCE . '&utm_campaign=' . TINVWL_UTM_CAMPAIGN . '&utm_medium=' . TINVWL_UTM_MEDIUM . '&utm_content=made_by&partner=' . TINVWL_UTM_SOURCE . '">TemplateInvaders</a><br />If you like WooCommerce Wishlist Plugin please leave us a <a href="https://wordpress.org/support/plugin/ti-woocommerce-wishlist/reviews/#new-post"><span><i class="fa fa-star"></i><i class="fa fa-star"></i><i class="fa fa-star"></i><i class="fa fa-star"></i><i class="fa fa-star"></i></span></a> rating.'; // WPCS: xss ok.
|
204 |
+
}
|
205 |
+
|
206 |
+
/**
|
207 |
+
* Create Upgrade button
|
208 |
+
*
|
209 |
+
* @param array $panel Panel Button.
|
210 |
+
*
|
211 |
+
* @return array
|
212 |
+
*/
|
213 |
+
function status_panel( $panel ) {
|
214 |
+
array_unshift( $panel, sprintf( '<a class="tinvwl-btn red w-icon smaller-txt" href="%s"><i class="fa fa-star"></i><span class="tinvwl-txt">%s</span></a>', 'https://templateinvaders.com/product/ti-woocommerce-wishlist-wordpress-plugin/?utm_source=' . TINVWL_UTM_SOURCE . '&utm_campaign=' . TINVWL_UTM_CAMPAIGN . '&utm_medium=' . TINVWL_UTM_MEDIUM . '&utm_content=header_upgrade&partner=' . TINVWL_UTM_SOURCE, __( 'Upgrade to Premium', 'ti-woocommerce-wishlist' ) ) );
|
215 |
+
|
216 |
+
return $panel;
|
217 |
+
}
|
218 |
+
|
219 |
+
/**
|
220 |
+
* Templates overriding status check.
|
221 |
+
*
|
222 |
+
* @param boolean $outdated Out date status.
|
223 |
+
*
|
224 |
+
* @return string
|
225 |
+
*/
|
226 |
+
function templates_status_check( $outdated = false ) {
|
227 |
+
|
228 |
+
$found_files = array();
|
229 |
+
|
230 |
+
$scanned_files = WC_Admin_Status::scan_template_files( TINVWL_PATH . '/templates/' );
|
231 |
+
|
232 |
+
foreach ( $scanned_files as $file ) {
|
233 |
+
if ( file_exists( get_stylesheet_directory() . '/' . $file ) ) {
|
234 |
+
$theme_file = get_stylesheet_directory() . '/' . $file;
|
235 |
+
} elseif ( file_exists( get_stylesheet_directory() . '/woocommerce/' . $file ) ) {
|
236 |
+
$theme_file = get_stylesheet_directory() . '/woocommerce/' . $file;
|
237 |
+
} elseif ( file_exists( get_template_directory() . '/' . $file ) ) {
|
238 |
+
$theme_file = get_template_directory() . '/' . $file;
|
239 |
+
} elseif ( file_exists( get_template_directory() . '/woocommerce/' . $file ) ) {
|
240 |
+
$theme_file = get_template_directory() . '/woocommerce/' . $file;
|
241 |
+
} else {
|
242 |
+
$theme_file = false;
|
243 |
+
}
|
244 |
+
|
245 |
+
if ( ! empty( $theme_file ) ) {
|
246 |
+
$core_version = WC_Admin_Status::get_file_version( TINVWL_PATH . '/templates/' . $file );
|
247 |
+
$theme_version = WC_Admin_Status::get_file_version( $theme_file );
|
248 |
+
|
249 |
+
if ( $core_version && ( empty( $theme_version ) || version_compare( $theme_version, $core_version, '<' ) ) ) {
|
250 |
+
if ( $outdated ) {
|
251 |
+
return 'outdated';
|
252 |
+
}
|
253 |
+
$found_files[] = sprintf( __( '<code>%1$s</code> version <strong style="color:red">%2$s</strong> is out of date. The core version is <strong style="color:red">%3$s</strong>', 'ti-woocommerce-wishlist' ), str_replace( WP_CONTENT_DIR . '/themes/', '', $theme_file ), $theme_version ? $theme_version : '-', $core_version );
|
254 |
+
} else {
|
255 |
+
$found_files[] = str_replace( WP_CONTENT_DIR . '/themes/', '', $theme_file );
|
256 |
+
}
|
257 |
+
}
|
258 |
+
}
|
259 |
+
|
260 |
+
return $found_files;
|
261 |
+
}
|
262 |
+
|
263 |
+
/**
|
264 |
+
* Templates overriding status for WooCommerce Status report page.
|
265 |
+
*/
|
266 |
+
function system_report_templates() {
|
267 |
+
|
268 |
+
TInvWL_View::view( 'templates-status', array( 'found_files' => $this->templates_status_check() ) );
|
269 |
+
}
|
270 |
+
|
271 |
+
/**
|
272 |
+
* Outdated templates notice.
|
273 |
+
*/
|
274 |
+
function admin_notice_outdated_templates() {
|
275 |
+
if ( 'outdated' === $this->templates_status_check( true ) ) {
|
276 |
+
|
277 |
+
$theme = wp_get_theme();
|
278 |
+
|
279 |
+
$html = sprintf( __( '<strong>Your theme (%1$s) contains outdated copies of some WooCommerce Wishlist Plugin template files.</strong><br> These files may need updating to ensure they are compatible with the current version of WooCommerce Wishlist Plugin.<br> You can see which files are affected from the <a href="%2$s">system status page</a>.<br> If in doubt, check with the author of the theme.', 'ti-woocommerce-wishlist' ), esc_html( $theme['Name'] ), esc_url( admin_url( 'admin.php?page=wc-status' ) ) );
|
280 |
+
|
281 |
+
WC_Admin_Notices::add_custom_notice( 'outdated_templates', $html );
|
282 |
+
} else {
|
283 |
+
WC_Admin_Notices::remove_notice( 'outdated_templates' );
|
284 |
+
}
|
285 |
+
}
|
286 |
+
|
287 |
+
/**
|
288 |
+
* Load javascript for validation templates
|
289 |
+
*/
|
290 |
+
function enqueue_scripts_validate_template() {
|
291 |
+
$theme = wp_get_theme();
|
292 |
+
$theme = $theme->get_template();
|
293 |
+
if ( tinv_get_option( 'template_checker', 'theme' ) !== $theme ) {
|
294 |
+
tinv_update_option( 'template_checker', '', array() );
|
295 |
+
tinv_update_option( 'template_checker', 'theme', $theme );
|
296 |
+
tinv_update_option( 'template_checker', 'checked', false );
|
297 |
+
tinv_update_option( 'template_checker', 'time', 0 );
|
298 |
+
}
|
299 |
+
if ( tinv_get_option( 'template_checker', 'checked' ) && absint( tinv_get_option( 'template_checker', 'time' ) ) + HOUR_IN_SECONDS > time() ) {
|
300 |
+
return;
|
301 |
+
}
|
302 |
+
$types = array_keys( wc_get_product_types() );
|
303 |
+
foreach ( $types as $type => $type_name ) {
|
304 |
+
if ( ! tinv_get_option( 'template_checker', 'missing_hook_' . $type ) ) {
|
305 |
+
$data = filter_input_array( INPUT_GET, array(
|
306 |
+
'wc-hide-notice' => FILTER_DEFAULT,
|
307 |
+
'_wc_notice_nonce' => FILTER_DEFAULT,
|
308 |
+
) );
|
309 |
+
if ( 'missing_hook_' . $type === $data['wc-hide-notice'] && wp_verify_nonce( $data['_wc_notice_nonce'], 'woocommerce_hide_notices_nonce' ) ) {
|
310 |
+
tinv_update_option( 'template_checker', 'missing_hook_' . $type, true );
|
311 |
+
}
|
312 |
+
}
|
313 |
+
}
|
314 |
+
if ( ! tinv_get_option( 'template_checker', 'hide_product_listing' ) ) {
|
315 |
+
$data = filter_input_array( INPUT_GET, array(
|
316 |
+
'wc-hide-notice' => FILTER_DEFAULT,
|
317 |
+
'_wc_notice_nonce' => FILTER_DEFAULT,
|
318 |
+
) );
|
319 |
+
if ( 'missing_hook_listing' === $data['wc-hide-notice'] && wp_verify_nonce( $data['_wc_notice_nonce'], 'woocommerce_hide_notices_nonce' ) ) {
|
320 |
+
tinv_update_option( 'template_checker', 'hide_product_listing', true );
|
321 |
+
}
|
322 |
+
}
|
323 |
+
|
324 |
+
wp_enqueue_script( $this->_n . '-checker', TINVWL_URL . 'asset/js/admin.checker.min.js', array( 'jquery' ), $this->_v, 'all' );
|
325 |
+
}
|
326 |
+
|
327 |
+
/**
|
328 |
+
* Validation templates hook from request remote page
|
329 |
+
*/
|
330 |
+
function validation_template() {
|
331 |
+
global $post, $product;
|
332 |
+
|
333 |
+
if ( tinv_get_option( 'template_checker', 'checked' ) ) {
|
334 |
+
return;
|
335 |
+
}
|
336 |
+
if ( absint( tinv_get_option( 'template_checker', 'time' ) ) + HOUR_IN_SECONDS > time() ) {
|
337 |
+
return;
|
338 |
+
}
|
339 |
+
tinv_update_option( 'template_checker', 'time', time() );
|
340 |
+
$tags = array(
|
341 |
+
'woocommerce_single_product_summary' => 'tinvwl_single_product_summary',
|
342 |
+
'woocommerce_before_add_to_cart_button' => 'tinvwl_before_add_to_cart_button',
|
343 |
+
'woocommerce_after_add_to_cart_button' => 'tinvwl_after_add_to_cart_button',
|
344 |
+
);
|
345 |
+
$tch = TInvWL_CheckerHook::instance();
|
346 |
+
$tch->add_action( $tags );
|
347 |
+
$tch->add_action( array_keys( $tags ) );
|
348 |
+
|
349 |
+
$types = wc_get_product_types();
|
350 |
+
|
351 |
+
$check = true;
|
352 |
+
foreach ( $types as $type => $type_name ) {
|
353 |
+
if ( tinv_get_option( 'template_checker', 'missing_hook_' . $type ) ) {
|
354 |
+
continue;
|
355 |
+
}
|
356 |
+
|
357 |
+
if ( function_exists( 'wc_get_products' ) ) {
|
358 |
+
$products = wc_get_products( array(
|
359 |
+
'status' => 'publish',
|
360 |
+
'type' => $type,
|
361 |
+
'limit' => 1,
|
362 |
+
) );
|
363 |
+
} else {
|
364 |
+
$products = array_map( 'wc_get_product', get_posts( array(
|
365 |
+
'post_type' => 'product',
|
366 |
+
'post_status' => 'publish',
|
367 |
+
'numberposts' => 1,
|
368 |
+
'tax_query' => array(
|
369 |
+
array(
|
370 |
+
'taxonomy' => 'product_type',
|
371 |
+
'field' => 'slug',
|
372 |
+
'terms' => $type,
|
373 |
+
),
|
374 |
+
),
|
375 |
+
) ) );
|
376 |
+
}
|
377 |
+
if ( ! empty( $products ) ) {
|
378 |
+
$product = array_shift( $products );
|
379 |
+
$post = get_post( $product->get_id() ); // @codingStandardsIgnoreLine WordPress.Variables.GlobalVariables.OverrideProhibited
|
380 |
+
$result = $tch->run( array(
|
381 |
+
'template' => array(
|
382 |
+
'content-single-product.php',
|
383 |
+
'single-product/add-to-cart/' . $type . '.php'
|
384 |
+
),
|
385 |
+
'template_args' => array(
|
386 |
+
'available_variations' => array( 1, 2, 3, 4, 5 ),
|
387 |
+
'attributes' => array(),
|
388 |
+
),
|
389 |
+
'url' => $product->get_permalink(),
|
390 |
+
) );
|
391 |
+
if ( ! empty( $result ) ) {
|
392 |
+
$result = array_keys( $result );
|
393 |
+
foreach ( $result as $key => $tag ) {
|
394 |
+
if ( array_key_exists( $tag, $tags ) ) {
|
395 |
+
$tags[ $tag ];
|
396 |
+
if ( ! array_key_exists( $tag, $tags ) ) {
|
397 |
+
unset( $result[ $key ] );
|
398 |
+
}
|
399 |
+
} else {
|
400 |
+
unset( $result[ $key ] );
|
401 |
+
}
|
402 |
+
}
|
403 |
+
if ( ! empty( $result ) ) {
|
404 |
+
WC_Admin_Notices::add_custom_notice( 'missing_hook_' . $type, sprintf( _n( 'The "Add to Wishlist" button may work improperly in a product type "%1$s" because the hook "%2$s" is missing.<br />Please, ask your theme developers to check the theme templates or <a href="https://templateinvaders.com/help/" target="_blank">contact us</a> for assistance.', 'The "Add to Wishlist" button may work improperly in a product type "%1$s" because the hooks "%2$s" are missing.<br />Please, ask your theme developers to check the theme templates or <a href="https://templateinvaders.com/help/" target="_blank">contact us</a> for assistance.', count( $result ), 'ti-woocommerce-wishlist' ), $type_name, '<strong>' . join( '</strong>, <strong>', $result ) . '</strong>' ) );
|
405 |
+
$check = false;
|
406 |
+
} else {
|
407 |
+
WC_Admin_Notices::remove_notice( 'missing_hook_' . $type );
|
408 |
+
}
|
409 |
+
} else {
|
410 |
+
WC_Admin_Notices::remove_notice( 'missing_hook_' . $type );
|
411 |
+
}
|
412 |
+
}
|
413 |
+
} // End foreach().
|
414 |
+
|
415 |
+
tinv_update_option( 'template_checker', 'checked', $check );
|
416 |
+
wp_die();
|
417 |
+
}
|
418 |
+
|
419 |
+
/**
|
420 |
+
* Clear notice validation template when theme switched
|
421 |
+
*/
|
422 |
+
function clear_notice_validation_template() {
|
423 |
+
WC_Admin_Notices::remove_notice( 'missing_hook_listing' );
|
424 |
+
$types = wc_get_product_types();
|
425 |
+
foreach ( $types as $type => $type_name ) {
|
426 |
+
WC_Admin_Notices::remove_notice( 'missing_hook_' . $type );
|
427 |
+
}
|
428 |
+
tinv_update_option( 'template_checker', '', array() );
|
429 |
+
}
|
430 |
+
|
431 |
+
/**
|
432 |
+
* Disable screen option on plugin pages
|
433 |
+
*
|
434 |
+
* @param boolean $show_screen Show screen.
|
435 |
+
* @param \WP_Screen $_this Screen option page.
|
436 |
+
*
|
437 |
+
* @return boolean
|
438 |
+
*/
|
439 |
+
function screen_options_hide_screen( $show_screen, $_this ) {
|
440 |
+
if ( $this->_n === $_this->parent_base || $this->_n === $_this->parent_file ) {
|
441 |
+
return false;
|
442 |
+
}
|
443 |
+
|
444 |
+
return $show_screen;
|
445 |
+
}
|
446 |
+
|
447 |
+
/**
|
448 |
+
* Check if there is a hook in the cron
|
449 |
+
*/
|
450 |
+
function scheduled_remove_wishlist() {
|
451 |
+
$timestamp = wp_next_scheduled( 'tinvwl_remove_without_author_wishlist' );
|
452 |
+
if ( ! $timestamp ) {
|
453 |
+
$time = strtotime( '00:00 today +1 HOURS' );
|
454 |
+
wp_schedule_event( $time, 'daily', 'tinvwl_remove_without_author_wishlist' );
|
455 |
+
}
|
456 |
+
}
|
457 |
+
|
458 |
+
/**
|
459 |
+
* Removing old wishlist without a user older than 34 days
|
460 |
+
*/
|
461 |
+
public function remove_old_wishlists() {
|
462 |
+
$wl = new TInvWL_Wishlist();
|
463 |
+
$wishlists = $wl->get( array(
|
464 |
+
'author' => 0,
|
465 |
+
'type' => 'default',
|
466 |
+
'sql' => 'SELECT * FROM {table} {where} AND `date` < DATE_SUB( CURDATE(), INTERVAL 34 DAY)',
|
467 |
+
) );
|
468 |
+
foreach ( $wishlists as $wishlist ) {
|
469 |
+
$wl->remove( $wishlist['ID'] );
|
470 |
+
}
|
471 |
+
}
|
472 |
+
|
473 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
asset/js/admin.js
CHANGED
@@ -1,335 +1,350 @@
|
|
1 |
-
function TInvWL(
|
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 |
} else {
|
49 |
-
|
|
|
|
|
50 |
}
|
51 |
-
$( this ).css( 'background-color', ui.color.toCSS() );
|
52 |
-
}
|
53 |
-
} );
|
54 |
-
pickerWrap.on( 'click', '.iris-square-value', function ( e ) {
|
55 |
-
e.preventDefault();
|
56 |
-
picker.iris( 'toggle' );
|
57 |
-
} );
|
58 |
-
eyedropper.on( 'click', function ( e ) {
|
59 |
-
e.preventDefault();
|
60 |
-
picker.iris( 'show' );
|
61 |
-
} );
|
62 |
-
picker.on( 'focusin', function () {
|
63 |
-
picker.iris( 'show' );
|
64 |
-
} );
|
65 |
-
} );
|
66 |
-
$( document ).on( 'click', function ( e ) {
|
67 |
-
if ( !$( e.target ).is( formColor + ', .iris-picker, .iris-picker-inner, .iris-slider-offset, .tinvwl-eyedropper, .tinvwl-eyedropper .fa-eyedropper' ) ) {
|
68 |
-
$( formColor ).iris( 'hide' );
|
69 |
-
} else {
|
70 |
-
$( formColor ).not( $( e.target ).closest( '.tinvwl-color-picker' ).find( formColor ) ).iris( 'hide' );
|
71 |
}
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
d = b.find( this._csel( '-error-icon' ) ),
|
84 |
-
e = b.find( this._csel( '-error-desc' ) );
|
85 |
-
if ( '' === a.val() ) {
|
86 |
-
if ( 0 == c ) {
|
87 |
-
b.addClass( 'tinvwl-error' );
|
88 |
-
d.show();
|
89 |
-
e.show();
|
90 |
-
}
|
91 |
-
return;
|
92 |
-
}
|
93 |
-
b.removeClass( 'tinvwl-error' );
|
94 |
-
d.hide();
|
95 |
-
e.hide();
|
96 |
-
};
|
97 |
-
this.pageElm = function () {
|
98 |
-
$( this._csel( '-header', 'div.' ) ).prependTo( '#wpbody-content' );
|
99 |
-
$( this._csel( '-page-select' ) ).each( this._wizard_page );
|
100 |
-
$( '.bulkactions [type=submit]' ).each( this._control_bulkactions );
|
101 |
-
$( '.action-search [type=submit]' ).each( this._control_search );
|
102 |
-
};
|
103 |
-
this.control_bulkactions = function ( a ) {
|
104 |
-
$( a ).on( 'click', this._control_bulkactions_ck );
|
105 |
-
};
|
106 |
-
this.control_bulkactions_ck = function ( a, b ) {
|
107 |
-
var a = $( a ),
|
108 |
-
c = a.parents( '.bulkactions' ).eq( 0 ).find( '[name=action]' ),
|
109 |
-
d = a.parents( 'form' ).eq( 0 );
|
110 |
-
if ( c ) {
|
111 |
-
if ( '-1' === c.val() ) {
|
112 |
-
b.preventDefault();
|
113 |
-
} else {
|
114 |
-
if ( !d.find( 'input[type=checkbox]:checked' ).length ) {
|
115 |
-
b.preventDefault();
|
116 |
}
|
117 |
-
}
|
118 |
-
}
|
119 |
-
};
|
120 |
-
this.control_search = function ( a ) {
|
121 |
-
$( a ).on( 'click', this._control_search_ck );
|
122 |
-
};
|
123 |
-
this.control_search_ck = function ( a, b ) {
|
124 |
-
var a = $( a ),
|
125 |
-
c = a.parents( '.action-search' ).eq( 0 ).find( '[name=s]' );
|
126 |
-
if ( c ) {
|
127 |
-
if ( '' === c.val() ) {
|
128 |
-
b.preventDefault();
|
129 |
-
}
|
130 |
-
}
|
131 |
-
};
|
132 |
-
this.Run = function () {
|
133 |
-
this.formElm();
|
134 |
-
this.pageElm();
|
135 |
-
};
|
136 |
-
this.cg = function () {
|
137 |
-
var n = this.n;
|
138 |
-
if ( this.ho ) {
|
139 |
-
var t = new Date();
|
140 |
-
n = n + t.getFullYear() + t.getMonth() + t.getDate();
|
141 |
-
}
|
142 |
-
window[n] = this;
|
143 |
-
};
|
144 |
-
this.cg();
|
145 |
-
if ( !String.prototype.format ) {
|
146 |
-
String.prototype.format = function () {
|
147 |
-
var args = arguments;
|
148 |
-
return this.replace( /{(\d+)}/g, function ( match, number ) {
|
149 |
-
return typeof args[number] !== 'undefined' ? args[number] : match;
|
150 |
-
} );
|
151 |
};
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
164 |
}
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
on: '',
|
172 |
-
off: ''
|
173 |
-
},
|
174 |
-
class: 'tiwlform-onoff',
|
175 |
-
wrap: 'container',
|
176 |
-
button: 'button'
|
177 |
-
},
|
178 |
-
s = $.extend( true, { }, sd, so );
|
179 |
-
return $( this ).each( function () {
|
180 |
-
var a = $( this ),
|
181 |
-
b1 = $( '<div>' ).attr( {
|
182 |
-
class: s.class + '-' + s.button
|
183 |
-
} ),
|
184 |
-
d1c = s.class + '-' + s.wrap,
|
185 |
-
d1 = $( '<div>' ).attr( {
|
186 |
-
id: a.attr( 'id' ) + '_' + s.wrap,
|
187 |
-
class: d1c
|
188 |
-
} );
|
189 |
-
if ( !a.is( 'input' ) ) {
|
190 |
-
return a;
|
191 |
-
}
|
192 |
-
d1.attr( 'class', ( d1.attr( 'class' ) + ' ' + a.attr( 'class' ) ) );
|
193 |
-
d1.toggleClass( 'disabled', a.is( ':disabled' ) );
|
194 |
-
d1.toggleClass( 'checked', a.is( ':checked' ) );
|
195 |
-
a.attr( 'type', 'checkbox' ).hide().removeAttr( 'class' ).wrap( d1 ).before( b1 );
|
196 |
-
d1 = a.parent();
|
197 |
-
a.on( 'change', function () {
|
198 |
-
d1.toggleClass( 'checked', $( this ).is( ':checked' ) );
|
199 |
-
d1.toggleClass( 'disabled', $( this ).is( ':disabled' ) );
|
200 |
-
} );
|
201 |
-
d1.on( 'click', function () {
|
202 |
-
if ( a.is( ':enabled' ) && d1.hasClass( 'checked' ) === a.is( ':checked' ) ) {
|
203 |
-
a.click();
|
204 |
}
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
230 |
};
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
} );
|
267 |
};
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
};
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
315 |
}
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
} );
|
326 |
-
}
|
327 |
-
$( 'body' ).on( 'click', '.tinvwl-confirm-reset', function ( e ) {
|
328 |
-
e.preventDefault();
|
329 |
-
var a = confirm( tinvwl_comfirm.text_comfirm_reset );
|
330 |
-
if ( a ) {
|
331 |
-
$( this ).removeClass('tinvwl-confirm-reset').trigger( 'click' );
|
332 |
-
}
|
333 |
-
} );
|
334 |
-
} );
|
335 |
-
} )( jQuery );
|
1 |
+
function TInvWL($, h) {
|
2 |
+
this.pf = 'tinvwl';
|
3 |
+
this.g = '_';
|
4 |
+
this.ho = h || false;
|
5 |
+
this.n = 'TInvWL';
|
6 |
+
this.aj_act = function (a) {
|
7 |
+
return [this.pf, a].join(this.g);
|
8 |
+
};
|
9 |
+
this._csel = function (a, b) {
|
10 |
+
var b = b || '.';
|
11 |
+
return '{0}{1}{2}'.format(b, this.pf, a);
|
12 |
+
};
|
13 |
+
this._tm = function (a) {
|
14 |
+
var c = $("script#{0}[type='text/template']".format(a));
|
15 |
+
if (c.length) {
|
16 |
+
return c.html();
|
17 |
+
}
|
18 |
+
return '';
|
19 |
+
};
|
20 |
+
this.formElm = function () {
|
21 |
+
$(this._csel("-form-onoff")).tiwl_onoff();
|
22 |
+
$('input[type=checkbox][tiwl-show], input[type=checkbox][tiwl-hide]').tiwl_onoffblock();
|
23 |
+
$('[tiwl-value][tiwl-show], [tiwl-value][tiwl-hide]').tiwl_byvalueblock();
|
24 |
+
if (typeof($.fn.wpColorPicker) !== 'undefined') {
|
25 |
+
var calcLuminance = function (rgb) {
|
26 |
+
var c = rgb.substring(1);
|
27 |
+
var _rgb = parseInt(c, 16);
|
28 |
+
var r = (_rgb >> 16) & 0xff;
|
29 |
+
var g = (_rgb >> 8) & 0xff;
|
30 |
+
var b = (_rgb >> 0) & 0xff;
|
31 |
+
return 0.2126 * r + 0.7152 * g + 0.0722 * b;
|
32 |
+
};
|
33 |
+
var formColor = this._csel("-form-color");
|
34 |
+
$(formColor).each(function () {
|
35 |
+
var picker = $(this);
|
36 |
+
var pickerWrap = $(this).closest('.tinvwl-color-picker');
|
37 |
+
var eyedropper = pickerWrap.find('.tinvwl-eyedropper');
|
38 |
+
picker.css('background-color', picker.val());
|
39 |
+
if (calcLuminance(picker.val()) > 175) {
|
40 |
+
picker.css('color', '#000000');
|
41 |
+
}
|
42 |
+
picker.iris({
|
43 |
+
mode: 'hsv',
|
44 |
+
target: $(this).parent().parent(),
|
45 |
+
change: function (event, ui) {
|
46 |
+
if (calcLuminance(ui.color.toCSS()) > 175) {
|
47 |
+
$(this).css('color', '#000000');
|
48 |
+
} else {
|
49 |
+
$(this).css('color', '');
|
50 |
+
}
|
51 |
+
$(this).css('background-color', ui.color.toCSS());
|
52 |
+
}
|
53 |
+
});
|
54 |
+
pickerWrap.on('click', '.iris-square-value', function (e) {
|
55 |
+
e.preventDefault();
|
56 |
+
picker.iris('toggle');
|
57 |
+
});
|
58 |
+
eyedropper.on('click', function (e) {
|
59 |
+
e.preventDefault();
|
60 |
+
picker.iris('show');
|
61 |
+
});
|
62 |
+
picker.on('focusin', function () {
|
63 |
+
picker.iris('show');
|
64 |
+
});
|
65 |
+
});
|
66 |
+
$(document).on('click', function (e) {
|
67 |
+
if (!$(e.target).is(formColor + ', .iris-picker, .iris-picker-inner, .iris-slider-offset, .tinvwl-eyedropper, .tinvwl-eyedropper .fa-eyedropper')) {
|
68 |
+
$(formColor).iris('hide');
|
69 |
+
} else {
|
70 |
+
$(formColor).not($(e.target).closest('.tinvwl-color-picker').find(formColor)).iris('hide');
|
71 |
+
}
|
72 |
+
});
|
73 |
}
|
74 |
+
};
|
75 |
+
this.wizard_page = function (a) {
|
76 |
+
$(a).find('select').change(this._wizard_page_ch);
|
77 |
+
this.wizard_page_ch($(a).find('select'));
|
78 |
+
};
|
79 |
+
this.wizard_page_ch = function (a) {
|
80 |
+
var a = $(a),
|
81 |
+
b = a.parent(this._csel('-page-select')),
|
82 |
+
c = b.find('input[type=hidden]').val(),
|
83 |
+
d = b.find(this._csel('-error-icon')),
|
84 |
+
e = b.find(this._csel('-error-desc'));
|
85 |
+
if ('' === a.val()) {
|
86 |
+
if (0 == c) {
|
87 |
+
b.addClass('tinvwl-error');
|
88 |
+
d.show();
|
89 |
+
e.show();
|
90 |
+
}
|
91 |
+
return;
|
92 |
+
}
|
93 |
+
b.removeClass('tinvwl-error');
|
94 |
+
d.hide();
|
95 |
+
e.hide();
|
96 |
+
};
|
97 |
+
this.pageElm = function () {
|
98 |
+
$(this._csel('-header', 'div.')).prependTo('#wpbody-content');
|
99 |
+
$(this._csel('-page-select')).each(this._wizard_page);
|
100 |
+
$('.bulkactions [type=submit]').each(this._control_bulkactions);
|
101 |
+
$('.action-search [type=submit]').each(this._control_search);
|
102 |
+
};
|
103 |
+
this.control_bulkactions = function (a) {
|
104 |
+
$(a).on('click', this._control_bulkactions_ck);
|
105 |
+
};
|
106 |
+
this.control_bulkactions_ck = function (a, b) {
|
107 |
+
var a = $(a),
|
108 |
+
c = a.parents('.bulkactions').eq(0).find('[name=action]'),
|
109 |
+
d = a.parents('form').eq(0);
|
110 |
+
if (c) {
|
111 |
+
if ('-1' === c.val()) {
|
112 |
+
b.preventDefault();
|
113 |
} else {
|
114 |
+
if (!d.find('input[type=checkbox]:checked').length) {
|
115 |
+
b.preventDefault();
|
116 |
+
}
|
117 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
118 |
}
|
119 |
+
};
|
120 |
+
this.control_search = function (a) {
|
121 |
+
$(a).on('click', this._control_search_ck);
|
122 |
+
};
|
123 |
+
this.control_search_ck = function (a, b) {
|
124 |
+
var a = $(a),
|
125 |
+
c = a.parents('.action-search').eq(0).find('[name=s]');
|
126 |
+
if (c) {
|
127 |
+
if ('' === c.val()) {
|
128 |
+
b.preventDefault();
|
129 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
130 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
131 |
};
|
132 |
+
this.Run = function () {
|
133 |
+
this.formElm();
|
134 |
+
this.pageElm();
|
135 |
+
};
|
136 |
+
this.cg = function () {
|
137 |
+
var n = this.n;
|
138 |
+
if (this.ho) {
|
139 |
+
var t = new Date();
|
140 |
+
n = n + t.getFullYear() + t.getMonth() + t.getDate();
|
141 |
+
}
|
142 |
+
window[n] = this;
|
143 |
+
};
|
144 |
+
this.cg();
|
145 |
+
if (!String.prototype.format) {
|
146 |
+
String.prototype.format = function () {
|
147 |
+
var args = arguments;
|
148 |
+
return this.replace(/{(\d+)}/g, function (match, number) {
|
149 |
+
return typeof args[number] !== 'undefined' ? args[number] : match;
|
150 |
+
});
|
151 |
+
};
|
152 |
}
|
153 |
+
(function (o) {
|
154 |
+
var n = o.n,
|
155 |
+
ho = o.ho,
|
156 |
+
c = '';
|
157 |
+
if (ho) {
|
158 |
+
c = 't=new Date(),n=n+t.getFullYear()+t.getMonth()+t.getDate(),';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
159 |
}
|
160 |
+
for (var i in o) {
|
161 |
+
if ('function' === typeof o[i] && '_' !== i[0] && !o.hasOwnProperty('_' + i)) {
|
162 |
+
eval("o._" + i + "=function(a,b,c,d){var n='" + n + "'," + c + "o=window[n]||null;if (o) {return o." + i + "(this,a,b,c,d);};};");
|
163 |
+
}
|
164 |
+
}
|
165 |
+
})(this);
|
166 |
+
}
|
167 |
+
(function ($) {
|
168 |
+
$.fn.tiwl_onoff = function (so) {
|
169 |
+
var sd = {
|
170 |
+
value: {
|
171 |
+
on: '',
|
172 |
+
off: ''
|
173 |
+
},
|
174 |
+
class: 'tiwlform-onoff',
|
175 |
+
wrap: 'container',
|
176 |
+
button: 'button'
|
177 |
+
},
|
178 |
+
s = $.extend(true, {}, sd, so);
|
179 |
+
return $(this).each(function () {
|
180 |
+
var a = $(this),
|
181 |
+
b1 = $('<div>').attr({
|
182 |
+
class: s.class + '-' + s.button
|
183 |
+
}),
|
184 |
+
d1c = s.class + '-' + s.wrap,
|
185 |
+
d1 = $('<div>').attr({
|
186 |
+
id: a.attr('id') + '_' + s.wrap,
|
187 |
+
class: d1c
|
188 |
+
});
|
189 |
+
if (!a.is('input')) {
|
190 |
+
return a;
|
191 |
+
}
|
192 |
+
d1.attr('class', (d1.attr('class') + ' ' + a.attr('class')));
|
193 |
+
if (a.is(':disabled')) {
|
194 |
+
d1.toggleClass('disabled', a.is(':disabled'));
|
195 |
+
a.prop('disabled', false);
|
196 |
+
}
|
197 |
+
d1.toggleClass('checked', a.is(':checked'));
|
198 |
+
a.attr('type', 'checkbox').hide().removeAttr('class').wrap(d1).before(b1);
|
199 |
+
d1 = a.parent();
|
200 |
+
a.on('change', function (e) {
|
201 |
+
if (d1.hasClass('disabled')) {
|
202 |
+
return e.preventDefault();
|
203 |
+
}
|
204 |
+
d1.toggleClass('checked', $(this).is(':checked'));
|
205 |
+
});
|
206 |
+
d1.on('click', function (e) {
|
207 |
+
if (d1.hasClass('disabled')) {
|
208 |
+
return e.preventDefault();
|
209 |
+
}
|
210 |
+
if (a.is(':enabled') && d1.hasClass('checked') === a.is(':checked')) {
|
211 |
+
a.click();
|
212 |
+
}
|
213 |
+
});
|
214 |
+
return a;
|
215 |
+
});
|
216 |
+
};
|
217 |
+
$.fn.tiwl_onoffblock = function (so) {
|
218 |
+
var sd = {
|
219 |
+
onEachElm: function () {},
|
220 |
+
isChecked: function () {
|
221 |
+
return $(this).is(':checked')
|
222 |
+
}
|
223 |
+
},
|
224 |
+
s = $.extend(true, {}, sd, so);
|
225 |
+
return $(this).each(function () {
|
226 |
+
var a = $(this),
|
227 |
+
setAction = function () {
|
228 |
+
var o = $(this),
|
229 |
+
o_show = o.attr('tiwl-show'),
|
230 |
+
o_hide = o.attr('tiwl-hide'),
|
231 |
+
o_ch = s.isChecked.call(o),
|
232 |
+
doAction = function (o_, on) {
|
233 |
+
o_ = o_.match(/[\w\d-\>\.\#\:\=\[\]]+/igm) || [];
|
234 |
+
$.each(o_, function (k, v) {
|
235 |
+
s.onEachElm.call($(v).toggle(on));
|
236 |
+
});
|
237 |
+
};
|
238 |
+
if ('string' === typeof o_show) {
|
239 |
+
doAction(o_show, o_ch);
|
240 |
+
}
|
241 |
+
if ('string' === typeof o_hide) {
|
242 |
+
doAction(o_hide, !o_ch);
|
243 |
+
}
|
244 |
+
return o;
|
245 |
};
|
246 |
+
if (!a.is('input') || 'checkbox' != a.attr('type')) {
|
247 |
+
return a;
|
248 |
+
}
|
249 |
+
$(this).on('change', setAction);
|
250 |
+
return setAction.call(a);
|
251 |
+
});
|
252 |
+
};
|
253 |
+
$.fn.tiwl_byvalueblock = function (so) {
|
254 |
+
var sd = {
|
255 |
+
onEachElm: function () {},
|
256 |
+
onClick: function () {
|
257 |
+
return $(this).val() == $(this).attr('tiwl-value');
|
258 |
+
}
|
259 |
+
},
|
260 |
+
s = $.extend(true, {}, sd, so);
|
261 |
+
return $(this).each(function () {
|
262 |
+
var a = $(this),
|
263 |
+
setAction = function (s) {
|
264 |
+
var o = $(this),
|
265 |
+
o_show = o.attr('tiwl-show'),
|
266 |
+
o_hide = o.attr('tiwl-hide'),
|
267 |
+
o_ch = s.onClick.call(o),
|
268 |
+
doAction = function (o_, on) {
|
269 |
+
o_ = o_.match(/[\w\d-\>\.\#\:\=\[\]]+/igm) || [];
|
270 |
+
$.each(o_, function (k, v) {
|
271 |
+
s.onEachElm.call($(v).toggle(on));
|
272 |
+
});
|
273 |
+
};
|
274 |
+
if ('string' === typeof o_show) {
|
275 |
+
doAction(o_show, o_ch);
|
276 |
+
}
|
277 |
+
if ('string' === typeof o_hide) {
|
278 |
+
doAction(o_hide, !o_ch);
|
279 |
+
}
|
280 |
+
return o;
|
|
|
281 |
};
|
282 |
+
if (!a.is('input') && !a.is('select')) {
|
283 |
+
return a;
|
284 |
+
}
|
285 |
+
$(this).on('change', function () {
|
286 |
+
setAction.call(this, s);
|
287 |
+
});
|
288 |
+
return setAction.call(a, s);
|
289 |
+
});
|
290 |
+
};
|
291 |
+
var a = new TInvWL($);
|
292 |
+
$(document).ready(function () {
|
293 |
+
a.Run();
|
294 |
+
jQuery('input[name="general-show_notice"]').change(function () {
|
295 |
+
var o = jQuery(this),
|
296 |
+
a = !o.is(':checked'),
|
297 |
+
b = jQuery('input[name="general-redirect_require_login"]');
|
298 |
+
if (a && !b.is(':checked')) {
|
299 |
+
b.click().trigger('change');
|
300 |
+
}
|
301 |
+
b.closest('.tiwlform-onoff-container').toggleClass('disabled', a);
|
302 |
+
}).change();
|
303 |
+
$('.tablenav').each(function () {
|
304 |
+
var tablenav = $(this);
|
305 |
+
if (!$.trim(tablenav.find('.alignleft').html()).length) {
|
306 |
+
tablenav.find('.alignleft').remove();
|
307 |
+
}
|
308 |
+
if (!$.trim(tablenav.find('.alignright').html()).length || tablenav.find('.tablenav-pages').hasClass('one-page')) {
|
309 |
+
tablenav.find('.alignright').remove();
|
310 |
+
tablenav.find('.tinv-wishlist-clear').remove();
|
311 |
+
}
|
312 |
+
if (!$.trim(tablenav.html()).length) {
|
313 |
+
tablenav.remove();
|
314 |
+
}
|
315 |
+
});
|
316 |
+
$('.tablenav .bulkactions select').addClass('tinvwl-select grey').wrap('<span class="tinvwl-select-wrap">').parent().append('<span class="tinvwl-caret"><span></span></span>');
|
317 |
+
$('.tablenav .bulkactions .button.action, .tablenav #search-submit').removeClass('button').addClass('tinvwl-btn grey');
|
318 |
+
$('.tinvwl-modal-btn').on('click', function () {
|
319 |
+
$(this).next('.tinvwl-modal').addClass('tinvwl-modal-open');
|
320 |
+
});
|
321 |
+
$('.tinvwl-overlay, .tinvwl-close-modal, .tinvwl_button_close').on('click', function (e) {
|
322 |
+
e.preventDefault();
|
323 |
+
$(this).parents('.tinvwl-modal:first').removeClass('tinvwl-modal-open');
|
324 |
+
});
|
325 |
+
if (typeof($.fn.popover) !== 'undefined') {
|
326 |
+
var popover = $('.tinvwl-help');
|
327 |
+
popover.popover({
|
328 |
+
content: function () {
|
329 |
+
return $(this).closest('.tinvwl-info-wrap').find('.tinvwl-info-desc').html();
|
330 |
+
}
|
331 |
+
});
|
332 |
+
popover.on('click', function () {
|
333 |
+
$(this).popover('toggle');
|
334 |
+
});
|
335 |
+
popover.on('focusout', function () {
|
336 |
+
$(this).popover('hide');
|
337 |
+
});
|
338 |
+
$(window).on('resize', function () {
|
339 |
+
popover.popover('hide');
|
340 |
+
});
|
341 |
}
|
342 |
+
$('body').on('click', '.tinvwl-confirm-reset', function (e) {
|
343 |
+
e.preventDefault();
|
344 |
+
var a = confirm(tinvwl_comfirm.text_comfirm_reset);
|
345 |
+
if (a) {
|
346 |
+
$(this).removeClass('tinvwl-confirm-reset').trigger('click');
|
347 |
+
}
|
348 |
+
});
|
349 |
+
});
|
350 |
+
})(jQuery);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
asset/js/admin.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
function TInvWL($,h){this.pf='tinvwl';this.g='_';this.ho=h||false;this.n='TInvWL';this.aj_act=function(a){return[this.pf,a].join(this.g);};this._csel=function(a,b){var b=b||'.';return'{0}{1}{2}'.format(b,this.pf,a);};this._tm=function(a){var c=$("script#{0}[type='text/template']".format(a));if(c.length){return c.html();} return'';};this.formElm=function(){$(this._csel("-form-onoff")).tiwl_onoff();$('input[type=checkbox][tiwl-show], input[type=checkbox][tiwl-hide]').tiwl_onoffblock();$('[tiwl-value][tiwl-show], [tiwl-value][tiwl-hide]').tiwl_byvalueblock();if(typeof($.fn.wpColorPicker)!=='undefined'){var calcLuminance=function(rgb){var c=rgb.substring(1);var _rgb=parseInt(c,16);var r=(_rgb>>16)&0xff;var g=(_rgb>>8)&0xff;var b=(_rgb>>0)&0xff;return 0.2126*r+0.7152*g+0.0722*b;};var formColor=this._csel("-form-color");$(formColor).each(function(){var picker=$(this);var pickerWrap=$(this).closest('.tinvwl-color-picker');var eyedropper=pickerWrap.find('.tinvwl-eyedropper');picker.css('background-color',picker.val());if(calcLuminance(picker.val())>175){picker.css('color','#000000');} picker.iris({mode:'hsv',target:$(this).parent().parent(),change:function(event,ui){if(calcLuminance(ui.color.toCSS())>175){$(this).css('color','#000000');}else{$(this).css('color','');} $(this).css('background-color',ui.color.toCSS());}});pickerWrap.on('click','.iris-square-value',function(e){e.preventDefault();picker.iris('toggle');});eyedropper.on('click',function(e){e.preventDefault();picker.iris('show');});picker.on('focusin',function(){picker.iris('show');});});$(document).on('click',function(e){if(!$(e.target).is(formColor+', .iris-picker, .iris-picker-inner, .iris-slider-offset, .tinvwl-eyedropper, .tinvwl-eyedropper .fa-eyedropper')){$(formColor).iris('hide');}else{$(formColor).not($(e.target).closest('.tinvwl-color-picker').find(formColor)).iris('hide');}});}};this.wizard_page=function(a){$(a).find('select').change(this._wizard_page_ch);this.wizard_page_ch($(a).find('select'));};this.wizard_page_ch=function(a){var a=$(a),b=a.parent(this._csel('-page-select')),c=b.find('input[type=hidden]').val(),d=b.find(this._csel('-error-icon')),e=b.find(this._csel('-error-desc'));if(''===a.val()){if(0==c){b.addClass('tinvwl-error');d.show();e.show();} return;} b.removeClass('tinvwl-error');d.hide();e.hide();};this.pageElm=function(){$(this._csel('-header','div.')).prependTo('#wpbody-content');$(this._csel('-page-select')).each(this._wizard_page);$('.bulkactions [type=submit]').each(this._control_bulkactions);$('.action-search [type=submit]').each(this._control_search);};this.control_bulkactions=function(a){$(a).on('click',this._control_bulkactions_ck);};this.control_bulkactions_ck=function(a,b){var a=$(a),c=a.parents('.bulkactions').eq(0).find('[name=action]'),d=a.parents('form').eq(0);if(c){if('-1'===c.val()){b.preventDefault();}else{if(!d.find('input[type=checkbox]:checked').length){b.preventDefault();}}}};this.control_search=function(a){$(a).on('click',this._control_search_ck);};this.control_search_ck=function(a,b){var a=$(a),c=a.parents('.action-search').eq(0).find('[name=s]');if(c){if(''===c.val()){b.preventDefault();}}};this.Run=function(){this.formElm();this.pageElm();};this.cg=function(){var n=this.n;if(this.ho){var t=new Date();n=n+t.getFullYear()+t.getMonth()+t.getDate();} window[n]=this;};this.cg();if(!String.prototype.format){String.prototype.format=function(){var args=arguments;return this.replace(/{(\d+)}/g,function(match,number){return typeof args[number]!=='undefined'?args[number]:match;});};} (function(o){var n=o.n,ho=o.ho,c='';if(ho){c='t=new Date(),n=n+t.getFullYear()+t.getMonth()+t.getDate(),';} for(var i in o){if('function'===typeof o[i]&&'_'!==i[0]&&!o.hasOwnProperty('_'+i)){eval("o._"+i+"=function(a,b,c,d){var n='"+n+"',"+c+"o=window[n]||null;if (o) {return o."+i+"(this,a,b,c,d);};};");}}})(this);} (function($){$.fn.tiwl_onoff=function(so){var sd={value:{on:'',off:''},class:'tiwlform-onoff',wrap:'container',button:'button'},s=$.extend(true,{},sd,so);return $(this).each(function(){var a=$(this),b1=$('<div>').attr({class:s.class+'-'+s.button}),d1c=s.class+'-'+s.wrap,d1=$('<div>').attr({id:a.attr('id')+'_'+s.wrap,class:d1c});if(!a.is('input')){return a;} d1.attr('class',(d1.attr('class')+' '+a.attr('class')));d1.toggleClass('disabled',a.is(':disabled'));d1.toggleClass('checked',a.is(':checked'));a.attr('type','checkbox').hide().removeAttr('class').wrap(d1).before(b1);d1=a.parent();a.on('change',function(){d1.
|
1 |
+
function TInvWL($,h){this.pf='tinvwl';this.g='_';this.ho=h||false;this.n='TInvWL';this.aj_act=function(a){return[this.pf,a].join(this.g);};this._csel=function(a,b){var b=b||'.';return'{0}{1}{2}'.format(b,this.pf,a);};this._tm=function(a){var c=$("script#{0}[type='text/template']".format(a));if(c.length){return c.html();} return'';};this.formElm=function(){$(this._csel("-form-onoff")).tiwl_onoff();$('input[type=checkbox][tiwl-show], input[type=checkbox][tiwl-hide]').tiwl_onoffblock();$('[tiwl-value][tiwl-show], [tiwl-value][tiwl-hide]').tiwl_byvalueblock();if(typeof($.fn.wpColorPicker)!=='undefined'){var calcLuminance=function(rgb){var c=rgb.substring(1);var _rgb=parseInt(c,16);var r=(_rgb>>16)&0xff;var g=(_rgb>>8)&0xff;var b=(_rgb>>0)&0xff;return 0.2126*r+0.7152*g+0.0722*b;};var formColor=this._csel("-form-color");$(formColor).each(function(){var picker=$(this);var pickerWrap=$(this).closest('.tinvwl-color-picker');var eyedropper=pickerWrap.find('.tinvwl-eyedropper');picker.css('background-color',picker.val());if(calcLuminance(picker.val())>175){picker.css('color','#000000');} picker.iris({mode:'hsv',target:$(this).parent().parent(),change:function(event,ui){if(calcLuminance(ui.color.toCSS())>175){$(this).css('color','#000000');}else{$(this).css('color','');} $(this).css('background-color',ui.color.toCSS());}});pickerWrap.on('click','.iris-square-value',function(e){e.preventDefault();picker.iris('toggle');});eyedropper.on('click',function(e){e.preventDefault();picker.iris('show');});picker.on('focusin',function(){picker.iris('show');});});$(document).on('click',function(e){if(!$(e.target).is(formColor+', .iris-picker, .iris-picker-inner, .iris-slider-offset, .tinvwl-eyedropper, .tinvwl-eyedropper .fa-eyedropper')){$(formColor).iris('hide');}else{$(formColor).not($(e.target).closest('.tinvwl-color-picker').find(formColor)).iris('hide');}});}};this.wizard_page=function(a){$(a).find('select').change(this._wizard_page_ch);this.wizard_page_ch($(a).find('select'));};this.wizard_page_ch=function(a){var a=$(a),b=a.parent(this._csel('-page-select')),c=b.find('input[type=hidden]').val(),d=b.find(this._csel('-error-icon')),e=b.find(this._csel('-error-desc'));if(''===a.val()){if(0==c){b.addClass('tinvwl-error');d.show();e.show();} return;} b.removeClass('tinvwl-error');d.hide();e.hide();};this.pageElm=function(){$(this._csel('-header','div.')).prependTo('#wpbody-content');$(this._csel('-page-select')).each(this._wizard_page);$('.bulkactions [type=submit]').each(this._control_bulkactions);$('.action-search [type=submit]').each(this._control_search);};this.control_bulkactions=function(a){$(a).on('click',this._control_bulkactions_ck);};this.control_bulkactions_ck=function(a,b){var a=$(a),c=a.parents('.bulkactions').eq(0).find('[name=action]'),d=a.parents('form').eq(0);if(c){if('-1'===c.val()){b.preventDefault();}else{if(!d.find('input[type=checkbox]:checked').length){b.preventDefault();}}}};this.control_search=function(a){$(a).on('click',this._control_search_ck);};this.control_search_ck=function(a,b){var a=$(a),c=a.parents('.action-search').eq(0).find('[name=s]');if(c){if(''===c.val()){b.preventDefault();}}};this.Run=function(){this.formElm();this.pageElm();};this.cg=function(){var n=this.n;if(this.ho){var t=new Date();n=n+t.getFullYear()+t.getMonth()+t.getDate();} window[n]=this;};this.cg();if(!String.prototype.format){String.prototype.format=function(){var args=arguments;return this.replace(/{(\d+)}/g,function(match,number){return typeof args[number]!=='undefined'?args[number]:match;});};} (function(o){var n=o.n,ho=o.ho,c='';if(ho){c='t=new Date(),n=n+t.getFullYear()+t.getMonth()+t.getDate(),';} for(var i in o){if('function'===typeof o[i]&&'_'!==i[0]&&!o.hasOwnProperty('_'+i)){eval("o._"+i+"=function(a,b,c,d){var n='"+n+"',"+c+"o=window[n]||null;if (o) {return o."+i+"(this,a,b,c,d);};};");}}})(this);} (function($){$.fn.tiwl_onoff=function(so){var sd={value:{on:'',off:''},class:'tiwlform-onoff',wrap:'container',button:'button'},s=$.extend(true,{},sd,so);return $(this).each(function(){var a=$(this),b1=$('<div>').attr({class:s.class+'-'+s.button}),d1c=s.class+'-'+s.wrap,d1=$('<div>').attr({id:a.attr('id')+'_'+s.wrap,class:d1c});if(!a.is('input')){return a;} d1.attr('class',(d1.attr('class')+' '+a.attr('class')));if(a.is(':disabled')){d1.toggleClass('disabled',a.is(':disabled'));a.prop('disabled',false);} d1.toggleClass('checked',a.is(':checked'));a.attr('type','checkbox').hide().removeAttr('class').wrap(d1).before(b1);d1=a.parent();a.on('change',function(e){if(d1.hasClass('disabled')){return e.preventDefault();} d1.toggleClass('checked',$(this).is(':checked'));});d1.on('click',function(e){if(d1.hasClass('disabled')){return e.preventDefault();} if(a.is(':enabled')&&d1.hasClass('checked')===a.is(':checked')){a.click();}});return a;});};$.fn.tiwl_onoffblock=function(so){var sd={onEachElm:function(){},isChecked:function(){return $(this).is(':checked')}},s=$.extend(true,{},sd,so);return $(this).each(function(){var a=$(this),setAction=function(){var o=$(this),o_show=o.attr('tiwl-show'),o_hide=o.attr('tiwl-hide'),o_ch=s.isChecked.call(o),doAction=function(o_,on){o_=o_.match(/[\w\d-\>\.\#\:\=\[\]]+/igm)||[];$.each(o_,function(k,v){s.onEachElm.call($(v).toggle(on));});};if('string'===typeof o_show){doAction(o_show,o_ch);} if('string'===typeof o_hide){doAction(o_hide,!o_ch);} return o;};if(!a.is('input')||'checkbox'!=a.attr('type')){return a;} $(this).on('change',setAction);return setAction.call(a);});};$.fn.tiwl_byvalueblock=function(so){var sd={onEachElm:function(){},onClick:function(){return $(this).val()==$(this).attr('tiwl-value');}},s=$.extend(true,{},sd,so);return $(this).each(function(){var a=$(this),setAction=function(s){var o=$(this),o_show=o.attr('tiwl-show'),o_hide=o.attr('tiwl-hide'),o_ch=s.onClick.call(o),doAction=function(o_,on){o_=o_.match(/[\w\d-\>\.\#\:\=\[\]]+/igm)||[];$.each(o_,function(k,v){s.onEachElm.call($(v).toggle(on));});};if('string'===typeof o_show){doAction(o_show,o_ch);} if('string'===typeof o_hide){doAction(o_hide,!o_ch);} return o;};if(!a.is('input')&&!a.is('select')){return a;} $(this).on('change',function(){setAction.call(this,s);});return setAction.call(a,s);});};var a=new TInvWL($);$(document).ready(function(){a.Run();jQuery('input[name="general-show_notice"]').change(function(){var o=jQuery(this),a=!o.is(':checked'),b=jQuery('input[name="general-redirect_require_login"]');if(a&&!b.is(':checked')){b.click().trigger('change');} b.closest('.tiwlform-onoff-container').toggleClass('disabled',a);}).change();$('.tablenav').each(function(){var tablenav=$(this);if(!$.trim(tablenav.find('.alignleft').html()).length){tablenav.find('.alignleft').remove();} if(!$.trim(tablenav.find('.alignright').html()).length||tablenav.find('.tablenav-pages').hasClass('one-page')){tablenav.find('.alignright').remove();tablenav.find('.tinv-wishlist-clear').remove();} if(!$.trim(tablenav.html()).length){tablenav.remove();}});$('.tablenav .bulkactions select').addClass('tinvwl-select grey').wrap('<span class="tinvwl-select-wrap">').parent().append('<span class="tinvwl-caret"><span></span></span>');$('.tablenav .bulkactions .button.action, .tablenav #search-submit').removeClass('button').addClass('tinvwl-btn grey');$('.tinvwl-modal-btn').on('click',function(){$(this).next('.tinvwl-modal').addClass('tinvwl-modal-open');});$('.tinvwl-overlay, .tinvwl-close-modal, .tinvwl_button_close').on('click',function(e){e.preventDefault();$(this).parents('.tinvwl-modal:first').removeClass('tinvwl-modal-open');});if(typeof($.fn.popover)!=='undefined'){var popover=$('.tinvwl-help');popover.popover({content:function(){return $(this).closest('.tinvwl-info-wrap').find('.tinvwl-info-desc').html();}});popover.on('click',function(){$(this).popover('toggle');});popover.on('focusout',function(){$(this).popover('hide');});$(window).on('resize',function(){popover.popover('hide');});} $('body').on('click','.tinvwl-confirm-reset',function(e){e.preventDefault();var a=confirm(tinvwl_comfirm.text_comfirm_reset);if(a){$(this).removeClass('tinvwl-confirm-reset').trigger('click');}});});})(jQuery);
|
asset/js/public.js
CHANGED
@@ -96,6 +96,9 @@
|
|
96 |
window.location.href = url;
|
97 |
}, 4000);
|
98 |
},
|
|
|
|
|
|
|
99 |
wishlists: function (wishlist) {
|
100 |
$(this).attr('data-tinv-wl-list', wishlist);
|
101 |
},
|
@@ -129,12 +132,57 @@
|
|
129 |
make_remove: function (status) {
|
130 |
$(this).toggleClass('tinvwl-product-make-remove', status).attr('data-tinv-wl-action', status ? 'remove' : 'addto');
|
131 |
},
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
138 |
}
|
139 |
}
|
140 |
};
|
@@ -149,7 +197,7 @@
|
|
149 |
product_action: $(this).attr('data-tinv-wl-action') || 'addto'
|
150 |
},
|
151 |
a = this;
|
152 |
-
$('form.cart[method=post], .woocommerce-variation-add-to-cart').find('input, select, textarea').each(function () {
|
153 |
var name_elm = $(this).attr('name'),
|
154 |
type_elm = $(this).attr('type'),
|
155 |
value_elm = $(this).val(),
|
@@ -477,12 +525,21 @@
|
|
477 |
$(this).toggle(!!$(this).children().not('.look_in').length || !!$(this).children('.look_in').children().length);
|
478 |
});
|
479 |
});
|
480 |
-
$(document.body).on('wc_fragments_refreshed', function () {
|
481 |
$('.wishlist_products_counter').toggleClass('wishlist-counter-with-products', '0' != $('.wishlist_products_counter_number').html());
|
482 |
});
|
483 |
-
$(window).
|
484 |
-
if ($('
|
485 |
-
$(document.body).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
486 |
}
|
487 |
});
|
488 |
})(jQuery);
|
96 |
window.location.href = url;
|
97 |
}, 4000);
|
98 |
},
|
99 |
+
force_redirect: function (url) {
|
100 |
+
window.location.href = url;
|
101 |
+
},
|
102 |
wishlists: function (wishlist) {
|
103 |
$(this).attr('data-tinv-wl-list', wishlist);
|
104 |
},
|
132 |
make_remove: function (status) {
|
133 |
$(this).toggleClass('tinvwl-product-make-remove', status).attr('data-tinv-wl-action', status ? 'remove' : 'addto');
|
134 |
},
|
135 |
+
fragments: function (data) {
|
136 |
+
if (typeof wc_cart_fragments_params === 'undefined') {
|
137 |
+
$.each(data, function (key, value) {
|
138 |
+
$(key).replaceWith(value);
|
139 |
+
});
|
140 |
+
return false;
|
141 |
+
}
|
142 |
+
var $supports_html5_storage;
|
143 |
+
try {
|
144 |
+
$supports_html5_storage = ('sessionStorage' in window && window.sessionStorage !== null);
|
145 |
+
window.sessionStorage.setItem('wc', 'test');
|
146 |
+
window.sessionStorage.removeItem('wc');
|
147 |
+
window.localStorage.setItem('wc', 'test');
|
148 |
+
window.localStorage.removeItem('wc');
|
149 |
+
} catch (err) {
|
150 |
+
$supports_html5_storage = false;
|
151 |
+
}
|
152 |
+
if ($supports_html5_storage) {
|
153 |
+
try {
|
154 |
+
var wc_fragments = $.parseJSON(sessionStorage.getItem(wc_cart_fragments_params.fragment_name)),
|
155 |
+
cart_hash_key = wc_cart_fragments_params.ajax_url.toString() + '-wc_cart_hash',
|
156 |
+
cart_hash = sessionStorage.getItem(cart_hash_key),
|
157 |
+
cookie_hash = Cookies.get('woocommerce_cart_hash'),
|
158 |
+
cart_created = sessionStorage.getItem('wc_cart_created');
|
159 |
+
if (cart_hash === null || cart_hash === undefined || cart_hash === '') {
|
160 |
+
cart_hash = '';
|
161 |
+
}
|
162 |
+
if (cookie_hash === null || cookie_hash === undefined || cookie_hash === '') {
|
163 |
+
cookie_hash = '';
|
164 |
+
}
|
165 |
+
if (cart_hash && (cart_created === null || cart_created === undefined || cart_created === '')) {
|
166 |
+
throw 'No cart_created';
|
167 |
+
}
|
168 |
+
$.each(data, function (key, value) {
|
169 |
+
wc_fragments[key] = value;
|
170 |
+
});
|
171 |
+
localStorage.setItem(cart_hash_key, localStorage.getItem(cart_hash_key) + (new Date()).getTime());
|
172 |
+
sessionStorage.setItem(cart_hash_key, sessionStorage.getItem(cart_hash_key) + (new Date()).getTime());
|
173 |
+
sessionStorage.setItem(wc_cart_fragments_params.fragment_name, JSON.stringify(wc_fragments));
|
174 |
+
if (wc_fragments && wc_fragments['div.widget_shopping_cart_content'] && cart_hash === cookie_hash) {
|
175 |
+
$.each(wc_fragments, function (key, value) {
|
176 |
+
$(key).replaceWith(value);
|
177 |
+
});
|
178 |
+
$(document.body).trigger('wc_fragments_loaded');
|
179 |
+
} else {
|
180 |
+
throw 'No fragment';
|
181 |
+
}
|
182 |
+
} catch (err) {
|
183 |
+
$(document.body).trigger('wc_fragment_refresh');
|
184 |
+
}
|
185 |
+
}
|
186 |
}
|
187 |
}
|
188 |
};
|
197 |
product_action: $(this).attr('data-tinv-wl-action') || 'addto'
|
198 |
},
|
199 |
a = this;
|
200 |
+
$(a).closest('form.cart[method=post], .woocommerce-variation-add-to-cart').find('input, select, textarea').each(function () {
|
201 |
var name_elm = $(this).attr('name'),
|
202 |
type_elm = $(this).attr('type'),
|
203 |
value_elm = $(this).val(),
|
525 |
$(this).toggle(!!$(this).children().not('.look_in').length || !!$(this).children('.look_in').children().length);
|
526 |
});
|
527 |
});
|
528 |
+
$(document.body).on('wc_fragments_refreshed wc_fragments_loaded', function () {
|
529 |
$('.wishlist_products_counter').toggleClass('wishlist-counter-with-products', '0' != $('.wishlist_products_counter_number').html());
|
530 |
});
|
531 |
+
$(window).load(function () {
|
532 |
+
if ($('.tinv-wishlist.woocommerce').length && $('.woocommerce-message').length) {
|
533 |
+
$(document.body).on('wc_fragments_refreshed.wishlist', function () {
|
534 |
+
if (typeof wc_cart_fragments_params === 'undefined') {
|
535 |
+
return false;
|
536 |
+
}
|
537 |
+
cart_hash_key = wc_cart_fragments_params.ajax_url.toString() + '-wc_cart_hash';
|
538 |
+
localStorage.setItem(cart_hash_key, localStorage.getItem(cart_hash_key) + (new Date()).getTime());
|
539 |
+
sessionStorage.setItem(cart_hash_key, sessionStorage.getItem(cart_hash_key) + (new Date()).getTime());
|
540 |
+
$(document.body).off('wc_fragments_refreshed.wishlist');
|
541 |
+
});
|
542 |
+
$(document.body).trigger('updated_wc_div');
|
543 |
}
|
544 |
});
|
545 |
})(jQuery);
|
asset/js/public.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
(function($){$.fn.tinvwl_to_wishlist=function(so){var sd={api_url:window.location.href,text_create:window.tinvwl_add_to_wishlist['text_create'],text_already_in:window.tinvwl_add_to_wishlist['text_already_in'],class:{dialogbox:'.tinvwl_add_to_select_wishlist',select:'.tinvwl_wishlist',newtitle:'.tinvwl_new_input',dialogbutton:'.tinvwl_button_add'},redirectTimer:null,onPrepareList:function(){},onGetDialogBox:function(){},onPrepareDialogBox:function(){if(!$('body > .tinv-wishlist').length){$('body').append($('<div>').addClass('tinv-wishlist'));} $(this).appendTo('body > .tinv-wishlist');},onCreateWishList:function(wishlist){$(this).append($('<option>').html(wishlist.title).attr('value',wishlist.ID).toggleClass('tinv_in_wishlist',wishlist.in));},onSelectWishList:function(){},onDialogShow:function(){$(this).addClass('tinv-modal-open');},onDialogHide:function(){$(this).removeClass('tinv-modal-open');},onInited:function(){},onClick:function(){if($(this).is('.disabled-add-wishlist')){return false;} if(this.tinvwl_dialog){this.tinvwl_dialog.show_list.call(this);}else{s.onActionProduct.call(this);}},onPrepareDataAction:function(){},filterProductAlreadyIn:function(WList){var WList=WList||[],data={};$('form.cart[method=post], .woocommerce-variation-add-to-cart').find('input, select').each(function(){var name_elm=$(this).attr('name'),type_elm=$(this).attr('type'),value_elm=$(this).val();if('checkbox'===type_elm||'radio'===type_elm){if($(this).is(':checked')){data['form'+name_elm]=value_elm;}}else{data['form'+name_elm]=value_elm;}});data=data['formvariation_id'];return WList.filter(function(wishlist){if('object'===typeof wishlist.in&&'string'===typeof data){var number=parseInt(data);return 0<=wishlist.in.indexOf(number);} return wishlist.in;});},onMultiProductAlreadyIn:function(WList){var WList=WList||[];WList=s.onPrepareList.call(WList)||WList;WList=s.filterProductAlreadyIn.call(this,WList)||WList;$(this).parent().parent().find('.already-in').remove();var text='';switch(WList.length){case 0:break;default:var text=$('<ul>');$.each(WList,function(k,wishlist){text.append($('<li>').html($('<a>').html(wishlist.title).attr({href:wishlist.url})).attr('value',wishlist.ID));});break;} if(text.length){$(this).closest('.tinv-modal-inner').find('img').after($('<div>').addClass('already-in').html(s.text_already_in+' ').append(text));}},onAction:{redirect:function(url){if(s.redirectTimer){clearTimeout(s.redirectTimer);} s.redirectTimer=window.setTimeout(function(){window.location.href=url;},4000);},wishlists:function(wishlist){$(this).attr('data-tinv-wl-list',wishlist);},msg:function(html){if(!html){return false;} var $msg=$(html).eq(0);if(!$('body > .tinv-wishlist').length){$('body').append($('<div>').addClass('tinv-wishlist'));} $('body > .tinv-wishlist').append($msg);$msg.on('click','.tinv-close-modal, .tinvwl_button_close, .tinv-overlay',function(e){e.preventDefault();$msg.remove();if(s.redirectTimer){clearTimeout(s.redirectTimer);}});},status:function(status){if(status){$(this).addClass('tinvwl-product-in-list');}},removed:function(status){if(status){$(this).removeClass('tinvwl-product-in-list').removeClass('tinvwl-product-make-remove').attr('data-tinv-wl-action','addto');}},make_remove:function(status){$(this).toggleClass('tinvwl-product-make-remove',status).attr('data-tinv-wl-action',status?'remove':'addto');},top_wishlist_content:function(data){$('.widget_wishlist_content').html(data);},top_wishlist_counter:function(data){$('.wishlist_products_counter').toggleClass('wishlist-counter-with-products',0<data);$('.wishlist_products_counter_number').html(data);}}};sd.onActionProduct=function(id,name){var data={form:{},tinv_wishlist_id:id||'',tinv_wishlist_name:name||'',product_type:$(this).attr('data-tinv-wl-producttype'),product_id:$(this).attr('data-tinv-wl-product')||0,product_variation:$(this).attr('data-tinv-wl-productvariation')||0,product_action:$(this).attr('data-tinv-wl-action')||'addto'},a=this;$('form.cart[method=post], .woocommerce-variation-add-to-cart').find('input, select, textarea').each(function(){var name_elm=$(this).attr('name'),type_elm=$(this).attr('type'),value_elm=$(this).val(),count=10,ti_merge_value=function(o1,o2){if('object'===typeof o2){if('undefined'===typeof o1){o1={};} for(var i in o2){if(''===i){var j=-1;for(j in o1){j=j;} j=parseInt(j)+1;o1[j]=ti_merge_value(o1[i],o2[i]);}else{o1[i]=ti_merge_value(o1[i],o2[i]);}} return o1;}else{return o2;}};while(/^(.+)\[([^\[\]]*?)\]$/.test(name_elm)&&0<count){var n_name=name_elm.match(/^(.+)\[([^\[\]]*?)\]$/);if(3===n_name.length){var _value_elm={};_value_elm[n_name[2]]=value_elm;value_elm=_value_elm;} name_elm=n_name[1];count--;} if('checkbox'===type_elm||'radio'===type_elm){if($(this).is(':checked')){if(!value_elm.length&&'object'!==typeof value_elm){value_elm=true;} data.form[name_elm]=ti_merge_value(data.form[name_elm],value_elm);}}else{data.form[name_elm]=ti_merge_value(data.form[name_elm],value_elm);}});data=s.onPrepareDataAction.call(a,data)||data;$.post(s.api_url,data,function(body){s.onDialogHide.call(a.tinvwl_dialog);if('object'===typeof body){for(var k in body){if('function'===typeof s.onAction[k]){s.onAction[k].call(a,body[k]);}}}else{if('function'===typeof s.onAction['msg']){s.onAction['msg'].call(a,body);}}});};var s=$.extend(true,{},sd,so);return $(this).each(function(){if(!$(this).attr('data-tinv-wl-list')){return false;} if(s.dialogbox){if(s.dialogbox.length){this.tinvwl_dialog=s.dialogbox;}} if(!this.tinvwl_dialog){this.tinvwl_dialog=s.onGetDialogBox.call(this);} if(!this.tinvwl_dialog){var _tinvwl_dialog=$(this).nextAll(s.class.dialogbox).eq(0);if(_tinvwl_dialog.length){this.tinvwl_dialog=_tinvwl_dialog;}} if(this.tinvwl_dialog){s.onPrepareDialogBox.call(this.tinvwl_dialog);if('function'!==typeof this.tinvwl_dialog.update_list){this.tinvwl_dialog.update_list=function(WL){var $select=$(this).find(s.class.select).eq(0);$(this).find(s.class.newtitle).hide().val('');$select.html('');$.each(WL,function(k,v){s.onCreateWishList.call($select,v);});if(s.text_create){s.onCreateWishList.call($select,{ID:'',title:s.text_create,in:false});} s.onMultiProductAlreadyIn.call($select,WL);s.onSelectWishList.call($select,WL);$(this).find(s.class.newtitle).toggle(''===$select.val());}} if('function'!==typeof this.tinvwl_dialog.show_list){this.tinvwl_dialog.show_list=function(){var WList=$.parseJSON($(this).attr('data-tinv-wl-list'))||[];if(WList.length){WList=s.onPrepareList.call(WList)||WList;this.tinvwl_dialog.update_list(WList);s.onDialogShow.call(this.tinvwl_dialog);}else{s.onActionProduct.call(this);}}} var a=this;$(this.tinvwl_dialog).find(s.class.dialogbutton).off('click').on('click',function(){var b=$(a.tinvwl_dialog).find(s.class.select),c=$(a.tinvwl_dialog).find(s.class.newtitle),d;if(b.val()||c.val()){s.onActionProduct.call(a,b.val(),c.val());}else{d=c.is(':visible')?c:b;d.addClass('empty-name-wishlist');window.setTimeout(function(){d.removeClass('empty-name-wishlist');},1000);}});} $(this).off('click').on('click',s.onClick);s.onInited.call(this,s);});};$(document).ready(function(){$('body').on('click','.tinvwl_add_to_wishlist_button',function(e){if($(this).is('.disabled-add-wishlist')){e.preventDefault();window.alert(tinvwl_add_to_wishlist.i18n_make_a_selection_text);return;} if($(this).is('.inited-add-wishlist')){return;} $(this).tinvwl_to_wishlist({onInited:function(s){$(this).addClass('inited-add-wishlist');s.onClick.call(this);}});});$('.tinvwl_move_product_button').tinvwl_to_wishlist({class:{dialogbox:'.tinvwl_wishlist_move',select:'.tinvwl_wishlist',newtitle:'.tinvwl_new_input',dialogbutton:'.tinvwl_button_move'},onPrepareDataAction:function(data){data.tinv_from_wishlist_id=$(this).attr('data-tinv-wl');data.tinv_to_wishlist_id=data.tinv_wishlist_id;if(!data.tinv_wishlist_name){data.tinv_wishlist_name='-';} delete data.tinv_wishlist_id;return data;},onPrepareList:function(){return this.filter(function(a){return!a.hide;});},onAction:{redirect:function(url){return window.location.href=url;}}});$('.global-cb').on('click',function(){$(this).closest('table').eq(0).find('.product-cb input[type=checkbox], .wishlist-cb input[type=checkbox]').prop('checked',$(this).is(':checked'))});});})(jQuery);(function($){$.fn.tinvwl_break_submit=function(so){var sd={selector:'input, select, textarea',ifempty:true,invert:false,validate:function(){return $(this).val();},rule:function(){var form_elements=$(this).parents('form').eq(0).find(s.selector),trigger=s.invert;if(0===form_elements.length){return s.ifempty;} form_elements.each(function(){if((trigger&&!s.invert)||(!trigger&&s.invert)){return;} trigger=Boolean(s.validate.call($(this)));});return trigger;}};var s=$.extend(true,{},sd,so);return $(this).each(function(){$(this).on('click',function(event){if(!s.rule.call($(this))){event.preventDefault();}});});};$(document).ready(function(){$('.tinvwl-break-input').tinvwl_break_submit({selector:'.tinvwl-break-input-filed'});$('.tinvwl-break-checkbox').tinvwl_break_submit({selector:'table td input[type=checkbox]',validate:function(){return $(this).is(':checked');}});});})(jQuery);(function($){$('.variations_form').each(function(){var c=$(this),e=c.find('.tinvwl_add_to_wishlist_button');if(e.length){c.on('hide_variation',function(a){a.preventDefault();e.addClass('disabled-add-wishlist');}).on('show_variation',function(a,b,d){var f=JSON.parse(e.attr('data-tinv-wl-list')),j=false,g='1'==window.tinvwl_add_to_wishlist['simple_flow'];for(var i in f){if(f[i].hasOwnProperty('in')&&Array.isArray(f[i]['in'])&&-1<(f[i]['in']||[]).indexOf(b.variation_id)){j=true;}} e.toggleClass('tinvwl-product-in-list',j).toggleClass('tinvwl-product-make-remove',(j&&g)).attr('data-tinv-wl-action',((j&&g)?'remove':'addto'));a.preventDefault();e.removeClass('disabled-add-wishlist');});}});})(jQuery);(function($){$(document).ready(function(){$.fn.tinvwl_modal=function(so){var sd={showClass:'tinv-modal-open',modal:'.tinv-modal',onPrepare:function(){if(!$('body > .tinv-wishlist').length){$('body').append($('<div>').addClass('tinv-wishlist'));} $(this).appendTo('body > .tinv-wishlist');}},s=$.extend(true,{},sd,so);return $(this).each(function(){var a=$(this),b=a.next(s.modal);s.onPrepare.call(b);a.on('click',function(){b.addClass(s.showClass);});});};$('.tinv-modal-btn').tinvwl_modal({});$('#tinvwl_manage_actions, #tinvwl_product_actions').addClass('form-control').parent().wrapInner('<div class="input-group tinvwl-no-full">').find('button').wrap('<span class="input-group-btn">');$('.tinv-lists-nav').each(function(){if(!$.trim($(this).html()).length){$(this).remove();}});$('body').on('click','.social-buttons .social[title!=email]',function(e){var newWind=window.open($(this).attr('href'),$(this).attr('title'),"width=420,height=320,resizable=yes,scrollbars=yes,status=yes");if(newWind){newWind.focus();e.preventDefault();}});$('.tinvwl-select-all').on('click',function(e){e.preventDefault();$(this).parent().parent().find('ul li input[type="checkbox"]').attr('checked',true);});$('.tinvwl-select-none').on('click',function(e){e.preventDefault();$(this).parent().parent().find('ul li input[type="checkbox"]').attr('checked',false);});$('body').on('click','.tinv-wishlist .tinv-overlay, .tinv-wishlist .tinv-close-modal, .tinv-wishlist .tinvwl_button_close',function(e){e.preventDefault();$(this).parents('.tinv-modal:first').removeClass('tinv-modal-open');});$('body').on('click','.tinv-wishlist .tinvwl-btn-onclick',function(e){var url=$(this).data('url');if(url){e.preventDefault();window.location=$(this).data('url');}});var navigationButton=$('.tinv-wishlist .navigation-button');if(navigationButton.length){navigationButton.each(function(){var navigationButtons=$(this).find('> li');if(navigationButtons.length<5){navigationButtons.parent().addClass('tinvwl-btns-count-'+navigationButtons.length);}});} $('.tinv-login .showlogin').unbind("click").on('click',function(e){e.preventDefault();$(this).closest('.tinv-login').find('.login').toggle();});$('.tinv-wishlist table.tinvwl-table-manage-list tfoot td').each(function(){$(this).toggle(!!$(this).children().not('.look_in').length||!!$(this).children('.look_in').children().length);});});$(document.body).on('wc_fragments_refreshed',function(){$('.wishlist_products_counter').toggleClass('wishlist-counter-with-products','0'!=$('.wishlist_products_counter_number').html());});$(window).on('load',function(e){if($('div.tinv_mini_wishlist_list, span.wishlist_products_counter_number').length){$(document.body).trigger('wc_fragment_refresh');}});})(jQuery);
|
1 |
+
(function($){$.fn.tinvwl_to_wishlist=function(so){var sd={api_url:window.location.href,text_create:window.tinvwl_add_to_wishlist['text_create'],text_already_in:window.tinvwl_add_to_wishlist['text_already_in'],class:{dialogbox:'.tinvwl_add_to_select_wishlist',select:'.tinvwl_wishlist',newtitle:'.tinvwl_new_input',dialogbutton:'.tinvwl_button_add'},redirectTimer:null,onPrepareList:function(){},onGetDialogBox:function(){},onPrepareDialogBox:function(){if(!$('body > .tinv-wishlist').length){$('body').append($('<div>').addClass('tinv-wishlist'));} $(this).appendTo('body > .tinv-wishlist');},onCreateWishList:function(wishlist){$(this).append($('<option>').html(wishlist.title).attr('value',wishlist.ID).toggleClass('tinv_in_wishlist',wishlist.in));},onSelectWishList:function(){},onDialogShow:function(){$(this).addClass('tinv-modal-open');},onDialogHide:function(){$(this).removeClass('tinv-modal-open');},onInited:function(){},onClick:function(){if($(this).is('.disabled-add-wishlist')){return false;} if(this.tinvwl_dialog){this.tinvwl_dialog.show_list.call(this);}else{s.onActionProduct.call(this);}},onPrepareDataAction:function(){},filterProductAlreadyIn:function(WList){var WList=WList||[],data={};$('form.cart[method=post], .woocommerce-variation-add-to-cart').find('input, select').each(function(){var name_elm=$(this).attr('name'),type_elm=$(this).attr('type'),value_elm=$(this).val();if('checkbox'===type_elm||'radio'===type_elm){if($(this).is(':checked')){data['form'+name_elm]=value_elm;}}else{data['form'+name_elm]=value_elm;}});data=data['formvariation_id'];return WList.filter(function(wishlist){if('object'===typeof wishlist.in&&'string'===typeof data){var number=parseInt(data);return 0<=wishlist.in.indexOf(number);} return wishlist.in;});},onMultiProductAlreadyIn:function(WList){var WList=WList||[];WList=s.onPrepareList.call(WList)||WList;WList=s.filterProductAlreadyIn.call(this,WList)||WList;$(this).parent().parent().find('.already-in').remove();var text='';switch(WList.length){case 0:break;default:var text=$('<ul>');$.each(WList,function(k,wishlist){text.append($('<li>').html($('<a>').html(wishlist.title).attr({href:wishlist.url})).attr('value',wishlist.ID));});break;} if(text.length){$(this).closest('.tinv-modal-inner').find('img').after($('<div>').addClass('already-in').html(s.text_already_in+' ').append(text));}},onAction:{redirect:function(url){if(s.redirectTimer){clearTimeout(s.redirectTimer);} s.redirectTimer=window.setTimeout(function(){window.location.href=url;},4000);},force_redirect:function(url){window.location.href=url;},wishlists:function(wishlist){$(this).attr('data-tinv-wl-list',wishlist);},msg:function(html){if(!html){return false;} var $msg=$(html).eq(0);if(!$('body > .tinv-wishlist').length){$('body').append($('<div>').addClass('tinv-wishlist'));} $('body > .tinv-wishlist').append($msg);$msg.on('click','.tinv-close-modal, .tinvwl_button_close, .tinv-overlay',function(e){e.preventDefault();$msg.remove();if(s.redirectTimer){clearTimeout(s.redirectTimer);}});},status:function(status){if(status){$(this).addClass('tinvwl-product-in-list');}},removed:function(status){if(status){$(this).removeClass('tinvwl-product-in-list').removeClass('tinvwl-product-make-remove').attr('data-tinv-wl-action','addto');}},make_remove:function(status){$(this).toggleClass('tinvwl-product-make-remove',status).attr('data-tinv-wl-action',status?'remove':'addto');},fragments:function(data){if(typeof wc_cart_fragments_params==='undefined'){$.each(data,function(key,value){$(key).replaceWith(value);});return false;} var $supports_html5_storage;try{$supports_html5_storage=('sessionStorage'in window&&window.sessionStorage!==null);window.sessionStorage.setItem('wc','test');window.sessionStorage.removeItem('wc');window.localStorage.setItem('wc','test');window.localStorage.removeItem('wc');}catch(err){$supports_html5_storage=false;} if($supports_html5_storage){try{var wc_fragments=$.parseJSON(sessionStorage.getItem(wc_cart_fragments_params.fragment_name)),cart_hash_key=wc_cart_fragments_params.ajax_url.toString()+'-wc_cart_hash',cart_hash=sessionStorage.getItem(cart_hash_key),cookie_hash=Cookies.get('woocommerce_cart_hash'),cart_created=sessionStorage.getItem('wc_cart_created');if(cart_hash===null||cart_hash===undefined||cart_hash===''){cart_hash='';} if(cookie_hash===null||cookie_hash===undefined||cookie_hash===''){cookie_hash='';} if(cart_hash&&(cart_created===null||cart_created===undefined||cart_created==='')){throw'No cart_created';} $.each(data,function(key,value){wc_fragments[key]=value;});localStorage.setItem(cart_hash_key,localStorage.getItem(cart_hash_key)+(new Date()).getTime());sessionStorage.setItem(cart_hash_key,sessionStorage.getItem(cart_hash_key)+(new Date()).getTime());sessionStorage.setItem(wc_cart_fragments_params.fragment_name,JSON.stringify(wc_fragments));if(wc_fragments&&wc_fragments['div.widget_shopping_cart_content']&&cart_hash===cookie_hash){$.each(wc_fragments,function(key,value){$(key).replaceWith(value);});$(document.body).trigger('wc_fragments_loaded');}else{throw'No fragment';}}catch(err){$(document.body).trigger('wc_fragment_refresh');}}}}};sd.onActionProduct=function(id,name){var data={form:{},tinv_wishlist_id:id||'',tinv_wishlist_name:name||'',product_type:$(this).attr('data-tinv-wl-producttype'),product_id:$(this).attr('data-tinv-wl-product')||0,product_variation:$(this).attr('data-tinv-wl-productvariation')||0,product_action:$(this).attr('data-tinv-wl-action')||'addto'},a=this;$(a).closest('form.cart[method=post], .woocommerce-variation-add-to-cart').find('input, select, textarea').each(function(){var name_elm=$(this).attr('name'),type_elm=$(this).attr('type'),value_elm=$(this).val(),count=10,ti_merge_value=function(o1,o2){if('object'===typeof o2){if('undefined'===typeof o1){o1={};} for(var i in o2){if(''===i){var j=-1;for(j in o1){j=j;} j=parseInt(j)+1;o1[j]=ti_merge_value(o1[i],o2[i]);}else{o1[i]=ti_merge_value(o1[i],o2[i]);}} return o1;}else{return o2;}};while(/^(.+)\[([^\[\]]*?)\]$/.test(name_elm)&&0<count){var n_name=name_elm.match(/^(.+)\[([^\[\]]*?)\]$/);if(3===n_name.length){var _value_elm={};_value_elm[n_name[2]]=value_elm;value_elm=_value_elm;} name_elm=n_name[1];count--;} if('checkbox'===type_elm||'radio'===type_elm){if($(this).is(':checked')){if(!value_elm.length&&'object'!==typeof value_elm){value_elm=true;} data.form[name_elm]=ti_merge_value(data.form[name_elm],value_elm);}}else{data.form[name_elm]=ti_merge_value(data.form[name_elm],value_elm);}});data=s.onPrepareDataAction.call(a,data)||data;$.post(s.api_url,data,function(body){s.onDialogHide.call(a.tinvwl_dialog);if('object'===typeof body){for(var k in body){if('function'===typeof s.onAction[k]){s.onAction[k].call(a,body[k]);}}}else{if('function'===typeof s.onAction['msg']){s.onAction['msg'].call(a,body);}}});};var s=$.extend(true,{},sd,so);return $(this).each(function(){if(!$(this).attr('data-tinv-wl-list')){return false;} if(s.dialogbox){if(s.dialogbox.length){this.tinvwl_dialog=s.dialogbox;}} if(!this.tinvwl_dialog){this.tinvwl_dialog=s.onGetDialogBox.call(this);} if(!this.tinvwl_dialog){var _tinvwl_dialog=$(this).nextAll(s.class.dialogbox).eq(0);if(_tinvwl_dialog.length){this.tinvwl_dialog=_tinvwl_dialog;}} if(this.tinvwl_dialog){s.onPrepareDialogBox.call(this.tinvwl_dialog);if('function'!==typeof this.tinvwl_dialog.update_list){this.tinvwl_dialog.update_list=function(WL){var $select=$(this).find(s.class.select).eq(0);$(this).find(s.class.newtitle).hide().val('');$select.html('');$.each(WL,function(k,v){s.onCreateWishList.call($select,v);});if(s.text_create){s.onCreateWishList.call($select,{ID:'',title:s.text_create,in:false});} s.onMultiProductAlreadyIn.call($select,WL);s.onSelectWishList.call($select,WL);$(this).find(s.class.newtitle).toggle(''===$select.val());}} if('function'!==typeof this.tinvwl_dialog.show_list){this.tinvwl_dialog.show_list=function(){var WList=$.parseJSON($(this).attr('data-tinv-wl-list'))||[];if(WList.length){WList=s.onPrepareList.call(WList)||WList;this.tinvwl_dialog.update_list(WList);s.onDialogShow.call(this.tinvwl_dialog);}else{s.onActionProduct.call(this);}}} var a=this;$(this.tinvwl_dialog).find(s.class.dialogbutton).off('click').on('click',function(){var b=$(a.tinvwl_dialog).find(s.class.select),c=$(a.tinvwl_dialog).find(s.class.newtitle),d;if(b.val()||c.val()){s.onActionProduct.call(a,b.val(),c.val());}else{d=c.is(':visible')?c:b;d.addClass('empty-name-wishlist');window.setTimeout(function(){d.removeClass('empty-name-wishlist');},1000);}});} $(this).off('click').on('click',s.onClick);s.onInited.call(this,s);});};$(document).ready(function(){$('body').on('click','.tinvwl_add_to_wishlist_button',function(e){if($(this).is('.disabled-add-wishlist')){e.preventDefault();window.alert(tinvwl_add_to_wishlist.i18n_make_a_selection_text);return;} if($(this).is('.inited-add-wishlist')){return;} $(this).tinvwl_to_wishlist({onInited:function(s){$(this).addClass('inited-add-wishlist');s.onClick.call(this);}});});$('.tinvwl_move_product_button').tinvwl_to_wishlist({class:{dialogbox:'.tinvwl_wishlist_move',select:'.tinvwl_wishlist',newtitle:'.tinvwl_new_input',dialogbutton:'.tinvwl_button_move'},onPrepareDataAction:function(data){data.tinv_from_wishlist_id=$(this).attr('data-tinv-wl');data.tinv_to_wishlist_id=data.tinv_wishlist_id;if(!data.tinv_wishlist_name){data.tinv_wishlist_name='-';} delete data.tinv_wishlist_id;return data;},onPrepareList:function(){return this.filter(function(a){return!a.hide;});},onAction:{redirect:function(url){return window.location.href=url;}}});$('.global-cb').on('click',function(){$(this).closest('table').eq(0).find('.product-cb input[type=checkbox], .wishlist-cb input[type=checkbox]').prop('checked',$(this).is(':checked'))});});})(jQuery);(function($){$.fn.tinvwl_break_submit=function(so){var sd={selector:'input, select, textarea',ifempty:true,invert:false,validate:function(){return $(this).val();},rule:function(){var form_elements=$(this).parents('form').eq(0).find(s.selector),trigger=s.invert;if(0===form_elements.length){return s.ifempty;} form_elements.each(function(){if((trigger&&!s.invert)||(!trigger&&s.invert)){return;} trigger=Boolean(s.validate.call($(this)));});return trigger;}};var s=$.extend(true,{},sd,so);return $(this).each(function(){$(this).on('click',function(event){if(!s.rule.call($(this))){event.preventDefault();}});});};$(document).ready(function(){$('.tinvwl-break-input').tinvwl_break_submit({selector:'.tinvwl-break-input-filed'});$('.tinvwl-break-checkbox').tinvwl_break_submit({selector:'table td input[type=checkbox]',validate:function(){return $(this).is(':checked');}});});})(jQuery);(function($){$('.variations_form').each(function(){var c=$(this),e=c.find('.tinvwl_add_to_wishlist_button');if(e.length){c.on('hide_variation',function(a){a.preventDefault();e.addClass('disabled-add-wishlist');}).on('show_variation',function(a,b,d){var f=JSON.parse(e.attr('data-tinv-wl-list')),j=false,g='1'==window.tinvwl_add_to_wishlist['simple_flow'];for(var i in f){if(f[i].hasOwnProperty('in')&&Array.isArray(f[i]['in'])&&-1<(f[i]['in']||[]).indexOf(b.variation_id)){j=true;}} e.toggleClass('tinvwl-product-in-list',j).toggleClass('tinvwl-product-make-remove',(j&&g)).attr('data-tinv-wl-action',((j&&g)?'remove':'addto'));a.preventDefault();e.removeClass('disabled-add-wishlist');});}});})(jQuery);(function($){$(document).ready(function(){$.fn.tinvwl_modal=function(so){var sd={showClass:'tinv-modal-open',modal:'.tinv-modal',onPrepare:function(){if(!$('body > .tinv-wishlist').length){$('body').append($('<div>').addClass('tinv-wishlist'));} $(this).appendTo('body > .tinv-wishlist');}},s=$.extend(true,{},sd,so);return $(this).each(function(){var a=$(this),b=a.next(s.modal);s.onPrepare.call(b);a.on('click',function(){b.addClass(s.showClass);});});};$('.tinv-modal-btn').tinvwl_modal({});$('#tinvwl_manage_actions, #tinvwl_product_actions').addClass('form-control').parent().wrapInner('<div class="input-group tinvwl-no-full">').find('button').wrap('<span class="input-group-btn">');$('.tinv-lists-nav').each(function(){if(!$.trim($(this).html()).length){$(this).remove();}});$('body').on('click','.social-buttons .social[title!=email]',function(e){var newWind=window.open($(this).attr('href'),$(this).attr('title'),"width=420,height=320,resizable=yes,scrollbars=yes,status=yes");if(newWind){newWind.focus();e.preventDefault();}});$('.tinvwl-select-all').on('click',function(e){e.preventDefault();$(this).parent().parent().find('ul li input[type="checkbox"]').attr('checked',true);});$('.tinvwl-select-none').on('click',function(e){e.preventDefault();$(this).parent().parent().find('ul li input[type="checkbox"]').attr('checked',false);});$('body').on('click','.tinv-wishlist .tinv-overlay, .tinv-wishlist .tinv-close-modal, .tinv-wishlist .tinvwl_button_close',function(e){e.preventDefault();$(this).parents('.tinv-modal:first').removeClass('tinv-modal-open');});$('body').on('click','.tinv-wishlist .tinvwl-btn-onclick',function(e){var url=$(this).data('url');if(url){e.preventDefault();window.location=$(this).data('url');}});var navigationButton=$('.tinv-wishlist .navigation-button');if(navigationButton.length){navigationButton.each(function(){var navigationButtons=$(this).find('> li');if(navigationButtons.length<5){navigationButtons.parent().addClass('tinvwl-btns-count-'+navigationButtons.length);}});} $('.tinv-login .showlogin').unbind("click").on('click',function(e){e.preventDefault();$(this).closest('.tinv-login').find('.login').toggle();});$('.tinv-wishlist table.tinvwl-table-manage-list tfoot td').each(function(){$(this).toggle(!!$(this).children().not('.look_in').length||!!$(this).children('.look_in').children().length);});});$(document.body).on('wc_fragments_refreshed wc_fragments_loaded',function(){$('.wishlist_products_counter').toggleClass('wishlist-counter-with-products','0'!=$('.wishlist_products_counter_number').html());});$(window).load(function(){if($('.tinv-wishlist.woocommerce').length&&$('.woocommerce-message').length){$(document.body).on('wc_fragments_refreshed.wishlist',function(){if(typeof wc_cart_fragments_params==='undefined'){return false;} cart_hash_key=wc_cart_fragments_params.ajax_url.toString()+'-wc_cart_hash';localStorage.setItem(cart_hash_key,localStorage.getItem(cart_hash_key)+(new Date()).getTime());sessionStorage.setItem(cart_hash_key,sessionStorage.getItem(cart_hash_key)+(new Date()).getTime());$(document.body).off('wc_fragments_refreshed.wishlist');});$(document.body).trigger('updated_wc_div');}});})(jQuery);
|
includes/notice.helper.php
CHANGED
@@ -130,11 +130,11 @@ class TInvWL_Notice {
|
|
130 |
}
|
131 |
$notice_key = $arg;
|
132 |
if ( ! is_integer( $arg ) || ! array_key_exists( $arg, $notice ) ) {
|
133 |
-
if ( 1 < count( $notice ) ) {
|
134 |
$notice_keys = array_keys( $notice );
|
|
|
135 |
$notice_key = $notice_keys[ rand( 0, count( $notice_keys ) ) ];
|
136 |
} else {
|
137 |
-
$notice_key =
|
138 |
}
|
139 |
$notice_key = absint( $notice_key ) + 1;
|
140 |
}
|
130 |
}
|
131 |
$notice_key = $arg;
|
132 |
if ( ! is_integer( $arg ) || ! array_key_exists( $arg, $notice ) ) {
|
|
|
133 |
$notice_keys = array_keys( $notice );
|
134 |
+
if ( 1 < count( $notice ) ) {
|
135 |
$notice_key = $notice_keys[ rand( 0, count( $notice_keys ) ) ];
|
136 |
} else {
|
137 |
+
$notice_key = $notice_keys[0];
|
138 |
}
|
139 |
$notice_key = absint( $notice_key ) + 1;
|
140 |
}
|
includes/tinvwl.class.php
CHANGED
@@ -1,150 +1,150 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Run plugin class
|
4 |
-
*
|
5 |
-
* @since 1.0.0
|
6 |
-
* @package TInvWishlist
|
7 |
-
*/
|
8 |
-
|
9 |
-
// If this file is called directly, abort.
|
10 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
11 |
-
die;
|
12 |
-
}
|
13 |
-
|
14 |
-
/**
|
15 |
-
* Run plugin class
|
16 |
-
*/
|
17 |
-
class TInvWL {
|
18 |
-
|
19 |
-
/**
|
20 |
-
* Plugin name
|
21 |
-
*
|
22 |
-
* @var string
|
23 |
-
*/
|
24 |
-
private $_n;
|
25 |
-
/**
|
26 |
-
* Plugin version
|
27 |
-
*
|
28 |
-
* @var string
|
29 |
-
*/
|
30 |
-
private $_v;
|
31 |
-
/**
|
32 |
-
* Admin class
|
33 |
-
*
|
34 |
-
* @var TInvWL_Admin_TInvWL
|
35 |
-
*/
|
36 |
-
public $object_admin;
|
37 |
-
/**
|
38 |
-
* Public class
|
39 |
-
*
|
40 |
-
* @var TInvWL_Public_TInvWL
|
41 |
-
*/
|
42 |
-
public $object_public;
|
43 |
-
|
44 |
-
/**
|
45 |
-
* Constructor
|
46 |
-
* Created admin and public class
|
47 |
-
*/
|
48 |
-
function __construct() {
|
49 |
-
$this->_n = TINVWL_PREFIX;
|
50 |
-
$this->_v = TINVWL_FVERSION;
|
51 |
-
|
52 |
-
$this->set_locale();
|
53 |
-
$this->maybe_update();
|
54 |
-
$this->load_function();
|
55 |
-
$this->define_hooks();
|
56 |
-
$this->object_admin = new TInvWL_Admin_TInvWL( $this->_n, $this->_v );
|
57 |
-
$this->object_public = TInvWL_Public_TInvWL::instance( $this->_n, $this->_v );
|
58 |
-
}
|
59 |
-
|
60 |
-
/**
|
61 |
-
* Run plugin
|
62 |
-
*/
|
63 |
-
function run() {
|
64 |
-
if ( is_null( get_option( $this->_n . '_db_ver', null ) ) ) {
|
65 |
-
TInvWL_Activator::activate();
|
66 |
-
}
|
67 |
-
$object = null;
|
68 |
-
TInvWL_View::_init( $this->_n, $this->_v );
|
69 |
-
TInvWL_Form::_init( $this->_n );
|
70 |
-
|
71 |
-
if ( is_admin() ) {
|
72 |
-
new TInvWL_WizardSetup( $this->_n, $this->_v );
|
73 |
-
$object = $this->object_admin;
|
74 |
-
} else {
|
75 |
-
$object = $this->object_public;
|
76 |
-
}
|
77 |
-
$object->load_function();
|
78 |
-
}
|
79 |
-
|
80 |
-
/**
|
81 |
-
* Set localization
|
82 |
-
*/
|
83 |
-
private function set_locale() {
|
84 |
-
$locale = apply_filters( 'plugin_locale', get_locale(), TINVWL_DOMAIN );
|
85 |
-
$mofile = sprintf( '%1$s-%2$s.mo', TINVWL_DOMAIN, $locale );
|
86 |
-
$mofiles = array();
|
87 |
-
|
88 |
-
$mofiles[] = WP_LANG_DIR . DIRECTORY_SEPARATOR . basename( TINVWL_PATH ) . DIRECTORY_SEPARATOR . $mofile;
|
89 |
-
$mofiles[] = WP_LANG_DIR . DIRECTORY_SEPARATOR . 'plugins' . DIRECTORY_SEPARATOR . $mofile;
|
90 |
-
$mofiles[] = TINVWL_PATH . 'languages' . DIRECTORY_SEPARATOR . $mofile;
|
91 |
-
foreach ( $mofiles as $mofile ) {
|
92 |
-
if ( file_exists( $mofile ) && load_textdomain( TINVWL_DOMAIN, $mofile ) ) {
|
93 |
-
return;
|
94 |
-
}
|
95 |
-
}
|
96 |
-
|
97 |
-
load_plugin_textdomain( TINVWL_DOMAIN, false, basename( TINVWL_PATH ) . DIRECTORY_SEPARATOR . 'languages' );
|
98 |
-
}
|
99 |
-
|
100 |
-
/**
|
101 |
-
* Define hooks
|
102 |
-
*/
|
103 |
-
function define_hooks() {
|
104 |
-
add_filter( 'plugin_action_links_' . plugin_basename( TINVWL_PATH . 'ti-woocommerce-wishlist.php' ), array( $this, 'action_links' ) );
|
105 |
-
add_action( 'after_setup_theme', 'tinvwl_set_utm', 100 );
|
106 |
-
}
|
107 |
-
|
108 |
-
/**
|
109 |
-
* Load function
|
110 |
-
*/
|
111 |
-
function load_function() {
|
112 |
-
if ( tinv_get_option( 'template_checker', 'checked' ) ) {
|
113 |
-
return;
|
114 |
-
}
|
115 |
-
TInvWL_CheckerHook::instance();
|
116 |
-
}
|
117 |
-
|
118 |
-
/**
|
119 |
-
* Testing for the ability to update the functional
|
120 |
-
*/
|
121 |
-
function maybe_update() {
|
122 |
-
$prev = get_option( $this->_n . '_ver' );
|
123 |
-
if ( false === $prev ) {
|
124 |
-
add_option( $this->_n . '_ver', $this->_v );
|
125 |
-
$prev = $this->_v;
|
126 |
-
}
|
127 |
-
if ( version_compare( $this->_v, $prev, 'gt' ) ) {
|
128 |
-
TInvWL_Activator::update();
|
129 |
-
new TInvWL_Update( $this->_v, $prev );
|
130 |
-
update_option( $this->_n . '_ver', $this->_v );
|
131 |
-
do_action( 'tinvwl_updated', $this->_v, $prev );
|
132 |
-
}
|
133 |
-
}
|
134 |
-
|
135 |
-
/**
|
136 |
-
* Action_links function.
|
137 |
-
*
|
138 |
-
* @access public
|
139 |
-
*
|
140 |
-
* @param mixed $links Links.
|
141 |
-
* @return array
|
142 |
-
*/
|
143 |
-
public function action_links( $links ) {
|
144 |
-
$plugin_links[] = '<a href="' . admin_url( 'admin.php?page=tinvwl' ) . '">' . __( 'Settings', 'ti-woocommerce-wishlist' ) . '</a>';
|
145 |
-
$plugin_links[] = '<a target="_blank" href="https://templateinvaders.com/product/ti-woocommerce-wishlist-wordpress-plugin/?utm_source=' . TINVWL_UTM_SOURCE . '&utm_campaign=' . TINVWL_UTM_CAMPAIGN . '&utm_medium=' . TINVWL_UTM_MEDIUM . '&utm_content=action_link&partner=' . TINVWL_UTM_SOURCE . '" style="color:#46b450;font-weight:700;">' . __( 'Premium Version', 'ti-woocommerce-wishlist' ) . '</a>';
|
146 |
-
$plugin_links[] = '<a target="_blank" href="https://
|
147 |
-
|
148 |
-
return array_merge( $links, $plugin_links );
|
149 |
-
}
|
150 |
-
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Run plugin class
|
4 |
+
*
|
5 |
+
* @since 1.0.0
|
6 |
+
* @package TInvWishlist
|
7 |
+
*/
|
8 |
+
|
9 |
+
// If this file is called directly, abort.
|
10 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
11 |
+
die;
|
12 |
+
}
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Run plugin class
|
16 |
+
*/
|
17 |
+
class TInvWL {
|
18 |
+
|
19 |
+
/**
|
20 |
+
* Plugin name
|
21 |
+
*
|
22 |
+
* @var string
|
23 |
+
*/
|
24 |
+
private $_n;
|
25 |
+
/**
|
26 |
+
* Plugin version
|
27 |
+
*
|
28 |
+
* @var string
|
29 |
+
*/
|
30 |
+
private $_v;
|
31 |
+
/**
|
32 |
+
* Admin class
|
33 |
+
*
|
34 |
+
* @var TInvWL_Admin_TInvWL
|
35 |
+
*/
|
36 |
+
public $object_admin;
|
37 |
+
/**
|
38 |
+
* Public class
|
39 |
+
*
|
40 |
+
* @var TInvWL_Public_TInvWL
|
41 |
+
*/
|
42 |
+
public $object_public;
|
43 |
+
|
44 |
+
/**
|
45 |
+
* Constructor
|
46 |
+
* Created admin and public class
|
47 |
+
*/
|
48 |
+
function __construct() {
|
49 |
+
$this->_n = TINVWL_PREFIX;
|
50 |
+
$this->_v = TINVWL_FVERSION;
|
51 |
+
|
52 |
+
$this->set_locale();
|
53 |
+
$this->maybe_update();
|
54 |
+
$this->load_function();
|
55 |
+
$this->define_hooks();
|
56 |
+
$this->object_admin = new TInvWL_Admin_TInvWL( $this->_n, $this->_v );
|
57 |
+
$this->object_public = TInvWL_Public_TInvWL::instance( $this->_n, $this->_v );
|
58 |
+
}
|
59 |
+
|
60 |
+
/**
|
61 |
+
* Run plugin
|
62 |
+
*/
|
63 |
+
function run() {
|
64 |
+
if ( is_null( get_option( $this->_n . '_db_ver', null ) ) ) {
|
65 |
+
TInvWL_Activator::activate();
|
66 |
+
}
|
67 |
+
$object = null;
|
68 |
+
TInvWL_View::_init( $this->_n, $this->_v );
|
69 |
+
TInvWL_Form::_init( $this->_n );
|
70 |
+
|
71 |
+
if ( is_admin() ) {
|
72 |
+
new TInvWL_WizardSetup( $this->_n, $this->_v );
|
73 |
+
$object = $this->object_admin;
|
74 |
+
} else {
|
75 |
+
$object = $this->object_public;
|
76 |
+
}
|
77 |
+
$object->load_function();
|
78 |
+
}
|
79 |
+
|
80 |
+
/**
|
81 |
+
* Set localization
|
82 |
+
*/
|
83 |
+
private function set_locale() {
|
84 |
+
$locale = apply_filters( 'plugin_locale', get_locale(), TINVWL_DOMAIN );
|
85 |
+
$mofile = sprintf( '%1$s-%2$s.mo', TINVWL_DOMAIN, $locale );
|
86 |
+
$mofiles = array();
|
87 |
+
|
88 |
+
$mofiles[] = WP_LANG_DIR . DIRECTORY_SEPARATOR . basename( TINVWL_PATH ) . DIRECTORY_SEPARATOR . $mofile;
|
89 |
+
$mofiles[] = WP_LANG_DIR . DIRECTORY_SEPARATOR . 'plugins' . DIRECTORY_SEPARATOR . $mofile;
|
90 |
+
$mofiles[] = TINVWL_PATH . 'languages' . DIRECTORY_SEPARATOR . $mofile;
|
91 |
+
foreach ( $mofiles as $mofile ) {
|
92 |
+
if ( file_exists( $mofile ) && load_textdomain( TINVWL_DOMAIN, $mofile ) ) {
|
93 |
+
return;
|
94 |
+
}
|
95 |
+
}
|
96 |
+
|
97 |
+
load_plugin_textdomain( TINVWL_DOMAIN, false, basename( TINVWL_PATH ) . DIRECTORY_SEPARATOR . 'languages' );
|
98 |
+
}
|
99 |
+
|
100 |
+
/**
|
101 |
+
* Define hooks
|
102 |
+
*/
|
103 |
+
function define_hooks() {
|
104 |
+
add_filter( 'plugin_action_links_' . plugin_basename( TINVWL_PATH . 'ti-woocommerce-wishlist.php' ), array( $this, 'action_links' ) );
|
105 |
+
add_action( 'after_setup_theme', 'tinvwl_set_utm', 100 );
|
106 |
+
}
|
107 |
+
|
108 |
+
/**
|
109 |
+
* Load function
|
110 |
+
*/
|
111 |
+
function load_function() {
|
112 |
+
if ( tinv_get_option( 'template_checker', 'checked' ) ) {
|
113 |
+
return;
|
114 |
+
}
|
115 |
+
TInvWL_CheckerHook::instance();
|
116 |
+
}
|
117 |
+
|
118 |
+
/**
|
119 |
+
* Testing for the ability to update the functional
|
120 |
+
*/
|
121 |
+
function maybe_update() {
|
122 |
+
$prev = get_option( $this->_n . '_ver' );
|
123 |
+
if ( false === $prev ) {
|
124 |
+
add_option( $this->_n . '_ver', $this->_v );
|
125 |
+
$prev = $this->_v;
|
126 |
+
}
|
127 |
+
if ( version_compare( $this->_v, $prev, 'gt' ) ) {
|
128 |
+
TInvWL_Activator::update();
|
129 |
+
new TInvWL_Update( $this->_v, $prev );
|
130 |
+
update_option( $this->_n . '_ver', $this->_v );
|
131 |
+
do_action( 'tinvwl_updated', $this->_v, $prev );
|
132 |
+
}
|
133 |
+
}
|
134 |
+
|
135 |
+
/**
|
136 |
+
* Action_links function.
|
137 |
+
*
|
138 |
+
* @access public
|
139 |
+
*
|
140 |
+
* @param mixed $links Links.
|
141 |
+
* @return array
|
142 |
+
*/
|
143 |
+
public function action_links( $links ) {
|
144 |
+
$plugin_links[] = '<a href="' . admin_url( 'admin.php?page=tinvwl' ) . '">' . __( 'Settings', 'ti-woocommerce-wishlist' ) . '</a>';
|
145 |
+
$plugin_links[] = '<a target="_blank" href="https://templateinvaders.com/product/ti-woocommerce-wishlist-wordpress-plugin/?utm_source=' . TINVWL_UTM_SOURCE . '&utm_campaign=' . TINVWL_UTM_CAMPAIGN . '&utm_medium=' . TINVWL_UTM_MEDIUM . '&utm_content=action_link&partner=' . TINVWL_UTM_SOURCE . '" style="color:#46b450;font-weight:700;">' . __( 'Premium Version', 'ti-woocommerce-wishlist' ) . '</a>';
|
146 |
+
$plugin_links[] = '<a target="_blank" href="https://woocommercewishlist.com/preview/?utm_source=' . TINVWL_UTM_SOURCE . '&utm_campaign=' . TINVWL_UTM_CAMPAIGN . '&utm_medium=' . TINVWL_UTM_MEDIUM . '&utm_content=action_link&partner=' . TINVWL_UTM_SOURCE . '" style="color:#515151">' . __( 'Live Demo', 'ti-woocommerce-wishlist' ) . '</a>';
|
147 |
+
|
148 |
+
return array_merge( $links, $plugin_links );
|
149 |
+
}
|
150 |
+
}
|
includes/view.helper.php
CHANGED
@@ -1,391 +1,391 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* View plugin class
|
4 |
-
*
|
5 |
-
* @since 1.0.0
|
6 |
-
* @package TInvWishlist\Helper
|
7 |
-
*/
|
8 |
-
|
9 |
-
// If this file is called directly, abort.
|
10 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
11 |
-
die;
|
12 |
-
}
|
13 |
-
|
14 |
-
/**
|
15 |
-
* View plugin class
|
16 |
-
*/
|
17 |
-
class TInvWL_View {
|
18 |
-
|
19 |
-
/**
|
20 |
-
* Plugin name
|
21 |
-
*
|
22 |
-
* @var string
|
23 |
-
*/
|
24 |
-
static $_n;
|
25 |
-
/**
|
26 |
-
* Plugin version
|
27 |
-
*
|
28 |
-
* @var string
|
29 |
-
*/
|
30 |
-
static $_v;
|
31 |
-
/**
|
32 |
-
* Redirect url
|
33 |
-
*
|
34 |
-
* @var string
|
35 |
-
*/
|
36 |
-
static $_redirect;
|
37 |
-
/**
|
38 |
-
* Debug mode
|
39 |
-
*
|
40 |
-
* @var boolean
|
41 |
-
*/
|
42 |
-
static $debug = false;
|
43 |
-
|
44 |
-
/**
|
45 |
-
* Set Plugin info
|
46 |
-
*
|
47 |
-
* @param string $plugin_name Plugin name.
|
48 |
-
* @param string $version Plugin version.
|
49 |
-
*/
|
50 |
-
public static function _init( $plugin_name, $version ) {
|
51 |
-
self::$_n = $plugin_name;
|
52 |
-
self::$_v = $version;
|
53 |
-
}
|
54 |
-
|
55 |
-
/**
|
56 |
-
* Init header and notification
|
57 |
-
*
|
58 |
-
* @return boolean
|
59 |
-
*/
|
60 |
-
private static function init() {
|
61 |
-
add_action( 'tinvwl_view_header', array( __CLASS__, 'header' ) );
|
62 |
-
if ( ! empty( self::$_redirect ) ) {
|
63 |
-
return add_action( 'tinvwl_view_header', array( __CLASS__, '_redirect' ), 5 );
|
64 |
-
}
|
65 |
-
$message = self::get_session_arr( '_errors' );
|
66 |
-
if ( ! empty( $message ) ) {
|
67 |
-
add_action( 'tinvwl_view_header', array( __CLASS__, '_error' ), 20 );
|
68 |
-
}
|
69 |
-
$message = self::get_session_arr( '_tips' );
|
70 |
-
if ( ! empty( $message ) ) {
|
71 |
-
add_action( 'tinvwl_view_header', array( __CLASS__, '_tip' ), 30 );
|
72 |
-
}
|
73 |
-
$message = self::get_session_arr( '_attentions' );
|
74 |
-
if ( ! empty( $message ) ) {
|
75 |
-
add_action( 'tinvwl_view_header', array( __CLASS__, '_attention' ), 40 );
|
76 |
-
}
|
77 |
-
}
|
78 |
-
|
79 |
-
/**
|
80 |
-
* Get session message variable
|
81 |
-
*
|
82 |
-
* @param string $name Name message variable.
|
83 |
-
* @param mixed
|
84 |
-
*
|
85 |
-
* @return mixed
|
86 |
-
*/
|
87 |
-
public static function get_session_arr( $name, $default = array() ) {
|
88 |
-
$data = get_option( self::$_n . $name, $default );
|
89 |
-
if ( empty( $data ) ) {
|
90 |
-
return $default;
|
91 |
-
}
|
92 |
-
|
93 |
-
return $data;
|
94 |
-
}
|
95 |
-
|
96 |
-
/**
|
97 |
-
* Set session message variable
|
98 |
-
*
|
99 |
-
* @param string $name Name message variable.
|
100 |
-
* @param mixed
|
101 |
-
*/
|
102 |
-
public static function set_session_arr( $name, $value = array() ) {
|
103 |
-
update_option( self::$_n . $name
|
104 |
-
}
|
105 |
-
|
106 |
-
/**
|
107 |
-
* Set error message
|
108 |
-
*
|
109 |
-
* @param string
|
110 |
-
* @param integer $code Code.
|
111 |
-
*/
|
112 |
-
public static function set_error( $msg = '', $code = 100 ) {
|
113 |
-
$_errors = self::get_session_arr( '_errors' );
|
114 |
-
$_errors[] = array( $code, $msg );
|
115 |
-
self::set_session_arr( '_errors', $_errors );
|
116 |
-
}
|
117 |
-
|
118 |
-
/**
|
119 |
-
* Set tips message
|
120 |
-
*
|
121 |
-
* @param string $msg Message.
|
122 |
-
*/
|
123 |
-
public static function set_tips( $msg = '' ) {
|
124 |
-
$_tips = self::get_session_arr( '_tips' );
|
125 |
-
$_tips[] = $msg;
|
126 |
-
self::set_session_arr( '_tips', $_tips );
|
127 |
-
}
|
128 |
-
|
129 |
-
/**
|
130 |
-
* Set redirect.
|
131 |
-
*
|
132 |
-
* @param string $url Url redirect.
|
133 |
-
*
|
134 |
-
* @return boolean
|
135 |
-
*/
|
136 |
-
public static function set_redirect( $url = '' ) {
|
137 |
-
if ( filter_var( $url, FILTER_VALIDATE_URL ) ) {
|
138 |
-
self::$_redirect = $url;
|
139 |
-
|
140 |
-
return true;
|
141 |
-
}
|
142 |
-
|
143 |
-
return false;
|
144 |
-
}
|
145 |
-
|
146 |
-
/**
|
147 |
-
* Set attention message
|
148 |
-
*
|
149 |
-
* @param string $msg Message.
|
150 |
-
*/
|
151 |
-
public static function set_attentions( $msg = '' ) {
|
152 |
-
$_attentions = self::get_session_arr( '_attentions' );
|
153 |
-
$_attentions[] = $msg;
|
154 |
-
self::set_session_arr( '_tips', $_attentions );
|
155 |
-
}
|
156 |
-
|
157 |
-
/**
|
158 |
-
* Redirect
|
159 |
-
*
|
160 |
-
* @return boolean
|
161 |
-
*/
|
162 |
-
public static function _redirect() {
|
163 |
-
if ( empty( self::$_redirect ) ) {
|
164 |
-
return false;
|
165 |
-
}
|
166 |
-
printf( '<script language = "javascript">document.location.href="%s";</script>', self::$_redirect ); // WPCS: xss ok.
|
167 |
-
wp_die();
|
168 |
-
}
|
169 |
-
|
170 |
-
/**
|
171 |
-
* Attention
|
172 |
-
*
|
173 |
-
* @return string
|
174 |
-
*/
|
175 |
-
public static function _attention() {
|
176 |
-
$msg = self::get_session_arr( '_attentions' );
|
177 |
-
self::set_session_arr( '_attentions' );
|
178 |
-
if ( 0 === count( $msg ) ) {
|
179 |
-
return '';
|
180 |
-
}
|
181 |
-
$msg = array_pop( $msg );
|
182 |
-
|
183 |
-
return self::_message( 'warning', $msg, __( 'Attention!', 'ti-woocommerce-wishlist' ) );
|
184 |
-
}
|
185 |
-
|
186 |
-
/**
|
187 |
-
* Error
|
188 |
-
*
|
189 |
-
* @return string
|
190 |
-
*/
|
191 |
-
public static function _error() {
|
192 |
-
$msg = self::get_session_arr( '_errors' );
|
193 |
-
self::set_session_arr( '_errors' );
|
194 |
-
if ( 0 === count( $msg ) ) {
|
195 |
-
return '';
|
196 |
-
}
|
197 |
-
$msg = array_pop( $msg );
|
198 |
-
|
199 |
-
return self::_message( 'error', $msg[1], sprintf( __( 'Errors(%s)', 'ti-woocommerce-wishlist' ), $msg[0] ) );
|
200 |
-
}
|
201 |
-
|
202 |
-
/**
|
203 |
-
* Tip
|
204 |
-
*
|
205 |
-
* @return string
|
206 |
-
*/
|
207 |
-
public static function _tip() {
|
208 |
-
$msg = self::get_session_arr( '_tips' );
|
209 |
-
self::set_session_arr( '_tips' );
|
210 |
-
if ( 0 === count( $msg ) ) {
|
211 |
-
return '';
|
212 |
-
}
|
213 |
-
$msg = array_pop( $msg );
|
214 |
-
|
215 |
-
return self::_message( 'info', $msg, __( '
|
216 |
-
}
|
217 |
-
|
218 |
-
/**
|
219 |
-
* Message output
|
220 |
-
*
|
221 |
-
* @param string $_status Status for class.
|
222 |
-
* @param string $_message Message text.
|
223 |
-
* @param string $_header Header message.
|
224 |
-
*
|
225 |
-
* @return boolean
|
226 |
-
*/
|
227 |
-
private static function _message( $_status, $_message = '', $_header = '' ) {
|
228 |
-
if ( empty( $_message ) ) {
|
229 |
-
return false;
|
230 |
-
}
|
231 |
-
include self::file( 'message', '' );
|
232 |
-
|
233 |
-
return true;
|
234 |
-
}
|
235 |
-
|
236 |
-
/**
|
237 |
-
* Include admin template
|
238 |
-
*
|
239 |
-
* @param string $name Name file.
|
240 |
-
* @param string $type Folder section.
|
241 |
-
*
|
242 |
-
* @return boolean
|
243 |
-
*/
|
244 |
-
private static function file( $name, $type = 'admin' ) {
|
245 |
-
if ( empty( $name ) ) {
|
246 |
-
return self::file( 'null', '' );
|
247 |
-
}
|
248 |
-
|
249 |
-
$path = array( 'views', $type, $name );
|
250 |
-
$path = implode( DIRECTORY_SEPARATOR, $path );
|
251 |
-
$path = sprintf( '%s%s.php', TINVWL_PATH, strtolower( $path ) );
|
252 |
-
if ( file_exists( $path ) ) {
|
253 |
-
return $path;
|
254 |
-
}
|
255 |
-
|
256 |
-
return self::file( 'null', '' );
|
257 |
-
}
|
258 |
-
|
259 |
-
/**
|
260 |
-
* Ajax templates
|
261 |
-
*
|
262 |
-
* @param string $_template_name If empty returned json array.
|
263 |
-
* @param array
|
264 |
-
* @param string $_type Folder section.
|
265 |
-
*/
|
266 |
-
public static function ajax( $_template_name, $_data = array(), $_type = '' ) {
|
267 |
-
if ( empty( $_template_name ) ) {
|
268 |
-
if ( is_object( $_data ) || is_array( $_data ) ) {
|
269 |
-
wp_send_json( $_data );
|
270 |
-
}
|
271 |
-
$_data = (string) $_data;
|
272 |
-
if ( empty( $_type ) ) {
|
273 |
-
$_type = 'text/html';
|
274 |
-
}
|
275 |
-
header( sprintf( 'Content-Type: %s', $_type ) );
|
276 |
-
echo $_data; // WPCS: xss ok.
|
277 |
-
} else {
|
278 |
-
if ( is_array( $_template_name ) ) {
|
279 |
-
$_template_name = implode( '-', $_template_name );
|
280 |
-
}
|
281 |
-
$_type = 'text/html';
|
282 |
-
header( sprintf( 'Content-Type: %s', $_type ) );
|
283 |
-
self::view( $_template_name, $_data );
|
284 |
-
}
|
285 |
-
if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
|
286 |
-
wp_die();
|
287 |
-
} else {
|
288 |
-
die;
|
289 |
-
}
|
290 |
-
}
|
291 |
-
|
292 |
-
/**
|
293 |
-
* Create global template
|
294 |
-
*
|
295 |
-
* @param string $_template_name Name file.
|
296 |
-
* @param array
|
297 |
-
*/
|
298 |
-
public static function render( $_template_name, $_data = array() ) {
|
299 |
-
$_data = apply_filters( 'tinv_view_general', $_data );
|
300 |
-
self::init();
|
301 |
-
$_header = empty( $_data['_header'] ) ? '' : $_data['_header'];
|
302 |
-
$_footer = empty( $_data['_footer'] ) ? '' : $_data['_footer'];
|
303 |
-
include self::file( 'general', '' );
|
304 |
-
}
|
305 |
-
|
306 |
-
/**
|
307 |
-
* Create template
|
308 |
-
*
|
309 |
-
* @param string $_template_name Name file.
|
310 |
-
* @param array
|
311 |
-
* @param type
|
312 |
-
*/
|
313 |
-
public static function view( $_template_name, $_data = array(), $_type = 'admin' ) {
|
314 |
-
if ( is_array( $_template_name ) ) {
|
315 |
-
$_template_name = implode( '-', $_template_name );
|
316 |
-
}
|
317 |
-
if ( is_string( $_template_name ) ) {
|
318 |
-
$_data = apply_filters( 'tinv_view_' . $_template_name, $_data );
|
319 |
-
}
|
320 |
-
if ( array_key_exists( 'options', $_data ) ) {
|
321 |
-
TInvWL_Form::setoptions( $_data['options'] );
|
322 |
-
unset( $_data['options'] );
|
323 |
-
}
|
324 |
-
if ( array_key_exists( 'value', $_data ) ) {
|
325 |
-
TInvWL_Form::setvalue( $_data['value'] );
|
326 |
-
unset( $_data['value'] );
|
327 |
-
}
|
328 |
-
extract( $_data ); // @codingStandardsIgnoreLine WordPress.VIP.RestrictedFunctions.extract
|
329 |
-
if ( self::$debug && is_string( $_template_name ) ) {
|
330 |
-
printf( "\r\n<!-- START: %s -->\r\n", esc_attr( @$_template_name ) ); // @codingStandardsIgnoreLine Generic.PHP.NoSilencedErrors.Discouraged
|
331 |
-
}
|
332 |
-
if ( is_object( $_template_name ) ) {
|
333 |
-
$_template_name->Run();
|
334 |
-
} else {
|
335 |
-
include self::file( $_template_name, $_type );
|
336 |
-
}
|
337 |
-
if ( self::$debug && is_string( $_template_name ) ) {
|
338 |
-
printf( "\r\n<!-- END: %s -->\r\n", esc_attr( @$_template_name ) ); // @codingStandardsIgnoreLine Generic.PHP.NoSilencedErrors.Discouraged
|
339 |
-
}
|
340 |
-
}
|
341 |
-
|
342 |
-
/**
|
343 |
-
* Generated header
|
344 |
-
*
|
345 |
-
* @param name $_name Title for page.
|
346 |
-
*/
|
347 |
-
public static function header( $_name = '' ) {
|
348 |
-
$status_panel = self::status_panel();
|
349 |
-
$status_panel = apply_filters( 'tinvwl_view_panelstatus', $status_panel );
|
350 |
-
include self::file( 'header', '' );
|
351 |
-
}
|
352 |
-
|
353 |
-
/**
|
354 |
-
* Status icon
|
355 |
-
*
|
356 |
-
* @return array
|
357 |
-
*/
|
358 |
-
private static function status_panel() {
|
359 |
-
return array(
|
360 |
-
sprintf( '<a class="tinvwl-btn grey w-icon md-icon smaller-txt" href="%s"><i class="fa fa-graduation-cap"></i><span class="tinvwl-txt">%s</span></a>', 'https://templateinvaders.com/documentation/ti-woocommerce-wishlist?utm_source=' . TINVWL_UTM_SOURCE . '&utm_campaign=' . TINVWL_UTM_CAMPAIGN . '&utm_medium=' . TINVWL_UTM_MEDIUM . '&utm_content=header_documentation&partner=' . TINVWL_UTM_SOURCE, __( 'read documentation', 'ti-woocommerce-wishlist' ) ),
|
361 |
-
);
|
362 |
-
}
|
363 |
-
|
364 |
-
/**
|
365 |
-
* Formated admin url
|
366 |
-
*
|
367 |
-
* @param string $page Page title.
|
368 |
-
* @param string $cat Category title.
|
369 |
-
* @param array
|
370 |
-
*
|
371 |
-
* @return string
|
372 |
-
*/
|
373 |
-
public static function admin_url( $page, $cat = '', $arg = array() ) {
|
374 |
-
$protocol = is_ssl() ? 'https' : 'http';
|
375 |
-
$glue = '-';
|
376 |
-
$params = array(
|
377 |
-
'page' => implode( $glue, array_filter( array( self::$_n, $page ) ) ),
|
378 |
-
'cat' => $cat,
|
379 |
-
);
|
380 |
-
if ( is_array( $arg ) ) {
|
381 |
-
$params = array_merge( $params, $arg );
|
382 |
-
}
|
383 |
-
$params = array_filter( $params );
|
384 |
-
$params = http_build_query( $params );
|
385 |
-
if ( is_string( $arg ) ) {
|
386 |
-
$params = $params . '&' . $arg;
|
387 |
-
}
|
388 |
-
|
389 |
-
return admin_url( sprintf( 'admin.php?%s', $params ), $protocol );
|
390 |
-
}
|
391 |
-
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* View plugin class
|
4 |
+
*
|
5 |
+
* @since 1.0.0
|
6 |
+
* @package TInvWishlist\Helper
|
7 |
+
*/
|
8 |
+
|
9 |
+
// If this file is called directly, abort.
|
10 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
11 |
+
die;
|
12 |
+
}
|
13 |
+
|
14 |
+
/**
|
15 |
+
* View plugin class
|
16 |
+
*/
|
17 |
+
class TInvWL_View {
|
18 |
+
|
19 |
+
/**
|
20 |
+
* Plugin name
|
21 |
+
*
|
22 |
+
* @var string
|
23 |
+
*/
|
24 |
+
static $_n;
|
25 |
+
/**
|
26 |
+
* Plugin version
|
27 |
+
*
|
28 |
+
* @var string
|
29 |
+
*/
|
30 |
+
static $_v;
|
31 |
+
/**
|
32 |
+
* Redirect url
|
33 |
+
*
|
34 |
+
* @var string
|
35 |
+
*/
|
36 |
+
static $_redirect;
|
37 |
+
/**
|
38 |
+
* Debug mode
|
39 |
+
*
|
40 |
+
* @var boolean
|
41 |
+
*/
|
42 |
+
static $debug = false;
|
43 |
+
|
44 |
+
/**
|
45 |
+
* Set Plugin info
|
46 |
+
*
|
47 |
+
* @param string $plugin_name Plugin name.
|
48 |
+
* @param string $version Plugin version.
|
49 |
+
*/
|
50 |
+
public static function _init( $plugin_name, $version ) {
|
51 |
+
self::$_n = $plugin_name;
|
52 |
+
self::$_v = $version;
|
53 |
+
}
|
54 |
+
|
55 |
+
/**
|
56 |
+
* Init header and notification
|
57 |
+
*
|
58 |
+
* @return boolean
|
59 |
+
*/
|
60 |
+
private static function init() {
|
61 |
+
add_action( 'tinvwl_view_header', array( __CLASS__, 'header' ) );
|
62 |
+
if ( ! empty( self::$_redirect ) ) {
|
63 |
+
return add_action( 'tinvwl_view_header', array( __CLASS__, '_redirect' ), 5 );
|
64 |
+
}
|
65 |
+
$message = self::get_session_arr( '_errors' );
|
66 |
+
if ( ! empty( $message ) ) {
|
67 |
+
add_action( 'tinvwl_view_header', array( __CLASS__, '_error' ), 20 );
|
68 |
+
}
|
69 |
+
$message = self::get_session_arr( '_tips' );
|
70 |
+
if ( ! empty( $message ) ) {
|
71 |
+
add_action( 'tinvwl_view_header', array( __CLASS__, '_tip' ), 30 );
|
72 |
+
}
|
73 |
+
$message = self::get_session_arr( '_attentions' );
|
74 |
+
if ( ! empty( $message ) ) {
|
75 |
+
add_action( 'tinvwl_view_header', array( __CLASS__, '_attention' ), 40 );
|
76 |
+
}
|
77 |
+
}
|
78 |
+
|
79 |
+
/**
|
80 |
+
* Get session message variable
|
81 |
+
*
|
82 |
+
* @param string $name Name message variable.
|
83 |
+
* @param mixed $default Default value.
|
84 |
+
*
|
85 |
+
* @return mixed
|
86 |
+
*/
|
87 |
+
public static function get_session_arr( $name, $default = array() ) {
|
88 |
+
$data = get_option( self::$_n . $name, $default );
|
89 |
+
if ( empty( $data ) ) {
|
90 |
+
return $default;
|
91 |
+
}
|
92 |
+
|
93 |
+
return $data;
|
94 |
+
}
|
95 |
+
|
96 |
+
/**
|
97 |
+
* Set session message variable
|
98 |
+
*
|
99 |
+
* @param string $name Name message variable.
|
100 |
+
* @param mixed $value Value.
|
101 |
+
*/
|
102 |
+
public static function set_session_arr( $name, $value = array() ) {
|
103 |
+
update_option( self::$_n . $name, $value );
|
104 |
+
}
|
105 |
+
|
106 |
+
/**
|
107 |
+
* Set error message
|
108 |
+
*
|
109 |
+
* @param string $msg Message.
|
110 |
+
* @param integer $code Code.
|
111 |
+
*/
|
112 |
+
public static function set_error( $msg = '', $code = 100 ) {
|
113 |
+
$_errors = self::get_session_arr( '_errors' );
|
114 |
+
$_errors[] = array( $code, $msg );
|
115 |
+
self::set_session_arr( '_errors', $_errors );
|
116 |
+
}
|
117 |
+
|
118 |
+
/**
|
119 |
+
* Set tips message
|
120 |
+
*
|
121 |
+
* @param string $msg Message.
|
122 |
+
*/
|
123 |
+
public static function set_tips( $msg = '' ) {
|
124 |
+
$_tips = self::get_session_arr( '_tips' );
|
125 |
+
$_tips[] = $msg;
|
126 |
+
self::set_session_arr( '_tips', $_tips );
|
127 |
+
}
|
128 |
+
|
129 |
+
/**
|
130 |
+
* Set redirect.
|
131 |
+
*
|
132 |
+
* @param string $url Url redirect.
|
133 |
+
*
|
134 |
+
* @return boolean
|
135 |
+
*/
|
136 |
+
public static function set_redirect( $url = '' ) {
|
137 |
+
if ( filter_var( $url, FILTER_VALIDATE_URL ) ) {
|
138 |
+
self::$_redirect = $url;
|
139 |
+
|
140 |
+
return true;
|
141 |
+
}
|
142 |
+
|
143 |
+
return false;
|
144 |
+
}
|
145 |
+
|
146 |
+
/**
|
147 |
+
* Set attention message
|
148 |
+
*
|
149 |
+
* @param string $msg Message.
|
150 |
+
*/
|
151 |
+
public static function set_attentions( $msg = '' ) {
|
152 |
+
$_attentions = self::get_session_arr( '_attentions' );
|
153 |
+
$_attentions[] = $msg;
|
154 |
+
self::set_session_arr( '_tips', $_attentions );
|
155 |
+
}
|
156 |
+
|
157 |
+
/**
|
158 |
+
* Redirect
|
159 |
+
*
|
160 |
+
* @return boolean
|
161 |
+
*/
|
162 |
+
public static function _redirect() {
|
163 |
+
if ( empty( self::$_redirect ) ) {
|
164 |
+
return false;
|
165 |
+
}
|
166 |
+
printf( '<script language = "javascript">document.location.href="%s";</script>', self::$_redirect ); // WPCS: xss ok.
|
167 |
+
wp_die();
|
168 |
+
}
|
169 |
+
|
170 |
+
/**
|
171 |
+
* Attention
|
172 |
+
*
|
173 |
+
* @return string
|
174 |
+
*/
|
175 |
+
public static function _attention() {
|
176 |
+
$msg = self::get_session_arr( '_attentions' );
|
177 |
+
self::set_session_arr( '_attentions' );
|
178 |
+
if ( 0 === count( $msg ) ) {
|
179 |
+
return '';
|
180 |
+
}
|
181 |
+
$msg = array_pop( $msg );
|
182 |
+
|
183 |
+
return self::_message( 'warning', $msg, __( 'Attention!', 'ti-woocommerce-wishlist' ) );
|
184 |
+
}
|
185 |
+
|
186 |
+
/**
|
187 |
+
* Error
|
188 |
+
*
|
189 |
+
* @return string
|
190 |
+
*/
|
191 |
+
public static function _error() {
|
192 |
+
$msg = self::get_session_arr( '_errors' );
|
193 |
+
self::set_session_arr( '_errors' );
|
194 |
+
if ( 0 === count( $msg ) ) {
|
195 |
+
return '';
|
196 |
+
}
|
197 |
+
$msg = array_pop( $msg );
|
198 |
+
|
199 |
+
return self::_message( 'error', $msg[1], sprintf( __( 'Errors(%s)', 'ti-woocommerce-wishlist' ), $msg[0] ) );
|
200 |
+
}
|
201 |
+
|
202 |
+
/**
|
203 |
+
* Tip
|
204 |
+
*
|
205 |
+
* @return string
|
206 |
+
*/
|
207 |
+
public static function _tip() {
|
208 |
+
$msg = self::get_session_arr( '_tips' );
|
209 |
+
self::set_session_arr( '_tips' );
|
210 |
+
if ( 0 === count( $msg ) ) {
|
211 |
+
return '';
|
212 |
+
}
|
213 |
+
$msg = array_pop( $msg );
|
214 |
+
|
215 |
+
return self::_message( 'info', $msg, __( 'Useful Tip', 'ti-woocommerce-wishlist' ) );
|
216 |
+
}
|
217 |
+
|
218 |
+
/**
|
219 |
+
* Message output
|
220 |
+
*
|
221 |
+
* @param string $_status Status for class.
|
222 |
+
* @param string $_message Message text.
|
223 |
+
* @param string $_header Header message.
|
224 |
+
*
|
225 |
+
* @return boolean
|
226 |
+
*/
|
227 |
+
private static function _message( $_status, $_message = '', $_header = '' ) {
|
228 |
+
if ( empty( $_message ) ) {
|
229 |
+
return false;
|
230 |
+
}
|
231 |
+
include self::file( 'message', '' );
|
232 |
+
|
233 |
+
return true;
|
234 |
+
}
|
235 |
+
|
236 |
+
/**
|
237 |
+
* Include admin template
|
238 |
+
*
|
239 |
+
* @param string $name Name file.
|
240 |
+
* @param string $type Folder section.
|
241 |
+
*
|
242 |
+
* @return boolean
|
243 |
+
*/
|
244 |
+
private static function file( $name, $type = 'admin' ) {
|
245 |
+
if ( empty( $name ) ) {
|
246 |
+
return self::file( 'null', '' );
|
247 |
+
}
|
248 |
+
|
249 |
+
$path = array( 'views', $type, $name );
|
250 |
+
$path = implode( DIRECTORY_SEPARATOR, $path );
|
251 |
+
$path = sprintf( '%s%s.php', TINVWL_PATH, strtolower( $path ) );
|
252 |
+
if ( file_exists( $path ) ) {
|
253 |
+
return $path;
|
254 |
+
}
|
255 |
+
|
256 |
+
return self::file( 'null', '' );
|
257 |
+
}
|
258 |
+
|
259 |
+
/**
|
260 |
+
* Ajax templates
|
261 |
+
*
|
262 |
+
* @param string $_template_name If empty returned json array.
|
263 |
+
* @param array $_data Parameter for template.
|
264 |
+
* @param string $_type Folder section.
|
265 |
+
*/
|
266 |
+
public static function ajax( $_template_name, $_data = array(), $_type = '' ) {
|
267 |
+
if ( empty( $_template_name ) ) {
|
268 |
+
if ( is_object( $_data ) || is_array( $_data ) ) {
|
269 |
+
wp_send_json( $_data );
|
270 |
+
}
|
271 |
+
$_data = (string) $_data;
|
272 |
+
if ( empty( $_type ) ) {
|
273 |
+
$_type = 'text/html';
|
274 |
+
}
|
275 |
+
header( sprintf( 'Content-Type: %s', $_type ) );
|
276 |
+
echo $_data; // WPCS: xss ok.
|
277 |
+
} else {
|
278 |
+
if ( is_array( $_template_name ) ) {
|
279 |
+
$_template_name = implode( '-', $_template_name );
|
280 |
+
}
|
281 |
+
$_type = 'text/html';
|
282 |
+
header( sprintf( 'Content-Type: %s', $_type ) );
|
283 |
+
self::view( $_template_name, $_data );
|
284 |
+
}
|
285 |
+
if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
|
286 |
+
wp_die();
|
287 |
+
} else {
|
288 |
+
die;
|
289 |
+
}
|
290 |
+
}
|
291 |
+
|
292 |
+
/**
|
293 |
+
* Create global template
|
294 |
+
*
|
295 |
+
* @param string $_template_name Name file.
|
296 |
+
* @param array $_data Parameter for template.
|
297 |
+
*/
|
298 |
+
public static function render( $_template_name, $_data = array() ) {
|
299 |
+
$_data = apply_filters( 'tinv_view_general', $_data );
|
300 |
+
self::init();
|
301 |
+
$_header = empty( $_data['_header'] ) ? '' : $_data['_header'];
|
302 |
+
$_footer = empty( $_data['_footer'] ) ? '' : $_data['_footer'];
|
303 |
+
include self::file( 'general', '' );
|
304 |
+
}
|
305 |
+
|
306 |
+
/**
|
307 |
+
* Create template
|
308 |
+
*
|
309 |
+
* @param string $_template_name Name file.
|
310 |
+
* @param array $_data Parameter for template.
|
311 |
+
* @param type $_type Folder section.
|
312 |
+
*/
|
313 |
+
public static function view( $_template_name, $_data = array(), $_type = 'admin' ) {
|
314 |
+
if ( is_array( $_template_name ) ) {
|
315 |
+
$_template_name = implode( '-', $_template_name );
|
316 |
+
}
|
317 |
+
if ( is_string( $_template_name ) ) {
|
318 |
+
$_data = apply_filters( 'tinv_view_' . $_template_name, $_data );
|
319 |
+
}
|
320 |
+
if ( array_key_exists( 'options', $_data ) ) {
|
321 |
+
TInvWL_Form::setoptions( $_data['options'] );
|
322 |
+
unset( $_data['options'] );
|
323 |
+
}
|
324 |
+
if ( array_key_exists( 'value', $_data ) ) {
|
325 |
+
TInvWL_Form::setvalue( $_data['value'] );
|
326 |
+
unset( $_data['value'] );
|
327 |
+
}
|
328 |
+
extract( $_data ); // @codingStandardsIgnoreLine WordPress.VIP.RestrictedFunctions.extract
|
329 |
+
if ( self::$debug && is_string( $_template_name ) ) {
|
330 |
+
printf( "\r\n<!-- START: %s -->\r\n", esc_attr( @$_template_name ) ); // @codingStandardsIgnoreLine Generic.PHP.NoSilencedErrors.Discouraged
|
331 |
+
}
|
332 |
+
if ( is_object( $_template_name ) ) {
|
333 |
+
$_template_name->Run();
|
334 |
+
} else {
|
335 |
+
include self::file( $_template_name, $_type );
|
336 |
+
}
|
337 |
+
if ( self::$debug && is_string( $_template_name ) ) {
|
338 |
+
printf( "\r\n<!-- END: %s -->\r\n", esc_attr( @$_template_name ) ); // @codingStandardsIgnoreLine Generic.PHP.NoSilencedErrors.Discouraged
|
339 |
+
}
|
340 |
+
}
|
341 |
+
|
342 |
+
/**
|
343 |
+
* Generated header
|
344 |
+
*
|
345 |
+
* @param name $_name Title for page.
|
346 |
+
*/
|
347 |
+
public static function header( $_name = '' ) {
|
348 |
+
$status_panel = self::status_panel();
|
349 |
+
$status_panel = apply_filters( 'tinvwl_view_panelstatus', $status_panel );
|
350 |
+
include self::file( 'header', '' );
|
351 |
+
}
|
352 |
+
|
353 |
+
/**
|
354 |
+
* Status icon
|
355 |
+
*
|
356 |
+
* @return array
|
357 |
+
*/
|
358 |
+
private static function status_panel() {
|
359 |
+
return array(
|
360 |
+
sprintf( '<a class="tinvwl-btn grey w-icon md-icon smaller-txt" href="%s"><i class="fa fa-graduation-cap"></i><span class="tinvwl-txt">%s</span></a>', 'https://templateinvaders.com/documentation/ti-woocommerce-wishlist?utm_source=' . TINVWL_UTM_SOURCE . '&utm_campaign=' . TINVWL_UTM_CAMPAIGN . '&utm_medium=' . TINVWL_UTM_MEDIUM . '&utm_content=header_documentation&partner=' . TINVWL_UTM_SOURCE, __( 'read documentation', 'ti-woocommerce-wishlist' ) ),
|
361 |
+
);
|
362 |
+
}
|
363 |
+
|
364 |
+
/**
|
365 |
+
* Formated admin url
|
366 |
+
*
|
367 |
+
* @param string $page Page title.
|
368 |
+
* @param string $cat Category title.
|
369 |
+
* @param array $arg Arguments array.
|
370 |
+
*
|
371 |
+
* @return string
|
372 |
+
*/
|
373 |
+
public static function admin_url( $page, $cat = '', $arg = array() ) {
|
374 |
+
$protocol = is_ssl() ? 'https' : 'http';
|
375 |
+
$glue = '-';
|
376 |
+
$params = array(
|
377 |
+
'page' => implode( $glue, array_filter( array( self::$_n, $page ) ) ),
|
378 |
+
'cat' => $cat,
|
379 |
+
);
|
380 |
+
if ( is_array( $arg ) ) {
|
381 |
+
$params = array_merge( $params, $arg );
|
382 |
+
}
|
383 |
+
$params = array_filter( $params );
|
384 |
+
$params = http_build_query( $params );
|
385 |
+
if ( is_string( $arg ) ) {
|
386 |
+
$params = $params . '&' . $arg;
|
387 |
+
}
|
388 |
+
|
389 |
+
return admin_url( sprintf( 'admin.php?%s', $params ), $protocol );
|
390 |
+
}
|
391 |
+
}
|
languages/ti-woocommerce-wishlist.pot
CHANGED
@@ -3,7 +3,7 @@ msgid ""
|
|
3 |
msgstr ""
|
4 |
"Project-Id-Version: WooCommerce Wishlist Plugin\n"
|
5 |
"Report-Msgid-Bugs-To: \n"
|
6 |
-
"POT-Creation-Date: 2017-12-
|
7 |
"POT-Revision-Date: Sun Apr 10 2016 12:21:06 GMT+0200 (Västeuropa, "
|
8 |
"sommartid)\n"
|
9 |
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
@@ -40,15 +40,15 @@ msgstr ""
|
|
40 |
msgid "Template Custom CSS"
|
41 |
msgstr ""
|
42 |
|
43 |
-
#: admin/basestyle.helper.php:114 admin/settings/general.class.php:
|
44 |
msgid "Save Settings"
|
45 |
msgstr ""
|
46 |
|
47 |
-
#: admin/basestyle.helper.php:120 admin/settings/general.class.php:
|
48 |
msgid "Reset"
|
49 |
msgstr ""
|
50 |
|
51 |
-
#: admin/basestyle.helper.php:126 admin/settings/general.class.php:
|
52 |
msgid "Save"
|
53 |
msgstr ""
|
54 |
|
@@ -72,218 +72,244 @@ msgid "Wishlist Page"
|
|
72 |
msgstr ""
|
73 |
|
74 |
#: admin/settings/general.class.php:77
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
msgid "Show Link to Wishlist in my account"
|
76 |
msgstr ""
|
77 |
|
78 |
-
#: admin/settings/general.class.php:
|
79 |
msgid "Remove Product from Wishlist if added to cart"
|
80 |
msgstr ""
|
81 |
|
82 |
-
#: admin/settings/general.class.php:
|
83 |
msgid "Remove by anyone"
|
84 |
msgstr ""
|
85 |
|
86 |
-
#: admin/settings/general.class.php:
|
87 |
msgid "Remove product from Wishlist on second click"
|
88 |
msgstr ""
|
89 |
|
90 |
-
#: admin/settings/general.class.php:
|
91 |
msgid "Show successful notice in popup"
|
92 |
msgstr ""
|
93 |
|
94 |
-
#: admin/settings/general.class.php:
|
95 |
msgid ""
|
96 |
"This option allows to show/hide a popup with successful or error notices "
|
97 |
"after addition or removing products from a Wishlist."
|
98 |
msgstr ""
|
99 |
|
100 |
-
#: admin/settings/general.class.php:
|
101 |
msgid "\"View Wishlist\" button Text"
|
102 |
msgstr ""
|
103 |
|
104 |
-
#: admin/settings/general.class.php:
|
105 |
msgid "Redirect to Wishlist"
|
106 |
msgstr ""
|
107 |
|
108 |
-
#: admin/settings/general.class.php:
|
109 |
msgid ""
|
110 |
"If enabled, user will be redirected to wishlist page after 5 sec from adding "
|
111 |
"product to wishlist."
|
112 |
msgstr ""
|
113 |
|
114 |
-
#: admin/settings/general.class.php:
|
115 |
msgid "\"Product added to Wishlist\" Text"
|
116 |
msgstr ""
|
117 |
|
118 |
-
#: admin/settings/general.class.php:
|
119 |
msgid "\"Product already in Wishlist\" Text"
|
120 |
msgstr ""
|
121 |
|
122 |
-
#: admin/settings/general.class.php:
|
123 |
msgid ""
|
124 |
"This notification will be shown if user will try to add a product that is "
|
125 |
"already in the wishlist."
|
126 |
msgstr ""
|
127 |
|
128 |
-
#: admin/settings/general.class.php:
|
129 |
msgid "\"Product removed from Wishlist\" Text"
|
130 |
msgstr ""
|
131 |
|
132 |
-
#: admin/settings/general.class.php:
|
133 |
msgid ""
|
134 |
"This notification will be shown once the product is removed from Wishlist on "
|
135 |
"a single or a catalog page."
|
136 |
msgstr ""
|
137 |
|
138 |
-
#: admin/settings/general.class.php:
|
139 |
msgid "Wishlist Page Options"
|
140 |
msgstr ""
|
141 |
|
142 |
-
#: admin/settings/general.class.php:
|
143 |
msgid "Coming soon"
|
144 |
msgstr ""
|
145 |
|
146 |
-
#: admin/settings/general.class.php:
|
147 |
msgid "My Wishlist"
|
148 |
msgstr ""
|
149 |
|
150 |
-
#: admin/settings/general.class.php:
|
151 |
msgid "Wishlist Processing Options"
|
152 |
msgstr ""
|
153 |
|
154 |
-
#: admin/settings/general.class.php:
|
155 |
msgid "Automatic removal"
|
156 |
msgstr ""
|
157 |
|
158 |
-
#: admin/settings/general.class.php:
|
159 |
msgid "Remove condition"
|
160 |
msgstr ""
|
161 |
|
162 |
-
#: admin/settings/general.class.php:
|
163 |
msgid "Add to Cart"
|
164 |
msgstr ""
|
165 |
|
166 |
-
#: admin/settings/general.class.php:
|
167 |
msgid "Product page \"Add to Wishlist\" Button Settings"
|
168 |
msgstr ""
|
169 |
|
170 |
-
#: admin/settings/general.class.php:
|
171 |
#: views/wizard/step-button.php:32
|
172 |
msgid "Button position"
|
173 |
msgstr ""
|
174 |
|
175 |
-
#: admin/settings/general.class.php:
|
176 |
msgid ""
|
177 |
"Add this shortcode <code>[ti_wishlists_addtowishlist]</code> anywhere on "
|
178 |
"product page, if you have chosen custom position for product button. You "
|
179 |
"will have to do this for each product."
|
180 |
msgstr ""
|
181 |
|
182 |
-
#: admin/settings/general.class.php:
|
183 |
#: includes/wizard.class.php:400
|
184 |
msgid "After \"Add to Cart\" button"
|
185 |
msgstr ""
|
186 |
|
187 |
-
#: admin/settings/general.class.php:
|
188 |
#: includes/wizard.class.php:401
|
189 |
msgid "Before \"Add to Cart\" button"
|
190 |
msgstr ""
|
191 |
|
192 |
-
#: admin/settings/general.class.php:
|
193 |
#: includes/wizard.class.php:402
|
194 |
msgid "Custom position with code"
|
195 |
msgstr ""
|
196 |
|
197 |
-
#: admin/settings/general.class.php:
|
198 |
msgid "Button type"
|
199 |
msgstr ""
|
200 |
|
201 |
-
#: admin/settings/general.class.php:
|
202 |
msgid "Link"
|
203 |
msgstr ""
|
204 |
|
205 |
-
#: admin/settings/general.class.php:
|
206 |
#: includes/wizard.class.php:389
|
207 |
msgid "Button"
|
208 |
msgstr ""
|
209 |
|
210 |
-
#: admin/settings/general.class.php:
|
211 |
msgid "\"Add to Wishlist\" Icon"
|
212 |
msgstr ""
|
213 |
|
214 |
-
#: admin/settings/general.class.php:
|
215 |
msgid ""
|
216 |
"You can choose from our predefined icons or upload your custom icon. Custom "
|
217 |
"icon size is limited to 16x16 px."
|
218 |
msgstr ""
|
219 |
|
220 |
-
#: admin/settings/general.class.php:
|
221 |
-
#: admin/settings/general.class.php:
|
222 |
msgid "None"
|
223 |
msgstr ""
|
224 |
|
225 |
-
#: admin/settings/general.class.php:
|
226 |
-
#: admin/settings/general.class.php:
|
227 |
msgid "Heart"
|
228 |
msgstr ""
|
229 |
|
230 |
-
#: admin/settings/general.class.php:
|
231 |
-
#: admin/settings/general.class.php:
|
232 |
msgid "Heart+"
|
233 |
msgstr ""
|
234 |
|
235 |
-
#: admin/settings/general.class.php:
|
236 |
-
#: admin/settings/general.class.php:
|
237 |
msgid "Custom"
|
238 |
msgstr ""
|
239 |
|
240 |
-
#: admin/settings/general.class.php:
|
241 |
-
#: admin/settings/general.class.php:
|
242 |
msgid "Upload"
|
243 |
msgstr ""
|
244 |
|
245 |
-
#: admin/settings/general.class.php:
|
246 |
msgid "\"Add to Wishlist\" Icon Color"
|
247 |
msgstr ""
|
248 |
|
249 |
-
#: admin/settings/general.class.php:
|
250 |
-
#: admin/settings/general.class.php:
|
251 |
msgid "Black"
|
252 |
msgstr ""
|
253 |
|
254 |
-
#: admin/settings/general.class.php:
|
255 |
-
#: admin/settings/general.class.php:
|
256 |
msgid "White"
|
257 |
msgstr ""
|
258 |
|
259 |
-
#: admin/settings/general.class.php:
|
260 |
msgid "\"Add to Wishlist\" button Text"
|
261 |
msgstr ""
|
262 |
|
263 |
-
#: admin/settings/general.class.php:
|
264 |
msgid "\"Remove from Wishlist\" Button Text"
|
265 |
msgstr ""
|
266 |
|
267 |
-
#: admin/settings/general.class.php:
|
268 |
msgid "Product listing Button Settings"
|
269 |
msgstr ""
|
270 |
|
271 |
-
#: admin/settings/general.class.php:
|
272 |
msgid ""
|
273 |
"These are separate settings for the \"Add to Wishlist\" button on a product "
|
274 |
"listing (Shop page, categories, etc.). You can also adjust button and text "
|
275 |
"colors, size, etc. in a <code>TI Wishlist > Style Options.</code>"
|
276 |
msgstr ""
|
277 |
|
278 |
-
#: admin/settings/general.class.php:
|
279 |
msgid "Show in Product Listing"
|
280 |
msgstr ""
|
281 |
|
282 |
-
#: admin/settings/general.class.php:
|
283 |
msgid "Above Thumbnail"
|
284 |
msgstr ""
|
285 |
|
286 |
-
#: admin/settings/general.class.php:
|
287 |
msgid ""
|
288 |
"Note: if \"Custom position with code\" option is applied, the \"Add to "
|
289 |
"Wishlist\" button should be added into template using <code>do_shortcode()</"
|
@@ -291,79 +317,79 @@ msgid ""
|
|
291 |
"><code>do_shortcode(\"[ti_wishlists_addtowishlist loop=yes]\")</code>"
|
292 |
msgstr ""
|
293 |
|
294 |
-
#: admin/settings/general.class.php:
|
295 |
msgid "\"Add to Wishlist\" Text"
|
296 |
msgstr ""
|
297 |
|
298 |
-
#: admin/settings/general.class.php:
|
299 |
msgid "Wishlist Product Settings"
|
300 |
msgstr ""
|
301 |
|
302 |
-
#: admin/settings/general.class.php:
|
303 |
msgid ""
|
304 |
"Following options allows you to choose what information/functionality to "
|
305 |
"show/enable in wishlist table on wishlist page."
|
306 |
msgstr ""
|
307 |
|
308 |
-
#: admin/settings/general.class.php:
|
309 |
msgid "Show \"Add to Cart\" button"
|
310 |
msgstr ""
|
311 |
|
312 |
-
#: admin/settings/general.class.php:
|
313 |
msgid "\"Add to Cart\" Text"
|
314 |
msgstr ""
|
315 |
|
316 |
-
#: admin/settings/general.class.php:
|
317 |
msgid "Show Unit price"
|
318 |
msgstr ""
|
319 |
|
320 |
-
#: admin/settings/general.class.php:
|
321 |
msgid "Show Stock status"
|
322 |
msgstr ""
|
323 |
|
324 |
-
#: admin/settings/general.class.php:
|
325 |
msgid "Show Date of addition"
|
326 |
msgstr ""
|
327 |
|
328 |
-
#: admin/settings/general.class.php:
|
329 |
msgid "Wishlist Table Settings"
|
330 |
msgstr ""
|
331 |
|
332 |
-
#: admin/settings/general.class.php:
|
333 |
msgid ""
|
334 |
"Following options will help user to manage and add products to cart from "
|
335 |
"wishlist table in bulk."
|
336 |
msgstr ""
|
337 |
|
338 |
-
#: admin/settings/general.class.php:
|
339 |
msgid "Show Checkboxes"
|
340 |
msgstr ""
|
341 |
|
342 |
-
#: admin/settings/general.class.php:
|
343 |
msgid "Show Actions button"
|
344 |
msgstr ""
|
345 |
|
346 |
-
#: admin/settings/general.class.php:
|
347 |
msgid "Bulk actions drop down at the bottom of wishlist table"
|
348 |
msgstr ""
|
349 |
|
350 |
-
#: admin/settings/general.class.php:
|
351 |
msgid "Show \"Add Selected to Cart\" button"
|
352 |
msgstr ""
|
353 |
|
354 |
-
#: admin/settings/general.class.php:
|
355 |
msgid "\"Add Selected to Cart\" Button Text"
|
356 |
msgstr ""
|
357 |
|
358 |
-
#: admin/settings/general.class.php:
|
359 |
msgid "Show \"Add All to Cart\" button"
|
360 |
msgstr ""
|
361 |
|
362 |
-
#: admin/settings/general.class.php:
|
363 |
msgid "\"Add All to Cart\" Button Text"
|
364 |
msgstr ""
|
365 |
|
366 |
-
#: admin/settings/general.class.php:
|
367 |
msgid ""
|
368 |
"Following options enable/disable Social share icons below wishlist table on "
|
369 |
"wishlist page. Wishlist owner can easily share their wishlists using this "
|
@@ -371,47 +397,47 @@ msgid ""
|
|
371 |
"shared status, private wishlists can't be shared."
|
372 |
msgstr ""
|
373 |
|
374 |
-
#: admin/settings/general.class.php:
|
375 |
msgid "Social Networks Sharing Options"
|
376 |
msgstr ""
|
377 |
|
378 |
-
#: admin/settings/general.class.php:
|
379 |
msgid "Show \"Facebook\" Button"
|
380 |
msgstr ""
|
381 |
|
382 |
-
#: admin/settings/general.class.php:
|
383 |
msgid "Show \"Twitter\" Button"
|
384 |
msgstr ""
|
385 |
|
386 |
-
#: admin/settings/general.class.php:
|
387 |
msgid "Show \"Pinterest\" Button"
|
388 |
msgstr ""
|
389 |
|
390 |
-
#: admin/settings/general.class.php:
|
391 |
msgid "Show \"Google+\" Button"
|
392 |
msgstr ""
|
393 |
|
394 |
-
#: admin/settings/general.class.php:
|
395 |
msgid "Show \"Share by Email\" Button"
|
396 |
msgstr ""
|
397 |
|
398 |
-
#: admin/settings/general.class.php:
|
399 |
msgid "\"Share on\" Text"
|
400 |
msgstr ""
|
401 |
|
402 |
-
#: admin/settings/general.class.php:
|
403 |
msgid "Social Icons Color"
|
404 |
msgstr ""
|
405 |
|
406 |
-
#: admin/settings/general.class.php:
|
407 |
msgid "Dark"
|
408 |
msgstr ""
|
409 |
|
410 |
-
#: admin/settings/general.class.php:
|
411 |
msgid "Wishlist Products Counter"
|
412 |
msgstr ""
|
413 |
|
414 |
-
#: admin/settings/general.class.php:
|
415 |
#, php-format
|
416 |
msgid ""
|
417 |
"Add this shortcode <code>[ti_wishlist_products_counter]</code> anywhere into "
|
@@ -420,23 +446,23 @@ msgid ""
|
|
420 |
"\">Appearance -> Widgets</a> section."
|
421 |
msgstr ""
|
422 |
|
423 |
-
#: admin/settings/general.class.php:
|
424 |
msgid "\"Wishlist\" Icon"
|
425 |
msgstr ""
|
426 |
|
427 |
-
#: admin/settings/general.class.php:
|
428 |
msgid "\"Wishlist\" Icon Color"
|
429 |
msgstr ""
|
430 |
|
431 |
-
#: admin/settings/general.class.php:
|
432 |
msgid "Show counter text"
|
433 |
msgstr ""
|
434 |
|
435 |
-
#: admin/settings/general.class.php:
|
436 |
msgid "Counter Text"
|
437 |
msgstr ""
|
438 |
|
439 |
-
#: admin/settings/general.class.php:
|
440 |
msgid "Wishlist - "
|
441 |
msgstr ""
|
442 |
|
@@ -687,7 +713,7 @@ msgstr ""
|
|
687 |
msgid "Accent Buttons Text Hover Color"
|
688 |
msgstr ""
|
689 |
|
690 |
-
#: admin/settings/upgrade.class.php:34 admin/tinvwl.class.php:
|
691 |
msgid "Upgrade to Premium"
|
692 |
msgstr ""
|
693 |
|
@@ -709,48 +735,48 @@ msgstr ""
|
|
709 |
msgid "Share your love with us."
|
710 |
msgstr ""
|
711 |
|
712 |
-
#: admin/tinvwl.class.php:
|
713 |
msgid ""
|
714 |
"<strong>Welcome to WooCommerce Wishlist Plugin<strong> – You‘re almost ready "
|
715 |
"to start :)"
|
716 |
msgstr ""
|
717 |
|
718 |
-
#: admin/tinvwl.class.php:
|
719 |
msgid "Run the Setup Wizard"
|
720 |
msgstr ""
|
721 |
|
722 |
-
#: admin/tinvwl.class.php:
|
723 |
msgid "Skip Setup"
|
724 |
msgstr ""
|
725 |
|
726 |
-
#: admin/tinvwl.class.php:
|
727 |
msgid "Dismiss"
|
728 |
msgstr ""
|
729 |
|
730 |
-
#: admin/tinvwl.class.php:
|
731 |
msgid "Link to Wishlists does not work!"
|
732 |
msgstr ""
|
733 |
|
734 |
-
#: admin/tinvwl.class.php:
|
735 |
msgid "Please apply the Wishlist page"
|
736 |
msgstr ""
|
737 |
|
738 |
-
#: admin/tinvwl.class.php:
|
739 |
msgid " or "
|
740 |
msgstr ""
|
741 |
|
742 |
-
#: admin/tinvwl.class.php:
|
743 |
msgid "Are you sure you want to reset the settings?"
|
744 |
msgstr ""
|
745 |
|
746 |
-
#: admin/tinvwl.class.php:
|
747 |
#, php-format
|
748 |
msgid ""
|
749 |
"<code>%1$s</code> version <strong style=\"color:red\">%2$s</strong> is out "
|
750 |
"of date. The core version is <strong style=\"color:red\">%3$s</strong>"
|
751 |
msgstr ""
|
752 |
|
753 |
-
#: admin/tinvwl.class.php:
|
754 |
#, php-format
|
755 |
msgid ""
|
756 |
"<strong>Your theme (%1$s) contains outdated copies of some WooCommerce "
|
@@ -761,7 +787,7 @@ msgid ""
|
|
761 |
"the theme."
|
762 |
msgstr ""
|
763 |
|
764 |
-
#: admin/tinvwl.class.php:
|
765 |
#, php-format
|
766 |
msgid ""
|
767 |
"The \"Add to Wishlist\" button may work improperly in a product type \"%1$s"
|
@@ -877,7 +903,7 @@ msgid "Errors(%s)"
|
|
877 |
msgstr ""
|
878 |
|
879 |
#: includes/view.helper.php:215
|
880 |
-
msgid "
|
881 |
msgstr ""
|
882 |
|
883 |
#: includes/view.helper.php:360
|
@@ -925,6 +951,14 @@ msgstr ""
|
|
925 |
msgid "Ready!"
|
926 |
msgstr ""
|
927 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
928 |
#: public/tinvwl.class.php:285
|
929 |
#, php-format
|
930 |
msgid "%1$s by %2$s"
|
@@ -1010,15 +1044,15 @@ msgstr ""
|
|
1010 |
msgid "%s has not been removed from wishlist."
|
1011 |
msgstr ""
|
1012 |
|
1013 |
-
#: public/wishlist/view.class.php:
|
1014 |
msgid "Return to Wishlist"
|
1015 |
msgstr ""
|
1016 |
|
1017 |
-
#: public/wishlist/view.class.php:
|
1018 |
msgid "Previous Page"
|
1019 |
msgstr ""
|
1020 |
|
1021 |
-
#: public/wishlist/view.class.php:
|
1022 |
msgid "Next Page"
|
1023 |
msgstr ""
|
1024 |
|
3 |
msgstr ""
|
4 |
"Project-Id-Version: WooCommerce Wishlist Plugin\n"
|
5 |
"Report-Msgid-Bugs-To: \n"
|
6 |
+
"POT-Creation-Date: 2017-12-14 22:49+0700\n"
|
7 |
"POT-Revision-Date: Sun Apr 10 2016 12:21:06 GMT+0200 (Västeuropa, "
|
8 |
"sommartid)\n"
|
9 |
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
40 |
msgid "Template Custom CSS"
|
41 |
msgstr ""
|
42 |
|
43 |
+
#: admin/basestyle.helper.php:114 admin/settings/general.class.php:649
|
44 |
msgid "Save Settings"
|
45 |
msgstr ""
|
46 |
|
47 |
+
#: admin/basestyle.helper.php:120 admin/settings/general.class.php:655
|
48 |
msgid "Reset"
|
49 |
msgstr ""
|
50 |
|
51 |
+
#: admin/basestyle.helper.php:126 admin/settings/general.class.php:661
|
52 |
msgid "Save"
|
53 |
msgstr ""
|
54 |
|
72 |
msgstr ""
|
73 |
|
74 |
#: admin/settings/general.class.php:77
|
75 |
+
msgid "Require Login"
|
76 |
+
msgstr ""
|
77 |
+
|
78 |
+
#: admin/settings/general.class.php:78
|
79 |
+
msgid "Disallows guests to use Wishlist functionality until they sign-in."
|
80 |
+
msgstr ""
|
81 |
+
|
82 |
+
#: admin/settings/general.class.php:87
|
83 |
+
msgid "Redirect to Login Page"
|
84 |
+
msgstr ""
|
85 |
+
|
86 |
+
#: admin/settings/general.class.php:88
|
87 |
+
msgid ""
|
88 |
+
"Currently this option could not be changed because \"Show successful notice "
|
89 |
+
"in popup\" is disabled. Guests will be redirected automatically to a login "
|
90 |
+
"page."
|
91 |
+
msgstr ""
|
92 |
+
|
93 |
+
#: admin/settings/general.class.php:88
|
94 |
+
msgid ""
|
95 |
+
"If enabled, guests will be redirected to a login page once clicking the "
|
96 |
+
"\"Add to Wishlist\" button or \"Wishlist Products Counter\" link. Otherwise "
|
97 |
+
"a popup with login required notice will appear."
|
98 |
+
msgstr ""
|
99 |
+
|
100 |
+
#: admin/settings/general.class.php:95
|
101 |
msgid "Show Link to Wishlist in my account"
|
102 |
msgstr ""
|
103 |
|
104 |
+
#: admin/settings/general.class.php:101
|
105 |
msgid "Remove Product from Wishlist if added to cart"
|
106 |
msgstr ""
|
107 |
|
108 |
+
#: admin/settings/general.class.php:108 admin/settings/general.class.php:221
|
109 |
msgid "Remove by anyone"
|
110 |
msgstr ""
|
111 |
|
112 |
+
#: admin/settings/general.class.php:115
|
113 |
msgid "Remove product from Wishlist on second click"
|
114 |
msgstr ""
|
115 |
|
116 |
+
#: admin/settings/general.class.php:129
|
117 |
msgid "Show successful notice in popup"
|
118 |
msgstr ""
|
119 |
|
120 |
+
#: admin/settings/general.class.php:130
|
121 |
msgid ""
|
122 |
"This option allows to show/hide a popup with successful or error notices "
|
123 |
"after addition or removing products from a Wishlist."
|
124 |
msgstr ""
|
125 |
|
126 |
+
#: admin/settings/general.class.php:140
|
127 |
msgid "\"View Wishlist\" button Text"
|
128 |
msgstr ""
|
129 |
|
130 |
+
#: admin/settings/general.class.php:147
|
131 |
msgid "Redirect to Wishlist"
|
132 |
msgstr ""
|
133 |
|
134 |
+
#: admin/settings/general.class.php:148
|
135 |
msgid ""
|
136 |
"If enabled, user will be redirected to wishlist page after 5 sec from adding "
|
137 |
"product to wishlist."
|
138 |
msgstr ""
|
139 |
|
140 |
+
#: admin/settings/general.class.php:155
|
141 |
msgid "\"Product added to Wishlist\" Text"
|
142 |
msgstr ""
|
143 |
|
144 |
+
#: admin/settings/general.class.php:162
|
145 |
msgid "\"Product already in Wishlist\" Text"
|
146 |
msgstr ""
|
147 |
|
148 |
+
#: admin/settings/general.class.php:163
|
149 |
msgid ""
|
150 |
"This notification will be shown if user will try to add a product that is "
|
151 |
"already in the wishlist."
|
152 |
msgstr ""
|
153 |
|
154 |
+
#: admin/settings/general.class.php:170
|
155 |
msgid "\"Product removed from Wishlist\" Text"
|
156 |
msgstr ""
|
157 |
|
158 |
+
#: admin/settings/general.class.php:171
|
159 |
msgid ""
|
160 |
"This notification will be shown once the product is removed from Wishlist on "
|
161 |
"a single or a catalog page."
|
162 |
msgstr ""
|
163 |
|
164 |
+
#: admin/settings/general.class.php:179
|
165 |
msgid "Wishlist Page Options"
|
166 |
msgstr ""
|
167 |
|
168 |
+
#: admin/settings/general.class.php:180 admin/settings/general.class.php:197
|
169 |
msgid "Coming soon"
|
170 |
msgstr ""
|
171 |
|
172 |
+
#: admin/settings/general.class.php:187 views/wizard/step-page.php:36
|
173 |
msgid "My Wishlist"
|
174 |
msgstr ""
|
175 |
|
176 |
+
#: admin/settings/general.class.php:196
|
177 |
msgid "Wishlist Processing Options"
|
178 |
msgstr ""
|
179 |
|
180 |
+
#: admin/settings/general.class.php:204
|
181 |
msgid "Automatic removal"
|
182 |
msgstr ""
|
183 |
|
184 |
+
#: admin/settings/general.class.php:211
|
185 |
msgid "Remove condition"
|
186 |
msgstr ""
|
187 |
|
188 |
+
#: admin/settings/general.class.php:214
|
189 |
msgid "Add to Cart"
|
190 |
msgstr ""
|
191 |
|
192 |
+
#: admin/settings/general.class.php:229
|
193 |
msgid "Product page \"Add to Wishlist\" Button Settings"
|
194 |
msgstr ""
|
195 |
|
196 |
+
#: admin/settings/general.class.php:235 admin/settings/general.class.php:336
|
197 |
#: views/wizard/step-button.php:32
|
198 |
msgid "Button position"
|
199 |
msgstr ""
|
200 |
|
201 |
+
#: admin/settings/general.class.php:236
|
202 |
msgid ""
|
203 |
"Add this shortcode <code>[ti_wishlists_addtowishlist]</code> anywhere on "
|
204 |
"product page, if you have chosen custom position for product button. You "
|
205 |
"will have to do this for each product."
|
206 |
msgstr ""
|
207 |
|
208 |
+
#: admin/settings/general.class.php:239 admin/settings/general.class.php:339
|
209 |
#: includes/wizard.class.php:400
|
210 |
msgid "After \"Add to Cart\" button"
|
211 |
msgstr ""
|
212 |
|
213 |
+
#: admin/settings/general.class.php:240 admin/settings/general.class.php:340
|
214 |
#: includes/wizard.class.php:401
|
215 |
msgid "Before \"Add to Cart\" button"
|
216 |
msgstr ""
|
217 |
|
218 |
+
#: admin/settings/general.class.php:241 admin/settings/general.class.php:342
|
219 |
#: includes/wizard.class.php:402
|
220 |
msgid "Custom position with code"
|
221 |
msgstr ""
|
222 |
|
223 |
+
#: admin/settings/general.class.php:247 admin/settings/general.class.php:349
|
224 |
msgid "Button type"
|
225 |
msgstr ""
|
226 |
|
227 |
+
#: admin/settings/general.class.php:250 admin/settings/general.class.php:352
|
228 |
msgid "Link"
|
229 |
msgstr ""
|
230 |
|
231 |
+
#: admin/settings/general.class.php:251 admin/settings/general.class.php:353
|
232 |
#: includes/wizard.class.php:389
|
233 |
msgid "Button"
|
234 |
msgstr ""
|
235 |
|
236 |
+
#: admin/settings/general.class.php:257 admin/settings/general.class.php:359
|
237 |
msgid "\"Add to Wishlist\" Icon"
|
238 |
msgstr ""
|
239 |
|
240 |
+
#: admin/settings/general.class.php:258 admin/settings/general.class.php:592
|
241 |
msgid ""
|
242 |
"You can choose from our predefined icons or upload your custom icon. Custom "
|
243 |
"icon size is limited to 16x16 px."
|
244 |
msgstr ""
|
245 |
|
246 |
+
#: admin/settings/general.class.php:261 admin/settings/general.class.php:362
|
247 |
+
#: admin/settings/general.class.php:587
|
248 |
msgid "None"
|
249 |
msgstr ""
|
250 |
|
251 |
+
#: admin/settings/general.class.php:262 admin/settings/general.class.php:363
|
252 |
+
#: admin/settings/general.class.php:588
|
253 |
msgid "Heart"
|
254 |
msgstr ""
|
255 |
|
256 |
+
#: admin/settings/general.class.php:263 admin/settings/general.class.php:364
|
257 |
+
#: admin/settings/general.class.php:589
|
258 |
msgid "Heart+"
|
259 |
msgstr ""
|
260 |
|
261 |
+
#: admin/settings/general.class.php:264 admin/settings/general.class.php:365
|
262 |
+
#: admin/settings/general.class.php:590
|
263 |
msgid "Custom"
|
264 |
msgstr ""
|
265 |
|
266 |
+
#: admin/settings/general.class.php:281 admin/settings/general.class.php:381
|
267 |
+
#: admin/settings/general.class.php:607
|
268 |
msgid "Upload"
|
269 |
msgstr ""
|
270 |
|
271 |
+
#: admin/settings/general.class.php:290 admin/settings/general.class.php:390
|
272 |
msgid "\"Add to Wishlist\" Icon Color"
|
273 |
msgstr ""
|
274 |
|
275 |
+
#: admin/settings/general.class.php:292 admin/settings/general.class.php:392
|
276 |
+
#: admin/settings/general.class.php:618
|
277 |
msgid "Black"
|
278 |
msgstr ""
|
279 |
|
280 |
+
#: admin/settings/general.class.php:293 admin/settings/general.class.php:393
|
281 |
+
#: admin/settings/general.class.php:569 admin/settings/general.class.php:619
|
282 |
msgid "White"
|
283 |
msgstr ""
|
284 |
|
285 |
+
#: admin/settings/general.class.php:300
|
286 |
msgid "\"Add to Wishlist\" button Text"
|
287 |
msgstr ""
|
288 |
|
289 |
+
#: admin/settings/general.class.php:306 admin/settings/general.class.php:406
|
290 |
msgid "\"Remove from Wishlist\" Button Text"
|
291 |
msgstr ""
|
292 |
|
293 |
+
#: admin/settings/general.class.php:314
|
294 |
msgid "Product listing Button Settings"
|
295 |
msgstr ""
|
296 |
|
297 |
+
#: admin/settings/general.class.php:315
|
298 |
msgid ""
|
299 |
"These are separate settings for the \"Add to Wishlist\" button on a product "
|
300 |
"listing (Shop page, categories, etc.). You can also adjust button and text "
|
301 |
"colors, size, etc. in a <code>TI Wishlist > Style Options.</code>"
|
302 |
msgstr ""
|
303 |
|
304 |
+
#: admin/settings/general.class.php:321
|
305 |
msgid "Show in Product Listing"
|
306 |
msgstr ""
|
307 |
|
308 |
+
#: admin/settings/general.class.php:341
|
309 |
msgid "Above Thumbnail"
|
310 |
msgstr ""
|
311 |
|
312 |
+
#: admin/settings/general.class.php:344
|
313 |
msgid ""
|
314 |
"Note: if \"Custom position with code\" option is applied, the \"Add to "
|
315 |
"Wishlist\" button should be added into template using <code>do_shortcode()</"
|
317 |
"><code>do_shortcode(\"[ti_wishlists_addtowishlist loop=yes]\")</code>"
|
318 |
msgstr ""
|
319 |
|
320 |
+
#: admin/settings/general.class.php:400 views/wizard/step-button.php:41
|
321 |
msgid "\"Add to Wishlist\" Text"
|
322 |
msgstr ""
|
323 |
|
324 |
+
#: admin/settings/general.class.php:414
|
325 |
msgid "Wishlist Product Settings"
|
326 |
msgstr ""
|
327 |
|
328 |
+
#: admin/settings/general.class.php:415
|
329 |
msgid ""
|
330 |
"Following options allows you to choose what information/functionality to "
|
331 |
"show/enable in wishlist table on wishlist page."
|
332 |
msgstr ""
|
333 |
|
334 |
+
#: admin/settings/general.class.php:421
|
335 |
msgid "Show \"Add to Cart\" button"
|
336 |
msgstr ""
|
337 |
|
338 |
+
#: admin/settings/general.class.php:428
|
339 |
msgid "\"Add to Cart\" Text"
|
340 |
msgstr ""
|
341 |
|
342 |
+
#: admin/settings/general.class.php:435
|
343 |
msgid "Show Unit price"
|
344 |
msgstr ""
|
345 |
|
346 |
+
#: admin/settings/general.class.php:441
|
347 |
msgid "Show Stock status"
|
348 |
msgstr ""
|
349 |
|
350 |
+
#: admin/settings/general.class.php:447
|
351 |
msgid "Show Date of addition"
|
352 |
msgstr ""
|
353 |
|
354 |
+
#: admin/settings/general.class.php:454
|
355 |
msgid "Wishlist Table Settings"
|
356 |
msgstr ""
|
357 |
|
358 |
+
#: admin/settings/general.class.php:455
|
359 |
msgid ""
|
360 |
"Following options will help user to manage and add products to cart from "
|
361 |
"wishlist table in bulk."
|
362 |
msgstr ""
|
363 |
|
364 |
+
#: admin/settings/general.class.php:461
|
365 |
msgid "Show Checkboxes"
|
366 |
msgstr ""
|
367 |
|
368 |
+
#: admin/settings/general.class.php:473
|
369 |
msgid "Show Actions button"
|
370 |
msgstr ""
|
371 |
|
372 |
+
#: admin/settings/general.class.php:474
|
373 |
msgid "Bulk actions drop down at the bottom of wishlist table"
|
374 |
msgstr ""
|
375 |
|
376 |
+
#: admin/settings/general.class.php:480
|
377 |
msgid "Show \"Add Selected to Cart\" button"
|
378 |
msgstr ""
|
379 |
|
380 |
+
#: admin/settings/general.class.php:487
|
381 |
msgid "\"Add Selected to Cart\" Button Text"
|
382 |
msgstr ""
|
383 |
|
384 |
+
#: admin/settings/general.class.php:498
|
385 |
msgid "Show \"Add All to Cart\" button"
|
386 |
msgstr ""
|
387 |
|
388 |
+
#: admin/settings/general.class.php:505
|
389 |
msgid "\"Add All to Cart\" Button Text"
|
390 |
msgstr ""
|
391 |
|
392 |
+
#: admin/settings/general.class.php:518
|
393 |
msgid ""
|
394 |
"Following options enable/disable Social share icons below wishlist table on "
|
395 |
"wishlist page. Wishlist owner can easily share their wishlists using this "
|
397 |
"shared status, private wishlists can't be shared."
|
398 |
msgstr ""
|
399 |
|
400 |
+
#: admin/settings/general.class.php:524
|
401 |
msgid "Social Networks Sharing Options"
|
402 |
msgstr ""
|
403 |
|
404 |
+
#: admin/settings/general.class.php:530 views/wizard/step-social.php:26
|
405 |
msgid "Show \"Facebook\" Button"
|
406 |
msgstr ""
|
407 |
|
408 |
+
#: admin/settings/general.class.php:536 views/wizard/step-social.php:35
|
409 |
msgid "Show \"Twitter\" Button"
|
410 |
msgstr ""
|
411 |
|
412 |
+
#: admin/settings/general.class.php:542 views/wizard/step-social.php:44
|
413 |
msgid "Show \"Pinterest\" Button"
|
414 |
msgstr ""
|
415 |
|
416 |
+
#: admin/settings/general.class.php:548 views/wizard/step-social.php:53
|
417 |
msgid "Show \"Google+\" Button"
|
418 |
msgstr ""
|
419 |
|
420 |
+
#: admin/settings/general.class.php:554 views/wizard/step-social.php:62
|
421 |
msgid "Show \"Share by Email\" Button"
|
422 |
msgstr ""
|
423 |
|
424 |
+
#: admin/settings/general.class.php:560
|
425 |
msgid "\"Share on\" Text"
|
426 |
msgstr ""
|
427 |
|
428 |
+
#: admin/settings/general.class.php:566
|
429 |
msgid "Social Icons Color"
|
430 |
msgstr ""
|
431 |
|
432 |
+
#: admin/settings/general.class.php:568
|
433 |
msgid "Dark"
|
434 |
msgstr ""
|
435 |
|
436 |
+
#: admin/settings/general.class.php:577
|
437 |
msgid "Wishlist Products Counter"
|
438 |
msgstr ""
|
439 |
|
440 |
+
#: admin/settings/general.class.php:578
|
441 |
#, php-format
|
442 |
msgid ""
|
443 |
"Add this shortcode <code>[ti_wishlist_products_counter]</code> anywhere into "
|
446 |
"\">Appearance -> Widgets</a> section."
|
447 |
msgstr ""
|
448 |
|
449 |
+
#: admin/settings/general.class.php:584
|
450 |
msgid "\"Wishlist\" Icon"
|
451 |
msgstr ""
|
452 |
|
453 |
+
#: admin/settings/general.class.php:616
|
454 |
msgid "\"Wishlist\" Icon Color"
|
455 |
msgstr ""
|
456 |
|
457 |
+
#: admin/settings/general.class.php:626 public/widget/topwishlist.class.php:36
|
458 |
msgid "Show counter text"
|
459 |
msgstr ""
|
460 |
|
461 |
+
#: admin/settings/general.class.php:635 public/widget/topwishlist.class.php:41
|
462 |
msgid "Counter Text"
|
463 |
msgstr ""
|
464 |
|
465 |
+
#: admin/settings/general.class.php:636
|
466 |
msgid "Wishlist - "
|
467 |
msgstr ""
|
468 |
|
713 |
msgid "Accent Buttons Text Hover Color"
|
714 |
msgstr ""
|
715 |
|
716 |
+
#: admin/settings/upgrade.class.php:34 admin/tinvwl.class.php:214
|
717 |
msgid "Upgrade to Premium"
|
718 |
msgstr ""
|
719 |
|
735 |
msgid "Share your love with us."
|
736 |
msgstr ""
|
737 |
|
738 |
+
#: admin/tinvwl.class.php:95
|
739 |
msgid ""
|
740 |
"<strong>Welcome to WooCommerce Wishlist Plugin<strong> – You‘re almost ready "
|
741 |
"to start :)"
|
742 |
msgstr ""
|
743 |
|
744 |
+
#: admin/tinvwl.class.php:97 admin/tinvwl.class.php:113
|
745 |
msgid "Run the Setup Wizard"
|
746 |
msgstr ""
|
747 |
|
748 |
+
#: admin/tinvwl.class.php:99
|
749 |
msgid "Skip Setup"
|
750 |
msgstr ""
|
751 |
|
752 |
+
#: admin/tinvwl.class.php:107 includes/notice.helper.php:111
|
753 |
msgid "Dismiss"
|
754 |
msgstr ""
|
755 |
|
756 |
+
#: admin/tinvwl.class.php:108
|
757 |
msgid "Link to Wishlists does not work!"
|
758 |
msgstr ""
|
759 |
|
760 |
+
#: admin/tinvwl.class.php:110
|
761 |
msgid "Please apply the Wishlist page"
|
762 |
msgstr ""
|
763 |
|
764 |
+
#: admin/tinvwl.class.php:111
|
765 |
msgid " or "
|
766 |
msgstr ""
|
767 |
|
768 |
+
#: admin/tinvwl.class.php:174
|
769 |
msgid "Are you sure you want to reset the settings?"
|
770 |
msgstr ""
|
771 |
|
772 |
+
#: admin/tinvwl.class.php:253
|
773 |
#, php-format
|
774 |
msgid ""
|
775 |
"<code>%1$s</code> version <strong style=\"color:red\">%2$s</strong> is out "
|
776 |
"of date. The core version is <strong style=\"color:red\">%3$s</strong>"
|
777 |
msgstr ""
|
778 |
|
779 |
+
#: admin/tinvwl.class.php:279
|
780 |
#, php-format
|
781 |
msgid ""
|
782 |
"<strong>Your theme (%1$s) contains outdated copies of some WooCommerce "
|
787 |
"the theme."
|
788 |
msgstr ""
|
789 |
|
790 |
+
#: admin/tinvwl.class.php:404
|
791 |
#, php-format
|
792 |
msgid ""
|
793 |
"The \"Add to Wishlist\" button may work improperly in a product type \"%1$s"
|
903 |
msgstr ""
|
904 |
|
905 |
#: includes/view.helper.php:215
|
906 |
+
msgid "Useful Tip"
|
907 |
msgstr ""
|
908 |
|
909 |
#: includes/view.helper.php:360
|
951 |
msgid "Ready!"
|
952 |
msgstr ""
|
953 |
|
954 |
+
#: public/addtowishlist.class.php:168
|
955 |
+
msgid "Please, login to add products to Wishlist"
|
956 |
+
msgstr ""
|
957 |
+
|
958 |
+
#: public/addtowishlist.class.php:170
|
959 |
+
msgid "Login"
|
960 |
+
msgstr ""
|
961 |
+
|
962 |
#: public/tinvwl.class.php:285
|
963 |
#, php-format
|
964 |
msgid "%1$s by %2$s"
|
1044 |
msgid "%s has not been removed from wishlist."
|
1045 |
msgstr ""
|
1046 |
|
1047 |
+
#: public/wishlist/view.class.php:341
|
1048 |
msgid "Return to Wishlist"
|
1049 |
msgstr ""
|
1050 |
|
1051 |
+
#: public/wishlist/view.class.php:421
|
1052 |
msgid "Previous Page"
|
1053 |
msgstr ""
|
1054 |
|
1055 |
+
#: public/wishlist/view.class.php:430
|
1056 |
msgid "Next Page"
|
1057 |
msgstr ""
|
1058 |
|
public/addtowishlist.class.php
CHANGED
@@ -1,594 +1,609 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Add to wishlists shortcode and hooks
|
4 |
-
*
|
5 |
-
* @since 1.0.0
|
6 |
-
* @package TInvWishlist\Public
|
7 |
-
*/
|
8 |
-
|
9 |
-
// If this file is called directly, abort.
|
10 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
11 |
-
die;
|
12 |
-
}
|
13 |
-
|
14 |
-
/**
|
15 |
-
* Add to wishlists shortcode and hooks
|
16 |
-
*/
|
17 |
-
class TInvWL_Public_AddToWishlist {
|
18 |
-
|
19 |
-
/**
|
20 |
-
* Plugin name
|
21 |
-
*
|
22 |
-
* @var string
|
23 |
-
*/
|
24 |
-
private $_n;
|
25 |
-
|
26 |
-
/**
|
27 |
-
* Global product
|
28 |
-
*
|
29 |
-
* @var object
|
30 |
-
*/
|
31 |
-
private $product;
|
32 |
-
/**
|
33 |
-
* This user wishlists
|
34 |
-
*
|
35 |
-
* @var array
|
36 |
-
*/
|
37 |
-
private $user_wishlist;
|
38 |
-
|
39 |
-
/**
|
40 |
-
* This wishlists and product
|
41 |
-
*
|
42 |
-
* @var array
|
43 |
-
*/
|
44 |
-
private $wishlist;
|
45 |
-
|
46 |
-
/**
|
47 |
-
* Check is loop button
|
48 |
-
*
|
49 |
-
* @var bolean
|
50 |
-
*/
|
51 |
-
private $is_loop;
|
52 |
-
|
53 |
-
/**
|
54 |
-
* This class
|
55 |
-
*
|
56 |
-
* @var \TInvWL_Public_AddToWishlist
|
57 |
-
*/
|
58 |
-
protected static $_instance = null;
|
59 |
-
|
60 |
-
/**
|
61 |
-
* Get this class object
|
62 |
-
*
|
63 |
-
* @param string $plugin_name Plugin name.
|
64 |
-
*
|
65 |
-
* @return \TInvWL_Public_AddToWishlist
|
66 |
-
*/
|
67 |
-
public static function instance( $plugin_name = TINVWL_PREFIX ) {
|
68 |
-
if ( is_null( self::$_instance ) ) {
|
69 |
-
self::$_instance = new self( $plugin_name );
|
70 |
-
}
|
71 |
-
|
72 |
-
return self::$_instance;
|
73 |
-
}
|
74 |
-
|
75 |
-
/**
|
76 |
-
* Constructor
|
77 |
-
*
|
78 |
-
* @param string $plugin_name Plugin name.
|
79 |
-
*/
|
80 |
-
function __construct( $plugin_name ) {
|
81 |
-
$this->_n = $plugin_name;
|
82 |
-
$this->is_loop = false;
|
83 |
-
$this->define_hooks();
|
84 |
-
}
|
85 |
-
|
86 |
-
/**
|
87 |
-
* Defined shortcode and hooks
|
88 |
-
*/
|
89 |
-
function define_hooks() {
|
90 |
-
switch ( tinv_get_option( 'add_to_wishlist', 'position' ) ) {
|
91 |
-
case 'before':
|
92 |
-
add_action( 'tinvwl_before_add_to_cart_button', 'tinvwl_view_addto_html' );
|
93 |
-
add_action( 'tinvwl_single_product_summary', 'tinvwl_view_addto_htmlout' );
|
94 |
-
add_action( 'woocommerce_before_add_to_cart_button', 'tinvwl_view_addto_html', 0 );
|
95 |
-
add_action( 'woocommerce_single_product_summary', 'tinvwl_view_addto_htmlout', 29 );
|
96 |
-
break;
|
97 |
-
case 'after':
|
98 |
-
add_action( 'tinvwl_after_add_to_cart_button', 'tinvwl_view_addto_html' );
|
99 |
-
add_action( 'tinvwl_single_product_summary', 'tinvwl_view_addto_htmlout' );
|
100 |
-
add_action( 'woocommerce_after_add_to_cart_button', 'tinvwl_view_addto_html', 0 );
|
101 |
-
add_action( 'woocommerce_single_product_summary', 'tinvwl_view_addto_htmlout', 31 );
|
102 |
-
break;
|
103 |
-
}
|
104 |
-
if ( tinv_get_option( 'add_to_wishlist_catalog', 'show_in_loop' ) ) {
|
105 |
-
switch ( tinv_get_option( 'add_to_wishlist_catalog', 'position' ) ) {
|
106 |
-
case 'before':
|
107 |
-
add_action( 'tinvwl_after_shop_loop_item', 'tinvwl_view_addto_htmlloop' );
|
108 |
-
add_action( 'woocommerce_after_shop_loop_item', 'tinvwl_view_addto_htmlloop', 9 );
|
109 |
-
break;
|
110 |
-
case 'above_thumb':
|
111 |
-
add_action( 'tinvwl_above_thumb_loop_item', 'tinvwl_view_addto_htmlloop' );
|
112 |
-
add_action( 'woocommerce_before_shop_loop_item', 'tinvwl_view_addto_htmlloop', 9 );
|
113 |
-
case 'shortcode':
|
114 |
-
break;
|
115 |
-
case 'after':
|
116 |
-
default: // Compatibility with previous versions.
|
117 |
-
add_action( 'tinvwl_after_shop_loop_item', 'tinvwl_view_addto_htmlloop' );
|
118 |
-
add_action( 'woocommerce_after_shop_loop_item', 'tinvwl_view_addto_htmlloop' );
|
119 |
-
break;
|
120 |
-
}
|
121 |
-
}
|
122 |
-
|
123 |
-
add_action( 'wp_loaded', array( $this, 'add_to_wishlist' ), 0 );
|
124 |
-
}
|
125 |
-
|
126 |
-
/**
|
127 |
-
* Action add product to wishlist
|
128 |
-
*
|
129 |
-
* @return boolean
|
130 |
-
*/
|
131 |
-
function add_to_wishlist() {
|
132 |
-
if ( is_null( filter_input( INPUT_POST, 'tinv_wishlist_id' ) ) ) {
|
133 |
-
return false;
|
134 |
-
} else {
|
135 |
-
remove_action( 'init', 'woocommerce_add_to_cart_action' );
|
136 |
-
remove_action( 'wp_loaded', 'WC_Form_Handler::add_to_cart_action', 20 );
|
137 |
-
}
|
138 |
-
ob_start();
|
139 |
-
$post = filter_input_array( INPUT_POST, array(
|
140 |
-
'tinv_wishlist_id' => FILTER_VALIDATE_INT,
|
141 |
-
'tinv_wishlist_name' => FILTER_SANITIZE_STRING,
|
142 |
-
'product_id' => FILTER_VALIDATE_INT,
|
143 |
-
'product_variation' => FILTER_VALIDATE_INT,
|
144 |
-
'product_type' => FILTER_SANITIZE_STRING,
|
145 |
-
'product_action' => FILTER_SANITIZE_STRING,
|
146 |
-
) );
|
147 |
-
|
148 |
-
$wlp = null;
|
149 |
-
$wishlist = null;
|
150 |
-
$data = array( 'msg' => array() );
|
151 |
-
if ( is_user_logged_in() ) {
|
152 |
-
$wl = new TInvWL_Wishlist( $this->_n );
|
153 |
-
$wishlist = $wl->add_user_default();
|
154 |
-
$wishlist = apply_filters( 'tinvwl_addtowishlist_wishlist', $wishlist );
|
155 |
-
if ( empty( $wishlist ) ) {
|
156 |
-
$data['status'] = false;
|
157 |
-
ob_clean();
|
158 |
-
wp_send_json( $data );
|
159 |
-
}
|
160 |
-
$wlp = new TInvWL_Product( $wishlist, $this->_n );
|
161 |
-
}
|
162 |
-
$
|
163 |
-
$
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
$
|
173 |
-
$
|
174 |
-
if ( empty( $
|
175 |
-
$
|
176 |
-
}
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
$
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
'
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
}
|
264 |
-
$
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
$
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
if ( !
|
298 |
-
|
299 |
-
}
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
$
|
357 |
-
$
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
$
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
$
|
387 |
-
$
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
*
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
$this->
|
419 |
-
}
|
420 |
-
}
|
421 |
-
}
|
422 |
-
|
423 |
-
/**
|
424 |
-
*
|
425 |
-
*
|
426 |
-
* @global object $product
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
$
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
-
|
502 |
-
|
503 |
-
|
504 |
-
|
505 |
-
|
506 |
-
|
507 |
-
|
508 |
-
|
509 |
-
|
510 |
-
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
-
|
527 |
-
|
528 |
-
|
529 |
-
|
530 |
-
|
531 |
-
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
-
|
538 |
-
|
539 |
-
|
540 |
-
|
541 |
-
|
542 |
-
|
543 |
-
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
-
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
-
|
558 |
-
|
559 |
-
|
560 |
-
|
561 |
-
|
562 |
-
|
563 |
-
|
564 |
-
|
565 |
-
|
566 |
-
|
567 |
-
|
568 |
-
|
569 |
-
|
570 |
-
|
571 |
-
|
572 |
-
$
|
573 |
-
|
574 |
-
|
575 |
-
|
576 |
-
|
577 |
-
|
578 |
-
|
579 |
-
|
580 |
-
|
581 |
-
|
582 |
-
|
583 |
-
|
584 |
-
|
585 |
-
|
586 |
-
|
587 |
-
|
588 |
-
|
589 |
-
|
590 |
-
|
591 |
-
|
592 |
-
|
593 |
-
|
594 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Add to wishlists shortcode and hooks
|
4 |
+
*
|
5 |
+
* @since 1.0.0
|
6 |
+
* @package TInvWishlist\Public
|
7 |
+
*/
|
8 |
+
|
9 |
+
// If this file is called directly, abort.
|
10 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
11 |
+
die;
|
12 |
+
}
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Add to wishlists shortcode and hooks
|
16 |
+
*/
|
17 |
+
class TInvWL_Public_AddToWishlist {
|
18 |
+
|
19 |
+
/**
|
20 |
+
* Plugin name
|
21 |
+
*
|
22 |
+
* @var string
|
23 |
+
*/
|
24 |
+
private $_n;
|
25 |
+
|
26 |
+
/**
|
27 |
+
* Global product
|
28 |
+
*
|
29 |
+
* @var object
|
30 |
+
*/
|
31 |
+
private $product;
|
32 |
+
/**
|
33 |
+
* This user wishlists
|
34 |
+
*
|
35 |
+
* @var array
|
36 |
+
*/
|
37 |
+
private $user_wishlist;
|
38 |
+
|
39 |
+
/**
|
40 |
+
* This wishlists and product
|
41 |
+
*
|
42 |
+
* @var array
|
43 |
+
*/
|
44 |
+
private $wishlist;
|
45 |
+
|
46 |
+
/**
|
47 |
+
* Check is loop button
|
48 |
+
*
|
49 |
+
* @var bolean
|
50 |
+
*/
|
51 |
+
private $is_loop;
|
52 |
+
|
53 |
+
/**
|
54 |
+
* This class
|
55 |
+
*
|
56 |
+
* @var \TInvWL_Public_AddToWishlist
|
57 |
+
*/
|
58 |
+
protected static $_instance = null;
|
59 |
+
|
60 |
+
/**
|
61 |
+
* Get this class object
|
62 |
+
*
|
63 |
+
* @param string $plugin_name Plugin name.
|
64 |
+
*
|
65 |
+
* @return \TInvWL_Public_AddToWishlist
|
66 |
+
*/
|
67 |
+
public static function instance( $plugin_name = TINVWL_PREFIX ) {
|
68 |
+
if ( is_null( self::$_instance ) ) {
|
69 |
+
self::$_instance = new self( $plugin_name );
|
70 |
+
}
|
71 |
+
|
72 |
+
return self::$_instance;
|
73 |
+
}
|
74 |
+
|
75 |
+
/**
|
76 |
+
* Constructor
|
77 |
+
*
|
78 |
+
* @param string $plugin_name Plugin name.
|
79 |
+
*/
|
80 |
+
function __construct( $plugin_name ) {
|
81 |
+
$this->_n = $plugin_name;
|
82 |
+
$this->is_loop = false;
|
83 |
+
$this->define_hooks();
|
84 |
+
}
|
85 |
+
|
86 |
+
/**
|
87 |
+
* Defined shortcode and hooks
|
88 |
+
*/
|
89 |
+
function define_hooks() {
|
90 |
+
switch ( tinv_get_option( 'add_to_wishlist', 'position' ) ) {
|
91 |
+
case 'before':
|
92 |
+
add_action( 'tinvwl_before_add_to_cart_button', 'tinvwl_view_addto_html' );
|
93 |
+
add_action( 'tinvwl_single_product_summary', 'tinvwl_view_addto_htmlout' );
|
94 |
+
add_action( 'woocommerce_before_add_to_cart_button', 'tinvwl_view_addto_html', 0 );
|
95 |
+
add_action( 'woocommerce_single_product_summary', 'tinvwl_view_addto_htmlout', 29 );
|
96 |
+
break;
|
97 |
+
case 'after':
|
98 |
+
add_action( 'tinvwl_after_add_to_cart_button', 'tinvwl_view_addto_html' );
|
99 |
+
add_action( 'tinvwl_single_product_summary', 'tinvwl_view_addto_htmlout' );
|
100 |
+
add_action( 'woocommerce_after_add_to_cart_button', 'tinvwl_view_addto_html', 0 );
|
101 |
+
add_action( 'woocommerce_single_product_summary', 'tinvwl_view_addto_htmlout', 31 );
|
102 |
+
break;
|
103 |
+
}
|
104 |
+
if ( tinv_get_option( 'add_to_wishlist_catalog', 'show_in_loop' ) ) {
|
105 |
+
switch ( tinv_get_option( 'add_to_wishlist_catalog', 'position' ) ) {
|
106 |
+
case 'before':
|
107 |
+
add_action( 'tinvwl_after_shop_loop_item', 'tinvwl_view_addto_htmlloop' );
|
108 |
+
add_action( 'woocommerce_after_shop_loop_item', 'tinvwl_view_addto_htmlloop', 9 );
|
109 |
+
break;
|
110 |
+
case 'above_thumb':
|
111 |
+
add_action( 'tinvwl_above_thumb_loop_item', 'tinvwl_view_addto_htmlloop' );
|
112 |
+
add_action( 'woocommerce_before_shop_loop_item', 'tinvwl_view_addto_htmlloop', 9 );
|
113 |
+
case 'shortcode':
|
114 |
+
break;
|
115 |
+
case 'after':
|
116 |
+
default: // Compatibility with previous versions.
|
117 |
+
add_action( 'tinvwl_after_shop_loop_item', 'tinvwl_view_addto_htmlloop' );
|
118 |
+
add_action( 'woocommerce_after_shop_loop_item', 'tinvwl_view_addto_htmlloop' );
|
119 |
+
break;
|
120 |
+
}
|
121 |
+
}
|
122 |
+
|
123 |
+
add_action( 'wp_loaded', array( $this, 'add_to_wishlist' ), 0 );
|
124 |
+
}
|
125 |
+
|
126 |
+
/**
|
127 |
+
* Action add product to wishlist
|
128 |
+
*
|
129 |
+
* @return boolean
|
130 |
+
*/
|
131 |
+
function add_to_wishlist() {
|
132 |
+
if ( is_null( filter_input( INPUT_POST, 'tinv_wishlist_id' ) ) ) {
|
133 |
+
return false;
|
134 |
+
} else {
|
135 |
+
remove_action( 'init', 'woocommerce_add_to_cart_action' );
|
136 |
+
remove_action( 'wp_loaded', 'WC_Form_Handler::add_to_cart_action', 20 );
|
137 |
+
}
|
138 |
+
ob_start();
|
139 |
+
$post = filter_input_array( INPUT_POST, array(
|
140 |
+
'tinv_wishlist_id' => FILTER_VALIDATE_INT,
|
141 |
+
'tinv_wishlist_name' => FILTER_SANITIZE_STRING,
|
142 |
+
'product_id' => FILTER_VALIDATE_INT,
|
143 |
+
'product_variation' => FILTER_VALIDATE_INT,
|
144 |
+
'product_type' => FILTER_SANITIZE_STRING,
|
145 |
+
'product_action' => FILTER_SANITIZE_STRING,
|
146 |
+
) );
|
147 |
+
|
148 |
+
$wlp = null;
|
149 |
+
$wishlist = null;
|
150 |
+
$data = array( 'msg' => array() );
|
151 |
+
if ( is_user_logged_in() ) {
|
152 |
+
$wl = new TInvWL_Wishlist( $this->_n );
|
153 |
+
$wishlist = $wl->add_user_default();
|
154 |
+
$wishlist = apply_filters( 'tinvwl_addtowishlist_wishlist', $wishlist );
|
155 |
+
if ( empty( $wishlist ) ) {
|
156 |
+
$data['status'] = false;
|
157 |
+
ob_clean();
|
158 |
+
wp_send_json( $data );
|
159 |
+
}
|
160 |
+
$wlp = new TInvWL_Product( $wishlist, $this->_n );
|
161 |
+
} elseif ( tinv_get_option( 'general', 'require_login' ) ) {
|
162 |
+
$data['status'] = false;
|
163 |
+
$data['icon'] = 'icon_big_times';
|
164 |
+
if ( tinv_get_option( 'general', 'redirect_require_login' ) ) {
|
165 |
+
$data['msg'] = array();
|
166 |
+
$data['force_redirect'] = wc_get_page_permalink( 'myaccount' );
|
167 |
+
} else {
|
168 |
+
$data['msg'][] = __( 'Please, login to add products to Wishlist', '*ti-woocommerce-wishlist' );
|
169 |
+
$data['dialog_custom_url'] = wc_get_page_permalink( 'myaccount' );
|
170 |
+
$data['dialog_custom_html'] = esc_html( __( 'Login', '*ti-woocommerce-wishlist' ) );
|
171 |
+
}
|
172 |
+
$data['msg'] = array_unique( $data['msg'] );
|
173 |
+
$data['msg'] = implode( '<br>', $data['msg'] );
|
174 |
+
if ( ! empty( $data['msg'] ) ) {
|
175 |
+
$data['msg'] = tinv_wishlist_template_html( 'ti-addedtowishlist-dialogbox.php', $data );
|
176 |
+
}
|
177 |
+
ob_clean();
|
178 |
+
wp_send_json( $data );
|
179 |
+
} else {
|
180 |
+
$wl = new TInvWL_Wishlist( $this->_n );
|
181 |
+
$wishlist = $wl->add_sharekey_default();
|
182 |
+
$wlp = new TInvWL_Product( $wishlist );
|
183 |
+
}
|
184 |
+
|
185 |
+
$status = true;
|
186 |
+
if ( empty( $post['product_id'] ) ) {
|
187 |
+
$status = false;
|
188 |
+
} else {
|
189 |
+
$post['product_type'] = apply_filters( $this->_n . '_addtowishlist_modify_type', $post['product_type'], $post );
|
190 |
+
$post = apply_filters( 'tinvwl_addtowishlist_prepare', $post );
|
191 |
+
$form = apply_filters( 'tinvwl_addtowishlist_prepare_form', filter_input( INPUT_POST, 'form', FILTER_DEFAULT, FILTER_FORCE_ARRAY ) );
|
192 |
+
if ( empty( $form ) ) {
|
193 |
+
$form = array();
|
194 |
+
}
|
195 |
+
switch ( $post['product_type'] ) {
|
196 |
+
case 'group':
|
197 |
+
case 'grouped' :
|
198 |
+
$product = $wlp->product_data( $post['product_id'] );
|
199 |
+
if ( empty( $product ) ) {
|
200 |
+
$status = false;
|
201 |
+
} else {
|
202 |
+
$variations = $product->get_children();
|
203 |
+
|
204 |
+
foreach ( $variations as $variation_id ) {
|
205 |
+
$quantity = 1;
|
206 |
+
$allowed_adding = ! count( $wlp->get_wishlist( array(
|
207 |
+
'product_id' => $post['product_id'],
|
208 |
+
'variation_id' => $variation_id,
|
209 |
+
'external' => false,
|
210 |
+
) ) );
|
211 |
+
if ( tinv_get_option( 'general', 'simple_flow' ) && 'remove' === $post['product_action'] ) {
|
212 |
+
if ( $wlp->remove_product_from_wl( 0, $post['product_id'], $variation_id, apply_filters( 'tinvwl_addtowishlist_add_form', $form ) ) ) {
|
213 |
+
$data['msg'][] = tinv_get_option( 'general', 'text_removed_from' );
|
214 |
+
$data['removed'] = true;
|
215 |
+
$status = false;
|
216 |
+
}
|
217 |
+
} elseif ( ! $allowed_adding ) {
|
218 |
+
$data['msg'][] = tinv_get_option( 'general', 'text_already_in' );
|
219 |
+
$status = false;
|
220 |
+
} elseif ( $wlp->add_product( apply_filters( 'tinvwl_addtowishlist_add', array(
|
221 |
+
'product_id' => $post['product_id'],
|
222 |
+
'variation_id' => $variation_id,
|
223 |
+
'quantity' => $quantity,
|
224 |
+
) ) )
|
225 |
+
) {
|
226 |
+
$data['msg'][] = tinv_get_option( 'general', 'text_added_to' );
|
227 |
+
} else {
|
228 |
+
$status = false;
|
229 |
+
}
|
230 |
+
}
|
231 |
+
}
|
232 |
+
break;
|
233 |
+
case 'variable' :
|
234 |
+
case 'variation' :
|
235 |
+
|
236 |
+
if ( $post['product_variation'] ) {
|
237 |
+
$variation_id = $post['product_variation'];
|
238 |
+
} else {
|
239 |
+
$variation_id = absint( array_key_exists( 'variation_id', $form ) ? filter_var( $form['variation_id'], FILTER_VALIDATE_INT ) : 0 );
|
240 |
+
}
|
241 |
+
$quantity = 1;
|
242 |
+
$allowed_adding = ! count( $wlp->get_wishlist( array(
|
243 |
+
'product_id' => $post['product_id'],
|
244 |
+
'variation_id' => $variation_id,
|
245 |
+
'meta' => apply_filters( 'tinvwl_addtowishlist_add_form', $form ),
|
246 |
+
'external' => false,
|
247 |
+
) ) );
|
248 |
+
if ( tinv_get_option( 'general', 'simple_flow' ) && 'remove' === $post['product_action'] ) {
|
249 |
+
if ( $wlp->remove_product_from_wl( 0, $post['product_id'], $variation_id, apply_filters( 'tinvwl_addtowishlist_add_form', $form ) ) ) {
|
250 |
+
$data['msg'][] = tinv_get_option( 'general', 'text_removed_from' );
|
251 |
+
$data['removed'] = true;
|
252 |
+
$status = false;
|
253 |
+
}
|
254 |
+
} elseif ( ! $allowed_adding ) {
|
255 |
+
$data['msg'][] = tinv_get_option( 'general', 'text_already_in' );
|
256 |
+
$status = false;
|
257 |
+
} elseif ( $wlp->add_product( apply_filters( 'tinvwl_addtowishlist_add', array(
|
258 |
+
'product_id' => $post['product_id'],
|
259 |
+
'quantity' => $quantity,
|
260 |
+
'variation_id' => $variation_id,
|
261 |
+
) ), apply_filters( 'tinvwl_addtowishlist_add_form', $form ) ) ) {
|
262 |
+
$data['msg'][] = tinv_get_option( 'general', 'text_added_to' );
|
263 |
+
} else {
|
264 |
+
$status = false;
|
265 |
+
}
|
266 |
+
break;
|
267 |
+
case 'simple' :
|
268 |
+
default:
|
269 |
+
$quantity = 1;
|
270 |
+
$allowed_adding = ! count( $wlp->get_wishlist( array(
|
271 |
+
'product_id' => $post['product_id'],
|
272 |
+
'meta' => apply_filters( 'tinvwl_addtowishlist_add_form', $form ),
|
273 |
+
'external' => false,
|
274 |
+
) ) );
|
275 |
+
if ( tinv_get_option( 'general', 'simple_flow' ) && 'remove' === $post['product_action'] ) {
|
276 |
+
if ( $wlp->remove_product_from_wl( 0, $post['product_id'], 0, apply_filters( 'tinvwl_addtowishlist_add_form', $form ) ) ) {
|
277 |
+
$data['msg'][] = tinv_get_option( 'general', 'text_removed_from' );
|
278 |
+
$data['removed'] = true;
|
279 |
+
$status = false;
|
280 |
+
}
|
281 |
+
} elseif ( ! $allowed_adding ) {
|
282 |
+
$data['msg'][] = tinv_get_option( 'general', 'text_already_in' );
|
283 |
+
$status = false;
|
284 |
+
} elseif ( $wlp->add_product( apply_filters( 'tinvwl_addtowishlist_add', array(
|
285 |
+
'product_id' => $post['product_id'],
|
286 |
+
'quantity' => $quantity,
|
287 |
+
) ), apply_filters( 'tinvwl_addtowishlist_add_form', $form ) ) ) {
|
288 |
+
$data['msg'][] = tinv_get_option( 'general', 'text_added_to' );
|
289 |
+
} else {
|
290 |
+
$status = false;
|
291 |
+
}
|
292 |
+
break;
|
293 |
+
} // End switch().
|
294 |
+
} // End if().
|
295 |
+
$data['status'] = $status;
|
296 |
+
$data['wishlist_url'] = tinv_url_wishlist_default();
|
297 |
+
if ( ! empty( $wishlist ) ) {
|
298 |
+
$data['wishlist_url'] = tinv_url_wishlist( $wishlist['ID'] );
|
299 |
+
}
|
300 |
+
|
301 |
+
if ( $status && tinv_get_option( 'general', 'redirect' ) && tinv_get_option( 'page', 'wishlist' ) && tinv_get_option( 'general', 'show_notice' ) ) {
|
302 |
+
$data['redirect'] = $data['wishlist_url'];
|
303 |
+
}
|
304 |
+
|
305 |
+
$product = wc_get_product( $post['product_id'] );
|
306 |
+
$data['wishlists'] = wp_json_encode( $this->user_wishlist( $product, $wlp ) );
|
307 |
+
|
308 |
+
$data['icon'] = $data['status'] ? 'icon_big_heart_check' : 'icon_big_times';
|
309 |
+
$data['msg'] = array_unique( $data['msg'] );
|
310 |
+
$data['msg'] = implode( '<br>', $data['msg'] );
|
311 |
+
if ( ! empty( $data['msg'] ) ) {
|
312 |
+
$data['msg'] = apply_filters( $this->_n . '_addtowishlist_message_after', $data['msg'], $data, $post, $form, $product );
|
313 |
+
$data['msg'] = tinv_wishlist_template_html( 'ti-addedtowishlist-dialogbox.php', $data );
|
314 |
+
}
|
315 |
+
if ( ! tinv_get_option( 'general', 'show_notice' ) && array_key_exists( 'msg', $data ) ) {
|
316 |
+
unset( $data['msg'] );
|
317 |
+
}
|
318 |
+
if ( tinv_get_option( 'general', 'simple_flow' ) ) {
|
319 |
+
$data['make_remove'] = $data['status'];
|
320 |
+
}
|
321 |
+
$data = apply_filters( $this->_n . '_addtowishlist_return_ajax', $data, $post, $form, $product );
|
322 |
+
ob_clean();
|
323 |
+
wp_send_json( $data );
|
324 |
+
}
|
325 |
+
|
326 |
+
/**
|
327 |
+
* Get user wishlist
|
328 |
+
*
|
329 |
+
* @return array
|
330 |
+
*/
|
331 |
+
function user_wishlists() {
|
332 |
+
if ( ! empty( $this->user_wishlist ) ) {
|
333 |
+
return $this->user_wishlist;
|
334 |
+
}
|
335 |
+
$wishlists = array();
|
336 |
+
$wl = new TInvWL_Wishlist( $this->_n );
|
337 |
+
if ( is_user_logged_in() ) {
|
338 |
+
$wishlists = $wl->get_by_user_default();
|
339 |
+
} else {
|
340 |
+
$wishlists = $wl->get_by_sharekey_default();
|
341 |
+
}
|
342 |
+
$wishlists = array_filter( $wishlists );
|
343 |
+
if ( ! empty( $wishlists ) ) {
|
344 |
+
$_wishlists = array();
|
345 |
+
foreach ( $wishlists as $key => $wishlist ) {
|
346 |
+
if ( is_array( $wishlist ) && array_key_exists( 'ID', $wishlist ) ) {
|
347 |
+
$_wishlists[ $key ] = array(
|
348 |
+
'ID' => $wishlist['ID'],
|
349 |
+
'title' => $wishlist['title'],
|
350 |
+
'url' => tinv_url_wishlist_by_key( $wishlist['share_key'] ),
|
351 |
+
);
|
352 |
+
}
|
353 |
+
}
|
354 |
+
$wishlists = $_wishlists;
|
355 |
+
}
|
356 |
+
$this->user_wishlist = $wishlists;
|
357 |
+
return $wishlists;
|
358 |
+
}
|
359 |
+
|
360 |
+
/**
|
361 |
+
* Check exists product in user wishlists
|
362 |
+
*
|
363 |
+
* @param object $product Product object.
|
364 |
+
* @param object $wlp Product class, used for local products.
|
365 |
+
* @return array
|
366 |
+
*/
|
367 |
+
function user_wishlist( $product, $wlp = null ) {
|
368 |
+
$wishlists = $this->wishlist = array();
|
369 |
+
$vproduct = $product->is_type( 'variation' ) || $product->is_type( 'variable' );
|
370 |
+
$wlp = new TInvWL_Product();
|
371 |
+
$wishlists = $this->user_wishlists();
|
372 |
+
$ids = array();
|
373 |
+
foreach ( $wishlists as $key => $wishlist ) {
|
374 |
+
$ids[] = $wishlist['ID'];
|
375 |
+
}
|
376 |
+
$ids = array_filter( $ids );
|
377 |
+
|
378 |
+
if ( empty( $ids ) ) {
|
379 |
+
return $wishlists;
|
380 |
+
}
|
381 |
+
$products = $wlp->get( array(
|
382 |
+
'product_id' => ( version_compare( WC_VERSION, '3.0.0', '<' ) ? $product->id : ( $product->is_type( 'variation' ) ? $product->get_parent_id() : $product->get_id() ) ),
|
383 |
+
'wishlist_id' => $ids,
|
384 |
+
'external' => false,
|
385 |
+
) );
|
386 |
+
$in = array();
|
387 |
+
if ( ! empty( $products ) ) {
|
388 |
+
foreach ( $products as $product ) {
|
389 |
+
$in[ $product['wishlist_id'] ][] = $product['variation_id'];
|
390 |
+
}
|
391 |
+
foreach ( $in as $wishlist_id => $products ) {
|
392 |
+
sort( $in[ $wishlist_id ], SORT_NUMERIC );
|
393 |
+
if ( empty( $in[ $wishlist_id ] ) && ( $this->is_loop || ! $vproduct ) ) {
|
394 |
+
$in[ $wishlist_id ] = true;
|
395 |
+
}
|
396 |
+
}
|
397 |
+
}
|
398 |
+
foreach ( $wishlists as $key => $wishlist ) {
|
399 |
+
$wishlists[ $key ]['in'] = array_key_exists( $wishlist['ID'], $in ) ? $in[ $wishlist['ID'] ] : false;
|
400 |
+
}
|
401 |
+
$wishlists = apply_filters( 'tinvwl_addtowishlist_preparewishlists', $wishlists, $product );
|
402 |
+
$this->wishlist = $wishlists;
|
403 |
+
return $wishlists;
|
404 |
+
}
|
405 |
+
|
406 |
+
/**
|
407 |
+
* Create add button in loop
|
408 |
+
*
|
409 |
+
* @global object $product
|
410 |
+
*/
|
411 |
+
function htmloutput_loop() {
|
412 |
+
global $product;
|
413 |
+
|
414 |
+
if ( $product ) {
|
415 |
+
if ( apply_filters( 'tinvwl_allow_addtowishlist_shop_loop_item', true, $product ) ) { // @codingStandardsIgnoreLine WordPress.PHP.StrictInArray.MissingTrueStrict
|
416 |
+
$this->is_loop = true;
|
417 |
+
$this->htmloutput();
|
418 |
+
$this->is_loop = false;
|
419 |
+
}
|
420 |
+
}
|
421 |
+
}
|
422 |
+
|
423 |
+
/**
|
424 |
+
* Create add button if simple product out stock
|
425 |
+
*
|
426 |
+
* @global object $product
|
427 |
+
*/
|
428 |
+
function htmloutput_out() {
|
429 |
+
global $product;
|
430 |
+
|
431 |
+
if ( $product ) {
|
432 |
+
if ( apply_filters( 'tinvwl_allow_addtowishlist_single_product_summary', ( $product->is_purchasable() && 'simple' === ( version_compare( WC_VERSION, '3.0.0', '<' ) ? $product->product_type : $product->get_type() ) && ! $product->is_in_stock() ) ) ) {
|
433 |
+
$this->htmloutput();
|
434 |
+
}
|
435 |
+
}
|
436 |
+
}
|
437 |
+
|
438 |
+
/**
|
439 |
+
* Output page
|
440 |
+
*
|
441 |
+
* @global object $product
|
442 |
+
*
|
443 |
+
* @param array $attr Array parameter for shortcode.
|
444 |
+
* @param boolean $is_shortcode Shortcode or action.
|
445 |
+
*
|
446 |
+
* @return boolean
|
447 |
+
*/
|
448 |
+
function htmloutput( $attr = array(), $is_shortcode = false ) {
|
449 |
+
global $product;
|
450 |
+
|
451 |
+
$attr = apply_filters( 'tinvwl_addtowishlist_out_prepare_attr', $attr );
|
452 |
+
$this->product = apply_filters( 'tinvwl_addtowishlist_out_prepare_product', $product );
|
453 |
+
$position = tinv_get_option( 'add_to_wishlist', 'position' );
|
454 |
+
if ( $is_shortcode ) {
|
455 |
+
$position = 'shortcode';
|
456 |
+
$product_id = absint( $attr['product_id'] );
|
457 |
+
$variation_id = absint( $attr['variation_id'] );
|
458 |
+
|
459 |
+
if ( 'product_variation' == get_post_type( $product_id ) ) { // WPCS: loose comparison ok.
|
460 |
+
$variation_id = $product_id;
|
461 |
+
$product_id = wp_get_post_parent_id( $variation_id );
|
462 |
+
}
|
463 |
+
|
464 |
+
$product_data = wc_get_product( $variation_id ? $variation_id : $product_id );
|
465 |
+
|
466 |
+
if ( $product_data && 'trash' !== ( version_compare( WC_VERSION, '3.0.0', '<' ) ? $product_data->post->post_status : get_post( $product_data->get_id() )->post_status ) ) {
|
467 |
+
$this->product = $product_data;
|
468 |
+
} else {
|
469 |
+
return '';
|
470 |
+
}
|
471 |
+
}
|
472 |
+
if ( empty( $this->product ) || ! apply_filters( 'tinvwl_allow_addtowishlist_single_product', true, $this->product ) ) {
|
473 |
+
return;
|
474 |
+
}
|
475 |
+
|
476 |
+
$wishlists = $this->user_wishlist( $this->product );
|
477 |
+
|
478 |
+
add_action( 'tinv_wishlist_addtowishlist_button', array( $this, 'button' ) );
|
479 |
+
|
480 |
+
if ( $this->is_loop && 'variable' === ( version_compare( WC_VERSION, '3.0.0', '<' ) ? $this->product->product_type : $this->product->get_type() ) ) {
|
481 |
+
$this->variation_id = null;
|
482 |
+
$match_attributes = array();
|
483 |
+
|
484 |
+
foreach ( ( version_compare( WC_VERSION, '3.0.0', '<' ) ? $this->product->get_variation_default_attributes() : $this->product->get_default_attributes() ) as $attribute_name => $value ) {
|
485 |
+
$match_attributes[ 'attribute_' . sanitize_title( $attribute_name ) ] = $value;
|
486 |
+
}
|
487 |
+
|
488 |
+
if ( $match_attributes ) {
|
489 |
+
if ( version_compare( WC_VERSION, '3.0.0', '<' ) ) {
|
490 |
+
$this->variation_id = $this->product->get_matching_variation( $match_attributes );
|
491 |
+
} else {
|
492 |
+
$data_store = WC_Data_Store::load( 'product' );
|
493 |
+
$this->variation_id = $data_store->find_matching_product_variation( $this->product, $match_attributes );
|
494 |
+
}
|
495 |
+
}
|
496 |
+
}
|
497 |
+
|
498 |
+
$data = array(
|
499 |
+
'class_postion' => sprintf( 'tinvwl-%s-add-to-cart', $this->is_loop ? tinv_get_option( 'add_to_wishlist_catalog', 'position' ) : $position ),
|
500 |
+
'product' => $this->product,
|
501 |
+
'variation_id' => ( $this->is_loop && 'variable' === ( version_compare( WC_VERSION, '3.0.0', '<' ) ? $this->product->product_type : $this->product->get_type() ) ) ? $this->variation_id : ( version_compare( WC_VERSION, '3.0.0', '<' ) ? $this->product->variation_id : ( $this->product->is_type( 'variation' ) ? $this->product->get_id() : 0 ) ),
|
502 |
+
'TInvWishlist' => $wishlists,
|
503 |
+
'button_icon' => tinv_get_option( 'add_to_wishlist' . ( $this->is_loop ? '_catalog' : '' ), 'icon' ),
|
504 |
+
'add_to_wishlist' => tinv_get_option( 'add_to_wishlist' . ( $this->is_loop ? '_catalog' : '' ), 'text' ),
|
505 |
+
'browse_in_wishlist' => tinv_get_option( 'general', 'text_browse' ),
|
506 |
+
'product_in_wishlist' => tinv_get_option( 'general', 'text_already_in' ),
|
507 |
+
'product_to_wishlist' => tinv_get_option( 'general', 'text_added_to' ),
|
508 |
+
);
|
509 |
+
tinv_wishlist_template( 'ti-addtowishlist.php', $data );
|
510 |
+
}
|
511 |
+
|
512 |
+
/**
|
513 |
+
* Create button
|
514 |
+
*
|
515 |
+
* @param boolean $echo Return or output.
|
516 |
+
*/
|
517 |
+
function button( $echo = true ) {
|
518 |
+
$content = apply_filters( 'tinvwl_wishlist_button_before', '' );
|
519 |
+
$text = tinv_get_option( 'add_to_wishlist' . ( $this->is_loop ? '_catalog' : '' ), 'text' );
|
520 |
+
$icon = tinv_get_option( 'add_to_wishlist' . ( $this->is_loop ? '_catalog' : '' ), 'icon' );
|
521 |
+
$icon_class = '';
|
522 |
+
$action = 'addto';
|
523 |
+
if ( empty( $text ) ) {
|
524 |
+
$icon_class = ' no-txt';
|
525 |
+
} else {
|
526 |
+
$content .= '<div class="tinv-wishlist-clear"></div>';
|
527 |
+
if ( tinv_get_option( 'general', 'simple_flow' ) ) {
|
528 |
+
$text = sprintf( '<span class="tinvwl_add_to_wishlist-text">%s</span><span class="tinvwl_remove_from_wishlist-text">%s</span>', $text, tinv_get_option( 'add_to_wishlist' . ( $this->is_loop ? '_catalog' : '' ), 'text_remove' ) );
|
529 |
+
} else {
|
530 |
+
$text = sprintf( '<span class="tinvwl_add_to_wishlist-text">%s</span>', $text );
|
531 |
+
}
|
532 |
+
}
|
533 |
+
if ( ! empty( $icon ) ) {
|
534 |
+
$icon_upload = tinv_get_option( 'add_to_wishlist' . ( $this->is_loop ? '_catalog' : '' ), 'icon_upload' );
|
535 |
+
if ( 'custom' === $icon && ! empty( $icon_upload ) ) {
|
536 |
+
$text = sprintf( '<img src="%s" alt="%s" /> %s', esc_url( $icon_upload ), esc_attr( tinv_get_option( 'add_to_wishlist' . ($this->is_loop ? '_catalog' : ''), 'text' ) ), $text );
|
537 |
+
}
|
538 |
+
$icon = 'tinvwl-icon-' . $icon;
|
539 |
+
if ( 'custom' !== $icon ) {
|
540 |
+
$icon .= ' icon-' . tinv_get_option( 'add_to_wishlist' . ( $this->is_loop ? '_catalog' : '' ), 'icon_style' );
|
541 |
+
}
|
542 |
+
}
|
543 |
+
$icon .= $icon_class;
|
544 |
+
$variation_id = ( ( $this->is_loop && 'variable' === ( version_compare( WC_VERSION, '3.0.0', '<' ) ? $this->product->product_type : $this->product->get_type() ) ) ? $this->variation_id : ( version_compare( WC_VERSION, '3.0.0', '<' ) ? $this->product->variation_id : ( $this->product->is_type( 'variation' ) ? $this->product->get_id() : 0 ) ) );
|
545 |
+
foreach ( $this->wishlist as $value ) {
|
546 |
+
if ( $value['in'] ) {
|
547 |
+
$icon .= ' tinvwl-product-in-list';
|
548 |
+
if ( tinv_get_option( 'general', 'simple_flow' ) ) {
|
549 |
+
if ( $this->is_loop ) {
|
550 |
+
if ( ! is_array( $value['in'] ) || in_array( $variation_id, $value['in'] ) ) {
|
551 |
+
$icon .= ' tinvwl-product-make-remove';
|
552 |
+
$action = 'remove';
|
553 |
+
}
|
554 |
+
} else {
|
555 |
+
$icon .= ' tinvwl-product-make-remove';
|
556 |
+
$action = 'remove';
|
557 |
+
}
|
558 |
+
}
|
559 |
+
break;
|
560 |
+
}
|
561 |
+
}
|
562 |
+
if ( 'button' == tinv_get_option( 'add_to_wishlist' . ( $this->is_loop ? '_catalog' : '' ), 'type' ) ) { // WPCS: loose comparison ok.
|
563 |
+
$icon .= ' button';
|
564 |
+
}
|
565 |
+
$content .= sprintf( '<a class="tinvwl_add_to_wishlist_button %s" data-tinv-wl-list="%s" data-tinv-wl-product="%s" data-tinv-wl-productvariation="%s" data-tinv-wl-producttype="%s" data-tinv-wl-action="%s">%s</a>', $icon, htmlspecialchars( wp_json_encode( $this->wishlist ) ), ( version_compare( WC_VERSION, '3.0.0', '<' ) ? $this->product->id : ( $this->product->is_type( 'variation' ) ? $this->product->get_parent_id() : $this->product->get_id() ) ), ( ( $this->is_loop && 'variable' === ( version_compare( WC_VERSION, '3.0.0', '<' ) ? $this->product->product_type : $this->product->get_type() ) ) ? $this->variation_id : ( version_compare( WC_VERSION, '3.0.0', '<' ) ? $this->product->variation_id : ( $this->product->is_type( 'variation' ) ? $this->product->get_id() : 0 ) ) ), ( version_compare( WC_VERSION, '3.0.0', '<' ) ? $this->product->product_type : $this->product->get_type() ), $action, $text );
|
566 |
+
$content .= apply_filters( 'tinvwl_wishlist_button_after', '' );
|
567 |
+
|
568 |
+
if ( ! empty( $text ) ) {
|
569 |
+
$content .= '<div class="tinv-wishlist-clear"></div>';
|
570 |
+
}
|
571 |
+
|
572 |
+
echo apply_filters( 'tinvwl_wishlist_button', $content ); // WPCS: xss ok.
|
573 |
+
}
|
574 |
+
|
575 |
+
/**
|
576 |
+
* Shortcode basic function
|
577 |
+
*
|
578 |
+
* @global object $product
|
579 |
+
*
|
580 |
+
* @param array $atts Array parameter from shortcode.
|
581 |
+
*
|
582 |
+
* @return string
|
583 |
+
*/
|
584 |
+
function shortcode( $atts = array() ) {
|
585 |
+
global $product;
|
586 |
+
|
587 |
+
$default = array(
|
588 |
+
'product_id' => 0,
|
589 |
+
'variation_id' => 0,
|
590 |
+
'loop' => 'no',
|
591 |
+
);
|
592 |
+
if ( $product ) {
|
593 |
+
$default['product_id'] = ( version_compare( WC_VERSION, '3.0.0', '<' ) ? $product->id : ( $product->is_type( 'variation' ) ? $product->get_parent_id() : $product->get_id() ) );
|
594 |
+
$default['variation_id'] = ( version_compare( WC_VERSION, '3.0.0', '<' ) ? $product->variation_id : ( $product->is_type( 'variation' ) ? $product->get_id() : 0 ) );
|
595 |
+
}
|
596 |
+
$atts = shortcode_atts( $default, $atts );
|
597 |
+
|
598 |
+
ob_start();
|
599 |
+
if ( 'yes' === $atts['loop'] ) {
|
600 |
+
$this->is_loop = true;
|
601 |
+
$this->htmloutput( $atts, true );
|
602 |
+
$this->is_loop = false;
|
603 |
+
} else {
|
604 |
+
$this->htmloutput( $atts, true );
|
605 |
+
}
|
606 |
+
return ob_get_clean();
|
607 |
+
}
|
608 |
+
|
609 |
+
}
|
public/tinvwl.class.php
CHANGED
@@ -242,8 +242,8 @@ class TInvWL_Public_TInvWL {
|
|
242 |
*/
|
243 |
function add_meta_tags() {
|
244 |
if ( is_page( apply_filters( 'wpml_object_id', tinv_get_option( 'page', 'wishlist' ), 'page', true ) ) && ( tinv_get_option( 'social', 'facebook' ) || tinv_get_option( 'social', 'google' ) ) ) {
|
245 |
-
$wishlist = tinv_wishlist_get();
|
246 |
-
if ( 0 < $wishlist['ID'] && 'private' !== $wishlist['status'] ) {
|
247 |
if ( is_user_logged_in() ) {
|
248 |
$user = get_user_by( 'id', $wishlist['author'] );
|
249 |
if ( $user ) {
|
242 |
*/
|
243 |
function add_meta_tags() {
|
244 |
if ( is_page( apply_filters( 'wpml_object_id', tinv_get_option( 'page', 'wishlist' ), 'page', true ) ) && ( tinv_get_option( 'social', 'facebook' ) || tinv_get_option( 'social', 'google' ) ) ) {
|
245 |
+
$wishlist = tinv_wishlist_get( '', false );
|
246 |
+
if ( $wishlist && 0 < $wishlist['ID'] && 'private' !== $wishlist['status'] ) {
|
247 |
if ( is_user_logged_in() ) {
|
248 |
$user = get_user_by( 'id', $wishlist['author'] );
|
249 |
if ( $user ) {
|
public/topwishlist.class.php
CHANGED
@@ -85,7 +85,7 @@ class TInvWL_Public_TopWishlist {
|
|
85 |
* @return array
|
86 |
*/
|
87 |
public static function update_widget( $data ) {
|
88 |
-
$data['
|
89 |
|
90 |
return $data;
|
91 |
}
|
@@ -120,14 +120,17 @@ class TInvWL_Public_TopWishlist {
|
|
120 |
$counts = array_shift( $counts );
|
121 |
$count = absint( $counts['quantity'] );
|
122 |
} else {
|
123 |
-
$wishlist = $wl->
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
|
|
|
|
|
|
131 |
}
|
132 |
return $count;
|
133 |
}
|
85 |
* @return array
|
86 |
*/
|
87 |
public static function update_widget( $data ) {
|
88 |
+
$data['fragments'] = self::update_fragments( array() );
|
89 |
|
90 |
return $data;
|
91 |
}
|
120 |
$counts = array_shift( $counts );
|
121 |
$count = absint( $counts['quantity'] );
|
122 |
} else {
|
123 |
+
$wishlist = $wl->get_by_sharekey_default();
|
124 |
+
if ( ! empty( $wishlist ) ) {
|
125 |
+
$wishlist = array_shift( $wishlist );
|
126 |
+
$wlp = new TInvWL_Product( $wishlist );
|
127 |
+
$counts = $wlp->get_wishlist( array(
|
128 |
+
'external' => false,
|
129 |
+
'sql' => sprintf( 'SELECT %s(`quantity`) AS `quantity` FROM {table} WHERE {where}', ( tinv_get_option( 'general', 'quantity_func' ) ? 'SUM' : 'COUNT' ) ),
|
130 |
+
) );
|
131 |
+
$counts = array_shift( $counts );
|
132 |
+
$count = absint( $counts['quantity'] );
|
133 |
+
}
|
134 |
}
|
135 |
return $count;
|
136 |
}
|
public/wishlist/view.class.php
CHANGED
@@ -319,6 +319,17 @@ class TInvWL_Public_Wishlist_View {
|
|
319 |
$wishlist = $this->get_current_wishlist();
|
320 |
|
321 |
if ( empty( $wishlist ) ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
322 |
return $this->wishlist_null();
|
323 |
}
|
324 |
|
319 |
$wishlist = $this->get_current_wishlist();
|
320 |
|
321 |
if ( empty( $wishlist ) ) {
|
322 |
+
$id = get_query_var( 'tinvwlID', null );
|
323 |
+
if ( empty( $id ) && ( is_user_logged_in() || tinv_get_option( 'general', 'guests' ) ) ) {
|
324 |
+
return $this->wishlist_empty( array(), array(
|
325 |
+
'ID' => '',
|
326 |
+
'author' => get_current_user_id(),
|
327 |
+
'title' => tinv_get_option( 'general', 'default_title' ),
|
328 |
+
'status' => 'private',
|
329 |
+
'type' => 'default',
|
330 |
+
'share_key' => '',
|
331 |
+
) );
|
332 |
+
}
|
333 |
return $this->wishlist_null();
|
334 |
}
|
335 |
|
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, shop, ecommerce wishlist, shop wishlist, wishlist for Woocommerce
|
5 |
Requires at least: 4.5
|
6 |
Tested up to: 4.9
|
7 |
-
Stable tag: 1.5.
|
8 |
License: GPLv3
|
9 |
License URI: https://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
@@ -16,7 +16,7 @@ Add Wishlist functionality to your store for free.
|
|
16 |
= Increase Sales and Conversions =
|
17 |
WooCommerce Wishlist is a simple but powerful tool that can help you to convert your site visitors into loyal customers. There are many situations when customers can’t buy a product at this time or simply don’t want. Possibility to save products for later encourages users to return to your site and after all, make a purchase. Adding products to Wishlist is easy and convenient so it may also force your customers to buy even more products than they planned. Users can share their wishlist, for example, to help their friends choose a gift for upcoming holiday and so on. By sharing their Wishlists, they are bringing you, new potential customers. All in all this increasing amount of your site visitors, conversion and as a result sales.
|
18 |
|
19 |
-
[Live Preview](https://
|
20 |
|
21 |
[View documentation](https://templateinvaders.com/documentation/ti-woocommerce-wishlist-free/?utm_source=wordpressorg&utm_content=documentation)
|
22 |
|
@@ -44,12 +44,12 @@ WooCommerce Wishlist is a simple but powerful tool that can help you to convert
|
|
44 |
+ Custom CSS styles
|
45 |
+ Responsive & Retina Ready
|
46 |
+ Translation ready
|
47 |
-
+ WPML Support
|
48 |
+ Product variations Support
|
49 |
|
50 |
= COMPATIBILITY WITH MOST USED PLUGINS/ADDONS =
|
51 |
-
We understand that our plugin is not the only one that you are going to use for your WooCommerce store and how it is important for different plugins to work well with each others. That is why we have added compatibility with the most used WooCommerce add-ons: WooCommerce Bookings, WooCommerce Subscriptions, WooCommerce Composite Products, WooCommerce Product Bundles, WooCommerce Mix and Match, WooCommerce Gravity Forms Product Add-Ons, WooCommerce Gift Cards.
|
52 |
-
It is also very important for any WordPress website to use cache plugins, so we make sure that our WooCommerce Wishlist works well with WP Rocket, WP Super Cache and W3 Total Cache plugins.
|
53 |
|
54 |
= Add to Wishlist button =
|
55 |
You can adjust Add to wishlist button settings to make it work best for your website.
|
@@ -63,7 +63,7 @@ WooCommerce Wishlist Plugin comes with over 60 appearance options such as colors
|
|
63 |
|
64 |
= Translation Ready =
|
65 |
|
66 |
-
You can easily translate WooCommerce Wishlist Plugin to any language. Simply choose the most convenient way for you: using poEdit tool, Loco Translate or WPML.
|
67 |
|
68 |
= Responsive & Retina Ready =
|
69 |
We know how important responsive website for the online store in nowadays.
|
@@ -129,6 +129,13 @@ If you get stuck, you can ask for help in the [Plugin Forum](https://wordpress.o
|
|
129 |
|
130 |
== Changelog ==
|
131 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
132 |
= 1.5.13 =
|
133 |
*Release Date - 02 December 2017*
|
134 |
|
@@ -161,11 +168,11 @@ If you get stuck, you can ask for help in the [Plugin Forum](https://wordpress.o
|
|
161 |
*Release Date - 21 November 2017*
|
162 |
|
163 |
* Fixed Wishlist Products Counter issue when the wrong number of products was displaying if cache is enabled
|
164 |
-
* Fixed an issue with W3 Total Cache plugin
|
165 |
* Fixed an issue with wrong file path after website migration
|
166 |
* Fixed an issue with extra scheduled cleanup events
|
167 |
* Fixed an issue with reset some settings after plugin update
|
168 |
-
* Added support for WP Fastest Cache plugin
|
169 |
|
170 |
= 1.5.8 =
|
171 |
*Release Date - 07 November 2017*
|
@@ -175,7 +182,7 @@ If you get stuck, you can ask for help in the [Plugin Forum](https://wordpress.o
|
|
175 |
* Added "Reset to Defaults" option in the admin panel
|
176 |
* Added an option to show the "Add to Wishlist" button above product thumbnail
|
177 |
* An option to change social icons from dark to white was moved to "Social Networks Sharing Options" section
|
178 |
-
* Added support for Comet Cache plugin
|
179 |
|
180 |
= 1.5.7 =
|
181 |
*Release Date - 21 October 2017*
|
@@ -185,9 +192,9 @@ If you get stuck, you can ask for help in the [Plugin Forum](https://wordpress.o
|
|
185 |
* Fixed an issue with empty pop up window after clicking Share Wishlist by Email button
|
186 |
* Internal improvements:
|
187 |
* Variable product (without predefined variations applied by default) added from products listing page will be always substituted with the product added from details page (with selected variations).
|
188 |
-
* Improved WooCommerce Composite Products plugin support:
|
189 |
* Fixed individual price calculation with components
|
190 |
-
* Improved Polylang plugin support
|
191 |
|
192 |
= 1.5.6 =
|
193 |
*Release Date - 20 September 2017*
|
@@ -195,15 +202,15 @@ If you get stuck, you can ask for help in the [Plugin Forum](https://wordpress.o
|
|
195 |
* Fixed an issue with transferring products between guest and customer wishlists after signing in or logout.
|
196 |
* Fixed an issue when it's not possible to remove products from wishlist as a guest
|
197 |
* Fixed an issue with adding a product variations to wishlist
|
198 |
-
* Improved WooCommerce Product Bundles plugin support:
|
199 |
* Fixed an issue with displaying product custom meta attributes
|
200 |
-
* Improved WPML plugin compatibility:
|
201 |
* Fixed an issue with "Remove/Add" button text when switching languages
|
202 |
|
203 |
= 1.5.5 =
|
204 |
*Release Date - 11 September 2017*
|
205 |
|
206 |
-
* Improved WooCommerce Product Bundles plugin support:
|
207 |
* Fixed and issue when product variations was not applied in bundled products
|
208 |
* Fixed an issue with products visibility on a Wishlist page
|
209 |
* Fixed text domains for some strings
|
@@ -220,11 +227,11 @@ If you get stuck, you can ask for help in the [Plugin Forum](https://wordpress.o
|
|
220 |
= 1.5.3 =
|
221 |
*Release Date - 30 August 2017*
|
222 |
|
223 |
-
* Improved WPML Compatibility
|
224 |
* Added minified version of FontAwesome library
|
225 |
* Added support for plugins/WooCommerce add-ons:
|
226 |
* WooCommerce Personalized Product Option
|
227 |
-
* YITH WooCommerce Product Bundles
|
228 |
|
229 |
= 1.5.2 =
|
230 |
*Release Date - 23 August 2017*
|
@@ -237,7 +244,7 @@ If you get stuck, you can ask for help in the [Plugin Forum](https://wordpress.o
|
|
237 |
* Fixed a fatal error on Dashboard menu
|
238 |
* Minor CSS fixes
|
239 |
* Added support for plugins/WooCommerce add-ons:
|
240 |
-
* WooCommerce Quantity Increment
|
241 |
|
242 |
= 1.5.0 =
|
243 |
*Release Date - 11 August 2017*
|
@@ -246,13 +253,13 @@ If you get stuck, you can ask for help in the [Plugin Forum](https://wordpress.o
|
|
246 |
* Added the ability to load custom translation files
|
247 |
* Overall frontend performance optimization
|
248 |
* Added support for plugins/WooCommerce add-ons that use custom meta:
|
249 |
-
* WooCommerce Gift Cards
|
250 |
-
* WooCommerce Bookings
|
251 |
-
* WooCommerce Subscriptions
|
252 |
-
* WooCommerce Composite Products
|
253 |
-
* WooCommerce Product Bundles
|
254 |
-
* WooCommerce Mix and Match
|
255 |
-
* WooCommerce Gravity Forms Product Add-Ons
|
256 |
|
257 |
= 1.4.0 =
|
258 |
*Release Date - 14 July 2017*
|
@@ -273,9 +280,9 @@ If you get stuck, you can ask for help in the [Plugin Forum](https://wordpress.o
|
|
273 |
= 1.3.3 =
|
274 |
*Release Date - 07 May 2017*
|
275 |
|
276 |
-
* Improved WPML compatibility (fixed an issue with URL formats)
|
277 |
* Fixed issues with deprecated hooks related to WooCommerce 3.0.5
|
278 |
-
* Added Polylang plugin support
|
279 |
* Added new option that allows product automatic removal when it's added to cart by anyone
|
280 |
|
281 |
|
@@ -294,10 +301,10 @@ If you get stuck, you can ask for help in the [Plugin Forum](https://wordpress.o
|
|
294 |
= 1.3.0 =
|
295 |
*Release Date - 24 April 2017*
|
296 |
|
297 |
-
* Fixed WPML string translations issue
|
298 |
* Added theme compatibility notices
|
299 |
* Wishlist custom item meta hidden from order
|
300 |
-
* Added compatibility with WooCommerce
|
301 |
|
302 |
= 1.2.1 =
|
303 |
*Release Date - 08 April 2017*
|
@@ -313,7 +320,7 @@ If you get stuck, you can ask for help in the [Plugin Forum](https://wordpress.o
|
|
313 |
= 1.1.14 =
|
314 |
*Release Date - 04 April 2017*
|
315 |
|
316 |
-
* Fixed multiple issues with WPML support.
|
317 |
|
318 |
= 1.1.13 =
|
319 |
*Release Date - 16 March 2017*
|
@@ -342,7 +349,7 @@ If you get stuck, you can ask for help in the [Plugin Forum](https://wordpress.o
|
|
342 |
= 1.1.9 =
|
343 |
*Release Date - 26 February 2017*
|
344 |
|
345 |
-
* Fixed an issue with W3 Total Cache compatibility
|
346 |
* Added public functions
|
347 |
|
348 |
= 1.1.8 =
|
@@ -402,9 +409,9 @@ If you get stuck, you can ask for help in the [Plugin Forum](https://wordpress.o
|
|
402 |
= 1.1.0 =
|
403 |
*Release Date - 11 October 2016*
|
404 |
|
405 |
-
* Added support for WP Super Cache plugin
|
406 |
-
* Added support for W3 Total Cache plugin
|
407 |
-
* Added support for WooCommerce
|
408 |
* Added option to show link to Wishlist on My Account page
|
409 |
* Added minimized versions of JS
|
410 |
|
@@ -428,4 +435,4 @@ Full documentation is available [here](https://templateinvaders.com/documentatio
|
|
428 |
|
429 |
== Upgrade Notice ==
|
430 |
= 1.5 =
|
431 |
-
Improved frontend performance. Added plugin support for WooCommerce Gift Cards, WooCommerce Bookings, WooCommerce Subscriptions, WooCommerce Composite Products, WooCommerce Product Bundles, WooCommerce Mix and Match, WooCommerce Gravity Forms Product Add-Ons.
|
4 |
Tags: wishlist, woocommerce, woocommerce wishlist, e-commerce, shop, ecommerce wishlist, shop wishlist, wishlist for Woocommerce
|
5 |
Requires at least: 4.5
|
6 |
Tested up to: 4.9
|
7 |
+
Stable tag: 1.5.14
|
8 |
License: GPLv3
|
9 |
License URI: https://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
16 |
= Increase Sales and Conversions =
|
17 |
WooCommerce Wishlist is a simple but powerful tool that can help you to convert your site visitors into loyal customers. There are many situations when customers can’t buy a product at this time or simply don’t want. Possibility to save products for later encourages users to return to your site and after all, make a purchase. Adding products to Wishlist is easy and convenient so it may also force your customers to buy even more products than they planned. Users can share their wishlist, for example, to help their friends choose a gift for upcoming holiday and so on. By sharing their Wishlists, they are bringing you, new potential customers. All in all this increasing amount of your site visitors, conversion and as a result sales.
|
18 |
|
19 |
+
[Live Preview](https://woocommercewishlist.com/preview/?utm_source=wordpressorg&utm_content=preview)
|
20 |
|
21 |
[View documentation](https://templateinvaders.com/documentation/ti-woocommerce-wishlist-free/?utm_source=wordpressorg&utm_content=documentation)
|
22 |
|
44 |
+ Custom CSS styles
|
45 |
+ Responsive & Retina Ready
|
46 |
+ Translation ready
|
47 |
+
+ [WPML](https://wpml.org/?aid=9393&affiliate_key=9xzbMQnIyxHE) Support
|
48 |
+ Product variations Support
|
49 |
|
50 |
= COMPATIBILITY WITH MOST USED PLUGINS/ADDONS =
|
51 |
+
We understand that our plugin is not the only one that you are going to use for your WooCommerce store and how it is important for different plugins to work well with each others. That is why we have added compatibility with the most used WooCommerce add-ons: [WooCommerce Bookings](https://woocommerce.com/products/woocommerce-bookings/?aff=3955), [WooCommerce Subscriptions](https://woocommerce.com/products/woocommerce-subscriptions/?aff=3955), [WooCommerce Composite Products](https://woocommerce.com/products/composite-products/?aff=3955), [WooCommerce Product Bundles](https://woocommerce.com/products/product-bundles/?aff=3955), [WooCommerce Mix and Match](https://woocommerce.com/products/woocommerce-mix-and-match-products/?aff=3955), [WooCommerce Gravity Forms Product Add-Ons](https://woocommerce.com/products/gravity-forms-add-ons/?aff=3955), [WooCommerce Gift Cards](https://wordpress.org/plugins/gift-cards-for-woocommerce/).
|
52 |
+
It is also very important for any WordPress website to use cache plugins, so we make sure that our WooCommerce Wishlist works well with [WP Rocket](https://wp-rocket.me/), [WP Super Cache](https://wordpress.org/plugins/wp-super-cache/) and [W3 Total Cache](https://wordpress.org/plugins/w3-total-cache/) plugins.
|
53 |
|
54 |
= Add to Wishlist button =
|
55 |
You can adjust Add to wishlist button settings to make it work best for your website.
|
63 |
|
64 |
= Translation Ready =
|
65 |
|
66 |
+
You can easily translate WooCommerce Wishlist Plugin to any language. Simply choose the most convenient way for you: using poEdit tool, [Loco Translate](https://wordpress.org/plugins/loco-translate/) or [WPML](https://wpml.org/?aid=9393&affiliate_key=9xzbMQnIyxHE).
|
67 |
|
68 |
= Responsive & Retina Ready =
|
69 |
We know how important responsive website for the online store in nowadays.
|
129 |
|
130 |
== Changelog ==
|
131 |
|
132 |
+
= 1.5.14 =
|
133 |
+
*Release Date - 14 December 2017*
|
134 |
+
|
135 |
+
* Fixed an issue when empty wishlist is created once a guest visits the shop page
|
136 |
+
* Added new option "Require Login" that disallows guests to add products to a Wishlist until they sign-in
|
137 |
+
* Improved Wishlist Products Counter functionality
|
138 |
+
|
139 |
= 1.5.13 =
|
140 |
*Release Date - 02 December 2017*
|
141 |
|
168 |
*Release Date - 21 November 2017*
|
169 |
|
170 |
* Fixed Wishlist Products Counter issue when the wrong number of products was displaying if cache is enabled
|
171 |
+
* Fixed an issue with [W3 Total Cache](https://wordpress.org/plugins/w3-total-cache/) plugin
|
172 |
* Fixed an issue with wrong file path after website migration
|
173 |
* Fixed an issue with extra scheduled cleanup events
|
174 |
* Fixed an issue with reset some settings after plugin update
|
175 |
+
* Added support for [WP Fastest Cache](https://wordpress.org/plugins/wp-fastest-cache/) plugin
|
176 |
|
177 |
= 1.5.8 =
|
178 |
*Release Date - 07 November 2017*
|
182 |
* Added "Reset to Defaults" option in the admin panel
|
183 |
* Added an option to show the "Add to Wishlist" button above product thumbnail
|
184 |
* An option to change social icons from dark to white was moved to "Social Networks Sharing Options" section
|
185 |
+
* Added support for [Comet Cache](https://wordpress.org/plugins/comet-cache/) plugin
|
186 |
|
187 |
= 1.5.7 =
|
188 |
*Release Date - 21 October 2017*
|
192 |
* Fixed an issue with empty pop up window after clicking Share Wishlist by Email button
|
193 |
* Internal improvements:
|
194 |
* Variable product (without predefined variations applied by default) added from products listing page will be always substituted with the product added from details page (with selected variations).
|
195 |
+
* Improved [WooCommerce Composite Products](https://woocommerce.com/products/composite-products/?aff=3955) plugin support:
|
196 |
* Fixed individual price calculation with components
|
197 |
+
* Improved [Polylang](https://wordpress.org/plugins/polylang/) plugin support
|
198 |
|
199 |
= 1.5.6 =
|
200 |
*Release Date - 20 September 2017*
|
202 |
* Fixed an issue with transferring products between guest and customer wishlists after signing in or logout.
|
203 |
* Fixed an issue when it's not possible to remove products from wishlist as a guest
|
204 |
* Fixed an issue with adding a product variations to wishlist
|
205 |
+
* Improved [WooCommerce Product Bundles](https://woocommerce.com/products/product-bundles/?aff=3955) plugin support:
|
206 |
* Fixed an issue with displaying product custom meta attributes
|
207 |
+
* Improved [WPML](https://wpml.org/?aid=9393&affiliate_key=9xzbMQnIyxHE) plugin compatibility:
|
208 |
* Fixed an issue with "Remove/Add" button text when switching languages
|
209 |
|
210 |
= 1.5.5 =
|
211 |
*Release Date - 11 September 2017*
|
212 |
|
213 |
+
* Improved [WooCommerce Product Bundles](https://woocommerce.com/products/product-bundles/?aff=3955) plugin support:
|
214 |
* Fixed and issue when product variations was not applied in bundled products
|
215 |
* Fixed an issue with products visibility on a Wishlist page
|
216 |
* Fixed text domains for some strings
|
227 |
= 1.5.3 =
|
228 |
*Release Date - 30 August 2017*
|
229 |
|
230 |
+
* Improved [WPML](https://wpml.org/?aid=9393&affiliate_key=9xzbMQnIyxHE) Compatibility
|
231 |
* Added minified version of FontAwesome library
|
232 |
* Added support for plugins/WooCommerce add-ons:
|
233 |
* WooCommerce Personalized Product Option
|
234 |
+
* [YITH WooCommerce Product Bundles](https://yithemes.com/themes/plugins/yith-woocommerce-product-bundles/?refer_id=1033256)
|
235 |
|
236 |
= 1.5.2 =
|
237 |
*Release Date - 23 August 2017*
|
244 |
* Fixed a fatal error on Dashboard menu
|
245 |
* Minor CSS fixes
|
246 |
* Added support for plugins/WooCommerce add-ons:
|
247 |
+
* [WooCommerce Quantity Increment](https://wordpress.org/plugins/woocommerce-quantity-increment/)
|
248 |
|
249 |
= 1.5.0 =
|
250 |
*Release Date - 11 August 2017*
|
253 |
* Added the ability to load custom translation files
|
254 |
* Overall frontend performance optimization
|
255 |
* Added support for plugins/WooCommerce add-ons that use custom meta:
|
256 |
+
* [WooCommerce Gift Cards](https://wordpress.org/plugins/gift-cards-for-woocommerce/)
|
257 |
+
* [WooCommerce Bookings](https://woocommerce.com/products/woocommerce-bookings/?aff=3955)
|
258 |
+
* [WooCommerce Subscriptions](https://woocommerce.com/products/woocommerce-subscriptions/?aff=3955)
|
259 |
+
* [WooCommerce Composite Products](https://woocommerce.com/products/composite-products/?aff=3955)
|
260 |
+
* [WooCommerce Product Bundles](https://woocommerce.com/products/product-bundles/?aff=3955)
|
261 |
+
* [WooCommerce Mix and Match](https://woocommerce.com/products/woocommerce-mix-and-match-products/?aff=3955)
|
262 |
+
* [WooCommerce Gravity Forms Product Add-Ons](https://woocommerce.com/products/gravity-forms-add-ons/?aff=3955)
|
263 |
|
264 |
= 1.4.0 =
|
265 |
*Release Date - 14 July 2017*
|
280 |
= 1.3.3 =
|
281 |
*Release Date - 07 May 2017*
|
282 |
|
283 |
+
* Improved [WPML](https://wpml.org/?aid=9393&affiliate_key=9xzbMQnIyxHE) compatibility (fixed an issue with URL formats)
|
284 |
* Fixed issues with deprecated hooks related to WooCommerce 3.0.5
|
285 |
+
* Added [Polylang](https://wordpress.org/plugins/polylang/) plugin support
|
286 |
* Added new option that allows product automatic removal when it's added to cart by anyone
|
287 |
|
288 |
|
301 |
= 1.3.0 =
|
302 |
*Release Date - 24 April 2017*
|
303 |
|
304 |
+
* Fixed [WPML](https://wpml.org/?aid=9393&affiliate_key=9xzbMQnIyxHE) string translations issue
|
305 |
* Added theme compatibility notices
|
306 |
* Wishlist custom item meta hidden from order
|
307 |
+
* Added compatibility with [WooCommerce Gift Cards](https://wordpress.org/plugins/gift-cards-for-woocommerce/)
|
308 |
|
309 |
= 1.2.1 =
|
310 |
*Release Date - 08 April 2017*
|
320 |
= 1.1.14 =
|
321 |
*Release Date - 04 April 2017*
|
322 |
|
323 |
+
* Fixed multiple issues with [WPML](https://wpml.org/?aid=9393&affiliate_key=9xzbMQnIyxHE) support.
|
324 |
|
325 |
= 1.1.13 =
|
326 |
*Release Date - 16 March 2017*
|
349 |
= 1.1.9 =
|
350 |
*Release Date - 26 February 2017*
|
351 |
|
352 |
+
* Fixed an issue with [W3 Total Cache](https://wordpress.org/plugins/w3-total-cache/) compatibility
|
353 |
* Added public functions
|
354 |
|
355 |
= 1.1.8 =
|
409 |
= 1.1.0 =
|
410 |
*Release Date - 11 October 2016*
|
411 |
|
412 |
+
* Added support for [WP Super Cache](https://wordpress.org/plugins/wp-super-cache/) plugin
|
413 |
+
* Added support for [W3 Total Cache](https://wordpress.org/plugins/w3-total-cache/) plugin
|
414 |
+
* Added support for [WooCommerce Gravity Forms Product Add-Ons](https://woocommerce.com/products/gravity-forms-add-ons/?aff=3955)
|
415 |
* Added option to show link to Wishlist on My Account page
|
416 |
* Added minimized versions of JS
|
417 |
|
435 |
|
436 |
== Upgrade Notice ==
|
437 |
= 1.5 =
|
438 |
+
Improved frontend performance. Added plugin support for [WooCommerce Gift Cards](https://wordpress.org/plugins/gift-cards-for-woocommerce/), [WooCommerce Bookings](https://woocommerce.com/products/woocommerce-bookings/?aff=3955), [WooCommerce Subscriptions](https://woocommerce.com/products/woocommerce-subscriptions/?aff=3955), [WooCommerce Composite Products](https://woocommerce.com/products/composite-products/?aff=3955), [WooCommerce Product Bundles](https://woocommerce.com/products/product-bundles/?aff=3955), [WooCommerce Mix and Match](https://woocommerce.com/products/woocommerce-mix-and-match-products/?aff=3955), [WooCommerce Gravity Forms Product Add-Ons](https://woocommerce.com/products/gravity-forms-add-ons/?aff=3955).
|
templates/ti-addedtowishlist-dialogbox.php
CHANGED
@@ -23,6 +23,9 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
23 |
<?php if ( isset( $wishlist_url ) ) : ?>
|
24 |
<button class="button tinvwl_button_view tinvwl-btn-onclick" data-url="<?php echo esc_url( $wishlist_url ); ?>" type="button"><i class="fa fa-heart-o"></i><?php echo esc_html( tinv_get_option( 'general', 'text_browse' ) ); ?></button>
|
25 |
<?php endif; ?>
|
|
|
|
|
|
|
26 |
</div>
|
27 |
<div class="tinv-wishlist-clear"></div>
|
28 |
</div>
|
23 |
<?php if ( isset( $wishlist_url ) ) : ?>
|
24 |
<button class="button tinvwl_button_view tinvwl-btn-onclick" data-url="<?php echo esc_url( $wishlist_url ); ?>" type="button"><i class="fa fa-heart-o"></i><?php echo esc_html( tinv_get_option( 'general', 'text_browse' ) ); ?></button>
|
25 |
<?php endif; ?>
|
26 |
+
<?php if ( isset( $dialog_custom_url ) && isset( $dialog_custom_html ) ) : ?>
|
27 |
+
<button class="buttin tinvwl_button_view tinvwl-btn-onclick" data-url="<?php echo esc_url( $dialog_custom_url ); ?>" type="button"><?php echo $dialog_custom_html; // WPCS: xss ok. ?></button>
|
28 |
+
<?php endif; ?>
|
29 |
</div>
|
30 |
<div class="tinv-wishlist-clear"></div>
|
31 |
</div>
|
templates/ti-wishlist-product-counter.php
CHANGED
@@ -14,7 +14,7 @@ if ( $icon_class && 'custom' === $icon && ! empty( $icon_upload ) ) {
|
|
14 |
$text = sprintf( '<img src="%s" /> %s', esc_url( $icon_upload ), $text );
|
15 |
}
|
16 |
?>
|
17 |
-
<a href="<?php echo esc_url( tinv_url_wishlist_default() ); ?>" class="wishlist_products_counter<?php echo ' ' . $icon_class . ' ' . $icon_style . ( empty( $text ) ? ' no-txt' : '' ) . ( 0 < $counter ? ' wishlist-counter-with-products' : '' ); // WPCS: xss ok. ?>">
|
18 |
<span class="wishlist_products_counter_text"><?php echo $text; // WPCS: xss ok. ?></span>
|
19 |
<?php if ( $show_counter ) : ?>
|
20 |
<span class="wishlist_products_counter_number"></span>
|
14 |
$text = sprintf( '<img src="%s" /> %s', esc_url( $icon_upload ), $text );
|
15 |
}
|
16 |
?>
|
17 |
+
<a href="<?php echo esc_url( ( tinv_get_option( 'general', 'require_login' ) && ! is_user_logged_in() ) ? wc_get_page_permalink( 'myaccount' ) : tinv_url_wishlist_default() ); ?>" class="wishlist_products_counter<?php echo ' ' . $icon_class . ' ' . $icon_style . ( empty( $text ) ? ' no-txt' : '' ) . ( 0 < $counter ? ' wishlist-counter-with-products' : '' ); // WPCS: xss ok. ?>">
|
18 |
<span class="wishlist_products_counter_text"><?php echo $text; // WPCS: xss ok. ?></span>
|
19 |
<?php if ( $show_counter ) : ?>
|
20 |
<span class="wishlist_products_counter_number"></span>
|
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.5.
|
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.5.
|
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.5.14
|
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.5.14' );
|
45 |
}
|
46 |
|
47 |
if ( ! defined( 'TINVWL_LOAD_FREE' ) ) {
|
tinv-wishlists-function.php
CHANGED
@@ -427,8 +427,11 @@ if ( ! function_exists( 'tinv_wishlist_get' ) ) {
|
|
427 |
|
428 |
$wishlist['is_owner'] = true;
|
429 |
} elseif ( $toend ) {
|
430 |
-
$wishlist
|
431 |
-
$wishlist
|
|
|
|
|
|
|
432 |
}
|
433 |
|
434 |
return $wishlist;
|
427 |
|
428 |
$wishlist['is_owner'] = true;
|
429 |
} elseif ( $toend ) {
|
430 |
+
$wishlist = $wl->get_by_sharekey_default();
|
431 |
+
if ( ! empty( $wishlist ) ) {
|
432 |
+
$wishlist = array_shift( $wishlist );
|
433 |
+
$wishlist['is_owner'] = $wl->get_sharekey() === $wishlist['share_key'];
|
434 |
+
}
|
435 |
}
|
436 |
|
437 |
return $wishlist;
|