本文整理汇总了PHP中NNText::fixHtmlTagStructure方法的典型用法代码示例。如果您正苦于以下问题:PHP NNText::fixHtmlTagStructure方法的具体用法?PHP NNText::fixHtmlTagStructure怎么用?PHP NNText::fixHtmlTagStructure使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NNText
的用法示例。
在下文中一共展示了NNText::fixHtmlTagStructure方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: processMatch
//.........这里部分代码省略.........
$chrome = $var;
}
continue;
}
if ($type != $this->params->module_tag) {
continue;
}
list($key, $val) = explode('=', $var, 2);
$val = str_replace(array('\\{', '\\}'), array('{', '}'), $val);
switch ($key) {
case 'style':
$chrome = $val;
break;
case 'ignore_access':
case 'ignore_state':
case 'ignore_assignments':
case 'ignore_caching':
$ignores[$key] = $val;
break;
case 'showtitle':
$overrides['showtitle'] = $val;
$forcetitle = $val;
break;
default:
break;
}
}
if ($type == $this->params->module_tag) {
if (!$chrome) {
$chrome = $forcetitle ? 'xhtml' : $this->params->style;
}
// module
$html = $this->processModule($id, $chrome, $ignores, $overrides, $area);
if ($html == 'MA_IGNORE') {
return false;
}
} else {
if (!$chrome) {
$chrome = $forcetitle ? 'xhtml' : '';
}
// module position
$html = $this->processPosition($id, $chrome);
}
if ($p_start && $p_end) {
$p_start = '';
$p_end = '';
}
$html = $br1a . $br2a . $html . $br2a . $br2b;
if ($div_start) {
$extra = trim(preg_replace('#\\{div(.*)\\}#si', '\\1', $div_start));
$div = '';
if ($extra) {
$extra = explode('|', $extra);
$extras = new stdClass();
foreach ($extra as $e) {
if (strpos($e, ':') !== false) {
list($key, $val) = explode(':', $e, 2);
$extras->{$key} = $val;
}
}
if (isset($extras->class)) {
$div .= 'class="' . $extras->class . '"';
}
$style = array();
if (isset($extras->width)) {
if (is_numeric($extras->width)) {
$extras->width .= 'px';
}
$style[] = 'width:' . $extras->width;
}
if (isset($extras->height)) {
if (is_numeric($extras->height)) {
$extras->height .= 'px';
}
$style[] = 'height:' . $extras->height;
}
if (isset($extras->align)) {
$style[] = 'float:' . $extras->align;
} else {
if (isset($extras->float)) {
$style[] = 'float:' . $extras->float;
}
}
if (!empty($style)) {
$div .= ' style="' . implode(';', $style) . ';"';
}
}
$html = trim('<div ' . trim($div)) . '>' . $html . '</div>';
$html = $p_end . $html . $p_start;
} else {
$html = $p_start . $html . $p_end;
}
NNText::fixHtmlTagStructure($html);
if ($this->params->place_comments) {
$html = $this->params->comment_start . $html . $this->params->comment_end;
}
$string = str_replace($match['0'], $html, $string);
unset($match);
return $id;
}
示例2: processMatch
public function processMatch(&$string, &$art, &$match, &$ignores, $type = 'article')
{
if ($this->params->message != '') {
if ($this->params->place_comments) {
return $this->params->comment_start . $this->params->message_start . $this->params->message . $this->params->message_end . $this->params->comment_end;
}
return '';
}
$p1_start = $match['1'];
$br1a = $match['2'];
//$type = $match['3'];
$id = $match['4'];
$br1b = $match['5'];
$p1_end = $match['6'];
$html = $match['7'];
$p2_start = $match['8'];
$br2a = $match['9'];
// end tag
$br2b = $match['10'];
$p2_end = $match['11'];
$html = trim($html);
preg_match('#^' . $this->params->breaks_start . '(.*?)' . $this->params->breaks_end . '$#s', trim($html), $text_match);
$p1_start = $p1_end || $text_match['1'] ? '' : $p1_start;
$p2_end = $p2_start || $text_match['5'] ? '' : $p2_end;
if (strpos($string, '{/div}') !== false && preg_match('#^' . $this->params->breaks_start . '(\\{div[^\\}]*\\})' . $this->params->breaks_end . '(.*?)' . $this->params->breaks_start . '(\\{/div\\})' . $this->params->breaks_end . '#s', $html, $div_match)) {
if ($div_match['1'] && $div_match['5']) {
$div_match['1'] = '';
}
if ($div_match['7'] && $div_match['11']) {
$div_match['11'] = '';
}
$html = $div_match['2'] . $div_match['3'] . $div_match['4'] . $div_match['1'] . $div_match['6'] . $div_match['11'] . $div_match['8'] . $div_match['9'] . $div_match['10'];
}
$type = $type ?: 'article';
if (strpos($id, ':') !== false) {
$type = explode(':', $id, 2);
if ($type['0'] == 'k2') {
$id = trim($type['1']);
}
}
$html = $this->processArticle($id, $art, $html, $type, $ignores);
if ($this->params->place_comments) {
$html = $this->params->comment_start . $html . $this->params->comment_end;
}
// Only add surrounding html if there is something to output (not only comments)
if (!preg_match('#^(<\\!--[^>]*-->)*$#', $html)) {
$html = $p1_start . $br1a . $br1b . $html . $br2a . $br2b . $p2_end;
NNText::fixHtmlTagStructure($html, false);
}
return $html;
}