Changeset 3737527
- Timestamp:
- 10/10/2026 02:29:49 AM (2 weeks ago)
- Location:
- homlity-real-estate/trunk
- Files:
-
- 17 edited
-
assets/js/pricing-admin.js (modified) (1 diff)
-
includes/schema/class-homlity-property-schema.php (modified) (5 diffs)
-
includes/schema/class-homlity-schema-helpers.php (modified) (1 diff)
-
plugin-inmobiliario.php (modified) (2 diffs)
-
readme.txt (modified) (1 diff)
-
src/Services/CardPriceResolver.php (modified) (2 diffs)
-
src/Services/PropertyPostType.php (modified) (1 diff)
-
src/Services/PropertySearchService.php (modified) (3 diffs)
-
src/Services/PropertyTaxonomies.php (modified) (5 diffs)
-
src/Services/SeoIntegrationService.php (modified) (3 diffs)
-
src/Services/TemplateService.php (modified) (6 diffs)
-
templates/parts/property-filter.php (modified) (2 diffs)
-
templates/parts/property-operation-price.php (modified) (4 diffs)
-
vendor/autoload.php (modified) (1 diff)
-
vendor/composer/autoload_psr4.php (modified) (1 diff)
-
vendor/composer/autoload_real.php (modified) (2 diffs)
-
vendor/composer/autoload_static.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
homlity-real-estate/trunk/assets/js/pricing-admin.js
r3623792 r3737527 7 7 function matchBlocks(slug, baseId) { 8 8 const wantsPermuta = baseId === 4 || slug.includes('permuta') || slug.includes('swap'); 9 const wantsRent = baseId === 1 || baseId === 3 || slug.includes('arriendo') || slug.includes(' rent');9 const wantsRent = baseId === 1 || baseId === 3 || slug.includes('arriendo') || slug.includes('alquil') || slug.includes('rent'); 10 10 const wantsSale = baseId === 2 || baseId === 3 || slug.includes('venta') || slug.includes('sale'); 11 11 const wantsAdmin = wantsRent || wantsSale || slug.includes('admin') || slug.includes('adm'); -
homlity-real-estate/trunk/includes/schema/class-homlity-property-schema.php
r3630479 r3737527 26 26 } 27 27 28 $offers = $this->offer_nodes($post_id, $url); 28 29 $nodes = array_filter([ 29 $this->listing_node($post_id, $url ),30 $this->listing_node($post_id, $url, $offers), 30 31 $this->property_node($post_id, $url), 31 $this->offer_node($post_id, $url),32 ...$offers, 32 33 $this->agent_node(), 33 34 $this->breadcrumb_node($post_id, $url), … … 39 40 // ── RealEstateListing ───────────────────────────────────────────────────── 40 41 41 private function listing_node(int $post_id, string $url ): array42 private function listing_node(int $post_id, string $url, array $offers): array 42 43 { 43 44 $images = Homlity_Schema_Helpers::images($post_id); … … 55 56 'identifier' => $code !== '' ? $code : null, 56 57 'mainEntity' => ['@id' => $url . '#property'], 57 'offers' => ['@id' => $url . '#offer'], 58 'offers' => count($offers) === 1 59 ? ['@id' => $offers[0]['@id']] 60 : (array_map(static fn(array $offer): array => ['@id' => $offer['@id']], $offers) ?: null), 58 61 ]; 59 62 … … 112 115 // ── Offer ───────────────────────────────────────────────────────────────── 113 116 114 private function offer_node(int $post_id, string $url): array 115 { 116 $op = Homlity_Schema_Helpers::operation($post_id); 117 $price = Homlity_Schema_Helpers::price($post_id); 118 $currency = Homlity_Schema_Helpers::currency($post_id); 117 private function offer_nodes(int $post_id, string $url): array 118 { 119 if (Homlity_Schema_Helpers::operation($post_id) !== 'both') { 120 return [$this->offer_node($post_id, $url)]; 121 } 122 $offers = []; 123 foreach (['rent', 'sale'] as $type) { 124 // An absent second price must not reuse the other operation's price. 125 if ((float) Homlity_Schema_Helpers::get_meta($post_id, 'price_' . $type) > 0) { 126 $offers[] = $this->offer_node($post_id, $url, $type); 127 } 128 } 129 return $offers; 130 } 131 132 private function offer_node(int $post_id, string $url, string $type = ''): array 133 { 134 $op = $type !== '' ? $type : Homlity_Schema_Helpers::operation($post_id); 135 $price = $type !== '' ? Homlity_Schema_Helpers::get_meta($post_id, 'price_' . $type) : Homlity_Schema_Helpers::price($post_id); 136 $currency = $type !== '' 137 ? (Homlity_Schema_Helpers::get_meta($post_id, 'currency_' . $type) ?: (new \Homlity\PluginInmobiliario\Services\CurrencyService())->baseCurrency()) 138 : Homlity_Schema_Helpers::currency($post_id); 119 139 $valid_until = Homlity_Schema_Helpers::price_valid_until($post_id); 120 140 $agent_id = home_url('/') . '#realestateagent'; … … 122 142 $node = [ 123 143 '@type' => 'Offer', 124 '@id' => $url . '#offer' ,144 '@id' => $url . '#offer' . ($type !== '' ? '-' . $type : ''), 125 145 'url' => $url, 126 146 'price' => $price !== '' ? $price : null, -
homlity-real-estate/trunk/includes/schema/class-homlity-schema-helpers.php
r3685581 r3737527 154 154 $is_sale = preg_match('/\b(venta|sale|sell|compra|compraventa)\b/', $haystack) === 1; 155 155 $is_rent = preg_match('/\b(arriendo|alquiler|rent|lease|arrendamiento)\b/', $haystack) === 1; 156 foreach ($terms as $term) { 157 if ($term instanceof \WP_Term && $term->taxonomy === \Homlity\PluginInmobiliario\Services\PropertyTaxonomies::TAXONOMY_OPERATION) { 158 $families = \Homlity\PluginInmobiliario\Services\PropertyTaxonomies::operationFamiliesForTerm($term); 159 $is_sale = $is_sale || in_array('sale', $families, true); 160 $is_rent = $is_rent || in_array('rent', $families, true); 161 } 162 } 156 163 157 164 if ($is_sale && $is_rent) { -
homlity-real-estate/trunk/plugin-inmobiliario.php
r3729219 r3737527 4 4 * Plugin Name: Homlity Real Estate 5 5 * Description: Homlity Real Estate, gestor de inmuebles, asesores, SEO y GEO listo para WordPress. 6 * Version: 2.9.1 36 * Version: 2.9.14 7 7 * Author: Ecosistema Inmobiliario Homlity 8 8 * Author URI: https://homlity.com/ … … 31 31 if (!defined('HOMLITY_PLUGIN_PATH')) define('HOMLITY_PLUGIN_PATH', plugin_dir_path(__FILE__)); 32 32 if (!defined('HOMLITY_PLUGIN_URL')) define('HOMLITY_PLUGIN_URL', plugin_dir_url(__FILE__)); 33 if (!defined('HOMLITY_PLUGIN_VERSION')) define('HOMLITY_PLUGIN_VERSION', '2.9.1 3');33 if (!defined('HOMLITY_PLUGIN_VERSION')) define('HOMLITY_PLUGIN_VERSION', '2.9.14'); 34 34 if (!defined('HOMLITY_PLUGIN_SLUG')) define('HOMLITY_PLUGIN_SLUG', 'homlity-real-estate'); 35 35 if (!defined('HOMLITY_PLUGIN_TEXT_DOMAIN')) define('HOMLITY_PLUGIN_TEXT_DOMAIN', 'homlity-real-estate'); -
homlity-real-estate/trunk/readme.txt
r3729219 r3737527 5 5 Tested up to: 7.1 6 6 Requires PHP: 8.0 7 Stable tag: 2.9.1 37 Stable tag: 2.9.14 8 8 License: GPLv2 or later 9 9 License URI: https://www.gnu.org/licenses/gpl-2.0.html -
homlity-real-estate/trunk/src/Services/CardPriceResolver.php
r3729219 r3737527 31 31 'homlity_plugin_card_price_lines', 32 32 null, 33 self::resolve($raw, $baseOperationId, $opSlugAndName ),33 self::resolve($raw, $baseOperationId, $opSlugAndName, self::operationLabelsForTerm($term instanceof \WP_Term ? $term : null)), 34 34 $postId 35 35 ); 36 36 } 37 37 38 /** @return array{rent:bool,sale:bool} */ 39 public static function operationTypes(int $baseOperationId, string $opSlugAndName): array 40 { 41 // Identity remains authoritative even when the display name changes. 42 if ($baseOperationId > 0) { 43 return ['rent' => in_array($baseOperationId, [1, 3], true), 'sale' => in_array($baseOperationId, [2, 3], true)]; 44 } 45 $operation = mb_strtolower($opSlugAndName); 46 return [ 47 'rent' => in_array($baseOperationId, [1, 3], true) 48 || preg_match('/(?:^|[\s\/_-])(?:arriendo|arrendamiento|alquiler|renta|rent)(?:$|[\s\/_-])/u', $operation) === 1, 49 'sale' => in_array($baseOperationId, [2, 3], true) || strpos($operation, 'venta') !== false, 50 ]; 51 } 52 53 /** 54 * Business identities choose the price; editable term names choose its label. 55 * Mixed operations use the configured names of the individual operations. 56 * 57 * @return array{rent:string,sale:string} 58 */ 59 public static function operationLabelsForTerm(?\WP_Term $term): array 60 { 61 $labels = []; 62 $configured = []; 63 foreach (['rent' => 1, 'sale' => 2] as $type => $baseId) { 64 $baseTerm = PropertyTaxonomies::baseOperationTermById($baseId); 65 if ($baseTerm instanceof \WP_Term) { 66 $baseTerm = PropertyTaxonomies::canonicalOperationTerm($baseTerm); 67 } 68 $labels[$type] = $baseTerm instanceof \WP_Term && trim($baseTerm->name) !== '' 69 ? $baseTerm->name 70 : PropertyTaxonomies::baseOperations()[$baseId]['name']; 71 $configured[$type] = $labels[$type] !== PropertyTaxonomies::baseOperations()[$baseId]['name']; 72 } 73 74 if ($term instanceof \WP_Term && trim($term->name) !== '') { 75 $types = self::operationTypes(PropertyTaxonomies::baseOperationIdForTerm($term), $term->slug . ' ' . $term->name); 76 if ($types['rent'] !== $types['sale']) { 77 $labels[$types['rent'] ? 'rent' : 'sale'] = $term->name; 78 } elseif ($types['rent'] && $types['sale']) { 79 foreach (preg_split('/\s*(?:\/|\by\b|&)\s*/iu', $term->name) ?: [] as $part) { 80 $partTypes = self::operationTypes(0, $part); 81 if ($partTypes['rent'] !== $partTypes['sale']) { 82 $type = $partTypes['rent'] ? 'rent' : 'sale'; 83 if (!$configured[$type]) { 84 $labels[$type] = $part; 85 } 86 } 87 } 88 } 89 } 90 91 return $labels; 92 } 93 38 94 /** 39 95 * @param array<string,mixed> $raw Values keyed by the logical meta names. 96 * @param array<string,string> $labels Display names keyed by rent/sale. 40 97 * @return array<int,array{type:string,label:string,amount:string,admin:?string,admin_included:bool}> 41 98 */ 42 public static function resolve(array $raw, int $baseOperationId, string $opSlugAndName ): array99 public static function resolve(array $raw, int $baseOperationId, string $opSlugAndName, array $labels = []): array 43 100 { 44 $operation = mb_strtolower($opSlugAndName); 45 $isSale = in_array($baseOperationId, [2, 3], true) || strpos($operation, 'venta') !== false; 46 $isRent = in_array($baseOperationId, [1, 3], true) || strpos($operation, 'arriendo') !== false; 47 $unknown = !$isSale && !$isRent; 101 $types = self::operationTypes($baseOperationId, $opSlugAndName); 102 $unknown = !$types['sale'] && !$types['rent']; 48 103 $currencyService = new CurrencyService(); 49 104 $lines = []; 50 105 51 foreach ( ['rent' => $isRent, 'sale' => $isSale]as $type => $enabled) {106 foreach ($types as $type => $enabled) { 52 107 $amount = $raw['price_' . $type] ?? ''; 53 108 if ((!$enabled && !$unknown) || $amount === '' || (float) $amount <= 0) { … … 64 119 $lines[] = [ 65 120 'type' => $type, 66 'label' => $ type === 'rent' ? __('Arriendo', 'homlity-real-estate') : __('Venta', 'homlity-real-estate'),121 'label' => $labels[$type] ?? ($type === 'rent' ? __('Arriendo', 'homlity-real-estate') : __('Venta', 'homlity-real-estate')), 67 122 'amount' => (string) homlity_plugin_apply_filters('homlity_plugin_format_price', null, $amount, $currency), 68 123 'admin' => $admin, -
homlity-real-estate/trunk/src/Services/PropertyPostType.php
r3665656 r3737527 2284 2284 2285 2285 if ($column === 'property_operation_value') { 2286 $operation = ''; 2287 $operationTerms = wp_get_post_terms($postId, PropertyTaxonomies::TAXONOMY_OPERATION); 2288 if (!is_wp_error($operationTerms) && !empty($operationTerms)) { 2289 $operation = strtolower(sanitize_title($operationTerms[0]->name)); 2290 } 2291 2292 $currencyService = new CurrencyService(); 2293 $currency = (string) get_post_meta($postId, '_property_currency_sale', true); 2294 if ($currency === '') { 2295 $currency = (string) get_post_meta($postId, '_property_currency_rent', true); 2296 } 2297 if ($currency === '') { 2298 $currency = (string) $currencyService->baseCurrency(); 2299 } 2300 2301 $priceSale = (string) get_post_meta($postId, '_property_price_sale', true); 2302 $priceRent = (string) get_post_meta($postId, '_property_price_rent', true); 2303 $priceAdmin = (string) get_post_meta($postId, '_property_price_admin', true); 2304 2305 $value = ''; 2306 if (strpos($operation, 'arriendo') !== false || strpos($operation, 'rent') !== false) { 2307 $value = $priceRent !== '' ? $priceRent : $priceSale; 2308 } else { 2309 $value = $priceSale !== '' ? $priceSale : $priceRent; 2310 } 2311 2312 if ($value === '' && $priceAdmin !== '') { 2313 $value = $priceAdmin; 2314 } 2315 2316 if ($value === '') { 2286 $lines = CardPriceResolver::forPost($postId); 2287 if ($lines === []) { 2317 2288 echo '—'; 2318 2289 return; 2319 2290 } 2320 2321 $formatted = \homlity_plugin_apply_filters('homlity_plugin_format_price', null, $value, $currency); 2322 echo esc_html((string) ($formatted !== null ? $formatted : $value)); 2291 foreach ($lines as $index => $line) { 2292 if ($index > 0) { 2293 echo '<br>'; 2294 } 2295 echo esc_html($line['label'] . ': ' . $line['amount']); 2296 } 2323 2297 return; 2324 2298 } -
homlity-real-estate/trunk/src/Services/PropertySearchService.php
r3665656 r3737527 163 163 ); 164 164 if ($termIds) { 165 if ($taxonomy === PropertyTaxonomies::TAXONOMY_OPERATION) { 166 $termIds = PropertyTaxonomies::expandOperationTermIds($termIds); 167 } 165 168 $args['tax_query'][] = [ 166 169 'taxonomy' => $taxonomy, … … 185 188 'taxonomy' => $taxonomy, 186 189 'field' => 'term_id', 187 'terms' => [$presetId], 190 'terms' => $taxonomy === PropertyTaxonomies::TAXONOMY_OPERATION 191 ? PropertyTaxonomies::expandOperationTermIds([$presetId]) 192 : [$presetId], 188 193 ]; 189 194 } … … 866 871 continue; 867 872 } 868 $text = strtolower(remove_accents($term->slug . ' ' . $term->name)); 869 if ( 870 strpos($text, 'arriendo') !== false || strpos($text, 'alquil') !== false 871 || strpos($text, 'renta') !== false || strpos($text, 'rent') !== false 872 ) { 873 if (in_array('rent', PropertyTaxonomies::operationFamiliesForTerm($term), true)) { 873 874 return '_property_price_rent'; 874 875 } -
homlity-real-estate/trunk/src/Services/PropertyTaxonomies.php
r3723270 r3737527 23 23 private const OPERATION_BASE_KEY_META = '_homlity_base_operation_key'; 24 24 private const OPERATION_BASE_ID_META = '_homlity_base_operation_id'; 25 private const OPERATION_ALIAS_SLUGS = [ 26 1 => ['alquiler', 'renta', 'arriendo', 'arrendamiento', 'rent'], 27 2 => ['venta', 'sale'], 28 3 => ['alquiler-venta', 'alquiler-y-venta', 'venta-alquiler', 'arriendo-venta', 'arriendo-y-venta', 'venta-arriendo', 'ambos'], 29 ]; 25 30 private const PROPERTY_TYPE_BASE_KEY_META = '_homlity_base_property_type_key'; 26 31 private const PROPERTY_TYPE_BASE_ID_META = '_homlity_base_property_type_id'; … … 1144 1149 'taxonomy' => self::TAXONOMY_OPERATION, 1145 1150 'hide_empty' => false, 1151 'fields' => 'all', 1146 1152 ]); 1147 1153 if (is_wp_error($allTerms) || empty($allTerms)) { … … 1151 1157 $expanded = $termIds; 1152 1158 foreach ($selectedTerms as $selectedTerm) { 1159 if (self::operationAliasBaseId($selectedTerm) === 0) { 1160 continue; 1161 } 1153 1162 $selectedFamilies = self::operationFamiliesForTerm($selectedTerm); 1154 1163 if (empty($selectedFamilies)) { … … 1213 1222 * @return string[] 1214 1223 */ 1215 p rivatestatic function operationFamiliesForTerm(\WP_Term $term): array1224 public static function operationFamiliesForTerm(\WP_Term $term): array 1216 1225 { 1217 1226 // Base terms are classified by identity so renaming them (e.g. "Venta" 1218 1227 // to "Comprar") keeps "Venta" searches matching "Arriendo/Venta". 1219 1228 $baseFamilies = [1 => ['rent'], 2 => ['sale'], 3 => ['rent', 'sale'], 4 => []]; 1220 $baseId = self:: baseOperationIdForTerm($term);1229 $baseId = self::operationAliasBaseId($term); 1221 1230 if (isset($baseFamilies[$baseId])) { 1222 1231 return $baseFamilies[$baseId]; … … 1224 1233 1225 1234 return self::operationFamiliesFromText($term->slug . ' ' . $term->name); 1235 } 1236 1237 /** 1238 * Resolve only exact synonyms; specialized operations keep their own URLs. 1239 * A renamed base term wins over historical aliases. 1240 */ 1241 public static function canonicalOperationTerm(\WP_Term $term): \WP_Term 1242 { 1243 $definitions = self::baseOperations(); 1244 $baseId = self::operationAliasBaseId($term); 1245 if (!isset(self::OPERATION_ALIAS_SLUGS[$baseId])) { 1246 return $term; 1247 } 1248 1249 $baseTerm = self::baseOperationTermById($baseId); 1250 if ($baseTerm instanceof \WP_Term 1251 && ($baseTerm->slug !== $definitions[$baseId]['slug'] || $baseTerm->name !== $definitions[$baseId]['name'])) { 1252 return $baseTerm; 1253 } 1254 foreach (self::OPERATION_ALIAS_SLUGS[$baseId] as $slug) { 1255 $candidate = get_term_by('slug', $slug, self::TAXONOMY_OPERATION); 1256 if ($candidate instanceof \WP_Term 1257 && self::operationFamiliesForTerm($candidate) === self::operationFamiliesForTerm($term)) { 1258 return $candidate; 1259 } 1260 } 1261 1262 return $baseTerm ?? $term; 1263 } 1264 1265 private static function operationAliasBaseId(\WP_Term $term): int 1266 { 1267 if ($term->taxonomy !== self::TAXONOMY_OPERATION) { 1268 return 0; 1269 } 1270 $baseId = self::baseOperationIdForTerm($term); 1271 if ($baseId === 0) { 1272 foreach (self::OPERATION_ALIAS_SLUGS as $id => $slugs) { 1273 if (in_array($term->slug, $slugs, true)) { 1274 $baseId = $id; 1275 break; 1276 } 1277 } 1278 } 1279 return $baseId; 1280 } 1281 1282 public static function canonicalOperationSlug(string $slug): string 1283 { 1284 $term = get_term_by('slug', $slug, self::TAXONOMY_OPERATION); 1285 return $term instanceof \WP_Term ? self::canonicalOperationTerm($term)->slug : $slug; 1286 } 1287 1288 /** @param \WP_Term[] $terms @return \WP_Term[] */ 1289 public static function publicOperationTerms(array $terms): array 1290 { 1291 $canonical = []; 1292 foreach ($terms as $term) { 1293 if ($term instanceof \WP_Term) { 1294 $representative = self::canonicalOperationTerm($term); 1295 $canonical[$representative->term_id] = $representative; 1296 } 1297 } 1298 return array_values($canonical); 1226 1299 } 1227 1300 -
homlity-real-estate/trunk/src/Services/SeoIntegrationService.php
r3665656 r3737527 498 498 // phpcs:enable WordPress.DB.PreparedSQL.InterpolatedNotPrepared,WordPress.DB.DirectDatabaseQuery.DirectQuery,WordPress.DB.DirectDatabaseQuery.NoCaching 499 499 foreach ((array) $slugs as $slug) { 500 if ($taxonomy === $taxOp) { 501 $slug = PropertyTaxonomies::canonicalOperationSlug((string) $slug); 502 } 500 503 $urls[] = home_url('/inmuebles/' . $prefix . '/' . rawurlencode((string) $slug) . '/'); 501 504 } … … 530 533 // phpcs:enable WordPress.DB.PreparedSQL.InterpolatedNotPrepared,WordPress.DB.DirectDatabaseQuery.DirectQuery,WordPress.DB.DirectDatabaseQuery.NoCaching 531 534 foreach ((array) $rows as $row) { 535 if ($taxA === $taxOp) { 536 $row = clone $row; 537 $row->slug_a = PropertyTaxonomies::canonicalOperationSlug((string) $row->slug_a); 538 } 532 539 $urls[] = home_url( 533 540 '/inmuebles/' . $prefA . '/' . rawurlencode((string) $row->slug_a) … … 559 566 // phpcs:enable WordPress.DB.PreparedSQL.InterpolatedNotPrepared,WordPress.DB.DirectDatabaseQuery.DirectQuery,WordPress.DB.DirectDatabaseQuery.NoCaching 560 567 foreach ((array) $rows as $row) { 568 $operationSlug = PropertyTaxonomies::canonicalOperationSlug((string) $row->g); 561 569 $urls[] = home_url( 562 '/inmuebles/gestion/' . rawurlencode( (string) $row->g)570 '/inmuebles/gestion/' . rawurlencode($operationSlug) 563 571 . '/tipo/' . rawurlencode((string) $row->t) 564 572 . '/ciudad/' . rawurlencode((string) $row->c) . '/' -
homlity-real-estate/trunk/src/Services/TemplateService.php
r3665656 r3737527 26 26 add_action('pre_get_posts', [$this, 'filterArchiveQuery']); 27 27 add_action('template_redirect', [$this, 'redirectLegacyFilteredArchiveUrl'], 1); 28 add_action('template_redirect', [$this, 'redirectOperationAliasArchiveUrl'], 1); 28 29 add_action('template_redirect', [$this, 'maybeRenderTechnicalSheetPdf'], 1); 29 30 add_action('template_redirect', [$this, 'redirectLegacyEnglishUrls']); … … 301 302 continue; 302 303 } 304 if ($routeKey === 'gestion') { 305 $value = PropertyTaxonomies::canonicalOperationSlug($value); 306 } 303 307 $segments[] = $routeKey; 304 308 $segments[] = rawurlencode($value); … … 311 315 312 316 return home_url($path); 317 } 318 319 /** Return a redirect only for an exact operation alias on an archive route. */ 320 public static function operationAliasArchiveRedirect(string $url): string 321 { 322 $path = (string) wp_parse_url($url, PHP_URL_PATH); 323 $archivePath = (string) wp_parse_url(home_url('/inmuebles/'), PHP_URL_PATH); 324 if (!str_starts_with($path, $archivePath . 'gestion/')) { 325 return ''; 326 } 327 $suffix = substr($path, strlen($archivePath)); 328 if (!preg_match('~^gestion/([^/]+)(?=/|$)~', $suffix, $matches)) { 329 return ''; 330 } 331 $slug = rawurldecode($matches[1]); 332 $canonical = PropertyTaxonomies::canonicalOperationSlug($slug); 333 if ($canonical === $slug) { 334 return ''; 335 } 336 $suffix = 'gestion/' . rawurlencode($canonical) . substr($suffix, strlen($matches[0])); 337 $query = (string) wp_parse_url($url, PHP_URL_QUERY); 338 return home_url('/inmuebles/' . $suffix) . ($query !== '' ? '?' . $query : ''); 339 } 340 341 public function redirectOperationAliasArchiveUrl(): void 342 { 343 if (is_admin() || wp_doing_ajax() || (defined('REST_REQUEST') && REST_REQUEST)) { 344 return; 345 } 346 $method = strtoupper((string) ($_SERVER['REQUEST_METHOD'] ?? 'GET')); 347 if (!in_array($method, ['GET', 'HEAD'], true)) { 348 return; 349 } 350 $target = self::operationAliasArchiveRedirect(wp_unslash((string) ($_SERVER['REQUEST_URI'] ?? ''))); 351 if ($target !== '') { 352 wp_safe_redirect($target, 301, 'Homlity Real Estate'); 353 exit; 354 } 313 355 } 314 356 … … 337 379 338 380 $legacyKeys = [ 381 'gestion', 382 'tipo', 383 'ciudad', 384 'barrios', 339 385 'property_operation', 340 386 'property_type', … … 514 560 if (!empty($_GET[$param])) { 515 561 $terms = array_map('sanitize_text_field', (array) wp_unslash($_GET[$param])); 562 if ($taxonomy === PropertyTaxonomies::TAXONOMY_OPERATION) { 563 $terms = PropertyTaxonomies::expandOperationTermSlugs($terms); 564 } 516 565 $taxQuery[] = [ 517 566 'taxonomy' => $taxonomy, … … 534 583 } 535 584 $terms = [sanitize_title($qvValue)]; 585 if ($taxonomy === PropertyTaxonomies::TAXONOMY_OPERATION) { 586 $terms = PropertyTaxonomies::expandOperationTermSlugs($terms); 587 } 536 588 $taxQuery[] = [ 537 589 'taxonomy' => $taxonomy, -
homlity-real-estate/trunk/templates/parts/property-filter.php
r3723270 r3737527 142 142 'taxonomy' => $taxonomy, 143 143 'hide_empty' => in_array($taxonomy, $onlyPublishedOptions, true), 144 'fields' => 'all', 144 145 ]); 145 146 if (is_wp_error($terms) || !$terms) { … … 147 148 } 148 149 $currentValues = is_array($currentValue) ? $currentValue : [$currentValue]; 150 if ($taxonomy === PropertyTaxonomies::TAXONOMY_OPERATION) { 151 $terms = PropertyTaxonomies::publicOperationTerms($terms); 152 $currentValues = array_map([PropertyTaxonomies::class, 'canonicalOperationSlug'], $currentValues); 153 } 149 154 $inputName = $multiple ? $name . '[]' : $name; 150 155 ?> -
homlity-real-estate/trunk/templates/parts/property-operation-price.php
r3623792 r3737527 13 13 14 14 use Homlity\PluginInmobiliario\Services\CurrencyService; 15 use Homlity\PluginInmobiliario\Services\CardPriceResolver; 15 16 use Homlity\PluginInmobiliario\Services\PropertyPostType; 16 17 use Homlity\PluginInmobiliario\Services\PropertyTaxonomies; … … 34 35 ? mb_strtolower($operationTerm->slug . ' ' . $operationTerm->name) 35 36 : ''; 36 $isVenta = in_array($baseOperationId, [2, 3], true) || strpos($opSlug, 'venta') !== false; 37 $isArriendo = in_array($baseOperationId, [1, 3], true) || strpos($opSlug, 'arriendo') !== false; 37 $operationTypes = CardPriceResolver::operationTypes($baseOperationId, $opSlug); 38 $priceLabels = CardPriceResolver::operationLabelsForTerm($operationTerm instanceof \WP_Term ? $operationTerm : null); 39 $isVenta = $operationTypes['sale']; 40 $isArriendo = $operationTypes['rent']; 38 41 $hideZero = ($s['hide_zero_values'] ?? 'no') === 'yes'; 39 42 … … 66 69 ], 67 70 'price_sale' => [ 68 'label' => __('Venta', 'homlity-real-estate'),71 'label' => $priceLabels['sale'], 69 72 'value' => ($priceSale !== '' && $priceSale !== null) 70 73 ? homlity_plugin_apply_filters('homlity_plugin_format_price', null, $priceSale, $currencySale) … … 72 75 ], 73 76 'price_rent' => [ 74 'label' => __('Arriendo', 'homlity-real-estate'),77 'label' => $priceLabels['rent'], 75 78 'value' => ($priceRent !== '' && $priceRent !== null) 76 79 ? homlity_plugin_apply_filters('homlity_plugin_format_price', null, $priceRent, $currencyRent) -
homlity-real-estate/trunk/vendor/autoload.php
r3729219 r3737527 23 23 require_once __DIR__ . '/composer/autoload_real.php'; 24 24 25 return ComposerAutoloaderInit 2634c38bb05d88eb3252b0a47e517ebb::getLoader();25 return ComposerAutoloaderInit9ed91c3af774bd98d27da333ef900c0a::getLoader(); -
homlity-real-estate/trunk/vendor/composer/autoload_psr4.php
r3729219 r3737527 9 9 'Svg\\' => array($vendorDir . '/dompdf/php-svg-lib/src/Svg'), 10 10 'Sabberworm\\CSS\\' => array($vendorDir . '/sabberworm/php-css-parser/src'), 11 'Psr\\Http\\Message\\' => array($vendorDir . '/psr/http- message/src', $vendorDir . '/psr/http-factory/src'),11 'Psr\\Http\\Message\\' => array($vendorDir . '/psr/http-factory/src', $vendorDir . '/psr/http-message/src'), 12 12 'Psr\\Http\\Client\\' => array($vendorDir . '/psr/http-client/src'), 13 13 'Masterminds\\' => array($vendorDir . '/masterminds/html5/src'), -
homlity-real-estate/trunk/vendor/composer/autoload_real.php
r3729219 r3737527 3 3 // autoload_real.php @generated by Composer 4 4 5 class ComposerAutoloaderInit 2634c38bb05d88eb3252b0a47e517ebb5 class ComposerAutoloaderInit9ed91c3af774bd98d27da333ef900c0a 6 6 { 7 7 private static $loader; … … 25 25 require __DIR__ . '/platform_check.php'; 26 26 27 spl_autoload_register(array('ComposerAutoloaderInit 2634c38bb05d88eb3252b0a47e517ebb', 'loadClassLoader'), true, true);27 spl_autoload_register(array('ComposerAutoloaderInit9ed91c3af774bd98d27da333ef900c0a', 'loadClassLoader'), true, true); 28 28 self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__)); 29 spl_autoload_unregister(array('ComposerAutoloaderInit 2634c38bb05d88eb3252b0a47e517ebb', 'loadClassLoader'));29 spl_autoload_unregister(array('ComposerAutoloaderInit9ed91c3af774bd98d27da333ef900c0a', 'loadClassLoader')); 30 30 31 31 require __DIR__ . '/autoload_static.php'; 32 call_user_func(\Composer\Autoload\ComposerStaticInit 2634c38bb05d88eb3252b0a47e517ebb::getInitializer($loader));32 call_user_func(\Composer\Autoload\ComposerStaticInit9ed91c3af774bd98d27da333ef900c0a::getInitializer($loader)); 33 33 34 34 $loader->register(true); 35 35 36 $filesToLoad = \Composer\Autoload\ComposerStaticInit 2634c38bb05d88eb3252b0a47e517ebb::$files;36 $filesToLoad = \Composer\Autoload\ComposerStaticInit9ed91c3af774bd98d27da333ef900c0a::$files; 37 37 $requireFile = \Closure::bind(static function ($fileIdentifier, $file) { 38 38 if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { -
homlity-real-estate/trunk/vendor/composer/autoload_static.php
r3729219 r3737527 5 5 namespace Composer\Autoload; 6 6 7 class ComposerStaticInit 2634c38bb05d88eb3252b0a47e517ebb7 class ComposerStaticInit9ed91c3af774bd98d27da333ef900c0a 8 8 { 9 9 public static $files = array ( … … 60 60 'Psr\\Http\\Message\\' => 61 61 array ( 62 0 => __DIR__ . '/..' . '/psr/http- message/src',63 1 => __DIR__ . '/..' . '/psr/http- factory/src',62 0 => __DIR__ . '/..' . '/psr/http-factory/src', 63 1 => __DIR__ . '/..' . '/psr/http-message/src', 64 64 ), 65 65 'Psr\\Http\\Client\\' => … … 670 670 { 671 671 return \Closure::bind(function () use ($loader) { 672 $loader->prefixLengthsPsr4 = ComposerStaticInit 2634c38bb05d88eb3252b0a47e517ebb::$prefixLengthsPsr4;673 $loader->prefixDirsPsr4 = ComposerStaticInit 2634c38bb05d88eb3252b0a47e517ebb::$prefixDirsPsr4;674 $loader->classMap = ComposerStaticInit 2634c38bb05d88eb3252b0a47e517ebb::$classMap;672 $loader->prefixLengthsPsr4 = ComposerStaticInit9ed91c3af774bd98d27da333ef900c0a::$prefixLengthsPsr4; 673 $loader->prefixDirsPsr4 = ComposerStaticInit9ed91c3af774bd98d27da333ef900c0a::$prefixDirsPsr4; 674 $loader->classMap = ComposerStaticInit9ed91c3af774bd98d27da333ef900c0a::$classMap; 675 675 676 676 }, null, ClassLoader::class);
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)