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


PHP wp_staticize_emoji函数代码示例

本文整理汇总了PHP中wp_staticize_emoji函数的典型用法代码示例。如果您正苦于以下问题:PHP wp_staticize_emoji函数的具体用法?PHP wp_staticize_emoji怎么用?PHP wp_staticize_emoji使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: wp_staticize_emoji_for_email

/**
 * Convert emoji in emails into static images.
 *
 * @since 4.2.0
 *
 * @param array $mail The email data array.
 * @return array The email data array, with emoji in the message staticized.
 */
function wp_staticize_emoji_for_email($mail)
{
    if (!isset($mail['message'])) {
        return $mail;
    }
    /*
     * We can only transform the emoji into images if it's a text/html email.
     * To do that, here's a cut down version of the same process that happens
     * in wp_mail() - get the Content-Type from the headers, if there is one,
     * then pass it through the wp_mail_content_type filter, in case a plugin
     * is handling changing the Content-Type.
     */
    $headers = array();
    if (isset($mail['headers'])) {
        if (is_array($mail['headers'])) {
            $headers = $mail['headers'];
        } else {
            $headers = explode("\n", str_replace("\r\n", "\n", $mail['headers']));
        }
    }
    foreach ($headers as $header) {
        if (strpos($header, ':') === false) {
            continue;
        }
        // Explode them out.
        list($name, $content) = explode(':', trim($header), 2);
        // Cleanup crew.
        $name = trim($name);
        $content = trim($content);
        if ('content-type' === strtolower($name)) {
            if (strpos($content, ';') !== false) {
                list($type, $charset) = explode(';', $content);
                $content_type = trim($type);
            } else {
                $content_type = trim($content);
            }
            break;
        }
    }
    // Set Content-Type if we don't have a content-type from the input headers.
    if (!isset($content_type)) {
        $content_type = 'text/plain';
    }
    /** This filter is documented in wp-includes/pluggable.php */
    $content_type = apply_filters('wp_mail_content_type', $content_type);
    if ('text/html' === $content_type) {
        $mail['message'] = wp_staticize_emoji($mail['message']);
    }
    return $mail;
}
开发者ID:zhoujiangyou,项目名称:WordPress,代码行数:58,代码来源:formatting.php

示例2: gwolle_gb_page_editor


//.........这里部分代码省略.........

								<div id="contentdiv" class="postbox" >
									<div class="handlediv"></div>
									<h3 class='hndle' title="<?php 
        esc_attr_e('Click to open or close', 'gwolle-gb');
        ?>
"><span><?php 
        _e('Guestbook entry', 'gwolle-gb');
        ?>
</span></h3>
									<div class="inside">
										<textarea rows="10" name="gwolle_gb_content" id="gwolle_gb_content" tabindex="1" placeholder="<?php 
        _e('Message', 'gwolle-gb');
        ?>
"><?php 
        echo gwolle_gb_sanitize_output($entry->get_content());
        ?>
</textarea>
										<?php 
        if (get_option('gwolle_gb-showLineBreaks', 'false') == 'false') {
            echo '<p>' . sprintf(__('Line breaks will not be visible to the visitors due to your <a href="%s">settings</a>.', 'gwolle-gb'), 'admin.php?page=' . GWOLLE_GB_FOLDER . '/settings.php') . '</p>';
        }
        $form_setting = gwolle_gb_get_setting('form');
        if (isset($form_setting['form_bbcode_enabled']) && $form_setting['form_bbcode_enabled'] === 'true') {
            wp_enqueue_script('markitup', plugins_url('../frontend/markitup/jquery.markitup.js', __FILE__), 'jquery', GWOLLE_GB_VER, false);
            wp_enqueue_script('markitup_set', plugins_url('../frontend/markitup/set.js', __FILE__), 'jquery', GWOLLE_GB_VER, false);
            wp_enqueue_style('gwolle_gb_markitup_css', plugins_url('../frontend/markitup/style.css', __FILE__), false, GWOLLE_GB_VER, 'screen');
            $dataToBePassed = array('bold' => __('Bold', 'gwolle-gb'), 'italic' => __('Italic', 'gwolle-gb'), 'bullet' => __('Bulleted List', 'gwolle-gb'), 'numeric' => __('Numeric List', 'gwolle-gb'), 'picture' => __('Picture', 'gwolle-gb'), 'source' => __('Source', 'gwolle-gb'), 'link' => __('Link', 'gwolle-gb'), 'linktext' => __('Your text to link...', 'gwolle-gb'), 'clean' => __('Clean', 'gwolle-gb'), 'emoji' => __('Emoji', 'gwolle-gb'));
            wp_localize_script('markitup_set', 'gwolle_gb_localize', $dataToBePassed);
            // Emoji symbols
            echo '<div class="gwolle_gb_emoji" style="display:none;">';
            $emoji = gwolle_gb_get_emoji();
            // make it into images for nice colors.
            if (function_exists('wp_staticize_emoji')) {
                $emoji = wp_staticize_emoji($emoji);
            }
            echo $emoji;
            echo '</div>';
        }
        ?>
									</div>
								</div>

								<div id="authordiv" class="postbox " >
									<div class="handlediv"></div>
									<h3 class='hndle' title="<?php 
        esc_attr_e('Click to open or close', 'gwolle-gb');
        ?>
"><span><?php 
        _e('Website', 'gwolle-gb');
        ?>
</span></h3>
									<div class="inside">
										<input type="url" name="gwolle_gb_author_website" tabindex="2" value="<?php 
        echo gwolle_gb_sanitize_output($entry->get_author_website());
        ?>
" id="author_website" placeholder="<?php 
        _e('Website', 'gwolle-gb');
        ?>
" />
										<p><?php 
        _e("Example: <code>http://www.example.com/</code>", 'gwolle-gb');
        ?>
</p>
									</div>
								</div>
开发者ID:RainGrid,项目名称:site,代码行数:67,代码来源:page-editor.php


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