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/pageutils.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'inc/pageutils.php') diff --git a/inc/pageutils.php b/inc/pageutils.php index 5f62926e4..adfb10cc7 100644 --- a/inc/pageutils.php +++ b/inc/pageutils.php @@ -265,7 +265,7 @@ function page_exists($id,$rev='',$clean=true) { * The filename is URL encoded to protect Unicode chars * * @param $raw_id string id of wikipage - * @param $rev string page revision, empty string for current + * @param $rev int|string page revision, empty string for current * @param $clean bool flag indicating that $raw_id should be cleaned. Only set to false * when $id is guaranteed to have been cleaned already. * @return string full path -- 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/pageutils.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'inc/pageutils.php') diff --git a/inc/pageutils.php b/inc/pageutils.php index adfb10cc7..b9c6418e2 100644 --- a/inc/pageutils.php +++ b/inc/pageutils.php @@ -20,7 +20,7 @@ * * @param string $param the $_REQUEST variable name, default 'id' * @param bool $clean if true, ID is cleaned - * @return mixed|string + * @return string */ function getID($param='id',$clean=true){ /** @var Input $INPUT */ @@ -97,6 +97,7 @@ function getID($param='id',$clean=true){ * converted to unaccented ones * * @author Andreas Gohr + * * @param string $raw_id The pageid to clean * @param boolean $ascii Force ASCII * @return string cleaned id @@ -152,7 +153,7 @@ function cleanID($raw_id,$ascii=false){ * @author Andreas Gohr * * @param string $id - * @return string|bool the namespace part or false if the given ID has no namespace (root) + * @return string|false the namespace part or false if the given ID has no namespace (root) */ function getNS($id){ $pos = strrpos((string)$id,':'); @@ -435,7 +436,7 @@ function localeFN($id,$ext='txt'){ * @param string $ns namespace which is context of id * @param string $id relative id * @param bool $clean flag indicating that id should be cleaned - * @return mixed|string + * @return string */ function resolve_id($ns,$id,$clean=true){ global $conf; @@ -718,6 +719,7 @@ function utf8_decodeFN($file){ * Used for sidebars, but can be used other stuff as well * * @todo add event hook + * * @param string $page the pagename you're looking for * @return string|false the full page id of the found page, false if any */ -- 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/pageutils.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'inc/pageutils.php') diff --git a/inc/pageutils.php b/inc/pageutils.php index 2fbcbfd1f..375712661 100644 --- a/inc/pageutils.php +++ b/inc/pageutils.php @@ -263,7 +263,7 @@ function page_exists($id,$rev='',$clean=true, $date_at=false) { if($pagelog_rev !== false) $rev = $pagelog_rev; } - return @file_exists(wikiFN($id,$rev,$clean)); + return file_exists(wikiFN($id,$rev,$clean)); } /** @@ -299,9 +299,9 @@ function wikiFN($raw_id,$rev='',$clean=true){ $fn = $conf['olddir'].'/'.utf8_encodeFN($id).'.'.$rev.'.txt'; if($conf['compression']){ //test for extensions here, we want to read both compressions - if (@file_exists($fn . '.gz')){ + if (file_exists($fn . '.gz')){ $fn .= '.gz'; - }else if(@file_exists($fn . '.bz2')){ + }else if(file_exists($fn . '.bz2')){ $fn .= '.bz2'; }else{ //file doesnt exist yet, so we take the configured extension @@ -418,9 +418,9 @@ function mediaFN($id, $rev=''){ function localeFN($id,$ext='txt'){ global $conf; $file = DOKU_CONF.'lang/'.$conf['lang'].'/'.$id.'.'.$ext; - if(!@file_exists($file)){ + if(!file_exists($file)){ $file = DOKU_INC.'inc/lang/'.$conf['lang'].'/'.$id.'.'.$ext; - if(!@file_exists($file)){ + if(!file_exists($file)){ //fall back to english $file = DOKU_INC.'inc/lang/en/'.$id.'.'.$ext; } @@ -504,7 +504,7 @@ function resolve_mediaid($ns,&$page,&$exists,$rev='',$date_at=false){ } $file = mediaFN($page,$rev); - $exists = @file_exists($file); + $exists = file_exists($file); } /** @@ -565,7 +565,7 @@ function resolve_pageid($ns,&$page,&$exists,$rev='',$date_at=false ){ } }else{ //check alternative plural/nonplural form - if(!@file_exists($file)){ + if(!file_exists($file)){ if( $conf['autoplural'] ){ if(substr($page,-1) == 's'){ $try = substr($page,0,-1); -- cgit v1.2.3 From 7de86af9758e71d251fad91063035a459d83d2eb Mon Sep 17 00:00:00 2001 From: Gerrit Uitslag Date: Tue, 30 Jun 2015 23:07:10 +0200 Subject: phpdocs, reformatting --- inc/pageutils.php | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) (limited to 'inc/pageutils.php') diff --git a/inc/pageutils.php b/inc/pageutils.php index 375712661..a5bf039d5 100644 --- a/inc/pageutils.php +++ b/inc/pageutils.php @@ -243,7 +243,6 @@ function sectionID($title,&$check) { return $title; } - /** * Wiki page existence check * @@ -251,9 +250,10 @@ function sectionID($title,&$check) { * * @author Chris Smith * - * @param string $id page id - * @param string|int $rev empty or revision timestamp - * @param bool $clean flag indicating that $id should be cleaned (see wikiFN as well) + * @param string $id page id + * @param string|int $rev empty or revision timestamp + * @param bool $clean flag indicating that $id should be cleaned (see wikiFN as well) + * @param bool $date_at * @return bool exists? */ function page_exists($id,$rev='',$clean=true, $date_at=false) { @@ -489,9 +489,11 @@ function resolve_id($ns,$id,$clean=true){ * * @author Andreas Gohr * - * @param string $ns namespace which is context of id - * @param string &$page (reference) relative media id, updated to resolved id - * @param bool &$exists (reference) updated with existance of media + * @param string $ns namespace which is context of id + * @param string &$page (reference) relative media id, updated to resolved id + * @param bool &$exists (reference) updated with existance of media + * @param int|string $rev + * @param bool $date_at */ function resolve_mediaid($ns,&$page,&$exists,$rev='',$date_at=false){ $page = resolve_id($ns,$page); @@ -502,7 +504,7 @@ function resolve_mediaid($ns,&$page,&$exists,$rev='',$date_at=false){ $rev = $medialog_rev; } } - + $file = mediaFN($page,$rev); $exists = file_exists($file); } @@ -512,9 +514,11 @@ function resolve_mediaid($ns,&$page,&$exists,$rev='',$date_at=false){ * * @author Andreas Gohr * - * @param string $ns namespace which is context of id - * @param string &$page (reference) relative page id, updated to resolved id - * @param bool &$exists (reference) updated with existance of media + * @param string $ns namespace which is context of id + * @param string &$page (reference) relative page id, updated to resolved id + * @param bool &$exists (reference) updated with existance of media + * @param string $rev + * @param bool $date_at */ function resolve_pageid($ns,&$page,&$exists,$rev='',$date_at=false ){ global $conf; -- cgit v1.2.3