code/libraries/joomlatools/component/koowa/translator/catalogue/abstract.php
public function generateKey($string)
    {
        $limit = $this->getConfig()->key_length;
        $key   = strtolower($string);

        if(!isset($this->_keys[$string]))
        {
            if (!$limit || strlen($key) <= $limit)
            {
                $key = strip_tags($key);
                $key = preg_replace('#\s+#m', ' ', $key);
                $key = preg_replace('#\{([A-Za-z0-9_\-\.]+)\}#', '$1', $key);
                $key = preg_replace('#(%[^%|^\s|^\b]+)#', 'X', $key);
                $key = preg_replace('#&.*?;#', '', $key);
                $key = preg_replace('#[\s-]+#', '_', $key);
                $key = preg_replace('#[^A-Za-z0-9_]#', '', $key);
                $key = preg_replace('#_+#', '_', $key);
                $key = trim($key, '_');
                $key = trim(strtoupper($key));
            }
            else
            {
                $hash = substr(md5($key), 0, 5);
                $key  = $this->generateKey(substr($string, 0, $limit));
                $key .= '_'.strtoupper($hash);
            }
        }
        else $key = $this->_keys[$string];

        return $key;
    }
public function generateKey($string)
    {
        $limit = $this->getConfig()->key_length;
        $key   = strtolower($string);

        if(!isset($this->_keys[$string]))
        {
            if (!$limit || strlen($key) <= $limit)
            {
                $key = strip_tags($key);
                $key = preg_replace('#\s+#m', ' ', $key);
                $key = preg_replace('#\{([A-Za-z0-9_\-\.]+)\}#', '$1', $key);
                $key = preg_replace('#(%[^%|^\s|^\b]+)#', 'X', $key);
                $key = preg_replace('#&.*?;#', '', $key);
                $key = preg_replace('#[\s-]+#', '_', $key);
                $key = preg_replace('#[^A-Za-z0-9_]#', '', $key);
                $key = preg_replace('#_+#', '_', $key);
                $key = trim($key, '_');
                $key = trim(strtoupper($key));
            }
            else
            {
                $hash = substr(md5($key), 0, 5);
                $key  = $this->generateKey(substr($string, 0, $limit));
                $key .= '_'.strtoupper($hash);
            }
        }
        else $key = $this->_keys[$string];

        return $key;
    }
public function generateKey ( $ string ) { $ limit = $ this -> getConfig ( ) -> key_length ; $ key = strtolower ( $ string ) ; if ( ! isset ( $ this -> _keys [ $ string ] ) ) { if ( ! $ limit || strlen ( $ key ) <= $ limit ) { $ key = strip_tags ( $ key ) ; $ key = preg_replace ( '#\s+#m' , ' ' , $ key ) ; $ key = preg_replace ( '#\{([A-Za-z0-9_\-\.]+)\}#' , '$1' , $ key ) ; $ key = preg_replace ( '#(%[^%|^\s|^\b]+)#' , 'X' , $ key ) ; $ key = preg_replace ( '#&.*?;#' , '' , $ key ) ; $ key = preg_replace ( '#[\s-]+#' , '_' , $ key ) ; $ key = preg_replace ( '#[^A-Za-z0-9_]#' , '' , $ key ) ; $ key = preg_replace ( '#_+#' , '_' , $ key ) ; $ key = trim ( $ key , '_' ) ; $ key = trim ( strtoupper ( $ key ) ) ; } else { $ hash = substr ( md5 ( $ key ) , 0 , 5 ) ; $ key = $ this -> generateKey ( substr ( $ string , 0 , $ limit ) ) ; $ key .= '_' . strtoupper ( $ hash ) ; } } else $ key = $ this -> _keys [ $ string ] ; return $ key ; }
Generates a translation key that is safe for INI format

Uses key_length in object config to limit the keys

@param  string $string
@return string
Generates a translation key that is safe for INI format