From e0c26282a603881e8d2f839d94c28dbbfc57d71b Mon Sep 17 00:00:00 2001 From: Gerrit Uitslag Date: Mon, 29 Sep 2014 03:34:17 +0200 Subject: scrutinizer documentations issues --- inc/template.php | 39 ++++++++++++++++++++++++++++----------- 1 file changed, 28 insertions(+), 11 deletions(-) (limited to 'inc/template.php') diff --git a/inc/template.php b/inc/template.php index 7f3c68534..667e3db1c 100644 --- a/inc/template.php +++ b/inc/template.php @@ -204,7 +204,7 @@ function tpl_toc($return = false) { $toc = $TOC; } elseif(($ACT == 'show' || substr($ACT, 0, 6) == 'export') && !$REV && $INFO['exists']) { // get TOC from metadata, render if neccessary - $meta = p_get_metadata($ID, false, METADATA_RENDER_USING_CACHE); + $meta = p_get_metadata($ID, '', METADATA_RENDER_USING_CACHE); if(isset($meta['internal']['toc'])) { $tocok = $meta['internal']['toc']; } else { @@ -503,6 +503,10 @@ function tpl_getparent($id) { * * @author Adrian Lang * @see tpl_get_action + * + * @param string $type + * @param bool $return + * @return bool|string html, or false if no data, true if printed */ function tpl_button($type, $return = false) { $data = tpl_get_action($type); @@ -534,6 +538,13 @@ function tpl_button($type, $return = false) { * * @author Adrian Lang * @see tpl_get_action + * + * @param string $type + * @param string $pre prefix of link + * @param string $suf suffix of link + * @param string $inner innerHML of link + * @param bool $return + * @return bool|string html or false if no data, true if printed */ function tpl_actionlink($type, $pre = '', $suf = '', $inner = '', $return = false) { global $lang; @@ -571,7 +582,7 @@ function tpl_actionlink($type, $pre = '', $suf = '', $inner = '', $return = fals $linktarget, $pre.(($inner) ? $inner : $caption).$suf, 'class="action '.$type.'" '. $akey.$rel. - 'title="'.hsc($caption).$addTitle.'"', 1 + 'title="'.hsc($caption).$addTitle.'"', true ); } if($return) return $out; @@ -599,6 +610,7 @@ function tpl_actionlink($type, $pre = '', $suf = '', $inner = '', $return = fals * @author Andreas Gohr * @author Matthias Grimm * @author Adrian Lang + * * @param string $type * @return array|bool|string */ @@ -757,20 +769,20 @@ function tpl_get_action($type) { * * @author Anika Henke * @param - * @param bool $link link or form button? - * @param bool $wrapper HTML element wrapper - * @param bool $return return or print - * @param string $pre prefix for links - * @param string $suf suffix for links - * @param string $inner inner HTML for links + * @param bool $link link or form button? + * @param string|bool $wrapper HTML element wrapper + * @param bool $return return or print + * @param string $pre prefix for links + * @param string $suf suffix for links + * @param string $inner inner HTML for links * @return bool|string */ function tpl_action($type, $link = false, $wrapper = false, $return = false, $pre = '', $suf = '', $inner = '') { $out = ''; if($link) { - $out .= tpl_actionlink($type, $pre, $suf, $inner, 1); + $out .= tpl_actionlink($type, $pre, $suf, $inner, true); } else { - $out .= tpl_button($type, 1); + $out .= tpl_button($type, true); } if($out && $wrapper) $out = "<$wrapper>$out"; @@ -1029,7 +1041,7 @@ function tpl_pagetitle($id = null, $ret = false) { * @author Andreas Gohr * @param array $tags tags to try * @param string $alt alternative output if no data was found - * @param null $src the image src, uses global $SRC if not given + * @param null|string $src the image src, uses global $SRC if not given * @return string */ function tpl_img_getTag($tags, $alt = '', $src = null) { @@ -1613,6 +1625,11 @@ function tpl_license($img = 'badge', $imgonly = false, $return = false, $wrap = * * This function is useful to populate sidebars or similar features in a * template + * + * @param string $pageid + * @param bool $print + * @param bool $propagate + * @return bool|null|string */ function tpl_include_page($pageid, $print = true, $propagate = false) { if (!$pageid) return false; -- cgit v1.2.3 From 59bc3b48fdffb76ee65a4b630be3ffa1f6c20c80 Mon Sep 17 00:00:00 2001 From: Gerrit Uitslag Date: Mon, 29 Sep 2014 21:45:27 +0200 Subject: more scrutinizer issue improvements --- inc/template.php | 1 - 1 file changed, 1 deletion(-) (limited to 'inc/template.php') diff --git a/inc/template.php b/inc/template.php index 667e3db1c..49f6986fd 100644 --- a/inc/template.php +++ b/inc/template.php @@ -759,7 +759,6 @@ function tpl_get_action($type) { break; default: return '[unknown %s type]'; - break; } return compact('accesskey', 'type', 'id', 'method', 'params', 'nofollow', 'replacement'); } -- cgit v1.2.3 From 42ea7f447f39fbc2f79eaaec31f8c10ede59c5d0 Mon Sep 17 00:00:00 2001 From: Gerrit Uitslag Date: Wed, 1 Oct 2014 11:30:27 +0200 Subject: Many PHPDocs, some unused and dyn declared vars many PHPDocs some unused variables some dynamically declared variables declared --- inc/template.php | 59 +++++++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 52 insertions(+), 7 deletions(-) (limited to 'inc/template.php') diff --git a/inc/template.php b/inc/template.php index 49f6986fd..98ea9df82 100644 --- a/inc/template.php +++ b/inc/template.php @@ -68,6 +68,7 @@ function tpl_basedir($tpl='') { * handled by this function. ACL stuff is not done here either. * * @author Andreas Gohr + * * @triggers TPL_ACT_RENDER * @triggers TPL_CONTENT_DISPLAY * @param bool $prependTOC should the TOC be displayed here? @@ -186,6 +187,7 @@ function tpl_content_core() { * a false argument * * @author Andreas Gohr + * * @param bool $return Should the TOC be returned instead to be printed? * @return string */ @@ -243,6 +245,8 @@ function tpl_toc($return = false) { * Handle the admin page contents * * @author Andreas Gohr + * + * @return bool */ function tpl_admin() { global $INFO; @@ -277,6 +281,7 @@ function tpl_admin() { * This has to go into the head section of your template. * * @author Andreas Gohr + * * @triggers TPL_METAHEADER_OUTPUT * @param bool $alt Should feeds and alternative format links be added? * @return bool @@ -426,10 +431,12 @@ function tpl_metaheaders($alt = true) { * instances. Attributes are given as key value pairs. Values will be HTML * encoded automatically so they should be provided as is in the $data array. * - * For tags having a body attribute specify the the body data in the special + * For tags having a body attribute specify the body data in the special * attribute '_data'. This field will NOT BE ESCAPED automatically. * * @author Andreas Gohr + * + * @param array $data */ function _tpl_metaheaders_action($data) { foreach($data as $tag => $inst) { @@ -456,6 +463,12 @@ function _tpl_metaheaders_action($data) { * Just builds a link. * * @author Andreas Gohr + * + * @param string $url + * @param string $name + * @param string $more + * @param bool $return return html + * @return bool|string html or true */ function tpl_link($url, $name, $more = '', $return = false) { $out = ' + * + * @param string $id page id + * @param string|null $name the name of the link + * @return bool */ function tpl_pagelink($id, $name = null) { print ''.html_wikilink($id, $name).''; @@ -485,6 +502,9 @@ function tpl_pagelink($id, $name = null) { * returns false if none is available * * @author Andreas Gohr + * + * @param string $id page id + * @return false|string */ function tpl_getparent($id) { $parent = getNS($id).':'; @@ -539,7 +559,7 @@ function tpl_button($type, $return = false) { * @author Adrian Lang * @see tpl_get_action * - * @param string $type + * @param string $type action command * @param string $pre prefix of link * @param string $suf suffix of link * @param string $inner innerHML of link @@ -767,7 +787,8 @@ function tpl_get_action($type) { * Wrapper around tpl_button() and tpl_actionlink() * * @author Anika Henke - * @param + * + * @param string $type action command * @param bool $link link or form button? * @param string|bool $wrapper HTML element wrapper * @param bool $return return or print @@ -801,6 +822,7 @@ function tpl_action($type, $link = false, $wrapper = false, $return = false, $pr * autocompletion feature (MSIE and Firefox) * * @author Andreas Gohr + * * @param bool $ajax * @param bool $autocomplete * @return bool @@ -829,6 +851,7 @@ function tpl_searchform($ajax = true, $autocomplete = true) { * Print the breadcrumbs trace * * @author Andreas Gohr + * * @param string $sep Separator between entries * @return bool */ @@ -870,6 +893,7 @@ function tpl_breadcrumbs($sep = '•') { * @author Sean Coates * @author * @todo May behave strangely in RTL languages + * * @param string $sep Separator between entries * @return bool */ @@ -920,6 +944,7 @@ function tpl_youarehere($sep = ' » ') { * Could be enhanced with a profile link in future? * * @author Andreas Gohr + * * @return bool */ function tpl_userinfo() { @@ -938,6 +963,7 @@ function tpl_userinfo() { * Print some info about the current page * * @author Andreas Gohr + * * @param bool $ret return content instead of printing it * @return bool|string */ @@ -1001,6 +1027,7 @@ function tpl_pageinfo($ret = false) { * the given ID is used. * * @author Andreas Gohr + * * @param string $id page id * @param bool $ret return content instead of printing * @return bool|string @@ -1038,6 +1065,7 @@ function tpl_pagetitle($id = null, $ret = false) { * Only allowed in: detail.php * * @author Andreas Gohr + * * @param array $tags tags to try * @param string $alt alternative output if no data was found * @param null|string $src the image src, uses global $SRC if not given @@ -1128,7 +1156,7 @@ function tpl_get_img_meta() { * @param $maxheight int - maximal height of the image * @param $link bool - link to the orginal size? * @param $params array - additional image attributes - * @return mixed Result of TPL_IMG_DISPLAY + * @return bool Result of TPL_IMG_DISPLAY */ function tpl_img($maxwidth = 0, $maxheight = 0, $link = true, $params = null) { global $IMG; @@ -1280,6 +1308,9 @@ function tpl_loadConfig() { * tpl_getLang($id) * * use this function to access template language variables + * + * @param string $id key of language string + * @return string */ function tpl_getLang($id) { static $lang = array(); @@ -1311,6 +1342,9 @@ function tpl_locale_xhtml($id) { /** * Prepends appropriate path for a language dependent filename + * + * @param string $id id of localized text + * @return string wiki text */ function tpl_localeFN($id) { $path = tpl_incdir().'lang/'; @@ -1337,6 +1371,8 @@ function tpl_localeFN($id) { * * @triggers MEDIAMANAGER_CONTENT_OUTPUT * @param bool $fromajax - set true when calling this function via ajax + * @param string $sort + * @author Andreas Gohr */ function tpl_mediaContent($fromajax = false, $sort='natural') { @@ -1511,6 +1547,9 @@ function tpl_mediaTree() { * Note: this will not use any pretty URLs * * @author Andreas Gohr + * + * @param string $empty empty option label + * @param string $button submit button label */ function tpl_actiondropdown($empty = '', $button = '>') { global $ID; @@ -1737,10 +1776,11 @@ function tpl_flush() { * If a given location starts with a colon it is assumed to be a media * file, otherwise it is assumed to be relative to the current template * - * @param array $search locations to look at - * @param bool $abs if to use absolute URL - * @param array &$imginfo filled with getimagesize() + * @param string[] $search locations to look at + * @param bool $abs if to use absolute URL + * @param array &$imginfo filled with getimagesize() * @return string + * * @author Andreas Gohr */ function tpl_getMediaFile($search, $abs = false, &$imginfo = null) { @@ -1791,6 +1831,8 @@ function tpl_getMediaFile($search, $abs = false, &$imginfo = null) { * * @author Anika Henke * @author Andreas Gohr + * + * @param string $file */ function tpl_includeFile($file) { global $config_cascade; @@ -1816,6 +1858,7 @@ function tpl_includeFile($file) { * Returns tag for various icon types (favicon|mobile|generic) * * @author Anika Henke + * * @param array $types - list of icon types to display (favicon|mobile|generic) * @return string */ @@ -1891,6 +1934,8 @@ function tpl_media() { * Return useful layout classes * * @author Anika Henke + * + * @return string */ function tpl_classes() { global $ACT, $conf, $ID, $INFO; -- cgit v1.2.3 From 7e8500eea1e53b1de0e0f70400664afa442cd08d Mon Sep 17 00:00:00 2001 From: Gerrit Uitslag Date: Thu, 2 Oct 2014 14:55:24 +0200 Subject: PHPDocs and some improvements --- inc/template.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'inc/template.php') diff --git a/inc/template.php b/inc/template.php index 98ea9df82..6bb6275f3 100644 --- a/inc/template.php +++ b/inc/template.php @@ -1066,8 +1066,8 @@ function tpl_pagetitle($id = null, $ret = false) { * * @author Andreas Gohr * - * @param array $tags tags to try - * @param string $alt alternative output if no data was found + * @param array|string $tags tags to try + * @param string $alt alternative output if no data was found * @param null|string $src the image src, uses global $SRC if not given * @return string */ -- cgit v1.2.3