| 1 | <?php |
||
| 9 | class CWhitelist |
||
| 10 | { |
||
| 11 | /** |
||
| 12 | * Array to contain the whitelist options. |
||
| 13 | */ |
||
| 14 | private $whitelist = array(); |
||
| 15 | |||
| 16 | |||
| 17 | |||
| 18 | /** |
||
| 19 | * Set the whitelist from an array of strings, each item in the |
||
| 20 | * whitelist should be a regexp without the surrounding / or #. |
||
| 21 | * |
||
| 22 | * @param array $whitelist with all valid options, |
||
| 23 | * default is to clear the whitelist. |
||
| 24 | 6 | * |
|
| 25 | * @return $this |
||
| 26 | 6 | */ |
|
| 27 | 1 | public function set($whitelist = array()) |
|
| 36 | |||
| 37 | |||
| 38 | |||
| 39 | /** |
||
| 40 | * Check if item exists in the whitelist. |
||
| 41 | * |
||
| 42 | * @param string $item string to check. |
||
| 43 | * @param array $whitelist optional with all valid options, default is null. |
||
| 44 | 5 | * |
|
| 45 | * @return boolean true if item is in whitelist, else false. |
||
| 46 | 5 | */ |
|
| 47 | 2 | public function check($item, $whitelist = null) |
|
| 65 | } |
||
| 66 |