• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP preg_quote函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: configure

 /**
  * Configure after successfull mount.
  *
  * @return void
  * @author Dmitry (dio) Levashov
  **/
 protected function configure()
 {
     $this->aroot = realpath($this->root);
     $root = $this->stat($this->root);
     if ($this->options['quarantine']) {
         $this->attributes[] = array('pattern' => '~^' . preg_quote(DIRECTORY_SEPARATOR . $this->options['quarantine']) . '$~', 'read' => false, 'write' => false, 'locked' => true, 'hidden' => true);
     }
     // chek thumbnails path
     if ($this->options['tmbPath']) {
         $this->options['tmbPath'] = strpos($this->options['tmbPath'], DIRECTORY_SEPARATOR) === false ? $this->root . DIRECTORY_SEPARATOR . $this->options['tmbPath'] : $this->_normpath($this->options['tmbPath']);
     }
     parent::configure();
     // if no thumbnails url - try detect it
     if ($root['read'] && !$this->tmbURL && $this->URL) {
         if (strpos($this->tmbPath, $this->root) === 0) {
             $this->tmbURL = $this->URL . str_replace(DIRECTORY_SEPARATOR, '/', substr($this->tmbPath, strlen($this->root) + 1));
             if (preg_match("|[^/?&=]\$|", $this->tmbURL)) {
                 $this->tmbURL .= '/';
             }
         }
     }
     // check quarantine dir
     if (!empty($this->options['quarantine'])) {
         $this->quarantine = $this->root . DIRECTORY_SEPARATOR . $this->options['quarantine'];
         if (!is_dir($this->quarantine) && !$this->_mkdir($this->root, $this->options['quarantine']) || !is_writable($this->quarantine)) {
             $this->archivers['extract'] = array();
             $this->disabled[] = 'extract';
         }
     } else {
         $this->archivers['extract'] = array();
         $this->disabled[] = 'extract';
     }
 }
开发者ID:rb26,项目名称:zenphoto,代码行数:39,代码来源:elFinderVolumeLocalFileSystem.class.php


示例2: parseLine

 /**
  * Parse of HTML line
  *
  * @param string $line
  * @param array $tags [optional]
  * @return \axy\min\html\helpers\ParseLineResult
  */
 public static function parseLine($line, array $tags = null)
 {
     $result = new ParseLineResult('');
     while ($line !== '') {
         if (!preg_match('~^(?<before>.*?)\\<(?<tag>/?[a-z0-9-]+)(?<attr>.*?)?>(?<after>.*?)$~is', $line, $matches)) {
             $result->append($line);
             break;
         }
         $tag = $matches['tag'];
         $after = $matches['after'];
         $tagL = strtolower($matches['tag']);
         $result->append($matches['before'] . '<' . $tag . $matches['attr'] . '>');
         if (isset($tags[$tagL])) {
             $pattern = '~^(?<before>.*?)(?<tag></' . preg_quote($tagL) . '>)(?<after>.*?)$~is';
             if (!preg_match($pattern, $after, $matches)) {
                 $result->tag = $tagL;
                 $result->after = $after;
                 break;
             }
             $content = $matches['before'];
             $content = self::process($content, $tags[$tagL]);
             $result->append($content . $matches['tag']);
             $line = $matches['after'];
         } else {
             $line = $after;
         }
     }
     if (!$result->tag) {
         $result->before = rtrim($result->before);
     }
     return $result;
 }
开发者ID:axypro,项目名称:min-html,代码行数:39,代码来源:Parser.php


