Version Description
- Added setting that allows you to translate only certain paths or exclude certain paths from being translated.
- Fixed some cases where GET parameters were lost from links in translated languages
- WP Bakery integration that allow to include/exclude blocks for languages
- Added a compatibility for the MyListing theme.
- Load unsupported languages section only if an API key is saved.
- Add support for AIO SEO sitemap detection
Download this release
Release Info
| Developer | madalin.ungureanu |
| Plugin | |
| Version | 1.9.5 |
| Comparing to | |
| See all releases | |
Code changes from version 1.9.4 to 1.9.5
- assets/css/trp-back-end-style.css +13 -0
- class-translate-press.php +4 -1
- includes/advanced-settings/do-not-translate-certain-paths.php +443 -0
- includes/class-advanced-tab.php +37 -2
- includes/class-language-switcher.php +1 -1
- includes/class-machine-translation-tab.php +2 -1
- includes/class-url-converter.php +14 -13
- includes/class-wp-bakery-language-for-blocks.php +262 -0
- includes/compatibility-functions.php +20 -1
- index.php +1 -1
- languages/translatepress-multilingual.catalog.php +2 -0
- languages/translatepress-multilingual.pot +17 -9
- readme.txt +10 -2
assets/css/trp-back-end-style.css
CHANGED
|
@@ -215,3 +215,16 @@ a.trp-recommended-learn-more{
|
|
| 215 |
.trp-recommended-buttons{
|
| 216 |
margin-bottom: 40px;
|
| 217 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 215 |
.trp-recommended-buttons{
|
| 216 |
margin-bottom: 40px;
|
| 217 |
}
|
| 218 |
+
|
| 219 |
+
#trp-adv-translate-certain-paths .trp-adv-holder {
|
| 220 |
+
margin-bottom: 24px;
|
| 221 |
+
}
|
| 222 |
+
|
| 223 |
+
#trp-adv-translate-certain-paths .trp-adv-holder label:not(:last-child) {
|
| 224 |
+
margin-right: 24px;
|
| 225 |
+
}
|
| 226 |
+
|
| 227 |
+
#trp-adv-translate-certain-paths textarea {
|
| 228 |
+
width: 450px;
|
| 229 |
+
min-height: 150px;
|
| 230 |
+
}
|
class-translate-press.php
CHANGED
|
@@ -57,7 +57,7 @@ class TRP_Translate_Press{
|
|
| 57 |
define( 'TRP_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
|
| 58 |
define( 'TRP_PLUGIN_BASE', plugin_basename( __DIR__ . '/index.php' ) );
|
| 59 |
define( 'TRP_PLUGIN_SLUG', 'translatepress-multilingual' );
|
| 60 |
-
define( 'TRP_PLUGIN_VERSION', '1.9.
|
| 61 |
|
| 62 |
wp_cache_add_non_persistent_groups(array('trp'));
|
| 63 |
|
|
@@ -116,6 +116,9 @@ class TRP_Translate_Press{
|
|
| 116 |
require_once TRP_PLUGIN_DIR . 'includes/class-install-plugins.php';
|
| 117 |
if ( did_action( 'elementor/loaded' ) )
|
| 118 |
require_once TRP_PLUGIN_DIR . 'includes/class-elementor-language-for-blocks.php';
|
|
|
|
|
|
|
|
|
|
| 119 |
}
|
| 120 |
|
| 121 |
/**
|
| 57 |
define( 'TRP_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
|
| 58 |
define( 'TRP_PLUGIN_BASE', plugin_basename( __DIR__ . '/index.php' ) );
|
| 59 |
define( 'TRP_PLUGIN_SLUG', 'translatepress-multilingual' );
|
| 60 |
+
define( 'TRP_PLUGIN_VERSION', '1.9.5' );
|
| 61 |
|
| 62 |
wp_cache_add_non_persistent_groups(array('trp'));
|
| 63 |
|
| 116 |
require_once TRP_PLUGIN_DIR . 'includes/class-install-plugins.php';
|
| 117 |
if ( did_action( 'elementor/loaded' ) )
|
| 118 |
require_once TRP_PLUGIN_DIR . 'includes/class-elementor-language-for-blocks.php';
|
| 119 |
+
if ( defined( 'WPB_VC_VERSION' ) ) {
|
| 120 |
+
require_once TRP_PLUGIN_DIR . 'includes/class-wp-bakery-language-for-blocks.php';
|
| 121 |
+
}
|
| 122 |
}
|
| 123 |
|
| 124 |
/**
|
includes/advanced-settings/do-not-translate-certain-paths.php
ADDED
|
@@ -0,0 +1,443 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
add_filter( 'trp_register_advanced_settings', 'trp_register_do_not_translate_certain_paths', 120 );
|
| 4 |
+
function trp_register_do_not_translate_certain_paths( $settings_array ){
|
| 5 |
+
|
| 6 |
+
$settings_array[] = array(
|
| 7 |
+
'type' => 'custom',
|
| 8 |
+
'name' => 'translateable_content',
|
| 9 |
+
'rows' => array( 'option' => 'radio', 'paths' => 'textarea' ),
|
| 10 |
+
'label' => esc_html__( 'Do not translate certain paths', 'translatepress-multilingual' ),
|
| 11 |
+
'description' => wp_kses( __( 'Choose what paths can be translated. Supports wildcard at the end of the path.<br>For example, to exclude https://example.com/some/path you can either use the rule /some/path/ or /some/*.<br>Enter each rule on it\'s own line. To exclude the home page use {{home}}.', 'translatepress-multilingual' ), array( 'br' => array() )),
|
| 12 |
+
);
|
| 13 |
+
|
| 14 |
+
return $settings_array;
|
| 15 |
+
|
| 16 |
+
}
|
| 17 |
+
|
| 18 |
+
add_filter( 'trp_advanced_setting_custom_translateable_content', 'trp_output_do_not_translate_certain_paths' );
|
| 19 |
+
function trp_output_do_not_translate_certain_paths( $setting ){
|
| 20 |
+
|
| 21 |
+
$trp_settings = ( new TRP_Settings() )->get_settings();
|
| 22 |
+
|
| 23 |
+
?>
|
| 24 |
+
<tr id="trp-adv-translate-certain-paths">
|
| 25 |
+
<th scope="row"><?php echo $setting['label']; ?></th>
|
| 26 |
+
<td>
|
| 27 |
+
<div class="trp-adv-holder">
|
| 28 |
+
<label>
|
| 29 |
+
<input type='radio' id='$setting_name' name="trp_advanced_settings[<?php echo $setting['name']; ?>][option]" value="exclude" <?php echo isset( $trp_settings['trp_advanced_settings'][$setting['name']]['option'] ) && $trp_settings['trp_advanced_settings'][$setting['name']]['option'] == 'exclude' ? 'checked' : ''; ?>>
|
| 30 |
+
<?php _e( 'Exclude Paths From Translation', 'translatepress' ); ?>
|
| 31 |
+
</label>
|
| 32 |
+
|
| 33 |
+
<label>
|
| 34 |
+
<input type='radio' id='$setting_name' name="trp_advanced_settings[<?php echo $setting['name']; ?>][option]" value="include" <?php echo isset( $trp_settings['trp_advanced_settings'][$setting['name']]['option'] ) && $trp_settings['trp_advanced_settings'][$setting['name']]['option'] == 'include' ? 'checked' : ''; ?> >
|
| 35 |
+
<?php _e( 'Translate Only Certain Paths', 'translatepress' ); ?>
|
| 36 |
+
</label>
|
| 37 |
+
</div>
|
| 38 |
+
|
| 39 |
+
<textarea class="trp-adv-big-textarea" name="trp_advanced_settings[<?php echo $setting['name']; ?>][paths]"><?php echo $trp_settings['trp_advanced_settings'][$setting['name']]['paths']; ?></textarea>
|
| 40 |
+
|
| 41 |
+
<p class="description"><?php echo $setting['description']; ?></p>
|
| 42 |
+
</td>
|
| 43 |
+
</tr>
|
| 44 |
+
|
| 45 |
+
|
| 46 |
+
<?php
|
| 47 |
+
return;
|
| 48 |
+
}
|
| 49 |
+
|
| 50 |
+
// Prevent TranslatePress from loading on excluded pages
|
| 51 |
+
add_action( 'trp_allow_tp_to_run', 'trp_exclude_include_paths_to_run_on', 2 );
|
| 52 |
+
function trp_exclude_include_paths_to_run_on(){
|
| 53 |
+
|
| 54 |
+
if( is_admin() )
|
| 55 |
+
return true;
|
| 56 |
+
|
| 57 |
+
if( isset( $_GET['trp-edit-translation'] ) && ( $_GET['trp-edit-translation'] == 'true' || $_GET['trp-edit-translation'] == 'preview' ) )
|
| 58 |
+
return true;
|
| 59 |
+
|
| 60 |
+
if( isset( $_GET['trp-string-translation'] ) && $_GET['trp-string-translation'] == 'true' )
|
| 61 |
+
return true;
|
| 62 |
+
|
| 63 |
+
$settings = get_option( 'trp_settings', false );
|
| 64 |
+
$advanced_settings = get_option( 'trp_advanced_settings', false );
|
| 65 |
+
|
| 66 |
+
if( empty( $advanced_settings ) || !isset( $advanced_settings['translateable_content'] ) || !isset( $advanced_settings['translateable_content']['option'] ) || empty( $advanced_settings['translateable_content']['paths'] ) )
|
| 67 |
+
return true;
|
| 68 |
+
|
| 69 |
+
$trp = TRP_Translate_Press::get_trp_instance();
|
| 70 |
+
$url_converter = $trp->get_component('url_converter');
|
| 71 |
+
$current_lang = $url_converter->get_lang_from_url_string( $url_converter->cur_page_url() );
|
| 72 |
+
|
| 73 |
+
if( empty( $current_lang ) )
|
| 74 |
+
$current_lang = $settings['default-language'];
|
| 75 |
+
|
| 76 |
+
if ( $url_converter->is_sitemap_path() )
|
| 77 |
+
return true;
|
| 78 |
+
|
| 79 |
+
// Skip checks if this is not the default language
|
| 80 |
+
if( !empty( $current_lang ) && $settings['default-language'] != $current_lang )
|
| 81 |
+
return true;
|
| 82 |
+
|
| 83 |
+
$paths = explode("\n", str_replace("\r", "", $advanced_settings['translateable_content']['paths'] ) );
|
| 84 |
+
$current_slug = sanitize_text_field( $_SERVER['REQUEST_URI'] );
|
| 85 |
+
|
| 86 |
+
$replace = '/';
|
| 87 |
+
|
| 88 |
+
if( isset( $settings['add-subdirectory-to-default-language'] ) && $settings['add-subdirectory-to-default-language'] == 'yes' )
|
| 89 |
+
$replace .= $settings['url-slugs'][$current_lang];
|
| 90 |
+
|
| 91 |
+
$current_slug = str_replace( $replace, '', untrailingslashit( $current_slug ) );
|
| 92 |
+
|
| 93 |
+
// Explode get params
|
| 94 |
+
$current_slug = explode( '?', $current_slug );
|
| 95 |
+
|
| 96 |
+
if( isset( $current_slug[1] ) ){
|
| 97 |
+
$current_get = $current_slug[1];
|
| 98 |
+
$current_slug = $current_slug[0];
|
| 99 |
+
} else {
|
| 100 |
+
$current_slug = $current_slug[0];
|
| 101 |
+
}
|
| 102 |
+
|
| 103 |
+
if( empty( $current_slug ) || $current_slug == '/' )
|
| 104 |
+
$current_slug = "{{home}}";
|
| 105 |
+
|
| 106 |
+
if( $advanced_settings['translateable_content']['option'] == 'exclude' ){
|
| 107 |
+
|
| 108 |
+
foreach( $paths as $path ){
|
| 109 |
+
|
| 110 |
+
if( !empty( $path ) ){
|
| 111 |
+
|
| 112 |
+
if( untrailingslashit( $current_slug ) == untrailingslashit( $path ) || ( strpos( $path, '*' ) !== false && strpos( untrailingslashit( $current_slug ), str_replace( '/*', '', $path ) ) !== false ) )
|
| 113 |
+
return false;
|
| 114 |
+
|
| 115 |
+
}
|
| 116 |
+
}
|
| 117 |
+
|
| 118 |
+
} else if( $advanced_settings['translateable_content']['option'] == 'include' ){
|
| 119 |
+
|
| 120 |
+
foreach( $paths as $path ){
|
| 121 |
+
|
| 122 |
+
if( !empty( $path ) ){
|
| 123 |
+
if( untrailingslashit( $current_slug ) == untrailingslashit( $path ) || ( strpos( $path, '*' ) !== false && strpos( untrailingslashit( $current_slug ), str_replace( '/*', '', $path ) ) !== false ) )
|
| 124 |
+
return true;
|
| 125 |
+
}
|
| 126 |
+
|
| 127 |
+
}
|
| 128 |
+
|
| 129 |
+
return false;
|
| 130 |
+
|
| 131 |
+
}
|
| 132 |
+
|
| 133 |
+
return true;
|
| 134 |
+
|
| 135 |
+
}
|
| 136 |
+
|
| 137 |
+
add_filter( 'trp_allow_language_redirect', 'trp_exclude_include_do_not_redirect_on_excluded_pages', 20, 3 );
|
| 138 |
+
function trp_exclude_include_do_not_redirect_on_excluded_pages( $redirect, $language, $url ){
|
| 139 |
+
|
| 140 |
+
if( isset( $_GET['trp-edit-translation'] ) && ( $_GET['trp-edit-translation'] == 'true' || $_GET['trp-edit-translation'] == 'preview' ) )
|
| 141 |
+
return $redirect;
|
| 142 |
+
|
| 143 |
+
if( isset( $_GET['trp-string-translation'] ) && $_GET['trp-string-translation'] == 'true' )
|
| 144 |
+
return $redirect;
|
| 145 |
+
|
| 146 |
+
$settings = get_option( 'trp_settings', false );
|
| 147 |
+
$advanced_settings = get_option( 'trp_advanced_settings', false );
|
| 148 |
+
|
| 149 |
+
if( empty( $advanced_settings ) || !isset( $advanced_settings['translateable_content'] ) || !isset( $advanced_settings['translateable_content']['option'] ) || empty( $advanced_settings['translateable_content']['paths'] ) )
|
| 150 |
+
return $redirect;
|
| 151 |
+
|
| 152 |
+
if( empty( $language ) || $language != $settings['default-language'] )
|
| 153 |
+
return $redirect;
|
| 154 |
+
|
| 155 |
+
$replace = trailingslashit( home_url() );
|
| 156 |
+
|
| 157 |
+
$current_slug = str_replace( $replace, '', trailingslashit( $url ) );
|
| 158 |
+
$paths = explode("\n", str_replace("\r", "", $advanced_settings['translateable_content']['paths'] ) );
|
| 159 |
+
|
| 160 |
+
// Explode get params
|
| 161 |
+
$current_slug = explode( '?', $current_slug );
|
| 162 |
+
|
| 163 |
+
if( isset( $current_slug[1] ) ){
|
| 164 |
+
$current_get = $current_slug[1];
|
| 165 |
+
$current_slug = $current_slug[0];
|
| 166 |
+
} else {
|
| 167 |
+
$current_slug = $current_slug[0];
|
| 168 |
+
}
|
| 169 |
+
|
| 170 |
+
if( empty( $current_slug ) || $current_slug == '/' )
|
| 171 |
+
$current_slug = "{{home}}";
|
| 172 |
+
|
| 173 |
+
if( $advanced_settings['translateable_content']['option'] == 'exclude' ){
|
| 174 |
+
|
| 175 |
+
foreach( $paths as $path ){
|
| 176 |
+
|
| 177 |
+
if( !empty( $path ) ){
|
| 178 |
+
|
| 179 |
+
if( untrailingslashit( $current_slug ) == untrailingslashit( $path ) || ( strpos( $path, '*' ) !== false && strpos( untrailingslashit( $current_slug ), str_replace( '/*', '', $path ) ) !== false ) )
|
| 180 |
+
return false;
|
| 181 |
+
|
| 182 |
+
}
|
| 183 |
+
}
|
| 184 |
+
|
| 185 |
+
} else if( $advanced_settings['translateable_content']['option'] == 'include' ){
|
| 186 |
+
|
| 187 |
+
foreach( $paths as $path ){
|
| 188 |
+
|
| 189 |
+
if( !empty( $path ) ){
|
| 190 |
+
if( untrailingslashit( $current_slug ) == untrailingslashit( $path ) || ( strpos( $path, '*' ) !== false && strpos( untrailingslashit( $current_slug ), str_replace( '/*', '', $path ) ) !== false ) )
|
| 191 |
+
return $redirect;
|
| 192 |
+
}
|
| 193 |
+
|
| 194 |
+
}
|
| 195 |
+
|
| 196 |
+
return false;
|
| 197 |
+
|
| 198 |
+
}
|
| 199 |
+
|
| 200 |
+
return $redirect;
|
| 201 |
+
|
| 202 |
+
}
|
| 203 |
+
|
| 204 |
+
add_action( 'init', 'trp_exclude_include_redirect_to_default_language', 1 );
|
| 205 |
+
function trp_exclude_include_redirect_to_default_language(){
|
| 206 |
+
|
| 207 |
+
if( isset( $_GET['trp-edit-translation'] ) && ( $_GET['trp-edit-translation'] == 'true' || $_GET['trp-edit-translation'] == 'preview' ) )
|
| 208 |
+
return $redirect;
|
| 209 |
+
|
| 210 |
+
if( isset( $_GET['trp-string-translation'] ) && $_GET['trp-string-translation'] == 'true' )
|
| 211 |
+
return $redirect;
|
| 212 |
+
|
| 213 |
+
if( is_admin() )
|
| 214 |
+
return;
|
| 215 |
+
|
| 216 |
+
$settings = get_option( 'trp_settings', false );
|
| 217 |
+
$advanced_settings = get_option( 'trp_advanced_settings', false );
|
| 218 |
+
|
| 219 |
+
if( empty( $advanced_settings ) || !isset( $advanced_settings['translateable_content'] ) || !isset( $advanced_settings['translateable_content']['option'] ) || empty( $advanced_settings['translateable_content']['paths'] ) )
|
| 220 |
+
return;
|
| 221 |
+
|
| 222 |
+
global $TRP_LANGUAGE;
|
| 223 |
+
$trp = TRP_Translate_Press::get_trp_instance();
|
| 224 |
+
$url_converter = $trp->get_component('url_converter');
|
| 225 |
+
|
| 226 |
+
$current_original_url = $url_converter->get_url_for_language( $settings['default-language'], null, '' );
|
| 227 |
+
|
| 228 |
+
// Attempt to redirect on default language only if the current URL contains the language
|
| 229 |
+
if( !isset( $TRP_LANGUAGE ) || $settings['default-language'] == $TRP_LANGUAGE ){
|
| 230 |
+
|
| 231 |
+
if( $url_converter->get_lang_from_url_string( $current_original_url ) === null )
|
| 232 |
+
return;
|
| 233 |
+
|
| 234 |
+
}
|
| 235 |
+
|
| 236 |
+
$absolute_home = $url_converter->get_abs_home();
|
| 237 |
+
|
| 238 |
+
// Take into account the subdirectory for default language option
|
| 239 |
+
if ( isset( $settings['add-subdirectory-to-default-language'] ) && $settings['add-subdirectory-to-default-language'] == 'yes' )
|
| 240 |
+
$absolute_home = trailingslashit( $absolute_home ) . $settings['url-slugs'][$settings['default-language']];
|
| 241 |
+
|
| 242 |
+
$current_slug = str_replace( $absolute_home, '', untrailingslashit( $current_original_url ) );
|
| 243 |
+
$paths = explode("\n", str_replace("\r", "", $advanced_settings['translateable_content']['paths'] ) );
|
| 244 |
+
|
| 245 |
+
// Remove language from this URL if present
|
| 246 |
+
$current_original_url = str_replace( '/' . $settings['url-slugs'][$settings['default-language']], '', $current_original_url );
|
| 247 |
+
|
| 248 |
+
// Explode get params
|
| 249 |
+
$current_slug = explode( '?', $current_slug );
|
| 250 |
+
|
| 251 |
+
if( isset( $current_slug[1] ) ){
|
| 252 |
+
$current_get = $current_slug[1];
|
| 253 |
+
$current_slug = $current_slug[0];
|
| 254 |
+
} else {
|
| 255 |
+
$current_slug = $current_slug[0];
|
| 256 |
+
}
|
| 257 |
+
|
| 258 |
+
if( empty( $current_slug ) || $current_slug == '/' )
|
| 259 |
+
$current_slug = "{{home}}";
|
| 260 |
+
|
| 261 |
+
if( $advanced_settings['translateable_content']['option'] == 'exclude' ){
|
| 262 |
+
|
| 263 |
+
foreach( $paths as $path ){
|
| 264 |
+
|
| 265 |
+
if( !empty( $path ) ){
|
| 266 |
+
|
| 267 |
+
if( untrailingslashit( $current_slug ) == untrailingslashit( $path ) || ( strpos( $path, '*' ) !== false && strpos( untrailingslashit( $current_slug ), str_replace( '/*', '', $path ) ) !== false ) ){
|
| 268 |
+
|
| 269 |
+
if( $url_converter->cur_page_url() != $current_original_url ){
|
| 270 |
+
wp_redirect( $current_original_url, 301 );
|
| 271 |
+
exit;
|
| 272 |
+
}
|
| 273 |
+
|
| 274 |
+
}
|
| 275 |
+
|
| 276 |
+
}
|
| 277 |
+
}
|
| 278 |
+
|
| 279 |
+
} else if( $advanced_settings['translateable_content']['option'] == 'include' ){
|
| 280 |
+
|
| 281 |
+
foreach( $paths as $path ){
|
| 282 |
+
|
| 283 |
+
if( !empty( $path ) ){
|
| 284 |
+
if( untrailingslashit( $current_slug ) == untrailingslashit( $path ) || ( strpos( $path, '*' ) !== false && strpos( untrailingslashit( $current_slug ), str_replace( '/*', '', $path ) ) !== false ) )
|
| 285 |
+
return;
|
| 286 |
+
}
|
| 287 |
+
|
| 288 |
+
}
|
| 289 |
+
|
| 290 |
+
if( $url_converter->cur_page_url() != $current_original_url ){
|
| 291 |
+
wp_redirect( $current_original_url, 301 );
|
| 292 |
+
exit;
|
| 293 |
+
}
|
| 294 |
+
|
| 295 |
+
}
|
| 296 |
+
|
| 297 |
+
}
|
| 298 |
+
|
| 299 |
+
// only force custom links in paths that are translatable
|
| 300 |
+
add_filter( 'trp_force_custom_links', 'trp_exclude_include_filter_custom_links', 10, 4);
|
| 301 |
+
function trp_exclude_include_filter_custom_links( $new_url, $url, $TRP_LANGUAGE, $a_href ){
|
| 302 |
+
|
| 303 |
+
if( isset( $_GET['trp-edit-translation'] ) && ( $_GET['trp-edit-translation'] == 'true' || $_GET['trp-edit-translation'] == 'preview' ) )
|
| 304 |
+
return $new_url;
|
| 305 |
+
|
| 306 |
+
if( isset( $_GET['trp-string-translation'] ) && $_GET['trp-string-translation'] == 'true' )
|
| 307 |
+
return $new_url;
|
| 308 |
+
|
| 309 |
+
$advanced_settings = get_option( 'trp_advanced_settings', false );
|
| 310 |
+
$settings = get_option( 'trp_settings', false );
|
| 311 |
+
|
| 312 |
+
if( empty( $advanced_settings ) || !isset( $advanced_settings['translateable_content'] ) || !isset( $advanced_settings['translateable_content']['option'] ) || empty( $advanced_settings['translateable_content']['paths'] ) )
|
| 313 |
+
return $new_url;
|
| 314 |
+
|
| 315 |
+
global $TRP_LANGUAGE;
|
| 316 |
+
$trp = TRP_Translate_Press::get_trp_instance();
|
| 317 |
+
$url_converter = $trp->get_component('url_converter');
|
| 318 |
+
|
| 319 |
+
if( !isset( $TRP_LANGUAGE ) || $settings['default-language'] == $TRP_LANGUAGE )
|
| 320 |
+
return;
|
| 321 |
+
|
| 322 |
+
$current_original_url = $url_converter->get_url_for_language( $settings['default-language'], $new_url, '' );
|
| 323 |
+
|
| 324 |
+
// Remove language from this URL if present
|
| 325 |
+
$current_original_url = str_replace( '/' . $settings['url-slugs'][$settings['default-language']], '', $current_original_url );
|
| 326 |
+
|
| 327 |
+
$absolute_home = $url_converter->get_abs_home();
|
| 328 |
+
|
| 329 |
+
$current_slug = str_replace( $absolute_home, '', untrailingslashit( $current_original_url ) );
|
| 330 |
+
$paths = explode("\n", str_replace("\r", "", $advanced_settings['translateable_content']['paths'] ) );
|
| 331 |
+
|
| 332 |
+
// Explode get params
|
| 333 |
+
$current_slug = explode( '?', $current_slug );
|
| 334 |
+
|
| 335 |
+
if( isset( $current_slug[1] ) ){
|
| 336 |
+
$current_get = $current_slug[1];
|
| 337 |
+
$current_slug = $current_slug[0];
|
| 338 |
+
} else {
|
| 339 |
+
$current_slug = $current_slug[0];
|
| 340 |
+
}
|
| 341 |
+
|
| 342 |
+
if( empty( $current_slug ) || $current_slug == '/' )
|
| 343 |
+
$current_slug = "{{home}}";
|
| 344 |
+
|
| 345 |
+
if( $advanced_settings['translateable_content']['option'] == 'exclude' ){
|
| 346 |
+
|
| 347 |
+
foreach( $paths as $path ){
|
| 348 |
+
|
| 349 |
+
if( !empty( $path ) ){
|
| 350 |
+
if( untrailingslashit( $current_slug ) == untrailingslashit( $path ) || ( strpos( $path, '*' ) !== false && strpos( untrailingslashit( $current_slug ), str_replace( '/*', '', $path ) ) !== false ) )
|
| 351 |
+
return $current_original_url;
|
| 352 |
+
}
|
| 353 |
+
|
| 354 |
+
}
|
| 355 |
+
|
| 356 |
+
} else if( $advanced_settings['translateable_content']['option'] == 'include' ){
|
| 357 |
+
|
| 358 |
+
foreach( $paths as $path ){
|
| 359 |
+
|
| 360 |
+
if( !empty( $path ) ){
|
| 361 |
+
if( untrailingslashit( $current_slug ) == untrailingslashit( $path ) || ( strpos( $path, '*' ) !== false && strpos( untrailingslashit( $current_slug ), str_replace( '/*', '', $path ) ) !== false ) )
|
| 362 |
+
return $new_url;
|
| 363 |
+
}
|
| 364 |
+
|
| 365 |
+
}
|
| 366 |
+
|
| 367 |
+
return $current_original_url;
|
| 368 |
+
|
| 369 |
+
}
|
| 370 |
+
|
| 371 |
+
return $new_url;
|
| 372 |
+
|
| 373 |
+
}
|
| 374 |
+
|
| 375 |
+
add_action( 'init', 'trp_exclude_include_add_sitemap_filter' );
|
| 376 |
+
function trp_exclude_include_add_sitemap_filter(){
|
| 377 |
+
if( defined( 'TRP_SP_PLUGIN_VERSION' ) && version_compare( TRP_SP_PLUGIN_VERSION, '1.3.6', '>=' ) )
|
| 378 |
+
add_filter( 'trp_xml_sitemap_output_for_url', 'trp_exclude_include_filter_sitemap_links', 10, 6 );
|
| 379 |
+
}
|
| 380 |
+
|
| 381 |
+
function trp_exclude_include_filter_sitemap_links( $new_output, $output, $settings, $alternate, $all_lang_urls, $url ){
|
| 382 |
+
|
| 383 |
+
$advanced_settings = get_option( 'trp_advanced_settings', false );
|
| 384 |
+
$settings = get_option( 'trp_settings', false );
|
| 385 |
+
|
| 386 |
+
if( empty( $advanced_settings ) || !isset( $advanced_settings['translateable_content'] ) || !isset( $advanced_settings['translateable_content']['option'] ) || empty( $advanced_settings['translateable_content']['paths'] ) )
|
| 387 |
+
return $new_output;
|
| 388 |
+
|
| 389 |
+
global $TRP_LANGUAGE;
|
| 390 |
+
$trp = TRP_Translate_Press::get_trp_instance();
|
| 391 |
+
$url_converter = $trp->get_component('url_converter');
|
| 392 |
+
|
| 393 |
+
if( empty( $url['loc'] ) )
|
| 394 |
+
return $new_output;
|
| 395 |
+
|
| 396 |
+
$current_original_url = $url_converter->get_url_for_language( $settings['default-language'], $url['loc'], '' );
|
| 397 |
+
$absolute_home = $url_converter->get_abs_home();
|
| 398 |
+
|
| 399 |
+
$current_slug = str_replace( $absolute_home, '', untrailingslashit( $current_original_url ) );
|
| 400 |
+
$paths = explode("\n", str_replace("\r", "", $advanced_settings['translateable_content']['paths'] ) );
|
| 401 |
+
|
| 402 |
+
// Explode get params
|
| 403 |
+
$current_slug = explode( '?', $current_slug );
|
| 404 |
+
|
| 405 |
+
if( isset( $current_slug[1] ) ){
|
| 406 |
+
$current_get = $current_slug[1];
|
| 407 |
+
$current_slug = $current_slug[0];
|
| 408 |
+
} else {
|
| 409 |
+
$current_slug = $current_slug[0];
|
| 410 |
+
}
|
| 411 |
+
|
| 412 |
+
if( empty( $current_slug ) || $current_slug == '/' )
|
| 413 |
+
$current_slug = "{{home}}";
|
| 414 |
+
|
| 415 |
+
if( $advanced_settings['translateable_content']['option'] == 'exclude' ){
|
| 416 |
+
|
| 417 |
+
foreach( $paths as $path ){
|
| 418 |
+
|
| 419 |
+
if( !empty( $path ) ){
|
| 420 |
+
if( untrailingslashit( $current_slug ) == untrailingslashit( $path ) || ( strpos( $path, '*' ) !== false && strpos( untrailingslashit( $current_slug ), str_replace( '/*', '', $path ) ) !== false ) )
|
| 421 |
+
return $output;
|
| 422 |
+
}
|
| 423 |
+
|
| 424 |
+
}
|
| 425 |
+
|
| 426 |
+
} else if( $advanced_settings['translateable_content']['option'] == 'include' ){
|
| 427 |
+
|
| 428 |
+
foreach( $paths as $path ){
|
| 429 |
+
|
| 430 |
+
if( !empty( $path ) ){
|
| 431 |
+
if( untrailingslashit( $current_slug ) == untrailingslashit( $path ) || ( strpos( $path, '*' ) !== false && strpos( untrailingslashit( $current_slug ), str_replace( '/*', '', $path ) ) !== false ) )
|
| 432 |
+
return $new_output;
|
| 433 |
+
}
|
| 434 |
+
|
| 435 |
+
}
|
| 436 |
+
|
| 437 |
+
return $output;
|
| 438 |
+
|
| 439 |
+
}
|
| 440 |
+
|
| 441 |
+
return $new_output;
|
| 442 |
+
|
| 443 |
+
}
|
includes/class-advanced-tab.php
CHANGED
|
@@ -77,10 +77,25 @@ class TRP_Advanced_Tab {
|
|
| 77 |
$settings[ $registered_setting['name'] ] = sanitize_text_field($submitted_settings[ $registered_setting['name'] ]);
|
| 78 |
break;
|
| 79 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 80 |
case 'input_array': {
|
| 81 |
foreach ( $registered_setting['rows'] as $row_label => $row_name ) {
|
| 82 |
if (isset($submitted_settings[$registered_setting['name']][$row_label])) {
|
| 83 |
-
$settings[$registered_setting['name']][$row_label] = sanitize_text_field($submitted_settings[$registered_setting['name']][$row_label]);
|
| 84 |
}
|
| 85 |
}
|
| 86 |
break;
|
|
@@ -205,6 +220,7 @@ class TRP_Advanced_Tab {
|
|
| 205 |
include_once(TRP_PLUGIN_DIR . 'includes/advanced-settings/separators.php');
|
| 206 |
include_once(TRP_PLUGIN_DIR . 'includes/advanced-settings/disable-languages-sitemap.php');
|
| 207 |
include_once(TRP_PLUGIN_DIR . 'includes/advanced-settings/remove-duplicates-from-db.php');
|
|
|
|
| 208 |
}
|
| 209 |
|
| 210 |
/*
|
|
@@ -263,6 +279,9 @@ class TRP_Advanced_Tab {
|
|
| 263 |
case 'mixed':
|
| 264 |
echo $this->mixed_setting( $setting );
|
| 265 |
break;
|
|
|
|
|
|
|
|
|
|
| 266 |
}
|
| 267 |
}
|
| 268 |
}
|
|
@@ -610,7 +629,7 @@ class TRP_Advanced_Tab {
|
|
| 610 |
break;
|
| 611 |
}
|
| 612 |
}
|
| 613 |
-
$html .= "<td><input type='button' class='button-secondary trp-adst-button-add-new-item' value='" . __( 'Add', 'translatepress-multilingual' ) . "'><span class='trp-adst-remove-element' style='display: none;' data-confirm-message='" . __('Are you sure you want to remove this item?', 'translatepress-multilingual') . "'>" . __( 'Remove', 'translatepress-multilingual' ) . "</span></td>";
|
| 614 |
$html .= "</tr></table>";
|
| 615 |
$html .= "<p class='description'>
|
| 616 |
" . $setting['description'] . "
|
|
@@ -621,4 +640,20 @@ class TRP_Advanced_Tab {
|
|
| 621 |
return apply_filters( 'trp_advanced_setting_list', $html );
|
| 622 |
|
| 623 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 624 |
}
|
| 77 |
$settings[ $registered_setting['name'] ] = sanitize_text_field($submitted_settings[ $registered_setting['name'] ]);
|
| 78 |
break;
|
| 79 |
}
|
| 80 |
+
case 'custom': {
|
| 81 |
+
foreach ( $registered_setting['rows'] as $row_label => $row_type ) {
|
| 82 |
+
if (isset($submitted_settings[$registered_setting['name']][$row_label])) {
|
| 83 |
+
|
| 84 |
+
if( $row_type != 'textarea' )
|
| 85 |
+
$value = sanitize_text_field( $submitted_settings[$registered_setting['name']][$row_label] );
|
| 86 |
+
else
|
| 87 |
+
$value = sanitize_textarea_field( $submitted_settings[$registered_setting['name']][$row_label] );
|
| 88 |
+
|
| 89 |
+
$settings[$registered_setting['name']][$row_label] = $value;
|
| 90 |
+
|
| 91 |
+
}
|
| 92 |
+
}
|
| 93 |
+
break;
|
| 94 |
+
}
|
| 95 |
case 'input_array': {
|
| 96 |
foreach ( $registered_setting['rows'] as $row_label => $row_name ) {
|
| 97 |
if (isset($submitted_settings[$registered_setting['name']][$row_label])) {
|
| 98 |
+
$settings[$registered_setting['name']][$row_label] = sanitize_text_field( $submitted_settings[$registered_setting['name']][$row_label] );
|
| 99 |
}
|
| 100 |
}
|
| 101 |
break;
|
| 220 |
include_once(TRP_PLUGIN_DIR . 'includes/advanced-settings/separators.php');
|
| 221 |
include_once(TRP_PLUGIN_DIR . 'includes/advanced-settings/disable-languages-sitemap.php');
|
| 222 |
include_once(TRP_PLUGIN_DIR . 'includes/advanced-settings/remove-duplicates-from-db.php');
|
| 223 |
+
include_once(TRP_PLUGIN_DIR . 'includes/advanced-settings/do-not-translate-certain-paths.php');
|
| 224 |
}
|
| 225 |
|
| 226 |
/*
|
| 279 |
case 'mixed':
|
| 280 |
echo $this->mixed_setting( $setting );
|
| 281 |
break;
|
| 282 |
+
case 'custom':
|
| 283 |
+
echo $this->custom_setting( $setting );
|
| 284 |
+
break;
|
| 285 |
}
|
| 286 |
}
|
| 287 |
}
|
| 629 |
break;
|
| 630 |
}
|
| 631 |
}
|
| 632 |
+
$html .= "<td><input type='button' id='button_add_" . $setting['name'] . "' class='button-secondary trp-adst-button-add-new-item' value='" . __( 'Add', 'translatepress-multilingual' ) . "'><span class='trp-adst-remove-element' style='display: none;' data-confirm-message='" . __('Are you sure you want to remove this item?', 'translatepress-multilingual') . "'>" . __( 'Remove', 'translatepress-multilingual' ) . "</span></td>";
|
| 633 |
$html .= "</tr></table>";
|
| 634 |
$html .= "<p class='description'>
|
| 635 |
" . $setting['description'] . "
|
| 640 |
return apply_filters( 'trp_advanced_setting_list', $html );
|
| 641 |
|
| 642 |
}
|
| 643 |
+
|
| 644 |
+
|
| 645 |
+
/**
|
| 646 |
+
* Can be used to output content outside the very static methods from above
|
| 647 |
+
* Hook to the provided filter
|
| 648 |
+
*
|
| 649 |
+
*/
|
| 650 |
+
public function custom_setting( $setting ){
|
| 651 |
+
|
| 652 |
+
if( empty( $setting['name'] ) )
|
| 653 |
+
return;
|
| 654 |
+
|
| 655 |
+
return apply_filters( 'trp_advanced_setting_custom_' . $setting['name'], $setting );
|
| 656 |
+
|
| 657 |
+
}
|
| 658 |
+
|
| 659 |
}
|
includes/class-language-switcher.php
CHANGED
|
@@ -46,7 +46,7 @@ class TRP_Language_Switcher{
|
|
| 46 |
|
| 47 |
$needed_language = $this->determine_needed_language( $language_from_url, $trp );
|
| 48 |
|
| 49 |
-
$allow_redirect = apply_filters( 'trp_allow_language_redirect', true, $needed_language );
|
| 50 |
if ( $allow_redirect ) {
|
| 51 |
if ( ( $language_from_url == null && isset( $this->settings['add-subdirectory-to-default-language'] ) && $this->settings['add-subdirectory-to-default-language'] == 'yes' ) ||
|
| 52 |
( $language_from_url == null && $needed_language != $this->settings['default-language'] ) ||
|
| 46 |
|
| 47 |
$needed_language = $this->determine_needed_language( $language_from_url, $trp );
|
| 48 |
|
| 49 |
+
$allow_redirect = apply_filters( 'trp_allow_language_redirect', true, $needed_language, $this->url_converter->cur_page_url() );
|
| 50 |
if ( $allow_redirect ) {
|
| 51 |
if ( ( $language_from_url == null && isset( $this->settings['add-subdirectory-to-default-language'] ) && $this->settings['add-subdirectory-to-default-language'] == 'yes' ) ||
|
| 52 |
( $language_from_url == null && $needed_language != $this->settings['default-language'] ) ||
|
includes/class-machine-translation-tab.php
CHANGED
|
@@ -130,13 +130,14 @@ class TRP_Machine_Translation_Tab {
|
|
| 130 |
|
| 131 |
return $engines;
|
| 132 |
}
|
| 133 |
-
|
| 134 |
public function display_unsupported_languages(){
|
| 135 |
$trp = TRP_Translate_Press::get_trp_instance();
|
| 136 |
$machine_translator = $trp->get_component( 'machine_translator' );
|
| 137 |
$trp_languages = $trp->get_component( 'languages' );
|
| 138 |
|
| 139 |
if ( 'yes' === $this->settings['trp_machine_translation_settings']['machine-translation'] &&
|
|
|
|
| 140 |
!$machine_translator->check_languages_availability($this->settings['translation-languages'])
|
| 141 |
){
|
| 142 |
|
| 130 |
|
| 131 |
return $engines;
|
| 132 |
}
|
| 133 |
+
|
| 134 |
public function display_unsupported_languages(){
|
| 135 |
$trp = TRP_Translate_Press::get_trp_instance();
|
| 136 |
$machine_translator = $trp->get_component( 'machine_translator' );
|
| 137 |
$trp_languages = $trp->get_component( 'languages' );
|
| 138 |
|
| 139 |
if ( 'yes' === $this->settings['trp_machine_translation_settings']['machine-translation'] &&
|
| 140 |
+
!empty( $machine_translator->get_api_key() ) &&
|
| 141 |
!$machine_translator->check_languages_availability($this->settings['translation-languages'])
|
| 142 |
){
|
| 143 |
|
includes/class-url-converter.php
CHANGED
|
@@ -105,13 +105,16 @@ class TRP_Url_Converter {
|
|
| 105 |
$path = $_SERVER['REQUEST_URI'];
|
| 106 |
}
|
| 107 |
|
| 108 |
-
//
|
| 109 |
if( strpos($path, 'sitemap') !== false &&
|
| 110 |
-
strpos($path, '.xml')
|
| 111 |
-
|
|
|
|
| 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',
|
|
|
|
|
|
|
| 115 |
){
|
| 116 |
return true;
|
| 117 |
}
|
|
@@ -323,17 +326,15 @@ class TRP_Url_Converter {
|
|
| 323 |
|
| 324 |
$processed_permalink = get_permalink($post_id);
|
| 325 |
|
| 326 |
-
|
| 327 |
-
|
| 328 |
-
} else {
|
| 329 |
-
$arguments = str_replace($processed_permalink, '', $url );
|
| 330 |
-
}
|
| 331 |
|
| 332 |
// if nothing was replaced, something was wrong, just use the normal permalink without any arguments.
|
| 333 |
-
if( $arguments == $
|
|
|
|
| 334 |
|
| 335 |
$TRP_LANGUAGE = $language;
|
| 336 |
-
$new_url = get_permalink(
|
| 337 |
trp_bulk_debug($debug, array('url' => $url, 'new url' => $new_url, 'found post id' => $post_id, 'url type' => 'based on permalink', 'for language' => $TRP_LANGUAGE));
|
| 338 |
$TRP_LANGUAGE = $trp_language_copy;
|
| 339 |
|
|
@@ -754,4 +755,4 @@ class TRP_Url_Converter {
|
|
| 754 |
return $url;
|
| 755 |
}
|
| 756 |
|
| 757 |
-
}
|
| 105 |
$path = $_SERVER['REQUEST_URI'];
|
| 106 |
}
|
| 107 |
|
| 108 |
+
// Verify that this is a sitemap url and that it contains the .xml extension
|
| 109 |
if( strpos($path, 'sitemap') !== false &&
|
| 110 |
+
strpos($path, '.xml') !== false &&
|
| 111 |
+
// Bypass this check if we're on certain filters in order to be able to generate other language urls
|
| 112 |
+
!in_array( 'wpseo_sitemap_url', $wp_current_filter ) &&
|
| 113 |
!in_array( 'seopress_sitemaps_url', $wp_current_filter ) &&
|
| 114 |
+
!in_array( 'rank_math/sitemap/url', $wp_current_filter ) &&
|
| 115 |
+
!in_array( 'aiosp_sitemap_data', $wp_current_filter ) &&
|
| 116 |
+
!in_array( 'aioseo_sitemap_terms', $wp_current_filter ) &&
|
| 117 |
+
!in_array( 'aioseo_sitemap_posts', $wp_current_filter )
|
| 118 |
){
|
| 119 |
return true;
|
| 120 |
}
|
| 326 |
|
| 327 |
$processed_permalink = get_permalink($post_id);
|
| 328 |
|
| 329 |
+
$url_to_replace = ($url_obj->isSchemeless()) ? trailingslashit(trailingslashit( home_url() ) . ltrim($url, '/') ) : $url;
|
| 330 |
+
$arguments = str_replace(untrailingslashit($processed_permalink), '', $url_to_replace );
|
|
|
|
|
|
|
|
|
|
| 331 |
|
| 332 |
// if nothing was replaced, something was wrong, just use the normal permalink without any arguments.
|
| 333 |
+
if( $arguments == $url_to_replace )
|
| 334 |
+
$arguments = '';
|
| 335 |
|
| 336 |
$TRP_LANGUAGE = $language;
|
| 337 |
+
$new_url = trailingslashit( get_permalink($post_id) ) . ltrim($arguments, '/');
|
| 338 |
trp_bulk_debug($debug, array('url' => $url, 'new url' => $new_url, 'found post id' => $post_id, 'url type' => 'based on permalink', 'for language' => $TRP_LANGUAGE));
|
| 339 |
$TRP_LANGUAGE = $trp_language_copy;
|
| 340 |
|
| 755 |
return $url;
|
| 756 |
}
|
| 757 |
|
| 758 |
+
}
|
includes/class-wp-bakery-language-for-blocks.php
ADDED
|
@@ -0,0 +1,262 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
// Exit if accessed directly
|
| 4 |
+
if (!defined('ABSPATH')) {
|
| 5 |
+
exit();
|
| 6 |
+
}
|
| 7 |
+
|
| 8 |
+
class TRP_WPBakery {
|
| 9 |
+
private static $_instance = null;
|
| 10 |
+
|
| 11 |
+
public $shortcode_param_type_dropdown_multi = 'trp_dropdown_multi';
|
| 12 |
+
public $param_name_show = 'trp_param_show';
|
| 13 |
+
public $param_name_show_language = 'trp_param_show_language';
|
| 14 |
+
public $param_name_exclude = 'trp_param_exclude';
|
| 15 |
+
public $param_name_exclude_languages = 'trp_param_exclude_languages';
|
| 16 |
+
|
| 17 |
+
/**
|
| 18 |
+
* Register plugin action hooks and filters
|
| 19 |
+
*/
|
| 20 |
+
public function __construct() {
|
| 21 |
+
add_action('init', [$this, 'init'], PHP_INT_MAX /* We need to collect all available shortcodes */);
|
| 22 |
+
add_filter(
|
| 23 |
+
'do_shortcode_tag',
|
| 24 |
+
[$this, 'do_shortcode_tag'],
|
| 25 |
+
PHP_INT_MAX /* We should be the last one, so no other filter can add additional content */,
|
| 26 |
+
3
|
| 27 |
+
);
|
| 28 |
+
}
|
| 29 |
+
|
| 30 |
+
public function init() {
|
| 31 |
+
if (class_exists('WPBMap')) {
|
| 32 |
+
WPBMap::addAllMappedShortcodes();
|
| 33 |
+
}
|
| 34 |
+
$this->register_dropdown_multi();
|
| 35 |
+
$this->register_params_show_for_shortcodes();
|
| 36 |
+
$this->register_params_exclude_for_shortcodes();
|
| 37 |
+
}
|
| 38 |
+
|
| 39 |
+
/**
|
| 40 |
+
* Modify the output of a given shortcode if TranslatePress is configured.
|
| 41 |
+
*/
|
| 42 |
+
public function do_shortcode_tag($output, $tag, $attr) {
|
| 43 |
+
return $this->is_hidden($attr) ? '' : $output;
|
| 44 |
+
}
|
| 45 |
+
|
| 46 |
+
/**
|
| 47 |
+
* Visual Composer does not a multi-dropdown out-of-the-box. But we can add an alternative
|
| 48 |
+
* `type` which supports the `<select multiple` usage.
|
| 49 |
+
*
|
| 50 |
+
* @see https://stackoverflow.com/a/48125515/5506547
|
| 51 |
+
*/
|
| 52 |
+
private function register_dropdown_multi() {
|
| 53 |
+
vc_add_shortcode_param($this->shortcode_param_type_dropdown_multi, function ($param, $value) {
|
| 54 |
+
if (!is_array($value)) {
|
| 55 |
+
$param_value_arr = explode(',', $value);
|
| 56 |
+
} else {
|
| 57 |
+
$param_value_arr = $value;
|
| 58 |
+
}
|
| 59 |
+
|
| 60 |
+
$param_line = '';
|
| 61 |
+
$param_line .=
|
| 62 |
+
'<select multiple name="' .
|
| 63 |
+
esc_attr($param['param_name']) .
|
| 64 |
+
'" class="wpb_vc_param_value wpb-input wpb-select ' .
|
| 65 |
+
esc_attr($param['param_name']) .
|
| 66 |
+
' ' .
|
| 67 |
+
esc_attr($param['type']) .
|
| 68 |
+
'">';
|
| 69 |
+
foreach ($param['value'] as $text_val => $val) {
|
| 70 |
+
if (is_numeric($text_val) && (is_string($val) || is_numeric($val))) {
|
| 71 |
+
$text_val = $val;
|
| 72 |
+
}
|
| 73 |
+
$selected = '';
|
| 74 |
+
if (!empty($param_value_arr) && in_array($val, $param_value_arr)) {
|
| 75 |
+
$selected = ' selected="selected"';
|
| 76 |
+
}
|
| 77 |
+
$param_line .=
|
| 78 |
+
'<option class="' . $val . '" value="' . $val . '"' . $selected . '>' . $text_val . '</option>';
|
| 79 |
+
}
|
| 80 |
+
$param_line .= '</select>';
|
| 81 |
+
|
| 82 |
+
return $param_line;
|
| 83 |
+
});
|
| 84 |
+
}
|
| 85 |
+
|
| 86 |
+
/**
|
| 87 |
+
* We need to register the parameter attributes for all available shortcodes.
|
| 88 |
+
*
|
| 89 |
+
* @see https://kb.wpbakery.com/docs/inner-api/vc_add_param/
|
| 90 |
+
*/
|
| 91 |
+
private function register_params_show_for_shortcodes() {
|
| 92 |
+
global $shortcode_tags;
|
| 93 |
+
$shortcode_bases = array_keys($shortcode_tags);
|
| 94 |
+
$group = $this->get_group();
|
| 95 |
+
|
| 96 |
+
$attributes_checkbox = [
|
| 97 |
+
'type' => 'checkbox',
|
| 98 |
+
'heading' => __('Restrict element to language', 'translatepress'),
|
| 99 |
+
'param_name' => $this->param_name_show,
|
| 100 |
+
'group' => $group,
|
| 101 |
+
'description' => __('Show this element only in one language.', 'translatepress')
|
| 102 |
+
];
|
| 103 |
+
|
| 104 |
+
$attributes_value = [
|
| 105 |
+
'type' => 'dropdown',
|
| 106 |
+
'heading' => __('Select language', 'translatepress'),
|
| 107 |
+
'param_name' => $this->param_name_show_language,
|
| 108 |
+
'group' => $group,
|
| 109 |
+
'value' => array_flip($this->get_published_languages(true)),
|
| 110 |
+
'description' => __('Choose in which language to show this element.', 'translatepress'),
|
| 111 |
+
'dependency' => [
|
| 112 |
+
'element' => $this->param_name_show,
|
| 113 |
+
'value' => 'true'
|
| 114 |
+
]
|
| 115 |
+
];
|
| 116 |
+
|
| 117 |
+
$skip_sc = apply_filters( 'trp_wpbakery_skip_shortcodes', $this->get_skip_sc_array());
|
| 118 |
+
foreach ($shortcode_bases as $sh) {
|
| 119 |
+
if ( !in_array( $sh, $skip_sc ) ) {
|
| 120 |
+
vc_add_param( $sh, $attributes_checkbox );
|
| 121 |
+
vc_add_param( $sh, $attributes_value );
|
| 122 |
+
}
|
| 123 |
+
}
|
| 124 |
+
}
|
| 125 |
+
|
| 126 |
+
/**
|
| 127 |
+
* We need to register the parameter attributes for all available shortcodes.
|
| 128 |
+
*
|
| 129 |
+
* @see https://kb.wpbakery.com/docs/inner-api/vc_add_param/
|
| 130 |
+
*/
|
| 131 |
+
private function register_params_exclude_for_shortcodes() {
|
| 132 |
+
global $shortcode_tags;
|
| 133 |
+
$shortcode_bases = array_keys($shortcode_tags);
|
| 134 |
+
$group = $this->get_group();
|
| 135 |
+
|
| 136 |
+
$attributes_checkbox = [
|
| 137 |
+
'type' => 'checkbox',
|
| 138 |
+
'heading' => __('Exclude from Language', 'translatepress'),
|
| 139 |
+
'param_name' => $this->param_name_exclude,
|
| 140 |
+
'group' => $group,
|
| 141 |
+
'description' => __('Exclude this element from specific languages.', 'translatepress')
|
| 142 |
+
];
|
| 143 |
+
|
| 144 |
+
$message =
|
| 145 |
+
'<p>' .
|
| 146 |
+
__(
|
| 147 |
+
'This element will still be visible when you are translating your website through the Translation Editor.',
|
| 148 |
+
'translatepress'
|
| 149 |
+
) .
|
| 150 |
+
'</p>';
|
| 151 |
+
$message .=
|
| 152 |
+
'<p>' .
|
| 153 |
+
__('The content of this element should be written in the default language.', 'translatepress') .
|
| 154 |
+
'</p>';
|
| 155 |
+
|
| 156 |
+
$attributes_value = [
|
| 157 |
+
'type' => $this->shortcode_param_type_dropdown_multi,
|
| 158 |
+
'heading' => __('Select languages', 'translatepress'),
|
| 159 |
+
'param_name' => $this->param_name_exclude_languages,
|
| 160 |
+
'group' => $group,
|
| 161 |
+
'value' => array_flip($this->get_published_languages(true)),
|
| 162 |
+
'description' => __('Choose from which languages to exclude this element.', 'translatepress') . $message,
|
| 163 |
+
'dependency' => [
|
| 164 |
+
'element' => $this->param_name_exclude,
|
| 165 |
+
'value' => 'true'
|
| 166 |
+
]
|
| 167 |
+
];
|
| 168 |
+
|
| 169 |
+
$skip_sc = apply_filters( 'trp_wpbakery_skip_shortcodes', $this->get_skip_sc_array());
|
| 170 |
+
foreach ($shortcode_bases as $sh) {
|
| 171 |
+
if ( !in_array( $sh, $skip_sc ) ) {
|
| 172 |
+
vc_add_param( $sh, $attributes_checkbox );
|
| 173 |
+
vc_add_param( $sh, $attributes_value );
|
| 174 |
+
}
|
| 175 |
+
}
|
| 176 |
+
}
|
| 177 |
+
|
| 178 |
+
private function get_group() {
|
| 179 |
+
return __('TranslatePress', 'translatepress');
|
| 180 |
+
}
|
| 181 |
+
|
| 182 |
+
private function get_published_languages($placeholder = false) {
|
| 183 |
+
$trp = TRP_Translate_Press::get_trp_instance();
|
| 184 |
+
$trp_languages = $trp->get_component('languages');
|
| 185 |
+
$trp_settings = $trp->get_component('settings');
|
| 186 |
+
$result = $trp_languages->get_language_names($trp_settings->get_settings()['publish-languages']);
|
| 187 |
+
|
| 188 |
+
if ($placeholder) {
|
| 189 |
+
$result = array_merge(['' => ''], $result);
|
| 190 |
+
}
|
| 191 |
+
return $result;
|
| 192 |
+
}
|
| 193 |
+
|
| 194 |
+
private function is_inline_editor() {
|
| 195 |
+
return ( isset($_GET['vc_action']) && $_GET['vc_action'] === 'vc_inline' ) ||
|
| 196 |
+
( isset($_GET['vc_editable']) && $_GET['vc_editable'] === 'true' );
|
| 197 |
+
}
|
| 198 |
+
|
| 199 |
+
private function is_hidden($attr) {
|
| 200 |
+
if (!is_array($attr) || $this->is_inline_editor()) {
|
| 201 |
+
return false;
|
| 202 |
+
}
|
| 203 |
+
|
| 204 |
+
// Restrict to only one language
|
| 205 |
+
if (isset($attr[$this->param_name_show], $attr[$this->param_name_show_language])) {
|
| 206 |
+
$current_language = get_locale();
|
| 207 |
+
|
| 208 |
+
if ($current_language !== $attr[$this->param_name_show_language]) {
|
| 209 |
+
return true;
|
| 210 |
+
}
|
| 211 |
+
}
|
| 212 |
+
|
| 213 |
+
// Exclude to multiple languages
|
| 214 |
+
if (isset($attr[$this->param_name_exclude], $attr[$this->param_name_exclude_languages])) {
|
| 215 |
+
$current_language = get_locale();
|
| 216 |
+
$exclude = explode(',', $attr[$this->param_name_exclude_languages]);
|
| 217 |
+
|
| 218 |
+
if (in_array($current_language, $exclude)) {
|
| 219 |
+
return true;
|
| 220 |
+
}
|
| 221 |
+
}
|
| 222 |
+
|
| 223 |
+
return false;
|
| 224 |
+
}
|
| 225 |
+
|
| 226 |
+
/**
|
| 227 |
+
*
|
| 228 |
+
* Ensures only one instance of the class is loaded or can be loaded.
|
| 229 |
+
*
|
| 230 |
+
* @return TRP_WPBakery An instance of the class.
|
| 231 |
+
*/
|
| 232 |
+
public static function instance() {
|
| 233 |
+
if (is_null(self::$_instance)) {
|
| 234 |
+
self::$_instance = new self();
|
| 235 |
+
}
|
| 236 |
+
|
| 237 |
+
return self::$_instance;
|
| 238 |
+
}
|
| 239 |
+
|
| 240 |
+
/**
|
| 241 |
+
*
|
| 242 |
+
* Shortcodes with missing 'params' trigger notice, so don't add TP settings to them
|
| 243 |
+
*
|
| 244 |
+
* @return array of shortcodes to skip
|
| 245 |
+
*/
|
| 246 |
+
public function get_skip_sc_array(){
|
| 247 |
+
$skip_sc = array();
|
| 248 |
+
$sc = WPBMap::getAllShortCodes();
|
| 249 |
+
if ( isset( $sc) && is_array($sc) ){
|
| 250 |
+
foreach( $sc as $key => $value ){
|
| 251 |
+
if ( isset($sc[$key] ) && !isset($sc[$key]['params'])){
|
| 252 |
+
$skip_sc[] = $key;
|
| 253 |
+
}
|
| 254 |
+
}
|
| 255 |
+
}
|
| 256 |
+
return $skip_sc;
|
| 257 |
+
}
|
| 258 |
+
|
| 259 |
+
}
|
| 260 |
+
|
| 261 |
+
// Instantiate Plugin Class
|
| 262 |
+
TRP_WPBakery::instance();
|
includes/compatibility-functions.php
CHANGED
|
@@ -1341,4 +1341,23 @@ function trp_force_search( $bool ){
|
|
| 1341 |
$bool = true;
|
| 1342 |
|
| 1343 |
return $bool;
|
| 1344 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1341 |
$bool = true;
|
| 1342 |
|
| 1343 |
return $bool;
|
| 1344 |
+
}
|
| 1345 |
+
|
| 1346 |
+
/**
|
| 1347 |
+
* Strip tags manually from a problematic string coming from the My Listing theme
|
| 1348 |
+
*/
|
| 1349 |
+
add_action('init', 'trp_mylisting_hook_exclude_string' );
|
| 1350 |
+
function trp_mylisting_hook_exclude_string(){
|
| 1351 |
+
if( class_exists( 'MyListing\\App' ) ){
|
| 1352 |
+
add_filter('gettext_with_context', 'trp_mylisting_exclude_string', 101, 4 );
|
| 1353 |
+
}
|
| 1354 |
+
}
|
| 1355 |
+
|
| 1356 |
+
function trp_mylisting_exclude_string( $translation, $text, $context, $domain ){
|
| 1357 |
+
|
| 1358 |
+
if( $domain == 'my-listing' && $text == 'my-listings' )
|
| 1359 |
+
$translation = TRP_Translation_Manager::strip_gettext_tags( $translation );
|
| 1360 |
+
|
| 1361 |
+
return $translation;
|
| 1362 |
+
|
| 1363 |
+
}
|
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.9.
|
| 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.9.5
|
| 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
|
@@ -328,6 +328,8 @@
|
|
| 328 |
<?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"); ?>
|
| 329 |
<?php __("Disable post container tags for post content", "translatepress-multilingual"); ?>
|
| 330 |
<?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"); ?>
|
|
|
|
|
|
|
| 331 |
<?php __("Automatically translate slugs", "translatepress-multilingual"); ?>
|
| 332 |
<?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"); ?>
|
| 333 |
<?php __("Enable the hreflang x-default tag for language:", "translatepress-multilingual"); ?>
|
| 328 |
<?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"); ?>
|
| 329 |
<?php __("Disable post container tags for post content", "translatepress-multilingual"); ?>
|
| 330 |
<?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"); ?>
|
| 331 |
+
<?php __("Do not translate certain paths", "translatepress-multilingual"); ?>
|
| 332 |
+
<?php __("Choose what paths can be translated. Supports wildcard at the end of the path.<br>For example, to exclude https://example.com/some/path you can either use the rule /some/path/ or /some/*.<br>Enter each rule on it's own line. To exclude the home page use {{home}}.", "translatepress-multilingual"); ?>
|
| 333 |
<?php __("Automatically translate slugs", "translatepress-multilingual"); ?>
|
| 334 |
<?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"); ?>
|
| 335 |
<?php __("Enable the hreflang x-default tag for language:", "translatepress-multilingual"); ?>
|
languages/translatepress-multilingual.pot
CHANGED
|
@@ -97,7 +97,7 @@ msgstr ""
|
|
| 97 |
msgid "Are you sure you want to remove this language?"
|
| 98 |
msgstr ""
|
| 99 |
|
| 100 |
-
#: ../tp-add-on-extra-languages/partials/language-selector-pro.php:43, includes/class-advanced-tab.php:
|
| 101 |
msgid "Remove"
|
| 102 |
msgstr ""
|
| 103 |
|
|
@@ -105,7 +105,7 @@ msgstr ""
|
|
| 105 |
msgid "Choose..."
|
| 106 |
msgstr ""
|
| 107 |
|
| 108 |
-
#: ../tp-add-on-extra-languages/partials/language-selector-pro.php:58, includes/class-advanced-tab.php:
|
| 109 |
msgid "Add"
|
| 110 |
msgstr ""
|
| 111 |
|
|
@@ -133,15 +133,15 @@ msgstr ""
|
|
| 133 |
msgid "Advanced"
|
| 134 |
msgstr ""
|
| 135 |
|
| 136 |
-
#: includes/class-advanced-tab.php:
|
| 137 |
msgid "Yes"
|
| 138 |
msgstr ""
|
| 139 |
|
| 140 |
-
#: includes/class-advanced-tab.php:
|
| 141 |
msgid "Are you sure you want to remove this item?"
|
| 142 |
msgstr ""
|
| 143 |
|
| 144 |
-
#: includes/class-advanced-tab.php:
|
| 145 |
msgid "Select..."
|
| 146 |
msgstr ""
|
| 147 |
|
|
@@ -277,19 +277,19 @@ msgstr ""
|
|
| 277 |
msgid "DeepL"
|
| 278 |
msgstr ""
|
| 279 |
|
| 280 |
-
#: includes/class-machine-translation-tab.php:
|
| 281 |
msgid "Unsupported languages"
|
| 282 |
msgstr ""
|
| 283 |
|
| 284 |
-
#: includes/class-machine-translation-tab.php:
|
| 285 |
msgid "Recheck supported languages"
|
| 286 |
msgstr ""
|
| 287 |
|
| 288 |
-
#: includes/class-machine-translation-tab.php:
|
| 289 |
msgid "(last checked on %s)"
|
| 290 |
msgstr ""
|
| 291 |
|
| 292 |
-
#: includes/class-machine-translation-tab.php:
|
| 293 |
msgid "The selected automatic translation engine does not provide support for these languages.<br>You can still manually translate pages in these languages using the Translation Editor."
|
| 294 |
msgstr ""
|
| 295 |
|
|
@@ -1329,6 +1329,14 @@ msgstr ""
|
|
| 1329 |
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."
|
| 1330 |
msgstr ""
|
| 1331 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1332 |
#: includes/advanced-settings/enable-auto-translate-slug.php:8
|
| 1333 |
msgid "Automatically translate slugs"
|
| 1334 |
msgstr ""
|
| 97 |
msgid "Are you sure you want to remove this language?"
|
| 98 |
msgstr ""
|
| 99 |
|
| 100 |
+
#: ../tp-add-on-extra-languages/partials/language-selector-pro.php:43, includes/class-advanced-tab.php:502, includes/class-advanced-tab.php:513, includes/class-advanced-tab.php:601, includes/class-advanced-tab.php:632, partials/main-settings-language-selector.php:40
|
| 101 |
msgid "Remove"
|
| 102 |
msgstr ""
|
| 103 |
|
| 105 |
msgid "Choose..."
|
| 106 |
msgstr ""
|
| 107 |
|
| 108 |
+
#: ../tp-add-on-extra-languages/partials/language-selector-pro.php:58, includes/class-advanced-tab.php:513, includes/class-advanced-tab.php:632, partials/main-settings-language-selector.php:55
|
| 109 |
msgid "Add"
|
| 110 |
msgstr ""
|
| 111 |
|
| 133 |
msgid "Advanced"
|
| 134 |
msgstr ""
|
| 135 |
|
| 136 |
+
#: includes/class-advanced-tab.php:305, includes/class-error-manager.php:155, partials/machine-translation-settings-page.php:13, partials/machine-translation-settings-page.php:78, partials/machine-translation-settings-page.php:111, partials/main-settings-page.php:41, partials/main-settings-page.php:54, partials/main-settings-page.php:67
|
| 137 |
msgid "Yes"
|
| 138 |
msgstr ""
|
| 139 |
|
| 140 |
+
#: includes/class-advanced-tab.php:502, includes/class-advanced-tab.php:513, includes/class-advanced-tab.php:601, includes/class-advanced-tab.php:632
|
| 141 |
msgid "Are you sure you want to remove this item?"
|
| 142 |
msgstr ""
|
| 143 |
|
| 144 |
+
#: includes/class-advanced-tab.php:585, includes/class-advanced-tab.php:619
|
| 145 |
msgid "Select..."
|
| 146 |
msgstr ""
|
| 147 |
|
| 277 |
msgid "DeepL"
|
| 278 |
msgstr ""
|
| 279 |
|
| 280 |
+
#: includes/class-machine-translation-tab.php:148
|
| 281 |
msgid "Unsupported languages"
|
| 282 |
msgstr ""
|
| 283 |
|
| 284 |
+
#: includes/class-machine-translation-tab.php:159
|
| 285 |
msgid "Recheck supported languages"
|
| 286 |
msgstr ""
|
| 287 |
|
| 288 |
+
#: includes/class-machine-translation-tab.php:160
|
| 289 |
msgid "(last checked on %s)"
|
| 290 |
msgstr ""
|
| 291 |
|
| 292 |
+
#: includes/class-machine-translation-tab.php:162
|
| 293 |
msgid "The selected automatic translation engine does not provide support for these languages.<br>You can still manually translate pages in these languages using the Translation Editor."
|
| 294 |
msgstr ""
|
| 295 |
|
| 1329 |
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."
|
| 1330 |
msgstr ""
|
| 1331 |
|
| 1332 |
+
#: includes/advanced-settings/do-not-translate-certain-paths.php:10
|
| 1333 |
+
msgid "Do not translate certain paths"
|
| 1334 |
+
msgstr ""
|
| 1335 |
+
|
| 1336 |
+
#: includes/advanced-settings/do-not-translate-certain-paths.php:11
|
| 1337 |
+
msgid "Choose what paths can be translated. Supports wildcard at the end of the path.<br>For example, to exclude https://example.com/some/path you can either use the rule /some/path/ or /some/*.<br>Enter each rule on it's own line. To exclude the home page use {{home}}."
|
| 1338 |
+
msgstr ""
|
| 1339 |
+
|
| 1340 |
#: includes/advanced-settings/enable-auto-translate-slug.php:8
|
| 1341 |
msgid "Automatically translate slugs"
|
| 1342 |
msgstr ""
|
readme.txt
CHANGED
|
@@ -3,9 +3,9 @@ Contributors: cozmoslabs, razvan.mo, madalin.ungureanu, sareiodata, cristophor
|
|
| 3 |
Donate link: https://www.translatepress.com/
|
| 4 |
Tags: translate, translation, multilingual, automatic translation, bilingual, front-end translation, google translate, language
|
| 5 |
Requires at least: 3.1.0
|
| 6 |
-
Tested up to: 5.6
|
| 7 |
Requires PHP: 5.6.20
|
| 8 |
-
Stable tag: 1.9.
|
| 9 |
License: GPLv2 or later
|
| 10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
| 11 |
|
|
@@ -138,6 +138,14 @@ For more information please check out our [documentation](https://translatepress
|
|
| 138 |
|
| 139 |
|
| 140 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 141 |
= 1.9.4 =
|
| 142 |
* Updated DOM parser to version 1.9.1, this should fix a bunch of broken HTML issues
|
| 143 |
* Fixed a case in Woocommerce where slugs weren't translated from the seo-pack addon
|
| 3 |
Donate link: https://www.translatepress.com/
|
| 4 |
Tags: translate, translation, multilingual, automatic translation, bilingual, front-end translation, google translate, language
|
| 5 |
Requires at least: 3.1.0
|
| 6 |
+
Tested up to: 5.6.1
|
| 7 |
Requires PHP: 5.6.20
|
| 8 |
+
Stable tag: 1.9.5
|
| 9 |
License: GPLv2 or later
|
| 10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
| 11 |
|
| 138 |
|
| 139 |
|
| 140 |
== Changelog ==
|
| 141 |
+
= 1.9.5 =
|
| 142 |
+
* Added setting that allows you to translate only certain paths or exclude certain paths from being translated.
|
| 143 |
+
* Fixed some cases where GET parameters were lost from links in translated languages
|
| 144 |
+
* WP Bakery integration that allow to include/exclude blocks for languages
|
| 145 |
+
* Added a compatibility for the MyListing theme.
|
| 146 |
+
* Load unsupported languages section only if an API key is saved.
|
| 147 |
+
* Add support for AIO SEO sitemap detection
|
| 148 |
+
|
| 149 |
= 1.9.4 =
|
| 150 |
* Updated DOM parser to version 1.9.1, this should fix a bunch of broken HTML issues
|
| 151 |
* Fixed a case in Woocommerce where slugs weren't translated from the seo-pack addon
|
