r20160122
This commit is contained in:
parent
8a39677267
commit
01e7dbf1ce
5 changed files with 38 additions and 4 deletions
|
@ -14,7 +14,6 @@ This is a list of people who have contributed to Sakura and also a list of the l
|
||||||
## Libraries
|
## Libraries
|
||||||
|
|
||||||
- [Twig](http://twig.sensiolabs.org/)
|
- [Twig](http://twig.sensiolabs.org/)
|
||||||
- [Parsedown](http://parsedown.org/)
|
|
||||||
- [PHPMailer](https://github.com/PHPMailer/PHPMailer)
|
- [PHPMailer](https://github.com/PHPMailer/PHPMailer)
|
||||||
- [PayPal API](https://paypal.com/)
|
- [PayPal API](https://paypal.com/)
|
||||||
- [jBBCode](http://jbbcode.com/)
|
- [jBBCode](http://jbbcode.com/)
|
||||||
|
|
35
libraries/BBcodeDefinitions/User.php
Normal file
35
libraries/BBcodeDefinitions/User.php
Normal 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>';
|
||||||
|
}
|
||||||
|
}
|
|
@ -186,7 +186,7 @@ class User
|
||||||
$diff = date_diff($birthday, $now);
|
$diff = date_diff($birthday, $now);
|
||||||
|
|
||||||
// Return the difference in years
|
// Return the difference in years
|
||||||
return $diff->format('%Y');
|
return (int) $diff->format('%Y');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Otherwise just return the birthday value
|
// Otherwise just return the birthday value
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
namespace Sakura;
|
namespace Sakura;
|
||||||
|
|
||||||
// Define Sakura version
|
// Define Sakura version
|
||||||
define('SAKURA_VERSION', '20160120');
|
define('SAKURA_VERSION', '20160122');
|
||||||
define('SAKURA_VLABEL', 'Amethyst');
|
define('SAKURA_VLABEL', 'Amethyst');
|
||||||
define('SAKURA_COLOUR', '#9966CC');
|
define('SAKURA_COLOUR', '#9966CC');
|
||||||
|
|
||||||
|
|
|
@ -118,7 +118,7 @@
|
||||||
<a href="#p{{ post.id }}" class="clean">{{ post.subject|slice(0, 50) }}{% if post.subject|length > 50 %}...{% endif %}</a>
|
<a href="#p{{ post.id }}" class="clean">{{ post.subject|slice(0, 50) }}{% if post.subject|length > 50 %}...{% endif %}</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="date">
|
<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>
|
||||||
<div class="clear"></div>
|
<div class="clear"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Reference in a new issue