示例3: test_interactive

 public function test_interactive()
 {
     // Create a gapselect question.
     $q = test_question_maker::make_question('calculated');
     $q->hints = array(new question_hint(1, 'This is the first hint.', FORMAT_HTML), new question_hint(2, 'This is the second hint.', FORMAT_HTML));
     $this->start_attempt_at_question($q, 'interactive', 3, 1);
     $values = $q->vs->get_values();
     $this->assertEquals($values, $q->datasetloader->load_values(1));
     // Check the initial state.
     $this->check_current_state(question_state::$todo);
     $this->check_current_mark(null);
     $this->check_current_output($this->get_contains_marked_out_of_summary(), $this->get_contains_submit_button_expectation(true), $this->get_does_not_contain_feedback_expectation(), $this->get_does_not_contain_validation_error_expectation(), $this->get_does_not_contain_try_again_button_expectation(), $this->get_no_hint_visible_expectation());
     // Submit blank.
     $this->process_submission(array('-submit' => 1, 'answer' => ''));
     // Verify.
     $this->check_current_state(question_state::$invalid);
     $this->check_current_mark(null);
     $this->check_current_output($this->get_contains_marked_out_of_summary(), $this->get_contains_submit_button_expectation(true), $this->get_does_not_contain_feedback_expectation(), $this->get_contains_validation_error_expectation(), $this->get_does_not_contain_try_again_button_expectation(), $this->get_no_hint_visible_expectation());
     // Sumit something that does not look like a number.
     $this->process_submission(array('-submit' => 1, 'answer' => 'newt'));
     // Verify.
     $this->check_current_state(question_state::$invalid);
     $this->check_current_mark(null);
     $this->check_current_output($this->get_contains_marked_out_of_summary(), $this->get_contains_submit_button_expectation(true), $this->get_does_not_contain_feedback_expectation(), $this->get_contains_validation_error_expectation(), new question_pattern_expectation('/' . preg_quote(get_string('invalidnumber', 'qtype_numerical'), '/') . '/'), $this->get_does_not_contain_try_again_button_expectation(), $this->get_no_hint_visible_expectation());
     // Now get it right.
     $this->process_submission(array('-submit' => 1, 'answer' => $values['a'] + $values['b']));
     // Verify.
     $this->check_current_state(question_state::$gradedright);
     $this->check_current_mark(3);
     $this->check_current_output($this->get_contains_mark_summary(3), $this->get_does_not_contain_submit_button_expectation(), $this->get_contains_correct_expectation(), $this->get_does_not_contain_validation_error_expectation(), $this->get_no_hint_visible_expectation());
 }
开发者ID:evltuma,项目名称:moodle,代码行数:31,代码来源:walkthrough_test.php


示例4: __construct

 public function __construct(ProcessorInterface $processor = null, $startSep = '---', $endSep = '---')
 {
     $this->startSep = $startSep;
     $this->endSep = $endSep;
     $this->processor = $processor ?: new YamlProcessor();
     $this->regexp = '{^(?:' . preg_quote($startSep) . ")[\r\n|\n]*(.*?)[\r\n|\n]+(?:" . preg_quote($endSep) . ")[\r\n|\n]*(.*)\$}s";
 }
开发者ID:webuni,项目名称:front-matter,代码行数:7,代码来源:FrontMatter.php


示例5: getColumnFromTable

 /**
  * Get column name
  * @param string $name
  * @return string
  */
 protected function getColumnFromTable($name)
 {
     if ($this->table != '%s' && preg_match('(^' . str_replace('%s', '(.*)', preg_quote($this->table)) . '$)', $name, $match)) {
         return $match[1];
     }
     return $name;
 }
开发者ID:sim2github,项目名称:notorm,代码行数:12,代码来源:StructureConvention.php


示例6: hookActionAdminControllerSetMedia

 public function hookActionAdminControllerSetMedia($params)
 {
     $admin_webpath = str_ireplace(_PS_ROOT_DIR_, '', _PS_ADMIN_DIR_);
     $admin_webpath = preg_replace('/^' . preg_quote(DIRECTORY_SEPARATOR, '/') . '/', '', $admin_webpath);
     $this->context->controller->addJS(array(_PS_JS_DIR_ . 'vendor/d3.v3.min.js', __PS_BASE_URI__ . $admin_webpath . '/themes/' . $this->context->employee->bo_theme . '/js/vendor/nv.d3.min.js'));
     $this->context->controller->addCSS(__PS_BASE_URI__ . $admin_webpath . '/themes/' . $this->context->employee->bo_theme . '/css/vendor/nv.d3.css');
 }
开发者ID:dev-lav,项目名称:htdocs,代码行数:7,代码来源:graphnvd3.php


示例7: __construct

 /**
  * Constructor.
  *
  * @param \Iterator $iterator    The Iterator to filter
  * @param array     $directories An array of directories to exclude
  */
 public function __construct(\Iterator $iterator, array $directories)
 {
     foreach ($directories as $directory) {
         $this->patterns[] = '#(^|/)' . preg_quote($directory, '#') . '(/|$)#';
     }
     parent::__construct($iterator);
 }
开发者ID:kchhainarong,项目名称:chantuchP,代码行数:13,代码来源:ExcludeDirectoryFilterIterator.php


