PluginProbe
Property Hive / 2.3.0
Property Hive v2.3.0
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/class-ph-elementor.php +37 -36 2.2.62.3.0 View file →
@@ -32,8 +32,9 @@
32 32 $query_vars['orderby'] = $ordering['orderby'] . ' post_title';
33 33 $query_vars['order'] = $ordering['order'];
34 34 if ( isset( $ordering['meta_key'] ) )
35 35 {
36 + // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_key -- Elementor integration copies the ordering meta_key produced by PH_Query, whose supported order cases map to fixed Property Hive keys. The surrounding hook applies only to named Property Hive query IDs; Elementor supplies its own paginated widget query.
36 37 $query_vars['meta_key'] = $ordering['meta_key'];
37 38 }
38 39 }
39 40
@@ -91,18 +92,10 @@
91 92 }
92 93
93 94 public function elementor_query_on_market_sales_only( $query )
94 95 {
95 - $original_department = isset($_REQUEST['department']) ? $_REQUEST['department'] : '';
96 -
97 - $_GET['department'] = 'residential-sales';
98 - $_REQUEST['department'] = 'residential-sales';
96 + $this->query_department( $query, 'residential-sales' );
99 97
100 - PH()->query->property_query( $query );
101 -
102 - $_GET['department'] = $original_department;
103 - $_REQUEST['department'] = $original_department;
104 -
105 98 // Set the custom post type
106 99 $query->set( 'post_type', [ 'property' ] );
107 100
108 101 // ensure a department is set as not set by default from property_query
@@ -117,18 +110,10 @@
117 110 }
118 111
119 112 public function elementor_query_on_market_lettings_only( $query )
120 113 {
121 - $original_department = isset($_REQUEST['department']) ? $_REQUEST['department'] : '';
122 -
123 - $_GET['department'] = 'residential-lettings';
124 - $_REQUEST['department'] = 'residential-lettings';
114 + $this->query_department( $query, 'residential-lettings' );
125 115
126 - PH()->query->property_query( $query );
127 -
128 - $_GET['department'] = $original_department;
129 - $_REQUEST['department'] = $original_department;
130 -
131 116 // Set the custom post type
132 117 $query->set( 'post_type', [ 'property' ] );
133 118
134 119 // ensure a department is set as not set by default from property_query
@@ -143,18 +128,10 @@
143 128 }
144 129
145 130 public function elementor_query_on_market_commercial_only( $query )
146 131 {
147 - $original_department = isset($_REQUEST['department']) ? $_REQUEST['department'] : '';
148 -
149 - $_GET['department'] = 'commercial';
150 - $_REQUEST['department'] = 'commercial';
132 + $this->query_department( $query, 'commercial' );
151 133
152 - PH()->query->property_query( $query );
153 -
154 - $_GET['department'] = $original_department;
155 - $_REQUEST['department'] = $original_department;
156 -
157 134 // Set the custom post type
158 135 $query->set( 'post_type', [ 'property' ] );
159 136
160 137 // ensure a department is set as not set by default from property_query
@@ -192,8 +169,32 @@
192 169 $query->set( 'orderby', $original_orderby );
193 170 $query->set( 'order', $original_order );
194 171 }
195 172
173 + /** Temporarily scope the public query while preserving the exact surrounding request. */
174 + private function query_department( $query, $department ) {
175 + // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- Snapshot only: this raw value is restored unchanged, never used in the scoped query. PH_Query separately validates request inputs.
176 + $original_request = array_key_exists( 'department', $_REQUEST ) ? array( $_REQUEST['department'] ) : array();
177 + // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- Snapshot only: preserve GET independently from REQUEST, including absence and the original slashing contract.
178 + $original_get = array_key_exists( 'department', $_GET ) ? array( $_GET['department'] ) : array();
179 + $_GET['department'] = $department;
180 + $_REQUEST['department'] = $department;
181 + try {
182 + PH()->query->property_query( $query );
183 + } finally {
184 + if ( $original_request ) {
185 + $_REQUEST['department'] = $original_request[0];
186 + } else {
187 + unset( $_REQUEST['department'] );
188 + }
189 + if ( $original_get ) {
190 + $_GET['department'] = $original_get[0];
191 + } else {
192 + unset( $_GET['department'] );
193 + }
194 + }
195 + }
196 +
196 197 private function remove_department_from_query( $query )
197 198 {
198 199 $new_meta_query = array();
199 200
@@ -223,15 +224,15 @@
223 224 wp_enqueue_style( 'propertyhive_fancybox_css' );
224 225
225 226 wp_enqueue_script( 'flexslider', $assets_path . 'js/flexslider/jquery.flexslider' . $suffix . '.js', array( 'jquery' ), '2.2.2', true );
226 227 wp_enqueue_script( 'flexslider-init', $assets_path . 'js/flexslider/jquery.flexslider.init' . $suffix . '.js', array( 'jquery','flexslider' ), PH_VERSION, true );
227 - wp_enqueue_style( 'flexslider_css', $assets_path . 'css/flexslider.css' );
228 + wp_enqueue_style( 'flexslider_css', $assets_path . 'css/flexslider.css', array(), PH_VERSION );
228 229
229 230 $api_key = get_option('propertyhive_google_maps_api_key');
230 - wp_register_script('googlemaps', '//maps.googleapis.com/maps/api/js?' . ( ( $api_key != '' && $api_key !== FALSE ) ? 'key=' . $api_key : '' ), false, '3');
231 + wp_register_script('googlemaps', '//maps.googleapis.com/maps/api/js?' . ( ( $api_key != '' && $api_key !== FALSE ) ? 'key=' . $api_key : '' ), false, '3', true );
231 232 wp_enqueue_script('googlemaps');
232 233
233 - wp_enqueue_script( 'propertyhive_elementor', $assets_path . 'js/elementor/elementor.js', array( 'jquery','flexslider' ), PH_VERSION, true );
234 + wp_enqueue_script( 'propertyhive_elementor', $assets_path . 'js/elementor/elementor.js', array( 'jquery','flexslider', 'googlemaps' ), PH_VERSION, true );
234 235 }
235 236
236 237 public function add_elementor_widget_category( $elements_manager )
237 238 {
@@ -392,11 +393,11 @@
392 393
393 394 $image_src = $images[0]['url'];
394 395
395 396 $image_class = ! empty( $settings['hover_animation'] ) ? 'elementor-animation-' . $settings['hover_animation'] : '';
396 - $image_class_html = ! empty( $image_class ) ? ' class="' . $image_class . '"' : '';
397 + $image_class_html = ! empty( $image_class ) ? ' class="' . esc_attr( $image_class ) . '"' : '';
397 398
398 - $html = sprintf( '<img src="%s" title="" alt=""%s />', esc_attr( $image_src ), $image_class_html );
399 + $html = sprintf( '<img src="%s" title="" alt=""%s />', esc_url( $image_src ), $image_class_html );
399 400 return $html;
400 401 }
401 402
402 403 public function elementor_widget_property_image_controls( $widget )
@@ -415,11 +416,11 @@
415 416
416 417 $widget->add_control(
417 418 'flag_note',
418 419 [
419 - 'label' => __( '', 'propertyhive' ),
420 + 'label' => '',
420 421 'type' => \Elementor\Controls_Manager::RAW_HTML,
421 - 'raw' => __( 'The flag shown will take its colour and position settings from the <a href="' . admin_url('admin.php?page=ph-settings&tab=template-assistant&section=flags') . '" target="_blank">Template Assistant Flags</a> settings area', 'propertyhive' ),
422 + 'raw' => /* translators: %s: Template Assistant flags settings URL. */ sprintf( __( 'The flag shown will take its colour and position settings from the <a href="%s" target="_blank">Template Assistant Flags</a> settings area', 'propertyhive' ), esc_url( admin_url( 'admin.php?page=ph-settings&tab=frontend&section=flags' ) ) ),
422 423 'condition' => [
423 424 'show_flag' => 'yes',
424 425 ],
425 426 ]
@@ -437,11 +438,11 @@
437 438 if ( $flag != '' )
438 439 {
439 440 $current_settings = get_option( 'propertyhive_template_assistant', array() );
440 441
441 - echo '<div class="flag flag-' . sanitize_title($flag) . '" style="position:absolute; text-transform:uppercase; font-size:13px; box-sizing:border-box; padding:7px 20px; ' . $current_settings['flag_position'] . '; color:' . $current_settings['flag_text_color'] . '; background:' . $current_settings['flag_bg_color'] . ';">' . $flag . '</div>';
442 + echo '<div class="flag flag-' . esc_attr( sanitize_title( $flag ) ) . '" style="' . esc_attr( 'position:absolute; text-transform:uppercase; font-size:13px; box-sizing:border-box; padding:7px 20px; ' . propertyhive_get_flag_custom_style( $current_settings ) ) . '">' . esc_html( $flag ) . '</div>';
442 443 }
443 444 }
444 445 }
445 446 }
446 447
447 -new PH_Elementor();
448 +new PH_Elementor();