source/Core/SeoEncoder.php
protected function _prepareTitle($sTitle, $blSkipTruncate = false, $iLang = false)
    {
        $sTitle = $this->encodeString($sTitle, true, $iLang);
        $sSep = self::$_sSeparator;
        if (!$sSep || ('/' == $sSep)) {
            $sSep = '_';
        }

        $sRegExp = '/[^A-Za-z0-9\/' . preg_quote(self::$_sPrefix, '/') . preg_quote($sSep, '/') . ']+/';
        $sTitle = preg_replace(["#/+#", $sRegExp, "# +#", "#(" . preg_quote($sSep, '/') . ")+#"], $sSep, $sTitle);

        $oStr = getStr();
        // smart truncate
        if (!$blSkipTruncate && $oStr->strlen($sTitle) > $this->_iIdLength) {
            $iFirstSpace = $oStr->strpos($sTitle, $sSep, $this->_iIdLength);
            if ($iFirstSpace !== false) {
                $sTitle = $oStr->substr($sTitle, 0, $iFirstSpace);
            }
        }

        $sTitle = trim($sTitle, $sSep);

        if (!$sTitle) {
            return self::$_sPrefix;
        }

        // cleaning
        return $sTitle;
    }
protected function _prepareTitle($sTitle, $blSkipTruncate = false, $iLang = false)
    {
        $sTitle = $this->encodeString($sTitle, true, $iLang);
        $sSep = self::$_sSeparator;
        if (!$sSep || ('/' == $sSep)) {
            $sSep = '_';
        }

        $sRegExp = '/[^A-Za-z0-9\/' . preg_quote(self::$_sPrefix, '/') . preg_quote($sSep, '/') . ']+/';
        $sTitle = preg_replace(["#/+#", $sRegExp, "# +#", "#(" . preg_quote($sSep, '/') . ")+#"], $sSep, $sTitle);

        $oStr = getStr();
        // smart truncate
        if (!$blSkipTruncate && $oStr->strlen($sTitle) > $this->_iIdLength) {
            $iFirstSpace = $oStr->strpos($sTitle, $sSep, $this->_iIdLength);
            if ($iFirstSpace !== false) {
                $sTitle = $oStr->substr($sTitle, 0, $iFirstSpace);
            }
        }

        $sTitle = trim($sTitle, $sSep);

        if (!$sTitle) {
            return self::$_sPrefix;
        }

        // cleaning
        return $sTitle;
    }
protected function _prepareTitle ( $ sTitle , $ blSkipTruncate = false , $ iLang = false ) { $ sTitle = $ this -> encodeString ( $ sTitle , true , $ iLang ) ; $ sSep = self :: $ _sSeparator ; if ( ! $ sSep || ( '/' == $ sSep ) ) { $ sSep = '_' ; } $ sRegExp = '/[^A-Za-z0-9\/' . preg_quote ( self :: $ _sPrefix , '/' ) . preg_quote ( $ sSep , '/' ) . ']+/' ; $ sTitle = preg_replace ( [ "#/+#" , $ sRegExp , "# +#" , "#(" . preg_quote ( $ sSep , '/' ) . ")+#" ] , $ sSep , $ sTitle ) ; $ oStr = getStr ( ) ; // smart truncate if ( ! $ blSkipTruncate && $ oStr -> strlen ( $ sTitle ) > $ this -> _iIdLength ) { $ iFirstSpace = $ oStr -> strpos ( $ sTitle , $ sSep , $ this -> _iIdLength ) ; if ( $ iFirstSpace !== false ) { $ sTitle = $ oStr -> substr ( $ sTitle , 0 , $ iFirstSpace ) ; } } $ sTitle = trim ( $ sTitle , $ sSep ) ; if ( ! $ sTitle ) { return self :: $ _sPrefix ; } // cleaning return $ sTitle ; }
Prepares and returns formatted object SEO id

@param string $sTitle         Original object title
@param bool   $blSkipTruncate Truncate title into defined lenght or not
@param int    $iLang          language ID, for which to prepare the title

@return string
Prepares and returns formatted object SEO id