本文整理汇总了PHP中Filter::filterString方法的典型用法代码示例。如果您正苦于以下问题:PHP Filter::filterString方法的具体用法?PHP Filter::filterString怎么用?PHP Filter::filterString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Filter
的用法示例。
在下文中一共展示了Filter::filterString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testFilterString
public function testFilterString()
{
$this->assertEquals(Filter::filterString(' <b><?php echo "biber"; ?></b>what? '), 'what?');
}
示例2: getTrailByTrailUuid
public static function getTrailByTrailUuid(PDO &$pdo, $trailUuid)
{
//sanitize the trailUuid before searching
try {
$trailUuid = Filter::filterString($trailUuid, "trailUuid");
} catch (InvalidArgumentException $invalidArgument) {
throw new PDOException($invalidArgument->getMessage(), 0, $invalidArgument);
} catch (RangeException $range) {
throw new PDOException($range->getMessage(), 0, $range);
} catch (Exception $exception) {
throw new PDOException($exception->getMessage(), 0, $exception);
}
//create query template
$query = "SELECT trailId, userId, browser, createDate, ipAddress, submitTrailId, trailAmenities, trailCondition,trailDescription, trailDifficulty, trailDistance, trailName, trailSubmissionType,\ntrailTerrain, trailTraffic, trailUse, trailUuid FROM trail WHERE trailUuid = :trailUuid";
$statement = $pdo->prepare($query);
//bind trailUuid to placeholder
$parameters = array("trailUuid" => $trailUuid);
$statement->execute($parameters);
//build an array of trails
$trails = new SplFixedArray($statement->rowCount());
$statement->setFetchMode(PDO::FETCH_ASSOC);
while (($row = $statement->fetch()) !== false) {
try {
//new trail ($trailId, $userId, $submitTrailId, $browser, $createDate, $ipAddress, $trailAccessibility, $trailAmenities, $trailCondition,$trailDescription, $trailDifficulty, $trailDistance, $trailSubmissionType,$trailTerrain, $trailName, $trailTraffic, $trailUse, $trailUuId)
$trail = new Trail($row["trailId"], $row["userId"], $row["browser"], $row["createDate"], $row["ipAddress"], $row["submitTrailId"], $row["trailAmenities"], $row["trailCondition"], $row["trailDescription"], $row["trailDifficulty"], $row["trailDistance"], $row["trailName"], $row["trailSubmissionType"], $row["trailTerrain"], $row["trailTraffic"], $row["trailUse"], $row["trailUuid"]);
$trails[$trails->key()] = $trail;
$trails->next();
} catch (Exception $e) {
//if the row couldn't be converted, rethrow it
throw new PDOException($e->getMessage(), 0, $e);
}
}
return $trails;
}
示例3: viewDbAction
public function viewDbAction()
{
$serverId = Request::post('server_id', 'pagecode', '');
if (!strlen($serverId)) {
Response::jsonError($this->_lang->WRONG_REQUEST);
}
$serverDir = $this->_deployConfig->get('datadir') . $serverId . '/';
$info = array();
$date = '---';
if (file_exists($serverDir . 'lastfsupdate')) {
$date = Filter::filterString(@file_get_contents($serverDir . 'lastdbupdate'));
}
if (file_exists($serverDir . 'db.php')) {
$info = (include $serverDir . 'db.php');
}
$data = array('info' => $info, 'date' => $date);
Response::jsonSuccess($data);
}