本文整理匯總了PHP中Sanitize::text方法的典型用法代碼示例。如果您正苦於以下問題:PHP Sanitize::text方法的具體用法?PHP Sanitize::text怎麽用?PHP Sanitize::text使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Sanitize
的用法示例。
在下文中一共展示了Sanitize::text方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: __construct
public function __construct($entityID = "", $full = false)
{
// Prepare Variables
$this->class = get_called_class();
$this->id = $entityID ? Sanitize::text($entityID) : "_" . Security_Hash::value(microtime(), 12);
// Attempt to retrieve this object
if (!($data = Database::selectValue("SELECT `data` FROM `entity_" . $this->class . "` WHERE `id`=? LIMIT 1", [$this->id]))) {
$data = '[]';
if (!Database::query("INSERT INTO `entity_" . $this->class . "` (id, data) VALUES (?, ?)", [$this->id, json_encode([])])) {
// Create the table if it doesn't exist
Database::exec("\n\t\t\t\tCREATE TABLE IF NOT EXISTS `entity_" . $this->class . "`\n\t\t\t\t(\n\t\t\t\t\t`id`\t\t\t\tvarchar(32)\t\t\t\t\tNOT NULL\tDEFAULT '',\n\t\t\t\t\t`data`\t\t\t\ttext\t\t\t\t\t\tNOT NULL\tDEFAULT '',\n\t\t\t\t\t\n\t\t\t\t\tUNIQUE (`id`)\n\t\t\t\t) ENGINE=InnoDB DEFAULT CHARSET=utf8 PARTITION BY KEY (`id`) PARTITIONS 7;");
Database::query("INSERT INTO `entity_" . $entityClass . "` (id, data) VALUES (?, ?)", [$this->id, $data]);
}
}
$this->data = json_decode($data, true);
$this->data['id'] = $this->id;
// If the object is supposed to retrieve all objects
if ($full) {
// Get all of the entity's relationships
$results = Database::selectMultiple("SELECT attribute, related_id FROM `entity_relationships` WHERE entity_class=? AND entity_id=?", [$class, $entityID]);
foreach ($results as $result) {
$this->data[$result['attribute']][] = $result['related_id'];
}
}
}
示例2: time
}
if (!isset($_POST['date_start'])) {
$_POST['date_start'] = time();
}
if (!isset($_POST['date_end'])) {
$_POST['date_end'] = 10;
}
// Sanitize Values
$_POST['title'] = Sanitize::safeword($_POST['title']);
$_POST['method'] = Sanitize::variable($_POST['method']);
$_POST['run_cycle'] = Sanitize::number($_POST['run_cycle'], 0);
$_POST['date_start'] = Sanitize::number($_POST['date_start'], 0);
$_POST['date_end'] = Sanitize::number($_POST['date_end'], 0);
// Sanitize Parameters
for ($a = 0; $a <= 3; $a++) {
$_POST['args'][$a] = isset($_POST['args'][$a]) ? Sanitize::text($_POST['args'][$a]) : "";
}
}
// Run Header
require SYS_PATH . "/controller/includes/admin_header.php";
// Get Navigation Entry
echo '
<h2 style="margin-top:20px;">' . ($editID ? 'Edit' : 'Create New') . ' Cron Task</h2>
<form class="uniform" action="/admin/cron/custom-task" method="post">' . Form::prepare("cron-custom") . '
<p>Title: <input type="text" name="title" value="' . $_POST['title'] . '" maxlength="22" /> (only useful to humans)</p>
<p>Method: <input type="text" name="method" value="' . $_POST['method'] . '" maxlength="22" /> (the MyTasks:: or Task:: method to call)</p>
<p>Parameters:
<br /><input type="text" name="args[0]" value="' . htmlspecialchars($_POST['args'][0]) . '" maxlength="250" /> (leave empty for unused)
<br /><input type="text" name="args[1]" value="' . htmlspecialchars($_POST['args'][1]) . '" maxlength="250" /> (leave empty for unused)
<br /><input type="text" name="args[2]" value="' . htmlspecialchars($_POST['args'][2]) . '" maxlength="250" /> (leave empty for unused)
示例3: array
<h1>Installation: Site Configuration</h1>
<h3>Step #1 - Update Configuration</h3>
<p>This configuration file applies to the application that you\'re currently installing.</p>
<p>You can locate the config.php file here: ' . SITE_PATH . '/config.php</p>
<h4>Option #1a: Automatic Update</h4>
<p>If you want the engine to automatically update the configuration file for your application, just press the "Update Automatically" button. Standard users that don\'t need any server-specific customization should use this option.</p>
<p><input type="submit" name="asd-submit" value="Update Automatically" /></p>
<h4>Option #1b: Manual Update</h4>
<p>Advanced users might want to set the configuration file for the application manually. To do this, open the config.php file for the application. You can base your configurations off of the values provided in the textbox below.</p>
<p>
<textarea style="width:100%; height:250px; tab-size:4; -moz-tab-size:4; -ms-tab-size:4; -webkit-tab-size:4;">' . $buildApp . '</textarea>
</p>
<p>You can find the config.php file in : ' . SITE_PATH . '/config.php</p>
<p><input type="submit" name="manual-submit" value="I have updated the file manually" /></p>
';
// Provide hidden post values
$pList = array('site-salt', 'site-handle', 'site-url', 'site-name', 'site-domain', 'site-database-name');
foreach ($pList as $pName) {
$pName = Sanitize::variable($pName, "-");
echo '
<input type="hidden" name="' . $pName . '" value="' . htmlspecialchars(Sanitize::text($_POST[$pName])) . '" />';
}
}
echo '
</form>';
// Display the Footer
require FOOTER_PATH;