Lines Matching defs:id

19  * For $param='id' $conf['start'] is returned if no id was found.
24 * @param string $param the $_REQUEST variable name, default 'id'
28 function getID($param='id',$clean=true){
34 $id = $INPUT->str($param);
36 //construct page id from request URI
37 if(empty($id) && $conf['userewrite'] == 2){
44 if($param != 'id') {
64 //remove script URL and Querystring to gain the id
66 $id = preg_replace ('/\?.*/','',$match[1]);
68 $id = urldecode($id);
70 $id = preg_replace('!^/+!','',$id);
74 if(substr($id,-1) == ':' || ($conf['useslash'] && substr($id,-1) == '/')){
75 if(page_exists($id.$conf['start'])){
77 $id = $id.$conf['start'];
78 }elseif(page_exists($id.noNS(cleanID($id)))){
80 $id = $id.noNS(cleanID($id));
81 }elseif(page_exists($id)){
83 $id = substr($id,0,-1);
86 $id = $id.$conf['start'];
90 if (isset($urlParameters['id'])) {
91 unset($urlParameters['id']);
93 send_redirect(wl($id, $urlParameters, true, '&'));
96 if($clean) $id = cleanID($id);
97 if($id === '' && $param=='id') $id = $conf['start'];
99 return $id;
112 * @return string cleaned id
130 $id = trim((string)$raw_id);
131 $id = \dokuwiki\Utf8\PhpString::strtolower($id);
135 $id = strtr($id,';/','::');
137 $id = strtr($id,';/',':'.$sepchar);
140 if($conf['deaccent'] == 2 || $ascii) $id = \dokuwiki\Utf8\Clean::romanize($id);
141 if($conf['deaccent'] || $ascii) $id = \dokuwiki\Utf8\Clean::deaccent($id,-1);
144 $id = \dokuwiki\Utf8\Clean::stripspecials($id,$sepchar,'\*');
146 if($ascii) $id = \dokuwiki\Utf8\Clean::strip($id);
149 $id = preg_replace($sepcharpat,$sepchar,$id);
150 $id = preg_replace('#:+#',':',$id);
151 $id = trim($id,':._-');
152 $id = preg_replace('#:[:\._\-]+#',':',$id);
153 $id = preg_replace('#[:\._\-]+:#',':',$id);
155 if (!$ascii) $cache[(string)$raw_id] = $id;
156 return($id);
164 * @param string $id
167 function getNS($id){
168 $pos = strrpos((string)$id,':');
170 return substr((string)$id,0,$pos);
180 * @param string $id
183 function noNS($id) {
184 $pos = strrpos($id, ':');
186 return substr($id, $pos+1);
188 return $id;
197 * @param string $id
200 function curNS($id) {
201 return noNS(getNS($id));
209 * @param string $id
212 function noNSorNS($id) {
215 $p = noNS($id);
217 $p = curNS($id);
263 * @param string $id page id
265 * @param bool $clean flag indicating that $id should be cleaned (see wikiFN as well)
269 function page_exists($id,$rev='',$clean=true, $date_at=false) {
271 $pagelog = new PageChangeLog($id);
276 return file_exists(wikiFN($id,$rev,$clean));
284 * @param $raw_id string id of wikipage
287 * when $id is guaranteed to have been cleaned already.
298 $id = $raw_id;
300 if ($clean) $id = cleanID($id);
301 $id = str_replace(':','/',$id);
303 if (isset($cache[$id]) && isset($cache[$id][$rev])) {
304 return $cache[$id][$rev];
308 $fn = $conf['datadir'].'/'.utf8_encodeFN($id).'.txt';
310 $fn = $conf['olddir'].'/'.utf8_encodeFN($id).'.'.$rev.'.txt';
324 if (!isset($cache[$id])) { $cache[$id] = array(); }
325 $cache[$id][$rev] = $fn;
334 * @param string $id page id
337 function wikiLockFN($id) {
339 return $conf['lockdir'].'/'.md5(cleanID($id)).'.lock';
348 * @param string $id page id
352 function metaFN($id,$ext){
354 $id = cleanID($id);
355 $id = str_replace(':','/',$id);
356 $fn = $conf['metadir'].'/'.utf8_encodeFN($id).$ext;
365 * @param string $id media id
369 function mediaMetaFN($id,$ext){
371 $id = cleanID($id);
372 $id = str_replace(':','/',$id);
373 $fn = $conf['mediametadir'].'/'.utf8_encodeFN($id).$ext;
383 * @param string $id page id
386 function metaFiles($id){
387 $basename = metaFN($id, '');
389 // filter files like foo.bar.meta when $id == 'foo'
401 * @param string $id media id
407 function mediaFN($id, $rev='', $clean=true){
409 if ($clean) $id = cleanID($id);
410 $id = str_replace(':','/',$id);
412 $fn = $conf['mediadir'].'/'.utf8_encodeFN($id);
414 $ext = mimetype($id);
415 $name = substr($id,0, -1*strlen($ext[0])-1);
425 * @param string $id The id of the local file
431 function localeFN($id,$ext='txt'){
433 $file = DOKU_CONF.'lang/'.$conf['lang'].'/'.$id.'.'.$ext;
435 $file = DOKU_INC.'inc/lang/'.$conf['lang'].'/'.$id.'.'.$ext;
438 $file = DOKU_INC.'inc/lang/en/'.$id.'.'.$ext;
455 * @param string $ns namespace which is context of id
456 * @param string $id relative id
457 * @param bool $clean flag indicating that id should be cleaned
460 function resolve_id($ns,$id,$clean=true){
464 if($conf['useslash']) $id = str_replace('/',':',$id);
466 // if the id starts with a dot we need to handle the
468 if($id && $id[0] == '.'){
470 $id = preg_replace('/^((\.+:)*)(\.+)(?=[^:\.])/','\1\3:',$id);
472 $id = $ns.':'.$id;
476 $pathA = explode(':', $id);
490 $id = implode(':', $result);
491 }elseif($ns !== false && strpos($id,':') === false){
493 $id = $ns.':'.$id;
496 if($clean) $id = cleanID($id);
497 return $id;
501 * Returns a full media id
505 * @param string $ns namespace which is context of id
506 * @param string &$page (reference) relative media id, updated to resolved id
526 * Returns a full page id
530 * @param string $ns namespace which is context of id
531 * @param string &$page (reference) relative page id, updated to resolved id
633 * @param string $id page id
636 function isHiddenPage($id){
638 'id' => $id,
658 if(preg_match('/'.$conf['hidepages'].'/ui',':'.$data['id'])){
668 * @param string $id page id
671 function isVisiblePage($id){
672 return !isHiddenPage($id);
676 * Format an id for output to a user
683 * @param string $id page id
686 function prettyprint_id($id) {
687 if (!$id || $id === ':') {
690 if ((substr($id, -1, 1) === ':')) {
691 $id .= '*';
693 return hsc($id);
763 * @return false|string the full page id of the found page, false if any