示例8: clean

 public static function clean($url, $toLower = true, $spacer = '-')
 {
     if ($toLower == true) {
         $url = strtolower($url);
     }
     // International umlauts
     $url = str_replace(array('á', 'à', 'â', 'Á', 'À', 'Â'), 'a', $url);
     $url = str_replace(array('ç', 'Ç'), 'c', $url);
     $url = str_replace(array('é', 'è', 'ë', 'ê', 'É', 'È', 'Ë', 'Ê'), 'e', $url);
     $url = str_replace(array('í', 'ì', 'î', 'ï', 'Í', 'Ì', 'Î', 'Ï'), 'i', $url);
     $url = str_replace(array('ó', 'ò', 'ô', 'Ó', 'Ò', 'Ô'), 'o', $url);
     $url = str_replace(array('ú', 'ù', 'û', 'Ú', 'Ù', 'Û'), 'u', $url);
     // German umlauts
     $url = str_replace(array('ä', 'Ä'), 'ae', $url);
     $url = str_replace(array('ö', 'Ö'), 'oe', $url);
     $url = str_replace(array('ü', 'Ü'), 'ue', $url);
     $url = str_replace(array('ß'), 'ss', $url);
     // Replace some special chars with delimiter
     $url = preg_replace('/[\\+\\s\\r\\n\\t]+/', $spacer, $url);
     // Replace multiple delimiter chars with only one char
     $url = preg_replace('/[' . preg_quote($spacer, '/') . ']+/', $spacer, $url);
     // Remove html and other special chars
     $url = preg_replace(array('/<[^>]*>/', '/[^a-z0-9\\-\\._' . preg_quote($spacer, '/') . ']/i'), '', $url);
     return $url;
 }
开发者ID:BackupTheBerlios,项目名称:viscacha-svn,代码行数:25,代码来源:class.URI.php


示例9: __construct

 function __construct($connect_options)
 {
     $this->url = $connect_options['url'];
     $this->is_require_auth = $connect_options['require_auth'];
     if ($this->is_require_auth) {
         $this->login = $connect_options['login'];
         $this->password = $connect_options['password'];
     }
     $this->connect_timeout = isset($connect_options['connect_timeout']) ? $connect_options['connect_timeout'] : 5;
     $this->timeout = isset($connect_options['timeout']) ? $connect_options['timeout'] : 5;
     $this->exclude = explode(';', $connect_options['exclude']);
     $parse_format = $connect_options['parse_format'];
     $this->matches = preg_split('/%\\w+/u', $parse_format);
     $matches_symbol = array();
     preg_match_all('/(%\\w+)/', $parse_format, $matches_symbol);
     $symbol = reset($matches_symbol[0]);
     $this->regex = '/';
     $this->tags = array();
     foreach ($this->matches as $key => $value) {
         if (!empty($value)) {
             $this->regex .= preg_quote($value);
             continue;
         }
         $this->tags[] = substr($symbol, 1);
         $symbol = next($matches_symbol[0]);
         if ($symbol === false) {
             $this->regex .= '(.+)';
             break;
         } else {
             $this->regex .= '(.+?)';
         }
     }
     $this->regex .= '/u';
 }
开发者ID:rodnover55,项目名称:last_tracks_shoutcast,代码行数:34,代码来源:last_track_request.php


示例10: apply

 /**
  * With lots of various rules we created 4 various rulesets for operators. If one
  * of the tokens or content is found we use the given regex on the joined array.
  *
  * @param  Testable $testable The testable object
  * @return void
  */
 public function apply($testable, array $config = array())
 {
     $tokens = $testable->tokens();
     foreach ($this->inspector as $inspector) {
         if (isset($inspector['tokens'])) {
             $byToken = $testable->findAll($inspector['tokens']);
         } else {
             $byToken = array();
         }
         if (isset($inspector['content'])) {
             $byContent = $testable->findAllContent($inspector['content']);
         } else {
             $byContent = array();
         }
         foreach (array_merge($byToken, $byContent) as $id) {
             $token = $tokens[$id];
             $isPHP = $testable->isPHP($token['line']);
             if ($isPHP && empty($token['isString'])) {
                 $pattern = String::insert($inspector['regex'], array('content' => preg_quote($token['content'], "/")));
                 $firstId = $id - $inspector['relativeTokens']['before'];
                 $firstId = $firstId < 0 ? 0 : $firstId;
                 $length = $inspector['relativeTokens']['length'];
                 $inspectTokens = array_slice($tokens, $firstId, $length);
                 $html = null;
                 foreach ($inspectTokens as $htmlToken) {
                     $html .= $htmlToken['content'];
                 }
                 if (preg_match($pattern, $html) === 0) {
                     $this->addViolation(array('message' => String::insert($inspector['message'], $token), 'line' => $token['line']));
                 }
             }
         }
     }
 }
