diff options
Diffstat (limited to 'inc/pageutils.php')
-rw-r--r-- | inc/pageutils.php | 50 |
1 files changed, 28 insertions, 22 deletions
diff --git a/inc/pageutils.php b/inc/pageutils.php index 49c00d36f..a5bf039d5 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 <andi@splitbrain.org> + * * @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 <andi@splitbrain.org> * * @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,':'); @@ -242,7 +243,6 @@ function sectionID($title,&$check) { return $title; } - /** * Wiki page existence check * @@ -250,9 +250,10 @@ function sectionID($title,&$check) { * * @author Chris Smith <chris@jalakai.co.uk> * - * @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) { @@ -262,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)); } /** @@ -271,7 +272,7 @@ function page_exists($id,$rev='',$clean=true, $date_at=false) { * 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 @@ -298,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 @@ -417,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; } @@ -441,7 +442,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; @@ -488,9 +489,11 @@ function resolve_id($ns,$id,$clean=true){ * * @author Andreas Gohr <andi@splitbrain.org> * - * @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); @@ -501,9 +504,9 @@ function resolve_mediaid($ns,&$page,&$exists,$rev='',$date_at=false){ $rev = $medialog_rev; } } - + $file = mediaFN($page,$rev); - $exists = @file_exists($file); + $exists = file_exists($file); } /** @@ -511,9 +514,11 @@ function resolve_mediaid($ns,&$page,&$exists,$rev='',$date_at=false){ * * @author Andreas Gohr <andi@splitbrain.org> * - * @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; @@ -564,7 +569,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); @@ -738,6 +743,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 */ |