Changeset 3389322
- Timestamp:
- 11/04/2025 05:01:06 AM (2 months ago)
- Location:
- image-comparison-elementor-addon
- Files:
-
- 6 added
- 2 deleted
- 20 edited
- 1 copied
-
tags/1.0.2.3 (copied) (copied from image-comparison-elementor-addon/trunk)
-
tags/1.0.2.3/.gitattributes (added)
-
tags/1.0.2.3/Inc/Addon/Image_Comparison.php (modified) (7 diffs)
-
tags/1.0.2.3/Libs/Assets.php (modified) (2 diffs)
-
tags/1.0.2.3/Libs/Recommended.php (modified) (2 diffs)
-
tags/1.0.2.3/assets/images/after.png (modified) (previous)
-
tags/1.0.2.3/assets/images/before.png (modified) (previous)
-
tags/1.0.2.3/assets/images/promo-image.png (modified) (previous)
-
tags/1.0.2.3/assets/js/elementor-patch.js (added)
-
tags/1.0.2.3/assets/js/image-comparison-elementor-addon-frontend.js (modified) (2 diffs)
-
tags/1.0.2.3/changelog.txt (added)
-
tags/1.0.2.3/class-image-comparison-elementor-addon.php (modified) (2 diffs)
-
tags/1.0.2.3/image-comparison-elementor-addon.php (modified) (2 diffs)
-
tags/1.0.2.3/readme.txt (modified) (2 diffs)
-
tags/1.0.2.3/vendor (deleted)
-
trunk/.gitattributes (added)
-
trunk/Inc/Addon/Image_Comparison.php (modified) (7 diffs)
-
trunk/Libs/Assets.php (modified) (2 diffs)
-
trunk/Libs/Recommended.php (modified) (2 diffs)
-
trunk/assets/images/after.png (modified) (previous)
-
trunk/assets/images/before.png (modified) (previous)
-
trunk/assets/images/promo-image.png (modified) (previous)
-
trunk/assets/js/elementor-patch.js (added)
-
trunk/assets/js/image-comparison-elementor-addon-frontend.js (modified) (2 diffs)
-
trunk/changelog.txt (added)
-
trunk/class-image-comparison-elementor-addon.php (modified) (2 diffs)
-
trunk/image-comparison-elementor-addon.php (modified) (2 diffs)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/vendor (deleted)
Legend:
- Unmodified
- Added
- Removed
-
image-comparison-elementor-addon/tags/1.0.2.3/Inc/Addon/Image_Comparison.php
r2956950 r3389322 6 6 use Elementor\Group_Control_Image_Size; 7 7 use Elementor\Group_Control_Typography; 8 use Elementor\Core\Schemes\Typography;9 use Elementor\Scheme_Color;10 8 use Elementor\Utils; 11 9 use Elementor\Control_Media; … … 45 43 'jquery-event-move', 46 44 'twentytwenty', 47 'imagesloaded',48 45 'image-comparison-elementor-addon-frontend' 49 46 ]; … … 66 63 } 67 64 68 protected function _register_controls() {65 protected function register_controls() { 69 66 70 67 $this->start_controls_section( … … 671 668 array( 672 669 'name' => 'jltma_image_comparison_before_label_typography_group', 673 'scheme' => Typography::TYPOGRAPHY_1,674 670 'selector' => '{{WRAPPER}} .jltma-image-comparison .twentytwenty-before-label:before', 675 671 ) … … 756 752 array( 757 753 'name' => 'jltma_image_comparison_after_label_typography_group', 758 'scheme' => Typography::TYPOGRAPHY_1,759 754 'selector' => '{{WRAPPER}} .jltma-image-comparison .twentytwenty-after-label:before', 760 755 ) … … 900 895 901 896 protected function render() { 902 $settings = $this->get_settings_for_display(); 903 $id = 'jltma-image-comparison-' . $this->get_id(); 897 $settings = $this->get_settings_for_display(); 898 $id = 'jltma-image-comparison-' . $this->get_id(); 899 900 // Check if we have images to display 901 if ( empty( $settings['jltma_image_comparison_before_image']['url'] ) && empty( $settings['jltma_image_comparison_after_image']['url'] ) ) { 902 echo '<div class="jltma-no-images-notice">Please add before and after images to the Image Comparison widget.</div>'; 903 return; 904 } 904 905 905 906 $this->add_render_attribute( … … 912 913 'jltma-image-comparison-' . esc_attr( $this->get_id()), 913 914 ]), 914 'data-image-comparison-settings' => [ 915 wp_json_encode(array_filter([ 916 "container_id" => esc_attr( $this->get_id()), 917 'visible_ratio' => ( $settings['jltma_image_comparison_visible_ratio']['size'] != '' ? $settings['jltma_image_comparison_visible_ratio']['size']/100 : '0.5' ), 918 'orientation' => ( $settings['jltma_image_comparison_orientation'] != '' ? $settings['jltma_image_comparison_orientation'] : 'horizontal' ), 919 'before_label' => ( $settings['jltma_image_comparison_before_label'] != '' ? esc_attr( $settings['jltma_image_comparison_before_label'] ) : '' ), 920 'after_label' => ( $settings['jltma_image_comparison_after_label'] != '' ? esc_attr( $settings['jltma_image_comparison_after_label'] ) : '' ), 921 'slider_on_hover' => ( $settings['jltma_image_comparison_move_handle'] == 'mouse_move' ? true : false ), 922 'slider_with_handle' => ( $settings['jltma_image_comparison_move_handle'] == 'drag' ? true : false ), 923 'slider_with_click' => ( $settings['jltma_image_comparison_move_handle'] == 'mouse_click' ? true : false ), 924 'no_overlay' => ( $settings['jltma_image_comparison_overlay'] == 'yes' ? false : true ) 925 ])) 926 ] 915 'data-image-comparison-settings' => wp_json_encode(array_filter([ 916 "container_id" => esc_attr( $this->get_id()), 917 'visible_ratio' => ( $settings['jltma_image_comparison_visible_ratio']['size'] != '' ? $settings['jltma_image_comparison_visible_ratio']['size']/100 : '0.5' ), 918 'orientation' => ( $settings['jltma_image_comparison_orientation'] != '' ? $settings['jltma_image_comparison_orientation'] : 'horizontal' ), 919 'before_label' => ( $settings['jltma_image_comparison_before_label'] != '' ? esc_attr( $settings['jltma_image_comparison_before_label'] ) : '' ), 920 'after_label' => ( $settings['jltma_image_comparison_after_label'] != '' ? esc_attr( $settings['jltma_image_comparison_after_label'] ) : '' ), 921 'slider_on_hover' => ( $settings['jltma_image_comparison_move_handle'] == 'mouse_move' ? true : false ), 922 'slider_with_handle' => ( $settings['jltma_image_comparison_move_handle'] == 'drag' ? true : false ), 923 'slider_with_click' => ( $settings['jltma_image_comparison_move_handle'] == 'mouse_click' ? true : false ), 924 'no_overlay' => ( $settings['jltma_image_comparison_overlay'] == 'yes' ? false : true ) 925 ])) 927 926 ] 928 927 ] -
image-comparison-elementor-addon/tags/1.0.2.3/Libs/Assets.php
r2956950 r3389322 23 23 */ 24 24 public function __construct() { 25 // add_action( 'wp_enqueue_scripts', array( $this, 'jlticel_enqueue_scripts' ), 100 );26 add_action( 'elementor/frontend/after_register_styles', [$this, 'jlticel_enqueue_scripts']);25 // Register scripts/styles for frontend 26 add_action( 'wp_enqueue_scripts', array( $this, 'jlticel_enqueue_scripts' ), 5 ); 27 27 add_action( 'admin_enqueue_scripts', array( $this, 'jlticel_admin_enqueue_scripts' ), 100 ); 28 28 } … … 45 45 public function jlticel_enqueue_scripts() { 46 46 47 // CSS Files . 48 wp_register_style( 'twentytwenty', JLTELIC_ASSETS . 'css/twentytwenty.css' ); 49 // wp_enqueue_style( 'image-comparison-elementor-addon-frontend', JLTELIC_ASSETS . 'css/image-comparison-elementor-addon-frontend.css', JLTELIC_VER, 'all' ); 50 wp_register_style( 'image-comparison-elementor-addon-frontend', JLTELIC_ASSETS . 'css/image-comparison-elementor-addon-frontend.css', JLTELIC_VER, 'all' ); 47 // CSS Files 48 wp_register_style( 'twentytwenty', JLTELIC_ASSETS . 'css/twentytwenty.css', array(), JLTELIC_VER, 'all' ); 49 wp_register_style( 'image-comparison-elementor-addon-frontend', JLTELIC_ASSETS . 'css/image-comparison-elementor-addon-frontend.css', array('twentytwenty'), JLTELIC_VER, 'all' ); 50 51 // Elementor Compatibility Patch - Load early to prevent tools error 52 wp_enqueue_script( 'jlticel-elementor-patch', JLTELIC_ASSETS . 'js/elementor-patch.js', array('jquery'), JLTELIC_VER, false ); 51 53 54 // Also add inline script for immediate patching 55 wp_add_inline_script( 'jquery', 56 'window.addEventListener("load", function() { 57 if (typeof elementorFrontend !== "undefined" && !elementorFrontend.tools) { 58 elementorFrontend.tools = {}; 59 } 60 });', 61 'after' 62 ); 52 63 53 // JS Files .64 // JS Files 54 65 wp_register_script( 'jquery-event-move', JLTELIC_ASSETS . 'js/jquery.event.move.js',array('jquery'), JLTELIC_VER, true ); 55 wp_register_script( 'twentytwenty', JLTELIC_ASSETS . 'js/jquery.twentytwenty.js',array('jquery'), JLTELIC_VER, true ); 56 // wp_register_script( 'master-image-comparison', JLTELIC_ASSETS . 'js/master-image-comparison.js',array('jquery'), JLTELIC_VER, true ); 57 wp_register_script( 'image-comparison-elementor-addon-frontend', JLTELIC_ASSETS . 'js/image-comparison-elementor-addon-frontend.js', array( 'jquery' ), JLTELIC_VER, true ); 58 59 wp_enqueue_script('jquery-event-move'); 60 wp_enqueue_script('twentytwenty'); 61 wp_enqueue_script('image-comparison-elementor-addon-frontend'); 66 wp_register_script( 'twentytwenty', JLTELIC_ASSETS . 'js/jquery.twentytwenty.js',array('jquery', 'jquery-event-move'), JLTELIC_VER, true ); 67 wp_register_script( 'image-comparison-elementor-addon-frontend', JLTELIC_ASSETS . 'js/image-comparison-elementor-addon-frontend.js', array( 'jquery', 'twentytwenty' ), JLTELIC_VER, true ); 62 68 63 69 } -
image-comparison-elementor-addon/tags/1.0.2.3/Libs/Recommended.php
r2956950 r3389322 290 290 wp_send_json_error( array( 'mess' => __( 'Nonce is invalid', 'image-comparison-elementor-addon' ) ) ); 291 291 } 292 293 // Check user capabilities 294 if ( ! current_user_can( 'activate_plugins' ) ) { 295 wp_send_json_error( array( 'mess' => __( 'You do not have permission to activate plugins.', 'image-comparison-elementor-addon' ) ) ); 296 } 297 292 298 $file = sanitize_text_field( wp_unslash( $_POST['file'] ) ); 293 299 $result = activate_plugin( $file ); … … 345 351 wp_send_json_error( array( 'mess' => __( 'Nonce is invalid', 'image-comparison-elementor-addon' ) ) ); 346 352 } 353 354 // Check user capabilities - only administrators can install/update plugins 355 if ( ! current_user_can( 'install_plugins' ) ) { 356 wp_send_json_error( array( 'mess' => __( 'You do not have permission to install or update plugins.', 'image-comparison-elementor-addon' ) ) ); 357 } 358 347 359 $plugin = sanitize_text_field( wp_unslash( $_POST['plugin'] ) ); 348 360 $type = isset( $_POST['type'] ) ? sanitize_text_field( wp_unslash( $_POST['type'] ) ) : 'install'; -
image-comparison-elementor-addon/tags/1.0.2.3/assets/js/image-comparison-elementor-addon-frontend.js
r2956950 r3389322 13 13 $jltma_image_data = $jltma_image_comp_wrap.data('image-comparison-settings'); 14 14 15 console.log($jltma_image_data);15 // Initialize twentytwenty with settings 16 16 17 17 $jltma_image_comp_wrap.twentytwenty({ … … 30 30 31 31 32 // Elementor Addons 32 // Initialize the widget when DOM is ready 33 $(document).ready(function() { 34 // Initialize all image comparison widgets on the page 35 $('.elementor-widget-master-image-comparison').each(function() { 36 Master_Image_Comparison.Before_After($(this), $); 37 }); 38 }); 39 40 // Also try to hook into Elementor if available (for editor compatibility) 33 41 $(window).on('elementor/frontend/init', function () { 34 if (elementorFrontend.isEditMode()) { editMode = true; } 35 elementorFrontend.hooks.addAction('frontend/element_ready/master-image-comparison.default', Master_Image_Comparison.Before_After ); 42 if (typeof elementorFrontend !== 'undefined' && elementorFrontend.hooks) { 43 try { 44 if (elementorFrontend.isEditMode && elementorFrontend.isEditMode()) { 45 editMode = true; 46 } 47 elementorFrontend.hooks.addAction('frontend/element_ready/master-image-comparison.default', Master_Image_Comparison.Before_After); 48 } catch (e) { 49 // Silently fallback to jQuery initialization 50 } 51 } 36 52 }); 37 53 -
image-comparison-elementor-addon/tags/1.0.2.3/class-image-comparison-elementor-addon.php
r2956950 r3389322 54 54 // Body Class. 55 55 add_filter( 'admin_body_class', array( $this, 'jlticel_body_class' ) ); 56 // This should run earlier . 57 // add_action( 'plugins_loaded', [ $this, 'jlticel_maybe_run_upgrades' ], -100 ); . 58 add_action( 'elementor/widgets/widgets_registered', [ $this, 'jlticel_init_widgets' ] ); 56 add_action( 'elementor/widgets/register', [ $this, 'jlticel_init_widgets' ] ); 59 57 60 58 } … … 164 162 * @author Jewel Theme <[email protected]> 165 163 */ 166 public function jlticel_init_widgets() { 167 \Elementor\Plugin::instance()->widgets_manager->register_widget_type( new \JLTELIC\Inc\Addon\Image_Comparison() ); 164 public function jlticel_init_widgets( $widgets_manager = null ) { 165 // Backward compatibility - check if we have the widgets_manager parameter 166 if ( ! $widgets_manager ) { 167 $widgets_manager = \Elementor\Plugin::instance()->widgets_manager; 168 } 169 170 // Use the appropriate registration method based on Elementor version 171 if ( method_exists( $widgets_manager, 'register' ) ) { 172 $widgets_manager->register( new \JLTELIC\Inc\Addon\Image_Comparison() ); 173 } else { 174 // Fallback for older Elementor versions 175 $widgets_manager->register_widget_type( new \JLTELIC\Inc\Addon\Image_Comparison() ); 176 } 168 177 } 169 178 -
image-comparison-elementor-addon/tags/1.0.2.3/image-comparison-elementor-addon.php
r2957119 r3389322 4 4 * Plugin URI: https://jeweltheme.com 5 5 * Description: Image comparison addon for elementor page builder plugin. Compare Before and After Images beautifully 6 * Version: 1.0.2. 26 * Version: 1.0.2.3 7 7 * Author: Jewel Theme 8 8 * Author URI: https://jeweltheme.com … … 101 101 include_once JLTELIC_DIR . '/class-image-comparison-elementor-addon.php'; 102 102 } 103 104 -
image-comparison-elementor-addon/tags/1.0.2.3/readme.txt
r2957119 r3389322 4 4 Tags: image comparison, before after, after before, image, comparison, elementor, elementor addon, addon, image comparison plugin, image comparison addon 5 5 Requires at least: 4.0 6 Tested up to: 6. 37 Stable tag: 1.0.2. 26 Tested up to: 6.8 7 Stable tag: 1.0.2.3 8 8 Requires PHP: 5.6 9 9 License: GPLv3 or later … … 130 130 4. Image comparison style 131 131 132 132 133 == Changelog == 133 = 1.0.2 (22-08-2022)= 134 135 = 1.0.2.3 = 136 * Security Fix: Added proper capability checks to prevent unauthorized plugin installation (Critical) 137 * Compatibility: Fixed Elementor "Cannot read properties of undefined (reading 'tools')" error 138 * Compatibility: Updated all deprecated Elementor API methods 139 * Performance: Optimized script loading - scripts only load when widget is used 140 * Code Quality: Removed all debug code and console errors for production 141 142 = 1.0.2 = 134 143 * Updated: WordPress 6.3 compatibility checked and fixed bugs 135 144 136 = 1.0.0 (18-02-2020)= 137 * Initial Release 138 145 = 1.0.0 = 146 * Initial Release 139 147 140 148 == Upgrade Notice == -
image-comparison-elementor-addon/trunk/Inc/Addon/Image_Comparison.php
r2956950 r3389322 6 6 use Elementor\Group_Control_Image_Size; 7 7 use Elementor\Group_Control_Typography; 8 use Elementor\Core\Schemes\Typography;9 use Elementor\Scheme_Color;10 8 use Elementor\Utils; 11 9 use Elementor\Control_Media; … … 45 43 'jquery-event-move', 46 44 'twentytwenty', 47 'imagesloaded',48 45 'image-comparison-elementor-addon-frontend' 49 46 ]; … … 66 63 } 67 64 68 protected function _register_controls() {65 protected function register_controls() { 69 66 70 67 $this->start_controls_section( … … 671 668 array( 672 669 'name' => 'jltma_image_comparison_before_label_typography_group', 673 'scheme' => Typography::TYPOGRAPHY_1,674 670 'selector' => '{{WRAPPER}} .jltma-image-comparison .twentytwenty-before-label:before', 675 671 ) … … 756 752 array( 757 753 'name' => 'jltma_image_comparison_after_label_typography_group', 758 'scheme' => Typography::TYPOGRAPHY_1,759 754 'selector' => '{{WRAPPER}} .jltma-image-comparison .twentytwenty-after-label:before', 760 755 ) … … 900 895 901 896 protected function render() { 902 $settings = $this->get_settings_for_display(); 903 $id = 'jltma-image-comparison-' . $this->get_id(); 897 $settings = $this->get_settings_for_display(); 898 $id = 'jltma-image-comparison-' . $this->get_id(); 899 900 // Check if we have images to display 901 if ( empty( $settings['jltma_image_comparison_before_image']['url'] ) && empty( $settings['jltma_image_comparison_after_image']['url'] ) ) { 902 echo '<div class="jltma-no-images-notice">Please add before and after images to the Image Comparison widget.</div>'; 903 return; 904 } 904 905 905 906 $this->add_render_attribute( … … 912 913 'jltma-image-comparison-' . esc_attr( $this->get_id()), 913 914 ]), 914 'data-image-comparison-settings' => [ 915 wp_json_encode(array_filter([ 916 "container_id" => esc_attr( $this->get_id()), 917 'visible_ratio' => ( $settings['jltma_image_comparison_visible_ratio']['size'] != '' ? $settings['jltma_image_comparison_visible_ratio']['size']/100 : '0.5' ), 918 'orientation' => ( $settings['jltma_image_comparison_orientation'] != '' ? $settings['jltma_image_comparison_orientation'] : 'horizontal' ), 919 'before_label' => ( $settings['jltma_image_comparison_before_label'] != '' ? esc_attr( $settings['jltma_image_comparison_before_label'] ) : '' ), 920 'after_label' => ( $settings['jltma_image_comparison_after_label'] != '' ? esc_attr( $settings['jltma_image_comparison_after_label'] ) : '' ), 921 'slider_on_hover' => ( $settings['jltma_image_comparison_move_handle'] == 'mouse_move' ? true : false ), 922 'slider_with_handle' => ( $settings['jltma_image_comparison_move_handle'] == 'drag' ? true : false ), 923 'slider_with_click' => ( $settings['jltma_image_comparison_move_handle'] == 'mouse_click' ? true : false ), 924 'no_overlay' => ( $settings['jltma_image_comparison_overlay'] == 'yes' ? false : true ) 925 ])) 926 ] 915 'data-image-comparison-settings' => wp_json_encode(array_filter([ 916 "container_id" => esc_attr( $this->get_id()), 917 'visible_ratio' => ( $settings['jltma_image_comparison_visible_ratio']['size'] != '' ? $settings['jltma_image_comparison_visible_ratio']['size']/100 : '0.5' ), 918 'orientation' => ( $settings['jltma_image_comparison_orientation'] != '' ? $settings['jltma_image_comparison_orientation'] : 'horizontal' ), 919 'before_label' => ( $settings['jltma_image_comparison_before_label'] != '' ? esc_attr( $settings['jltma_image_comparison_before_label'] ) : '' ), 920 'after_label' => ( $settings['jltma_image_comparison_after_label'] != '' ? esc_attr( $settings['jltma_image_comparison_after_label'] ) : '' ), 921 'slider_on_hover' => ( $settings['jltma_image_comparison_move_handle'] == 'mouse_move' ? true : false ), 922 'slider_with_handle' => ( $settings['jltma_image_comparison_move_handle'] == 'drag' ? true : false ), 923 'slider_with_click' => ( $settings['jltma_image_comparison_move_handle'] == 'mouse_click' ? true : false ), 924 'no_overlay' => ( $settings['jltma_image_comparison_overlay'] == 'yes' ? false : true ) 925 ])) 927 926 ] 928 927 ] -
image-comparison-elementor-addon/trunk/Libs/Assets.php
r2956950 r3389322 23 23 */ 24 24 public function __construct() { 25 // add_action( 'wp_enqueue_scripts', array( $this, 'jlticel_enqueue_scripts' ), 100 );26 add_action( 'elementor/frontend/after_register_styles', [$this, 'jlticel_enqueue_scripts']);25 // Register scripts/styles for frontend 26 add_action( 'wp_enqueue_scripts', array( $this, 'jlticel_enqueue_scripts' ), 5 ); 27 27 add_action( 'admin_enqueue_scripts', array( $this, 'jlticel_admin_enqueue_scripts' ), 100 ); 28 28 } … … 45 45 public function jlticel_enqueue_scripts() { 46 46 47 // CSS Files . 48 wp_register_style( 'twentytwenty', JLTELIC_ASSETS . 'css/twentytwenty.css' ); 49 // wp_enqueue_style( 'image-comparison-elementor-addon-frontend', JLTELIC_ASSETS . 'css/image-comparison-elementor-addon-frontend.css', JLTELIC_VER, 'all' ); 50 wp_register_style( 'image-comparison-elementor-addon-frontend', JLTELIC_ASSETS . 'css/image-comparison-elementor-addon-frontend.css', JLTELIC_VER, 'all' ); 47 // CSS Files 48 wp_register_style( 'twentytwenty', JLTELIC_ASSETS . 'css/twentytwenty.css', array(), JLTELIC_VER, 'all' ); 49 wp_register_style( 'image-comparison-elementor-addon-frontend', JLTELIC_ASSETS . 'css/image-comparison-elementor-addon-frontend.css', array('twentytwenty'), JLTELIC_VER, 'all' ); 50 51 // Elementor Compatibility Patch - Load early to prevent tools error 52 wp_enqueue_script( 'jlticel-elementor-patch', JLTELIC_ASSETS . 'js/elementor-patch.js', array('jquery'), JLTELIC_VER, false ); 51 53 54 // Also add inline script for immediate patching 55 wp_add_inline_script( 'jquery', 56 'window.addEventListener("load", function() { 57 if (typeof elementorFrontend !== "undefined" && !elementorFrontend.tools) { 58 elementorFrontend.tools = {}; 59 } 60 });', 61 'after' 62 ); 52 63 53 // JS Files .64 // JS Files 54 65 wp_register_script( 'jquery-event-move', JLTELIC_ASSETS . 'js/jquery.event.move.js',array('jquery'), JLTELIC_VER, true ); 55 wp_register_script( 'twentytwenty', JLTELIC_ASSETS . 'js/jquery.twentytwenty.js',array('jquery'), JLTELIC_VER, true ); 56 // wp_register_script( 'master-image-comparison', JLTELIC_ASSETS . 'js/master-image-comparison.js',array('jquery'), JLTELIC_VER, true ); 57 wp_register_script( 'image-comparison-elementor-addon-frontend', JLTELIC_ASSETS . 'js/image-comparison-elementor-addon-frontend.js', array( 'jquery' ), JLTELIC_VER, true ); 58 59 wp_enqueue_script('jquery-event-move'); 60 wp_enqueue_script('twentytwenty'); 61 wp_enqueue_script('image-comparison-elementor-addon-frontend'); 66 wp_register_script( 'twentytwenty', JLTELIC_ASSETS . 'js/jquery.twentytwenty.js',array('jquery', 'jquery-event-move'), JLTELIC_VER, true ); 67 wp_register_script( 'image-comparison-elementor-addon-frontend', JLTELIC_ASSETS . 'js/image-comparison-elementor-addon-frontend.js', array( 'jquery', 'twentytwenty' ), JLTELIC_VER, true ); 62 68 63 69 } -
image-comparison-elementor-addon/trunk/Libs/Recommended.php
r2956950 r3389322 290 290 wp_send_json_error( array( 'mess' => __( 'Nonce is invalid', 'image-comparison-elementor-addon' ) ) ); 291 291 } 292 293 // Check user capabilities 294 if ( ! current_user_can( 'activate_plugins' ) ) { 295 wp_send_json_error( array( 'mess' => __( 'You do not have permission to activate plugins.', 'image-comparison-elementor-addon' ) ) ); 296 } 297 292 298 $file = sanitize_text_field( wp_unslash( $_POST['file'] ) ); 293 299 $result = activate_plugin( $file ); … … 345 351 wp_send_json_error( array( 'mess' => __( 'Nonce is invalid', 'image-comparison-elementor-addon' ) ) ); 346 352 } 353 354 // Check user capabilities - only administrators can install/update plugins 355 if ( ! current_user_can( 'install_plugins' ) ) { 356 wp_send_json_error( array( 'mess' => __( 'You do not have permission to install or update plugins.', 'image-comparison-elementor-addon' ) ) ); 357 } 358 347 359 $plugin = sanitize_text_field( wp_unslash( $_POST['plugin'] ) ); 348 360 $type = isset( $_POST['type'] ) ? sanitize_text_field( wp_unslash( $_POST['type'] ) ) : 'install'; -
image-comparison-elementor-addon/trunk/assets/js/image-comparison-elementor-addon-frontend.js
r2956950 r3389322 13 13 $jltma_image_data = $jltma_image_comp_wrap.data('image-comparison-settings'); 14 14 15 console.log($jltma_image_data);15 // Initialize twentytwenty with settings 16 16 17 17 $jltma_image_comp_wrap.twentytwenty({ … … 30 30 31 31 32 // Elementor Addons 32 // Initialize the widget when DOM is ready 33 $(document).ready(function() { 34 // Initialize all image comparison widgets on the page 35 $('.elementor-widget-master-image-comparison').each(function() { 36 Master_Image_Comparison.Before_After($(this), $); 37 }); 38 }); 39 40 // Also try to hook into Elementor if available (for editor compatibility) 33 41 $(window).on('elementor/frontend/init', function () { 34 if (elementorFrontend.isEditMode()) { editMode = true; } 35 elementorFrontend.hooks.addAction('frontend/element_ready/master-image-comparison.default', Master_Image_Comparison.Before_After ); 42 if (typeof elementorFrontend !== 'undefined' && elementorFrontend.hooks) { 43 try { 44 if (elementorFrontend.isEditMode && elementorFrontend.isEditMode()) { 45 editMode = true; 46 } 47 elementorFrontend.hooks.addAction('frontend/element_ready/master-image-comparison.default', Master_Image_Comparison.Before_After); 48 } catch (e) { 49 // Silently fallback to jQuery initialization 50 } 51 } 36 52 }); 37 53 -
image-comparison-elementor-addon/trunk/class-image-comparison-elementor-addon.php
r2956950 r3389322 54 54 // Body Class. 55 55 add_filter( 'admin_body_class', array( $this, 'jlticel_body_class' ) ); 56 // This should run earlier . 57 // add_action( 'plugins_loaded', [ $this, 'jlticel_maybe_run_upgrades' ], -100 ); . 58 add_action( 'elementor/widgets/widgets_registered', [ $this, 'jlticel_init_widgets' ] ); 56 add_action( 'elementor/widgets/register', [ $this, 'jlticel_init_widgets' ] ); 59 57 60 58 } … … 164 162 * @author Jewel Theme <[email protected]> 165 163 */ 166 public function jlticel_init_widgets() { 167 \Elementor\Plugin::instance()->widgets_manager->register_widget_type( new \JLTELIC\Inc\Addon\Image_Comparison() ); 164 public function jlticel_init_widgets( $widgets_manager = null ) { 165 // Backward compatibility - check if we have the widgets_manager parameter 166 if ( ! $widgets_manager ) { 167 $widgets_manager = \Elementor\Plugin::instance()->widgets_manager; 168 } 169 170 // Use the appropriate registration method based on Elementor version 171 if ( method_exists( $widgets_manager, 'register' ) ) { 172 $widgets_manager->register( new \JLTELIC\Inc\Addon\Image_Comparison() ); 173 } else { 174 // Fallback for older Elementor versions 175 $widgets_manager->register_widget_type( new \JLTELIC\Inc\Addon\Image_Comparison() ); 176 } 168 177 } 169 178 -
image-comparison-elementor-addon/trunk/image-comparison-elementor-addon.php
r2957119 r3389322 4 4 * Plugin URI: https://jeweltheme.com 5 5 * Description: Image comparison addon for elementor page builder plugin. Compare Before and After Images beautifully 6 * Version: 1.0.2. 26 * Version: 1.0.2.3 7 7 * Author: Jewel Theme 8 8 * Author URI: https://jeweltheme.com … … 101 101 include_once JLTELIC_DIR . '/class-image-comparison-elementor-addon.php'; 102 102 } 103 104 -
image-comparison-elementor-addon/trunk/readme.txt
r2957119 r3389322 4 4 Tags: image comparison, before after, after before, image, comparison, elementor, elementor addon, addon, image comparison plugin, image comparison addon 5 5 Requires at least: 4.0 6 Tested up to: 6. 37 Stable tag: 1.0.2. 26 Tested up to: 6.8 7 Stable tag: 1.0.2.3 8 8 Requires PHP: 5.6 9 9 License: GPLv3 or later … … 130 130 4. Image comparison style 131 131 132 132 133 == Changelog == 133 = 1.0.2 (22-08-2022)= 134 135 = 1.0.2.3 = 136 * Security Fix: Added proper capability checks to prevent unauthorized plugin installation (Critical) 137 * Compatibility: Fixed Elementor "Cannot read properties of undefined (reading 'tools')" error 138 * Compatibility: Updated all deprecated Elementor API methods 139 * Performance: Optimized script loading - scripts only load when widget is used 140 * Code Quality: Removed all debug code and console errors for production 141 142 = 1.0.2 = 134 143 * Updated: WordPress 6.3 compatibility checked and fixed bugs 135 144 136 = 1.0.0 (18-02-2020)= 137 * Initial Release 138 145 = 1.0.0 = 146 * Initial Release 139 147 140 148 == Upgrade Notice ==
Note: See TracChangeset
for help on using the changeset viewer.