本文整理汇总了PHP中wp_spaces_regexp函数的典型用法代码示例。如果您正苦于以下问题:PHP wp_spaces_regexp函数的具体用法?PHP wp_spaces_regexp怎么用?PHP wp_spaces_regexp使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wp_spaces_regexp函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: smilies_init_old
function smilies_init_old()
{
global $wpsmiliestrans, $wp_smiliessearch;
// don't bother setting up smilies if they are disabled
if (!get_option('use_smilies')) {
return;
}
if (!isset($wpsmiliestrans)) {
$wpsmiliestrans = array(':mrgreen:' => 'icon_mrgreen.gif', ':neutral:' => 'icon_neutral.gif', ':twisted:' => 'icon_twisted.gif', ':arrow:' => 'icon_arrow.gif', ':shock:' => 'icon_eek.gif', ':smile:' => 'icon_smile.gif', ':???:' => 'icon_confused.gif', ':cool:' => 'icon_cool.gif', ':evil:' => 'icon_evil.gif', ':grin:' => 'icon_biggrin.gif', ':idea:' => 'icon_idea.gif', ':oops:' => 'icon_redface.gif', ':razz:' => 'icon_razz.gif', ':roll:' => 'icon_rolleyes.gif', ':wink:' => 'icon_wink.gif', ':cry:' => 'icon_cry.gif', ':eek:' => 'icon_surprised.gif', ':lol:' => 'icon_lol.gif', ':mad:' => 'icon_mad.gif', ':sad:' => 'icon_sad.gif', '8-)' => 'icon_cool.gif', '8-O' => 'icon_eek.gif', ':-(' => 'icon_sad.gif', ':-)' => 'icon_smile.gif', ':-?' => 'icon_confused.gif', ':-D' => 'icon_biggrin.gif', ':-P' => 'icon_razz.gif', ':-o' => 'icon_surprised.gif', ':-x' => 'icon_mad.gif', ':-|' => 'icon_neutral.gif', ';-)' => 'icon_wink.gif', '8O' => 'icon_eek.gif', ':(' => 'icon_sad.gif', ':)' => 'icon_smile.gif', ':?' => 'icon_confused.gif', ':D' => 'icon_biggrin.gif', ':P' => 'icon_razz.gif', ':o' => 'icon_surprised.gif', ':x' => 'icon_mad.gif', ':|' => 'icon_neutral.gif', ';)' => 'icon_wink.gif', ':!:' => 'icon_exclaim.gif', ':?:' => 'icon_question.gif');
}
if (count($wpsmiliestrans) == 0) {
return;
}
/*
* NOTE: we sort the smilies in reverse key order. This is to make sure
* we match the longest possible smilie (:???: vs :?) as the regular
* expression used below is first-match
*/
krsort($wpsmiliestrans);
$spaces = wp_spaces_regexp();
// Begin first "subpattern"
$wp_smiliessearch = '/(?<=' . $spaces . '|^)';
$subchar = '';
foreach ((array) $wpsmiliestrans as $smiley => $img) {
$firstchar = substr($smiley, 0, 1);
$rest = substr($smiley, 1);
// new subpattern?
if ($firstchar != $subchar) {
if ($subchar != '') {
$wp_smiliessearch .= ')(?=' . $spaces . '|$)';
// End previous "subpattern"
$wp_smiliessearch .= '|(?<=' . $spaces . '|^)';
// Begin another "subpattern"
}
$subchar = $firstchar;
$wp_smiliessearch .= preg_quote($firstchar, '/') . '(?:';
} else {
$wp_smiliessearch .= '|';
}
$wp_smiliessearch .= preg_quote($rest, '/');
}
$wp_smiliessearch .= ')(?=' . $spaces . '|$)/m';
}
开发者ID:leshy-org,项目名称:leshy_JiaJia,代码行数:43,代码来源:patch.php
示例2: smilies_init
/**
* Convert smiley code to the icon graphic file equivalent.
*
* You can turn off smilies, by going to the write setting screen and unchecking
* the box, or by setting 'use_smilies' option to false or removing the option.
*
* Plugins may override the default smiley list by setting the $wpsmiliestrans
* to an array, with the key the code the blogger types in and the value the
* image file.
*
* The $wp_smiliessearch global is for the regular expression and is set each
* time the function is called.
*
* The full list of smilies can be found in the function and won't be listed in
* the description. Probably should create a Codex page for it, so that it is
* available.
*
* @global array $wpsmiliestrans
* @global array $wp_smiliessearch
*
* @since 2.2.0
*/
function smilies_init()
{
global $wpsmiliestrans, $wp_smiliessearch;
// don't bother setting up smilies if they are disabled
if (!get_option('use_smilies')) {
return;
}
if (!isset($wpsmiliestrans)) {
$wpsmiliestrans = array(':mrgreen:' => 'mrgreen.png', ':neutral:' => "
|
请发表评论