PluginProbe
Property Hive / 2.3.0
Property Hive v2.3.0
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 1.4.62 All 260 releases
propertyhive / templates / search / orderby.php

orderby.php in Property Hive 2.3.0, at templates/search/orderby.php

76 lines 3.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Show options for ordering
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 $propertyhive;
13
14 ?>
15 <form class="propertyhive-ordering" method="get">
16 <?php
17 if (
18 ( !in_array( $department, array('', 'commercial') ) && ph_get_custom_department_based_on($department) != 'commercial' ) ||
19 ( $department == '' && get_option( 'propertyhive_primary_department' ) != 'commercial' && ph_get_custom_department_based_on(get_option( 'propertyhive_primary_department' )) != 'commercial' )
20 )
21 {
22 // 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.
23 $results_orderby = apply_filters( 'propertyhive_results_orderby', array(
24 'price-desc' => __( 'Default sorting', 'propertyhive' ),
25 'date' => __( 'Sort by date added', 'propertyhive' ),
26 'price-asc' => __( 'Sort by price: low to high', 'propertyhive' ),
27 'price-desc' => __( 'Sort by price: high to low', 'propertyhive' ),
28 ) );
29 }
30 else
31 {
32 // 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.
33 $results_orderby = apply_filters( 'propertyhive_results_orderby', array(
34 'floor_area-desc' => __( 'Default sorting', 'propertyhive' ),
35 'date' => __( 'Sort by date added', 'propertyhive' ),
36 'floor_area-asc' => __( 'Sort by floor area: low to high', 'propertyhive' ),
37 'floor_area-desc' => __( 'Sort by floor area: high to low', 'propertyhive' ),
38 'price-asc' => __( 'Sort by price: low to high', 'propertyhive' ),
39 'price-desc' => __( 'Sort by price: high to low', 'propertyhive' ),
40 ) );
41 }
42
43 if ( !empty($results_orderby) )
44 {
45 ?>
46 <select name="orderby" class="orderby">
47 <?php
48 // 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.
49 foreach ( $results_orderby as $id => $name )
50 {
51 echo '<option value="' . esc_attr( $id ) . '" ' . selected( $orderby, $id, false ) . '>' . esc_attr( $name ) . '</option>';
52 }
53 ?>
54 </select>
55 <?php
56 }
57
58 // Keep query string vars intact
59 // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound, WordPress.Security.NonceVerification.Recommended -- Function-scoped template locals preserve read-only search filters; every hidden-field name/value is escaped below.
60 foreach ( $_GET as $key => $val ) {
61 if ( 'orderby' === $key || 'submit' === $key )
62 continue;
63
64 if ( is_array( $val ) ) {
65 // 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.
66 foreach( $val as $innerVal ) {
67 echo '<input type="hidden" name="' . esc_attr( $key ) . '[]" value="' . esc_attr( $innerVal ) . '" />';
68 }
69
70 } else {
71 echo '<input type="hidden" name="' . esc_attr( $key ) . '" value="' . esc_attr( $val ) . '" />';
72 }
73 }
74 ?>
75 </form>
76