本文整理汇总了PHP中nnText::fixHtmlTagStructure方法的典型用法代码示例。如果您正苦于以下问题:PHP nnText::fixHtmlTagStructure方法的具体用法?PHP nnText::fixHtmlTagStructure怎么用?PHP nnText::fixHtmlTagStructure使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nnText
的用法示例。
在下文中一共展示了nnText::fixHtmlTagStructure方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: processMatch
//.........这里部分代码省略.........
$id = array_shift($vars);
foreach ($vars as $var) {
$var = trim(str_replace('[:MA_BAR:]', '|', $var));
if (!$var) {
continue;
}
if (strpos($var, '=') === false) {
if ($this->params->override_style) {
$chrome = $var;
}
} else {
if ($type == $this->params->module_tag) {
list($key, $val) = explode('=', $var, 2);
$val = str_replace(array('\\{', '\\}'), array('{', '}'), $val);
if ($key == 'style') {
$chrome = $val;
} else {
if (in_array($key, array('ignore_access', 'ignore_state', 'ignore_assignments', 'ignore_caching'))) {
$ignores[$key] = $val;
} else {
if ($key == 'showtitle') {
$overrides['showtitle'] = $val;
$forcetitle = $val;
}
}
}
}
}
}
if (!$chrome) {
$chrome = $forcetitle ? 'xhtml' : $this->params->style;
}
if ($type == $this->params->module_tag) {
// module
$html = $this->processModule($id, $chrome, $ignores, $overrides, $area);
if ($html == 'MA_IGNORE') {
return 0;
}
} else {
// 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 1;
}
示例2: processMatch
public function processMatch(&$string, &$art, &$match, &$ignores, &$count = 0, $first = 0, $last = 0, $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, $count, $first, $last);
if ($this->params->place_comments) {
$html = $this->params->comment_start . $html . $this->params->comment_end;
}
$html = $p1_start . $br1a . $br1b . $html . $br2a . $br2b . $p2_end;
nnText::fixHtmlTagStructure($html, false);
return $html;
}