Last active
December 16, 2015 01:09
-
-
Save julianwachholz/5352862 to your computer and use it in GitHub Desktop.
Mind you, most of this does absolutely nothing or could be rewritten in two lines.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * Explodes an XPath into an Array / only 2 Levels | |
| * @param array $xpath | |
| * @param boolean $utf8Encode | |
| * @return array | |
| */ | |
| private function titleExploder($xpath, $utf8Encode = TRUE) { | |
| $exTitle = explode('/', $xpath); | |
| if ($utf8Encode) { | |
| foreach ($exTitle as $k => &$v) { | |
| $v = utf8_encode($v); | |
| } | |
| } | |
| if (count($exTitle) > 1) { | |
| // voodoo magic | |
| return array(array_shift($exTitle)) + array(0, implode(' / ', $exTitle)); | |
| } | |
| return $exTitle; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment