Dateiansicht:
Datei: | Projekte -> PHP:libGetBreadcrumb -> libGetBreadcrumb.inc.min.php |
---|---|
md5: | 98f29a7c2eabbf72db24bbb12e285cf0 |
sha1: | 4103be421d6034df1679a0bb09f4d2c1fdf26611 |
Download-Link: | Download |
- <?php
- function getBreadcrumb($sPath,$bolLastLink=false,$sPrePath='',$cDelimOut='/',$cDelimInput='/'){$out='';$path=trim(trim($sPath,$cDelimInput));$ar=explode($cDelimInput,$path);$step=0;$lnk=$sPrePath; foreach($ar as$s){$step++;$txt=htmlspecialchars($s);$lnk.='/'.rawurlencode($s);if($bolLastLink or count($ar)>$step){$out.=$cDelimOut.'<a href="'.$lnk.'">'.$txt.'</a>';}else{$out.=$cDelimOut.$txt;}}$s=array();$s=array();$s[]='\\';$r[]='\\\\';$s[]='/';$r[]='\/';$s[]='?';$r[]='\?';$s[]='+';$r[]='\+';$s[]='*';$r[]='\*';$s[]='.';$r[]='\.';$s[]='(';$r[]='\(';$s[]=')';$r[]='\)';$s[]='[';$r[]='\[';$s[]=']';$r[]='\]';$s[]='{';$r[]='\{';$s[]='}';$r[]='\}';return preg_replace('/^'.str_replace($s,$r,$cDelimOut).'/','',$out);}