Update of /cvsroot/easymod/easymod2/dev
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv621
Added Files:
compare_lang_file_versions.php
Log Message:
* Developed to automatically generate the information required to
* update the EasyMOD Language Pack Changelog posted here:
* http://area51.phpbb.com/phpBB/viewtopic.php?f=17&t=20153
--- NEW FILE: compare_lang_file_versions.php ---
<?php
/**
* Compare 2 language files.
*
* Developed to automatically generate the information required to
* update the EasyMOD Language Pack Changelog posted here:
* http://area51.phpbb.com/phpBB/viewtopic.php?f=17&t=20153
*/
// Two different versions of the same language file ;-)
$myfiles = array(
'old' => 'lang_easymod_021.php',
'new' => 'lang_easymod_030.php'
);
// This is where we store the comparission results, the diffs
$diff = array(
'Added' => array(),
'Modified' => array(),
'Removed' => array()
);
/**
* Load language files into $mylangs array
*/
$mylangs = array();
foreach( $myfiles as $key => $filename )
{
$lang = array();
include($filename);
$mylangs[$key] = $lang;
unset($lang);
}
// Extract Added entries
foreach( $mylangs['new'] as $key => $text )
{
if( !isset($mylangs['old'][$key]) )
{
$diff['Added'][] = $key;
}
}
// Extract Modified and Removed entries
foreach( $mylangs['old'] as $key => $text )
{
if( !isset($mylangs['new'][$key]) )
{
$diff['Removed'][] = $key;
}
else
{
if( $text != $mylangs['new'][$key] )
{
$diff['Modified'][] = $key;
}
}
}
// Generate the diff report formatted for forum posting
foreach( $diff as $type => $array )
{
echo '[size=14][b]' . $type . "[/b][/size]<br />\n";
echo "[list]<br />\n";
for( $i=0; $i < count($array); $i++ )
{
echo '[*]$lang[\'' . $array[$i] . "']<br />\n";
}
echo "[/list]<br />\n";
}
?>
|