本文整理汇总了PHP中ICL_AdminNotifier类的典型用法代码示例。如果您正苦于以下问题:PHP ICL_AdminNotifier类的具体用法?PHP ICL_AdminNotifier怎么用?PHP ICL_AdminNotifier使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ICL_AdminNotifier类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: wpml_wcml_3_8_is_required
function wpml_wcml_3_8_is_required()
{
if (defined('WCML_VERSION')) {
$message_id = 'icl_wcml_3_8_is_required';
if (version_compare(WCML_VERSION, '3.8', '<')) {
$message = array('id' => $message_id, 'type' => 'icl-admin-message-warning', 'limit_to_page' => 'wpml-wcml', 'admin_notice' => true, 'classes' => array('error'), 'text' => sprintf(__("%sIMPORTANT:%s You are using a version of WooCommerce Multilingual that is not fully compatible with the current WPML version. The %sproducts translation editor has been deactivated%s for this reason.%sPlease upgrade to %sWooCommerce Multilingual 3.8%s to restore the translation editor for products and use all the other functions.", 'sitepress'), '<strong>', '</strong>', '<strong>', '</strong>', '<br /><br />', '<strong><a href="https://wpml.org/?p=867248">', '</a></strong>'));
ICL_AdminNotifier::add_message($message);
?>
<?php
if (isset($_GET['page']) && $_GET['page'] == 'wpml-wcml') {
?>
<script>
jQuery(document).ready(function () {
jQuery('.wcml_details').unbind('click');
jQuery('.wcml_products_translation input[type=text], .wcml_products_translation textarea, .wcml_products_translation button').attr('disabled', 'disabled');
jQuery('.wcml_products a.wcml_details').css('text-decoration', 'line-through');
jQuery('.wcml_products').on('click', 'a.wcml_details', function () {
location.href = '#adminmenumain';
jQuery('#icl-id-icl_wcml_3_8_is_required').fadeIn(100).fadeOut(100).fadeIn(100).fadeOut(100).fadeIn(100);
return false;
})
})
</script>
<?php
}
?>
<?php
} else {
ICL_AdminNotifier::remove_message($message_id);
}
}
}
示例2: icl_handle_error
/**
* If the given $source is an error type, it will display an instant message
*
* @param $source WP_Error|TranslationProxy_Api_Error|Exception
*/
function icl_handle_error($source)
{
$error = false;
if (is_translationproxy_api_error($source)) {
$error = array('message' => $source->getMessage(), 'code' => $source->getCode());
} elseif (is_exception($source)) {
$error = array('message' => $source->getMessage(), 'code' => $source->getCode());
} elseif (is_wp_error($source)) {
$error = array('message' => $source->get_error_message(), 'data' => $source->get_error_data(), 'code' => $source->get_error_code());
}
if ($error) {
$message = '';
$message .= '<strong>';
if (isset($error['code']) && $error['code']) {
$message .= '#' . $error['code'] . ' ';
}
$message .= $error['message'];
$message .= '</strong>';
if (isset($error['data'])) {
foreach ($error['data'] as $data_key => $data_item) {
if ($data_key == 'details') {
$message .= '<br/>Details: ' . $data_item;
} elseif ($data_key == 'service_id') {
$message .= '<br/>Service ID: ' . $data_item;
} else {
$message .= '<br/><pre>' . print_r($data_item, true) . '</pre>';
}
}
}
ICL_AdminNotifier::displayInstantMessage($message, 'error');
}
return $error;
}
示例3: missing_php_extensions
private function missing_php_extensions()
{
$extensions = array();
if (ini_get('allow_url_fopen') !== '1') {
$extensions['allow_url_fopen'] = array('type' => 'setting', 'type_description' => __('PHP Setting', 'wpml-translation-management'), 'value' => '1');
}
if (!extension_loaded('openssl')) {
$extensions['openssl'] = array('type' => 'extension', 'type_description' => __('PHP Extension', 'wpml-translation-management'));
}
if (class_exists('ICL_AdminNotifier') && (!defined('ICL_HIDE_TRANSLATION_SERVICES') || !ICL_HIDE_TRANSLATION_SERVICES)) {
$wpml_wp_api_check = new WPML_WP_API();
if (count($extensions) > 0 && $wpml_wp_api_check->is_tm_page()) {
$message = '';
$message .= '<p>';
$message .= __('WPML Translation Management requires the following PHP extensions and settings:', 'wpml-translation-management');
$message .= '</p>';
$message .= '<ul>';
foreach ($extensions as $id => $data) {
$message .= '<li>';
if ('setting' === $data['type']) {
$message .= $data['type_description'] . ': <code>' . $id . '=' . $data['value'] . '</code>';
}
if ('extension' === $data['type']) {
$message .= $data['type_description'] . ': <strong>' . $id . '</strong>';
}
$message .= '</li>';
}
$message .= '</ul>';
$args = array('id' => 'wpml-tm-missing-extensions', 'group' => 'wpml-tm-requirements', 'msg' => $message, 'type' => 'error', 'admin_notice' => true, 'hide' => true);
ICL_AdminNotifier::add_message($args);
} else {
ICL_AdminNotifier::remove_message_group('wpml-tm-requirements');
}
}
}
示例4: render
function render()
{
global $wp_taxonomies;
$icl_post_types = $this->sitepress->get_translatable_documents(true);
$cposts = array();
$notice = '';
foreach ($icl_post_types as $k => $v) {
if (!in_array($k, array('post', 'page'))) {
$cposts[$k] = $v;
}
}
$cpt_sync_settings = $this->sitepress->get_setting('custom_posts_sync_option');
foreach ($cposts as $k => $cpost) {
if (!isset($cpt_sync_settings[$k])) {
$cposts_sync_not_set[] = $cpost->labels->name;
}
}
if (!empty($cposts_sync_not_set)) {
$notice = '<p class="updated fade">';
$notice .= sprintf(__("You haven't set your <a %s>synchronization preferences</a> for these custom posts: %s. Default value was selected.", 'sitepress'), 'href="admin.php?page=' . WPML_TM_FOLDER . '/menu/main.php&sm=mcsetup"', '<i>' . join('</i>, <i>', $cposts_sync_not_set) . '</i>');
$notice .= '</p>';
}
$icl_post_types = $this->sitepress->get_translatable_documents(true);
if ($icl_post_types) {
$custom_posts = array();
$icl_post_types = $this->sitepress->get_translatable_documents(true);
foreach ($icl_post_types as $k => $v) {
if (!in_array($k, array('post', 'page'))) {
$custom_posts[$k] = $v;
}
}
$slug_settings = $this->sitepress->get_setting('posts_slug_translation');
foreach ($custom_posts as $k => $custom_post) {
$_has_slug = isset($custom_post->rewrite['slug']) && $custom_post->rewrite['slug'];
$_translate = !empty($slug_settings['types'][$k]);
if ($_has_slug) {
$string_id_prepared = $this->wpdb->prepare("SELECT id FROM {$this->wpdb->prefix}icl_strings WHERE name = %s AND value = %s ", array('Url slug: ' . trim($custom_post->rewrite['slug'], '/'), trim($custom_post->rewrite['slug'], '/')));
$string_id = $this->wpdb->get_var($string_id_prepared);
if ($slug_settings['on'] && $_translate && !$string_id) {
$message = sprintf(__("%s slugs are set to be translated, but they are missing their translation", 'sitepress'), $custom_post->labels->name);
$notice .= ICL_AdminNotifier::displayInstantMessage($message, 'error', 'below-h2', true);
}
}
}
}
$ctaxonomies = array_diff(array_keys((array) $wp_taxonomies), array('post_tag', 'category', 'nav_menu', 'link_category', 'post_format'));
$tax_sync_settings = $this->sitepress->get_setting('taxonomies_sync_option');
foreach ($ctaxonomies as $ctax) {
if (!isset($tax_sync_settings[$ctax])) {
$tax_sync_not_set[] = $wp_taxonomies[$ctax]->label;
}
}
if (!empty($tax_sync_not_set)) {
$notice .= '<p class="updated">';
$notice .= sprintf(__("You haven't set your <a %s>synchronization preferences</a> for these taxonomies: %s. Default value was selected.", 'sitepress'), 'href="admin.php?page=' . WPML_TM_FOLDER . '/menu/main.php&sm=mcsetup"', '<i>' . join('</i>, <i>', $tax_sync_not_set) . '</i>');
$notice .= '</p>';
}
return $notice;
}
示例5: wpml_new_duplicated_terms_filter
function wpml_new_duplicated_terms_filter($post_ids, $duplicates_only = true)
{
require_once ICL_PLUGIN_PATH . '/inc/taxonomy-term-translation/wpml-term-hierarchy-duplication.class.php';
$hier_dupl = new WPML_Term_Hierarchy_Duplication();
$taxonomies = $hier_dupl->duplicates_require_sync($post_ids, $duplicates_only);
if ((bool) $taxonomies) {
$text = __("The posts you just saved led to the creation of new hierarchical terms.\nTheir hierarchical relationship to one another is not yet synchronized with the original post's terms for the following taxonomies:", 'wpml-translation-management');
$text = '<p>' . $text . '</p>';
foreach ($taxonomies as $taxonomy) {
$text .= '<p><a href="admin.php?page=' . ICL_PLUGIN_FOLDER . '/menu/taxonomy-translation.php&taxonomy=' . $taxonomy . '&sync=1">' . get_taxonomy_labels(get_taxonomy($taxonomy))->name . '</a></p>';
}
$message_args = array('id' => 'duplication-tm-dashboard-notification', 'text' => $text, 'type' => 'information', 'group' => 'duplication-notification', 'admin_notice' => true, 'show_once' => true, 'hide_per_user' => true);
ICL_AdminNotifier::add_message($message_args);
}
}
示例6: promote_wcml_message
public function promote_wcml_message()
{
$promote = false;
if (class_exists('WooCommerce') && !class_exists('woocommerce_wpml')) {
global $pagenow;
$promote = $this->wpml_wp_api->is_tm_page();
if (isset($_GET['post_type']) && !empty($_GET['post_type'])) {
$promote = 'product' === $_GET['post_type'] && 'edit.php' === $pagenow;
}
}
if ($promote) {
$message = '';
$wcml_link = '<a href="https://wordpress.org/plugins/woocommerce-multilingual" target="_blank">WooCommerce Multilingual.</a>';
$message .= sprintf(__('Looks like you are running a multilingual WooCommerce site. To easily translate WooCommerce products and categories, you should use %s', 'wpml-translation-management'), $wcml_link);
$args = array('id' => 'promote-wcml', 'group' => 'promote-wcml', 'msg' => $message, 'type' => 'notice', 'admin_notice' => true, 'hide' => true);
ICL_AdminNotifier::add_message($args);
} else {
ICL_AdminNotifier::remove_message_group('promote-wcml');
}
}
示例7: cpt_default_and_st_language_warning
function cpt_default_and_st_language_warning()
{
static $called = false;
if (!$called) {
global $sitepress, $sitepress_settings;
$st_language_code = $sitepress_settings['st']['strings_language'];
$st_language = $sitepress->get_display_language_name($st_language_code, $sitepress->get_admin_language());
$st_page_url = admin_url('admin.php?page=wpml-string-translation/menu/string-translation.php');
$message = 'The strings language in your site is set to %s instead of English. ';
$message .= 'This means that the original slug will appear in the URL when displaying content in %s.';
$message .= ' ';
$message .= '<strong><a href="%s" target="_blank">Read more</a> | ';
$message .= '<a href="%s#icl_st_sw_form">Change strings language</a></strong>';
$message = __($message, 'wpml-string-translation');
$message = sprintf($message, $st_language, $st_language, 'http://wpml.org/faq/string-translation-default-language-not-english/', $st_page_url);
$fallback_message = _('<a href="%s" target="_blank">How to translate strings when default language is not English</a>');
$fallback_message = sprintf($fallback_message, 'http://wpml.org/faq/string-translation-default-language-not-english/');
ICL_AdminNotifier::addMessage('cpt_default_and_st_language_warning', $message, 'icl-admin-message-warning', true, $fallback_message, false, 'cpt-translation');
$called = true;
}
}
示例8: check_settings_integrity
//.........这里部分代码省略.........
}
global $wpdb;
static $result;
if (isset($result)) {
return $result;
}
$current_settings = get_option('icl_sitepress_settings');
if (!$current_settings) {
return true;
}
$setup_wizard_step = false;
if (isset($current_settings['setup_wizard_step'])) {
$setup_wizard_step = $current_settings['setup_wizard_step'];
}
$setup_complete = false;
$setup_complete_missing = true;
if (isset($current_settings['setup_complete'])) {
$setup_complete = $current_settings['setup_complete'];
$setup_complete_missing = false;
}
//Skip checks during first setup wizard
if ($setup_wizard_step !== false && $setup_wizard_step < 4 || !$setup_complete_missing && $setup_complete === false && $setup_wizard_step == 4) {
return true;
}
$default_language = false;
$default_language_missing = true;
if (isset($current_settings['default_language'])) {
$default_language = $current_settings['default_language'];
$default_language_missing = false;
}
$active_languages_sql = "SELECT * FROM " . $wpdb->prefix . 'icl_languages WHERE active=%d';
$active_languages_prepared = $wpdb->prepare($active_languages_sql, array(1));
$active_languages = $wpdb->get_results($active_languages_prepared);
$existing_translations_sql = "SELECT count(*) FROM " . $wpdb->prefix . 'icl_translations';
$existing_translations = $wpdb->get_var($existing_translations_sql);
$show_notice = false;
$message = '';
if ((!$setup_complete || !$default_language) && $existing_translations) {
$message .= '<p>';
$message .= __('Your WPML settings seem to be corrupted. To avoid corrupting your existing data, we have hidden WPML from this site.', 'sitepress');
$message .= '</p>';
$message .= '<p>';
$message .= __('If this is the first time you install WPML on this site, you may have faced a database or script connection drop, that caused settings to be not completely store.', 'sitepress');
$message .= __('In this case, you can click on the <strong>Reset Settings</strong> button: this will reset WPML settings and any language translation information, allowing you to restart the wizard.', 'sitepress');
$message .= '</p>';
$message .= '<p>';
$message .= sprintf(__('If you have just upgraded WPML or after starting over you keep getting this message, please contact the <a href="%s">support forum</a> as soon as possible, in order to provide you with a fix to this issue.', 'sitepress'), 'https://wpml.org/forums/');
$message .= '</p>';
$message .= '<p>';
$confirm_message = _x('Are you sure you want to reset WPML Settings?', 'Reset WPML settings', 'sitepress');
$confirm_message .= ' ';
$confirm_message .= _x('This will also empty translation information (if any).', 'Reset WPML settings', 'sitepress');
$message .= '<a href="?icl_reset_settings=1&debug_action=reset_wpml_settings&nonce=' . wp_create_nonce('reset_wpml_settings') . '" class="button" onclick="return window.confirm(\'' . $confirm_message . '\');" >' . __('Reset Settings', 'sitepress') . '</a>';
$message .= ' ';
$message .= ' ';
$message .= ' ';
$message .= '<a href="https://wpml.org/forums/" class="button">' . __('Contact Support', 'sitepress') . '</a>';
$message .= '</p>';
$message .= '<p>';
$message .= __('Additional details for the support team (there is no need to copy it, as the support team will be able to see it once logged in):', 'sitepress');
$message .= '</p>';
$message .= '<p><textarea rows="10" style="width:100%;display:block;" onclick="this.focus();this.select();" readonly="readonly">';
$message .= str_repeat('=', 50);
$wpml_plugins_list = SitePress::get_installed_plugins();
foreach ($wpml_plugins_list as $name => $plugin_data) {
$plugin_name = $name;
$file = $plugin_data['file'];
$message .= PHP_EOL . $plugin_name;
$message .= ' ' . (isset($plugin_data['plugin']['Version']) ? $plugin_data['plugin']['Version'] : __('Version n/a', 'sitepress'));
$message .= ' => ';
if (empty($plugin_data['plugin'])) {
$message .= 'Not installed';
} else {
$message .= 'Installed';
}
$message .= '/';
$message .= isset($file) && is_plugin_active($file) ? 'Active' : 'Not Active';
}
$message .= PHP_EOL . str_repeat('-', 50);
$message .= PHP_EOL . 'icl_translations count: ' . ($existing_translations ? $existing_translations : '0');
$message .= PHP_EOL . 'setup_complete: ' . ($setup_complete ? 'true' : 'false');
$message .= PHP_EOL . 'setup_complete missing: ' . ($setup_complete_missing ? 'true' : 'false');
$message .= PHP_EOL . 'default_language: ' . ($default_language ? $default_language : '""');
$message .= PHP_EOL . 'default_language_missing: ' . ($default_language_missing ? 'true' : 'false');
$message .= PHP_EOL . PHP_EOL . 'active_languages: ' . PHP_EOL . print_r($active_languages, true);
$message .= PHP_EOL . PHP_EOL . 'icl_sitepress_settings (serialized): ' . PHP_EOL . serialize($current_settings);
$message .= PHP_EOL . PHP_EOL . 'icl_sitepress_settings (unserialized): ' . PHP_EOL . print_r($current_settings, true);
$message .= PHP_EOL . str_repeat('=', 50);
$message .= '</textarea></p>';
$show_notice = true;
}
// ICL_AdminNotifier::removeMessage( 'check_settings_integrity' );
ICL_AdminNotifier::removeMessage('check_settings_integrity_corrupted');
if ($show_notice) {
ICL_AdminNotifier::addMessage('check_settings_integrity_corrupted', $message, 'error', false, false, false, 'check_settings_integrity', true);
ICL_AdminNotifier::displayMessages('check_settings_integrity');
}
$result = !$show_notice;
return $result;
}
示例9: display_basket_notification
function display_basket_notification($position)
{
if (class_exists('ICL_AdminNotifier') && class_exists('TranslationProxy_Basket')) {
$positions = TranslationProxy_Basket::get_basket_notification_positions();
if (isset($positions[$position])) {
ICL_AdminNotifier::display_messages('translation-basket-notification');
}
}
}
示例10: show_3_2_upgrade_notice
private function show_3_2_upgrade_notice()
{
global $sitepress;
$upgrade_setting = 'tm_upgrade_3.2';
if (!$sitepress->get_setting($upgrade_setting)) {
$args = array('id' => $upgrade_setting, 'msg' => '<p>' . __("We've updated the way to send documents to translation", 'wpml-translation-management') . '</p>' . '<a href="https://wpml.org/version/wpml-3-2/">' . __('WPML 3.2 release notes', 'wpml-translation-management') . '</a>', 'admin_notice' => true, 'hide' => true, 'limit_to_page' => WPML_TM_FOLDER . '/menu/main.php');
ICL_AdminNotifier::add_message($args);
$sitepress->set_setting($upgrade_setting, true);
$sitepress->save_settings();
}
}
示例11: __
} else {
echo ' dir="ltr" style="text-align:left;direction:ltr;width:100%"';
}
}
?>
<div class="wrap">
<div id="icon-wpml" class="icon32"><br /></div>
<h2><?php
echo __('String translation', 'wpml-string-translation');
?>
</h2>
<?php
if (class_exists('ICL_AdminNotifier')) {
ICL_AdminNotifier::displayMessages('string-translation');
}
?>
<?php
if (isset($icl_st_po_strings) && !empty($icl_st_po_strings)) {
?>
<p><?php
printf(__("These are the strings that we found in your .po file. Please carefully review them. Then, click on the 'add' or 'cancel' buttons at the %sbottom of this screen%s. You can exclude individual strings by clearing the check boxes next to them.", 'wpml-string-translation'), '<a href="#add_po_strings_confirm">', '</a>');
?>
</p>
<form method="post" action="<?php
echo admin_url("admin.php?page=" . WPML_ST_FOLDER . "/menu/string-translation.php");
?>
示例12: wpml_update_term_names_troubleshoot
/**
* Ajax handler for the troubleshoot page. Updates the term name on those terms given via the Ajax action.
*/
public static function wpml_update_term_names_troubleshoot()
{
global $wpdb;
ICL_AdminNotifier::removeMessage('termssuffixnotice');
$term_names = array();
$nonce = filter_input(INPUT_POST, '_icl_nonce', FILTER_SANITIZE_STRING);
if (!wp_verify_nonce($nonce, 'update_term_names_nonce')) {
die('Wrong Nonce');
}
$request_post_terms = filter_input(INPUT_POST, 'terms');
if ($request_post_terms) {
$term_names = json_decode(stripcslashes($request_post_terms));
if (!is_object($term_names)) {
$term_names = array();
}
}
$updated = array();
foreach ($term_names as $term_id => $new_name) {
$res = $wpdb->update($wpdb->terms, array('name' => $new_name), array('term_id' => $term_id));
if ($res) {
$updated[] = $term_id;
}
}
wp_send_json_success($updated);
}
示例13: _st_default_and_st_language_warning
static function _st_default_and_st_language_warning()
{
global $sitepress;
$string_settings = apply_filters('wpml_get_setting', false, 'st');
if (isset($string_settings['strings_language'])) {
ICL_AdminNotifier::removeMessage('_st_default_language_warning');
static $called = false;
if (defined('WPML_ST_FOLDER') && !$called) {
$st_language_code = $string_settings['strings_language'];
$st_language = $sitepress->get_display_language_name($st_language_code, $sitepress->get_admin_language());
$page = WPML_ST_FOLDER . '/menu/string-translation.php';
$st_page_url = admin_url('admin.php?page=' . $page);
$message = __('The strings language in your site is set to %s instead of English.
This means that all English texts that are hard-coded in PHP will appear when displaying content in %s.
<strong><a href="%s" target="_blank">Read more</a> | <a href="%s#icl_st_sw_form">Change strings language</a></strong>', 'wpml-string-translation');
$message = sprintf($message, $st_language, $st_language, 'https://wpml.org/faq/string-translation-default-language-not-english/', $st_page_url);
$fallback_message = __('<a href="%s" target="_blank">How to translate strings when default language is not English</a>', 'wpml-string-translation');
$fallback_message = sprintf($fallback_message, 'https://wpml.org/faq/string-translation-default-language-not-english/');
ICL_AdminNotifier::addMessage('_st_default_and_st_language_warning', $message, 'icl-admin-message-warning', true, $fallback_message, false, 'string-translation');
$called = true;
}
}
}
示例14: icl_local_edit_translator_form
/**
* Add/edit local translator form
*
* @param string $action add|edit
* @param int|object $selected_translator
*
* @return mixed
*/
private function icl_local_edit_translator_form($action = 'add', $selected_translator = 0)
{
$blog_users_nt = TranslationManagement::get_blog_not_translators();
$output = '';
$return['name'] = __('Local', 'wpml-translation-management');
$return['description'] = __('Your own translators', 'wpml-translation-management');
if ($action === 'add' && empty($blog_users_nt)) {
$alert_message = '<p>';
$alert_message .= __('All WordPress users are already translators. To add more translators, first create accounts for them.', 'wpml-translation-management');
$alert_message .= '</p>';
$return['content'] = '';
$return['messages'] = ICL_AdminNotifier::display_instant_message($alert_message, 'information', false, true);
return $return;
}
$output .= '<div id="icl_tm_add_user_errors">
<span class="icl_tm_no_to">' . __('Select user.', 'wpml-translation-management') . '</span>
</div>
<input type="hidden" name="icl_tm_action" value="' . $action . '_translator" />' . wp_nonce_field($action . '_translator', $action . '_translator_nonce', true, false);
if (!$selected_translator) {
$output .= '<input type="hidden" id="icl_tm_selected_user" name="user_id" />';
$output .= '<input type="text" id="icl_quick_src_users" placeholder="' . esc_attr__('search', 'wpml-translation-management') . '" />';
$output .= ' <span id="icl_user_src_nf"></span>';
$output .= '<img style="display:none;margin-left:3px;" src="' . esc_url(admin_url('images/wpspin_light.gif')) . '" class="waiting" alt="" />';
$output .= '<p>' . __('To add translators, they must first have accounts in WordPress. Translators can have any editing privileges, including subscriber.') . '</p>';
} else {
$output .= '<span class="updated fade" style="padding:4px">' . sprintf(__('Editing language pairs for <strong>%s</strong>', 'wpml-translation-management'), esc_html($selected_translator->display_name) . ' (' . $selected_translator->user_login . ')') . '</span>';
$output .= '<input type="hidden" name="user_id" value="' . $selected_translator->ID . '" />';
}
if ($selected_translator) {
$output .= '<br />
<div class="icl_tm_lang_pairs"';
if ($selected_translator) {
$output .= ' style="display:block"';
}
$output .= '>
<ul>';
$languages = $this->get_translation_languages();
foreach ($languages as $from_lang) {
$lang_from_selected = false;
if ($selected_translator && 0 < @count($selected_translator->language_pairs[$from_lang['code']])) {
$lang_from_selected = true;
}
$output .= '<li class="js-icl-tm-lang-from';
if ($lang_from_selected) {
$output .= ' js-lang-from-selected';
}
$output .= '">';
$output .= '<label><input class="icl_tm_from_lang" type="checkbox"';
if ($lang_from_selected) {
$output .= ' checked="checked"';
}
$output .= ' /> ';
$output .= sprintf(__('From %s', 'wpml-translation-management'), $from_lang['display_name']) . '</label>
<div class="icl_tm_lang_pairs_to"';
if ($selected_translator && 0 < @count($selected_translator->language_pairs[$from_lang['code']])) {
$output .= ' style="display:block"';
}
$output .= '>
<small>' . __('to', 'wpml-translation-management') . '</small>
<ul>';
foreach ($languages as $to_lang) {
if ($from_lang['code'] === $to_lang['code']) {
continue;
}
$lang_selected = false;
if ($selected_translator->ID && isset($selected_translator->language_pairs[$from_lang['code']][$to_lang['code']])) {
$lang_selected = true;
}
$output .= '<li class="js-icl-tm-lang-pair';
if ($lang_selected) {
$output .= ' js-lang-pair-selected';
}
$output .= '">
<label><input class="icl_tm_to_lang" type="checkbox" name="lang_pairs[' . $from_lang['code'] . '][' . $to_lang['code'] . ']" value="1"';
if ($lang_selected) {
$output .= ' checked="checked"';
}
$output .= ' /> ';
$output .= $to_lang['display_name'] . '</label>
</li>';
}
$output .= '</ul>
</div>
</li>';
}
$output .= '</ul>';
$output .= '</div><input class="button-primary" type="submit" value="';
$output .= $selected_translator ? esc_attr(__('Update', 'wpml-translation-management')) : esc_attr(__('Add as translator', 'wpml-translation-management'));
$output .= '" /> <input type="submit" value="' . __('Cancel', 'wpml-translation-management') . '" name="cancel" class="button-secondary" onclick="history.go(-1); return false;" />';
}
$return['content'] = $output;
//.........这里部分代码省略.........
示例15: wpml_update_term_names_troubleshoot
/**
* Ajax handler for the troubleshoot page. Updates the term name on those terms given via the Ajax action.
*/
public static function wpml_update_term_names_troubleshoot()
{
global $wpdb;
ICL_AdminNotifier::removeMessage('termssuffixnotice');
$term_names = array();
if (isset($_POST['terms']) && $_POST['terms']) {
$term_names = json_decode(stripcslashes($_POST['terms']));
if (!is_object($term_names)) {
$term_names = array();
}
}
$updated = array();
foreach ($term_names as $term_id => $new_name) {
$res = $wpdb->update($wpdb->terms, array('name' => $new_name), array('term_id' => $term_id));
if ($res) {
$updated[] = $term_id;
}
}
wp_send_json_success($updated);
}
开发者ID:StudioCreate,项目名称:Uncle-Hummer-WordPress-Theme,代码行数:23,代码来源:wpml-troubleshooting-terms-menu.class.php