PluginProbe
LA-Studio Element Kit for Elementor / trunk
LA-Studio Element Kit for Elementor vtrunk
1.6.2 trunk 1.0.0 1.0.1 1.1.3.6 1.1.4.1 1.1.4.2.1 1.1.5 1.3.6 1.6.0 1.6.1
lastudio-element-kit / lastudio-element-kit.php

lastudio-element-kit.php in LA-Studio Element Kit for Elementor trunk, at lastudio-element-kit.php

808 lines 26.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Plugin Name: LA-Studio Element Kit for Elementor
4 * Plugin URI: https://la-studioweb.com/lastudio-element-kit/
5 * Description: Additional widgets for Elementor page builder. It has 60 highly customizable widgets
6 * Version: 1.6.2
7 * Requires at least: 6.0
8 * Requires PHP: 7.4
9 * Author: LA-Studio
10 * Author URI: https://1.envato.market/POnObq
11 * License: GPL-2.0+
12 * License URI: http://www.gnu.org/licenses/gpl-2.0.txt
13 * Text Domain: lastudio-kit
14 * Domain Path: /languages
15 *
16 * Elementor tested up to: 4.1.5
17 * Elementor Pro tested up to: 4.1.5
18 * WooCommerce tested up to: 10.9.4
19 *
20 * @package lastudio-kit
21 * @author LA-Studio
22 * @license GPL-2.0+
23 * @copyright 2026, LA-Studio
24 */
25
26 // If this file is called directly, abort.
27 if ( ! defined( 'WPINC' ) ) {
28 die;
29 }
30
31 if(!class_exists('LaStudio_Kit')){
32 class LaStudio_Kit{
33 /**
34 * A reference to an instance of this class.
35 *
36 * @since 1.0.0
37 * @access private
38 * @var object
39 */
40 private static $instance = null;
41
42 /**
43 * Holder for base plugin URL
44 *
45 * @since 1.0.0
46 * @access private
47 * @var string
48 */
49 private $plugin_url = null;
50
51 /**
52 * Holder for base plugin path
53 *
54 * @since 1.0.0
55 * @access private
56 * @var string
57 */
58 private $plugin_path = null;
59
60 /**
61 * Plugin version
62 *
63 * @var string
64 */
65 private $version = '1.6.2';
66
67 /**
68 * Framework component
69 *
70 * @since 1.0.0
71 * @access public
72 * @var object
73 */
74 public $module_loader = null;
75
76
77 /**
78 * @var \LaStudioKitThemeBuilder\Modules\Modules_Manager $modules_manager
79 */
80 public $modules_manager;
81
82 /**
83 * @since 2.0.0
84 * @access public
85 * @var \LaStudioKitExtensions\Manager $extensions_manager
86 */
87 public $extensions_manager;
88
89 /**
90 * @var LaStudio_Kit_Ajax_Manager $ajax_manager;
91 */
92 public $ajax_manager;
93
94 /**
95 * Holder for current Customizer module instance.
96 *
97 * @since 1.0.0
98 * @var CX_Customizer
99 */
100 public $customizer = null;
101
102
103 /**
104 * Sets up needed actions/filters for the plugin to initialize.
105 *
106 * @since 1.0.0
107 * @access public
108 * @return void
109 */
110 public function __construct() {
111
112 spl_autoload_register( [ $this, 'autoload' ] );
113
114 // Load the CX Loader.
115 add_action( 'after_setup_theme', array( $this, 'module_loader' ), -20 );
116
117 // load includes
118 add_action( 'after_setup_theme', array( $this, 'includes' ), 4 );
119
120 // init customizer
121 add_action( 'after_setup_theme', array( $this, 'init_customizer' ), 6 );
122
123 // Internationalize the text strings used.
124 add_action( 'init', array( $this, 'lang' ), 0 );
125
126 // Load files.
127 add_action( 'init', array( $this, 'init' ), -999 );
128
129 // Dashboard Init
130 add_action( 'init', array( $this, 'dashboard_init' ), -999 );
131
132 // Add body class
133 add_filter('body_class', array( $this, 'body_class' ), 0);
134
135 add_action('elementor/init', [ $this, 'on_elementor_init' ] );
136
137 add_action('admin_enqueue_scripts', [ $this, 'admin_enqueue'] );
138
139 add_action( 'plugins_loaded', [ $this, 'plugins_loaded' ], 11 );
140
141 // Register handle ajax global
142
143 // Register activation and deactivation hook.
144 register_activation_hook( __FILE__, array( $this, 'activation' ) );
145 register_deactivation_hook( __FILE__, array( $this, 'deactivation' ) );
146
147 // Load handle ajax
148 $this->ajax_manager = new LaStudio_Kit_Ajax_Manager();
149
150 // WPML Integrations
151 add_action( 'init', [ $this, 'solve_wpml_missing_addon' ], -10);
152 }
153
154 /**
155 * Load the theme modules.
156 *
157 * @since 1.0.0
158 */
159 public function module_loader() {
160
161 require $this->plugin_path( 'includes/framework/loader.php' );
162
163 $this->module_loader = new LaStudio_Kit_CX_Loader(
164 array(
165 $this->plugin_path( 'includes/framework/vue-ui/cherry-x-vue-ui.php' ),
166 $this->plugin_path( 'includes/framework/db-updater/cx-db-updater.php' ),
167 $this->plugin_path( 'includes/framework/dashboard/dashboard.php' ),
168 $this->plugin_path( 'includes/framework/interface-builder/interface-builder.php' ),
169 $this->plugin_path( 'includes/framework/post-meta/post-meta.php' ),
170 $this->plugin_path( 'includes/framework/term-meta/term-meta.php' ),
171 $this->plugin_path( 'includes/framework/customizer/customizer.php' ),
172 $this->plugin_path( 'includes/framework/fonts-manager/fonts-manager.php' ),
173 $this->plugin_path( 'includes/class-breadcrumbs.php' ),
174 )
175 );
176
177 // Enable support for Post Formats
178 add_theme_support( 'post-formats', array( 'standard', 'video', 'gallery', 'audio', 'quote', 'link' ) );
179 }
180
181 /**
182 * Load the theme includes
183 */
184 public function includes(){
185 require_once $this->plugin_path( 'includes/class-post-meta.php' );
186 require_once $this->plugin_path( 'includes/class-term-meta.php' );
187 }
188
189 /**
190 * Returns plugin version
191 *
192 * @return string
193 */
194 public function get_version( $basic = false ) {
195
196 if($basic){
197 return $this->version;
198 }
199
200 if(defined('LA_DEBUG') && LA_DEBUG){
201 return time();
202 }
203 return $this->version;
204 }
205
206 /**
207 * Manually init required modules.
208 *
209 * @return void
210 */
211 public function init() {
212 if ( ! $this->has_elementor() ) {
213 add_action( 'admin_notices', array( $this, 'required_plugins_notice' ) );
214 return;
215 }
216
217 $this->load_files();
218
219 lastudio_kit_integration()->init();
220 lastudio_kit_svg_manager()->init();
221
222 //Init Rest Api
223 \LaStudioKit\Rest_Api::get_instance();
224
225 $this->extensions_manager = new LaStudioKitExtensions\Manager();
226
227 do_action( 'lastudio-kit/init', $this );
228 }
229
230 /**
231 * [dashboard_init description]
232 * @return [type] [description]
233 */
234 public function dashboard_init() {
235
236 if ( is_admin() ) {
237
238 \LaStudioKit\Settings::get_instance();
239
240 $lastudio_kit_dashboard_module_data = $this->module_loader->get_included_module_data( 'dashboard.php' );
241
242 $lastudio_kit_dashboard = \LaStudioKit_Dashboard\Dashboard::get_instance();
243
244 $lastudio_kit_dashboard->init( array(
245 'path' => $lastudio_kit_dashboard_module_data['path'],
246 'url' => $lastudio_kit_dashboard_module_data['url'],
247 'cx_ui_instance' => array( $this, 'dashboard_ui_instance_init' ),
248 'plugin_data' => array(
249 'slug' => 'lastudio-kit',
250 'file' => 'lastudio-element-kit/lastudio-element-kit.php',
251 'version' => $this->get_version(),
252 'plugin_links' => array(
253 array(
254 'label' => esc_html__( 'Go to settings', 'lastudio-kit' ),
255 'url' => add_query_arg( array( 'page' => 'lastudio-kit-dashboard-settings-page', 'subpage' => 'lastudio-kit-general-settings' ), admin_url( 'admin.php' ) ),
256 'target' => '_self',
257 ),
258 ),
259 ),
260 ) );
261 }
262 }
263
264 /**
265 * [dashboard_ui_instance_init description]
266 * @return [type] [description]
267 */
268 public function dashboard_ui_instance_init() {
269 $cx_ui_module_data = $this->module_loader->get_included_module_data( 'cherry-x-vue-ui.php' );
270
271 return new CX_Vue_UI( $cx_ui_module_data );
272 }
273
274 /**
275 * Show recommended plugins notice.
276 *
277 * @return void
278 */
279 public function required_plugins_notice() {
280 $screen = get_current_screen();
281
282 if ( isset( $screen->parent_file ) && 'plugins.php' === $screen->parent_file && 'update' === $screen->id ) {
283 return;
284 }
285
286 $plugin = 'elementor/elementor.php';
287
288 $installed_plugins = get_plugins();
289 $is_elementor_installed = isset( $installed_plugins[ $plugin ] );
290
291 if ( $is_elementor_installed ) {
292 if ( ! current_user_can( 'activate_plugins' ) ) {
293 return;
294 }
295
296 $activation_url = wp_nonce_url( 'plugins.php?action=activate&amp;plugin=' . $plugin . '&amp;plugin_status=all&amp;paged=1&amp;s', 'activate-plugin_' . $plugin );
297
298 $message = sprintf( '<p>%s</p>', esc_html__( 'LA-Studio Kit requires Elementor to be activated.', 'lastudio-kit' ) );
299 $message .= sprintf( '<p><a href="%s" class="button-primary">%s</a></p>', $activation_url, esc_html__( 'Activate Elementor Now', 'lastudio-kit' ) );
300 }
301 else {
302 if ( ! current_user_can( 'install_plugins' ) ) {
303 return;
304 }
305
306 $install_url = wp_nonce_url( self_admin_url( 'update.php?action=install-plugin&plugin=elementor' ), 'install-plugin_elementor' );
307
308 $message = sprintf( '<p>%s</p>', esc_html__( 'LA-Studio Kit requires Elementor to be installed.', 'lastudio-kit' ) );
309 $message .= sprintf( '<p><a href="%s" class="button-primary">%s</a></p>', $install_url, esc_html__( 'Install Elementor Now', 'lastudio-kit' ) );
310 }
311
312 printf( '<div class="notice notice-warning is-dismissible">%s</div>', wp_kses( $message, [
313 'p' => [],
314 'a' => [
315 'href' => true,
316 'class' => true,
317 ],
318 ] ) );
319 }
320
321 /**
322 * Check if theme has elementor
323 *
324 * @return boolean
325 */
326 public function has_elementor() {
327 return defined( 'ELEMENTOR_VERSION' );
328 }
329
330 /**
331 * Check if theme has elementor
332 *
333 * @return boolean
334 */
335 public function has_elementor_pro() {
336 return defined( 'ELEMENTOR_PRO_VERSION' );
337 }
338
339 /**
340 * Returns Elementor instance
341 *
342 * @return \Elementor\Plugin
343 */
344 public function elementor() {
345 return \Elementor\Plugin::instance();
346 }
347
348 public function is_elementor_preview(){
349 return (!empty( $_GET['elementor_library'] ) && !empty( $_GET['preview_id'] ) && !empty( $_GET['preview'] ));
350 }
351
352 /**
353 * Load required files.
354 *
355 * @return void
356 */
357 public function load_files() {
358
359 require_once $this->plugin_path( 'includes/class-helper.php' );
360 require_once $this->plugin_path( 'includes/class-integration.php' );
361 require_once $this->plugin_path( 'includes/class-settings.php' );
362 require_once $this->plugin_path( 'includes/settings/manager.php' );
363 require_once $this->plugin_path( 'includes/class-svg-manager.php' );
364
365 require_once $this->plugin_path( 'includes/rest-api/template-helper.php' );
366 require_once $this->plugin_path( 'includes/rest-api/rest-api.php' );
367 require_once $this->plugin_path( 'includes/rest-api/endpoints/base.php' );
368 require_once $this->plugin_path( 'includes/rest-api/endpoints/elementor-template.php' );
369 require_once $this->plugin_path( 'includes/rest-api/endpoints/plugin-settings.php' );
370
371 require_once $this->plugin_path( 'includes/integrations/override.php' );
372 require_once $this->plugin_path( 'includes/integrations/advance.php' );
373
374 }
375
376 /**
377 * Returns path to file or dir inside plugin folder
378 *
379 * @param string $path Path inside plugin dir.
380 * @return string
381 */
382 public function plugin_path( $path = null ) {
383
384 if ( ! $this->plugin_path ) {
385 $this->plugin_path = trailingslashit( plugin_dir_path( __FILE__ ) );
386 }
387
388 return $this->plugin_path . $path;
389 }
390 /**
391 * Returns url to file or dir inside plugin folder
392 *
393 * @param string $path Path inside plugin dir.
394 * @return string
395 */
396 public function plugin_url( $path = null ) {
397
398 if ( ! $this->plugin_url ) {
399 $this->plugin_url = trailingslashit( plugin_dir_url( __FILE__ ) );
400 }
401
402 return $this->plugin_url . $path;
403 }
404
405 /**
406 * Loads the translation files.
407 *
408 * @since 1.0.0
409 * @access public
410 * @return void
411 */
412 public function lang() {
413 load_plugin_textdomain( 'lastudio-kit', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );
414 }
415
416 /**
417 * Get the template path.
418 *
419 * @return string
420 */
421 public function template_path() {
422 return apply_filters( 'lastudio-kit/template-path', 'lastudio-kit/' );
423 }
424
425 /**
426 * Returns path to template file.
427 *
428 * @return string|bool
429 */
430 public function get_template( $name = null ) {
431
432 if ( empty($name) || ! is_string($name) ) {
433 return false;
434 }
435
436 $name = \LaStudio_Kit_Helper::sanitize_template_string($name);
437
438 if ( pathinfo($name, PATHINFO_EXTENSION) !== 'php' ) {
439 return false;
440 }
441
442 $pathname = $this->template_path() . $name;
443
444 $template = locate_template($pathname);
445
446 if ( empty($template) ) {
447 $template = $this->plugin_path('templates/' . $name);
448 }
449
450 if (
451 ! empty($template)
452 && is_string($template)
453 && is_readable($template)
454 ) {
455 return $template;
456 }
457
458 return false;
459 }
460
461 /**
462 * Do some stuff on plugin activation
463 *
464 * @since 1.0.0
465 * @return void
466 */
467 public static function activation() {
468 }
469
470 /**
471 * Do some stuff on plugin activation
472 *
473 * @since 1.0.0
474 * @return void
475 */
476 public static function deactivation() {
477 }
478
479 /**
480 *
481 * Add custom css class into body tag
482 *
483 * @param $classes
484 * @return array
485 */
486 public function body_class( $classes ){
487 if(!is_rtl()){
488 $classes[] = 'ltr';
489 }
490 return $classes;
491 }
492
493 public function on_elementor_init(){
494 $this->modules_manager = new \LaStudioKitThemeBuilder\Modules\Modules_Manager();
495 }
496
497 public function admin_enqueue(){
498 wp_enqueue_style(
499 'lastudio-kit-admin-css',
500 $this->plugin_url( 'assets/css/lastudio-kit-admin.css' ),
501 false,
502 $this->get_version()
503 );
504 wp_enqueue_script(
505 'lastudio-kit-admin',
506 $this->plugin_url('assets/js/lastudio-kit-admin.js'),
507 array( 'jquery' ),
508 $this->get_version(),
509 true
510 );
511 }
512
513 public static function get_instance() {
514 // If the single instance hasn't been set, set it now.
515 if ( null == self::$instance ) {
516 self::$instance = new self;
517 }
518 return self::$instance;
519 }
520
521 public function autoload( $class ) {
522
523 $mappings = [
524 'LaStudio_Kit_Ajax_Manager' => 'includes/modules/ajax/manager.php',
525 'LaStudioKitThemeBuilder_AdminApp' => 'includes/modules/admin-app/admin-app.php',
526 'Elementor\LaStudioKit_Base' => 'includes/base/class-widget-base.php'
527 ];
528
529 if( array_key_exists( $class, $mappings ) ){
530 if ( ! class_exists( $class, false ) ) {
531 $filename = $this->plugin_path($mappings[$class]);
532 if ( is_readable( $filename ) ) {
533 include( $filename );
534 }
535 }
536 return;
537 }
538
539 if (str_starts_with($class, 'Elementor\LaStudioKit_')) {
540 if ( ! class_exists( $class, false ) ) {
541 $class = str_replace('Elementor\LaStudioKit_', '', $class);
542 $file_addons = strtolower(
543 preg_replace(
544 [ '/^' . 'LaStudioKit_' . '\\\/', '/([a-z])([A-Z])/', '/_/', '/\\\/' ],
545 [ '', '$1-$2', '-', DIRECTORY_SEPARATOR ],
546 $class
547 )
548 );
549 $_file_one = $this->plugin_path('includes/addons/' . $file_addons . '.php');
550 $_file_two = $this->plugin_path('includes/addons/vendor/' . $file_addons . '.php');
551 if(is_readable( $_file_one )){
552 include $_file_one;
553 }
554 elseif (is_readable( $_file_two )){
555 include $_file_two;
556 }
557 }
558 return;
559 }
560
561 if (str_starts_with($class, 'LaStudioKitExtensions')) {
562
563 if ( ! class_exists( $class, false ) ) {
564 $filename_extends = strtolower(
565 preg_replace(
566 [ '/^' . 'LaStudioKitExtensions' . '\\\/', '/([a-z])([A-Z])/', '/_/', '/\\\/' ],
567 [ '', '$1-$2', '-', DIRECTORY_SEPARATOR ],
568 $class
569 )
570 );
571 $filename_extends = $this->plugin_path('includes/extensions/' . $filename_extends . '.php');
572
573 if ( is_readable( $filename_extends ) ) {
574 include( $filename_extends );
575 }
576 }
577 return;
578 }
579
580 if (str_starts_with($class, 'LaStudioKitIntegrations')) {
581
582 if ( ! class_exists( $class, false ) ) {
583 $filename_extends = strtolower(
584 preg_replace(
585 [ '/^' . 'LaStudioKitIntegrations' . '\\\/', '/([a-z])([A-Z])/', '/_/', '/\\\/' ],
586 [ '', '$1-$2', '-', DIRECTORY_SEPARATOR ],
587 $class
588 )
589 );
590 $filename_extends = $this->plugin_path('includes/integrations/' . $filename_extends . '.php');
591
592 if ( is_readable( $filename_extends ) ) {
593 include( $filename_extends );
594 }
595 }
596 return;
597 }
598
599 if (!str_starts_with($class, 'LaStudioKitThemeBuilder')) {
600 return;
601 }
602
603 if ( ! class_exists( $class, false ) ) {
604
605 $filename = strtolower(
606 preg_replace(
607 [ '/^' . 'LaStudioKitThemeBuilder' . '\\\/', '/([a-z])([A-Z])/', '/_/', '/\\\/' ],
608 [ '', '$1-$2', '-', DIRECTORY_SEPARATOR ],
609 $class
610 )
611 );
612
613 $filename = $this->plugin_path('includes/' . $filename . '.php');
614
615 if ( is_readable( $filename ) ) {
616 include( $filename );
617 }
618 }
619
620 }
621
622 public function get_theme_support( $prop = '', $default = null ) {
623 $theme_support = get_theme_support( 'lastudio' );
624 $theme_support = is_array( $theme_support ) ? $theme_support[0] : false;
625
626 if ( ! $theme_support ) {
627 return $default;
628 }
629
630 if ( $prop ) {
631 $prop_stack = explode( '::', $prop );
632 $prop_key = array_shift( $prop_stack );
633
634 if ( isset( $theme_support[ $prop_key ] ) ) {
635 $value = $theme_support[ $prop_key ];
636
637 if ( count( $prop_stack ) ) {
638 foreach ( $prop_stack as $prop_key ) {
639 if ( is_array( $value ) && isset( $value[ $prop_key ] ) ) {
640 $value = $value[ $prop_key ];
641 } else {
642 $value = $default;
643 break;
644 }
645 }
646 }
647 } else {
648 $value = $default;
649 }
650
651 return $value;
652 }
653
654 return $theme_support;
655 }
656
657 public function init_customizer(){
658
659 // Init CX_Customizer
660 $customizer_options = [
661 'prefix' => 'lakit',
662 'path' => $this->plugin_path( 'includes/framework/customizer/' ),
663 'capability' => 'edit_theme_options',
664 'type' => 'theme_mod',
665 'fonts_manager' => new \CX_Fonts_Manager( ['prefix' => 'lakit'] ),
666 'options' => []
667 ];
668
669 $this->customizer = new \CX_Customizer( apply_filters('lastudio-kit/theme/customizer/options', $customizer_options) );
670 }
671
672 public function plugins_loaded(){
673 if( $this->has_elementor() && !$this->has_elementor_pro() ){
674 new LaStudioKitThemeBuilder_AdminApp();
675 }
676 }
677
678 public function is_optimized_css_mode(){
679 return false;
680 }
681
682 public function solve_wpml_missing_addon(){
683 new LaStudioKitIntegrations\WPML\Base();
684 if( !defined('WPML_ST_VERSION') && class_exists('\WPML_Elementor_Translate_IDs_Factory', false)){
685 $factory = new \WPML_Elementor_Translate_IDs_Factory();
686 $integration = $factory->create();
687 $integration->add_hooks();
688 }
689 }
690 }
691 }
692
693 if(!function_exists('lastudio_kit')){
694 /**
695 * Returns instance of the plugin class.
696 *
697 * @since 1.0.0
698 * @return LaStudio_Kit
699 */
700 function lastudio_kit(){
701 return LaStudio_Kit::get_instance();
702 }
703 }
704
705 lastudio_kit();
706
707 if(!function_exists('la_get_wc_script_data')){
708 function la_get_wc_script_data( $handle ){
709 if(!function_exists('WC')){
710 return false;
711 }
712 switch ( $handle ) {
713 case 'wc-add-to-cart-variation':
714 $params = array(
715 'wc_ajax_url' => WC_AJAX::get_endpoint( '%%endpoint%%' ),
716 'i18n_no_matching_variations_text' => esc_attr__( 'Sorry, no products matched your selection. Please choose a different combination.', 'woocommerce' ),
717 'i18n_make_a_selection_text' => esc_attr__( 'Please select some product options before adding this product to your cart.', 'woocommerce' ),
718 'i18n_unavailable_text' => esc_attr__( 'Sorry, this product is unavailable. Please choose a different combination.', 'woocommerce' ),
719 );
720 break;
721 default:
722 $params = false;
723 }
724
725 return $params;
726
727 }
728 }
729
730 if(!function_exists('la_get_polyfill_inline')){
731 function la_get_polyfill_inline( $data = [] ) {
732 $response_data = '';
733 if(!empty($data)){
734 foreach ($data as $handle => $polyfill){
735 if(!empty($polyfill['condition']) && !empty($polyfill['src'])){
736 $src = $polyfill['src'];
737 if ( ! empty( $polyfill['version'] ) ) {
738 $src = add_query_arg( 'ver', $polyfill['version'], $src );
739 }
740 $src = esc_url( apply_filters( 'script_loader_src', $src, $handle ) );
741 if ( ! $src ) {
742 continue;
743 }
744 $response_data .= (
745 // Test presence of feature...
746 '( ' . $polyfill['condition'] . ' ) || ' .
747 /*
748 * ...appending polyfill on any failures. Cautious viewers may balk
749 * at the `document.write`. Its caveat of synchronous mid-stream
750 * blocking write is exactly the behavior we need though.
751 */
752 'document.write( \'<script src="' . $src . '"></scr\' + \'ipt>\' );'
753 );
754 }
755 }
756 }
757 return $response_data;
758 }
759 }
760
761 if(!function_exists('lastudiokit__remove_object_class_filter')){
762 /**
763 *
764 * Remove Class Filter Without Access to Class Object
765 *
766 * @sources
767 * - https://gist.github.com/tripflex/c6518efc1753cf2392559866b4bd1a53#gistcomment-2823505
768 *
769 * @param string $tag Filter to remove
770 * @param string $class_name Class name for the filter's callback
771 * @param string $method_name Method name for the filter's callback
772 * @param int $priority Priority of the filter (default 10)
773 *
774 * @return bool Whether the function is removed.
775 */
776 function lastudiokit__remove_object_class_filter( $tag, $class_name = '', $method_name = '', $priority = 10 ) {
777 if(empty($class_name) || empty($class_name) || empty($tag)){
778 return false;
779 }
780 global $wp_filter;
781 $is_hook_removed = false;
782 if ( ! empty( $wp_filter[ $tag ]->callbacks[ $priority ] ) ) {
783 $methods = array_filter(wp_list_pluck(
784 $wp_filter[ $tag ]->callbacks[ $priority ],
785 'function'
786 ), function ($method) {
787 return is_string($method) || is_array($method);
788 });
789 $found_hooks = ! empty( $methods ) ? wp_list_filter( $methods, array( 1 => $method_name ) ) : array();
790 foreach( $found_hooks as $hook_key => $hook ) {
791 if ( ! empty( $hook[0] ) && is_object( $hook[0] ) && get_class( $hook[0] ) === $class_name ) {
792 $wp_filter[ $tag ]->remove_filter( $tag, $hook, $priority );
793 $is_hook_removed = true;
794 }
795 }
796 }
797 return $is_hook_removed;
798 }
799 }
800
801 add_action('woocommerce_init', function (){
802 if(is_admin() && (isset($_GET['action']) && $_GET['action'] === 'elementor')){
803 lastudiokit__remove_object_class_filter('wp_print_scripts', 'Automattic\WooCommerce\Blocks\Payments\Api', 'verify_payment_methods_dependencies', 1);
804 }
805 if( !empty($_GET['filter_product_brand']) && class_exists('WC_Brands', false) ){
806 lastudiokit__remove_object_class_filter('woocommerce_layered_nav_term_html', 'WC_Brands', 'woocommerce_brands_update_layered_nav_link', 10);
807 }
808 });