Skip to content

Commit

Permalink
Allow all tags on articles
Browse files Browse the repository at this point in the history
  • Loading branch information
DanieL authored and DanieL committed Nov 1, 2022
1 parent 10f6b2f commit 5132223
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions objects/video.php
Original file line number Diff line number Diff line change
Expand Up @@ -2282,16 +2282,19 @@ public function setDescription($description) {
}
if (empty($advancedCustom->disableHTMLDescription)) {
$articleObj = AVideoPlugin::getObjectData('Articles');
$configPuri = HTMLPurifier_Config::createDefault();
$configPuri->set('Cache.SerializerPath', getCacheDir());
$purifier = new HTMLPurifier($configPuri);
if (empty($articleObj->allowAttributes)) {
$configPuri->set('HTML.AllowedAttributes', ['a.href', 'a.target', 'a.title', 'a.title', 'img.src', 'img.width', 'img.height', 'span.style']); // remove all attributes except a.href
$configPuri->set('Attr.AllowedFrameTargets', ['_blank']);
$configPuri->set('CSS.AllowedProperties', []); // remove all CSS
}
$configPuri->set('AutoFormat.RemoveEmpty', true); // remove empty elements
$pure = $purifier->purify($description);
if(empty($articleObj->allowAllTags)){
$configPuri = HTMLPurifier_Config::createDefault();
$configPuri->set('Cache.SerializerPath', getCacheDir());
$purifier = new HTMLPurifier($configPuri);
if (empty($articleObj->allowAttributes)) {
$configPuri->set('HTML.AllowedAttributes', ['a.href', 'a.target', 'a.title', 'a.title', 'img.src', 'img.width', 'img.height', 'span.style']); // remove all attributes except a.href
$configPuri->set('Attr.AllowedFrameTargets', ['_blank']);
$configPuri->set('CSS.AllowedProperties', []); // remove all CSS
}
$configPuri->set('AutoFormat.RemoveEmpty', true); // remove empty elements
$pure = $purifier->purify($description);
}

$parts = explode("<body>", $pure);
if (!empty($parts[1])) {
$parts = explode("</body>", $parts[1]);
Expand Down

0 comments on commit 5132223

Please sign in to comment.