Welcome, Guest. Please Login or Register.
April 30, 2025, 05:48:50 AM
Home Help Search Log in Register
News: If you are still using YaBB SE, please consider upgrading to SMF as soon as possible.

YaBB SE Community  |  General Category  |  Test Board  |  . « previous next »
Pages: [1] Reply Ignore Print
Author Topic: .  (Read 715 times)
groundup
Disciple of Joe, Head Cleric
Mod Team
YaBB God
*****
Posts: 2983


Error 309: Please notify the administrator of this

WWW
.
« on: December 06, 2002, 05:40:39 AM »
Reply with quote

<?php
/************************************************/
/* Language File Seperator                      */
/* by Joshua Dickerson (aka groundup)           */
/************************************************/
/* This will help with reducing memory usage no */
/* matter what the version of YSE or language.  */
/* Remember to run the mod of this.             */
/************************************************/
/* Also my site: www.Boardnation.com. Free msg  */
/* board hosting with NO banners and NO popups! */
/************************************************/

# Get all language and php files from the sources directory
$langs = array();
$files = array();
while(
$fn readdir(opendir('./Sources/')))
{
   if(
substr($fn,strrpos($fn,'.')+1,'r')=='lng')
   {
      
$langs[] = $fn;
      
mkdir($_SERVER['DOCUMENT_ROOT'].'/Sources/'.$fn);
   }
   if(
substr($fn,strrpos($fn,'.')+1,'r')=='php')
      
$files[] = $fn;
}

$i=0;
while(
$file fread(fopen($_SERVER['DOCUMENT_ROOT'].'/Sources/'.$files[$i],'r')))
{
   
preg_match_all("/\$txt\[(.*?)\]/",$file,$matches);
   while(
$matches)
   {
      
$matches str_replace('\''''$matches);
      
$matches str_replace('"'''$matches);
   }
   
$matches array_unique($matches);
   
asort($matches);

$a=0;
   while(
$langs)
   {
      include(
"$_SERVER['DOCUMENT_ROOT']/Sources/$langs[$a]");
      
$txt '<?php';
      
reset($matches);
      while(
$matches)
      {
         
$txt .= '$txt['.$matches.']'."\n";
      }
      
$txt .= '?>
';
      $newlang = substr_replace($files[$i],'lng',strrpos($fn,'.')+1);
      fwrite(fopen($_SERVER['DOCUMENT_ROOT'].'/Sources/languages/'.$langs[$a].'/'.$newlang,'r'),$txt);
   $a++;
   }
   $i++;
}
?>
« Last Edit: December 06, 2002, 05:59:17 AM by groundup » Logged

http://www.fastfinancialfreedom.org - financial freedom is a myth
http://www.fastfinancialfreedom.org - financial freedom is a myth
http://www.fastfinancialfreedom.org - financial freedom is a myth
fastfinancialfreedom.org
Chris Cromer
The Strange One
Mod Team
YaBB God
*****
Posts: 3152


I am just a figment of your imagination.

WWW
Re:.
« Reply #1 on: December 06, 2002, 06:13:59 AM »
Reply with quote

<?php
/************************************************/
/* Language File Seperator                      */
/* by Joshua Dickerson (aka groundup)           */
/************************************************/
/* This will help with reducing memory usage no */
/* matter what the version of YSE or language.  */
/* Remember to run the mod of this.             */
/************************************************/
/* Also my site: www.Boardnation.com. Free msg  */
/* board hosting with NO banners and NO popups! */
/************************************************/

# Get all language and php files from the sources directory
$dir opendir('./Sources/');
while(
$fn readdir($dir))
{
   if(
substr($fn,strrpos($fn,'.')+1)=='lng')
   {
      
$langs[] = $fn;
      
$tmp explode('.',$fn);
      
mkdir($_SERVER['DOCUMENT_ROOT'].'/Sources/'.$tmp[0]);
   }
   if(
substr($fn,strrpos($fn,'.')+1)=='php')
   {
      
$files[] = $fn;
   }
}

$dir opendir('./');
while(
$fn readdir($dir))
{
   if(
substr($fn,strrpos($fn,'.')+1)=='lng')
   {
      
$langs[] = $fn;
      
$tmp explode('.',$fn);
      
mkdir($_SERVER['DOCUMENT_ROOT'].'/Sources/'.$tmp[0]);
   }
}

$i=0;
$dir fopen($_SERVER['DOCUMENT_ROOT'].'/Sources/'.$files[$i],'r');
while(
$file fread($dir))
{
   
preg_match_all("/\$txt\[(.*?)\]/",$file,$matches);
   while(
$matches)
   {
      
$matches str_replace('\''''$matches);
      
$matches str_replace('"'''$matches);
   }
   
$matches array_unique($matches);
   
asort($matches);

$a=0;
   while(
$langs)
   {
      include(
"$_SERVER[DOCUMENT_ROOT]/Sources/$langs[$a]");
      
$txt '<?php';
      
reset($matches);
      while(
$matches)
      {
         
$txt .= '$txt['.$matches.']'."\n";
      }
      
$txt .= '?>
';
      $newlang = substr_replace($files[$i],'lng',strrpos($fn,'.')+1);
      fwrite(fopen($_SERVER['DOCUMENT_ROOT'].'/Sources/languages/'.$langs[$a].'/'.$newlang,'r'),$txt);
   $a++;
   }
   $i++;
}
?>
« Last Edit: December 06, 2002, 06:22:04 AM by Chris Cromer » Logged

Chris Cromer

I am not suffering from insanity, I am enjoying every minute of it.
Pages: [1] Reply Ignore Print 
YaBB SE Community  |  General Category  |  Test Board  |  . « previous - next »
 


Powered by MySQL Powered by PHP YaBB SE Community | Powered by YaBB SE
© 2001-2003, YaBB SE Dev Team. All Rights Reserved.
SMF 2.1.4 © 2023, Simple Machines
Valid XHTML 1.0! Valid CSS

Page created in 0.028 seconds with 19 queries.