royal-elementor-addons
Last commit date
admin
1 year ago
assets
1 year ago
base
1 year ago
classes
1 year ago
extensions
1 year ago
freemius
1 year ago
includes
1 year ago
languages
1 year ago
modules
1 year ago
plugin.php
1 year ago
readme.txt
1 year ago
wpml-config.xml
1 year ago
wpr-addons.php
1 year ago
plugin.php
1052 lines
| 1 | <?php |
| 2 | namespace WprAddons; |
| 3 | |
| 4 | use Elementor\Utils; |
| 5 | use Elementor\Controls_Manager; |
| 6 | use WprAddons\Includes\Controls\WprAjaxSelect2\WPR_Control_Ajax_Select2; |
| 7 | use WprAddons\Includes\Controls\WPR_Control_Animations; |
| 8 | use WprAddons\Includes\Controls\WPR_Control_Animations_Alt; |
| 9 | use WprAddons\Includes\Controls\WPR_Control_Button_Animations; |
| 10 | use WprAddons\Includes\Controls\WPR_Control_Arrow_Icons; |
| 11 | use WprAddons\Classes\Utilities; |
| 12 | use Elementor\Core\App\App; |
| 13 | use WP_REST_Response; |
| 14 | |
| 15 | if ( ! defined( 'ABSPATH' ) ) { exit; } // Exit if accessed directly |
| 16 | |
| 17 | /** |
| 18 | * Main class plugin |
| 19 | */ |
| 20 | class Plugin { |
| 21 | |
| 22 | /** |
| 23 | * @var Plugin |
| 24 | */ |
| 25 | private static $_instance; |
| 26 | |
| 27 | /** |
| 28 | * @var Manager |
| 29 | */ |
| 30 | private $_modules_manager; |
| 31 | |
| 32 | /** |
| 33 | * @var array |
| 34 | */ |
| 35 | private $_localize_settings = []; |
| 36 | |
| 37 | /** |
| 38 | * @return string |
| 39 | */ |
| 40 | public function get_version() { |
| 41 | return WPR_ADDONS_VERSION; |
| 42 | } |
| 43 | |
| 44 | /** |
| 45 | * Throw error on object clone |
| 46 | * |
| 47 | * The whole idea of the singleton design pattern is that there is a single |
| 48 | * object therefore, we don't want the object to be cloned. |
| 49 | * |
| 50 | * @since 1.0 |
| 51 | * @return void |
| 52 | */ |
| 53 | public function __clone() { |
| 54 | // Cloning instances of the class is forbidden |
| 55 | _doing_it_wrong( __FUNCTION__, esc_html__( 'Cheatin huh?', 'wpr-addons' ), '1.0' ); |
| 56 | } |
| 57 | |
| 58 | /** |
| 59 | * Disable unserializing of the class |
| 60 | * |
| 61 | * @since 1.0 |
| 62 | * @return void |
| 63 | */ |
| 64 | public function __wakeup() { |
| 65 | // Unserializing instances of the class is forbidden |
| 66 | _doing_it_wrong( __FUNCTION__, esc_html__( 'Cheatin huh?', 'wpr-addons' ), '1.0' ); |
| 67 | } |
| 68 | |
| 69 | /** |
| 70 | * @return Plugin |
| 71 | */ |
| 72 | public static function instance() { |
| 73 | if ( is_null( self::$_instance ) ) { |
| 74 | self::$_instance = new self(); |
| 75 | } |
| 76 | |
| 77 | return self::$_instance; |
| 78 | } |
| 79 | |
| 80 | private function _includes() { |
| 81 | // Modules Manager |
| 82 | require WPR_ADDONS_PATH . 'includes/modules-manager.php'; |
| 83 | |
| 84 | // Custom Controls |
| 85 | require WPR_ADDONS_PATH . 'includes/controls/wpr-ajax-select2/wpr-control-ajax-select2.php'; |
| 86 | require WPR_ADDONS_PATH . 'includes/controls/wpr-ajax-select2/wpr-control-ajax-select2-api.php'; |
| 87 | require WPR_ADDONS_PATH . 'includes/controls/wpr-control-animations.php'; |
| 88 | require WPR_ADDONS_PATH . 'includes/controls/wpr-control-icons.php'; |
| 89 | |
| 90 | // Templates Library |
| 91 | require WPR_ADDONS_PATH . 'admin/includes/wpr-templates-library.php'; |
| 92 | |
| 93 | // Post Likes |
| 94 | require WPR_ADDONS_PATH . 'classes/modules/wpr-post-likes.php'; |
| 95 | |
| 96 | // Ajax Search |
| 97 | require WPR_ADDONS_PATH . 'classes/modules/wpr-ajax-search.php'; |
| 98 | |
| 99 | |
| 100 | require WPR_ADDONS_PATH . 'classes/modules/wpr-load-more-instagram-posts.php'; |
| 101 | |
| 102 | |
| 103 | require WPR_ADDONS_PATH . 'classes/modules/wpr-load-more-tweets.php'; |
| 104 | |
| 105 | // Meta Keys |
| 106 | require WPR_ADDONS_PATH . 'classes/wpr-custom-meta-keys.php'; |
| 107 | |
| 108 | // Particles |
| 109 | if ( 'on' === get_option('wpr-particles', 'on') ) {//TODO: make this check automatic(loop through) for all extensions |
| 110 | require WPR_ADDONS_PATH . 'extensions/wpr-particles.php'; |
| 111 | } |
| 112 | |
| 113 | // Parallax |
| 114 | if ( 'on' === get_option('wpr-parallax-background', 'on') || 'on' === get_option('wpr-parallax-multi-layer', 'on') ) { |
| 115 | require WPR_ADDONS_PATH . 'extensions/wpr-parallax.php'; |
| 116 | } |
| 117 | |
| 118 | // Sticky Header |
| 119 | if ( 'on' === get_option('wpr-sticky-section', 'on') ) { |
| 120 | require WPR_ADDONS_PATH . 'extensions/wpr-sticky-section.php'; |
| 121 | } |
| 122 | |
| 123 | // Custom CSS |
| 124 | if ( 'on' === get_option('wpr-custom-css', 'on') ) { |
| 125 | require WPR_ADDONS_PATH . 'extensions/wpr-custom-css.php'; |
| 126 | } |
| 127 | |
| 128 | // Mega Menu |
| 129 | require WPR_ADDONS_PATH . 'admin/mega-menu.php'; |
| 130 | |
| 131 | |
| 132 | // Form Builder |
| 133 | // TODO:: ommit if form builder turned off if possible |
| 134 | require WPR_ADDONS_PATH . 'classes/modules/wpr-form-handlers.php'; |
| 135 | |
| 136 | // Admin Files |
| 137 | if ( is_admin() ) { |
| 138 | if ( get_option('wpr_hide_banners') !== 'on' ) { |
| 139 | // Pro Features Notice |
| 140 | require WPR_ADDONS_PATH . 'admin/notices/pro-features-notice.php'; |
| 141 | |
| 142 | // Plugin Update Notice |
| 143 | require WPR_ADDONS_PATH . 'admin/notices/plugin-update-notice.php'; |
| 144 | |
| 145 | // Plugin Sale Notice |
| 146 | require WPR_ADDONS_PATH . 'admin/notices/plugin-sale-notice.php'; |
| 147 | |
| 148 | // Rating Notice |
| 149 | require WPR_ADDONS_PATH . 'admin/notices/rating-notice.php'; |
| 150 | } |
| 151 | |
| 152 | // Plugin Options |
| 153 | require WPR_ADDONS_PATH . 'admin/plugin-options.php'; |
| 154 | |
| 155 | // Templates Kit |
| 156 | require WPR_ADDONS_PATH . 'admin/templates-kit.php'; |
| 157 | |
| 158 | // Theme Builder |
| 159 | require WPR_ADDONS_PATH . 'admin/theme-builder.php'; |
| 160 | |
| 161 | // Premade Blocks |
| 162 | require WPR_ADDONS_PATH . 'admin/premade-blocks.php'; |
| 163 | |
| 164 | // Theme Builder |
| 165 | require WPR_ADDONS_PATH . 'admin/popups.php'; |
| 166 | |
| 167 | // Secondary Image |
| 168 | require WPR_ADDONS_PATH . 'admin/metabox/wpr-secondary-image.php'; |
| 169 | |
| 170 | // Dropdown Category Filter for Wpr Templates |
| 171 | require WPR_ADDONS_PATH . 'admin/includes/wpr-templates-category-filter.php'; |
| 172 | |
| 173 | // Hide Theme Notice |
| 174 | // TODO: Remove this and fix with Transients |
| 175 | add_action( 'admin_enqueue_scripts', [ $this, 'hide_theme_notice' ] ); |
| 176 | } |
| 177 | |
| 178 | if ( class_exists('WooCommerce') ) { |
| 179 | if ( 'on' === get_option('wpr_override_woo_templates', 'on') ) { |
| 180 | require WPR_ADDONS_PATH . 'includes/woocommerce/woocommerce-config.php'; |
| 181 | } |
| 182 | |
| 183 | // Add Remove From Wishlist |
| 184 | require WPR_ADDONS_PATH . 'classes/woocommerce/wpr-add-remove-from-wishlist.php'; |
| 185 | |
| 186 | // Add Remove From Compare |
| 187 | require WPR_ADDONS_PATH . 'classes/woocommerce/wpr-add-remove-from-compare.php'; |
| 188 | |
| 189 | // Update Mini Wishlist |
| 190 | require WPR_ADDONS_PATH . 'classes/woocommerce/wpr-update-mini-wishlist.php'; |
| 191 | |
| 192 | // Compare Popup Action |
| 193 | require WPR_ADDONS_PATH . 'classes/woocommerce/wpr-compare-popup-action.php'; |
| 194 | |
| 195 | // Add Remove From Compare |
| 196 | require WPR_ADDONS_PATH . 'classes/woocommerce/wpr-update-mini-compare.php'; |
| 197 | |
| 198 | // Count Wishlist Items |
| 199 | require WPR_ADDONS_PATH . 'classes/woocommerce/wpr-count-wishlist-compare-items.php'; |
| 200 | require WPR_ADDONS_PATH . 'classes/woocommerce/wpr-check-product-in-wc.php'; |
| 201 | } |
| 202 | } |
| 203 | |
| 204 | public function autoload( $class ) { |
| 205 | if ( 0 !== strpos( $class, __NAMESPACE__ ) ) { |
| 206 | return; |
| 207 | } |
| 208 | |
| 209 | $filename = strtolower( |
| 210 | preg_replace( |
| 211 | [ '/^' . __NAMESPACE__ . '\\\/', '/([a-z])([A-Z])/', '/_/', '/\\\/' ], |
| 212 | [ '', '$1-$2', '-', DIRECTORY_SEPARATOR ], |
| 213 | $class |
| 214 | ) |
| 215 | ); |
| 216 | $filename = WPR_ADDONS_PATH . $filename . '.php'; |
| 217 | |
| 218 | if ( is_readable( $filename ) ) { |
| 219 | include( $filename ); |
| 220 | } |
| 221 | } |
| 222 | |
| 223 | public function get_localize_settings() { |
| 224 | return $this->_localize_settings; |
| 225 | } |
| 226 | |
| 227 | public function add_localize_settings( $setting_key, $setting_value = null ) { |
| 228 | if ( is_array( $setting_key ) ) { |
| 229 | $this->_localize_settings = array_replace_recursive( $this->_localize_settings, $setting_key ); |
| 230 | |
| 231 | return; |
| 232 | } |
| 233 | |
| 234 | if ( ! is_array( $setting_value ) || ! isset( $this->_localize_settings[ $setting_key ] ) || ! is_array( $this->_localize_settings[ $setting_key ] ) ) { |
| 235 | $this->_localize_settings[ $setting_key ] = $setting_value; |
| 236 | |
| 237 | return; |
| 238 | } |
| 239 | |
| 240 | $this->_localize_settings[ $setting_key ] = array_replace_recursive( $this->_localize_settings[ $setting_key ], $setting_value ); |
| 241 | } |
| 242 | |
| 243 | public function script_suffix() { |
| 244 | // $dir = is_rtl() ? '-rtl' : ''; |
| 245 | return defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min'; |
| 246 | } |
| 247 | |
| 248 | public function register_ajax_hooks() { |
| 249 | add_action( 'wp_ajax_mailchimp_subscribe', [new Utilities, 'ajax_mailchimp_subscribe'] ); |
| 250 | add_action( 'wp_ajax_nopriv_mailchimp_subscribe', [new Utilities, 'ajax_mailchimp_subscribe'] ); |
| 251 | } |
| 252 | |
| 253 | public function mega_menu_ajax_loading() { |
| 254 | $elementor = \Elementor\Plugin::instance(); |
| 255 | $mega_id = get_post_meta( $_GET['item_id'], 'wpr-mega-menu-item', true); |
| 256 | $content = $elementor->frontend->get_builder_content_for_display($mega_id); |
| 257 | |
| 258 | wp_send_json( $content ); |
| 259 | } |
| 260 | |
| 261 | public function register_megamenu_route() { |
| 262 | add_action( 'rest_api_init', function() { |
| 263 | register_rest_route( |
| 264 | 'wpraddons/v1', |
| 265 | '/wprmegamenu/', |
| 266 | [ |
| 267 | 'methods' => 'GET', |
| 268 | 'callback' => [$this, 'mega_menu_ajax_loading'], |
| 269 | 'permission_callback' => '__return_true' |
| 270 | ] |
| 271 | ); |
| 272 | } ); |
| 273 | } |
| 274 | |
| 275 | public function register_custom_controls() { |
| 276 | |
| 277 | $controls_manager = \Elementor\Plugin::$instance->controls_manager; |
| 278 | $controls_manager->register( new WPR_Control_Ajax_Select2() ); |
| 279 | $controls_manager->register( new WPR_Control_Animations() ); |
| 280 | $controls_manager->register( new WPR_Control_Animations_Alt() ); |
| 281 | $controls_manager->register( new WPR_Control_Button_Animations() ); |
| 282 | $controls_manager->register( new WPR_Control_Arrow_Icons() ); |
| 283 | |
| 284 | } |
| 285 | |
| 286 | public function register_elementor_document_type( $documents_manager ) { |
| 287 | // Theme Builder |
| 288 | require WPR_ADDONS_PATH . 'modules/theme-builder/wpr-theme-builder.php'; |
| 289 | $documents_manager->register_document_type( 'wpr-theme-builder', 'Wpr_Theme_Builder' ); |
| 290 | |
| 291 | // Popups |
| 292 | require WPR_ADDONS_PATH . 'modules/popup/wpr-popup.php'; |
| 293 | |
| 294 | if ( wpr_fs()->can_use_premium_code() && defined('WPR_ADDONS_PRO_VERSION') ) { |
| 295 | require WPR_ADDONS_PRO_PATH . 'modules/popup-pro/wpr-popup-pro.php'; |
| 296 | $documents_manager->register_document_type( 'wpr-popups', 'Wpr_Popup_Pro' ); |
| 297 | } else { |
| 298 | $documents_manager->register_document_type( 'wpr-popups', 'Wpr_Popup' ); |
| 299 | } |
| 300 | } |
| 301 | |
| 302 | public function enqueue_styles() { |
| 303 | |
| 304 | wp_register_style( |
| 305 | 'wpr-animations-css', |
| 306 | WPR_ADDONS_URL . 'assets/css/lib/animations/wpr-animations'. $this->script_suffix() .'.css', |
| 307 | [], |
| 308 | Plugin::instance()->get_version() |
| 309 | ); |
| 310 | |
| 311 | wp_register_style( |
| 312 | 'wpr-link-animations-css', |
| 313 | WPR_ADDONS_URL . 'assets/css/lib/animations/wpr-link-animations'. $this->script_suffix() .'.css', |
| 314 | [], |
| 315 | Plugin::instance()->get_version() |
| 316 | ); |
| 317 | |
| 318 | wp_register_style( |
| 319 | 'wpr-loading-animations-css', |
| 320 | WPR_ADDONS_URL . 'assets/css/lib/animations/loading-animations'. $this->script_suffix() .'.css', |
| 321 | [], |
| 322 | Plugin::instance()->get_version() |
| 323 | ); |
| 324 | |
| 325 | wp_register_style( |
| 326 | 'wpr-button-animations-css', |
| 327 | WPR_ADDONS_URL . 'assets/css/lib/animations/button-animations'. $this->script_suffix() .'.css', |
| 328 | [], |
| 329 | Plugin::instance()->get_version() |
| 330 | ); |
| 331 | |
| 332 | // GOGA - enqueue instead of register (because of animations) |
| 333 | wp_enqueue_style( |
| 334 | 'wpr-text-animations-css', |
| 335 | WPR_ADDONS_URL . 'assets/css/lib/animations/text-animations'. $this->script_suffix() .'.css', |
| 336 | [], |
| 337 | Plugin::instance()->get_version() |
| 338 | ); |
| 339 | |
| 340 | wp_register_style( |
| 341 | 'wpr-lightgallery-css', |
| 342 | WPR_ADDONS_URL . 'assets/css/lib/lightgallery/lightgallery'. $this->script_suffix() .'.css', |
| 343 | [], |
| 344 | Plugin::instance()->get_version() |
| 345 | ); |
| 346 | |
| 347 | // Posts Timeline |
| 348 | wp_register_style( |
| 349 | 'wpr-aos-css', |
| 350 | WPR_ADDONS_URL . 'assets/css/lib/aos/aos.min.css', |
| 351 | [] |
| 352 | ); |
| 353 | |
| 354 | wp_register_style( |
| 355 | 'wpr-flipster-css', |
| 356 | WPR_ADDONS_URL . 'assets/css/lib/flipster/jquery.flipster.min.css', |
| 357 | [], |
| 358 | Plugin::instance()->get_version() |
| 359 | ); |
| 360 | |
| 361 | wp_enqueue_style( |
| 362 | 'wpr-addons-css', |
| 363 | WPR_ADDONS_URL . 'assets/css/frontend'. $this->script_suffix() .'.css', |
| 364 | [], |
| 365 | Plugin::instance()->get_version() |
| 366 | ); |
| 367 | |
| 368 | // Load FontAwesome - TODO: Check if necessary (maybe elementor is already loading this) |
| 369 | wp_enqueue_style( |
| 370 | 'font-awesome-5-all', |
| 371 | ELEMENTOR_ASSETS_URL . 'lib/font-awesome/css/all'. $this->script_suffix() .'.css', |
| 372 | false, |
| 373 | Plugin::instance()->get_version() |
| 374 | ); |
| 375 | |
| 376 | if ( \Elementor\Plugin::$instance->preview->is_preview_mode() ) { |
| 377 | wp_enqueue_style( |
| 378 | 'wpr-addons-library-frontend-css', |
| 379 | WPR_ADDONS_URL . 'assets/css/admin/library-frontend'. $this->script_suffix() .'.css', |
| 380 | [], |
| 381 | Plugin::instance()->get_version() |
| 382 | ); |
| 383 | } |
| 384 | } |
| 385 | |
| 386 | public function enqueue_editor_styles() { |
| 387 | |
| 388 | wp_enqueue_style( |
| 389 | 'wpr-animations-css', |
| 390 | WPR_ADDONS_URL . 'assets/css/lib/animations/wpr-animations'. $this->script_suffix() .'.css', |
| 391 | [], |
| 392 | Plugin::instance()->get_version() |
| 393 | ); |
| 394 | |
| 395 | wp_enqueue_style( |
| 396 | 'wpr-animations-link-css', |
| 397 | WPR_ADDONS_URL . 'assets/css/lib/animations/wpr-link-animations'. $this->script_suffix() .'.css', |
| 398 | [], |
| 399 | Plugin::instance()->get_version() |
| 400 | ); |
| 401 | |
| 402 | wp_enqueue_style( |
| 403 | 'wpr-loading-animations-css', |
| 404 | WPR_ADDONS_URL . 'assets/css/lib/animations/loading-animations'. $this->script_suffix() .'.css', |
| 405 | [], |
| 406 | Plugin::instance()->get_version() |
| 407 | ); |
| 408 | |
| 409 | wp_enqueue_style( |
| 410 | 'wpr-button-animations-css', |
| 411 | WPR_ADDONS_URL . 'assets/css/lib/animations/button-animations'. $this->script_suffix() .'.css', |
| 412 | [], |
| 413 | Plugin::instance()->get_version() |
| 414 | ); |
| 415 | |
| 416 | wp_enqueue_style( |
| 417 | 'wpr-text-animations-css', |
| 418 | WPR_ADDONS_URL . 'assets/css/lib/animations/text-animations'. $this->script_suffix() .'.css', |
| 419 | [], |
| 420 | Plugin::instance()->get_version() |
| 421 | ); |
| 422 | |
| 423 | wp_enqueue_style( |
| 424 | 'wpr-aos-css', |
| 425 | WPR_ADDONS_URL . 'assets/css/lib/aos/aos.min.css', |
| 426 | [] |
| 427 | ); |
| 428 | |
| 429 | wp_enqueue_style( |
| 430 | 'wpr-flipster-css', |
| 431 | WPR_ADDONS_URL . 'assets/css/lib/flipster/jquery.flipster.min.css', |
| 432 | [], |
| 433 | Plugin::instance()->get_version() |
| 434 | ); |
| 435 | } |
| 436 | |
| 437 | public function hide_theme_notice() { |
| 438 | wp_enqueue_style( 'hide-theme-notice', WPR_ADDONS_URL .'assets/css/admin/wporg-theme-notice.css', [] ); |
| 439 | |
| 440 | wp_enqueue_script( |
| 441 | 'wpr-plugin-notice-js', |
| 442 | WPR_ADDONS_URL . 'assets/js/admin/plugin-update-notice.js', |
| 443 | [ |
| 444 | 'jquery' |
| 445 | ] |
| 446 | ); |
| 447 | |
| 448 | // wp_enqueue_script( |
| 449 | // 'wpr-wrong-update-js', |
| 450 | // WPR_ADDONS_URL . 'assets/js/admin/wrong-update.js', |
| 451 | // [ |
| 452 | // 'jquery' |
| 453 | // ] |
| 454 | // ); |
| 455 | |
| 456 | wp_localize_script( |
| 457 | 'wpr-plugin-notice-js', |
| 458 | 'WprPluginNotice', |
| 459 | [ |
| 460 | 'ajaxurl' => admin_url( 'admin-ajax.php' ), |
| 461 | 'nonce' => wp_create_nonce( 'wpr-plugin-notice-js' ), |
| 462 | ] |
| 463 | ); |
| 464 | } |
| 465 | |
| 466 | public function enqueue_scripts() { |
| 467 | |
| 468 | wp_enqueue_script( |
| 469 | 'wpr-addons-js', |
| 470 | WPR_ADDONS_URL . 'assets/js/frontend'. $this->script_suffix() .'.js', |
| 471 | [ |
| 472 | 'jquery', |
| 473 | 'elementor-frontend' |
| 474 | ], |
| 475 | Plugin::instance()->get_version(), |
| 476 | true |
| 477 | ); |
| 478 | |
| 479 | wp_enqueue_script( |
| 480 | 'wpr-modal-popups-js', |
| 481 | WPR_ADDONS_URL . 'assets/js/modal-popups'. $this->script_suffix() .'.js', |
| 482 | [ |
| 483 | 'jquery', |
| 484 | ], |
| 485 | Plugin::instance()->get_version(), |
| 486 | true |
| 487 | ); |
| 488 | |
| 489 | wp_localize_script( |
| 490 | 'wpr-addons-js', |
| 491 | 'WprConfig', // This is used in the js file to group all of your scripts together |
| 492 | [ |
| 493 | 'ajaxurl' => admin_url( 'admin-ajax.php' ), |
| 494 | 'resturl' => get_rest_url() . 'wpraddons/v1', |
| 495 | 'nonce' => wp_create_nonce( 'wpr-addons-js' ), |
| 496 | 'addedToCartText' => esc_html__('was added to cart', 'wpr-addons'), |
| 497 | 'viewCart' => esc_html__('View Cart', 'wpr-addons'), |
| 498 | 'comparePageID' => get_option('wpr_compare_page'), |
| 499 | 'comparePageURL' => get_permalink(get_option('wpr_compare_page')), |
| 500 | 'wishlistPageID' => get_option('wpr_wishlist_page'), |
| 501 | 'wishlistPageURL' => get_permalink(get_option('wpr_wishlist_page')), |
| 502 | 'chooseQuantityText' => esc_html__('Please select the required number of items.', 'wpr-addons'), |
| 503 | 'site_key' => get_option('wpr_recaptcha_v3_site_key'), |
| 504 | 'is_admin' => current_user_can('manage_options'), |
| 505 | 'input_empty' => esc_html__('Please fill out this field', 'wpr-addons'), |
| 506 | 'select_empty' => esc_html__('Nothing selected', 'wpr-addons'), |
| 507 | 'file_empty' => esc_html__('Please upload a file', 'wpr-addons'), |
| 508 | 'recaptcha_error' => esc_html__('Recaptcha Error', 'wpr-addons') |
| 509 | ] |
| 510 | ); |
| 511 | } |
| 512 | |
| 513 | public function register_scripts() { |
| 514 | |
| 515 | wp_register_script( |
| 516 | 'wpr-infinite-scroll', |
| 517 | WPR_ADDONS_URL . 'assets/js/lib/infinite-scroll/infinite-scroll.min.js', |
| 518 | [ |
| 519 | 'jquery', |
| 520 | ], |
| 521 | '3.0.5', |
| 522 | true |
| 523 | ); |
| 524 | |
| 525 | wp_register_script( |
| 526 | 'wpr-isotope', |
| 527 | WPR_ADDONS_URL . 'assets/js/lib/isotope/isotope'. $this->script_suffix() .'.js', |
| 528 | [ |
| 529 | 'jquery', |
| 530 | ], |
| 531 | '3.0.8', |
| 532 | true |
| 533 | ); |
| 534 | |
| 535 | wp_register_script( |
| 536 | 'wpr-slick', |
| 537 | WPR_ADDONS_URL . 'assets/js/lib/slick/slick'. $this->script_suffix() .'.js', |
| 538 | [ |
| 539 | 'jquery', |
| 540 | ], |
| 541 | '1.8.1', |
| 542 | true |
| 543 | ); |
| 544 | |
| 545 | wp_register_script( |
| 546 | 'wpr-lightgallery', |
| 547 | WPR_ADDONS_URL . 'assets/js/lib/lightgallery/lightgallery'. $this->script_suffix() .'.js', |
| 548 | [ |
| 549 | 'jquery', |
| 550 | ], |
| 551 | '1.6.12', |
| 552 | true |
| 553 | ); |
| 554 | |
| 555 | wp_register_script( |
| 556 | 'wpr-marquee', |
| 557 | WPR_ADDONS_URL . 'assets/js/lib/marquee/marquee'. $this->script_suffix() .'.js', |
| 558 | [ |
| 559 | 'jquery', |
| 560 | ], |
| 561 | '1.0', |
| 562 | true |
| 563 | ); |
| 564 | |
| 565 | wp_register_script( |
| 566 | 'wpr-google-maps', |
| 567 | 'https://maps.googleapis.com/maps/api/js?key='. esc_attr(get_option('wpr_google_map_api_key')), |
| 568 | [], |
| 569 | '', |
| 570 | true |
| 571 | ); |
| 572 | |
| 573 | wp_register_script( |
| 574 | 'wpr-google-maps-clusters', |
| 575 | WPR_ADDONS_URL . 'assets/js/lib/gmap/markerclusterer'. $this->script_suffix() .'.js', |
| 576 | [], |
| 577 | '1.0.3', |
| 578 | true |
| 579 | ); |
| 580 | |
| 581 | wp_register_script( |
| 582 | 'jquery-event-move', |
| 583 | WPR_ADDONS_URL . 'assets/js/lib/jquery-event-move/jquery.event.move'. $this->script_suffix() .'.js', |
| 584 | [], |
| 585 | '2.0', |
| 586 | true |
| 587 | ); |
| 588 | |
| 589 | wp_register_script( |
| 590 | 'wpr-lottie-animations', |
| 591 | WPR_ADDONS_URL . 'assets/js/lib/lottie/lottie.min.js', |
| 592 | [], |
| 593 | '5.8.0', |
| 594 | true |
| 595 | ); |
| 596 | |
| 597 | wp_register_script( |
| 598 | 'wpr-table-to-excel-js', |
| 599 | WPR_ADDONS_URL . 'assets/js/lib/tableToExcel/tableToExcel.js', |
| 600 | [], |
| 601 | null, |
| 602 | true |
| 603 | ); |
| 604 | |
| 605 | wp_register_script( |
| 606 | 'wpr-aos-js', |
| 607 | WPR_ADDONS_URL . 'assets/js/lib/aos/aos.min.js', |
| 608 | [], |
| 609 | null, |
| 610 | true |
| 611 | ); |
| 612 | |
| 613 | wp_register_script( |
| 614 | 'wpr-charts', |
| 615 | WPR_ADDONS_URL . 'assets/js/lib/charts/charts.min.js', |
| 616 | [], |
| 617 | '3.7.0', |
| 618 | true |
| 619 | ); |
| 620 | |
| 621 | wp_register_script( |
| 622 | 'wpr-flipster', |
| 623 | WPR_ADDONS_URL . 'assets/js/lib/flipster/jquery.flipster.min.js', |
| 624 | [], |
| 625 | '2.0', |
| 626 | true |
| 627 | ); |
| 628 | |
| 629 | wp_register_script( |
| 630 | 'wpr-perfect-scroll-js', |
| 631 | WPR_ADDONS_URL .'assets/js/lib/perfect-scrollbar/perfect-scrollbar.min.js', |
| 632 | [ 'jquery' ], |
| 633 | '0.4.9' |
| 634 | ); |
| 635 | } |
| 636 | |
| 637 | public function enqueue_panel_scripts() { |
| 638 | |
| 639 | wp_enqueue_script( |
| 640 | 'wpr-addons-editor-js', |
| 641 | WPR_ADDONS_URL . 'assets/js/admin/editor'. $this->script_suffix() .'.js', |
| 642 | [ 'jquery', 'wp-i18n' ], |
| 643 | Plugin::instance()->get_version(), |
| 644 | true |
| 645 | ); |
| 646 | |
| 647 | $args = ['nonce' => wp_create_nonce( 'wpr-addons-editor-js' ), 'adminURL' => admin_url(), 'isWooCommerceActive' => class_exists('WooCommerce') ? true : false]; |
| 648 | |
| 649 | $args = array_merge($args, Utilities::get_registered_modules()); |
| 650 | |
| 651 | wp_localize_script( |
| 652 | 'wpr-addons-editor-js', |
| 653 | 'registered_modules', |
| 654 | $args |
| 655 | ); |
| 656 | } |
| 657 | |
| 658 | public function enqueue_inner_panel_scripts() { |
| 659 | |
| 660 | wp_enqueue_script( |
| 661 | 'wpr-macy-js', |
| 662 | WPR_ADDONS_URL . 'assets/js/lib/macy/macy.js', |
| 663 | [], |
| 664 | '3.0.6', |
| 665 | true |
| 666 | ); |
| 667 | |
| 668 | wp_enqueue_script( |
| 669 | 'wpr-addons-library-frontend-js', |
| 670 | WPR_ADDONS_URL . 'assets/js/admin/library-frontend'. $this->script_suffix() .'.js', |
| 671 | [ 'jquery', 'wpr-macy-js' ], |
| 672 | Plugin::instance()->get_version(), |
| 673 | true |
| 674 | ); |
| 675 | |
| 676 | wp_localize_script( |
| 677 | 'wpr-addons-library-frontend-js', |
| 678 | 'white_label', |
| 679 | [ |
| 680 | 'logo_url' => !empty(get_option('wpr_wl_plugin_logo')) ? esc_url(wp_get_attachment_image_src(get_option('wpr_wl_plugin_logo'), 'full')[0]) : WPR_ADDONS_ASSETS_URL .'img/logo-40x40.png' |
| 681 | ] |
| 682 | ); |
| 683 | |
| 684 | wp_localize_script( |
| 685 | 'wpr-addons-library-frontend-js', |
| 686 | 'WprLibFrontLoc', |
| 687 | [ |
| 688 | 'nonce' => wp_create_nonce('wpr-addons-library-frontend-js') |
| 689 | ] |
| 690 | ); |
| 691 | |
| 692 | wp_enqueue_script( |
| 693 | 'wpr-addons-library-editor-js', |
| 694 | WPR_ADDONS_URL . 'assets/js/admin/library-editor'. $this->script_suffix() .'.js', |
| 695 | [ 'jquery' ], |
| 696 | Plugin::instance()->get_version(), |
| 697 | true |
| 698 | ); |
| 699 | } |
| 700 | |
| 701 | public function enqueue_panel_styles() { |
| 702 | wp_enqueue_style( |
| 703 | 'wpr-addons-library-editor-css', |
| 704 | WPR_ADDONS_URL . 'assets/css/admin/editor'. $this->script_suffix() .'.css', |
| 705 | [], |
| 706 | Plugin::instance()->get_version() |
| 707 | ); |
| 708 | |
| 709 | $custom_css = " |
| 710 | .wpr-pro-notice { |
| 711 | background: #404349 !important; |
| 712 | border-color: #323232 !important; |
| 713 | } |
| 714 | .elementor-control select option[value*=pro-] { |
| 715 | background: #60646e !important; |
| 716 | } |
| 717 | .elementor-panel .wpr-icon:after { |
| 718 | box-shadow: 0 0 2px 2px #6985ee !important; |
| 719 | } |
| 720 | .wpr-pro-notice > span { |
| 721 | color: #fff !important; |
| 722 | font-weight: bold; |
| 723 | } |
| 724 | "; |
| 725 | |
| 726 | $ui_theme = isset(get_user_meta(get_current_user_id(), 'elementor_preferences')[0]['ui_theme']) ? get_user_meta(get_current_user_id(), 'elementor_preferences')[0]['ui_theme'] : ''; |
| 727 | |
| 728 | if ( $ui_theme && $ui_theme === 'dark' ) { |
| 729 | wp_add_inline_style( 'elementor-editor-dark-mode', $custom_css ); |
| 730 | } |
| 731 | } |
| 732 | |
| 733 | // Lightbox Styles |
| 734 | public function lightbox_styles() { |
| 735 | echo '<style id="wpr_lightbox_styles"> |
| 736 | .lg-backdrop { |
| 737 | background-color: '. esc_html(get_option('wpr_lb_bg_color','rgba(0,0,0,0.6)')) .' !important; |
| 738 | } |
| 739 | .lg-toolbar, |
| 740 | .lg-dropdown { |
| 741 | background-color: '. esc_html(get_option('wpr_lb_toolbar_color','rgba(0,0,0,0.8)')) .' !important; |
| 742 | } |
| 743 | .lg-dropdown:after { |
| 744 | border-bottom-color: '. esc_html(get_option('wpr_lb_toolbar_color','rgba(0,0,0,0.8)')) .' !important; |
| 745 | } |
| 746 | .lg-sub-html { |
| 747 | background-color: '. esc_html(get_option('wpr_lb_caption_color','rgba(0,0,0,0.8)')) .' !important; |
| 748 | } |
| 749 | .lg-thumb-outer, |
| 750 | .lg-progress-bar { |
| 751 | background-color: '. esc_html(get_option('wpr_lb_gallery_color','#444444')) .' !important; |
| 752 | } |
| 753 | .lg-progress { |
| 754 | background-color: '. esc_html(get_option('wpr_lb_pb_color','#a90707')) .' !important; |
| 755 | } |
| 756 | .lg-icon { |
| 757 | color: '. esc_html(get_option('wpr_lb_ui_color','#efefef')) .' !important; |
| 758 | font-size: '. esc_html(get_option('wpr_lb_icon_size',20)) .'px !important; |
| 759 | } |
| 760 | .lg-icon.lg-toogle-thumb { |
| 761 | font-size: '. esc_html((get_option('wpr_lb_icon_size',20) + 4)) .'px !important; |
| 762 | } |
| 763 | .lg-icon:hover, |
| 764 | .lg-dropdown-text:hover { |
| 765 | color: '. esc_html(get_option('wpr_lb_ui_hr_color','#ffffff')) .' !important; |
| 766 | } |
| 767 | .lg-sub-html, |
| 768 | .lg-dropdown-text { |
| 769 | color: '. esc_html(get_option('wpr_lb_text_color','#efefef')) .' !important; |
| 770 | font-size: '. esc_html(get_option('wpr_lb_text_size',14)) .'px !important; |
| 771 | } |
| 772 | #lg-counter { |
| 773 | color: '. esc_html(get_option('wpr_lb_text_color','#efefef')) .' !important; |
| 774 | font-size: '. esc_html(get_option('wpr_lb_text_size',14)) .'px !important; |
| 775 | } |
| 776 | .lg-prev, |
| 777 | .lg-next { |
| 778 | font-size: '. esc_html(get_option('wpr_lb_arrow_size',35)) .'px !important; |
| 779 | } |
| 780 | |
| 781 | /* Defaults */ |
| 782 | .lg-icon { |
| 783 | background-color: transparent !important; |
| 784 | } |
| 785 | |
| 786 | #lg-counter { |
| 787 | opacity: 0.9; |
| 788 | } |
| 789 | |
| 790 | .lg-thumb-outer { |
| 791 | padding: 0 10px; |
| 792 | } |
| 793 | |
| 794 | .lg-thumb-item { |
| 795 | border-radius: 0 !important; |
| 796 | border: none !important; |
| 797 | opacity: 0.5; |
| 798 | } |
| 799 | |
| 800 | .lg-thumb-item.active { |
| 801 | opacity: 1; |
| 802 | } |
| 803 | </style>'; |
| 804 | } |
| 805 | |
| 806 | public function elementor_init() { |
| 807 | $this->_modules_manager = new Manager(); |
| 808 | } |
| 809 | |
| 810 | public function register_widget_categories() { |
| 811 | // Add element category in panel |
| 812 | \Elementor\Plugin::instance()->elements_manager->add_category( |
| 813 | 'wpr-widgets', |
| 814 | [ |
| 815 | 'title' => Utilities::get_plugin_name(true), |
| 816 | 'icon' => 'font', |
| 817 | ] |
| 818 | ); |
| 819 | |
| 820 | // Add Woo element category in panel |
| 821 | if ( Utilities::is_theme_builder_template() ) { |
| 822 | \Elementor\Plugin::instance()->elements_manager->add_category( |
| 823 | 'wpr-theme-builder-widgets', |
| 824 | [ |
| 825 | 'title' => sprintf(esc_html__( '%s Theme Builder', 'wpr-addons' ), Utilities::get_plugin_name()), |
| 826 | 'icon' => 'font', |
| 827 | ] |
| 828 | ); |
| 829 | } |
| 830 | |
| 831 | // Add Woocommerce Builder category in panel |
| 832 | if ( Utilities::is_theme_builder_template() ) { |
| 833 | \Elementor\Plugin::instance()->elements_manager->add_category( |
| 834 | 'wpr-woocommerce-builder-widgets', |
| 835 | [ |
| 836 | 'title' => sprintf(esc_html__( '%s Woocommerce Builder', 'wpr-addons' ), Utilities::get_plugin_name()), |
| 837 | 'icon' => 'font', |
| 838 | ] |
| 839 | ); |
| 840 | } |
| 841 | |
| 842 | // Add Premium Widtgets category in panel |
| 843 | \Elementor\Plugin::instance()->elements_manager->add_category( |
| 844 | 'wpr-premium-widgets', |
| 845 | [ |
| 846 | 'title' => sprintf(esc_html__( '%s Premium Widgets', 'wpr-addons' ), Utilities::get_plugin_name()), |
| 847 | 'icon' => 'font', |
| 848 | ] |
| 849 | ); |
| 850 | } |
| 851 | |
| 852 | public function promote_premium_widgets($config) { |
| 853 | |
| 854 | // if ( is_plugin_active('elementor-pro/elementor-pro.php') || is_plugin_active('pro-elements/pro-elements.php') ) { |
| 855 | // } |
| 856 | $config['promotionWidgets'] = []; |
| 857 | |
| 858 | $category = Utilities::is_theme_builder_template() ? 'wpr-woocommerce-builder-widgets' : 'wpr-premium-widgets'; |
| 859 | |
| 860 | if ( ! wpr_fs()->can_use_premium_code() ) { |
| 861 | $promotion_widgets = [ |
| 862 | [ |
| 863 | 'name' => 'wpr-woo-category-grid', |
| 864 | 'title' => __('Woo Category Grid', 'wpr-addons'), |
| 865 | 'icon' => 'wpr-icon eicon-gallery-grid', |
| 866 | 'categories' => '["'. $category .'"]', |
| 867 | ], |
| 868 | [ |
| 869 | 'name' => 'wpr-my-account', |
| 870 | 'title' => __('My Account', 'wpr-addons'), |
| 871 | 'icon' => 'wpr-icon eicon-my-account', |
| 872 | 'categories' => '["'. $category .'"]', |
| 873 | ], |
| 874 | [ |
| 875 | 'name' => 'wpr-product-filters', |
| 876 | 'title' => __('Product Filters', 'wpr-addons'), |
| 877 | 'icon' => 'wpr-icon eicon-filter', |
| 878 | 'categories' => '["'. $category .'"]', |
| 879 | ], |
| 880 | [ |
| 881 | 'name' => 'wpr-product-breadcrumbs', |
| 882 | 'title' => __('Product Breadcrumbs', 'wpr-addons'), |
| 883 | 'icon' => 'wpr-icon eicon-product-breadcrumbs', |
| 884 | 'categories' => '["'. $category .'"]', |
| 885 | ], |
| 886 | [ |
| 887 | 'name' => 'wpr-breadcrumbs', |
| 888 | 'title' => __('Post Breadcrumbs', 'wpr-addons'), |
| 889 | 'icon' => 'wpr-icon eicon-product-breadcrumbs', |
| 890 | 'categories' => '["'. $category .'"]', |
| 891 | ], |
| 892 | ]; |
| 893 | |
| 894 | $config['promotionWidgets'] = array_merge( $config['promotionWidgets'], $promotion_widgets ); |
| 895 | } |
| 896 | |
| 897 | if ( !wpr_fs()->is_plan( 'expert' ) ) { |
| 898 | $expert_widgets = [ |
| 899 | [ |
| 900 | 'name' => 'wpr-category-grid', |
| 901 | 'title' => __('Category Grid', 'wpr-addons'), |
| 902 | 'icon' => 'wpr-icon eicon-gallery-grid', |
| 903 | 'categories' => '["'. $category .'"]', |
| 904 | ], |
| 905 | [ |
| 906 | 'name' => 'wpr-wishlist-button', |
| 907 | 'title' => __('Wishlist Button', 'wpr-addons'), |
| 908 | 'icon' => 'wpr-icon eicon-heart', |
| 909 | 'categories' => '["'. $category .'"]', |
| 910 | ], |
| 911 | [ |
| 912 | 'name' => 'wpr-mini-wishlist', |
| 913 | 'title' => __('Mini Wishlist', 'wpr-addons'), |
| 914 | 'icon' => 'wpr-icon eicon-heart', |
| 915 | 'categories' => '["'. $category .'"]', |
| 916 | ], |
| 917 | [ |
| 918 | 'name' => 'wpr-wishlist', |
| 919 | 'title' => __('Wishlist Table', 'wpr-addons'), |
| 920 | 'icon' => 'wpr-icon eicon-heart', |
| 921 | 'categories' => '["'. $category .'"]', |
| 922 | ], |
| 923 | [ |
| 924 | 'name' => 'wpr-compare-button', |
| 925 | 'title' => __('Compare Button', 'wpr-addons'), |
| 926 | 'icon' => 'wpr-icon eicon-exchange', // GOGA - new icon needed for compare |
| 927 | 'categories' => '["'. $category .'"]', |
| 928 | ], |
| 929 | [ |
| 930 | 'name' => 'wpr-mini-compare', |
| 931 | 'title' => __('Mini Compare', 'wpr-addons'), |
| 932 | 'icon' => 'wpr-icon eicon-exchange', |
| 933 | 'categories' => '["'. $category .'"]', |
| 934 | ], |
| 935 | [ |
| 936 | 'name' => 'wpr-compare', |
| 937 | 'title' => __('Compare Table', 'wpr-addons'), |
| 938 | 'icon' => 'wpr-icon eicon-exchange', |
| 939 | 'categories' => '["'. $category .'"]', |
| 940 | ], |
| 941 | [ |
| 942 | 'name' => 'wpr-custom-field', |
| 943 | 'title' => __('Custom Field', 'wpr-addons'), |
| 944 | 'icon' => 'wpr-icon eicon-database', |
| 945 | 'categories' => '["'. $category .'"]', |
| 946 | ], |
| 947 | ]; |
| 948 | |
| 949 | $config['promotionWidgets'] = array_merge( $config['promotionWidgets'], $expert_widgets ); |
| 950 | } |
| 951 | |
| 952 | return $config; |
| 953 | } |
| 954 | |
| 955 | protected function add_actions() { |
| 956 | // Register Widgets |
| 957 | add_action( 'elementor/init', [ $this, 'elementor_init' ] ); |
| 958 | |
| 959 | // Register Categories |
| 960 | add_action( 'elementor/elements/categories_registered', [ $this, 'register_widget_categories' ] ); |
| 961 | |
| 962 | // Register Ajax Hooks |
| 963 | $this->register_ajax_hooks(); |
| 964 | |
| 965 | // Register Mega Menu Route |
| 966 | $this->register_megamenu_route(); |
| 967 | |
| 968 | // $this->register_compare_custom_routes(); |
| 969 | |
| 970 | // Register Custom Controls |
| 971 | add_action( 'elementor/controls/controls_registered', [ $this, 'register_custom_controls' ] ); |
| 972 | |
| 973 | // Register Document Type |
| 974 | add_action( 'elementor/documents/register', [ $this, 'register_elementor_document_type' ] ); |
| 975 | |
| 976 | // Frontend CSS |
| 977 | add_action( 'wp_enqueue_scripts', [ $this, 'enqueue_styles' ], 998 ); |
| 978 | |
| 979 | // Editor CSS |
| 980 | add_action( 'elementor/preview/enqueue_styles', [ $this, 'enqueue_editor_styles' ], 998 ); |
| 981 | |
| 982 | // Register Scripts |
| 983 | add_action( 'elementor/frontend/before_register_scripts', [ $this, 'register_scripts' ], 998 ); |
| 984 | |
| 985 | // Frontend JS |
| 986 | add_action( 'elementor/frontend/before_enqueue_scripts', [ $this, 'enqueue_scripts' ], 998 ); |
| 987 | |
| 988 | // Editor CSS/JS |
| 989 | add_action( 'elementor/editor/after_enqueue_styles', [ $this, 'enqueue_panel_styles' ], 988 ); |
| 990 | add_action( 'elementor/editor/before_enqueue_scripts', [ $this, 'enqueue_inner_panel_scripts' ], 988 ); |
| 991 | add_action( 'elementor/editor/after_enqueue_scripts', [ $this, 'enqueue_panel_scripts' ], 988 ); |
| 992 | |
| 993 | // Lightbox Styles |
| 994 | add_action( 'wp_head', [ $this, 'lightbox_styles' ], 988 ); |
| 995 | |
| 996 | // Promote Premium Widgets |
| 997 | if ( current_user_can('administrator') ) { |
| 998 | add_filter('elementor/editor/localize_settings', [$this, 'promote_premium_widgets']); |
| 999 | } |
| 1000 | |
| 1001 | add_filter( 'pre_get_posts', [$this, 'wpr_custom_posts_per_page'] ); |
| 1002 | add_filter('excerpt_more', [$this, 'wpr_custom_excerpt_more']); |
| 1003 | add_filter('excerpt_length', [$this, 'wpr_custom_excerpt_length']); |
| 1004 | } |
| 1005 | |
| 1006 | /* |
| 1007 | ** Custom function to modify excerpt more text |
| 1008 | */ |
| 1009 | function wpr_custom_excerpt_more($more) { // TODO: check |
| 1010 | return ''; // Change to '...' or any other text if desired |
| 1011 | } |
| 1012 | |
| 1013 | /* |
| 1014 | ** Custom function to modify excerpt more length |
| 1015 | */ |
| 1016 | function wpr_custom_excerpt_length($length) { |
| 1017 | return 999; |
| 1018 | } |
| 1019 | |
| 1020 | public function wpr_custom_posts_per_page( $query ) { |
| 1021 | if ( $query->is_main_query() && isset($query->query['post_type']) ) { |
| 1022 | if (is_admin() ) { |
| 1023 | if (\Elementor\Plugin::$instance->editor && !\Elementor\Plugin::$instance->editor->is_edit_mode()) { |
| 1024 | return; |
| 1025 | } |
| 1026 | } |
| 1027 | $query_post_type = $query->query['post_type']; |
| 1028 | if ( is_string($query_post_type) && is_post_type_archive($query_post_type) && get_option('wpr_cpt_ppp_'. $query_post_type ) ) { |
| 1029 | $query->set( 'posts_per_page', get_option('wpr_cpt_ppp_'. $query_post_type ) ); |
| 1030 | } |
| 1031 | } |
| 1032 | |
| 1033 | return $query; |
| 1034 | } |
| 1035 | |
| 1036 | /** |
| 1037 | * Plugin constructor. |
| 1038 | */ |
| 1039 | private function __construct() { |
| 1040 | spl_autoload_register( [ $this, 'autoload' ] ); |
| 1041 | |
| 1042 | $this->_includes(); |
| 1043 | $this->add_actions(); |
| 1044 | } |
| 1045 | |
| 1046 | } |
| 1047 | |
| 1048 | if ( ! defined( 'WPR_ADDONS_TESTS' ) ) { |
| 1049 | // In tests we run the instance manually. |
| 1050 | Plugin::instance(); |
| 1051 | } |
| 1052 |