Пример #1
0
 public function generateSlug($lastSlug = null)
 {
     $manager = self::factoryManager('new', 'default', 'new');
     $exist = true;
     $salt = '';
     $i = 0;
     while ($exist && $i < 50) {
         $this->_slug = Tools::stringToUrl($this->_titre, '-', 'UTF-8', true) . $salt;
         $count = $manager->existsSlug($this->_slug, $lastSlug);
         $exist = $count >= 1 ? true : false;
         $salt = (string) $i;
         $i++;
     }
     return $this->_slug;
 }
Пример #2
0
 protected function _generateUrl($flushUrlAfter = false, $flusUrlParameters = false)
 {
     if ($this->_rewrite) {
         $url = new Rewriting($this->_rewriteOptions['rewriteRuleFile']);
         $url->setCharset($this->_charset);
         if ($this->_file != null && $this->_rewriteOptions['keepUrlFile']) {
             $url->setUrlFile($this->_file, $this->_rewriteOptions['keepUrlFileExt']);
         }
         foreach ($this->_args as &$arg) {
             $url->setArgs($arg, $this->_rewriteOptions['notPutArgsKey'], false, $flushUrlAfter, $flusUrlParameters);
         }
         $this->_url = $url->getUrl($this->_rewriteOptions['checkRewriteRule']);
     } else {
         $argsLink = count($this->_args) > 0 ? '?' : '';
         foreach ($this->_args as &$arg) {
             foreach ($arg as $key => &$value) {
                 $argsLink .= Tools::stringToUrl($key, '_', $this->_charset) . '=' . Tools::stringToUrl($value, '_', $this->_charset) . '&amp;';
             }
         }
         $this->_url = $this->_file != null ? $this->_file . trim($argsLink, '&amp;') : trim($argsLink, '&amp;');
     }
 }
Пример #3
0
 protected function _generateUrl()
 {
     $argsLink = '';
     foreach ($this->_args as &$arg) {
         if ($this->_notPutArgsKey) {
             $argsLink .= Tools::stringToUrl($arg, '_', $this->_charset) . '/';
         } else {
             foreach ($arg as $key => &$value) {
                 $argsLink .= Tools::stringToUrl($key, '_', $this->_charset) . '/' . Tools::stringToUrl($value, '_', $this->_charset) . '/';
             }
         }
     }
     if ($this->_file != null) {
         $this->_url = $this->_file . '/' . trim($argsLink, '/') . $this->_extension;
     } else {
         $this->_url = trim($argsLink, '/') . $this->_extension;
     }
 }