| @@ -2,9 +2,9 @@ | ||
| 2 | 2 | /** |
| 3 | 3 | * Plugin Name: Easy Elements |
| 4 | 4 | * Plugin URI: https://wpeasyelements.com/ |
| 5 | 5 | * Description: Provides a set of custom Elementor widgets, shortcodes, and enhancements. |
| 6 | - * Version: 1.2.8 | |
| 6 | + * Version: 1.2.1 | |
| 7 | 7 | * Author: Themewant |
| 8 | 8 | * Author URI: https://themewant.com/ |
| 9 | 9 | * Text Domain: easy-elements |
| 10 | 10 | * Domain Path: /languages |
| @@ -15,16 +15,10 @@ | ||
| 15 | 15 | if ( ! defined( 'ABSPATH' ) ) { |
| 16 | 16 | exit; |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | +define( 'EASYELEMENTS_VER', '1.2.1' ); | |
| 19 | 20 | |
| 20 | -define( 'EASY_ELEMENTS_DEV', false ); | |
| 21 | -if ( defined( 'EASY_ELEMENTS_DEV' ) && true == EASY_ELEMENTS_DEV ) { | |
| 22 | - define('EASYELEMENTS_VER', '1.2.8' . time() ); | |
| 23 | -} else { | |
| 24 | - define( 'EASYELEMENTS_VER', '1.2.8' ); | |
| 25 | -} | |
| 26 | - | |
| 27 | 21 | // Define constants |
| 28 | 22 | define( 'EASYELEMENTS_FILE', __FILE__ ); |
| 29 | 23 | define( 'EASYELEMENTS_DIR_PATH', plugin_dir_path( __FILE__ ) ); |
| 30 | 24 | define( 'EASYELEMENTS_DIR_URL', plugin_dir_url( __FILE__ ) ); |
| @@ -29,9 +23,9 @@ | ||
| 29 | 23 | define( 'EASYELEMENTS_DIR_PATH', plugin_dir_path( __FILE__ ) ); |
| 30 | 24 | define( 'EASYELEMENTS_DIR_URL', plugin_dir_url( __FILE__ ) ); |
| 31 | 25 | define( 'EASYELEMENTS_ASSETS_URL', EASYELEMENTS_DIR_URL . 'assets/' ); |
| 32 | 26 | define( 'EASYELEMENTS_URL', plugins_url( '/', __FILE__ ) ); |
| 33 | -define( 'EASYELEMENTS_PATH', plugin_basename( EASYELEMENTS_FILE ) ); | |
| 27 | +define( 'EASYELEMENTS_PATH', plugin_basename( __FILE__ ) ); | |
| 34 | 28 | define( 'EASYELEMENTS_DOMAIN', trailingslashit( 'https://wpeasyelements.com/' ) ); |
| 35 | 29 | define( 'EASYELEMENTS_URL_ADMIN', plugin_dir_url( __FILE__ ) ); |
| 36 | 30 | define( 'EASYELEMENTS_ASSETS_ADMIN', trailingslashit( EASYELEMENTS_URL_ADMIN ) ); |
| 37 | 31 | |
| @@ -38,7 +32,73 @@ | ||
| 38 | 32 | if ( ! defined( 'EASY_EXTENSION_BADGE' ) ) { |
| 39 | 33 | define( 'EASY_EXTENSION_BADGE', '<span class="easy-extension-badge"></span>' ); |
| 40 | 34 | } |
| 41 | 35 | |
| 42 | -require_once __DIR__ . '/vendor/autoload.php'; | |
| 36 | +require_once EASYELEMENTS_DIR_PATH . 'inc/class-loader.php'; | |
| 43 | 37 | |
| 44 | -require_once EASYELEMENTS_DIR_PATH . 'base.php'; | |
| 38 | +register_activation_hook( EASYELEMENTS_FILE, 'easy_elements_activate' ); | |
| 39 | + | |
| 40 | +function easy_elements_activate() { | |
| 41 | + | |
| 42 | + if ( class_exists( 'Easyel_Elements' ) ) { | |
| 43 | + | |
| 44 | + $option_key_extension = 'easy_element_extensions'; | |
| 45 | + $settings = get_option( $option_key_extension, [] ); | |
| 46 | + | |
| 47 | + $include_extension = array( | |
| 48 | + "enable_wrapper_link", | |
| 49 | + "enable_post_duplicator", | |
| 50 | + "enable_dynamic_content", | |
| 51 | + ); | |
| 52 | + | |
| 53 | + $fields2 = []; | |
| 54 | + | |
| 55 | + if ( function_exists('easyel_get_extension_fields') ) { | |
| 56 | + $fields2 = easyel_get_extension_fields(); | |
| 57 | + } | |
| 58 | + | |
| 59 | + foreach ( $fields2 as $key => $data ) { | |
| 60 | + | |
| 61 | + if ( array_key_exists( $key, $settings ) ) { | |
| 62 | + continue; | |
| 63 | + } | |
| 64 | + | |
| 65 | + $settings[$key] = in_array( $key, $include_extension, true ) ? 1 : 0; | |
| 66 | + } | |
| 67 | + | |
| 68 | + update_option( $option_key_extension, $settings ); | |
| 69 | + | |
| 70 | + $include_widget = array( | |
| 71 | + "easy_table", | |
| 72 | + "bmi_calculator", | |
| 73 | + ); | |
| 74 | + | |
| 75 | + $available_elements = Easyel_Elements::get_instance()->easyel_elements_get_available_widgets(); | |
| 76 | + $tab = 'widget'; | |
| 77 | + | |
| 78 | + foreach ( $available_elements as $key => $widget ) { | |
| 79 | + | |
| 80 | + if ( isset( $widget['tab'] ) && $widget['tab'] === $tab ) { | |
| 81 | + | |
| 82 | + $option_name = 'easy_element_' . $tab . '_' . $key; | |
| 83 | + | |
| 84 | + $existing_value = get_option( $option_name, null ); | |
| 85 | + | |
| 86 | + if ( $existing_value !== null ) { | |
| 87 | + continue; | |
| 88 | + } | |
| 89 | + | |
| 90 | + if ( in_array( $key, $include_widget, true ) ) { | |
| 91 | + add_option( $option_name, '0' ); | |
| 92 | + } | |
| 93 | + } | |
| 94 | + } | |
| 95 | + } | |
| 96 | + | |
| 97 | + flush_rewrite_rules(); | |
| 98 | +} | |
| 99 | + | |
| 100 | +add_action( 'plugins_loaded', function() { | |
| 101 | + if ( class_exists( 'Easy_Header_Footer_Elementor' ) ) { | |
| 102 | + Easy_Header_Footer_Elementor::instance(); | |
| 103 | + } | |
| 104 | +}); | |