开发者ID:unionofrad,项目名称:li3_quality,代码行数:41,代码来源:OperatorSpacing.php


示例11: censorword_cache

 /**
  * 生成敏感词缓存 filter:替换关键字,banned:禁止关键字,mod:审核关键字
  * @return string 关键词数据
  */
 public function censorword_cache()
 {
     $banned = $mod = array();
     $bannednum = $modnum = 0;
     $data = array('filter' => array(), 'banned' => '', 'mod' => '');
     foreach ($this->select() as $censor) {
         if (preg_match('/^\\/(.+?)\\/$/', $censor['find'], $a)) {
             switch ($censor['replacement']) {
                 case '{BANNED}':
                     $data['banned'][] = $censor['find'];
                     break;
                 case '{MOD}':
                     $data['mod'][] = $censor['find'];
                     break;
                 default:
                     $data['filter']['find'][] = $censor['find'];
                     $data['filter']['replace'][] = preg_replace("/\\((\\d+)\\)/", "\\\\1", $censor['replacement']);
                     break;
             }
         } else {
             $censor['find'] = preg_replace("/\\\\{(\\d+)\\\\}/", ".{0,\\1}", preg_quote($censor['find'], '/'));
             switch ($censor['replacement']) {
                 case '{BANNED}':
                     $banned[] = $censor['find'];
                     $bannednum++;
                     if ($bannednum == 1000) {
                         $data['banned'][] = '/(' . implode('|', $banned) . ')/i';
                         $banned = array();
                         $bannednum = 0;
                     }
                     break;
                 case '{MOD}':
                     $mod[] = $censor['find'];
                     $modnum++;
                     if ($modnum == 1000) {
                         $data['mod'][] = '/(' . implode('|', $mod) . ')/i';
                         $mod = array();
                         $modnum = 0;
                     }
                     break;
                 default:
                     $data['filter']['find'][] = '/' . $censor['find'] . '/i';
                     $data['filter']['replace'][] = $censor['replacement'];
                     break;
             }
         }
     }
     if ($banned) {
         $data['banned'][] = '/(' . implode('|', $banned) . ')/i';
     }
     if ($mod) {
         $data['mod'][] = '/(' . implode('|', $mod) . ')/i';
     }
     //过滤关键词数据
     F("Censor_words", $data);
     //分类数据
     $typedata = M("Terms")->where(array("module" => "censor"))->select();
     F("Censor_type", $typedata);
     return $data;
 }
开发者ID:NeilFee,项目名称:vipxinbaigo,代码行数:64,代码来源:CensorModel.class.php


示例12: quote

 /**
  * Quote regular expression characters.
  *
  * @param string $value
  * @param string $delimiter
  *
  * @return string
  */
 public function quote($value, $delimiter = '/')
 {
     if (!isset($value)) {
         return null;
     }
     return preg_quote($value, $delimiter);
 }
开发者ID:vgrish,项目名称:twiggy,代码行数:15,代码来源:twiggyextensionpcre.class.php


示例13: testFetchButton

 /**
  * Tests the fetchButton method
  *
  * @return  void
  *
  * @since   3.0
  */
 public function testFetchButton()
 {
     $name = 'jdotorg';
     $text = 'Joomla.org';
     $url = 'http://www.joomla.org';
     $this->assertRegExp('#<button onclick="location.href=\'' . preg_quote($url, '#') . '\';" class="btn btn-small">\\s*' . '<span class="icon-' . preg_quote($name, '#') . '"></span>\\s+' . preg_quote($text, '#') . '\\s*' . '</button>\\s*#', $this->object->fetchButton('Link', $name, $text, $url));
 }
开发者ID:n3t,项目名称:joomla-cms,代码行数:14,代码来源:JToolbarButtonLinkTest.php


