本文整理汇总了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';