Version Description
- Fixed: Minor bugs
Download this release
Release Info
Developer | yithemes |
Plugin | YITH WooCommerce Catalog Mode |
Version | 1.0.4 |
Comparing to | |
See all releases |
Code changes from version 1.0.3 to 1.0.4
- class.yith-woocommerce-catalog-mode.php +241 -83
- init.php +21 -5
- plugin-fw/assets/js/yit-plugin-panel.js +69 -20
- plugin-fw/assets/js/yit-plugin-panel.min.js +10 -9
- plugin-fw/assets/js/yit-wp-pointer.js +1 -1
- plugin-fw/lib/yit-metabox.php +1 -1
- plugin-fw/lib/yit-plugin-panel.php +1 -1
- plugin-fw/lib/yit-upgrade.php +7 -2
- plugin-fw/lib/yit-video.php +14 -8
- plugin-fw/licence/lib/yit-licence.php +19 -8
- plugin-fw/licence/lib/yit-plugin-licence.php +1 -0
- plugin-fw/licence/lib/yit-theme-licence.php +1 -0
- plugin-fw/templates/metaboxes/tab.php +10 -1
- plugin-fw/templates/metaboxes/types/contactform.php +1 -1
- plugin-fw/templates/metaboxes/types/onoff.php +4 -0
- plugin-fw/yit-deactive-plugin.php +1 -1
- plugin-options/settings-options.php +1 -1
- readme.txt +6 -2
class.yith-woocommerce-catalog-mode.php
CHANGED
@@ -71,21 +71,28 @@ class YITH_WC_Catalog_Mode {
|
|
71 |
|
72 |
if ( $this->check_user_admin_enable() ){
|
73 |
|
74 |
-
|
75 |
|
76 |
if ( ! is_admin() ) {
|
|
|
|
|
|
|
|
|
77 |
|
|
|
|
|
|
|
|
|
78 |
add_action( 'woocommerce_single_product_summary', array( $this, 'hide_add_to_cart_single' ), 10 );
|
79 |
add_action( 'woocommerce_before_shop_loop_item_title', array( $this, 'hide_add_to_cart_loop' ), 5 );
|
80 |
add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_styles' ) );
|
81 |
|
82 |
-
|
83 |
|
84 |
-
}
|
85 |
|
86 |
-
|
87 |
|
88 |
-
|
89 |
|
90 |
}
|
91 |
|
@@ -137,25 +144,26 @@ class YITH_WC_Catalog_Mode {
|
|
137 |
}
|
138 |
|
139 |
/**
|
140 |
-
*
|
141 |
*
|
142 |
-
* @since 1.0.
|
|
|
143 |
* @author Alberto Ruggiero
|
144 |
-
* @param $priority
|
145 |
* @return bool
|
146 |
*/
|
147 |
-
public function
|
148 |
|
149 |
$hide = false;
|
150 |
|
151 |
-
if ( get_option( '
|
152 |
|
153 |
-
|
|
|
154 |
|
155 |
-
|
156 |
-
$enable_exclusion = get_option( 'ywctm_exclude_hide_add_to_cart' );
|
157 |
|
158 |
-
|
|
|
159 |
|
160 |
if ( $enable_exclusion == '' || $enable_exclusion == 'no' ) {
|
161 |
|
@@ -168,22 +176,156 @@ class YITH_WC_Catalog_Mode {
|
|
168 |
$hide = true;
|
169 |
|
170 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
171 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
172 |
}
|
|
|
173 |
}
|
174 |
|
175 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
176 |
|
177 |
-
|
|
|
178 |
|
179 |
-
|
180 |
|
181 |
-
|
|
|
182 |
|
183 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
184 |
|
185 |
}
|
186 |
|
|
|
187 |
}
|
188 |
|
189 |
/**
|
@@ -197,47 +339,71 @@ class YITH_WC_Catalog_Mode {
|
|
197 |
|
198 |
$remove = false;
|
199 |
|
200 |
-
if ( get_option( '
|
|
|
|
|
|
|
|
|
201 |
|
202 |
global $post;
|
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 |
if ( $remove ){
|
235 |
|
236 |
remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 10 );
|
|
|
237 |
|
238 |
} else {
|
239 |
|
240 |
add_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 10 );
|
|
|
241 |
|
242 |
}
|
243 |
|
@@ -257,47 +423,65 @@ class YITH_WC_Catalog_Mode {
|
|
257 |
}
|
258 |
|
259 |
/**
|
260 |
-
*
|
261 |
*
|
262 |
-
* @since 1.0.
|
263 |
* @author Alberto Ruggiero
|
264 |
* @return void
|
265 |
*/
|
266 |
-
public function
|
267 |
-
|
268 |
-
$pages_to_check = array(
|
269 |
-
get_option( 'woocommerce_cart_page_id' ),
|
270 |
-
get_option( 'woocommerce_checkout_page_id' )
|
271 |
-
);
|
272 |
|
273 |
if ( get_option( 'ywctm_hide_cart_header' ) == 'yes' ) {
|
274 |
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
|
|
|
|
|
|
281 |
|
282 |
-
wp_update_post( $page );
|
283 |
-
}
|
284 |
}
|
285 |
|
286 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
287 |
|
288 |
-
|
289 |
-
|
290 |
-
$
|
291 |
-
'ID' => $page_id,
|
292 |
-
'post_status' => 'publish'
|
293 |
-
);
|
294 |
|
295 |
-
wp_update_post( $page );
|
296 |
}
|
|
|
297 |
}
|
298 |
|
299 |
}
|
300 |
|
|
|
|
|
301 |
}
|
302 |
|
303 |
/**
|
@@ -432,30 +616,4 @@ class YITH_WC_Catalog_Mode {
|
|
432 |
return $plugin_meta;
|
433 |
}
|
434 |
|
435 |
-
/**
|
436 |
-
* On plugin deactivation, publish cart and checkout pages if se to draft
|
437 |
-
*
|
438 |
-
* @since 1.0.0
|
439 |
-
* @author Alberto Ruggiero
|
440 |
-
* @return void
|
441 |
-
*/
|
442 |
-
static function reactivate_hidden_pages () {
|
443 |
-
|
444 |
-
$pages_to_check = array(
|
445 |
-
get_option( 'woocommerce_cart_page_id' ),
|
446 |
-
get_option( 'woocommerce_checkout_page_id' )
|
447 |
-
);
|
448 |
-
|
449 |
-
foreach ( $pages_to_check as $page_id ) {
|
450 |
-
if ( get_post_status ( $page_id ) != 'publish' ) {
|
451 |
-
$page = array(
|
452 |
-
'ID' => $page_id,
|
453 |
-
'post_status' => 'publish'
|
454 |
-
);
|
455 |
-
|
456 |
-
wp_update_post( $page );
|
457 |
-
}
|
458 |
-
}
|
459 |
-
}
|
460 |
-
|
461 |
}
|
71 |
|
72 |
if ( $this->check_user_admin_enable() ){
|
73 |
|
74 |
+
|
75 |
|
76 |
if ( ! is_admin() ) {
|
77 |
+
if( get_option( 'ywctm_hide_cart_header' ) == 'yes' ){
|
78 |
+
|
79 |
+
$priority = has_action( 'wp_loaded', array( 'WC_Form_Handler', 'add_to_cart_action' ) );
|
80 |
+
remove_action( 'wp_loaded', array( 'WC_Form_Handler', 'add_to_cart_action' ), $priority );
|
81 |
|
82 |
+
}
|
83 |
+
|
84 |
+
add_action( 'wp', array( $this, 'check_pages_redirect' ) );
|
85 |
+
add_action( 'get_pages', array( $this, 'hide_cart_checkout_pages' ) );
|
86 |
add_action( 'woocommerce_single_product_summary', array( $this, 'hide_add_to_cart_single' ), 10 );
|
87 |
add_action( 'woocommerce_before_shop_loop_item_title', array( $this, 'hide_add_to_cart_loop' ), 5 );
|
88 |
add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_styles' ) );
|
89 |
|
90 |
+
add_filter( 'woocommerce_add_to_cart_validation', array( $this, 'avoid_add_to_cart' ), 10, 2 );
|
91 |
|
|
|
92 |
|
93 |
+
}
|
94 |
|
95 |
+
}
|
96 |
|
97 |
}
|
98 |
|
144 |
}
|
145 |
|
146 |
/**
|
147 |
+
* Check if price is hidden to hide add to cart button
|
148 |
*
|
149 |
+
* @since 1.0.4
|
150 |
+
* @param $post_id
|
151 |
* @author Alberto Ruggiero
|
|
|
152 |
* @return bool
|
153 |
*/
|
154 |
+
public function check_price_hidden( $post_id ) {
|
155 |
|
156 |
$hide = false;
|
157 |
|
158 |
+
if ( get_option( 'ywctm_hide_price' ) == 'yes' ) {
|
159 |
|
160 |
+
$ywctm_hide_price_users = ( get_option( 'ywctm_hide_price_users' ) != 'unregistered' ) ? true : false;
|
161 |
+
$user_logged = is_user_logged_in();
|
162 |
|
163 |
+
if ( ! ( ! $ywctm_hide_price_users && $user_logged ) ) {
|
|
|
164 |
|
165 |
+
$exclude_catalog = get_post_meta( $post_id, '_ywctm_exclude_hide_price', true );
|
166 |
+
$enable_exclusion = get_option( 'ywctm_exclude_hide_price' );
|
167 |
|
168 |
if ( $enable_exclusion == '' || $enable_exclusion == 'no' ) {
|
169 |
|
176 |
$hide = true;
|
177 |
|
178 |
}
|
179 |
+
|
180 |
+
}
|
181 |
+
|
182 |
+
$reverse_criteria = get_option( 'ywctm_exclude_hide_price_reverse' );
|
183 |
+
|
184 |
+
if ( $reverse_criteria == 'yes' ) {
|
185 |
+
|
186 |
+
$hide = ! $hide;
|
187 |
+
|
188 |
+
}
|
189 |
+
|
190 |
+
}
|
191 |
+
|
192 |
+
}
|
193 |
+
|
194 |
+
return $hide;
|
195 |
+
|
196 |
+
}
|
197 |
+
|
198 |
+
/**
|
199 |
+
* Checks if "Add to cart" needs to be hidden
|
200 |
+
*
|
201 |
+
* @since 1.0.2
|
202 |
+
* @author Alberto Ruggiero
|
203 |
+
* @param $priority
|
204 |
+
* @return bool
|
205 |
+
*/
|
206 |
+
public function check_add_to_cart_single( $priority = true ) {
|
207 |
+
|
208 |
+
$hide = false;
|
209 |
+
|
210 |
+
if ( get_option( 'ywctm_enable_plugin' ) == 'yes' && $this->check_user_admin_enable() ) {
|
211 |
+
|
212 |
+
if ( get_option( 'ywctm_hide_cart_header' ) == 'yes' ) {
|
213 |
+
|
214 |
+
$hide = true;
|
215 |
+
|
216 |
+
} else {
|
217 |
+
|
218 |
+
global $post;
|
219 |
+
|
220 |
+
if ( get_option( 'ywctm_hide_add_to_cart_single' ) == 'yes' ) {
|
221 |
+
|
222 |
+
$ywctm_hide_price_users = ( get_option( 'ywctm_hide_price_users' ) != 'unregistered' ) ? true : false;
|
223 |
+
$user_logged = is_user_logged_in();
|
224 |
+
|
225 |
+
if ( ! ( ! $ywctm_hide_price_users && $user_logged ) ) {
|
226 |
+
|
227 |
+
$exclude_catalog = get_post_meta( $post->ID, '_ywctm_exclude_catalog_mode', true );
|
228 |
+
$enable_exclusion = get_option( 'ywctm_exclude_hide_add_to_cart' );
|
229 |
+
|
230 |
+
if ( $priority ) {
|
231 |
+
|
232 |
+
if ( $enable_exclusion == '' || $enable_exclusion == 'no' ) {
|
233 |
+
|
234 |
+
$hide = true;
|
235 |
+
|
236 |
+
} else {
|
237 |
+
|
238 |
+
if ( $exclude_catalog == '' || $exclude_catalog == 'no' ) {
|
239 |
+
|
240 |
+
$hide = true;
|
241 |
+
|
242 |
+
}
|
243 |
+
|
244 |
+
}
|
245 |
+
|
246 |
+
}
|
247 |
+
}
|
248 |
+
|
249 |
}
|
250 |
+
|
251 |
+
$reverse_criteria = get_option( 'ywctm_exclude_hide_add_to_cart_reverse' );
|
252 |
+
|
253 |
+
if ( $reverse_criteria == 'yes' ) {
|
254 |
+
|
255 |
+
$hide = ! $hide;
|
256 |
+
|
257 |
+
}
|
258 |
+
|
259 |
+
if ( $this->check_price_hidden( $post->ID ) ) {
|
260 |
+
|
261 |
+
$hide = true;
|
262 |
+
|
263 |
+
}
|
264 |
+
|
265 |
}
|
266 |
+
|
267 |
}
|
268 |
|
269 |
+
return $hide;
|
270 |
+
}
|
271 |
+
|
272 |
+
public function avoid_add_to_cart( $passed, $product_id ) {
|
273 |
+
|
274 |
+
if ( get_option( 'ywctm_enable_plugin' ) == 'yes' && $this->check_user_admin_enable() ) {
|
275 |
+
|
276 |
+
if ( get_option( 'ywctm_hide_cart_header' ) == 'yes' ) {
|
277 |
+
|
278 |
+
$passed = false;
|
279 |
+
|
280 |
+
} else {
|
281 |
+
|
282 |
+
if ( get_option( 'ywctm_hide_add_to_cart_single' ) == 'yes' ) {
|
283 |
|
284 |
+
$ywctm_hide_price_users = ( get_option( 'ywctm_hide_price_users' ) != 'unregistered' ) ? true : false;
|
285 |
+
$user_logged = is_user_logged_in();
|
286 |
|
287 |
+
if ( ! ( ! $ywctm_hide_price_users && $user_logged ) ) {
|
288 |
|
289 |
+
$exclude_catalog = get_post_meta( $product_id, '_ywctm_exclude_catalog_mode', true );
|
290 |
+
$enable_exclusion = get_option( 'ywctm_exclude_hide_add_to_cart' );
|
291 |
|
292 |
+
if ( $enable_exclusion == '' || $enable_exclusion == 'no' ) {
|
293 |
+
|
294 |
+
$passed = false;
|
295 |
+
|
296 |
+
} else {
|
297 |
+
|
298 |
+
if ( $exclude_catalog == '' || $exclude_catalog == 'no' ) {
|
299 |
+
|
300 |
+
$passed = false;
|
301 |
+
|
302 |
+
}
|
303 |
+
|
304 |
+
}
|
305 |
+
|
306 |
+
}
|
307 |
+
|
308 |
+
}
|
309 |
+
|
310 |
+
$reverse_criteria = get_option( 'ywctm_exclude_hide_add_to_cart_reverse' );
|
311 |
+
|
312 |
+
if ( $reverse_criteria == 'yes' ) {
|
313 |
+
|
314 |
+
$passed = ! $passed;
|
315 |
+
|
316 |
+
}
|
317 |
+
|
318 |
+
if ( $this->check_price_hidden( $product_id ) ) {
|
319 |
+
|
320 |
+
$passed = false;
|
321 |
+
|
322 |
+
}
|
323 |
+
|
324 |
+
}
|
325 |
|
326 |
}
|
327 |
|
328 |
+
return $passed;
|
329 |
}
|
330 |
|
331 |
/**
|
339 |
|
340 |
$remove = false;
|
341 |
|
342 |
+
if ( get_option( 'ywctm_hide_cart_header' ) == 'yes' ) {
|
343 |
+
|
344 |
+
$remove = true;
|
345 |
+
|
346 |
+
} else {
|
347 |
|
348 |
global $post;
|
349 |
|
350 |
+
if ( get_option( 'ywctm_hide_add_to_cart_loop' ) == 'yes' ) {
|
351 |
|
352 |
+
$ywctm_hide_price_users = ( get_option( 'ywctm_hide_price_users' ) != 'unregistered' ) ? true : false;
|
353 |
+
$user_logged = is_user_logged_in();
|
354 |
|
355 |
+
if ( ! ( ! $ywctm_hide_price_users && $user_logged ) ) {
|
356 |
|
357 |
+
$exclude_catalog = get_post_meta( $post->ID, '_ywctm_exclude_catalog_mode', true );
|
358 |
+
$enable_exclusion = get_option( 'ywctm_exclude_hide_add_to_cart' );
|
359 |
|
360 |
+
if ( $enable_exclusion == '' || $enable_exclusion == 'no' ) {
|
361 |
|
362 |
+
$remove = true;
|
363 |
|
364 |
+
} else {
|
365 |
|
366 |
+
if ( $exclude_catalog == '' || $exclude_catalog == 'no' ) {
|
367 |
+
|
368 |
+
$remove = true;
|
369 |
+
|
370 |
+
} else {
|
371 |
|
372 |
+
$remove = false;
|
373 |
+
|
374 |
+
}
|
375 |
+
|
376 |
+
}
|
377 |
|
378 |
}
|
379 |
+
|
380 |
+
}
|
381 |
+
|
382 |
+
$reverse_criteria = get_option( 'ywctm_exclude_hide_add_to_cart_reverse' );
|
383 |
+
|
384 |
+
if ( $reverse_criteria == 'yes' ) {
|
385 |
+
|
386 |
+
$remove = ! $remove;
|
387 |
+
|
388 |
}
|
|
|
389 |
|
390 |
+
if ( $this->check_price_hidden( $post->ID ) ) {
|
391 |
|
392 |
+
$remove = true;
|
393 |
|
394 |
+
}
|
395 |
|
396 |
}
|
397 |
|
398 |
if ( $remove ){
|
399 |
|
400 |
remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 10 );
|
401 |
+
add_filter( 'woocommerce_loop_add_to_cart_link', '__return_empty_string', 10, 2);
|
402 |
|
403 |
} else {
|
404 |
|
405 |
add_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 10 );
|
406 |
+
remove_filter( 'woocommerce_loop_add_to_cart_link', '__return_empty_string', 10);
|
407 |
|
408 |
}
|
409 |
|
423 |
}
|
424 |
|
425 |
/**
|
426 |
+
* Avoid Cart and Checkout Pages to be visited
|
427 |
*
|
428 |
+
* @since 1.0.4
|
429 |
* @author Alberto Ruggiero
|
430 |
* @return void
|
431 |
*/
|
432 |
+
public function check_pages_redirect() {
|
|
|
|
|
|
|
|
|
|
|
433 |
|
434 |
if ( get_option( 'ywctm_hide_cart_header' ) == 'yes' ) {
|
435 |
|
436 |
+
$cart = get_option( 'woocommerce_cart_page_id' );
|
437 |
+
$checkout = get_option( 'woocommerce_checkout_page_id' );
|
438 |
+
|
439 |
+
wp_reset_query();
|
440 |
+
|
441 |
+
if( is_page( $cart ) || is_page( $checkout ) ) {
|
442 |
+
|
443 |
+
wp_redirect( home_url() );
|
444 |
+
exit;
|
445 |
|
|
|
|
|
446 |
}
|
447 |
|
448 |
+
}
|
449 |
+
|
450 |
+
}
|
451 |
+
|
452 |
+
|
453 |
+
/**
|
454 |
+
* Removes Cart and checkout pages from menu
|
455 |
+
*
|
456 |
+
* @since 1.0.4
|
457 |
+
* @param $pages
|
458 |
+
* @author Alberto Ruggiero
|
459 |
+
* @return mixed
|
460 |
+
*/
|
461 |
+
public function hide_cart_checkout_pages( $pages ) {
|
462 |
+
|
463 |
+
if ( get_option( 'ywctm_hide_cart_header' ) == 'yes' ) {
|
464 |
+
|
465 |
+
$excluded_pages = array(
|
466 |
+
get_option( 'woocommerce_cart_page_id' ),
|
467 |
+
get_option( 'woocommerce_checkout_page_id' )
|
468 |
+
);
|
469 |
+
|
470 |
+
for ( $i = 0; $i < count( $pages ); $i++ ) {
|
471 |
+
$page = & $pages[ $i ];
|
472 |
|
473 |
+
if ( in_array( $page->ID, $excluded_pages ) ) {
|
474 |
+
|
475 |
+
unset( $pages[ $i ] );
|
|
|
|
|
|
|
476 |
|
|
|
477 |
}
|
478 |
+
|
479 |
}
|
480 |
|
481 |
}
|
482 |
|
483 |
+
return $pages;
|
484 |
+
|
485 |
}
|
486 |
|
487 |
/**
|
616 |
return $plugin_meta;
|
617 |
}
|
618 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
619 |
}
|
init.php
CHANGED
@@ -5,7 +5,7 @@ Plugin URI: http://yithemes.com/themes/plugins/yith-woocommerce-catalog-mode/
|
|
5 |
Description: YITH Woocommerce Catalog Mode allows you to disable shop functions.
|
6 |
Author: Yithemes
|
7 |
Text Domain: ywctm
|
8 |
-
Version: 1.0.
|
9 |
Author URI: http://yithemes.com/
|
10 |
*/
|
11 |
|
@@ -34,7 +34,7 @@ function ywctm_install_free_admin_notice() {
|
|
34 |
}
|
35 |
|
36 |
if ( ! defined( 'YWCTM_VERSION' ) ) {
|
37 |
-
define( 'YWCTM_VERSION', '1.0.
|
38 |
}
|
39 |
|
40 |
if ( ! defined( 'YWCTM_FREE_INIT' ) ) {
|
@@ -66,9 +66,6 @@ function ywctm_init() {
|
|
66 |
/* Load YWCTM text domain */
|
67 |
load_plugin_textdomain( 'ywctm', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
|
68 |
|
69 |
-
|
70 |
-
register_deactivation_hook( __FILE__, array('YITH_WC_Catalog_Mode', 'reactivate_hidden_pages' ) );
|
71 |
-
|
72 |
global $YITH_WC_Catalog_Mode;
|
73 |
$YITH_WC_Catalog_Mode = new YITH_WC_Catalog_Mode();
|
74 |
}
|
@@ -99,7 +96,26 @@ if ( !function_exists( 'yith_plugin_registration_hook' ) ) {
|
|
99 |
require_once( YWCTM_DIR . 'class.yith-woocommerce-catalog-mode.php' );
|
100 |
|
101 |
register_activation_hook( __FILE__, 'yith_plugin_registration_hook' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
102 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
103 |
|
104 |
|
105 |
|
5 |
Description: YITH Woocommerce Catalog Mode allows you to disable shop functions.
|
6 |
Author: Yithemes
|
7 |
Text Domain: ywctm
|
8 |
+
Version: 1.0.4
|
9 |
Author URI: http://yithemes.com/
|
10 |
*/
|
11 |
|
34 |
}
|
35 |
|
36 |
if ( ! defined( 'YWCTM_VERSION' ) ) {
|
37 |
+
define( 'YWCTM_VERSION', '1.0.4' );
|
38 |
}
|
39 |
|
40 |
if ( ! defined( 'YWCTM_FREE_INIT' ) ) {
|
66 |
/* Load YWCTM text domain */
|
67 |
load_plugin_textdomain( 'ywctm', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
|
68 |
|
|
|
|
|
|
|
69 |
global $YITH_WC_Catalog_Mode;
|
70 |
$YITH_WC_Catalog_Mode = new YITH_WC_Catalog_Mode();
|
71 |
}
|
96 |
require_once( YWCTM_DIR . 'class.yith-woocommerce-catalog-mode.php' );
|
97 |
|
98 |
register_activation_hook( __FILE__, 'yith_plugin_registration_hook' );
|
99 |
+
register_activation_hook( __FILE__, 'ywctm_plugin_activation' );
|
100 |
+
|
101 |
+
function ywctm_plugin_activation () {
|
102 |
+
|
103 |
+
$pages_to_check = array(
|
104 |
+
get_option( 'woocommerce_cart_page_id' ),
|
105 |
+
get_option( 'woocommerce_checkout_page_id' )
|
106 |
+
);
|
107 |
|
108 |
+
foreach ( $pages_to_check as $page_id ) {
|
109 |
+
if ( get_post_status ( $page_id ) != 'publish' ) {
|
110 |
+
$page = array(
|
111 |
+
'ID' => $page_id,
|
112 |
+
'post_status' => 'publish'
|
113 |
+
);
|
114 |
+
|
115 |
+
wp_update_post( $page );
|
116 |
+
}
|
117 |
+
}
|
118 |
+
}
|
119 |
|
120 |
|
121 |
|
plugin-fw/assets/js/yit-plugin-panel.js
CHANGED
@@ -121,29 +121,78 @@
|
|
121 |
}
|
122 |
}).change();
|
123 |
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
141 |
}
|
142 |
|
143 |
-
|
144 |
-
|
145 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
146 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
147 |
}
|
148 |
|
149 |
$('.plugin-option .add_media').on('click', function () {
|
121 |
}
|
122 |
}).change();
|
123 |
|
124 |
+
//$(document).on('click', '.plugin-option .upload_button', function (e) {
|
125 |
+
// var send_attachment_bkp = wp.media.editor.send.attachment;
|
126 |
+
// var button = $(this);
|
127 |
+
// var id = button.attr('id').replace('-button', '');
|
128 |
+
// _custom_media = true;
|
129 |
+
// wp.media.editor.send.attachment = function (props, attachment) {
|
130 |
+
// if (_custom_media) {
|
131 |
+
// if ($("#" + id).is('input[type=text]')) {
|
132 |
+
// $("#" + id).val(attachment.url);
|
133 |
+
// } else {
|
134 |
+
// $("#" + id + '_custom').val(attachment.url);
|
135 |
+
// }
|
136 |
+
//
|
137 |
+
// } else {
|
138 |
+
// return _orig_send_attachment.apply(this, [props, attachment]);
|
139 |
+
// }
|
140 |
+
// ;
|
141 |
+
// }
|
142 |
+
//
|
143 |
+
// wp.media.editor.open(button);
|
144 |
+
// return false;
|
145 |
+
//});
|
146 |
+
|
147 |
+
$( document ).on( 'click', '.plugin-option .upload_button', function(e) {
|
148 |
+
e.preventDefault();
|
149 |
+
|
150 |
+
var t = $(this),
|
151 |
+
custom_uploader,
|
152 |
+
id = t.attr('id').replace(/-button$/, '');
|
153 |
+
|
154 |
+
//If the uploader object has already been created, reopen the dialog
|
155 |
+
if (custom_uploader) {
|
156 |
+
custom_uploader.open();
|
157 |
+
return;
|
158 |
}
|
159 |
|
160 |
+
var custom_uploader_states = [
|
161 |
+
// Main states.
|
162 |
+
new wp.media.controller.Library({
|
163 |
+
library: wp.media.query(),
|
164 |
+
multiple: false,
|
165 |
+
title: 'Choose Image',
|
166 |
+
priority: 20,
|
167 |
+
filterable: 'uploaded'
|
168 |
+
})
|
169 |
+
];
|
170 |
+
|
171 |
+
// Create the media frame.
|
172 |
+
custom_uploader = wp.media.frames.downloadable_file = wp.media({
|
173 |
+
// Set the title of the modal.
|
174 |
+
title: 'Choose Image',
|
175 |
+
library: {
|
176 |
+
type: ''
|
177 |
+
},
|
178 |
+
button: {
|
179 |
+
text: 'Choose Image'
|
180 |
+
},
|
181 |
+
multiple: false,
|
182 |
+
states: custom_uploader_states
|
183 |
+
});
|
184 |
|
185 |
+
|
186 |
+
//When a file is selected, grab the URL and set it as the text field's value
|
187 |
+
custom_uploader.on( 'select' , function() {
|
188 |
+
var attachment = custom_uploader.state().get( 'selection' ).first().toJSON();
|
189 |
+
|
190 |
+
$("#" + id).val( attachment.url );
|
191 |
+
});
|
192 |
+
|
193 |
+
//Open the uploader dialog
|
194 |
+
custom_uploader.open();
|
195 |
+
});
|
196 |
}
|
197 |
|
198 |
$('.plugin-option .add_media').on('click', function () {
|
plugin-fw/assets/js/yit-plugin-panel.min.js
CHANGED
@@ -1,9 +1,10 @@
|
|
1 |
-
(function(a){var
|
2 |
-
"</span>")};a(".plugin-option .select_wrapper select").not(".chosen").each(
|
3 |
-
function(){var b=a(this).prev("input");b.prop("checked")?b.prop("checked",!1).attr("value","no").removeClass("onoffchecked"):b.prop("checked",!0).attr("value","yes").addClass("onoffchecked");b.change()});a(".plugin-option .slider_container .ui-slider-horizontal").each(function(){var b=a(this).data("val"),c=a(this).data("min"),
|
4 |
-
a(this).siblings(".feedback").find("strong").text(c.value+
|
5 |
-
|
6 |
-
typeof b){":radio"==b.substr(0,6)&&(b+=":checked");for(var g=g.split(","),
|
7 |
-
b});c.val(JSON.stringify(f).replace(/[\\"']/g,"\\$&").replace(/\u0000/g,"\\0"))}}).disableSelection()});a(document).ready(function(){a(".yith-video-link").click(function(b){b.preventDefault();b=a(this).data("video-id");a("."+b).dialog({dialogClass:"wp-dialog yit-dialog yit-video-dialog",modal:!0,closeOnEscape:!0,width:"auto",resizable:!1,draggable:!1,create:function(b,
|
8 |
-
a(".ui-dialog :button").blur()})});a(document).ready(function(){a(".codemirror").each(function(b,c){var
|
9 |
-
d+="})(window,document,'script','//www.google-analytics.com/analytics.js','ga');\n\n";
|
|
1 |
+
(function(a){var l=function(){var b="";a(this).attr("multiple")?(a(this).children("option:selected").each(function(c,d){0!=c&&(b+=", ");b+=a(d).text()}),""==b&&a(this).children().children("option:selected").each(function(c,d){0!=c&&(b+=", ");b+=a(d).text()})):(b=a(this).children("option:selected").text(),""==b&&(b=a(this).children().children("option:selected").text()));0>=a(this).parent().find("span").length&&a(this).before("<span></span>");a(this).parent().children("span").replaceWith("<span>"+b+
|
2 |
+
"</span>")};a(".plugin-option .select_wrapper select").not(".chosen").each(l).change(l);a(".plugin-option .select_wrapper").click(function(b){b.stopPropagation();a(this).find("select[multiple]").not(".chosen").toggle()});a(".plugin-option .select_wrapper select[multiple]").not(".chosen").click(function(a){a.stopPropagation()});a(window).click(function(){a(".plugin-option .select_wrapper select[multiple]").not(".chosen").hide()});a(".plugin-option .chosen .select_wrapper select").chosen();a(".plugin-option .on_off_container span").on("click",
|
3 |
+
function(){var b=a(this).prev("input");b.prop("checked")?b.prop("checked",!1).attr("value","no").removeClass("onoffchecked"):b.prop("checked",!0).attr("value","yes").addClass("onoffchecked");b.change()});a(".plugin-option .slider_container .ui-slider-horizontal").each(function(){var b=a(this).data("val"),c=a(this).data("min"),d=a(this).data("max"),e=a(this).data("step"),f=a(this).data("labels");a(this).slider({value:b,min:c,max:d,range:"min",step:e,slide:function(b,c){a(this).find("input").val(c.value);
|
4 |
+
a(this).siblings(".feedback").find("strong").text(c.value+f)}})});"undefined"!==typeof wp&&"undefined"!==typeof wp.media&&(a(".plugin-option .upload_img_url").change(function(){var b=a(this).val(),c=a(this).parent().siblings(".upload_img_preview");/(http|ftp|https):\/\/[a-zA-Z0-9@?^=%&:/~+#-_.]*.(gif|jpg|jpeg|png|ico)/.test(b)?c.html('<img src="'+b+'" style="max-width:600px; max-height:300px;" />'):c.html("")}).change(),a(document).on("click",".plugin-option .upload_button",function(b){b.preventDefault();
|
5 |
+
var c,d=a(this).attr("id").replace(/-button$/,"");c||(b=[new wp.media.controller.Library({library:wp.media.query(),multiple:!1,title:"Choose Image",priority:20,filterable:"uploaded"})],c=wp.media.frames.downloadable_file=wp.media({title:"Choose Image",library:{type:""},button:{text:"Choose Image"},multiple:!1,states:b}),c.on("select",function(){var b=c.state().get("selection").first().toJSON();a("#"+d).val(b.url)}));c.open()}));a(".plugin-option .add_media").on("click",function(){});a("[data-field]").each(function(){var b=
|
6 |
+
a(this),c="#"+b.data("field"),d="#"+b.data("dep"),e=b.data("value");a(d).on("change",function(){var b=d,g=e.toString(),h=!0;if("string"==typeof b){":radio"==b.substr(0,6)&&(b+=":checked");for(var g=g.split(","),k=0;k<g.length;k++)if(a(b).val()!=g[k])h=!1;else{h=!0;break}}h?a(c+"-container").closest("tr").show():a(c+"-container").closest("tr").hide()}).change()});a(".rm_connectedlist").each(function(){var b=a(this).find("ul"),c=a(this).find(":hidden");b.sortable({connectWith:b,update:function(d,e){var f=
|
7 |
+
{};b.each(function(){var b={};a(this).children().each(function(){b[a(this).data("option")]=a(this).text()});f[a(this).data("list")]=b});c.val(JSON.stringify(f).replace(/[\\"']/g,"\\$&").replace(/\u0000/g,"\\0"))}}).disableSelection()});a(document).ready(function(){a(".yith-video-link").click(function(b){b.preventDefault();b=a(this).data("video-id");a("."+b).dialog({dialogClass:"wp-dialog yit-dialog yit-video-dialog",modal:!0,closeOnEscape:!0,width:"auto",resizable:!1,draggable:!1,create:function(b,
|
8 |
+
d){a(this).css("maxWidth","853px")},open:function(b,d){a(".ui-widget-overlay").bind("click",function(){a(this).siblings(".ui-dialog").find(".ui-dialog-content").dialog("close")})}});a(".ui-dialog :button").blur()})});a(document).ready(function(){a(".codemirror").each(function(b,c){var d=CodeMirror.fromTextArea(c,{lineNumbers:1,mode:"javascript",showCursorWhenSelecting:!0});a(c).data("codemirrorInstance",d)})});a(document).ready(function(){a(".google-analytic-generate").click(function(){var b=a("#"+
|
9 |
+
a(this).data("textarea")).data("codemirrorInstance"),c=a("#"+a(this).data("input")).val(),d=a(this).data("basename"),e;e="(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){\n(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement( o ),\nm=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)\n";e+="})(window,document,'script','//www.google-analytics.com/analytics.js','ga');\n\n";e+="ga('create', '"+c+"', '"+d+"');\n";e+="ga('send', 'pageview');\n";
|
10 |
+
b.replaceRange(e,b.getCursor("start"),b.getCursor("end"))})})})(jQuery);
|
plugin-fw/assets/js/yit-wp-pointer.js
CHANGED
@@ -23,7 +23,7 @@ jQuery(document).ready( function($) {
|
|
23 |
pointerClass: 'yit-wp-pointer',
|
24 |
content : options.content,
|
25 |
position: options.position,
|
26 |
-
open : function () {
|
27 |
selected_plugin_row.toggleClass( 'yit-pointer-selected-row' );
|
28 |
top_level_menu.addClass( 'yit-pointer' );
|
29 |
},
|
23 |
pointerClass: 'yit-wp-pointer',
|
24 |
content : options.content,
|
25 |
position: options.position,
|
26 |
+
open : function () {
|
27 |
selected_plugin_row.toggleClass( 'yit-pointer-selected-row' );
|
28 |
top_level_menu.addClass( 'yit-pointer' );
|
29 |
},
|
plugin-fw/lib/yit-metabox.php
CHANGED
@@ -30,7 +30,7 @@ if ( ! class_exists( 'YIT_Metabox' ) ) {
|
|
30 |
* 'fields' => array(
|
31 |
* 'meta_checkbox' => array(
|
32 |
* 'label' => __( 'Show title', 'yit' ),
|
33 |
-
* 'desc' => __( '
|
34 |
* 'type' => 'checkbox',
|
35 |
* 'private' => false,
|
36 |
* 'std' => '1'),
|
30 |
* 'fields' => array(
|
31 |
* 'meta_checkbox' => array(
|
32 |
* 'label' => __( 'Show title', 'yit' ),
|
33 |
+
* 'desc' => __( 'Choose whether to show title of the page or not.', 'yit' ),
|
34 |
* 'type' => 'checkbox',
|
35 |
* 'private' => false,
|
36 |
* 'std' => '1'),
|
plugin-fw/lib/yit-plugin-panel.php
CHANGED
@@ -717,7 +717,7 @@ if ( ! class_exists( 'YIT_Plugin_Panel' ) ) {
|
|
717 |
include $type;
|
718 |
}
|
719 |
else {
|
720 |
-
do_action( "yit_panel_{$option['type']}", $option, $db_value );
|
721 |
}
|
722 |
}
|
723 |
}
|
717 |
include $type;
|
718 |
}
|
719 |
else {
|
720 |
+
do_action( "yit_panel_{$option['type']}", $option, $db_value, $custom_attributes );
|
721 |
}
|
722 |
}
|
723 |
}
|
plugin-fw/lib/yit-upgrade.php
CHANGED
@@ -59,6 +59,10 @@ if ( ! class_exists( 'YIT_Upgrade' ) ) {
|
|
59 |
if( is_network_admin() ){
|
60 |
add_action( 'admin_enqueue_scripts', array( $this, 'network_admin_enqueue_scripts' ) );
|
61 |
}
|
|
|
|
|
|
|
|
|
62 |
}
|
63 |
|
64 |
/**
|
@@ -129,7 +133,7 @@ if ( ! class_exists( 'YIT_Upgrade' ) ) {
|
|
129 |
|
130 |
$update_url[ $init ] = wp_nonce_url( self_admin_url('update.php?action=upgrade-plugin-multisite&plugin=') . $init, 'upgrade-plugin-multisite_' . $init );
|
131 |
$changelog_id = str_replace( array( '/', '.php', '.' ), array( '-', '', '-' ), $init );
|
132 |
-
$details_url[ $init ] = '#TB_inline' . add_query_arg( array( 'width' => 722, 'height' => 914, 'inlineId' => $changelog_id ) , '' );
|
133 |
$changelogs[ $init ] = $this->in_theme_update_message( $this->_plugins[ $init ], $this->_plugins[ $init ]['info']['changelog'], $changelog_id, false );
|
134 |
}
|
135 |
|
@@ -362,6 +366,7 @@ if ( ! class_exists( 'YIT_Upgrade' ) ) {
|
|
362 |
$obj->new_version = (string)$plugin_remote_info->latest;
|
363 |
$obj->changelog = (string)$plugin_remote_info->changelog;
|
364 |
$obj->package = $package;
|
|
|
365 |
$transient->response[$init] = $obj;
|
366 |
}
|
367 |
|
@@ -400,7 +405,7 @@ if ( ! class_exists( 'YIT_Upgrade' ) ) {
|
|
400 |
$r = $current->response[ $init ];
|
401 |
|
402 |
$changelog_id = str_replace( array( '/', '.php', '.' ), array( '-', '', '-' ), $init );
|
403 |
-
$details_url = '#TB_inline' . add_query_arg( array( 'width' => 722, 'height' => 914, 'inlineId' => $changelog_id ) , '' );
|
404 |
|
405 |
/**
|
406 |
* @see wp_plugin_update_rows() in wp-single\wp-admin\includes\update.php
|
59 |
if( is_network_admin() ){
|
60 |
add_action( 'admin_enqueue_scripts', array( $this, 'network_admin_enqueue_scripts' ) );
|
61 |
}
|
62 |
+
|
63 |
+
if( defined( 'YIT_LICENCE_DEBUG' ) && YIT_LICENCE_DEBUG ){
|
64 |
+
$this->_package_url = 'http://dev.yithemes.com';
|
65 |
+
}
|
66 |
}
|
67 |
|
68 |
/**
|
133 |
|
134 |
$update_url[ $init ] = wp_nonce_url( self_admin_url('update.php?action=upgrade-plugin-multisite&plugin=') . $init, 'upgrade-plugin-multisite_' . $init );
|
135 |
$changelog_id = str_replace( array( '/', '.php', '.' ), array( '-', '', '-' ), $init );
|
136 |
+
$details_url[ $init ] = '#TB_inline' . esc_url( add_query_arg( array( 'width' => 722, 'height' => 914, 'inlineId' => $changelog_id ) , '' ) );
|
137 |
$changelogs[ $init ] = $this->in_theme_update_message( $this->_plugins[ $init ], $this->_plugins[ $init ]['info']['changelog'], $changelog_id, false );
|
138 |
}
|
139 |
|
366 |
$obj->new_version = (string)$plugin_remote_info->latest;
|
367 |
$obj->changelog = (string)$plugin_remote_info->changelog;
|
368 |
$obj->package = $package;
|
369 |
+
$obj->plugin = $init;
|
370 |
$transient->response[$init] = $obj;
|
371 |
}
|
372 |
|
405 |
$r = $current->response[ $init ];
|
406 |
|
407 |
$changelog_id = str_replace( array( '/', '.php', '.' ), array( '-', '', '-' ), $init );
|
408 |
+
$details_url = '#TB_inline' . esc_url( add_query_arg( array( 'width' => 722, 'height' => 914, 'inlineId' => $changelog_id ) , '' ) );
|
409 |
|
410 |
/**
|
411 |
* @see wp_plugin_update_rows() in wp-single\wp-admin\includes\update.php
|
plugin-fw/lib/yit-video.php
CHANGED
@@ -59,7 +59,8 @@ if ( ! class_exists( 'YIT_Video' ) ) {
|
|
59 |
|
60 |
if( ! $echo ) ob_start();
|
61 |
|
62 |
-
$id = preg_replace( '/[&|&]feature=([\w\-]*)/', '', $id );
|
|
|
63 |
|
64 |
<div class="post_video youtube">
|
65 |
<iframe wmode="transparent" width="<?php echo $width; ?>" height="<?php echo $height; ?>" src="https://www.youtube.com/embed/<?php echo $id; ?>?wmode=transparent" frameborder="0" allowfullscreen></iframe>
|
@@ -98,7 +99,8 @@ if ( ! class_exists( 'YIT_Video' ) ) {
|
|
98 |
|
99 |
if( ! $echo ) ob_start();
|
100 |
|
101 |
-
$id = preg_replace( '/[&|&]feature=([\w\-]*)/', '', $id )
|
|
|
102 |
|
103 |
<div class="post_video vimeo">
|
104 |
<iframe wmode="transparent" src="http://player.vimeo.com/video/<?php echo $id; ?>?title=0&byline=0&portrait=0" width="<?php echo $width; ?>" height="<?php echo $height; ?>" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>
|
@@ -124,16 +126,20 @@ if ( ! class_exists( 'YIT_Video' ) ) {
|
|
124 |
if ( ! isset( $parsed['host'] ) ) {
|
125 |
return false;
|
126 |
}
|
127 |
-
switch ( $parsed['host'] ) {
|
128 |
|
|
|
|
|
|
|
129 |
case 'www.youtube.com' :
|
130 |
case 'youtu.be' :
|
|
|
131 |
$id = self::youtube_id_by_url( $url );
|
132 |
return "youtube:$id";
|
133 |
|
|
|
134 |
case 'vimeo.com' :
|
135 |
-
preg_match( '/http
|
136 |
-
$id = $matches[
|
137 |
return "vimeo:$id";
|
138 |
|
139 |
default :
|
@@ -154,7 +160,7 @@ if ( ! class_exists( 'YIT_Video' ) ) {
|
|
154 |
* @author Antonino Scarfi' <antonino.scarfi@yithemes.com>
|
155 |
*/
|
156 |
protected static function youtube_id_by_url( $url ) {
|
157 |
-
if ( preg_match( '/http
|
158 |
$url = parse_url($url, PHP_URL_PATH);
|
159 |
$url = str_replace( '/', '', $url);
|
160 |
return $url;
|
@@ -164,12 +170,12 @@ if ( ! class_exists( 'YIT_Video' ) ) {
|
|
164 |
$url = str_replace( 'v=', '', $arr['query'] );
|
165 |
return $url;
|
166 |
|
167 |
-
} elseif ( preg_match( '/http
|
168 |
$arr = parse_url($url);
|
169 |
$url = str_replace( '/v/', '', $arr['path'] );
|
170 |
return $url;
|
171 |
|
172 |
-
} elseif ( preg_match( '/http
|
173 |
$arr = parse_url($url);
|
174 |
$url = str_replace( '/embed/', '', $arr['path'] );
|
175 |
return $url;
|
59 |
|
60 |
if( ! $echo ) ob_start();
|
61 |
|
62 |
+
$id = preg_replace( '/[&|&]feature=([\w\-]*)/', '', $id );
|
63 |
+
$id = preg_replace( '/(youtube|vimeo):/', '', $id ); ?>
|
64 |
|
65 |
<div class="post_video youtube">
|
66 |
<iframe wmode="transparent" width="<?php echo $width; ?>" height="<?php echo $height; ?>" src="https://www.youtube.com/embed/<?php echo $id; ?>?wmode=transparent" frameborder="0" allowfullscreen></iframe>
|
99 |
|
100 |
if( ! $echo ) ob_start();
|
101 |
|
102 |
+
$id = preg_replace( '/[&|&]feature=([\w\-]*)/', '', $id );
|
103 |
+
$id = preg_replace( '/(youtube|vimeo):/', '', $id ); ?>
|
104 |
|
105 |
<div class="post_video vimeo">
|
106 |
<iframe wmode="transparent" src="http://player.vimeo.com/video/<?php echo $id; ?>?title=0&byline=0&portrait=0" width="<?php echo $width; ?>" height="<?php echo $height; ?>" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>
|
126 |
if ( ! isset( $parsed['host'] ) ) {
|
127 |
return false;
|
128 |
}
|
|
|
129 |
|
130 |
+
|
131 |
+
switch ( $parsed['host'] ) {
|
132 |
+
case 'youtube.com' :
|
133 |
case 'www.youtube.com' :
|
134 |
case 'youtu.be' :
|
135 |
+
case 'www.youtu.be' :
|
136 |
$id = self::youtube_id_by_url( $url );
|
137 |
return "youtube:$id";
|
138 |
|
139 |
+
case 'www.vimeo.com' :
|
140 |
case 'vimeo.com' :
|
141 |
+
preg_match( '/http(s)?:\/\/(\w+.)?vimeo\.com\/(.*)?(\/[0-9]+)/', $url, $matches );
|
142 |
+
$id = trim( $matches[4], '/' );
|
143 |
return "vimeo:$id";
|
144 |
|
145 |
default :
|
160 |
* @author Antonino Scarfi' <antonino.scarfi@yithemes.com>
|
161 |
*/
|
162 |
protected static function youtube_id_by_url( $url ) {
|
163 |
+
if ( preg_match( '/http(s)?:\/\/youtu.be/', $url, $matches) ) {
|
164 |
$url = parse_url($url, PHP_URL_PATH);
|
165 |
$url = str_replace( '/', '', $url);
|
166 |
return $url;
|
170 |
$url = str_replace( 'v=', '', $arr['query'] );
|
171 |
return $url;
|
172 |
|
173 |
+
} elseif ( preg_match( '/http(s)?:\/\/(\w+.)?youtube.com\/v/', $url, $matches) ) {
|
174 |
$arr = parse_url($url);
|
175 |
$url = str_replace( '/v/', '', $arr['path'] );
|
176 |
return $url;
|
177 |
|
178 |
+
} elseif ( preg_match( '/http(s)?:\/\/(\w+.)?youtube.com\/embed/', $url, $matches) ) {
|
179 |
$arr = parse_url($url);
|
180 |
$url = str_replace( '/embed/', '', $arr['path'] );
|
181 |
return $url;
|
plugin-fw/licence/lib/yit-licence.php
CHANGED
@@ -62,7 +62,12 @@ if ( ! class_exists( 'YIT_Licence' ) ) {
|
|
62 |
* @since 1.0
|
63 |
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
64 |
*/
|
65 |
-
|
|
|
|
|
|
|
|
|
|
|
66 |
|
67 |
/**
|
68 |
* Premium products registration
|
@@ -135,9 +140,9 @@ if ( ! class_exists( 'YIT_Licence' ) ) {
|
|
135 |
/**
|
136 |
* Support to YIT Framework < 2.0
|
137 |
*/
|
138 |
-
$filename
|
139 |
-
$script_path
|
140 |
-
$style_path
|
141 |
|
142 |
wp_enqueue_script( 'yit-licence', $script_path . '/licence/assets/js/' . $filename, array( 'jquery' ), '1.0.0', true );
|
143 |
wp_enqueue_style( 'yit-theme-licence', $style_path . '/licence/assets/css/yit-licence.css' );
|
@@ -184,7 +189,7 @@ if ( ! class_exists( 'YIT_Licence' ) ) {
|
|
184 |
'instance' => $this->get_home_url()
|
185 |
);
|
186 |
|
187 |
-
$api_uri = add_query_arg( $args, $this->get_api_uri( 'activation' ) );
|
188 |
$response = wp_remote_get( $api_uri );
|
189 |
|
190 |
if ( is_wp_error( $response ) ) {
|
@@ -213,6 +218,9 @@ if ( ! class_exists( 'YIT_Licence' ) ) {
|
|
213 |
|
214 |
update_option( $this->_licence_option, $options );
|
215 |
|
|
|
|
|
|
|
216 |
/* === Licence Activation Template === */
|
217 |
$body['template'] = $this->show_activation_panel();
|
218 |
}
|
@@ -252,7 +260,7 @@ if ( ! class_exists( 'YIT_Licence' ) ) {
|
|
252 |
'instance' => $this->get_home_url()
|
253 |
);
|
254 |
|
255 |
-
$api_uri = add_query_arg( $args, $this->get_api_uri( 'check' ) );
|
256 |
$response = wp_remote_get( $api_uri );
|
257 |
|
258 |
if ( ! is_wp_error( $response ) ) {
|
@@ -315,6 +323,9 @@ if ( ! class_exists( 'YIT_Licence' ) ) {
|
|
315 |
|
316 |
/* === Update Plugin Licence Information === */
|
317 |
update_option( $this->_licence_option, $licence );
|
|
|
|
|
|
|
318 |
}
|
319 |
return $status;
|
320 |
}
|
@@ -336,7 +347,7 @@ if ( ! class_exists( 'YIT_Licence' ) ) {
|
|
336 |
}
|
337 |
|
338 |
/* === Regenerate Update Plugins Transient === */
|
339 |
-
|
340 |
|
341 |
do_action( 'yit_licence_after_check' );
|
342 |
|
@@ -505,7 +516,7 @@ if ( ! class_exists( 'YIT_Licence' ) ) {
|
|
505 |
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
506 |
*/
|
507 |
public function get_licence_activation_page_url() {
|
508 |
-
return add_query_arg( array( 'page' => $this->_settings['page'] ), admin_url( 'admin.php' ) );
|
509 |
}
|
510 |
|
511 |
|
62 |
* @since 1.0
|
63 |
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
64 |
*/
|
65 |
+
public function __construct(){
|
66 |
+
|
67 |
+
if( defined( 'YIT_LICENCE_DEBUG' ) && YIT_LICENCE_DEBUG ){
|
68 |
+
$this->_api_uri = 'http://dev.yithemes.com';
|
69 |
+
}
|
70 |
+
}
|
71 |
|
72 |
/**
|
73 |
* Premium products registration
|
140 |
/**
|
141 |
* Support to YIT Framework < 2.0
|
142 |
*/
|
143 |
+
$filename = function_exists( 'yit_load_js_file' ) ? yit_load_js_file( 'yit-licence.js' ) : 'yit-licence.js';
|
144 |
+
$script_path = defined( 'YIT_CORE_PLUGIN_URL' ) ? YIT_CORE_PLUGIN_URL : get_template_directory_uri() . '/core/plugin-fw';
|
145 |
+
$style_path = defined( 'YIT_CORE_PLUGIN_URL' ) ? YIT_CORE_PLUGIN_URL : get_template_directory_uri() . '/core/plugin-fw';
|
146 |
|
147 |
wp_enqueue_script( 'yit-licence', $script_path . '/licence/assets/js/' . $filename, array( 'jquery' ), '1.0.0', true );
|
148 |
wp_enqueue_style( 'yit-theme-licence', $style_path . '/licence/assets/css/yit-licence.css' );
|
189 |
'instance' => $this->get_home_url()
|
190 |
);
|
191 |
|
192 |
+
$api_uri = esc_url_raw( add_query_arg( $args, $this->get_api_uri( 'activation' ) ) );
|
193 |
$response = wp_remote_get( $api_uri );
|
194 |
|
195 |
if ( is_wp_error( $response ) ) {
|
218 |
|
219 |
update_option( $this->_licence_option, $options );
|
220 |
|
221 |
+
/* === Update Plugin Licence Information === */
|
222 |
+
YIT_Upgrade()->force_regenerate_update_transient();
|
223 |
+
|
224 |
/* === Licence Activation Template === */
|
225 |
$body['template'] = $this->show_activation_panel();
|
226 |
}
|
260 |
'instance' => $this->get_home_url()
|
261 |
);
|
262 |
|
263 |
+
$api_uri = esc_url_raw( add_query_arg( $args, $this->get_api_uri( 'check' ) ) );
|
264 |
$response = wp_remote_get( $api_uri );
|
265 |
|
266 |
if ( ! is_wp_error( $response ) ) {
|
323 |
|
324 |
/* === Update Plugin Licence Information === */
|
325 |
update_option( $this->_licence_option, $licence );
|
326 |
+
|
327 |
+
/* === Update Plugin Licence Information === */
|
328 |
+
YIT_Upgrade()->force_regenerate_update_transient();
|
329 |
}
|
330 |
return $status;
|
331 |
}
|
347 |
}
|
348 |
|
349 |
/* === Regenerate Update Plugins Transient === */
|
350 |
+
YIT_Upgrade()->force_regenerate_update_transient();
|
351 |
|
352 |
do_action( 'yit_licence_after_check' );
|
353 |
|
516 |
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
517 |
*/
|
518 |
public function get_licence_activation_page_url() {
|
519 |
+
return esc_url( add_query_arg( array( 'page' => $this->_settings['page'] ), admin_url( 'admin.php' ) ) );
|
520 |
}
|
521 |
|
522 |
|
plugin-fw/licence/lib/yit-plugin-licence.php
CHANGED
@@ -57,6 +57,7 @@ if ( ! class_exists( 'YIT_Plugin_Licence' ) ) {
|
|
57 |
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
58 |
*/
|
59 |
public function __construct() {
|
|
|
60 |
|
61 |
$this->_settings = array(
|
62 |
'parent_page' => 'yit_plugin_panel',
|
57 |
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
58 |
*/
|
59 |
public function __construct() {
|
60 |
+
parent::__construct();
|
61 |
|
62 |
$this->_settings = array(
|
63 |
'parent_page' => 'yit_plugin_panel',
|
plugin-fw/licence/lib/yit-theme-licence.php
CHANGED
@@ -57,6 +57,7 @@ if ( ! class_exists( 'YIT_Theme_Licence' ) ) {
|
|
57 |
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
58 |
*/
|
59 |
public function __construct() {
|
|
|
60 |
|
61 |
$this->_settings = array(
|
62 |
'parent_page' => 'yit_product_panel',
|
57 |
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
58 |
*/
|
59 |
public function __construct() {
|
60 |
+
parent::__construct();
|
61 |
|
62 |
$this->_settings = array(
|
63 |
'parent_page' => 'yit_product_panel',
|
plugin-fw/templates/metaboxes/tab.php
CHANGED
@@ -56,7 +56,16 @@ do_action( 'yit_before_metaboxes_tab' ) ?>
|
|
56 |
$field['value'] = $value != '' ? $value : ( isset( $field['std'] ) ? $field['std'] : '' );
|
57 |
?>
|
58 |
<div class="the-metabox <?php echo $field['type'] ?> clearfix<?php if ( empty( $field['label'] ) ) : ?> no-label<?php endif; ?>">
|
59 |
-
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
60 |
</div>
|
61 |
<?php endforeach ?>
|
62 |
</div>
|
56 |
$field['value'] = $value != '' ? $value : ( isset( $field['std'] ) ? $field['std'] : '' );
|
57 |
?>
|
58 |
<div class="the-metabox <?php echo $field['type'] ?> clearfix<?php if ( empty( $field['label'] ) ) : ?> no-label<?php endif; ?>">
|
59 |
+
<?php $args = apply_filters('yit_fw_metaboxes_type_args', array(
|
60 |
+
'basename' => YIT_CORE_PLUGIN_PATH,
|
61 |
+
'path' => '/metaboxes/types/',
|
62 |
+
'type' => $field['type'],
|
63 |
+
'args' => array('args' => $field)
|
64 |
+
)
|
65 |
+
);
|
66 |
+
extract( $args );
|
67 |
+
?>
|
68 |
+
<?php yit_plugin_get_template( $basename, $path . $type . '.php' , $args ) ?>
|
69 |
</div>
|
70 |
<?php endforeach ?>
|
71 |
</div>
|
plugin-fw/templates/metaboxes/types/contactform.php
CHANGED
@@ -54,7 +54,7 @@ $options["icon"] = YIT_Plugin_Common::get_awesome_icons();
|
|
54 |
/* End select Font Awesome */
|
55 |
?>
|
56 |
<div id="<?php echo $id ?>-container" <?php if ( isset($deps) ): ?>data-field="<?php echo $id ?>" data-dep="<?php echo $deps['ids'] ?>" data-value="<?php echo $deps['values'] ?>" <?php endif ?>>
|
57 |
-
|
58 |
|
59 |
<p class="field-row">
|
60 |
<a href="" class="button-secondary add-items"><?php _e( 'Add field', 'yit' ) ?></a>
|
54 |
/* End select Font Awesome */
|
55 |
?>
|
56 |
<div id="<?php echo $id ?>-container" <?php if ( isset($deps) ): ?>data-field="<?php echo $id ?>" data-dep="<?php echo $deps['ids'] ?>" data-value="<?php echo $deps['values'] ?>" <?php endif ?>>
|
57 |
+
<?php if( isset( $label ) ):?><label for="<?php echo $id ?>"><?php echo $label ?></label><?php endif;?>
|
58 |
|
59 |
<p class="field-row">
|
60 |
<a href="" class="button-secondary add-items"><?php _e( 'Add field', 'yit' ) ?></a>
|
plugin-fw/templates/metaboxes/types/onoff.php
CHANGED
@@ -14,6 +14,10 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
14 |
|
15 |
extract( $args );
|
16 |
|
|
|
|
|
|
|
|
|
17 |
?>
|
18 |
<div id="<?php echo $id ?>-container" <?php if ( isset($deps) ): ?>data-field="<?php echo $id ?>" data-dep="<?php echo $deps['ids'] ?>" data-value="<?php echo $deps['values'] ?>" <?php endif ?> class="rm_onoff onoff_container">
|
19 |
|
14 |
|
15 |
extract( $args );
|
16 |
|
17 |
+
if ( !isset( $desc ) ) {
|
18 |
+
$desc='';
|
19 |
+
}
|
20 |
+
|
21 |
?>
|
22 |
<div id="<?php echo $id ?>-container" <?php if ( isset($deps) ): ?>data-field="<?php echo $id ?>" data-dep="<?php echo $deps['ids'] ?>" data-value="<?php echo $deps['values'] ?>" <?php endif ?> class="rm_onoff onoff_container">
|
23 |
|
plugin-fw/yit-deactive-plugin.php
CHANGED
@@ -26,7 +26,7 @@ if ( ! function_exists( 'yit_deactive_free_version' ) ) {
|
|
26 |
|
27 |
global $status, $page, $s;
|
28 |
$redirect = 'plugins.php?action=activate&plugin=' . $to_active . '&plugin_status=' . $status . '&paged=' . $page . '&s=' . $s;
|
29 |
-
$redirect = add_query_arg( '_wpnonce', wp_create_nonce( 'activate-plugin_' . $to_active ), $redirect );
|
30 |
|
31 |
header( 'Location: ' . $redirect );
|
32 |
exit();
|
26 |
|
27 |
global $status, $page, $s;
|
28 |
$redirect = 'plugins.php?action=activate&plugin=' . $to_active . '&plugin_status=' . $status . '&paged=' . $page . '&s=' . $s;
|
29 |
+
$redirect = esc_url_raw( add_query_arg( '_wpnonce', wp_create_nonce( 'activate-plugin_' . $to_active ), $redirect ) );
|
30 |
|
31 |
header( 'Location: ' . $redirect );
|
32 |
exit();
|
plugin-options/settings-options.php
CHANGED
@@ -107,7 +107,7 @@ return array(
|
|
107 |
'catalog_mode_settings_disable_cart_in_header' => array(
|
108 |
'name' => __( '"Cart" and "Checkout" pages', 'ywctm' ),
|
109 |
'type' => 'checkbox',
|
110 |
-
'desc' => __( 'Hide', 'ywctm' ),
|
111 |
'id' => 'ywctm_hide_cart_header',
|
112 |
'default' => 'no',
|
113 |
),
|
107 |
'catalog_mode_settings_disable_cart_in_header' => array(
|
108 |
'name' => __( '"Cart" and "Checkout" pages', 'ywctm' ),
|
109 |
'type' => 'checkbox',
|
110 |
+
'desc' => __( 'Hide and disable all shop features', 'ywctm' ),
|
111 |
'id' => 'ywctm_hide_cart_header',
|
112 |
'default' => 'no',
|
113 |
),
|
readme.txt
CHANGED
@@ -3,8 +3,8 @@
|
|
3 |
Contributors: yithemes
|
4 |
Tags: woocommerce, products, themes, yit, yith, e-commerce, shop, catalog mode, catalogue mode, remove add to cart, ask for price, ask price, asking for price, asking price, button remove, call, call for price, call me, call us, contact, email, hide add to cart, hide price
|
5 |
Requires at least: 4.0
|
6 |
-
Tested up to: 4.
|
7 |
-
Stable tag: 1.0.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -48,6 +48,10 @@ YITH WooCommerce Catalog Mode will add a new tab called "Catalog Mode" inside th
|
|
48 |
|
49 |
== Changelog ==
|
50 |
|
|
|
|
|
|
|
|
|
51 |
= 1.0.3 =
|
52 |
|
53 |
* Fixed: Improved code performance
|
3 |
Contributors: yithemes
|
4 |
Tags: woocommerce, products, themes, yit, yith, e-commerce, shop, catalog mode, catalogue mode, remove add to cart, ask for price, ask price, asking for price, asking price, button remove, call, call for price, call me, call us, contact, email, hide add to cart, hide price
|
5 |
Requires at least: 4.0
|
6 |
+
Tested up to: 4.2.1
|
7 |
+
Stable tag: 1.0.4
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
48 |
|
49 |
== Changelog ==
|
50 |
|
51 |
+
= 1.0.4 =
|
52 |
+
|
53 |
+
* Fixed: Minor bugs
|
54 |
+
|
55 |
= 1.0.3 =
|
56 |
|
57 |
* Fixed: Improved code performance
|