Commit c20678fb by Scott

Coding style (PHPDoc auto-gen)

parent 7f346522
...@@ -34,6 +34,11 @@ require_once QA_INCLUDE_DIR . 'db/selects.php'; ...@@ -34,6 +34,11 @@ require_once QA_INCLUDE_DIR . 'db/selects.php';
/** /**
* Standard database failure handler function which bring up the install/repair/upgrade page * Standard database failure handler function which bring up the install/repair/upgrade page
* @param $type
* @param int $errno
* @param string $error
* @param string $query
* @return mixed
*/ */
function qa_page_db_fail_handler($type, $errno = null, $error = null, $query = null) function qa_page_db_fail_handler($type, $errno = null, $error = null, $query = null)
{ {
...@@ -227,7 +232,9 @@ function qa_get_request_content() ...@@ -227,7 +232,9 @@ function qa_get_request_content()
/** /**
* Output the $qa_content via the theme class after doing some pre-processing, mainly relating to Javascript * Output the $qa_content via the theme class after doing some pre-processing, mainly relating to Javascript
* @param $qa_content
* @return mixed
*/ */
function qa_output_content($qa_content) function qa_output_content($qa_content)
{ {
...@@ -375,6 +382,8 @@ function qa_output_content($qa_content) ...@@ -375,6 +382,8 @@ function qa_output_content($qa_content)
/** /**
* Update any statistics required by the fields in $qa_content, and return true if something was done * Update any statistics required by the fields in $qa_content, and return true if something was done
* @param $qa_content
* @return bool
*/ */
function qa_do_content_stats($qa_content) function qa_do_content_stats($qa_content)
{ {
...@@ -452,6 +461,7 @@ function qa_page_routing() ...@@ -452,6 +461,7 @@ function qa_page_routing()
/** /**
* Sets the template which should be passed to the theme class, telling it which type of page it's displaying * Sets the template which should be passed to the theme class, telling it which type of page it's displaying
* @param $template
*/ */
function qa_set_template($template) function qa_set_template($template)
{ {
...@@ -463,8 +473,11 @@ function qa_set_template($template) ...@@ -463,8 +473,11 @@ function qa_set_template($template)
/** /**
* Start preparing theme content in global $qa_content variable, with or without $voting support, * Start preparing theme content in global $qa_content variable, with or without $voting support,
* in the context of the categories in $categoryids (if not null) * in the context of the categories in $categoryids (if not null)
* @param bool $voting
* @param array $categoryids
* @return array
*/ */
function qa_content_prepare($voting=false, $categoryids=null) function qa_content_prepare($voting = false, $categoryids = null)
{ {
if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); } if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
......
...@@ -36,6 +36,10 @@ require_once QA_INCLUDE_DIR . 'app/options.php'; ...@@ -36,6 +36,10 @@ require_once QA_INCLUDE_DIR . 'app/options.php';
/** /**
* Database failure handler function for RSS feeds - outputs HTTP and text errors * Database failure handler function for RSS feeds - outputs HTTP and text errors
* @param $type
* @param int $errno
* @param string $error
* @param string $query
*/ */
function qa_feed_db_fail_handler($type, $errno = null, $error = null, $query = null) function qa_feed_db_fail_handler($type, $errno = null, $error = null, $query = null)
{ {
...@@ -58,6 +62,15 @@ function qa_feed_not_found() ...@@ -58,6 +62,15 @@ function qa_feed_not_found()
/** /**
* Common function to load appropriate set of questions for requested feed, check category exists, and set up page title * Common function to load appropriate set of questions for requested feed, check category exists, and set up page title
* @param array $categoryslugs
* @param string $allkey
* @param string $catkey
* @param string $title
* @param array $questionselectspec1
* @param array $questionselectspec2
* @param array $questionselectspec3
* @param array $questionselectspec4
* @return array
*/ */
function qa_feed_load_ifcategory($categoryslugs, $allkey, $catkey, &$title, function qa_feed_load_ifcategory($categoryslugs, $allkey, $catkey, &$title,
$questionselectspec1 = null, $questionselectspec2 = null, $questionselectspec3 = null, $questionselectspec4 = null) $questionselectspec1 = null, $questionselectspec2 = null, $questionselectspec3 = null, $questionselectspec4 = null)
......
...@@ -58,6 +58,10 @@ class qa_html_theme_base ...@@ -58,6 +58,10 @@ class qa_html_theme_base
/** /**
* Initialize the object and assign local variables. * Initialize the object and assign local variables.
* @param $template
* @param $content
* @param $rooturl
* @param $request
*/ */
public function __construct($template, $content, $rooturl, $request) public function __construct($template, $content, $rooturl, $request)
{ {
...@@ -72,6 +76,10 @@ class qa_html_theme_base ...@@ -72,6 +76,10 @@ class qa_html_theme_base
/** /**
* @deprecated PHP4-style constructor deprecated from 1.7; please use proper `__construct` * @deprecated PHP4-style constructor deprecated from 1.7; please use proper `__construct`
* function instead. * function instead.
* @param $template
* @param $content
* @param $rooturl
* @param $request
*/ */
public function qa_html_theme_base($template, $content, $rooturl, $request) public function qa_html_theme_base($template, $content, $rooturl, $request)
{ {
...@@ -83,6 +91,7 @@ class qa_html_theme_base ...@@ -83,6 +91,7 @@ class qa_html_theme_base
* Output each element in $elements on a separate line, with automatic HTML indenting. * Output each element in $elements on a separate line, with automatic HTML indenting.
* This should be passed markup which uses the <tag/> form for unpaired tags, to help keep * This should be passed markup which uses the <tag/> form for unpaired tags, to help keep
* track of indenting, although its actual output converts these to <tag> for W3C validation. * track of indenting, although its actual output converts these to <tag> for W3C validation.
* @param $elements
*/ */
public function output_array($elements) public function output_array($elements)
{ {
...@@ -125,6 +134,7 @@ class qa_html_theme_base ...@@ -125,6 +134,7 @@ class qa_html_theme_base
/** /**
* Output $html at the current indent level, but don't change indent level based on the markup within. * Output $html at the current indent level, but don't change indent level based on the markup within.
* Useful for user-entered HTML which is unlikely to follow the rules we need to track indenting. * Useful for user-entered HTML which is unlikely to follow the rules we need to track indenting.
* @param $html
*/ */
public function output_raw($html) public function output_raw($html)
{ {
...@@ -136,8 +146,13 @@ class qa_html_theme_base ...@@ -136,8 +146,13 @@ class qa_html_theme_base
/** /**
* Output the three elements ['prefix'], ['data'] and ['suffix'] of $parts (if they're defined), * Output the three elements ['prefix'], ['data'] and ['suffix'] of $parts (if they're defined),
* with appropriate CSS classes based on $class, using $outertag and $innertag in the markup. * with appropriate CSS classes based on $class, using $outertag and $innertag in the markup.
* @param $parts
* @param $class
* @param string $outertag
* @param string $innertag
* @param string $extraclass
*/ */
public function output_split($parts, $class, $outertag='span', $innertag='span', $extraclass=null) public function output_split($parts, $class, $outertag = 'span', $innertag = 'span', $extraclass = null)
{ {
if (empty($parts) && strtolower($outertag) != 'td') if (empty($parts) && strtolower($outertag) != 'td')
return; return;
...@@ -154,6 +169,8 @@ class qa_html_theme_base ...@@ -154,6 +169,8 @@ class qa_html_theme_base
/** /**
* Set some context, which be accessed via $this->context for a function to know where it's being used on the page. * Set some context, which be accessed via $this->context for a function to know where it's being used on the page.
* @param $key
* @param $value
*/ */
public function set_context($key, $value) public function set_context($key, $value)
{ {
...@@ -163,6 +180,7 @@ class qa_html_theme_base ...@@ -163,6 +180,7 @@ class qa_html_theme_base
/** /**
* Clear some context (used at the end of the appropriate loop). * Clear some context (used at the end of the appropriate loop).
* @param $key
*/ */
public function clear_context($key) public function clear_context($key)
{ {
...@@ -173,8 +191,11 @@ class qa_html_theme_base ...@@ -173,8 +191,11 @@ class qa_html_theme_base
/** /**
* Reorder the parts of the page according to the $parts array which contains part keys in their new order. Call this * Reorder the parts of the page according to the $parts array which contains part keys in their new order. Call this
* before main_parts(). See the docs for qa_array_reorder() in util/sort.php for the other parameters. * before main_parts(). See the docs for qa_array_reorder() in util/sort.php for the other parameters.
* @param $parts
* @param string $beforekey
* @param bool $reorderrelative
*/ */
public function reorder_parts($parts, $beforekey=null, $reorderrelative=true) public function reorder_parts($parts, $beforekey = null, $reorderrelative = true)
{ {
require_once QA_INCLUDE_DIR.'util/sort.php'; require_once QA_INCLUDE_DIR.'util/sort.php';
...@@ -184,6 +205,8 @@ class qa_html_theme_base ...@@ -184,6 +205,8 @@ class qa_html_theme_base
/** /**
* Output the widgets (as provided in $this->content['widgets']) for $region and $place. * Output the widgets (as provided in $this->content['widgets']) for $region and $place.
* @param $region
* @param $place
*/ */
public function widgets($region, $place) public function widgets($region, $place)
{ {
...@@ -992,8 +1015,12 @@ class qa_html_theme_base ...@@ -992,8 +1015,12 @@ class qa_html_theme_base
/** /**
* Reorder the fields of $form according to the $keys array which contains the field keys in their new order. Call * Reorder the fields of $form according to the $keys array which contains the field keys in their new order. Call
* before any fields are output. See the docs for qa_array_reorder() in util/sort.php for the other parameters. * before any fields are output. See the docs for qa_array_reorder() in util/sort.php for the other parameters.
* @param $form
* @param $keys
* @param mixed $beforekey
* @param bool $reorderrelative
*/ */
public function form_reorder_fields(&$form, $keys, $beforekey=null, $reorderrelative=true) public function form_reorder_fields(&$form, $keys, $beforekey = null, $reorderrelative = true)
{ {
require_once QA_INCLUDE_DIR.'util/sort.php'; require_once QA_INCLUDE_DIR.'util/sort.php';
...@@ -1175,8 +1202,12 @@ class qa_html_theme_base ...@@ -1175,8 +1202,12 @@ class qa_html_theme_base
/** /**
* Reorder the buttons of $form according to the $keys array which contains the button keys in their new order. Call * Reorder the buttons of $form according to the $keys array which contains the button keys in their new order. Call
* before any buttons are output. See the docs for qa_array_reorder() in util/sort.php for the other parameters. * before any buttons are output. See the docs for qa_array_reorder() in util/sort.php for the other parameters.
* @param $form
* @param $keys
* @param mixed $beforekey
* @param bool $reorderrelative
*/ */
public function form_reorder_buttons(&$form, $keys, $beforekey=null, $reorderrelative=true) public function form_reorder_buttons(&$form, $keys, $beforekey = null, $reorderrelative = true)
{ {
require_once QA_INCLUDE_DIR.'util/sort.php'; require_once QA_INCLUDE_DIR.'util/sort.php';
...@@ -1308,6 +1339,8 @@ class qa_html_theme_base ...@@ -1308,6 +1339,8 @@ class qa_html_theme_base
* tags: any attributes to be added to the select. * tags: any attributes to be added to the select.
* value: the selected value from the 'options' parameter. * value: the selected value from the 'options' parameter.
* match_by: whether to match the 'value' (default) or 'key' of each option to determine if it is to be selected. * match_by: whether to match the 'value' (default) or 'key' of each option to determine if it is to be selected.
* @param $field
* @param $style
*/ */
public function form_select($field, $style) public function form_select($field, $style)
{ {
...@@ -1437,6 +1470,8 @@ class qa_html_theme_base ...@@ -1437,6 +1470,8 @@ class qa_html_theme_base
* @deprecated Table-based layout of users/tags is deprecated from 1.7 onwards and may be * @deprecated Table-based layout of users/tags is deprecated from 1.7 onwards and may be
* removed in a future version. Themes can switch to the new layout by setting the member * removed in a future version. Themes can switch to the new layout by setting the member
* variable $ranking_block_layout to false. * variable $ranking_block_layout to false.
* @param $ranking
* @param $class
*/ */
public function ranking_table($ranking, $class) public function ranking_table($ranking, $class)
{ {
...@@ -1465,6 +1500,9 @@ class qa_html_theme_base ...@@ -1465,6 +1500,9 @@ class qa_html_theme_base
/** /**
* @deprecated See ranking_table above. * @deprecated See ranking_table above.
* @param $item
* @param $class
* @param $spacer
*/ */
public function ranking_table_item($item, $class, $spacer) public function ranking_table_item($item, $class, $spacer)
{ {
...@@ -1491,6 +1529,7 @@ class qa_html_theme_base ...@@ -1491,6 +1529,7 @@ class qa_html_theme_base
/** /**
* @deprecated See ranking_table above. * @deprecated See ranking_table above.
* @param $class
*/ */
public function ranking_spacer($class) public function ranking_spacer($class)
{ {
...@@ -1798,7 +1837,7 @@ class qa_html_theme_base ...@@ -1798,7 +1837,7 @@ class qa_html_theme_base
$this->output_split(@$post['views'], 'qa-view-count'); $this->output_split(@$post['views'], 'qa-view-count');
} }
public function avatar($item, $class, $prefix=null) public function avatar($item, $class, $prefix = null)
{ {
if (isset($item['avatar'])) { if (isset($item['avatar'])) {
if (isset($prefix)) if (isset($prefix))
...@@ -1851,13 +1890,16 @@ class qa_html_theme_base ...@@ -1851,13 +1890,16 @@ class qa_html_theme_base
/** /**
* @deprecated Deprecated from 1.7; please use avatar() instead. * @deprecated Deprecated from 1.7; please use avatar() instead.
* @param $post
* @param $class
* @param string $prefix
*/ */
public function post_avatar($post, $class, $prefix=null) public function post_avatar($post, $class, $prefix = null)
{ {
$this->avatar($post, $class, $prefix); $this->avatar($post, $class, $prefix);
} }
public function post_meta($post, $class, $prefix=null, $separator='<br/>') public function post_meta($post, $class, $prefix = null, $separator = '<br/>')
{ {
$this->output('<span class="'.$class.'-meta">'); $this->output('<span class="'.$class.'-meta">');
...@@ -2426,8 +2468,10 @@ class qa_html_theme_base ...@@ -2426,8 +2468,10 @@ class qa_html_theme_base
/** /**
* Generic method to output a basic list of question links. * Generic method to output a basic list of question links.
* @param array $q_list
* @param string $attrs
*/ */
public function q_title_list($q_list, $attrs=null) public function q_title_list($q_list, $attrs = null)
{ {
$this->output('<ul class="qa-q-title-list">'); $this->output('<ul class="qa-q-title-list">');
foreach ($q_list as $q) { foreach ($q_list as $q) {
...@@ -2442,8 +2486,10 @@ class qa_html_theme_base ...@@ -2442,8 +2486,10 @@ class qa_html_theme_base
/** /**
* Output block of similar questions when asking. * Output block of similar questions when asking.
* @param array $q_list
* @param string $pretext
*/ */
public function q_ask_similar($q_list, $pretext='') public function q_ask_similar($q_list, $pretext = '')
{ {
if (!count($q_list)) if (!count($q_list))
return; return;
...@@ -2451,7 +2497,7 @@ class qa_html_theme_base ...@@ -2451,7 +2497,7 @@ class qa_html_theme_base
$this->output('<div class="qa-ask-similar">'); $this->output('<div class="qa-ask-similar">');
if (strlen($pretext) > 0) if (strlen($pretext) > 0)
$this->output('<p class="qa-ask-similar-title">'.$pretext.'</p>'); $this->output('<p class="qa-ask-similar-title">' . $pretext . '</p>');
$this->q_title_list($q_list, 'target="_blank"'); $this->q_title_list($q_list, 'target="_blank"');
$this->output('</div>'); $this->output('</div>');
......
...@@ -27,6 +27,9 @@ if (!defined('QA_VERSION')) { // don't allow this page to be requested directly ...@@ -27,6 +27,9 @@ if (!defined('QA_VERSION')) { // don't allow this page to be requested directly
/** /**
* Sort the $array of inner arrays by sub-element $by1 of each inner array, and optionally then by sub-element $by2 * Sort the $array of inner arrays by sub-element $by1 of each inner array, and optionally then by sub-element $by2
* @param $array
* @param $by1
* @param null $by2
*/ */
function qa_sort_by(&$array, $by1, $by2 = null) function qa_sort_by(&$array, $by1, $by2 = null)
{ {
...@@ -41,6 +44,9 @@ function qa_sort_by(&$array, $by1, $by2 = null) ...@@ -41,6 +44,9 @@ function qa_sort_by(&$array, $by1, $by2 = null)
/** /**
* Function used in uasort to implement qa_sort_by() * Function used in uasort to implement qa_sort_by()
* @param $a
* @param $b
* @return int
*/ */
function qa_sort_by_fn($a, $b) function qa_sort_by_fn($a, $b)
{ {
...@@ -67,6 +73,9 @@ function qa_sort_by_fn($a, $b) ...@@ -67,6 +73,9 @@ function qa_sort_by_fn($a, $b)
/** /**
* General comparison function for two values, textual or numeric * General comparison function for two values, textual or numeric
* @deprecated * @deprecated
* @param $a
* @param $b
* @return int
*/ */
function qa_sort_cmp($a, $b) function qa_sort_cmp($a, $b)
{ {
...@@ -80,6 +89,9 @@ function qa_sort_cmp($a, $b) ...@@ -80,6 +89,9 @@ function qa_sort_cmp($a, $b)
/** /**
* Inserts $addelements into $array, preserving their keys, before $beforekey in that array. * Inserts $addelements into $array, preserving their keys, before $beforekey in that array.
* If $beforekey cannot be found, the elements are appended at the end of the array. * If $beforekey cannot be found, the elements are appended at the end of the array.
* @param $array
* @param $beforekey
* @param $addelements
*/ */
function qa_array_insert(&$array, $beforekey, $addelements) function qa_array_insert(&$array, $beforekey, $addelements)
{ {
...@@ -118,6 +130,10 @@ define('QA_ARRAY_AT_END', 0.9); // place all the elements at the end of the arra ...@@ -118,6 +130,10 @@ define('QA_ARRAY_AT_END', 0.9); // place all the elements at the end of the arra
* element by passing the key of that element in $beforekey (if $beforekey is not found, the elements are moved to the * element by passing the key of that element in $beforekey (if $beforekey is not found, the elements are moved to the
* end of the array). Any of the QA_ARRAY_* values defined above can also be passed in the $beforekey parameter. * end of the array). Any of the QA_ARRAY_* values defined above can also be passed in the $beforekey parameter.
* If $reorderrelative is true, the relative ordering between the elements will also be set by the order in $keys. * If $reorderrelative is true, the relative ordering between the elements will also be set by the order in $keys.
* @param $array
* @param $keys
* @param mixed $beforekey
* @param bool $reorderrelative
*/ */
function qa_array_reorder(&$array, $keys, $beforekey = null, $reorderrelative = true) function qa_array_reorder(&$array, $keys, $beforekey = null, $reorderrelative = true)
{ {
......
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