Find this useful? Enter your email to receive occasional updates for securing PHP code.
Signing you up...
Thank you for signing up!
PHP Decode
<?php /* * This file is part of Flarum. * * For detailed copyright and license informa..
Decoded Output download
<?php
/*
* This file is part of Flarum.
*
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/
namespace Flarum\Mentions\Formatter;
use Flarum\Post\Post;
use Flarum\Tags\Tag;
use Psr\Http\Message\ServerRequestInterface as Request;
use s9e\TextFormatter\Renderer;
use s9e\TextFormatter\Utils;
class FormatTagMentions
{
public function __invoke(Renderer $renderer, mixed $context, ?string $xml, Request $request = null): string
{
return Utils::replaceAttributes($xml, 'TAGMENTION', function ($attributes) use ($context) {
/** @var Tag|null $tag */
$tag = (($context && isset($context->getRelations()['mentionsTags'])) || $context instanceof Post)
? $context->mentionsTags->find($attributes['id'])
: Tag::query()->find($attributes['id']);
if ($tag) {
$attributes['deleted'] = false;
$attributes['tagname'] = $tag->name;
$attributes['slug'] = $tag->slug;
$attributes['color'] = $tag->color ?? '';
$attributes['icon'] = $tag->icon ?? '';
} else {
$attributes['deleted'] = true;
}
return $attributes;
});
}
}
?>
Did this file decode correctly?
Original Code
<?php
/*
* This file is part of Flarum.
*
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/
namespace Flarum\Mentions\Formatter;
use Flarum\Post\Post;
use Flarum\Tags\Tag;
use Psr\Http\Message\ServerRequestInterface as Request;
use s9e\TextFormatter\Renderer;
use s9e\TextFormatter\Utils;
class FormatTagMentions
{
public function __invoke(Renderer $renderer, mixed $context, ?string $xml, Request $request = null): string
{
return Utils::replaceAttributes($xml, 'TAGMENTION', function ($attributes) use ($context) {
/** @var Tag|null $tag */
$tag = (($context && isset($context->getRelations()['mentionsTags'])) || $context instanceof Post)
? $context->mentionsTags->find($attributes['id'])
: Tag::query()->find($attributes['id']);
if ($tag) {
$attributes['deleted'] = false;
$attributes['tagname'] = $tag->name;
$attributes['slug'] = $tag->slug;
$attributes['color'] = $tag->color ?? '';
$attributes['icon'] = $tag->icon ?? '';
} else {
$attributes['deleted'] = true;
}
return $attributes;
});
}
}
Function Calls
None |
Stats
MD5 | b33270e6d7c9dd25bece3ff778b20e87 |
Eval Count | 0 |
Decode Time | 98 ms |