PluginProbe
WP Directory Kit / 1.3.4
WP Directory Kit v1.3.4
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 1.3.4, at elementor-elements/elementor-init.php

417 lines 16.7 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 * Initialize the class and set its properties.
60 *
61 * @since 1.0.0
62 * @param string $plugin_name The name of this plugin.
63 * @param string $version The version of this plugin.
64 */
65 public function __construct( $plugin_name='wpdirectorykit', $version='1.0' ) {
66 $this->plugin_name = $plugin_name;
67 $this->version = $version;
68 }
69
70 /**
71 * Register the stylesheets for the admin area.
72 *
73 * @since 1.0.0
74 */
75 public function enqueue_styles() {
76 /**
77 * This function is provided for demonstration purposes only.
78 *
79 * An instance of this class should be passed to the run() function
80 * defined in Wpdirectorykit_Loader as all of the hooks are defined
81 * in that particular class.
82 *
83 * The Wpdirectorykit_Loader will then create the relationship
84 * between the defined hooks and the functions defined in this
85 * class.
86 */
87
88 wp_enqueue_style( 'font-awesome' );
89 }
90
91 /**
92 * Register the JavaScript for the admin area.
93 *
94 * @since 1.0.0
95 */
96 public function enqueue_scripts() {
97 /**
98 * This function is provided for demonstration purposes only.
99 *
100 * An instance of this class should be passed to the run() function
101 * defined in Wpdirectorykit_Loader as all of the hooks are defined
102 * in that particular class.
103 *
104 * The Wpdirectorykit_Loader will then create the relationship
105 * between the defined hooks and the functions defined in this
106 * class.
107 */
108 wp_enqueue_script( 'wdk-elementor-main', plugin_dir_url( __FILE__ ) . 'assets/js/wdk-main.js', array(), $this->version, true );
109 }
110
111 /**
112 * Load class/script files
113 *
114 * @since 1.0.0
115 */
116 public function loader() {
117
118 }
119
120 /**
121 * Includes
122 *
123 * @since 1.0.0
124 *
125 * @access private
126 */
127 private function includes() {
128 require_once plugin_dir_path( __FILE__ ) . 'classes/wdk-elementor-base.php';
129 require_once plugin_dir_path( __FILE__ ) . 'classes/wdk-field-label.php';
130 require_once plugin_dir_path( __FILE__ ) . 'classes/wdk-field-value.php';
131 require_once plugin_dir_path( __FILE__ ) . 'classes/wdk-field-images.php';
132 require_once plugin_dir_path( __FILE__ ) . 'classes/wdk-field-files.php';
133 require_once plugin_dir_path( __FILE__ ) . 'classes/wdk-field-files-list.php';
134 require_once plugin_dir_path( __FILE__ ) . 'classes/wdk-field-icon.php';
135 require_once plugin_dir_path( __FILE__ ) . 'classes/wdk-listing-agents-listings.php';
136 require_once plugin_dir_path( __FILE__ ) . 'classes/wdk-listing-similar-listings.php';
137 require_once plugin_dir_path( __FILE__ ) . 'classes/wdk-listing-related-listings.php';
138 require_once plugin_dir_path( __FILE__ ) . 'classes/wdk-listing-related-listings-table.php';
139 require_once plugin_dir_path( __FILE__ ) . 'classes/wdk-locations-grid.php';
140 require_once plugin_dir_path( __FILE__ ) . 'classes/wdk-categories-grid-cover.php';
141 require_once plugin_dir_path( __FILE__ ) . 'classes/wdk-locations-grid-cover.php';
142 require_once plugin_dir_path( __FILE__ ) . 'classes/wdk-categories-grid.php';
143 require_once plugin_dir_path( __FILE__ ) . 'classes/wdk-categories-list.php';
144 require_once plugin_dir_path( __FILE__ ) . 'classes/wdk-categories-tree.php';
145 require_once plugin_dir_path( __FILE__ ) . 'classes/wdk-locations-tree.php';
146 require_once plugin_dir_path( __FILE__ ) . 'classes/wdk-categories-tree-top.php';
147 require_once plugin_dir_path( __FILE__ ) . 'classes/wdk-locations-list.php';
148 require_once plugin_dir_path( __FILE__ ) . 'classes/wdk-listings-results.php';
149 require_once plugin_dir_path( __FILE__ ) . 'classes/wdk-listings-carousel.php';
150 require_once plugin_dir_path( __FILE__ ) . 'classes/wdk-listing-slider.php';
151 require_once plugin_dir_path( __FILE__ ) . 'classes/wdk-categories-carousel.php';
152 require_once plugin_dir_path( __FILE__ ) . 'classes/wdk-locations-carousel.php';
153 require_once plugin_dir_path( __FILE__ ) . 'classes/wdk-map.php';
154 require_once plugin_dir_path( __FILE__ ) . 'classes/wdk-search.php';
155 require_once plugin_dir_path( __FILE__ ) . 'classes/wdk-listing-fields-section.php';
156 require_once plugin_dir_path( __FILE__ ) . 'classes/wdk-listings-list.php';
157 require_once plugin_dir_path( __FILE__ ) . 'classes/wdk-listing-map.php';
158 require_once plugin_dir_path( __FILE__ ) . 'classes/wdk-listing-agent.php';
159 require_once plugin_dir_path( __FILE__ ) . 'classes/wdk-listing-agent-field.php';
160 require_once plugin_dir_path( __FILE__ ) . 'classes/wdk-listing-agent-avatar.php';
161 require_once plugin_dir_path( __FILE__ ) . 'classes/wdk-button.php';
162 require_once plugin_dir_path( __FILE__ ) . 'classes/wdk-button-login.php';
163 require_once plugin_dir_path( __FILE__ ) . 'classes/wdk-button-addlisting.php';
164
165 require_once plugin_dir_path( __FILE__ ) . 'classes/wdk-listing-carousel.php';
166 require_once plugin_dir_path( __FILE__ ) . 'classes/wdk-listing-sliders.php';
167 require_once plugin_dir_path( __FILE__ ) . 'classes/wdk-listing-sliders-more-grid-images.php';
168 require_once plugin_dir_path( __FILE__ ) . 'classes/wdk-listing-sliders-grid-images.php';
169 require_once plugin_dir_path( __FILE__ ) . 'classes/wdk-listing-sliders-carousel.php';
170 require_once plugin_dir_path( __FILE__ ) . 'classes/wdk-last-search.php';
171 require_once plugin_dir_path( __FILE__ ) . 'classes/wdk-implode-shortcode.php';
172 require_once plugin_dir_path( __FILE__ ) . 'classes/wdk-tabs.php';
173
174 if(wdk_get_option('wdk_experimental_features') && wdk_get_option('wdk_experimental_search_popup')) {
175 require_once plugin_dir_path( __FILE__ ) . 'classes/wdk-search-popup.php';
176 }
177
178 do_action('wpdirectorykit/elementor-elements/includes');
179 }
180
181 /**
182 * Register Widget
183 *
184 * @since 1.0.0
185 *
186 * @access private
187 */
188 private function register_widget() {
189
190 $listing_page_id = get_option('wdk_listing_page');
191
192 if(!empty($listing_page_id))
193 {
194 $post_data = NULL;
195 if(isset($_GET['post']))
196 $post_data = get_post(intval($_GET['post']));
197 if(
198 (wdk_get_option('wdk_experimental_features') && wdk_get_option('wdk_experimental_listing_card_elementor_layout')) ||
199 (isset($_GET['post']) && $_GET['post'] == $listing_page_id) ||
200 (isset($post_data->post_type) && $post_data->post_type == 'elementor_library')
201 )
202 {
203 $this->add_widget('Wdk\Elementor\Widgets\WdkFieldLabel');
204 $this->add_widget('Wdk\Elementor\Widgets\WdkFieldValue');
205 $this->add_widget('Wdk\Elementor\Widgets\WdkFieldFiles');
206 $this->add_widget('Wdk\Elementor\Widgets\WdkFieldFilesList');
207 $this->add_widget('Wdk\Elementor\Widgets\WdkFieldImages');
208 $this->add_widget('Wdk\Elementor\Widgets\WdkFieldIcon');
209 $this->add_widget('Wdk\Elementor\Widgets\WdkListingAgentsListings');
210 $this->add_widget('Wdk\Elementor\Widgets\WdkListingSimilarListings');
211 $this->add_widget('Wdk\Elementor\Widgets\WdkListingRelatedListingsTable');
212 $this->add_widget('Wdk\Elementor\Widgets\WdkListingRelatedListings');
213 $this->add_widget('Wdk\Elementor\Widgets\WdkListingSlider');
214 $this->add_widget('Wdk\Elementor\Widgets\WdkListingFieldsSection');
215 $this->add_widget('Wdk\Elementor\Widgets\WdkListingMap');
216 $this->add_widget('Wdk\Elementor\Widgets\WdkListinAgent');
217 $this->add_widget('Wdk\Elementor\Widgets\WdkListingAgentField');
218 $this->add_widget('Wdk\Elementor\Widgets\WdkListingAgentAvatar');
219
220 $this->add_widget('Wdk\Elementor\Widgets\WdkCoolListingCarousel');
221 $this->add_widget('Wdk\Elementor\Widgets\WdkListingSlidersCarousel');
222 $this->add_widget('Wdk\Elementor\Widgets\WdkListingSlidersGridMoreImages');
223 $this->add_widget('Wdk\Elementor\Widgets\WdkListingSlidersGridImages');
224 $this->add_widget('Wdk\Elementor\Widgets\WdkListingSliders');
225 do_action('wpdirectorykit/elementor-elements/register_widget/listing', $this);
226 }
227 else if(isset($_GET['post']))
228 {
229
230 }
231 else
232 {
233 $this->add_widget('Wdk\Elementor\Widgets\WdkFieldLabel');
234 $this->add_widget('Wdk\Elementor\Widgets\WdkFieldValue');
235 $this->add_widget('Wdk\Elementor\Widgets\WdkFieldFiles');
236 $this->add_widget('Wdk\Elementor\Widgets\WdkFieldFilesList');
237 $this->add_widget('Wdk\Elementor\Widgets\WdkFieldImages');
238 $this->add_widget('Wdk\Elementor\Widgets\WdkFieldIcon');
239 $this->add_widget('Wdk\Elementor\Widgets\WdkListingAgentsListings');
240 $this->add_widget('Wdk\Elementor\Widgets\WdkListingSimilarListings');
241 $this->add_widget('Wdk\Elementor\Widgets\WdkListingRelatedListingsTable');
242 $this->add_widget('Wdk\Elementor\Widgets\WdkListingRelatedListings');
243 $this->add_widget('Wdk\Elementor\Widgets\WdkListingSlider');
244 $this->add_widget('Wdk\Elementor\Widgets\WdkListingFieldsSection');
245 $this->add_widget('Wdk\Elementor\Widgets\WdkListingMap');
246 $this->add_widget('Wdk\Elementor\Widgets\WdkListinAgent');
247 $this->add_widget('Wdk\Elementor\Widgets\WdkListingAgentField');
248 $this->add_widget('Wdk\Elementor\Widgets\WdkListingAgentAvatar');
249
250 $this->add_widget('Wdk\Elementor\Widgets\WdkCoolListingCarousel');
251 $this->add_widget('Wdk\Elementor\Widgets\WdkListingSlidersCarousel');
252 $this->add_widget('Wdk\Elementor\Widgets\WdkListingSlidersGridMoreImages');
253 $this->add_widget('Wdk\Elementor\Widgets\WdkListingSlidersGridImages');
254 $this->add_widget('Wdk\Elementor\Widgets\WdkListingSliders');
255 do_action('wpdirectorykit/elementor-elements/register_widget/listing', $this);
256 }
257
258 //POST data[elementor_post_lock][post_ID]
259 }
260
261 $this->add_widget('Wdk\Elementor\Widgets\WdkLocationsList');
262 $this->add_widget('Wdk\Elementor\Widgets\WdkCategoriesList');
263 $this->add_widget('Wdk\Elementor\Widgets\WdkCategoriesTree');
264 $this->add_widget('Wdk\Elementor\Widgets\WdkCategoriesTreeTop');
265 $this->add_widget('Wdk\Elementor\Widgets\WdkLocationsTree');
266 $this->add_widget('Wdk\Elementor\Widgets\WdkListingsResults');
267 $this->add_widget('Wdk\Elementor\Widgets\WdkListingsCarousel');
268 $this->add_widget('Wdk\Elementor\Widgets\WdkCategoriesCarousel');
269 $this->add_widget('Wdk\Elementor\Widgets\WdkLocationsCarousel');
270 $this->add_widget('Wdk\Elementor\Widgets\WdkCategoriesGrid');
271 $this->add_widget('Wdk\Elementor\Widgets\WdkLocationsGrid');
272 $this->add_widget('Wdk\Elementor\Widgets\WdkCategoriesGridCover');
273 $this->add_widget('Wdk\Elementor\Widgets\WdkLocationsGridCover');
274 $this->add_widget('Wdk\Elementor\Widgets\WdkSearch');
275 $this->add_widget('Wdk\Elementor\Widgets\WdkMap');
276 $this->add_widget('Wdk\Elementor\Widgets\WdkListingsList');
277 $this->add_widget('Wdk\Elementor\Widgets\WdkButton');
278 $this->add_widget('Wdk\Elementor\Widgets\WdkButtonLogin');
279 $this->add_widget('Wdk\Elementor\Widgets\WdkButtonAddlisting');
280 $this->add_widget('Wdk\Elementor\Widgets\WdkLastSearch');
281 $this->add_widget('Wdk\Elementor\Widgets\WdkImplodeShortcode');
282 $this->add_widget('Wdk\Elementor\Widgets\WdkTabs');
283
284 if(wdk_get_option('wdk_experimental_features') && wdk_get_option('wdk_experimental_search_popup')) {
285 $this->add_widget('Wdk\Elementor\Widgets\WdkSearchPopup');
286 }
287
288 do_action('wpdirectorykit/elementor-elements/register_widget', $this);
289 }
290
291 public function add_widget($class = ''){
292 if(class_exists($class))
293 {
294 $object = new $class();
295 \Elementor\Plugin::instance()->widgets_manager->register( $object );
296 };
297 }
298
299 /**
300 * Register Widget
301 *
302 * @since 1.0.0
303 *
304 * @access private
305 */
306 private function register_modules() {
307
308 }
309
310 /**
311 * On Widgets Registered
312 *
313 * @since 1.0.0
314 *
315 * @access public
316 */
317 public function on_widgets_registered() {
318 $this->includes();
319 $this->register_widget();
320 $this->register_modules();
321 }
322
323 /**
324 * Add elementor category
325 *
326 * @since 1.0.0
327 *
328 * @access public
329 */
330 function load_category( $elements_manager ) {
331 $elements_manager->add_category(
332 $this->elementor_category_name,
333 [
334 'title' => esc_html__( 'Wdk', 'wpdirectorykit' ),
335 'icon' => 'fa fa-plug',
336 ]
337 );
338
339 $elements_manager->add_category(
340 $this->elementor_category_name_listing_preview,
341 [
342 'title' => esc_html__( 'Wdk Listing Preview', 'wpdirectorykit' ),
343 'icon' => 'fa fa-plug',
344 ]
345 );
346
347 $elements_manager->add_category(
348 $this->elementor_category_name_listing_preview_sliders,
349 [
350 'title' => esc_html__( 'Wdk Listing Sliders', 'wpdirectorykit' ),
351 'icon' => 'fa fa-plug',
352 ]
353 );
354 }
355
356
357 /**
358 * Start Elementor Addon
359 */
360 public function run() {
361
362 require_once plugin_dir_path( __FILE__ ) . 'classes/wdk-elementor-base.php';
363
364 add_action( 'wp_enqueue_scripts',[ $this, 'enqueue_styles' ]);
365 add_action( 'wp_enqueue_scripts',[ $this, 'enqueue_scripts' ]);
366
367 add_action( 'elementor/elements/categories_registered', [ $this, 'load_category' ] );
368 add_action( 'elementor/widgets/register', [ $this, 'on_widgets_registered' ] );
369
370 do_action('wpdirectorykit/elementor-elements/run');
371
372 /* load module */
373 $this->loader();
374 //wmvc_dump($meta);
375 }
376
377
378 }
379
380 /* Init lib after elementor loaded */
381 add_action( 'elementor/init', function() {
382 $wdk_elementor = new Wdk_Elementor( );
383 $wdk_elementor->run();
384 do_action('wpdirectorykit/elementor-elements/init');
385 }, 1);
386
387 /* example extension for wdk elements
388 add_action('wpdirectorykit/elementor-elements/includes', function(){
389 require_once WPDIRECTORYKIT_PATH . '/elementor-extensions/class-contact-form.php';
390 });
391
392 add_action('wpdirectorykit/elementor-elements/register_widget/listing', function(){
393 $object = new Wdk\Elementor\Widgets\WdkContactFormExt();
394 \Elementor\Plugin::instance()->widgets_manager->register( $object );
395 });
396 */
397
398 /* load extension */
399
400 add_action('wpdirectorykit/elementor-elements/register_widget/listing', function(){
401 add_action('eli/includes', function(){
402 require_once WPDIRECTORYKIT_PATH . '/elementor-extensions/class-contact-form.php';
403 });
404
405 add_action('eli/register_widget', function(){
406 $object = new Wdk\Elementor\Extensions\WdkContactFormExt();
407 \Elementor\Plugin::instance()->widgets_manager->register( $object );
408 });
409
410 });
411
412 require_once WPDIRECTORYKIT_PATH . '/elementor-extensions/class-ajax-handler.php';
413 $object = new Wdk\Elementor\Extensions\AjaxHandler();
414
415 require_once WPDIRECTORYKIT_PATH . '/elementor-extensions/class-hider.php';
416 require_once WPDIRECTORYKIT_PATH . '/elementor-extensions/class-hider-addons.php';
417