diff options
author | Paul S. Owen <psotfx@users.sourceforge.net> | 2002-03-14 15:55:21 +0000 |
---|---|---|
committer | Paul S. Owen <psotfx@users.sourceforge.net> | 2002-03-14 15:55:21 +0000 |
commit | 34b0719c027ded778f57dbbfe28ba58805fe53d6 (patch) | |
tree | 375f2eb8a93c64bf6e6837b13055c44af0ffd7a5 /phpBB/develop/revar_lang_files.php | |
parent | aef33ac0cf82fb504edfcef9bfa579ee17bdd330 (diff) | |
download | forums-34b0719c027ded778f57dbbfe28ba58805fe53d6.tar forums-34b0719c027ded778f57dbbfe28ba58805fe53d6.tar.gz forums-34b0719c027ded778f57dbbfe28ba58805fe53d6.tar.bz2 forums-34b0719c027ded778f57dbbfe28ba58805fe53d6.tar.xz forums-34b0719c027ded778f57dbbfe28ba58805fe53d6.zip |
Turn all lang files into single array ... testing proposal by ractive
git-svn-id: file:///svn/phpbb/trunk@2300 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/develop/revar_lang_files.php')
-rw-r--r-- | phpBB/develop/revar_lang_files.php | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/phpBB/develop/revar_lang_files.php b/phpBB/develop/revar_lang_files.php new file mode 100644 index 0000000000..b5fbc5631b --- /dev/null +++ b/phpBB/develop/revar_lang_files.php @@ -0,0 +1,82 @@ +<?php +/*************************************************************************** + * revar_lang_files.php + * ------------------- + * begin : Saturday, Feb 13, 2001 + * copyright : (C) 2001 The phpBB Group + * email : support@phpbb.com + * + * $Id$ + * + * + ***************************************************************************/ + +/*************************************************************************** + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + ***************************************************************************/ + +// +// Security message: +// +// This script is potentially dangerous. +// Remove or comment the next line (die(".... ) to enable this script. +// Do NOT FORGET to either remove this script or disable it after you have used it. +// +die("Please read the first lines of this script for instructions on how to enable it"); + +$vars = array('lang_main' => 'lang', 'lang_admin' => 'lang', 'lang_faq' => 'faq', 'lang_bbcode' => 'faq'); + +$dirname = "./../language"; +$dir = opendir($dirname); + +while ( $file = readdir($dir) ) +{ + if ( ereg("^lang_", $file) && !is_file($dirname . "/" . $file) && !is_link($dirname . "/" . $file) ) + { + foreach($vars as $lang_file => $lang_var) + { + $$lang_var = array(); + + include($dirname . "/" . $file . "/" . $lang_file . '.php'); + + $store = ""; + while( list($key, $value) = each($$lang_var) ) + { + if ( !is_array($value) ) + { + $key = ( is_string($key) ) ? "'$key'" : $key; + $store .= ( ( $store != "" ) ? ", \n\t" : "" ) . "$key => '" . addslashes($value) . "'"; + } + else + { + $key = ( is_string($key) ) ? "'$key'" : $key; + $store .= ( ( $store != "" ) ? ", \n\t" : "" ) . "$key => array(\n\t\t"; + + $store2 = ""; + while( list($key2, $value2) = each($value) ) + { + $key2 = ( is_string($key) ) ? "'$key2'" : $key2; + $store2 .= ( ( $store2 != "" ) ? ", \n\t\t" : "" ) . "$key2 => '" . addslashes($value2) . "'"; + } + $store .= $store2 . "\n\t)"; + } + } + + $store = "<?php\n\$$lang_var = array(\n\t$store\n);\n?".">"; + + $fp = fopen($dirname . "/" . $file . "/" . $lang_file . '.php', 'w'); + + fwrite($fp, $store); + + fclose($fp); + + } + } +} + +?>
\ No newline at end of file |