WooCommerce Wishlist Plugin - Version 1.3.3

Version Description

Release Date - 07 May 2017

  • Improved WPML compatibility (fixed an issue with URL formats)
  • Fixed issues with deprecated hooks related to WooCommerce 3.0.5
  • Added Polylang plugin support
  • Added new option that allows product automatic removal when it's added to cart by anyone
Download this release

Release Info

Developer templateinvaders
Plugin Icon 128x128 WooCommerce Wishlist Plugin
Version 1.3.3
Comparing to
See all releases

Code changes from version 1.3.2 to 1.3.3

admin/settings/general.class.php CHANGED
@@ -81,6 +81,14 @@ class TInvWL_Admin_Settings_General extends TInvWL_Admin_BaseSection {
81
  'name' => 'processing_autoremove',
82
  'text' => __( 'Remove Product from Wishlist if added to cart', 'ti-woocommerce-wishlist' ),
83
  'std' => true,
 
 
 
 
 
 
 
 
84
  ),
85
  ),
86
  ),
@@ -125,6 +133,13 @@ class TInvWL_Admin_Settings_General extends TInvWL_Admin_BaseSection {
125
  ),
126
  'class' => 'tiwl-processing-autoremove',
127
  ),
 
 
 
 
 
 
 
128
  ),
129
  ),
130
  array(
@@ -413,8 +428,9 @@ class TInvWL_Admin_Settings_General extends TInvWL_Admin_BaseSection {
413
  */
414
  function constructor_load( $sections ) {
415
  $data = parent::constructor_load( $sections );
416
- $data['general']['page_wishlist'] = $data['page']['wishlist'];
417
- $data['general']['processing_autoremove'] = $data['processing']['autoremove'];
 
418
  return $data;
419
  }
420
 
@@ -430,6 +446,7 @@ class TInvWL_Admin_Settings_General extends TInvWL_Admin_BaseSection {
430
  }
431
  tinv_update_option( 'page', 'wishlist', $data['general']['page_wishlist'] );
432
  tinv_update_option( 'processing', 'autoremove', $data['general']['processing_autoremove'] );
 
433
  tinv_update_option( 'processing', 'autoremove_status', 'tinvwl-addcart' );
434
  TInvWL_Public_TInvWL::update_rewrite_rules();
435
  }
81
  'name' => 'processing_autoremove',
82
  'text' => __( 'Remove Product from Wishlist if added to cart', 'ti-woocommerce-wishlist' ),
83
  'std' => true,
84
+ 'extra' => array( 'tiwl-show' => '.tiwl-processing-autoremove-anyone' ),
85
+ ),
86
+ array(
87
+ 'type' => 'checkboxonoff',
88
+ 'name' => 'processing_autoremove_anyone',
89
+ 'text' => __( 'Remove by anyone', 'ti-woocommerce-wishlist' ),
90
+ 'std' => false,
91
+ 'class' => 'tiwl-processing-autoremove-anyone',
92
  ),
93
  ),
94
  ),
133
  ),
134
  'class' => 'tiwl-processing-autoremove',
135
  ),
136
+ array(
137
+ 'type' => 'checkboxonoff',
138
+ 'name' => 'autoremove_anyone',
139
+ 'text' => __( 'Remove by anyone', 'ti-woocommerce-wishlist' ),
140
+ 'std' => false,
141
+ 'class' => 'tiwl-processing-autoremove',
142
+ ),
143
  ),
144
  ),
145
  array(
428
  */
429
  function constructor_load( $sections ) {
430
  $data = parent::constructor_load( $sections );
431
+ $data['general']['page_wishlist'] = $data['page']['wishlist'];
432
+ $data['general']['processing_autoremove'] = $data['processing']['autoremove'];
433
+ $data['general']['processing_autoremove_anyone'] = $data['processing']['autoremove_anyone'];
434
  return $data;
435
  }
436
 
446
  }
447
  tinv_update_option( 'page', 'wishlist', $data['general']['page_wishlist'] );
448
  tinv_update_option( 'processing', 'autoremove', $data['general']['processing_autoremove'] );
449
+ tinv_update_option( 'processing', 'autoremove_anyone', $data['general']['processing_autoremove_anyone'] );
450
  tinv_update_option( 'processing', 'autoremove_status', 'tinvwl-addcart' );
451
  TInvWL_Public_TInvWL::update_rewrite_rules();
452
  }
