示例#1
0
文件: Th.php 项目: ei-grad/phorm
 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
0
 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
0
文件: Table.php 项目: ei-grad/phorm
 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
0
文件: Size.php 项目: ei-grad/phorm
 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
0
文件: List.php 项目: ei-grad/phorm
 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
0
文件: Abbr.php 项目: ei-grad/phorm
 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
0
文件: Li.php 项目: ZerGabriel/ffcms
 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
0
文件: P.php 项目: ei-grad/phorm
 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
0
 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
0
文件: A.php 项目: ZerGabriel/ffcms
 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
0
文件: Tr.php 项目: ei-grad/phorm
 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
0
 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
0
文件: Simple.php 项目: ei-grad/phorm
 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
0
 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
0
文件: Bdo.php 项目: ZerGabriel/ffcms
 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>';
 }
示例#16
0
文件: Font.php 项目: ZerGabriel/ffcms
 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>';
 }
示例#17
0
文件: Email.php 项目: ei-grad/phorm
 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>';
 }
示例#18
0
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("&lt;", "<", $body);
        $body = str_replace("&gt;", ">", $body);
        $insert->execute(array($body, $row['BookId']));
        $insert->closeCursor();
    }
    $sqlite_db->query("commit;");
}
示例#19
0
文件: cms.php 项目: vityapro/cms
 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;
 }
示例#20
0
文件: Address.php 项目: ei-grad/phorm
 function get_html($tree = null)
 {
     return '<address class="bb">' . parent::get_html($this->tree) . '</address>';
 }
示例#21
0
 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();
 }
示例#22
0
 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>';
 }
示例#23
0
 function get_html($tree = null)
 {
     return '<caption class="bb">' . parent::get_html($this->tree) . '</caption>';
 }
示例#24
0
文件: Bbcode.php 项目: ei-grad/phorm
 /**
  * Фильтр
  * 
  * @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();
 }
示例#25
0
文件: preview.php 项目: ei-grad/phorm
<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>
示例#26
0
 function get_html($tree = null)
 {
     return '<small>' . parent::get_html() . '</small>';
 }
示例#27
0
 function convert_bbcode($text)
 {
     $bb = new bbcode($text);
     // convert BBCode to HTML
     return $bb->get_html();
 }
示例#28
0
文件: Color.php 项目: ei-grad/phorm
 function get_html($tree = null)
 {
     $color = htmlspecialchars($this->attrib['color']);
     return '<font color="' . $color . '">' . parent::get_html($this->tree) . '</font>';
 }
示例#29
0
 function get_html($elems = false)
 {
     return '<u>' . parent::get_html($this->tree) . '</u>';
 }