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>'; }
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>'; }
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; }
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>'; }
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; }
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>'; }
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>'; }
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"; }
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>'; }
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>'; }
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; }
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>'; }
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; }
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>'; }
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>'; }
function get_html($tree = null) { $attr = ''; if (isset($this->attrib['face'])) { $face = $this->attrib['face']; } else { $face = $this->attrib['font']; } if ($face) { $attr .= ' face="' . htmlspecialchars($face) . '"'; } $color = isset($this->attrib['color']) ? $this->attrib['color'] : ''; if ($color) { $attr .= ' color="' . htmlspecialchars($color) . '"'; } $size = isset($this->attrib['size']) ? $this->attrib['size'] : ''; if ($size) { $attr .= ' size="' . htmlspecialchars($size) . '"'; } return '<font' . $attr . '>' . parent::get_html($this->tree) . '</font>'; }
function get_html($tree = null) { $this->autolinks = false; $attr = ' class="bb_email"'; $href = $this->attrib['email']; if (!$href) { foreach ($this->tree as $text) { if ('text' == $text['type']) { $href .= $text['str']; } } } $protocols = array('mailto:'); $is_http = false; foreach ($protocols as $val) { if ($val == substr($href, 0, strlen($val))) { $is_http = true; break; } } if (!$is_http) { $href = 'mailto:' . $href; } if ($href) { $attr .= ' href="' . htmlspecialchars($href) . '"'; } $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' . $attr . '>' . parent::get_html($this->tree) . '</a>'; }
function book_info($mysql_db, $sqlite_db, $min) { $sqlite_db->query("begin transaction;"); $bb = new bbcode(); $bb->autolinks = false; $sqltest = "SELECT BookId FROM libbannotations WHERE BookId>{$min}"; $query = $mysql_db->query($sqltest); while ($row = $query->fetch_array()) { echo "Book: " . $row['BookId'] . "\n"; $sqltest1 = "SELECT Body FROM libbannotations WHERE BookId=" . $row['BookId']; $query1 = $mysql_db->query($sqltest1); $row1 = $query1->fetch_array(); $sql = "UPDATE books SET description=? where id=?"; $insert = $sqlite_db->prepare($sql); $bb->parse($row1['Body']); $body = $bb->get_html(); $body = str_replace("<", "<", $body); $body = str_replace(">", ">", $body); $insert->execute(array($body, $row['BookId'])); $insert->closeCursor(); } $sqlite_db->query("commit;"); }
public static function parseSmiles($text, $parse_bbcode = false) { $_parse_text = self::callEvent('GET_PARSER', array('return' => '', 'text' => $text, 'parse_bbcode' => $parse_bbcode)); if ($_parse_text['return']) { return $_parse_text['return']; } self::includeFile('includes/bbcode/bbcode.lib.php'); if (!$parse_bbcode) { $text = bbcode::autoLink($text); } else { //parse bbcode $bb = new bbcode($text); $text = $bb->get_html(); // конвертируем в смайлы в изображения $text = $bb->replaceEmotionToSmile($text); } return $text; }
function get_html($tree = null) { return '<address class="bb">' . parent::get_html($this->tree) . '</address>'; }
function convert_bbcode($text) { App::import('Vendor', 'BbcodeLib', array('file' => 'bbcode' . DS . 'bbcode.lib.php')); $bb = new bbcode($text); // convert BBCode to HTML return $bb->get_html(); }
function get_html($tree = null) { $param = htmlspecialchars(parent::get_html($tree)); return '<iframe width="420" height="315" src="http://www.youtube.com/embed/' . $param . '" frameborder="0" allowfullscreen></iframe>'; }
function get_html($tree = null) { return '<caption class="bb">' . parent::get_html($this->tree) . '</caption>'; }
/** * Фильтр * * @param string $str Входящая строка * * @return string */ public function filter($str) { require_once 'Phorm/Plugin/Xbb/bbcode.lib.php'; $bbcode = new bbcode($str); return $bbcode->get_html(); }
<html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8" /> <title>Test the BBCode parser</title> <meta name="author" content="Dmitriy Skorobogatov" /> <link href="./style.css" rel="stylesheet" type="text/css" /> <!--[if IE 6]> <style type="text/css">div.bb_code_header { margin-top: 0; }</style> <![endif]--> </head> <body> <p align="center"><font color="#999999"> <strong>..:.:: Предварительный просмотр ::.:..</strong> </font></p> <?php $text = isset($_POST['xbb_textarea']) ? $_POST['xbb_textarea'] : ''; if (get_magic_quotes_gpc()) { $text = stripslashes($text); } // Подключаем библиотеку xBB require_once './bbcode.lib.php'; // Создаем объект и парсим $text $bb = new bbcode($text); echo $bb->get_html(); ?> <p align="center"><font color="#999999"> <strong>..:.:: Предварительный просмотр ::.:..</strong> </font></p> </body> </html>
function get_html($tree = null) { return '<small>' . parent::get_html() . '</small>'; }
function convert_bbcode($text) { $bb = new bbcode($text); // convert BBCode to HTML return $bb->get_html(); }
function get_html($tree = null) { $color = htmlspecialchars($this->attrib['color']); return '<font color="' . $color . '">' . parent::get_html($this->tree) . '</font>'; }
function get_html($elems = false) { return '<u>' . parent::get_html($this->tree) . '</u>'; }