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


PHP repl函数代码示例

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


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

示例1: filter

 /**
  * Strip the undesired HTML markup
  *
  * @param string $value The input string with HTML markup
  *
  * @return string Filtered string
  *
  *
  */
 public function filter($value)
 {
     // start by stripping the comments, if necessary
     if (!$this->allowComments) {
         $value = preg_replace('/<!\\-\\-.*\\-\\->/U', '', $value);
     }
     // strip unallowed tags
     $allowed = '';
     foreach ($this->allowedTags as $tag) {
         $allowed .= "<{$tag}>";
     }
     $value = strip_tags($value, $allowed);
     // strip unallowed attributes - only if there are allowed tags,
     // otherwise all attributes have already been removed with the tags
     if (!empty($this->allowedTags)) {
         $allowed = $this->allowedAttributes;
         do {
             $old = $value;
             $value = preg_replace_callback('/<[a-zA-Z]+ *(([a-zA-Z_:][\\-a-zA-Z0-9_:\\.]+) *=.*["\'].*["\']).*>/U', function ($matches) use($allowed) {
                 if (in_array($matches[2], $allowed)) {
                     return $matches[0];
                 } else {
                     return repl(' ' . $matches[1], '', $matches[0]);
                 }
             }, $value);
         } while ($old != $value);
     }
     // we're left with the filtered value
     return $value;
 }
开发者ID:schpill,项目名称:thin,代码行数:39,代码来源:Striptags.php

示例2: __construct

 public function __construct($table, $fields)
 {
     /* polymorphism */
     $fields = !Arrays::is($fields) ? strstr($fields, ',') ? explode(',', repl(' ', '', $fields)) : [$fields] : $fields;
     $this->table = $table;
     $this->fields = $fields;
 }
开发者ID:schpill,项目名称:standalone,代码行数:7,代码来源:Indexation.php

示例3: filter

 /**
  * Strip all newline characters and convert them to spaces
  *
  * @param string $value The input string
  *
  * @return string Filtered string
  */
 public function filter($value)
 {
     // replace Windows line endings
     $value = repl("\r\n", " ", $value);
     // replace Unix line endings
     $value = repl("\n", " ", $value);
     return $value;
 }
开发者ID:schpill,项目名称:thin,代码行数:15,代码来源:Stripnewlines.php

示例4: keys

 public function keys($pattern)
 {
     $collection = array();
     if (strstr($pattern, '%%') or strstr($pattern, '*')) {
         $pattern = repl('%%', '', repl('*', '', $pattern));
     }
     return $this->search($pattern);
 }
开发者ID:schpill,项目名称:thin,代码行数:8,代码来源:Driver.php

示例5: keys

 public function keys($pattern)
 {
     $collection = array();
     $pattern = repl('*', '', $pattern);
     $rows = $this->search($pattern);
     if (count($rows)) {
         foreach ($rows as $row) {
             array_push($collection, $row);
         }
     }
     return $collection;
 }
开发者ID:schpill,项目名称:thin,代码行数:12,代码来源:Quickdb.php

示例6: getInfosVideo

 public static function getInfosVideo($videoId, $returnObject = true)
 {
     $xml = dwn(repl('##videoId##', $videoId, static::VIDEO_INFOS_URI));
     $xml = simplexml_load_string($xml);
     $json = json_encode($xml);
     $array = json_decode($json, true);
     if (true === $returnObject) {
         $obj = new Container($array);
         return $obj;
     }
     return $array;
 }
开发者ID:schpill,项目名称:thin,代码行数:12,代码来源:Youtube.php

示例7: keys

 public function keys($pattern)
 {
     $pattern = repl('*', '%', $pattern);
     $res = $this->db->where("key LIKE {$pattern}")->exec();
     $collection = array();
     if (count($res)) {
         foreach ($res as $row) {
             array_push($collection, $row['key']);
         }
     }
     return $collection;
 }
开发者ID:schpill,项目名称:thin,代码行数:12,代码来源:Textdb.php

示例8: write

 public function write($file, $data)
 {
     $dirStore = $this->model->dirStore();
     self::fp($this->hashFile($file), $data);
     if (count($this->replicas)) {
         $raw = repl($dirStore, '', $this->hashFile($file));
         foreach ($this->replicas as $replica) {
             $rawFile = $replica . $raw;
             self::fp($rawFile, $data);
         }
     }
     return $this;
 }
开发者ID:schpill,项目名称:standalone,代码行数:13,代码来源:Local.php

示例9: write

 public function write($file, $data)
 {
     $key = $this->redisKey($file);
     $source = $this->fp($file, $data);
     if (count($this->replicas)) {
         $dirStore = $this->model->dirStore();
         $raw = repl($dirStore, '', $file);
         foreach ($this->replicas as $replica) {
             $rawFile = $replica . $raw;
             $copy = $this->fp($rawFile, $data);
         }
     }
     $this->model->cache()->set($key, $data);
 }
开发者ID:schpill,项目名称:standalone,代码行数:14,代码来源:Redis.php

