Files
UNIT3D-Community-Edition/app/Models/Page.php
T
HDVinnie a3efd98e84 (Security Update) HTMLPurifier 🔐
- closes #875
- Fixes HTML Tags Not Being Contained / Elevated within user-generated bodies like (posts, comments, signature, etc.)
2019-10-11 11:57:17 -04:00

63 lines
2.0 KiB
PHP
Executable File

<?php
/**
* NOTICE OF LICENSE.
*
* UNIT3D is open-sourced software licensed under the GNU General Public License v3.0
* The details is bundled with this project in the file LICENSE.txt.
*
* @project UNIT3D
*
* @license https://www.gnu.org/licenses/agpl-3.0.en.html/ GNU Affero General Public License v3.0
* @author HDVinnie
*/
namespace App\Models;
use App\Helpers\Bbcode;
use Illuminate\Database\Eloquent\Model;
/**
* @property int $id
* @property string|null $name
* @property string|null $slug
* @property string|null $content
* @property \Illuminate\Support\Carbon|null $created_at
* @property \Illuminate\Support\Carbon|null $updated_at
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Page newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Page newQuery()
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Page query()
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Page whereContent($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Page whereCreatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Page whereId($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Page whereName($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Page whereSlug($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Page whereUpdatedAt($value)
* @mixin \Eloquent
*/
class Page extends Model
{
/**
* Set The Pages Content After Its Been Purified.
*
* @param string $value
*
* @return void
*/
public function setContentAttribute($value)
{
$this->attributes['content'] = clean($value);
}
/**
* Parse Content And Return Valid HTML.
*
* @return string Parsed BBCODE To HTML
*/
public function getContentHtml()
{
$bbcode = new Bbcode();
return $bbcode->parse(clean($this->content), true);
}
}