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)
{ {
...@@ -228,6 +233,8 @@ function qa_get_request_content() ...@@ -228,6 +233,8 @@ 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); }
......
...@@ -35,6 +35,8 @@ define('QA_BUILD_DATE', '2016-03-14'); ...@@ -35,6 +35,8 @@ define('QA_BUILD_DATE', '2016-03-14');
* Class names should be of the form Q2A_<Namespace>_<Class>, e.g. Q2A_Util_Debug. There may be multiple "namespaces". * Class names should be of the form Q2A_<Namespace>_<Class>, e.g. Q2A_Util_Debug. There may be multiple "namespaces".
* Classes are mapped to PHP files with the underscores converted to directory separators. The Q2A_Util_Debug class is in * Classes are mapped to PHP files with the underscores converted to directory separators. The Q2A_Util_Debug class is in
* the file qa-include/Q2A/Util/Debug.php. A class named Q2A_Db_User_Messages would be in a file qa-include/Q2A/Db/User/Messages.php. * the file qa-include/Q2A/Util/Debug.php. A class named Q2A_Db_User_Messages would be in a file qa-include/Q2A/Db/User/Messages.php.
*
* @param $class
*/ */
function qa_autoload($class) function qa_autoload($class)
{ {
...@@ -72,6 +74,8 @@ qa_initialize_plugins(); ...@@ -72,6 +74,8 @@ qa_initialize_plugins();
/** /**
* Converts the $version string (e.g. 1.6.2.2) to a floating point that can be used for greater/lesser comparisons * Converts the $version string (e.g. 1.6.2.2) to a floating point that can be used for greater/lesser comparisons
* (PHP's version_compare() function is not quite suitable for our needs) * (PHP's version_compare() function is not quite suitable for our needs)
* @param $version
* @return float
*/ */
function qa_version_to_float($version) function qa_version_to_float($version)
{ {
...@@ -93,6 +97,8 @@ function qa_version_to_float($version) ...@@ -93,6 +97,8 @@ function qa_version_to_float($version)
/** /**
* Returns true if the current Q2A version is lower than $version, if both are valid version strings for qa_version_to_float() * Returns true if the current Q2A version is lower than $version, if both are valid version strings for qa_version_to_float()
* @param $version
* @return bool
*/ */
function qa_qa_version_below($version) function qa_qa_version_below($version)
{ {
...@@ -105,6 +111,8 @@ function qa_qa_version_below($version) ...@@ -105,6 +111,8 @@ function qa_qa_version_below($version)
/** /**
* Returns true if the current PHP version is lower than $version, if both are valid version strings for qa_version_to_float() * Returns true if the current PHP version is lower than $version, if both are valid version strings for qa_version_to_float()
* @param $version
* @return bool
*/ */
function qa_php_version_below($version) function qa_php_version_below($version)
{ {
...@@ -383,6 +391,10 @@ function qa_initialize_plugins() ...@@ -383,6 +391,10 @@ function qa_initialize_plugins()
* Name, Description, Min Q2A & Min PHP are not currently used by themes. * Name, Description, Min Q2A & Min PHP are not currently used by themes.
* *
* @deprecated Deprecated from 1.7; Q2A_Util_Metadata class and metadata.json files should be used instead * @deprecated Deprecated from 1.7; Q2A_Util_Metadata class and metadata.json files should be used instead
* @param $contents
* @param $type
* @param bool $versiononly
* @return array
*/ */
function qa_addon_metadata($contents, $type, $versiononly = false) function qa_addon_metadata($contents, $type, $versiononly = false)
{ {
...@@ -472,6 +484,12 @@ function qa_load_override_files() ...@@ -472,6 +484,12 @@ function qa_load_override_files()
/** /**
* Register a module of $type named $name, whose class named $class is defined in file $include (or null if no include necessary) * Register a module of $type named $name, whose class named $class is defined in file $include (or null if no include necessary)
* If this module comes from a plugin, pass in the local plugin $directory and the $urltoroot relative url for that directory * If this module comes from a plugin, pass in the local plugin $directory and the $urltoroot relative url for that directory
* @param $type
* @param $include
* @param $class
* @param $name
* @param string $directory
* @param string $urltoroot
*/ */
function qa_register_module($type, $include, $class, $name, $directory = QA_INCLUDE_DIR, $urltoroot = null) function qa_register_module($type, $include, $class, $name, $directory = QA_INCLUDE_DIR, $urltoroot = null)
{ {
...@@ -496,6 +514,10 @@ function qa_register_module($type, $include, $class, $name, $directory = QA_INCL ...@@ -496,6 +514,10 @@ function qa_register_module($type, $include, $class, $name, $directory = QA_INCL
/** /**
* Register a layer named $name, defined in file $include. If this layer comes from a plugin (as all currently do), * Register a layer named $name, defined in file $include. If this layer comes from a plugin (as all currently do),
* pass in the local plugin $directory and the $urltoroot relative url for that directory * pass in the local plugin $directory and the $urltoroot relative url for that directory
* @param $include
* @param $name
* @param string $directory
* @param string $urltoroot
*/ */
function qa_register_layer($include, $name, $directory = QA_INCLUDE_DIR, $urltoroot = null) function qa_register_layer($include, $name, $directory = QA_INCLUDE_DIR, $urltoroot = null)
{ {
...@@ -519,6 +541,9 @@ function qa_register_layer($include, $name, $directory = QA_INCLUDE_DIR, $urltor ...@@ -519,6 +541,9 @@ function qa_register_layer($include, $name, $directory = QA_INCLUDE_DIR, $urltor
/** /**
* Register a file $include containing override functions. If this file comes from a plugin (as all currently do), * Register a file $include containing override functions. If this file comes from a plugin (as all currently do),
* pass in the local plugin $directory and the $urltoroot relative url for that directory * pass in the local plugin $directory and the $urltoroot relative url for that directory
* @param $include
* @param string $directory
* @param string $urltoroot
*/ */
function qa_register_overrides($include, $directory = QA_INCLUDE_DIR, $urltoroot = null) function qa_register_overrides($include, $directory = QA_INCLUDE_DIR, $urltoroot = null)
{ {
...@@ -536,6 +561,8 @@ function qa_register_overrides($include, $directory = QA_INCLUDE_DIR, $urltoroot ...@@ -536,6 +561,8 @@ function qa_register_overrides($include, $directory = QA_INCLUDE_DIR, $urltoroot
* Register a set of language phrases, which should be accessed by the prefix $name/ in the qa_lang_*() functions. * Register a set of language phrases, which should be accessed by the prefix $name/ in the qa_lang_*() functions.
* Pass in the $pattern representing the PHP files that define these phrases, where * in the pattern is replaced with * Pass in the $pattern representing the PHP files that define these phrases, where * in the pattern is replaced with
* the language code (e.g. 'fr') and/or 'default'. These files should be formatted like Q2A's qa-lang-*.php files. * the language code (e.g. 'fr') and/or 'default'. These files should be formatted like Q2A's qa-lang-*.php files.
* @param $pattern
* @param $name
*/ */
function qa_register_phrases($pattern, $name) function qa_register_phrases($pattern, $name)
{ {
...@@ -559,6 +586,10 @@ function qa_register_phrases($pattern, $name) ...@@ -559,6 +586,10 @@ function qa_register_phrases($pattern, $name)
/** /**
* Register a plugin module of $type named $name, whose class named $class is defined in file $include (or null if no include necessary) * Register a plugin module of $type named $name, whose class named $class is defined in file $include (or null if no include necessary)
* This function relies on some global variable values and can only be called from a plugin's qa-plugin.php file * This function relies on some global variable values and can only be called from a plugin's qa-plugin.php file
* @param $type
* @param $include
* @param $class
* @param $name
*/ */
function qa_register_plugin_module($type, $include, $class, $name) function qa_register_plugin_module($type, $include, $class, $name)
{ {
...@@ -574,6 +605,8 @@ function qa_register_plugin_module($type, $include, $class, $name) ...@@ -574,6 +605,8 @@ function qa_register_plugin_module($type, $include, $class, $name)
/** /**
* Register a plugin layer named $name, defined in file $include. Can only be called from a plugin's qa-plugin.php file * Register a plugin layer named $name, defined in file $include. Can only be called from a plugin's qa-plugin.php file
* @param $include
* @param $name
*/ */
function qa_register_plugin_layer($include, $name) function qa_register_plugin_layer($include, $name)
{ {
...@@ -589,6 +622,7 @@ function qa_register_plugin_layer($include, $name) ...@@ -589,6 +622,7 @@ function qa_register_plugin_layer($include, $name)
/** /**
* Register a plugin file $include containing override functions. Can only be called from a plugin's qa-plugin.php file * Register a plugin file $include containing override functions. Can only be called from a plugin's qa-plugin.php file
* @param $include
*/ */
function qa_register_plugin_overrides($include) function qa_register_plugin_overrides($include)
{ {
...@@ -604,6 +638,8 @@ function qa_register_plugin_overrides($include) ...@@ -604,6 +638,8 @@ function qa_register_plugin_overrides($include)
/** /**
* Register a file name $pattern within a plugin directory containing language phrases accessed by the prefix $name * Register a file name $pattern within a plugin directory containing language phrases accessed by the prefix $name
* @param $pattern
* @param $name
*/ */
function qa_register_plugin_phrases($pattern, $name) function qa_register_plugin_phrases($pattern, $name)
{ {
...@@ -622,6 +658,8 @@ function qa_register_plugin_phrases($pattern, $name) ...@@ -622,6 +658,8 @@ function qa_register_plugin_phrases($pattern, $name)
/** /**
* Calls eval() on the PHP code in $eval which came from the file $filename. It supplements PHP's regular error reporting by * Calls eval() on the PHP code in $eval which came from the file $filename. It supplements PHP's regular error reporting by
* displaying/logging (as appropriate) the original source filename, if an error occurred when evaluating the code. * displaying/logging (as appropriate) the original source filename, if an error occurred when evaluating the code.
* @param $eval
* @param $filename
*/ */
function qa_eval_from_file($eval, $filename) function qa_eval_from_file($eval, $filename)
{ {
...@@ -655,6 +693,9 @@ function qa_eval_from_file($eval, $filename) ...@@ -655,6 +693,9 @@ function qa_eval_from_file($eval, $filename)
/** /**
* Call $function with the arguments in the $args array (doesn't work with call-by-reference functions) * Call $function with the arguments in the $args array (doesn't work with call-by-reference functions)
* @param $function
* @param $args
* @return mixed
*/ */
function qa_call($function, $args) function qa_call($function, $args)
{ {
...@@ -709,6 +750,9 @@ function qa_to_override($function) ...@@ -709,6 +750,9 @@ function qa_to_override($function)
/** /**
* Call the function which immediately overrides $function with the arguments in the $args array * Call the function which immediately overrides $function with the arguments in the $args array
* @param $function
* @param $args
* @return mixed
*/ */
function qa_call_override($function, $args) function qa_call_override($function, $args)
{ {
...@@ -729,6 +773,7 @@ function qa_call_override($function, $args) ...@@ -729,6 +773,7 @@ function qa_call_override($function, $args)
/** /**
* Exit PHP immediately after reporting a shutdown with $reason to any installed process modules * Exit PHP immediately after reporting a shutdown with $reason to any installed process modules
* @param string $reason
*/ */
function qa_exit($reason = null) function qa_exit($reason = null)
{ {
...@@ -741,6 +786,8 @@ function qa_exit($reason = null) ...@@ -741,6 +786,8 @@ function qa_exit($reason = null)
/** /**
* Display $message in the browser, write it to server error log, and then stop abruptly * Display $message in the browser, write it to server error log, and then stop abruptly
* @param $message
* @return mixed
*/ */
function qa_fatal_error($message) function qa_fatal_error($message)
{ {
...@@ -784,6 +831,8 @@ function qa_list_module_types() ...@@ -784,6 +831,8 @@ function qa_list_module_types()
/** /**
* Return a list of names of registered modules of $type * Return a list of names of registered modules of $type
* @param $type
* @return array
*/ */
function qa_list_modules($type) function qa_list_modules($type)
{ {
...@@ -793,6 +842,9 @@ function qa_list_modules($type) ...@@ -793,6 +842,9 @@ function qa_list_modules($type)
/** /**
* Return an array containing information about the module of $type named $name * Return an array containing information about the module of $type named $name
* @param $type
* @param $name
* @return
*/ */
function qa_get_module_info($type, $name) function qa_get_module_info($type, $name)
{ {
...@@ -802,6 +854,9 @@ function qa_get_module_info($type, $name) ...@@ -802,6 +854,9 @@ function qa_get_module_info($type, $name)
/** /**
* Return an instantiated class for module of $type named $name, whose functions can be called, or null if it doesn't exist * Return an instantiated class for module of $type named $name, whose functions can be called, or null if it doesn't exist
* @param $type
* @param $name
* @return mixed|null
*/ */
function qa_load_module($type, $name) function qa_load_module($type, $name)
{ {
...@@ -833,6 +888,8 @@ function qa_load_module($type, $name) ...@@ -833,6 +888,8 @@ function qa_load_module($type, $name)
/** /**
* Return an array of instantiated clases for modules which have defined $method * Return an array of instantiated clases for modules which have defined $method
* (all modules are loaded but not included in the returned array) * (all modules are loaded but not included in the returned array)
* @param $method
* @return array
*/ */
function qa_load_all_modules_with($method) function qa_load_all_modules_with($method)
{ {
...@@ -855,6 +912,9 @@ function qa_load_all_modules_with($method) ...@@ -855,6 +912,9 @@ function qa_load_all_modules_with($method)
/** /**
* Return an array of instantiated clases for modules of $type which have defined $method * Return an array of instantiated clases for modules of $type which have defined $method
* (other modules of that type are also loaded but not included in the returned array) * (other modules of that type are also loaded but not included in the returned array)
* @param $type
* @param $method
* @return array
*/ */
function qa_load_modules_with($type, $method) function qa_load_modules_with($type, $method)
{ {
...@@ -877,6 +937,9 @@ function qa_load_modules_with($type, $method) ...@@ -877,6 +937,9 @@ function qa_load_modules_with($type, $method)
/** /**
* Return HTML representation of $string, work well with blocks of text if $multiline is true * Return HTML representation of $string, work well with blocks of text if $multiline is true
* @param $string
* @param bool $multiline
* @return mixed|string
*/ */
function qa_html($string, $multiline = false) function qa_html($string, $multiline = false)
{ {
...@@ -897,8 +960,12 @@ function qa_html($string, $multiline = false) ...@@ -897,8 +960,12 @@ function qa_html($string, $multiline = false)
* Return $html after ensuring it is safe, i.e. removing Javascripts and the like - uses htmLawed library * Return $html after ensuring it is safe, i.e. removing Javascripts and the like - uses htmLawed library
* Links open in a new window if $linksnewwindow is true. Set $storage to true if sanitization is for * Links open in a new window if $linksnewwindow is true. Set $storage to true if sanitization is for
* storing in the database, rather than immediate display to user - some think this should be less strict. * storing in the database, rather than immediate display to user - some think this should be less strict.
* @param $html
* @param bool $linksnewwindow
* @param bool $storage
* @return mixed|string
*/ */
function qa_sanitize_html($html, $linksnewwindow=false, $storage=false) function qa_sanitize_html($html, $linksnewwindow = false, $storage = false)
{ {
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); }
...@@ -923,6 +990,9 @@ function qa_sanitize_html($html, $linksnewwindow=false, $storage=false) ...@@ -923,6 +990,9 @@ function qa_sanitize_html($html, $linksnewwindow=false, $storage=false)
/** /**
* htmLawed hook function used to process tags in qa_sanitize_html(...) * htmLawed hook function used to process tags in qa_sanitize_html(...)
* @param $element
* @param array $attributes
* @return string
*/ */
function qa_sanitize_html_hook_tag($element, $attributes = null) function qa_sanitize_html_hook_tag($element, $attributes = null)
{ {
...@@ -950,6 +1020,8 @@ function qa_sanitize_html_hook_tag($element, $attributes = null) ...@@ -950,6 +1020,8 @@ function qa_sanitize_html_hook_tag($element, $attributes = null)
/** /**
* Return XML representation of $string, which is similar to HTML but ASCII control characters are also disallowed * Return XML representation of $string, which is similar to HTML but ASCII control characters are also disallowed
* @param $string
* @return string
*/ */
function qa_xml($string) function qa_xml($string)
{ {
...@@ -960,6 +1032,9 @@ function qa_xml($string) ...@@ -960,6 +1032,9 @@ function qa_xml($string)
/** /**
* Return JavaScript representation of $value, putting in quotes if non-numeric or if $forcequotes is true. In the * Return JavaScript representation of $value, putting in quotes if non-numeric or if $forcequotes is true. In the
* case of boolean values they are returned as the appropriate true or false string * case of boolean values they are returned as the appropriate true or false string
* @param $value
* @param bool $forcequotes
* @return string
*/ */
function qa_js($value, $forcequotes = false) function qa_js($value, $forcequotes = false)
{ {
...@@ -984,8 +1059,12 @@ function qa_js($value, $forcequotes = false) ...@@ -984,8 +1059,12 @@ function qa_js($value, $forcequotes = false)
/** /**
* Inform Q2A that the current request is $request (slash-separated, independent of the url scheme chosen), * Inform Q2A that the current request is $request (slash-separated, independent of the url scheme chosen),
* that the relative path to the Q2A root apperas to be $relativeroot, and the url scheme appears to be $usedformat * that the relative path to the Q2A root apperas to be $relativeroot, and the url scheme appears to be $usedformat
* @param $request
* @param $relativeroot
* @param $usedformat
* @return mixed
*/ */
function qa_set_request($request, $relativeroot, $usedformat=null) function qa_set_request($request, $relativeroot, $usedformat = 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); }
...@@ -1011,6 +1090,8 @@ function qa_request() ...@@ -1011,6 +1090,8 @@ function qa_request()
/** /**
* Returns the indexed $part (as separated by slashes) of the current Q2A request, or null if it doesn't exist * Returns the indexed $part (as separated by slashes) of the current Q2A request, or null if it doesn't exist
* @param $part
* @return
*/ */
function qa_request_part($part) function qa_request_part($part)
{ {
...@@ -1021,6 +1102,8 @@ function qa_request_part($part) ...@@ -1021,6 +1102,8 @@ function qa_request_part($part)
/** /**
* Returns an array of parts (as separated by slashes) of the current Q2A request, starting at part $start * Returns an array of parts (as separated by slashes) of the current Q2A request, starting at part $start
* @param int $start
* @return array
*/ */
function qa_request_parts($start = 0) function qa_request_parts($start = 0)
{ {
...@@ -1030,6 +1113,8 @@ function qa_request_parts($start = 0) ...@@ -1030,6 +1113,8 @@ function qa_request_parts($start = 0)
/** /**
* Return string for incoming GET/POST/COOKIE value, stripping slashes if appropriate * Return string for incoming GET/POST/COOKIE value, stripping slashes if appropriate
* @param $string
* @return mixed|string
*/ */
function qa_gpc_to_string($string) function qa_gpc_to_string($string)
{ {
...@@ -1041,6 +1126,8 @@ function qa_gpc_to_string($string) ...@@ -1041,6 +1126,8 @@ function qa_gpc_to_string($string)
/** /**
* Return string with slashes added, if appropriate for later removal by qa_gpc_to_string() * Return string with slashes added, if appropriate for later removal by qa_gpc_to_string()
* @param $string
* @return mixed|string
*/ */
function qa_string_to_gpc($string) function qa_string_to_gpc($string)
{ {
...@@ -1052,6 +1139,8 @@ function qa_string_to_gpc($string) ...@@ -1052,6 +1139,8 @@ function qa_string_to_gpc($string)
/** /**
* Return string for incoming GET field, or null if it's not defined * Return string for incoming GET field, or null if it's not defined
* @param $field
* @return mixed|null|string
*/ */
function qa_get($field) function qa_get($field)
{ {
...@@ -1064,6 +1153,8 @@ function qa_get($field) ...@@ -1064,6 +1153,8 @@ function qa_get($field)
/** /**
* Return string for incoming POST field, or null if it's not defined. * Return string for incoming POST field, or null if it's not defined.
* While we're at it, trim() surrounding white space and converted to Unix line endings. * While we're at it, trim() surrounding white space and converted to Unix line endings.
* @param $field
* @return mixed|null
*/ */
function qa_post_text($field) function qa_post_text($field)
{ {
...@@ -1075,6 +1166,8 @@ function qa_post_text($field) ...@@ -1075,6 +1166,8 @@ function qa_post_text($field)
/** /**
* Return an array for incoming POST field, or null if it's not an array or not defined. * Return an array for incoming POST field, or null if it's not an array or not defined.
* While we're at it, trim() surrounding white space for each value and convert them to Unix line endings. * While we're at it, trim() surrounding white space for each value and convert them to Unix line endings.
* @param $field
* @return array|mixed|null
*/ */
function qa_post_array($field) function qa_post_array($field)
{ {
...@@ -1095,6 +1188,8 @@ function qa_post_array($field) ...@@ -1095,6 +1188,8 @@ function qa_post_array($field)
/** /**
* Return true if form button $name was clicked (as type=submit/image) to create this page request, or if a * Return true if form button $name was clicked (as type=submit/image) to create this page request, or if a
* simulated click was sent for the button (via 'qa_click' POST field) * simulated click was sent for the button (via 'qa_click' POST field)
* @param $name
* @return bool|mixed
*/ */
function qa_clicked($name) function qa_clicked($name)
{ {
...@@ -1254,6 +1349,8 @@ function qa_is_mobile_probably() ...@@ -1254,6 +1349,8 @@ function qa_is_mobile_probably()
* loading an option now will cause a problem (see issue in qa_default_option()). The part of * loading an option now will cause a problem (see issue in qa_default_option()). The part of
* $identifier before the slash (/) replaces the * in the qa-lang-*.php file references, and the * $identifier before the slash (/) replaces the * in the qa-lang-*.php file references, and the
* part after the / is the key of the array element to be taken from that file's returned result. * part after the / is the key of the array element to be taken from that file's returned result.
* @param $identifier
* @return string
*/ */
function qa_lang($identifier) function qa_lang($identifier)
{ {
...@@ -1302,6 +1399,10 @@ function qa_lang($identifier) ...@@ -1302,6 +1399,10 @@ function qa_lang($identifier)
/** /**
* Return the translated string for $identifier, with $symbol substituted for $textparam * Return the translated string for $identifier, with $symbol substituted for $textparam
* @param $identifier
* @param $textparam
* @param string $symbol
* @return mixed
*/ */
function qa_lang_sub($identifier, $textparam, $symbol = '^') function qa_lang_sub($identifier, $textparam, $symbol = '^')
{ {
...@@ -1311,6 +1412,8 @@ function qa_lang_sub($identifier, $textparam, $symbol = '^') ...@@ -1311,6 +1412,8 @@ function qa_lang_sub($identifier, $textparam, $symbol = '^')
/** /**
* Return the translated string for $identifier, converted to HTML * Return the translated string for $identifier, converted to HTML
* @param $identifier
* @return mixed|string
*/ */
function qa_lang_html($identifier) function qa_lang_html($identifier)
{ {
...@@ -1320,6 +1423,10 @@ function qa_lang_html($identifier) ...@@ -1320,6 +1423,10 @@ function qa_lang_html($identifier)
/** /**
* Return the translated string for $identifier converted to HTML, with $symbol *then* substituted for $htmlparam * Return the translated string for $identifier converted to HTML, with $symbol *then* substituted for $htmlparam
* @param $identifier
* @param $htmlparam
* @param string $symbol
* @return mixed
*/ */
function qa_lang_html_sub($identifier, $htmlparam, $symbol = '^') function qa_lang_html_sub($identifier, $htmlparam, $symbol = '^')
{ {
...@@ -1330,6 +1437,10 @@ function qa_lang_html_sub($identifier, $htmlparam, $symbol = '^') ...@@ -1330,6 +1437,10 @@ function qa_lang_html_sub($identifier, $htmlparam, $symbol = '^')
/** /**
* Return an array containing the translated string for $identifier converted to HTML, then split into three, * Return an array containing the translated string for $identifier converted to HTML, then split into three,
* with $symbol substituted for $htmlparam in the 'data' element, and obvious 'prefix' and 'suffix' elements * with $symbol substituted for $htmlparam in the 'data' element, and obvious 'prefix' and 'suffix' elements
* @param $identifier
* @param $htmlparam
* @param string $symbol
* @return array
*/ */
function qa_lang_html_sub_split($identifier, $htmlparam, $symbol = '^') function qa_lang_html_sub_split($identifier, $htmlparam, $symbol = '^')
{ {
...@@ -1378,8 +1489,14 @@ function qa_get_request_map() ...@@ -1378,8 +1489,14 @@ function qa_get_request_map()
* Slashes in $request will not be urlencoded, but any other characters will. * Slashes in $request will not be urlencoded, but any other characters will.
* If $neaturls is set, use that, otherwise retrieve the option. If $rooturl is set, take * If $neaturls is set, use that, otherwise retrieve the option. If $rooturl is set, take
* that as the root of the Q2A site, otherwise use path to root which was set elsewhere. * that as the root of the Q2A site, otherwise use path to root which was set elsewhere.
* @param $request
* @param array $params
* @param string $rooturl
* @param int $neaturls
* @param string $anchor
* @return string
*/ */
function qa_path($request, $params=null, $rooturl=null, $neaturls=null, $anchor=null) function qa_path($request, $params = null, $rooturl = null, $neaturls = null, $anchor = 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); }
...@@ -1447,6 +1564,12 @@ function qa_path($request, $params=null, $rooturl=null, $neaturls=null, $anchor= ...@@ -1447,6 +1564,12 @@ function qa_path($request, $params=null, $rooturl=null, $neaturls=null, $anchor=
/** /**
* Return HTML representation of relative URI path for $request - see qa_path() for other parameters * Return HTML representation of relative URI path for $request - see qa_path() for other parameters
* @param $request
* @param array $params
* @param string $rooturl
* @param int $neaturls
* @param string $anchor
* @return mixed|string
*/ */
function qa_path_html($request, $params = null, $rooturl = null, $neaturls = null, $anchor = null) function qa_path_html($request, $params = null, $rooturl = null, $neaturls = null, $anchor = null)
{ {
...@@ -1456,6 +1579,10 @@ function qa_path_html($request, $params = null, $rooturl = null, $neaturls = nul ...@@ -1456,6 +1579,10 @@ function qa_path_html($request, $params = null, $rooturl = null, $neaturls = nul
/** /**
* Return the absolute URI for $request - see qa_path() for other parameters * Return the absolute URI for $request - see qa_path() for other parameters
* @param $request
* @param array $params
* @param string $anchor
* @return string
*/ */
function qa_path_absolute($request, $params = null, $anchor = null) function qa_path_absolute($request, $params = null, $anchor = null)
{ {
...@@ -1486,6 +1613,9 @@ function qa_q_request($questionid, $title) ...@@ -1486,6 +1613,9 @@ function qa_q_request($questionid, $title)
/** /**
* Return the HTML anchor that should be used for post $postid with $basetype (Q/A/C) * Return the HTML anchor that should be used for post $postid with $basetype (Q/A/C)
* @param $basetype
* @param $postid
* @return mixed|string
*/ */
function qa_anchor($basetype, $postid) function qa_anchor($basetype, $postid)
{ {
...@@ -1498,6 +1628,12 @@ function qa_anchor($basetype, $postid) ...@@ -1498,6 +1628,12 @@ function qa_anchor($basetype, $postid)
/** /**
* Return the URL for question $questionid with $title, possibly using $absolute URLs. * Return the URL for question $questionid with $title, possibly using $absolute URLs.
* To link to a specific answer or comment in a question, set $showtype and $showid accordingly. * To link to a specific answer or comment in a question, set $showtype and $showid accordingly.
* @param $questionid
* @param $title
* @param bool $absolute
* @param string $showtype
* @param int $showid
* @return mixed|string
*/ */
function qa_q_path($questionid, $title, $absolute = false, $showtype = null, $showid = null) function qa_q_path($questionid, $title, $absolute = false, $showtype = null, $showid = null)
{ {
...@@ -1518,6 +1654,12 @@ function qa_q_path($questionid, $title, $absolute = false, $showtype = null, $sh ...@@ -1518,6 +1654,12 @@ function qa_q_path($questionid, $title, $absolute = false, $showtype = null, $sh
/** /**
* Return the HTML representation of the URL for $questionid - other parameters as for qa_q_path() * Return the HTML representation of the URL for $questionid - other parameters as for qa_q_path()
* @param $questionid
* @param $title
* @param bool $absolute
* @param string $showtype
* @param int $showid
* @return mixed|string
*/ */
function qa_q_path_html($questionid, $title, $absolute = false, $showtype = null, $showid = null) function qa_q_path_html($questionid, $title, $absolute = false, $showtype = null, $showid = null)
{ {
...@@ -1527,6 +1669,8 @@ function qa_q_path_html($questionid, $title, $absolute = false, $showtype = null ...@@ -1527,6 +1669,8 @@ function qa_q_path_html($questionid, $title, $absolute = false, $showtype = null
/** /**
* Return the request for the specified $feed * Return the request for the specified $feed
* @param $feed
* @return mixed|string
*/ */
function qa_feed_request($feed) function qa_feed_request($feed)
{ {
...@@ -1552,8 +1696,14 @@ function qa_self_html() ...@@ -1552,8 +1696,14 @@ function qa_self_html()
/** /**
* Return HTML for hidden fields to insert into a <form method="get"...> on the page. * Return HTML for hidden fields to insert into a <form method="get"...> on the page.
* This is needed because any parameters on the URL will be lost when the form is submitted. * This is needed because any parameters on the URL will be lost when the form is submitted.
* @param $request
* @param array $params
* @param string $rooturl
* @param int $neaturls
* @param string $anchor
* @return mixed|string
*/ */
function qa_path_form_html($request, $params=null, $rooturl=null, $neaturls=null, $anchor=null) function qa_path_form_html($request, $params = null, $rooturl = null, $neaturls = null, $anchor = 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); }
...@@ -1575,8 +1725,14 @@ function qa_path_form_html($request, $params=null, $rooturl=null, $neaturls=null ...@@ -1575,8 +1725,14 @@ function qa_path_form_html($request, $params=null, $rooturl=null, $neaturls=null
/** /**
* Redirect the user's web browser to $request and then we're done - see qa_path() for other parameters * Redirect the user's web browser to $request and then we're done - see qa_path() for other parameters
* @param $request
* @param array $params
* @param string $rooturl
* @param int $neaturls
* @param string $anchor
* @return mixed
*/ */
function qa_redirect($request, $params=null, $rooturl=null, $neaturls=null, $anchor=null) function qa_redirect($request, $params = null, $rooturl = null, $neaturls = null, $anchor = 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); }
...@@ -1586,6 +1742,8 @@ function qa_redirect($request, $params=null, $rooturl=null, $neaturls=null, $anc ...@@ -1586,6 +1742,8 @@ function qa_redirect($request, $params=null, $rooturl=null, $neaturls=null, $anc
/** /**
* Redirect the user's web browser to page $path which is already a URL * Redirect the user's web browser to page $path which is already a URL
* @param $url
* @return mixed
*/ */
function qa_redirect_raw($url) function qa_redirect_raw($url)
{ {
...@@ -1600,6 +1758,8 @@ function qa_redirect_raw($url) ...@@ -1600,6 +1758,8 @@ function qa_redirect_raw($url)
/** /**
* Return the contents of remote $url, using file_get_contents() if possible, otherwise curl functions * Return the contents of remote $url, using file_get_contents() if possible, otherwise curl functions
* @param $url
* @return mixed|string
*/ */
function qa_retrieve_url($url) function qa_retrieve_url($url)
{ {
...@@ -1626,6 +1786,9 @@ function qa_retrieve_url($url) ...@@ -1626,6 +1786,9 @@ function qa_retrieve_url($url)
/** /**
* Shortcut to get or set an option value without specifying database * Shortcut to get or set an option value without specifying database
* @param $name
* @param mixed $value
* @return
*/ */
function qa_opt($name, $value = null) function qa_opt($name, $value = null)
{ {
...@@ -1646,6 +1809,7 @@ function qa_opt($name, $value = null) ...@@ -1646,6 +1809,7 @@ function qa_opt($name, $value = null)
/** /**
* Simple method to output a preformatted variable * Simple method to output a preformatted variable
* @param $var
*/ */
function qa_debug($var) function qa_debug($var)
{ {
...@@ -1660,6 +1824,7 @@ function qa_debug($var) ...@@ -1660,6 +1824,7 @@ function qa_debug($var)
/** /**
* Suspend the reporting of events to event modules via qa_report_event(...) if $suspend is * Suspend the reporting of events to event modules via qa_report_event(...) if $suspend is
* true, otherwise reinstate it. A counter is kept to allow multiple calls. * true, otherwise reinstate it. A counter is kept to allow multiple calls.
* @param bool $suspend
*/ */
function qa_suspend_event_reports($suspend = true) function qa_suspend_event_reports($suspend = true)
{ {
...@@ -1671,6 +1836,12 @@ function qa_suspend_event_reports($suspend = true) ...@@ -1671,6 +1836,12 @@ function qa_suspend_event_reports($suspend = true)
/** /**
* Send a notification of event $event by $userid, $handle and $cookieid to all event modules, with extra $params * Send a notification of event $event by $userid, $handle and $cookieid to all event modules, with extra $params
* @param $event
* @param $userid
* @param $handle
* @param $cookieid
* @param array $params
* @return mixed|void
*/ */
function qa_report_event($event, $userid, $handle, $cookieid, $params=array()) function qa_report_event($event, $userid, $handle, $cookieid, $params=array())
{ {
......
...@@ -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