Advertisement
Guest User

youAreHere

a guest
Nov 17th, 2020
26
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.68 KB | None | 0 0
  1.                         case 'youAreHere':
  2.                             $path = $this->option['page'];
  3.                             $nextSeparatorIndex = strpos($path, $prefs['namespace_separator']);
  4.                             if ($prefs['namespace_enabled'] == 'n' || $nextSeparatorIndex == false) {
  5.                                 // namespace disabled or no namespace in title
  6.                                 $value = $path;
  7.                                 break;
  8.                             } else {
  9.                                 $value = "";
  10.                                 $currentPageName = "";
  11.                                 $currentPageLink = "";                             
  12.                                 $pathLen = strlen($path);
  13.                                 $separatorLen = strlen($prefs['namespace_separator']);
  14.                                 while($pathLen != 0 && $pathLen != $separatorLen) {
  15.                                     // Exit condition: path has been parsed or it contains separator only
  16.                                     if ($nextSeparatorIndex == 0) {
  17.                                         // Path starts with namespace separator: we move it from path to currentPageLink
  18.                                         // and we update nextSeparatorIndex
  19.                                         $path = substr($path, $separatorLen);
  20.                                         $currentPageLink .= $prefs['namespace_separator'];
  21.                                         $nextSeparatorIndex = strpos($path, $prefs['namespace_separator']);
  22.                                     }
  23.                                     $currentPageName = ($nextSeparatorIndex != false)? substr($path, 0, $nextSeparatorIndex) : $path;
  24.                                     $currentPageLink .= $currentPageName;
  25.                                    
  26.                                     $path = substr($path, strlen($currentPageName));
  27.                                     $pathLen = strlen($path);
  28.                                     $nextSeparatorIndex = strpos($path, $prefs['namespace_separator']);
  29.                                    
  30.                                     if ($path != "") {
  31.                                         $value .= "((".$currentPageLink."|".$currentPageName.")) > ";
  32.                                     } else {
  33.                                         // Last element of the path, after last namespace separator
  34.                                         $value .= "((".$currentPageLink."|".$currentPageName."))";
  35.                                     }
  36.                                 }
  37.                             }                              
  38.                             break;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement