当前位置: 首页>>代码示例>>PHP>>正文


PHP ICL_AdminNotifier::displayInstantMessage方法代码示例

本文整理汇总了PHP中ICL_AdminNotifier::displayInstantMessage方法的典型用法代码示例。如果您正苦于以下问题:PHP ICL_AdminNotifier::displayInstantMessage方法的具体用法?PHP ICL_AdminNotifier::displayInstantMessage怎么用?PHP ICL_AdminNotifier::displayInstantMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ICL_AdminNotifier的用法示例。


在下文中一共展示了ICL_AdminNotifier::displayInstantMessage方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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;
}
开发者ID:agiper,项目名称:wordpress,代码行数:38,代码来源:functions.php

示例2: 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;
 }
开发者ID:aarongillett,项目名称:B22-151217,代码行数:59,代码来源:class-wpml-tm-cpt-dashboard-widget.php

示例3: print_translatable_custom_content_status

 function print_translatable_custom_content_status()
 {
     global $wp_taxonomies;
     $icl_post_types = $this->get_translatable_documents(true);
     $cposts = array();
     $notice = '';
     foreach ($icl_post_types as $k => $v) {
         if (!in_array($k, array('post', 'page'))) {
             $cposts[$k] = $v;
         }
     }
     foreach ($cposts as $k => $cpost) {
         if (!isset($this->settings['custom_posts_sync_option'][$k])) {
             $cposts_sync_not_set[] = $cpost->labels->name;
         }
     }
     if (defined('WPML_TM_VERSION') && !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->get_translatable_documents(true);
     if (defined('WPML_TM_VERSION') && $icl_post_types) {
         global $wpdb, $sitepress_settings;
         $default_language = $this->get_default_language();
         $custom_posts = array();
         $icl_post_types = $this->get_translatable_documents(true);
         foreach ($icl_post_types as $k => $v) {
             if (!in_array($k, array('post', 'page'))) {
                 $custom_posts[$k] = $v;
             }
         }
         foreach ($custom_posts as $k => $custom_post) {
             $_has_slug = isset($custom_post->rewrite['slug']) && $custom_post->rewrite['slug'];
             $_translate = !empty($sitepress_settings['posts_slug_translation']['types'][$k]);
             if ($_has_slug) {
                 if (isset($sitepress_settings['st']) && $default_language != $sitepress_settings['st']['strings_language']) {
                     $string_id_prepared = $wpdb->prepare("\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tSELECT s.id FROM {$wpdb->prefix}icl_strings s\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tJOIN {$wpdb->prefix}icl_string_translations st\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tON st.string_id = s.id\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE st.language=%s AND s.value=%s AND s.name LIKE %s\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t", array($default_language, $custom_post->rewrite['slug'], 'URL slug: %'));
                 } else {
                     $string_id_prepared = $wpdb->prepare("SELECT id FROM {$wpdb->prefix}icl_strings WHERE name = %s AND value = %s ", array('Url slug: ' . $custom_post->rewrite['slug'], $custom_post->rewrite['slug']));
                 }
                 $string_id = $wpdb->get_var($string_id_prepared);
                 if ($_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'));
     foreach ($ctaxonomies as $ctax) {
         if (!isset($this->settings['taxonomies_sync_option'][$ctax])) {
             $tax_sync_not_set[] = $wp_taxonomies[$ctax]->label;
         }
     }
     if (defined('WPML_TM_VERSION') && !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>';
     }
     echo $notice;
 }
开发者ID:pablomarsan,项目名称:iftheme-docs,代码行数:62,代码来源:sitepress.class.php

示例4: esc_html_e

 />
		                <br/><br/>
		                <div class="icl_tm_error" id="icl_dup_ovr_warn" style="display: none">
			                <?php 
    esc_html_e('Any existing content (translations) will be overwritten when creating duplicates.', 'wpml-translation-management');
    ?>
<br/>
			                <?php 
    esc_html_e("When duplicating content, please first duplicate parent pages to maintain the site's hierarchy.", 'wpml-translation-management');
    ?>

		                </div>
	                <?php 
} else {
    $message = _('You currently have no active alternate languages!', 'wpml-translation-management');
    ICL_AdminNotifier::displayInstantMessage($message, 'error');
}
?>
                </td>
            </tr>
        </tbody>
    </table>

    </form>

    <br />
    <?php 
$ICL_Pro_Translation->get_icl_manually_tranlations_box('icl_cyan_box');
// shows only when translation polling is on and there are translations in progress
?>
开发者ID:Calraiser,项目名称:flux,代码行数:30,代码来源:dashboard.php

示例5: isset

            ?>
                                        <?php 
            $_has_slug = isset($custom_post->rewrite['slug']) && $custom_post->rewrite['slug'];
            $_on = $sitepress_settings['posts_slug_translation']['on'] && $_has_slug && isset($sitepress_settings['custom_posts_sync_option'][$k]) && $sitepress_settings['custom_posts_sync_option'][$k] == 1;
            $is_hidden = $_on ? '' : 'hidden';
            $_translate = !empty($sitepress_settings['posts_slug_translation']['types'][$k]);
            if ($_has_slug) {
                if ($default_language != $sitepress_settings['st']['strings_language']) {
                    $string_id_prepared = $wpdb->prepare("\r\n                                                        SELECT s.id FROM {$wpdb->prefix}icl_strings s\r\n                                                            JOIN {$wpdb->prefix}icl_string_translations st\r\n                                                            ON st.string_id = s.id\r\n                                                            WHERE st.language=%s AND s.value=%s AND s.name LIKE %s\r\n                                                    ", array($default_language, $custom_post->rewrite['slug'], 'URL slug: %'));
                } else {
                    $string_id_prepared = $wpdb->prepare("SELECT id FROM {$wpdb->prefix}icl_strings WHERE name = %s AND value = %s ", array('Url slug: ' . $custom_post->rewrite['slug'], $custom_post->rewrite['slug']));
                }
                $string_id = $wpdb->get_var($string_id_prepared);
                if ($_translate && !$string_id) {
                    $message = sprintf(__("%s slugs are set to be translated, but they are missing their translation", 'sitepress'), $custom_post->labels->name);
                    ICL_AdminNotifier::displayInstantMessage($message, 'error', 'below-h2', false);
                }
                $_slug_translations = icl_get_string_translations_by_id($string_id);
            } else {
                $_slug_translations = false;
            }
            ?>
                                        <?php 
            if ($_has_slug && isset($sitepress_settings['posts_slug_translation']['on']) && $sitepress_settings['posts_slug_translation']['on']) {
                ?>
                                            <div class="icl_slug_translation_choice <?php 
                echo $is_hidden;
                ?>
">
                                                <p>
                                                    <label>
开发者ID:santikrass,项目名称:apache,代码行数:31,代码来源:_custom_types_translation.php

示例6: render

    public function render($post_type, $custom_post)
    {
        $_has_slug = isset($custom_post->rewrite['slug']) && $custom_post->rewrite['slug'];
        $_on = $this->settings->is_on() && $_has_slug && $this->post_sync_setting->is_sync($post_type);
        $is_hidden = $_on ? '' : 'hidden';
        $_translate = $this->settings->is_translate($post_type);
        $string_id = null;
        if ($_has_slug) {
            list($string_id, $_slug_translations) = WPML_Slug_Translation::get_translations($post_type);
            if ($this->settings->is_on() && $_translate && !$string_id) {
                $message = sprintf(__("%s slugs are set to be translated, but they are missing their translation", 'sitepress'), $custom_post->labels->name);
                ICL_AdminNotifier::displayInstantMessage($message, 'error', 'below-h2', false);
            }
        } else {
            $_slug_translations = false;
        }
        if ($_has_slug && $this->settings->is_on()) {
            ?>
			<div class="icl_slug_translation_choice <?php 
            echo $is_hidden;
            ?>
">
				<p>
					<label>
						<input name="translate_slugs[<?php 
            echo $post_type;
            ?>
][on]" type="checkbox" value="1" <?php 
            checked(1, $_translate, true);
            ?>
 />
						<?php 
            printf(__('Use different slugs in different languages for %s.', 'sitepress'), $custom_post->labels->name);
            ?>
					</label>
				</p>

				<table class="js-cpt-slugs <?php 
            if (empty($_translate)) {
                ?>
hidden<?php 
            }
            ?>
">


					<?php 
            if ($string_id) {
                $string = new WPML_ST_String($string_id, $this->wpdb);
                $string_lang = $string->get_language();
            } else {
                $string_lang = '';
            }
            $string_lang = $string_lang ? $string_lang : $this->sitepress->get_default_language();
            $languages = $this->sitepress->get_active_languages();
            if (!in_array($string_lang, array_keys($languages))) {
                $all_languages = $this->sitepress->get_languages();
                $languages[$string_lang] = $all_languages[$string_lang];
            }
            $original_slug = WPML_Slug_Translation::get_slug_by_type($post_type);
            $original_slug = $original_slug ? $original_slug : (isset($custom_post->slug) ? $custom_post->slug : $custom_post->rewrite['slug']);
            foreach ($languages as $language) {
                $slug_translation_value = !empty($_slug_translations[$language['code']]['value']) ? $_slug_translations[$language['code']]['value'] : '';
                $slug_translation_sample = $original_slug . ' @' . $language['code'];
                ?>
						<tr<?php 
                if ($language['code'] == $string_lang) {
                    echo ' style="display:none"';
                }
                ?>
>
							<td>
								<label for="translate_slugs[<?php 
                echo $post_type;
                ?>
][langs][<?php 
                echo $language['code'];
                ?>
]"><?php 
                echo $this->sitepress->get_flag_img($language['code']) . ' ' . $language['display_name'];
                ?>
</label>
							</td>
							<td>
								<input
										id="translate_slugs[<?php 
                echo $post_type;
                ?>
][langs][<?php 
                echo $language['code'];
                ?>
]"
										class="js-translate-slug"
										name="translate_slugs[<?php 
                echo $post_type;
                ?>
][langs][<?php 
                echo $language['code'];
                ?>
]" type="text" value="<?php 
//.........这里部分代码省略.........
开发者ID:aarongillett,项目名称:B22-151217,代码行数:101,代码来源:class-wpml-custom-post-slug-ui.php


注:本文中的ICL_AdminNotifier::displayInstantMessage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。