ILIAS  Release_4_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilHtmlPurifierComposite.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 require_once 'Services/Html/interfaces/interface.ilHtmlPurifierInterface.php';
5 
14 {
23  protected $purifiers = array();
24 
33  public function addPurifier(ilHtmlPurifierInterface $a_purifier)
34  {
35  $key = array_search($a_purifier, $this->purifiers);
36  if(false === $key)
37  {
38  $this->purifiers[] = $a_purifier;
39  return true;
40  }
41 
42  return false;
43  }
44 
53  public function removePurifier(ilHtmlPurifierInterface $a_purifier)
54  {
55  $key = array_search($a_purifier, $this->purifiers);
56  if(false === $key)
57  {
58  return false;
59  }
60  unset($this->purifiers[$key]);
61 
62  return true;
63  }
64 
73  public function purify($a_html)
74  {
75  foreach($this->purifiers as $oPurifier)
76  {
77  $a_html = $oPurifier->purify($a_html);
78  }
79 
80  return $a_html;
81  }
82 
91  public function purifyArray(Array $a_array_of_html)
92  {
93  foreach($a_array_of_html as $key => $html)
94  {
95  foreach($this->purifiers as $oPurifier)
96  {
97  $html = $oPurifier->purify($html);
98  }
99 
100  $a_array_of_html[$key] = $html;
101  }
102 
103  return $a_array_of_html;
104  }
105 }
106 ?>