More linting with PHPDoc comments
This commit is contained in:
parent
bd0310a699
commit
d0b0c7f93d
2 changed files with 28 additions and 15 deletions
|
@ -266,12 +266,14 @@ interface CacheEngine {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $key
|
* @param string $key
|
||||||
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function get($key);
|
public function get($key);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $key
|
* @param string $key
|
||||||
*
|
* @param mixed $val
|
||||||
|
* @param integer $time
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function set($key, $val, $time=0);
|
public function set($key, $val, $time=0);
|
||||||
|
@ -345,7 +347,7 @@ class MemcacheCache implements CacheEngine {
|
||||||
/**
|
/**
|
||||||
* @param string $key
|
* @param string $key
|
||||||
* @param mixed $val
|
* @param mixed $val
|
||||||
* @param int $time
|
* @param integer $time
|
||||||
*/
|
*/
|
||||||
public function set($key, $val, $time=0) {
|
public function set($key, $val, $time=0) {
|
||||||
assert('!is_null($key)');
|
assert('!is_null($key)');
|
||||||
|
@ -422,6 +424,10 @@ class Database {
|
||||||
* @var null|PDO
|
* @var null|PDO
|
||||||
*/
|
*/
|
||||||
private $db = null;
|
private $db = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var float
|
||||||
|
*/
|
||||||
public $dbtime = 0.0;
|
public $dbtime = 0.0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -8,7 +8,7 @@ require_once "lib/context.php";
|
||||||
/**
|
/**
|
||||||
* Make some data safe for printing into HTML
|
* Make some data safe for printing into HTML
|
||||||
*
|
*
|
||||||
* @param $input
|
* @param string $input
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function html_escape($input) {
|
function html_escape($input) {
|
||||||
|
@ -18,7 +18,7 @@ function html_escape($input) {
|
||||||
/**
|
/**
|
||||||
* Unescape data that was made safe for printing into HTML
|
* Unescape data that was made safe for printing into HTML
|
||||||
*
|
*
|
||||||
* @param $input
|
* @param string $input
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function html_unescape($input) {
|
function html_unescape($input) {
|
||||||
|
@ -28,7 +28,7 @@ function html_unescape($input) {
|
||||||
/**
|
/**
|
||||||
* Make sure some data is safe to be used in integer context
|
* Make sure some data is safe to be used in integer context
|
||||||
*
|
*
|
||||||
* @param $input
|
* @param string $input
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
function int_escape($input) {
|
function int_escape($input) {
|
||||||
|
@ -42,7 +42,7 @@ function int_escape($input) {
|
||||||
/**
|
/**
|
||||||
* Make sure some data is safe to be used in URL context
|
* Make sure some data is safe to be used in URL context
|
||||||
*
|
*
|
||||||
* @param $input
|
* @param string $input
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function url_escape($input) {
|
function url_escape($input) {
|
||||||
|
@ -77,7 +77,7 @@ function url_escape($input) {
|
||||||
/**
|
/**
|
||||||
* Make sure some data is safe to be used in SQL context
|
* Make sure some data is safe to be used in SQL context
|
||||||
*
|
*
|
||||||
* @param $input
|
* @param string $input
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function sql_escape($input) {
|
function sql_escape($input) {
|
||||||
|
@ -125,7 +125,7 @@ function bool_escape($input) {
|
||||||
* Some functions require a callback function for escaping,
|
* Some functions require a callback function for escaping,
|
||||||
* but we might not want to alter the data
|
* but we might not want to alter the data
|
||||||
*
|
*
|
||||||
* @param $input
|
* @param string $input
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function no_escape($input) {
|
function no_escape($input) {
|
||||||
|
@ -202,7 +202,7 @@ function truncate($string, $limit, $break=" ", $pad="...") {
|
||||||
/**
|
/**
|
||||||
* Turn a human readable filesize into an integer, eg 1KB -> 1024
|
* Turn a human readable filesize into an integer, eg 1KB -> 1024
|
||||||
*
|
*
|
||||||
* @param $limit
|
* @param string|integer $limit
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
function parse_shorthand_int($limit) {
|
function parse_shorthand_int($limit) {
|
||||||
|
@ -232,7 +232,7 @@ function parse_shorthand_int($limit) {
|
||||||
/**
|
/**
|
||||||
* Turn an integer into a human readable filesize, eg 1024 -> 1KB
|
* Turn an integer into a human readable filesize, eg 1024 -> 1KB
|
||||||
*
|
*
|
||||||
* @param $int
|
* @param integer $int
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function to_shorthand_int($int) {
|
function to_shorthand_int($int) {
|
||||||
|
@ -254,7 +254,7 @@ function to_shorthand_int($int) {
|
||||||
/**
|
/**
|
||||||
* Turn a date into a time, a date, an "X minutes ago...", etc
|
* Turn a date into a time, a date, an "X minutes ago...", etc
|
||||||
*
|
*
|
||||||
* @param $date
|
* @param string $date
|
||||||
* @param bool $html
|
* @param bool $html
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
|
@ -267,7 +267,7 @@ function autodate($date, $html=true) {
|
||||||
/**
|
/**
|
||||||
* Check if a given string is a valid date-time. ( Format: yyyy-mm-dd hh:mm:ss )
|
* Check if a given string is a valid date-time. ( Format: yyyy-mm-dd hh:mm:ss )
|
||||||
*
|
*
|
||||||
* @param $dateTime
|
* @param string $dateTime
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
function isValidDateTime($dateTime) {
|
function isValidDateTime($dateTime) {
|
||||||
|
@ -283,7 +283,7 @@ function isValidDateTime($dateTime) {
|
||||||
/**
|
/**
|
||||||
* Check if a given string is a valid date. ( Format: yyyy-mm-dd )
|
* Check if a given string is a valid date. ( Format: yyyy-mm-dd )
|
||||||
*
|
*
|
||||||
* @param $date
|
* @param string $date
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
function isValidDate($date) {
|
function isValidDate($date) {
|
||||||
|
@ -297,6 +297,9 @@ function isValidDate($date) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string[] $inputs
|
||||||
|
*/
|
||||||
function validate_input($inputs) {
|
function validate_input($inputs) {
|
||||||
$outputs = array();
|
$outputs = array();
|
||||||
|
|
||||||
|
@ -391,8 +394,8 @@ function validate_input($inputs) {
|
||||||
*
|
*
|
||||||
* FIXME: also check that IP ban ext is installed
|
* FIXME: also check that IP ban ext is installed
|
||||||
*
|
*
|
||||||
* @param $ip
|
* @param string $ip
|
||||||
* @param $ban_reason
|
* @param string $ban_reason
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function show_ip($ip, $ban_reason) {
|
function show_ip($ip, $ban_reason) {
|
||||||
|
@ -616,6 +619,7 @@ function zglob($pattern) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets contact link as mailto: or http:
|
* Gets contact link as mailto: or http:
|
||||||
|
* @return string
|
||||||
*/
|
*/
|
||||||
function contact_link() {
|
function contact_link() {
|
||||||
global $config;
|
global $config;
|
||||||
|
@ -1734,6 +1738,9 @@ function _get_user() {
|
||||||
return $user;
|
return $user;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
function _get_query() {
|
function _get_query() {
|
||||||
return @$_POST["q"]?:@$_GET["q"];
|
return @$_POST["q"]?:@$_GET["q"];
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue