HTMLPurifier/Strategy/ValidateAttributes.php Quellcode

ValidateAttributes.php
gehe zur Dokumentation dieser Datei
1 <?php
2 
8 {
9 
16  public function execute($tokens, $config, $context)
17  {
18  // setup validator
19  $validator = new HTMLPurifier_AttrValidator();
20 
21  $token = false;
22  $context->register('CurrentToken', $token);
23 
24  foreach ($tokens as $key => $token) {
25 
26  // only process tokens that have attributes,
27  // namely start and empty tags
28  if (!$token instanceof HTMLPurifier_Token_Start && !$token instanceof HTMLPurifier_Token_Empty) {
29  continue;
30  }
31 
32  // skip tokens that are armored
33  if (!empty($token->armor['ValidateAttributes'])) {
34  continue;
35  }
36 
37  // note that we have no facilities here for removing tokens
38  $validator->validateToken($token, $config, $context);
39  }
40  $context->destroy('CurrentToken');
41  return $tokens;
42  }
43 }
44 
45 // vim: et sw=4 sts=4




Korrekturen, Hinweise und Ergänzungen

Bitte scheuen Sie sich nicht und melden Sie, was auf dieser Seite sachlich falsch oder irreführend ist, was ergänzt werden sollte, was fehlt usw. Dazu bitte oben aus dem Menü Seite den Eintrag Support Forum wählen. Es ist eine kostenlose Anmeldung erforderlich, um Anmerkungen zu posten. Unpassende Postings, Spam usw. werden kommentarlos entfernt.