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
plugin.php
509 lines
| 1 | <?php |
| 2 | namespace ElementsKit_Lite; |
| 3 | |
| 4 | defined( 'ABSPATH' ) || exit; |
| 5 | |
| 6 | |
| 7 | /** |
| 8 | * ElementsKit - the God class. |
| 9 | * Initiate all necessary classes, hooks, configs. |
| 10 | * |
| 11 | * @since 1.0.0 |
| 12 | */ |
| 13 | class Plugin { |
| 14 | |
| 15 | |
| 16 | /** |
| 17 | * The plugin instance. |
| 18 | * |
| 19 | * @since 1.0.0 |
| 20 | * @access public |
| 21 | * @static |
| 22 | * |
| 23 | * @var Plugin |
| 24 | */ |
| 25 | public static $instance = null; |
| 26 | |
| 27 | /** |
| 28 | * Construct the plugin object. |
| 29 | * |
| 30 | * @since 1.0.0 |
| 31 | * @access public |
| 32 | */ |
| 33 | public function __construct() { |
| 34 | |
| 35 | // check on-boarding status |
| 36 | Libs\Framework\Classes\Onboard_Status::instance()->onboard(); |
| 37 | |
| 38 | // Initialize deactivation feedback |
| 39 | Core\Plugin_Unsubscribe::instance(); |
| 40 | |
| 41 | // migrate old settings db to new format. |
| 42 | new Compatibility\Data_Migration\Settings_Db(); |
| 43 | |
| 44 | // compatibility for element manager. |
| 45 | new Compatibility\Element_Manager\Init(); |
| 46 | |
| 47 | // Enqueue admin scripts. |
| 48 | add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin' ) ); |
| 49 | |
| 50 | // Enqueue inline scripts |
| 51 | Core\Build_Inline_Scripts::instance(); |
| 52 | |
| 53 | // Register plugin settings pages |
| 54 | Libs\Framework\Attr::instance(); |
| 55 | |
| 56 | // Register default widgets |
| 57 | Core\Build_Widgets::instance(); |
| 58 | |
| 59 | // Register default modules |
| 60 | Core\Build_Modules::instance(); |
| 61 | |
| 62 | // register plugin activation actions |
| 63 | ( new Core\Activation_Actions() )->init(); |
| 64 | |
| 65 | add_action( 'send_headers', array( $this, 'add_meta_for_search_excluded' ) ); |
| 66 | |
| 67 | // Register ElementsKit supported widgets to Elementor from 3rd party plugins. |
| 68 | add_action( 'elementor/widgets/register', array( $this, 'register_widgets' ), 1050 ); |
| 69 | |
| 70 | // Register wpml compatibility |
| 71 | Compatibility\Wpml\Init::instance(); |
| 72 | |
| 73 | // Compatibility issues |
| 74 | Compatibility\Conflicts\Init::instance(); |
| 75 | |
| 76 | // Show forms sub menu page |
| 77 | \Wpmet\Libs\Forms::instance(); |
| 78 | |
| 79 | $is_pro_active = \ElementsKit_Lite\Utils::ekit_is_plugin_active( 'elementskit/elementskit.php'); |
| 80 | |
| 81 | // Initialize editor promotion for pro widgets |
| 82 | if( ! $is_pro_active ) { |
| 83 | add_action( 'elementor/editor/init', function() { |
| 84 | if ( class_exists( '\ElementsKit_Lite\Core\Editor_Promotion' ) ) { |
| 85 | \ElementsKit_Lite\Core\Editor_Promotion::instance()->init(); |
| 86 | } |
| 87 | } ); |
| 88 | } |
| 89 | |
| 90 | if ( is_admin() && Libs\Framework\Classes\Utils::instance()->get_settings( 'ekit_user_consent_for_banner', 'yes' ) == 'yes' ) { |
| 91 | $filter_string = \ElementsKit_Lite::active_plugins(); |
| 92 | /** |
| 93 | * Show WPMET stories widget in dashboard |
| 94 | */ |
| 95 | \Wpmet\Libs\Stories::instance( 'elementskit-lite' ) |
| 96 | // ->is_test(true) |
| 97 | ->set_filter( $filter_string ) |
| 98 | ->set_plugin( 'ElementsKit', 'https://wpmet.com/plugin/elementskit/' ) |
| 99 | ->set_api_url( 'https://api.wpmet.com/public/stories/' ) |
| 100 | ->call(); |
| 101 | |
| 102 | /** |
| 103 | * Show WPMET banner (codename: jhanda) |
| 104 | */ |
| 105 | \Wpmet\Libs\Banner::instance( 'elementskit-lite' ) |
| 106 | // ->is_test(true) |
| 107 | ->set_filter( ltrim( $filter_string, ',' ) ) |
| 108 | ->set_api_url( 'https://api.wpmet.com/public/jhanda' ) |
| 109 | ->set_plugin_screens( 'edit-elementskit_template' ) |
| 110 | ->set_plugin_screens( 'toplevel_page_elementskit' ) |
| 111 | ->call(); |
| 112 | |
| 113 | /** |
| 114 | * Ask for rating |
| 115 | * A rating notice will appear depends on |
| 116 | * @set_first_appear_day methods |
| 117 | */ |
| 118 | \Wpmet\Libs\Rating::instance( 'elementskit-lite' ) |
| 119 | ->set_plugin( 'ElementsKit', 'https://wpmet.com/wordpress.org/rating/elementskit' ) |
| 120 | ->set_plugin_logo( 'https://ps.w.org/elementskit-lite/assets/icon-128x128.gif', 'width:150px !important' ) |
| 121 | ->set_allowed_screens( 'edit-elementskit_template' ) |
| 122 | ->set_allowed_screens( 'toplevel_page_elementskit' ) |
| 123 | ->set_allowed_screens( 'elementskit_page_elementskit-lite_get_help' ) |
| 124 | ->set_priority( 10 ) |
| 125 | ->set_first_appear_day( 7 ) |
| 126 | ->set_condition( true ) |
| 127 | ->call(); |
| 128 | |
| 129 | } |
| 130 | |
| 131 | /** |
| 132 | * Show go Premium menu |
| 133 | */ |
| 134 | $pro_awareness = \Wpmet\Libs\Pro_Awareness::instance('elementskit-lite'); |
| 135 | |
| 136 | if(version_compare($pro_awareness->get_version(), '1.2.0') >= 0) { |
| 137 | $pro_awareness |
| 138 | ->set_parent_menu_slug( 'elementskit' ) |
| 139 | ->set_plugin_file( 'elementskit-lite/elementskit-lite.php' ) |
| 140 | ->set_pro_link( |
| 141 | ( ( \ElementsKit_Lite::package_type() != 'free' ) ? '' : 'https://wpmet.com/elementskit-pricing' ) |
| 142 | ) |
| 143 | ->set_default_grid_thumbnail( \ElementsKit_Lite::lib_url() . 'pro-awareness/assets/support.png' ) |
| 144 | ->set_page_grid( |
| 145 | array( |
| 146 | 'url' => 'https://wpmet.com/fb-group', |
| 147 | 'title' => 'Join the Community', |
| 148 | 'thumbnail' => \ElementsKit_Lite::lib_url() . 'pro-awareness/assets/community.png', |
| 149 | 'description' => 'Join our Facebook group to get 20% discount coupon on premium products. Follow us to get more exciting offers.' |
| 150 | ) |
| 151 | ) |
| 152 | ->set_page_grid( |
| 153 | array( |
| 154 | 'url' => 'https://www.youtube.com/playlist?list=PL3t2OjZ6gY8MVnyA4OLB6qXb77-roJOuY', |
| 155 | 'title' => 'Video Tutorials', |
| 156 | 'thumbnail' => \ElementsKit_Lite::lib_url() . 'pro-awareness/assets/videos.png', |
| 157 | 'description' => 'Learn the step by step process for developing your site easily from video tutorials.' |
| 158 | ) |
| 159 | ) |
| 160 | ->set_page_grid( |
| 161 | array( |
| 162 | 'url' => 'https://wpmet.com/plugin/elementskit/roadmaps#ideas', |
| 163 | 'title' => 'Request a feature', |
| 164 | 'thumbnail' => \ElementsKit_Lite::lib_url() . 'pro-awareness/assets/request.png', |
| 165 | 'description' => 'Have any special feature in mind? Let us know through the feature request.' |
| 166 | ) |
| 167 | ) |
| 168 | ->set_page_grid( |
| 169 | array( |
| 170 | 'url' => 'https://wpmet.com/doc/elementskit/', |
| 171 | 'title' => 'Documentation', |
| 172 | 'thumbnail' => \ElementsKit_Lite::lib_url() . 'pro-awareness/assets/documentation.png', |
| 173 | 'description' => 'Detailed documentation to help you understand the functionality of each feature.' |
| 174 | ) |
| 175 | ) |
| 176 | ->set_page_grid( |
| 177 | array( |
| 178 | 'url' => 'https://wpmet.com/plugin/elementskit/roadmaps/', |
| 179 | 'title' => 'Public Roadmap', |
| 180 | 'thumbnail' => \ElementsKit_Lite::lib_url() . 'pro-awareness/assets/roadmaps.png', |
| 181 | 'description' => 'Check our upcoming new features, detailed development stories and tasks' |
| 182 | ) |
| 183 | ) |
| 184 | ->set_plugin_row_meta( 'Documentation', 'https://wpmet.com/elementskit-docs', array( 'target' => '_blank' ) ) |
| 185 | ->set_plugin_row_meta( 'Facebook Community', 'https://wpmet.com/fb-group', array( 'target' => '_blank' ) ) |
| 186 | ->set_plugin_row_meta( 'Rate the plugin � |
| 187 | � |
| 188 | � |
| 189 | � |
| 190 | � |
| 191 | ', 'https://wordpress.org/support/plugin/elementskit-lite/reviews/#new-post', array( 'target' => '_blank' ) ) |
| 192 | ->set_plugin_action_link( 'Settings', admin_url() . 'admin.php?page=elementskit' ) |
| 193 | ->set_plugin_action_link( |
| 194 | ( $is_pro_active ? '' : 'Go Premium' ), |
| 195 | 'https://wpmet.com/elementskit-pricing', |
| 196 | array( |
| 197 | 'target' => '_blank', |
| 198 | 'style' => 'color: #FCB214; font-weight: bold;', |
| 199 | ) |
| 200 | ) |
| 201 | ->call(); |
| 202 | } |
| 203 | |
| 204 | // Adding pro lebel |
| 205 | if ( \ElementsKit_Lite::package_type() == 'free' ) { |
| 206 | new Libs\Pro_Label\Init(); |
| 207 | } |
| 208 | |
| 209 | /** |
| 210 | * Show our plugins menu for others wpmet plugins |
| 211 | */ |
| 212 | \Wpmet\Libs\Our_Plugins::instance()->init('elementskit-lite') # @text_domain |
| 213 | ->set_parent_menu_slug('elementskit') # @plugin_slug |
| 214 | ->set_submenu_name( |
| 215 | esc_html__('Our Plugins', 'elementskit-lite') |
| 216 | ) # @submenu_name (optional- default: Our Plugins) |
| 217 | ->set_section_title( |
| 218 | esc_html__('Take Your WordPress Website To Next Level!', 'elementskit-lite') |
| 219 | ) # @section_title (optional) |
| 220 | ->set_section_description( |
| 221 | esc_html__('Our diverse range of plugins has every solution for WordPress, Gutenberg, Elementor, and WooCommerce.', 'elementskit-lite') |
| 222 | ) # @section_description (optional) |
| 223 | ->set_items_per_row(4) # @items_per_row (optional- default: 6) |
| 224 | ->set_plugins( |
| 225 | [ |
| 226 | 'getgenie/getgenie.php' => [ |
| 227 | 'name' => esc_html__('GetGenie AI', 'elementskit-lite'), |
| 228 | 'url' => 'https://wordpress.org/plugins/getgenie/', |
| 229 | 'icon' => 'https://ps.w.org/getgenie/assets/icon-256x256.gif?rev=2798355', |
| 230 | 'desc' => esc_html__('Your personal AI assistant for content and SEO. Write content that ranks on Google with NLP keywords and SERP analysis data.', 'elementskit-lite'), |
| 231 | 'docs' => 'https://getgenie.ai/docs/', |
| 232 | ], |
| 233 | 'shopengine/shopengine.php' => [ |
| 234 | 'name' => esc_html__('ShopEngine', 'elementskit-lite'), |
| 235 | 'url' => 'https://wordpress.org/plugins/shopengine/', |
| 236 | 'icon' => 'https://ps.w.org/shopengine/assets/icon-256x256.gif?rev=2505061', |
| 237 | 'desc' => esc_html__('Complete WooCommerce solution for Elementor to fully customize any pages including cart, checkout, shop page, and so on.', 'elementskit-lite'), |
| 238 | 'docs' => 'https://wpmet.com/doc/shopengine/', |
| 239 | ], |
| 240 | 'metform/metform.php' => [ |
| 241 | 'name' => esc_html__('MetForm', 'elementskit-lite'), |
| 242 | 'url' => 'https://wordpress.org/plugins/genie-image-ai/', |
| 243 | 'icon' => 'https://ps.w.org/metform/assets/icon-256x256.png?rev=2544152', |
| 244 | 'desc' => esc_html__('Drag & drop form builder for Elementor to create contact forms, multi-step forms, and more — smoother, faster, and better!', 'elementskit-lite'), |
| 245 | 'docs' => 'https://wpmet.com/doc/metform/', |
| 246 | ], |
| 247 | 'emailkit/EmailKit.php' => [ |
| 248 | 'name' => esc_html__('EmailKit', 'elementskit-lite'), |
| 249 | 'url' => 'https://wordpress.org/plugins/genie-image-ai/', |
| 250 | 'icon' => 'https://ps.w.org/emailkit/assets/icon-256x256.png?rev=3003571', |
| 251 | 'desc' => esc_html__('Advanced email customizer for WooCommerce and WordPress. Build, customize, and send emails from WordPress to boost your sales!', 'elementskit-lite'), |
| 252 | 'docs' => 'https://wpmet.com/doc/emailkit/', |
| 253 | ], |
| 254 | 'gutenkit-blocks-addon/gutenkit-blocks-addon.php' => [ |
| 255 | 'name' => esc_html__('GutenKit', 'elementskit-lite'), |
| 256 | 'url' => 'https://wordpress.org/plugins/gutenkit-blocks-addon/', |
| 257 | 'icon' => 'https://ps.w.org/gutenkit-blocks-addon/assets/icon-256x256.gif?rev=3044956', |
| 258 | 'desc' => esc_html__('Gutenberg blocks, patterns, and templates that extend the page-building experience using the WordPress block editor.', 'elementskit-lite'), |
| 259 | 'docs' => 'https://wpmet.com/docs/gutenkit/', |
| 260 | ], |
| 261 | 'popup-builder-block/popup-builder-block.php' => [ |
| 262 | 'name' => esc_html__('PopupKit', 'elementskit-lite'), |
| 263 | 'url' => 'https://wordpress.org/plugins/popup-builder-block/', |
| 264 | 'icon' => 'https://ps.w.org/popup-builder-block/assets/icon-256x256.png?rev=3316844', |
| 265 | 'desc' => esc_html__('Design popups that convert, right in your WordPress dashboard.', 'elementskit-lite'), |
| 266 | 'docs' => 'https://wpmet.com/docs/gutenkit/', |
| 267 | ], |
| 268 | 'table-builder-block/table-builder-block.php' => [ |
| 269 | 'name' => esc_html__('TableKit', 'elementskit-lite'), |
| 270 | 'url' => 'https://wordpress.org/plugins/table-builder-block/', |
| 271 | 'icon' => 'https://ps.w.org/table-builder-block/assets/icon-256x256.jpg?rev=3168211', |
| 272 | 'desc' => esc_html__('Fully Customizable. Multi-Media Integration. Synch Any Data Files. All Within Block Editor.', 'elementskit-lite'), |
| 273 | 'docs' => 'https://wpmet.com/docs/gutenkit/', |
| 274 | ], |
| 275 | 'wp-social/wp-social.php' => [ |
| 276 | 'name' => esc_html__('WP Social', 'elementskit-lite'), |
| 277 | 'url' => 'https://wordpress.org/plugins/wp-social/', |
| 278 | 'icon' => 'https://ps.w.org/wp-social/assets/icon-256x256.png?rev=2544214', |
| 279 | 'desc' => esc_html__('Add social share, login, and engagement counter — unified solution for all social media with tons of different styles for your website.', 'elementskit-lite'), |
| 280 | 'docs' => 'https://wpmet.com/doc/wp-social/', |
| 281 | ], |
| 282 | 'wp-ultimate-review/wp-ultimate-review.php' => [ |
| 283 | 'name' => esc_html__('WP Ultimate Review', 'elementskit-lite'), |
| 284 | 'url' => 'https://wordpress.org/plugins/wp-ultimate-review/', |
| 285 | 'icon' => 'https://ps.w.org/wp-ultimate-review/assets/icon-256x256.png?rev=2544187', |
| 286 | 'desc' => esc_html__('Collect and showcase reviews on your website to build brand credibility and social proof with the easiest solution.', 'elementskit-lite'), |
| 287 | 'docs' => 'https://wpmet.com/doc/wp-ultimate-review/', |
| 288 | ], |
| 289 | 'wp-fundraising-donation/wp-fundraising.php' => [ |
| 290 | 'name' => esc_html__('FundEngine', 'elementskit-lite'), |
| 291 | 'url' => 'https://wordpress.org/plugins/wp-fundraising-donation/', |
| 292 | 'icon' => 'https://ps.w.org/wp-fundraising-donation/assets/icon-256x256.png?rev=2544150', |
| 293 | 'desc' => esc_html__('Create fundraising, crowdfunding, and donation websites with PayPal and Stripe payment gateway integration.', 'elementskit-lite'), |
| 294 | 'docs' => 'https://wpmet.com/doc/fundengine/', |
| 295 | ], |
| 296 | 'blocks-for-shopengine/shopengine-gutenberg-addon.php' => [ |
| 297 | 'name' => esc_html__('Blocks for ShopEngine', 'elementskit-lite'), |
| 298 | 'url' => 'https://wordpress.org/plugins/blocks-for-shopengine/', |
| 299 | 'icon' => 'https://ps.w.org/blocks-for-shopengine/assets/icon-256x256.gif?rev=2702483', |
| 300 | 'desc' => esc_html__('All in one WooCommerce solution for Gutenberg! Build your WooCommerce pages in a block editor with full customization.', 'elementskit-lite'), |
| 301 | 'docs' => 'https://wpmet.com/doc/shopengine/shopengine-gutenberg/', |
| 302 | ], |
| 303 | 'genie-image-ai/genie-image-ai.php' => [ |
| 304 | 'name' => esc_html__('Genie Image', 'elementskit-lite'), |
| 305 | 'url' => 'https://wordpress.org/plugins/genie-image-ai/', |
| 306 | 'icon' => 'https://ps.w.org/genie-image-ai/assets/icon-256x256.png?rev=2977297', |
| 307 | 'desc' => esc_html__('AI-powered text-to-image generator for WordPress with OpenAI’s DALL-E 2 technology to generate high-quality images in one click.', 'elementskit-lite'), |
| 308 | 'docs' => 'https://getgenie.ai/docs/', |
| 309 | ], |
| 310 | ] |
| 311 | ) # @plugins |
| 312 | ->call(); |
| 313 | |
| 314 | $user_consent = Libs\Framework\Classes\Utils::instance()->get_settings('ekit_user_consent_for_banner', 'yes') == 'yes'; |
| 315 | |
| 316 | /** |
| 317 | * EmailKit Global Class initialization |
| 318 | * |
| 319 | */ |
| 320 | if ( |
| 321 | class_exists('WooCommerce') |
| 322 | && !class_exists('EmailKit') |
| 323 | && !did_action('edit_with_emailkit_loaded') |
| 324 | && class_exists('\Wpmet\Libs\Emailkit') |
| 325 | && $user_consent |
| 326 | ) { |
| 327 | new \Wpmet\Libs\Emailkit(); |
| 328 | } |
| 329 | |
| 330 | /** |
| 331 | * Initializes the Template Library of the Gutenkit plugin |
| 332 | * |
| 333 | * This code block checks if certain conditions are met and then initializes the Template Library of the Gutenkit plugin. |
| 334 | * |
| 335 | * Conditions: |
| 336 | * - The action 'edit_with_gutenkit_loaded' has not been performed yet. |
| 337 | * - The class '\ElementsKit_Lite\Libs\Template_Library\Init' exists. |
| 338 | * - The setting 'ekit_user_consent_for_banner' in the Utils class is set to 'yes'. |
| 339 | * - The plugin 'gutenkit-blocks-addon' is not active or install. |
| 340 | * |
| 341 | * If any of the above conditions are met, the Template Library is initialized by creating a new instance of |
| 342 | * the class '\ElementsKit_Lite\Libs\Template_Library\Init'. |
| 343 | * |
| 344 | * @since 3.1.4 |
| 345 | */ |
| 346 | if ($user_consent && class_exists('\ElementsKit_Lite\Libs\Template_Library\Init') && !did_action('gutenkit/init')) { |
| 347 | new \ElementsKit_Lite\Libs\Template_Library\Init(); |
| 348 | } |
| 349 | } |
| 350 | |
| 351 | /** |
| 352 | * Check the admin screen and show the rating notice if eligible |
| 353 | * |
| 354 | * @access private |
| 355 | * @return boolean |
| 356 | */ |
| 357 | private function should_show_rating_notice() { |
| 358 | |
| 359 | if ( \ElementsKit_Lite::package_type() == 'free' ) { |
| 360 | return true; |
| 361 | } |
| 362 | |
| 363 | if ( ! function_exists( 'get_current_screen' ) ) { |
| 364 | return false; |
| 365 | } |
| 366 | |
| 367 | $current_screen = ( get_current_screen() )->base; |
| 368 | $current_post_type = ( get_current_screen() )->post_type; |
| 369 | $eligible_post_type = array( 'elementskit_template' ); |
| 370 | $eligible_screens = array( 'plugins', 'dashboard', 'elementskit', 'themes' ); |
| 371 | |
| 372 | if ( in_array( $current_post_type, $eligible_post_type ) ) { |
| 373 | return true; |
| 374 | } |
| 375 | |
| 376 | if ( in_array( $current_screen, $eligible_screens ) ) { |
| 377 | return true; |
| 378 | } |
| 379 | |
| 380 | return false; |
| 381 | } |
| 382 | |
| 383 | /** |
| 384 | * Enqueue scripts |
| 385 | * |
| 386 | * Enqueue js and css to admin. |
| 387 | * |
| 388 | * @since 1.0.0 |
| 389 | * @access public |
| 390 | */ |
| 391 | public function enqueue_admin() { |
| 392 | $screen = get_current_screen(); |
| 393 | |
| 394 | if ( ! in_array( $screen->id, array( 'nav-menus', 'toplevel_page_elementskit', 'edit-elementskit_template', 'elementskit_page_elementskit-license', 'elementskit_page_elementskit-lite_get_help' ) ) ) { |
| 395 | return; |
| 396 | } |
| 397 | |
| 398 | wp_register_style( 'fontawesome', \ElementsKit_Lite::widget_url() . 'init/assets/css/font-awesome.min.css', false, \ElementsKit_Lite::version() ); |
| 399 | wp_register_style( 'elementskit-font-css-admin', \ElementsKit_Lite::module_url() . 'elementskit-icon-pack/assets/css/ekiticons.css', false, \ElementsKit_Lite::version() ); |
| 400 | wp_register_style( 'elementskit-init-css-admin', \ElementsKit_Lite::lib_url() . 'framework/assets/css/admin-style.css', false, \ElementsKit_Lite::version() ); |
| 401 | |
| 402 | wp_enqueue_style( 'fontawesome' ); |
| 403 | wp_enqueue_style( 'elementskit-font-css-admin' ); |
| 404 | wp_enqueue_style( 'elementskit-init-css-admin' ); |
| 405 | |
| 406 | wp_enqueue_script( 'ekit-admin-core', \ElementsKit_Lite::lib_url() . 'framework/assets/js/ekit-admin-core.js', array( 'jquery' ), \ElementsKit_Lite::version(), true ); |
| 407 | |
| 408 | $data['rest_url'] = get_rest_url(); |
| 409 | $data['nonce'] = wp_create_nonce( 'wp_rest' ); |
| 410 | |
| 411 | wp_localize_script( 'ekit-admin-core', 'rest_config', $data ); |
| 412 | |
| 413 | wp_localize_script( |
| 414 | 'ekit-admin-core', |
| 415 | 'ekit_ajax_var', |
| 416 | array( |
| 417 | 'nonce' => wp_create_nonce( 'ajax-nonce' ), |
| 418 | ) |
| 419 | ); |
| 420 | } |
| 421 | |
| 422 | /** |
| 423 | * Control registrar. |
| 424 | * |
| 425 | * Register the custom controls for Elementor |
| 426 | * using `elementskit/widgets/widgets_registered` action. |
| 427 | * |
| 428 | * @since 1.0.0 |
| 429 | * @access public |
| 430 | */ |
| 431 | public function register_control( $widgets_manager ) { |
| 432 | do_action( 'elementskit/widgets/widgets_registered', $widgets_manager ); |
| 433 | } |
| 434 | |
| 435 | |
| 436 | /** |
| 437 | * Widget registrar. |
| 438 | * |
| 439 | * Retrieve all the registered widgets |
| 440 | * using `elementor/widgets/register` action. |
| 441 | * |
| 442 | * @since 1.0.0 |
| 443 | * @access public |
| 444 | */ |
| 445 | public function register_widgets( $widgets_manager ) { |
| 446 | do_action( 'elementskit/widgets/widgets_registered', $widgets_manager ); |
| 447 | } |
| 448 | |
| 449 | /** |
| 450 | * Excluding ElementsKit template and megamenu content from search engine. |
| 451 | * See - https://wordpress.org/support/topic/google-is-indexing-elementskit-content-as-separate-pages/ |
| 452 | * |
| 453 | * @since 1.4.5 |
| 454 | * @access public |
| 455 | */ |
| 456 | public function add_meta_for_search_excluded() { |
| 457 | if ( |
| 458 | ! is_admin() && |
| 459 | is_singular() && |
| 460 | in_array( |
| 461 | get_post_type(), |
| 462 | array( 'elementskit_widget', 'elementskit_template', 'elementskit_content' ), |
| 463 | true |
| 464 | ) |
| 465 | ) { |
| 466 | header( 'X-Robots-Tag: noindex', true ); |
| 467 | } |
| 468 | } |
| 469 | |
| 470 | /** |
| 471 | * Autoloader. |
| 472 | * |
| 473 | * ElementsKit autoloader loads all the classes needed to run the plugin. |
| 474 | * |
| 475 | * @since 1.0.0 |
| 476 | * @access private |
| 477 | */ |
| 478 | public static function registrar_autoloader() { |
| 479 | require_once \ElementsKit_Lite::plugin_dir() . '/autoloader.php'; |
| 480 | Autoloader::run(); |
| 481 | } |
| 482 | |
| 483 | /** |
| 484 | * Instance. |
| 485 | * |
| 486 | * Ensures only one instance of the plugin class is loaded or can be loaded. |
| 487 | * |
| 488 | * @since 1.0.0 |
| 489 | * @access public |
| 490 | * @static |
| 491 | * |
| 492 | * @return Plugin An instance of the class. |
| 493 | */ |
| 494 | public static function instance() { |
| 495 | if ( is_null( self::$instance ) ) { |
| 496 | |
| 497 | do_action( 'elementskit_lite/before_loaded' ); |
| 498 | |
| 499 | // Fire when ElementsKit instance. |
| 500 | self::$instance = new self(); |
| 501 | |
| 502 | do_action( 'elementskit/loaded' ); // legacy support |
| 503 | do_action( 'elementskit_lite/after_loaded' ); |
| 504 | } |
| 505 | |
| 506 | return self::$instance; |
| 507 | } |
| 508 | } |
| 509 |