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
propertyhive / templates / single-property / material-information.php

material-information.php in Property Hive 2.3.1, at templates/single-property/material-information.php

80 lines 3.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Single Property Material Information
4 *
5 * @author PropertyHive
6 * @package PropertyHive/Templates
7 * @version 1.0.0
8 */
9
10 if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
11
12 global $post, $property;
13
14 // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Template-local variable; the template is included through a helper/function scope, so PrefixAllGlobals misclassifies the file when checked standalone.
15 $material_information = $property->get_material_information();
16
17 if ( empty($material_information) )
18 {
19 return;
20 }
21 // Built-in keys use literal messages so translation tools can discover every label.
22 $propertyhive_material_labels = array(
23 'utilities' => __( 'Utilities', 'propertyhive' ),
24 'accessibility' => __( 'Accessibility', 'propertyhive' ),
25 'restrictions' => __( 'Restrictions', 'propertyhive' ),
26 'rights' => __( 'Rights', 'propertyhive' ),
27 'flood_risk' => __( 'Flood Risk', 'propertyhive' ),
28 'electricity' => __( 'Electricity', 'propertyhive' ),
29 'water' => __( 'Water', 'propertyhive' ),
30 'heating' => __( 'Heating', 'propertyhive' ),
31 'broadband' => __( 'Broadband', 'propertyhive' ),
32 'sewerage' => __( 'Sewerage', 'propertyhive' ),
33 'flooded_in_last_five_years' => __( 'Flooded In Last Five Years', 'propertyhive' ),
34 'flood_source' => __( 'Flood Source', 'propertyhive' ),
35 'flood_defences' => __( 'Flood Defences', 'propertyhive' ),
36 );
37 $propertyhive_material_label = static function ( $key ) use ( $propertyhive_material_labels ) {
38 if ( isset( $propertyhive_material_labels[ $key ] ) ) {
39 return $propertyhive_material_labels[ $key ];
40 }
41 // Preserve translations registered by extensions for their own material-information keys.
42 // phpcs:ignore WordPress.WP.I18n.NonSingularStringLiteralText -- Extension-defined labels have no built-in literal; preserve the existing translation contract.
43 return __( ucwords( str_replace( '_', ' ', $key ) ), 'propertyhive' );
44 };
45 ?>
46 <div class="property-material-information" style="min-width:400px">
47
48 <h2><?php echo esc_html( __( 'Utilities & More', 'propertyhive' ) ); ?></h2>
49
50 <?php do_action( 'propertyhive_property_material_information_start' ); ?>
51
52 <?php
53 // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Template-local variable; the template is included through a helper/function scope, so PrefixAllGlobals misclassifies the file when checked standalone.
54 foreach ( $material_information as $key => $value )
55 {
56 // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Template-local variable.
57 $label = $propertyhive_material_label( $key );
58 echo '<h4>' . esc_html( $label ) . '</h4>';
59
60 if ( is_array($value) && !empty($value) )
61 {
62 // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Template-local variable; the template is included through a helper/function scope, so PrefixAllGlobals misclassifies the file when checked standalone.
63 foreach ( $value as $subkey => $subvalue )
64 {
65 // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Template-local variable.
66 $label = $propertyhive_material_label( $subkey );
67
68 echo '<strong>' . esc_html( $label ) . ':</strong> ' . esc_html($subvalue) . '<br>';
69 }
70 }
71 else
72 {
73 echo '<strong>' . esc_html( $label ) . ':</strong> ' . esc_html($value) . '<br>';
74 }
75 }
76 ?>
77
78 <?php do_action( 'propertyhive_property_material_information_end' ); ?>
79
80 </div>