當前位置: 首頁>>代碼示例>>PHP>>正文


PHP ICL_AdminNotifier::add_message方法代碼示例

本文整理匯總了PHP中ICL_AdminNotifier::add_message方法的典型用法代碼示例。如果您正苦於以下問題:PHP ICL_AdminNotifier::add_message方法的具體用法?PHP ICL_AdminNotifier::add_message怎麽用?PHP ICL_AdminNotifier::add_message使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在ICL_AdminNotifier的用法示例。


在下文中一共展示了ICL_AdminNotifier::add_message方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: 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');
         }
     }
 }
開發者ID:Alexg10,項目名稱:Egzobeatbox,代碼行數:35,代碼來源:class-wpml-tm-requirements.php

示例2: 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);
        }
    }
}
開發者ID:studiopengpeng,項目名稱:ASCOMETAL,代碼行數:34,代碼來源:not-compatible-plugins.php

示例3: 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);
    }
}
開發者ID:pcuervo,項目名稱:odc,代碼行數:15,代碼來源:wpml-private-actions.php

示例4: 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');
     }
 }
開發者ID:nayabbukhari,項目名稱:circulocristiano,代碼行數:20,代碼來源:class-wpml-tm-promotions.php

示例5: icl_tm_cancel_jobs

 /**
  * Cancel translation jobs.
  *
  * @param array $data  Request data
  */
 public function icl_tm_cancel_jobs($data)
 {
     $message = array('id' => 'icl_tm_message_cancel_jobs', 'type' => 'updated');
     if (isset($data['icl_translation_id'])) {
         $this->cancel_translation_request($data['icl_translation_id']);
         $message['text'] = __('Translation requests cancelled.', 'sitepress');
     } else {
         $message['text'] = __('No Translation requests selected.', 'sitepress');
     }
     ICL_AdminNotifier::add_message($message);
 }
開發者ID:gencagushi,項目名稱:tema,代碼行數:16,代碼來源:translation-management.class.php

示例6: 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();
     }
 }
開發者ID:ryuqing,項目名稱:cake,代碼行數:11,代碼來源:wpml-translation-management.class.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');
 }
開發者ID:studiopengpeng,項目名稱:ASCOMETAL,代碼行數:45,代碼來源:class-wpml-translation-management.php

示例8: update_basket_notifications

 /**
  * Register notification with number of items in basket and link to basket
  */
 public static function update_basket_notifications()
 {
     $positions = self::get_basket_notification_positions();
     $basket_link = "admin.php?page=" . WPML_TM_FOLDER . "/menu/main.php&sm=basket";
     foreach ($positions as $position => $group) {
         ICL_AdminNotifier::remove_message_group($position);
     }
     self::get_basket();
     $basket_items_count = self::get_basket_items_count(true);
     // if we have something in the basket
     if ($basket_items_count > 0 && (!isset($_GET['clear_basket']) || $_GET['clear_basket'] != 1) && (!isset($_GET['action']) || $_GET['action'] != 'delete')) {
         $text = __('The items you have selected are now in the translation basket &ndash;', 'wpml-translation-management');
         $text .= ' ' . sprintf(__('<a href="%s">Send to translation &raquo;</a>', 'wpml-translation-management'), $basket_link);
         // translation management pages
         $message_args = array('id' => $positions['tm_dashboard_top'], 'text' => $text, 'classes' => 'small', 'type' => 'information small', 'group' => $positions['tm_dashboard_top'], 'admin_notice' => false, 'hide_per_user' => false, 'dismiss_per_user' => false, 'capability' => 'manage_options');
         ICL_AdminNotifier::add_message($message_args);
     } else {
         ICL_AdminNotifier::remove_message($positions['tm_dashboard_top']);
     }
     $admin_basket_message_id = $positions['admin_notice'];
     if (self::$messages || $basket_items_count > 0) {
         $additional_messages = array();
         if (isset(self::$messages) && is_array(self::$messages)) {
             foreach (self::$messages as $message) {
                 $additional_messages[] = $message['text'];
             }
         }
         $additional_messages_text = '';
         if (count($additional_messages) > 0) {
             $additional_messages_text = '<ul><li>' . implode('</li><li>', $additional_messages) . '</li></ul>';
         }
         $limit_to_page = array();
         $limit_to_page[] = WPML_TM_FOLDER . '/menu/main.php';
         $message_args = array('id' => $admin_basket_message_id, 'text' => $additional_messages_text, 'classes' => 'small', 'type' => 'information', 'group' => $admin_basket_message_id, 'admin_notice' => true, 'hide_per_user' => false, 'dismiss_per_user' => false, 'limit_to_page' => $limit_to_page, 'show_once' => true);
         if (trim($additional_messages_text) != '') {
             ICL_AdminNotifier::add_message($message_args);
         }
     } else {
         ICL_AdminNotifier::remove_message($admin_basket_message_id);
     }
 }
開發者ID:studiopengpeng,項目名稱:ASCOMETAL,代碼行數:44,代碼來源:translationproxy-basket.class.php

示例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') . ' &raquo;</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);
     }
 }
開發者ID:Junaid-Farid,項目名稱:gocnex,代碼行數:54,代碼來源:wpml-translation-management.class.php


注:本文中的ICL_AdminNotifier::add_message方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。