essential-addons-for-elementor-lite
Last commit date
admin
8 years ago
assets
8 years ago
elements
8 years ago
includes
8 years ago
essential_adons_elementor.php
8 years ago
readme.txt
8 years ago
essential_adons_elementor.php
156 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Plugin Name: Essential Addons Elementor [Lite] |
| 4 | * Description: Elements bundle for Elementor page builder plugin for WordPress. <a href="https://essential-addons.com/elementor/buy.php">Get Premium version</a> |
| 5 | * Plugin URI: https://essential-addons.com/elementor/ |
| 6 | * Author: Codetic |
| 7 | * Version: 2.2.0 |
| 8 | * Author URI: http://www.codetic.net |
| 9 | * |
| 10 | * Text Domain: essential-addons-elementor |
| 11 | */ |
| 12 | |
| 13 | if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly |
| 14 | |
| 15 | define( 'ESSENTIAL_ADDONS_EL_URL', plugins_url( '/', __FILE__ ) ); |
| 16 | define( 'ESSENTIAL_ADDONS_EL_PATH', plugin_dir_path( __FILE__ ) ); |
| 17 | |
| 18 | |
| 19 | require_once ESSENTIAL_ADDONS_EL_PATH.'includes/elementor-helper.php'; |
| 20 | require_once ESSENTIAL_ADDONS_EL_PATH.'includes/queries.php'; |
| 21 | require_once ESSENTIAL_ADDONS_EL_PATH.'admin/settings.php'; |
| 22 | |
| 23 | function add_eael_elements(){ |
| 24 | |
| 25 | $eael_default_settings = array( |
| 26 | 'contact-form-7' => true, |
| 27 | 'count-down' => true, |
| 28 | 'creative-btn' => true, |
| 29 | 'fancy-text' => true, |
| 30 | 'post-grid' => true, |
| 31 | 'post-timeline' => true, |
| 32 | 'product-grid' => true, |
| 33 | 'team-members' => true, |
| 34 | 'testimonials' => true, |
| 35 | 'weforms' => true, |
| 36 | 'call-to-action' => true, |
| 37 | 'flip-box' => true, |
| 38 | 'info-box' => true, |
| 39 | 'dual-header' => true, |
| 40 | 'price-table' => true, |
| 41 | ); |
| 42 | $is_component_active = get_option( 'eael_save_settings', $eael_default_settings ); |
| 43 | // load elements |
| 44 | if( $is_component_active['post-grid'] ) { |
| 45 | require_once ESSENTIAL_ADDONS_EL_PATH.'elements/post-grid/post-grid.php'; |
| 46 | } |
| 47 | if( $is_component_active['post-timeline'] ) { |
| 48 | require_once ESSENTIAL_ADDONS_EL_PATH.'elements/post-timeline/post-timeline.php'; |
| 49 | } |
| 50 | if( $is_component_active['fancy-text'] ) { |
| 51 | require_once ESSENTIAL_ADDONS_EL_PATH.'elements/fancy-text/fancy-text.php'; |
| 52 | } |
| 53 | if( $is_component_active['creative-btn'] ) { |
| 54 | require_once ESSENTIAL_ADDONS_EL_PATH.'elements/creative-button/creative-button.php'; |
| 55 | } |
| 56 | if( $is_component_active['count-down'] ) { |
| 57 | require_once ESSENTIAL_ADDONS_EL_PATH.'elements/countdown/countdown.php'; |
| 58 | } |
| 59 | if( $is_component_active['team-members'] ) { |
| 60 | require_once ESSENTIAL_ADDONS_EL_PATH.'elements/team-members/team-members.php'; |
| 61 | } |
| 62 | if( $is_component_active['testimonials'] ) { |
| 63 | require_once ESSENTIAL_ADDONS_EL_PATH.'elements/testimonials/testimonials.php'; |
| 64 | } |
| 65 | |
| 66 | if ( function_exists( 'WC' ) && $is_component_active['product-grid'] ) { |
| 67 | require_once ESSENTIAL_ADDONS_EL_PATH.'elements/product-grid/product-grid.php'; |
| 68 | } |
| 69 | |
| 70 | if ( function_exists( 'wpcf7' ) && $is_component_active['contact-form-7'] ) { |
| 71 | require_once ESSENTIAL_ADDONS_EL_PATH.'elements/contact-form-7/contact-form-7.php'; |
| 72 | } |
| 73 | |
| 74 | if ( function_exists( 'WeForms' ) && $is_component_active['weforms'] ) { |
| 75 | require_once ESSENTIAL_ADDONS_EL_PATH.'elements/weforms/weforms.php'; |
| 76 | } |
| 77 | |
| 78 | if( $is_component_active['info-box'] ) { |
| 79 | require_once ESSENTIAL_ADDONS_EL_PATH.'elements/infobox/infobox.php'; |
| 80 | } |
| 81 | |
| 82 | if( $is_component_active['flip-box'] ) { |
| 83 | require_once ESSENTIAL_ADDONS_EL_PATH.'elements/flipbox/flipbox.php'; |
| 84 | } |
| 85 | |
| 86 | if( $is_component_active['call-to-action'] ) { |
| 87 | require_once ESSENTIAL_ADDONS_EL_PATH.'elements/call-to-action/call-to-action.php'; |
| 88 | } |
| 89 | |
| 90 | if( $is_component_active['dual-header'] ) { |
| 91 | require_once ESSENTIAL_ADDONS_EL_PATH.'elements/dual-color-header/dual-color-header.php'; |
| 92 | } |
| 93 | if( $is_component_active['price-table'] ) { |
| 94 | require_once ESSENTIAL_ADDONS_EL_PATH.'elements/pricing-table/pricing-table.php'; |
| 95 | } |
| 96 | } |
| 97 | add_action('elementor/widgets/widgets_registered','add_eael_elements'); |
| 98 | |
| 99 | |
| 100 | function essential_addons_el_enqueue(){ |
| 101 | $is_component_active = get_option( 'eael_save_settings' ); |
| 102 | wp_enqueue_style('essential_addons_elementor-css',ESSENTIAL_ADDONS_EL_URL.'assets/css/essential-addons-elementor.css'); |
| 103 | |
| 104 | if( $is_component_active['fancy-text'] ) { |
| 105 | wp_enqueue_script('essential_addons_elementor-fancy-text-js',ESSENTIAL_ADDONS_EL_URL.'assets/js/fancy-text.js', array('jquery'),'1.0', true); |
| 106 | } |
| 107 | |
| 108 | if( $is_component_active['count-down'] ) { |
| 109 | wp_enqueue_script('essential_addons_elementor-countdown-js',ESSENTIAL_ADDONS_EL_URL.'assets/js/countdown.min.js', array('jquery'),'1.0', true); |
| 110 | } |
| 111 | |
| 112 | } |
| 113 | add_action( 'wp_enqueue_scripts', 'essential_addons_el_enqueue' ); |
| 114 | |
| 115 | |
| 116 | // Editor CSS |
| 117 | |
| 118 | add_action( 'elementor/editor/before_enqueue_scripts', function() { |
| 119 | |
| 120 | wp_register_style( 'essential_addons_elementor_editor-css', ESSENTIAL_ADDONS_EL_URL.'assets/css/essential-addons-editor.css'); |
| 121 | wp_enqueue_style( 'essential_addons_elementor_editor-css' ); |
| 122 | |
| 123 | } ); |
| 124 | |
| 125 | // Action menus |
| 126 | |
| 127 | function eael_add_settings_link( $links ) { |
| 128 | $settings_link = sprintf( '<a href="admin.php?page=eael-settings">' . __( 'Settings' ) . '</a>' ); |
| 129 | $go_pro_link = sprintf( '<a href="https://essential-addons.com/elementor/buy.php" target="_blank" style="color: #39b54a; font-weight: bold;">' . __( 'Go Pro' ) . '</a>' ); |
| 130 | array_push( $links, $settings_link, $go_pro_link ); |
| 131 | return $links; |
| 132 | } |
| 133 | $plugin = plugin_basename( __FILE__ ); |
| 134 | add_filter( "plugin_action_links_$plugin", 'eael_add_settings_link' ); |
| 135 | |
| 136 | |
| 137 | |
| 138 | // Redirect to options page |
| 139 | |
| 140 | register_activation_hook(__FILE__, 'eael_activate'); |
| 141 | add_action('admin_init', 'eael_redirect'); |
| 142 | |
| 143 | function eael_activate() { |
| 144 | add_option('eael_do_activation_redirect', true); |
| 145 | } |
| 146 | |
| 147 | function eael_redirect() { |
| 148 | if (get_option('eael_do_activation_redirect', false)) { |
| 149 | delete_option('eael_do_activation_redirect'); |
| 150 | if(!isset($_GET['activate-multi'])) |
| 151 | { |
| 152 | wp_redirect("admin.php?page=eael-settings"); |
| 153 | } |
| 154 | } |
| 155 | } |
| 156 |