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


PHP game::smileys方法代码示例

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


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

示例1: bb_to_html

 public static function bb_to_html($bb)
 {
     static $code_from_cache_single = array();
     static $code_to_cache_single = array();
     static $code_from_cache = array();
     static $code_to_cache = array();
     // sikre html
     $bb = htmlspecialchars($bb);
     if (empty($code_from_cache)) {
         global $__server;
         // kode som kun skal kjøres en gang
         $replaces_single = array('~\\r~u' => '', '~\\[html=([a-z0-9]+)\\](.+?)\\[/html=\\1\\]~iseu' => 'game::html_add(\'$1\', \'$2\')', '~\\[nobb\\](.+?)\\[/nobb\\]~iseu' => 'game::nobb_add(\'$1\')', '~\\[linkonly\\](.+?)\\[/linkonly\\]~iseu' => 'game::linkonly_add(\'$1\')', '~\\[comment\\](.+?)\\[/comment\\]~isu' => '#', '~\\[comment=([^\\]]+)\\](.+?)\\[/comment\\]~isu' => '<span style="border: 1px solid #333333; background-color: #222222; padding: 2px">#$1</span>', '~\\[comment hide\\](.+?)\\[/comment\\]~isu' => '', '~\\[hide\\](.+?)\\[/hide\\]~isu' => '', '~(?<=[!>:\\?\\.\\s\\xA0[\\]()*\\\\;]|^)(https?://)?(www.)?youtube.com/v/([0-9a-z_\\-]{11})[^\\s<>&\\\\]*~iu' => '<object width="425" height="350"><param name="movie" value="https://www.youtube.com/v/$3"></param><param name="wmode" value="transparent"></param><embed src="https://www.youtube.com/v/$3" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"></embed></object><br />Adresse: <a href="$0">$0</a>', '~(?<=[!>:\\?\\.\\s\\xA0[\\]()*\\\\;]|^)(https?://)?(www.)?youtube.com/.+v=([0-9a-z_\\-]{11})[^\\s<]*~iu' => '<object width="425" height="350"><param name="movie" value="https://www.youtube.com/v/$3"></param><param name="wmode" value="transparent"></param><embed src="https://www.youtube.com/v/$3" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"></embed></object>', '~\\[youtube\\].+v=([0-9a-z_\\.]+).*\\[/youtube\\]~iu' => '<object width="425" height="350"><param name="movie" value="https://www.youtube.com/v/$1"></param><param name="wmode" value="transparent"></param><embed src="https://www.youtube.com/v/$1" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"></embed></object>', '~\\[youtube\\]https?://((www.)?youtube.com/.+?)\\[/youtube\\]~iu' => '<object width="425" height="350"><param name="movie" value="https://$1"></param><param name="wmode" value="transparent"></param><embed src="https://$1" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"></embed></object>', '~\\[img\\]([^\\["\'\\n]+)\\[/img\\]~ieu' => 'game::secure_img_addr(\'$1\')', '~(?<=[!>:\\?\\.\\s\\xA0[\\]()*\\\\;]|^)((?:https?|ftp)://([\\w\\d/=;\\\\?#\\-_%:@+æøå\\~]|[,.](?! )|&amp;)+)~iu' => '<a href="$1" target="_blank">$1</a>', '~(?<=[!>:\\?\\.\\s\\xA0[\\]()*\\\\;]|^)(www\\.([\\w\\d/=;\\\\?#\\-_%:@+æøå\\~]|[,.](?! )|&amp;)+)~iu' => '<a href="http://$1" target="_blank">$1</a>', '~\\[iurl=/?([^\\]\\n]*)\\](.+?)\\[/iurl\\]~ieu' => '\'<a href="' . $__server['absolute_path'] . '/$1">\'.stripslashes(\'$2\').\'</a>\'', '~\\[user=([0-9a-zA-Z\\-_ ]+)\\]~iu' => '<user="$1" />', '~\\[user id=([0-9]+)\\]~iu' => '<user id="$1" />', '~\\[ff=([0-9]+)\\]~u' => '<ff_link>$1</ff_link>', '~\\[hr\\](\\n)?~iu' => '<div class="hr"></div>');
         // kode som kan kjøres flere ganger
         $replaces_multiple = array('~(?:\\n){0,2}\\[h([1-6])\\](.+?)\\[/h\\1\\]\\n{0,2}~iu' => '<h$1>$2</h$1>', '~\\[b\\](.+?)\\[/b\\]~isu' => '<b>$1</b>', '~\\[i\\](.+?)\\[/i\\]~isu' => '<i>$1</i>', '~\\[u\\](.+?)\\[/u\\]~isu' => '<u>$1</u>', '~\\[s\\](.+?)\\[/s\\]~isu' => '<del>$1</del>', '~\\[left=([0-5]?[0-9]{1,2})(?:px)?\\](.+?)\\[/left\\](\\n)?~isu' => '<div class="l" style="margin-left:$1px">$2</div>', '~\\[right=([0-5]?[0-9]{1,2})(?:px)?\\](.+?)\\[/right\\](\\n)?~isu' => '<div class="r" style="margin-right:$1px">$2</div>', '~\\[left=([0-9]{1,2})%\\](.+?)\\[/left\\](\\n)?~isu' => '<div class="l" style="margin-left:$1%">$2</div>', '~\\[right=([0-9]{1,2})%\\](.+?)\\[/right\\](\\n)?~isu' => '<div class="r" style="margin-right:$1%">$2</div>', '~\\[left\\](.+?)\\[/left\\](\\n)?~isu' => '<div class="l">$1</div>', '~\\[right\\](.+?)\\[/right\\](\\n)?~isu' => '<div class="r">$1</div>', '~\\[center\\](.+?)\\[/center\\](\\n)?~isu' => '<div class="c">$1</div>', '~\\[justify\\](.+?)\\[/justify\\](\\n)?~isu' => '<div class="j">$1</div>', '~\\[float=(right)\\](.+?)\\[/float\\](\\n)?~isu' => '<div style="float:$1;margin-left: 5px">$2</div>', '~\\[float=(left)\\](.+?)\\[/float\\](\\n)?~isu' => '<div style="float:$1;margin-right: 5px">$2</div>', '~\\[clear\\]~iu' => '<div style="clear:both"></div>', '~\\[width=([0-6]?[0-9]{1,2})(?:px)?\\](.+?)\\[/width\\](\\n)?~isu' => '<div style="width:$1px">$2</div>', '~\\n?\\[ul\\](?:.+?)(\\[li\\].+?)\\n*\\[/ul\\]\\n{0,2}~isu' => '<ul>$1</ul>', '~\\n*\\[li\\]\\n?(.+?)\\n?\\[/li\\][^\\[<]*~isu' => '<li>$1</li>$2', '~\\[color=(SM|bakgrunn)\\](.*?)\\[/color\\]~isu' => '<span style="color: #222222;">$2</span>', '~\\[color=(#[\\da-fA-F]{3}|#[\\da-fA-F]{6}|[\\w]{1,12})\\](.*?)\\[/color\\]~isu' => '<span style="color: $1;">$2</span>', '~\\[(black|white|red|green|blue)\\](.+?)\\[/\\1\\]~isu' => '<span style="color: $1;">$2</span>', '~\\[quote]\\n?(.+?)\\n?\\[/quote\\]\\n?~isu' => '<div class="quote_box"><span class="quote_header">Sitat:</span>$1</div>', '~\\[sub\\](.+?)\\[/sub\\]~isu' => '<sub>$1</sub>', '~\\[sup\\](.+?)\\[/sup\\]~isu' => '<sup>$1</sup>', '~\\[size=(1?[\\d]{1,2}p[xt]|(?:x-)?small(?:er)?|(?:x-)?large[r]?)\\](.+?)\\[/size\\]~isu' => '<span style="font-size: $1;">$2</span>', '~\\[size=([\\d])\\](.+?)\\[/size\\]~isu' => '<font size="$1">$2</font>');
         $code_from_cache = array_keys($replaces_multiple);
         $code_to_cache = array_values($replaces_multiple);
         $code_from_cache_single = array_keys($replaces_single);
         $code_to_cache_single = array_values($replaces_single);
     }
     // fiks bb-koder som kun skal kjøres en gang
     $bb = preg_replace($code_from_cache_single, $code_to_cache_single, $bb);
     // fiks liste med *
     $matches = false;
     if (preg_match_all("~(?:\n{0,2})^ \\* .+(\n \\* .+)*\$(?:\n{0,2})~mu", $bb, $matches)) {
         foreach ($matches[0] as $match) {
             $row = explode("\n", $match);
             $html = '<ul>';
             foreach ($row as $r) {
                 $r = mb_substr($r, 3);
                 if (empty($r)) {
                     continue;
                 }
                 $html .= '<li>' . $r . '</li>';
             }
             $html .= '</ul>';
             $bb = str_replace($match, $html, $bb);
         }
     }
     // fiks liste med #
     $matches = false;
     if (preg_match_all("~(?:\n{0,2})^ # .+(\n # .+)*\$(?:\n{0,2})~mu", $bb, $matches)) {
         foreach ($matches[0] as $match) {
             $row = explode("\n", $match);
             $html = '<ol>';
             foreach ($row as $r) {
                 $r = mb_substr($r, 3);
                 if (empty($r)) {
                     continue;
                 }
                 $html .= '<li>' . $r . '</li>';
             }
             $html .= '</ol>';
             $bb = str_replace($match, $html, $bb);
         }
     }
     // fiks bb-koder som kan oppstå flere ganger inni hverandre (recursive)
     $count = 0;
     while (($bb = preg_replace($code_from_cache, $code_to_cache, $bb, -1, $count)) && $count > 0) {
     }
     // fiks smileys
     $bb = game::smileys($bb);
     // sett tilbake [nobb] innhold
     $bb = self::nobb_replace($bb);
     // sett tilbake [linkonly] innhold
     $bb = self::linkonly_replace($bb);
     // fiks linjeskift og returner
     return str_replace("\n", "<br />\n", $bb);
 }
开发者ID:Kuzat,项目名称:kofradia,代码行数:68,代码来源:class.game.php


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