| 1 |
<?php |
| 2 |
defined( 'ABSPATH' ) || exit; |
| 3 |
|
| 4 |
/** |
| 5 |
* Plugin Name: ElementsKit Lite |
| 6 |
* Description: The most advanced addons for Elementor with tons of widgets, Header builder, Footer builder, Mega menu builder, layout pack and powerful custom controls. |
| 7 |
* Plugin URI: https://products.wpmet.com/elementskit |
| 8 |
* Author: Wpmet |
| 9 |
* Version: 2.3.1.1 |
| 10 |
* Author URI: https://wpmet.com/ |
| 11 |
* |
| 12 |
* Text Domain: elementskit-lite |
| 13 |
* Domain Path: /languages |
| 14 |
* |
| 15 |
* ElementsKit is a powerful addon for Elementor page builder. |
| 16 |
* It includes most comprehensive modules, such as "header footer builder", "mega menu", |
| 17 |
* "layout installer", "quick form builder" etc under the hood. |
| 18 |
* It has a tons of widgets to create any sites with an ease. It has some most unique |
| 19 |
* and powerful custom controls for elementor, such as "image picker", "ajax select", "widget area". |
| 20 |
* |
| 21 |
*/ |
| 22 |
|
| 23 |
final class ElementsKit_Lite{ |
| 24 |
/** |
| 25 |
* Plugin Version |
| 26 |
* |
| 27 |
* @since 1.0.0 |
| 28 |
* @var string The plugin version. |
| 29 |
*/ |
| 30 |
static function version(){ |
| 31 |
return '2.3.1.1'; |
| 32 |
} |
| 33 |
|
| 34 |
/** |
| 35 |
* Package type |
| 36 |
* |
| 37 |
* @since 1.1.0 |
| 38 |
* @var string The plugin purchase type [pro/ free]. |
| 39 |
*/ |
| 40 |
static function package_type(){ |
| 41 |
return apply_filters( 'elementskit/core/package_type', 'free' ); |
| 42 |
} |
| 43 |
|
| 44 |
|
| 45 |
/** |
| 46 |
* Package type |
| 47 |
* |
| 48 |
* @since 1.1.0 |
| 49 |
* @var string The plugin purchase type [pro/ free]. |
| 50 |
*/ |
| 51 |
static function license_status(){ |
| 52 |
if(!class_exists('ElementsKit\Libs\Framework\Classes\License')){ |
| 53 |
return 'invalid'; |
| 54 |
} |
| 55 |
if(ElementsKit\Libs\Framework\Classes\License::instance()->status() != 'valid'){ |
| 56 |
return 'invalid'; |
| 57 |
} |
| 58 |
|
| 59 |
return 'valid'; |
| 60 |
} |
| 61 |
|
| 62 |
public static function license_data(){ |
| 63 |
if(!class_exists('\ElementsKit_Lite\Libs\Framework\Classes\Utils')){ |
| 64 |
return [ |
| 65 |
'key' => '', |
| 66 |
'checksum' => '', |
| 67 |
'plugin_package' => \ElementsKit_Lite::package_type() |
| 68 |
]; |
| 69 |
} |
| 70 |
|
| 71 |
return [ |
| 72 |
'key' => \ElementsKit_Lite\Libs\Framework\Classes\Utils::instance()->get_option('license_key'), |
| 73 |
'checksum' => get_option('__validate_oppai__'), |
| 74 |
'plugin_package' => \ElementsKit_Lite::package_type() |
| 75 |
]; |
| 76 |
} |
| 77 |
|
| 78 |
|
| 79 |
/** |
| 80 |
* Product ID |
| 81 |
* |
| 82 |
* @since 1.2.6 |
| 83 |
* @var string The plugin ID in our server. |
| 84 |
*/ |
| 85 |
static function product_id(){ |
| 86 |
return '9'; |
| 87 |
} |
| 88 |
|
| 89 |
/** |
| 90 |
* Author Name |
| 91 |
* |
| 92 |
* @since 1.3.1 |
| 93 |
* @var string The plugin author. |
| 94 |
*/ |
| 95 |
static function author_name(){ |
| 96 |
return 'Wpmet'; |
| 97 |
} |
| 98 |
|
| 99 |
/** |
| 100 |
* Store Name |
| 101 |
* |
| 102 |
* @since 1.3.1 |
| 103 |
* @var string The store name: self site, envato. |
| 104 |
*/ |
| 105 |
static function store_name(){ |
| 106 |
return 'wordpressorg'; |
| 107 |
} |
| 108 |
|
| 109 |
/** |
| 110 |
* Minimum Elementor Version |
| 111 |
* |
| 112 |
* @since 1.0.0 |
| 113 |
* @var string Minimum Elementor version required to run the plugin. |
| 114 |
*/ |
| 115 |
static function min_el_version(){ |
| 116 |
return '2.8.0'; |
| 117 |
} |
| 118 |
|
| 119 |
/** |
| 120 |
* Minimum PHP Version |
| 121 |
* |
| 122 |
* @since 1.0.0 |
| 123 |
* @var string Minimum PHP version required to run the plugin. |
| 124 |
*/ |
| 125 |
static function min_php_version(){ |
| 126 |
return '7.0'; |
| 127 |
} |
| 128 |
|
| 129 |
/** |
| 130 |
* Plugin file |
| 131 |
* |
| 132 |
* @since 1.0.0 |
| 133 |
* @var string plugins's root file. |
| 134 |
*/ |
| 135 |
static function plugin_file(){ |
| 136 |
return __FILE__; |
| 137 |
} |
| 138 |
|
| 139 |
/** |
| 140 |
* Plugin url |
| 141 |
* |
| 142 |
* @since 1.0.0 |
| 143 |
* @var string plugins's root url. |
| 144 |
*/ |
| 145 |
static function plugin_url(){ |
| 146 |
return trailingslashit(plugin_dir_url( __FILE__ )); |
| 147 |
} |
| 148 |
|
| 149 |
/** |
| 150 |
* Plugin dir |
| 151 |
* |
| 152 |
* @since 1.0.0 |
| 153 |
* @var string plugins's root directory. |
| 154 |
*/ |
| 155 |
static function plugin_dir(){ |
| 156 |
return trailingslashit(plugin_dir_path( __FILE__ )); |
| 157 |
} |
| 158 |
|
| 159 |
/** |
| 160 |
* Plugin's widget directory. |
| 161 |
* |
| 162 |
* @since 1.0.0 |
| 163 |
* @var string widget's root directory. |
| 164 |
*/ |
| 165 |
static function widget_dir(){ |
| 166 |
return self::plugin_dir() . 'widgets/'; |
| 167 |
} |
| 168 |
|
| 169 |
/** |
| 170 |
* Plugin's widget url. |
| 171 |
* |
| 172 |
* @since 1.0.0 |
| 173 |
* @var string widget's root url. |
| 174 |
*/ |
| 175 |
static function widget_url(){ |
| 176 |
return self::plugin_url() . 'widgets/'; |
| 177 |
} |
| 178 |
|
| 179 |
|
| 180 |
/** |
| 181 |
* API url |
| 182 |
* |
| 183 |
* @since 1.0.0 |
| 184 |
* @var string for license, layout notification related functions. |
| 185 |
*/ |
| 186 |
static function api_url(){ |
| 187 |
return 'https://api.wpmet.com/public/'; |
| 188 |
} |
| 189 |
|
| 190 |
/** |
| 191 |
* Account url |
| 192 |
* |
| 193 |
* @since 1.2.6 |
| 194 |
* @var string for plugin update notification, user account page. |
| 195 |
*/ |
| 196 |
static function account_url(){ |
| 197 |
return 'https://account.wpmet.com'; |
| 198 |
} |
| 199 |
|
| 200 |
/** |
| 201 |
* Plugin's module directory. |
| 202 |
* |
| 203 |
* @since 1.0.0 |
| 204 |
* @var string module's root directory. |
| 205 |
*/ |
| 206 |
static function module_dir(){ |
| 207 |
return self::plugin_dir() . 'modules/'; |
| 208 |
} |
| 209 |
|
| 210 |
/** |
| 211 |
* Plugin's module url. |
| 212 |
* |
| 213 |
* @since 1.0.0 |
| 214 |
* @var string module's root url. |
| 215 |
*/ |
| 216 |
static function module_url(){ |
| 217 |
return self::plugin_url() . 'modules/'; |
| 218 |
} |
| 219 |
|
| 220 |
|
| 221 |
/** |
| 222 |
* Plugin's lib directory. |
| 223 |
* |
| 224 |
* @since 1.0.0 |
| 225 |
* @var string lib's root directory. |
| 226 |
*/ |
| 227 |
static function lib_dir(){ |
| 228 |
return self::plugin_dir() . 'libs/'; |
| 229 |
} |
| 230 |
|
| 231 |
/** |
| 232 |
* Plugin's lib url. |
| 233 |
* |
| 234 |
* @since 1.0.0 |
| 235 |
* @var string lib's root url. |
| 236 |
*/ |
| 237 |
static function lib_url(){ |
| 238 |
return self::plugin_url() . 'libs/'; |
| 239 |
} |
| 240 |
|
| 241 |
/** |
| 242 |
* Constructor |
| 243 |
* |
| 244 |
* @since 1.0.0 |
| 245 |
* @access public |
| 246 |
*/ |
| 247 |
public function __construct() { |
| 248 |
// Load the main static helper class. |
| 249 |
require_once self::plugin_dir() . 'libs/notice/notice.php'; // new notice system |
| 250 |
require_once self::plugin_dir() . 'libs/banner/banner.php'; // new banner system |
| 251 |
require_once self::plugin_dir() . 'libs/stories/stories.php'; // new stories system |
| 252 |
require_once self::plugin_dir() . 'libs/rating/rating.php'; |
| 253 |
require_once self::plugin_dir() . 'libs/pro-awareness/pro-awareness.php'; // pro menu class file |
| 254 |
require_once self::plugin_dir() . 'helpers/utils.php'; |
| 255 |
|
| 256 |
// Load translation |
| 257 |
add_action( 'init', array( $this, 'i18n' ) ); |
| 258 |
// Init Plugin |
| 259 |
add_action( 'plugins_loaded', array( $this, 'init' ), 100 ); |
| 260 |
} |
| 261 |
|
| 262 |
/** |
| 263 |
* Load Textdomain |
| 264 |
* |
| 265 |
* Load plugin localization files. |
| 266 |
* Fired by `init` action hook. |
| 267 |
* |
| 268 |
* @since 1.0.0 |
| 269 |
* @access public |
| 270 |
*/ |
| 271 |
public function i18n() { |
| 272 |
load_plugin_textdomain( 'elementskit-lite', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' ); |
| 273 |
} |
| 274 |
|
| 275 |
/** |
| 276 |
* Initialize the plugin |
| 277 |
* |
| 278 |
* Checks for basic plugin requirements, if one check fail don't continue, |
| 279 |
* if all check have passed include the plugin class. |
| 280 |
* |
| 281 |
* Fired by `plugins_loaded` action hook. |
| 282 |
* |
| 283 |
* @since 1.0.0 |
| 284 |
* @access public |
| 285 |
*/ |
| 286 |
public function init() { |
| 287 |
|
| 288 |
// init notice class |
| 289 |
\Oxaim\Libs\Notice::init(); |
| 290 |
|
| 291 |
// init pro menu class |
| 292 |
\Wpmet\Libs\Pro_Awareness::init(); |
| 293 |
|
| 294 |
// Check if Elementor installed and activated. |
| 295 |
if ( ! did_action( 'elementor/loaded' ) ) { |
| 296 |
add_action( 'admin_head', array( $this, 'missing_elementor' ) ); |
| 297 |
return; |
| 298 |
} |
| 299 |
|
| 300 |
// Check for required PHP version. |
| 301 |
if ( version_compare( PHP_VERSION, self::min_php_version(), '<' ) ) { |
| 302 |
add_action( 'admin_head', array( $this, 'failed_php_version' ) ); |
| 303 |
return; |
| 304 |
} |
| 305 |
// Once we get here, We have passed all validation checks so we can safely include our plugin. |
| 306 |
|
| 307 |
// Register ElementsKit_Lite widget category |
| 308 |
add_action('elementor/elements/categories_registered', [$this, 'elementor_widget_category']); |
| 309 |
|
| 310 |
add_action( 'elementor/init', function(){ |
| 311 |
if(class_exists('ElementsKit') && !class_exists('ElementsKit_Comp')){ |
| 312 |
return; |
| 313 |
} |
| 314 |
|
| 315 |
// adding backward classes and methods for older 14 number themes. |
| 316 |
require_once self::plugin_dir() . 'compatibility/backward/plugin-class-backward-compatibility.php'; |
| 317 |
require_once self::plugin_dir() . 'compatibility/backward/utils-backward-compablity.php'; |
| 318 |
|
| 319 |
// Load the Plugin class, it's the core class of ElementsKit_Lite. |
| 320 |
require_once self::plugin_dir() . 'plugin.php'; |
| 321 |
|
| 322 |
// adding backward classes and methods for older 14 number themes. |
| 323 |
require_once self::plugin_dir() . 'compatibility/backward/module-list.php'; |
| 324 |
require_once self::plugin_dir() . 'compatibility/backward/widget-list.php'; |
| 325 |
}); |
| 326 |
|
| 327 |
} |
| 328 |
|
| 329 |
|
| 330 |
|
| 331 |
/** |
| 332 |
* Admin notice |
| 333 |
* |
| 334 |
* Warning when the site doesn't have required Elementor. |
| 335 |
* |
| 336 |
* @since 1.0.0 |
| 337 |
* @access public |
| 338 |
*/ |
| 339 |
public function missing_elementor() { |
| 340 |
if ( isset( $_GET['activate'] ) ) { |
| 341 |
unset( $_GET['activate'] ); |
| 342 |
} |
| 343 |
$btn = [ |
| 344 |
'default_class' => 'button', |
| 345 |
'class' => 'button-primary ', // button-primary button-secondary button-small button-large button-link |
| 346 |
]; |
| 347 |
|
| 348 |
if ( file_exists( WP_PLUGIN_DIR . '/elementor/elementor.php' ) ) { |
| 349 |
$btn['text'] = esc_html__('Activate Elementor', 'elementskit-lite'); |
| 350 |
$btn['url'] = wp_nonce_url( 'plugins.php?action=activate&plugin=elementor/elementor.php&plugin_status=all&paged=1', 'activate-plugin_elementor/elementor.php' ); |
| 351 |
} else { |
| 352 |
$btn['text'] = esc_html__('Install Elementor', 'elementskit-lite'); |
| 353 |
$btn['url'] = wp_nonce_url( self_admin_url( 'update.php?action=install-plugin&plugin=elementor' ), 'install-plugin_elementor' ); |
| 354 |
} |
| 355 |
|
| 356 |
\Oxaim\Libs\Notice::instance('elementskit-lite', 'unsupported-elementor-version') |
| 357 |
->set_type('error') |
| 358 |
->set_message(sprintf( esc_html__( 'ElementsKit requires Elementor version %1$s+, which is currently NOT RUNNING.', 'elementskit-lite' ), self::min_el_version() )) |
| 359 |
->set_button($btn) |
| 360 |
->call(); |
| 361 |
} |
| 362 |
|
| 363 |
|
| 364 |
/** |
| 365 |
* Admin notice |
| 366 |
* |
| 367 |
* Warning when the site doesn't have a minimum required PHP version. |
| 368 |
* |
| 369 |
* @since 1.0.0 |
| 370 |
* @access public |
| 371 |
*/ |
| 372 |
public function failed_php_version() { |
| 373 |
\Oxaim\Libs\Notice::instance('elementskit-lite', 'unsupported-php-version') |
| 374 |
->set_type('error') |
| 375 |
->set_message(sprintf( esc_html__( 'ElementsKit requires PHP version %1$s+, which is currently NOT RUNNING on this server.', 'elementskit-lite' ), self::min_php_version() )) |
| 376 |
->call(); |
| 377 |
} |
| 378 |
|
| 379 |
/** |
| 380 |
* Rewrite flush. |
| 381 |
* |
| 382 |
* @since 1.0.7 |
| 383 |
* @access public |
| 384 |
*/ |
| 385 |
public static function install_activation_key(){ |
| 386 |
add_option('elementskit-lite__plugin_activated', self::plugin_file()); |
| 387 |
} |
| 388 |
/** |
| 389 |
* Add category. |
| 390 |
* |
| 391 |
* Register custom widget category in Elementor's editor |
| 392 |
* |
| 393 |
* @since 1.0.0 |
| 394 |
* @access public |
| 395 |
*/ |
| 396 |
public function elementor_widget_category($widgets_manager){ |
| 397 |
\Elementor\Plugin::$instance->elements_manager->add_category( |
| 398 |
'elementskit', |
| 399 |
[ |
| 400 |
'title' =>esc_html__( 'ElementsKit', 'elementskit-lite' ), |
| 401 |
'icon' => 'fa fa-plug', |
| 402 |
], |
| 403 |
1 |
| 404 |
); |
| 405 |
\Elementor\Plugin::$instance->elements_manager->add_category( |
| 406 |
'elementskit_headerfooter', |
| 407 |
[ |
| 408 |
'title' =>esc_html__( 'ElementsKit Header Footer', 'elementskit-lite' ), |
| 409 |
'icon' => 'fa fa-plug', |
| 410 |
], |
| 411 |
1 |
| 412 |
); |
| 413 |
} |
| 414 |
} |
| 415 |
|
| 416 |
new ElementsKit_Lite(); |
| 417 |
|
| 418 |
register_activation_hook( __FILE__, 'ElementsKit_Lite::install_activation_key' ); |
| 419 |
|