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


PHP Mapper::base方法代码示例

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


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

示例1: write

 public static function write($name, $value, $expires = null)
 {
     $self = self::getInstance();
     $expires = $self->expire($expires);
     $path = Mapper::normalize(Mapper::base() . $self->path);
     return setcookie($self->name . '[' . $name . ']', self::encrypt($value), $expires, $path, $self->domain, $self->secure);
 }
开发者ID:klawdyo,项目名称:spaghettiphp,代码行数:7,代码来源:Cookie.php

示例2: parse

 public function parse($text, $use_emoticons = true, $emoticons_path = "/images/emoticons/")
 {
     $text = trim($text);
     $this->use_emoticons = $use_emoticons;
     $this->emoticons_path = $emoticons_path;
     $smiles = $this->smiles;
     // BBCode [code]
     if (!function_exists('escape')) {
         function escape($s)
         {
             global $text;
             $text = strip_tags($text);
             $code = $s[1];
             $code = htmlspecialchars($code);
             $code = str_replace("[", "[", $code);
             $code = str_replace("]", "]", $code);
             return '<pre><code>' . $code . '</code></pre>';
         }
     }
     $text = preg_replace_callback('/\\[code\\](.*?)\\[\\/code\\]/ms', "escape", $text);
     // BBCode to find...
     $in = array('/\\[b\\](.*?)\\[\\/b\\]/ms', '/\\[i\\](.*?)\\[\\/i\\]/ms', '/\\[u\\](.*?)\\[\\/u\\]/ms', '/\\[img\\](.*?)\\[\\/img\\]/ms', '/\\[email\\](.*?)\\[\\/email\\]/ms', '/\\[url](.*?)\\[\\/url\\]/ms', '/\\[url\\="([^\\"]+)"\\](.*?)\\[\\/url\\]/ms', '/\\[size\\="?(.*?)"?\\](.*?)\\[\\/size\\]/ms', '/\\[color\\="?(.*?)"?\\](.*?)\\[\\/color\\]/ms', '/\\[quote](.*?)\\[\\/quote\\]/ms', '/\\[list\\=(.*?)\\](.*?)\\[\\/list\\]/ms', '/\\[list\\](.*?)\\[\\/list\\]/ms', '/\\[\\*\\]\\s?(.*?)\\n/ms');
     // And replace them by...
     $out = array('<strong>\\1</strong>', '<em>\\1</em>', '<u>\\1</u>', '<img src="' . Mapper::base() . '\\/images\\/\\1" alt="\\1" />', '<a href="mailto:\\1">\\1</a>', '<a href="' . Mapper::base() . '\\1' . '">\\1</a>', '<a href="' . Mapper::base() . '\\1' . '">\\2</a>', '<span style="font-size:\\1%">\\2</span>', '<span style="color:\\1">\\2</span>', '<blockquote>\\1</blockquote>', '<ol start="\\1">\\2</ol>', '<ul>\\1</ul>', '<li>\\1</li>');
     $text = preg_replace($in, $out, $text);
     if ($this->use_emoticons) {
         foreach ($smiles as $key => $smile) {
             $smiles[$key] = $this->mapSmiles(strtolower($key), $smile);
         }
         $text = str_replace(array_keys($smiles), $smiles, $text);
     }
     // paragraphs
     $text = str_replace("\r", "", $text);
     $text = "<p>" . preg_replace("%(\n){2,}%", "</p><p>", $text) . "</p>";
     $text = nl2br($text);
     // clean some tags to remain strict
     // not very elegant, but it works. No time to do better ;)
     if (!function_exists('removeBr')) {
         function removeBr($s)
         {
             return str_replace("<br />", "", $s[0]);
         }
     }
     $text = preg_replace_callback('/<pre>(.*?)<\\/pre>/ms', "removeBr", $text);
     $text = preg_replace('/<p><pre>(.*?)<\\/pre><\\/p>/ms', "<pre>\\1</pre>", $text);
     $text = preg_replace_callback('/<ul>(.*?)<\\/ul>/ms', "removeBr", $text);
     $text = preg_replace('/<p><ul>(.*?)<\\/ul><\\/p>/ms', "<ul>\\1</ul>", $text);
     return $text;
 }
开发者ID:klawdyo,项目名称:spaghettiphp,代码行数:49,代码来源:BBCodeHelper.php


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