| @@ -3,8 +3,9 @@ | ||
| 3 | 3 | namespace UltimatePostKit; |
| 4 | 4 | |
| 5 | 5 | use Elementor\Plugin; |
| 6 | 6 | use UltimatePostKit\Admin; |
| 7 | +use UltimatePostKit\Includes\Ultimate_Post_Kit_WPML; | |
| 7 | 8 | |
| 8 | 9 | if ( ! defined( 'ABSPATH' ) ) { |
| 9 | 10 | exit; |
| 10 | 11 | } // Exit if accessed directly |
| @@ -87,8 +88,9 @@ | ||
| 87 | 88 | public static function instance() { |
| 88 | 89 | if ( is_null( self::$_instance ) ) { |
| 89 | 90 | self::$_instance = new self(); |
| 90 | 91 | } |
| 92 | + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- established hook name relied on across the plugin family; renaming would break integration. | |
| 91 | 93 | do_action( 'bdthemes_ultimate_post_kit/init' ); |
| 92 | 94 | return self::$_instance; |
| 93 | 95 | } |
| 94 | 96 | |
| @@ -116,8 +118,11 @@ | ||
| 116 | 118 | require_once BDTUPK_PATH . 'traits/global-widget-controls.php'; |
| 117 | 119 | require_once BDTUPK_PATH . 'traits/global-swiper-functions.php'; |
| 118 | 120 | require_once BDTUPK_INC_PATH . 'modules-manager.php'; |
| 119 | 121 | |
| 122 | + // wpml compatibility class for wpml support | |
| 123 | + require_once BDTUPK_PATH . 'includes/class-elements-wpml-compatibility.php'; | |
| 124 | + | |
| 120 | 125 | if ( $category_image == 'on' ) { |
| 121 | 126 | require BDTUPK_INC_PATH . 'ultimate-post-kit-category-image.php'; |
| 122 | 127 | } |
| 123 | 128 | // if ($category_image == 'on') { |
| @@ -123,15 +128,20 @@ | ||
| 123 | 128 | // if ($category_image == 'on') { |
| 124 | 129 | require BDTUPK_INC_PATH . 'ultimate-post-kit-metabox.php'; |
| 125 | 130 | // } |
| 126 | 131 | |
| 127 | - if ( ! class_exists( 'BdThemes_Duplicator' ) ) { | |
| 128 | - if ( $duplicator == 'on' ) { | |
| 129 | - require BDTUPK_PATH . 'includes/class-duplicator.php'; | |
| 130 | - } | |
| 132 | + // The class is namespaced, so the old unqualified class_exists() check never | |
| 133 | + // matched and the file could be loaded alongside a sibling plugin's duplicator. | |
| 134 | + // Also skip our copy entirely when Live Copy Paste is providing the same feature, | |
| 135 | + // since both provide the same duplicate-post admin action. | |
| 136 | + if ( $duplicator == 'on' | |
| 137 | + && ! class_exists( '\\UltimatePostKit\\Includes\\BdThemes_Duplicator' ) | |
| 138 | + && ! class_exists( '\\ElementPack\\Includes\\BdThemes_Duplicator' ) | |
| 139 | + && ! class_exists( '\\BdThemes_Duplicator' ) ) { | |
| 140 | + require BDTUPK_PATH . 'includes/class-duplicator.php'; | |
| 131 | 141 | } |
| 132 | 142 | |
| 133 | - if ( ! class_exists( 'BdThemes_Live_Copy' ) ) { | |
| 143 | + if ( ! class_exists( '\\UltimatePostKit\\Includes\\LiveCopy\\BdThemes_Live_Copy' ) ) { | |
| 134 | 144 | if ( ( $live_copy == 'on' ) && ( ! is_plugin_active( 'live-copy-paste/live-copy-paste.php' ) ) ) { |
| 135 | 145 | require_once BDTUPK_PATH . 'includes/live-copy/class-live-copy.php'; |
| 136 | 146 | } |
| 137 | 147 | } |
| @@ -177,15 +187,15 @@ | ||
| 177 | 187 | public function register_site_scripts() { |
| 178 | 188 | |
| 179 | 189 | // $suffix = '.min'; |
| 180 | 190 | |
| 181 | - wp_register_script( 'goodshare', BDTUPK_ASSETS_URL . 'vendor/js/goodshare.min.js', [ 'jquery' ], '4.1.2', true ); | |
| 182 | - wp_register_script( 'scrolline', BDTUPK_ASSETS_URL . 'vendor/js/jquery.scrolline.min.js', [ 'jquery' ], '4.1.2', true ); | |
| 183 | - wp_register_script( 'news-ticker-js', BDTUPK_ASSETS_URL . 'vendor/js/newsticker.min.js', [ 'jquery' ], '', true ); | |
| 184 | - wp_register_script( 'fslightbox', BDTUPK_ASSETS_URL . 'vendor/js/fslightbox.min.js', [], '3.4.1', true ); | |
| 185 | - wp_register_script( 'upk-animations', BDTUPK_ASSETS_URL . 'js/extensions/upk-animations.min.js', [ 'jquery' ], '', true ); | |
| 191 | + wp_register_script( 'goodshare', BDTUPK_ASSETS_URL . 'vendor/js/goodshare.min.js', [ 'jquery' ], '6.3.0', true ); | |
| 192 | + wp_register_script( 'scrolline', BDTUPK_ASSETS_URL . 'vendor/js/jquery.scrolline.min.js', [ 'jquery' ], BDTUPK_VER, true ); | |
| 193 | + wp_register_script( 'news-ticker-js', BDTUPK_ASSETS_URL . 'vendor/js/newsticker.min.js', [ 'jquery' ], BDTUPK_VER, true ); | |
| 194 | + wp_register_script( 'fslightbox', BDTUPK_ASSETS_URL . 'vendor/js/fslightbox.min.js', [], '3.8.0', true ); | |
| 195 | + wp_register_script( 'upk-animations', BDTUPK_ASSETS_URL . 'js/extensions/upk-animations.min.js', [ 'jquery' ], BDTUPK_VER, true ); | |
| 186 | 196 | |
| 187 | - wp_register_script( 'upk-ajax-loadmore', BDTUPK_ASSETS_URL . 'js/extensions/upk-ajax-loadmore.min.js', [ 'jquery' ], '', true ); | |
| 197 | + wp_register_script( 'upk-ajax-loadmore', BDTUPK_ASSETS_URL . 'js/extensions/upk-ajax-loadmore.min.js', [ 'jquery' ], BDTUPK_VER, true ); | |
| 188 | 198 | |
| 189 | 199 | wp_register_script( 'upk-all-scripts', BDTUPK_ASSETS_URL . 'js/upk-all-scripts.min.js', [ |
| 190 | 200 | 'jquery', |
| 191 | 201 | 'scrolline' |
| @@ -286,11 +296,25 @@ | ||
| 286 | 296 | wp_register_style( 'upk-editor', BDTUPK_ASSETS_URL . 'css/upk-editor' . $direction_suffix . '.css', '', BDTUPK_VER ); |
| 287 | 297 | wp_register_style( 'upk-font', BDTUPK_URL . 'assets/css/upk-font' . $direction_suffix . '.css', [], BDTUPK_VER ); |
| 288 | 298 | |
| 289 | 299 | wp_enqueue_style( 'upk-editor' ); |
| 300 | + wp_add_inline_style( | |
| 301 | + 'upk-editor', | |
| 302 | + '#elementor-panel{' | |
| 303 | + . '--upk-pro-control-tooltip:' . wp_json_encode( __( 'This is a pro control, available with Ultimate Post Kit Pro version.', 'ultimate-post-kit' ) ) . ';' | |
| 304 | + . '--upk-badge-new:' . wp_json_encode( __( 'NEW', 'ultimate-post-kit' ) ) . ';' | |
| 305 | + . '--upk-badge-pro:' . wp_json_encode( __( 'PRO', 'ultimate-post-kit' ) ) . ';' | |
| 306 | + . '--upk-badge-updated:' . wp_json_encode( __( 'UPDATED', 'ultimate-post-kit' ) ) . ';' | |
| 307 | + . '}' | |
| 308 | + ); | |
| 290 | 309 | wp_enqueue_style( 'upk-font' ); |
| 291 | 310 | } |
| 292 | 311 | |
| 312 | + // Load WPML compatibility instance | |
| 313 | + public function wpml_compatiblity() { | |
| 314 | + return Ultimate_Post_Kit_WPML::get_instance(); | |
| 315 | + } | |
| 316 | + | |
| 293 | 317 | /** |
| 294 | 318 | * initialize the category |
| 295 | 319 | * @return [type] [description] |
| 296 | 320 | */ |
| @@ -347,8 +371,11 @@ | ||
| 347 | 371 | $this->_includes(); |
| 348 | 372 | |
| 349 | 373 | // Finally hooked up all things here |
| 350 | 374 | $this->setup_hooks(); |
| 375 | + | |
| 376 | + // Load WPML compatibility instance | |
| 377 | + $this->wpml_compatiblity()->init(); | |
| 351 | 378 | |
| 352 | 379 | add_action( 'init', [ $this, 'init' ] ); |
| 353 | 380 | } |
| 354 | 381 | } |