本文整理汇总了PHP中TranslationManagement::get_selected_translator方法的典型用法代码示例。如果您正苦于以下问题:PHP TranslationManagement::get_selected_translator方法的具体用法?PHP TranslationManagement::get_selected_translator怎么用?PHP TranslationManagement::get_selected_translator使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TranslationManagement
的用法示例。
在下文中一共展示了TranslationManagement::get_selected_translator方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: build_content_translators
public function build_content_translators()
{
global $current_user;
$selected_translator = $this->tm_instance->get_selected_translator();
$active_service = $this->active_service;
$service_name = $this->service_name;
if (current_user_can('list_users') || current_user_can('manage_options')) {
add_filter('icl_translation_services_button', array($this, 'icl_local_add_translator_button'));
add_filter('icl_translation_services_button', array('TranslationProxy', 'get_current_service_info'));
$only_local_translators = $active_service && (!TranslationProxy_Service::is_authenticated($active_service) || $active_service && !$active_service->has_translator_selection);
?>
<div id="icl-your-translators">
<?php
if ($active_service && TranslationProxy::translator_selection_available()) {
if ($only_local_translators) {
$translation_dashboard_url = "admin.php?page=" . WPML_TM_FOLDER . "/menu/main.php&sm=dashboard";
$translation_dashboard_link = sprintf('<a href="%s">' . __('Translation Dashboard', 'wpml-translation-management') . '</a>', $translation_dashboard_url);
$service_html = '<p>';
$service_html .= sprintf(__('This section is for selecting WPML (local) translators only. If you wish to use %s, please go to %s.'), '<strong>' . $service_name . '</strong>', $translation_dashboard_link);
$service_html .= '</p>';
} else {
$service_html = TranslationProxy::get_service_translators_info();
}
ICL_AdminNotifier::display_instant_message($service_html);
}
if ($selected_translator && $selected_translator->ID) {
// Edit form
echo '<h3>' . __('Edit translator', 'wpml-translation-management') . '</h3>';
echo '<form id="icl_tm_adduser" method="post" action="">' . "\r\n";
echo $this->icl_local_edit_translator_form('edit', $selected_translator) . "\r\n";
echo '</form>' . "\r\n";
} else {
// Services add translator form
// Services hook
$services_buttons = apply_filters('icl_translation_services_button', array());
if (!empty($services_buttons)) {
if (!$only_local_translators) {
// Toggle button
echo '<input type="submit" class="button secondary" id="icl_add_translator_form_toggle" value="' . __('Add Translator', 'wpml-translation-management') . ' »" />' . "\r\n";
}
// Toggle div start
$form_classes = array('translator-form-wrapper');
if (!isset($_GET['service']) && !$only_local_translators) {
$form_classes[] = 'hidden';
}
echo '<div id="icl_add_translator_form_wrapper" class="' . implode(' ', $form_classes) . '">';
// Open form
echo '<form id="icl_tm_adduser" method="post" action="">';
$languages = $this->get_translation_languages();
$from = '<label>' . __('From language:', 'wpml-translation-management') . ' <select name="from_lang" id="edit-from">' . "\r\n" . '<option value="0">' . __('Choose', 'wpml-translation-management') . '</option>' . "\r\n";
$to = '<label>' . __('To language:', 'wpml-translation-management') . ' <select name="to_lang" id="edit-to">' . "\r\n" . '<option value="0">' . __('Choose', 'wpml-translation-management') . '</option>' . "\r\n";
foreach ($languages as $language) {
// select language from request
$selected_from = isset($_GET['icl_lng']) && $_GET['icl_lng'] == $language['code'] ? ' selected="selected"' : '';
$from .= '<option ' . $selected_from . ' value="' . $language['code'] . '"' . @strval($selected_from) . '>' . $language['display_name'] . '</option>' . "\r\n";
$to .= '<option value="' . $language['code'] . '"' . '>' . $language['display_name'] . '</option>' . "\r\n";
}
echo $from . '</select></label>' . "\r\n";
echo $to . '</select></label>' . "\r\n";
if (!$only_local_translators) {
// Services radio boxes
echo '<h4 style="margin-bottom:5px;">' . __('Select translation service', 'wpml-translation-management') . '</h4>' . "\r\n";
} else {
echo '<h4 style="margin-bottom:5px;">' . __('Select translators', 'wpml-translation-management') . '</h4>' . "\r\n";
}
foreach ($services_buttons as $service => $button) {
if ($only_local_translators && $service != 'local') {
continue;
}
if (!isset($button['has_translator_selection']) || $button['has_translator_selection']) {
$selected = '';
if (count($services_buttons) == 1 || $only_local_translators && $service == 'local' || isset($_GET['service']) && $_GET['service'] == $service) {
$selected = ' checked="checked"';
}
if (!$only_local_translators && $service != 'local') {
$selected = ' checked="checked"';
}
$title = array();
$has_translator_selection = isset($service['has_translator_selection']) ? $service['has_translator_selection'] : false;
echo '<div style="margin-bottom:5px;">';
$display = $only_local_translators && $service == 'local' ? ' style="display:none;"' : '';
echo '<input type="radio"
id="radio-' . $service . '"
name="services"
data-has_translator_selection="' . $has_translator_selection . '"
value="' . $service . '"' . $selected . $display . ' />';
if (isset($button['name']) && $button['name']) {
$title[] = '<label for="radio-' . $service . '"' . $display . '> ' . $button['name'];
}
if (isset($button['description']) && $button['description']) {
$title[] = $button['description'];
}
if (isset($button['more_link']) && $button['more_link']) {
$title[] = $button['more_link'];
}
echo implode(' - ', $title) . "\r\n";
echo '</label>';
echo isset($button['content']) && $button['content'] ? $button['content'] . "\r\n" : '';
echo isset($button['messages']) && $button['messages'] ? $button['messages'] . "\r\n" : '';
if (isset($button['setup_url']) && $button['setup_url']) {
//.........这里部分代码省略.........