'.$arMatch['innerHtml'].'';
if ($bfirst)
$sReplase = $sToc.'
'.$sReplase;
// so as not to replace all of the same titles
$text = preg_replace('/'.preg_quote($arMatch[0], '/').'/'.BX_UTF_PCRE_MODIFIER, $sReplase, $text, 1);
$bfirst = false;
}
}
}
return $text;
}
function _codeCallback($matches)
{
$codeText = "";
$i = count($this->arCode);
$codeText = $matches[2];
if($this->textType == "html")
$codeText = CWikiUtils::htmlspecialchars_decode($codeText);
$this->arCode[] = $codeText;
return '##CODE'.$i.'##';
}
function _noWikiCallback($matches)
{
$i = count($this->arNowiki);
$this->arNowiki[] = $matches[2];
return '##NOWIKI'.$i.'##';
}
function _codeReturnCallback($matches)
{
return ''.$this->arCode[$matches[2]].'
';
}
function _noWikiReturnCallback($matches)
{
return $this->arNowiki[$matches[2]];
}
function _noWikiReturn2Callback($matches)
{
return ''.htmlspecialcharsbx($this->arNowiki[$matches[2]]).'';
}
function parseBeforeSave($text, &$arCat = array(), $nameTemplate = "")
{
$userLogin = CWikiUtils::GetUserLogin(array(), $nameTemplate);
//$text = preg_replace_callback('/((.*)<\/nowiki>)/isU'.BX_UTF_PCRE_MODIFIER, array(&$this, '_noWikiCallback'), $text);
// Subscribe
$text = preg_replace( '/--~~~~*/'.BX_UTF_PCRE_MODIFIER, '\\1--'.$userLogin.' '.ConvertTimeStamp(false, 'FULL'), $text );
// Category
$matches = array();
$textWithoutNowiki = preg_replace('/((.*)<\/nowiki>)/isU'.BX_UTF_PCRE_MODIFIER, '', $text);
if (preg_match_all('/\[\[(Category|'.GetMessage('CATEGORY_NAME').'):(.+)\]\]/iU'.BX_UTF_PCRE_MODIFIER, $textWithoutNowiki, $matches))
$arCat = array_unique($matches[2]);
//$text = preg_replace_callback('/(##NOWIKI(\d+)##)/isU'.BX_UTF_PCRE_MODIFIER, array(&$this, '_noWikiReturn2Callback'), $text);
return $text;
}
function parseForSearch($text)
{
// delete Category
$text = preg_replace('/\[\[(Category|'.GetMessage('CATEGORY_NAME').'):(.+)\]\]/iU'.BX_UTF_PCRE_MODIFIER, '', $text);
// delete Files
$text = preg_replace('/\[?\[(:)?(File|'.GetMessage('FILE_NAME').'):(.+)\]\]?/iU'.BX_UTF_PCRE_MODIFIER, '', $text);
// delete External Links
$text = preg_replace('/\[((http|https|ftp)(.+))( (.+))?\]/iU'.BX_UTF_PCRE_MODIFIER, '\\1\\2 \\5', $text);
// delete Internal Links
$text = preg_replace('/\[\[(.+(?!:))(\|(.*))?\]\]/iU'.BX_UTF_PCRE_MODIFIER, '\\1\\2', $text);
// delete Headers
for($i = 6; $i >= 1; $i--)
{
$_H = str_repeat('=', $i);
$text = preg_replace('/'.$_H.'(.*?)'.$_H.'/miU'.BX_UTF_PCRE_MODIFIER, '\\1', $text);
}
return $text;
}
}
?>