本文整理匯總了PHP中TranslationProxy::get_current_service_name方法的典型用法代碼示例。如果您正苦於以下問題:PHP TranslationProxy::get_current_service_name方法的具體用法?PHP TranslationProxy::get_current_service_name怎麽用?PHP TranslationProxy::get_current_service_name使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類TranslationProxy
的用法示例。
在下文中一共展示了TranslationProxy::get_current_service_name方法的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: __construct
/**
* @param wpdb $wpdb
* @param SitePress $sitepress
* @param TranslationManagement $tm_instance
*/
public function __construct(&$wpdb, &$sitepress, &$tm_instance)
{
parent::__construct($wpdb, $sitepress);
$this->tm_instance =& $tm_instance;
$this->active_service = TranslationProxy::get_current_service();
$this->service_name = TranslationProxy::get_current_service_name();
}
示例2: get_model
public function get_model()
{
$translation_service_name = TranslationProxy::get_current_service_name();
$alert_1 = 'Use this feature when you want to reset your translation process. All your existing translations will remain unchanged. Any translation work that is currently in progress will be stopped.';
$alert_2 = '';
if (!$translation_service_name) {
$translation_service_name = 'PRO';
$alert_2 = 'Only select this option if you have no pending jobs or you are sure of what you are doing.';
} else {
if (!TranslationProxy::has_preferred_translation_service()) {
$alert_2 = 'If you have sent content to %1$s, you should cancel the projects in %1$s system.';
}
$alert_2 .= 'Any work that completes after you do this reset cannot be received by your site.';
}
$model = array('strings' => array('title' => __('Reset professional translation state', 'wpml-translation-management'), 'alert1' => sprintf(__($alert_1, 'wpml-translation-management'), $translation_service_name), 'alert2' => sprintf(__($alert_2, 'wpml-translation-management'), $translation_service_name), 'checkBoxLabel' => sprintf(__('I am about to stop any ongoing work done by %1$s.', 'wpml-translation-management'), $translation_service_name), 'button' => __('Reset professional translation state', 'wpml-translation-management')), 'placeHolder' => 'icl_reset_pro');
return $model;
}
開發者ID:aarongillett,項目名稱:B22-151217,代碼行數:17,代碼來源:class-wpml-tm-troubleshooting-reset-pro-trans-config-ui.php
示例3: __construct
public function __construct()
{
$this->active_service = TranslationProxy::get_current_service();
$this->service_name = TranslationProxy::get_current_service_name();
}
示例4: load
function load()
{
global $pagenow;
self::ensure_includes();
$this->activate_embedded_modules();
global $sitepress;
$this->plugin_localization();
add_action('wp_ajax_basket_extra_fields_refresh', array($this, 'basket_extra_fields_refresh'));
// Check if WPML is active. If not display warning message and not load Sticky links
if (!defined('ICL_SITEPRESS_VERSION') || ICL_PLUGIN_INACTIVE) {
if (!function_exists('is_multisite') || !is_multisite()) {
add_action('admin_notices', array($this, '_no_wpml_warning'));
}
return false;
} elseif (!$sitepress->get_setting('setup_complete')) {
add_action('admin_notices', array($this, '_wpml_not_installed_warning'));
return false;
} elseif (version_compare(ICL_SITEPRESS_VERSION, '2.0.5', '<')) {
add_action('admin_notices', array($this, '_old_wpml_warning'));
return false;
}
if (isset($_GET['icl_action'])) {
if ($_GET['icl_action'] == 'reminder_popup') {
add_action('init', array('TranslationProxy_Popup', 'display'));
} elseif ($_GET['icl_action'] == 'dismiss_help') {
$sitepress->set_setting('dont_show_help_admin_notice', true);
$sitepress->save_settings();
}
}
if (is_admin() || defined('XMLRPC_REQUEST')) {
global $ICL_Pro_Translation;
$ICL_Pro_Translation = new WPML_Pro_Translation();
}
if (is_admin()) {
$this->automatic_service_selection();
add_action('translation_service_authentication', array($this, 'translation_service_authentication'));
add_filter('translation_service_js_data', array($this, 'translation_service_js_data'));
add_filter('wpml_string_status_text', array('WPML_Remote_String_Translation', 'string_status_text_filter'), 10, 3);
add_action('wp_ajax_translation_service_authentication', array($this, 'translation_service_authentication_ajax'));
add_action('wp_ajax_translation_service_toggle', array($this, 'translation_service_toggle_ajax'));
add_action('trashed_post', array($this, 'trashed_post_actions'), 10, 2);
add_action('wp_ajax_icl_get_jobs_table', 'icl_get_jobs_table');
add_action('wp_ajax_icl_cancel_translation_jobs', 'icl_cancel_translation_jobs');
add_action('wp_ajax_icl_populate_translations_pickup_box', 'icl_populate_translations_pickup_box');
add_action('wp_ajax_icl_pickup_translations', 'icl_pickup_translations');
add_action('wp_ajax_icl_get_job_original_field_content', 'icl_get_job_original_field_content');
add_action('wp_ajax_icl_get_blog_users_not_translators', 'icl_get_blog_users_not_translators');
add_action('wp_ajax_get_translator_status', array('TranslationProxy_Translator', 'get_translator_status_ajax'));
add_action('wpml_updated_translation_status', array('TranslationProxy_Batch', 'maybe_assign_generic_batch'), 10, 2);
add_action('wpml_added_local_translation_job', array('WPML_Translation_Job_Terms', 'set_translated_term_values'), 10, 2);
if (!defined('DOING_AJAX')) {
$has_custom_fields = TranslationProxy::has_custom_fields();
$custom_fields_data = TranslationProxy::get_custom_fields_data();
$current_service_name = TranslationProxy::get_current_service_name();
if ($has_custom_fields && $current_service_name && !$custom_fields_data && !$this->is_services_tab()) {
if (defined('WPML_TP_DEFAULT_SUID')) {
$service_tab_name = TranslationProxy::get_current_service_name();
} else {
$service_tab_name = __('Translators', 'wpml-translation-management');
}
$services_url = "admin.php?page=" . WPML_TM_FOLDER . "/menu/main.php&sm=translators";
$href_open = '<strong><a href="' . $services_url . '">';
$href_close = '</a></strong>';
$services_link = $href_open . $service_tab_name . ' Tab' . $href_close;
$service_authentication_link = '<strong>' . __('Click here to authenticate', 'wpml-translation-management') . '</strong>';
$service_deactivation_link = '<strong>' . __('Click here to deactivate', 'wpml-translation-management') . '</strong>';
if (defined('WPML_TP_DEFAULT_SUID')) {
$authentication_message = __("You are using a translation service which requires authentication.", 'wpml-translation-management');
$authentication_message .= '<ul>';
$authentication_message .= '<li>';
$authentication_message .= sprintf(__("Please go to %s and use the link %s.", 'wpml-translation-management'), $services_link, $service_authentication_link);
$authentication_message .= '</li>';
} else {
$authentication_message = __("You have selected a translation service which requires authentication.", 'wpml-translation-management');
$authentication_message .= '<ul>';
$authentication_message .= '<li>';
$authentication_message .= sprintf(__("If you wish to use %s, please go to %s and use the link %s.", 'wpml-translation-management'), '<strong>' . $current_service_name . '</strong>', $services_link, $service_authentication_link);
$authentication_message .= '</li>';
$authentication_message .= '<li>';
$authentication_message .= sprintf(__("If you wish to use only local translators, please go to %s and use the link %s.", 'wpml-translation-management'), $services_link, $service_deactivation_link);
$authentication_message .= '</li>';
$authentication_message .= '</ul>';
}
$args = array('id' => 'current_service_authentication_required', 'group' => 'current_service_authentication', 'msg' => $authentication_message, 'type' => 'error', 'admin_notice' => true, 'hide' => false, 'limit_to_page' => array(WPML_TM_FOLDER . '/menu/main.php'));
ICL_AdminNotifier::add_message($args);
} else {
ICL_AdminNotifier::remove_message('current_service_authentication_required');
}
if ($pagenow == 'admin.php' && isset($_GET['page']) && $_GET['page'] == WPML_TM_FOLDER . '/menu/main.php' && (!isset($_GET['sm']) || $_GET['sm'] === 'dashboard')) {
$this->show_3_2_upgrade_notice();
}
}
do_action('wpml_tm_init');
if ($pagenow != 'customize.php') {
// stop TM scripts from messing up theme customizer
add_action('admin_enqueue_scripts', array($this, 'admin_enqueue_scripts'));
add_action('admin_print_styles', array($this, 'admin_print_styles'));
}
add_action('icl_wpml_top_menu_added', array($this, '_icl_hook_top_menu'));
add_action('admin_menu', array($this, 'menu'));
//.........這裏部分代碼省略.........
示例5: get_translator_html
protected function get_translator_html($job)
{
$job = (object) $job;
$current_service_name = TranslationProxy::get_current_service_name();
$translation_services = array('local', TranslationProxy::get_current_service_id());
$translator = '';
if ($job->translation_service && $job->translation_service !== 'local') {
try {
$project = TranslationProxy::get_current_project();
if ($project) {
if ($project->service->has_translator_selection) {
$translator_contact_iframe_url = $project->translator_contact_iframe_url($job->translator_id);
$iframe_args = array('title' => __('Contact the translator', 'wpml-translation-management'), 'unload_cb' => 'icl_thickbox_refresh');
$translator .= TranslationProxy_Popup::get_link($translator_contact_iframe_url, $iframe_args);
$translator .= esc_html($job->translator_name);
$translator .= "</a> (" . $current_service_name . ")";
} else {
$translator .= $current_service_name;
}
} else {
$translator .= esc_html($job->translator_name);
}
} catch (Exception $e) {
// Just doesn't create the output
}
} elseif ($job->status == ICL_TM_COMPLETE) {
$translator_data = get_userdata($job->translator_id);
$translator_name = $translator_data ? $translator_data->display_name : "";
$translator = '<span class="icl-finished-local-name">' . $translator_name . '</span>';
} else {
$translator .= '<span class="icl_tj_select_translator">';
$selected_translator = isset($job->translator_id) ? $job->translator_id : false;
$disabled = false;
if ($job->translation_service && $job->translation_service !== 'local' && is_numeric($job->translation_service)) {
$selected_translator = TranslationProxy_Service::get_wpml_translator_id($job->translation_service, $job->translator_id);
$disabled = true;
}
$job_id = isset($job->job_id) ? $job->job_id : $job->id;
$local_only = isset($job->local_only) ? $job->local_only : true;
$args = array('id' => 'icl_tj_translator_for_' . $job_id, 'name' => 'icl_tj_translator_for_' . $job_id, 'from' => $job->source_language_code, 'to' => $job->language_code, 'selected' => $selected_translator, 'services' => $translation_services, 'disabled' => $disabled, 'echo' => false, 'local_only' => $local_only);
$translator .= TranslationManagement::translators_dropdown($args);
$translator .= '<input type="hidden" id="icl_tj_ov_' . $job_id . '" value="' . (int) $job->translator_id . '" />';
$translator .= '<input type="hidden" id="icl_tj_ty_' . $job_id . '" value="' . strtolower($this->get_type()) . '" />';
$translator .= '<span class="icl_tj_select_translator_controls" id="icl_tj_tc_' . $job_id . '">';
$translator .= '<input type="button" class="button-secondary icl_tj_ok" value="' . __('Send', 'wpml-translation-management') . '" /> ';
$translator .= '<input type="button" class="button-secondary icl_tj_cancel" value="' . __('Cancel', 'wpml-translation-management') . '" />';
$translator .= '</span>';
}
return $translator;
}
示例6: menu
static function menu()
{
global $wpdb, $sitepress;
if (!class_exists('TranslationManagement')) {
return;
}
$site_id = $sitepress->get_setting('site_id');
$access_key = $sitepress->get_setting('access_key');
?>
<h4><?php
_e('Translation Management', 'sitepress');
?>
</h4>
<?php
$current_service_name = TranslationProxy::get_current_service_name();
if ($site_id && $access_key) {
?>
<p>
<input id="icl_sync_jobs" type="button" class="button-secondary"
value="<?php
echo sprintf(__('Synchronize translation jobs with %s', 'sitepress'), $current_service_name);
?>
"/><br/>
<small
style="margin-left:10px;"><?php
echo sprintf(__('Fixes links between translation entries in the database and %s.', 'sitepress'), $current_service_name);
?>
</small>
</p>
<p>
<input id="icl_cms_id_fix" type="button" class="button-secondary"
value="<?php
_e('CMS ID fix', 'sitepress');
?>
"/>
<span id="icl_cms_id_fix_prgs" style="display: none;"><?php
$fixing_count_sql = "\n\t\t\t\t\t\tSELECT COUNT(*)\n\t\t\t\t\t\tFROM {$wpdb->prefix}icl_translations t\n\t\t\t\t\t\tJOIN {$wpdb->prefix}icl_translation_status s\n\t\t\t\t\t\t\tON t.translation_id=s.translation_id\n\t\t\t\t\t\tWHERE t.element_type LIKE 'post\\_%'\n\t\t\t\t\t\t\tAND t.source_language_code IS NOT NULL\n\t\t\t\t\t\t\tAND s.translation_service=%s\n\t\t\t\t\t\t";
$fixing_count_prepared = $wpdb->prepare($fixing_count_sql, array($current_service_name));
$fixing_count = $wpdb->get_var($fixing_count_prepared);
printf(__('fixing %s/%d', 'sitepress'), '<span id="icl_cms_id_fix_prgs_cnt">0</span>', $fixing_count);
?>
</span><br/>
<small
style="margin-left:10px;"><?php
_e("Updates translation in progress with new style identifiers for documents. The new identifiers depend on the document being translated and the languages so it's not possible to get out of sync when translations are being deleted locally.", 'sitepress');
?>
</small>
</p>
<p>
<input id="icl_sync_cancelled" type="button" class="button-secondary"
value="<?php
echo sprintf(__('Check cancelled jobs on %s', 'sitepress'), $current_service_name);
?>
"/><br/>
<small
style="margin-left:10px;"><?php
echo sprintf(__('When using the translation pickup mode cancelled jobs on %s need to be synced manually.', 'sitepress'), $current_service_name);
?>
</small>
</p>
<div id="icl_sync_cancelled_resp" class="clear"></div>
<input type="hidden" id="icl_ts_t2c" value=""/>
<?php
}
?>
<br clear="all"/>
<?php
if (SitePress_Setup::setup_complete()) {
$translation_service_name = $current_service_name;
//Todo: [WPML 3.3] Move JS to an external resource
$translation_service_checkbox_js_code = "if(jQuery(this).attr('checked')) ";
$translation_service_checkbox_js_code .= "jQuery('#icl_reset_pro_but').removeClass('button-primary-disabled'); ";
$translation_service_checkbox_js_code .= "else jQuery('#icl_reset_pro_but').addClass('button-primary-disabled');";
$translation_service_button_js_code = "if(!jQuery('#icl_reset_pro_check').attr('checked') || !confirm('";
$translation_service_button_js_code .= esc_js(__('Are you sure you want to reset the PRO translation configuration?', 'sitepress'));
$translation_service_button_js_code .= "')) return false;";
?>
<br/>
<div class="icl_cyan_box">
<h3><?php
_e('Reset PRO translation configuration', 'sitepress');
?>
</h3>
<div class="icl_form_errors">
<?php
echo sprintf(__("Resetting your %s account will interrupt any translation jobs that you have in progress.", 'wpml-translation-management'), $translation_service_name);
?>
<br/>
<?php
echo sprintf(__("Only use this function if your current %s account doesn't include any jobs, or if the account was deleted.", 'wpml-translation-management'), $translation_service_name);
?>
</div>
<p style="padding:6px;">
<label>
<input onchange="<?php
echo $translation_service_checkbox_js_code;
?>
" id="icl_reset_pro_check"
type="checkbox" value="1"/>
//.........這裏部分代碼省略.........
示例7: send_basket_commit
public function send_basket_commit()
{
$has_remote_translators = false;
try {
$response = false;
$errors = array();
if (TranslationProxy::is_batch_mode()) {
$project = TranslationProxy::get_current_project();
$translators = $_POST['translators'];
$has_remote_translators = false;
if (is_array($translators)) {
foreach ($translators as $translator) {
if (!TranslationProxy_Service::is_local_translator($translator)) {
$has_remote_translators = true;
break;
}
}
} else {
$has_remote_translators = true;
}
if ($project && $has_remote_translators) {
$response = $project->commit_batch_job();
if (!empty($project->errors)) {
$response = false;
}
} else {
//Local translation only: return true
$response = true;
}
}
if ($response) {
$is_error = false;
TranslationProxy_Basket::delete_all_items_from_basket();
$service_name = TranslationProxy::get_current_service_name();
if (isset($has_remote_translators) && $has_remote_translators) {
$response->call_to_action = '<strong>' . sprintf(__('You have sent items to %s. Please check if additional steps are required on their end', 'wpml-translation-management'), $service_name) . '</strong>';
}
} else {
$response = false;
$is_error = true;
if (isset($project) && $project) {
$errors = $project->errors;
}
}
} catch (Exception $e) {
$response = false;
$is_error = true;
$errors[] = $e->getMessage();
}
$result = array('result' => $response, 'is_error' => $is_error, 'errors' => $errors);
if (!empty($errors)) {
$this->rollback_basket_commit();
wp_send_json_error($result);
} else {
wp_send_json_success($result);
}
}
示例8: translators_dropdown
public static function translators_dropdown($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 $show_service bool */
/** @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');
$show_service = true;
$disabled = false;
$default_name = false;
$local_only = false;
extract($args, EXTR_OVERWRITE);
$translators = array();
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', 'sitepress'), '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', 'sitepress'), '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', 'sitepress'));
$translators = array_merge($translators, self::get_blog_translators(array('from' => $from, 'to' => $to)));
}
$translators = apply_filters('wpml_tm_translators_list', $translators);
$dropdown .= '<select id="' . esc_attr($id) . '" 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 .= esc_html($t->display_name);
if ($show_service) {
$dropdown .= ' (';
$dropdown .= isset($t->service) ? $t->service : __('Local', 'sitepress');
$dropdown .= ')';
}
$dropdown .= '</option>';
}
$dropdown .= '</select>';
} catch (TranslationProxy_Api_Error $ex) {
$dropdown .= __('Translation Proxy error', 'sitepress') . ': ' . $ex->getMessage();
} catch (Exception $ex) {
$dropdown .= __('Error', 'sitepress') . ': ' . $ex->getMessage();
}
if ($add_label) {
$dropdown = '<label for="' . esc_attr($id) . '">' . __('Translation jobs for:', 'wpml-translation-management') . '</label> ' . $dropdown;
}
if ($echo) {
//.........這裏部分代碼省略.........
示例9: get_current_service_name
public function get_current_service_name()
{
return TranslationProxy::get_current_service_name();
}
示例10: service_authentication_notice
private function service_authentication_notice()
{
$message_id = 'current_service_authentication_required';
if ($this->service_activation_incomplete()) {
$current_service_name = TranslationProxy::get_current_service_name();
if ($this->is_translators_tab()) {
if ($this->service_requires_translators() && 'ICanLocalize' === $current_service_name) {
$message = __('You selected %1$s as your translation service. Next, you need to add translators from %1$s to your site. Click on the "Add translators" button. Select the source and target language and choose %1$s as the source of the translator. You can add different translators between different languages.', 'wpml-translation-management');
$button_text = __('Getting started with ICanLocalize', 'wpml-translation-management');
$button_url = 'https://wpml.org/translation-service/icanlocalize/';
$notification_message = '';
$notification_message .= '<p>';
$notification_message .= sprintf($message, $current_service_name);
$notification_message .= '</p>';
$notification_message .= '<a href="' . $button_url . '" target="_blank">' . $button_text . '</a>';
}
} else {
$service_tab_name = __('Translators', 'wpml-translation-management');
$services_url = "admin.php?page=" . WPML_TM_FOLDER . "/menu/main.php&sm=translators";
$href_open = '<strong><a href="' . $services_url . '">';
$href_close = '</a></strong>';
$services_link = $href_open . $service_tab_name . ' Tab' . $href_close;
$service_authentication_link = '<strong>' . __('Authenticate', 'wpml-translation-management') . '</strong> button';
$service_deactivation_link = '<strong>' . __('Deactivate', 'wpml-translation-management') . '</strong> button';
if (TranslationProxy::get_tp_default_suid()) {
$notification_message = __("You are using a translation service which requires authentication.", 'wpml-translation-management');
$notification_message .= '<ul>';
$notification_message .= '<li>';
$notification_message .= sprintf(__('Please go to %1$s and use the link %2$s.', 'wpml-translation-management'), $services_link, $service_authentication_link);
$notification_message .= '</li>';
} else {
$problem_detected = false;
if ($this->service_requires_authentication()) {
$notification_message = __("You have selected a translation service which requires authentication.", 'wpml-translation-management');
} elseif ($this->service_requires_translators()) {
$notification_message = __("You have selected a translation service which requires translators.", 'wpml-translation-management');
$service_authentication_link = '<strong>' . __('Add Translator', 'wpml-translation-management') . ' »</strong>';
} else {
$problem_detected = true;
$notification_message = __("There is a problem with your translation service.", 'wpml-translation-management');
}
$notification_message .= '<ul>';
$notification_message .= '<li>';
if ($this->service_requires_authentication()) {
$notification_message .= sprintf(__("If you wish to use %s, please go to %s and use the link %s.", 'wpml-translation-management'), '<strong>' . $current_service_name . '</strong>', $services_link, $service_authentication_link);
} elseif ($this->service_requires_translators()) {
$notification_message .= sprintf(__("If you wish to use %s, please go to %s and use the link %s.", 'wpml-translation-management'), '<strong>' . $current_service_name . '</strong>', $services_link, $service_authentication_link);
} elseif ($problem_detected) {
$notification_message .= sprintf(__("Please contact your administrator.", 'wpml-translation-management'), $services_link, $service_authentication_link);
}
$notification_message .= '</li>';
$notification_message .= '<li>';
$notification_message .= sprintf(__("If you wish to use only local translators, please go to %s and use the link %s.", 'wpml-translation-management'), $services_link, $service_deactivation_link);
$notification_message .= '</li>';
$notification_message .= '</ul>';
}
}
}
if (isset($notification_message)) {
$args = array('id' => $message_id, 'group' => 'current_service_authentication', 'msg' => $notification_message, 'type' => 'error', 'admin_notice' => true, 'hide' => false, 'limit_to_page' => array(WPML_TM_FOLDER . '/menu/main.php'));
ICL_AdminNotifier::add_message($args);
} else {
ICL_AdminNotifier::remove_message($message_id);
}
}
示例11: service_authentication_notice
private function service_authentication_notice()
{
$message_id = 'current_service_authentication_required';
if (!$this->is_translators_tab() && $this->service_activation_incomplete()) {
$current_service_name = TranslationProxy::get_current_service_name();
if (defined('WPML_TP_DEFAULT_SUID')) {
$service_tab_name = $current_service_name;
} else {
$service_tab_name = __('Translators', 'wpml-translation-management');
}
$services_url = "admin.php?page=" . WPML_TM_FOLDER . "/menu/main.php&sm=translators";
$href_open = '<strong><a href="' . $services_url . '">';
$href_close = '</a></strong>';
$services_link = $href_open . $service_tab_name . ' Tab' . $href_close;
$service_authentication_link = '<strong>' . __('Click here to authenticate', 'wpml-translation-management') . '</strong>';
$service_deactivation_link = '<strong>' . __('Click here to deactivate', 'wpml-translation-management') . '</strong>';
if (defined('WPML_TP_DEFAULT_SUID')) {
$authentication_message = __("You are using a translation service which requires authentication.", 'wpml-translation-management');
$authentication_message .= '<ul>';
$authentication_message .= '<li>';
$authentication_message .= sprintf(__("Please go to %s and use the link %s.", 'wpml-translation-management'), $services_link, $service_authentication_link);
$authentication_message .= '</li>';
} else {
$problem_detected = false;
if ($this->service_requires_authentication()) {
$authentication_message = __("You have selected a translation service which requires authentication.", 'wpml-translation-management');
} elseif ($this->service_requires_translators()) {
$authentication_message = __("You have selected a translation service which requires translators.", 'wpml-translation-management');
$service_authentication_link = '<strong>' . __('Add Translator', 'wpml-translation-management') . ' »</strong>';
} else {
$problem_detected = true;
$authentication_message = __("There is a problem with your translation service.", 'wpml-translation-management');
}
$authentication_message .= '<ul>';
$authentication_message .= '<li>';
if ($this->service_requires_authentication()) {
$authentication_message .= sprintf(__("If you wish to use %s, please go to %s and use the link %s.", 'wpml-translation-management'), '<strong>' . $current_service_name . '</strong>', $services_link, $service_authentication_link);
} elseif ($this->service_requires_translators()) {
$authentication_message .= sprintf(__("If you wish to use %s, please go to %s and use the link %s.", 'wpml-translation-management'), '<strong>' . $current_service_name . '</strong>', $services_link, $service_authentication_link);
} elseif ($problem_detected) {
$authentication_message .= sprintf(__("Please contact your administrator.", 'wpml-translation-management'), $services_link, $service_authentication_link);
}
$authentication_message .= '</li>';
$authentication_message .= '<li>';
$authentication_message .= sprintf(__("If you wish to use only local translators, please go to %s and use the link %s.", 'wpml-translation-management'), $services_link, $service_deactivation_link);
$authentication_message .= '</li>';
$authentication_message .= '</ul>';
}
$args = array('id' => $message_id, 'group' => 'current_service_authentication', 'msg' => $authentication_message, 'type' => 'error', 'admin_notice' => true, 'hide' => false, 'limit_to_page' => array(WPML_TM_FOLDER . '/menu/main.php'));
ICL_AdminNotifier::add_message($args);
} else {
ICL_AdminNotifier::remove_message($message_id);
}
}
示例12: flush_website_details_cache_button
private function flush_website_details_cache_button()
{
$ts_name = TranslationProxy::get_current_service_name();
$link_text = sprintf(__('Refresh Translators data from %s', 'wpml-translation-management'), $ts_name);
$nonce = wp_create_nonce('wpml-flush-website-details-cache');
return '<a href="#" data-nonce="' . $nonce . '" type="submit" class="button secondary js-flush-website-details-cache">' . $link_text . ' »</a>' . PHP_EOL;
}
示例13: get_model
public function get_model()
{
$ts_name = TranslationProxy::get_current_service_name();
$model = array('strings' => array('title' => __('Show other professional translation options', 'wpml-translation-management'), 'button' => __('Enable other translation services', 'wpml-translation-management'), 'message' => sprintf(__('Your site is currently configured to use only %s as its professional translation service.', 'wpml-translation-management'), $ts_name)), 'placeHolder' => 'wpml_clear_ts');
return $model;
}