PluginProbe
WP Directory Kit / trunk
WP Directory Kit vtrunk
1.5.6 1.5.5 1.5.4 1.5.3 trunk 1.1.0 1.1.6 1.1.8 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.8 1.4.0 1.4.1 All 35 releases
wpdirectorykit / elementor-elements / elementor-init.php

elementor-init.php in WP Directory Kit trunk, at elementor-elements/elementor-init.php

678 lines 24.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * The admin-specific functionality of the plugin.
4 *
5 * @link listing-themes.com
6 * @since 1.0.0
7 *
8 * @package Wpdirectorykit
9 * @subpackage Wpdirectorykit/admin
10 */
11
12 /**
13 * The admin-specific functionality of the plugin.
14 *
15 * Defines the plugin name, version, and two examples hooks for how to
16 * enqueue the admin-specific stylesheet and JavaScript.
17 *
18 * @package Wpdirectorykit
19 * @subpackage Wpdirectorykit/admin
20 * @author listing-themes.com <dev@listing-themes.com>
21 */
22
23 if ( ! defined( 'ABSPATH' ) ) {
24 exit; // Exit if accessed directly.
25 }
26
27 class Wdk_Elementor {
28
29 /**
30 * The ID of this plugin.
31 *
32 * @since 1.0.0
33 * @access private
34 * @var string $plugin_name The ID of this plugin.
35 */
36 private $plugin_name;
37
38 /**
39 * The version of this plugin.
40 *
41 * @since 1.0.0
42 * @access private
43 * @var string $version The current version of this plugin.
44 */
45 private $version;
46
47 /**
48 * The name of Elementor Category.
49 *
50 * @since 1.0.0
51 * @access private
52 * @var string $version The current version of this plugin.
53 */
54 private $elementor_category_name = 'wdk-elementor';
55 private $elementor_category_name_listing_preview = 'wdk-elementor-listing-preview';
56 private $elementor_category_name_listing_preview_sliders = 'wdk-elementor-listing-preview-sliders';
57
58
59 /**
60 * The name Elementors Custom Controls.
61 *
62 * @since 1.0.0
63 * @access private
64 * @var string $version The current version of this plugin.
65 */
66 private $custom_controls = [
67 WPDIRECTORYKIT_PATH.'elementor-elements/classes/includes/controls/wdk-post-filter.php'=>'Wdk\Includes\Controls\Wdk_Post_Filter',
68 WPDIRECTORYKIT_PATH.'elementor-elements/classes/includes/controls/wdk-field-selector.php'=>'Wdk\Includes\Controls\Wdk_Field_Selector',
69 ];
70
71 /**
72 * Initialize the class and set its properties.
73 *
74 * @since 1.0.0
75 * @param string $plugin_name The name of this plugin.
76 * @param string $version The version of this plugin.
77 */
78 public function __construct( $plugin_name='wpdirectorykit', $version='1.0' ) {
79 $this->plugin_name = $plugin_name;
80 $this->version = $version;
81
82
83 add_action( 'elementor/controls/register', array( $this, 'add_controls' ) );
84
85 add_action( 'wp_ajax_wdk_handle_live_editor', array( $this, 'wdk_handle_live_editor' ) );
86 add_action( 'wp_ajax_wdk_update_filter', array( $this, 'get_posts_list' ) );
87
88
89 add_action( 'elementor/editor/before_enqueue_styles', array( $this, 'enqueue_editor_styles' ) );
90 add_action( 'elementor/editor/after_enqueue_styles', array( $this, 'load_live_editor_modal' ) );
91 add_action( 'elementor/editor/after_enqueue_scripts', array( $this, 'after_enqueue_scripts' ) );
92 }
93
94 /**
95 * Register the stylesheets for the admin area.
96 *
97 * @since 1.0.0
98 */
99 public function enqueue_styles() {
100 /**
101 * This function is provided for demonstration purposes only.
102 *
103 * An instance of this class should be passed to the run() function
104 * defined in Wpdirectorykit_Loader as all of the hooks are defined
105 * in that particular class.
106 *
107 * The Wpdirectorykit_Loader will then create the relationship
108 * between the defined hooks and the functions defined in this
109 * class.
110 */
111
112 wp_enqueue_style( 'font-awesome' );
113 }
114
115 /**
116 * Register the JavaScript for the admin area.
117 *
118 * @since 1.0.0
119 */
120 public function enqueue_scripts() {
121 /**
122 * This function is provided for demonstration purposes only.
123 *
124 * An instance of this class should be passed to the run() function
125 * defined in Wpdirectorykit_Loader as all of the hooks are defined
126 * in that particular class.
127 *
128 * The Wpdirectorykit_Loader will then create the relationship
129 * between the defined hooks and the functions defined in this
130 * class.
131 */
132 wp_enqueue_script( 'wdk-elementor-main', plugin_dir_url( __FILE__ ) . 'assets/js/wdk-main.js', array(), $this->version, true );
133
134 }
135
136 /**
137 * Load class/script files
138 *
139 * @since 1.0.0
140 */
141 public function loader() {
142
143 }
144
145 /**
146 * Includes
147 *
148 * @since 1.0.0
149 *
150 * @access private
151 */
152 private function includes() {
153 require_once plugin_dir_path( __FILE__ ) . 'classes/wdk-elementor-base.php';
154 require_once plugin_dir_path( __FILE__ ) . 'classes/wdk-field-label.php';
155 require_once plugin_dir_path( __FILE__ ) . 'classes/wdk-field-value.php';
156 require_once plugin_dir_path( __FILE__ ) . 'classes/wdk-field-images.php';
157 require_once plugin_dir_path( __FILE__ ) . 'classes/wdk-field-files.php';
158 require_once plugin_dir_path( __FILE__ ) . 'classes/wdk-field-files-list.php';
159 require_once plugin_dir_path( __FILE__ ) . 'classes/wdk-field-icon.php';
160 require_once plugin_dir_path( __FILE__ ) . 'classes/wdk-listing-agents-listings.php';
161 require_once plugin_dir_path( __FILE__ ) . 'classes/wdk-listing-similar-listings.php';
162 require_once plugin_dir_path( __FILE__ ) . 'classes/wdk-listing-related-listings.php';
163 require_once plugin_dir_path( __FILE__ ) . 'classes/wdk-listing-related-listings-table.php';
164 require_once plugin_dir_path( __FILE__ ) . 'classes/wdk-locations-grid.php';
165 require_once plugin_dir_path( __FILE__ ) . 'classes/wdk-categories-grid-cover.php';
166 require_once plugin_dir_path( __FILE__ ) . 'classes/wdk-locations-grid-cover.php';
167 require_once plugin_dir_path( __FILE__ ) . 'classes/wdk-categories-grid.php';
168 require_once plugin_dir_path( __FILE__ ) . 'classes/wdk-categories-list.php';
169 require_once plugin_dir_path( __FILE__ ) . 'classes/wdk-categories-tree.php';
170 require_once plugin_dir_path( __FILE__ ) . 'classes/wdk-locations-tree.php';
171 require_once plugin_dir_path( __FILE__ ) . 'classes/wdk-categories-tree-top.php';
172 require_once plugin_dir_path( __FILE__ ) . 'classes/wdk-locations-list.php';
173 require_once plugin_dir_path( __FILE__ ) . 'classes/wdk-listings-results.php';
174 require_once plugin_dir_path( __FILE__ ) . 'classes/wdk-listings-carousel.php';
175 require_once plugin_dir_path( __FILE__ ) . 'classes/wdk-listing-slider.php';
176 require_once plugin_dir_path( __FILE__ ) . 'classes/wdk-categories-carousel.php';
177 require_once plugin_dir_path( __FILE__ ) . 'classes/wdk-locations-carousel.php';
178 require_once plugin_dir_path( __FILE__ ) . 'classes/wdk-map.php';
179 require_once plugin_dir_path( __FILE__ ) . 'classes/wdk-search.php';
180 require_once plugin_dir_path( __FILE__ ) . 'classes/wdk-listing-fields-section.php';
181 require_once plugin_dir_path( __FILE__ ) . 'classes/wdk-listings-list.php';
182 require_once plugin_dir_path( __FILE__ ) . 'classes/wdk-listing-map.php';
183 require_once plugin_dir_path( __FILE__ ) . 'classes/wdk-listing-agent.php';
184 require_once plugin_dir_path( __FILE__ ) . 'classes/wdk-listing-agent-field.php';
185 require_once plugin_dir_path( __FILE__ ) . 'classes/wdk-listing-agent-avatar.php';
186 require_once plugin_dir_path( __FILE__ ) . 'classes/wdk-button.php';
187 require_once plugin_dir_path( __FILE__ ) . 'classes/wdk-button-login.php';
188 require_once plugin_dir_path( __FILE__ ) . 'classes/wdk-button-addlisting.php';
189
190 require_once plugin_dir_path( __FILE__ ) . 'classes/wdk-listing-carousel.php';
191 require_once plugin_dir_path( __FILE__ ) . 'classes/wdk-listing-sliders.php';
192 require_once plugin_dir_path( __FILE__ ) . 'classes/wdk-listing-sliders-more-grid-images.php';
193 require_once plugin_dir_path( __FILE__ ) . 'classes/wdk-listing-sliders-grid-images.php';
194 require_once plugin_dir_path( __FILE__ ) . 'classes/wdk-listing-sliders-carousel.php';
195 require_once plugin_dir_path( __FILE__ ) . 'classes/wdk-last-search.php';
196 require_once plugin_dir_path( __FILE__ ) . 'classes/wdk-implode-shortcode.php';
197 require_once plugin_dir_path( __FILE__ ) . 'classes/wdk-tabs.php';
198 require_once plugin_dir_path( __FILE__ ) . 'classes/wdk-language-switcher.php';
199 require_once plugin_dir_path( __FILE__ ) . 'classes/wdk-button-share.php';
200
201 if(wdk_get_option('wdk_experimental_features') && wdk_get_option('wdk_experimental_search_popup')) {
202 require_once plugin_dir_path( __FILE__ ) . 'classes/wdk-search-popup.php';
203 }
204
205 do_action('wpdirectorykit/elementor-elements/includes');
206 }
207
208 /**
209 * Register Widget
210 *
211 * @since 1.0.0
212 *
213 * @access private
214 */
215 private function register_widget() {
216
217 $listing_page_id = get_option('wdk_listing_page');
218
219 if(!empty($listing_page_id))
220 {
221 $post_data = NULL;
222 if(isset($_GET['post']))
223 $post_data = get_post(intval($_GET['post']));
224 if(
225 (isset($_GET['post']) && $_GET['post'] == $listing_page_id) ||
226 (isset($post_data->post_type) && $post_data->post_type == 'elementor_library')
227 )
228 {
229 $this->add_widget('Wdk\Elementor\Widgets\WdkFieldLabel');
230 $this->add_widget('Wdk\Elementor\Widgets\WdkFieldValue');
231 $this->add_widget('Wdk\Elementor\Widgets\WdkFieldFiles');
232 $this->add_widget('Wdk\Elementor\Widgets\WdkFieldFilesList');
233 $this->add_widget('Wdk\Elementor\Widgets\WdkFieldImages');
234 $this->add_widget('Wdk\Elementor\Widgets\WdkFieldIcon');
235 $this->add_widget('Wdk\Elementor\Widgets\WdkListingAgentsListings');
236 $this->add_widget('Wdk\Elementor\Widgets\WdkListingSimilarListings');
237 $this->add_widget('Wdk\Elementor\Widgets\WdkListingRelatedListingsTable');
238 $this->add_widget('Wdk\Elementor\Widgets\WdkListingRelatedListings');
239 $this->add_widget('Wdk\Elementor\Widgets\WdkListingSlider');
240 $this->add_widget('Wdk\Elementor\Widgets\WdkListingFieldsSection');
241 $this->add_widget('Wdk\Elementor\Widgets\WdkListingMap');
242 $this->add_widget('Wdk\Elementor\Widgets\WdkListinAgent');
243 $this->add_widget('Wdk\Elementor\Widgets\WdkListingAgentField');
244 $this->add_widget('Wdk\Elementor\Widgets\WdkListingAgentAvatar');
245
246 $this->add_widget('Wdk\Elementor\Widgets\WdkCoolListingCarousel');
247 $this->add_widget('Wdk\Elementor\Widgets\WdkListingSlidersCarousel');
248 $this->add_widget('Wdk\Elementor\Widgets\WdkListingSlidersGridMoreImages');
249 $this->add_widget('Wdk\Elementor\Widgets\WdkListingSlidersGridImages');
250 $this->add_widget('Wdk\Elementor\Widgets\WdkListingSliders');
251 do_action('wpdirectorykit/elementor-elements/register_widget/listing', $this);
252 }
253 else if(isset($_GET['post']))
254 {
255
256 }
257 else
258 {
259 $this->add_widget('Wdk\Elementor\Widgets\WdkFieldLabel');
260 $this->add_widget('Wdk\Elementor\Widgets\WdkFieldValue');
261 $this->add_widget('Wdk\Elementor\Widgets\WdkFieldFiles');
262 $this->add_widget('Wdk\Elementor\Widgets\WdkFieldFilesList');
263 $this->add_widget('Wdk\Elementor\Widgets\WdkFieldImages');
264 $this->add_widget('Wdk\Elementor\Widgets\WdkFieldIcon');
265 $this->add_widget('Wdk\Elementor\Widgets\WdkListingAgentsListings');
266 $this->add_widget('Wdk\Elementor\Widgets\WdkListingSimilarListings');
267 $this->add_widget('Wdk\Elementor\Widgets\WdkListingRelatedListingsTable');
268 $this->add_widget('Wdk\Elementor\Widgets\WdkListingRelatedListings');
269 $this->add_widget('Wdk\Elementor\Widgets\WdkListingSlider');
270 $this->add_widget('Wdk\Elementor\Widgets\WdkListingFieldsSection');
271 $this->add_widget('Wdk\Elementor\Widgets\WdkListingMap');
272 $this->add_widget('Wdk\Elementor\Widgets\WdkListinAgent');
273 $this->add_widget('Wdk\Elementor\Widgets\WdkListingAgentField');
274 $this->add_widget('Wdk\Elementor\Widgets\WdkListingAgentAvatar');
275
276 $this->add_widget('Wdk\Elementor\Widgets\WdkCoolListingCarousel');
277 $this->add_widget('Wdk\Elementor\Widgets\WdkListingSlidersCarousel');
278 $this->add_widget('Wdk\Elementor\Widgets\WdkListingSlidersGridMoreImages');
279 $this->add_widget('Wdk\Elementor\Widgets\WdkListingSlidersGridImages');
280 $this->add_widget('Wdk\Elementor\Widgets\WdkListingSliders');
281 do_action('wpdirectorykit/elementor-elements/register_widget/listing', $this);
282 }
283
284 //POST data[elementor_post_lock][post_ID]
285 }
286
287 $this->add_widget('Wdk\Elementor\Widgets\WdkLocationsList');
288 $this->add_widget('Wdk\Elementor\Widgets\WdkCategoriesList');
289 $this->add_widget('Wdk\Elementor\Widgets\WdkCategoriesTree');
290 $this->add_widget('Wdk\Elementor\Widgets\WdkCategoriesTreeTop');
291 $this->add_widget('Wdk\Elementor\Widgets\WdkLocationsTree');
292 $this->add_widget('Wdk\Elementor\Widgets\WdkListingsResults');
293 $this->add_widget('Wdk\Elementor\Widgets\WdkListingsCarousel');
294 $this->add_widget('Wdk\Elementor\Widgets\WdkCategoriesCarousel');
295 $this->add_widget('Wdk\Elementor\Widgets\WdkLocationsCarousel');
296 $this->add_widget('Wdk\Elementor\Widgets\WdkCategoriesGrid');
297 $this->add_widget('Wdk\Elementor\Widgets\WdkLocationsGrid');
298 $this->add_widget('Wdk\Elementor\Widgets\WdkCategoriesGridCover');
299 $this->add_widget('Wdk\Elementor\Widgets\WdkLocationsGridCover');
300 $this->add_widget('Wdk\Elementor\Widgets\WdkSearch');
301 $this->add_widget('Wdk\Elementor\Widgets\WdkMap');
302 $this->add_widget('Wdk\Elementor\Widgets\WdkListingsList');
303 $this->add_widget('Wdk\Elementor\Widgets\WdkButton');
304 $this->add_widget('Wdk\Elementor\Widgets\WdkButtonLogin');
305 $this->add_widget('Wdk\Elementor\Widgets\WdkButtonAddlisting');
306 $this->add_widget('Wdk\Elementor\Widgets\WdkLastSearch');
307 $this->add_widget('Wdk\Elementor\Widgets\WdkImplodeShortcode');
308 $this->add_widget('Wdk\Elementor\Widgets\WdkTabs');
309 $this->add_widget('Wdk\Elementor\Widgets\WdkLanguageSwitcher');
310 $this->add_widget('Wdk\Elementor\Widgets\WdkButtonShare');
311
312 if(wdk_get_option('wdk_experimental_features') && wdk_get_option('wdk_experimental_search_popup')) {
313 $this->add_widget('Wdk\Elementor\Widgets\WdkSearchPopup');
314 }
315
316 do_action('wpdirectorykit/elementor-elements/register_widget', $this);
317 }
318
319 public function add_widget($class = ''){
320 if(class_exists($class))
321 {
322 $object = new $class();
323 \Elementor\Plugin::instance()->widgets_manager->register( $object );
324 };
325 }
326
327
328 /**
329 * Registers Custom Controls.
330 *
331 * @since 1.0.0
332 * @access public
333 *
334 */
335 public function add_controls() {
336
337
338 $control_manager = \Elementor\Plugin::instance();
339
340 $this->custom_controls = apply_filters('wpdirectorykit/elementor/custom_controls', $this->custom_controls);
341
342 foreach ($this->custom_controls as $include_file => $class) {
343 if(empty($class) || !file_exists($include_file)) continue;
344
345 require_once $include_file;
346 $control_manager->controls_manager->register( new $class() );
347 }
348
349 }
350
351 /**
352 * Register Widget
353 *
354 * @since 1.0.0
355 *
356 * @access private
357 */
358 private function register_modules() {
359
360 }
361
362
363 /**
364 * On Widgets Registered
365 *
366 * @since 1.0.0
367 *
368 * @access public
369 */
370 public function on_widgets_registered() {
371 $this->includes();
372 $this->register_widget();
373 $this->register_modules();
374 }
375
376 /**
377 * Add elementor category
378 *
379 * @since 1.0.0
380 *
381 * @access public
382 */
383 function load_category( $elements_manager ) {
384 $elements_manager->add_category(
385 $this->elementor_category_name,
386 [
387 'title' => esc_html__( 'Wdk', 'wpdirectorykit' ),
388 'icon' => 'fa fa-plug',
389 ]
390 );
391
392 $elements_manager->add_category(
393 $this->elementor_category_name_listing_preview,
394 [
395 'title' => esc_html__( 'Wdk Listing Preview', 'wpdirectorykit' ),
396 'icon' => 'fa fa-plug',
397 ]
398 );
399
400 $elements_manager->add_category(
401 $this->elementor_category_name_listing_preview_sliders,
402 [
403 'title' => esc_html__( 'Wdk Listing Sliders', 'wpdirectorykit' ),
404 'icon' => 'fa fa-plug',
405 ]
406 );
407 }
408
409 /**
410 * Handle Live Editor Modal.
411 *
412 * @access public
413 * @since 4.8.10
414 */
415 public function wdk_handle_live_editor() {
416
417 check_ajax_referer( 'wdk-live-editor', 'security' );
418
419 if ( ! isset( $_POST['post_id'] ) ) {
420 wp_send_json_error();
421 }
422
423 $post_id = sanitize_text_field( wp_unslash( $_POST['post_id'] ) );
424 $meta_input = array(
425 '_elementor_edit_mode' => 'builder',
426 '_elementor_template_type' => 'page',
427 '_wp_page_template' => 'elementor_canvas',
428 );
429
430 $post = null;
431
432 if(!empty($post_id))
433 $post = get_post( $post_id );
434
435 if ( empty( $post ) ) { // create a new one.
436
437 $post_title = 'WDK Template | #' . substr( md5( wp_rand(0000,9999) ), 0, 4 );
438
439 $params = array(
440 'post_content' => '',
441 'post_type' => 'elementor_library',
442 'post_title' => $post_title,
443 'post_status' => 'publish',
444 'meta_input' => $meta_input,
445 );
446
447 $post_id = wp_insert_post( $params );
448
449 } else {
450 $post_id = $post->ID;
451 $post_title = $post->post_title;
452 }
453
454 $edit_url = get_admin_url() . '/post.php?post=' . $post_id . '&action=elementor';
455
456 $result = array(
457 'url' => $edit_url,
458 'id' => $post_id,
459 'title' => $post_title,
460 );
461
462 wp_send_json_success( $result );
463 }
464
465
466 /**
467 * Get posts list
468 *
469 * Get posts list array
470 *
471 * @since 4.2.8
472 * @access public
473 */
474 public static function get_posts_list() {
475
476 check_ajax_referer( 'wdk-blog-widget-nonce', 'nonce' );
477
478 $post_type = isset( $_POST['post_type'] ) ? wp_unslash( $_POST['post_type'] ) : '';
479
480 $post_type = array_map( 'sanitize_text_field', $post_type );
481
482 if ( empty( $post_type ) ) {
483 wp_send_json_error( esc_html__( 'Empty Post Type.', 'wpdirectorykit' ) );
484 }
485
486 $list = get_posts(
487 array(
488 'post_type' => $post_type,
489 'posts_per_page' => -1,
490 'update_post_term_cache' => false,
491 'update_post_meta_cache' => false,
492 )
493 );
494
495 $options = array();
496
497 if ( ! empty( $list ) && ! is_wp_error( $list ) ) {
498 foreach ( $list as $post ) {
499 $key = in_array( 'elementor_library', $post_type, true ) ? $post->post_title : $post->ID;
500 $options[ $key ] = $post->post_title;
501 }
502 }
503
504 wp_send_json_success( wp_json_encode( $options ) );
505 }
506
507 /**
508 * Load Live Editor Modal.
509 * Puts live editor popup html into the editor.
510 *
511 * @access public
512 * @since 4.8.10
513 */
514 public function load_live_editor_modal() {
515 ob_start();
516 include_once WPDIRECTORYKIT_PATH . 'elementor-elements/classes/includes/live-editor-modal.php';
517 $output = ob_get_contents();
518 ob_end_clean();
519 echo $output; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
520 }
521
522 /**
523 * After Enqueue Scripts
524 *
525 * Loads editor scripts for our controls.
526 *
527 * @access public
528 * @return void
529 */
530 public function after_enqueue_scripts() {
531
532 wp_enqueue_script( 'wdk-elementor-live-editor', WPDIRECTORYKIT_URL . 'elementor-elements/classes/includes/js/live-editor.js', array(), $this->version, true );
533
534 wp_localize_script( 'wdk-elementor-live-editor', 'liveEditor', array(
535 'ajaxurl' => esc_url( admin_url( 'admin-ajax.php' ) ),
536 'nonce' => wp_create_nonce( 'wdk-live-editor' ),
537 ));
538
539 wp_enqueue_script(
540 'wdk-controls-handlers',
541 WPDIRECTORYKIT_URL . 'elementor-elements/classes/includes/js/controls-handlers.js',
542 array( 'elementor-editor', 'jquery' ),
543 $this->version,
544 true
545 );
546
547 wp_localize_script(
548 'wdk-controls-handlers',
549 'PremiumSettings',
550 array(
551 'ajaxurl' => esc_url( admin_url( 'admin-ajax.php' ) ),
552 'nonce' => wp_create_nonce( 'wdk-blog-widget-nonce' ),
553 )
554 );
555 }
556
557 /**
558 * Loads plugin icons font
559 *
560 * @since 1.0.0
561 * @access public
562 * @return void
563 */
564 public function enqueue_editor_styles() {
565
566 $theme = 'dark';
567
568 wp_enqueue_style(
569 'wdk-elementor-live-editor',
570 WPDIRECTORYKIT_URL . 'elementor-elements/classes/includes/css/wdk-elementor-live-editor.css',
571 array(),
572 $this->version
573 );
574
575 // Enqueue required style for Elementor dark UI Theme.
576 if ( 'dark' == $theme ) {
577 wp_add_inline_style(
578 'wdk-elementor-live-editor',
579 '.elementor-panel .elementor-control-section_pa_docs .elementor-panel-heading-title.elementor-panel-heading-title,
580 .elementor-control-raw-html.editor-pa-doc a {
581 color: #e0e1e3 !important;
582 }
583 [class^="pa-"]::after,
584 [class*=" pa-"]::after {
585 color: #aaa;
586 opacity: 1 !important;
587 }
588 .wdk-promotion-dialog .wdk-promotion-btn {
589 background-color: #202124 !important
590 }'
591 );
592 }
593 }
594
595 /**
596 * Start Elementor Addon
597 */
598 public function run() {
599
600 require_once plugin_dir_path( __FILE__ ) . 'classes/wdk-elementor-base.php';
601
602 add_action( 'wp_enqueue_scripts',[ $this, 'enqueue_styles' ]);
603 add_action( 'wp_enqueue_scripts',[ $this, 'enqueue_scripts' ]);
604
605 add_action( 'elementor/elements/categories_registered', [ $this, 'load_category' ] );
606 add_action( 'elementor/widgets/register', [ $this, 'on_widgets_registered' ] );
607
608 do_action('wpdirectorykit/elementor-elements/run');
609
610 /* load module */
611 $this->loader();
612 //wmvc_dump($meta);
613 }
614
615
616 }
617
618 /* Init lib after elementor loaded */
619 add_action( 'elementor/init', function() {
620 $wdk_elementor = new Wdk_Elementor( );
621 $wdk_elementor->run();
622 do_action('wpdirectorykit/elementor-elements/init');
623 }, 1);
624
625 /* example extension for wdk elements
626 add_action('wpdirectorykit/elementor-elements/includes', function(){
627 require_once WPDIRECTORYKIT_PATH . '/elementor-extensions/class-contact-form.php';
628 });
629
630 add_action('wpdirectorykit/elementor-elements/register_widget/listing', function(){
631 $object = new Wdk\Elementor\Widgets\WdkContactFormExt();
632 \Elementor\Plugin::instance()->widgets_manager->register( $object );
633 });
634 */
635
636 /* load extension */
637
638 add_action('wpdirectorykit/elementor-elements/register_widget/listing', function(){
639 add_action('eli/includes', function(){
640 require_once WPDIRECTORYKIT_PATH . '/elementor-extensions/class-contact-form.php';
641 });
642
643 add_action('eli/register_widget', function(){
644 $object = new Wdk\Elementor\Extensions\WdkContactFormExt();
645 \Elementor\Plugin::instance()->widgets_manager->register( $object );
646 });
647
648 });
649
650
651 if((get_option('wdk_experimental_features') && get_option('wdk_experimental_listing_card_elementor_layout'))) {
652 add_action('wpdirectorykit/elementor-elements/register_widget', function(){
653 $card_elements= [
654 'wdk-listing-card-button' => 'WdkListingCardButton',
655 'wdk-listing-card-field-value' => 'WdkListingCardFieldValue',
656 'wdk-listing-card-field-icon' => 'WdkListingCardFieldIcon',
657 'wdk-listing-card-field-label' => 'WdkListingCardFieldLabel',
658 'wdk-listing-card-thumbnail' => 'WdkListingCardThumbnail',
659 ];
660 foreach ($card_elements as $file => $object_name) {
661 if(!file_exists(WPDIRECTORYKIT_PATH . '/elementor-extensions/'.$file.'.php')) continue;
662
663 require_once WPDIRECTORYKIT_PATH . '/elementor-extensions/'.$file.'.php';
664 $class_name = 'Wdk\\Elementor\\Extensions\\' . $object_name;
665 $object = new $class_name();
666 \Elementor\Plugin::instance()->widgets_manager->register( $object );
667 }
668 });
669 }
670
671
672
673 require_once WPDIRECTORYKIT_PATH . '/elementor-extensions/class-ajax-handler.php';
674 $object = new Wdk\Elementor\Extensions\AjaxHandler();
675
676 require_once WPDIRECTORYKIT_PATH . '/elementor-extensions/class-hider.php';
677 require_once WPDIRECTORYKIT_PATH . '/elementor-extensions/class-hider-addons.php';
678