本文整理汇总了PHP中ICL_AdminNotifier::remove_message方法的典型用法代码示例。如果您正苦于以下问题:PHP ICL_AdminNotifier::remove_message方法的具体用法?PHP ICL_AdminNotifier::remove_message怎么用?PHP ICL_AdminNotifier::remove_message使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ICL_AdminNotifier
的用法示例。
在下文中一共展示了ICL_AdminNotifier::remove_message方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: show_messages
/**
* Display admin notices.
*/
public function show_messages()
{
foreach ($this->message_ids as $message_suffix) {
$message_id = 'icl_tm_message_' . $message_suffix;
$message = ICL_AdminNotifier::get_message($message_id);
if (isset($message['type'], $message['text'])) {
echo '<div class="' . esc_attr($message['type']) . ' below-h2"><p>' . esc_html($message['text']) . '</p></div>';
ICL_AdminNotifier::remove_message($message_id);
}
}
}
示例3: validate_basket_package_item
/**
* @param $translation_action
* @param $source_language
*
* @return bool
*/
private function validate_basket_package_item($translation_action, $source_language)
{
ICL_AdminNotifier::remove_message('the_basket_items_notification');
$package = $this->package;
$package_id = $package->ID;
$basket = TranslationProxy_Basket::get_basket();
$package_is_valid = true;
$basket_source_language = TranslationProxy_Basket::get_source_language();
if ($basket && $basket_source_language) {
if ($source_language != $basket_source_language) {
TranslationProxy_Basket::add_message(array('type' => 'update', 'text' => __('You cannot add packages in this language to the basket since it already contains posts, packages or strings of another source language!
Either submit the current basket and then add the post or delete the posts of differing language in the current basket', 'sitepress')));
TranslationProxy_Basket::update_basket();
$package_is_valid = false;
}
}
if (!$translation_action) {
TranslationProxy_Basket::add_message(array('type' => 'error', 'text' => __('Please select at least one language to translate into.', 'sitepress')));
$package_is_valid = false;
}
if (!$package_id) {
TranslationProxy_Basket::add_message(array('type' => 'error', 'text' => __('Please select at least one document to translate.', 'sitepress')));
$package_is_valid = false;
return $package_is_valid;
}
return $package_is_valid;
}
示例4: automatic_service_selection
protected function automatic_service_selection()
{
if (defined('DOING_AJAX') || !$this->automatic_service_selection_pages()) {
return;
}
$done = wp_cache_get('done', 'automatic_service_selection');
ICL_AdminNotifier::remove_message('automatic_service_selection');
if (!$done && defined('WPML_TP_DEFAULT_SUID')) {
$selected_service = TranslationProxy::get_current_service();
if (isset($selected_service->suid) && $selected_service->suid == WPML_TP_DEFAULT_SUID) {
return;
}
try {
$service_by_suid = TranslationProxy_Service::get_service_by_suid(WPML_TP_DEFAULT_SUID);
} catch (Exception $ex) {
$service_by_suid = false;
}
if (isset($service_by_suid->id)) {
$selected_service_id = isset($selected_service->id) ? $selected_service->id : false;
if (!$selected_service_id || $selected_service_id != $service_by_suid->id) {
if ($selected_service_id) {
TranslationProxy::deselect_active_service();
}
$result = TranslationProxy::select_service($service_by_suid->id);
if (is_wp_error($result)) {
$error_data = $result->get_error_data();
$error_data_string = false;
foreach ($error_data as $key => $error_data_message) {
$error_data_string .= $result->get_error_message() . '<br/>';
$error_data_string .= $key . ': <pre>' . print_r($error_data_message, true) . '</pre>';
$error_data_string .= $result->get_error_message() . $error_data_string;
}
}
if (defined('WPML_TP_SERVICE_CUSTOM_FIELDS')) {
TranslationProxy::authenticate_service($service_by_suid->id, WPML_TP_SERVICE_CUSTOM_FIELDS);
}
}
} else {
$error_data_string = __("WPML can't find the translation service specified in WPML_TP_DEFAULT_SUID constant. Please remove the constant or set the correct value.", 'wpml-translation-management');
}
}
if (isset($error_data_string)) {
$automatic_service_selection_args = array('id' => 'automatic_service_selection', 'group' => 'automatic_service_selection', 'msg' => $error_data_string, 'type' => 'error', 'admin_notice' => true, 'hide' => false);
ICL_AdminNotifier::add_message($automatic_service_selection_args);
}
wp_cache_set('done', true, 'automatic_service_selection');
}
示例5: build_content_dashboard_documents_options
//.........这里部分代码省略.........
<?php
if ($lang['code'] == $this->translation_filter['from_lang']) {
continue;
}
$radio_prefix_html = '<input type="radio" name="tr_action[' . $lang['code'] . ']" ';
?>
<tr>
<td><strong><?php
echo $lang['display_name'];
?>
</strong></td>
<td>
<label>
<?php
echo $radio_prefix_html;
?>
value="1" <?php
echo $translate_checked;
?>
/>
<?php
_e('Translate', 'wpml-translation-management');
?>
</label>
</td>
<td>
<label>
<?php
echo $radio_prefix_html;
?>
value="2" <?php
echo $duplicate_checked;
?>
/>
<?php
_e('Duplicate content', 'wpml-translation-management');
?>
</label>
</td>
<td>
<label>
<?php
echo $radio_prefix_html;
?>
value="0" <?php
echo $do_nothing_checked;
?>
/>
<?php
_e('Do nothing', 'wpml-translation-management');
?>
</label>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
<br/>
<input name="iclnonce" type="hidden" value="<?php
echo wp_create_nonce('pro-translation-icl');
?>
"/>
<?php
$tm_jobs_submit_disabled = disabled(empty($this->selected_languages) && empty($this->selected_posts), true, false);
$tm_jobs_submit_caption = __('Add to translation basket', 'wpml-translation-management');
?>
<input id="icl_tm_jobs_submit" class="button-primary" type="submit" value="<?php
echo $tm_jobs_submit_caption;
?>
" <?php
echo $tm_jobs_submit_disabled;
?>
/>
<div id="icl_dup_ovr_warn" class="icl_dup_ovr_warn" style="display:none;">
<?php
$dup_message = '<p>';
$dup_message .= __('Any existing content (translations) will be overwritten when creating duplicates.', 'wpml-translation-management');
$dup_message .= '</p>';
$dup_message .= '<p>';
$dup_message .= __("When duplicating content, please first duplicate parent pages to maintain the site's hierarchy.", 'wpml-translation-management');
$dup_message .= '</p>';
ICL_AdminNotifier::display_instant_message($dup_message, 'error');
?>
</div>
<div style="width: 45%; margin: auto; position: relative; top: -30px;">
<?php
ICL_AdminNotifier::display_messages('translation-dashboard-under-translation-options');
ICL_AdminNotifier::remove_message('items_added_to_basket');
?>
</div>
</td>
</tr>
</tbody>
</table>
<?php
}
示例6: display_string_menu
//.........这里部分代码省略.........
?>
]"
name="translate_to[<?php
echo $lang['code'];
?>
]"
value="1"
id="icl_st_translate_to_<?php
echo $lang['code'];
?>
" <?php
echo $checked;
?>
data-language="<?php
echo $lang['code'];
?>
"
/>
<label
for="translate_to[<?php
echo $lang['code'];
?>
]"
class="<?php
echo $label_class;
?>
">
<?php
printf(__('Translate to %s', 'wpml-translation-management'), $lang['display_name']);
?>
</label>
<?php
if (isset($target_status[$lang['code']]) && $target_status[$lang['code']]) {
?>
<span style="display: none;"
id="icl_st_max_rate_<?php
echo $lang['code'];
?>
"><?php
echo $target_rate[$lang['code']];
?>
</span>
<span style="display: none;"
id="icl_st_estimate_<?php
echo $lang['code'];
?>
_wrap"
class="icl_st_estimate_wrap">
(<?php
printf(__('Estimated cost: %s USD', 'wpml-translation-management'), '<span id="icl_st_estimate_' . $lang['code'] . '">0</span>');
?>
)</span>
<?php
}
?>
</li>
<?php
}
?>
</ul>
<?php
echo wpml_nonce_field('icl-string-translation');
?>
<input id="icl_send_strings" class="button-primary"
type="submit"
value="<?php
_e('Add to translation basket', 'wpml-translation-management');
?>
"
disabled="disabled"
data-lang-not-active-message="<?php
_e('One of the selected strings is in a language that is not activate. It can not be added to the translation basket.', 'wpml-translation-management');
?>
"
data-more-than-one-lang-message="<?php
_e('Strings in different languages are selected. They can not be added to the translation basket.', 'wpml-translation-management');
?>
"
data-translation-basket-lang-message="<?php
_e('You cannot add strings in this language to the basket since it already contains posts or strings of another source language! Either submit the current basket or delete the posts of differing language in the current basket', 'wpml-translation-management');
?>
"
/>
<div class="update-nag js-translation-message"
style="display:none"></div>
<div style="width: 45%; margin: auto">
<?php
ICL_AdminNotifier::display_messages('string-translation-under-translation-options');
ICL_AdminNotifier::remove_message('items_added_to_basket');
?>
</div>
</td>
</tr>
</tbody>
</table>
</form>
<?php
}
示例7: automatic_service_selection
private function automatic_service_selection()
{
if (defined('DOING_AJAX') || !$this->automatic_service_selection_pages()) {
return;
}
$done = wp_cache_get('done', 'automatic_service_selection');
ICL_AdminNotifier::remove_message('automatic_service_selection');
$tp_default_suid = TranslationProxy::get_tp_default_suid();
if (!$done && $tp_default_suid) {
$selected_service = TranslationProxy::get_current_service();
if (isset($selected_service->suid) && $selected_service->suid == $tp_default_suid) {
return;
}
try {
$service_by_suid = TranslationProxy_Service::get_service_by_suid($tp_default_suid);
} catch (Exception $ex) {
$service_by_suid = false;
}
if (isset($service_by_suid->id)) {
$selected_service_id = isset($selected_service->id) ? $selected_service->id : false;
if (!$selected_service_id || $selected_service_id != $service_by_suid->id) {
if ($selected_service_id) {
TranslationProxy::deselect_active_service();
}
$result = TranslationProxy::select_service($service_by_suid->id);
if (is_wp_error($result)) {
$error_data = $result->get_error_data();
$error_data_string = false;
foreach ($error_data as $key => $error_data_message) {
$error_data_string .= $result->get_error_message() . '<br/>';
$error_data_string .= $key . ': <pre>' . print_r($error_data_message, true) . '</pre>';
$error_data_string .= $result->get_error_message() . $error_data_string;
}
}
}
} else {
$error_data_string = __("WPML can't find the translation service. Please contact WPML Support or your translation service provider.", 'wpml-translation-management');
}
}
if (isset($error_data_string)) {
$automatic_service_selection_args = array('id' => 'automatic_service_selection', 'group' => 'automatic_service_selection', 'msg' => $error_data_string, 'type' => 'error', 'admin_notice' => true, 'hide' => false);
ICL_AdminNotifier::add_message($automatic_service_selection_args);
}
wp_cache_set('done', true, 'automatic_service_selection');
}
示例8: add_strings_to_basket
/**
* Serves WPML > String translation form submission and adds strings to basket
*
* @param array $string_ids identifiers of strings
* @param $source_language
* @param array $target_languages selected target languages
* @return bool
* @todo: [WPML 3.3] move to ST and handle with hooks
*/
public static function add_strings_to_basket($string_ids, $source_language, $target_languages)
{
global $wpdb, $sitepress;
self::get_basket();
ICL_AdminNotifier::remove_message('the_basket_items_notification');
/* structure of cart in get_option:
* [posts]
* [element_id]
* [to_langs]
* [language_code] fr | pl | de ... with value 1
* [strings]
* [string_id]
* [to_langs]
* [language_code]
*/
// no post selected ?
if (empty($string_ids)) {
self::$messages[] = array('type' => 'error', 'text' => __('Please select at least one document to translate.', 'wpml-translation-management'));
self::update_basket();
return false;
}
// no language selected ?
if (empty($target_languages)) {
self::$messages[] = array('type' => 'error', 'text' => __('Please select at least one language to translate into.', 'wpml-translation-management'));
self::update_basket();
return false;
}
if (self::get_basket() && self::get_source_language()) {
/*we do not add items that are not in the source language of the current basket
we cannot yet set its source language though since update_basket would set the basket
to false oso long as we do not have any elements in the basket*/
if ($source_language != self::get_source_language()) {
self::$messages[] = array('type' => 'update', 'text' => __('You cannot add strings in this language to the basket since it already contains posts or strings of another source language!
Either submit the current basket and then add the post or delete the posts of differing language in the current basket', 'wpml-translation-management'));
self::update_basket();
return false;
}
}
foreach ($target_languages as $target_language => $selected) {
if ($target_language == $source_language) {
continue;
}
$target_language_name = $sitepress->get_display_language_name($target_language);
foreach ($string_ids as $id) {
$send_to_basket = true;
$query = "\tSELECT \t{$wpdb->prefix}icl_string_translations.status,\n\t\t\t\t\t\t\t\t\t\t{$wpdb->prefix}icl_strings.value\n\t\t\t\t\t\t\t\tFROM {$wpdb->prefix}icl_string_translations\n\t\t\t\t\t\t\t\tINNER JOIN {$wpdb->prefix}icl_strings\n\t\t\t\t\t\t\t\t\tON {$wpdb->prefix}icl_string_translations.string_id = {$wpdb->prefix}icl_strings.id\n\t\t\t\t\t\t\t\tWHERE {$wpdb->prefix}icl_string_translations.string_id=%d\n\t\t\t\t\t\t\t\t\tAND {$wpdb->prefix}icl_string_translations.language=%s";
$string_translation = $wpdb->get_row($wpdb->prepare($query, $id, $target_language));
if (!is_null($string_translation) && $string_translation->status == ICL_TM_WAITING_FOR_TRANSLATOR) {
self::$messages[] = array('type' => 'update', 'text' => sprintf(__('String "%s" will be ignored for %s, because translation is already waiting for translator.', 'wpml-translation-management'), $string_translation->value, $target_language_name));
$send_to_basket = false;
}
if ($send_to_basket) {
self::$basket['string'][$id]['from_lang'] = $source_language;
self::$basket['string'][$id]['to_langs'][$target_language] = 1;
// set basket language if not already set
if (!isset(self::$basket['source_language'])) {
self::$basket['source_language'] = $source_language;
}
}
}
}
self::update_basket();
return true;
}
示例9: 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);
}
}
示例10: display_string_menu
//.........这里部分代码省略.........
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<ul id="icl_tm_languages">
<?php
foreach ($strings_target_languages as $lang) {
if ($lang['code'] == $lang_filter) {
continue;
}
$is_active_language = $sitepress->is_active_language($lang['code']);
$checked = checked(true, $is_active_language, false);
$label_class = $is_active_language ? 'active' : 'non-active';
?>
<li>
<input type="checkbox"
id="translate_to[<?php
echo $lang['code'];
?>
]"
name="translate_to[<?php
echo $lang['code'];
?>
]"
value="1"
id="icl_st_translate_to_<?php
echo $lang['code'];
?>
" <?php
echo $checked;
?>
/>
<label for="translate_to[<?php
echo $lang['code'];
?>
]"
class="<?php
echo $label_class;
?>
">
<?php
printf(__('Translate to %s', 'wpml-translation-management'), $lang['display_name']);
?>
</label>
<?php
if (isset($target_status[$lang['code']]) && $target_status[$lang['code']]) {
?>
<span style="display: none;"
id="icl_st_max_rate_<?php
echo $lang['code'];
?>
"><?php
echo $target_rate[$lang['code']];
?>
</span>
<span style="display: none;"
id="icl_st_estimate_<?php
echo $lang['code'];
?>
_wrap"
class="icl_st_estimate_wrap">
(<?php
printf(__('Estimated cost: %s USD', 'wpml-translation-management'), '<span id="icl_st_estimate_' . $lang['code'] . '">0</span>');
?>
)</span>
<?php
}
?>
</li>
<?php
}
?>
</ul>
<input name="iclnonce" type="hidden"
value="<?php
echo wp_create_nonce('icl-string-translation');
?>
"/>
<input id="icl_send_strings" class="button-primary" type="submit"
value="<?php
_e('Add to translation basket', 'wpml-translation-management');
?>
"
disabled="disabled"/>
<div style="width: 45%; margin: auto">
<?php
ICL_AdminNotifier::display_messages('string-translation-under-translation-options');
ICL_AdminNotifier::remove_message('items_added_to_basket');
?>
</div>
</td>
</tr>
</tbody>
</table>
</form>
<?php
}