本文整理汇总了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;
}
示例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;
}
示例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);
}
示例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;
}