本文整理匯總了PHP中Sanitizer::getInstance方法的典型用法代碼示例。如果您正苦於以下問題:PHP Sanitizer::getInstance方法的具體用法?PHP Sanitizer::getInstance怎麽用?PHP Sanitizer::getInstance使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Sanitizer
的用法示例。
在下文中一共展示了Sanitizer::getInstance方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: __construct
public function __construct($state = null)
{
parent::__construct('forgotPasswordForm', 'Reset password');
if ($state == null) {
$this->state = Sanitizer::getInstance()->filterUint('state');
} else {
$this->state = $state;
}
$this->addElement(new ElementHidden('state', null, $this->state));
switch ($this->state) {
case self::STATE_USER_PROVIDE_EMAIL:
$this->constructUserProvideEmail();
break;
case self::STATE_USER_PROVIDE_SECRET:
$this->constructUserProvideSecret();
break;
default:
throw new InvalidArgumentException('Unknown form state: ' . $this->state);
}
$this->addButtons(Form::BTN_SUBMIT);
}
示例2: testGetInstance
/**
* @covers Xoops\Core\Text\Sanitizer::getInstance
*/
public function testGetInstance()
{
$actual = Sanitizer::getInstance();
$this->assertInstanceOf('\\Xoops\\Core\\Text\\Sanitizer', $actual);
$this->assertSame($this->object, $actual);
}
示例3:
<?php
require_once 'includes/widgets/header.php';
$groupId = Sanitizer::getInstance()->filterUint('id');
$sql = 'SELECT g.id, g.title FROM groups g WHERE g.id = :id';
$stmt = DatabaseFactory::getInstance()->prepare($sql);
$stmt->bindValue(':id', $groupId);
$stmt->execute();
$tpl->assign('itemGroup', $stmt->fetchRow());
$sql = 'SELECT u.id, "secondary" as source, u.username FROM group_memberships m LEFT JOIN users u ON m.user = u.id WHERE m.group = :id1 UNION SELECT u.id, "primary" as source, u.username FROM users u WHERE u.group = :id2';
$stmt = DatabaseFactory::getInstance()->prepare($sql);
$stmt->bindValue(':id1', $groupId);
$stmt->bindValue(':id2', $groupId);
$stmt->execute();
$tpl->assign('listMembers', $stmt->fetchAll());
$sql = 'SELECT p.`key`, p.description FROM privileges_g gp LEFT JOIN permissions p ON gp.permission = p.id WHERE gp.group = :gid';
$stmt = DatabaseFactory::getInstance()->prepare($sql);
$stmt->bindValue(':gid', $groupId);
$stmt->execute();
$tpl->assign('listPrivileges', $stmt->fetchAll());
$tpl->display('viewGroup.tpl');
require_once 'includes/widgets/footer.php';