| @@ -105,22 +105,22 @@ | ||
| 105 | 105 | */ |
| 106 | 106 | public static function get_shortcode_data( $tinymce = false ) { |
| 107 | 107 | |
| 108 | 108 | $snippets = get_posts( [ |
| 109 | - 'post_type' => WINP_SNIPPETS_POST_TYPE, | |
| 110 | - 'meta_query' => [ | |
| 111 | - 'relation' => 'AND', | |
| 112 | - [ | |
| 113 | - 'key' => WINP_Plugin::app()->getPrefix() . 'snippet_scope', | |
| 114 | - 'value' => 'shortcode', | |
| 115 | - ], | |
| 116 | - [ | |
| 117 | - 'key' => WINP_Plugin::app()->getPrefix() . 'snippet_activate', | |
| 118 | - 'value' => 1, | |
| 119 | - ], | |
| 109 | + 'post_type' => WINP_SNIPPETS_POST_TYPE, | |
| 110 | + 'meta_query' => [ | |
| 111 | + 'relation' => 'AND', | |
| 112 | + [ | |
| 113 | + 'key' => WINP_Plugin::app()->getPrefix() . 'snippet_scope', | |
| 114 | + 'value' => 'shortcode' | |
| 120 | 115 | ], |
| 121 | - 'post_status' => 'publish', | |
| 122 | - 'numberposts' => - 1, | |
| 116 | + [ | |
| 117 | + 'key' => WINP_Plugin::app()->getPrefix() . 'snippet_activate', | |
| 118 | + 'value' => 1 | |
| 119 | + ] | |
| 120 | + ], | |
| 121 | + 'post_status' => 'publish', | |
| 122 | + 'numberposts' => - 1 | |
| 123 | 123 | ] ); |
| 124 | 124 | |
| 125 | 125 | $result = []; |
| 126 | 126 | |
| @@ -135,9 +135,9 @@ | ||
| 135 | 135 | if ( ! empty( $available_tags ) ) { |
| 136 | 136 | $available_tags = array_map( 'trim', explode( ',', $available_tags ) ); |
| 137 | 137 | $available_tags = array_unique( $available_tags ); |
| 138 | 138 | } else { |
| 139 | - if ( $snippet_type !== 'text' && $snippet_type !== 'advert' ) { | |
| 139 | + if ( $snippet_type !== 'text' ) { | |
| 140 | 140 | $available_tags = [ 'id', 'title' ]; |
| 141 | 141 | } else { |
| 142 | 142 | $available_tags = [ 'id' ]; |
| 143 | 143 | } |
| @@ -143,12 +143,12 @@ | ||
| 143 | 143 | } |
| 144 | 144 | } |
| 145 | 145 | |
| 146 | 146 | $tags = [ |
| 147 | - 'id' => $snippet->ID, | |
| 148 | - 'type' => $snippet_type, | |
| 149 | - 'name' => $snippet_type == WINP_SNIPPET_TYPE_UNIVERSAL ? 'wbcr_snippet' : 'wbcr_' . $snippet_type . '_snippet', | |
| 150 | - 'title' => empty( $snippet->post_title ) ? '(no titled, ID=' . $snippet->ID . ')' : $snippet->post_title, | |
| 147 | + 'id' => $snippet->ID, | |
| 148 | + 'type' => $snippet_type, | |
| 149 | + 'name' => $snippet_type == WINP_SNIPPET_TYPE_UNIVERSAL ? 'wbcr_snippet' : 'wbcr_' . $snippet_type . '_snippet', | |
| 150 | + 'title' => empty( $snippet->post_title ) ? '(no titled, ID=' . $snippet->ID . ')' : $snippet->post_title | |
| 151 | 151 | ]; |
| 152 | 152 | |
| 153 | 153 | if ( ! empty( $available_tags ) ) { |
| 154 | 154 | foreach ( (array) $available_tags as $tag ) { |
| @@ -185,9 +185,9 @@ | ||
| 185 | 185 | global $post; |
| 186 | 186 | |
| 187 | 187 | $_post = $post; |
| 188 | 188 | |
| 189 | - $snippet_type = WINP_Plugin::app()->request->get( 'winp_item', WINP_SNIPPET_TYPE_PHP, 'sanitize_key' ); | |
| 189 | + $snippet_type = WINP_Plugin::app()->request->get( 'winp_item', WINP_SNIPPET_TYPE_PHP, true ); | |
| 190 | 190 | $get_post = WINP_Plugin::app()->request->get( 'post', '' ); |
| 191 | 191 | |
| 192 | 192 | if ( empty( $post_id ) && ! empty( $get_post ) && ! is_array( $get_post ) ) { |
| 193 | 193 | $post_id = esc_attr( $get_post ); |
| @@ -227,16 +227,16 @@ | ||
| 227 | 227 | } |
| 228 | 228 | |
| 229 | 229 | // (#3) |
| 230 | 230 | $rest_url = wp_parse_url( site_url( $prefix ) ); |
| 231 | - $current_url = wp_parse_url( esc_url( add_query_arg( [] ) ) ); | |
| 231 | + $current_url = wp_parse_url( add_query_arg( [] ) ); | |
| 232 | 232 | |
| 233 | 233 | return strpos( $current_url['path'], $rest_url['path'], 0 ) === 0; |
| 234 | 234 | } |
| 235 | 235 | |
| 236 | 236 | /** |
| 237 | + * @since 2.1.0 | |
| 237 | 238 | * @return bool |
| 238 | - * @since 2.1.0 | |
| 239 | 239 | */ |
| 240 | 240 | public static function doing_ajax() { |
| 241 | 241 | if ( function_exists( 'wp_doing_ajax' ) ) { |
| 242 | 242 | return wp_doing_ajax(); |
| @@ -245,10 +245,10 @@ | ||
| 245 | 245 | return defined( 'DOING_AJAX' ) && DOING_AJAX; |
| 246 | 246 | } |
| 247 | 247 | |
| 248 | 248 | /** |
| 249 | + * @since 2.1.0 | |
| 249 | 250 | * @return bool |
| 250 | - * @since 2.1.0 | |
| 251 | 251 | */ |
| 252 | 252 | public static function doing_cron() { |
| 253 | 253 | if ( function_exists( 'wp_doing_cron' ) ) { |
| 254 | 254 | return wp_doing_cron(); |
| @@ -263,14 +263,14 @@ | ||
| 263 | 263 | * |
| 264 | 264 | * If the migration was an error, we need to reliably get the |
| 265 | 265 | * snippet code if the post_content cell is empty. |
| 266 | 266 | * |
| 267 | + * @author Alexander Kovalev <alex.kovalevv@gmail.com> | |
| 268 | + * @since 2.2.1 | |
| 269 | + * | |
| 267 | 270 | * @param WP_Post $post |
| 268 | 271 | * |
| 269 | 272 | * @return string snippet code |
| 270 | - * @author Alexander Kovalev <alex.kovalevv@gmail.com> | |
| 271 | - * @since 2.2.1 | |
| 272 | - * | |
| 273 | 273 | */ |
| 274 | 274 | public static function get_snippet_code( $post ) { |
| 275 | 275 | if ( empty( $post->post_content ) ) { |
| 276 | 276 | return WINP_Helper::getMetaOption( $post->ID, 'snippet_code' ); |
| @@ -281,11 +281,11 @@ | ||
| 281 | 281 | |
| 282 | 282 | /** |
| 283 | 283 | * Get meta option |
| 284 | 284 | * |
| 285 | - * @param int $post_id | |
| 285 | + * @param int $post_id | |
| 286 | 286 | * @param string $option_name |
| 287 | - * @param mixed $default | |
| 287 | + * @param mixed $default | |
| 288 | 288 | * |
| 289 | 289 | * @return mixed|array |
| 290 | 290 | */ |
| 291 | 291 | public static function getMetaOption( $post_id, $option_name, $default = null ) { |
| @@ -306,11 +306,11 @@ | ||
| 306 | 306 | |
| 307 | 307 | /** |
| 308 | 308 | * Udpdate meta option |
| 309 | 309 | * |
| 310 | - * @param int $post_id | |
| 310 | + * @param int $post_id | |
| 311 | 311 | * @param string $option_name |
| 312 | - * @param mixed $option_value | |
| 312 | + * @param mixed $option_value | |
| 313 | 313 | * |
| 314 | 314 | * @return bool|int |
| 315 | 315 | */ |
| 316 | 316 | public static function updateMetaOption( $post_id, $option_name, $option_value ) { |
| @@ -321,9 +321,9 @@ | ||
| 321 | 321 | |
| 322 | 322 | /** |
| 323 | 323 | * Remove meta option |
| 324 | 324 | * |
| 325 | - * @param int $post_id | |
| 325 | + * @param int $post_id | |
| 326 | 326 | * @param string $option_name |
| 327 | 327 | * |
| 328 | 328 | * @return bool|int |
| 329 | 329 | */ |
| @@ -389,64 +389,49 @@ | ||
| 389 | 389 | update_option( WINP_Plugin::app()->getOptionName( 'code_editor_auto_close_brackets' ), 1 ); |
| 390 | 390 | update_option( WINP_Plugin::app()->getOptionName( 'code_editor_highlight_selection_matches' ), 0 ); |
| 391 | 391 | |
| 392 | 392 | $posts = [ |
| 393 | - [ | |
| 394 | - 'post_title' => __( 'Simple universal snippet: Google analytics tracking', 'insert-php' ), | |
| 395 | - 'post_name' => 'simple-universal-snippet', | |
| 396 | - 'post_content' => self::get_simple_universal_snippet(), | |
| 397 | - 'meta' => [ | |
| 398 | - 'type' => WINP_SNIPPET_TYPE_UNIVERSAL, | |
| 399 | - 'description' => __( 'Google analytics tracking code will be added to all pages before the </head> tag. Please remember to set the Tracking ID before activating the snippet.' ), | |
| 400 | - 'filters' => 'a:1:{i:0;O:8:"stdClass":2:{s:10:"conditions";a:1:{i:0;O:8:"stdClass":2:{s:4:"type";s:5:"scope";s:10:"conditions";a:1:{i:0;O:8:"stdClass":4:{s:5:"param";s:18:"location-some-page";s:8:"operator";s:6:"equals";s:4:"type";s:6:"select";s:5:"value";s:8:"base_web";}}}}s:4:"type";s:6:"showif";}}', | |
| 401 | - 'tags' => [ 'universal', 'tracking' ], | |
| 402 | - 'priority' => 10, | |
| 403 | - ], | |
| 404 | - ], | |
| 405 | - [ | |
| 406 | - 'post_title' => __( 'Simple text snippet: What is Lorem Ipsum?', 'insert-php' ), | |
| 407 | - 'post_name' => 'simple-text-snippet', | |
| 408 | - 'post_content' => self::get_simple_text_snippet(), | |
| 409 | - 'meta' => [ | |
| 410 | - 'type' => WINP_SNIPPET_TYPE_TEXT, | |
| 411 | - 'description' => __( 'This ordinary maintenance text. With this snippet, you can fill your pages with meaningless English text.', 'insert-php' ), | |
| 412 | - 'filters' => 'a:1:{i:0;O:8:"stdClass":2:{s:10:"conditions";a:2:{i:0;O:8:"stdClass":2:{s:4:"type";s:5:"scope";s:10:"conditions";a:1:{i:0;O:8:"stdClass":4:{s:5:"param";s:18:"location-some-page";s:8:"operator";s:6:"equals";s:4:"type";s:6:"select";s:5:"value";s:9:"base_sing";}}}i:1;O:8:"stdClass":2:{s:4:"type";s:5:"scope";s:10:"conditions";a:2:{i:0;O:8:"stdClass":4:{s:5:"param";s:18:"location-post-type";s:8:"operator";s:6:"equals";s:4:"type";s:6:"select";s:5:"value";s:4:"post";}i:1;O:8:"stdClass":4:{s:5:"param";s:18:"location-post-type";s:8:"operator";s:6:"equals";s:4:"type";s:6:"select";s:5:"value";s:4:"page";}}}}s:4:"type";s:6:"showif";}}', | |
| 413 | - 'tags' => [ 'text', 'lorem ipsum' ], | |
| 414 | - 'priority' => 20, | |
| 415 | - ], | |
| 416 | - ], | |
| 417 | - [ | |
| 418 | - 'post_title' => __( 'Simple php snippet: Disable emojis', 'insert-php' ), | |
| 419 | - 'post_name' => 'simple-php-snippet', | |
| 420 | - 'post_content' => self::get_simple_php_snippet(), | |
| 421 | - 'meta' => [ | |
| 422 | - 'type' => WINP_SNIPPET_TYPE_PHP, | |
| 423 | - 'description' => __( 'Emojis are little icons used to express ideas or emotions. While these icons are fun and all, are they really necessary for your WordPress site? This snippet to disable emojis on your site to make it faster.', 'insert-php' ), | |
| 424 | - 'tags' => [ 'php', 'disable features' ], | |
| 425 | - 'priority' => 30, | |
| 426 | - ], | |
| 427 | - ], | |
| 428 | - [ | |
| 429 | - 'post_title' => __( 'Add Facebook Pixel to the Order success page', 'insert-php' ), | |
| 430 | - 'post_name' => 'simple-uni-snippet-for-woocommerce', | |
| 431 | - 'post_content' => self::get_woo_snippet(), | |
| 432 | - 'meta' => [ | |
| 433 | - 'type' => WINP_SNIPPET_TYPE_UNIVERSAL, | |
| 434 | - 'description' => __( 'Add Facebook Pixel to the Order success page.', 'insert-php' ), | |
| 435 | - 'filters' => 'a:1:{i:0;O:8:"stdClass":2:{s:10:"conditions";a:1:{i:0;O:8:"stdClass":2:{s:4:"type";s:5:"scope";s:10:"conditions";a:1:{i:0;O:8:"stdClass":4:{s:5:"param";s:18:"location-some-page";s:8:"operator";s:6:"equals";s:4:"type";s:6:"select";s:5:"value";s:16:"woo_checkout_pay";}}}}s:4:"type";s:6:"showif";}}', | |
| 436 | - 'tags' => [ 'woocommerce' ], | |
| 437 | - 'priority' => 40, | |
| 438 | - ], | |
| 439 | - ], | |
| 393 | + [ | |
| 394 | + 'post_title' => __( 'Simple php snippet: Disable emojis', 'insert-php' ), | |
| 395 | + 'post_name' => 'simple-php-snippet', | |
| 396 | + 'post_content' => self::get_simple_php_snippet(), | |
| 397 | + 'meta' => [ | |
| 398 | + 'type' => WINP_SNIPPET_TYPE_PHP, | |
| 399 | + 'description' => __( 'Emojis are little icons used to express ideas or emotions. While these icons are fun and all, are they really necessary for your WordPress site? This snippet to disable emojis on your site to make it faster.', 'insert-php' ), | |
| 400 | + 'tags' => [ 'php', 'disable features' ] | |
| 401 | + ] | |
| 402 | + ], | |
| 403 | + [ | |
| 404 | + 'post_title' => __( 'Simple text snippet: What is Lorem Ipsum?', 'insert-php' ), | |
| 405 | + 'post_name' => 'simple-text-snippet', | |
| 406 | + 'post_content' => self::get_simple_text_snippet(), | |
| 407 | + 'meta' => [ | |
| 408 | + 'type' => WINP_SNIPPET_TYPE_TEXT, | |
| 409 | + 'description' => __( 'This ordinary maintenance text. With this snippet, you can fill your pages with meaningless English text.', 'insert-php' ), | |
| 410 | + 'filters' => 'a:1:{i:0;O:8:"stdClass":2:{s:10:"conditions";a:2:{i:0;O:8:"stdClass":2:{s:4:"type";s:5:"scope";s:10:"conditions";a:1:{i:0;O:8:"stdClass":4:{s:5:"param";s:18:"location-some-page";s:8:"operator";s:6:"equals";s:4:"type";s:6:"select";s:5:"value";s:9:"base_sing";}}}i:1;O:8:"stdClass":2:{s:4:"type";s:5:"scope";s:10:"conditions";a:2:{i:0;O:8:"stdClass":4:{s:5:"param";s:18:"location-post-type";s:8:"operator";s:6:"equals";s:4:"type";s:6:"select";s:5:"value";s:4:"post";}i:1;O:8:"stdClass":4:{s:5:"param";s:18:"location-post-type";s:8:"operator";s:6:"equals";s:4:"type";s:6:"select";s:5:"value";s:4:"page";}}}}s:4:"type";s:6:"showif";}}', | |
| 411 | + 'tags' => [ 'text', 'lorem ipsum' ] | |
| 412 | + ] | |
| 413 | + ], | |
| 414 | + [ | |
| 415 | + 'post_title' => __( 'Simple universal snippet: Google analytics tracking', 'insert-php' ), | |
| 416 | + 'post_name' => 'simple-universal-snippet', | |
| 417 | + 'post_content' => self::get_simple_universal_snippet(), | |
| 418 | + 'meta' => [ | |
| 419 | + 'type' => WINP_SNIPPET_TYPE_UNIVERSAL, | |
| 420 | + 'description' => __( 'Google analytics tracking code will be added to all pages before the </head> tag. Please remember to set the Tracking ID before activating the snippet.' ), | |
| 421 | + 'filters' => 'a:1:{i:0;O:8:"stdClass":2:{s:10:"conditions";a:1:{i:0;O:8:"stdClass":2:{s:4:"type";s:5:"scope";s:10:"conditions";a:1:{i:0;O:8:"stdClass":4:{s:5:"param";s:18:"location-some-page";s:8:"operator";s:6:"equals";s:4:"type";s:6:"select";s:5:"value";s:8:"base_web";}}}}s:4:"type";s:6:"showif";}}', | |
| 422 | + 'tags' => [ 'universal', 'tracking' ] | |
| 423 | + ] | |
| 424 | + ] | |
| 440 | 425 | ]; |
| 441 | 426 | |
| 442 | 427 | foreach ( $posts as $post ) { |
| 443 | 428 | // '@' here is to hide unexpected output while plugin activation |
| 444 | 429 | $post_id = @wp_insert_post( [ |
| 445 | - 'post_content' => $post['post_content'], | |
| 446 | - 'post_title' => $post['post_title'], | |
| 447 | - 'post_status' => 'publish', | |
| 448 | - 'post_type' => WINP_SNIPPETS_POST_TYPE, | |
| 430 | + 'post_content' => $post['post_content'], | |
| 431 | + 'post_title' => $post['post_title'], | |
| 432 | + 'post_status' => 'publish', | |
| 433 | + 'post_type' => WINP_SNIPPETS_POST_TYPE | |
| 449 | 434 | ] ); |
| 450 | 435 | |
| 451 | 436 | if ( ! is_wp_error( $post_id ) ) { |
| 452 | 437 | if ( isset( $post['meta']['type'] ) ) { |
| @@ -480,12 +465,8 @@ | ||
| 480 | 465 | } |
| 481 | 466 | |
| 482 | 467 | wp_set_post_terms( $post_id, $post['meta']['tags'], WINP_SNIPPETS_TAXONOMY, true ); |
| 483 | 468 | } |
| 484 | - | |
| 485 | - if ( isset( $post['meta']['priority'] ) ) { | |
| 486 | - WINP_Helper::updateMetaOption( $post_id, 'snippet_priority', $post['meta']['priority'] ); | |
| 487 | - } | |
| 488 | 469 | } |
| 489 | 470 | } |
| 490 | 471 | |
| 491 | 472 | update_option( WINP_Plugin::app()->getOptionName( 'demo_snippets_created' ), 1 ); |
| @@ -555,34 +536,8 @@ | ||
| 555 | 536 | return $output; |
| 556 | 537 | } |
| 557 | 538 | |
| 558 | 539 | /** |
| 559 | - * Returns an example of the content of a woocommerce snippet. | |
| 560 | - * | |
| 561 | - * @return string | |
| 562 | - */ | |
| 563 | - protected static function get_woo_snippet() { | |
| 564 | - $output = <<<SCRIPT | |
| 565 | -<script type="text/javascript"> | |
| 566 | - var pixel_id = ''; // Add you FB pixel ID! | |
| 567 | - !function (f, b, e, v, n, t, s) { | |
| 568 | - if (f.fbq) return; n = f.fbq = function () { | |
| 569 | - n.callMethod ? | |
| 570 | - n.callMethod.apply(n, arguments) : n.queue.push(arguments) | |
| 571 | - }; if (!f._fbq) f._fbq = n; | |
| 572 | - n.push = n; n.loaded = !0; n.version = '2.0'; n.queue = []; t = b.createElement(e); t.async = !0; | |
| 573 | - t.src = v; s = b.getElementsByTagName(e)[0]; s.parentNode.insertBefore(t, s) | |
| 574 | - }(window,document, 'script', 'https://connect.facebook.net/en_US/fbevents.js'); | |
| 575 | - | |
| 576 | - fbq('init', pixel_id); | |
| 577 | - fbq('track', 'PageView'); | |
| 578 | -</script> | |
| 579 | -SCRIPT; | |
| 580 | - | |
| 581 | - return $output; | |
| 582 | - } | |
| 583 | - | |
| 584 | - /** | |
| 585 | 540 | * Wrapper for register shortcode |
| 586 | 541 | * |
| 587 | 542 | * @param $name |
| 588 | 543 | * @param $obj |
| @@ -587,9 +542,9 @@ | ||
| 587 | 542 | * @param $name |
| 588 | 543 | * @param $obj |
| 589 | 544 | */ |
| 590 | 545 | public static function register_shortcode( $name, $obj ) { |
| 591 | - Wbcr_FactoryShortcodes333::register( $name, $obj ); | |
| 546 | + Wbcr_FactoryShortcodes329::register( $name, $obj ); | |
| 592 | 547 | } |
| 593 | 548 | |
| 594 | 549 | /** |
| 595 | 550 | * Wrapper for get factory class for container |
| @@ -596,20 +551,20 @@ | ||
| 596 | 551 | * |
| 597 | 552 | * @return string |
| 598 | 553 | */ |
| 599 | 554 | public static function get_factory_class() { |
| 600 | - return "factory-bootstrap-459 factory-fontawesome-000"; | |
| 555 | + return "factory-bootstrap-420 factory-fontawesome-000"; | |
| 601 | 556 | } |
| 602 | 557 | |
| 603 | 558 | /** |
| 604 | - * Wrapper for Wbcr_FactoryForms455_OptionsValueProvider object | |
| 559 | + * Wrapper for Wbcr_FactoryForms417_OptionsValueProvider object | |
| 605 | 560 | * |
| 606 | 561 | * @param $plugin |
| 607 | 562 | * |
| 608 | - * @return Wbcr_FactoryForms455_OptionsValueProvider | |
| 563 | + * @return Wbcr_FactoryForms417_OptionsValueProvider | |
| 609 | 564 | */ |
| 610 | 565 | public static function get_options_value_provider( $plugin ) { |
| 611 | - return new Wbcr_FactoryForms455_OptionsValueProvider( $plugin ); | |
| 566 | + return new Wbcr_FactoryForms417_OptionsValueProvider( $plugin ); | |
| 612 | 567 | } |
| 613 | 568 | |
| 614 | 569 | /** |
| 615 | 570 | * Wrapper for get factory form object |
| @@ -616,12 +571,12 @@ | ||
| 616 | 571 | * |
| 617 | 572 | * @param $options |
| 618 | 573 | * @param $plugin |
| 619 | 574 | * |
| 620 | - * @return Wbcr_FactoryForms455_Form | |
| 575 | + * @return Wbcr_FactoryForms417_Form | |
| 621 | 576 | */ |
| 622 | 577 | public static function get_factory_form( $options, $plugin ) { |
| 623 | - return new Wbcr_FactoryForms455_Form( $options, $plugin ); | |
| 578 | + return new Wbcr_FactoryForms417_Form( $options, $plugin ); | |
| 624 | 579 | } |
| 625 | 580 | |
| 626 | 581 | /** |
| 627 | 582 | * Wrapper for register factory metaboxes |
| @@ -630,9 +585,9 @@ | ||
| 630 | 585 | * @param $post_type |
| 631 | 586 | * @param $plugin |
| 632 | 587 | */ |
| 633 | 588 | public static function register_factory_metaboxes( $class_name_or_object, $post_type, $plugin ) { |
| 634 | - Wbcr_FactoryMetaboxes413::registerFor( $class_name_or_object, $post_type, $plugin ); | |
| 589 | + Wbcr_FactoryMetaboxes409::registerFor( $class_name_or_object, $post_type, $plugin ); | |
| 635 | 590 | } |
| 636 | 591 | |
| 637 | 592 | /** |
| 638 | 593 | * Render html for purchase button |
| @@ -641,13 +596,13 @@ | ||
| 641 | 596 | $price_url = WINP_Plugin::app()->get_support()->get_pricing_url( true, $utm_tracking_location ); |
| 642 | 597 | $price = WINP_Plugin::app()->premium->get_price(); |
| 643 | 598 | $price = empty( $price ) ? 19 : $price; |
| 644 | 599 | ?> |
| 645 | - <p class="winp-purchase-button"> | |
| 646 | - <a class="button" id="winp-library-buy-button" href="<?php echo esc_url( $price_url ) ?>" target="_blank"> | |
| 647 | - <span><?php echo __( 'Purchase premium for', 'insert-php' ) . ' $' . esc_attr( $price ); ?></span> | |
| 648 | - </a> | |
| 649 | - </p> | |
| 600 | + <p class="winp-purchase-button"> | |
| 601 | + <a class="button" id="winp-library-buy-button" href="<?php echo esc_url( $price_url ) ?>" target="_blank"> | |
| 602 | + <span><?php echo __( 'Purchase premium for', 'insert-php' ) . ' $' . esc_attr( $price ); ?></span> | |
| 603 | + </a> | |
| 604 | + </p> | |
| 650 | 605 | <?php |
| 651 | 606 | } |
| 652 | 607 | |
| 653 | 608 | /** |
| @@ -690,9 +645,9 @@ | ||
| 690 | 645 | comet_cache::clear(); |
| 691 | 646 | } else if ( class_exists( 'WpeCommon' ) ) { |
| 692 | 647 | // WPEngine cache purge/flush methods to call by default |
| 693 | 648 | $wpe_methods = [ |
| 694 | - 'purge_varnish_cache', | |
| 649 | + 'purge_varnish_cache', | |
| 695 | 650 | ]; |
| 696 | 651 | |
| 697 | 652 | // More agressive clear/flush/purge behind a filter |
| 698 | 653 | if ( apply_filters( 'wbcr/factory/flush_wpengine_aggressive', false ) ) { |
| @@ -721,82 +676,5 @@ | ||
| 721 | 676 | prune_super_cache( $cache_path, true ); |
| 722 | 677 | } |
| 723 | 678 | } |
| 724 | 679 | } |
| 725 | - | |
| 726 | - /** | |
| 727 | - * @param $post WP_Post | |
| 728 | - * | |
| 729 | - * @return string | |
| 730 | - * @since 2.4.0 | |
| 731 | - * | |
| 732 | - */ | |
| 733 | - public static function get_where_use_text( $post ) { | |
| 734 | - global $winp_snippets_locations; | |
| 735 | - $snippet_scope = self::getMetaOption( $post->ID, 'snippet_scope' ); | |
| 736 | - $result = ""; | |
| 737 | - | |
| 738 | - if ( $snippet_scope == 'evrywhere' ) { | |
| 739 | - $result = __( 'Run everywhere', 'insert-php' ); | |
| 740 | - } else if ( $snippet_scope == 'auto' ) { | |
| 741 | - $items = $winp_snippets_locations->getList(); | |
| 742 | - | |
| 743 | - $snippet_location = self::getMetaOption( $post->ID, 'snippet_location', '' ); | |
| 744 | - | |
| 745 | - if ( ! empty( $snippet_location ) ) { | |
| 746 | - $text = $items[ $snippet_location ][0] ?? ''; | |
| 747 | - } else { | |
| 748 | - $text = __( 'Everywhere', 'insert-php' ); | |
| 749 | - } | |
| 750 | - | |
| 751 | - $result = esc_html( $text ); | |
| 752 | - } else { | |
| 753 | - $result = self::get_shortcode_text( $post ); | |
| 754 | - } | |
| 755 | - | |
| 756 | - return $result; | |
| 757 | - } | |
| 758 | - | |
| 759 | - /** | |
| 760 | - * @param $post WP_Post | |
| 761 | - * | |
| 762 | - * @return string | |
| 763 | - */ | |
| 764 | - public static function get_shortcode_text( $post ) { | |
| 765 | - $snippet_type = self::get_snippet_type( $post->ID ); | |
| 766 | - $snippet_type = ( $snippet_type == WINP_SNIPPET_TYPE_UNIVERSAL ? '' : $snippet_type . '_' ); | |
| 767 | - | |
| 768 | - return esc_html( apply_filters( 'wbcr/inp/viewtable/where_use', '[wbcr_' . $snippet_type . 'snippet id="' . $post->ID . '"]', $post->ID ) ); | |
| 769 | - } | |
| 770 | - | |
| 771 | - /** | |
| 772 | - * @param $post WP_Post | |
| 773 | - * | |
| 774 | - * @return int | |
| 775 | - */ | |
| 776 | - public static function get_next_snippet_priority() { | |
| 777 | - global $wpdb; | |
| 778 | - | |
| 779 | - $max_priority = $wpdb->get_var( " | |
| 780 | - SELECT MAX(CAST(meta_value AS UNSIGNED)) | |
| 781 | - FROM {$wpdb->postmeta} | |
| 782 | - WHERE meta_key = '" . WINP_Plugin::app()->getPrefix() . "snippet_priority'" ); | |
| 783 | - | |
| 784 | - if ( is_null( $max_priority ) ) { | |
| 785 | - $max_priority = 0; | |
| 786 | - } else { | |
| 787 | - $max_priority = (int) $max_priority; | |
| 788 | - } | |
| 789 | - | |
| 790 | - return $max_priority + 10; | |
| 791 | - } | |
| 792 | - | |
| 793 | - /** | |
| 794 | - * @return bool | |
| 795 | - * | |
| 796 | - * @since 2.4.0 | |
| 797 | - */ | |
| 798 | - public static function is_woo_active() { | |
| 799 | - return is_plugin_active( 'woocommerce/woocommerce.php' ); | |
| 800 | - } | |
| 801 | - | |
| 802 | 680 | } |