Files
faveo/app/BaseModel.php
Sujit Prasad ffa56a43cb update v1.0.7.9 R.C.
This is a Release Candidate. We are still testing.
2016-08-03 20:04:36 +05:30

35 lines
1.2 KiB
PHP

<?php
namespace App;
use File;
use Illuminate\Database\Eloquent\Model;
/**
* ======================================
* Attchment Model
* ======================================
* This is a model representing the attachment table.
*
* @author Ladybird <info@ladybirdweb.com>
*/
class BaseModel extends Model
{
public function setAttribute($property, $value)
{
require_once base_path('vendor'.DIRECTORY_SEPARATOR.'htmlpurifier'.DIRECTORY_SEPARATOR.'library'.DIRECTORY_SEPARATOR.'HTMLPurifier.auto.php');
$path = base_path('vendor'.DIRECTORY_SEPARATOR.'htmlpurifier'.DIRECTORY_SEPARATOR.'library'.DIRECTORY_SEPARATOR.'HTMLPurifier'.DIRECTORY_SEPARATOR.'DefinitionCache'.DIRECTORY_SEPARATOR.'Serializer');
if (!File::exists($path)) {
File::makeDirectory($path, $mode = 0777, true, true);
}
$config = \HTMLPurifier_Config::createDefault();
$config->set('HTML.Trusted', true);
$config->set('Filter.YouTube', true);
$purifier = new \HTMLPurifier($config);
if ($value != strip_tags($value)) {
$value = $purifier->purify($value);
}
parent::setAttribute($property, $value);
}
}