public function parseAlias(SimpleXMLElement $entry, Article $article) { $alias = ''; foreach ($entry->link as $link) { if (!empty($link['rel']) && $link['rel'] == 'alternate') { $url = (string) $link['href']; $this->hrefMap[$url] = !$this->debug ? $article->get('id') : rand(1, 10000); $lastSlash = strpos(strrev($url), '/'); $strLength = strlen($url); $lastPos = $strLength - $lastSlash; $alias = substr($url, $lastPos); $ext = pathinfo($alias, PATHINFO_EXTENSION); $alias = str_replace(array('.', $ext), '', $alias); } } if (empty($alias)) { $title = (string) $entry->title; $alias = $article->cleanAlias($title); } return $alias; }