| @@ 11-24 (lines=14) @@ | ||
| 8 | * @param HTMLPurifier_Config $config |
|
| 9 | * @return int|bool |
|
| 10 | */ |
|
| 11 | public function add($def, $config) |
|
| 12 | { |
|
| 13 | if (!$this->checkDefType($def)) { |
|
| 14 | return null; |
|
| 15 | } |
|
| 16 | $file = $this->generateFilePath($config); |
|
| 17 | if (file_exists($file)) { |
|
| 18 | return false; |
|
| 19 | } |
|
| 20 | if (!$this->_prepareDir($config)) { |
|
| 21 | return false; |
|
| 22 | } |
|
| 23 | return $this->_write($file, serialize($def), $config); |
|
| 24 | } |
|
| 25 | ||
| 26 | /** |
|
| 27 | * @param HTMLPurifier_Definition $def |
|
| @@ 48-61 (lines=14) @@ | ||
| 45 | * @param HTMLPurifier_Config $config |
|
| 46 | * @return int|bool |
|
| 47 | */ |
|
| 48 | public function replace($def, $config) |
|
| 49 | { |
|
| 50 | if (!$this->checkDefType($def)) { |
|
| 51 | return; |
|
| 52 | } |
|
| 53 | $file = $this->generateFilePath($config); |
|
| 54 | if (!file_exists($file)) { |
|
| 55 | return false; |
|
| 56 | } |
|
| 57 | if (!$this->_prepareDir($config)) { |
|
| 58 | return false; |
|
| 59 | } |
|
| 60 | return $this->_write($file, serialize($def), $config); |
|
| 61 | } |
|
| 62 | ||
| 63 | /** |
|
| 64 | * @param HTMLPurifier_Config $config |
|