示例14: get_homepage_link

 /**
  * Get the full form (e.g. /home/) relative link to the home page for the current HTTP_HOST value. Note that the
  * link is trimmed of leading and trailing slashes before returning to ensure consistency.
  *
  * @return string
  */
 public static function get_homepage_link()
 {
     if (!self::$cached_homepage_link) {
         // TODO Move to 'homepagefordomain' module
         if (class_exists('HomepageForDomainExtension')) {
             $host = str_replace('www.', null, $_SERVER['HTTP_HOST']);
             $SQL_host = Convert::raw2sql($host);
             $candidates = DataObject::get('SiteTree', "\"HomepageForDomain\" LIKE '%{$SQL_host}%'");
             if ($candidates) {
                 foreach ($candidates as $candidate) {
                     if (preg_match('/(,|^) *' . preg_quote($host) . ' *(,|$)/', $candidate->HomepageForDomain)) {
                         self::$cached_homepage_link = trim($candidate->RelativeLink(true), '/');
                     }
                 }
             }
         }
         if (!self::$cached_homepage_link) {
             // TODO Move to 'translatable' module
             if (class_exists('Translatable') && Object::has_extension('SiteTree', 'Translatable') && ($link = Translatable::get_homepage_link_by_locale(Translatable::get_current_locale()))) {
                 self::$cached_homepage_link = $link;
             } else {
                 self::$cached_homepage_link = self::get_default_homepage_link();
             }
         }
     }
     return self::$cached_homepage_link;
 }
开发者ID:prostart,项目名称:cobblestonepath,代码行数:33,代码来源:RootURLController.php


示例15: fnmatch

 function fnmatch($pattern, $string, $flags = 0)
 {
     $modifiers = null;
     $transforms = array('\\*' => '.*', '\\?' => '.', '\\[\\!' => '[^', '\\[' => '[', '\\]' => ']', '\\.' => '\\.', '\\' => '\\\\');
     // Forward slash in string must be in pattern:
     if ($flags & FNM_PATHNAME) {
         $transforms['\\*'] = '[^/]*';
     }
     // Back slash should not be escaped:
     if ($flags & FNM_NOESCAPE) {
         unset($transforms['\\']);
     }
     // Perform case insensitive match:
     if ($flags & FNM_CASEFOLD) {
         $modifiers .= 'i';
     }
     // Period at start must be the same as pattern:
     if ($flags & FNM_PERIOD) {
         if (strpos($string, '.') === 0 && strpos($pattern, '.') !== 0) {
             return false;
         }
     }
     $pattern = '~^' . strtr(preg_quote($pattern, '~'), $transforms) . '$~' . $modifiers;
     return (bool) preg_match($pattern, $string);
 }
开发者ID:niko-lgdcom,项目名称:archives,代码行数:25,代码来源:compat.php


示例16: dir_tree

function dir_tree($dir, $EXT, $subDir = true)
{
    $path = array();
    $stack[] = $dir;
    while ($stack) {
        $thisdir = array_pop($stack);
        if ($dircont = scandir($thisdir)) {
            $i = 0;
            while (isset($dircont[$i])) {
                if (!in_array($dircont[$i], array('.', '..', '.svn', '.info'))) {
                    $current_file = $thisdir . $dircont[$i];
                    if (is_file($current_file)) {
                        foreach ($EXT as $FILEXT) {
                            if (preg_match("/\\." . preg_quote($FILEXT) . "\$/i", $current_file)) {
                                $path[] = str_replace(ROOT_PATH, '', str_replace('\\', '/', $current_file));
                                break;
                            }
                        }
                    } elseif ($subDir && is_dir($current_file)) {
                        $stack[] = $current_file . "/";
                    }
                }
                $i++;
            }
        }
    }
    return $path;
}
开发者ID:tatarysh,项目名称:2Moons,代码行数:28,代码来源:ShowVertify.php


示例17: show

 /**
  * Show sites
  *
  * ## OPTIONS
  *
  * @subcommand list
  * @alias show
  */
 public function show($args, $assoc_args)
 {
     $sites = SiteFactory::instance();
     $data = array();
     foreach ($sites as $site) {
         $report = array('name' => $site->getName());
         $fields = Input::optional('fields', $assoc_args, 'name,framework,service_level,id');
         $filter = Input::optional('filter', $assoc_args, false);
         if ($filter) {
             if (!strpos($filter, ":")) {
                 Terminus::error("Improperly formatted filter");
             }
             $filter = explode(':', $filter);
             list($filter_field, $filter_value) = $filter;
             if (!preg_match("#" . preg_quote($filter_value) . "#", $site->info($filter_field))) {
                 // skip rows not matching our filter
                 continue;
             }
         }
         if ($fields) {
             $fields = explode(',', $fields);
             foreach ($fields as $field) {
                 $report[$field] = $site->info($field);
             }
         } else {
             $info = $site->info();
             foreach ($info as $key => $value) {
                 $report[$key] = $value;
             }
         }
         $data[] = $report;
     }
     $this->handleDisplay($data);
     return $data;
 }
