HTMLPurifier_Config::getBatch PHP Method

getBatch() public method

Retrieves an array of directives to values from a given namespace
public getBatch ( string $namespace ) : array
$namespace string String namespace
return array
    public function getBatch($namespace)
    {
        if (!$this->finalized) {
            $this->autoFinalize();
        }
        $full = $this->getAll();
        if (!isset($full[$namespace])) {
            $this->triggerError('Cannot retrieve undefined namespace ' . htmlspecialchars($namespace), E_USER_WARNING);
            return;
        }
        return $full[$namespace];
    }

Usage Example

Example #1
0
 public function test_getBatch()
 {
     $this->schema->add('Variables.TangentialAcceleration', 'a_tan', 'string', false);
     $this->schema->add('Variables.AngularAcceleration', 'alpha', 'string', false);
     $config = new HTMLPurifier_Config($this->schema);
     $config->autoFinalize = false;
     $config->chatty = false;
     // grab a namespace
     $this->assertIdentical($config->getBatch('Variables'), array('TangentialAcceleration' => 'a_tan', 'AngularAcceleration' => 'alpha'));
     // grab a non-existant namespace
     $this->expectError('Cannot retrieve undefined namespace Constants');
     $config->getBatch('Constants');
 }