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