Fix the PHPDoc comments on these.

This commit is contained in:
jgen 2014-04-25 21:42:52 -04:00
parent 3e899710d7
commit 5f2be45f68

View File

@ -10,6 +10,7 @@ require_once "lib/context.php";
/** /**
* Make some data safe for printing into HTML * Make some data safe for printing into HTML
* *
* @param $input
* @return string * @return string
*/ */
function html_escape($input) { function html_escape($input) {
@ -19,6 +20,7 @@ function html_escape($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
* @return int * @return int
*/ */
function int_escape($input) { function int_escape($input) {
@ -32,6 +34,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
* @return string * @return string
*/ */
function url_escape($input) { function url_escape($input) {
@ -66,6 +69,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
* @return string * @return string
*/ */
function sql_escape($input) { function sql_escape($input) {
@ -77,6 +81,7 @@ function sql_escape($input) {
/** /**
* Turn all manner of HTML / INI / JS / DB booleans into a PHP one * Turn all manner of HTML / INI / JS / DB booleans into a PHP one
* *
* @param $input
* @return boolean * @return boolean
*/ */
function bool_escape($input) { function bool_escape($input) {
@ -112,6 +117,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
* @return string * @return string
*/ */
function no_escape($input) { function no_escape($input) {
@ -156,6 +162,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
* @return int * @return int
*/ */
function parse_shorthand_int($limit) { function parse_shorthand_int($limit) {
@ -185,6 +192,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
* @return string * @return string
*/ */
function to_shorthand_int($int) { function to_shorthand_int($int) {
@ -206,6 +214,8 @@ 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 bool $html
* @return string * @return string
*/ */
function autodate($date, $html=true) { function autodate($date, $html=true) {
@ -217,6 +227,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
* @return boolean * @return boolean
*/ */
function isValidDateTime($dateTime) { function isValidDateTime($dateTime) {
@ -232,6 +243,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
* @return boolean * @return boolean
*/ */
function isValidDate($date) { function isValidDate($date) {
@ -251,6 +263,8 @@ function isValidDate($date) {
* *
* FIXME: also check that IP ban ext is installed * FIXME: also check that IP ban ext is installed
* *
* @param $ip
* @param $ban_reason
* @return string * @return string
*/ */
function show_ip($ip, $ban_reason) { function show_ip($ip, $ban_reason) {
@ -298,6 +312,8 @@ function endsWith(/*string*/ $haystack, /*string*/ $needle) {
* *
* eg make_link("post/list") becomes "/v2/index.php?q=post/list" * eg make_link("post/list") becomes "/v2/index.php?q=post/list"
* *
* @param null $page
* @param null $query
* @return string * @return string
*/ */
function make_link($page=null, $query=null) { function make_link($page=null, $query=null) {
@ -334,6 +350,7 @@ function make_link($page=null, $query=null) {
/** /**
* Take the current URL and modify some paramaters * Take the current URL and modify some paramaters
* *
* @param $changes
* @return string * @return string
*/ */
function modify_current_url($changes) { function modify_current_url($changes) {
@ -375,6 +392,7 @@ function modify_url($url, $changes) {
/** /**
* Turn a relative link into an absolute one, including hostname * Turn a relative link into an absolute one, including hostname
* *
* @param $link
* @return string * @return string
*/ */
function make_http(/*string*/ $link) { function make_http(/*string*/ $link) {
@ -388,11 +406,11 @@ function make_http(/*string*/ $link) {
/** /**
* Make a form tag with relevant auth token and stuff * Make a form tag with relevant auth token and stuff
* *
* @param target string * @param string $target
* @param method string * @param string $method
* @param multipart boolean * @param bool $multipart
* @param form_id string * @param string $form_id
* @param onsubmit string * @param string $onsubmit
* *
* @return string * @return string
*/ */
@ -508,16 +526,18 @@ function captcha_check() {
\* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ \* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/** /**
* Get MIME type for file * Get MIME type for file
* *
* The contents of this function are taken from the __getMimeType() function * The contents of this function are taken from the __getMimeType() function
* from the "Amazon S3 PHP class" which is Copyright (c) 2008, Donovan Schönknecht * from the "Amazon S3 PHP class" which is Copyright (c) 2008, Donovan Schönknecht
* and released under the 'Simplified BSD License'. * and released under the 'Simplified BSD License'.
* *
* @internal Used to get mime types * @internal Used to get mime types
* @param string &$file File path * @param string &$file File path
* @return string * @param string $ext
*/ * @param bool $list
* @return string
*/
function getMimeType($file, $ext="", $list=false) { function getMimeType($file, $ext="", $list=false) {
// Static extension lookup // Static extension lookup
@ -642,6 +662,8 @@ function _count_execs($db, $sql, $inputarray) {
/** /**
* Compare two Block objects, used to sort them before being displayed * Compare two Block objects, used to sort them before being displayed
* *
* @param Block $a
* @param Block $b
* @return int * @return int
*/ */
function blockcmp(Block $a, Block $b) { function blockcmp(Block $a, Block $b) {
@ -705,6 +727,7 @@ function get_memory_limit() {
* Get the currently active IP, masked to make it not change when the last * Get the currently active IP, masked to make it not change when the last
* octet or two change, for use in session cookies and such * octet or two change, for use in session cookies and such
* *
* @param Config $config
* @return string * @return string
*/ */
function get_session_ip(Config $config) { function get_session_ip(Config $config) {
@ -791,6 +814,7 @@ function get_base_href() {
* A shorthand way to send a TextFormattingEvent and get the * A shorthand way to send a TextFormattingEvent and get the
* results * results
* *
* @param $string
* @return string * @return string
*/ */
function format_text(/*string*/ $string) { function format_text(/*string*/ $string) {
@ -1009,6 +1033,8 @@ function get_request_id() {
/** /**
* Remove an item from an array * Remove an item from an array
* *
* @param $array
* @param $to_remove
* @return array * @return array
*/ */
function array_remove($array, $to_remove) { function array_remove($array, $to_remove) {
@ -1027,6 +1053,8 @@ function array_remove($array, $to_remove) {
* *
* Also removes duplicate values from the array. * Also removes duplicate values from the array.
* *
* @param $array
* @param $element
* @return array * @return array
*/ */
function array_add($array, $element) { function array_add($array, $element) {
@ -1040,6 +1068,7 @@ function array_add($array, $element) {
/** /**
* Return the unique elements of an array, case insensitively * Return the unique elements of an array, case insensitively
* *
* @param $array
* @return array * @return array
*/ */
function array_iunique($array) { function array_iunique($array) {
@ -1063,6 +1092,8 @@ function array_iunique($array) {
* *
* from http://uk.php.net/network * from http://uk.php.net/network
* *
* @param $IP
* @param $CIDR
* @return bool * @return bool
*/ */
function ip_in_range($IP, $CIDR) { function ip_in_range($IP, $CIDR) {
@ -1123,7 +1154,7 @@ function deltree($f) {
} }
/** /**
* Copy an entire file heirachy * Copy an entire file hierarchy
* *
* from a comment on http://uk.php.net/copy * from a comment on http://uk.php.net/copy
*/ */