Permalink
Browse files

возвращен пробел в список пробельных символов, код приведен в большее…

… соответствие стандартам кодирования Zend
  • Loading branch information...
1 parent 27979e1 commit 0e8f79951c54dbbaf655bd9f064b64df8ab9f533 @Gemorroj committed Apr 8, 2012
View
@@ -22,13 +22,18 @@
******************************************************************************/
// Класс для тегов [a], [anchor] и [url]
-class Xbb_Tags_A extends bbcode {
+class Xbb_Tags_A extends bbcode
+{
public $behaviour = 'a';
- function get_html($tree = null) {
+
+ public function get_html($tree = null)
+ {
$this -> autolinks = false;
$text = '';
foreach ($this -> tree as $val) {
- if ('text' == $val['type']) { $text .= $val['str']; }
+ if ('text' === $val['type']) {
+ $text .= $val['str'];
+ }
}
$href = '';
if (isset($this -> attrib['url'])) {
@@ -40,15 +45,17 @@ function get_html($tree = null) {
if (! $href && isset($this -> attrib['href'])) {
$href = $this -> attrib['href'];
}
- if (! $href && ! isset($this -> attrib['anchor'])) { $href = $text; }
- $href = $this -> checkUrl($href);
+ if (! $href && ! isset($this -> attrib['anchor'])) {
+ $href = $text;
+ }
+ $href = $this -> _checkUrl($href);
$attr = 'class="bb"';
if ($href) {
- $attr .= ' href="'.$href.'"';
+ $attr .= ' href="' . $href . '"';
}
if (isset($this -> attrib['title'])) {
$title = $this -> attrib['title'];
- $attr .= ' title="'.htmlspecialchars($title).'"';
+ $attr .= ' title="' . htmlspecialchars($title) . '"';
}
$id = '';
if (isset($this -> attrib['id'])) {
@@ -62,14 +69,16 @@ function get_html($tree = null) {
if (! $id) { $id = $text; }
}
if ($id) {
- if ($id{0} < 'A' || $id{0} > 'z') { $id = 'bb'.$id; }
- $attr .= ' id="'.htmlspecialchars($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).'"';
+ $attr .= ' target="' . htmlspecialchars($target) . '"';
}
- return '<a '.$attr.'>'.parent::get_html($this -> tree).'</a>';
+
+ return '<a ' . $attr . '>' . parent::get_html($this -> tree) . '</a>';
}
}
-?>
View
@@ -22,14 +22,16 @@
******************************************************************************/
// Класс для тега [abbr]
-class Xbb_Tags_Abbr extends bbcode {
+class Xbb_Tags_Abbr extends bbcode
+{
public $behaviour = 'span';
- function get_html($tree = null) {
+
+ public function get_html($tree = null)
+ {
$attrib = 'class="bb"';
if ($this -> attrib['abbr']) {
- $attrib .= ' title="'.htmlspecialchars($this -> attrib['abbr']).'"';
+ $attrib .= ' title="' . htmlspecialchars($this -> attrib['abbr']) . '"';
}
- return '<abbr '.$attrib.'>'.parent::get_html($this -> tree).'</abbr>';
+ return '<abbr ' . $attrib . '>' . parent::get_html($this -> tree) . '</abbr>';
}
}
-?>
View
@@ -22,16 +22,19 @@
******************************************************************************/
// Класс для тега [acronym]
-class Xbb_Tags_Acronym extends bbcode {
+class Xbb_Tags_Acronym extends bbcode
+{
public $behaviour = 'span';
- function get_html($tree = null) {
+
+ public function get_html($tree = null)
+ {
$attrib = 'class="bb"';
if ($this -> attrib['acronym']) {
- $attrib .= ' title="'.htmlspecialchars($this -> attrib['acronym'])
- .'"';
+ $attrib .= ' title="' . htmlspecialchars($this -> attrib['acronym'])
+ . '"';
}
- return '<acronym '.$attrib.'>'.parent::get_html($this -> tree)
- .'</acronym>';
+
+ return '<acronym ' . $attrib . '>' . parent::get_html($this -> tree)
+ . '</acronym>';
}
}
-?>
View
@@ -22,11 +22,13 @@
******************************************************************************/
// Класс для тега [address]
-class Xbb_Tags_Address extends bbcode {
+class Xbb_Tags_Address extends bbcode
+{
public $rbr = 1;
- function get_html($tree = null) {
- return '<address class="bb">'.parent::get_html($this -> tree)
- .'</address>';
+
+ public function get_html($tree = null)
+ {
+ return '<address class="bb">' . parent::get_html($this -> tree)
+ . '</address>';
}
}
-?>
View
@@ -22,9 +22,12 @@
******************************************************************************/
// Класс для тегов [align], [center], [justify], [left] и [right]
-class Xbb_Tags_Align extends bbcode {
+class Xbb_Tags_Align extends bbcode
+{
public $rbr = 1;
- function get_html($tree = null) {
+
+ public function get_html($tree = null)
+ {
$align = '';
if (isset($this -> attrib['justify'])) { $align = 'justify'; }
if (isset($this -> attrib['left'])) { $align = 'left'; }
@@ -46,8 +49,9 @@ function get_html($tree = null) {
break;
}
}
- return '<div class="bb" align="'.$align.'">'
- .parent::get_html($this -> tree).'</div>';
+
+ return '<div class="bb" align="' . $align . '">'
+ . parent::get_html($this -> tree) . '</div>';
}
}
?>
View
@@ -22,20 +22,25 @@
******************************************************************************/
// Класс для тега [bbcode]
-class Xbb_Tags_Bbcode extends bbcode {
- public $behaviour = 'code';
- function get_html($tree = null) {
+class Xbb_Tags_Bbcode extends bbcode
+{
+ public $behaviour = 'code';
+
+ public function get_html($tree = null)
+ {
$str = '';
foreach ($this -> tree as $item) {
- if ('item' == $item['type']) { continue; }
+ if ('item' === $item['type']) {
+ continue;
+ }
$str .= $item['str'];
}
$bb = new bbcode();
$bb -> tags = $this -> tags;
$bb -> mnemonics = $this -> mnemonics;
$bb -> autolinks = $this -> autolinks;
$bb -> parse($str);
- return '<code class="bb_code">'.$bb -> highlight().'</code>';
+
+ return '<code class="bb_code">' . $bb -> highlight() . '</code>';
}
}
-?>
View
@@ -22,9 +22,12 @@
******************************************************************************/
// Класс для тега [bdo]
-class Xbb_Tags_Bdo extends bbcode {
+class Xbb_Tags_Bdo extends bbcode
+{
public $behaviour = 'span';
- function get_html($tree = null) {
+
+ public function get_html($tree = null)
+ {
$dir = '';
switch (strtolower($this->attrib['bdo'])) {
case 'ltr':
@@ -42,7 +45,7 @@ function get_html($tree = null) {
if (isset($this->attrib['lang'])) {
$attr .= ' lang="' . htmlspecialchars($this->attrib['lang']) . '"';
}
+
return '<bdo ' . $attr . '>' . parent::get_html() . '</bdo>';
}
}
-?>
View
@@ -22,11 +22,13 @@
******************************************************************************/
// Класс для тега [br]
-class Xbb_Tags_Br extends bbcode {
+class Xbb_Tags_Br extends bbcode
+{
public $is_close = true;
public $behaviour = 'span';
- function get_html($tree = null) {
+
+ public function get_html($tree = null)
+ {
return '<br class="bb" />' . "\n";
}
}
-?>
View
@@ -22,11 +22,13 @@
******************************************************************************/
// Класс для тега [caption]
-class Xbb_Tags_Caption extends bbcode {
+class Xbb_Tags_Caption extends bbcode
+{
public $behaviour = 'caption';
- function get_html($tree = null) {
- return '<caption class="bb">'.parent::get_html($this -> tree)
- .'</caption>';
+
+ public function get_html($tree = null)
+ {
+ return '<caption class="bb">' . parent::get_html($this -> tree)
+ . '</caption>';
}
}
-?>
View
@@ -22,7 +22,8 @@
******************************************************************************/
/* Класс для тегов подсветки синтаксиса и для тегов [code] и [pre] */
-class Xbb_Tags_Code extends bbcode {
+class Xbb_Tags_Code extends bbcode
+{
/* Число разрывов строк, которые должны быть игнорированы перед тегом */
public $lbr = 0;
/* Число разрывов строк, которые должны быть игнорированы после тега */
@@ -44,18 +45,22 @@ class Xbb_Tags_Code extends bbcode {
);
/* Объект GeSHi */
private $_geshi;
+
/* Конструктор класса */
- function Xbb_Tags_Code() {
+ public function __construct()
+ {
$geshi_path = realpath(
dirname(__FILE__) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR
. '..' . DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR . 'geshi.php'
);
@include_once $geshi_path;
- @$this->_geshi = new GeSHi('', 'text');
+ $this->_geshi = new GeSHi('', 'text');
$this->_geshi->set_header_type(GESHI_HEADER_NONE);
}
+
/* Описываем конвертацию в HTML */
- function get_html($tree = null) {
+ public function get_html($tree = null)
+ {
// Находим язык подсветки
switch ($this->tag) {
case 'code':
@@ -66,16 +71,19 @@ function get_html($tree = null) {
break;
default:
$language = $this->tag;
+ break;
}
if (! $language) { $language = 'text'; }
if (isset($this->lang_synonym[$language])) {
$language = $this->lang_synonym[$language];
}
- @$this->_geshi->set_language($language);
+ $this->_geshi->set_language($language);
// Находим подсвечиваемый код
$source = '';
foreach ($this->tree as $item) {
- if ('item' == $item['type']) { continue; }
+ if ('item' === $item['type']) {
+ continue;
+ }
$source .= $item['str'];
}
$this->_geshi->set_source($source);
@@ -109,16 +117,16 @@ function get_html($tree = null) {
$result = htmlspecialchars($this->attrib['title'], ENT_NOQUOTES);
}
// Получаем подсвеченный код
- $result = '<div class="bb_code"><div class="bb_code_header">' .$result
+ $result = '<div class="bb_code"><div class="bb_code_header">' . $result
. '</div>' . $this->_geshi->parse_code();
// Формируем подпись под кодом
if (isset($this->attrib['footer'])) {
$content = htmlspecialchars($this->attrib['footer'], ENT_NOQUOTES);
$content = '<div class="bb_code_footer">' . $content . '</div>';
$result .= $content;
}
+
// Возвращаем результат
return $result . '</div>';
}
}
-?>
View
@@ -22,12 +22,14 @@
******************************************************************************/
// Класс для тега [color]
-class Xbb_Tags_Color extends bbcode {
+class Xbb_Tags_Color extends bbcode
+{
public $behaviour = 'span';
- function get_html($tree = null) {
+
+ public function get_html($tree = null)
+ {
$color = htmlspecialchars($this -> attrib['color']);
- return '<font color="'.$color.'">'.parent::get_html($this -> tree)
- .'</font>';
+ return '<font color="' . $color . '">' . parent::get_html($this -> tree)
+ . '</font>';
}
}
-?>
Oops, something went wrong.

0 comments on commit 0e8f799

Please sign in to comment.