示例10: __construct

 public function __construct($language, $segment = '')
 {
     if (Inflector::length($segment)) {
         $fileTranslation = LANGUAGE_PATH . DS . ucwords(Inflector::lower(repl('.', DS, $segment))) . DS . Inflector::lower($language) . '.ini';
     } else {
         $fileTranslation = LANGUAGE_PATH . DS . Inflector::lower($language) . '.ini';
     }
     if (File::exists($fileTranslation)) {
         $ini = new Ini($fileTranslation);
         $translations = $ini->parseIni();
         $this->setSentences($translations);
         Utils::set('ThinTranslate', $this);
     } else {
         throw new Exception('The translation file ' . $fileTranslation . ' does not exist.');
     }
 }
开发者ID:schpill,项目名称:thin,代码行数:16,代码来源:Translation.php

示例11: start_repl

function start_repl()
{
    $dot = isPOSIX() ? '·' : '-';
    echo <<<LICENSE
Quack {$dot} Copyright (C) 2016 Marcelo Camargo
This program comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to redistribute it
under certain conditions; type 'show c' for details.

LICENSE;
    echo "Use quack --help for more information", PHP_EOL;
    if (args_have('-h', '--help')) {
        open_repl_help();
        return;
    }
    repl();
}
开发者ID:quack,项目名称:quack,代码行数:17,代码来源:QuackRepl.php

示例12: getInfosMovie

 public static function getInfosMovie($id)
 {
     $html = dwn('http://vod.canalplay.com/films/cinema/holiday,297,308,' . $id . '.aspx');
     if (strstr($html, 'Object moved to')) {
         $url = 'http://vod.canalplay.com' . urldecode(Utils::cut('<h2>Object moved to <a href="', '"', $html));
         $html = dwn($url);
     }
     $story = Utils::cut('alt="L\'histoire" title="L\'histoire" /></h2><p>', '</p>', $html);
     $title = Utils::cut('var title="', '"', $html);
     $image = 'http://canalplay-publishing.canal-plus.com/movies/' . $id . '/pictures/' . $id . '_pivot.jpg';
     $purpose = Utils::cut('title="A propos du film" /></h2><p>', '</p></div></div>', $html);
     $distribution = array();
     $tab = explode("title=\"Voir tous les films de/avec '", $html);
     if (count($tab)) {
         for ($i = 1; $i < count($tab) - 1; $i++) {
             $seg = trim($tab[$i]);
             if (strstr($seg, "</a>") && strstr($seg, "underline")) {
                 $person = Utils::cut('\'">', '</a>', $seg);
                 if (!Arrays::inArray($person, $distribution)) {
                     $distribution[] = $person;
                 }
             }
         }
     }
     $director = null;
     $actors = array();
     if (count($distribution)) {
         $director = current($distribution);
         $actors = array();
         if (1 < count($distribution)) {
             for ($j = 1; $j < count($distribution); $j++) {
                 $actors[] = $distribution[$j];
             }
         }
     }
     $other = Utils::cut('<li style="clear:left;"><strong><br />', '</li>', $html);
     list($first, $second) = explode('</strong>- ', $other, 2);
     list($country, $year) = explode("-", $first, 2);
     $country = substr($country, 0, -1);
     $year = repl("\n", '', $year);
     $year = repl("\r", '', $year);
     $year = repl("\n", '', $year);
     list($duration, $dummy) = @explode("\n", $second, 2);
     $infos = array('title' => $title, 'story' => $story, 'image' => $image, 'purpose' => $purpose, 'director' => $director, 'actors' => $actors, 'country' => $country, 'year' => $year, 'duration' => $duration);
     return $infos;
 }
开发者ID:schpill,项目名称:thin,代码行数:46,代码来源:Allocine.php

示例13: keys

 public function keys($pattern)
 {
     $collection = $this->data($pattern);
     if (!Arrays::is($collection)) {
         $oldPattern = $pattern;
         $pattern .= '*#*';
         $pattern = repl('**', '*', $pattern);
         $files = $this->glob($this->dir . DS . $pattern);
         $collection = array();
         if (count($files)) {
             foreach ($files as $row) {
                 array_push($collection, $row);
             }
         }
         $this->setData($oldPattern, $collection);
     }
     return $collection;
 }
开发者ID:schpill,项目名称:thin,代码行数:18,代码来源:Txtdb.php

示例14: keys

 public function keys($pattern)
 {
     $pattern = repl('*', '%', $pattern);
     $q = "SELECT kvs_db_id FROM kvs_db WHERE kvs_db_id LIKE '{$pattern}'";
     $res = $this->execute($q);
     if (Arrays::is($res)) {
         $count = count($res);
     } else {
         $count = $res->rowCount();
     }
     if ($count < 1) {
         return array();
     }
     $collection = array();
     foreach ($res as $row) {
         array_push($collection, $row['kvs_db_id']);
     }
     return $collection;
 }
开发者ID:noikiy,项目名称:inovi,代码行数:19,代码来源:Kvdb.php

示例15: keys

 public function keys($pattern = 'all')
 {
     $data = $this->data();
     $data = !strstr($data, '{') ? array() : json_decode($data, true);
     $keys = array_keys($data);
     if ($pattern == 'all') {
         return $keys;
     }
     $pattern = repl('*', '', $pattern);
     $collection = array();
     if (count($keys)) {
         foreach ($keys as $key) {
             if (strstr($key, $pattern)) {
                 array_push($collection, $key);
             }
         }
     }
     return $collection;
 }
开发者ID:noikiy,项目名称:inovi,代码行数:19,代码来源:Fastdb.php


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