Plugin Directory

Changeset 3452972


Ignore:
Timestamp:
02/03/2026 02:45:02 PM (5 weeks ago)
Author:
dynamicooo
Message:

Add minimum Elementor version check (3.25.0)

Location:
dynamic-inspector-for-elementor
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • dynamic-inspector-for-elementor/tags/1.0.0/core/plugin.php

    r3452953 r3452972  
    4545     */
    4646    private function init() {
    47         // Check if Elementor is loaded
    48         if ( ! did_action( 'elementor/loaded' ) ) {
    49             add_action( 'admin_notices', [ $this, 'elementor_missing_notice' ] );
    50             return;
    51         }
    52 
    5347        $this->notices = new \DynamicInspectorForElementor\AdminPages\Notices();
    5448
     
    174168        return $this->frontend_inspector_manager;
    175169    }
    176 
    177     /**
    178      * @return void
    179      */
    180     public function elementor_missing_notice() {
    181         $message = sprintf(
    182         /* translators: 1: Plugin name 2: Elementor */
    183             esc_html__( '"%1$s" requires "%2$s" to be installed and activated.', 'dynamic-inspector-for-elementor' ),
    184             '<strong>' . esc_html__( 'Dynamic Inspector for Elementor', 'dynamic-inspector-for-elementor' ) . '</strong>',
    185             '<strong>' . esc_html__( 'Elementor', 'dynamic-inspector-for-elementor' ) . '</strong>'
    186         );
    187 
    188         printf( '<div class="notice notice-warning is-dismissible"><p>%1$s</p></div>', wp_kses_post( $message ) );
    189     }
    190170}
  • dynamic-inspector-for-elementor/tags/1.0.0/dynamic-inspector-for-elementor.php

    r3452953 r3452972  
    4545define( 'DIFE_URL', plugin_dir_url( __FILE__ ) );
    4646define( 'DIFE_PLUGIN_BASE', plugin_basename( __FILE__ ) );
     47define( 'DIFE_PRODUCT_NAME', 'Dynamic Inspector for Elementor' );
     48
     49// Required versions
     50define( 'DIFE_MINIMUM_ELEMENTOR_VERSION', '3.25.0' );
     51define( 'DIFE_MINIMUM_ELEMENTOR_PRO_VERSION', '3.25.0' );
    4752
    4853/**
     
    5257 */
    5358function dife_load_plugin() {
     59    // Check if Elementor is loaded
     60    if ( ! did_action( 'elementor/loaded' ) ) {
     61        add_action( 'admin_notices', 'dife_fail_load' );
     62        return;
     63    }
     64
     65    // Check Elementor version
     66    if ( defined( 'ELEMENTOR_VERSION' ) && version_compare( ELEMENTOR_VERSION, DIFE_MINIMUM_ELEMENTOR_VERSION, '<' ) ) {
     67        add_action( 'admin_notices', 'dife_admin_notice_minimum_elementor_version' );
     68        return;
     69    }
     70
     71    // Check Elementor Pro version (only if Pro is active)
     72    if ( defined( 'ELEMENTOR_PRO_VERSION' ) && version_compare( ELEMENTOR_PRO_VERSION, DIFE_MINIMUM_ELEMENTOR_PRO_VERSION, '<' ) ) {
     73        add_action( 'admin_notices', 'dife_admin_notice_minimum_elementor_pro_version' );
     74        return;
     75    }
     76
    5477    // Simple autoloader for plugin classes
    5578    spl_autoload_register(
     
    91114    echo '<div class="error"><p>' . wp_kses_post( $msg ) . '</p></div>';
    92115}
     116
     117/**
     118 * @return void
     119 */
     120function dife_admin_notice_minimum_elementor_version() {
     121    /* translators: %1$s: product name, %2$s: minimum Elementor version */
     122    $msg = sprintf( esc_html__( '%1$s requires Elementor version %2$s or greater.', 'dynamic-inspector-for-elementor' ), DIFE_PRODUCT_NAME, DIFE_MINIMUM_ELEMENTOR_VERSION );
     123    echo '<div class="notice notice-error"><p>' . esc_html( $msg ) . '</p></div>';
     124}
     125
     126/**
     127 * @return void
     128 */
     129function dife_admin_notice_minimum_elementor_pro_version() {
     130    /* translators: %1$s: product name, %2$s: minimum Elementor Pro version */
     131    $msg = sprintf( esc_html__( 'If you want to use Elementor Pro with %1$s, it requires version %2$s or greater.', 'dynamic-inspector-for-elementor' ), DIFE_PRODUCT_NAME, DIFE_MINIMUM_ELEMENTOR_PRO_VERSION );
     132    echo '<div class="notice notice-error"><p>' . esc_html( $msg ) . '</p></div>';
     133}
  • dynamic-inspector-for-elementor/trunk/core/plugin.php

    r3452953 r3452972  
    4545     */
    4646    private function init() {
    47         // Check if Elementor is loaded
    48         if ( ! did_action( 'elementor/loaded' ) ) {
    49             add_action( 'admin_notices', [ $this, 'elementor_missing_notice' ] );
    50             return;
    51         }
    52 
    5347        $this->notices = new \DynamicInspectorForElementor\AdminPages\Notices();
    5448
     
    174168        return $this->frontend_inspector_manager;
    175169    }
    176 
    177     /**
    178      * @return void
    179      */
    180     public function elementor_missing_notice() {
    181         $message = sprintf(
    182         /* translators: 1: Plugin name 2: Elementor */
    183             esc_html__( '"%1$s" requires "%2$s" to be installed and activated.', 'dynamic-inspector-for-elementor' ),
    184             '<strong>' . esc_html__( 'Dynamic Inspector for Elementor', 'dynamic-inspector-for-elementor' ) . '</strong>',
    185             '<strong>' . esc_html__( 'Elementor', 'dynamic-inspector-for-elementor' ) . '</strong>'
    186         );
    187 
    188         printf( '<div class="notice notice-warning is-dismissible"><p>%1$s</p></div>', wp_kses_post( $message ) );
    189     }
    190170}
  • dynamic-inspector-for-elementor/trunk/dynamic-inspector-for-elementor.php

    r3452953 r3452972  
    4545define( 'DIFE_URL', plugin_dir_url( __FILE__ ) );
    4646define( 'DIFE_PLUGIN_BASE', plugin_basename( __FILE__ ) );
     47define( 'DIFE_PRODUCT_NAME', 'Dynamic Inspector for Elementor' );
     48
     49// Required versions
     50define( 'DIFE_MINIMUM_ELEMENTOR_VERSION', '3.25.0' );
     51define( 'DIFE_MINIMUM_ELEMENTOR_PRO_VERSION', '3.25.0' );
    4752
    4853/**
     
    5257 */
    5358function dife_load_plugin() {
     59    // Check if Elementor is loaded
     60    if ( ! did_action( 'elementor/loaded' ) ) {
     61        add_action( 'admin_notices', 'dife_fail_load' );
     62        return;
     63    }
     64
     65    // Check Elementor version
     66    if ( defined( 'ELEMENTOR_VERSION' ) && version_compare( ELEMENTOR_VERSION, DIFE_MINIMUM_ELEMENTOR_VERSION, '<' ) ) {
     67        add_action( 'admin_notices', 'dife_admin_notice_minimum_elementor_version' );
     68        return;
     69    }
     70
     71    // Check Elementor Pro version (only if Pro is active)
     72    if ( defined( 'ELEMENTOR_PRO_VERSION' ) && version_compare( ELEMENTOR_PRO_VERSION, DIFE_MINIMUM_ELEMENTOR_PRO_VERSION, '<' ) ) {
     73        add_action( 'admin_notices', 'dife_admin_notice_minimum_elementor_pro_version' );
     74        return;
     75    }
     76
    5477    // Simple autoloader for plugin classes
    5578    spl_autoload_register(
     
    91114    echo '<div class="error"><p>' . wp_kses_post( $msg ) . '</p></div>';
    92115}
     116
     117/**
     118 * @return void
     119 */
     120function dife_admin_notice_minimum_elementor_version() {
     121    /* translators: %1$s: product name, %2$s: minimum Elementor version */
     122    $msg = sprintf( esc_html__( '%1$s requires Elementor version %2$s or greater.', 'dynamic-inspector-for-elementor' ), DIFE_PRODUCT_NAME, DIFE_MINIMUM_ELEMENTOR_VERSION );
     123    echo '<div class="notice notice-error"><p>' . esc_html( $msg ) . '</p></div>';
     124}
     125
     126/**
     127 * @return void
     128 */
     129function dife_admin_notice_minimum_elementor_pro_version() {
     130    /* translators: %1$s: product name, %2$s: minimum Elementor Pro version */
     131    $msg = sprintf( esc_html__( 'If you want to use Elementor Pro with %1$s, it requires version %2$s or greater.', 'dynamic-inspector-for-elementor' ), DIFE_PRODUCT_NAME, DIFE_MINIMUM_ELEMENTOR_PRO_VERSION );
     132    echo '<div class="notice notice-error"><p>' . esc_html( $msg ) . '</p></div>';
     133}
Note: See TracChangeset for help on using the changeset viewer.