r20160122

This commit is contained in:
flash 2016-01-22 13:46:52 +01:00
parent 8a39677267
commit 01e7dbf1ce
5 changed files with 38 additions and 4 deletions

View file

@ -14,7 +14,6 @@ This is a list of people who have contributed to Sakura and also a list of the l
## Libraries
- [Twig](http://twig.sensiolabs.org/)
- [Parsedown](http://parsedown.org/)
- [PHPMailer](https://github.com/PHPMailer/PHPMailer)
- [PayPal API](https://paypal.com/)
- [jBBCode](http://jbbcode.com/)

View file

@ -0,0 +1,35 @@
<?php
/*
* User bbcode
*/
namespace Sakura\BBcodeDefinitions;
use JBBCode\Parser;
use JBBCode\CodeDefinition;
use JBBCode\ElementNode;
class User extends CodeDefinition
{
public function __construct()
{
parent::__construct();
$this->setTagName("user");
$this->setUseOption(false);
$this->setParseContent(false);
}
public function asHtml(ElementNode $el)
{
$content = "";
foreach ($el->getChildren() as $child) {
$content .= \Sakura\Utils::cleanString($child->getAsText(), true);
}
$user = \Sakura\User::construct($content);
$urls = new \Sakura\Urls();
return '<a class="default username" href="' . $urls->format('USER_PROFILE', [$user->id]) . '" style="color: ' . $user->colour . '; text-shadow: 0 0 .3em ' . $user->colour . '; font-weight: bold;">' . $user->username . '</a>';
}
}

View file

@ -186,7 +186,7 @@ class User
$diff = date_diff($birthday, $now);
// Return the difference in years
return $diff->format('%Y');
return (int) $diff->format('%Y');
}
// Otherwise just return the birthday value

View file

@ -8,7 +8,7 @@
namespace Sakura;
// Define Sakura version
define('SAKURA_VERSION', '20160120');
define('SAKURA_VERSION', '20160122');
define('SAKURA_VLABEL', 'Amethyst');
define('SAKURA_COLOUR', '#9966CC');

View file

@ -118,7 +118,7 @@
<a href="#p{{ post.id }}" class="clean">{{ post.subject|slice(0, 50) }}{% if post.subject|length > 50 %}...{% endif %}</a>
</div>
<div class="date">
<a href="{{ urls.format('FORUM_POST', [post.id]) }}#p{{ post.id }}" class="clean" title="{{ post.time|date(sakura.dateFormat) }}">{{ post.timeElapsed }}</a>
<a href="{{ urls.format('FORUM_POST', [post.id]) }}#p{{ post.id }}" class="clean" title="{{ post.time|date(sakura.dateFormat) }}">#{{ post.id }} - {{ post.timeElapsed }}</a>
</div>
<div class="clear"></div>
</div>