Skip to content
Browse files

добавлена поддержка атрибутов alt и title у тега img

  • Loading branch information...
1 parent 0e8f799 commit 181c44fead91f2331c375a316768cfc155c3c8ff @Gemorroj committed Apr 8, 2012
Showing with 12 additions and 2 deletions.
  1. +12 −2 Xbb/Tags/Img.php
View
14 Xbb/Tags/Img.php
@@ -28,8 +28,18 @@ class Xbb_Tags_Img extends bbcode
public function get_html($tree = null)
{
- //TODO:добавить аттрибуты alt и title
- $attr = 'alt=""';
+ $attr = '';
+
+ if (isset($this -> attrib['alt'])) {
+ $attr .= ' alt="' . htmlspecialchars($this -> attrib['alt']) . '"';
+ } else {
+ // обязательный атрибут
+ $attr .= ' alt=""';
+ }
+
+ if (isset($this -> attrib['title'])) {
+ $attr .= ' title="' . htmlspecialchars($this -> attrib['title']) . '"';
+ }
if (isset($this -> attrib['width'])) {
$width = (int) $this -> attrib['width'];
$attr .= $width ? ' width="' . $width . '"' : '';

0 comments on commit 181c44f

Please sign in to comment.
Something went wrong with that request. Please try again.