本文整理汇总了PHP中bbcode::get_html方法的典型用法代码示例。如果您正苦于以下问题:PHP bbcode::get_html方法的具体用法?PHP bbcode::get_html怎么用?PHP bbcode::get_html使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类bbcode
的用法示例。
在下文中一共展示了bbcode::get_html方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: isset
function get_html($tree = null)
{
$attr = ' class="bb"';
$width = isset($this->attrib['width']) ? $this->attrib['width'] : '';
if ($width) {
$attr .= ' width="' . htmlspecialchars($width) . '"';
}
$height = isset($this->attrib['height']) ? $this->attrib['height'] : '';
if ($height) {
$attr .= ' height="' . htmlspecialchars($height) . '"';
}
$align = isset($this->attrib['align']) ? $this->attrib['align'] : '';
if ($align) {
$attr .= ' align="' . htmlspecialchars($align) . '"';
}
$valign = isset($this->attrib['valign']) ? $this->attrib['valign'] : '';
if ($valign) {
$attr .= ' valign="' . htmlspecialchars($valign) . '"';
}
if (isset($this->attrib['colspan'])) {
$colspan = (int) $this->attrib['colspan'];
if ($colspan) {
$attr .= ' colspan="' . $colspan . '"';
}
}
if (isset($this->attrib['rowspan'])) {
$rowspan = (int) $this->attrib['rowspan'];
if ($rowspan) {
$attr .= ' rowspan="' . $rowspan . '"';
}
}
return '<th' . $attr . '>' . parent::get_html($this->tree) . '</th>';
}
示例2: switch
function get_html($tree = null)
{
$align = '';
if (isset($this->attrib['justify'])) {
$align = 'justify';
}
if (isset($this->attrib['left'])) {
$align = 'left';
}
if (isset($this->attrib['right'])) {
$align = 'right';
}
if (isset($this->attrib['center'])) {
$align = 'center';
}
if (!$align && isset($this->attrib['align'])) {
switch (strtolower($this->attrib['align'])) {
case 'left':
$align = 'left';
break;
case 'right':
$align = 'right';
break;
case 'center':
$align = 'center';
break;
case 'justify':
$align = 'justify';
break;
}
}
return '<div class="bb" align="' . $align . '">' . parent::get_html($this->tree) . '</div>';
}
示例3: isset
function get_html($tree = null)
{
$attr = ' class="bb"';
$border = isset($this->attrib['border']) ? (int) $this->attrib['border'] : null;
if (null !== $border) {
$attr .= ' border="' . $border . '"';
}
$width = isset($this->attrib['width']) ? $this->attrib['width'] : '';
if ($width) {
$attr .= ' width="' . htmlspecialchars($width) . '"';
}
$cellspacing = isset($this->attrib['cellspacing']) ? (int) $this->attrib['cellspacing'] : null;
if (null !== $cellspacing) {
$attr .= ' cellspacing="' . $cellspacing . '"';
}
$cellpadding = isset($this->attrib['cellpadding']) ? (int) $this->attrib['cellpadding'] : null;
if (null !== $cellpadding) {
$attr .= ' cellpadding="' . $cellpadding . '"';
}
$align = isset($this->attrib['align']) ? $this->attrib['align'] : '';
if ($align) {
$attr .= ' align="' . htmlspecialchars($align) . '"';
}
$str = '<table' . $attr . '>';
foreach ($this->tree as $key => $item) {
if ('text' == $item['type']) {
unset($this->tree[$key]);
}
}
$str .= parent::get_html($this->tree) . '</table>';
return $str;
}
示例4:
function get_html($tree = null)
{
$sign = '';
if (strlen($this->attrib['size'])) {
$sign = $this->attrib['size'][0];
}
if ('+' != $sign) {
$sign = '';
}
$size = (int) $this->attrib['size'];
if ($size >= 50 && $size <= 200) {
return '<font style="font-size:' . $size . '%">' . parent::get_html($this->tree) . '</font>';
}
if (7 < $size) {
$size = 7;
$sign = '';
}
if (-6 > $size) {
$size = '-6';
$sign = '';
}
if (0 == $size) {
$size = 3;
}
$size = $sign . $size;
return '<font size="' . $size . '">' . parent::get_html($this->tree) . '</font>';
}
示例5: switch
function get_html($tree = null)
{
$tag_name = 'ul';
$type = '';
switch ($this->tag) {
case 'ol':
$tag_name = 'ol';
$type = strtolower($this->attrib['ol']);
break;
case 'list':
if ($this->attrib['list']) {
$tag_name = 'ol';
}
$type = strtolower($this->attrib['list']);
$this->tag = 'del';
}
$attr = ' class="bb"';
if ('1' == $type) {
$attr .= ' type="1"';
} elseif ($type) {
$attr .= ' type="a"';
}
$str = '<' . $tag_name . $attr . '>' . parent::get_html() . '</' . $tag_name . '>';
return $str;
}
示例6: htmlspecialchars
function get_html($tree = null)
{
$attrib = 'class="bb"';
if ($this->attrib['abbr']) {
$attrib .= ' title="' . htmlspecialchars($this->attrib['abbr']) . '"';
}
return '<abbr ' . $attrib . '>' . parent::get_html($this->tree) . '</abbr>';
}
示例7:
function get_html($tree = null)
{
$attrib = 'class="bb"';
if ('' !== $this->attrib['*']) {
$this->attrib['*'] = (int) $this->attrib['*'];
$attrib .= ' value="' . $this->attrib['*'] . '"';
}
return '<li ' . $attrib . '>' . parent::get_html($this->tree) . '</li>';
}
示例8: isset
function get_html($tree = null)
{
$str = "\n<" . $this->tag . ' class="bb"';
$align = isset($this->attrib['align']) ? $this->attrib['align'] : '';
if ($align) {
$str .= ' align="' . htmlspecialchars($align) . '"';
}
return $str . '>' . parent::get_html() . '</' . $this->tag . ">\n";
}
示例9: foreach
function get_html($tree = null)
{
$this->autolinks = false;
$text = '';
foreach ($this->tree as $val) {
if ('text' == $val['type']) {
$text .= $val['str'];
}
}
$href = '';
if (isset($this->attrib['url'])) {
$href = $this->attrib['url'];
}
if (!$href && isset($this->attrib['a'])) {
$href = $this->attrib['a'];
}
if (!$href && isset($this->attrib['href'])) {
$href = $this->attrib['href'];
}
if (!$href && !isset($this->attrib['anchor'])) {
$href = $text;
}
$href = $this->checkUrl($href);
$attr = 'class="bb"';
if ($href) {
$attr .= ' href="' . $href . '"';
}
if (isset($this->attrib['title'])) {
$title = $this->attrib['title'];
$attr .= ' title="' . htmlspecialchars($title) . '"';
}
$id = '';
if (isset($this->attrib['id'])) {
$id = $this->attrib['id'];
}
if (!$id && isset($this->attrib['name'])) {
$id = $this->attrib['name'];
}
if (!$id && isset($this->attrib['anchor'])) {
$id = $this->attrib['anchor'];
if (!$id) {
$id = $text;
}
}
if ($id) {
if ($id[0] < 'A' || $id[0] > 'z') {
$id = 'bb' . $id;
}
$attr .= ' id="' . htmlspecialchars($id) . '"';
}
if (isset($this->attrib['target'])) {
$target = $this->attrib['target'];
$attr .= ' target="' . htmlspecialchars($target) . '"';
}
return smarty_modifier_linkify(parent::get_html($this->tree), parent::get_html($this->tree));
//return '<a '.$attr.'>'.parent::get_html($this -> tree).'</a>';
}
示例10: foreach
function get_html($tree = null)
{
$this->autolinks = false;
$text = '';
foreach ($this->tree as $val) {
if ('text' == $val['type']) {
$text .= $val['str'];
}
}
$href = '';
if (isset($this->attrib['url'])) {
$href = $this->attrib['url'];
}
if (!$href && isset($this->attrib['a'])) {
$href = $this->attrib['a'];
}
if (!$href && isset($this->attrib['href'])) {
$href = $this->attrib['href'];
}
if (!$href && !isset($this->attrib['anchor'])) {
$href = $text;
}
$href = $this->checkUrl($href);
$attr = 'class="bb"';
if ($href) {
if (system::getInstance()->prefixEquals($href, property::getInstance()->get('url')) || $href == property::getInstance()->get('url')) {
$attr .= ' href="' . $href . '"';
} else {
$attr .= ' href="' . $href . '" rel="nofollow"';
}
}
if (isset($this->attrib['title'])) {
$title = $this->attrib['title'];
$attr .= ' title="' . htmlspecialchars($title) . '"';
}
$id = '';
if (isset($this->attrib['id'])) {
$id = $this->attrib['id'];
}
if (!$id && isset($this->attrib['name'])) {
$id = $this->attrib['name'];
}
if (!$id && isset($this->attrib['anchor'])) {
$id = $this->attrib['anchor'];
if (!$id) {
$id = $text;
}
}
if ($id) {
if ($id[0] < 'A' || $id[0] > 'z') {
$id = 'bb' . $id;
}
$attr .= ' id="' . htmlspecialchars($id) . '"';
}
return '<a ' . $attr . ' target="_blank">' . parent::get_html($this->tree) . '</a>';
}
示例11: foreach
function get_html($tree = null)
{
$str = '<tr class="bb">';
foreach ($this->tree as $key => $item) {
if ('text' == $item['type']) {
unset($this->tree[$key]);
}
}
$str .= parent::get_html($this->tree) . '</tr>';
return $str;
}
示例12: htmlspecialchars
function get_html($tree = null)
{
if ('blockquote' == $this->tag) {
$author = htmlspecialchars($this->attrib['blockquote']);
} else {
$author = htmlspecialchars($this->attrib['quote']);
}
if ($author) {
$author = '<div class="bb_quote_author">' . $author . '</div>';
}
return '<blockquote class="bb_quote">' . $author . parent::get_html($this->tree) . '</blockquote>';
}
示例13: switch
function get_html($tree = null)
{
switch ($this->tag) {
case 'b':
$this->tag = 'strong';
break;
case 's':
case 'strike':
$this->tag = 'del';
}
$html = '<' . $this->tag . ' class="bb">' . parent::get_html() . '</' . $this->tag . '>';
return $html;
}
示例14: htmlspecialchars
function get_html($tree = null)
{
$attr = htmlspecialchars(rawurlencode($this->attrib['google']));
$attr = ' href="http://www.google.com/search?q=' . $attr . '"';
$title = isset($this->attrib['title']) ? $this->attrib['title'] : '';
if ($title) {
$attr .= ' title="' . htmlspecialchars($title) . '"';
}
$name = isset($this->attrib['name']) ? $this->attrib['name'] : '';
if ($name) {
$attr .= ' name="' . htmlspecialchars($name) . '"';
}
$target = isset($this->attrib['target']) ? $this->attrib['target'] : '';
if ($target) {
$attr .= ' target="' . htmlspecialchars($target) . '"';
}
return '<a class="bb_google" ' . $attr . '>' . parent::get_html($this->tree) . '</a>';
}
示例15: switch
function get_html($tree = null)
{
$dir = '';
switch (strtolower($this->attrib['bdo'])) {
case 'ltr':
$dir = 'ltr';
break;
case 'rtl':
$dir = 'rtl';
}
if (!$dir) {
return parent::get_html();
}
/* <bdo> может иметь следующие атрибуты: dir, lang, id, class, style,
title. */
$attr = 'dir="' . $dir . '" class="bb"';
if (isset($this->attrib['lang'])) {
$attr .= ' lang="' . htmlspecialchars($this->attrib['lang']) . '"';
}
return '<bdo ' . $attr . '>' . parent::get_html() . '</bdo>';
}