Lines Matching full:hash
77 * Builds an interchange object based on a hash.
79 * @param HTMLPurifier_StringHash $hash source data
82 public function build($interchange, $hash) argument
84 if (!$hash instanceof HTMLPurifier_StringHash) {
85 $hash = new HTMLPurifier_StringHash($hash);
87 if (!isset($hash['ID'])) {
88 throw new HTMLPurifier_ConfigSchema_Exception('Hash does not have any ID');
90 if (strpos($hash['ID'], '.') === false) {
91 if (count($hash) == 2 && isset($hash['DESCRIPTION'])) {
92 $hash->offsetGet('DESCRIPTION'); // prevent complaining
97 $this->buildDirective($interchange, $hash);
99 $this->_findUnused($hash);
104 * @param HTMLPurifier_StringHash $hash
107 public function buildDirective($interchange, $hash) argument
112 $directive->id = $this->id($hash->offsetGet('ID'));
115 if (isset($hash['TYPE'])) {
116 $type = explode('/', $hash->offsetGet('TYPE'));
122 … throw new HTMLPurifier_ConfigSchema_Exception("TYPE in directive hash '$id' not defined");
125 if (isset($hash['DEFAULT'])) {
128 $hash->offsetGet('DEFAULT'),
133 … new HTMLPurifier_ConfigSchema_Exception($e->getMessage() . " in DEFAULT in directive hash '$id'");
137 if (isset($hash['DESCRIPTION'])) {
138 $directive->description = $hash->offsetGet('DESCRIPTION');
141 if (isset($hash['ALLOWED'])) {
142 $directive->allowed = $this->lookup($this->evalArray($hash->offsetGet('ALLOWED')));
145 if (isset($hash['VALUE-ALIASES'])) {
146 $directive->valueAliases = $this->evalArray($hash->offsetGet('VALUE-ALIASES'));
149 if (isset($hash['ALIASES'])) {
150 $raw_aliases = trim($hash->offsetGet('ALIASES'));
157 if (isset($hash['VERSION'])) {
158 $directive->version = $hash->offsetGet('VERSION');
161 if (isset($hash['DEPRECATED-USE'])) {
162 $directive->deprecatedUse = $this->id($hash->offsetGet('DEPRECATED-USE'));
165 if (isset($hash['DEPRECATED-VERSION'])) {
166 $directive->deprecatedVersion = $hash->offsetGet('DEPRECATED-VERSION');
169 if (isset($hash['EXTERNAL'])) {
170 $directive->external = preg_split('/\s*,\s*/', trim($hash->offsetGet('EXTERNAL')));
211 * Triggers errors for any unused keys passed in the hash; such keys
213 * @param HTMLPurifier_StringHash $hash Hash to check.
215 protected function _findUnused($hash) argument
217 $accessed = $hash->getAccessed();
218 foreach ($hash as $k => $v) {
220 trigger_error("String hash key '$k' not used by builder", E_USER_NOTICE);