PluginProbe
Property Hive / 2.3.1
Property Hive v2.3.1
2.3.1 2.3.0 2.2.6 2.2.5 2.2.4 2.2.3 2.2.2 1.4.46 1.4.47 1.4.48 1.4.49 1.4.5 1.4.50 1.4.51 1.4.52 1.4.53 1.4.54 1.4.55 1.4.56 1.4.57 1.4.58 1.4.59 1.4.6 1.4.60 1.4.61 All 261 releases
← All changes | includes/ph-property-functions.php +65 -25 2.2.22.3.1 View file →
@@ -1,5 +1,10 @@
1 1 <?php
2 +
3 +if ( ! defined( 'ABSPATH' ) ) {
4 + exit;
5 +}
6 +
2 7 /**
3 8 * PropertyHive Property Functions
4 9 *
5 10 * Functions for property specific things.
@@ -16,8 +21,9 @@
16 21 * @param mixed $the_property Post object or post ID of the property.
17 22 * @param array $args (default: array()) Contains all arguments to be used to get this property.
18 23 * @return PH_Property
19 24 */
25 +// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound -- Legacy public global helper get_property; the established callable name is part of the plugin/extension API and must remain stable.
20 26 function get_property( $the_property = false, $args = array() ) {
21 27 return new PH_Property( $the_property );
22 28 }
23 29
@@ -26,8 +32,9 @@
26 32 *
27 33 * @access public
28 34 * @return array
29 35 */
36 +// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound -- Legacy public global helper ph_get_featured_property_ids; the established callable name is part of the plugin/extension API and must remain stable.
30 37 function ph_get_featured_property_ids() {
31 38
32 39 // Load from cache
33 40 $featured_property_ids = get_transient( 'ph_featured_properties' );
@@ -39,8 +46,9 @@
39 46 $featured = get_posts( array(
40 47 'post_type' => 'property',
41 48 'posts_per_page' => -1,
42 49 'post_status' => 'publish',
50 + // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_query -- Featured/on-market flags use existing property metadata; all matching IDs are cached in the existing transient.
43 51 'meta_query' => array(
44 52 array(
45 53 'key' => '_on_market',
46 54 'value' => 'yes'
@@ -65,8 +73,9 @@
65 73 *
66 74 * @access public
67 75 * @return string
68 76 */
77 +// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound -- Legacy public global helper ph_placeholder_img_src; the established callable name is part of the plugin/extension API and must remain stable.
69 78 function ph_placeholder_img_src() {
70 79 return apply_filters( 'propertyhive_placeholder_img_src', PH()->plugin_url() . '/assets/images/placeholder.png' );
71 80 }
72 81
@@ -75,17 +84,19 @@
75 84 *
76 85 * @access public
77 86 * @return string
78 87 */
88 +// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound -- Legacy public global helper ph_placeholder_img; the established callable name is part of the plugin/extension API and must remain stable.
79 89 function ph_placeholder_img( $size = 'thumbnail' ) {
80 90 $dimensions = ph_get_image_size( $size );
81 91
82 - return apply_filters('propertyhive_placeholder_img', '<img src="' . ph_placeholder_img_src() . '" alt="Placeholder" width="' . esc_attr( $dimensions['width'] ) . '" class="property-placeholder wp-post-image" height="' . esc_attr( $dimensions['height'] ) . '" />' );
92 + return apply_filters('propertyhive_placeholder_img', '<img src="' . esc_url( ph_placeholder_img_src() ) . '" alt="Placeholder" width="' . esc_attr( $dimensions['width'] ) . '" class="property-placeholder wp-post-image" height="' . esc_attr( $dimensions['height'] ) . '" />' );
83 93 }
84 94
85 95 /**
86 96 * Track property views
87 97 */
98 +// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound -- Legacy public global helper ph_track_property_view; the established callable name is part of the plugin/extension API and must remain stable.
88 99 function ph_track_property_view() {
89 100 if ( ! is_singular( 'property' ) )
90 101 return;
91 102
@@ -93,18 +104,22 @@
93 104
94 105 // Track in cookie
95 106 if ( apply_filters( 'propertyhive_store_in_recently_viewed_cookie', true ) )
96 107 {
97 - if ( empty( $_COOKIE['propertyhive_recently_viewed'] ) )
98 - $viewed_properties = array();
99 - else
100 - $viewed_properties = (array) explode( '|', $_COOKIE['propertyhive_recently_viewed'] );
108 + $viewed_properties = array();
109 + $viewed_cookie = isset( $_COOKIE['propertyhive_recently_viewed'] ) && is_string( $_COOKIE['propertyhive_recently_viewed'] ) ? sanitize_text_field( wp_unslash( $_COOKIE['propertyhive_recently_viewed'] ) ) : '';
110 + foreach ( explode( '|', $viewed_cookie ) as $viewed_id ) {
111 + if ( ctype_digit( $viewed_id ) && absint( $viewed_id ) > 0 ) {
112 + $viewed_properties[] = absint( $viewed_id );
113 + }
114 + }
115 + $viewed_properties = array_values( array_unique( $viewed_properties ) );
101 116
102 117 if ( ! in_array( $post->ID, $viewed_properties ) )
103 118 $viewed_properties[] = $post->ID;
104 119
105 - if ( sizeof( $viewed_properties ) > 15 )
106 - array_shift( $viewed_properties );
120 + if ( count( $viewed_properties ) > 15 )
121 + $viewed_properties = array_slice( $viewed_properties, -15 );
107 122
108 123 // Store for session only
109 124 ph_setcookie( 'propertyhive_recently_viewed', implode( '|', $viewed_properties ) );
110 125 }
@@ -120,14 +135,14 @@
120 135 {
121 136 $view_counts = array();
122 137 }
123 138
124 - if ( !isset($view_counts[date("Y-m-d")]) )
139 + if ( !isset($view_counts[gmdate("Y-m-d")]) )
125 140 {
126 - $view_counts[date("Y-m-d")] = 0;
141 + $view_counts[gmdate("Y-m-d")] = 0;
127 142 }
128 143
129 - ++$view_counts[date("Y-m-d")];
144 + ++$view_counts[gmdate("Y-m-d")];
130 145
131 146 update_post_meta( $post->ID, '_view_statistics', $view_counts );
132 147 }
133 148 }
@@ -133,8 +148,9 @@
133 148 }
134 149
135 150 add_action( 'template_redirect', 'ph_track_property_view', 20 );
136 151
152 +// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound -- Legacy public global helper get_property_map; the established callable name is part of the plugin/extension API and must remain stable.
137 153 function get_property_map( $args = array() )
138 154 {
139 155 global $property;
140 156
@@ -143,9 +159,9 @@
143 159 $id_suffix = ( ( isset($args['id']) && $args['id'] != '' ) ? '_' . $args['id'] : '' );
144 160
145 161 if ( get_option('propertyhive_maps_provider') == 'mapbox' )
146 162 {
147 - echo '<div id="property_map_canvas' . esc_attr($id_suffix) . '" style="background:#EEE; height:' . esc_attr( str_replace( "px", "", ( ( isset($args['height']) && !empty($args['height']) && is_numeric($args['height']) ) ? (int)$args['height'] : '400' ) ) ) . 'px"></div>';
163 + echo '<div id="property_map_canvas' . esc_attr($id_suffix) . '" style="background:#EEE; height:' . esc_attr( ( ( isset($args['height']) && !empty($args['height']) && is_numeric($args['height']) ) ? (int)$args['height'] : 400 ) ) . 'px"></div>';
148 164
149 165 $assets_path = str_replace( array( 'http:', 'https:' ), '', PH()->plugin_url() ) . '/assets/js/mapbox/';
150 166
151 167 wp_register_style('mapbox', $assets_path . 'mapbox-gl.css', array(), '3.8.0');
@@ -240,9 +256,9 @@
240 256 <?php
241 257 }
242 258 elseif ( get_option('propertyhive_maps_provider') == 'osm' )
243 259 {
244 - echo '<div id="property_map_canvas' . esc_attr($id_suffix) . '" style="background:#EEE; height:' . esc_attr( str_replace( "px", "", ( ( isset($args['height']) && !empty($args['height']) && is_numeric($args['height']) ) ? (int)$args['height'] : '400' ) ) ) . 'px"></div>';
260 + echo '<div id="property_map_canvas' . esc_attr($id_suffix) . '" style="background:#EEE; height:' . esc_attr( ( ( isset($args['height']) && !empty($args['height']) && is_numeric($args['height']) ) ? (int)$args['height'] : 400 ) ) . 'px"></div>';
245 261
246 262 $assets_path = str_replace( array( 'http:', 'https:' ), '', PH()->plugin_url() ) . '/assets/js/leaflet/';
247 263
248 264 wp_register_style('leaflet', $assets_path . 'leaflet.css', array(), '1.9.4');
@@ -332,9 +348,9 @@
332 348 }
333 349 do_action( 'propertyhive_property_map_actions', $property, $args, $id_suffix );
334 350 ?>
335 351
336 - L.marker([<?php echo (float)$property->latitude; ?>, <?php echo (float)$property->longitude; ?>]<?php echo $icon_code; ?>).addTo(property_map<?php echo esc_js($id_suffix); ?>);
352 + L.marker([<?php echo (float)$property->latitude; ?>, <?php echo (float)$property->longitude; ?>]<?php echo $icon_code === ', { icon: custom_icon }' ? ', { icon: custom_icon }' : ''; ?>).addTo(property_map<?php echo esc_js($id_suffix); ?>);
337 353 }
338 354
339 355 <?php if ( !isset($args['init_on_load']) || ( isset($args['init_on_load']) && ($args['init_on_load'] === 'true' || $args['init_on_load'] === TRUE) ) ) { ?>
340 356 if (window.addEventListener) {
@@ -353,9 +369,9 @@
353 369 if ( isset($args['embed']) && ($args['embed'] === 'true' || $args['embed'] === TRUE) )
354 370 {
355 371 echo '<iframe
356 372 width="100%"
357 - height="' . str_replace( "px", "", ( ( isset($args['height']) && !empty($args['height']) && is_numeric($args['height']) ) ? (int)$args['height'] : '400' ) ) . '"
373 + height="' . ( ( isset($args['height']) && !empty($args['height']) && is_numeric($args['height']) ) ? (int)$args['height'] : 400 ) . '"
358 374 style="border:0"
359 375 loading="lazy"
360 376 allowfullscreen
361 377 referrerpolicy="no-referrer-when-downgrade"
@@ -363,11 +379,11 @@
363 379 </iframe>';
364 380 }
365 381 else
366 382 {
367 - echo '<div id="property_map_canvas' . esc_attr($id_suffix) . '" style="background:#EEE; height:' . esc_attr( str_replace( "px", "", ( ( isset($args['height']) && !empty($args['height']) && is_numeric($args['height']) ) ? (int)$args['height'] : '400' ) ) ) . 'px"></div>';
383 + echo '<div id="property_map_canvas' . esc_attr($id_suffix) . '" style="background:#EEE; height:' . esc_attr( ( ( isset($args['height']) && !empty($args['height']) && is_numeric($args['height']) ) ? (int)$args['height'] : 400 ) ) . 'px"></div>';
368 384
369 - wp_register_script('googlemaps', '//maps.googleapis.com/maps/api/js?' . ( ( $api_key != '' && $api_key !== FALSE ) ? 'key=' . $api_key : '' ), false, '3');
385 + wp_register_script('googlemaps', '//maps.googleapis.com/maps/api/js?' . ( ( $api_key != '' && $api_key !== FALSE ) ? 'key=' . $api_key : '' ), false, '3', true );
370 386 wp_enqueue_script('googlemaps');
371 387 ?>
372 388 <script>
373 389
@@ -387,11 +403,15 @@
387 403 if ( class_exists( 'PH_Map_Search' ) )
388 404 {
389 405 $map_add_on_settings = get_option( 'propertyhive_map_search', array() );
390 406
391 - if ( isset($map_add_on_settings['style_js']) && trim($map_add_on_settings['style_js']) != '' )
407 + if ( isset($map_add_on_settings['style_js']) && is_string($map_add_on_settings['style_js']) && trim($map_add_on_settings['style_js']) != '' )
392 408 {
393 - echo 'map_options.styles = ' . trim($map_add_on_settings['style_js']) . ';';
409 + // Google Maps styles are JSON arrays, including legacy Snazzy Maps style properties.
410 + $map_styles = json_decode( $map_add_on_settings['style_js'] );
411 + if ( is_array( $map_styles ) ) {
412 + echo 'map_options.styles = ' . wp_json_encode( $map_styles, JSON_HEX_TAG | JSON_HEX_AMP | JSON_HEX_APOS | JSON_HEX_QUOT ) . ';';
413 + }
394 414 }
395 415 }
396 416
397 417 do_action( 'propertyhive_property_map_options', $property, $args, $id_suffix );
@@ -421,9 +441,9 @@
421 441 {
422 442 $size = getimagesize( get_attached_file( $map_add_on_settings['custom_icon_attachment_id'] ) );
423 443 if ( $size !== FALSE && !empty($size) )
424 444 {
425 - echo ', anchor: new google.maps.Point(' . floor( (int)$size[0] / 2 ) . ', ' . floor( (int)$size[1] / 2 ) . ')';
445 + echo ', anchor: new google.maps.Point(' . (int) floor( (int)$size[0] / 2 ) . ', ' . (int) floor( (int)$size[1] / 2 ) . ')';
426 446 }
427 447 }
428 448 echo '};';
429 449 echo 'marker_options.icon = ph_map_icon;';
@@ -454,8 +474,9 @@
454 474 do_action( 'propertyhive_property_map_after' );
455 475 }
456 476 }
457 477
478 +// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound -- Legacy public global helper get_property_static_map; the established callable name is part of the plugin/extension API and must remain stable.
458 479 function get_property_static_map( $args = array() )
459 480 {
460 481 global $property;
461 482
@@ -475,9 +496,9 @@
475 496 $link = ( ( isset($args['link']) && ($args['link'] === 'false' || $args['link'] === FALSE) ) ? 'false' : 'true' );
476 497
477 498 $map_url = 'https://maps.googleapis.com/maps/api/staticmap?' .
478 499 'center=' . (float)$property->latitude . ',' . (float)$property->longitude .
479 - '&size=1024x' . str_replace( "px", "", ( ( isset($args['height']) && !empty($args['height']) && is_numeric($args['height']) ) ? (int)$args['height'] : '400' ) ) .
500 + '&size=1024x' . ( ( isset($args['height']) && !empty($args['height']) && is_numeric($args['height']) ) ? (int)$args['height'] : 400 ) .
480 501 '&zoom=' . ( ( isset($args['zoom']) && !empty($args['zoom']) ) ? (int)$args['zoom'] : '14' ) .
481 502 '&maptype=roadmap' .
482 503 '&markers=%7C%7C' . (float)$property->latitude . ',' . (float)$property->longitude .
483 504 '&key=' . urlencode($api_key);
@@ -483,9 +504,9 @@
483 504 '&key=' . urlencode($api_key);
484 505
485 506 echo '<style type="text/css">
486 507 #property_static_map' . esc_attr($id_suffix) . ' {
487 - height:' . str_replace( "px", "", ( ( isset($args['height']) && !empty($args['height']) && is_numeric($args['height']) ) ? (int)$args['height'] : '400' ) ) . 'px;
508 + height:' . ( ( isset($args['height']) && !empty($args['height']) && is_numeric($args['height']) ) ? (int)$args['height'] : 400 ) . 'px;
488 509 display: block;
489 510 background-image: url("' . esc_url($map_url) . '");
490 511 background-repeat: no-repeat;
491 512 background-position: 50% 50%;
@@ -504,8 +525,9 @@
504 525 }
505 526 }
506 527 }
507 528
529 +// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound -- Legacy public global helper get_property_street_view; the established callable name is part of the plugin/extension API and must remain stable.
508 530 function get_property_street_view( $args = array() )
509 531 {
510 532 global $property;
511 533
@@ -522,9 +544,9 @@
522 544 if ( isset($args['embed']) && ($args['embed'] === 'true' || $args['embed'] === TRUE) )
523 545 {
524 546 echo '<iframe
525 547 width="100%"
526 - height="' . str_replace( "px", "", ( ( isset($args['height']) && !empty($args['height']) && is_numeric($args['height']) ) ? (int)$args['height'] : '400' ) ) . '"
548 + height="' . ( ( isset($args['height']) && !empty($args['height']) && is_numeric($args['height']) ) ? (int)$args['height'] : 400 ) . '"
527 549 style="border:0"
528 550 loading="lazy"
529 551 allowfullscreen
530 552 referrerpolicy="no-referrer-when-downgrade"
@@ -532,12 +554,12 @@
532 554 </iframe>';
533 555 }
534 556 else
535 557 {
536 - wp_register_script('googlemaps', '//maps.googleapis.com/maps/api/js?' . ( ( $api_key != '' && $api_key !== FALSE ) ? 'key=' . $api_key : '' ), false, '3');
558 + wp_register_script('googlemaps', '//maps.googleapis.com/maps/api/js?' . ( ( $api_key != '' && $api_key !== FALSE ) ? 'key=' . $api_key : '' ), false, '3', true );
537 559 wp_enqueue_script('googlemaps');
538 560
539 - echo '<div id="property_street_view_canvas" style="height:' . str_replace( "px", "", ( ( isset($args['height']) && !empty($args['height']) && is_numeric($args['height']) ) ? (int)$args['height'] : '400' ) ) . 'px"></div>';
561 + echo '<div id="property_street_view_canvas" style="height:' . ( ( isset($args['height']) && !empty($args['height']) && is_numeric($args['height']) ) ? (int)$args['height'] : 400 ) . 'px"></div>';
540 562 ?>
541 563 <script>
542 564
543 565 // We declare vars globally so developers can access them
@@ -585,8 +607,9 @@
585 607 }
586 608 }
587 609 }
588 610
611 +// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound -- Legacy public global helper get_electricity_types; the established callable name is part of the plugin/extension API and must remain stable.
589 612 function get_electricity_types()
590 613 {
591 614 $types = array(
592 615 'mains_supply' => __( 'Mains Supply', 'propertyhive' ),
@@ -603,8 +626,9 @@
603 626
604 627 return $types;
605 628 }
606 629
630 +// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound -- Legacy public global helper get_electricity_type; the established callable name is part of the plugin/extension API and must remain stable.
607 631 function get_electricity_type( $type )
608 632 {
609 633 $types = get_electricity_types();
610 634
@@ -615,8 +639,9 @@
615 639
616 640 return '';
617 641 }
618 642
643 +// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound -- Legacy public global helper get_water_types; the established callable name is part of the plugin/extension API and must remain stable.
619 644 function get_water_types()
620 645 {
621 646 $types = array(
622 647 'mains_supply' => __( 'Mains Supply', 'propertyhive' ),
@@ -631,8 +656,9 @@
631 656
632 657 return $types;
633 658 }
634 659
660 +// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound -- Legacy public global helper get_water_type; the established callable name is part of the plugin/extension API and must remain stable.
635 661 function get_water_type( $type )
636 662 {
637 663 $types = get_water_types();
638 664
@@ -643,8 +669,9 @@
643 669
644 670 return '';
645 671 }
646 672
673 +// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound -- Legacy public global helper get_broadband_types; the established callable name is part of the plugin/extension API and must remain stable.
647 674 function get_broadband_types()
648 675 {
649 676 $types = array(
650 677 'adsl' => __( 'ADSL', 'propertyhive' ),
@@ -662,8 +689,9 @@
662 689
663 690 return $types;
664 691 }
665 692
693 +// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound -- Legacy public global helper get_broadband_type; the established callable name is part of the plugin/extension API and must remain stable.
666 694 function get_broadband_type( $type )
667 695 {
668 696 $types = get_broadband_types();
669 697
@@ -674,8 +702,9 @@
674 702
675 703 return '';
676 704 }
677 705
706 +// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound -- Legacy public global helper get_heating_types; the established callable name is part of the plugin/extension API and must remain stable.
678 707 function get_heating_types()
679 708 {
680 709 $types = array(
681 710 'air_conditioning' => __( 'Air Conditioning', 'propertyhive' ),
@@ -707,8 +736,9 @@
707 736
708 737 return $types;
709 738 }
710 739
740 +// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound -- Legacy public global helper get_heating_type; the established callable name is part of the plugin/extension API and must remain stable.
711 741 function get_heating_type( $type )
712 742 {
713 743 $types = get_heating_types();
714 744
@@ -719,8 +749,9 @@
719 749
720 750 return '';
721 751 }
722 752
753 +// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound -- Legacy public global helper get_sewerage_types; the established callable name is part of the plugin/extension API and must remain stable.
723 754 function get_sewerage_types()
724 755 {
725 756 $types = array(
726 757 'mains_supply' => __( 'Mains Supply', 'propertyhive' ),
@@ -735,8 +766,9 @@
735 766
736 767 return $types;
737 768 }
738 769
770 +// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound -- Legacy public global helper get_sewerage_type; the established callable name is part of the plugin/extension API and must remain stable.
739 771 function get_sewerage_type( $type )
740 772 {
741 773 $types = get_sewerage_types();
742 774
@@ -747,8 +779,9 @@
747 779
748 780 return '';
749 781 }
750 782
783 +// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound -- Legacy public global helper get_flooding_source_types; the established callable name is part of the plugin/extension API and must remain stable.
751 784 function get_flooding_source_types()
752 785 {
753 786 $types = array(
754 787 'river' => __( 'River', 'propertyhive' ),
@@ -766,8 +799,9 @@
766 799
767 800 return $types;
768 801 }
769 802
803 +// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound -- Legacy public global helper get_flooding_source_type; the established callable name is part of the plugin/extension API and must remain stable.
770 804 function get_flooding_source_type( $type )
771 805 {
772 806 $types = get_flooding_source_types();
773 807
@@ -778,8 +812,9 @@
778 812
779 813 return '';
780 814 }
781 815
816 +// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound -- Legacy public global helper get_accessibility_types; the established callable name is part of the plugin/extension API and must remain stable.
782 817 function get_accessibility_types()
783 818 {
784 819 $types = array(
785 820 'lateral_living' => __( 'Lateral Living', 'propertyhive' ),
@@ -801,8 +836,9 @@
801 836
802 837 return $types;
803 838 }
804 839
840 +// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound -- Legacy public global helper get_accessibility_type; the established callable name is part of the plugin/extension API and must remain stable.
805 841 function get_accessibility_type( $type )
806 842 {
807 843 $types = get_accessibility_types();
808 844
@@ -813,8 +849,9 @@
813 849
814 850 return '';
815 851 }
816 852
853 +// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound -- Legacy public global helper get_restrictions; the established callable name is part of the plugin/extension API and must remain stable.
817 854 function get_restrictions()
818 855 {
819 856 $types = array(
820 857 'conservation_area' => __( 'Restrictions due to being in a conservation area', 'propertyhive' ),
@@ -837,8 +874,9 @@
837 874
838 875 return $types;
839 876 }
840 877
878 +// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound -- Legacy public global helper get_restriction; the established callable name is part of the plugin/extension API and must remain stable.
841 879 function get_restriction( $type )
842 880 {
843 881 $types = get_restrictions();
844 882
@@ -849,8 +887,9 @@
849 887
850 888 return '';
851 889 }
852 890
891 +// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound -- Legacy public global helper get_rights; the established callable name is part of the plugin/extension API and must remain stable.
853 892 function get_rights()
854 893 {
855 894 $types = array(
856 895 'right_of_way_public' => __( 'Public rights of way', 'propertyhive' ),
@@ -870,8 +909,9 @@
870 909
871 910 return $types;
872 911 }
873 912
913 +// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound -- Legacy public global helper get_right; the established callable name is part of the plugin/extension API and must remain stable.
874 914 function get_right( $type )
875 915 {
876 916 $types = get_rights();
877 917
@@ -901,9 +941,9 @@
901 941 $photos = get_post_meta( $post_id, '_photos', TRUE );
902 942 if ( is_array($photos) && !empty($photos) )
903 943 {
904 944 $photos = array_filter( $photos );
905 - $value = $photos[0];
945 + if ( !empty($photos) ) { $value = $photos[0]; }
906 946 }
907 947 }
908 948
909 949 if ( ! $single )