| @@ -2,15 +2,17 @@ | ||
| 2 | 2 | |
| 3 | 3 | namespace UltimateStoreKit\Includes\Builder; |
| 4 | 4 | |
| 5 | 5 | use Elementor\Widget_Base; |
| 6 | +use UltimateStoreKit\Ultimate_Store_Kit_Loader; | |
| 6 | 7 | |
| 7 | 8 | |
| 8 | - | |
| 9 | -if (!defined('ABSPATH')) { | |
| 9 | +if (! defined('ABSPATH')) { | |
| 10 | 10 | exit; |
| 11 | 11 | } // Exit if accessed directly |
| 12 | 12 | |
| 13 | +// phpcs:disable WordPress.NamingConventions.PrefixAllGlobals -- usk_ / BDTUSK_ / ultimate-store-kit- are this plugin's established public prefixes. Ultimate Store Kit Pro calls into these names, as does third-party integration code, so renaming them is a breaking change. Plugin Check only recognises prefixes derived verbatim from the slug and so reports them as unprefixed. | |
| 14 | + | |
| 13 | 15 | abstract class Builder_Widget_Base extends Widget_Base { |
| 14 | 16 | |
| 15 | 17 | public $__temp_query = null; |
| 16 | 18 | public $__product_data = false; |
| @@ -24,12 +26,14 @@ | ||
| 24 | 26 | public function in_elementor() { |
| 25 | 27 | $result = false; |
| 26 | 28 | |
| 27 | 29 | if (wp_doing_ajax()) { |
| 28 | - $result = $this->is_elementor_ajax; | |
| 30 | + $result = isset($this->is_elementor_ajax); | |
| 29 | 31 | } elseif ( |
| 30 | 32 | \Elementor\Plugin::instance()->editor->is_edit_mode() |
| 31 | 33 | || \Elementor\Plugin::instance()->preview->is_preview_mode() |
| 34 | + || Ultimate_Store_Kit_Loader::elementor()->editor->is_edit_mode() | |
| 35 | + || Ultimate_Store_Kit_Loader::elementor()->preview->is_preview_mode() | |
| 32 | 36 | ) { |
| 33 | 37 | $result = true; |
| 34 | 38 | } |
| 35 | 39 | |
| @@ -37,10 +41,12 @@ | ||
| 37 | 41 | } |
| 38 | 42 | |
| 39 | 43 | protected function is_ultimate_builder_editor() { |
| 40 | 44 | |
| 41 | - if (!$this->in_elementor() && !wp_doing_ajax()) return; | |
| 42 | - if (get_post_type() !== Meta::POST_TYPE) return; | |
| 45 | + if (! $this->in_elementor() && ! wp_doing_ajax()) | |
| 46 | + return; | |
| 47 | + if (get_post_type() !== Meta::POST_TYPE) | |
| 48 | + return; | |
| 43 | 49 | |
| 44 | 50 | return true; |
| 45 | 51 | } |
| 46 | 52 | |
| @@ -49,16 +55,16 @@ | ||
| 49 | 55 | * Set editor data for ajax save only |
| 50 | 56 | */ |
| 51 | 57 | public function usk_set_single_post_preview_data() { |
| 52 | 58 | |
| 53 | - if (!$this->is_ultimate_builder_editor()) { | |
| 59 | + if (! $this->is_ultimate_builder_editor()) { | |
| 54 | 60 | return; |
| 55 | 61 | } |
| 56 | 62 | |
| 57 | 63 | global $post; |
| 58 | 64 | |
| 59 | - $templateId = get_transient('ultimate_store_template_id_' . get_current_user_id()); | |
| 60 | - $posts = get_transient('ultimate_store_template_sample_post_' . get_current_user_id()); | |
| 65 | + $templateId = get_transient('ultimate_store_kit_template_id_' . get_current_user_id()); | |
| 66 | + $posts = get_transient('ultimate_store_kit_template_sample_post_' . get_current_user_id()); | |
| 61 | 67 | |
| 62 | 68 | if ($posts instanceof \WP_Query && $posts->have_posts() && $templateId == $post->ID) { |
| 63 | 69 | foreach ($posts->posts as $post) { |
| 64 | 70 | $GLOBALS['post'] = $post; |