Plugin Directory

Changeset 3389322


Ignore:
Timestamp:
11/04/2025 05:01:06 AM (2 months ago)
Author:
Litonice13
Message:

Update to version 1.0.2.3 from GitHub

Location:
image-comparison-elementor-addon
Files:
6 added
2 deleted
20 edited
1 copied

Legend:

Unmodified
Added
Removed
  • image-comparison-elementor-addon/tags/1.0.2.3/Inc/Addon/Image_Comparison.php

    r2956950 r3389322  
    66use Elementor\Group_Control_Image_Size;
    77use Elementor\Group_Control_Typography;
    8 use Elementor\Core\Schemes\Typography;
    9 use Elementor\Scheme_Color;
    108use Elementor\Utils;
    119use Elementor\Control_Media;
     
    4543            'jquery-event-move',
    4644            'twentytwenty',
    47             'imagesloaded',
    4845            'image-comparison-elementor-addon-frontend'
    4946        ];
     
    6663    }
    6764
    68     protected function _register_controls() {
     65    protected function register_controls() {
    6966
    7067        $this->start_controls_section(
     
    671668            array(
    672669                'name'     => 'jltma_image_comparison_before_label_typography_group',
    673                 'scheme'   => Typography::TYPOGRAPHY_1,
    674670                'selector' => '{{WRAPPER}} .jltma-image-comparison .twentytwenty-before-label:before',
    675671            )
     
    756752            array(
    757753                'name'     => 'jltma_image_comparison_after_label_typography_group',
    758                 'scheme'   => Typography::TYPOGRAPHY_1,
    759754                'selector' => '{{WRAPPER}} .jltma-image-comparison .twentytwenty-after-label:before',
    760755            )
     
    900895
    901896    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        }
    904905
    905906        $this->add_render_attribute(
     
    912913                        'jltma-image-comparison-' . esc_attr( $this->get_id()),
    913914                    ]),
    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                    ]))
    927926                ]
    928927            ]
  • image-comparison-elementor-addon/tags/1.0.2.3/Libs/Assets.php

    r2956950 r3389322  
    2323         */
    2424        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 );
    2727            add_action( 'admin_enqueue_scripts', array( $this, 'jlticel_admin_enqueue_scripts' ), 100 );
    2828        }
     
    4545        public function jlticel_enqueue_scripts() {
    4646
    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 );
    5153           
     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            );
    5263
    53             // JS Files .
     64            // JS Files
    5465            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 );
    6268
    6369        }
  • image-comparison-elementor-addon/tags/1.0.2.3/Libs/Recommended.php

    r2956950 r3389322  
    290290                        wp_send_json_error( array( 'mess' => __( 'Nonce is invalid', 'image-comparison-elementor-addon' ) ) );
    291291                    }
     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
    292298                    $file   = sanitize_text_field( wp_unslash( $_POST['file'] ) );
    293299                    $result = activate_plugin( $file );
     
    345351                        wp_send_json_error( array( 'mess' => __( 'Nonce is invalid', 'image-comparison-elementor-addon' ) ) );
    346352                    }
     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
    347359                    $plugin   = sanitize_text_field( wp_unslash( $_POST['plugin'] ) );
    348360                    $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  
    1313                $jltma_image_data            = $jltma_image_comp_wrap.data('image-comparison-settings');
    1414
    15                 console.log($jltma_image_data);
     15                // Initialize twentytwenty with settings
    1616
    1717                $jltma_image_comp_wrap.twentytwenty({
     
    3030
    3131
    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)
    3341    $(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        }
    3652    });
    3753
  • image-comparison-elementor-addon/tags/1.0.2.3/class-image-comparison-elementor-addon.php

    r2956950 r3389322  
    5454            // Body Class.
    5555            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' ] );
    5957
    6058        }
     
    164162         * @author Jewel Theme <[email protected]>
    165163         */
    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            }
    168177        }
    169178
  • image-comparison-elementor-addon/tags/1.0.2.3/image-comparison-elementor-addon.php

    r2957119 r3389322  
    44 * Plugin URI:  https://jeweltheme.com
    55 * Description: Image comparison addon for elementor page builder plugin. Compare Before and After Images beautifully
    6  * Version:     1.0.2.2
     6 * Version:     1.0.2.3
    77 * Author:      Jewel Theme
    88 * Author URI:  https://jeweltheme.com
     
    101101    include_once JLTELIC_DIR . '/class-image-comparison-elementor-addon.php';
    102102}
     103
     104
  • image-comparison-elementor-addon/tags/1.0.2.3/readme.txt

    r2957119 r3389322  
    44Tags: image comparison, before after, after before, image, comparison, elementor, elementor addon, addon, image comparison plugin, image comparison addon
    55Requires at least: 4.0
    6 Tested up to: 6.3
    7 Stable tag: 1.0.2.2
     6Tested up to: 6.8
     7Stable tag: 1.0.2.3
    88Requires PHP: 5.6
    99License: GPLv3 or later
     
    1301304. Image comparison style
    131131
     132
    132133== 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 =
    134143* Updated: WordPress 6.3 compatibility checked and fixed bugs
    135144
    136  = 1.0.0 (18-02-2020)=
    137  * Initial Release
    138 
     145= 1.0.0 =
     146* Initial Release
    139147
    140148== Upgrade Notice ==
  • image-comparison-elementor-addon/trunk/Inc/Addon/Image_Comparison.php

    r2956950 r3389322  
    66use Elementor\Group_Control_Image_Size;
    77use Elementor\Group_Control_Typography;
    8 use Elementor\Core\Schemes\Typography;
    9 use Elementor\Scheme_Color;
    108use Elementor\Utils;
    119use Elementor\Control_Media;
     
    4543            'jquery-event-move',
    4644            'twentytwenty',
    47             'imagesloaded',
    4845            'image-comparison-elementor-addon-frontend'
    4946        ];
     
    6663    }
    6764
    68     protected function _register_controls() {
     65    protected function register_controls() {
    6966
    7067        $this->start_controls_section(
     
    671668            array(
    672669                'name'     => 'jltma_image_comparison_before_label_typography_group',
    673                 'scheme'   => Typography::TYPOGRAPHY_1,
    674670                'selector' => '{{WRAPPER}} .jltma-image-comparison .twentytwenty-before-label:before',
    675671            )
     
    756752            array(
    757753                'name'     => 'jltma_image_comparison_after_label_typography_group',
    758                 'scheme'   => Typography::TYPOGRAPHY_1,
    759754                'selector' => '{{WRAPPER}} .jltma-image-comparison .twentytwenty-after-label:before',
    760755            )
     
    900895
    901896    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        }
    904905
    905906        $this->add_render_attribute(
     
    912913                        'jltma-image-comparison-' . esc_attr( $this->get_id()),
    913914                    ]),
    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                    ]))
    927926                ]
    928927            ]
  • image-comparison-elementor-addon/trunk/Libs/Assets.php

    r2956950 r3389322  
    2323         */
    2424        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 );
    2727            add_action( 'admin_enqueue_scripts', array( $this, 'jlticel_admin_enqueue_scripts' ), 100 );
    2828        }
     
    4545        public function jlticel_enqueue_scripts() {
    4646
    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 );
    5153           
     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            );
    5263
    53             // JS Files .
     64            // JS Files
    5465            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 );
    6268
    6369        }
  • image-comparison-elementor-addon/trunk/Libs/Recommended.php

    r2956950 r3389322  
    290290                        wp_send_json_error( array( 'mess' => __( 'Nonce is invalid', 'image-comparison-elementor-addon' ) ) );
    291291                    }
     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
    292298                    $file   = sanitize_text_field( wp_unslash( $_POST['file'] ) );
    293299                    $result = activate_plugin( $file );
     
    345351                        wp_send_json_error( array( 'mess' => __( 'Nonce is invalid', 'image-comparison-elementor-addon' ) ) );
    346352                    }
     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
    347359                    $plugin   = sanitize_text_field( wp_unslash( $_POST['plugin'] ) );
    348360                    $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  
    1313                $jltma_image_data            = $jltma_image_comp_wrap.data('image-comparison-settings');
    1414
    15                 console.log($jltma_image_data);
     15                // Initialize twentytwenty with settings
    1616
    1717                $jltma_image_comp_wrap.twentytwenty({
     
    3030
    3131
    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)
    3341    $(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        }
    3652    });
    3753
  • image-comparison-elementor-addon/trunk/class-image-comparison-elementor-addon.php

    r2956950 r3389322  
    5454            // Body Class.
    5555            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' ] );
    5957
    6058        }
     
    164162         * @author Jewel Theme <[email protected]>
    165163         */
    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            }
    168177        }
    169178
  • image-comparison-elementor-addon/trunk/image-comparison-elementor-addon.php

    r2957119 r3389322  
    44 * Plugin URI:  https://jeweltheme.com
    55 * Description: Image comparison addon for elementor page builder plugin. Compare Before and After Images beautifully
    6  * Version:     1.0.2.2
     6 * Version:     1.0.2.3
    77 * Author:      Jewel Theme
    88 * Author URI:  https://jeweltheme.com
     
    101101    include_once JLTELIC_DIR . '/class-image-comparison-elementor-addon.php';
    102102}
     103
     104
  • image-comparison-elementor-addon/trunk/readme.txt

    r2957119 r3389322  
    44Tags: image comparison, before after, after before, image, comparison, elementor, elementor addon, addon, image comparison plugin, image comparison addon
    55Requires at least: 4.0
    6 Tested up to: 6.3
    7 Stable tag: 1.0.2.2
     6Tested up to: 6.8
     7Stable tag: 1.0.2.3
    88Requires PHP: 5.6
    99License: GPLv3 or later
     
    1301304. Image comparison style
    131131
     132
    132133== 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 =
    134143* Updated: WordPress 6.3 compatibility checked and fixed bugs
    135144
    136  = 1.0.0 (18-02-2020)=
    137  * Initial Release
    138 
     145= 1.0.0 =
     146* Initial Release
    139147
    140148== Upgrade Notice ==
Note: See TracChangeset for help on using the changeset viewer.