Welcome, Guest. Please Login or Register.
May 13, 2024, 11:45:45 PM
Home Help Search Log in Register
News: SMF is the next generation in forum software, almost completely re-written from the ground up, make sure you don't fall for cheap imitations that suffer from feature bloat!

YaBB SE Community  |  Development  |  Completed mods  |  [Code 1.5.x] Missing Language String Detector 1.0 « previous next »
Pages: [1] Reply Ignore Print
Author Topic: [Code 1.5.x] Missing Language String Detector 1.0  (Read 894 times)
[Unknown]
Global Moderator
YaBB God
*****
Posts: 7830


ICQ - 179721867unknownbrackets@hotmail.com WWW
[Code 1.5.x] Missing Language String Detector 1.0
« on: March 09, 2003, 08:40:32 AM »
Reply with quote

I was actually writing this for a completely different reason (and even method...), but I thought this would be useful when writing modifications or new mod files.

Please note that while I am giving you the code, this is not released under the GPL.  Do not redistribute it.

<?php
// Language file checker, version 1.0.
// Copyright 2003 by [Unknown].  All rights reserved.  Do not redistribute without permission.

$cwd dirname(__FILE__);

// Change this to the language file you want to test.
$language_file $cwd '/english.lng';

define('YaBBSE'1);

require (
$language_file);

$sd dir($cwd '/Sources');
while (
$entry $sd->read())
{
   if (
is_file($cwd '/Sources/' $entry) && $entry != 'index.php' && $entry != 'gpl.txt')
      
$file_list[] = $cwd '/Sources/' $entry;
}
$sd->close();
$file_list[] = $cwd '/SSI.php';
$file_list[] = $cwd '/help.php';
$file_list[] = $cwd '/Printpage.php';
$file_list[] = $cwd '/Reminder.php';

$txt_used = array();
foreach (
$file_list as $file)
{
   
$full implode(''file($file));
   
preg_match_all('/\$txt\[(?:\')?([^\]]+?)(?:\')?\]/i'$full$matches);

   foreach (
$matches[1] as $text)
      if (!isset(
$txt[$text]))
      {
         if (!isset(
$txt_used[$text]))
            
$txt_used[$text] = array(basename($file));
         elseif (!
in_array(basename($file), $txt_used[$text]))
            
$txt_used[$text][] = basename($file);
      }
}

ksort($txt_used);

echo 
'<pre>';
print_r($txt_used);
echo 
'</pre>';

?>


-[Unknown]
Logged
Pages: [1] Reply Ignore Print 
YaBB SE Community  |  Development  |  Completed mods  |  [Code 1.5.x] Missing Language String Detector 1.0 « 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.033 seconds with 21 queries.