public function save()
    {
        $keys = array_keys($this->langstrings);
        sort($keys);

        $maxlen       = 0;
        $langPrefixes = array();
        foreach ($keys as $key) {
            $tokens = explode('.', $key);
            if (preg_match('/tl_layout\.[a-z]+\.css\./', $key)) {
                $tokens = array($tokens[0], $tokens[1] . '.' . $tokens[2], $tokens[3]);
            }
            $langPrefix = '$GLOBALS[\'TL_LANG\']';
            foreach ($tokens as $token) {
                $langPrefix .= '[\'' . $token . '\']';
            }

            $langPrefixes[$key] = $langPrefix;

            if (strlen($langPrefix) > $maxlen) {
                $maxlen = strlen($langPrefix);
            }
        }

        $buffer = $this->getHead() . PHP_EOL . PHP_EOL;
        foreach ($keys as $key) {
            $prefix  = $langPrefixes[$key];
            $buffer .= sprintf(
                '%s = %s;' . PHP_EOL,
                $prefix . str_repeat(' ', ($maxlen - strlen($prefix))),
                var_export($this->getValue($key), true)
            );
        }
        $buffer  .= PHP_EOL;
        $resource = fopen($this->filename, 'wb');
        fputs($resource, $buffer);

        fclose($resource);
    }
public function save()
    {
        $keys = array_keys($this->langstrings);
        sort($keys);

        $maxlen       = 0;
        $langPrefixes = array();
        foreach ($keys as $key) {
            $tokens = explode('.', $key);
            if (preg_match('/tl_layout\.[a-z]+\.css\./', $key)) {
                $tokens = array($tokens[0], $tokens[1] . '.' . $tokens[2], $tokens[3]);
            }
            $langPrefix = '$GLOBALS[\'TL_LANG\']';
            foreach ($tokens as $token) {
                $langPrefix .= '[\'' . $token . '\']';
            }

            $langPrefixes[$key] = $langPrefix;

            if (strlen($langPrefix) > $maxlen) {
                $maxlen = strlen($langPrefix);
            }
        }

        $buffer = $this->getHead() . PHP_EOL . PHP_EOL;
        foreach ($keys as $key) {
            $prefix  = $langPrefixes[$key];
            $buffer .= sprintf(
                '%s = %s;' . PHP_EOL,
                $prefix . str_repeat(' ', ($maxlen - strlen($prefix))),
                var_export($this->getValue($key), true)
            );
        }
        $buffer  .= PHP_EOL;
        $resource = fopen($this->filename, 'wb');
        fputs($resource, $buffer);

        fclose($resource);
    }
public function save ( ) { $ keys = array_keys ( $ this -> langstrings ) ; sort ( $ keys ) ; $ maxlen = 0 ; $ langPrefixes = array ( ) ; foreach ( $ keys as $ key ) { $ tokens = explode ( '.' , $ key ) ; if ( preg_match ( '/tl_layout\.[a-z]+\.css\./' , $ key ) ) { $ tokens = array ( $ tokens [ 0 ] , $ tokens [ 1 ] . '.' . $ tokens [ 2 ] , $ tokens [ 3 ] ) ; } $ langPrefix = '$GLOBALS[\'TL_LANG\']' ; foreach ( $ tokens as $ token ) { $ langPrefix .= '[\'' . $ token . '\']' ; } $ langPrefixes [ $ key ] = $ langPrefix ; if ( strlen ( $ langPrefix ) > $ maxlen ) { $ maxlen = strlen ( $ langPrefix ) ; } } $ buffer = $ this -> getHead ( ) . PHP_EOL . PHP_EOL ; foreach ( $ keys as $ key ) { $ prefix = $ langPrefixes [ $ key ] ; $ buffer .= sprintf ( '%s = %s;' . PHP_EOL , $ prefix . str_repeat ( ' ' , ( $ maxlen - strlen ( $ prefix ) ) ) , var_export ( $ this -> getValue ( $ key ) , true ) ) ; } $ buffer .= PHP_EOL ; $ resource = fopen ( $ this -> filename , 'wb' ) ; fputs ( $ resource , $ buffer ) ; fclose ( $ resource ) ; }
Save the file to disk.

@return void
Save the file to disk .