ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
HTMLPurifier_AttrTransform_SafeParam Class Reference

Validates name/value pairs in param tags to be used in safe objects. More...

+ Inheritance diagram for HTMLPurifier_AttrTransform_SafeParam:
+ Collaboration diagram for HTMLPurifier_AttrTransform_SafeParam:

Public Member Functions

 __construct ()
 
 transform ($attr, $config, $context)
 
- Public Member Functions inherited from HTMLPurifier_AttrTransform
 transform ($attr, $config, $context)
 Abstract: makes changes to the attributes dependent on multiple values. More...
 
 prependCSS (&$attr, $css)
 Prepends CSS properties to the style attribute, creating the attribute if it doesn't exist. More...
 
 confiscateAttr (&$attr, $key)
 Retrieves and removes an attribute. More...
 

Data Fields

 $name = "SafeParam"
 string More...
 

Private Attributes

 $uri
 HTMLPurifier_AttrDef_URI More...
 

Detailed Description

Validates name/value pairs in param tags to be used in safe objects.

This will only allow name values it recognizes, and pre-fill certain attributes with required values.

Note
This class only supports Flash. In the future, Quicktime support may be added.
Warning
This class expects an injector to add the necessary parameters tags.

Definition at line 15 of file SafeParam.php.

Constructor & Destructor Documentation

◆ __construct()

HTMLPurifier_AttrTransform_SafeParam::__construct ( )

Definition at line 27 of file SafeParam.php.

References array.

28  {
29  $this->uri = new HTMLPurifier_AttrDef_URI(true); // embedded
30  $this->wmode = new HTMLPurifier_AttrDef_Enum(array('window', 'opaque', 'transparent'));
31  }
Create styles array
The data for the language used.
Validates a keyword against a list of valid values.
Definition: Enum.php:10
Validates a URI as defined by RFC 3986.
Definition: URI.php:7

Member Function Documentation

◆ transform()

HTMLPurifier_AttrTransform_SafeParam::transform (   $attr,
  $config,
  $context 
)
Parameters
array$attr
HTMLPurifier_Config$config
HTMLPurifier_Context$context
Returns
array

Definition at line 39 of file SafeParam.php.

References $config.

40  {
41  // If we add support for other objects, we'll need to alter the
42  // transforms.
43  switch ($attr['name']) {
44  // application/x-shockwave-flash
45  // Keep this synchronized with Injector/SafeObject.php
46  case 'allowScriptAccess':
47  $attr['value'] = 'never';
48  break;
49  case 'allowNetworking':
50  $attr['value'] = 'internal';
51  break;
52  case 'allowFullScreen':
53  if ($config->get('HTML.FlashAllowFullScreen')) {
54  $attr['value'] = ($attr['value'] == 'true') ? 'true' : 'false';
55  } else {
56  $attr['value'] = 'false';
57  }
58  break;
59  case 'wmode':
60  $attr['value'] = $this->wmode->validate($attr['value'], $config, $context);
61  break;
62  case 'movie':
63  case 'src':
64  $attr['name'] = "movie";
65  $attr['value'] = $this->uri->validate($attr['value'], $config, $context);
66  break;
67  case 'flashvars':
68  // we're going to allow arbitrary inputs to the SWF, on
69  // the reasoning that it could only hack the SWF, not us.
70  break;
71  // add other cases to support other param name/value pairs
72  default:
73  $attr['name'] = $attr['value'] = null;
74  }
75  return $attr;
76  }

Field Documentation

◆ $name

HTMLPurifier_AttrTransform_SafeParam::$name = "SafeParam"

string

Definition at line 20 of file SafeParam.php.

◆ $uri

HTMLPurifier_AttrTransform_SafeParam::$uri
private

HTMLPurifier_AttrDef_URI

Definition at line 25 of file SafeParam.php.


The documentation for this class was generated from the following file: