essential-addons-for-elementor-lite
Last commit date
assets
7 years ago
elements
7 years ago
includes
7 years ago
languages
7 years ago
vendor
7 years ago
essential_adons_elementor.php
7 years ago
readme.txt
7 years ago
essential_adons_elementor.php
324 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Plugin Name: Essential Addons for Elementor |
| 4 | * Description: The ultimate elements library for Elementor page builder plugin for WordPress. |
| 5 | * Plugin URI: https://essential-addons.com/elementor/ |
| 6 | * Author: WPDeveloper |
| 7 | * Version: 2.10.2 |
| 8 | * Author URI: https://wpdeveloper.net/ |
| 9 | * |
| 10 | * Text Domain: essential-addons-elementor |
| 11 | * Domain Path: /languages |
| 12 | */ |
| 13 | |
| 14 | if (!defined('ABSPATH')) { |
| 15 | exit; |
| 16 | } // Exit if accessed directly |
| 17 | |
| 18 | /** |
| 19 | * Including composer autoload. |
| 20 | * |
| 21 | * @since 3.0.0 |
| 22 | */ |
| 23 | require_once plugin_dir_path(__FILE__) . 'vendor/autoload.php'; |
| 24 | |
| 25 | /** |
| 26 | * Skeleton of Essential Addons |
| 27 | * |
| 28 | * @since 3.0.0 |
| 29 | */ |
| 30 | class Essential_Addons_Elementor |
| 31 | { |
| 32 | use Essential_Addons_Elementor\Traits\Core; |
| 33 | use Essential_Addons_Elementor\Traits\Helper; |
| 34 | use Essential_Addons_Elementor\Traits\Generator; |
| 35 | use Essential_Addons_Elementor\Traits\Enqueue; |
| 36 | use Essential_Addons_Elementor\Traits\Admin; |
| 37 | use Essential_Addons_Elementor\Traits\Elements; |
| 38 | |
| 39 | public $registered_elements; |
| 40 | public $transient_elements; |
| 41 | |
| 42 | /** |
| 43 | * Constructor of plugin class |
| 44 | * |
| 45 | * @since 3.0.0 |
| 46 | */ |
| 47 | public function __construct() |
| 48 | { |
| 49 | // define plugins constants |
| 50 | define('EAEL_PLUGIN_FILE', __FILE__); |
| 51 | define('EAEL_PLUGIN_BASENAME', plugin_basename(__FILE__)); |
| 52 | define('EAEL_PLUGIN_PATH', plugin_dir_path(__FILE__)); |
| 53 | define('EAEL_PLUGIN_URL', plugins_url('/', __FILE__)); |
| 54 | define('EAEL_PLUGIN_VERSION', '2.10.2'); |
| 55 | define('EAEL_ASSET_PATH', wp_upload_dir()['basedir'] . DIRECTORY_SEPARATOR . 'essential-addons-elementor'); |
| 56 | define('EAEL_ASSET_URL', wp_upload_dir()['baseurl'] . '/essential-addons-elementor'); |
| 57 | |
| 58 | // define elements classmap |
| 59 | $this->registered_elements = [ |
| 60 | 'post-grid' => [ |
| 61 | 'class' => 'Eael_Post_Grid', |
| 62 | 'dependency' => [ |
| 63 | 'css' => [ |
| 64 | 'assets/front-end/css/product-grid.css', |
| 65 | ], |
| 66 | 'js' => [ |
| 67 | 'assets/front-end/js/vendor/isotope/isotope.pkgd.min.js', |
| 68 | 'assets/front-end/js/vendor/load-more/load-more.js', |
| 69 | ], |
| 70 | ], |
| 71 | ], |
| 72 | 'post-timeline' => [ |
| 73 | 'class' => 'Eael_Post_Timeline', |
| 74 | 'dependency' => [ |
| 75 | 'js' => [ |
| 76 | 'assets/front-end/js/vendor/load-more/load-more.js', |
| 77 | ], |
| 78 | ], |
| 79 | ], |
| 80 | 'fancy-text' => [ |
| 81 | 'class' => 'Eael_Fancy_Text', |
| 82 | 'dependency' => [ |
| 83 | 'js' => [ |
| 84 | 'assets/front-end/js/vendor/fancy-text/fancy-text.js', |
| 85 | ], |
| 86 | ], |
| 87 | ], |
| 88 | 'creative-btn' => [ |
| 89 | 'class' => 'Eael_Creative_Button', |
| 90 | ], |
| 91 | 'count-down' => [ |
| 92 | 'class' => 'Eael_Countdown', |
| 93 | 'dependency' => [ |
| 94 | 'js' => [ |
| 95 | 'assets/front-end/js/vendor/count-down/count-down.min.js', |
| 96 | ], |
| 97 | ], |
| 98 | ], |
| 99 | 'team-members' => [ |
| 100 | 'class' => 'Eael_Team_Member', |
| 101 | ], |
| 102 | 'testimonials' => [ |
| 103 | 'class' => 'Eael_Testimonial', |
| 104 | ], |
| 105 | 'info-box' => [ |
| 106 | 'class' => 'Eael_Info_Box', |
| 107 | ], |
| 108 | 'flip-box' => [ |
| 109 | 'class' => 'Eael_Flip_Box', |
| 110 | ], |
| 111 | 'call-to-action' => [ |
| 112 | 'class' => 'Eael_Cta_Box', |
| 113 | ], |
| 114 | 'dual-header' => [ |
| 115 | 'class' => 'Eael_Dual_Color_Header', |
| 116 | ], |
| 117 | 'price-table' => [ |
| 118 | 'class' => 'Eael_Pricing_Table', |
| 119 | 'dependency' => [ |
| 120 | 'js' => [ |
| 121 | 'assets/front-end/js/vendor/tooltipster/tooltipster.bundle.min.js', |
| 122 | ], |
| 123 | ], |
| 124 | ], |
| 125 | 'twitter-feed' => [ |
| 126 | 'class' => 'Eael_Twitter_Feed', |
| 127 | 'dependency' => [ |
| 128 | 'js' => [ |
| 129 | 'assets/front-end/js/vendor/isotope/isotope.pkgd.min.js', |
| 130 | 'assets/front-end/js/vendor/social-feeds/codebird.js', |
| 131 | 'assets/front-end/js/vendor/social-feeds/doT.min.js', |
| 132 | 'assets/front-end/js/vendor/social-feeds/moment.js', |
| 133 | 'assets/front-end/js/vendor/social-feeds/jquery.socialfeed.js', |
| 134 | ], |
| 135 | ], |
| 136 | ], |
| 137 | 'data-table' => [ |
| 138 | 'class' => 'Eael_Data_Table', |
| 139 | ], |
| 140 | 'filter-gallery' => [ |
| 141 | 'class' => 'Eael_Filterable_Gallery', |
| 142 | 'dependency' => [ |
| 143 | 'css' => [ |
| 144 | 'assets/front-end/css/magnific-popup.css', |
| 145 | ], |
| 146 | 'js' => [ |
| 147 | 'assets/front-end/js/vendor/isotope/isotope.pkgd.min.js', |
| 148 | 'assets/front-end/js/vendor/magnific-popup/jquery.magnific-popup.min.js', |
| 149 | ], |
| 150 | ], |
| 151 | ], |
| 152 | 'image-accordion' => [ |
| 153 | 'class' => 'Eael_Image_Accordion', |
| 154 | ], |
| 155 | 'content-ticker' => [ |
| 156 | 'class' => 'Eael_Content_Ticker', |
| 157 | ], |
| 158 | 'tooltip' => [ |
| 159 | 'class' => 'Eael_Tooltip', |
| 160 | ], |
| 161 | 'adv-accordion' => [ |
| 162 | 'class' => 'Eael_Adv_Accordion', |
| 163 | ], |
| 164 | 'adv-tabs' => [ |
| 165 | 'class' => 'Eael_Adv_Tabs', |
| 166 | ], |
| 167 | 'progress-bar' => [ |
| 168 | 'class' => 'Eael_Progress_Bar', |
| 169 | 'dependency' => [ |
| 170 | 'js' => [ |
| 171 | 'assets/front-end/js/vendor/progress-bar/progress-bar.min.js', |
| 172 | 'assets/front-end/js/vendor/inview/inview.min.js', |
| 173 | ], |
| 174 | ], |
| 175 | ], |
| 176 | 'feature-list' => [ |
| 177 | 'class' => 'Eael_Feature_List', |
| 178 | ], |
| 179 | 'product-grid' => [ |
| 180 | 'class' => 'Eael_Product_Grid', |
| 181 | 'condition' => [ |
| 182 | 'function_exists', |
| 183 | 'WC', |
| 184 | ], |
| 185 | ], |
| 186 | 'contact-form-7' => [ |
| 187 | 'class' => 'Eael_Contact_Form_7', |
| 188 | 'condition' => [ |
| 189 | 'function_exists', |
| 190 | 'wpcf7', |
| 191 | ], |
| 192 | ], |
| 193 | 'weforms' => [ |
| 194 | 'class' => 'Eael_WeForms', |
| 195 | 'condition' => [ |
| 196 | 'function_exists', |
| 197 | 'WeForms', |
| 198 | ], |
| 199 | ], |
| 200 | 'ninja-form' => [ |
| 201 | 'class' => 'Eael_NinjaForms', |
| 202 | 'condition' => [ |
| 203 | 'function_exists', |
| 204 | 'Ninja_Forms', |
| 205 | ], |
| 206 | ], |
| 207 | 'gravity-form' => [ |
| 208 | 'class' => 'Eael_GravityForms', |
| 209 | 'condition' => [ |
| 210 | 'class_exists', |
| 211 | 'GFForms', |
| 212 | ], |
| 213 | ], |
| 214 | 'caldera-form' => [ |
| 215 | 'class' => 'Eael_Caldera_Forms', |
| 216 | 'condition' => [ |
| 217 | 'class_exists', |
| 218 | 'Caldera_Forms', |
| 219 | ], |
| 220 | ], |
| 221 | 'wpforms' => [ |
| 222 | 'class' => 'Eael_WpForms', |
| 223 | 'condition' => [ |
| 224 | 'class_exists', |
| 225 | '\WPForms\WPForms', |
| 226 | ], |
| 227 | ], |
| 228 | ]; |
| 229 | |
| 230 | // initialize transient elements |
| 231 | $this->transient_elements = []; |
| 232 | } |
| 233 | |
| 234 | public function run() |
| 235 | { |
| 236 | // Start plugin tracking |
| 237 | $this->start_plugin_tracking(); |
| 238 | |
| 239 | // Generator |
| 240 | add_action('elementor/frontend/before_render', array($this, 'collect_transient_elements')); |
| 241 | add_action('elementor/editor/after_save', array($this, 'set_transient_status')); |
| 242 | add_action('loop_end', array($this, 'generate_post_scripts')); |
| 243 | |
| 244 | // Enqueue |
| 245 | add_action('wp_enqueue_scripts', array($this, 'enqueue_scripts')); |
| 246 | |
| 247 | // Ajax |
| 248 | add_action('wp_ajax_load_more', array($this, 'eael_load_more_ajax')); |
| 249 | add_action('wp_ajax_nopriv_load_more', array($this, 'eael_load_more_ajax')); |
| 250 | |
| 251 | // Elements |
| 252 | add_action('elementor/widgets/widgets_registered', array($this, 'eael_add_elements')); |
| 253 | add_action('elementor/controls/controls_registered', array($this, 'controls_registered')); |
| 254 | add_action('elementor/elements/categories_registered', array($this, 'add_elementor_widget_categories')); |
| 255 | |
| 256 | // Admin |
| 257 | if (is_admin()) { |
| 258 | // Admin |
| 259 | $this->admin_notice(); |
| 260 | add_action('admin_menu', array($this, 'admin_menu'), 600); |
| 261 | add_action('admin_enqueue_scripts', array($this, 'admin_enqueue_scripts')); |
| 262 | add_action('wp_ajax_save_settings_with_ajax', array($this, 'save_settings')); |
| 263 | add_action('wp_ajax_clear_cache_files_with_ajax', array($this, 'clear_cache_files')); |
| 264 | |
| 265 | // Core |
| 266 | add_filter('plugin_action_links_' . EAEL_PLUGIN_BASENAME, array($this, 'eael_add_settings_link')); |
| 267 | add_filter('plugin_action_links_' . EAEL_PLUGIN_BASENAME, array($this, 'eael_pro_filter_action_links')); |
| 268 | add_action('admin_init', array($this, 'eael_redirect')); |
| 269 | add_action('admin_footer-plugins.php', array($this, 'plugins_footer_for_pro')); |
| 270 | |
| 271 | if (!did_action('elementor/loaded')) { |
| 272 | add_action('admin_notices', array($this, 'eael_is_failed_to_load')); |
| 273 | } |
| 274 | } |
| 275 | } |
| 276 | } |
| 277 | |
| 278 | /** |
| 279 | * Global instance of Essential Addons |
| 280 | * |
| 281 | * @since 3.0.0 |
| 282 | */ |
| 283 | $GLOBALS['Essential_Addons_Elementor'] = new Essential_Addons_Elementor; |
| 284 | |
| 285 | /** |
| 286 | * Run plugin |
| 287 | * |
| 288 | * @since 3.0.0 |
| 289 | */ |
| 290 | add_action('plugins_loaded', function () { |
| 291 | global $Essential_Addons_Elementor; |
| 292 | $Essential_Addons_Elementor->run(); |
| 293 | }); |
| 294 | |
| 295 | /** |
| 296 | * Activation hook |
| 297 | * |
| 298 | * @since v3.0.0 |
| 299 | */ |
| 300 | register_activation_hook(__FILE__, function () { |
| 301 | global $Essential_Addons_Elementor; |
| 302 | $Essential_Addons_Elementor->plugin_activation_hook(); |
| 303 | }); |
| 304 | |
| 305 | /** |
| 306 | * Deactivation hook |
| 307 | * |
| 308 | * @since v3.0.0 |
| 309 | */ |
| 310 | register_deactivation_hook(__FILE__, function () { |
| 311 | global $Essential_Addons_Elementor; |
| 312 | $Essential_Addons_Elementor->plugin_deactivation_hook(); |
| 313 | }); |
| 314 | |
| 315 | /** |
| 316 | * Upgrade hook |
| 317 | * |
| 318 | * @since v3.0.0 |
| 319 | */ |
| 320 | add_action('upgrader_process_complete', function () { |
| 321 | global $Essential_Addons_Elementor; |
| 322 | $Essential_Addons_Elementor->plugin_upgrade_hook(); |
| 323 | }); |
| 324 |