开发者ID:xwp,项目名称:pantheon-cli,代码行数:43,代码来源:sites.php


示例18: event_logging_find_source

/**
 * This routine is used for automatically determining the source for an
 * event that has to be logged. It can determine the source by using either
 * a trace back depth level for examining the call stack or by using
 * the name of a file for which the event happened.
 *
 * The depth level is used to find the caller file by looking at a
 * debug_backtrace() array at the given level. The level might not be the
 * same for all requests, because some logged events will take multiple
 * steps before hitting the log writing functions (for example the database
 * error logging will run through an extra function call).
 *
 * The file that generated the event can also be passed as the $file
 * parameter. In that case, the code will directly use that parameter
 * and not investigate the call stack at all.
 *
 * @param $level   - The call stack depth at which the event generating
 *                   file can be found.
 * @param $file    - The file name of the file that generated the event or
 *                   NULL if this file name is unknown.
 *
 * @return $source - A string that can be used as the event source.
 */
function event_logging_find_source($level = 0, $file = NULL)
{
    $source = NULL;
    $from_module = FALSE;
    // Determine the file that generated the event.
    if ($file === NULL) {
        if (function_exists('debug_backtrace')) {
            $bt = debug_backtrace();
            if (isset($bt[$level]["file"])) {
                $file = $bt[$level]["file"];
            }
        }
    }
    // See if the file belongs to a module.
    if ($file !== NULL) {
        $moddir = preg_quote(dirname(dirname(__FILE__)), '!');
        if (preg_match("!^{$moddir}/([^/]+)/!", $file, $m)) {
            $source = $m[1];
            $from_module = TRUE;
        }
    }
    // No module found? Then the logging is probably done by a regular
    // Phorum page. We can use the phorum_page constant as the source here.
    if ($source === NULL) {
        if (defined("phorum_page")) {
            $source = phorum_page;
        } elseif (defined('PHORUM_ADMIN')) {
            $source = "admin";
        } else {
            $source = "unknown";
        }
    }
    return array($source, $from_module);
}
开发者ID:netovs,项目名称:Core,代码行数:57,代码来源:event_logging.php


示例19: initSmilePatterns

 protected function initSmilePatterns()
 {
     $this->smilePatterns = array();
     $this->smileReplaces = array();
     $pre = "";
     foreach ($this->smiles as $row) {
         if (preg_match("/\\w\$/", $row["TYPING"])) {
             $pre .= "|" . preg_quote($row["TYPING"], "/");
         }
     }
     foreach ($this->smiles as $row) {
         if ($row["TYPING"] != '' && $row["IMAGE"] != '') {
             $code = str_replace(array("'", "<", ">"), array("\\'", "&lt;", "&gt;"), $row["TYPING"]);
             $patt = preg_quote($code, "/");
             $code = preg_quote(str_replace(array("\\"), array("&#092;"), $code));
             $image = preg_quote(str_replace("'", "\\'", $row["IMAGE"]));
             $description = preg_quote(htmlspecialcharsbx(str_replace(array("\\"), array("&#092;"), $row["DESCRIPTION"]), ENT_QUOTES), "/");
             $patternName = "pattern" . count($this->smilePatterns);
             $this->smilePatterns[] = "/(?<=^|\\>|[" . $this->wordSeparator . "\\&]" . $pre . ")(?P<" . $patternName . ">{$patt})(?=\$|\\<|[" . $this->wordSeparator . "\\&])/s" . BX_UTF_PCRE_MODIFIER;
             $this->smileReplaces[$patternName] = array("code" => $code, "image" => $image, "description" => $description, "width" => intval($row["IMAGE_WIDTH"]), "height" => intval($row["IMAGE_HEIGHT"]), "descriptionDecode" => $row["DESCRIPTION_DECODE"] == 'Y' ? true : false);
         }
     }
     usort($this->smilePatterns, function ($a, $b) {
         return strlen($a) > strlen($b) ? -1 : 1;
     });
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:26,代码来源:textparser.php


示例20: clear

 public function clear($prefix = '')
 {
     $ns = $this->getPrefix() . $prefix;
     $ns = preg_quote($ns, '/');
     $iter = new \APCIterator('user', '/^' . $ns . '/', APC_ITER_KEY);
     return apc_delete($iter);
 }
开发者ID:Kevin-ZK,项目名称:vaneDisk,代码行数:7,代码来源:apc.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP preg_replace函数代码示例发布时间:2022-05-15
下一篇:
PHP preg_match_all函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap