Skip to content

Commit

Permalink
в тэг quote добавлен атрибут author.
Browse files Browse the repository at this point in the history
  • Loading branch information
Gemorroj committed Oct 18, 2014
1 parent 1da9a1d commit 2d9c6f6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
8 changes: 8 additions & 0 deletions Tests/Xbbcode/Tag/QuoteTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,13 @@ public function testTag()
$xbbcode = new Xbbcode();
$xbbcode->parse($text);
$this->assertEquals($result, $xbbcode->getHtml());


$text = 'test [quote author=test]xBBCode[/quote].';
$result = 'test <blockquote class="bb bb_quote"><div class="bb_quote_author">test:</div>xBBCode</blockquote>.';

$xbbcode = new Xbbcode();
$xbbcode->parse($text);
$this->assertEquals($result, $xbbcode->getHtml());
}
}
5 changes: 4 additions & 1 deletion src/Xbbcode/Tag/Quote.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,10 @@ protected function getAuthor()
{
$author = '';

if (isset($this->attributes['quote'])) {
if (isset($this->attributes['author'])) {
$author = $this->attributes['author'];
}
if (!$author && isset($this->attributes['quote'])) {
$author = $this->attributes['quote'];
}
if (!$author && isset($this->attributes['blockquote'])) {
Expand Down

0 comments on commit 2d9c6f6

Please sign in to comment.