/** * Parses $token->getTextToBeParsed() according to the following syntax rule: * UrlPath ::= ["/"][PageUrlKey][QuerySeparator Parameters][Suffix]["/"] . * * Uses $this->_schema URL settings (m_seo_schema_XXX tables), puts all found matches into $this->_parsedUrls. * * @param Mana_Seo_Model_ParsedUrl $token * @return bool */ protected function _parseUrlPath($token) { $pageToken = clone $token->setSlash(substr($token->getTextToBeParsed(), -1) == '/' ? '/' : '')->setTextToBeParsed(rtrim($token->getTextToBeParsed(), '/')); /* @var $mbstring Mana_Core_Helper_Mbstring */ $mbstring = Mage::helper('mana_core/mbstring'); // split by "/", split suffix $separator = $this->_schema->getQuerySeparator(); $suffixes = $this->_scanSuffixes($pageToken, $this->_getAllSuffixes($pageToken)); $tokens = $this->_scanUntilSeparatorOrSuffix($suffixes, $separator); // get all valid page URL key and suffix combinations (including home page) based on given URL path if ($tokens = $this->_getPageUrlKeysAndRemoveSuffixes($tokens)) { foreach ($tokens as $token) { $this->_setPage($token); if ($this->_parseParameters($token)) { return true; } } } // home page if ($mbstring->startsWith($separator, '/') && $mbstring->strlen($separator) > 1 && $mbstring->startsWith($pageToken->getTextToBeParsed(), $mbstring->substr($separator, 1))) { $pageToken->setTextToBeParsed($mbstring->substr($pageToken->getTextToBeParsed(), $mbstring->strlen($separator) - 1)); } if ($tokens = $this->_scanSuffixes($pageToken, $this->_getSuffixesByType($token, 'home_page'))) { foreach ($tokens as $token) { $this->_setHomePage($token); if ($this->_parseParameters($token)) { return true; } } } return false; }