diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f19b3bd..fa131ae 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -25,7 +25,7 @@ jobs: MYSQL_ALLOW_EMPTY_PASSWORD: "yes" env: - PLUGIN_VERSION: 1.3.43 + PLUGIN_VERSION: 1.3.44 WP_PROJECT_TYPE: plugin WP_VERSION: latest WP_MULTISITE: 0 diff --git a/includes/lib/transifex-live-integration-hreflang.php b/includes/lib/transifex-live-integration-hreflang.php index dba0520..67adc62 100644 --- a/includes/lib/transifex-live-integration-hreflang.php +++ b/includes/lib/transifex-live-integration-hreflang.php @@ -126,7 +126,7 @@ public function render_hreflang() { return false; } global $wp; - $disable_canonical_urls = $this->settings['canonical_urls']; + $disable_canonical_urls = isset($this->settings['canonical_urls']) ? $this->settings['canonical_urls'] : false; $lang = get_query_var( 'lang' ); $url_path = add_query_arg( array(), $wp->request ); $source_url_path = (substr( $url_path, 0, strlen( $lang ) ) === $lang) ? substr( $url_path, strlen( $lang ), strlen( $url_path ) ) : $url_path; diff --git a/includes/lib/transifex-live-integration-picker.php b/includes/lib/transifex-live-integration-picker.php index 5fec285..cb2b8c0 100644 --- a/includes/lib/transifex-live-integration-picker.php +++ b/includes/lib/transifex-live-integration-picker.php @@ -72,7 +72,16 @@ function render() { $lang = get_query_var( 'lang' ); $home_url = home_url( $wp->request ); $url_path = add_query_arg( array(), $wp->request ); - $source_url_path = (substr($url_path, 0, strlen($lang) + 1) === $lang . '/') ? substr($url_path, strlen($lang) + 1) : $url_path; + + // If url contains the language prefix, make sure we don't remove it from url + // in this case return the url_path with e.g engagement => /engagement + // Otherwise remove the part from url string until the language prefix + // e.g el/sample_page =>sample_page + if (strpos($url_path, $lang ) !== false && $url_path !== $lang && strpos($url_path, $lang .'/' ) === false) { + $source_url_path = '/' . $url_path; + } else { + $source_url_path = (substr($url_path, 0, strlen($lang)) === $lang) ? substr($url_path, strlen($lang)) : $url_path; + } $url_map = Transifex_Live_Integration_Common::generate_language_url_map( $source_url_path, $this->tokenized_url, $this->language_map ); $site_url_slash_maybe = (new Transifex_Live_Integration_WP_Services())->get_site_url($this->is_subdirectory_install); $site_url = rtrim( $site_url_slash_maybe, '/' ) . '/'; diff --git a/readme.md b/readme.md index 22ce2d4..2808e01 100755 --- a/readme.md +++ b/readme.md @@ -69,6 +69,9 @@ Ex. $updated_content = apply_filters('tx_link', $original_content); * It is also recommended to use [widgets](https://codex.wordpress.org/Widgets_API) in your theme instead of custom code, since this allows you to make your integration more future proof against incompatibilities with 3rd party modules. == Changelog == += 1.3.44 = +Fix for language picker + = 1.3.43 = Fix for archive pages with customized slug diff --git a/readme.txt b/readme.txt index 634fab7..e1acfef 100755 --- a/readme.txt +++ b/readme.txt @@ -4,7 +4,7 @@ Contributors: txmatthew, ThemeBoy, brooksx Tags: transifex, localize, localization, multilingual, international, SEO Requires at least: 3.5.2 Tested up to: 6.5.3 -Stable tag: 1.3.43 +Stable tag: 1.3.44 License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html @@ -78,6 +78,9 @@ Ex. $updated_content = apply_filters('tx_link', $original_content); It is also recommended to use [widgets](https://codex.wordpress.org/Widgets_API) in your theme instead of custom code, since this allows you to make your integration more future proof against incompatibilities with 3rd party modules. == Changelog == += 1.3.44 = +Fix for language picker + = 1.3.43 = Fix for archive pages with customized slug diff --git a/transifex-live-integration-main.php b/transifex-live-integration-main.php index 179b7d1..5cf7102 100755 --- a/transifex-live-integration-main.php +++ b/transifex-live-integration-main.php @@ -22,6 +22,9 @@ static function do_plugin( $is_admin, $version ) { $settings = Transifex_Live_Integration_Defaults::settings(); } + if (!isset($settings['is_subdirectory_install'])) { + $settings['is_subdirectory_install'] = 0; + } $live_settings = Transifex_Live_Integration_Defaults::transifex_settings(); $debug_mode = ($settings['debug']) ? true : false; diff --git a/transifex-live-integration.php b/transifex-live-integration.php index 0d1d083..0282f4e 100755 --- a/transifex-live-integration.php +++ b/transifex-live-integration.php @@ -5,13 +5,13 @@ * * @link https://help.transifex.com/en/articles/6261241-wordpress * @package TransifexLiveIntegration - * @version 1.3.43 + * @version 1.3.44 * * @wordpress-plugin * Plugin Name: International SEO by Transifex * Plugin URI: https://help.transifex.com/en/articles/6261241-wordpress * Description: Translate your WordPress powered website using Transifex. - * Version: 1.3.43 + * Version: 1.3.44 * License: GNU General Public License * License URI: http://www.gnu.org/licenses/gpl-2.0.txt * Text Domain: transifex-live-integration @@ -75,7 +75,7 @@ } define( 'LANG_PARAM', 'lang' ); -$version = '1.3.43'; +$version = '1.3.44'; require_once( dirname( __FILE__ ) . '/transifex-live-integration-main.php' ); Transifex_Live_Integration::do_plugin( is_admin(), $version );