Elementor' ); } elseif ( defined( 'ELEMENTOR_VERSION' ) && version_compare( ELEMENTOR_VERSION, PIXLORA_MIN_ELEMENTOR_VERSION, '<' ) ) { $notices[] = sprintf( /* translators: 1: Elementor plugin name, 2: required version */ esc_html__( 'Pixlora Elements requires %1$s version %2$s or greater.', 'pixlora-elements' ), 'Elementor', PIXLORA_MIN_ELEMENTOR_VERSION ); } if ( empty( $notices ) ) { return true; } add_action( 'admin_notices', function () use ( $notices ) { if ( ! current_user_can( 'activate_plugins' ) ) { return; } foreach ( $notices as $notice ) { printf( '

%s

', wp_kses_post( $notice ) ); } } ); return false; } /** * Activation hook. */ function pixlora_activate() { if ( version_compare( PHP_VERSION, PIXLORA_MIN_PHP_VERSION, '<' ) ) { deactivate_plugins( PIXLORA_BASENAME ); wp_die( esc_html__( 'Pixlora Elements requires PHP 7.4 or greater.', 'pixlora-elements' ), esc_html__( 'Plugin activation error', 'pixlora-elements' ), array( 'back_link' => true ) ); } /* * Elementor is not checked here: the activation request runs before * "plugins_loaded", so Elementor has not booted yet even when it is active. * The "Requires Plugins: elementor" header makes WordPress block activation * while Elementor is inactive, and pixlora_check_requirements() shows an * admin notice (and keeps the plugin idle) if Elementor is later missing * or outdated. */ add_option( 'pixlora_version', PIXLORA_VERSION ); flush_rewrite_rules(); } register_activation_hook( __FILE__, 'pixlora_activate' ); /** * Deactivation hook. */ function pixlora_deactivate() { flush_rewrite_rules(); } register_deactivation_hook( __FILE__, 'pixlora_deactivate' );