Version Description
- Added support for All In One SEO
- Added compatibility with Peepso double slashing translated links
- Add option in Advanced tab to disable translated links in sitemap
- Add options to disable post container tags in Advanced Tab.
- Organize Advanced Tabs by categories.
- Fix an error regarding the settings class in class-languages.php
- Fixed a filter in the trp_curpageurl() function
- Fix fatal error thrown when trying to access the global while it's null in some cases
- Fixed x-default from advanced not working as expected
Download this release
Release Info
| Developer | madalin.ungureanu |
| Plugin | |
| Version | 1.6.8 |
| Comparing to | |
| See all releases | |
Code changes from version 1.6.7 to 1.6.8
- assets/css/trp-back-end-style.css +4 -0
- class-translate-press.php +2 -1
- includes/advanced-settings/disable-languages-sitemap.php +21 -0
- includes/advanced-settings/disable-post-container-tags.php +48 -0
- includes/advanced-settings/enable-auto-translate-slug.php +1 -1
- includes/advanced-settings/enable-hreflang-xdefault.php +1 -1
- includes/advanced-settings/separators.php +42 -0
- includes/class-advanced-tab.php +28 -3
- includes/class-languages.php +6 -0
- includes/class-translation-render.php +11 -3
- includes/class-url-converter.php +5 -4
- includes/compatibility-functions.php +21 -0
- index.php +1 -1
- languages/translatepress-multilingual.catalog.php +10 -0
- languages/translatepress-multilingual.pot +45 -5
- partials/advanced-settings-page.php +5 -0
- readme.txt +12 -1
assets/css/trp-back-end-style.css
CHANGED
|
@@ -182,4 +182,8 @@ table.trp-adst-list-option th{
|
|
| 182 |
}
|
| 183 |
.trp-adst-radio .description{
|
| 184 |
margin-top: 2em;
|
|
|
|
|
|
|
|
|
|
|
|
|
| 185 |
}
|
| 182 |
}
|
| 183 |
.trp-adst-radio .description{
|
| 184 |
margin-top: 2em;
|
| 185 |
+
}
|
| 186 |
+
#trp_advanced_tab_content_table{
|
| 187 |
+
margin-top: 25px;
|
| 188 |
+
font-size: 15px;
|
| 189 |
}
|
class-translate-press.php
CHANGED
|
@@ -53,7 +53,7 @@ class TRP_Translate_Press{
|
|
| 53 |
define( 'TRP_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
|
| 54 |
define( 'TRP_PLUGIN_BASE', plugin_basename( __DIR__ . '/index.php' ) );
|
| 55 |
define( 'TRP_PLUGIN_SLUG', 'translatepress-multilingual' );
|
| 56 |
-
define( 'TRP_PLUGIN_VERSION', '1.6.
|
| 57 |
|
| 58 |
wp_cache_add_non_persistent_groups(array('trp'));
|
| 59 |
|
|
@@ -185,6 +185,7 @@ class TRP_Translate_Press{
|
|
| 185 |
$this->loader->add_action( 'trp_settings_tabs', $this->advanced_tab, 'add_advanced_tab_to_settings', 10, 1 );
|
| 186 |
$this->loader->add_action( 'admin_menu', $this->advanced_tab, 'add_submenu_page_advanced' );
|
| 187 |
$this->loader->add_action( 'trp_output_advanced_settings_options', $this->advanced_tab, 'output_advanced_options' );
|
|
|
|
| 188 |
$this->loader->add_action( 'admin_init', $this->advanced_tab, 'register_setting' );
|
| 189 |
$this->loader->add_action( 'admin_notices', $this->advanced_tab, 'admin_notices' );
|
| 190 |
|
| 53 |
define( 'TRP_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
|
| 54 |
define( 'TRP_PLUGIN_BASE', plugin_basename( __DIR__ . '/index.php' ) );
|
| 55 |
define( 'TRP_PLUGIN_SLUG', 'translatepress-multilingual' );
|
| 56 |
+
define( 'TRP_PLUGIN_VERSION', '1.6.8' );
|
| 57 |
|
| 58 |
wp_cache_add_non_persistent_groups(array('trp'));
|
| 59 |
|
| 185 |
$this->loader->add_action( 'trp_settings_tabs', $this->advanced_tab, 'add_advanced_tab_to_settings', 10, 1 );
|
| 186 |
$this->loader->add_action( 'admin_menu', $this->advanced_tab, 'add_submenu_page_advanced' );
|
| 187 |
$this->loader->add_action( 'trp_output_advanced_settings_options', $this->advanced_tab, 'output_advanced_options' );
|
| 188 |
+
$this->loader->add_action( 'trp_before_output_advanced_settings_options', $this->advanced_tab, 'trp_advanced_settings_content_table' );
|
| 189 |
$this->loader->add_action( 'admin_init', $this->advanced_tab, 'register_setting' );
|
| 190 |
$this->loader->add_action( 'admin_notices', $this->advanced_tab, 'admin_notices' );
|
| 191 |
|
includes/advanced-settings/disable-languages-sitemap.php
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
add_filter( 'trp_register_advanced_settings', 'trp_register_disable_languages_sitemap', 1090);
|
| 3 |
+
function trp_register_disable_languages_sitemap( $settings_array ){
|
| 4 |
+
$settings_array[] = array(
|
| 5 |
+
'name' => 'disable_languages_sitemap',
|
| 6 |
+
'type' => 'checkbox',
|
| 7 |
+
'label' => esc_html__( 'Exclude translated links from sitemap', 'translatepress-multilingual' ),
|
| 8 |
+
'description' => wp_kses( __( 'Do not include translated links in sitemaps generated by SEO plugins.<br/>Requires <a href="https://translatepress.com/docs/addons/seo-pack/" title="TranslatePress Add-on SEO Pack documentation" target="_blank"> SEO Pack Add-on</a> to be installed and activated.', 'translatepress-multilingual' ), array( 'br' => array(), 'a' => array( 'href' => array(), 'title' => array(), 'target' => array() ) ) ),
|
| 9 |
+
);
|
| 10 |
+
return $settings_array;
|
| 11 |
+
}
|
| 12 |
+
|
| 13 |
+
add_filter('trp_disable_languages_sitemap', 'trp_disable_languages_sitemap_function');
|
| 14 |
+
function trp_disable_languages_sitemap_function($allow) {
|
| 15 |
+
|
| 16 |
+
$option = get_option( 'trp_advanced_settings', true );
|
| 17 |
+
if ( isset( $option['disable_languages_sitemap'] ) && $option['disable_languages_sitemap'] === 'yes' ) {
|
| 18 |
+
return true;
|
| 19 |
+
}
|
| 20 |
+
return $allow;
|
| 21 |
+
}
|
includes/advanced-settings/disable-post-container-tags.php
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/** Post title */
|
| 4 |
+
add_filter( 'trp_register_advanced_settings', 'trp_register_disable_post_container_tags_for_post_title', 510 );
|
| 5 |
+
function trp_register_disable_post_container_tags_for_post_title( $settings_array ){
|
| 6 |
+
$settings_array[] = array(
|
| 7 |
+
'name' => 'disable_post_container_tags_for_post_title',
|
| 8 |
+
'type' => 'checkbox',
|
| 9 |
+
'label' => esc_html__( 'Disable post container tags for post title', 'translatepress-multilingual' ),
|
| 10 |
+
'description' => wp_kses( __( 'It disables search indexing the post title in translated languages.<br/>Useful when the title of the post doesn\'t allow HTML thus breaking the page.', 'translatepress-multilingual' ), array( 'br' => array() ) ),
|
| 11 |
+
);
|
| 12 |
+
return $settings_array;
|
| 13 |
+
}
|
| 14 |
+
|
| 15 |
+
add_filter( 'trp_before_running_hooks', 'trp_remove_hooks_to_disable_post_title_search_wraps' );
|
| 16 |
+
function trp_remove_hooks_to_disable_post_title_search_wraps( $trp_loader ){
|
| 17 |
+
$option = get_option( 'trp_advanced_settings', true );
|
| 18 |
+
if ( isset( $option['disable_post_container_tags_for_post_title'] ) && $option['disable_post_container_tags_for_post_title'] === 'yes' ) {
|
| 19 |
+
$trp = TRP_Translate_Press::get_trp_instance();
|
| 20 |
+
$translation_render = $trp->get_component( 'translation_render' );
|
| 21 |
+
$trp_loader->remove_hook( 'the_title', 'wrap_with_post_id', $translation_render );
|
| 22 |
+
}
|
| 23 |
+
}
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
/** Post content */
|
| 27 |
+
add_filter( 'trp_register_advanced_settings', 'trp_register_disable_post_container_tags_for_post_content', 520 );
|
| 28 |
+
function trp_register_disable_post_container_tags_for_post_content( $settings_array ){
|
| 29 |
+
$settings_array[] = array(
|
| 30 |
+
'name' => 'disable_post_container_tags_for_post_content',
|
| 31 |
+
'type' => 'checkbox',
|
| 32 |
+
'label' => esc_html__( 'Disable post container tags for post content', 'translatepress-multilingual' ),
|
| 33 |
+
'description' => wp_kses( __( 'It disables search indexing the post content in translated languages.<br/>Useful when the content of the post doesn\'t allow HTML thus breaking the page.', 'translatepress-multilingual' ), array( 'br' => array() ) ),
|
| 34 |
+
);
|
| 35 |
+
return $settings_array;
|
| 36 |
+
}
|
| 37 |
+
|
| 38 |
+
add_filter( 'trp_before_running_hooks', 'trp_remove_hooks_to_disable_post_content_search_wraps' );
|
| 39 |
+
function trp_remove_hooks_to_disable_post_content_search_wraps( $trp_loader ){
|
| 40 |
+
$option = get_option( 'trp_advanced_settings', true );
|
| 41 |
+
if ( isset( $option['disable_post_container_tags_for_post_content'] ) && $option['disable_post_container_tags_for_post_content'] === 'yes' ) {
|
| 42 |
+
$trp = TRP_Translate_Press::get_trp_instance();
|
| 43 |
+
$translation_render = $trp->get_component( 'translation_render' );
|
| 44 |
+
$trp_loader->remove_hook( 'the_content', 'wrap_with_post_id', $translation_render );
|
| 45 |
+
}
|
| 46 |
+
}
|
| 47 |
+
|
| 48 |
+
|
includes/advanced-settings/enable-auto-translate-slug.php
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
<?php
|
| 2 |
|
| 3 |
-
add_filter( 'trp_register_advanced_settings', 'trp_register_enable_auto_translate_slug',
|
| 4 |
function trp_register_enable_auto_translate_slug( $settings_array ){
|
| 5 |
$settings_array[] = array(
|
| 6 |
'name' => 'enable_auto_translate_slug',
|
| 1 |
<?php
|
| 2 |
|
| 3 |
+
add_filter( 'trp_register_advanced_settings', 'trp_register_enable_auto_translate_slug', 1080 );
|
| 4 |
function trp_register_enable_auto_translate_slug( $settings_array ){
|
| 5 |
$settings_array[] = array(
|
| 6 |
'name' => 'enable_auto_translate_slug',
|
includes/advanced-settings/enable-hreflang-xdefault.php
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
<?php
|
| 2 |
-
add_filter( 'trp_register_advanced_settings', 'trp_register_enable_hreflang_xdefault',
|
| 3 |
function trp_register_enable_hreflang_xdefault( $settings_array ){
|
| 4 |
$settings_array[] = array(
|
| 5 |
'name' => 'enable_hreflang_xdefault',
|
| 1 |
<?php
|
| 2 |
+
add_filter( 'trp_register_advanced_settings', 'trp_register_enable_hreflang_xdefault', 1100 );
|
| 3 |
function trp_register_enable_hreflang_xdefault( $settings_array ){
|
| 4 |
$settings_array[] = array(
|
| 5 |
'name' => 'enable_hreflang_xdefault',
|
includes/advanced-settings/separators.php
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
add_filter( 'trp_register_advanced_settings', 'trp_register_troubleshoot_separator', 5 );
|
| 4 |
+
function trp_register_troubleshoot_separator( $settings_array ){
|
| 5 |
+
$settings_array[] = array(
|
| 6 |
+
'name' => 'troubleshoot_options',
|
| 7 |
+
'type' => 'separator',
|
| 8 |
+
'label' => esc_html__( 'Troubleshooting', 'translatepress-multilingual' ),
|
| 9 |
+
'no-border' => true
|
| 10 |
+
);
|
| 11 |
+
return $settings_array;
|
| 12 |
+
}
|
| 13 |
+
|
| 14 |
+
add_filter( 'trp_register_advanced_settings', 'trp_register_exclude_separator', 95 );
|
| 15 |
+
function trp_register_exclude_separator( $settings_array ){
|
| 16 |
+
$settings_array[] = array(
|
| 17 |
+
'name' => 'exclude_strings',
|
| 18 |
+
'type' => 'separator',
|
| 19 |
+
'label' => esc_html__( 'Exclude strings', 'translatepress-multilingual' )
|
| 20 |
+
);
|
| 21 |
+
return $settings_array;
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
add_filter( 'trp_register_advanced_settings', 'trp_register_debug_separator', 500 );
|
| 25 |
+
function trp_register_debug_separator( $settings_array ){
|
| 26 |
+
$settings_array[] = array(
|
| 27 |
+
'name' => 'debug_options',
|
| 28 |
+
'type' => 'separator',
|
| 29 |
+
'label' => esc_html__( 'Debug', 'translatepress-multilingual' )
|
| 30 |
+
);
|
| 31 |
+
return $settings_array;
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
add_filter( 'trp_register_advanced_settings', 'trp_register_miscellaneous_separator', 1000 );
|
| 35 |
+
function trp_register_miscellaneous_separator( $settings_array ){
|
| 36 |
+
$settings_array[] = array(
|
| 37 |
+
'name' => 'miscellaneous_options',
|
| 38 |
+
'type' => 'separator',
|
| 39 |
+
'label' => esc_html__( 'Miscellaneous options', 'translatepress-multilingual' )
|
| 40 |
+
);
|
| 41 |
+
return $settings_array;
|
| 42 |
+
}
|
includes/class-advanced-tab.php
CHANGED
|
@@ -156,6 +156,9 @@ class TRP_Advanced_Tab {
|
|
| 156 |
include_once(TRP_PLUGIN_DIR . 'includes/advanced-settings/strip-gettext-post-content.php');
|
| 157 |
include_once(TRP_PLUGIN_DIR . 'includes/advanced-settings/strip-gettext-post-meta.php');
|
| 158 |
include_once(TRP_PLUGIN_DIR . 'includes/advanced-settings/exclude-words-from-auto-translate.php');
|
|
|
|
|
|
|
|
|
|
| 159 |
}
|
| 160 |
|
| 161 |
/*
|
|
@@ -166,8 +169,26 @@ class TRP_Advanced_Tab {
|
|
| 166 |
}
|
| 167 |
|
| 168 |
/*
|
| 169 |
-
* Hooked to
|
| 170 |
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 171 |
public function output_advanced_options(){
|
| 172 |
$advanced_settings_array = $this->get_registered_advanced_settings();
|
| 173 |
foreach( $advanced_settings_array as $setting ){
|
|
@@ -327,11 +348,15 @@ class TRP_Advanced_Tab {
|
|
| 327 |
* @return 'string'
|
| 328 |
*/
|
| 329 |
public function separator_setting( $setting ){
|
| 330 |
-
$html = "
|
| 331 |
-
|
|
|
|
|
|
|
| 332 |
<th scope='row'></th>
|
| 333 |
<td></td>
|
| 334 |
</tr>";
|
|
|
|
|
|
|
| 335 |
return apply_filters('trp_advanced_setting_separator', $html );
|
| 336 |
}
|
| 337 |
|
| 156 |
include_once(TRP_PLUGIN_DIR . 'includes/advanced-settings/strip-gettext-post-content.php');
|
| 157 |
include_once(TRP_PLUGIN_DIR . 'includes/advanced-settings/strip-gettext-post-meta.php');
|
| 158 |
include_once(TRP_PLUGIN_DIR . 'includes/advanced-settings/exclude-words-from-auto-translate.php');
|
| 159 |
+
include_once(TRP_PLUGIN_DIR . 'includes/advanced-settings/disable-post-container-tags.php');
|
| 160 |
+
include_once(TRP_PLUGIN_DIR . 'includes/advanced-settings/separators.php');
|
| 161 |
+
include_once(TRP_PLUGIN_DIR . 'includes/advanced-settings/disable-languages-sitemap.php');
|
| 162 |
}
|
| 163 |
|
| 164 |
/*
|
| 169 |
}
|
| 170 |
|
| 171 |
/*
|
| 172 |
+
* Hooked to trp_before_output_advanced_settings_options
|
| 173 |
*/
|
| 174 |
+
function trp_advanced_settings_content_table(){
|
| 175 |
+
$advanced_settings_array = $this->get_registered_advanced_settings();
|
| 176 |
+
$html = '<p id="trp_advanced_tab_content_table">';
|
| 177 |
+
foreach( $advanced_settings_array as $setting ){
|
| 178 |
+
if ( $setting['type'] !== 'separator' ){
|
| 179 |
+
continue;
|
| 180 |
+
}
|
| 181 |
+
$html .= '<a class="trp_advanced_tab_content_table_item" href="#' . $setting['name'] . '">' . $setting['label'] . '</a> | ';
|
| 182 |
+
}
|
| 183 |
+
$html = rtrim($html, " | ");
|
| 184 |
+
$html .= '</p>';
|
| 185 |
+
echo $html;
|
| 186 |
+
}
|
| 187 |
+
|
| 188 |
+
|
| 189 |
+
/*
|
| 190 |
+
* Hooked to trp_settings_navigation_tabs
|
| 191 |
+
*/
|
| 192 |
public function output_advanced_options(){
|
| 193 |
$advanced_settings_array = $this->get_registered_advanced_settings();
|
| 194 |
foreach( $advanced_settings_array as $setting ){
|
| 348 |
* @return 'string'
|
| 349 |
*/
|
| 350 |
public function separator_setting( $setting ){
|
| 351 |
+
$html = "";
|
| 352 |
+
if ( !isset( $setting['no-border'] ) || $setting['no-border'] !== true ) {
|
| 353 |
+
$html .= "
|
| 354 |
+
<tr id='" . $setting['name'] . "' style='border-bottom: 1px solid #ccc;' >
|
| 355 |
<th scope='row'></th>
|
| 356 |
<td></td>
|
| 357 |
</tr>";
|
| 358 |
+
}
|
| 359 |
+
$html .="<tr><td><h2>" . $setting['label'] . "<h2></td></tr>";
|
| 360 |
return apply_filters('trp_advanced_setting_separator', $html );
|
| 361 |
}
|
| 362 |
|
includes/class-languages.php
CHANGED
|
@@ -43,6 +43,12 @@ class TRP_Languages{
|
|
| 43 |
$this->is_admin_request= $trp_is_admin_request->is_admin_request();
|
| 44 |
}
|
| 45 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 46 |
if ( $this->is_admin_request )
|
| 47 |
return $locale;
|
| 48 |
|
| 43 |
$this->is_admin_request= $trp_is_admin_request->is_admin_request();
|
| 44 |
}
|
| 45 |
|
| 46 |
+
if ( !$this->settings ){
|
| 47 |
+
$trp = TRP_Translate_Press::get_trp_instance();
|
| 48 |
+
$trp_settings = $trp->get_component( 'settings' );
|
| 49 |
+
$this->settings = $trp_settings->get_settings();
|
| 50 |
+
}
|
| 51 |
+
|
| 52 |
if ( $this->is_admin_request )
|
| 53 |
return $locale;
|
| 54 |
|
includes/class-translation-render.php
CHANGED
|
@@ -320,10 +320,18 @@ class TRP_Translation_Render{
|
|
| 320 |
$this->url_converter = $trp->get_component('url_converter');
|
| 321 |
}
|
| 322 |
|
|
|
|
| 323 |
/* make sure we only translate on the rest_prepare_$post_type filter in REST requests and not the whole json */
|
| 324 |
-
|
| 325 |
-
|
| 326 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 327 |
}
|
| 328 |
|
| 329 |
global $TRP_LANGUAGE;
|
| 320 |
$this->url_converter = $trp->get_component('url_converter');
|
| 321 |
}
|
| 322 |
|
| 323 |
+
|
| 324 |
/* make sure we only translate on the rest_prepare_$post_type filter in REST requests and not the whole json */
|
| 325 |
+
|
| 326 |
+
/* in certain cases $wp_rewrite is null, so it trows a fatal error. This is just a quick fix. The actual issue is probably in WordPress core
|
| 327 |
+
* see taskid #2pjped
|
| 328 |
+
*/
|
| 329 |
+
global $wp_rewrite;
|
| 330 |
+
if( is_object($wp_rewrite) ) {
|
| 331 |
+
if( strpos( $this->url_converter->cur_page_url(), get_rest_url() ) !== false && strpos( current_filter(), 'rest_prepare_' ) !== 0){
|
| 332 |
+
$trpremoved = $this->remove_trp_html_tags( $output );
|
| 333 |
+
return $trpremoved;
|
| 334 |
+
}
|
| 335 |
}
|
| 336 |
|
| 337 |
global $TRP_LANGUAGE;
|
includes/class-url-converter.php
CHANGED
|
@@ -110,7 +110,8 @@ class TRP_Url_Converter {
|
|
| 110 |
strpos($path, '.xml') !== false &&
|
| 111 |
!in_array( 'wpseo_sitemap_url', $wp_current_filter ) &&
|
| 112 |
!in_array( 'seopress_sitemaps_url', $wp_current_filter ) &&
|
| 113 |
-
!in_array( 'rank_math/sitemap/url', $wp_current_filter )
|
|
|
|
| 114 |
){
|
| 115 |
return true;
|
| 116 |
}
|
|
@@ -140,8 +141,8 @@ class TRP_Url_Converter {
|
|
| 140 |
echo '<link rel="alternate" hreflang="' . esc_attr( $hreflang ). '" href="' . esc_url( $this->get_url_for_language( $language ) ) . '"/>' . "\n";
|
| 141 |
}
|
| 142 |
|
| 143 |
-
if( isset($this->settings['
|
| 144 |
-
$default_lang = $this->settings['
|
| 145 |
echo '<link rel="alternate" hreflang="x-default" href="' . esc_url( $this->get_url_for_language( $default_lang ) ) . '"/>' . "\n";
|
| 146 |
}
|
| 147 |
}
|
|
@@ -540,7 +541,7 @@ class TRP_Url_Converter {
|
|
| 540 |
$req_uri = trim($this->get_abs_home(), '/') . '/' . ltrim( $req_uri, '/' );
|
| 541 |
|
| 542 |
|
| 543 |
-
if ( function_exists('apply_filters') ) $
|
| 544 |
wp_cache_set('cur_page_url', $req_uri, 'trp');
|
| 545 |
return $req_uri;
|
| 546 |
}
|
| 110 |
strpos($path, '.xml') !== false &&
|
| 111 |
!in_array( 'wpseo_sitemap_url', $wp_current_filter ) &&
|
| 112 |
!in_array( 'seopress_sitemaps_url', $wp_current_filter ) &&
|
| 113 |
+
!in_array( 'rank_math/sitemap/url', $wp_current_filter )&&
|
| 114 |
+
!in_array( 'aiosp_sitemap_data', $wp_current_filter )
|
| 115 |
){
|
| 116 |
return true;
|
| 117 |
}
|
| 141 |
echo '<link rel="alternate" hreflang="' . esc_attr( $hreflang ). '" href="' . esc_url( $this->get_url_for_language( $language ) ) . '"/>' . "\n";
|
| 142 |
}
|
| 143 |
|
| 144 |
+
if( isset($this->settings['trp_advanced_settings']['enable_hreflang_xdefault']) && $this->settings['trp_advanced_settings']['enable_hreflang_xdefault'] != 'disabled' ){
|
| 145 |
+
$default_lang = $this->settings['trp_advanced_settings']['enable_hreflang_xdefault'];
|
| 146 |
echo '<link rel="alternate" hreflang="x-default" href="' . esc_url( $this->get_url_for_language( $default_lang ) ) . '"/>' . "\n";
|
| 147 |
}
|
| 148 |
}
|
| 541 |
$req_uri = trim($this->get_abs_home(), '/') . '/' . ltrim( $req_uri, '/' );
|
| 542 |
|
| 543 |
|
| 544 |
+
if ( function_exists('apply_filters') ) $req_uri = apply_filters('trp_curpageurl', $req_uri);
|
| 545 |
wp_cache_set('cur_page_url', $req_uri, 'trp');
|
| 546 |
return $req_uri;
|
| 547 |
}
|
includes/compatibility-functions.php
CHANGED
|
@@ -116,6 +116,25 @@ function trp_use_home_url_in_peepso_ajax( $data ){
|
|
| 116 |
return $data;
|
| 117 |
}
|
| 118 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 119 |
/**
|
| 120 |
* Filter ginger_iframe_banner and ginger_text_banner to use shortcodes so our conditional lang shortcode works.
|
| 121 |
*
|
|
@@ -522,3 +541,5 @@ function trp_woo_fondy_payment_gateway_exclude_gettext_strings($translation, $te
|
|
| 522 |
}
|
| 523 |
return $translation;
|
| 524 |
}
|
|
|
|
|
|
| 116 |
return $data;
|
| 117 |
}
|
| 118 |
|
| 119 |
+
/**
|
| 120 |
+
* Compatibility with Peepso urls having extra / due their link builder not considering home urls having trailing slashes
|
| 121 |
+
*/
|
| 122 |
+
add_filter('peepso_get_page', 'trp_remove_peepso_double_slash', 10, 2);
|
| 123 |
+
function trp_remove_peepso_double_slash( $page, $name){
|
| 124 |
+
|
| 125 |
+
// avoid accidentally replacing // from http://
|
| 126 |
+
$page = str_replace('http://', 'http:/', $page );
|
| 127 |
+
$page = str_replace('https://', 'https:/', $page );
|
| 128 |
+
|
| 129 |
+
$page = str_replace('//', '/', $page );
|
| 130 |
+
|
| 131 |
+
// place it back
|
| 132 |
+
$page = str_replace('https:/', 'https://', $page );
|
| 133 |
+
$page = str_replace('http:/', 'http://', $page );
|
| 134 |
+
|
| 135 |
+
return $page;
|
| 136 |
+
};
|
| 137 |
+
|
| 138 |
/**
|
| 139 |
* Filter ginger_iframe_banner and ginger_text_banner to use shortcodes so our conditional lang shortcode works.
|
| 140 |
*
|
| 541 |
}
|
| 542 |
return $translation;
|
| 543 |
}
|
| 544 |
+
|
| 545 |
+
|
index.php
CHANGED
|
@@ -3,7 +3,7 @@
|
|
| 3 |
Plugin Name: TranslatePress - Multilingual
|
| 4 |
Plugin URI: https://translatepress.com/
|
| 5 |
Description: Experience a better way of translating your WordPress site using a visual front-end translation editor, with full support for WooCommerce and site builders.
|
| 6 |
-
Version: 1.6.
|
| 7 |
Author: Cozmoslabs, Razvan Mocanu, Madalin Ungureanu, Cristophor Hurduban
|
| 8 |
Author URI: https://cozmoslabs.com/
|
| 9 |
Text Domain: translatepress-multilingual
|
| 3 |
Plugin Name: TranslatePress - Multilingual
|
| 4 |
Plugin URI: https://translatepress.com/
|
| 5 |
Description: Experience a better way of translating your WordPress site using a visual front-end translation editor, with full support for WooCommerce and site builders.
|
| 6 |
+
Version: 1.6.8
|
| 7 |
Author: Cozmoslabs, Razvan Mocanu, Madalin Ungureanu, Cristophor Hurduban
|
| 8 |
Author URI: https://cozmoslabs.com/
|
| 9 |
Text Domain: translatepress-multilingual
|
languages/translatepress-multilingual.catalog.php
CHANGED
|
@@ -257,6 +257,12 @@
|
|
| 257 |
<?php __("Allow this user to translate the website.", "translatepress-multilingual"); ?>
|
| 258 |
<?php __("Disable dynamic translation", "translatepress-multilingual"); ?>
|
| 259 |
<?php __("It disables detection of strings displayed dynamically using JavaScript. <br/>Strings loaded via a server side AJAX call will still be translated.", "translatepress-multilingual"); ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 260 |
<?php __("Automatically translate slugs", "translatepress-multilingual"); ?>
|
| 261 |
<?php __("Generate automatic translations of slugs for posts, pages and Custom Post Types.<br/>Requires <a href=\"https://translatepress.com/docs/addons/seo-pack/\" title=\"TranslatePress Add-on SEO Pack documentation\" target=\"_blank\"> SEO Pack Add-on</a> to be installed and activated.", "translatepress-multilingual"); ?>
|
| 262 |
<?php __("Enable the hreflang x-default tag for language:", "translatepress-multilingual"); ?>
|
|
@@ -277,6 +283,10 @@
|
|
| 277 |
<?php __("General attempt to fix broken or missing HTML on translated pages.<br/><strong>Only try this if the \"Fix spaces between html attribute\" did not solve the issue.</strong>", "translatepress-multilingual"); ?>
|
| 278 |
<?php __("Fix spaces between HTML attributes", "translatepress-multilingual"); ?>
|
| 279 |
<?php __("Fixes attributes without spaces between them because they are not valid HTML.<br> May help fix missing or broken content from the HTML on translated pages.", "translatepress-multilingual"); ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
| 280 |
<?php __("Fix missing dynamic content", "translatepress-multilingual"); ?>
|
| 281 |
<?php __("May help fix missing content inserted using JavaScript. <br> It shows dynamically inserted content in original language for a moment before the translation request is finished.", "translatepress-multilingual"); ?>
|
| 282 |
<?php __("Filter Gettext wrapping from post content and title", "translatepress-multilingual"); ?>
|
| 257 |
<?php __("Allow this user to translate the website.", "translatepress-multilingual"); ?>
|
| 258 |
<?php __("Disable dynamic translation", "translatepress-multilingual"); ?>
|
| 259 |
<?php __("It disables detection of strings displayed dynamically using JavaScript. <br/>Strings loaded via a server side AJAX call will still be translated.", "translatepress-multilingual"); ?>
|
| 260 |
+
<?php __("Exclude translated links from sitemap", "translatepress-multilingual"); ?>
|
| 261 |
+
<?php __("Do not include translated links in sitemaps generated by SEO plugins.<br/>Requires <a href=\"https://translatepress.com/docs/addons/seo-pack/\" title=\"TranslatePress Add-on SEO Pack documentation\" target=\"_blank\"> SEO Pack Add-on</a> to be installed and activated.", "translatepress-multilingual"); ?>
|
| 262 |
+
<?php __("Disable post container tags for post title", "translatepress-multilingual"); ?>
|
| 263 |
+
<?php __("It disables search indexing the post title in translated languages.<br/>Useful when the title of the post doesn't allow HTML thus breaking the page.", "translatepress-multilingual"); ?>
|
| 264 |
+
<?php __("Disable post container tags for post content", "translatepress-multilingual"); ?>
|
| 265 |
+
<?php __("It disables search indexing the post content in translated languages.<br/>Useful when the content of the post doesn't allow HTML thus breaking the page.", "translatepress-multilingual"); ?>
|
| 266 |
<?php __("Automatically translate slugs", "translatepress-multilingual"); ?>
|
| 267 |
<?php __("Generate automatic translations of slugs for posts, pages and Custom Post Types.<br/>Requires <a href=\"https://translatepress.com/docs/addons/seo-pack/\" title=\"TranslatePress Add-on SEO Pack documentation\" target=\"_blank\"> SEO Pack Add-on</a> to be installed and activated.", "translatepress-multilingual"); ?>
|
| 268 |
<?php __("Enable the hreflang x-default tag for language:", "translatepress-multilingual"); ?>
|
| 283 |
<?php __("General attempt to fix broken or missing HTML on translated pages.<br/><strong>Only try this if the \"Fix spaces between html attribute\" did not solve the issue.</strong>", "translatepress-multilingual"); ?>
|
| 284 |
<?php __("Fix spaces between HTML attributes", "translatepress-multilingual"); ?>
|
| 285 |
<?php __("Fixes attributes without spaces between them because they are not valid HTML.<br> May help fix missing or broken content from the HTML on translated pages.", "translatepress-multilingual"); ?>
|
| 286 |
+
<?php __("Troubleshooting", "translatepress-multilingual"); ?>
|
| 287 |
+
<?php __("Exclude strings", "translatepress-multilingual"); ?>
|
| 288 |
+
<?php __("Debug", "translatepress-multilingual"); ?>
|
| 289 |
+
<?php __("Miscellaneous options", "translatepress-multilingual"); ?>
|
| 290 |
<?php __("Fix missing dynamic content", "translatepress-multilingual"); ?>
|
| 291 |
<?php __("May help fix missing content inserted using JavaScript. <br> It shows dynamically inserted content in original language for a moment before the translation request is finished.", "translatepress-multilingual"); ?>
|
| 292 |
<?php __("Filter Gettext wrapping from post content and title", "translatepress-multilingual"); ?>
|
languages/translatepress-multilingual.pot
CHANGED
|
@@ -101,7 +101,7 @@ msgstr ""
|
|
| 101 |
msgid "Are you sure you want to remove this language?"
|
| 102 |
msgstr ""
|
| 103 |
|
| 104 |
-
#: ../tp-add-on-extra-languages/partials/language-selector-pro.php:43, ../translatepress/includes/class-advanced-tab.php:
|
| 105 |
msgid "Remove"
|
| 106 |
msgstr ""
|
| 107 |
|
|
@@ -109,7 +109,7 @@ msgstr ""
|
|
| 109 |
msgid "Choose..."
|
| 110 |
msgstr ""
|
| 111 |
|
| 112 |
-
#: ../tp-add-on-extra-languages/partials/language-selector-pro.php:58, ../translatepress/includes/class-advanced-tab.php:
|
| 113 |
msgid "Add"
|
| 114 |
msgstr ""
|
| 115 |
|
|
@@ -125,11 +125,11 @@ msgstr ""
|
|
| 125 |
msgid "Advanced"
|
| 126 |
msgstr ""
|
| 127 |
|
| 128 |
-
#: ../translatepress/includes/class-advanced-tab.php:
|
| 129 |
msgid "Yes"
|
| 130 |
msgstr ""
|
| 131 |
|
| 132 |
-
#: ../translatepress/includes/class-advanced-tab.php:
|
| 133 |
msgid "Are you sure you want to remove this item?"
|
| 134 |
msgstr ""
|
| 135 |
|
|
@@ -773,7 +773,7 @@ msgstr ""
|
|
| 773 |
msgid "TranslatePress Advanced Settings"
|
| 774 |
msgstr ""
|
| 775 |
|
| 776 |
-
#: ../translatepress/partials/advanced-settings-page.php:
|
| 777 |
msgid "Save Changes"
|
| 778 |
msgstr ""
|
| 779 |
|
|
@@ -1045,6 +1045,30 @@ msgstr ""
|
|
| 1045 |
msgid "It disables detection of strings displayed dynamically using JavaScript. <br/>Strings loaded via a server side AJAX call will still be translated."
|
| 1046 |
msgstr ""
|
| 1047 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1048 |
#: ../translatepress/includes/advanced-settings/enable-auto-translate-slug.php:8
|
| 1049 |
msgid "Automatically translate slugs"
|
| 1050 |
msgstr ""
|
|
@@ -1125,6 +1149,22 @@ msgstr ""
|
|
| 1125 |
msgid "Fixes attributes without spaces between them because they are not valid HTML.<br> May help fix missing or broken content from the HTML on translated pages."
|
| 1126 |
msgstr ""
|
| 1127 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1128 |
#: ../translatepress/includes/advanced-settings/show-dynamic-content-before-translation.php:8
|
| 1129 |
msgid "Fix missing dynamic content"
|
| 1130 |
msgstr ""
|
| 101 |
msgid "Are you sure you want to remove this language?"
|
| 102 |
msgstr ""
|
| 103 |
|
| 104 |
+
#: ../tp-add-on-extra-languages/partials/language-selector-pro.php:43, ../translatepress/includes/class-advanced-tab.php:399, ../translatepress/includes/class-advanced-tab.php:409, ../translatepress/partials/main-settings-language-selector.php:40
|
| 105 |
msgid "Remove"
|
| 106 |
msgstr ""
|
| 107 |
|
| 109 |
msgid "Choose..."
|
| 110 |
msgstr ""
|
| 111 |
|
| 112 |
+
#: ../tp-add-on-extra-languages/partials/language-selector-pro.php:58, ../translatepress/includes/class-advanced-tab.php:409, ../translatepress/partials/main-settings-language-selector.php:55
|
| 113 |
msgid "Add"
|
| 114 |
msgstr ""
|
| 115 |
|
| 125 |
msgid "Advanced"
|
| 126 |
msgstr ""
|
| 127 |
|
| 128 |
+
#: ../translatepress/includes/class-advanced-tab.php:237, ../translatepress/includes/class-error-manager.php:155, ../translatepress/partials/machine-translation-settings-page.php:13, ../translatepress/partials/machine-translation-settings-page.php:78, ../translatepress/partials/machine-translation-settings-page.php:111, ../translatepress/partials/main-settings-page.php:41, ../translatepress/partials/main-settings-page.php:54, ../translatepress/partials/main-settings-page.php:67
|
| 129 |
msgid "Yes"
|
| 130 |
msgstr ""
|
| 131 |
|
| 132 |
+
#: ../translatepress/includes/class-advanced-tab.php:399, ../translatepress/includes/class-advanced-tab.php:409
|
| 133 |
msgid "Are you sure you want to remove this item?"
|
| 134 |
msgstr ""
|
| 135 |
|
| 773 |
msgid "TranslatePress Advanced Settings"
|
| 774 |
msgstr ""
|
| 775 |
|
| 776 |
+
#: ../translatepress/partials/advanced-settings-page.php:16
|
| 777 |
msgid "Save Changes"
|
| 778 |
msgstr ""
|
| 779 |
|
| 1045 |
msgid "It disables detection of strings displayed dynamically using JavaScript. <br/>Strings loaded via a server side AJAX call will still be translated."
|
| 1046 |
msgstr ""
|
| 1047 |
|
| 1048 |
+
#: ../translatepress/includes/advanced-settings/disable-languages-sitemap.php:7
|
| 1049 |
+
msgid "Exclude translated links from sitemap"
|
| 1050 |
+
msgstr ""
|
| 1051 |
+
|
| 1052 |
+
#: ../translatepress/includes/advanced-settings/disable-languages-sitemap.php:8
|
| 1053 |
+
msgid "Do not include translated links in sitemaps generated by SEO plugins.<br/>Requires <a href=\"https://translatepress.com/docs/addons/seo-pack/\" title=\"TranslatePress Add-on SEO Pack documentation\" target=\"_blank\"> SEO Pack Add-on</a> to be installed and activated."
|
| 1054 |
+
msgstr ""
|
| 1055 |
+
|
| 1056 |
+
#: ../translatepress/includes/advanced-settings/disable-post-container-tags.php:9
|
| 1057 |
+
msgid "Disable post container tags for post title"
|
| 1058 |
+
msgstr ""
|
| 1059 |
+
|
| 1060 |
+
#: ../translatepress/includes/advanced-settings/disable-post-container-tags.php:10
|
| 1061 |
+
msgid "It disables search indexing the post title in translated languages.<br/>Useful when the title of the post doesn't allow HTML thus breaking the page."
|
| 1062 |
+
msgstr ""
|
| 1063 |
+
|
| 1064 |
+
#: ../translatepress/includes/advanced-settings/disable-post-container-tags.php:32
|
| 1065 |
+
msgid "Disable post container tags for post content"
|
| 1066 |
+
msgstr ""
|
| 1067 |
+
|
| 1068 |
+
#: ../translatepress/includes/advanced-settings/disable-post-container-tags.php:33
|
| 1069 |
+
msgid "It disables search indexing the post content in translated languages.<br/>Useful when the content of the post doesn't allow HTML thus breaking the page."
|
| 1070 |
+
msgstr ""
|
| 1071 |
+
|
| 1072 |
#: ../translatepress/includes/advanced-settings/enable-auto-translate-slug.php:8
|
| 1073 |
msgid "Automatically translate slugs"
|
| 1074 |
msgstr ""
|
| 1149 |
msgid "Fixes attributes without spaces between them because they are not valid HTML.<br> May help fix missing or broken content from the HTML on translated pages."
|
| 1150 |
msgstr ""
|
| 1151 |
|
| 1152 |
+
#: ../translatepress/includes/advanced-settings/separators.php:8
|
| 1153 |
+
msgid "Troubleshooting"
|
| 1154 |
+
msgstr ""
|
| 1155 |
+
|
| 1156 |
+
#: ../translatepress/includes/advanced-settings/separators.php:19
|
| 1157 |
+
msgid "Exclude strings"
|
| 1158 |
+
msgstr ""
|
| 1159 |
+
|
| 1160 |
+
#: ../translatepress/includes/advanced-settings/separators.php:29
|
| 1161 |
+
msgid "Debug"
|
| 1162 |
+
msgstr ""
|
| 1163 |
+
|
| 1164 |
+
#: ../translatepress/includes/advanced-settings/separators.php:39
|
| 1165 |
+
msgid "Miscellaneous options"
|
| 1166 |
+
msgstr ""
|
| 1167 |
+
|
| 1168 |
#: ../translatepress/includes/advanced-settings/show-dynamic-content-before-translation.php:8
|
| 1169 |
msgid "Fix missing dynamic content"
|
| 1170 |
msgstr ""
|
partials/advanced-settings-page.php
CHANGED
|
@@ -5,9 +5,14 @@
|
|
| 5 |
<h1> <?php esc_html_e( 'TranslatePress Advanced Settings', 'translatepress-multilingual' );?></h1>
|
| 6 |
<?php do_action ( 'trp_settings_navigation_tabs' ); ?>
|
| 7 |
|
|
|
|
|
|
|
| 8 |
<table id="trp-options" class="form-table">
|
| 9 |
<?php do_action('trp_output_advanced_settings_options' ); ?>
|
| 10 |
</table>
|
|
|
|
|
|
|
|
|
|
| 11 |
<?php submit_button( __( 'Save Changes', 'translatepress-multilingual' ) ); ?>
|
| 12 |
</form>
|
| 13 |
</div>
|
| 5 |
<h1> <?php esc_html_e( 'TranslatePress Advanced Settings', 'translatepress-multilingual' );?></h1>
|
| 6 |
<?php do_action ( 'trp_settings_navigation_tabs' ); ?>
|
| 7 |
|
| 8 |
+
<?php do_action('trp_before_output_advanced_settings_options' ); ?>
|
| 9 |
+
|
| 10 |
<table id="trp-options" class="form-table">
|
| 11 |
<?php do_action('trp_output_advanced_settings_options' ); ?>
|
| 12 |
</table>
|
| 13 |
+
|
| 14 |
+
<?php do_action('trp_after_output_advanced_settings_options' ); ?>
|
| 15 |
+
|
| 16 |
<?php submit_button( __( 'Save Changes', 'translatepress-multilingual' ) ); ?>
|
| 17 |
</form>
|
| 18 |
</div>
|
readme.txt
CHANGED
|
@@ -5,7 +5,7 @@ Tags: translate, translation, multilingual, automatic translation, bilingual, fr
|
|
| 5 |
Requires at least: 3.1.0
|
| 6 |
Tested up to: 5.3.2
|
| 7 |
Requires PHP: 5.6.20
|
| 8 |
-
Stable tag: 1.6.
|
| 9 |
License: GPLv2 or later
|
| 10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
| 11 |
|
|
@@ -143,6 +143,17 @@ For more information please check out [TranslatePress - Multilingual plugin docu
|
|
| 143 |
|
| 144 |
|
| 145 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 146 |
= 1.6.7 =
|
| 147 |
* Improved the database update queries
|
| 148 |
* Fixed an error in mysql regarding post_parent_id meta insert if no id was found
|
| 5 |
Requires at least: 3.1.0
|
| 6 |
Tested up to: 5.3.2
|
| 7 |
Requires PHP: 5.6.20
|
| 8 |
+
Stable tag: 1.6.8
|
| 9 |
License: GPLv2 or later
|
| 10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
| 11 |
|
| 143 |
|
| 144 |
|
| 145 |
== Changelog ==
|
| 146 |
+
= 1.6.8 =
|
| 147 |
+
* Added support for All In One SEO
|
| 148 |
+
* Added compatibility with Peepso double slashing translated links
|
| 149 |
+
* Add option in Advanced tab to disable translated links in sitemap
|
| 150 |
+
* Add options to disable post container tags in Advanced Tab.
|
| 151 |
+
* Organize Advanced Tabs by categories.
|
| 152 |
+
* Fix an error regarding the settings class in class-languages.php
|
| 153 |
+
* Fixed a filter in the trp_curpageurl() function
|
| 154 |
+
* Fix fatal error thrown when trying to access the global while it's null in some cases
|
| 155 |
+
* Fixed x-default from advanced not working as expected
|
| 156 |
+
|
| 157 |
= 1.6.7 =
|
| 158 |
* Improved the database update queries
|
| 159 |
* Fixed an error in mysql regarding post_parent_id meta insert if no id was found
|
