1
0
mirror of https://git.tt-rss.org/git/tt-rss.git synced 2025-12-15 23:35:56 +00:00

Revert "remove htmlpurifier"

This reverts commit c21a462d52.
This commit is contained in:
Andrew Dolgov
2012-06-05 21:52:21 +04:00
parent 705b97b7fc
commit 010efc9b81
356 changed files with 26185 additions and 4 deletions

View File

@@ -0,0 +1,27 @@
<?php
/**
* Class for handling width/height length attribute transformations to CSS
*/
class HTMLPurifier_AttrTransform_Length extends HTMLPurifier_AttrTransform
{
protected $name;
protected $cssName;
public function __construct($name, $css_name = null) {
$this->name = $name;
$this->cssName = $css_name ? $css_name : $name;
}
public function transform($attr, $config, $context) {
if (!isset($attr[$this->name])) return $attr;
$length = $this->confiscateAttr($attr, $this->name);
if(ctype_digit($length)) $length .= 'px';
$this->prependCSS($attr, $this->cssName . ":$length;");
return $attr;
}
}
// vim: et sw=4 sts=4