本文整理汇总了PHP中nnText::getContentContainingSearches方法的典型用法代码示例。如果您正苦于以下问题:PHP nnText::getContentContainingSearches方法的具体用法?PHP nnText::getContentContainingSearches怎么用?PHP nnText::getContentContainingSearches使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nnText
的用法示例。
在下文中一共展示了nnText::getContentContainingSearches方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: processArticles
public function processArticles(&$string, $area = 'articles', $art = null)
{
list($pre_string, $string, $post_string) = nnText::getContentContainingSearches($string, array('{' . $this->params->article_tag), array('{/' . $this->params->article_tag . '}'));
if ($string == '') {
$string = $pre_string . $string . $post_string;
return;
}
$regex_close = '#\\{/' . $this->params->tags . '\\}#si';
if (@preg_match($regex_close . 'u', $string)) {
$regex_close .= 'u';
}
$regex = $this->params->regex;
if (@preg_match($regex . 'u', $string)) {
$regex .= 'u';
}
$matches = array();
$break = 0;
while ($break++ < 10 && strpos($string, $this->params->article_tag) !== false && preg_match_all($regex, $string, $matches, PREG_SET_ORDER) > 0) {
foreach ($matches as $match) {
$this->helpers->get('article')->replace($string, $match, $art);
}
$matches = array();
}
$string = $pre_string . $string . $post_string;
}
示例2: replaceInTheRest
function replaceInTheRest(&$string)
{
if (!is_string($string) || $string == '') {
return;
}
list($pre_string, $string, $post_string) = nnText::getContentContainingSearches($string, array('{' . $this->src_params->syntax_word), array('{/' . $this->src_params->syntax_word . '}'));
if ($string == '') {
$string = $pre_string . $string . $post_string;
return;
}
// COMPONENT
if (JFactory::getDocument()->getType() == 'feed') {
$s = '#(<item[^>]*>)#s';
$string = preg_replace($s, '\\1<!-- START: SRC_COMPONENT -->', $string);
$string = str_replace('</item>', '<!-- END: SRC_COMPONENT --></item>', $string);
}
if (strpos($string, '<!-- START: SRC_COMPONENT -->') === false) {
$this->tagArea($string, 'SRC', 'component');
}
$components = $this->getTagArea($string, 'SRC', 'component');
foreach ($components as $component) {
$this->replace($component['1'], 'components', '');
$string = str_replace($component['0'], $component['1'], $string);
}
// EVERYWHERE
$this->replace($string, 'other');
$string = $pre_string . $string . $post_string;
}
示例3: replace
function replace(&$string, $regex, $area = 'articles')
{
list($pre_string, $string, $post_string) = nnText::getContentContainingSearches($string, $this->params->start_tags, null, 200, 500);
if ($string == '') {
$string = $pre_string . $string . $post_string;
return;
}
if (@preg_match($regex . 'u', $string)) {
$regex .= 'u';
}
$matches = array();
$protects = array();
if (!nnText::stringContains($string, $this->params->start_tags) || !preg_match_all($regex, $string, $matches, PREG_SET_ORDER)) {
$string = $pre_string . $string . $post_string;
return;
}
foreach ($matches as $match) {
if ($this->processMatch($string, $match, $area)) {
continue;
}
$protected = $this->params->protect_start . base64_encode($match['0']) . $this->params->protect_end;
$string = str_replace($match['0'], $protected, $string);
$protects[] = array($match['0'], $protected);
}
unset($matches);
foreach ($protects as $protect) {
$string = str_replace($protect['1'], $protect['0'], $string);
}
$string = $pre_string . $string . $post_string;
}