includes/tinvwl.class.php CHANGED
@@ -87,7 +87,7 @@ class TInvWL {
87
  */
88
  function define_hooks() {
89
  add_filter( 'plugin_action_links_' . plugin_basename( TINVWL_PATH . 'ti-woocommerce-wishlist.php' ), array( $this, 'action_links' ) );
90
- add_action('after_setup_theme', 'tinvwl_set_utm');
91
  }
92
 
93
  /**
87
  */
88
  function define_hooks() {
89
  add_filter( 'plugin_action_links_' . plugin_basename( TINVWL_PATH . 'ti-woocommerce-wishlist.php' ), array( $this, 'action_links' ) );
90
+ add_action('after_setup_theme', 'tinvwl_set_utm', 100);
91
  }
92
 
93
  /**
includes/view.helper.php CHANGED
@@ -85,7 +85,7 @@ class TInvWL_View {
85
  * @return mixed
86
  */
87
  public static function get_session_arr( $name, $default = array() ) {
88
- $data = @$_SESSION[ self::$_n . $name ]; // @codingStandardsIgnoreLine WordPress.VIP.SessionVariableUsage.SessionVarsProhibited
89
  if ( empty( $data ) ) {
90
  return $default;
91
  }
@@ -100,7 +100,7 @@ class TInvWL_View {
100
  * @param mixed $value Value.
101
  */
102
  public static function set_session_arr( $name, $value = array() ) {
103
- $_SESSION[ self::$_n . $name ] = $value; // @codingStandardsIgnoreLine WordPress.VIP.SessionVariableUsage.SessionVarsProhibited
104
  }
105
 
106
  /**
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
  }
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
  /**
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-04-28 00:03+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,11 +40,11 @@ msgstr ""
40
  msgid "Template Custom CSS"
41
  msgstr ""
42
 
43
- #: admin/basestyle.helper.php:114 admin/settings/general.class.php:395
44
  msgid "Save Settings"
45
  msgstr ""
46
 
47
- #: admin/basestyle.helper.php:120 admin/settings/general.class.php:401
48
  msgid "Save"
49
  msgstr ""
50
 
@@ -75,217 +75,221 @@ msgstr ""
75
  msgid "Remove Product from Wishlist if added to cart"
76
  msgstr ""
77
 
78
- #: admin/settings/general.class.php:89
 
 
 
 
79
  msgid "Wishlist Page Options"
80
  msgstr ""
81
 
82
- #: admin/settings/general.class.php:90 admin/settings/general.class.php:107
83
- #: public/tinvwl.class.php:228
84
  msgid "Coming soon"
85
  msgstr ""
86
 
87
- #: admin/settings/general.class.php:97 views/wizard/step-page.php:36
88
  msgid "My Wishlist"
89
  msgstr ""
90
 
91
- #: admin/settings/general.class.php:106
92
  msgid "Wishlist Processing Options"
93
  msgstr ""
94
 
95
- #: admin/settings/general.class.php:114
96
  msgid "Automatic removal"
97
  msgstr ""
98
 
99
- #: admin/settings/general.class.php:121
100
  msgid "Remove condition"
101
  msgstr ""
102
 
103
- #: admin/settings/general.class.php:124
104
  msgid "Add to Card"
105
  msgstr ""
106
 
107
- #: admin/settings/general.class.php:132
108
  msgid "Product page \"Add to Wishlist\" Button Settings"
109
  msgstr ""
110
 
111
- #: admin/settings/general.class.php:138 views/wizard/step-button.php:32
112
  msgid "Button position"
113
  msgstr ""
114
 
115
- #: admin/settings/general.class.php:139
116
  msgid ""
117
  "Add this shortcode <code>[ti_wishlists_addtowishlist]</code> anywhere on "
118
  "product page, if you have chosen custom position for product button. You "
119
  "will have to do this for each product."
120
  msgstr ""
121
 
122
- #: admin/settings/general.class.php:142 includes/wizard.class.php:400
123
  msgid "After \"Add to Cart\" button"
124
  msgstr ""
125
 
126
- #: admin/settings/general.class.php:143 includes/wizard.class.php:401
127
  msgid "Before \"Add to Cart\" button"
128
  msgstr ""
129
 
130
- #: admin/settings/general.class.php:144 includes/wizard.class.php:402
131
  msgid "Custom position with code"
132
  msgstr ""
133
 
134
- #: admin/settings/general.class.php:150
135
  msgid "Button type"
136
  msgstr ""
137
 
138
- #: admin/settings/general.class.php:153
139
  msgid "Link"
140
  msgstr ""
141
 
142
- #: admin/settings/general.class.php:154 includes/wizard.class.php:389
143
  msgid "Button"
144
  msgstr ""
145
 
146
- #: admin/settings/general.class.php:160
147
  msgid "\"Add to Wishlist\" Icon"
148
  msgstr ""
149
 
150
- #: admin/settings/general.class.php:161
151
  msgid ""
152
  "You can choose from our predefined icons or upload your custom icon. Custom "
153
  "icon size is limited to 16x16 px."
154
  msgstr ""
155
 
156
- #: admin/settings/general.class.php:164
157
  msgid "None"
158
  msgstr ""
159
 
160
- #: admin/settings/general.class.php:165
161
  msgid "Heart"
162
  msgstr ""
163
 
164
- #: admin/settings/general.class.php:166
165
  msgid "Heart+"
166
  msgstr ""
167
 
168
- #: admin/settings/general.class.php:167
169
  msgid "Custom"
170
  msgstr ""
171
 
172
- #: admin/settings/general.class.php:184
173
  msgid "Upload"
174
  msgstr ""
175
 
176
- #: admin/settings/general.class.php:193
177
  msgid "\"Add to Wishlist\" Icon Color"
178
  msgstr ""
179
 
180
- #: admin/settings/general.class.php:195
181
  msgid "Black"
182
  msgstr ""
183
 
184
- #: admin/settings/general.class.php:196 admin/settings/style.class.php:502
185
  msgid "White"
186
  msgstr ""
187
 
188
- #: admin/settings/general.class.php:203
189
  msgid "\"Add to Wishlist\" button Text"
190
  msgstr ""
191
 
192
- #: admin/settings/general.class.php:209
193
  msgid "\"View Wishlist\" button Text"
194
  msgstr ""
195
 
196
- #: admin/settings/general.class.php:215
197
  msgid "Redirect to Wishlist"
198
  msgstr ""
199
 
200
- #: admin/settings/general.class.php:216
201
  msgid ""
202
  "If enabled, user will be redirected to wishlist page after 5 sec from adding "
203
  "product to wishlist."
204
  msgstr ""
205
 
206
- #: admin/settings/general.class.php:222
207
  msgid "\"Product already in Wishlist\" Text"
208
  msgstr ""
209
 
210
- #: admin/settings/general.class.php:223
211
  msgid ""
212
  "This notification will be shown if user will try to add product that already "
213
  "in wishlist when quantity on wishlist page is disabled."
214
  msgstr ""
215
 
216
- #: admin/settings/general.class.php:229
217
  msgid "\"Product added to Wishlist\" Text"
218
  msgstr ""
219
 
220
- #: admin/settings/general.class.php:236
221
  msgid "Wishlist Product Settings"
222
  msgstr ""
223
 
224
- #: admin/settings/general.class.php:237
225
  msgid ""
226
  "Following options allows you to choose what information/functionality to "
227
  "show/enable in wishlist table on wishlist page."
228
  msgstr ""
229
 
230
- #: admin/settings/general.class.php:243
231
  msgid "Show \"Add to Cart\" button"
232
  msgstr ""
233
 
234
- #: admin/settings/general.class.php:250
235
  msgid "\"Add to Cart\" Text"
236
  msgstr ""
237
 
238
- #: admin/settings/general.class.php:257
239
  msgid "Show Unit price"
240
  msgstr ""
241
 
242
- #: admin/settings/general.class.php:263
243
  msgid "Show Stock status"
244
  msgstr ""
245
 
246
- #: admin/settings/general.class.php:269
247
  msgid "Show Date of addition"
248
  msgstr ""
249
 
250
- #: admin/settings/general.class.php:276
251
  msgid "Wishlist Table Settings"
252
  msgstr ""
253
 
254
- #: admin/settings/general.class.php:277
255
  msgid ""
256
  "Following options will help user to manage and add products to cart from "
257
  "wishlist table in bulk."
258
  msgstr ""
259
 
260
- #: admin/settings/general.class.php:283
261
  msgid "Show Checkboxes"
262
  msgstr ""
263
 
264
- #: admin/settings/general.class.php:295
265
  msgid "Show Actions button"
266
  msgstr ""
267
 
268
- #: admin/settings/general.class.php:296
269
  msgid "Bulk actions drop down at the bottom of wishlist table"
270
  msgstr ""
271
 
272
- #: admin/settings/general.class.php:302
273
  msgid "Show \"Add Selected to Cart\" button"
274
  msgstr ""
275
 
276
- #: admin/settings/general.class.php:309
277
  msgid "\"Add Selected to Cart\" Button Text"
278
  msgstr ""
279
 
280
- #: admin/settings/general.class.php:320
281
  msgid "Show \"Add All to Cart\" button"
282
  msgstr ""
283
 
284
- #: admin/settings/general.class.php:327
285
  msgid "\"Add All to Cart\" Button Text"
286
  msgstr ""
287
 
288
- #: admin/settings/general.class.php:340
289
  msgid ""
290
  "Following options enable/disable Social share icons below wishlist table on "
291
  "wishlist page. Wishlist owner can easily share their wishlists using this "
@@ -293,31 +297,31 @@ msgid ""
293
  "shared status, private wishlists can't be shared."
294
  msgstr ""
295
 
296
- #: admin/settings/general.class.php:346
297
  msgid "Social Networks Sharing Options"
298
  msgstr ""
299
 
300
- #: admin/settings/general.class.php:352 views/wizard/step-social.php:26
301
  msgid "Show \"Share on Facebook\" Button"
302
  msgstr ""
303
 
304
- #: admin/settings/general.class.php:358 views/wizard/step-social.php:35
305
  msgid "Show \"Tweet on Twitter\" Button"
306
  msgstr ""
307
 
308
- #: admin/settings/general.class.php:364 views/wizard/step-social.php:44
309
  msgid "Show \"Pin on Pinterest\" Button"
310
  msgstr ""
311
 
312
- #: admin/settings/general.class.php:370 views/wizard/step-social.php:53
313
  msgid "Show \"Share on Google+\" Button"
314
  msgstr ""
315
 
316
- #: admin/settings/general.class.php:376 views/wizard/step-social.php:62
317
  msgid "Show \"Share on Email\" Button"
318
  msgstr ""
319
 
320
- #: admin/settings/general.class.php:382
321
  msgid "\"Share on\" Text"
322
  msgstr ""
323
 
@@ -791,7 +795,7 @@ msgid "Page Setup"
791
  msgstr ""
792
 
793
  #: includes/wizard.class.php:282 includes/wizard.class.php:312
794
- #: public/tinvwl.class.php:430
795
  msgid "Wishlist"
796
  msgstr ""
797
 
@@ -827,16 +831,16 @@ msgstr ""
827
  msgid "Product option is not selected!"
828
  msgstr ""
829
 
830
- #: public/tinvwl.class.php:227
831
  #, php-format
832
  msgid "%1$s of %2$s"
833
  msgstr ""
834
 
835
- #: public/tinvwl.class.php:366
836
  msgid "Create New"
837
  msgstr ""
838
 
839
- #: public/tinvwl.class.php:368
840
  msgid ""
841
  "Please select some product options before adding this product to your "
842
  "wishlist."
@@ -937,15 +941,15 @@ msgstr ""
937
  msgid "Stock Status"
938
  msgstr ""
939
 
940
- #: templates/ti-wishlist-user.php:101 templates/ti-wishlist.php:108
941
  msgid "In stock"
942
  msgstr ""
943
 
944
- #: tinv-wishlists-function.php:695
945
  msgid "Select options"
946
  msgstr ""
947
 
948
- #: tinv-wishlists-function.php:950
949
  #, php-format
950
  msgid ""
951
  "Please help us improve %2$s! If you opt-in, some data about your usage of "
@@ -953,18 +957,18 @@ msgid ""
953
  "work just fine."
954
  msgstr ""
955
 
956
- #: tinv-wishlists-function.php:960
957
  #, php-format
958
  msgid ""
959
  "Allow %6$s to collect some usage data with %5$s to make the plugin even more "
960
  "awesome. If you skip this, that's okay! %2$s will still work just fine."
961
  msgstr ""
962
 
963
- #: tinv-wishlists-function.php:960
964
  msgid "WooCommerce Wishlist Plugin"
965
  msgstr ""
966
 
967
- #: tinv-wishlists-function.php:960
968
  msgid "TemplateInvaders"
969
  msgstr ""
970
 
3
  msgstr ""
4
  "Project-Id-Version: WooCommerce Wishlist Plugin\n"
5
  "Report-Msgid-Bugs-To: \n"
6
+ "POT-Creation-Date: 2017-05-07 19:11+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:410
44
  msgid "Save Settings"
45
  msgstr ""
46
 
47
+ #: admin/basestyle.helper.php:120 admin/settings/general.class.php:416
48
  msgid "Save"
49
  msgstr ""
50
 
75
  msgid "Remove Product from Wishlist if added to cart"
76
  msgstr ""
77
 
78
+ #: admin/settings/general.class.php:89 admin/settings/general.class.php:139
79
+ msgid "Remove by anyone"
80
+ msgstr ""
81
+
82
+ #: admin/settings/general.class.php:97
83
  msgid "Wishlist Page Options"
84
  msgstr ""
85
 
86
+ #: admin/settings/general.class.php:98 admin/settings/general.class.php:115
87
+ #: public/tinvwl.class.php:245
88
  msgid "Coming soon"
89
  msgstr ""
90
 
91
+ #: admin/settings/general.class.php:105 views/wizard/step-page.php:36
92
  msgid "My Wishlist"
93
  msgstr ""
94
 
95
+ #: admin/settings/general.class.php:114
96
  msgid "Wishlist Processing Options"
97
  msgstr ""
98
 
99
+ #: admin/settings/general.class.php:122
100
  msgid "Automatic removal"
101
  msgstr ""
102
 
103
+ #: admin/settings/general.class.php:129
104
  msgid "Remove condition"
105
  msgstr ""
106
 
107
+ #: admin/settings/general.class.php:132
108
  msgid "Add to Card"
109
  msgstr ""
110
 
111
+ #: admin/settings/general.class.php:147
112
  msgid "Product page \"Add to Wishlist\" Button Settings"
113
  msgstr ""
114
 
115
+ #: admin/settings/general.class.php:153 views/wizard/step-button.php:32
116
  msgid "Button position"
117
  msgstr ""
118
 
119
+ #: admin/settings/general.class.php:154
120
  msgid ""
121
  "Add this shortcode <code>[ti_wishlists_addtowishlist]</code> anywhere on "
122
  "product page, if you have chosen custom position for product button. You "
123
  "will have to do this for each product."
124
  msgstr ""
125
 
126
+ #: admin/settings/general.class.php:157 includes/wizard.class.php:400
127
  msgid "After \"Add to Cart\" button"
128
  msgstr ""
129
 
130
+ #: admin/settings/general.class.php:158 includes/wizard.class.php:401
131
  msgid "Before \"Add to Cart\" button"
132
  msgstr ""
133
 
134
+ #: admin/settings/general.class.php:159 includes/wizard.class.php:402
135
  msgid "Custom position with code"
136
  msgstr ""
137
 
138
+ #: admin/settings/general.class.php:165
139
  msgid "Button type"
140
  msgstr ""
141
 
142
+ #: admin/settings/general.class.php:168
143
  msgid "Link"
144
  msgstr ""
145
 
146
+ #: admin/settings/general.class.php:169 includes/wizard.class.php:389
147
  msgid "Button"
148
  msgstr ""
149
 
150
+ #: admin/settings/general.class.php:175
151
  msgid "\"Add to Wishlist\" Icon"
152
  msgstr ""
153
 
154
+ #: admin/settings/general.class.php:176
155
  msgid ""
156
  "You can choose from our predefined icons or upload your custom icon. Custom "
157
  "icon size is limited to 16x16 px."
158
  msgstr ""
159
 
160
+ #: admin/settings/general.class.php:179
161
  msgid "None"
162
  msgstr ""
163
 
164
+ #: admin/settings/general.class.php:180
165
  msgid "Heart"
166
  msgstr ""
167
 
168
+ #: admin/settings/general.class.php:181
169
  msgid "Heart+"
170
  msgstr ""
171
 
172
+ #: admin/settings/general.class.php:182
173
  msgid "Custom"
174
  msgstr ""
175
 
176
+ #: admin/settings/general.class.php:199
177
  msgid "Upload"
178
  msgstr ""
179
 
180
+ #: admin/settings/general.class.php:208
181
  msgid "\"Add to Wishlist\" Icon Color"
182
  msgstr ""
183
 
184
+ #: admin/settings/general.class.php:210
185
  msgid "Black"
186
  msgstr ""
187
 
188
+ #: admin/settings/general.class.php:211 admin/settings/style.class.php:502
189
  msgid "White"
190
  msgstr ""
191
 
192
+ #: admin/settings/general.class.php:218
193
  msgid "\"Add to Wishlist\" button Text"
194
  msgstr ""
195
 
196
+ #: admin/settings/general.class.php:224
197
  msgid "\"View Wishlist\" button Text"
198
  msgstr ""
199
 
200
+ #: admin/settings/general.class.php:230
201
  msgid "Redirect to Wishlist"
202
  msgstr ""
203
 
204
+ #: admin/settings/general.class.php:231
205
  msgid ""
206
  "If enabled, user will be redirected to wishlist page after 5 sec from adding "
207
  "product to wishlist."
208
  msgstr ""
209
 
210
+ #: admin/settings/general.class.php:237
211
  msgid "\"Product already in Wishlist\" Text"
212
  msgstr ""
213
 
214
+ #: admin/settings/general.class.php:238
215
  msgid ""
216
  "This notification will be shown if user will try to add product that already "
217
  "in wishlist when quantity on wishlist page is disabled."
218
  msgstr ""
219
 
220
+ #: admin/settings/general.class.php:244
221
  msgid "\"Product added to Wishlist\" Text"
222
  msgstr ""
223
 
224
+ #: admin/settings/general.class.php:251
225
  msgid "Wishlist Product Settings"
226
  msgstr ""
227
 
228
+ #: admin/settings/general.class.php:252
229
  msgid ""
230
  "Following options allows you to choose what information/functionality to "
231
  "show/enable in wishlist table on wishlist page."
232
  msgstr ""
233
 
234
+ #: admin/settings/general.class.php:258
235
  msgid "Show \"Add to Cart\" button"
236
  msgstr ""
237
 
238
+ #: admin/settings/general.class.php:265
239
  msgid "\"Add to Cart\" Text"
240
  msgstr ""
241
 
242
+ #: admin/settings/general.class.php:272
243
  msgid "Show Unit price"
244
  msgstr ""
245
 
246
+ #: admin/settings/general.class.php:278
247
  msgid "Show Stock status"
248
  msgstr ""
249
 
250
+ #: admin/settings/general.class.php:284
251
  msgid "Show Date of addition"
252
  msgstr ""
253
 
254
+ #: admin/settings/general.class.php:291
255
  msgid "Wishlist Table Settings"
256
  msgstr ""
257
 
258
+ #: admin/settings/general.class.php:292
259
  msgid ""
260
  "Following options will help user to manage and add products to cart from "
261
  "wishlist table in bulk."
262
  msgstr ""
263
 
264
+ #: admin/settings/general.class.php:298
265
  msgid "Show Checkboxes"
266
  msgstr ""
267
 
268
+ #: admin/settings/general.class.php:310
269
  msgid "Show Actions button"
270
  msgstr ""
271
 
272
+ #: admin/settings/general.class.php:311
273
  msgid "Bulk actions drop down at the bottom of wishlist table"
274
  msgstr ""
275
 
276
+ #: admin/settings/general.class.php:317
277
  msgid "Show \"Add Selected to Cart\" button"
278
  msgstr ""
279
 
280
+ #: admin/settings/general.class.php:324
281
  msgid "\"Add Selected to Cart\" Button Text"
282
  msgstr ""
283
 
284
+ #: admin/settings/general.class.php:335
285
  msgid "Show \"Add All to Cart\" button"
286
  msgstr ""
287
 
288
+ #: admin/settings/general.class.php:342
289
  msgid "\"Add All to Cart\" Button Text"
290
  msgstr ""
291
 
292
+ #: admin/settings/general.class.php:355
293
  msgid ""
294
  "Following options enable/disable Social share icons below wishlist table on "
295
  "wishlist page. Wishlist owner can easily share their wishlists using this "
297
  "shared status, private wishlists can't be shared."
298
  msgstr ""
299
 
300
+ #: admin/settings/general.class.php:361
301
  msgid "Social Networks Sharing Options"
302
  msgstr ""
303
 
304
+ #: admin/settings/general.class.php:367 views/wizard/step-social.php:26
305
  msgid "Show \"Share on Facebook\" Button"
306
  msgstr ""
307
 
308
+ #: admin/settings/general.class.php:373 views/wizard/step-social.php:35
309
  msgid "Show \"Tweet on Twitter\" Button"
310
  msgstr ""
311
 
312
+ #: admin/settings/general.class.php:379 views/wizard/step-social.php:44
313
  msgid "Show \"Pin on Pinterest\" Button"
314
  msgstr ""
315
 
316
+ #: admin/settings/general.class.php:385 views/wizard/step-social.php:53
317
  msgid "Show \"Share on Google+\" Button"
318
  msgstr ""
319
 
320
+ #: admin/settings/general.class.php:391 views/wizard/step-social.php:62
321
  msgid "Show \"Share on Email\" Button"
322
  msgstr ""
323
 
324
+ #: admin/settings/general.class.php:397
325
  msgid "\"Share on\" Text"
326
  msgstr ""
327
 
795
  msgstr ""
796
 
797
  #: includes/wizard.class.php:282 includes/wizard.class.php:312
798
+ #: public/tinvwl.class.php:454
799
  msgid "Wishlist"
800
  msgstr ""
801
 
831
  msgid "Product option is not selected!"
832
  msgstr ""
833
 
834
+ #: public/tinvwl.class.php:244
835
  #, php-format
836
  msgid "%1$s of %2$s"
837
  msgstr ""
838
 
839
+ #: public/tinvwl.class.php:388
840
  msgid "Create New"
841
  msgstr ""
842
 
843
+ #: public/tinvwl.class.php:390
844
  msgid ""
845
  "Please select some product options before adding this product to your "
846
  "wishlist."
941
  msgid "Stock Status"
942
  msgstr ""
943
 
944
+ #: templates/ti-wishlist-user.php:104 templates/ti-wishlist.php:108
945
  msgid "In stock"
946
  msgstr ""
947
 
948
+ #: tinv-wishlists-function.php:700
949
  msgid "Select options"
950
  msgstr ""
951
 
952
+ #: tinv-wishlists-function.php:980
953
  #, php-format
954
  msgid ""
955
  "Please help us improve %2$s! If you opt-in, some data about your usage of "
957
  "work just fine."
958
  msgstr ""
959
 
960
+ #: tinv-wishlists-function.php:990
961
  #, php-format
962
  msgid ""
963
  "Allow %6$s to collect some usage data with %5$s to make the plugin even more "
964
  "awesome. If you skip this, that's okay! %2$s will still work just fine."
965
  msgstr ""
966
 
967
+ #: tinv-wishlists-function.php:990
968
  msgid "WooCommerce Wishlist Plugin"
969
  msgstr ""
970
 
971
+ #: tinv-wishlists-function.php:990
972
  msgid "TemplateInvaders"
973
  msgstr ""
974
 
public/cart.class.php CHANGED
@@ -58,7 +58,11 @@ class TInvWL_Public_Cart {
58
  function define_hooks() {
59
  add_action( 'woocommerce_before_cart_item_quantity_zero', array( __CLASS__, 'remove_item_data' ) );
60
  add_action( 'woocommerce_cart_emptied', array( __CLASS__, 'remove_item_data' ) );
61
- add_action( 'woocommerce_add_order_item_meta', array( $this, 'add_order_item_meta' ), 10, 3 );
 
 
 
 
62
  }
63
 
64
  /**
@@ -98,7 +102,7 @@ class TInvWL_Public_Cart {
98
  $cart_item_key = WC()->cart->add_to_cart( $product_id, $quantity, $variation_id, $variations );
99
  if ( $cart_item_key ) {
100
  do_action( 'tinvwl_addedproduct_tocart', $cart_item_key, $product_id, $quantity, $variation_id );
101
- if ( $wishlist['is_owner'] && 'tinvwl-addcart' === tinv_get_option( 'processing', 'autoremove_status' ) ) {
102
  self::ar_f_wl( $wishlist, $product_id, $quantity, $variation_id );
103
  }
104
  self::set_item_data( $cart_item_key, $wishlist['share_key'], $quantity );
@@ -116,7 +120,7 @@ class TInvWL_Public_Cart {
116
  * @return array
117
  */
118
  public static function get_item_data( $cart_item_key, $wishlist = null ) {
119
- $data = (array) WC()->session->get( self::$_n . '_wishlist_cart', array() );
120
  if ( empty( $data[ $cart_item_key ] ) ) {
121
  $data[ $cart_item_key ] = array();
122
  }
@@ -137,7 +141,7 @@ class TInvWL_Public_Cart {
137
  * @return boolean
138
  */
139
  public static function set_item_data( $cart_item_key, $wishlist, $quantity = 1 ) {
140
- $data = (array) WC()->session->get( self::$_n . '_wishlist_cart', array() );
141
  if ( empty( $data[ $cart_item_key ] ) ) {
142
  $data[ $cart_item_key ] = array();
143
  }
@@ -148,7 +152,7 @@ class TInvWL_Public_Cart {
148
  $data[ $cart_item_key ][ $wishlist ] = $quantity;
149
  }
150
 
151
- WC()->session->set( self::$_n . '_wishlist_cart', $data );
152
  return true;
153
  }
154
 
@@ -160,9 +164,9 @@ class TInvWL_Public_Cart {
160
  * @return boolean
161
  */
162
  public static function remove_item_data( $cart_item_key = null, $wishlist = null ) {
163
- $data = (array) WC()->session->get( self::$_n . '_wishlist_cart', array() );
164
  if ( empty( $cart_item_key ) ) {
165
- WC()->session->set( self::$_n . '_wishlist_cart', array() );
166
  return true;
167
  }
168
  if ( ! array_key_exists( $cart_item_key, $data ) ) {
@@ -176,7 +180,7 @@ class TInvWL_Public_Cart {
176
  }
177
  unset( $data[ $cart_item_key ][ $wishlist ] );
178
  }
179
- WC()->session->set( self::$_n . '_wishlist_cart', $data );
180
  return true;
181
  }
182
 
@@ -191,11 +195,20 @@ class TInvWL_Public_Cart {
191
  $data = self::get_item_data( $cart_item_key );
192
  $data = apply_filters( 'tinvwl_addproduct_toorder', $data, $cart_item_key, $values );
193
  if ( ! empty( $data ) ) {
194
- if ( function_exists( 'wc_add_order_item_meta' ) ) {
195
- wc_add_order_item_meta( $item_id, self::$_n . '_wishlist_cart', $data );
196
- } else {
197
- woocommerce_add_order_item_meta( $item_id, self::$_n . '_wishlist_cart', $data );
198
- }
 
 
 
 
 
 
 
 
 
199
  }
200
  }
201
 
58
  function define_hooks() {
59
  add_action( 'woocommerce_before_cart_item_quantity_zero', array( __CLASS__, 'remove_item_data' ) );
60
  add_action( 'woocommerce_cart_emptied', array( __CLASS__, 'remove_item_data' ) );
61
+ if ( version_compare( WC_VERSION, '3.0.0', '<' ) ) {
62
+ add_action( 'woocommerce_add_order_item_meta', array( $this, 'add_order_item_meta' ), 10, 3 );
63
+ } else {
64
+ add_action( 'woocommerce_checkout_create_order', array( $this, 'add_order_item_meta_v3' ) );
65
+ }
66
  }
67
 
68
  /**
102
  $cart_item_key = WC()->cart->add_to_cart( $product_id, $quantity, $variation_id, $variations );
103
  if ( $cart_item_key ) {
104
  do_action( 'tinvwl_addedproduct_tocart', $cart_item_key, $product_id, $quantity, $variation_id );
105
+ if ( ( 'private' !== $wishlist['status'] && tinv_get_option( 'processing', 'autoremove_anyone' ) ) || $wishlist['is_owner'] && 'tinvwl-addcart' === tinv_get_option( 'processing', 'autoremove_status' ) ) {
106
  self::ar_f_wl( $wishlist, $product_id, $quantity, $variation_id );
107
  }
108
  self::set_item_data( $cart_item_key, $wishlist['share_key'], $quantity );
120
  * @return array
121
  */
122
  public static function get_item_data( $cart_item_key, $wishlist = null ) {
123
+ $data = (array) WC()->session->get( 'tinvwl_wishlist_cart', array() );
124
  if ( empty( $data[ $cart_item_key ] ) ) {
125
  $data[ $cart_item_key ] = array();
126
  }
141
  * @return boolean
142
  */
143
  public static function set_item_data( $cart_item_key, $wishlist, $quantity = 1 ) {
144
+ $data = (array) WC()->session->get( '_tinvwl_wishlist_cart', array() );
145
  if ( empty( $data[ $cart_item_key ] ) ) {
146
  $data[ $cart_item_key ] = array();
147
  }
152
  $data[ $cart_item_key ][ $wishlist ] = $quantity;
153
  }
154
 
155
+ WC()->session->set( 'tinvwl_wishlist_cart', $data );
156
  return true;
157
  }
158
 
164
  * @return boolean
165
  */
166
  public static function remove_item_data( $cart_item_key = null, $wishlist = null ) {
167
+ $data = (array) WC()->session->get( 'tinvwl_wishlist_cart', array() );
168
  if ( empty( $cart_item_key ) ) {
169
+ WC()->session->set( 'tinvwl_wishlist_cart', array() );
170
  return true;
171
  }
172
  if ( ! array_key_exists( $cart_item_key, $data ) ) {
180
  }
181
  unset( $data[ $cart_item_key ][ $wishlist ] );
182
  }
183
+ WC()->session->set( 'tinvwl_wishlist_cart', $data );
184
  return true;
185
  }
186
 
195
  $data = self::get_item_data( $cart_item_key );
196
  $data = apply_filters( 'tinvwl_addproduct_toorder', $data, $cart_item_key, $values );
197
  if ( ! empty( $data ) ) {
198
+ wc_add_order_item_meta( $item_id, '_tinvwl_wishlist_cart', $data );
199
+ }
200
+ }
201
+
202
+ /**
203
+ * Add meta data for product when created order
204
+ *
205
+ * @param \WC_Order $order Orlder object.
206
+ */
207
+ public function add_order_item_meta_v3( $order ) {
208
+ foreach ( $order->get_items() as $item ) {
209
+ $data = self::get_item_data( $item->legacy_cart_item_key );
210
+ $data = apply_filters( 'tinvwl_addproduct_toorder', $data, $item->legacy_cart_item_key, $item->legacy_values );
211
+ $item->update_meta_data( '_tinvwl_wishlist_cart', $data );
212
  }
213
  }
214
 
public/tinvwl.class.php CHANGED
@@ -41,12 +41,14 @@ class TInvWL_Public_TInvWL {
41
  *
42
  * @param string $plugin_name Plugin name.
43
  * @param string $version Plugin version.
 
44
  * @return \TInvWL_Public_TInvWL
45
  */
46
  public static function instance( $plugin_name = TINVWL_PREFIX, $version = TINVWL_VERSION ) {
47
  if ( is_null( self::$_instance ) ) {
48
  self::$_instance = new self( $plugin_name, $version );
49
  }
 
50
  return self::$_instance;
51
  }
52
 
@@ -57,8 +59,8 @@ class TInvWL_Public_TInvWL {
57
  * @param string $version Plugin version.
58
  */
59
  function __construct( $plugin_name, $version ) {
60
- $this->_n = $plugin_name;
61
- $this->_v = $version;
62
  $this->pre_load_function();
63
  }
64
 
@@ -77,8 +79,8 @@ class TInvWL_Public_TInvWL {
77
  add_filter( 'woocommerce_locate_template', array( $this, 'locate_template' ), 10, 3 );
78
 
79
  $this->addto = TInvWL_Public_AddToWishlist::instance( $this->_n );
80
- $this->view = TInvWL_Public_Wishlist_View::instance( $this->_n );
81
- $this->cart = TInvWL_Public_Cart::instance( $this->_n );
82
  }
83
 
84
  /**
@@ -132,6 +134,7 @@ class TInvWL_Public_TInvWL {
132
  * @param string $core_file Absolute path.
133
  * @param string $template Requered Template file.
134
  * @param string $template_base Template path.
 
135
  * @return string
136
  */
137
  function locate_template( $core_file, $template, $template_base ) {
@@ -139,6 +142,7 @@ class TInvWL_Public_TInvWL {
139
  if ( empty( $_core_file ) ) {
140
  return $core_file;
141
  }
 
142
  return $_core_file;
143
  }
144
 
@@ -164,20 +168,32 @@ class TInvWL_Public_TInvWL {
164
  * Create rewrite url for wishlist
165
  */
166
  function add_rewrite_rules() {
167
- $id = tinv_get_option( 'page', 'wishlist' );
168
- $pages = array( $id );
169
- $languages = apply_filters( 'wpml_active_languages', array(), array( 'skip_missing' => 0, 'orderby' => 'code' ) );
 
 
 
 
170
  if ( ! empty( $languages ) ) {
171
  foreach ( $languages as $l ) {
172
- $pages[] = apply_filters( 'wpml_object_id', $id, 'page', true, $l['language_code'] );
 
173
  }
174
- $pages = array_unique( $pages );
 
175
  }
 
176
  $pages = array_filter( $pages );
177
  if ( ! empty( $pages ) ) {
178
  foreach ( $pages as $page ) {
179
- $page = get_post( $page );
180
- $page_slug = $page->post_name;
 
 
 
 
 
181
 
182
  add_rewrite_rule( '(([^/]+/)*' . $page_slug . ')/([A-Fa-f0-9]{6})?/page/([0-9]{1,})/?$', 'index.php?pagename=$matches[1]&tinvwlID=$matches[3]&paged=$matches[4]', 'top' );
183
  add_rewrite_rule( '(([^/]+/)*' . $page_slug . ')/([A-Fa-f0-9]{6})?/?$', 'index.php?pagename=$matches[1]&tinvwlID=$matches[3]', 'top' );
@@ -189,11 +205,12 @@ class TInvWL_Public_TInvWL {
189
  * Add new POST variable
190
  *
191
  * @param array $public_var WordPress Public variable.
 
192
  * @return array
193
  */
194
  function add_query_var( $public_var ) {
195
- $public_var[] = 'tinvwlID';
196
- $public_var[] = 'tiws';
197
 
198
  return $public_var;
199
  }
@@ -205,28 +222,28 @@ class TInvWL_Public_TInvWL {
205
  if ( is_page( apply_filters( 'wpml_object_id', tinv_get_option( 'page', 'wishlist' ), 'page', true ) ) ) {
206
  $wishlist = tinv_wishlist_get();
207
  if ( 0 < $wishlist['ID'] && 'private' !== $wishlist['status'] ) {
208
- $user = get_user_by( 'id', $wishlist['author'] );
209
- $user_name = trim( sprintf( '%s %s', $user->user_firstname, $user->user_lastname ) );
210
- $user = @$user->display_name; // @codingStandardsIgnoreLine Generic.PHP.NoSilencedErrors.Discouraged
211
-
212
- $wlp = new TInvWL_Product( $wishlist );
213
- $products = $wlp->get_wishlist( array(
214
- 'count' => 1,
215
- 'order_by' => 'date',
216
- 'order' => 'DESC',
217
  ) );
218
- $product = array_shift( $products );
219
- $image = '';
220
  if ( ! empty( $product ) && ! empty( $product['data'] ) ) {
221
  list( $image, $width, $height, $is_intermediate ) = wp_get_attachment_image_src( $product['data']->get_image_id(), 'full' );
222
  }
223
 
224
- $meta = array(
225
- 'url' => tinv_url_wishlist( $wishlist['share_key'] ),
226
- 'type' => 'product.group',
227
- 'title' => sprintf( __( '%1$s of %2$s', 'ti-woocommerce-wishlist' ), $wishlist['title'], ( empty( $user_name )? $user : $user_name ) ),
228
- 'description' => __( 'Coming soon', 'ti-woocommerce-wishlist' ),
229
- 'image' => $image,
230
  );
231
  if ( tinv_get_option( 'social', 'facebook' ) ) {
232
  foreach ( $meta as $name => $content ) {
@@ -252,12 +269,14 @@ class TInvWL_Public_TInvWL {
252
  * Create ogp namespace
253
  *
254
  * @param string $text A space-separated list of language attributes.
 
255
  * @return string
256
  */
257
  function add_ogp( $text ) {
258
  if ( is_page( apply_filters( 'wpml_object_id', tinv_get_option( 'page', 'wishlist' ), 'page', true ) ) ) {
259
  $text = 'prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb# product: http://ogp.me/ns/product#" itemscope itemtype="http://schema.org/Offer" ' . $text;
260
  }
 
261
  return $text;
262
  }
263
 
@@ -267,13 +286,14 @@ class TInvWL_Public_TInvWL {
267
  * @return boolean
268
  */
269
  function is_pluginpage() {
270
- $pages = tinv_get_option( 'page' );
271
- $pages = array_filter( $pages );
272
  foreach ( $pages as $page ) {
273
  if ( is_page( apply_filters( 'wpml_object_id', $page, 'page', true ) ) ) {
274
  return true;
275
  }
276
  }
 
277
  return false;
278
  }
279
 
@@ -299,18 +319,20 @@ class TInvWL_Public_TInvWL {
299
  if ( ! tinv_get_option( 'style', 'customstyle' ) || tinv_get_option( 'style_plain', 'allow' ) ) {
300
  wp_enqueue_style( $this->_n . '-dynaminc', admin_url( 'admin-ajax.php' ) . '?action=' . $this->_n . '_css', array( $this->_n ), $this->_v, 'all' );
301
  }
302
- wp_enqueue_style( $this->_n . '-font-awesome', TINVWL_URL . 'asset/css/font-awesome.min.css', array(), $this->_v, 'all' );
303
  }
304
 
305
  /**
306
  * Compress CSS
307
  *
308
  * @param string $css CSS Content.
 
309
  * @return string
310
  */
311
  function compress_css( $css ) {
312
  $css = preg_replace( '!/\*[^*]*\*+([^/][^*]*\*+)*/!', ' ', $css );
313
  $css = preg_replace( '/(\r|\n|\t| {2,})/', ' ', $css );
 
314
  return $css;
315
  }
316
 
@@ -319,25 +341,25 @@ class TInvWL_Public_TInvWL {
319
  */
320
  function dynaminc_css() {
321
  header( 'Content-type: text/css; charset=' . get_option( 'blog_charset' ) );
322
- $css = get_transient( TINVWL_PREFIX . '_dynamic_' );
323
  if ( ! $css ) {
324
  $css = '';
325
  if ( ! tinv_get_option( 'style', 'customstyle' ) ) {
326
- $newcss = tinv_get_option( 'style_options', 'css' );
327
  if ( $newcss ) {
328
  $newcss = $this->compress_css( $newcss );
329
- $css .= $newcss;
330
  }
331
  }
332
  if ( tinv_get_option( 'style_plain', 'allow' ) ) {
333
  $newcss = tinv_get_option( 'style_plain', 'css' );
334
  if ( $newcss ) {
335
  $newcss = $this->compress_css( $newcss );
336
- $css .= $newcss;
337
  }
338
  }
339
- $image_url = TINVWL_URL . 'asset/img/';
340
- $css = str_replace( '../img/', $image_url, $css );
341
  set_transient( TINVWL_PREFIX . '_dynamic_', $css, DAY_IN_SECONDS );
342
  }
343
  echo $css; // WPCS: xss ok.
@@ -363,8 +385,8 @@ class TInvWL_Public_TInvWL {
363
  $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
364
  wp_register_script( $this->_n, TINVWL_URL . 'asset/js/public' . $suffix . '.js', array( 'jquery' ), $this->_v, true );
365
  wp_localize_script( $this->_n, 'tinvwl_add_to_wishlist', array(
366
- 'text_create' => __( 'Create New', 'ti-woocommerce-wishlist' ),
367
- 'text_already_in' => tinv_get_option( 'add_to_wishlist', 'text_already_in' ),
368
  'i18n_make_a_selection_text' => esc_attr__( 'Please select some product options before adding this product to your wishlist.', 'ti-woocommerce-wishlist' ),
369
  ) );
370
  wp_enqueue_script( $this->_n );
@@ -382,6 +404,7 @@ class TInvWL_Public_TInvWL {
382
  *
383
  * @param string $user_login Not used.
384
  * @param object $user User object.
 
385
  * @return boolean
386
  */
387
  function transfert_local_to_user( $user_login, $user ) {
@@ -396,9 +419,9 @@ class TInvWL_Public_TInvWL {
396
  function transfert_local_to_user_register( $user_id ) {
397
  $wlpl = TInvWL_Product_Local::instance( $this->_n );
398
 
399
- $wl = new TInvWL_Wishlist( $this->_n );
400
- $wl->user = $user_id;
401
- $wishlist = $wl->add_user_default();
402
 
403
  $wlp = new TInvWL_Product( $wishlist, $this->_n );
404
 
@@ -420,17 +443,19 @@ class TInvWL_Public_TInvWL {
420
  * Add link to wishlist in WooCommerce My Account page.
421
  *
422
  * @param array $items Menu items links in my accounts.
 
423
  * @return array
424
  */
425
  function account_menu_items( $items ) {
426
- $index_position = apply_filters( $this->_n . '_myaccount_position_wishlist', -1, $items );
427
- $items = array_merge(
428
  array_slice( $items, 0, $index_position, true ),
429
  array(
430
  'tinv_wishlist' => __( 'Wishlist', 'ti-woocommerce-wishlist' ),
431
- ),
432
  array_slice( $items, $index_position, null, true )
433
  );
 
434
  return $items;
435
  }
436
 
@@ -441,12 +466,14 @@ class TInvWL_Public_TInvWL {
441
  * @param string $endpoint End point name.
442
  * @param string $value Not used.
443
  * @param string $permalink Not used.
 
444
  * @return string
445
  */
446
  function account_menu_endpoint( $url, $endpoint, $value, $permalink ) {
447
  if ( 'tinv_wishlist' === $endpoint ) {
448
  $url = tinv_url_wishlist_default();
449
  }
 
450
  return $url;
451
  }
452
 
@@ -456,10 +483,10 @@ class TInvWL_Public_TInvWL {
456
  * @param integer $id Removed userid.
457
  */
458
  function delete_user_wishlist( $id ) {
459
- $wl = new TInvWL_Wishlist( $this->_n );
460
- $wishlists = $wl->get( array(
461
  'author' => $id,
462
- 'count' => 9999999,
463
  ) );
464
  if ( ! empty( $wishlists ) ) {
465
  foreach ( $wishlists as $wishlist ) {
41
  *
42
  * @param string $plugin_name Plugin name.
43
  * @param string $version Plugin version.
44
+ *
45
  * @return \TInvWL_Public_TInvWL
46
  */
47
  public static function instance( $plugin_name = TINVWL_PREFIX, $version = TINVWL_VERSION ) {
48
  if ( is_null( self::$_instance ) ) {
49
  self::$_instance = new self( $plugin_name, $version );
50
  }
51
+
52
  return self::$_instance;
53
  }
54
 
59
  * @param string $version Plugin version.
60
  */
61
  function __construct( $plugin_name, $version ) {
62
+ $this->_n = $plugin_name;
63
+ $this->_v = $version;
64
  $this->pre_load_function();
65
  }
66
 
79
  add_filter( 'woocommerce_locate_template', array( $this, 'locate_template' ), 10, 3 );
80
 
81
  $this->addto = TInvWL_Public_AddToWishlist::instance( $this->_n );
82
+ $this->view = TInvWL_Public_Wishlist_View::instance( $this->_n );
83
+ $this->cart = TInvWL_Public_Cart::instance( $this->_n );
84
  }
85
 
86
  /**
134
  * @param string $core_file Absolute path.
135
  * @param string $template Requered Template file.
136
  * @param string $template_base Template path.
137
+ *
138
  * @return string
139
  */
140
  function locate_template( $core_file, $template, $template_base ) {
142
  if ( empty( $_core_file ) ) {
143
  return $core_file;
144
  }
145
+
146
  return $_core_file;
147
  }
148
 
168
  * Create rewrite url for wishlist
169
  */
170
  function add_rewrite_rules() {
171
+ $id = tinv_get_option( 'page', 'wishlist' );
172
+ $pages = array( $id );
173
+ $language_codes = array();
174
+ $languages = apply_filters( 'wpml_active_languages', array(), array(
175
+ 'skip_missing' => 0,
176
+ 'orderby' => 'code'
177
+ ) );
178
  if ( ! empty( $languages ) ) {
179
  foreach ( $languages as $l ) {
180
+ $pages[] = apply_filters( 'wpml_object_id', $id, 'page', true, $l['language_code'] );
181
+ $language_codes[] = $l['language_code'];
182
  }
183
+ $pages = array_unique( $pages );
184
+ $language_codes = implode( '|', array_unique( $language_codes ) );
185
  }
186
+
187
  $pages = array_filter( $pages );
188
  if ( ! empty( $pages ) ) {
189
  foreach ( $pages as $page ) {
190
+ $page = get_post( $page );
191
+ $page_slug = $page->post_name;
192
+
193
+ if ( $language_codes && defined( 'POLYLANG_VERSION' ) ) {
194
+ add_rewrite_rule( '^(' . $language_codes . ')/(([^/]+/)*' . $page_slug . ')/([A-Fa-f0-9]{6})?/page/([0-9]{1,})/?$', 'index.php?pagename=$matches[2]&tinvwlID=$matches[4]&paged=$matches[5]&lang=$matches[1]', 'top' );
195
+ add_rewrite_rule( '^(' . $language_codes . ')/(([^/]+/)*' . $page_slug . ')/([A-Fa-f0-9]{6})?/?$', 'index.php?pagename=$matches[2]&tinvwlID=$matches[4]&paged=$matches[5]&lang=$matches[1]', 'top' );
196
+ }
197
 
198
  add_rewrite_rule( '(([^/]+/)*' . $page_slug . ')/([A-Fa-f0-9]{6})?/page/([0-9]{1,})/?$', 'index.php?pagename=$matches[1]&tinvwlID=$matches[3]&paged=$matches[4]', 'top' );
199
  add_rewrite_rule( '(([^/]+/)*' . $page_slug . ')/([A-Fa-f0-9]{6})?/?$', 'index.php?pagename=$matches[1]&tinvwlID=$matches[3]', 'top' );
205
  * Add new POST variable
206
  *
207
  * @param array $public_var WordPress Public variable.
208
+ *
209
  * @return array
210
  */
211
  function add_query_var( $public_var ) {
212
+ $public_var[] = 'tinvwlID';
213
+ $public_var[] = 'tiws';
214
 
215
  return $public_var;
216
  }
222
  if ( is_page( apply_filters( 'wpml_object_id', tinv_get_option( 'page', 'wishlist' ), 'page', true ) ) ) {
223
  $wishlist = tinv_wishlist_get();
224
  if ( 0 < $wishlist['ID'] && 'private' !== $wishlist['status'] ) {
225
+ $user = get_user_by( 'id', $wishlist['author'] );
226
+ $user_name = trim( sprintf( '%s %s', $user->user_firstname, $user->user_lastname ) );
227
+ $user = @$user->display_name; // @codingStandardsIgnoreLine Generic.PHP.NoSilencedErrors.Discouraged
228
+
229
+ $wlp = new TInvWL_Product( $wishlist );
230
+ $products = $wlp->get_wishlist( array(
231
+ 'count' => 1,
232
+ 'order_by' => 'date',
233
+ 'order' => 'DESC',
234
  ) );
235
+ $product = array_shift( $products );
236
+ $image = '';
237
  if ( ! empty( $product ) && ! empty( $product['data'] ) ) {
238
  list( $image, $width, $height, $is_intermediate ) = wp_get_attachment_image_src( $product['data']->get_image_id(), 'full' );
239
  }
240
 
241
+ $meta = array(
242
+ 'url' => tinv_url_wishlist( $wishlist['share_key'] ),
243
+ 'type' => 'product.group',
244
+ 'title' => sprintf( __( '%1$s of %2$s', 'ti-woocommerce-wishlist' ), $wishlist['title'], ( empty( $user_name ) ? $user : $user_name ) ),
245
+ 'description' => __( 'Coming soon', 'ti-woocommerce-wishlist' ),
246
+ 'image' => $image,
247
  );
248
  if ( tinv_get_option( 'social', 'facebook' ) ) {
249
  foreach ( $meta as $name => $content ) {
269
  * Create ogp namespace
270
  *
271
  * @param string $text A space-separated list of language attributes.
272
+ *
273
  * @return string
274
  */
275
  function add_ogp( $text ) {
276
  if ( is_page( apply_filters( 'wpml_object_id', tinv_get_option( 'page', 'wishlist' ), 'page', true ) ) ) {
277
  $text = 'prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb# product: http://ogp.me/ns/product#" itemscope itemtype="http://schema.org/Offer" ' . $text;
278
  }
279
+
280
  return $text;
281
  }
282
 
286
  * @return boolean
287
  */
288
  function is_pluginpage() {
289
+ $pages = tinv_get_option( 'page' );
290
+ $pages = array_filter( $pages );
291
  foreach ( $pages as $page ) {
292
  if ( is_page( apply_filters( 'wpml_object_id', $page, 'page', true ) ) ) {
293
  return true;
294
  }
295
  }
296
+
297
  return false;
298
  }
299
 
319
  if ( ! tinv_get_option( 'style', 'customstyle' ) || tinv_get_option( 'style_plain', 'allow' ) ) {
320
  wp_enqueue_style( $this->_n . '-dynaminc', admin_url( 'admin-ajax.php' ) . '?action=' . $this->_n . '_css', array( $this->_n ), $this->_v, 'all' );
321
  }
322
+ wp_enqueue_style( $this->_n . '-font-awesome', TINVWL_URL . 'asset/css/font-awesome.min.css', array(), $this->_v, 'all' );
323
  }
324
 
325
  /**
326
  * Compress CSS
327
  *
328
  * @param string $css CSS Content.
329
+ *
330
  * @return string
331
  */
332
  function compress_css( $css ) {
333
  $css = preg_replace( '!/\*[^*]*\*+([^/][^*]*\*+)*/!', ' ', $css );
334
  $css = preg_replace( '/(\r|\n|\t| {2,})/', ' ', $css );
335
+
336
  return $css;
337
  }
338
 
341
  */
342
  function dynaminc_css() {
343
  header( 'Content-type: text/css; charset=' . get_option( 'blog_charset' ) );
344
+ $css = get_transient( TINVWL_PREFIX . '_dynamic_' );
345
  if ( ! $css ) {
346
  $css = '';
347
  if ( ! tinv_get_option( 'style', 'customstyle' ) ) {
348
+ $newcss = tinv_get_option( 'style_options', 'css' );
349
  if ( $newcss ) {
350
  $newcss = $this->compress_css( $newcss );
351
+ $css .= $newcss;
352
  }
353
  }
354
  if ( tinv_get_option( 'style_plain', 'allow' ) ) {
355
  $newcss = tinv_get_option( 'style_plain', 'css' );
356
  if ( $newcss ) {
357
  $newcss = $this->compress_css( $newcss );
358
+ $css .= $newcss;
359
  }
360
  }
361
+ $image_url = TINVWL_URL . 'asset/img/';
362
+ $css = str_replace( '../img/', $image_url, $css );
363
  set_transient( TINVWL_PREFIX . '_dynamic_', $css, DAY_IN_SECONDS );
364
  }
365
  echo $css; // WPCS: xss ok.
385
  $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
386
  wp_register_script( $this->_n, TINVWL_URL . 'asset/js/public' . $suffix . '.js', array( 'jquery' ), $this->_v, true );
387
  wp_localize_script( $this->_n, 'tinvwl_add_to_wishlist', array(
388
+ 'text_create' => __( 'Create New', 'ti-woocommerce-wishlist' ),
389
+ 'text_already_in' => tinv_get_option( 'add_to_wishlist', 'text_already_in' ),
390
  'i18n_make_a_selection_text' => esc_attr__( 'Please select some product options before adding this product to your wishlist.', 'ti-woocommerce-wishlist' ),
391
  ) );
392
  wp_enqueue_script( $this->_n );
404
  *
405
  * @param string $user_login Not used.
406
  * @param object $user User object.
407
+ *
408
  * @return boolean
409
  */
410
  function transfert_local_to_user( $user_login, $user ) {
419
  function transfert_local_to_user_register( $user_id ) {
420
  $wlpl = TInvWL_Product_Local::instance( $this->_n );
421
 
422
+ $wl = new TInvWL_Wishlist( $this->_n );
423
+ $wl->user = $user_id;
424
+ $wishlist = $wl->add_user_default();
425
 
426
  $wlp = new TInvWL_Product( $wishlist, $this->_n );
427
 
443
  * Add link to wishlist in WooCommerce My Account page.
444
  *
445
  * @param array $items Menu items links in my accounts.
446
+ *
447
  * @return array
448
  */
449
  function account_menu_items( $items ) {
450
+ $index_position = apply_filters( $this->_n . '_myaccount_position_wishlist', - 1, $items );
451
+ $items = array_merge(
452
  array_slice( $items, 0, $index_position, true ),
453
  array(
454
  'tinv_wishlist' => __( 'Wishlist', 'ti-woocommerce-wishlist' ),
455
+ ),
456
  array_slice( $items, $index_position, null, true )
457
  );
458
+
459
  return $items;
460
  }
461
 
466
  * @param string $endpoint End point name.
467
  * @param string $value Not used.
468
  * @param string $permalink Not used.
469
+ *
470
  * @return string
471
  */
472
  function account_menu_endpoint( $url, $endpoint, $value, $permalink ) {
473
  if ( 'tinv_wishlist' === $endpoint ) {
474
  $url = tinv_url_wishlist_default();
475
  }
476
+
477
  return $url;
478
  }
479
 
483
  * @param integer $id Removed userid.
484
  */
485
  function delete_user_wishlist( $id ) {
486
+ $wl = new TInvWL_Wishlist( $this->_n );
487
+ $wishlists = $wl->get( array(
488
  'author' => $id,
489
+ 'count' => 9999999,
490
  ) );
491
  if ( ! empty( $wishlists ) ) {
492
  foreach ( $wishlists as $wishlist ) {
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://templateinvaders.com/?utm_source=wordpressorg&utm_content=d
4
  Tags: wishlist, woocommerce, products, e-commerce, shop, ecommerce wishlist, woocommerce wishlist, woocommerce , shop wishlist, wishlist for Woocommerce
5
  Requires at least: 4.5
6
  Tested up to: 4.7.4
7
- Stable tag: 1.3.2
8
  License: GPLv3
9
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -126,6 +126,15 @@ If you get stuck, you can ask for help in the [Plugin Forum](https://wordpress.o
126
 
127
  == Changelog ==
128
 
 
 
 
 
 
 
 
 
 
129
  = 1.3.2 =
130
  *Release Date - 27 April 2017*
131
 
4
  Tags: wishlist, woocommerce, products, e-commerce, shop, ecommerce wishlist, woocommerce wishlist, woocommerce , shop wishlist, wishlist for Woocommerce
5
  Requires at least: 4.5
6
  Tested up to: 4.7.4
7
+ Stable tag: 1.3.3
8
  License: GPLv3
9
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
10
 
126
 
127
  == Changelog ==
128
 
129
+ = 1.3.3 =
130
+ *Release Date - 07 May 2017*
131
+
132
+ * Improved WPML compatibility (fixed an issue with URL formats)
133
+ * Fixed issues with deprecated hooks related to WooCommerce 3.0.5
134
+ * Added Polylang plugin support
135
+ * Added new option that allows product automatic removal when it's added to cart by anyone
136
+
137
+
138
  = 1.3.2 =
139
  *Release Date - 27 April 2017*
140
 
templates/ti-wishlist-user.php CHANGED
@@ -33,6 +33,9 @@ if ( ! defined( 'ABSPATH' ) ) {
33
  <?php if ( $wishlist_table_row['colm_stock'] ) { ?>
34
  <th class="product-stock"><?php esc_html_e( 'Stock Status', 'ti-woocommerce-wishlist' ); ?></th>
35
  <?php } ?>
 
 
 
36
  </tr>
37
  </thead>
38
  <tbody>
@@ -104,6 +107,15 @@ if ( ! defined( 'ABSPATH' ) ) {
104
  ?>
105
  </td>
106
  <?php } ?>
 
 
 
 
 
 
 
 
 
107
  </tr>
108
  <?php
109
  }
33
  <?php if ( $wishlist_table_row['colm_stock'] ) { ?>
34
  <th class="product-stock"><?php esc_html_e( 'Stock Status', 'ti-woocommerce-wishlist' ); ?></th>
35
  <?php } ?>
36
+ <?php if ( $wishlist_table_row['add_to_card'] ) { ?>
37
+ <th class="product-action">&nbsp;</th>
38
+ <?php } ?>
39
  </tr>
40
  </thead>
41
  <tbody>
107
  ?>
108
  </td>
109
  <?php } ?>
110
+ <?php if ( $wishlist_table_row['add_to_card'] ) { ?>
111
+ <td class="product-action">
112
+ <?php
113
+ if ( apply_filters( 'tinvwl_wishlist_item_action_add_to_card', $wishlist_table_row['add_to_card'], $wl_product, $product ) ) {
114
+ ?>
115
+ <button class="button alt" name="tinvwl-add-to-cart" value="<?php echo esc_attr( $wl_product['ID'] ); ?>"><i class="fa fa-shopping-cart"></i><span class="tinvwl-txt"><?php echo esc_html( apply_filters( 'tinvwl_wishlist_item_add_to_card', $wishlist_table_row['text_add_to_card'], $wl_product, $product ) ); ?></span></button>
116
+ <?php } ?>
117
+ </td>
118
+ <?php } ?>
119
  </tr>
120
  <?php
121
  }
ti-woocommerce-wishlist.php CHANGED
@@ -5,7 +5,7 @@
5
  * Plugin Name: WooCommerce Wishlist Plugin
6
  * Plugin URI: https://wordpress.org/plugins/ti-woocommerce-wishlist/
7
  * Description: Wishlist functionality for your WooCommerce store.
8
- * Version: 1.3.2
9
  * Author: TemplateInvaders
10
  * Author URI: https://templateinvaders.com/
11
  * License: GPL-2.0+
@@ -37,7 +37,7 @@ if ( ! defined( 'TINVWL_DOMAIN' ) ) {
37
  }
38
 
39
  if ( ! defined( 'TINVWL_FVERSION' ) ) {
40
- define( 'TINVWL_FVERSION', '1.3.2' );
41
  }
42
 
43
  if ( ! defined( 'TINVWL_LOAD_FREE' ) ) {
5
  * Plugin Name: WooCommerce Wishlist Plugin
6
  * Plugin URI: https://wordpress.org/plugins/ti-woocommerce-wishlist/
7
  * Description: Wishlist functionality for your WooCommerce store.
8
+ * Version: 1.3.3
9
  * Author: TemplateInvaders
10
  * Author URI: https://templateinvaders.com/
11
  * License: GPL-2.0+
37
  }
38
 
39
  if ( ! defined( 'TINVWL_FVERSION' ) ) {
40
+ define( 'TINVWL_FVERSION', '1.3.3' );
41
  }
42
 
43
  if ( ! defined( 'TINVWL_LOAD_FREE' ) ) {
tinv-wishlists-function.php CHANGED
@@ -448,12 +448,17 @@ if ( ! function_exists( 'tinv_url_wishlist' ) ) {
448
  $share_key = $wishlist['share_key'];
449
 
450
  if ( get_option( 'permalink_structure' ) ) {
 
 
 
 
 
451
  if ( ! preg_match( '/\/$/', $full_link ) ) {
452
  $full_link .= '/';
453
  }
454
- $full_link .= $share_key . '/';
455
  } else {
456
- $full_link .= '&tinvwlID=' . $share_key;
457
  }
458
 
459
  if ( $full ) {
@@ -857,6 +862,31 @@ if ( ! function_exists( 'tinvwl_wpml_product_get' ) ) {
857
  add_filter( 'tinvwl_wishlist_product_get', 'tinvwl_wpml_product_get' );
858
  }
859
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
860
  if ( ! function_exists( 'tinvwl_gift_card_add' ) ) {
861
 
862
  /**
448
  $share_key = $wishlist['share_key'];
449
 
450
  if ( get_option( 'permalink_structure' ) ) {
451
+ $suffix = '';
452
+ if ( preg_match( '/([^\?]+)\?*?(.*)/i', $full_link, $_full_link ) ) {
453
+ $full_link = $_full_link[1];
454
+ $suffix = $_full_link[2];
455
+ }
456
  if ( ! preg_match( '/\/$/', $full_link ) ) {
457
  $full_link .= '/';
458
  }
459
+ $full_link .= $share_key . '/' . $suffix;
460
  } else {
461
+ $full_link .= add_query_arg( 'tinvwlID', $share_key, $full_link );
462
  }
463
 
464
  if ( $full ) {
862
  add_filter( 'tinvwl_wishlist_product_get', 'tinvwl_wpml_product_get' );
863
  }
864
 
865
+ if ( ! function_exists( 'tinvwl_wpml_filter_link' ) ) {
866
+
867
+ function tinvwl_wpml_filter_link( $full_link, $l ) {
868
+ $share_key = get_query_var( 'tinvwlID', null );
869
+ if ( ! empty( $share_key ) ) {
870
+ if ( get_option( 'permalink_structure' ) ) {
871
+ $suffix = '';
872
+ if ( preg_match( '/([^\?]+)\?*?(.*)/i', $full_link, $_full_link ) ) {
873
+ $full_link = $_full_link[1];
874
+ $suffix = $_full_link[2];
875
+ }
876
+ if ( ! preg_match( '/\/$/', $full_link ) ) {
877
+ $full_link .= '/';
878
+ }
879
+ $full_link .= $share_key . '/' . $suffix;
880
+ } else {
881
+ $full_link .= add_query_arg( 'tinvwlID', $share_key, $full_link );
882
+ }
883
+ }
884
+ return $full_link;
885
+ }
886
+
887
+ add_filter( 'WPML_filter_link', 'tinvwl_wpml_filter_link', 10, 2 );
888
+ }
889
+
890
  if ( ! function_exists( 'tinvwl_gift_card_add' ) ) {
891
 
892
  /**