| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
* Plugin Name: Easy Elementor Addons - Addons Pack for Elementor Page Builder |
| 5 |
* Plugin URI: https://demo.hashthemes.com/easy-elementor-addons/ |
| 6 |
* Description: Level up with Easy Elementor Addons – adds powerful widgets and sleek design tools to your favorite Elementor page builder. |
| 7 |
* Version: 2.3.2 |
| 8 |
* Author: HashThemes |
| 9 |
* Author URI: https://hashthemes.com/ |
| 10 |
* Text Domain: easy-elementor-addons |
| 11 |
* License: GPL-2.0+ |
| 12 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt |
| 13 |
* Domain Path: /languages |
| 14 |
* Elementor tested up to: 3.32 |
| 15 |
*/ |
| 16 |
/* If this file is called directly, abort */ |
| 17 |
if (!defined('WPINC')) { |
| 18 |
die(); |
| 19 |
} |
| 20 |
|
| 21 |
define('EEAD_VERSION', '2.3.2'); |
| 22 |
|
| 23 |
define('EEAD_FILE', __FILE__); |
| 24 |
define('EEAD_PLUGIN_BASENAME', plugin_basename(EEAD_FILE)); |
| 25 |
define('EEAD_PATH', plugin_dir_path(EEAD_FILE)); |
| 26 |
define('EEAD_URL', plugins_url('/', EEAD_FILE)); |
| 27 |
|
| 28 |
define('EEAD_ASSETS_URL', EEAD_URL . 'assets/'); |
| 29 |
|
| 30 |
if (!class_exists('Easy_Elementor_Addons')) { |
| 31 |
|
| 32 |
class Easy_Elementor_Addons { |
| 33 |
|
| 34 |
private static $instance = NULL; |
| 35 |
|
| 36 |
public static function get_instance() { |
| 37 |
// If the single instance hasn't been set, set it now. |
| 38 |
if (self::$instance == NULL) { |
| 39 |
self::$instance = new self; |
| 40 |
} |
| 41 |
return self::$instance; |
| 42 |
} |
| 43 |
|
| 44 |
public function __construct() { |
| 45 |
|
| 46 |
// Run On Plugin Activation |
| 47 |
register_activation_hook(__FILE__, array($this, 'plugin_activation')); |
| 48 |
|
| 49 |
// Load necessary files. |
| 50 |
add_action('plugins_loaded', array($this, 'init')); |
| 51 |
add_filter('plugin_action_links_' . plugin_basename(EEAD_FILE), array($this, 'add_plugin_action_link'), 10, 1); |
| 52 |
} |
| 53 |
|
| 54 |
public function init() { |
| 55 |
|
| 56 |
// Check if Elementor installed and activated |
| 57 |
if (!did_action('elementor/loaded')) { |
| 58 |
add_action('admin_notices', array($this, 'required_plugins_notice')); |
| 59 |
return; |
| 60 |
} |
| 61 |
|
| 62 |
require EEAD_PATH . 'inc/helper-functions.php'; |
| 63 |
require EEAD_PATH . 'inc/widget-loader.php'; |
| 64 |
require EEAD_PATH . 'inc/icon-manager.php'; |
| 65 |
require EEAD_PATH . 'inc/sticky-container.php'; |
| 66 |
require EEAD_PATH . 'inc/admin-menu/admin-menu-class.php'; |
| 67 |
//require EEAD_PATH . 'templates/templates.php'; |
| 68 |
} |
| 69 |
|
| 70 |
public function required_plugins_notice() { |
| 71 |
$screen = get_current_screen(); |
| 72 |
if (isset($screen->parent_file) && 'plugins.php' === $screen->parent_file && 'update' === $screen->id) { |
| 73 |
return; |
| 74 |
} |
| 75 |
|
| 76 |
$plugin = 'elementor/elementor.php'; |
| 77 |
|
| 78 |
if ($this->is_elementor_installed()) { |
| 79 |
if (!current_user_can('activate_plugins')) { |
| 80 |
return; |
| 81 |
} |
| 82 |
|
| 83 |
$activation_url = wp_nonce_url('plugins.php?action=activate&plugin=' . $plugin . '&plugin_status=all&paged=1&s', 'activate-plugin_' . $plugin); |
| 84 |
$admin_message = '<p>' . esc_html__('Oops! Easy Elementor Addons is not working because you need to activate the Elementor plugin first.', 'easy-elementor-addons') . '</p>'; |
| 85 |
$admin_message .= '<p>' . sprintf('<a href="%s" class="button-primary">%s</a>', $activation_url, esc_html__('Activate Elementor Now', 'easy-elementor-addons')) . '</p>'; |
| 86 |
} else { |
| 87 |
if (!current_user_can('install_plugins')) { |
| 88 |
return; |
| 89 |
} |
| 90 |
|
| 91 |
$install_url = wp_nonce_url(self_admin_url('update.php?action=install-plugin&plugin=elementor'), 'install-plugin_elementor'); |
| 92 |
$admin_message = '<p>' . esc_html__('Oops! Easy Elementor Addons is not working because you need to install the Elementor plugin', 'easy-elementor-addons') . '</p>'; |
| 93 |
$admin_message .= '<p>' . sprintf('<a href="%s" class="button-primary">%s</a>', $install_url, esc_html__('Install Elementor Now', 'easy-elementor-addons')) . '</p>'; |
| 94 |
} |
| 95 |
|
| 96 |
echo '<div class="error">' . wp_kses_post($admin_message) . '</div>'; |
| 97 |
} |
| 98 |
|
| 99 |
/** |
| 100 |
* Check if theme has elementor installed |
| 101 |
* |
| 102 |
* @return boolean |
| 103 |
*/ |
| 104 |
public function is_elementor_installed() { |
| 105 |
$file_path = 'elementor/elementor.php'; |
| 106 |
$installed_plugins = get_plugins(); |
| 107 |
|
| 108 |
return isset($installed_plugins[$file_path]); |
| 109 |
} |
| 110 |
|
| 111 |
public function plugin_activation() { |
| 112 |
} |
| 113 |
|
| 114 |
public function add_plugin_action_link($links) { |
| 115 |
$custom['settings'] = sprintf( |
| 116 |
'<a href="%s" aria-label="%s">%s</a>', esc_url(add_query_arg('page', 'eead-settings', admin_url('admin.php'))), esc_attr__('Easy Elementor Addons Settings', 'easy-elementor-addons'), esc_html__('Settings', 'easy-elementor-addons') |
| 117 |
); |
| 118 |
|
| 119 |
return array_merge($custom, (array) $links); |
| 120 |
} |
| 121 |
} |
| 122 |
|
| 123 |
} |
| 124 |
|
| 125 |
/** |
| 126 |
* Returns instanse of the plugin class. |
| 127 |
* |
| 128 |
* @since 1.0.0 |
| 129 |
* @return object |
| 130 |
*/ |
| 131 |
if (!function_exists('easy_elementor_addons')) { |
| 132 |
|
| 133 |
function easy_elementor_addons() { |
| 134 |
return Easy_Elementor_Addons::get_instance(); |
| 135 |
} |
| 136 |
|
| 137 |
} |
| 138 |
|
| 139 |
easy_elementor_addons(); |