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/html.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'inc/html.php') diff --git a/inc/html.php b/inc/html.php index bda6fb398..dd4a3d8da 100644 --- a/inc/html.php +++ b/inc/html.php @@ -422,6 +422,9 @@ function html_locked(){ * @author Andreas Gohr * @author Ben Coburn * @author Kate Arzamastseva + * + * @param int $first skip the first n changelog lines + * @param bool|string $media_id id of media, or false for current page */ function html_revisions($first=0, $media_id = false){ global $ID; @@ -926,7 +929,7 @@ function html_li_default($item){ * @param array $data array with item arrays * @param string $class class of ul wrapper * @param callable $func callback to print an list item - * @param string $lifunc callback to the opening li tag + * @param callable $lifunc callback to the opening li tag * @param bool $forcewrapper Trigger building a wrapper ul if the first level is 0 (we have a root object) or 1 (just the root content) * @return string html of an unordered list -- 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/html.php | 1 + 1 file changed, 1 insertion(+) (limited to 'inc/html.php') diff --git a/inc/html.php b/inc/html.php index dd4a3d8da..ce6360175 100644 --- a/inc/html.php +++ b/inc/html.php @@ -1902,6 +1902,7 @@ function html_debug(){ print ''; if (function_exists('apache_get_version')) { + $apache = array(); $apache['version'] = apache_get_version(); if (function_exists('apache_get_modules')) { -- 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/html.php | 68 +++++++++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 63 insertions(+), 5 deletions(-) (limited to 'inc/html.php') diff --git a/inc/html.php b/inc/html.php index ce6360175..adcd212ed 100644 --- a/inc/html.php +++ b/inc/html.php @@ -83,6 +83,10 @@ function html_denied() { * inserts section edit buttons if wanted or removes the markers * * @author Andreas Gohr + * + * @param string $text + * @param bool $show show section edit buttons? + * @return string */ function html_secedit($text,$show=true){ global $INFO; @@ -101,8 +105,11 @@ function html_secedit($text,$show=true){ * prepares section edit button data for event triggering * used as a callback in html_secedit * - * @triggers HTML_SECEDIT_BUTTON * @author Andreas Gohr + * + * @param array $matches matches with regexp + * @return string + * @triggers HTML_SECEDIT_BUTTON */ function html_secedit_button($matches){ $data = array('secid' => $matches[1], @@ -121,6 +128,9 @@ function html_secedit_button($matches){ * used as default action form HTML_SECEDIT_BUTTON * * @author Adrian Lang + * + * @param array $data name, section id and target + * @return string html */ function html_secedit_get_button($data) { global $ID; @@ -147,6 +157,8 @@ function html_secedit_get_button($data) { * Just the back to top button (in its own form) * * @author Andreas Gohr + * + * @return string html */ function html_topbtn(){ global $lang; @@ -161,6 +173,15 @@ function html_topbtn(){ * If tooltip exists, the access key tooltip is replaced. * * @author Andreas Gohr + * + * @param string $name + * @param string $id + * @param string $akey access key + * @param string[string] $params key-value pairs added as hidden inputs + * @param string $method + * @param string $tooltip + * @param bool|string $label label text, false: lookup btn_$name in localization + * @return string */ function html_btn($name,$id,$akey,$params,$method='get',$tooltip='',$label=false){ global $conf; @@ -213,9 +234,11 @@ function html_btn($name,$id,$akey,$params,$method='get',$tooltip='',$label=false } /** - * show a wiki page + * Show a wiki page * * @author Andreas Gohr + * + * @param null|string $txt wiki text or null for showing $ID */ function html_show($txt=null){ global $ID; @@ -281,6 +304,10 @@ function html_draft(){ * * @author Andreas Gohr * @author Harry Fuecks + * + * @param string $html + * @param array|string $phrases + * @return string html */ function html_hilight($html,$phrases){ $phrases = (array) $phrases; @@ -299,6 +326,9 @@ function html_hilight($html,$phrases){ * Callback used by html_hilight() * * @author Harry Fuecks + * + * @param array $m matches + * @return string html */ function html_hilight_callback($m) { $hlight = unslash($m[0]); @@ -646,6 +676,9 @@ function html_revisions($first=0, $media_id = false){ * @author Matthias Grimm * @author Ben Coburn * @author Kate Arzamastseva + * + * @param int $first + * @param string $show_changes */ function html_recent($first=0, $show_changes='both'){ global $conf; @@ -833,6 +866,8 @@ function html_recent($first=0, $show_changes='both'){ * Display page index * * @author Andreas Gohr + * + * @param string $ns */ function html_index($ns){ global $conf; @@ -861,6 +896,9 @@ function html_index($ns){ * User function for html_buildlist() * * @author Andreas Gohr + * + * @param array $item + * @return string */ function html_list_index($item){ global $ID, $conf; @@ -891,6 +929,9 @@ function html_list_index($item){ * it gives different classes to opened or closed "folders" * * @author Andreas Gohr + * + * @param array $item + * @return string html */ function html_li_index($item){ if($item['type'] == "f"){ @@ -906,6 +947,9 @@ function html_li_index($item){ * Default List item * * @author Andreas Gohr + * + * @param array $item + * @return string html */ function html_li_default($item){ return '
  • '; @@ -1021,12 +1065,13 @@ function html_backlinks(){ /** * Get header of diff HTML + * * @param string $l_rev Left revisions * @param string $r_rev Right revision * @param string $id Page id, if null $ID is used * @param bool $media If it is for media files * @param bool $inline Return the header on a single line - * @return array HTML snippets for diff header + * @return string[] HTML snippets for diff header */ function html_diff_head($l_rev, $r_rev, $id = null, $media = false, $inline = false) { global $lang; @@ -1482,7 +1527,7 @@ function html_diff_navigationlink($difftype, $linktype, $lrev, $rrev = null) { /** * Insert soft breaks in diff html * - * @param $diffhtml + * @param string $diffhtml * @return string */ function html_insert_softbreaks($diffhtml) { @@ -1521,6 +1566,9 @@ REGEX; * show warning on conflict detection * * @author Andreas Gohr + * + * @param string $text + * @param string $summary */ function html_conflict($text,$summary){ global $ID; @@ -1681,7 +1729,6 @@ function html_edit(){ global $lang; global $conf; global $TEXT; - global $RANGE; if ($INPUT->has('changecheck')) { $check = $INPUT->str('changecheck'); @@ -1783,6 +1830,7 @@ function html_edit(){ * Display the default edit form * * Is the default action for HTML_EDIT_FORMSELECTION. + * * @param mixed[] $param */ function html_edit_form($param) { @@ -1802,6 +1850,8 @@ function html_edit_form($param) { * Adds a checkbox for minor edits for logged in users * * @author Andreas Gohr + * + * @return array|bool */ function html_minoredit(){ global $conf; @@ -2081,6 +2131,9 @@ function html_resendpwd() { * Return the TOC rendered to XHTML * * @author Andreas Gohr + * + * @param array $toc + * @return string html */ function html_TOC($toc){ if(!count($toc)) return ''; @@ -2099,6 +2152,9 @@ function html_TOC($toc){ /** * Callback for html_buildlist + * + * @param array $item + * @return string html */ function html_list_toc($item){ if(isset($item['hid'])){ @@ -2133,6 +2189,7 @@ function html_mktocitem($link, $text, $level, $hash='#'){ * Triggers an event with the form name: HTML_{$name}FORM_OUTPUT * * @author Tom N Harris + * * @param string $name The name of the form * @param Doku_Form $form The form */ @@ -2145,6 +2202,7 @@ function html_form($name, &$form) { /** * Form print function. * Just calls printForm() on the data object. + * * @param Doku_Form $data The form */ function html_form_output($data) { -- cgit v1.2.3 From e3710957c6b7e12293805a15d0624be7c7054092 Mon Sep 17 00:00:00 2001 From: Gerrit Uitslag Date: Wed, 1 Oct 2014 17:05:40 +0200 Subject: more phpdocs and minor check --- inc/html.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'inc/html.php') diff --git a/inc/html.php b/inc/html.php index adcd212ed..754e08edf 100644 --- a/inc/html.php +++ b/inc/html.php @@ -177,7 +177,7 @@ function html_topbtn(){ * @param string $name * @param string $id * @param string $akey access key - * @param string[string] $params key-value pairs added as hidden inputs + * @param string[] $params key-value pairs added as hidden inputs * @param string $method * @param string $tooltip * @param bool|string $label label text, false: lookup btn_$name in localization -- cgit v1.2.3 From f7dbf1759d3f9a578d8d84bda58bda7777ee7365 Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Thu, 11 Dec 2014 20:21:44 +0100 Subject: scroll to current page when opening the sitemap --- inc/html.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'inc/html.php') diff --git a/inc/html.php b/inc/html.php index 711cd8db6..cdcd166d9 100644 --- a/inc/html.php +++ b/inc/html.php @@ -937,8 +937,14 @@ function html_list_index($item){ * @return string html */ function html_li_index($item){ + global $INFO; + if($item['type'] == "f"){ - return '
  • '; + // scroll to the current item + if($item['id'] == $INFO['id']) { + $id = ' id="scroll__here"'; + } + return '
  • '; }elseif($item['open']){ return '
  • '; }else{ -- cgit v1.2.3 From 6fa4721ac57074f958b12cf2cf28a489f24e89e1 Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Thu, 11 Dec 2014 20:51:55 +0100 Subject: add new behaviour: bounce Add the class .bounce to any element to let it bounce slightly for 2 seconds. This is useful to make the user aware of some element. Can be combined with #scroll__here when a long list auto scrolls to a certain item. --- inc/html.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'inc/html.php') diff --git a/inc/html.php b/inc/html.php index cdcd166d9..87affd47b 100644 --- a/inc/html.php +++ b/inc/html.php @@ -939,12 +939,16 @@ function html_list_index($item){ function html_li_index($item){ global $INFO; + $class = ''; + $id = ''; + if($item['type'] == "f"){ // scroll to the current item if($item['id'] == $INFO['id']) { $id = ' id="scroll__here"'; + $class = ' bounce'; } - return '
  • '; + return '
  • '; }elseif($item['open']){ return '
  • '; }else{ -- cgit v1.2.3 From 79e79377626799a77c11aa7849cb9c64305590c8 Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Wed, 7 Jan 2015 10:47:45 +0100 Subject: Remove error supression for file_exists() In an older version of PHP a file_exists() call would issue a warning when the file did not exist. This was fixed in later PHP releases. Since we require PHP 5.3 now, there's no need to supress any error here anymore. This might even give a minor performance boost. --- inc/html.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'inc/html.php') diff --git a/inc/html.php b/inc/html.php index 87affd47b..3a93a6604 100644 --- a/inc/html.php +++ b/inc/html.php @@ -501,7 +501,7 @@ function html_revisions($first=0, $media_id = false){ $form->addElement(form_makeOpenTag('ul')); if (!$media_id) $exists = $INFO['exists']; - else $exists = @file_exists(mediaFN($id)); + else $exists = file_exists(mediaFN($id)); $display_name = (!$media_id && useHeading('navigation')) ? hsc(p_get_first_heading($id)) : $id; if (!$display_name) $display_name = $id; @@ -568,7 +568,7 @@ function html_revisions($first=0, $media_id = false){ $date = dformat($rev); $info = $changelog->getRevisionInfo($rev); if($media_id) { - $exists = @file_exists(mediaFN($id, $rev)); + $exists = file_exists(mediaFN($id, $rev)); } else { $exists = page_exists($id, $rev); } @@ -765,7 +765,7 @@ function html_recent($first=0, $show_changes='both'){ $href = ''; if (!empty($recent['media'])) { - $diff = (count(getRevisions($recent['id'], 0, 1, 8192, true)) && @file_exists(mediaFN($recent['id']))); + $diff = (count(getRevisions($recent['id'], 0, 1, 8192, true)) && file_exists(mediaFN($recent['id']))); if ($diff) { $href = media_managerURL(array('tab_details' => 'history', 'mediado' => 'diff', 'image' => $recent['id'], 'ns' => getNS($recent['id'])), '&'); -- cgit v1.2.3 From 0747f5d729d43516c67c5240a662a68dfb446437 Mon Sep 17 00:00:00 2001 From: ghi Date: Tue, 17 Feb 2015 11:38:10 +0100 Subject: event HTML_SHOWREV_OUTPUT --- inc/html.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'inc/html.php') diff --git a/inc/html.php b/inc/html.php index 3a93a6604..c87d0ea87 100644 --- a/inc/html.php +++ b/inc/html.php @@ -232,6 +232,14 @@ function html_btn($name,$id,$akey,$params,$method='get',$tooltip='',$label=false return $ret; } +/** + * show a revision warning + * + * @author Szymon Olewniczak + */ +function html_showrev($data) { + print p_locale_xhtml($data); +} /** * Show a wiki page @@ -265,7 +273,10 @@ function html_show($txt=null){ echo ''; }else{ - if ($REV||$DATE_AT) print p_locale_xhtml('showrev'); + if ($REV||$DATE_AT){ + $data = 'showrev'; + trigger_event('HTML_SHOWREV_OUTPUT', $data, 'html_showrev'); + } $html = p_wiki_xhtml($ID,$REV,true,$DATE_AT); $html = html_secedit($html,$secedit); if($INFO['prependTOC']) $html = tpl_toc(true).$html; -- cgit v1.2.3 From c8556525035212e8abf05907e8cfdf290bb6dcd6 Mon Sep 17 00:00:00 2001 From: ghi Date: Wed, 18 Feb 2015 10:47:05 +0100 Subject: passing rev and date_at to the event --- inc/html.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'inc/html.php') diff --git a/inc/html.php b/inc/html.php index c87d0ea87..4bf784502 100644 --- a/inc/html.php +++ b/inc/html.php @@ -237,8 +237,8 @@ function html_btn($name,$id,$akey,$params,$method='get',$tooltip='',$label=false * * @author Szymon Olewniczak */ -function html_showrev($data) { - print p_locale_xhtml($data); +function html_showrev() { + print p_locale_xhtml('showrev'); } /** @@ -274,7 +274,7 @@ function html_show($txt=null){ }else{ if ($REV||$DATE_AT){ - $data = 'showrev'; + $data = array('rev' => &$REV, 'date_at' => &$DATE_AT); trigger_event('HTML_SHOWREV_OUTPUT', $data, 'html_showrev'); } $html = p_wiki_xhtml($ID,$REV,true,$DATE_AT); -- cgit v1.2.3 From 689215716f1a8fc21318a4e032a96a3a592317e7 Mon Sep 17 00:00:00 2001 From: Gerrit Uitslag Date: Sat, 16 May 2015 10:51:32 +0200 Subject: replace deprecated getRevisions call --- inc/html.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'inc/html.php') diff --git a/inc/html.php b/inc/html.php index 4bf784502..2564c3bd6 100644 --- a/inc/html.php +++ b/inc/html.php @@ -776,10 +776,16 @@ function html_recent($first=0, $show_changes='both'){ $href = ''; if (!empty($recent['media'])) { - $diff = (count(getRevisions($recent['id'], 0, 1, 8192, true)) && file_exists(mediaFN($recent['id']))); + $changelog = new MediaChangeLog($recent['id']); + $revs = $changelog->getRevisions(0, 1); + $diff = (count($revs) && file_exists(mediaFN($recent['id']))); if ($diff) { - $href = media_managerURL(array('tab_details' => 'history', - 'mediado' => 'diff', 'image' => $recent['id'], 'ns' => getNS($recent['id'])), '&'); + $href = media_managerURL(array( + 'tab_details' => 'history', + 'mediado' => 'diff', + 'image' => $recent['id'], + 'ns' => getNS($recent['id']) + ), '&'); } } else { $href = wl($recent['id'],"do=diff", false, '&'); -- cgit v1.2.3 From bdca103af13cf846a195328c69264d3ec632056b Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Fri, 22 May 2015 14:39:25 +0200 Subject: avoid accessing nonexistant array key. fixes #1165 --- inc/html.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'inc/html.php') diff --git a/inc/html.php b/inc/html.php index 2564c3bd6..2f10e3c08 100644 --- a/inc/html.php +++ b/inc/html.php @@ -1409,7 +1409,13 @@ function html_diff_navigation($pagelog, $type, $l_rev, $r_rev) { // last timestamp is not in changelog, retrieve timestamp from metadata // note: when page is removed, the metadata timestamp is zero - $r_rev = $r_rev ? $r_rev : $INFO['meta']['last_change']['date']; + if(!$r_rev) { + if(isset($INFO['meta']['last_change']['date'])) { + $r_rev = $INFO['meta']['last_change']['date']; + } else { + $r_rev = 0; + } + } //retrieve revisions with additional info list($l_revs, $r_revs) = $pagelog->getRevisionsAround($l_rev, $r_rev); -- cgit v1.2.3 From ae614416a5d7f5cab6c5b82a0c45f587d7fa9c01 Mon Sep 17 00:00:00 2001 From: Anika Henke Date: Sun, 12 Jul 2015 19:05:43 +0100 Subject: changed all input type=submit buttons to button type=submit button for better stylability --- inc/html.php | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'inc/html.php') diff --git a/inc/html.php b/inc/html.php index 2f10e3c08..1ccc056de 100644 --- a/inc/html.php +++ b/inc/html.php @@ -183,7 +183,7 @@ function html_topbtn(){ * @param bool|string $label label text, false: lookup btn_$name in localization * @return string */ -function html_btn($name,$id,$akey,$params,$method='get',$tooltip='',$label=false){ +function html_btn($name, $id, $akey, $params, $method='get', $tooltip='', $label=false){ global $conf; global $lang; @@ -221,13 +221,15 @@ function html_btn($name,$id,$akey,$params,$method='get',$tooltip='',$label=false $tip = htmlspecialchars($label); } - $ret .= 'addElement(form_makeOpenTag('div', array('class' => 'pagenav-prev'))); - $form->addElement(form_makeTag('input', array( + $form->addElement(form_makeOpenTag('button', array( 'type' => 'submit', 'name' => 'first['.$first.']', - 'value' => $lang['btn_newer'], 'accesskey' => 'n', 'title' => $lang['btn_newer'].' [N]', 'class' => 'button show' ))); + $form->addElement($lang['btn_newer']); + $form->addElement(form_makeCloseTag('button')); $form->addElement(form_makeCloseTag('div')); } if ($hasNext) { $form->addElement(form_makeOpenTag('div', array('class' => 'pagenav-next'))); - $form->addElement(form_makeTag('input', array( + $form->addElement(form_makeOpenTag('button', array( 'type' => 'submit', 'name' => 'first['.$last.']', - 'value' => $lang['btn_older'], 'accesskey' => 'p', 'title' => $lang['btn_older'].' [P]', 'class' => 'button show' ))); + $form->addElement($lang['btn_older']); + $form->addElement(form_makeCloseTag('button')); $form->addElement(form_makeCloseTag('div')); } $form->addElement(form_makeCloseTag('div')); @@ -1005,7 +1009,7 @@ function html_li_default($item){ * @param callable $func callback to print an list item * @param callable $lifunc callback to the opening li tag * @param bool $forcewrapper Trigger building a wrapper ul if the first level is - 0 (we have a root object) or 1 (just the root content) + * 0 (we have a root object) or 1 (just the root content) * @return string html of an unordered list */ function html_buildlist($data,$class,$func,$lifunc='html_li_default',$forcewrapper=false){ -- cgit v1.2.3 From 8d4151ded3d683f2ef8524b9bb48460a767e334f Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Sat, 18 Jul 2015 12:46:50 +0200 Subject: added styler into default plugin section The icon does not match the others because the NuvolaX icon theme seems to have vanished from the Internet. Ideally all those admin icons could use a replacement. But that should be a different PR I guess. --- inc/html.php | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'inc/html.php') diff --git a/inc/html.php b/inc/html.php index 2f10e3c08..36083a57e 100644 --- a/inc/html.php +++ b/inc/html.php @@ -2076,6 +2076,13 @@ function html_admin(){ $menu['config']['prompt'].'
  • '); } unset($menu['config']); + + if($menu['styling']){ + ptln('
  • '); + } + unset($menu['styling']); } ptln(''); -- cgit v1.2.3