| 1 |
<?php |
| 2 |
/** |
| 3 |
* Plugin Name: Sky Addons for Elementor |
| 4 |
* Plugin URI: https://skyaddons.com/ |
| 5 |
* Description: <a href="https://skyaddons.com/">Sky Addons for Elementor</a> offers a range of advanced and engaging widgets for your website. With features like Free Elementor Templates Library, card, advanced accordion, advanced slider, advanced skill bars, dual button, image compare, info box, list group, logo grid, team member, floating effects and many more, it's easy to find what you're looking for. Install it today to create a better web! |
| 6 |
* Version: 3.8.4 |
| 7 |
* Requires at least: 5.0 |
| 8 |
* Requires PHP: 7.4 |
| 9 |
* Author: wowDevs |
| 10 |
* Author URI: https://wowdevs.com/ |
| 11 |
* Text Domain: sky-elementor-addons |
| 12 |
* Domain Path: /languages/ |
| 13 |
* License: GPLv3 or later |
| 14 |
* License URI: https://opensource.org/licenses/GPL-3.0 |
| 15 |
* Elementor requires at least: 3.0.0 |
| 16 |
* Elementor tested up to: 4.1.2 |
| 17 |
* |
| 18 |
* @package Sky_Addons |
| 19 |
*/ |
| 20 |
|
| 21 |
if ( ! defined( 'ABSPATH' ) ) { |
| 22 |
exit; |
| 23 |
} |
| 24 |
|
| 25 |
define( 'SKY_ADDONS_VERSION', '3.8.4' ); |
| 26 |
define( 'SKY_ADDONS_SLUG', 'sky-addons' ); |
| 27 |
|
| 28 |
define( 'SKY_ADDONS__FILE__', __FILE__ ); |
| 29 |
define( 'SKY_ADDONS_PLUGIN_BASE', plugin_basename( SKY_ADDONS__FILE__ ) ); |
| 30 |
define( 'SKY_ADDONS_PATH', plugin_dir_path( SKY_ADDONS__FILE__ ) ); |
| 31 |
define( 'SKY_ADDONS_MODULES_PATH', SKY_ADDONS_PATH . 'modules/' ); |
| 32 |
define( 'SKY_ADDONS_INC_PATH', SKY_ADDONS_PATH . 'includes/' ); |
| 33 |
define( 'SKY_ADDONS_URL', plugins_url( '/', SKY_ADDONS__FILE__ ) ); |
| 34 |
define( 'SKY_ADDONS_ASSETS_URL', SKY_ADDONS_URL . 'assets/' ); |
| 35 |
define( 'SKY_ADDONS_ASSETS_PATH', SKY_ADDONS_PATH . 'assets/' ); |
| 36 |
define( 'SKY_ADDONS_MODULES_URL', SKY_ADDONS_URL . 'modules/' ); |
| 37 |
define( 'SKY_ADDONS_PATH_NAME', basename( dirname( SKY_ADDONS__FILE__ ) ) ); |
| 38 |
|
| 39 |
/** |
| 40 |
* Load gettext translate for our text domain. |
| 41 |
* |
| 42 |
* @since 1.0.0 |
| 43 |
* |
| 44 |
* @return void |
| 45 |
*/ |
| 46 |
function sky_addons_load_textdomain() { |
| 47 |
load_plugin_textdomain( 'sky-elementor-addons', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' ); |
| 48 |
} |
| 49 |
|
| 50 |
add_action( 'init', 'sky_addons_load_textdomain' ); |
| 51 |
|
| 52 |
if ( ! function_exists( '_is_sky_addons_pro_activated' ) ) { |
| 53 |
|
| 54 |
function _is_sky_addons_pro_activated() { |
| 55 |
|
| 56 |
if ( ! function_exists( 'get_plugins' ) ) { |
| 57 |
require_once ABSPATH . 'wp-admin/includes/plugin.php'; |
| 58 |
} |
| 59 |
|
| 60 |
$file_path = 'sky-elementor-addons-pro/sky-elementor-addons-pro.php'; |
| 61 |
|
| 62 |
if ( is_plugin_active( $file_path ) ) { |
| 63 |
return true; |
| 64 |
} |
| 65 |
|
| 66 |
return false; |
| 67 |
} |
| 68 |
} |
| 69 |
|
| 70 |
if ( ! _is_sky_addons_pro_activated() ) { |
| 71 |
require_once SKY_ADDONS_INC_PATH . 'pro-widget-map.php'; |
| 72 |
} |
| 73 |
|
| 74 |
function sky_addons_load_plugin() { |
| 75 |
|
| 76 |
load_plugin_textdomain( 'sky-elementor-addons' ); |
| 77 |
|
| 78 |
/** |
| 79 |
* Helper functions — always available, no Elementor dependency at load time. |
| 80 |
*/ |
| 81 |
require_once __DIR__ . '/includes/functions.php'; |
| 82 |
|
| 83 |
/** |
| 84 |
* Asset Manager mode helpers — must be available before modules-manager, |
| 85 |
* plugin.php and the optimizer class, so loaded here alongside functions.php. |
| 86 |
*/ |
| 87 |
require_once __DIR__ . '/includes/optimizer/functions.php'; |
| 88 |
|
| 89 |
/** |
| 90 |
* Templates Library feature flag — must be available before plugin.php |
| 91 |
* and class-core.php which gate the library boot on this function. |
| 92 |
*/ |
| 93 |
require_once __DIR__ . '/includes/templates/functions.php'; |
| 94 |
|
| 95 |
// Core always boots: admin menu, dashboard REST API, custom scripts CPT. |
| 96 |
require_once SKY_ADDONS_PATH . 'class-core.php'; |
| 97 |
\Sky_Addons\Core::instance(); |
| 98 |
|
| 99 |
if ( ! did_action( 'elementor/loaded' ) ) { |
| 100 |
add_action( 'admin_notices', 'sky_addons_fail_load' ); |
| 101 |
return; |
| 102 |
} |
| 103 |
|
| 104 |
$elementor_version_required = '3.0.0'; |
| 105 |
if ( ! version_compare( ELEMENTOR_VERSION, $elementor_version_required, '>=' ) ) { |
| 106 |
add_action( 'admin_notices', 'sky_addons_fail_load_out_of_date' ); |
| 107 |
return; |
| 108 |
} |
| 109 |
|
| 110 |
// plugin.php is always loaded: it defines the class and helper functions. |
| 111 |
require_once SKY_ADDONS_PATH . 'plugin.php'; |
| 112 |
\Sky_Addons\Sky_Addons_Plugin::instance(); |
| 113 |
} |
| 114 |
|
| 115 |
add_action( 'plugins_loaded', 'sky_addons_load_plugin' ); |
| 116 |
|
| 117 |
/** |
| 118 |
* Show in WP Dashboard notice about the plugin is not activated. |
| 119 |
* |
| 120 |
* @since 1.0.0 |
| 121 |
* |
| 122 |
* @return void |
| 123 |
*/ |
| 124 |
function sky_addons_fail_load() { |
| 125 |
$screen = get_current_screen(); |
| 126 |
if ( isset( $screen->parent_file ) && 'plugins.php' === $screen->parent_file && 'update' === $screen->id ) { |
| 127 |
return; |
| 128 |
} |
| 129 |
|
| 130 |
$plugin = 'elementor/elementor.php'; |
| 131 |
|
| 132 |
if ( _is_elementor_installed() ) { |
| 133 |
if ( ! current_user_can( 'activate_plugins' ) ) { |
| 134 |
return; |
| 135 |
} |
| 136 |
|
| 137 |
$activation_url = wp_nonce_url( 'plugins.php?action=activate&plugin=' . $plugin . '&plugin_status=all&paged=1&s', 'activate-plugin_' . $plugin ); |
| 138 |
|
| 139 |
$message = '<p>' . esc_html__( 'Sky Addons for Elementor is not working because you need to activate the Elementor plugin.', 'sky-elementor-addons' ) . '</p>'; |
| 140 |
$message .= '<p>' . sprintf( '<a href="%s" class="button-primary">%s</a>', $activation_url, esc_html__( 'Activate Elementor Now', 'sky-elementor-addons' ) ) . '</p>'; |
| 141 |
} else { |
| 142 |
if ( ! current_user_can( 'install_plugins' ) ) { |
| 143 |
return; |
| 144 |
} |
| 145 |
|
| 146 |
$install_url = wp_nonce_url( self_admin_url( 'update.php?action=install-plugin&plugin=elementor' ), 'install-plugin_elementor' ); |
| 147 |
|
| 148 |
$message = '<p>' . esc_html__( 'Sky Addons for Elementor is not working because you need to install the Elemenor plugin', 'sky-elementor-addons' ) . '</p>'; |
| 149 |
$message .= '<p>' . sprintf( '<a href="%s" class="button-primary">%s</a>', $install_url, esc_html__( 'Install Elementor Now', 'sky-elementor-addons' ) ) . '</p>'; |
| 150 |
} |
| 151 |
|
| 152 |
printf( '<div class="error"><p>%s</p></div>', wp_kses_post( $message ) ); |
| 153 |
} |
| 154 |
|
| 155 |
function sky_addons_fail_load_out_of_date() { |
| 156 |
if ( ! current_user_can( 'update_plugins' ) ) { |
| 157 |
return; |
| 158 |
} |
| 159 |
|
| 160 |
$file_path = 'elementor/elementor.php'; |
| 161 |
|
| 162 |
$upgrade_link = wp_nonce_url( self_admin_url( 'update.php?action=upgrade-plugin&plugin=' ) . $file_path, 'upgrade-plugin_' . $file_path ); |
| 163 |
$message = '<p>' . esc_html__( 'Sky Addons for Elementor is not working because you are using an old version of Elementor.', 'sky-elementor-addons' ) . '</p>'; |
| 164 |
$message .= '<p>' . sprintf( '<a href="%s" class="button-primary">%s</a>', $upgrade_link, esc_html__( 'Update Elementor Now', 'sky-elementor-addons' ) ) . '</p>'; |
| 165 |
|
| 166 |
printf( '<div class="error"><p>%s</p></div>', wp_kses_post( $message ) ); |
| 167 |
} |
| 168 |
|
| 169 |
if ( ! function_exists( '_is_elementor_installed' ) ) { |
| 170 |
|
| 171 |
function _is_elementor_installed() { |
| 172 |
$file_path = 'elementor/elementor.php'; |
| 173 |
$installed_plugins = get_plugins(); |
| 174 |
|
| 175 |
return isset( $installed_plugins[ $file_path ] ); |
| 176 |
} |
| 177 |
} |
| 178 |
|
| 179 |
/** |
| 180 |
* |
| 181 |
* Do stuff upon plugin activation |
| 182 |
*/ |
| 183 |
function sky_addons_activate() { |
| 184 |
$installed = get_option( 'sky_addons_installed' ); |
| 185 |
$first_version = get_option( 'sky_addons_first_version' ); |
| 186 |
|
| 187 |
if ( ! $installed ) { |
| 188 |
update_option( 'sky_addons_installed', time() ); |
| 189 |
} |
| 190 |
|
| 191 |
if ( ! $first_version ) { |
| 192 |
update_option( 'sky_addons_first_version', SKY_ADDONS_VERSION ); |
| 193 |
} |
| 194 |
|
| 195 |
update_option( 'sky_addons_version', SKY_ADDONS_VERSION ); |
| 196 |
} |
| 197 |
|
| 198 |
register_activation_hook( SKY_ADDONS__FILE__, 'sky_addons_activate' ); |
| 199 |
|
| 200 |
|
| 201 |
/** |
| 202 |
* SDK Integration |
| 203 |
*/ |
| 204 |
|
| 205 |
if ( ! function_exists( 'dci_plugin_sky_addons' ) ) { |
| 206 |
function dci_plugin_sky_addons() { |
| 207 |
|
| 208 |
// Include DCI SDK. |
| 209 |
require_once __DIR__ . '/dci/start.php'; |
| 210 |
|
| 211 |
dci_dynamic_init( |
| 212 |
[ |
| 213 |
'product_id' => 1, |
| 214 |
'plugin_name' => 'Sky Addons for Elementor', // make simple, must not empty |
| 215 |
'plugin_title' => 'Love using Sky Addons? Congrats 🎉 ( Never miss an Important Update )', // You can describe your plugin title here |
| 216 |
'plugin_icon' => SKY_ADDONS_ASSETS_URL . 'images/sky-logo-gradient.svg', // delete the line of you don't need |
| 217 |
'api_endpoint' => 'https://dashboard.wowdevs.com/wp-json/dci/v1/data-insights', |
| 218 |
'slug' => 'sky-elementor-addons', |
| 219 |
'core_file' => false, |
| 220 |
'plugin_deactivate_id' => false, |
| 221 |
'menu' => [ |
| 222 |
'slug' => 'sky-addons', |
| 223 |
], |
| 224 |
'public_key' => 'pk_KBsDjbVN4rZidFoSQzBFrXIuMmHvOJvm', |
| 225 |
'is_premium' => false, |
| 226 |
'popup_notice' => false, |
| 227 |
'deactivate_feedback' => true, |
| 228 |
'delay_time' => [ |
| 229 |
'time' => 3 * DAY_IN_SECONDS, |
| 230 |
], |
| 231 |
'text_domain' => 'sky-elementor-addons', |
| 232 |
'plugin_msg' => '<p>Be Top-contributor by sharing non-sensitive plugin data and create an impact to the global WordPress community today! You can receive valuable emails periodically.</p>', |
| 233 |
] |
| 234 |
); |
| 235 |
} |
| 236 |
add_action( 'admin_init', 'dci_plugin_sky_addons' ); |
| 237 |
} |
| 238 |
|
| 239 |
|
| 240 |
/** |
| 241 |
* Review Automation Integration |
| 242 |
*/ |
| 243 |
|
| 244 |
if ( ! function_exists( 'sky_addons_rc_plugin' ) ) { |
| 245 |
function sky_addons_rc_plugin() { |
| 246 |
|
| 247 |
require_once SKY_ADDONS_PATH . 'includes/feedbacks/start.php'; |
| 248 |
|
| 249 |
rc_dynamic_init( |
| 250 |
[ |
| 251 |
'plugin_name' => 'Sky Addons for Elementor', |
| 252 |
'plugin_icon' => SKY_ADDONS_ASSETS_URL . 'images/sky-logo-gradient.svg', |
| 253 |
'slug' => 'sky-elementor-addons', |
| 254 |
'menu' => [ |
| 255 |
'slug' => 'sky-addons', |
| 256 |
], |
| 257 |
'review_url' => 'https://wordpress.org/support/plugin/sky-elementor-addons/reviews/#new-post', |
| 258 |
'plugin_title' => 'Yay! Great that you\'re using Sky Addons', |
| 259 |
'plugin_msg' => '<p>Loved using Sky Addons on your website? Share your experience in a review and help us spread the love to everyone right now. Good words will help the community.</p>', |
| 260 |
] |
| 261 |
); |
| 262 |
} |
| 263 |
add_action( 'admin_init', 'sky_addons_rc_plugin' ); |
| 264 |
} |
| 265 |
|
| 266 |
/** |
| 267 |
* Will be remove this feature after March 2025 |
| 268 |
* |
| 269 |
* We are facing a little bit _WP_Dependency issue and that's why we are using this feature. |
| 270 |
*/ |
| 271 |
if ( ! function_exists( 'sky_addons_pro_compare_version' ) ) { |
| 272 |
function sky_addons_pro_compare_version( $target_version ) { |
| 273 |
// Plugin file path |
| 274 |
$plugin_file = 'sky-elementor-addons-pro/sky-elementor-addons-pro.php'; |
| 275 |
|
| 276 |
// Get all installed plugins |
| 277 |
$all_plugins = get_plugins(); |
| 278 |
|
| 279 |
if ( isset( $all_plugins[ $plugin_file ] ) ) { |
| 280 |
// Get the current version of the plugin |
| 281 |
$current_version = $all_plugins[ $plugin_file ]['Version']; |
| 282 |
|
| 283 |
// Compare versions |
| 284 |
if ( version_compare( $current_version, $target_version, '<' ) ) { |
| 285 |
/** |
| 286 |
* Plugin is older than |
| 287 |
*/ |
| 288 |
require_once SKY_ADDONS_INC_PATH . 'pro-solutions/solutions.php'; |
| 289 |
} elseif ( version_compare( $current_version, $target_version, '>' ) ) { |
| 290 |
/** |
| 291 |
* Plugin is newer than |
| 292 |
*/ |
| 293 |
} else { |
| 294 |
/** |
| 295 |
* Plugin is the same version |
| 296 |
*/ |
| 297 |
} |
| 298 |
} |
| 299 |
|
| 300 |
return 'Plugin is not installed.'; |
| 301 |
} |
| 302 |
|
| 303 |
sky_addons_pro_compare_version( '2.1.1' ); |
| 304 |
} |
| 305 |
|