public function setup($config) { $newObject = HTMLPurifier_ElementDef::create(null, null, array('type' => 'Enum#application/x-shockwave-flash,image/svg+xml', 'width' => 'Length#1280', 'height' => 'Length#1920')); parent::setup($config); $object =& $this->info['object']; $object->mergeIn($newObject); $param =& $this->info['param']; $param->attr_transform_post[count($param->attr_transform_post) - 1] = new OC_HTMLPurifier_AttrTransform_SafeParam(); unset($this->info_injector[count($this->info_injector) - 1]); $this->info_injector[] = new OC_HTMLPurifier_Injector_SafeObject(); }
/** * Convenience function that sets up a new element * * @param $element Name of element to add * @param $type What content set should element be registered to? * Set as false to skip this step. * @param $contents Allowed children in form of: * "$content_model_type: $content_model" * @param $attr_includes What attribute collections to register to * element? * @param $attr What unique attributes does the element define? * * @note See ElementDef for in-depth descriptions of these parameters. * @return Created element definition object, so you * can set advanced parameters */ public function addElement($element, $type, $contents, $attr_includes = array(), $attr = array()) { $this->elements[] = $element; // parse content_model list($content_model_type, $content_model) = $this->parseContents($contents); // merge in attribute inclusions $this->mergeInAttrIncludes($attr, $attr_includes); // add element to content sets if ($type) { $this->addElementToContentSet($element, $type); } // create element $this->info[$element] = HTMLPurifier_ElementDef::create($content_model, $content_model_type, $attr); // literal object $contents means direct child manipulation if (!is_string($contents)) { $this->info[$element]->child = $contents; } return $this->info[$element]; }
public function addElement($element, $type, $contents, $attr_includes = array(), $attr = array()) { $this->elements[] = $element; list($content_model_type, $content_model) = $this->parseContents($contents); $this->mergeInAttrIncludes($attr, $attr_includes); if ($type) { $this->addElementToContentSet($element, $type); } $this->info[$element] = HTMLPurifier_ElementDef::create($content_model, $content_model_type, $attr); if (!is_string($contents)) { $this->info[$element]->child = $contents; } return $this->info[$element]; }