Commit 929a312b by pupi1985

PHPDoc update in app/cookies, app/format, app/mailing and app/search

parent 53749f1e
...@@ -27,6 +27,7 @@ if (!defined('QA_VERSION')) { // don't allow this page to be requested directly ...@@ -27,6 +27,7 @@ if (!defined('QA_VERSION')) { // don't allow this page to be requested directly
/** /**
* Return the user identification cookie sent by the browser for this page request, or null if none * Return the user identification cookie sent by the browser for this page request, or null if none
* @return string|null
*/ */
function qa_cookie_get() function qa_cookie_get()
{ {
...@@ -39,6 +40,7 @@ function qa_cookie_get() ...@@ -39,6 +40,7 @@ function qa_cookie_get()
/** /**
* Return user identification cookie sent by browser if valid, or create a new one if not. * Return user identification cookie sent by browser if valid, or create a new one if not.
* Either way, extend for another year (this is used when an anonymous post is created) * Either way, extend for another year (this is used when an anonymous post is created)
* @return string
*/ */
function qa_cookie_get_create() function qa_cookie_get_create()
{ {
...@@ -63,8 +65,8 @@ function qa_cookie_get_create() ...@@ -63,8 +65,8 @@ function qa_cookie_get_create()
/** /**
* Called after a database write $action performed by a user identified by $cookieid, * Called after a database write $action performed by a user identified by $cookieid,
* relating to $questionid, $answerid and/or $commentid * relating to $questionid, $answerid and/or $commentid
* @param $cookieid * @param string $cookieid
* @param $action * @param string $action
*/ */
function qa_cookie_report_action($cookieid, $action) function qa_cookie_report_action($cookieid, $action)
{ {
......
...@@ -30,8 +30,8 @@ define('QA_PAGE_FLAGS_NEW_WINDOW', 2); ...@@ -30,8 +30,8 @@ define('QA_PAGE_FLAGS_NEW_WINDOW', 2);
/** /**
* Return textual representation of $seconds * Return textual representation of $seconds
* @param $seconds * @param int $seconds
* @return mixed|string * @return string
*/ */
function qa_time_to_string($seconds) function qa_time_to_string($seconds)
{ {
...@@ -69,9 +69,9 @@ function qa_time_to_string($seconds) ...@@ -69,9 +69,9 @@ function qa_time_to_string($seconds)
/** /**
* Check if $post is by user $userid, or if post is anonymous and $userid not specified, then * Check if $post is by user $userid, or if post is anonymous and $userid not specified, then
* check if $post is by the anonymous user identified by $cookieid * check if $post is by the anonymous user identified by $cookieid
* @param $post * @param array $post
* @param $userid * @param mixed $userid
* @param $cookieid * @param string $cookieid
* @return bool * @return bool
*/ */
function qa_post_is_by_user($post, $userid, $cookieid) function qa_post_is_by_user($post, $userid, $cookieid)
...@@ -92,7 +92,6 @@ function qa_post_is_by_user($post, $userid, $cookieid) ...@@ -92,7 +92,6 @@ function qa_post_is_by_user($post, $userid, $cookieid)
/** /**
* Return array which maps the 'userid' and/or 'lastuserid' of each user to its HTML representation. * Return array which maps the 'userid' and/or 'lastuserid' of each user to its HTML representation.
* For internal user management, corresponding 'handle' and/or 'lasthandle' are required in each element. * For internal user management, corresponding 'handle' and/or 'lasthandle' are required in each element.
*
* @param array $useridhandles User IDs or usernames. * @param array $useridhandles User IDs or usernames.
* @param bool $microdata Whether to include microdata. * @param bool $microdata Whether to include microdata.
* @return array The HTML. * @return array The HTML.
...@@ -143,6 +142,7 @@ function qa_userids_handles_html($useridhandles, $microdata = false) ...@@ -143,6 +142,7 @@ function qa_userids_handles_html($useridhandles, $microdata = false)
* users tend to favorite many more questions than other things.) The top-level array can contain three keys - 'user' for favorited * users tend to favorite many more questions than other things.) The top-level array can contain three keys - 'user' for favorited
* users, 'tag' for tags, 'category' for categories. The next level down has the identifier for each favorited entity in the *key* * users, 'tag' for tags, 'category' for categories. The next level down has the identifier for each favorited entity in the *key*
* of the array, and true for its value. If no user is logged in the empty array is returned. The result is cached for future calls. * of the array, and true for its value. If no user is logged in the empty array is returned. The result is cached for future calls.
* @return array
*/ */
function qa_get_favorite_non_qs_map() function qa_get_favorite_non_qs_map()
{ {
...@@ -182,7 +182,6 @@ function qa_get_favorite_non_qs_map() ...@@ -182,7 +182,6 @@ function qa_get_favorite_non_qs_map()
/** /**
* Convert textual tag to HTML representation, linked to its tag page. * Convert textual tag to HTML representation, linked to its tag page.
*
* @param string $tag The tag. * @param string $tag The tag.
* @param bool $microdata Whether to include microdata. * @param bool $microdata Whether to include microdata.
* @param bool $favorited Show the tag as favorited. * @param bool $favorited Show the tag as favorited.
...@@ -203,8 +202,8 @@ function qa_tag_html($tag, $microdata = false, $favorited = false) ...@@ -203,8 +202,8 @@ function qa_tag_html($tag, $microdata = false, $favorited = false)
/** /**
* Given $navcategories retrieved for $categoryid from the database (using qa_db_category_nav_selectspec(...)), * Given $navcategories retrieved for $categoryid from the database (using qa_db_category_nav_selectspec(...)),
* return an array of elements from $navcategories for the hierarchy down to $categoryid. * return an array of elements from $navcategories for the hierarchy down to $categoryid.
* @param $navcategories * @param array $navcategories
* @param $categoryid * @param int $categoryid
* @return array * @return array
*/ */
function qa_category_path($navcategories, $categoryid) function qa_category_path($navcategories, $categoryid)
...@@ -221,8 +220,8 @@ function qa_category_path($navcategories, $categoryid) ...@@ -221,8 +220,8 @@ function qa_category_path($navcategories, $categoryid)
/** /**
* Given $navcategories retrieved for $categoryid from the database (using qa_db_category_nav_selectspec(...)), * Given $navcategories retrieved for $categoryid from the database (using qa_db_category_nav_selectspec(...)),
* return some HTML that shows the category hierarchy down to $categoryid. * return some HTML that shows the category hierarchy down to $categoryid.
* @param $navcategories * @param array $navcategories
* @param $categoryid * @param int $categoryid
* @return string * @return string
*/ */
function qa_category_path_html($navcategories, $categoryid) function qa_category_path_html($navcategories, $categoryid)
...@@ -240,8 +239,8 @@ function qa_category_path_html($navcategories, $categoryid) ...@@ -240,8 +239,8 @@ function qa_category_path_html($navcategories, $categoryid)
/** /**
* Given $navcategories retrieved for $categoryid from the database (using qa_db_category_nav_selectspec(...)), * Given $navcategories retrieved for $categoryid from the database (using qa_db_category_nav_selectspec(...)),
* return a Q2A request string that represents the category hierarchy down to $categoryid. * return a Q2A request string that represents the category hierarchy down to $categoryid.
* @param $navcategories * @param array $navcategories
* @param $categoryid * @param int $categoryid
* @return string * @return string
*/ */
function qa_category_path_request($navcategories, $categoryid) function qa_category_path_request($navcategories, $categoryid)
...@@ -258,8 +257,8 @@ function qa_category_path_request($navcategories, $categoryid) ...@@ -258,8 +257,8 @@ function qa_category_path_request($navcategories, $categoryid)
/** /**
* Return HTML to use for $ip address, which links to appropriate page with $anchorhtml * Return HTML to use for $ip address, which links to appropriate page with $anchorhtml
* @param $ip * @param string $ip
* @param null $anchorhtml * @param string|null $anchorhtml
* @return mixed|string * @return mixed|string
*/ */
function qa_ip_anchor_html($ip, $anchorhtml = null) function qa_ip_anchor_html($ip, $anchorhtml = null)
...@@ -280,11 +279,11 @@ function qa_ip_anchor_html($ip, $anchorhtml = null) ...@@ -280,11 +279,11 @@ function qa_ip_anchor_html($ip, $anchorhtml = null)
* $dummy is a placeholder (used to be $categories parameter but that's no longer needed) * $dummy is a placeholder (used to be $categories parameter but that's no longer needed)
* $options is an array which sets what is displayed (see qa_post_html_defaults() in /qa-include/app/options.php) * $options is an array which sets what is displayed (see qa_post_html_defaults() in /qa-include/app/options.php)
* If something is missing from $post (e.g. ['content']), correponding HTML also omitted. * If something is missing from $post (e.g. ['content']), correponding HTML also omitted.
* @param $post * @param array $post
* @param $userid * @param mixed $userid
* @param $cookieid * @param string $cookieid
* @param $usershtml * @param array $usershtml
* @param $dummy * @param null $dummy
* @param array $options * @param array $options
* @return array * @return array
*/ */
...@@ -683,7 +682,6 @@ function qa_post_html_fields($post, $userid, $cookieid, $usershtml, $dummy, $opt ...@@ -683,7 +682,6 @@ function qa_post_html_fields($post, $userid, $cookieid, $usershtml, $dummy, $opt
/** /**
* Generate array of mostly HTML representing a message, to be passed to theme layer. * Generate array of mostly HTML representing a message, to be passed to theme layer.
*
* @param array $message The message object (as retrieved from database). * @param array $message The message object (as retrieved from database).
* @param array $options Viewing options (see qa_message_html_defaults() in /qa-include/app/options.php). * @param array $options Viewing options (see qa_message_html_defaults() in /qa-include/app/options.php).
* @return array The HTML. * @return array The HTML.
...@@ -738,9 +736,8 @@ function qa_message_html_fields($message, $options = array()) ...@@ -738,9 +736,8 @@ function qa_message_html_fields($message, $options = array())
/** /**
* Generate array of split HTML (prefix, data, suffix) to represent author of post. * Generate array of split HTML (prefix, data, suffix) to represent author of post.
*
* @param bool $isbyuser True if the current user made the post. * @param bool $isbyuser True if the current user made the post.
* @param int $postuserid The post user's ID. * @param int|null $postuserid The post user's ID.
* @param array $usershtml Array of HTML representing usernames. * @param array $usershtml Array of HTML representing usernames.
* @param string $ip The post user's IP. * @param string $ip The post user's IP.
* @param bool|string $microdata Whether to include microdata. * @param bool|string $microdata Whether to include microdata.
...@@ -776,9 +773,8 @@ function qa_who_to_html($isbyuser, $postuserid, $usershtml, $ip = null, $microda ...@@ -776,9 +773,8 @@ function qa_who_to_html($isbyuser, $postuserid, $usershtml, $ip = null, $microda
/** /**
* Generate array of split HTML (prefix, data, suffix) to represent a timestamp, optionally with the full date. * Generate array of split HTML (prefix, data, suffix) to represent a timestamp, optionally with the full date.
*
* @param int $timestamp Unix timestamp. * @param int $timestamp Unix timestamp.
* @param int $fulldatedays Number of days after which to show the full date. * @param int|null $fulldatedays Number of days after which to show the full date.
* @return array The HTML. * @return array The HTML.
*/ */
function qa_when_to_html($timestamp, $fulldatedays) function qa_when_to_html($timestamp, $fulldatedays)
...@@ -815,12 +811,12 @@ function qa_when_to_html($timestamp, $fulldatedays) ...@@ -815,12 +811,12 @@ function qa_when_to_html($timestamp, $fulldatedays)
* $question, as retrieved from database, with fields prefixed 'o' for the answer, comment or edit. * $question, as retrieved from database, with fields prefixed 'o' for the answer, comment or edit.
* $userid, $cookieid, $usershtml, $options are passed through to qa_post_html_fields(). If $question['opersonal'] * $userid, $cookieid, $usershtml, $options are passed through to qa_post_html_fields(). If $question['opersonal']
* is set and true then the item is displayed with its personal relevance to the user (for user updates page). * is set and true then the item is displayed with its personal relevance to the user (for user updates page).
* @param $question * @param array $question
* @param $userid * @param mixed $userid
* @param $cookieid * @param string $cookieid
* @param $usershtml * @param array $usershtml
* @param $dummy * @param null $dummy
* @param $options * @param array $options
* @return array * @return array
*/ */
function qa_other_to_q_html_fields($question, $userid, $cookieid, $usershtml, $dummy, $options) function qa_other_to_q_html_fields($question, $userid, $cookieid, $usershtml, $dummy, $options)
...@@ -979,12 +975,12 @@ function qa_other_to_q_html_fields($question, $userid, $cookieid, $usershtml, $d ...@@ -979,12 +975,12 @@ function qa_other_to_q_html_fields($question, $userid, $cookieid, $usershtml, $d
/** /**
* Based on the elements in $question, return HTML to be passed to theme layer to link * Based on the elements in $question, return HTML to be passed to theme layer to link
* to the question, or to an associated answer, comment or edit. * to the question, or to an associated answer, comment or edit.
* @param $question * @param array $question
* @param $userid * @param mixed $userid
* @param $cookieid * @param string $cookieid
* @param $usershtml * @param array $usershtml
* @param $dummy * @param null $dummy
* @param $options * @param array $options
* @return array * @return array
*/ */
function qa_any_to_q_html_fields($question, $userid, $cookieid, $usershtml, $dummy, $options) function qa_any_to_q_html_fields($question, $userid, $cookieid, $usershtml, $dummy, $options)
...@@ -1001,8 +997,8 @@ function qa_any_to_q_html_fields($question, $userid, $cookieid, $usershtml, $dum ...@@ -1001,8 +997,8 @@ function qa_any_to_q_html_fields($question, $userid, $cookieid, $usershtml, $dum
/** /**
* Each element in $questions represents a question and optional associated answer, comment or edit, as retrieved from database. * Each element in $questions represents a question and optional associated answer, comment or edit, as retrieved from database.
* Return it sorted by the date appropriate for each element, without removing duplicate references to the same question. * Return it sorted by the date appropriate for each element, without removing duplicate references to the same question.
* @param $questions * @param array $questions
* @return mixed * @return array
*/ */
function qa_any_sort_by_date($questions) function qa_any_sort_by_date($questions)
{ {
...@@ -1022,7 +1018,7 @@ function qa_any_sort_by_date($questions) ...@@ -1022,7 +1018,7 @@ function qa_any_sort_by_date($questions)
/** /**
* Each element in $questions represents a question and optional associated answer, comment or edit, as retrieved from database. * Each element in $questions represents a question and optional associated answer, comment or edit, as retrieved from database.
* Return it sorted by the date appropriate for each element, and keep only the first item related to each question. * Return it sorted by the date appropriate for each element, and keep only the first item related to each question.
* @param $questions * @param array $questions
* @return array * @return array
*/ */
function qa_any_sort_and_dedupe($questions) function qa_any_sort_and_dedupe($questions)
...@@ -1079,7 +1075,7 @@ function qa_any_sort_and_dedupe($questions) ...@@ -1079,7 +1075,7 @@ function qa_any_sort_and_dedupe($questions)
/** /**
* Each element in $questions represents a question and optional associated answer, comment or edit, as retrieved from database. * Each element in $questions represents a question and optional associated answer, comment or edit, as retrieved from database.
* Return an array of elements (userid,handle) for the appropriate user for each element. * Return an array of elements (userid,handle) for the appropriate user for each element.
* @param $questions * @param array $questions
* @return array * @return array
*/ */
function qa_any_get_userids_handles($questions) function qa_any_get_userids_handles($questions)
...@@ -1108,7 +1104,7 @@ function qa_any_get_userids_handles($questions) ...@@ -1108,7 +1104,7 @@ function qa_any_get_userids_handles($questions)
* Return $html with any URLs converted into links (with nofollow and in a new window if $newwindow). * Return $html with any URLs converted into links (with nofollow and in a new window if $newwindow).
* Closing parentheses/brackets are removed from the link if they don't have a matching opening one. This avoids creating * Closing parentheses/brackets are removed from the link if they don't have a matching opening one. This avoids creating
* incorrect URLs from (http://www.question2answer.org) but allow URLs such as http://www.wikipedia.org/Computers_(Software) * incorrect URLs from (http://www.question2answer.org) but allow URLs such as http://www.wikipedia.org/Computers_(Software)
* @param $html * @param string $html
* @param bool $newwindow * @param bool $newwindow
* @return mixed * @return mixed
*/ */
...@@ -1160,7 +1156,7 @@ function qa_html_convert_urls($html, $newwindow = false) ...@@ -1160,7 +1156,7 @@ function qa_html_convert_urls($html, $newwindow = false)
/** /**
* Return HTML representation of $url (if it appears to be an URL), linked with nofollow and in a new window if $newwindow * Return HTML representation of $url (if it appears to be an URL), linked with nofollow and in a new window if $newwindow
* @param $url * @param string $url
* @param bool $newwindow * @param bool $newwindow
* @return mixed|string * @return mixed|string
*/ */
...@@ -1182,9 +1178,9 @@ function qa_url_to_html_link($url, $newwindow = false) ...@@ -1182,9 +1178,9 @@ function qa_url_to_html_link($url, $newwindow = false)
/** /**
* Return $htmlmessage with ^1...^6 substituted for links to log in or register or confirm email and come back to $topage with $params * Return $htmlmessage with ^1...^6 substituted for links to log in or register or confirm email and come back to $topage with $params
* @param $htmlmessage * @param string $htmlmessage
* @param null $topage * @param string|null $topage
* @param null $params * @param string|null $params
* @return string * @return string
*/ */
function qa_insert_login_links($htmlmessage, $topage = null, $params = null) function qa_insert_login_links($htmlmessage, $topage = null, $params = null)
...@@ -1214,14 +1210,14 @@ function qa_insert_login_links($htmlmessage, $topage = null, $params = null) ...@@ -1214,14 +1210,14 @@ function qa_insert_login_links($htmlmessage, $topage = null, $params = null)
* $start is current offset, there are $pagesize items per page and $count items in total * $start is current offset, there are $pagesize items per page and $count items in total
* (unless $hasmore is true in which case there are at least $count items). * (unless $hasmore is true in which case there are at least $count items).
* Show links to $prevnext pages before and after this one and include $params in the URLs. * Show links to $prevnext pages before and after this one and include $params in the URLs.
* @param $request * @param string $request
* @param $start * @param int $start
* @param $pagesize * @param int $pagesize
* @param $count * @param int $count
* @param $prevnext * @param int $prevnext
* @param array $params * @param array $params
* @param bool $hasmore * @param bool $hasmore
* @param null $anchor * @param string|null $anchor
* @return array|null * @return array|null
*/ */
function qa_html_page_links($request, $start, $pagesize, $count, $prevnext, $params = array(), $hasmore = false, $anchor = null) function qa_html_page_links($request, $start, $pagesize, $count, $prevnext, $params = array(), $hasmore = false, $anchor = null)
...@@ -1286,8 +1282,8 @@ function qa_html_page_links($request, $start, $pagesize, $count, $prevnext, $par ...@@ -1286,8 +1282,8 @@ function qa_html_page_links($request, $start, $pagesize, $count, $prevnext, $par
* Return HTML that suggests browsing all questions (in the category specified by $categoryrequest, if * Return HTML that suggests browsing all questions (in the category specified by $categoryrequest, if
* it's not null) and also popular tags if $usingtags is true * it's not null) and also popular tags if $usingtags is true
* @param bool $usingtags * @param bool $usingtags
* @param null $categoryrequest * @param string|null $categoryrequest
* @return mixed|string * @return string
*/ */
function qa_html_suggest_qs_tags($usingtags = false, $categoryrequest = null) function qa_html_suggest_qs_tags($usingtags = false, $categoryrequest = null)
{ {
...@@ -1313,8 +1309,8 @@ function qa_html_suggest_qs_tags($usingtags = false, $categoryrequest = null) ...@@ -1313,8 +1309,8 @@ function qa_html_suggest_qs_tags($usingtags = false, $categoryrequest = null)
/** /**
* Return HTML that suggest getting things started by asking a question, in $categoryid if not null * Return HTML that suggest getting things started by asking a question, in $categoryid if not null
* @param null $categoryid * @param int|null $categoryid
* @return mixed|string * @return string
*/ */
function qa_html_suggest_ask($categoryid = null) function qa_html_suggest_ask($categoryid = null)
{ {
...@@ -1336,12 +1332,12 @@ function qa_html_suggest_ask($categoryid = null) ...@@ -1336,12 +1332,12 @@ function qa_html_suggest_ask($categoryid = null)
/** /**
* Return the navigation structure for the category hierarchical menu, with $selectedid selected, * Return the navigation structure for the category hierarchical menu, with $selectedid selected,
* and links beginning with $pathprefix, and showing question counts if $showqcount * and links beginning with $pathprefix, and showing question counts if $showqcount
* @param $categories * @param array $categories
* @param null $selectedid * @param int|null $selectedid
* @param string $pathprefix * @param string $pathprefix
* @param bool $showqcount * @param bool $showqcount
* @param null $pathparams * @param array|null $pathparams
* @return array|mixed * @return array
*/ */
function qa_category_navigation($categories, $selectedid = null, $pathprefix = '', $showqcount = true, $pathparams = null) function qa_category_navigation($categories, $selectedid = null, $pathprefix = '', $showqcount = true, $pathparams = null)
{ {
...@@ -1361,14 +1357,14 @@ function qa_category_navigation($categories, $selectedid = null, $pathprefix = ' ...@@ -1361,14 +1357,14 @@ function qa_category_navigation($categories, $selectedid = null, $pathprefix = '
/** /**
* Recursion function used by qa_category_navigation(...) to build hierarchical category menu. * Recursion function used by qa_category_navigation(...) to build hierarchical category menu.
* @param $parentcategories * @param array $parentcategories
* @param $parentid * @param int|null $parentid
* @param $selecteds * @param array $selecteds
* @param $pathprefix * @param string $pathprefix
* @param $showqcount * @param bool $showqcount
* @param $pathparams * @param array $pathparams
* @param null $favoritemap * @param array|null $favoritemap
* @return array|mixed * @return array
*/ */
function qa_category_navigation_sub($parentcategories, $parentid, $selecteds, $pathprefix, $showqcount, $pathparams, $favoritemap = null) function qa_category_navigation_sub($parentcategories, $parentid, $selecteds, $pathprefix, $showqcount, $pathparams, $favoritemap = null)
{ {
...@@ -1407,6 +1403,7 @@ function qa_category_navigation_sub($parentcategories, $parentid, $selecteds, $p ...@@ -1407,6 +1403,7 @@ function qa_category_navigation_sub($parentcategories, $parentid, $selecteds, $p
/** /**
* Return the sub navigation structure for user listing pages * Return the sub navigation structure for user listing pages
* @return array|null
*/ */
function qa_users_sub_navigation() function qa_users_sub_navigation()
{ {
...@@ -1455,8 +1452,8 @@ function qa_users_sub_navigation() ...@@ -1455,8 +1452,8 @@ function qa_users_sub_navigation()
/** /**
* Return the sub navigation structure for navigating between the different pages relating to a user * Return the sub navigation structure for navigating between the different pages relating to a user
* @param $handle * @param string $handle
* @param $selected * @param string $selected
* @param bool $ismyuser * @param bool $ismyuser
* @return array * @return array
*/ */
...@@ -1526,7 +1523,7 @@ function qa_user_sub_navigation($handle, $selected, $ismyuser = false) ...@@ -1526,7 +1523,7 @@ function qa_user_sub_navigation($handle, $selected, $ismyuser = false)
/** /**
* Return the sub navigation structure for private message pages * Return the sub navigation structure for private message pages
* @deprecated 1.8.0 This menu is no longer used. * @deprecated 1.8.0 This menu is no longer used.
* @param null $selected * @param string|null $selected
* @return array * @return array
*/ */
function qa_messages_sub_navigation($selected = null) function qa_messages_sub_navigation($selected = null)
...@@ -1552,7 +1549,6 @@ function qa_messages_sub_navigation($selected = null) ...@@ -1552,7 +1549,6 @@ function qa_messages_sub_navigation($selected = null)
/** /**
* Return the sub navigation structure for user account pages. * Return the sub navigation structure for user account pages.
*
* @deprecated Deprecated from 1.6.3; use `qa_user_sub_navigation()` instead. * @deprecated Deprecated from 1.6.3; use `qa_user_sub_navigation()` instead.
*/ */
function qa_account_sub_navigation() function qa_account_sub_navigation()
...@@ -1573,7 +1569,7 @@ function qa_account_sub_navigation() ...@@ -1573,7 +1569,7 @@ function qa_account_sub_navigation()
/** /**
* Return the url for $page retrieved from the database * Return the url for $page retrieved from the database
* @param $page * @param array $page
* @return string * @return string
*/ */
function qa_custom_page_url($page) function qa_custom_page_url($page)
...@@ -1586,8 +1582,8 @@ function qa_custom_page_url($page) ...@@ -1586,8 +1582,8 @@ function qa_custom_page_url($page)
/** /**
* Add an element to the $navigation array corresponding to $page retrieved from the database * Add an element to the $navigation array corresponding to $page retrieved from the database
* @param $navigation * @param array $navigation
* @param $page * @param array $page
*/ */
function qa_navigation_add_page(&$navigation, $page) function qa_navigation_add_page(&$navigation, $page)
{ {
...@@ -1607,7 +1603,7 @@ function qa_navigation_add_page(&$navigation, $page) ...@@ -1607,7 +1603,7 @@ function qa_navigation_add_page(&$navigation, $page)
/** /**
* Convert an admin option for matching into a threshold for the score given by database search * Convert an admin option for matching into a threshold for the score given by database search
* @param $match * @param int $match
* @return int * @return int
*/ */
function qa_match_to_min_score($match) function qa_match_to_min_score($match)
...@@ -1618,7 +1614,6 @@ function qa_match_to_min_score($match) ...@@ -1618,7 +1614,6 @@ function qa_match_to_min_score($match)
/** /**
* Adds JavaScript to the page to handle toggling of form fields based on other fields. * Adds JavaScript to the page to handle toggling of form fields based on other fields.
*
* @param array $qa_content Page content array. * @param array $qa_content Page content array.
* @param array $effects List of rules for element toggling, with the structure: * @param array $effects List of rules for element toggling, with the structure:
* array('target1' => 'source1', 'target2' => 'source2', ...) * array('target1' => 'source1', 'target2' => 'source2', ...)
...@@ -1676,13 +1671,13 @@ function qa_set_display_rules(&$qa_content, $effects) ...@@ -1676,13 +1671,13 @@ function qa_set_display_rules(&$qa_content, $effects)
/** /**
* Set up $qa_content and $field (with HTML name $fieldname) for tag auto-completion, where * Set up $qa_content and $field (with HTML name $fieldname) for tag auto-completion, where
* $exampletags are suggestions and $completetags are simply the most popular ones. Show up to $maxtags. * $exampletags are suggestions and $completetags are simply the most popular ones. Show up to $maxtags.
* @param $qa_content * @param array $qa_content
* @param $field * @param array $field
* @param $fieldname * @param string $fieldname
* @param $tags * @param array $tags
* @param $exampletags * @param array $exampletags
* @param $completetags * @param array $completetags
* @param $maxtags * @param int $maxtags
*/ */
function qa_set_up_tag_field(&$qa_content, &$field, $fieldname, $tags, $exampletags, $completetags, $maxtags) function qa_set_up_tag_field(&$qa_content, &$field, $fieldname, $tags, $exampletags, $completetags, $maxtags)
{ {
...@@ -1716,7 +1711,7 @@ function qa_set_up_tag_field(&$qa_content, &$field, $fieldname, $tags, $examplet ...@@ -1716,7 +1711,7 @@ function qa_set_up_tag_field(&$qa_content, &$field, $fieldname, $tags, $examplet
/** /**
* Get a list of user-entered tags submitted from a field that was created with qa_set_up_tag_field(...) * Get a list of user-entered tags submitted from a field that was created with qa_set_up_tag_field(...)
* @param $fieldname * @param string $fieldname
* @return array * @return array
*/ */
function qa_get_tags_field_value($fieldname) function qa_get_tags_field_value($fieldname)
...@@ -1738,15 +1733,15 @@ function qa_get_tags_field_value($fieldname) ...@@ -1738,15 +1733,15 @@ function qa_get_tags_field_value($fieldname)
* If $allownone is true, it will allow selection of no category. If $allownosub is true, it will allow a category to be * If $allownone is true, it will allow selection of no category. If $allownosub is true, it will allow a category to be
* selected without selecting a subcategory within. Set $maxdepth to the maximum depth of category that can be selected * selected without selecting a subcategory within. Set $maxdepth to the maximum depth of category that can be selected
* (or null for no maximum) and $excludecategoryid to a category that should not be included. * (or null for no maximum) and $excludecategoryid to a category that should not be included.
* @param $qa_content * @param array $qa_content
* @param $field * @param array $field
* @param $fieldname * @param string $fieldname
* @param $navcategories * @param array $navcategories
* @param $categoryid * @param int $categoryid
* @param $allownone * @param int $allownone
* @param $allownosub * @param int $allownosub
* @param null $maxdepth * @param int|null $maxdepth
* @param null $excludecategoryid * @param int|null $excludecategoryid
*/ */
function qa_set_up_category_field(&$qa_content, &$field, $fieldname, $navcategories, $categoryid, $allownone, $allownosub, $maxdepth = null, $excludecategoryid = null) function qa_set_up_category_field(&$qa_content, &$field, $fieldname, $navcategories, $categoryid, $allownone, $allownosub, $maxdepth = null, $excludecategoryid = null)
{ {
...@@ -1834,8 +1829,8 @@ function qa_set_up_category_field(&$qa_content, &$field, $fieldname, $navcategor ...@@ -1834,8 +1829,8 @@ function qa_set_up_category_field(&$qa_content, &$field, $fieldname, $navcategor
/** /**
* Get the user-entered category id submitted from a field that was created with qa_set_up_category_field(...) * Get the user-entered category id submitted from a field that was created with qa_set_up_category_field(...)
* @param $fieldname * @param string $fieldname
* @return mixed|null * @return string|null
*/ */
function qa_get_category_field_value($fieldname) function qa_get_category_field_value($fieldname)
{ {
...@@ -1858,9 +1853,9 @@ function qa_get_category_field_value($fieldname) ...@@ -1858,9 +1853,9 @@ function qa_get_category_field_value($fieldname)
/** /**
* Set up $qa_content and add to $fields to allow the user to enter their name for a post if they are not logged in * Set up $qa_content and add to $fields to allow the user to enter their name for a post if they are not logged in
* $inname is from previous submission/validation. Pass $fieldprefix to add a prefix to the form field name used. * $inname is from previous submission/validation. Pass $fieldprefix to add a prefix to the form field name used.
* @param $qa_content * @param array $qa_content
* @param $fields * @param array $fields
* @param $inname * @param string $inname
* @param string $fieldprefix * @param string $fieldprefix
*/ */
function qa_set_up_name_field(&$qa_content, &$fields, $inname, $fieldprefix = '') function qa_set_up_name_field(&$qa_content, &$fields, $inname, $fieldprefix = '')
...@@ -1878,13 +1873,13 @@ function qa_set_up_name_field(&$qa_content, &$fields, $inname, $fieldprefix = '' ...@@ -1878,13 +1873,13 @@ function qa_set_up_name_field(&$qa_content, &$fields, $inname, $fieldprefix = ''
* $basetype is 'Q', 'A' or 'C' for question, answer or comment. $login_email is the email of logged in user, * $basetype is 'Q', 'A' or 'C' for question, answer or comment. $login_email is the email of logged in user,
* or null if this is an anonymous post. $innotify, $inemail and $errors_email are from previous submission/validation. * or null if this is an anonymous post. $innotify, $inemail and $errors_email are from previous submission/validation.
* Pass $fieldprefix to add a prefix to the form field names and IDs used. * Pass $fieldprefix to add a prefix to the form field names and IDs used.
* @param $qa_content * @param array $qa_content
* @param $fields * @param array $fields
* @param $basetype * @param string $basetype
* @param $login_email * @param string|null $login_email
* @param $innotify * @param string $innotify
* @param $inemail * @param string $inemail
* @param $errors_email * @param string $errors_email
* @param string $fieldprefix * @param string $fieldprefix
*/ */
function qa_set_up_notify_fields(&$qa_content, &$fields, $basetype, $login_email, $innotify, $inemail, $errors_email, $fieldprefix = '') function qa_set_up_notify_fields(&$qa_content, &$fields, $basetype, $login_email, $innotify, $inemail, $errors_email, $fieldprefix = '')
...@@ -1959,10 +1954,10 @@ function qa_get_site_theme() ...@@ -1959,10 +1954,10 @@ function qa_get_site_theme()
/** /**
* Return the initialized class for $theme (or the default if it's gone), passing $template, $content and $request. * Return the initialized class for $theme (or the default if it's gone), passing $template, $content and $request.
* Also applies any registered plugin layers. * Also applies any registered plugin layers.
* @param $theme * @param string $theme
* @param $template * @param string $template
* @param $content * @param array $content
* @param $request * @param string $request
* @return qa_html_theme_base * @return qa_html_theme_base
*/ */
function qa_load_theme_class($theme, $template, $content, $request) function qa_load_theme_class($theme, $template, $content, $request)
...@@ -2055,9 +2050,9 @@ function qa_load_theme_class($theme, $template, $content, $request) ...@@ -2055,9 +2050,9 @@ function qa_load_theme_class($theme, $template, $content, $request)
/** /**
* Return an instantiation of the appropriate editor module class, given $content in $format * Return an instantiation of the appropriate editor module class, given $content in $format
* Pass the preferred module name in $editorname, on return it will contain the name of the module used. * Pass the preferred module name in $editorname, on return it will contain the name of the module used.
* @param $content string * @param string $content
* @param $format string * @param string $format
* @param $editorname string * @param string $editorname
* @return object * @return object
*/ */
function qa_load_editor($content, $format, &$editorname) function qa_load_editor($content, $format, &$editorname)
...@@ -2092,7 +2087,7 @@ function qa_load_editor($content, $format, &$editorname) ...@@ -2092,7 +2087,7 @@ function qa_load_editor($content, $format, &$editorname)
* $content, $format, $fieldname, $rows and $focusnow are passed through to the module's get_field() method. ($focusnow * $content, $format, $fieldname, $rows and $focusnow are passed through to the module's get_field() method. ($focusnow
* is deprecated as a parameter to get_field() but it's still passed through for old editor modules.) Based on * is deprecated as a parameter to get_field() but it's still passed through for old editor modules.) Based on
* $focusnow and $loadnow, also add the editor's load and/or focus scripts to $qa_content's onload handlers. * $focusnow and $loadnow, also add the editor's load and/or focus scripts to $qa_content's onload handlers.
* @param $editor object * @param object $editor
* @param array $qa_content * @param array $qa_content
* @param string $content * @param string $content
* @param string $format * @param string $format
...@@ -2100,7 +2095,7 @@ function qa_load_editor($content, $format, &$editorname) ...@@ -2100,7 +2095,7 @@ function qa_load_editor($content, $format, &$editorname)
* @param int $rows * @param int $rows
* @param bool $focusnow * @param bool $focusnow
* @param bool $loadnow * @param bool $loadnow
* @return string|array * @return array
*/ */
function qa_editor_load_field($editor, &$qa_content, $content, $format, $fieldname, $rows, $focusnow = false, $loadnow = true) function qa_editor_load_field($editor, &$qa_content, $content, $format, $fieldname, $rows, $focusnow = false, $loadnow = true)
{ {
...@@ -2192,12 +2187,12 @@ function qa_get_post_title($fieldname) ...@@ -2192,12 +2187,12 @@ function qa_get_post_title($fieldname)
/** /**
* Retrieve the POST from an editor module's HTML field named $contentfield, where the editor's name was in HTML field $editorfield * Retrieve the POST from an editor module's HTML field named $contentfield, where the editor's name was in HTML field $editorfield
* Assigns the module's output to $incontent and $informat, editor's name in $ineditor, text rendering of content in $intext * Assigns the module's output to $incontent and $informat, editor's name in $ineditor, text rendering of content in $intext
* @param $editorfield * @param string $editorfield
* @param $contentfield * @param string $contentfield
* @param $ineditor * @param string $ineditor
* @param $incontent * @param string $incontent
* @param $informat * @param string $informat
* @param $intext * @param string $intext
*/ */
function qa_get_post_content($editorfield, $contentfield, &$ineditor, &$incontent, &$informat, &$intext) function qa_get_post_content($editorfield, $contentfield, &$ineditor, &$incontent, &$informat, &$intext)
{ {
...@@ -2217,8 +2212,8 @@ function qa_get_post_content($editorfield, $contentfield, &$ineditor, &$inconten ...@@ -2217,8 +2212,8 @@ function qa_get_post_content($editorfield, $contentfield, &$ineditor, &$inconten
/** /**
* Check if any of the 'content', 'format' or 'text' elements have changed between $oldfields and $fields * Check if any of the 'content', 'format' or 'text' elements have changed between $oldfields and $fields
* If so, recalculate $fields['text'] based on $fields['content'] and $fields['format'] * If so, recalculate $fields['text'] based on $fields['content'] and $fields['format']
* @param $fields * @param array $fields
* @param $oldfields * @param array $oldfields
*/ */
function qa_update_post_text(&$fields, $oldfields) function qa_update_post_text(&$fields, $oldfields)
{ {
...@@ -2234,12 +2229,12 @@ function qa_update_post_text(&$fields, $oldfields) ...@@ -2234,12 +2229,12 @@ function qa_update_post_text(&$fields, $oldfields)
/** /**
* Return the <img...> HTML to display avatar $blobid whose stored size is $width and $height * Return the <img...> HTML to display avatar $blobid whose stored size is $width and $height
* Constrain the image to $size (width AND height) and pad it to that size if $padding is true * Constrain the image to $size (width AND height) and pad it to that size if $padding is true
* @param $blobId * @param string $blobId
* @param $width * @param int $width
* @param $height * @param int $height
* @param $size * @param int $size
* @param bool $padding * @param bool $padding
* @return null|string * @return string|null
*/ */
function qa_get_avatar_blob_html($blobId, $width, $height, $size, $padding = false) function qa_get_avatar_blob_html($blobId, $width, $height, $size, $padding = false)
{ {
...@@ -2277,9 +2272,9 @@ function qa_get_avatar_blob_html($blobId, $width, $height, $size, $padding = fal ...@@ -2277,9 +2272,9 @@ function qa_get_avatar_blob_html($blobId, $width, $height, $size, $padding = fal
/** /**
* Return the <img...> HTML to display the Gravatar for $email, constrained to $size * Return the <img...> HTML to display the Gravatar for $email, constrained to $size
* @param $email * @param string $email
* @param $size * @param int|null $size
* @return mixed|null|string * @return string|null
*/ */
function qa_get_gravatar_html($email, $size) function qa_get_gravatar_html($email, $size)
{ {
...@@ -2300,9 +2295,9 @@ function qa_get_gravatar_html($email, $size) ...@@ -2300,9 +2295,9 @@ function qa_get_gravatar_html($email, $size)
/** /**
* Retrieve the appropriate user title from $pointstitle for a user with $userpoints points, or null if none * Retrieve the appropriate user title from $pointstitle for a user with $userpoints points, or null if none
* @param $userpoints * @param int $userpoints
* @param $pointstitle * @param array $pointstitle
* @return null * @return string|null
*/ */
function qa_get_points_title_html($userpoints, $pointstitle) function qa_get_points_title_html($userpoints, $pointstitle)
{ {
...@@ -2318,9 +2313,9 @@ function qa_get_points_title_html($userpoints, $pointstitle) ...@@ -2318,9 +2313,9 @@ function qa_get_points_title_html($userpoints, $pointstitle)
/** /**
* Return an form to add to the $qa_content['notices'] array for displaying a user notice with id $noticeid * Return an form to add to the $qa_content['notices'] array for displaying a user notice with id $noticeid
* and $content. Pass the raw database information for the notice in $rawnotice. * and $content. Pass the raw database information for the notice in $rawnotice.
* @param $noticeid * @param string $noticeid
* @param $content * @param string $content
* @param null $rawnotice * @param array|null $rawnotice
* @return array * @return array
*/ */
function qa_notice_form($noticeid, $content, $rawnotice = null) function qa_notice_form($noticeid, $content, $rawnotice = null)
...@@ -2341,10 +2336,10 @@ function qa_notice_form($noticeid, $content, $rawnotice = null) ...@@ -2341,10 +2336,10 @@ function qa_notice_form($noticeid, $content, $rawnotice = null)
/** /**
* Return a form to set in $qa_content['favorite'] for the favoriting button for entity $entitytype with $entityid. * Return a form to set in $qa_content['favorite'] for the favoriting button for entity $entitytype with $entityid.
* Set $favorite to whether the entity is currently a favorite and a description title for the button in $title. * Set $favorite to whether the entity is currently a favorite and a description title for the button in $title.
* @param $entitytype * @param string $entitytype
* @param $entityid * @param mixed $entityid
* @param $favorite * @param bool $favorite
* @param $title * @param string $title
* @return array * @return array
*/ */
function qa_favorite_form($entitytype, $entityid, $favorite, $title) function qa_favorite_form($entitytype, $entityid, $favorite, $title)
......
...@@ -120,10 +120,10 @@ function qa_mailing_perform_step() ...@@ -120,10 +120,10 @@ function qa_mailing_perform_step()
/** /**
* Send a single message from the mailing, to $userid with $handle and $email. * Send a single message from the mailing, to $userid with $handle and $email.
* Pass the user's existing $emailcode if there is one, otherwise a new one will be set up * Pass the user's existing $emailcode if there is one, otherwise a new one will be set up
* @param $userid * @param mixed $userid
* @param $handle * @param string $handle
* @param $email * @param string $email
* @param $emailcode * @param string $emailcode
* @return bool * @return bool
*/ */
function qa_mailing_send_one($userid, $handle, $email, $emailcode) function qa_mailing_send_one($userid, $handle, $email, $emailcode)
...@@ -152,6 +152,7 @@ function qa_mailing_send_one($userid, $handle, $email, $emailcode) ...@@ -152,6 +152,7 @@ function qa_mailing_send_one($userid, $handle, $email, $emailcode)
/** /**
* Return a message describing current progress in the mailing * Return a message describing current progress in the mailing
* @return string|null
*/ */
function qa_mailing_progress_message() function qa_mailing_progress_message()
{ {
......
...@@ -30,13 +30,13 @@ if (!defined('QA_VERSION')) { // don't allow this page to be requested directly ...@@ -30,13 +30,13 @@ if (!defined('QA_VERSION')) { // don't allow this page to be requested directly
* to get absolute URLs for the results and $fullcontent if the results should include full post content. This calls * to get absolute URLs for the results and $fullcontent if the results should include full post content. This calls
* through to the chosen search module, and performs all the necessary post-processing to supplement the results for * through to the chosen search module, and performs all the necessary post-processing to supplement the results for
* display online or in an RSS feed. * display online or in an RSS feed.
* @param $query * @param string $query
* @param $start * @param int $start
* @param $count * @param int $count
* @param $userid * @param mixed $userid
* @param $absoluteurls * @param bool $absoluteurls
* @param $fullcontent * @param bool $fullcontent
* @return * @return array
*/ */
function qa_get_search_results($query, $start, $count, $userid, $absoluteurls, $fullcontent) function qa_get_search_results($query, $start, $count, $userid, $absoluteurls, $fullcontent)
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment