本文整理汇总了PHP中HTMLPurifier_Config::loadIni方法的典型用法代码示例。如果您正苦于以下问题:PHP HTMLPurifier_Config::loadIni方法的具体用法?PHP HTMLPurifier_Config::loadIni怎么用?PHP HTMLPurifier_Config::loadIni使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTMLPurifier_Config
的用法示例。
在下文中一共展示了HTMLPurifier_Config::loadIni方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: create
/**
* @param string|array|HTMLPurifier_Config $config
* @param HTMLPurifier_ConfigSchema $schema
* @return HTMLPurifier_Config
*/
public static function create($config = null, HTMLPurifier_ConfigSchema $schema = null)
{
if (!$schema instanceof HTMLPurifier_ConfigSchema) {
$schema = HTMLPurifier_ConfigSchema::makeFromSerial();
}
if ($config instanceof HTMLPurifier_Config) {
$configObj = $config;
} else {
$configObj = new HTMLPurifier_Config($schema);
$configObj->set('Core.Encoding', 'UTF-8');
$configObj->set('HTML.Doctype', 'HTML 4.01 Transitional');
if (is_string($config)) {
$configObj->loadIni($config);
} elseif (is_array($config)) {
$configObj->loadArray($config);
}
}
$def = $configObj->getHTMLDefinition(true);
// this finalizes config
HTMLPurifier_HTML5Definition::setup($def);
return $configObj;
}
示例2: create
/**
* Convenience constructor that creates a config object based on a mixed var
* @param mixed $config Variable that defines the state of the config
* object. Can be: a HTMLPurifier_Config() object,
* an array of directives based on loadArray(),
* or a string filename of an ini file.
* @param HTMLPurifier_ConfigSchema $schema Schema object
* @return HTMLPurifier_Config Configured object
*/
public static function create($config, $schema = null)
{
if ($config instanceof HTMLPurifier_Config) {
// pass-through
return $config;
}
if (!$schema) {
$ret = HTMLPurifier_Config::createDefault();
} else {
$ret = new HTMLPurifier_Config($schema);
}
if (is_string($config)) {
$ret->loadIni($config);
} elseif (is_array($config)) {
$ret->loadArray($config);
}
return $ret;
}
示例3: test_finalize
public function test_finalize()
{
// test finalization
$this->schema->add('Poem.Meter', 'iambic', 'string', false);
$config = new HTMLPurifier_Config($this->schema);
$config->autoFinalize = false;
$config->chatty = false;
$config->set('Poem.Meter', 'irregular');
$config->finalize();
$this->expectError('Cannot set directive after finalization');
$config->set('Poem.Meter', 'vedic');
$this->expectError('Cannot load directives after finalization');
$config->loadArray(array('Poem.Meter' => 'octosyllable'));
$this->expectError('Cannot load directives after finalization');
$config->loadIni(dirname(__FILE__) . '/ConfigTest-finalize.ini');
}