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/class-ph-appraisal.php +27 -4 1.4.492.3.1 View file →
@@ -12,8 +12,9 @@
12 12 * @package PropertyHive/Classes
13 13 * @category Class
14 14 * @author PropertyHive
15 15 */
16 +// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedClassFound -- Legacy public global class PH_Appraisal; preserving the existing PH_* class name is required for plugin and extension compatibility.
16 17 class PH_Appraisal {
17 18
18 19 /** @public int Appraisal (post) ID */
19 20 public $id;
@@ -165,16 +166,36 @@
165 166 * @return string
166 167 */
167 168 public function get_formatted_price( ) {
168 169
169 - $prefix = '£';
170 - $suffix = '';
170 + $ph_countries = new PH_Countries();
171 +
172 + $currency = 'GBP';
173 +
174 + $default_country = get_option( 'propertyhive_default_country', 'GB' );
175 + $countries = get_option( 'propertyhive_countries', array( $default_country ) );
176 + if ( count($countries) == 1 )
177 + {
178 + foreach ( $countries as $country )
179 + {
180 + $country = $ph_countries->get_country( $country );
181 +
182 + $currency = $country['currency_code'];
183 + }
184 + }
185 +
186 + $currency = $ph_countries->get_currency( $currency );
187 +
188 + $prefix = ( ($currency['currency_prefix']) ? $currency['currency_symbol'] : '' );
189 + $suffix = ( (!$currency['currency_prefix']) ? $currency['currency_symbol'] : '' );
190 +
171 191 switch ($this->_department)
172 192 {
173 193 case "residential-sales":
174 194 {
175 195 $price = $this->_valued_price;
176 - return ( ( $price != '' ) ? $prefix . number_format($price, 0, get_option('propertyhive_price_decimal_separator', '.'), get_option('propertyhive_price_thousand_separator', ',')) . $suffix : '-' );
196 +
197 + return ( ( $price != '' ) ? $prefix . ph_display_price_field($price) . $suffix : '-' );
177 198 break;
178 199 }
179 200 case "residential-lettings":
180 201 {
@@ -182,14 +203,16 @@
182 203 if ( $price != '' )
183 204 {
184 205 switch ( $this->_valued_rent_frequency )
185 206 {
207 + case "pd": { $price = ($price * 365) / 52; break; }
186 208 case "pw": { $price = ($price * 12) / 52; break; }
187 209 case "pq": { $price = ($price * 12) / 4; break; }
188 210 case "pa": { $price = ($price * 12); break; }
189 211 }
190 212 }
191 - return ( ( $price != '' ) ? $prefix . number_format($price, 0, get_option('propertyhive_price_decimal_separator', '.'), get_option('propertyhive_price_thousand_separator', ',')) . $suffix . ' ' . __( $this->_rent_frequency, 'propertyhive' ) : '-' );
213 +
214 + return ( ( $price != '' ) ? $prefix . ph_display_price_field($price) . $suffix . ' ' . propertyhive_get_rent_frequency_label( $this->_rent_frequency ) : '-' );
192 215 break;
193 216 }
194 217 }
195 218