本文整理汇总了PHP中HTMLPurifier_Config::loadArrayFromForm方法的典型用法代码示例。如果您正苦于以下问题:PHP HTMLPurifier_Config::loadArrayFromForm方法的具体用法?PHP HTMLPurifier_Config::loadArrayFromForm怎么用?PHP HTMLPurifier_Config::loadArrayFromForm使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTMLPurifier_Config
的用法示例。
在下文中一共展示了HTMLPurifier_Config::loadArrayFromForm方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: test_loadArrayFromForm
public function test_loadArrayFromForm()
{
$this->schema->add('Pancake.Mix', 'buttermilk', 'string', false);
$this->schema->add('Pancake.Served', true, 'bool', false);
$this->schema->add('Toppings.Syrup', true, 'bool', false);
$this->schema->add('Toppings.Flavor', 'maple', 'string', false);
$this->schema->add('Toppings.Strawberries', 3, 'int', false);
$this->schema->add('Toppings.Calories', 2000, 'int', true);
$this->schema->add('Toppings.DefinitionID', null, 'string', true);
$this->schema->add('Toppings.DefinitionRev', 1, 'int', false);
$this->schema->add('Toppings.Protected', 1, 'int', false);
$get = array('breakfast' => array('Pancake.Mix' => 'nasty', 'Pancake.Served' => '0', 'Toppings.Syrup' => '0', 'Toppings.Flavor' => "juice", 'Toppings.Strawberries' => '999', 'Toppings.Calories' => '', 'Null_Toppings.Calories' => '1', 'Toppings.DefinitionID' => '<argh>', 'Toppings.DefinitionRev' => '65', 'Toppings.Protected' => '4'));
$config_expect = HTMLPurifier_Config::create(array('Pancake.Served' => false, 'Toppings.Syrup' => false, 'Toppings.Flavor' => "juice", 'Toppings.Strawberries' => 999, 'Toppings.Calories' => null), $this->schema);
$config_result = HTMLPurifier_Config::loadArrayFromForm($get, 'breakfast', array('Pancake.Served', 'Toppings', '-Toppings.Protected'), false, $this->schema);
$this->assertEqual($config_expect, $config_result);
/*
MAGIC QUOTES NOT TESTED!!!
$get = array(
'breakfast' => array(
'Pancake.Mix' => 'n\\asty'
)
);
$config_expect = HTMLPurifier_Config::create(array(
'Pancake.Mix' => 'n\\asty'
));
$config_result = HTMLPurifier_Config::loadArrayFromForm($get, 'breakfast', true, false);
$this->assertEqual($config_expect, $config_result);
*/
}
示例2: HTMLPurifier_ConfigSchema_Builder_ConfigSchema
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>HTML Purifier Config Form Smoketest</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" href="../library/HTMLPurifier/Printer/ConfigForm.css" type="text/css" />
<script defer="defer" type="text/javascript" src="../library/HTMLPurifier/Printer/ConfigForm.js"></script>
</head>
<body>
<h1>HTML Purifier Config Form Smoketest</h1>
<p>This file outputs the configuration form for every single type
of directive possible.</p>
<form id="htmlpurifier-config" name="htmlpurifier-config" method="get" action=""
style="float:right;">
<?php
$schema_builder = new HTMLPurifier_ConfigSchema_Builder_ConfigSchema();
$schema = $schema_builder->build($interchange);
$config = HTMLPurifier_Config::loadArrayFromForm($_GET, 'config', true, true, $schema);
$printer = new HTMLPurifier_Printer_ConfigForm('config', '?doc#%s');
echo $printer->render(array(HTMLPurifier_Config::createDefault(), $config));
?>
</form>
<pre>
<?php
echo htmlspecialchars(var_export($config->getAll(), true));
?>
</pre>
</body>
</html>
<?php
// vim: et sw=4 sts=4
示例3: htmlspecialchars
<head>
<title>HTML Purifier Config Form Smoketest</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" href="../library/HTMLPurifier/Printer/ConfigForm.css" type="text/css" />
<script defer="defer" type="text/javascript" src="../library/HTMLPurifier/Printer/ConfigForm.js"></script>
</head>
<body>
<h1>HTML Purifier Config Form Smoketest</h1>
<p>This file outputs the configuration form for every single type
of directive possible.</p>
<form id="htmlpurifier-config" name="htmlpurifier-config" method="get" action=""
style="float:right;">
<?php
require_once 'HTMLPurifier/Printer/ConfigForm.php';
// fictional set, attempts to cover every possible data-type
// see source at ConfigTest.php
require_once 'testSchema.php';
// cleanup ( this should be rolled into Config )
$config = HTMLPurifier_Config::loadArrayFromForm($_GET, 'config');
$printer = new HTMLPurifier_Printer_ConfigForm('config', '?doc#%s');
echo $printer->render($config);
?>
</form>
<pre>
<?php
echo htmlspecialchars(print_r($config->getAll(), true));
?>
</pre>
</body>
</html>