ttrss/classes/handler.php

40 lines
738 B
PHP
Raw Normal View History

2011-12-12 19:32:29 +00:00
<?php
class Handler implements IHandler {
// TODO: class properties can be switched to PHP typing if/when the minimum PHP_VERSION is raised to 7.4.0+
/** @var PDO */
2017-12-01 12:31:16 +00:00
protected $pdo;
/** @var array<int|string, mixed> */
2011-12-12 19:32:29 +00:00
protected $args;
/**
* @param array<int|string, mixed> $args
*/
function __construct(array $args) {
2017-12-01 12:31:16 +00:00
$this->pdo = Db::pdo();
2011-12-12 19:32:29 +00:00
$this->args = $args;
}
function csrf_ignore(string $method): bool {
return false;
2011-12-26 08:02:52 +00:00
}
function before(string $method): bool {
2011-12-12 19:32:29 +00:00
return true;
}
2011-12-12 20:20:53 +00:00
function after(): bool {
2011-12-12 20:20:53 +00:00
return true;
}
/**
* @param mixed $p
*/
protected static function _param_to_bool($p): bool {
if (is_string($p)) {
$p = clean($p);
}
return $p && ($p !== "f" && $p !== "false");
}
}