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