PATH:
var
/
www
/
clients
/
client1
/
web1
/
web
/
wp-content
/
sitepress-multilingual-cms
/
classes
<?php /** * Class WPML_TM_Translators_Dropdown */ class WPML_TM_Translators_Dropdown { /** * @var WPML_TM_Blog_Translators $blog_translators */ private $blog_translators; /** * @param WPML_TM_Blog_Translators $blog_translators */ public function __construct( $blog_translators ) { $this->blog_translators = $blog_translators; } /** * @param array $args * * @return string */ public function render( $args = array() ) { $dropdown = ''; /** @var $from string|false */ /** @var $to string|false */ /** @var $classes string|false */ /** @var $id string|false */ /** @var $name string|false */ /** @var $selected bool */ /** @var $echo bool */ /** @var $add_label bool */ /** @var $services array */ /** @var $disabled bool */ /** @var $default_name bool|string */ /** @var $local_only bool */ // set default value for variables $from = false; $to = false; $id = 'translator_id'; $name = 'translator_id'; $selected = 0; $echo = true; $add_label = false; $services = array( 'local' ); $disabled = false; $default_name = false; $local_only = false; extract( $args, EXTR_OVERWRITE ); $translators = array(); $id .= $from ? '_' . $from . ( $to ? '_' . $to : '' ) : ''; try { $translation_service = TranslationProxy::get_current_service(); $translation_service_id = TranslationProxy::get_current_service_id(); $translation_service_name = TranslationProxy::get_current_service_name(); $is_service_authenticated = TranslationProxy::is_service_authenticated(); // if translation service does not support translators choice, always shows first available if ( isset( $translation_service->id ) && ! TranslationProxy::translator_selection_available() && $is_service_authenticated ) { $translators[] = (object) array( 'ID' => TranslationProxy_Service::get_wpml_translator_id( $translation_service->id ), 'display_name' => __( 'First available', 'wpml-translation-management' ), 'service' => $translation_service_name, ); } elseif ( in_array( $translation_service_id, $services ) && $is_service_authenticated ) { $lang_status = TranslationProxy_Translator::get_language_pairs(); if ( empty( $lang_status ) ) { $lang_status = array(); } foreach ( (array) $lang_status as $language_pair ) { if ( $from && $from != $language_pair['from'] ) { continue; } if ( $to && $to != $language_pair['to'] ) { continue; } if ( ! empty( $language_pair['translators'] ) ) { if ( 1 < count( $language_pair['translators'] ) ) { $translators[] = (object) array( 'ID' => TranslationProxy_Service::get_wpml_translator_id( $translation_service->id ), 'display_name' => __( 'First available', 'wpml-translation-management' ), 'service' => $translation_service_name, ); } foreach ( $language_pair['translators'] as $tr ) { if ( ! isset( $_icl_translators[ $tr['id'] ] ) ) { $translators[] = $_icl_translators[ $tr['id'] ] = (object) array( 'ID' => TranslationProxy_Service::get_wpml_translator_id( $translation_service->id, $tr['id'] ), 'display_name' => $tr['nickname'], 'service' => $translation_service_name, ); } } } } } if ( in_array( 'local', $services ) ) { $translators[] = (object) array( 'ID' => 0, 'display_name' => __( 'First available', 'wpml-translation-management' ), ); $translators = array_merge( $translators, $this->blog_translators->get_blog_translators( array( 'from' => $from, 'to' => $to, ) ) ); } $translators = apply_filters( 'wpml_tm_translators_list', $translators ); $dropdown .= '<select id="' . esc_attr( $id ) . '" class="js-wpml-translator-dropdown" data-lang-to="' . esc_attr( $to ) . '" name="' . esc_attr( $name ) . '" ' . ( $disabled ? 'disabled="disabled"' : '' ) . '>'; if ( $default_name ) { $dropdown_selected = selected( $selected, false, false ); $dropdown .= '<option value="" ' . $dropdown_selected . '>'; $dropdown .= esc_html( $default_name ); $dropdown .= '</option>'; } foreach ( $translators as $t ) { if ( $local_only && isset( $t->service ) ) { continue; } $current_translator = $t->ID; $dropdown_selected = selected( $selected, $current_translator, false ); $dropdown .= '<option value="' . $current_translator . '" ' . $dropdown_selected . '>'; $dropdown .= isset( $t->service ) ? $t->service : esc_html( $t->display_name ); $dropdown .= '</option>'; } $dropdown .= '</select>'; } catch ( WPMLTranslationProxyApiException $ex ) { $dropdown .= esc_html__( 'Translation Proxy error', 'wpml-translation-management' ) . ': ' . $ex->getMessage(); } catch ( Exception $ex ) { $dropdown .= esc_html__( 'Error', 'wpml-translation-management' ) . ': ' . $ex->getMessage(); } if ( $add_label ) { $dropdown = '<label for="' . esc_attr( $id ) . '">' . esc_html__( 'Translation jobs for:', 'wpml-translation-management' ) . '</label> ' . $dropdown; } if ( $echo ) { echo $dropdown; } return $dropdown; } }
[+]
wpml-wp
[+]
ajax
[-] class-wpml-tm-translators-dropdown.php
[edit]
[+]
translation-priorities
[-] class-wpml-tm-promotions.php
[edit]
[+]
hooks
[+]
ICL-20-migration
[+]
templates
[+]
action-filter-loader
[-] class-wpml-translation-proxy-api.php
[edit]
[+]
wpml-st
[+]
utilities
[-] class-wpml-tm-translated-field.php
[edit]
[+]
requirements
[+]
sticky-posts
[-] class-wpml-tm-page.php
[edit]
[+]
icl
[+]
display-as-translated
[+]
custom-field-translation
[+]
language
[+]
ATE
[+]
shortcodes
[+]
translate_link_targets
[+]
core-abstract-classes
[+]
full-site-editing
[+]
settings
[-] class-wpml-file.php
[edit]
[+]
xliff
[+]
reset
[+]
REST-hooks
[+]
comments
[+]
plugins
[+]
templating
[+]
container
[+]
taxonomy
[+]
cookie
[-] class-wpml-tm-requirements.php
[edit]
[+]
translation-dashboard
[+]
helpers
[+]
translation-feedback
[+]
admin-language-switcher
[-] class-wpml-tm-troubleshooting-clear-ts.php
[edit]
[+]
jobs
[+]
compatibility
[+]
wp-core-hooks
[+]
post-edit-screen
[-] class-wpml-tm-troubleshooting-clear-ts-ui.php
[edit]
[+]
translation-jobs
[+]
logging
[+]
roles
[+]
media
[-] class-wpml-active-plugin-provider.php
[edit]
[+]
media-translation
[-] class-wpml-config-update.php
[edit]
[+]
seo
[+]
options
[+]
Installer
[-] class-wpml-tm-ajax-factory-2.php
[edit]
[+]
automatic-translation
[+]
troubleshoot
[+]
records
[-] class-wpml-translate-independently.php
[edit]
[+]
abstract
[-] class-wpml-tm-resources-factory.php
[edit]
[+]
post-types
[+]
wp-cli
[+]
translation-proxy
[-] class-wpml-tm-loader.php
[edit]
[-] class-wpml-config-update-integrator.php
[edit]
[-] class-wpml-theme-localization-type.php
[edit]
[+]
taxonomy-term-translation
[+]
setup
[+]
language-switcher
[+]
translation-mode
[+]
jobs-deadline
[+]
database-queries
[+]
utils
[+]
translation-basket
[-] ISitePress.php
[edit]
[-] class-wpml-current-screen.php
[edit]
[-] class-wpml-tm-ajax-factory.php
[edit]
[+]
admin-bar
[+]
canonicals
[+]
custom-xml-config
[-] class-wpml-db-chunk.php
[edit]
[+]
url-handling
[+]
admin-resources
[+]
theme-plugin-localization
[+]
ui-elements
[+]
languages
[+]
wizard
[-] LanguageNegotiation.php
[edit]
[-] class-wpml-browser-redirect.php
[edit]
[+]
menu
[-] class-wpml-mo-file-search.php
[edit]
[+]
query-filtering
[+]
translation-management
[+]
filters
[-] class-wpml-xmlrpc.php
[edit]
[-] class-wpml-site-id.php
[edit]
[+]
block-editor
[+]
icl-to-ate-migration
[+]
translations
[+]
user-language
[+]
..
[+]
menu-elements
[+]
translation-batch
[-] class-wpml-tm-api.php
[edit]
[-] class-wpml-translation-management.php
[edit]
[-] class-wpml-translation-job-factory.php
[edit]
[+]
xml-config
[+]
REST
[+]
editor
[+]
admin-menu
[+]
localization
[+]
tp-client
[+]
translation-roles
[-] Geolocalization.php
[edit]
[+]
wp
[+]
API
[+]
twig-extensions
[+]
troubleshooting
[+]
privacy
[+]
user
[-] class-wpml-tm-service-activation-ajax.php
[edit]
[+]
widgets
[+]
super-globals
[+]
emails
[+]
words-count
[+]
support
[+]
post-translation
[+]
browser-language-redirect
[+]
request-handling
[+]
notices
[+]
upgrade