Changeset 3444552
- Timestamp:
- 01/22/2026 05:55:32 AM (4 weeks ago)
- Location:
- 404-solution
- Files:
-
- 10 edited
- 1 copied
-
tags/3.1.10 (copied) (copied from 404-solution/trunk)
-
tags/3.1.10/404-solution.php (modified) (1 diff)
-
tags/3.1.10/CHANGELOG.md (modified) (1 diff)
-
tags/3.1.10/README.md (modified) (1 diff)
-
tags/3.1.10/includes/PluginLogic.php (modified) (2 diffs)
-
tags/3.1.10/readme.txt (modified) (4 diffs)
-
trunk/404-solution.php (modified) (1 diff)
-
trunk/CHANGELOG.md (modified) (1 diff)
-
trunk/README.md (modified) (1 diff)
-
trunk/includes/PluginLogic.php (modified) (2 diffs)
-
trunk/readme.txt (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
404-solution/tags/3.1.10/404-solution.php
r3443087 r3444552 8 8 Author URI: https://www.ajexperience.com/404-solution/ 9 9 10 Version: 3.1. 910 Version: 3.1.10 11 11 Requires at least: 5.0 12 12 Requires PHP: 7.4 -
404-solution/tags/3.1.10/CHANGELOG.md
r3443087 r3444552 1 1 # Changelog # 2 3 ## Version 3.1.10 (Jan 21, 2026) ## 4 * Improvement: Add WPML and Polylang-aware redirect translation based on the request language. 2 5 3 6 ## Version 3.1.9 (Jan 20, 2026) ## -
404-solution/tags/3.1.10/README.md
r3443087 r3444552 81 81 ## Changelog ## 82 82 83 ## Version 3.1.10 (Jan 21, 2026) ## 84 * Improvement: Add WPML and Polylang-aware redirect translation based on the request language. 85 83 86 ## Version 3.1.9 (Jan 20, 2026) ## 84 87 * FIX: Manual and external redirects now store and match Unicode paths consistently. -
404-solution/tags/3.1.10/includes/PluginLogic.php
r3443087 r3444552 421 421 } 422 422 423 if ($translated === null || $translated === '') { 424 $translated = $this->wpmlRedirectUrl($location, $requestedURL); 425 if ($translated !== null && $translated !== '') { 426 $location = $translated; 427 } 428 } 429 430 if ($translated === null || $translated === '') { 431 $translated = $this->polylangRedirectUrl($location, $requestedURL); 432 if ($translated !== null && $translated !== '') { 433 $location = $translated; 434 } 435 } 436 423 437 // Allow other multilingual plugins/themes to override redirect destinations. 424 438 return apply_filters('abj404_translate_redirect_url', $location, $requestedURL); … … 483 497 if (function_exists('trp_get_current_language')) { 484 498 $language = trp_get_current_language(); 499 if (is_string($language) && $language !== '') { 500 return $language; 501 } 502 } 503 504 return ''; 505 } 506 507 private function wpmlRedirectUrl($location, $requestedURL) { 508 if (!$this->wpmlIntegrationAvailable()) { 509 return null; 510 } 511 512 if (!$this->isLocalUrl($location)) { 513 return null; 514 } 515 516 $language = $this->getWpmlLanguageFromRequest($requestedURL); 517 if ($language === '') { 518 return null; 519 } 520 521 $translated = $this->wpmlTranslateUrl($location, $language); 522 if (!is_string($translated) || $translated === '' || $translated === $location) { 523 return null; 524 } 525 526 if (!$this->isLocalUrl($translated)) { 527 return null; 528 } 529 530 return $translated; 531 } 532 533 private function wpmlIntegrationAvailable() { 534 return function_exists('wpml_current_language') || 535 has_filter('wpml_current_language') || 536 has_filter('wpml_language_from_url') || 537 has_filter('wpml_permalink'); 538 } 539 540 private function wpmlTranslateUrl($url, $language) { 541 if (has_filter('wpml_permalink')) { 542 return apply_filters('wpml_permalink', $url, $language); 543 } 544 545 return null; 546 } 547 548 private function getWpmlLanguageFromRequest($requestedURL) { 549 $fullRequestedUrl = $this->buildFullUrlFromRequest($requestedURL); 550 551 if (has_filter('wpml_language_from_url')) { 552 $language = apply_filters('wpml_language_from_url', '', $fullRequestedUrl); 553 if (is_string($language) && $language !== '') { 554 return $language; 555 } 556 } 557 558 if (function_exists('wpml_current_language')) { 559 $language = wpml_current_language(); 560 if (is_string($language) && $language !== '') { 561 return $language; 562 } 563 } 564 565 if (has_filter('wpml_current_language')) { 566 $language = apply_filters('wpml_current_language', null); 567 if (is_string($language) && $language !== '') { 568 return $language; 569 } 570 } 571 572 return ''; 573 } 574 575 private function polylangRedirectUrl($location, $requestedURL) { 576 if (!$this->polylangIntegrationAvailable()) { 577 return null; 578 } 579 580 if (!$this->isLocalUrl($location)) { 581 return null; 582 } 583 584 $language = $this->getPolylangLanguageFromRequest($requestedURL); 585 if ($language === '') { 586 return null; 587 } 588 589 $translated = $this->polylangTranslateUrl($location, $language); 590 if (!is_string($translated) || $translated === '' || $translated === $location) { 591 return null; 592 } 593 594 if (!$this->isLocalUrl($translated)) { 595 return null; 596 } 597 598 return $translated; 599 } 600 601 private function polylangIntegrationAvailable() { 602 return function_exists('pll_current_language') || 603 function_exists('pll_translate_url'); 604 } 605 606 private function polylangTranslateUrl($url, $language) { 607 if (function_exists('pll_translate_url')) { 608 return pll_translate_url($url, $language); 609 } 610 611 return null; 612 } 613 614 private function getPolylangLanguageFromRequest($requestedURL) { 615 if (function_exists('pll_current_language')) { 616 $language = pll_current_language(); 485 617 if (is_string($language) && $language !== '') { 486 618 return $language; -
404-solution/tags/3.1.10/readme.txt
r3443087 r3444552 6 6 Requires PHP: 7.4 7 7 Tested up to: 6.9 8 Stable tag: 3.1. 98 Stable tag: 3.1.10 9 9 License: GPL-3.0-or-later 10 10 License URI: https://www.gnu.org/licenses/gpl-3.0.html … … 38 38 * **Debug logging** to troubleshoot redirect behavior 39 39 * **Performance optimized** for sites with 10,000+ pages 40 * **Multilingual-friendly redirects** (TranslatePress, WPML, Polylang) to keep redirects in the request language 40 41 41 42 = How It Works = … … 111 112 **Important:** For very high-traffic sites with thousands of simultaneous users, disable "Create automatic redirects" and don't use the shortcode to ensure optimal performance. 112 113 114 = Does it work with WPML or Polylang? = 115 116 Yes. 404 Solution keeps redirects in the same language as the request when WPML or Polylang is active. TranslatePress is also supported. Language is detected using the multilingual plugin’s URL/language APIs, and the matched redirect destination is translated to that language without changing the matching logic. 117 113 118 = Does it work with WooCommerce? = 114 119 … … 237 242 238 243 == Changelog == 244 245 = Version 3.1.10 (Jan 21, 2026) = 246 * Improvement: Add WPML and Polylang-aware redirect translation based on the request language. 239 247 240 248 = Version 3.1.9 (Jan 20, 2026) = -
404-solution/trunk/404-solution.php
r3443087 r3444552 8 8 Author URI: https://www.ajexperience.com/404-solution/ 9 9 10 Version: 3.1. 910 Version: 3.1.10 11 11 Requires at least: 5.0 12 12 Requires PHP: 7.4 -
404-solution/trunk/CHANGELOG.md
r3443087 r3444552 1 1 # Changelog # 2 3 ## Version 3.1.10 (Jan 21, 2026) ## 4 * Improvement: Add WPML and Polylang-aware redirect translation based on the request language. 2 5 3 6 ## Version 3.1.9 (Jan 20, 2026) ## -
404-solution/trunk/README.md
r3443087 r3444552 81 81 ## Changelog ## 82 82 83 ## Version 3.1.10 (Jan 21, 2026) ## 84 * Improvement: Add WPML and Polylang-aware redirect translation based on the request language. 85 83 86 ## Version 3.1.9 (Jan 20, 2026) ## 84 87 * FIX: Manual and external redirects now store and match Unicode paths consistently. -
404-solution/trunk/includes/PluginLogic.php
r3443087 r3444552 421 421 } 422 422 423 if ($translated === null || $translated === '') { 424 $translated = $this->wpmlRedirectUrl($location, $requestedURL); 425 if ($translated !== null && $translated !== '') { 426 $location = $translated; 427 } 428 } 429 430 if ($translated === null || $translated === '') { 431 $translated = $this->polylangRedirectUrl($location, $requestedURL); 432 if ($translated !== null && $translated !== '') { 433 $location = $translated; 434 } 435 } 436 423 437 // Allow other multilingual plugins/themes to override redirect destinations. 424 438 return apply_filters('abj404_translate_redirect_url', $location, $requestedURL); … … 483 497 if (function_exists('trp_get_current_language')) { 484 498 $language = trp_get_current_language(); 499 if (is_string($language) && $language !== '') { 500 return $language; 501 } 502 } 503 504 return ''; 505 } 506 507 private function wpmlRedirectUrl($location, $requestedURL) { 508 if (!$this->wpmlIntegrationAvailable()) { 509 return null; 510 } 511 512 if (!$this->isLocalUrl($location)) { 513 return null; 514 } 515 516 $language = $this->getWpmlLanguageFromRequest($requestedURL); 517 if ($language === '') { 518 return null; 519 } 520 521 $translated = $this->wpmlTranslateUrl($location, $language); 522 if (!is_string($translated) || $translated === '' || $translated === $location) { 523 return null; 524 } 525 526 if (!$this->isLocalUrl($translated)) { 527 return null; 528 } 529 530 return $translated; 531 } 532 533 private function wpmlIntegrationAvailable() { 534 return function_exists('wpml_current_language') || 535 has_filter('wpml_current_language') || 536 has_filter('wpml_language_from_url') || 537 has_filter('wpml_permalink'); 538 } 539 540 private function wpmlTranslateUrl($url, $language) { 541 if (has_filter('wpml_permalink')) { 542 return apply_filters('wpml_permalink', $url, $language); 543 } 544 545 return null; 546 } 547 548 private function getWpmlLanguageFromRequest($requestedURL) { 549 $fullRequestedUrl = $this->buildFullUrlFromRequest($requestedURL); 550 551 if (has_filter('wpml_language_from_url')) { 552 $language = apply_filters('wpml_language_from_url', '', $fullRequestedUrl); 553 if (is_string($language) && $language !== '') { 554 return $language; 555 } 556 } 557 558 if (function_exists('wpml_current_language')) { 559 $language = wpml_current_language(); 560 if (is_string($language) && $language !== '') { 561 return $language; 562 } 563 } 564 565 if (has_filter('wpml_current_language')) { 566 $language = apply_filters('wpml_current_language', null); 567 if (is_string($language) && $language !== '') { 568 return $language; 569 } 570 } 571 572 return ''; 573 } 574 575 private function polylangRedirectUrl($location, $requestedURL) { 576 if (!$this->polylangIntegrationAvailable()) { 577 return null; 578 } 579 580 if (!$this->isLocalUrl($location)) { 581 return null; 582 } 583 584 $language = $this->getPolylangLanguageFromRequest($requestedURL); 585 if ($language === '') { 586 return null; 587 } 588 589 $translated = $this->polylangTranslateUrl($location, $language); 590 if (!is_string($translated) || $translated === '' || $translated === $location) { 591 return null; 592 } 593 594 if (!$this->isLocalUrl($translated)) { 595 return null; 596 } 597 598 return $translated; 599 } 600 601 private function polylangIntegrationAvailable() { 602 return function_exists('pll_current_language') || 603 function_exists('pll_translate_url'); 604 } 605 606 private function polylangTranslateUrl($url, $language) { 607 if (function_exists('pll_translate_url')) { 608 return pll_translate_url($url, $language); 609 } 610 611 return null; 612 } 613 614 private function getPolylangLanguageFromRequest($requestedURL) { 615 if (function_exists('pll_current_language')) { 616 $language = pll_current_language(); 485 617 if (is_string($language) && $language !== '') { 486 618 return $language; -
404-solution/trunk/readme.txt
r3443087 r3444552 6 6 Requires PHP: 7.4 7 7 Tested up to: 6.9 8 Stable tag: 3.1. 98 Stable tag: 3.1.10 9 9 License: GPL-3.0-or-later 10 10 License URI: https://www.gnu.org/licenses/gpl-3.0.html … … 38 38 * **Debug logging** to troubleshoot redirect behavior 39 39 * **Performance optimized** for sites with 10,000+ pages 40 * **Multilingual-friendly redirects** (TranslatePress, WPML, Polylang) to keep redirects in the request language 40 41 41 42 = How It Works = … … 111 112 **Important:** For very high-traffic sites with thousands of simultaneous users, disable "Create automatic redirects" and don't use the shortcode to ensure optimal performance. 112 113 114 = Does it work with WPML or Polylang? = 115 116 Yes. 404 Solution keeps redirects in the same language as the request when WPML or Polylang is active. TranslatePress is also supported. Language is detected using the multilingual plugin’s URL/language APIs, and the matched redirect destination is translated to that language without changing the matching logic. 117 113 118 = Does it work with WooCommerce? = 114 119 … … 237 242 238 243 == Changelog == 244 245 = Version 3.1.10 (Jan 21, 2026) = 246 * Improvement: Add WPML and Polylang-aware redirect translation based on the request language. 239 247 240 248 = Version 3.1.9 (Jan 20, 2026) =
Note: See TracChangeset
for help on using the changeset viewer.