PATH:
home
/
sparklp6
/
public_html
/
website_356c8563
/
wp-content
/
plugins
/
translatepress-multilingual
/
includes
<?php if ( !defined('ABSPATH' ) ) exit(); // add conditional language shortcode /** * Old shortcode that displays different content in a particular language * * @deprecated 2.9.21 Use the shortcode language_include or language_exclude instead. * @see trp_include_content_in_language(), trp_exclude_content_in_language()) */ add_shortcode( 'trp_language', 'trp_language_content'); /* --------------------------------------------------------------------------- * Shortcode [trp_language language="en_US"] [/trp_language] * --------------------------------------------------------------------------- */ function trp_language_content( $attr, $content = null ){ global $TRP_LANGUAGE_SHORTCODE; if (!isset($TRP_LANGUAGE_SHORTCODE)){ $TRP_LANGUAGE_SHORTCODE = array(); } $TRP_LANGUAGE_SHORTCODE[] = $content; $attr = shortcode_atts(array( 'language' => '', ), $attr); $current_language = get_locale(); if( $current_language == $attr['language'] ){ $output = do_shortcode($content); }else{ $output = ""; } return $output; } // add conditional languages shortcode add_shortcode( 'language-include', 'trp_include_content_in_language'); /* --------------------------------------------------------------------------- * Shortcode [language-include lang="en_us,fr_fr,ro_RO" enable_translation="yes" (default value)] [/language-include] * * Displays content in the chosen languages (attribute lang="") and allows to decide if the content should be translatable or not * ( enable_translation="yes"/"no" - default value is "yes" ) * --------------------------------------------------------------------------- */ function trp_include_content_in_language( $attr, $content = null ){ $attr = shortcode_atts([ 'lang' => '', 'enable_translation' => 'yes', // default is "yes" if not set ], $attr, 'language-include'); $output = trp_get_include_exclude_content( true, $attr['lang'], $attr['enable_translation'], $content ); return $output; } // add conditional language shortcode add_shortcode( 'language-exclude', 'trp_exclude_content_in_language'); /* --------------------------------------------------------------------------- * Shortcode [language-exclude lang="en_us,fr_fr,ro_RO" enable_translation="yes" (default value)] [/language-exclude] * * Restricts content in the chosen languages (attribute lang="") and allows to decide if the content should be translatable or not * ( enable_translation="yes"/"no" - default value is "yes" ) * --------------------------------------------------------------------------- */ function trp_exclude_content_in_language( $attr, $content = null ){ $attr = shortcode_atts([ 'lang' => '', 'enable_translation' => 'yes', // default is "yes" if not set ], $attr, 'language-exclude'); $output = trp_get_include_exclude_content( false, $attr['lang'], $attr['enable_translation'], $content ); return $output; } // function to be called inside the language_include/ exclude shortcodes // $include can be true or false function trp_get_include_exclude_content( $include, $allowed_languages, $enable_translation_var, $content = null ) { global $TRP_LANGUAGE; $allowed_languages = array_map('trim', explode(',', strtolower($allowed_languages))); $enable_translation = true; if (isset($enable_translation_var)) { $value = strtolower(trim($enable_translation_var)); if ($value === 'no') { $enable_translation = false; } } if ($include === in_array(strtolower($TRP_LANGUAGE), $allowed_languages)) { /* "include the content" and "current language is among specified languages" * OR * "exclude the content" and "current language is NOT among specified languages" */ $output = $enable_translation ? do_shortcode($content) : do_shortcode('<trp-tag data-no-translation>' . $content . '</trp-tag>'); }else{ $output = ""; } return $output; } add_filter('trp_exclude_words_from_automatic_translation', 'trp_add_shortcode_content_to_excluded_words_from_auto_translation'); function trp_add_shortcode_content_to_excluded_words_from_auto_translation($excluded_words){ global $TRP_LANGUAGE_SHORTCODE; if (!isset($TRP_LANGUAGE_SHORTCODE)){ $TRP_LANGUAGE_SHORTCODE = array(); } $excluded_words = array_merge($excluded_words, $TRP_LANGUAGE_SHORTCODE); return $excluded_words; }
[-] class-plugin-notices.php
[edit]
[-] class-editor-api-gettext-strings.php
[edit]
[-] class-machine-translator-logger.php
[edit]
[-] functions.php
[edit]
[-] class-check-invalid-text.php
[edit]
[+]
google-translate
[-] .htaccess
[edit]
[-] class-error-manager.php
[edit]
[+]
gutenberg-blocks
[-] external-functions.php
[edit]
[+]
string-translation
[-] class-upgrade.php
[edit]
[-] class-editor-api-regular-strings.php
[edit]
[-] class-translation-manager.php
[edit]
[+]
queries
[-] class-elementor-language-for-blocks.php
[edit]
[-] class-advanced-tab.php
[edit]
[-] class-search.php
[edit]
[-] class-hooks-loader.php
[edit]
[+]
gettext
[-] class-ai-words-notification.php
[edit]
[-] class-reviews.php
[edit]
[-] class-plugin-optin.php
[edit]
[-] class-translation-memory.php
[edit]
[-] class-machine-translation-tab.php
[edit]
[-] class-support-chat.php
[edit]
[-] shortcodes.php
[edit]
[-] class-preferred-user-language.php
[edit]
[+]
onboarding
[-] class-language-switcher.php
[edit]
[-] class-languages.php
[edit]
[+]
upgrade
[+]
advanced-settings
[-] trp-ajax.php
[edit]
[-] class-onboarding.php
[edit]
[-] class-wp-bakery-language-for-blocks.php
[edit]
[-] class-rewrite-rules.php
[edit]
[-] class-language-switcher-tab.php
[edit]
[-] class-language-switcher-v2.php
[edit]
[-] compatibility-functions.php
[edit]
[-] class-woocommerce-emails.php
[edit]
[-] class-translation-render.php
[edit]
[-] class-install-plugins.php
[edit]
[-] class-edd-sl-plugin-updater.php
[edit]
[-] class-machine-translator.php
[edit]
[-] custom-language.php
[edit]
[-] class-settings.php
[edit]
[-] class-uri.php
[edit]
[-] class-url-converter.php
[edit]
[+]
mtapi
[+]
..