當前位置: 首頁>>代碼示例>>PHP>>正文


PHP PMF_String::preg_match_all方法代碼示例

本文整理匯總了PHP中PMF_String::preg_match_all方法的典型用法代碼示例。如果您正苦於以下問題:PHP PMF_String::preg_match_all方法的具體用法?PHP PMF_String::preg_match_all怎麽用?PHP PMF_String::preg_match_all使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在PMF_String的用法示例。


在下文中一共展示了PMF_String::preg_match_all方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: setRelationLinks

 /**
  * Verlinkt einen Artikel dynamisch mit der Suche �ber die �bergebenen Schl�sselw�rter
  *
  * @param    string     $strHighlight
  * @param    string     $strSource
  * @param    integer    $intCount
  * @return   string
  * @author   Marco Enders <marco@minimarco.de>
  * @author   Thorsten Rinne <thorsten@phpmyfaq.de>
  */
 public function setRelationLinks($strHighlight, $strSource, $intCount = 0)
 {
     global $in_content;
     $x = 0;
     $arrMatch = array();
     PMF_String::preg_match_all('/(<a[^<>]*?>.*?<\\/a>)|(<.*?>)/is', $strSource, $arrMatch);
     $strSource = PMF_String::preg_replace('/(<a[^<>]*?>.*?<\\/a>)|(<.*?>)/is', '~+*# replaced html #*+~', $strSource);
     $x = $x + PMF_String::preg_match('/(' . preg_quote($strHighlight) . ')/ims', $strSource);
     $strSource = PMF_String::preg_replace('/(' . preg_quote($strHighlight) . ')/ims', '<a href="index.php?action=search&search=' . $strHighlight . '" title="Insgesamt ' . $intCount . ' Artikel zu diesem Schlagwort (' . $strHighlight . ') vorhanden. Jetzt danach suchen..." class="relation">$1</a>', $strSource);
     foreach ($arrMatch[0] as $html) {
         $strSource = PMF_String::preg_replace('/' . preg_quote('~+*# replaced html #*+~') . '/', $html, $strSource, 1);
     }
     if ($x == 0) {
         $in_content = false;
     } else {
         $in_content = true;
     }
     return $strSource;
 }
開發者ID:noon,項目名稱:phpMyFAQ,代碼行數:29,代碼來源:Relation.php

示例2: _readBlocks

 /**
  * This function reads the block
  *
  * @param  string $tpl Block to read
  * 
  * @return string
  */
 private function _readBlocks($tpl)
 {
     $tmpBlocks = array();
     // read all blocks into $tmpBlocks
     PMF_String::preg_match_all('/\\[([[:alpha:]]+)\\]\\s*[\\W\\w\\s\\{\\}\\<\\>\\=\\"\\/]*?\\s*\\[\\/\\1\\]/', $tpl, $tmpBlocks);
     $unblocked = $tpl;
     if (isset($tmpBlocks)) {
         $blockCount = count($tmpBlocks[0]);
         for ($i = 0; $i < $blockCount; $i++) {
             $name = '';
             //find block name
             PMF_String::preg_match('/\\[.+\\]/', $tmpBlocks[0][$i], $name);
             $name = PMF_String::preg_replace('/[\\[\\[\\/\\]]/', '', $name);
             //remove block tags from block
             $res = str_replace('[' . $name[0] . ']', '', $tmpBlocks[0][$i]);
             $res = str_replace('[/' . $name[0] . ']', '', $res);
             $tplBlocks[$name[0]] = $res;
             //unblocked content
             $unblocked = str_replace($tplBlocks[$name[0]], '', $unblocked);
             $unblocked = str_replace('[' . $name[0] . ']', '', $unblocked);
             $unblocked = str_replace('[/' . $name[0] . ']', '', $unblocked);
         }
         $hits = array();
         PMF_String::preg_match_all('/\\{.+?\\}/', $unblocked, $hits);
         $tplBlocks['unblocked'] = $hits[0];
     } else {
         // no blocks defined
         $tplBlocks = $tpl;
     }
     return $tplBlocks;
 }
開發者ID:jr-ewing,項目名稱:phpMyFAQ,代碼行數:38,代碼來源:Template.php

示例3: preg_match_all

 /**
  * 
  * Match a regexp globally
  * @param string $pattern
  * @param string $subject
  * @param array &$matches
  * @param int $flags
  * @param int $offset
  * 
  * @return int
  */
 public static function preg_match_all($pattern, $subject, &$matches = null, $flags = 0, $offset = 0)
 {
     return self::$instance->preg_match_all($pattern, $subject, $matches, $flags, $offset);
 }
開發者ID:noon,項目名稱:phpMyFAQ,代碼行數:15,代碼來源:String.php

示例4: alignTablePrefixByPattern

 /**
  * Align the prefix of the table name used in the PMF backup file,
  * from the (old) value of the system upon which the backup was performed
  * to the (new) prefix of the system upon which the backup will be restored.
  * This alignment will be perfomed ONLY upon those given SQL queries starting
  * with the given pattern.
  *
  * @param string $query
  * @param string $startPattern
  * @param string $oldValue
  * @param string $newValue
  * 
  * @return  string
  */
 private static function alignTablePrefixByPattern($query, $startPattern, $oldValue, $newValue)
 {
     $return = $query;
     $matches = [];
     PMF_String::preg_match_all("/^" . $startPattern . "\\s+(\\w+)(\\s+|\$)/i", $query, $matches);
     if (isset($matches[1][0])) {
         $oldTableFullName = $matches[1][0];
         $newTableFullName = $newValue . PMF_String::substr($oldTableFullName, PMF_String::strlen($oldValue));
         $return = str_replace($oldTableFullName, $newTableFullName, $query);
     }
     return $return;
 }
開發者ID:maggiofrancesco,項目名稱:phpMyFAQ,代碼行數:26,代碼來源:Helper.php


注:本文中的PMF_String::preg_match_all方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。