PluginProbe
WP Directory Kit / 1.3.0
WP Directory Kit v1.3.0
1.5.9 1.5.7 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 All 37 releases
wpdirectorykit / elementor-extensions / class-hider.php

class-hider.php in WP Directory Kit 1.3.0, at elementor-extensions/class-hider.php

705 lines 27.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 if (!defined('ABSPATH'))
4 exit; // Exit if accessed directly
5
6 use Elementor\Plugin;
7 use Elementor\Controls_Manager;
8 use Elementor\Modules\DynamicTags\Module;
9
10 add_action( 'elementor/init', function() {
11
12 $listing_page_id = get_option('wdk_listing_page');
13
14 if(!empty($listing_page_id))
15 {
16 new WDK_Extension_Hider();
17
18 /*
19 if(isset($_GET['post']) && $_GET['post'] == $listing_page_id)
20 {
21 new WDK_Extension_Hider();
22 }
23 elseif(!Plugin::$instance->editor->is_edit_mode())
24 {
25 new WDK_Extension_Hider();
26 }*/
27 }
28 });
29
30 /**
31 * WDK_Extension_Hider
32 *
33 * Class to extend Elementor controls functionality, adding hide feature based on specific wdk field
34 *
35 */
36
37 class WDK_Extension_Hider {
38
39 public $name = 'WDK Hider';
40
41 private $is_common = true;
42
43 private $depended_scripts = [];
44
45 private $depended_styles = [];
46
47 private $has_controls = TRUE;
48
49 public $common_sections_actions = array(
50 array(
51 'element' => 'common',
52 'action' => '_section_style',
53 ),
54 array(
55 'element' => 'container',
56 'action' => 'section_layout',
57 ),
58 array(
59 'element' => 'section',
60 'action' => 'section_advanced',
61 ),
62 array(
63 'element' => 'column',
64 'action' => 'section_advanced',
65 ),
66 );
67
68 private $supported_elements = array(
69 'heading'
70 );
71
72 public function __construct() {
73
74 /*
75 Controls_Manager::add_tab(
76 'wdk_hider',
77 __( 'Hider', 'wpdirectorykit' )
78 );*/
79
80 $this->init();
81 }
82
83 public function init( $param = null ) {
84 // Enqueue scripts
85 add_action( 'elementor/frontend/after_enqueue_scripts', [ $this, 'enqueue_scripts' ] );
86
87 // Enqueue styles
88 add_action( 'elementor/frontend/after_enqueue_styles', [ $this, 'enqueue_styles' ] );
89
90 // Elementor hooks
91
92 if ( $this->is_common ) {
93 // Add the advanced section required to display controls
94 $this->add_common_sections_actions();
95 }
96
97 $this->add_actions();
98 }
99
100 public static function is_enabled() {
101 return true;
102 }
103
104 public function add_script_depends( $handler ) {
105 $this->depended_scripts[] = $handler;
106 }
107
108 public function add_style_depends( $handler ) {
109 $this->depended_styles[] = $handler;
110 }
111
112 public function get_script_depends() {
113 return $this->depended_scripts;
114 }
115
116 public function enqueue_scripts() {
117 foreach ( $this->get_script_depends() as $script ) {
118 wp_enqueue_script( $script );
119 }
120 }
121
122 public function get_style_depends() {
123 return $this->depended_styles;
124 }
125
126 public static function get_description() {
127 return '';
128 }
129
130 public function enqueue_styles() {
131 foreach ( $this->get_style_depends() as $style ) {
132 wp_enqueue_style( $style );
133 }
134 }
135
136 public function _enqueue_scripts() {
137 $scripts = $this->get_script_depends();
138 if ( ! empty( $scripts ) ) {
139 foreach ( $scripts as $script ) {
140 wp_enqueue_script( $script );
141 }
142 }
143 }
144
145 public function _enqueue_styles() {
146 $styles = $this->get_style_depends();
147 if ( ! empty( $styles ) ) {
148 foreach ( $styles as $style ) {
149 wp_enqueue_style( $style );
150 }
151 }
152 }
153
154 public function enqueue_all() {
155 $this->_enqueue_styles();
156 $this->_enqueue_scripts();
157 }
158
159 public function get_low_name() {
160 return 'hider';
161 }
162
163 final public function add_common_sections( $element, $args ) {
164 $low_name = $this->get_low_name();
165 $section_name = 'wdk_section_' . $low_name . '_advanced';
166
167 if ( ! $this->has_controls ) {
168 // no need settings
169 return false;
170 }
171
172 // Check if this section exists
173 $section_exists = \Elementor\Plugin::instance()->controls_manager->get_control_from_stack( $element->get_unique_name(), $section_name );
174
175 if ( ! is_wp_error( $section_exists ) ) {
176 // We can't and should try to add this section to the stack
177 return false;
178 }
179
180 $this->get_control_section( $section_name, $element );
181 }
182
183 public function add_common_sections_actions() {
184 foreach ( $this->common_sections_actions as $action ) {
185 // Activate action for elements
186 add_action('elementor/element/' . $action['element'] . '/' . $action['action'] . '/after_section_end', function ( $element, $args ) {
187 $this->add_common_sections( $element, $args );
188 }, 10, 2);
189 }
190 }
191
192 protected function add_actions() {
193
194 // WIDGET
195 add_action( 'elementor/frontend/widget/before_render', [ $this, '_start_element' ], 10, 1 );
196 add_action( 'elementor/frontend/widget/after_render', [ $this, '_end_element' ], 10, 1 );
197
198 // SECTION
199 add_action( 'elementor/frontend/section/before_render', [ $this, '_start_element' ], 10, 1 );
200 add_action( 'elementor/frontend/section/after_render', [ $this, '_end_element' ], 10, 1 );
201
202 // CONTAINER
203 add_action( 'elementor/frontend/container/before_render', [ $this, '_start_element' ], 10, 1 );
204 add_action( 'elementor/frontend/container/after_render', [ $this, '_end_element' ], 10, 1 );
205
206 // COLUMN
207 add_action( 'elementor/frontend/column/before_render', [ $this, '_start_element' ], 10, 1 );
208 add_action( 'elementor/frontend/column/after_render', [ $this, '_end_element' ], 10, 1 );
209
210
211 }
212
213 protected function remove_controls( $element, $controls = null ) {
214 if ( empty( $controls ) ) {
215 return;
216 }
217
218 if ( is_array( $controls ) ) {
219 $control_id = $controls;
220
221 foreach ( $controls as $control_id ) {
222 $element->remove_control( $control_id );
223 }
224 } else {
225 $element->remove_control( $controls );
226 }
227 }
228
229 public function get_control_section( $section_name, $element ) {
230 $low_name = $this->get_low_name();
231
232 $element->start_controls_section(
233 $section_name,
234 [
235 'label' => '<span class="color-wdk icon icon-dyn-logo-wdk pull-right ml-1"></span> ' . $this->name,
236 'tab' => 'advanced',
237 ]
238 );
239
240 $fields_data = wdk_cached_field_get();
241 $fields_list = array('' => esc_html__('Not Selected', 'wpdirectorykit'));
242 $order_i = 0;
243 $fields_allow_for_get = array();
244 $fields_allow_for_compare = array();
245 $fields_list [(++$order_i).'__section'] = esc_html__('-- Section Custom fields --', 'wpdirectorykit');
246
247 $fields_list [(++$order_i).'__hide_on_get'] = esc_html__('Hide if GET is', 'wpdirectorykit');
248 $fields_allow_for_get[] = $order_i.'__hide_on_get';
249 $fields_list [(++$order_i).'__show_on_get'] = esc_html__('Show if GET is', 'wpdirectorykit');
250 $fields_allow_for_get[] = $order_i.'__show_on_get';
251
252 $fields_list [(++$order_i).'__profile_have_agency'] = esc_html__('Profile page is agency', 'wpdirectorykit');
253 $fields_list [(++$order_i).'__have_agency'] = esc_html__('Listing have agency', 'wpdirectorykit');
254 $fields_list [(++$order_i).'__have_sublistings'] = esc_html__('Listing have sublistings', 'wpdirectorykit');
255 $fields_list [(++$order_i).'__have_calendar'] = esc_html__('Listing have calendar', 'wpdirectorykit');
256 $fields_list [(++$order_i).'__havent_calendar'] = esc_html__('Listing not have calendar', 'wpdirectorykit');
257 $fields_list [(++$order_i).'__havent_images'] = esc_html__('Listing not have images', 'wpdirectorykit');
258 $fields_list [(++$order_i).'__have_images'] = esc_html__('Listing have images', 'wpdirectorykit');
259 $fields_list [(++$order_i).'__idlisting'] = esc_html__('Id listing', 'wpdirectorykit');
260 $fields_list [(++$order_i).'__post_id'] = esc_html__('Post Id', 'wpdirectorykit');
261 $fields_list [(++$order_i).'__lat'] = esc_html__('Gps Lat', 'wpdirectorykit');
262 $fields_list [(++$order_i).'__lng'] = esc_html__('Gps Lng', 'wpdirectorykit');
263 $fields_list [(++$order_i).'__date'] = esc_html__('Date', 'wpdirectorykit');
264 $fields_list [(++$order_i).'__date_modified'] = esc_html__('Date Modified', 'wpdirectorykit');
265 $fields_list [(++$order_i).'__post_content'] = esc_html__('WP Content', 'wpdirectorykit');
266 $fields_list [(++$order_i).'__address'] = esc_html__('Address', 'wpdirectorykit');
267 $fields_list [(++$order_i).'__category_id'] = esc_html__('Category', 'wpdirectorykit');
268 $fields_allow_for_compare[] = ($order_i).'__category_id';
269 $fields_list [(++$order_i).'__location_id'] = esc_html__('Location', 'wpdirectorykit');
270 $fields_allow_for_compare[] = ($order_i).'__location_id';
271 foreach($fields_data as $field)
272 {
273 if(wmvc_show_data('field_type', $field) == 'SECTION') {
274 $fields_list [(++$order_i).'section__'.wmvc_show_data('idfield', $field)] = '-- '.esc_html__('Section', 'wpdirectorykit').' '.wmvc_show_data('field_label', $field).' --';
275 } else {
276 $fields_list[(++$order_i).'__'.wmvc_show_data('idfield', $field)] = '#'.wmvc_show_data('idfield', $field).' '.wmvc_show_data('field_label', $field).'['.wmvc_show_data('field_type', $field).']';
277 $fields_allow_for_compare[] = ($order_i).'__'.wmvc_show_data('idfield', $field);
278 }
279 }
280
281 $element->add_control(
282 'wdk_related_field',
283 [
284 'label' => esc_html__('WDK Related FIeld', 'wpdirectorykit'),
285 'type' => Controls_Manager::SELECT,
286 'options' => $fields_list,
287 'default' => '',
288 'return_value' => 'section',
289 'frontend_available' => true,
290 'render_type' => 'none',
291 ]
292 );
293
294 $element->add_control(
295 'wdk_related_show_on_get_key',
296 [
297 'label' => __( 'Key', 'wpdirectorykit' ),
298 'type' => \Elementor\Controls_Manager::TEXT,
299 'default' => '',
300 'condition' => [
301 'wdk_related_field' => $fields_allow_for_get,
302 ],
303 ]
304 );
305
306 $element->add_control(
307 'wdk_related_show_on_get_value',
308 [
309 'label' => __( 'Value', 'wpdirectorykit' ),
310 'type' => \Elementor\Controls_Manager::TEXT,
311 'default' => '',
312 'condition' => [
313 'wdk_related_field' => $fields_allow_for_get,
314 ],
315 ]
316 );
317
318 $element->add_control(
319 'wdk_related_compare_type',
320 [
321 'label' => __( 'Compare Type', 'wpdirectorykit' ),
322 'type' => \Elementor\Controls_Manager::SELECT,
323 'default' => '',
324 'options' => [
325 '' => esc_html__('Default (if not empty)', 'wpdirectorykit'),
326 '==' => esc_html__('==', 'wpdirectorykit'),
327 '!=' => esc_html__('!=', 'wpdirectorykit'),
328 '>' => esc_html__('>', 'wpdirectorykit'),
329 '<' => esc_html__('<', 'wpdirectorykit'),
330 ],
331 'condition' => [
332 'wdk_related_field' => $fields_allow_for_compare,
333 ],
334 ]
335 );
336
337 $element->add_control(
338 'wdk_related_compare_value',
339 [
340 'label' => __( 'Value', 'wpdirectorykit' ),
341 'type' => \Elementor\Controls_Manager::TEXT,
342 'default' => '',
343 'condition' => [
344 'wdk_related_field' => $fields_allow_for_compare,
345 ],
346 ]
347 );
348
349 $element->end_controls_section();
350
351 }
352
353 public function _start_element( $element ) {
354 global $wdk_listing_id;
355 $wdkmembership_user_id = wdk_get_profile_page_id();
356
357 //if(Plugin::$instance->editor->is_edit_mode())return;
358 if(Plugin::$instance->editor->is_edit_mode() || (empty($wdk_listing_id) && empty($wdkmembership_user_id)))return;
359 //if(!in_array($element->get_name(), $this->supported_elements))return;
360
361 $WMVC = &wdk_get_instance();
362 $WMVC->model('field_m');
363 $WMVC->load_helper('listing');
364 $settings = $element->get_settings_for_display();
365
366 if(isset($settings['wdk_related_field']) && !empty($settings['wdk_related_field']))
367 {
368
369 $field_id = NULL;
370 $field_value = NULL;
371 $field_empty = FALSE;
372 if(strpos($settings['wdk_related_field'], '__') !== FALSE){
373 $field_id = substr($settings['wdk_related_field'], strpos($settings['wdk_related_field'],'__')+2);
374 }
375
376 if(is_null($field_id))return;
377 if($field_id == 'show_on_get' || $field_id == 'hide_on_get') {
378 if(!empty($settings['wdk_related_show_on_get_key']) && !empty($settings['wdk_related_show_on_get_value'])) {
379 $get_val = null;
380 if(isset($_GET[$settings['wdk_related_show_on_get_key']])){
381 $get_val = sanitize_text_field($_GET[$settings['wdk_related_show_on_get_key']]);
382 }
383
384 if($field_id == 'hide_on_get') {
385 if($get_val == $settings['wdk_related_show_on_get_value']){
386 $field_empty = true;
387 }
388 } else if($field_id == 'show_on_get') {
389 if($get_val !== $settings['wdk_related_show_on_get_value']){
390 $field_empty = true;
391 }
392 }
393 }
394 }elseif($field_id == 'havent_calendar' || $field_id == 'have_calendar') {
395 if(function_exists('run_wdk_bookings')) {
396 global $Winter_MVC_wdk_bookings;
397 $Winter_MVC_wdk_bookings->model('calendar_m');
398 $calendar = $Winter_MVC_wdk_bookings->calendar_m->get_by(array('post_id' => $wdk_listing_id, 'is_activated' => 1));
399 if($field_id == 'havent_calendar') {
400 if($calendar){
401 $field_empty = true;
402 }
403 } else if($field_id == 'have_calendar') {
404 if(!$calendar){
405 $field_empty = true;
406 }
407 }
408 }
409 } elseif($field_id == 'profile_have_agency') {
410 $wdkmembership_user_id = wdk_get_profile_page_id();
411 $field_empty = true;
412
413
414 if($wdkmembership_user_id) {
415 $user = wdk_get_user_data($wdkmembership_user_id);
416 if($user && wmvc_is_user_in_role($user['userdata'], 'wdk_agency')) {
417 $field_empty = false;
418 }
419
420 }
421 } elseif($field_id == 'have_agency') {
422 $field_empty = true;
423 if(function_exists('run_wdk_membership') && file_exists(WDK_MEMBERSHIP_PATH.'application/models/Agency_agent_m.php')) {
424 if(wdk_field_value ('user_id_editor', $wdk_listing_id)) {
425 $agent_id = wdk_field_value ('user_id_editor', $wdk_listing_id);
426 global $Winter_MVC_wdk_membership;
427 $Winter_MVC_wdk_membership->model('agency_agent_m');
428 $agent_agency = $Winter_MVC_wdk_membership->agency_agent_m->get_by(array('agent_id' => $agent_id, 'status' => 'CONFIRMED'), TRUE);
429 if($agent_agency) {
430 $user = wdk_get_user_data( wmvc_show_data('agency_id', $agent_agency, 0));
431 if($user){
432 $field_empty = false;
433 }
434 }
435 }
436 }
437 } elseif($field_id == 'have_sublistings') {
438
439 $field_empty = true;
440 if(!empty(wdk_field_value('listing_related_ids', $wdk_listing_id))){
441 foreach (explode(',',wdk_field_value('listing_related_ids', $wdk_listing_id)) as $key => $child_idlisting) {
442 if(!wdk_field_value('is_activated', $child_idlisting) || !wdk_field_value('is_approved', $child_idlisting)) continue;
443
444 $field_empty = false;
445 break;
446 }
447 }
448 } elseif($field_id == 'havent_images' || $field_id == 'have_images') {
449 $images = wdk_field_value('listing_images', $wdk_listing_id);
450 if($field_id == 'havent_images') {
451 if($images){
452 $field_empty = true;
453 }
454 } else if($field_id == 'have_images') {
455 if(!$images){
456 $field_empty = true;
457 }
458 }
459 } elseif(wdk_field_option($field_id, 'field_type') == "SECTION") {
460
461 // get all section fields
462 $sections_data = $WMVC->field_m->get_fields_section();
463
464 if(!isset($sections_data[$field_id]) || !isset($sections_data[$field_id]['fields']))return;
465
466 // check if all subfields are empty
467 $field_empty = true;
468 foreach($sections_data[$field_id]['fields'] as $field) {
469 if(!empty(wdk_field_value(wmvc_show_data('idfield', $field), $wdk_listing_id))){
470 $field_empty = false;
471 break;
472 }
473 }
474 }
475 else
476 {
477 $field_value = wdk_field_value($field_id, $wdk_listing_id);
478 if(!empty($settings['wdk_related_compare_type'])) {
479 switch ($settings['wdk_related_compare_type']) {
480 case '==':
481 if($field_value == $settings['wdk_related_compare_value']) {
482 } else {
483 $field_empty = TRUE;
484 }
485 break;
486 case '!=':
487 if($field_value != $settings['wdk_related_compare_value']) {
488 } else {
489 $field_empty = TRUE;
490 }
491 break;
492 case '>':
493 if($field_value > $settings['wdk_related_compare_value']) {
494 } else {
495 $field_empty = TRUE;
496 }
497 break;
498 case '<':
499 if($field_value < $settings['wdk_related_compare_value']) {
500 } else {
501 $field_empty = TRUE;
502 }
503 break;
504 default:
505 # code...
506 break;
507 }
508 } else {
509 if(empty($field_value))$field_empty = TRUE;
510 }
511 }
512
513 if($field_empty)
514 {
515 /*
516 echo '<pre>';
517 var_dump($settings['wdk_related_field']);
518 echo '</pre>';
519 */
520
521 ob_start();
522 }
523
524 }
525 }
526
527 public function _end_element( $element ) {
528 global $wdk_listing_id;
529
530 $wdkmembership_user_id = wdk_get_profile_page_id();
531
532 //if(Plugin::$instance->editor->is_edit_mode())return;
533 if(Plugin::$instance->editor->is_edit_mode() || (empty($wdk_listing_id) && empty($wdkmembership_user_id)))return;
534 //if(!in_array($element->get_name(), $this->supported_elements))return;
535
536 $WMVC = &wdk_get_instance();
537 $WMVC->model('field_m');
538 $WMVC->load_helper('listing');
539 $settings = $element->get_settings_for_display();
540
541 if(isset($settings['wdk_related_field']) && !empty($settings['wdk_related_field']))
542 {
543 $field_id = NULL;
544 $field_value = NULL;
545 $field_empty = FALSE;
546 if(strpos($settings['wdk_related_field'], '__') !== FALSE){
547 $field_id = substr($settings['wdk_related_field'], strpos($settings['wdk_related_field'],'__')+2);
548 }
549
550 if(is_null($field_id))return;
551 if($field_id == 'show_on_get' || $field_id == 'hide_on_get') {
552 if(!empty($settings['wdk_related_show_on_get_key']) && !empty($settings['wdk_related_show_on_get_value'])) {
553 $get_val = null;
554 if(isset($_GET[$settings['wdk_related_show_on_get_key']])){
555 $get_val = sanitize_text_field($_GET[$settings['wdk_related_show_on_get_key']]);
556 }
557 if($field_id == 'hide_on_get') {
558 if($get_val == $settings['wdk_related_show_on_get_value']){
559 $field_empty = true;
560 }
561 } else if($field_id == 'show_on_get') {
562 if($get_val !== $settings['wdk_related_show_on_get_value']){
563 $field_empty = true;
564 }
565 }
566 }
567 }elseif($field_id == 'havent_calendar' || $field_id == 'have_calendar') {
568 if(function_exists('run_wdk_bookings')) {
569 global $Winter_MVC_wdk_bookings;
570 $Winter_MVC_wdk_bookings->model('calendar_m');
571 $calendar = $Winter_MVC_wdk_bookings->calendar_m->get_by(array('post_id' => $wdk_listing_id, 'is_activated' => 1));
572 if($field_id == 'havent_calendar') {
573 if($calendar){
574 $field_empty = true;
575 }
576 } else if($field_id == 'have_calendar') {
577 if(!$calendar){
578 $field_empty = true;
579 }
580 }
581 }
582 } elseif($field_id == 'have_sublistings') {
583
584 $field_empty = true;
585 if(!empty(wdk_field_value('listing_related_ids', $wdk_listing_id))){
586 foreach (explode(',',wdk_field_value('listing_related_ids', $wdk_listing_id)) as $key => $child_idlisting) {
587 if(!wdk_field_value('is_activated', $child_idlisting) || !wdk_field_value('is_approved', $child_idlisting)) continue;
588
589 $field_empty = false;
590 break;
591 }
592 }
593 } elseif($field_id == 'have_agency') {
594 $field_empty = true;
595 if(function_exists('run_wdk_membership') && file_exists(WDK_MEMBERSHIP_PATH.'application/models/Agency_agent_m.php')) {
596 if(wdk_field_value ('user_id_editor', $wdk_listing_id)) {
597 $agent_id = wdk_field_value ('user_id_editor', $wdk_listing_id);
598 global $Winter_MVC_wdk_membership;
599 $Winter_MVC_wdk_membership->model('agency_agent_m');
600 $agent_agency = $Winter_MVC_wdk_membership->agency_agent_m->get_by(array('agent_id' => $agent_id, 'status' => 'CONFIRMED'), TRUE);
601 if($agent_agency) {
602 $user = wdk_get_user_data( wmvc_show_data('agency_id', $agent_agency, 0));
603 if($user){
604 $field_empty = false;
605 }
606 }
607 }
608 }
609 } elseif($field_id == 'profile_have_agency') {
610 $wdkmembership_user_id = wdk_get_profile_page_id();
611 $field_empty = true;
612 if($wdkmembership_user_id) {
613 $user = wdk_get_user_data($wdkmembership_user_id);
614 if($user && wmvc_is_user_in_role($user['userdata'], 'wdk_agency')) {
615 $field_empty = false;
616 }
617
618 }
619 } elseif($field_id == 'havent_images' || $field_id == 'have_images') {
620 $images = wdk_field_value('listing_images', $wdk_listing_id);
621 if($field_id == 'havent_images') {
622 if($images){
623 $field_empty = true;
624 }
625 } else if($field_id == 'have_images') {
626 if(!$images){
627 $field_empty = true;
628 }
629 }
630 } elseif(wdk_field_option($field_id, 'field_type') == "SECTION") {
631
632 // get all section fields
633 $sections_data = $WMVC->field_m->get_fields_section();
634
635 if(!isset($sections_data[$field_id]) || !isset($sections_data[$field_id]['fields']))return;
636
637 // check if all subfields are empty
638 $field_empty = true;
639 foreach($sections_data[$field_id]['fields'] as $field) {
640 if(!empty(wdk_field_value(wmvc_show_data('idfield', $field), $wdk_listing_id))){
641 $field_empty = false;
642 break;
643 }
644 }
645 }
646 else
647 {
648 $field_value = wdk_field_value($field_id, $wdk_listing_id);
649 if(!empty($settings['wdk_related_compare_type'])) {
650 switch ($settings['wdk_related_compare_type']) {
651 case '==':
652 if($field_value == $settings['wdk_related_compare_value']) {
653 } else {
654 $field_empty = TRUE;
655 }
656 break;
657 case '!=':
658 if($field_value != $settings['wdk_related_compare_value']) {
659 } else {
660 $field_empty = TRUE;
661 }
662 break;
663 case '>':
664 if($field_value > $settings['wdk_related_compare_value']) {
665 } else {
666 $field_empty = TRUE;
667 }
668 break;
669 case '<':
670 if($field_value < $settings['wdk_related_compare_value']) {
671 } else {
672 $field_empty = TRUE;
673 }
674 break;
675 default:
676 # code...
677 break;
678 }
679 } else {
680 if(empty($field_value))$field_empty = TRUE;
681 }
682 }
683
684 if($field_empty)
685 {
686 /*
687 echo '<pre>';
688 var_dump($settings['wdk_related_field']);
689 echo '</pre>';
690 */
691
692 $content = ob_get_clean();
693 }
694
695 }
696 }
697
698 }
699
700
701
702
703
704
705