Changeset 32 for branches

Show
Ignore:
Timestamp:
02/11/09 14:25:35 (3 years ago)
Author:
daris
Message:

lang editor: changed table layout to div layout, added search and some other tiny changes

Location:
branches/lang_editor
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • branches/lang_editor/admin/lang_editor.php

    r31 r32  
    5252$lang = (isset($_GET['lang']) && file_exists(FORUM_ROOT.'lang/'.$_GET['lang'])) ? basename($_GET['lang']) : null; 
    5353$file = isset($_GET['file']) ? basename($_GET['file']) : null; 
     54$search = isset($_GET['search']) ? $_GET['search'] : null; 
    5455 
    5556$edit_file = null; 
     
    7980        save_lang(); 
    8081         
    81         redirect(EXT_FILE.'?lang='.$_POST['lang'], $lang_le['Lang file updated'].' '.$lang_common['Redirect']); 
     82        redirect(EXT_FILE.'?lang='.$_POST['lang'], $lang_le['Lang file updated']); 
    8283} 
    8384 
     
    118119                } 
    119120         
    120                 redirect(EXT_FILE.'?lang='.$lang.'&ext='.$_GET['ext'], $lang_le['Lang file created'].' '.$lang_common['Redirect']); 
    121         } 
    122  
    123 } 
    124  
    125  
    126  
    127 if ($act && $ext && $act == 'export') 
     121                redirect(EXT_FILE.'?lang='.$lang.'&ext='.$_GET['ext'], $lang_le['Lang file created']); 
     122        } 
     123 
     124} 
     125 
     126 
     127 
     128if ($act && $act == 'export') 
    128129{ 
    129130        if (!class_exists('ZipArchive')) 
     
    131132         
    132133        // Get version 
    133         $manifest = file_get_contents(FORUM_ROOT.'extensions/'.$ext.'/manifest.xml'); 
    134         preg_match('#<version>([\d\.]*)<\/version>#', $manifest, $matches); 
    135         $version = $matches[1]; 
    136  
    137         $archive = FORUM_ROOT.'extensions/lang_editor/cache/'.$ext.'_'.$version.'.zip'; 
     134        $version = get_extension_version($ext); 
     135 
     136        $exclude_langs = isset($_GET['exclude']) ? explode(',', $_GET['exclude']) : array(); 
     137 
     138        if ($ext) 
     139                $filename = $ext.'_'.$version; 
     140        elseif ($lang) 
     141                $filename = $lang; 
     142 
     143        $archive = FORUM_ROOT.'extensions/lang_editor/cache/'.$filename.'.zip'; 
    138144         
    139145        if (file_exists($archive)) 
     
    143149        if ($zip->open($archive, ZIPARCHIVE::CREATE) === TRUE) 
    144150        { 
    145                 add_dir_to_archive(FORUM_ROOT.'extensions/', $ext); 
     151                if ($ext) 
     152                        add_dir_to_archive(FORUM_ROOT.'extensions/', $ext); 
     153                elseif ($lang) 
     154                        add_dir_to_archive(FORUM_ROOT.'lang/', $lang); 
    146155                 
    147156                $zip->close(); 
     
    150159        }  
    151160        else 
    152                 message(sprintf($lang_le['No permissions'], FORUM_ROOT.'cache/extension.zip')); 
    153 } 
    154  
    155 // Display language list 
    156 if (!$lang) 
     161                message(sprintf($lang_le['No permissions'], $archive)); 
     162} 
     163 
     164 
     165if ($search) 
    157166{ 
    158167        // Setup breadcrumbs 
     
    163172        ); 
    164173 
     174        $search_results = array(); 
     175        search($search, FORUM_ROOT.'/lang/'.$lang); 
     176         
     177        if (empty($search_results)) 
     178                message('Empty search results'); 
     179 
    165180        define('FORUM_PAGE_SECTION', 'management'); 
    166181        define('FORUM_PAGE', 'admin-lang-editor'); 
     
    173188        <div class="main-content main-frm"> 
    174189                <div class="content-head"> 
    175                         <h2 class="hn"><span><?php echo $lang_le['Lang editor'] ?></span></h2> 
    176                 </div> 
    177                 <div class="ct-box info-box"> 
    178                         <h3 class="ct-legend hn"><span><?php echo $lang_le['Language list'] ?></span></h3> 
    179                         <ul> 
    180 <?php 
     190                        <h2 class="hn"><span><?php echo $lang_le['Language list'] ?></span></h2> 
     191                </div> 
     192 
     193<?php 
     194 
     195        foreach ($search_results as $file => $results) 
     196        { 
     197?> 
     198         
     199                        <div class="content-head"> 
     200                                <h3 class="hn"><span><?php echo $file ?></span></h3> 
     201                        </div> 
     202                        <div class="frm-group frm-hdgroup group<?php echo ++$forum_page['group_count'] ?>"> 
     203<?php 
     204                foreach ($results as $result) 
     205                { 
     206                        $key = $result[0]; 
     207                        $string = $result[1]; 
     208?> 
     209                                <fieldset class="mf-set set<?php echo ++$forum_page['item_count'] ?><?php echo ($forum_page['item_count'] == 1) ? ' mf-head' : ' mf-extra' ?>"> 
     210                                        <legend><span><a href="<?php echo EXT_FILE.'?lang='.$lang.'&file='.$file.'&highlight='.$key ?>#highlight"><?php echo $key ?></a></span></legend> 
     211                                        <div class="mf-box"> 
     212                                                <div class="mf-field mf-field1 forum-field"> 
     213                                                        <span class="aslabel"><?php echo $lang_le['Orginal string'] ?></span> 
     214                                                        <span class="fld-input"><?php echo $string ?></span> 
     215                                                </div> 
     216                                        </div> 
     217                                </fieldset> 
     218<?php 
     219                } 
     220                 
     221?> 
     222                        </div> 
     223<?php 
     224        } 
     225?> 
     226        </div> 
     227<?php 
     228 
     229} 
     230 
     231// Display language list 
     232else if (!$lang) 
     233{ 
     234        // Setup breadcrumbs 
     235        $forum_page['crumbs'] = array( 
     236                array($forum_config['o_board_title'], forum_link($forum_url['index'])), 
     237                array($lang_admin_common['Forum administration'], forum_link($forum_url['admin_index'])), 
     238                $lang_le['Lang editor'], 
     239        ); 
     240 
     241        define('FORUM_PAGE_SECTION', 'management'); 
     242        define('FORUM_PAGE', 'admin-lang-editor'); 
     243        define('FORUM_PAGE_TYPE', 'sectioned'); 
     244        require FORUM_ROOT.'header.php'; 
     245         
     246        ob_start(); 
     247 
     248?> 
     249        <div class="main-content main-frm"> 
     250                <div class="content-head"> 
     251                        <h2 class="hn"><span><?php echo $lang_le['Language list'] ?></span></h2> 
     252                </div> 
     253 
     254<?php 
     255        $languages = array(); 
    181256        $d = dir(FORUM_ROOT.'lang/'); 
    182257        while ($f = $d->read()) 
    183258        { 
    184259                if (substr($f, 0, 1) != '.' && is_dir(FORUM_ROOT.'lang/'.$f) && $f != 'English') 
    185                         echo '<li><a href="'.EXT_FILE.'?lang='.$f.'">'.$f.'</a></li>'; 
    186         } 
    187  
    188 ?> 
    189                         </ul> 
    190                 </div> 
     260                        $languages[] = $f; 
     261        } 
     262         
     263        sort($languages); 
     264         
     265        foreach ($languages as $language) 
     266        { 
     267                $actions = array(); 
     268                $actions[] = '<a href="'.EXT_FILE.'?act=export&amp;lang='.$language.'">Export</a>'; 
     269 
     270?> 
     271                <div class="ct-box info-box"> 
     272                        <p style="float: right"><?php echo implode(' | ', $actions) ?></p> 
     273                        <h3 class="ct-legend hn"><span><a href="<?php echo EXT_FILE.'?lang='.$language ?>"><?php echo $language ?></a></span></h3> 
     274                </div> 
     275<?php 
     276        } 
     277 
     278?> 
     279 
    191280        </div> 
    192281<?php 
     
    219308        require FORUM_ROOT.'header.php'; 
    220309 
    221  
    222 ?> 
     310        ob_start(); 
     311         
     312        $compare_lang = 'English'; 
     313 
     314        $result = read_lang($edit_file, str_replace($lang, 'English', $edit_file)); 
     315        $string_list = $result[0]; 
     316         
     317//      echo '<pre>';print_r();exit; 
     318         
     319        $first = current($string_list); 
     320         
     321        if (substr($first[0], 0, 2) != '//') 
     322                array_insert($string_list, 0, array('//'.$lang_le['String list'])); 
     323 
     324?> 
     325        <div class="main-subhead"> 
     326                <h2 class="hn"><span><?php echo $lang_le['Lang editor'] ?></span></h2> 
     327        </div> 
    223328        <div class="main-content main-frm"> 
    224                 <div class="content-head"> 
    225                         <h2 class="hn"><span><?php echo $lang_le['Lang editor'] ?></span></h2> 
    226                 </div> 
     329 
    227330                <form class="frm-form" method="post" accept-charset="utf-8" action="<?php echo EXT_FILE ?>"> 
    228331                        <div class="hidden"> 
     
    231334                                <input type="hidden" name="file" value="<?php echo $edit_file ?>" /> 
    232335                        </div> 
     336 
     337<?php if ($result[1] == true) : ?> 
    233338                        <div class="ct-box info-box"> 
    234          
    235 <?php 
    236         $compare_lang = 'English'; 
    237  
    238         $result = read_lang($edit_file, str_replace($lang, 'English', $edit_file)); 
    239         $string_list = $result[0]; 
    240          
    241 ?> 
    242                                 <h3 class="ct-legend hn"><span><?php echo $lang_le['String list'] ?></span></h3> 
    243 <?php if ($result[1] == true) : ?> 
    244                                         <input type="hidden" name="diff" value="1" /> 
    245                                         <?php echo $lang_le['Different structure'] ?> 
     339                                <h3 class="ct-legend hn"><span><?php echo $lang_le['Different structure'] ?></span></h3> 
     340                        </div> 
     341                        <input type="hidden" name="diff" value="1" /> 
    246342<?php endif; ?> 
    247                                 <br /> 
    248                                 <table> 
    249                                         <tr> 
    250                                                 <th width="20%"></th> 
    251                                                 <th width="30%"><?php echo $lang_le['Orginal string'] ?></th> 
    252                                                 <th><?php echo $lang_le['Translated string'] ?></th> 
    253                                                 <th width="10"></th> 
    254                                         </tr> 
    255 <?php 
    256  
    257  
    258                          
     343         
     344<?php 
     345        $i = 0; 
     346         
     347        $highlight = isset($_GET['highlight']) ? $_GET['highlight'] : null; 
     348 
    259349        foreach ($string_list as $key => $value) 
    260350        { 
     351                if (substr($value[0], 0, 2) == '//')    // A new category since last iteration? 
     352                { 
     353                        if ($i > 0) echo "\t\t\t".'</div>'."\n"; 
     354 
     355                        $forum_page['group_count'] = $forum_page['item_count'] = 0; 
     356?> 
     357                        <div class="content-head"> 
     358                                <h3 class="hn"><span><?php echo trim(substr($value[0], 2)) ?></span></h3> 
     359                        </div> 
     360                        <div class="frm-group frm-hdgroup group<?php echo ++$forum_page['group_count'] ?>"> 
     361<?php 
     362                        unset($string_list[$key]); 
     363                        continue; 
     364                } 
     365         
     366         
     367                $fieldset_style = ''; 
     368         
    261369                if (isset($value[0]) && isset($value[1])) 
    262370                        $strlen = max(strlen($value[1]), strlen($value[0])); 
     
    264372                        $strlen = (isset($value[1]) ? strlen($value[1]) : strlen($value[0])); 
    265373                $rows = round($strlen / 50) + 1; 
    266 ?> 
    267                                         <tr> 
    268                                                 <td><?php echo $key ?></td> 
    269                                                 <td> 
    270                                                         <?php echo (isset($value[0]) ? forum_htmlencode($value[0]) : '<span style="color: red">Not exists</span>') ?> 
    271                                                         <?php echo (isset($value[2])) ? '<br /><span style="color: gray; font-size: 10px">'.$value[2].'</span>' : '' ?> 
    272                                                 </td> 
    273                                                 <td<?php echo ((!isset($value[1]) || (isset($value[0]) && isset($value[1]) && $value[0] == $value[1])) ? ' style="background: #ffc7c7"' : '') ?>> 
    274                                                         <?php if ($rows > 1) { ?> 
    275                                                         <textarea name="tr[<?php echo $key ?>]" style="width: 100%" rows="<?php echo $rows ?>"><?php echo (isset($value[1]) ? forum_htmlencode($value[1]) : forum_htmlencode($value[0])) ?></textarea> 
    276                                                         <?php } else { ?> 
    277                                                         <input name="tr[<?php echo $key ?>]" style="width: 100%" value="<?php echo (isset($value[1]) ? forum_htmlencode($value[1]) : forum_htmlencode($value[0])) ?>" /> 
    278                                                         <?php } ?> 
    279                                                 </td> 
    280                                         </tr> 
    281 <?php 
    282         } 
    283  
    284 ?> 
    285                                 </table> 
     374                 
     375                $field1 = (isset($value[0]) ? forum_htmlencode($value[0]) : '<span style="color: red">Not exists</span>'); 
     376                $field1 .= (isset($value[2])) ? '<span style="display: block; color: gray; font-size: 10px">'.$value[2].'</span>' : ''; 
     377 
     378                if (!isset($value[1]) || (isset($value[0]) && isset($value[1]) && $value[0] == $value[1])) 
     379                        $fieldset_style = ' style="background: #fcc; border: 1px solid #fbb; margin: -1px"'; 
     380                 
     381                if ($highlight && $highlight == $key) 
     382                { 
     383                        $fieldset_style = ' id="highlight" style="background: #ddd; border: 1px solid #bbb; margin: -1px"'; 
     384                } 
     385?> 
     386                                <fieldset class="mf-set set<?php echo ++$forum_page['item_count'] ?><?php echo ($forum_page['item_count'] == 1) ? ' mf-head' : ' mf-extra' ?>"<?php echo $fieldset_style ?>> 
     387                                        <legend><span><?php echo $key ?></span></legend> 
     388                                        <div class="mf-box"> 
     389                                                <div class="mf-field mf-field1 forum-field"> 
     390                                                        <span class="aslabel"><?php echo $lang_le['Orginal string'] ?></span> 
     391                                                        <span class="fld-input"><?php echo $field1 ?></span> 
     392                                                </div> 
     393                                                <div class="mf-field"> 
     394                                                        <label for="fld<?php echo ++$forum_page['fld_count'] ?>"><span><?php echo $lang_le['Translated string'] ?></span></label><br /> 
     395<?php if ($rows > 1) { ?> 
     396                                                        <textarea name="tr[<?php echo $key ?>]" style="width: 350px; height: <?php echo $rows*15 ?>px" rows="<?php echo $rows ?>"><?php echo (isset($value[1]) ? forum_htmlencode($value[1]) : forum_htmlencode($value[0])) ?></textarea> 
     397<?php } else { ?> 
     398                                                        <input name="tr[<?php echo $key ?>]" style="width: 350px" value="<?php echo (isset($value[1]) ? forum_htmlencode($value[1]) : forum_htmlencode($value[0])) ?>" /> 
     399<?php } ?> 
     400                                                </div> 
     401                                        </div> 
     402                                </fieldset> 
     403 
     404<?php 
     405                $i++; 
     406        } 
     407 
     408?> 
    286409                        </div> 
    287410                        <div class="frm-buttons"> 
     
    297420} 
    298421 
    299 // Display files and extension list 
     422// Display files for extension 
    300423else if ($ext && $lang && !$file) 
    301424{ 
     
    319442        <div class="main-content main-frm"> 
    320443                <div class="content-head"> 
    321                         <h2 class="hn"><span><?php echo $lang_le['Lang editor'] ?></span></h2> 
     444                        <h2 class="hn"><span><?php echo $lang_le['File list'] ?></span></h2> 
    322445                </div> 
    323446 
    324447                <div class="ct-box info-box"> 
    325                         <h3 class="ct-legend hn"><span><?php echo $lang_le['File list'] ?></span></h3> 
    326448                        <ul> 
    327449<?php 
     
    362484        require FORUM_ROOT.'header.php'; 
    363485 
    364  
     486        ob_start(); 
    365487?> 
    366488        <div class="main-content main-frm"> 
     489 
     490                <form class="frm-form" method="get" accept-charset="utf-8" action="<?php echo EXT_FILE ?>"> 
     491                        <div class="hidden"> 
     492                                <input type="hidden" name="csrf_token" value="<?php echo generate_form_token(EXT_FILE) ?>" /> 
     493                                <input type="hidden" name="lang" value="<?php echo $lang ?>" /> 
     494                        </div> 
     495                         
     496                        <div class="content-head"> 
     497                                <h3 class="hn"><span><?php echo 'Search' ?></span></h3> 
     498                        </div> 
     499                        <fieldset class="frm-group group<?php echo ++$forum_page['group_count'] ?>"> 
     500                                <legend class="group-legend"><strong><?php echo 'Search' ?></strong></legend> 
     501                                <div class="sf-set set<?php echo ++$forum_page['item_count'] ?>"> 
     502                                        <div class="sf-box text"> 
     503                                                <label for="fld<?php echo ++$forum_page['fld_count'] ?>"><span><?php echo 'Search' ?></span></label> 
     504                                                <span class="fld-input"><input type="text" id="fld<?php echo $forum_page['fld_count'] ?>" name="search" size="50" /></span> 
     505                                        </div> 
     506                                </div> 
     507                        </fieldset> 
     508                        <div class="frm-buttons"> 
     509                                <span class="submit"><input type="submit" name="submit_search" value="Search" /></span> 
     510                        </div> 
     511                </form> 
     512 
    367513                <div class="content-head"> 
    368                         <h2 class="hn"><span><?php echo $lang_le['Lang editor'] ?></span></h2> 
    369                 </div> 
    370  
     514                        <h2 class="hn"><span><?php echo $lang_le['File list'] ?></span></h2> 
     515                </div> 
     516                 
    371517                <div class="ct-box info-box"> 
    372                         <h3 class="ct-legend hn"><span><?php echo $lang_le['File list'] ?></span></h3> 
    373518                        <ul> 
    374519<?php 
     520        $files = array(); 
     521 
    375522        $add_dir = (isset($edit_file) && is_dir(FORUM_ROOT.'lang/'.$lang.'/'.$edit_file) ? '/'.$edit_file.'/' : ''); 
    376523        $d = dir(FORUM_ROOT.'lang/'.$lang.$add_dir); 
     
    378525        { 
    379526                if (substr($f, 0, 1) != '.' && !is_dir(FORUM_ROOT.'lang/'.$lang.$add_dir.'/'.$f) && substr($f, strlen($f) - 4, 4) == '.php') 
    380                 { 
    381                         echo '<li><a href="'.EXT_FILE.'?lang='.$lang.'&amp;file='.$add_dir.$f.'">'.$f.'</a></li>'; 
    382                 } 
    383         } 
     527                        $files[] = $f; 
     528        } 
     529         
     530        sort($files); 
     531        foreach ($files as $file) 
     532                echo '<li><a href="'.EXT_FILE.'?lang='.$lang.'&amp;file='.$file.'">'.$file.'</a></li>'; 
     533                 
    384534 
    385535?> 
    386536                        </ul> 
    387537                </div> 
    388                 <div class="ct-box info-box"> 
    389                         <h3 class="ct-legend hn"><span><?php echo $lang_le['Extension list'] ?></span></h3> 
    390                         <ul> 
    391 <?php 
     538 
     539                <div class="content-head"> 
     540                        <h2 class="hn"><span><?php echo $lang_le['Extension list'] ?></span></h2> 
     541                </div> 
     542<?php 
     543 
    392544        $dir = FORUM_ROOT.'extensions/'; 
    393545        $d = dir($dir); 
     
    398550                        $name = ucfirst(str_replace('_', ' ', $f)); 
    399551                         
    400                         $export = ' [ <a href="'.EXT_FILE.'?act=export&amp;lang='.$lang.'&amp;ext='.$f.'">Export</a> ]'; 
    401                          
     552                        $url = null; 
     553                        $actions = array(); 
     554 
    402555                        // if translated lang exists 
    403556                        if (file_exists($dir.$f.'/lang/'.$lang) || file_exists($dir.$f.'/lang/'.$lang.'.php')) 
     557                        { 
    404558                                $url = '?lang='.$lang.'&ext='.$f; 
     559                                $actions[] = '<a href="'.EXT_FILE.'?act=export&amp;lang='.$lang.'&amp;ext='.$f.'&exclude='.$lang.'">Export without '.$lang.'</a>'; 
     560                        } 
    405561                         
    406562                        // if extension has english file 
    407563                        elseif (file_exists($dir.$f.'/lang/English') || file_exists($dir.$f.'/lang/English.php')) 
    408                                 $url = '?act=create&amp;lang='.$lang.'&ext='.$f.'" style="color: red'; 
     564                                $actions[] = '<a href="'.EXT_FILE.'?act=create&amp;lang='.$lang.'&ext='.$f.'" style="color: red">Create</a>'; 
     565 
     566                        $actions[] = '<a href="'.EXT_FILE.'?act=export&amp;lang='.$lang.'&amp;ext='.$f.'">Export</a>'; 
    409567                         
     568                        $version = get_extension_version($f); 
     569                         
     570                        if ($url) 
     571                                $name = '<a href="'.EXT_FILE.$url.'"><strong>'.$name.'</strong> v'.$version.'</a>'; 
    410572                        else 
    411                                 $url = null; 
    412                          
    413                         echo '<li>'.($url ? '<a href="'.EXT_FILE.$url.'">' : '').$name.($url ? '</a>' : '').$export.'</li>'; 
     573                                $name .= ' v'.$version; 
     574 
     575?> 
     576                <div class="ct-box info-box"> 
     577                        <p style="float: right"><?php echo implode(' | ', $actions) ?></p> 
     578                        <h3 class="ct-legend hn"><span><?php echo $name ?></span></h3> 
     579                </div> 
     580 
     581<?php 
    414582 
    415583                } 
     
    417585 
    418586?> 
    419                         </ul> 
    420                 </div> 
    421587        </div> 
    422588 
  • branches/lang_editor/include/functions.php

    r30 r32  
    11<?php 
    2  
    32 
    43 
     
    1615 
    1716        $file = file_get_contents($compare_filepath); 
    18         $file = str_replace('<?php', '', $file); 
     17        $file = substr($file, strpos($file, '$lang')); 
    1918        $file = preg_replace('#\$lang_.*?\s*=\s*array\(#si', '$lang_compare = array(', $file); 
     19        $file = preg_replace("#\n//(.*?)\n#si", "\n".'\'//$1\','."\n", $file); 
    2020        eval($file); 
    2121         
    2222        $file = trim(file_get_contents($filepath)); 
    23         $file = substr($file, strpos($file, '<?php')); 
     23        $file = substr($file, strpos($file, '$lang')); 
    2424        $file = str_replace('<?php', '', $file); 
    2525        $file = preg_replace('#\$lang_.*?\s*=\s*array\(#si', '$lang = array(', $file); 
     
    2828        $result = array(); 
    2929        $diff = $is_different = false; 
    30                  
     30         
     31        // Go through English language file 
    3132        foreach ($lang_compare as $key => $value) 
    32         { 
     33        {                
    3334                $item = array($value); 
    3435                 
     
    3839                        unset($lang[$key]); 
    3940                } 
    40                 elseif (!$diff) 
     41                elseif (!$diff && substr($value, 0, 2) != '//') // Ignore comments 
    4142                        $diff = true; 
    4243                 
     
    4445        } 
    4546         
     47        // Check if $lang_compare and $lang are different 
    4648        $is_different = (count($lang) > 0 || $diff); 
    4749         
     
    113115 
    114116 
     117function get_extension_version($extension) 
     118{ 
     119        $manifest = file_get_contents(FORUM_ROOT.'extensions/'.$extension.'/manifest.xml'); 
     120        preg_match('#<version>(.*?)<\/version>#', $manifest, $matches); 
     121        return $matches[1]; 
     122} 
     123 
     124 
     125function search($what, $directory) 
     126{ 
     127        global $search_results; 
     128 
     129        $dir = dir($directory); 
     130        while ($file = $dir->read()) 
     131        { 
     132                if (substr($file, 0, 1) != '.') 
     133                { 
     134                        if (is_dir($directory.'/'.$file)) 
     135                        { 
     136                                //search($what, $directory.'/'.$file); 
     137                        } 
     138                        else if (preg_match('#.php$#', $file)) 
     139                        { 
     140                                $file_contents = file_get_contents($directory.'/'.$file); 
     141                                preg_match_all("#\n'([^']*?)'\s*?=>\s*?'([^']*?".$what."[^']*?)'\s*?,#si", $file_contents, $matches); 
     142                                foreach ($matches[1] as $key => $match) 
     143                                        $search_results[$file][] = array($matches[1][$key], $matches[2][$key]); 
     144 
     145                                preg_match_all("#\n'([^']*?".$what."[^']*?)'\s*?=>\s*?'(.*?)'\s*?,#si", $file_contents, $matches); 
     146                                foreach ($matches[1] as $key => $match) 
     147                                        $search_results[$file][] = array($matches[1][$key], $matches[2][$key]); 
     148                        } 
     149                } 
     150        } 
     151} 
     152 
     153 
    115154function add_dir_to_archive($directory, $subdir = '') 
    116155{ 
    117         global $zip; 
     156        global $zip, $exclude_langs; 
    118157         
    119158        $dir = dir($directory.'/'.$subdir); 
     
    122161                if (substr($file, 0, 1) != '.' && !preg_match('#.diff$#', $file)) 
    123162                { 
    124                         if (is_dir($directory.'/'.$subdir.'/'.$file)) 
     163                        if (is_dir($directory.'/'.$subdir.'/'.$file) && !in_array($file, $exclude_langs)) 
    125164                        { 
    126165                                $zip->addEmptyDir($subdir.'/'.$file); 
  • branches/lang_editor/lang/English.php

    r2 r32  
    33$lang_le = array( 
    44 
    5 'Lang editor'                   => 'Lang editor', 
    6 'Lang file updated'             => 'Lang file updated', 
    7 'Lang file created'             => 'Lang file created', 
     5'Lang editor'                           => 'Lang editor', 
     6'Lang file updated'                     => 'Lang file updated. Redirecting…', 
     7'Lang file created'                     => 'Lang file created. Redirecting…', 
    88 
    9 'Language list'                 => 'Language list', 
     9'Language list'                         => 'Language list', 
    1010'Different structure'           => 'File English and translated has different structure (e.g. some strings are missing), translated file will be generated from English file.', 
    1111 
    12 'String list'                   => 'String list', 
    13 'Orginal string'                => 'Orginal string', 
    14 'Translated string'             => 'Translated string', 
     12'String list'                           => 'String list', 
     13'Orginal string'                        => 'Orginal string', 
     14'Translated string'                     => 'Translated string', 
    1515 
    16 'File list'                     => 'File list', 
    17 'Extension list'                => 'Extension list', 
     16'File list'                                     => 'File list', 
     17'Extension list'                        => 'Extension list', 
    1818'Language file for compare does not exist'      => 'Language file for compare does not exist', 
    1919'Language file does not exist'  => 'Language file does not exist', 
    2020 
    21 'Save'                          => 'Save', 
    22 'No permissions'                => 'No permissions to "%s"', 
     21'Save'                                          => 'Save', 
     22'No permissions'                        => 'No permissions to "%s"', 
    2323); 
  • branches/lang_editor/manifest.xml

    r3 r32  
    44        <id>lang_editor</id> 
    55        <title>Lang Editor</title> 
    6         <version>0.2</version> 
     6        <version>0.3</version> 
    77        <description>Allow easly edits strings in language files</description> 
    88        <author>Daris</author>