// fix added toolbar in AdminTranslationsController

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@10444 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
lLefevre
2011-11-22 15:54:14 +00:00
parent 4334537fe1
commit 62696d85f9
8 changed files with 519 additions and 478 deletions
+139 -134
View File
@@ -24,141 +24,146 @@
* International Registered Trademark & Property of PrestaShop SA * International Registered Trademark & Property of PrestaShop SA
*} *}
<script type="text/javascript"> {extends file="helper/view/view.tpl"}
function chooseTypeTranslation(id_lang)
{
getE('translation_lang').value = id_lang;
document.getElementById('typeTranslationForm').submit();
}
</script>
<fieldset class="width3"><legend><img src="../img/admin/translation.gif" />{l s='Modify translations'}</legend> {block name="override_tpl"}
{l s='Here you can modify translations for all text input into PrestaShop.'}<br /> <script type="text/javascript">
{l s='First, select a section (such as Back Office or Modules), then click the flag representing the language you want to edit.'}<br /><br /> function chooseTypeTranslation(id_lang)
<form method="get" action="index.php" id="typeTranslationForm"> {
<input type="hidden" name="tab" value="AdminTranslations" /> getE('translation_lang').value = id_lang;
<input type="hidden" name="lang" id="translation_lang" value="0" /> document.getElementById('typeTranslationForm').submit();
<select name="type" style="float:left; margin-right:10px;"> }
{foreach $translations as $key => $translation} </script>
<option value="{$key}">{$translation}&nbsp;</option>
{/foreach} <fieldset>
</select> <legend><img src="../img/admin/translation.gif" />{l s='Modify translations'}</legend>
{foreach $languages as $language} {l s='Here you can modify translations for all text input into PrestaShop.'}<br />
<a href="javascript:chooseTypeTranslation('{$language['iso_code']}')"> {l s='First, select a section (such as Back Office or Modules), then click the flag representing the language you want to edit.'}<br /><br />
<img src="{$theme_lang_dir}{$language['id_lang']}.jpg" alt="{$language['iso_code']}" title="{$language['iso_code']}" /> <form method="get" action="index.php" id="typeTranslationForm">
</a> <input type="hidden" name="tab" value="AdminTranslations" />
{/foreach} <input type="hidden" name="lang" id="translation_lang" value="0" />
<input type="hidden" name="token" value="{$token}" /> <select name="type" style="float:left; margin-right:10px;">
</form> {foreach $translations as $key => $translation}
</fieldset> <option value="{$key}">{$translation}&nbsp;</option>
{/foreach}
<br /><h2>{l s='Translation exchange'}</h2> </select>
<form action="{$url_submit}" method="post" enctype="multipart/form-data">
<fieldset class="width3">
<legend>
<img src="../img/admin/import.gif" />{l s='Add / Update a language'}
</legend>
<div id="submitAddLangContent" style="float:left;">
<p>{l s='You can add or update a language directly from prestashop.com here'}</p>
<div class="warn">
{l s='If you choose to update an existing language pack, all your previous customization in the theme named prestashop will be lost. This includes front office expressions and default e-mail templates.'}
</div>
{if $packs_to_update || $packs_to_install}
<div style="font-weight:bold; float:left;">{l s='Language you want to add or update:'}
<select id="params_import_language" name="params_import_language">
<optgroup label="{l s='Add a language'}">
{foreach $packs_to_install as $lang_pack}
<option value="{$lang_pack['iso_code']}|{$lang_pack['version']}">{$lang_pack['name']}</option>
{/foreach}
</optgroup>
<optgroup label="{l s='Update a language'}">
{foreach $packs_to_update as $lang_pack}
<option value="{$lang_pack['iso_code']}|{$lang_pack['version']}">{$lang_pack['name']}</option>
{/foreach}
</optgroup>
</select> &nbsp;
<input type="submit" value="{l s='Add or update the language'}" name="submitAddLanguage" class="button" />
</div>
{else}
<br /><br /><p class="error">{l s='Cannot connect to prestashop.com to get languages list.'}</p></div>
{/if}
</div>
</fieldset>
</form><br /><br />
<form action="{$url_submit}" method="post" enctype="multipart/form-data">
<fieldset class="width3">
<legend>
<img src="../img/admin/import.gif" />{l s='Import a language pack manually'}
</legend>
<div id="submitImportContent">
{l s='If the name format is: isocode.gzip (e.g. fr.gzip) and the language corresponding to this package does not exist, it will automatically be created.'}
{l s='Be careful, as it will replace all existing data for the destination language!'}<br /><br />
{l s='Language pack to import:'} <input type="file" name="file" /> &nbsp;<input type="submit" value="{l s='Import'}" name="submitImport" class="button" /></p>
</div>
</fieldset>
</form>
<br /><br />
<form action="{$url_submit}" method="post" enctype="multipart/form-data">
<fieldset class="width3">
<legend><img src="../img/admin/export.gif" />{l s='Export a language'}</legend>
<p>{l s='Export data from one language to a file (language pack).'}<br />
{l s='Choose the theme from which you want to export translations.'}<br />
<select name="iso_code" style="margin-top:10px;">
{foreach $languages as $language} {foreach $languages as $language}
<option value="{$language['iso_code']}">{$language['name']}</option> <a href="javascript:chooseTypeTranslation('{$language['iso_code']}')">
<img src="{$theme_lang_dir}{$language['id_lang']}.jpg" alt="{$language['iso_code']}" title="{$language['iso_code']}" />
</a>
{/foreach} {/foreach}
</select> <input type="hidden" name="token" value="{$token}" />
&nbsp;&nbsp;&nbsp; </form>
<select name="theme" style="margin-top:10px;">
{foreach $themes as $theme}
<option value="{$theme['name']}">{$theme['name']}</option>
{/foreach}
</select>&nbsp;&nbsp;
<input type="submit" class="button" name="submitExport" value="{l s='Export'}" />
</fieldset> </fieldset>
</form>
<br /><br /> <br /><h2>{l s='Translation exchange'}</h2>
<form action="{$url_submit}" method="post"> <form action="{$url_submit}" method="post" enctype="multipart/form-data">
<fieldset class="width3"> <fieldset>
<legend><img src="../img/admin/copy_files.gif" />{l s='Copy'}</legend> <legend>
<p>{l s='Copies data from one language to another.'}<br /> <img src="../img/admin/import.gif" />{l s='Add / Update a language'}
{l s='Be careful, as it will replace all existing data for the destination language!'}<br /> </legend>
{l s='If necessary'}, <b><a href="{$url_create_language}">{l s='first create a new language'}</a></b>.</p> <div id="submitAddLangContent" style="float:left;">
<div style="float:left;"> <p>{l s='You can add or update a language directly from prestashop.com here'}</p>
<p> <div class="warn">
<div style="width:75px; font-weight:bold; float:left;">{l s='From:'}</div> {l s='If you choose to update an existing language pack, all your previous customization in the theme named prestashop will be lost. This includes front office expressions and default e-mail templates.'}
<select name="fromLang">'; </div>
{foreach $languages as $language} {if $packs_to_update || $packs_to_install}
<option value="{$language['iso_code']}">{$language['name']}</option> <div style="font-weight:bold; float:left;">{l s='Language you want to add or update:'}
{/foreach} <select id="params_import_language" name="params_import_language">
</select> <optgroup label="{l s='Add a language'}">
&nbsp;&nbsp;&nbsp; {foreach $packs_to_install as $lang_pack}
<select name="fromTheme"> <option value="{$lang_pack['iso_code']}|{$lang_pack['version']}">{$lang_pack['name']}</option>
{foreach $themes as $theme} {/foreach}
<option value="{$theme['name']}">{$theme['name']}</option> </optgroup>
{/foreach} <optgroup label="{l s='Update a language'}">
</select> <span style="font-style: bold; color: red;">*</span> {foreach $packs_to_update as $lang_pack}
</p> <option value="{$lang_pack['iso_code']}|{$lang_pack['version']}">{$lang_pack['name']}</option>
<p> {/foreach}
<div style="width:75px; font-weight:bold; float:left;">{l s='To:'}</div> </optgroup>
<select name="toLang"> </select> &nbsp;
{foreach $languages as $language} <input type="submit" value="{l s='Add or update the language'}" name="submitAddLanguage" class="button" />
<option value="{$language['iso_code']}">{$language['name']}</option> </div>
{/foreach} {else}
</select> <br /><br /><p class="error">{l s='Cannot connect to prestashop.com to get languages list.'}</p></div>
&nbsp;&nbsp;&nbsp; {/if}
<select name="toTheme"> </div>
{foreach $themes as $theme} </fieldset>
<option value="{$theme['name']}">{$theme['name']}</option> </form><br /><br />
{/foreach}
</select> <form action="{$url_submit}" method="post" enctype="multipart/form-data">
</p> <fieldset>
</div> <legend>
<div style="float:left;"> <img src="../img/admin/import.gif" />{l s='Import a language pack manually'}
<input type="submit" value="{l s=' Copy '}" name="submitCopyLang" class="button" style="margin:25px 0px 0px 25px;" /> </legend>
</div> <div id="submitImportContent">
<p style="clear: left; padding: 16px 0px 0px 0px;"><span style="font-style: bold; color: red;">*</span> {l s='Language files (as indicated at Tools >> Languages >> Edition) must be complete to allow copying of translations'}</p> {l s='If the name format is: isocode.gzip (e.g. fr.gzip) and the language corresponding to this package does not exist, it will automatically be created.'}
</fieldset> {l s='Be careful, as it will replace all existing data for the destination language!'}<br /><br />
</form> {l s='Language pack to import:'} <input type="file" name="file" /> &nbsp;<input type="submit" value="{l s='Import'}" name="submitImport" class="button" /></p>
</div>
</fieldset>
</form>
<br /><br />
<form action="{$url_submit}" method="post" enctype="multipart/form-data">
<fieldset>
<legend><img src="../img/admin/export.gif" />{l s='Export a language'}</legend>
<p>{l s='Export data from one language to a file (language pack).'}<br />
{l s='Choose the theme from which you want to export translations.'}<br />
<select name="iso_code" style="margin-top:10px;">
{foreach $languages as $language}
<option value="{$language['iso_code']}">{$language['name']}</option>
{/foreach}
</select>
&nbsp;&nbsp;&nbsp;
<select name="theme" style="margin-top:10px;">
{foreach $themes as $theme}
<option value="{$theme['name']}">{$theme['name']}</option>
{/foreach}
</select>&nbsp;&nbsp;
<input type="submit" class="button" name="submitExport" value="{l s='Export'}" />
</fieldset>
</form>
<br /><br />
<form action="{$url_submit}" method="post">
<fieldset>
<legend><img src="../img/admin/copy_files.gif" />{l s='Copy'}</legend>
<p>{l s='Copies data from one language to another.'}<br />
{l s='Be careful, as it will replace all existing data for the destination language!'}<br />
{l s='If necessary'}, <b><a href="{$url_create_language}">{l s='first create a new language'}</a></b>.</p>
<div style="float:left;">
<p>
<div style="width:75px; font-weight:bold; float:left;">{l s='From:'}</div>
<select name="fromLang">';
{foreach $languages as $language}
<option value="{$language['iso_code']}">{$language['name']}</option>
{/foreach}
</select>
&nbsp;&nbsp;&nbsp;
<select name="fromTheme">
{foreach $themes as $theme}
<option value="{$theme['name']}">{$theme['name']}</option>
{/foreach}
</select> <span style="font-style: bold; color: red;">*</span>
</p>
<p>
<div style="width:75px; font-weight:bold; float:left;">{l s='To:'}</div>
<select name="toLang">
{foreach $languages as $language}
<option value="{$language['iso_code']}">{$language['name']}</option>
{/foreach}
</select>
&nbsp;&nbsp;&nbsp;
<select name="toTheme">
{foreach $themes as $theme}
<option value="{$theme['name']}">{$theme['name']}</option>
{/foreach}
</select>
</p>
</div>
<div style="float:left;">
<input type="submit" value="{l s=' Copy '}" name="submitCopyLang" class="button" style="margin:25px 0px 0px 25px;" />
</div>
<p style="clear: left; padding: 16px 0px 0px 0px;"><span style="font-style: bold; color: red;">*</span> {l s='Language files (as indicated at Tools >> Languages >> Edition) must be complete to allow copying of translations'}</p>
</fieldset>
</form>
{/block}
@@ -24,23 +24,29 @@
* International Registered Trademark & Property of PrestaShop SA * International Registered Trademark & Property of PrestaShop SA
*} *}
<h2>{l s='Language'} : {$lang} - {$translation_type}</h2> {extends file="helper/view/view.tpl"}
{l s='Errors to translate'} : <b>{$count}</b>
{$limit_warning} {block name="override_tpl"}
{if !$suoshin_exceeded}
<form method="post" action="{$url_submit}" class="form"> <h2>{l s='Language'} : {$lang} - {$translation_type}</h2>
{$auto_translate} {l s='Errors to translate'} : <b>{$count}</b>
<input type="hidden" name="lang" value="{$lang}" /> {$limit_warning}
<input type="submit" name="submitTranslations{$type|ucfirst}" value="{l s='Update translations'}" class="button" /> {if !$suoshin_exceeded}
<br /><br /> <form method="post" action="{$url_submit}" class="form">
<table cellpadding="0" cellspacing="0" class="table"> {$auto_translate}
{foreach $errorsArray as $key => $value} <input type="hidden" name="lang" value="{$lang}" />
<tr {if empty($value)}style="background-color:#FBB"{else}{cycle values='class="alt_row",'}{/if}> <input type="submit" name="submitTranslations{$type|ucfirst}" value="{l s='Update translations'}" class="button" />
<td>{$key|stripslashes}</td> <br /><br />
<td style="width: 430px">= <input type="text" name="{$key|md5}" value="{$value|regex_replace:'#"#':'&quot;'|stripslashes}" style="width: 380px"></td> <table cellpadding="0" cellspacing="0" class="table">
</tr> {foreach $errorsArray as $key => $value}
{/foreach} <tr {if empty($value)}style="background-color:#FBB"{else}{cycle values='class="alt_row",'}{/if}>
</table><br /> <td>{$key|stripslashes}</td>
<input type="submit" name="submitTranslations{$type|ucfirst}" value="{l s='Update translations'}" class="button" /> <td style="width: 430px">= <input type="text" name="{$key|md5}" value="{$value|regex_replace:'#"#':'&quot;'|stripslashes}" style="width: 380px"></td>
</form> </tr>
{/if} {/foreach}
</table><br />
<input type="submit" name="submitTranslations{$type|ucfirst}" value="{l s='Update translations'}" class="button" />
</form>
{/if}
{/block}
@@ -24,48 +24,54 @@
* International Registered Trademark & Property of PrestaShop SA * International Registered Trademark & Property of PrestaShop SA
*} *}
<h2>{l s='Language'} : {$lang} - {$translation_type}</h2> {extends file="helper/view/view.tpl"}
{l s='Expressions to translate'} : <b>{$count}</b>. {l s='Click on the titles to open fieldsets'}.<br /><br />
<p>{l s='total missing expresssions:'} {$missing_translations|array_sum} </p> {block name="override_tpl"}
{$limit_warning}
{if !$suoshin_exceeded} <h2>{l s='Language'} : {$lang} - {$translation_type}</h2>
<form method="post" action="{$url_submit}" class="form"> {l s='Expressions to translate'} : <b>{$count}</b>. {l s='Click on the titles to open fieldsets'}.<br /><br />
{$toggle_button} <p>{l s='total missing expresssions:'} {$missing_translations|array_sum} </p>
{$auto_translate} {$limit_warning}
<input type="hidden" name="lang" value="{$lang}" /> {if !$suoshin_exceeded}
<input type="submit" name="submitTranslations{$type|ucfirst}" value="{l s='Update translations'}" class="button" /> <form method="post" action="{$url_submit}" class="form">
<br /><br /> {$toggle_button}
{foreach $tabsArray as $k => $newLang} {$auto_translate}
{if !empty($newLang)} <input type="hidden" name="lang" value="{$lang}" />
<fieldset> <input type="submit" name="submitTranslations{$type|ucfirst}" value="{l s='Update translations'}" class="button" />
<legend style="cursor : pointer" onclick="$('#{$k}-tpl').slideToggle();"> <br /><br />
{$k} - <font color="blue">{$newLang|count}</font> {l s='expressions'} {foreach $tabsArray as $k => $newLang}
{if isset($missing_translations[$k])}(<font color="red">{$missing_translations[$k]} {l s='missing'}</font>){/if} {if !empty($newLang)}
</legend> <fieldset>
<div name="{$type}_div" id="{$k}-tpl" style="display:{if isset($missing_translations[$k])}block{else}none{/if}"> <legend style="cursor : pointer" onclick="$('#{$k}-tpl').slideToggle();">
<table cellpadding="2"> {$k} - <font color="blue">{$newLang|count}</font> {l s='expressions'}
{foreach $newLang as $key => $value} {if isset($missing_translations[$k])}(<font color="red">{$missing_translations[$k]} {l s='missing'}</font>){/if}
<tr> </legend>
<td style="width: 40%">{$key|stripslashes}</td> <div name="{$type}_div" id="{$k}-tpl" style="display:{if isset($missing_translations[$k])}block{else}none{/if}">
<td>= {*todo : md5 is already calculated in AdminTranslationsController*} <table cellpadding="2">
{if $key|strlen < $textarea_sized} {foreach $newLang as $key => $value}
<input type="text" <tr>
style="width: 450px" <td style="width: 40%">{$key|stripslashes}</td>
name="{if in_array($type, array('front', 'fields'))}{$k}_{$key|md5}{else}{$k}{$key|md5}{/if}" <td>= {*todo : md5 is already calculated in AdminTranslationsController*}
value="{$value|regex_replace:'/"/':'&quot;'|stripslashes}" /> {if $key|strlen < $textarea_sized}
{else} <input type="text"
<textarea rows="{($key|strlen / $textarea_sized)|intval}" style="width: 450px"
style="width: 450px" name="{if in_array($type, array('front', 'fields'))}{$k}_{$key|md5}{else}{$k}{$key|md5}{/if}"
name="{if in_array($type, array('front', 'fields'))}{$k}_{$key|md5}{else}{$k}{$key|md5}{/if}" value="{$value|regex_replace:'/"/':'&quot;'|stripslashes}" />
>{$value|regex_replace:'/"/':'&quot;'|stripslashes}</textarea> {else}
{/if} <textarea rows="{($key|strlen / $textarea_sized)|intval}"
</td> style="width: 450px"
</tr> name="{if in_array($type, array('front', 'fields'))}{$k}_{$key|md5}{else}{$k}{$key|md5}{/if}"
{/foreach} >{$value|regex_replace:'/"/':'&quot;'|stripslashes}</textarea>
</table> {/if}
</div> </td>
</fieldset><br /> </tr>
{/if} {/foreach}
{/foreach} </table>
<br /><input type="submit" name="submitTranslations{$type|ucfirst}" value="{l s='Update translations'}" class="button" /></form> </div>
{/if} </fieldset><br />
{/if}
{/foreach}
<br /><input type="submit" name="submitTranslations{$type|ucfirst}" value="{l s='Update translations'}" class="button" /></form>
{/if}
{/block}
@@ -24,40 +24,46 @@
* International Registered Trademark & Property of PrestaShop SA * International Registered Trademark & Property of PrestaShop SA
*} *}
{$tinyMCE} {extends file="helper/view/view.tpl"}
<h2>{l s='Language'} : {$lang} - {$translation_type}</h2> {block name="override_tpl"}
{l s='Click on the titles to open fieldsets'}.<br /><br />
{if !$suoshin_exceeded}
<form method="post" action="{$url_submit}" class="form">
{$toggle_button}
<input type="hidden" name="lang" value="{$lang}" />
<input type="hidden" name="type" value="{$type}" />
<input type="submit" name="submitTranslations{$type|ucfirst}" value="{l s='Update translations'}" class="button" />
<input type="submit" name="submitTranslations{$type|ucfirst}AndStay" value="{l s='Update and stay'}" class="button" />
<br /><br />
{l s='Core e-mails:'}
{$mail_content}
{l s='Modules e-mails:'} {$tinyMCE}
{foreach $module_mails as $module_name => $mails}
{$mails['display']}
{/foreach}
{if !empty($theme_mails)} <h2>{l s='Language'} : {$lang} - {$translation_type}</h2>
{l s='Themes e-mails:'} {l s='Click on the titles to open fieldsets'}.<br /><br />
{$bool_title = false} {if !$suoshin_exceeded}
{foreach $theme_mails as $theme_or_module_name => $mails} <form method="post" action="{$url_submit}" class="form">
{if $theme_or_module_name != 'theme_mail' && !$bool_title} {$toggle_button}
{$bool_title = true} <input type="hidden" name="lang" value="{$lang}" />
{l s='E-mails modules in theme:'} <input type="hidden" name="type" value="{$type}" />
{/if} <input type="submit" name="submitTranslations{$type|ucfirst}" value="{l s='Update translations'}" class="button" />
<input type="submit" name="submitTranslations{$type|ucfirst}AndStay" value="{l s='Update and stay'}" class="button" />
<br /><br />
{l s='Core e-mails:'}
{$mail_content}
{l s='Modules e-mails:'}
{foreach $module_mails as $module_name => $mails}
{$mails['display']} {$mails['display']}
{/foreach} {/foreach}
{if !empty($theme_mails)}
{l s='Themes e-mails:'}
{$bool_title = false}
{foreach $theme_mails as $theme_or_module_name => $mails}
{if $theme_or_module_name != 'theme_mail' && !$bool_title}
{$bool_title = true}
{l s='E-mails modules in theme:'}
{/if}
{$mails['display']}
{/foreach}
{/if}
<br />
<input type="submit" name="submitTranslations{$type|ucfirst}" value="{l s='Update translations'}" class="button" />
<input type="submit" name="submitTranslations{$type|ucfirst}AndStay" value="{l s='Update and stay'}" class="button" />
</form>
{/if} {/if}
<br />
<input type="submit" name="submitTranslations{$type|ucfirst}" value="{l s='Update translations'}" class="button" /> {/block}
<input type="submit" name="submitTranslations{$type|ucfirst}AndStay" value="{l s='Update and stay'}" class="button" />
</form>
{/if}
@@ -24,71 +24,77 @@
* International Registered Trademark & Property of PrestaShop SA * International Registered Trademark & Property of PrestaShop SA
*} *}
<h2>{l s='Language'} : {$lang} - {$translation_type}</h2> {extends file="helper/view/view.tpl"}
{l s='Expressions to translate'} : <b>{$count}</b>. {l s='Click on the titles to open fieldsets'}.<br /><br />
{$limit_warning}
{if !$suoshin_exceeded}
<form method="post" action="{$url_submit}" class="form">
{$toggle_button}
{$auto_translate}
<input type="hidden" name="lang" value="{$lang}" />
<input type="submit" name="submitTranslations{$type|ucfirst}" value="{l s='Update translations'}" class="button" />
<br /><br />
{if count($modules_translations) > 1} {block name="override_tpl"}
<h3 style="padding:0;margin:0;">{l s='List of Themes - Click to access theme translation:'}</h3>
<ul style="list-style-type:none;padding:0;margin:0 0 10px 0;"> <h2>{l s='Language'} : {$lang} - {$translation_type}</h2>
{foreach array_keys($modules_translations) as $theme} {l s='Expressions to translate'} : <b>{$count}</b>. {l s='Click on the titles to open fieldsets'}.<br /><br />
<li><a href="#{$theme}" class="link">- {if $theme === 'default'}{l s='default'}{else}$theme{/if}</a></li> {$limit_warning}
{/foreach} {if !$suoshin_exceeded}
</ul> <form method="post" action="{$url_submit}" class="form">
{/if} {$toggle_button}
{$auto_translate}
{foreach $modules_translations as $theme_name => $theme} <input type="hidden" name="lang" value="{$lang}" />
<h2>&gt;{l s='Theme:'} <a name="{$theme_name}">{if $theme_name === $default_theme_name}{l s='default'}{else}{$theme_name}{/if} </h2> <input type="submit" name="submitTranslations{$type|ucfirst}" value="{l s='Update translations'}" class="button" />
{foreach $theme as $module_name => $module} <br /><br />
{l s='Module:'} <a name="{$module_name}" style="font-style:italic">{$module_name}</a>
{foreach $module as $template_name => $newLang} {if count($modules_translations) > 1}
{if !empty($newLang)} <h3 style="padding:0;margin:0;">{l s='List of Themes - Click to access theme translation:'}</h3>
{$occurrences = $newLang|array_count_values} <ul style="list-style-type:none;padding:0;margin:0 0 10px 0;">
{if isset($occurrences[''])} {foreach array_keys($modules_translations) as $theme}
{$missing_translations = $occurrences['']} <li><a href="#{$theme}" class="link">- {if $theme === 'default'}{l s='default'}{else}$theme{/if}</a></li>
{else} {/foreach}
{$missing_translations = 0} </ul>
{/if}
{foreach $modules_translations as $theme_name => $theme}
<h2>&gt;{l s='Theme:'} <a name="{$theme_name}">{if $theme_name === $default_theme_name}{l s='default'}{else}{$theme_name}{/if} </h2>
{foreach $theme as $module_name => $module}
{l s='Module:'} <a name="{$module_name}" style="font-style:italic">{$module_name}</a>
{foreach $module as $template_name => $newLang}
{if !empty($newLang)}
{$occurrences = $newLang|array_count_values}
{if isset($occurrences[''])}
{$missing_translations = $occurrences['']}
{else}
{$missing_translations = 0}
{/if}
<fieldset>
<legend style="cursor : pointer" onclick="$('#{$theme_name}_{$module_name}_{$template_name}').slideToggle();">{if $theme_name === 'default'}{l s='default'}{else}{$theme_name}{/if} - {$template_name}
<font color="blue">{$newLang|count}</font> {l s='expressions'} (<font color="red">{$missing_translations}</font>)
</legend>
<div name="{$type}_div" id="{$theme_name}_{$module_name}_{$template_name}" style="display:{if $missing_translations}block{else}none{/if}">
<table cellpadding="2">
{foreach $newLang as $key => $value}
<tr>
<td style="width: 40%">{$key|stripslashes}</td>
<td>=
{* Prepare name string for md5() *}
{capture assign="name"}{strtolower($module_name)}_{strtolower($theme_name)}_{strtolower($template_name)}_{md5($key)}{/capture}
{if $key|strlen < $textarea_sized}
<input type="text"
style="width: 450px"
name="{$name|md5}"
value="{$value|regex_replace:'#"#':'&quot;'|stripslashes}" />
{else}
<textarea rows="{($key|strlen / $textarea_sized)|intval}"
style="width: 450px"
name="{$name|md5}">
{$value|regex_replace:'#"#':'&quot;'|stripslashes}
</textarea>
{/if}
</td>
</tr>
{/foreach}
</table>
</div>
</fieldset><br />
{/if} {/if}
<fieldset> {/foreach}
<legend style="cursor : pointer" onclick="$('#{$theme_name}_{$module_name}_{$template_name}').slideToggle();">{if $theme_name === 'default'}{l s='default'}{else}{$theme_name}{/if} - {$template_name}
<font color="blue">{$newLang|count}</font> {l s='expressions'} (<font color="red">{$missing_translations}</font>)
</legend>
<div name="{$type}_div" id="{$theme_name}_{$module_name}_{$template_name}" style="display:{if $missing_translations}block{else}none{/if}">
<table cellpadding="2">
{foreach $newLang as $key => $value}
<tr>
<td style="width: 40%">{$key|stripslashes}</td>
<td>=
{* Prepare name string for md5() *}
{capture assign="name"}{strtolower($module_name)}_{strtolower($theme_name)}_{strtolower($template_name)}_{md5($key)}{/capture}
{if $key|strlen < $textarea_sized}
<input type="text"
style="width: 450px"
name="{$name|md5}"
value="{$value|regex_replace:'#"#':'&quot;'|stripslashes}" />
{else}
<textarea rows="{($key|strlen / $textarea_sized)|intval}"
style="width: 450px"
name="{$name|md5}">
{$value|regex_replace:'#"#':'&quot;'|stripslashes}
</textarea>
{/if}
</td>
</tr>
{/foreach}
</table>
</div>
</fieldset><br />
{/if}
{/foreach} {/foreach}
{/foreach} {/foreach}
{/foreach} <br /><input type="submit" name="submitTranslations{$type|ucfirst}" value="{l s='Update translations'}" class="button" /></form>
<br /><input type="submit" name="submitTranslations{$type|ucfirst}" value="{l s='Update translations'}" class="button" /></form> {/if}
{/if}
{/block}
+2 -2
View File
@@ -1371,12 +1371,12 @@ class AdminControllerCore extends Controller
/** /**
* Override to init display of the view page * Override to init display of the view page
*/ */
public function initView() public function initView($tpl = false)
{ {
$helper = new HelperView($this); $helper = new HelperView($this);
$this->setHelperDisplay($helper); $this->setHelperDisplay($helper);
$helper->tpl_vars = $this->tpl_view_vars; $helper->tpl_vars = $this->tpl_view_vars;
$view = $helper->generateView(); $view = $helper->generateView($tpl);
$this->toolbar_fix = false; $this->toolbar_fix = false;
return $view; return $view;
+2 -2
View File
@@ -42,9 +42,9 @@ class HelperViewCore extends Helper
parent::__construct(); parent::__construct();
} }
public function generateView() public function generateView($tpl = false)
{ {
$this->tpl = $this->createTemplate($this->base_tpl); $this->tpl = $this->createTemplate(!$tpl ? $this->base_tpl : $tpl);
$this->tpl->assign(array( $this->tpl->assign(array(
'title' => $this->title, 'title' => $this->title,
+192 -180
View File
@@ -64,6 +64,15 @@ class AdminTranslationsControllerCore extends AdminController
$this->context->smarty->assign(array('content' => $this->content)); $this->context->smarty->assign(array('content' => $this->content));
} }
public function initToolbar()
{
$this->toolbar_btn['cancel'] = array(
'href' => self::$currentIndex.'&token='.$this->token,
'desc' => $this->l('Cancel')
);
}
public function initMain() public function initMain()
{ {
// Block modify // Block modify
@@ -80,10 +89,10 @@ class AdminTranslationsControllerCore extends AdminController
// Block add/update // Block add/update
$packs_to_install = array(); $packs_to_install = array();
$packs_to_update = array(); $packs_to_update = array();
if ($lang_packs = Tools::file_get_contents($this->link_lang_pack .'?version='._PS_VERSION_, false, @stream_context_create(array('http' => array('method' => 'GET', 'timeout' => 5))))) if ($lang_packs = Tools::file_get_contents($this->link_lang_pack.'?version='._PS_VERSION_, false, @stream_context_create(array('http' => array('method' => 'GET', 'timeout' => 5)))))
// Notice : for php < 5.2 compatibility, Tools::jsonDecode. The second parameter to true will set us // Notice : for php < 5.2 compatibility, Tools::jsonDecode. The second parameter to true will set us
if ($lang_packs != '' AND $lang_packs = Tools::jsonDecode($lang_packs,true)) if ($lang_packs != '' && $lang_packs = Tools::jsonDecode($lang_packs, true))
foreach($lang_packs as $key => $lang_pack) foreach ($lang_packs as $key => $lang_pack)
{ {
if (!Language::isInstalled($lang_pack['iso_code'])) if (!Language::isInstalled($lang_pack['iso_code']))
$packs_to_install[$key] = $lang_pack; $packs_to_install[$key] = $lang_pack;
@@ -91,7 +100,7 @@ class AdminTranslationsControllerCore extends AdminController
$packs_to_update[$key] = $lang_pack; $packs_to_update[$key] = $lang_pack;
} }
$this->context->smarty->assign(array( $this->tpl_view_vars = array(
'theme_lang_dir' =>_THEME_LANG_DIR_, 'theme_lang_dir' =>_THEME_LANG_DIR_,
'token' => $this->token, 'token' => $this->token,
'languages' => Language::getLanguages(false), 'languages' => Language::getLanguages(false),
@@ -101,9 +110,10 @@ class AdminTranslationsControllerCore extends AdminController
'url_submit' => self::$currentIndex.'&token='.$this->token, 'url_submit' => self::$currentIndex.'&token='.$this->token,
'themes' => $themes = self::getThemesList(), 'themes' => $themes = self::getThemesList(),
'url_create_language' => 'index.php?tab=AdminLanguages&addlang&token='.Tools::getAdminToken('AdminLanguages'.(int)(Tab::getIdFromClassName('AdminLanguages')).(int)$this->context->employee->id), 'url_create_language' => 'index.php?tab=AdminLanguages&addlang&token='.Tools::getAdminToken('AdminLanguages'.(int)(Tab::getIdFromClassName('AdminLanguages')).(int)$this->context->employee->id),
)); );
return $this->context->smarty->fetch('translations/main.tpl'); $this->toolbar_fix = false;
return parent::initView('main.tpl');
} }
/** /**
@@ -116,20 +126,20 @@ class AdminTranslationsControllerCore extends AdminController
{ {
global $_MODULES, $_MODULE; global $_MODULES, $_MODULE;
if (!isset($_MODULE) AND !isset($_MODULES)) if (!isset($_MODULE) && !isset($_MODULES))
$_MODULES = array(); $_MODULES = array();
elseif (isset($_MODULE)) else if (isset($_MODULE))
{ {
if(is_array($_MODULE) AND $is_default === true) if (is_array($_MODULE) && $is_default === true)
{ {
$_NEW_MODULE = array(); $_NEW_MODULE = array();
foreach($_MODULE as $key=>$value) foreach ($_MODULE as $key => $value)
{ {
$_NEW_MODULE[self::DEFAULT_THEME_NAME.$key] = $value; $_NEW_MODULE[self::DEFAULT_THEME_NAME.$key] = $value;
} }
$_MODULE = $_NEW_MODULE; $_MODULE = $_NEW_MODULE;
} }
$_MODULES = (is_array($_MODULES) AND is_array($_MODULE)) ? array_merge($_MODULES, $_MODULE) : $_MODULE; $_MODULES = (is_array($_MODULES) && is_array($_MODULE)) ? array_merge($_MODULES, $_MODULE) : $_MODULE;
} }
} }
@@ -152,7 +162,7 @@ class AdminTranslationsControllerCore extends AdminController
// If folder wasn't already added // If folder wasn't already added
if (!file_exists($path)) if (!file_exists($path))
{ {
if(!mkdir($path, 0777, true)) if (!mkdir($path, 0777, true))
{ {
$bool &= false; $bool &= false;
$this->_errors[] = $this->l('Cannot create the folder').' "'.$path.'". '.$this->l('Check directory writing permissions.'); $this->_errors[] = $this->l('Cannot create the folder').' "'.$path.'". '.$this->l('Check directory writing permissions.');
@@ -167,14 +177,14 @@ class AdminTranslationsControllerCore extends AdminController
{ {
unset($_POST['submitTranslations'.$type], $_POST['lang']); unset($_POST['submitTranslations'.$type], $_POST['lang']);
unset($_POST['token']); unset($_POST['token']);
$toInsert = array(); $to_insert = array();
foreach($_POST AS $key => $value) foreach ($_POST as $key => $value)
if (!empty($value)) if (!empty($value))
$toInsert[$key] = $value; $to_insert[$key] = $value;
$tab = ($fullmark ? Tools::strtoupper($fullmark) : 'LANG').($mark ? Tools::strtoupper($mark) : ''); $tab = ($fullmark ? Tools::strtoupper($fullmark) : 'LANG').($mark ? Tools::strtoupper($mark) : '');
fwrite($fd, "<?php\n\nglobal \$_".$tab.";\n\$_".$tab." = array();\n"); fwrite($fd, "<?php\n\nglobal \$_".$tab.";\n\$_".$tab." = array();\n");
foreach($toInsert AS $key => $value) foreach ($to_insert as $key => $value)
fwrite($fd, '$_'.$tab.'[\''.pSQL($key, true).'\'] = \''.pSQL($value, true).'\';'."\n"); fwrite($fd, '$_'.$tab.'[\''.pSQL($key, true).'\'] = \''.pSQL($value, true).'\';'."\n");
fwrite($fd, "\n?>"); fwrite($fd, "\n?>");
fclose($fd); fclose($fd);
@@ -186,28 +196,26 @@ class AdminTranslationsControllerCore extends AdminController
public function submitCopyLang() public function submitCopyLang()
{ {
if (!($fromLang = strval(Tools::getValue('fromLang'))) OR !($toLang = strval(Tools::getValue('toLang')))) if (!($from_lang = strval(Tools::getValue('fromLang'))) || !($to_lang = strval(Tools::getValue('toLang'))))
$this->_errors[] = $this->l('you must select 2 languages in order to copy data from one to another'); $this->_errors[] = $this->l('you must select 2 languages in order to copy data from one to another');
elseif (!($fromTheme = strval(Tools::getValue('fromTheme'))) OR !($toTheme = strval(Tools::getValue('toTheme')))) else if (!($from_theme = strval(Tools::getValue('fromTheme'))) || !($to_theme = strval(Tools::getValue('toTheme'))))
$this->_errors[] = $this->l('you must select 2 themes in order to copy data from one to another'); $this->_errors[] = $this->l('you must select 2 themes in order to copy data from one to another');
elseif (!Language::copyLanguageData(Language::getIdByIso($fromLang), Language::getIdByIso($toLang))) else if (!Language::copyLanguageData(Language::getIdByIso($from_lang), Language::getIdByIso($to_lang)))
$this->_errors[] = $this->l('an error occurred while copying data'); $this->_errors[] = $this->l('an error occurred while copying data');
elseif ($fromLang == $toLang AND $fromTheme == $toTheme) else if ($from_lang == $to_lang && $from_theme == $to_theme)
$this->_errors[] = $this->l('nothing to copy! (same language and theme)'); $this->_errors[] = $this->l('nothing to copy! (same language and theme)');
if (sizeof($this->_errors)) if (count($this->_errors))
return ; return;
$bool = true; $bool = true;
$items = Language::getFilesList($fromLang, $fromTheme, $toLang, $toTheme, false, false, true); $items = Language::getFilesList($from_lang, $from_theme, $to_lang, $to_theme, false, false, true);
foreach ($items AS $source => $dest) foreach ($items as $source => $dest)
{ {
$bool &= $this->checkDirAndCreate($dest); $bool &= $this->checkDirAndCreate($dest);
$bool &= @copy($source, $dest); $bool &= @copy($source, $dest);
if (strpos($dest, 'modules') AND basename($source) === $fromLang.'.php' AND $bool !== false) if (strpos($dest, 'modules') && basename($source) === $from_lang.'.php' && $bool !== false)
{ $bool &= $this->changeModulesKeyTranslation($dest, $from_theme, $to_theme);
$bool &= $this->changeModulesKeyTranslation($dest, $fromTheme, $toTheme);
}
} }
if ($bool) if ($bool)
Tools::redirectAdmin(self::$currentIndex.'&conf=14&token='.$this->token); Tools::redirectAdmin(self::$currentIndex.'&conf=14&token='.$this->token);
@@ -222,17 +230,15 @@ class AdminTranslationsControllerCore extends AdminController
* @param string $theme_to * @param string $theme_to
* @return boolean * @return boolean
*/ */
public function changeModulesKeyTranslation ($path, $theme_from, $theme_to) public function changeModulesKeyTranslation($path, $theme_from, $theme_to)
{ {
$content = file_get_contents($path); $content = file_get_contents($path);
$arr_replace = array(); $arr_replace = array();
$bool_flag = true; $bool_flag = true;
if(preg_match_all('#\$_MODULE\[\'([^\']+)\'\]#Ui', $content, $matches)) if (preg_match_all('#\$_MODULE\[\'([^\']+)\'\]#Ui', $content, $matches))
{ {
foreach ($matches[1] as $key=>$value) foreach ($matches[1] as $key => $value)
{
$arr_replace[$value] = str_replace($theme_from, $theme_to, $value); $arr_replace[$value] = str_replace($theme_from, $theme_to, $value);
}
$content = str_replace(array_keys($arr_replace), array_values($arr_replace), $content); $content = str_replace(array_keys($arr_replace), array_values($arr_replace), $content);
$bool_flag = (file_put_contents($path, $content) === false) ? false : true; $bool_flag = (file_put_contents($path, $content) === false) ? false : true;
} }
@@ -243,18 +249,18 @@ class AdminTranslationsControllerCore extends AdminController
{ {
$lang = strtolower(Tools::getValue('iso_code')); $lang = strtolower(Tools::getValue('iso_code'));
$theme = strval(Tools::getValue('theme')); $theme = strval(Tools::getValue('theme'));
if ($lang AND $theme) if ($lang && $theme)
{ {
$items = array_flip(Language::getFilesList($lang, $theme, false, false, false, false, true)); $items = array_flip(Language::getFilesList($lang, $theme, false, false, false, false, true));
$gz = new Archive_Tar(_PS_TRANSLATIONS_DIR_.'/export/'.$lang.'.gzip', true); $gz = new Archive_Tar(_PS_TRANSLATIONS_DIR_.'/export/'.$lang.'.gzip', true);
if ($gz->createModify($items, NULL, _PS_ROOT_DIR_)); if ($gz->createModify($items, null, _PS_ROOT_DIR_));
Tools::redirect('translations/export/'.$lang.'.gzip'); Tools::redirect('translations/export/'.$lang.'.gzip');
$this->_errors[] = Tools::displayError('An error occurred while creating archive.'); $this->_errors[] = Tools::displayError('An error occurred while creating archive.');
} }
$this->_errors[] = Tools::displayError('Please choose a language and theme.'); $this->_errors[] = Tools::displayError('Please choose a language and theme.');
} }
public function checkAndAddMailsFiles ($iso_code, $files_list) public function checkAndAddMailsFiles($iso_code, $files_list)
{ {
$mails = scandir(_PS_MAIL_DIR_.'en/'); $mails = scandir(_PS_MAIL_DIR_.'en/');
$mails_new_lang = array(); $mails_new_lang = array();
@@ -263,21 +269,19 @@ class AdminTranslationsControllerCore extends AdminController
if (preg_match('#^mails\/([a-z0-9]+)\/#Ui', $file['filename'], $matches)) if (preg_match('#^mails\/([a-z0-9]+)\/#Ui', $file['filename'], $matches))
{ {
$slash_pos = strrpos($file['filename'], '/'); $slash_pos = strrpos($file['filename'], '/');
$mails_new_lang[] = substr($file['filename'], -(strlen($file['filename'])-$slash_pos-1)); $mails_new_lang[] = substr($file['filename'], -(strlen($file['filename']) - $slash_pos - 1));
} }
} }
$arr_mails_needed = array_diff($mails, $mails_new_lang); $arr_mails_needed = array_diff($mails, $mails_new_lang);
foreach ($arr_mails_needed as $mail_to_add) foreach ($arr_mails_needed as $mail_to_add)
{ {
if ($mail_to_add !== '.' && $mail_to_add !== '..' && $mail_to_add !== '.svn') if ($mail_to_add !== '.' && $mail_to_add !== '..' && $mail_to_add !== '.svn')
{
@copy(_PS_MAIL_DIR_.'en/'.$mail_to_add, _PS_MAIL_DIR_.$iso_code.'/'.$mail_to_add); @copy(_PS_MAIL_DIR_.'en/'.$mail_to_add, _PS_MAIL_DIR_.$iso_code.'/'.$mail_to_add);
}
} }
} }
public function submitImportLang() public function submitImportLang()
{ {
if (!isset($_FILES['file']['tmp_name']) OR !$_FILES['file']['tmp_name']) if (!isset($_FILES['file']['tmp_name']) || !$_FILES['file']['tmp_name'])
$this->_errors[] = Tools::displayError('No file selected'); $this->_errors[] = Tools::displayError('No file selected');
else else
{ {
@@ -303,7 +307,9 @@ class AdminTranslationsControllerCore extends AdminController
$arr_import_lang = explode('|', Tools::getValue('params_import_language')); /* 0 = Language ISO code, 1 = PS version */ $arr_import_lang = explode('|', Tools::getValue('params_import_language')); /* 0 = Language ISO code, 1 = PS version */
if (Validate::isLangIsoCode($arr_import_lang[0])) if (Validate::isLangIsoCode($arr_import_lang[0]))
{ {
if ($content = Tools::file_get_contents('http://www.prestashop.com/download/lang_packs/gzip/'.$arr_import_lang[1].'/'.$arr_import_lang[0].'.gzip', false, @stream_context_create(array('http' => array('method' => 'GET', 'timeout' => 5))))) if ($content = Tools::file_get_contents(
'http://www.prestashop.com/download/lang_packs/gzip/'.$arr_import_lang[1].'/'.$arr_import_lang[0].'.gzip', false,
@stream_context_create(array('http' => array('method' => 'GET', 'timeout' => 5)))))
{ {
$file = _PS_TRANSLATIONS_DIR_.$arr_import_lang[0].'.gzip'; $file = _PS_TRANSLATIONS_DIR_.$arr_import_lang[0].'.gzip';
if (file_put_contents($file, $content)) if (file_put_contents($file, $content))
@@ -355,11 +361,11 @@ class AdminTranslationsControllerCore extends AdminController
$is_default = $theme_name === self::DEFAULT_THEME_NAME ? true : false; $is_default = $theme_name === self::DEFAULT_THEME_NAME ? true : false;
// Set file_name in static var, this allow to open and wright the file just one time // Set file_name in static var, this allow to open and wright the file just one time
if (!isset($_cache_file[($is_default ? self::DEFAULT_THEME_NAME : $theme_name).'-'.$file_name]) ) if (!isset($_cache_file[($is_default ? self::DEFAULT_THEME_NAME : $theme_name).'-'.$file_name]))
{ {
$str_write = ''; $str_write = '';
$_cache_file[($is_default ? self::DEFAULT_THEME_NAME : $theme_name).'-'.$file_name] = true; $_cache_file[($is_default ? self::DEFAULT_THEME_NAME : $theme_name).'-'.$file_name] = true;
if(!file_exists($file_name)) if (!file_exists($file_name))
file_put_contents($file_name, ''); file_put_contents($file_name, '');
if (!is_writable($file_name)) if (!is_writable($file_name))
die ($this->l('Cannot write the theme\'s language file ').'('.$file_name.')'.$this->l('. Please check write permissions.')); die ($this->l('Cannot write the theme\'s language file ').'('.$file_name.')'.$this->l('. Please check write permissions.'));
@@ -372,9 +378,9 @@ class AdminTranslationsControllerCore extends AdminController
if (!$dir) if (!$dir)
$dir = ($theme_name == self::DEFAULT_THEME_NAME ? _PS_MODULE_DIR_.$module_name.'/' : _PS_ALL_THEMES_DIR_.$theme_name.'/modules/'.$module_name.'/'); $dir = ($theme_name == self::DEFAULT_THEME_NAME ? _PS_MODULE_DIR_.$module_name.'/' : _PS_ALL_THEMES_DIR_.$theme_name.'/modules/'.$module_name.'/');
foreach ($files AS $template_file) foreach ($files as $template_file)
{ {
if ((preg_match('/^(.*).tpl$/', $template_file) OR ($is_default AND preg_match('/^(.*).php$/', $template_file))) AND file_exists($tpl = $dir.$template_file)) if ((preg_match('/^(.*).tpl$/', $template_file) || ($is_default && preg_match('/^(.*).php$/', $template_file))) && file_exists($tpl = $dir.$template_file))
{ {
// Get translations key // Get translations key
$content = file_get_contents($tpl); $content = file_get_contents($tpl);
@@ -383,11 +389,11 @@ class AdminTranslationsControllerCore extends AdminController
// Write each translation on its module file // Write each translation on its module file
$template_name = substr(basename($template_file), 0, -4); $template_name = substr(basename($template_file), 0, -4);
foreach ($matches[1] AS $key) foreach ($matches[1] as $key)
{ {
$post_key = md5(strtolower($module_name).'_'.($is_default ? self::DEFAULT_THEME_NAME : strtolower($theme_name)).'_'.strtolower($template_name).'_'.md5($key)); $post_key = md5(strtolower($module_name).'_'.($is_default ? self::DEFAULT_THEME_NAME : strtolower($theme_name)).'_'.strtolower($template_name).'_'.md5($key));
$pattern = '\'<{'.strtolower($module_name).'}'.($is_default ? 'prestashop' : strtolower($theme_name)).'>'.strtolower($template_name).'_'.md5($key).'\''; $pattern = '\'<{'.strtolower($module_name).'}'.($is_default ? 'prestashop' : strtolower($theme_name)).'>'.strtolower($template_name).'_'.md5($key).'\'';
if (array_key_exists($post_key, $_POST) AND !empty($_POST[$post_key]) AND !in_array($pattern, $array_check_duplicate)) if (array_key_exists($post_key, $_POST) && !empty($_POST[$post_key]) && !in_array($pattern, $array_check_duplicate))
{ {
$array_check_duplicate[] = $pattern; $array_check_duplicate[] = $pattern;
$str_write .= '$_MODULE['.$pattern.'] = \''.pSQL($_POST[$post_key]).'\';'."\n"; $str_write .= '$_MODULE['.$pattern.'] = \''.pSQL($_POST[$post_key]).'\';'."\n";
@@ -399,17 +405,17 @@ class AdminTranslationsControllerCore extends AdminController
if (isset($_cache_file[($is_default ? self::DEFAULT_THEME_NAME : $theme_name).'-'.$file_name]) AND $str_write != "<?php\n\nglobal \$_MODULE;\n\$_MODULE = array();\n") if (isset($_cache_file[($is_default ? self::DEFAULT_THEME_NAME : $theme_name).'-'.$file_name]) AND $str_write != "<?php\n\nglobal \$_MODULE;\n\$_MODULE = array();\n")
file_put_contents($file_name, $str_write); file_put_contents($file_name, $str_write);
} }
public function clearModuleFiles ($files, $type_clear = 'file', $path = '') public function clearModuleFiles($files, $type_clear = 'file', $path = '')
{ {
$arr_exclude = array('img', 'js', 'mails'); $arr_exclude = array('img', 'js', 'mails');
$arr_good_ext = array('.tpl', '.php'); $arr_good_ext = array('.tpl', '.php');
foreach ($files as $key=>$file) foreach ($files as $key => $file)
{ {
if ($file{0} === '.' OR in_array(substr($file, 0, strrpos($file,'.')), $this->all_iso_lang)) if ($file{0} === '.' || in_array(substr($file, 0, strrpos($file,'.')), $this->all_iso_lang))
unset($files[$key]); unset($files[$key]);
else if ($type_clear === 'file' AND !in_array(substr($file, strrpos($file,'.')),$arr_good_ext)) else if ($type_clear === 'file' && !in_array(substr($file, strrpos($file,'.')), $arr_good_ext))
unset($files[$key]); unset($files[$key]);
else if ($type_clear === 'directory' AND (!is_dir($path.$file) OR in_array($file, $arr_exclude))) else if ($type_clear === 'directory' && (!is_dir($path.$file) || in_array($file, $arr_exclude)))
unset($files[$key]); unset($files[$key]);
} }
@@ -443,9 +449,9 @@ class AdminTranslationsControllerCore extends AdminController
// in AndminTranslation::modules_translations array // in AndminTranslation::modules_translations array
// see below // see below
$array_check_duplicate = array(); $array_check_duplicate = array();
foreach ($files AS $template_file) foreach ($files as $template_file)
{ {
if ((preg_match('/^(.*).tpl$/', $template_file) OR ($is_default AND preg_match('/^(.*).php$/', $template_file))) AND file_exists($tpl = $dir.$template_file)) if ((preg_match('/^(.*).tpl$/', $template_file) || ($is_default && preg_match('/^(.*).php$/', $template_file))) && file_exists($tpl = $dir.$template_file))
{ {
$content = file_get_contents($tpl); $content = file_get_contents($tpl);
// module files can now be ignored by adding this string in a file // module files can now be ignored by adding this string in a file
@@ -457,7 +463,7 @@ class AdminTranslationsControllerCore extends AdminController
// Write each translation on its module file // Write each translation on its module file
$template_name = substr(basename($template_file), 0, -4); $template_name = substr(basename($template_file), 0, -4);
foreach ($matches[1] AS $key) foreach ($matches[1] as $key)
{ {
$module_key = ($is_default ? self::DEFAULT_THEME_NAME : '').'<{'.Tools::strtolower($module_name).'}'.strtolower($is_default ? 'prestashop' : $theme_name).'>'.Tools::strtolower($template_name).'_'.md5($key); $module_key = ($is_default ? self::DEFAULT_THEME_NAME : '').'<{'.Tools::strtolower($module_name).'}'.strtolower($is_default ? 'prestashop' : $theme_name).'>'.Tools::strtolower($template_name).'_'.md5($key);
// to avoid duplicate entry // to avoid duplicate entry
@@ -490,28 +496,28 @@ class AdminTranslationsControllerCore extends AdminController
else else
$this->_errors[] = Tools::displayError('You do not have permission to add here.'); $this->_errors[] = Tools::displayError('You do not have permission to add here.');
} }
elseif (Tools::isSubmit('submitExport')) else if (Tools::isSubmit('submitExport'))
{ {
if ($this->tabAccess['add'] === '1') if ($this->tabAccess['add'] === '1')
$this->submitExportLang(); $this->submitExportLang();
else else
$this->_errors[] = Tools::displayError('You do not have permission to add here.'); $this->_errors[] = Tools::displayError('You do not have permission to add here.');
} }
elseif (Tools::isSubmit('submitImport')) else if (Tools::isSubmit('submitImport'))
{ {
if ($this->tabAccess['add'] === '1') if ($this->tabAccess['add'] === '1')
$this->submitImportLang(); $this->submitImportLang();
else else
$this->_errors[] = Tools::displayError('You do not have permission to add here.'); $this->_errors[] = Tools::displayError('You do not have permission to add here.');
} }
elseif (Tools::isSubmit('submitAddLanguage')) else if (Tools::isSubmit('submitAddLanguage'))
{ {
if ($this->tabAccess['add'] === '1') if ($this->tabAccess['add'] === '1')
$this->submitAddLang(); $this->submitAddLang();
else else
$this->_errors[] = Tools::displayError('You do not have permission to add here.'); $this->_errors[] = Tools::displayError('You do not have permission to add here.');
} }
elseif (Tools::isSubmit('submitTranslationsFront')) else if (Tools::isSubmit('submitTranslationsFront'))
{ {
if ($this->tabAccess['edit'] === '1') if ($this->tabAccess['edit'] === '1')
{ {
@@ -522,7 +528,7 @@ class AdminTranslationsControllerCore extends AdminController
else else
$this->_errors[] = Tools::displayError('You do not have permission to edit here.'); $this->_errors[] = Tools::displayError('You do not have permission to edit here.');
} }
elseif (Tools::isSubmit('submitTranslationsPdf')) else if (Tools::isSubmit('submitTranslationsPdf'))
{ {
if ($this->tabAccess['edit'] === '1') if ($this->tabAccess['edit'] === '1')
{ {
@@ -533,7 +539,7 @@ class AdminTranslationsControllerCore extends AdminController
else else
$this->_errors[] = Tools::displayError('You do not have permission to edit here.'); $this->_errors[] = Tools::displayError('You do not have permission to edit here.');
} }
elseif (Tools::isSubmit('submitTranslationsBack')) else if (Tools::isSubmit('submitTranslationsBack'))
{ {
if ($this->tabAccess['edit'] === '1') if ($this->tabAccess['edit'] === '1')
{ {
@@ -544,7 +550,7 @@ class AdminTranslationsControllerCore extends AdminController
else else
$this->_errors[] = Tools::displayError('You do not have permission to edit here.'); $this->_errors[] = Tools::displayError('You do not have permission to edit here.');
} }
elseif (Tools::isSubmit('submitTranslationsErrors')) else if (Tools::isSubmit('submitTranslationsErrors'))
{ {
if ($this->tabAccess['edit'] === '1') if ($this->tabAccess['edit'] === '1')
{ {
@@ -555,7 +561,7 @@ class AdminTranslationsControllerCore extends AdminController
else else
$this->_errors[] = Tools::displayError('You do not have permission to edit here.'); $this->_errors[] = Tools::displayError('You do not have permission to edit here.');
} }
elseif (Tools::isSubmit('submitTranslationsFields')) else if (Tools::isSubmit('submitTranslationsFields'))
{ {
if ($this->tabAccess['edit'] === '1') if ($this->tabAccess['edit'] === '1')
{ {
@@ -567,7 +573,7 @@ class AdminTranslationsControllerCore extends AdminController
$this->_errors[] = Tools::displayError('You do not have permission to edit here.'); $this->_errors[] = Tools::displayError('You do not have permission to edit here.');
} }
elseif (Tools::isSubmit('submitTranslationsMails') || Tools::isSubmit('submitTranslationsMailsAndStay')) else if (Tools::isSubmit('submitTranslationsMails') || Tools::isSubmit('submitTranslationsMailsAndStay'))
{ {
if ($this->tabAccess['edit'] === '1' && ($id_lang = Language::getIdByIso(Tools::getValue('lang'))) > 0) if ($this->tabAccess['edit'] === '1' && ($id_lang = Language::getIdByIso(Tools::getValue('lang'))) > 0)
{ {
@@ -576,7 +582,7 @@ class AdminTranslationsControllerCore extends AdminController
else else
$this->_errors[] = Tools::displayError('You do not have permission to edit here.'); $this->_errors[] = Tools::displayError('You do not have permission to edit here.');
} }
elseif (Tools::isSubmit('submitTranslationsModules')) else if (Tools::isSubmit('submitTranslationsModules'))
{ {
if ($this->tabAccess['edit'] === '1') if ($this->tabAccess['edit'] === '1')
{ {
@@ -595,7 +601,7 @@ class AdminTranslationsControllerCore extends AdminController
$arr_files = $this->getAllModuleFiles($modules, _PS_MODULE_DIR_, $lang, true); $arr_files = $this->getAllModuleFiles($modules, _PS_MODULE_DIR_, $lang, true);
$arr_find_and_write = array_merge($arr_find_and_write, $arr_files); $arr_find_and_write = array_merge($arr_find_and_write, $arr_files);
if(file_exists(_PS_THEME_DIR_.'/modules/')) if (file_exists(_PS_THEME_DIR_.'/modules/'))
{ {
$modules = scandir(_PS_THEME_DIR_.'/modules/'); $modules = scandir(_PS_THEME_DIR_.'/modules/');
$arr_files = $this->getAllModuleFiles($modules, _PS_THEME_DIR_.'modules/', $lang); $arr_files = $this->getAllModuleFiles($modules, _PS_THEME_DIR_.'modules/', $lang);
@@ -717,12 +723,12 @@ class AdminTranslationsControllerCore extends AdminController
if (isset($arr_mail_path['theme_mail'])) if (isset($arr_mail_path['theme_mail']))
$array_subjects['themes_and_modules'] = array('translations'=>array(), 'path'=>$arr_mail_path['theme_mail'].'lang.php'); $array_subjects['themes_and_modules'] = array('translations'=>array(), 'path'=>$arr_mail_path['theme_mail'].'lang.php');
foreach ($subjects AS $group => $subject_translation) foreach ($subjects as $group => $subject_translation)
{ {
if ($group == 'core_mail' || $group == 'module_mail') { if ($group == 'core_mail' || $group == 'module_mail') {
$array_subjects['core_and_modules']['translations'] = array_merge($array_subjects['core_and_modules']['translations'], $subject_translation); $array_subjects['core_and_modules']['translations'] = array_merge($array_subjects['core_and_modules']['translations'], $subject_translation);
} }
elseif ( isset($array_subjects['themes_and_modules']) && ($group == 'theme_mail' || $group == 'theme_module_mail')) { else if ( isset($array_subjects['themes_and_modules']) && ($group == 'theme_mail' || $group == 'theme_module_mail')) {
$array_subjects['themes_and_modules']['translations'] = array_merge($array_subjects['themes_and_modules']['translations'], $subject_translation); $array_subjects['themes_and_modules']['translations'] = array_merge($array_subjects['themes_and_modules']['translations'], $subject_translation);
} }
} }
@@ -865,8 +871,8 @@ class AdminTranslationsControllerCore extends AdminController
/* List templates to parse */ /* List templates to parse */
$templates = array_merge(scandir(_PS_THEME_DIR_), scandir(_PS_ALL_THEMES_DIR_)); $templates = array_merge(scandir(_PS_THEME_DIR_), scandir(_PS_ALL_THEMES_DIR_));
$count = 0; $count = 0;
$tabsArray = array(); $tabs_array = array();
foreach ($templates AS $template) foreach ($templates as $template)
if (preg_match('/^(.*).tpl$/', $template) AND (file_exists($tpl = _PS_THEME_DIR_.$template) OR file_exists($tpl = _PS_ALL_THEMES_DIR_.$template))) if (preg_match('/^(.*).tpl$/', $template) AND (file_exists($tpl = _PS_THEME_DIR_.$template) OR file_exists($tpl = _PS_ALL_THEMES_DIR_.$template)))
{ {
$prefix_key = substr(basename($template), 0, -4); $prefix_key = substr(basename($template), 0, -4);
@@ -879,9 +885,9 @@ class AdminTranslationsControllerCore extends AdminController
preg_match_all($regex, $content, $matches); preg_match_all($regex, $content, $matches);
/* Get string translation */ /* Get string translation */
foreach($matches[1] AS $key) foreach ($matches[1] as $key)
{ {
if(empty($key)) if (empty($key))
{ {
$this->_errors[] = $this->l('Empty string found, please edit:').' <br />'._PS_THEME_DIR_.''.$template; $this->_errors[] = $this->l('Empty string found, please edit:').' <br />'._PS_THEME_DIR_.''.$template;
$newLang[$key] = ''; $newLang[$key] = '';
@@ -902,12 +908,11 @@ class AdminTranslationsControllerCore extends AdminController
} }
} }
} }
$tabsArray[$prefix_key] = $newLang; $tabs_array[$prefix_key] = $newLang;
$count += sizeof($newLang); $count += count($newLang);
} }
$tpl = $this->context->smarty->createTemplate('translations/translation_form.tpl'); $this->tpl_view_vars = array(
$tpl->assign(array(
'lang' => Tools::strtoupper($lang), 'lang' => Tools::strtoupper($lang),
'translation_type' => $this->l('Front-Office translations'), 'translation_type' => $this->l('Front-Office translations'),
'missing_translations' => $missing_translations, 'missing_translations' => $missing_translations,
@@ -917,11 +922,13 @@ class AdminTranslationsControllerCore extends AdminController
'url_submit' => self::$currentIndex.'&submitTranslationsBack=1&token='.$this->token, 'url_submit' => self::$currentIndex.'&submitTranslationsBack=1&token='.$this->token,
'toggle_button' => $this->displayToggleButton(), 'toggle_button' => $this->displayToggleButton(),
'auto_translate' => $this->displayAutoTranslate(), 'auto_translate' => $this->displayAutoTranslate(),
'tabsArray' => $tabsArray, 'tabsArray' => $tabs_array,
'textarea_sized' => TEXTAREA_SIZED, 'textarea_sized' => TEXTAREA_SIZED,
'type' => 'front' 'type' => 'front'
)); );
return $tpl->fetch();
$this->initToolbar();
return parent::initView('translation_form.tpl');
} }
public function initFormBack($lang) public function initFormBack($lang)
@@ -936,38 +943,38 @@ class AdminTranslationsControllerCore extends AdminController
$tabs[] = '../../classes/AdminController.php'; $tabs[] = '../../classes/AdminController.php';
$files = array(); $files = array();
$i=0; $i=0;
foreach ($tabs AS $tab) foreach ($tabs as $tab)
if (preg_match('/^(.*)\.php$/', $tab) AND file_exists($tpl = _PS_ADMIN_CONTROLLER_DIR_.$tab)) if (preg_match('/^(.*)\.php$/', $tab) AND file_exists($tpl = _PS_ADMIN_CONTROLLER_DIR_.$tab))
{ {
// -4 becomes -14 to remove the ending "Controller.php" from the filename // -4 becomes -14 to remove the ending "Controller.php" from the filename
$prefix_key = basename(substr($tab, 0, -14)); $prefix_key = basename(substr($tab, 0, -14));
// @todo this is retrcompatible, but we should not leave this // @todo this is retrcompatible, but we should not leave this
if( $prefix_key == 'Admin') if ( $prefix_key == 'Admin')
$prefix_key = 'AdminTab'; $prefix_key = 'AdminTab';
$fd = fopen($tpl, 'r'); $fd = fopen($tpl, 'r');
$content = fread($fd, filesize($tpl)); $content = fread($fd, filesize($tpl));
fclose($fd); fclose($fd);
$regex = '/this->l\(\''._PS_TRANS_PATTERN_.'\'[\)|\,]/U'; $regex = '/this->l\(\''._PS_TRANS_PATTERN_.'\'[\)|\,]/U';
preg_match_all($regex, $content, $matches); preg_match_all($regex, $content, $matches);
foreach ($matches[1] AS $key) foreach ($matches[1] as $key)
{ {
// Caution ! front has underscore between prefix key and md5, back has not // Caution ! front has underscore between prefix key and md5, back has not
if (isset($_LANGADM[$prefix_key.md5($key)])) if (isset($_LANGADM[$prefix_key.md5($key)]))
$tabsArray[$prefix_key][$key] = stripslashes(html_entity_decode($_LANGADM[$prefix_key.md5($key)], ENT_COMPAT, 'UTF-8')); $tabs_array[$prefix_key][$key] = stripslashes(html_entity_decode($_LANGADM[$prefix_key.md5($key)], ENT_COMPAT, 'UTF-8'));
else else
{ {
$tabsArray[$prefix_key][$key] = ''; $tabs_array[$prefix_key][$key] = '';
if (!isset($missing_translations[$prefix_key])) if (!isset($missing_translations[$prefix_key]))
$missing_translations[$prefix_key] = 1; $missing_translations[$prefix_key] = 1;
else else
$missing_translations[$prefix_key]++; $missing_translations[$prefix_key]++;
} }
} }
$count += isset($tabsArray[$prefix_key]) ? sizeof($tabsArray[$prefix_key]) : 0; $count += isset($tabs_array[$prefix_key]) ? count($tabs_array[$prefix_key]) : 0;
} }
foreach (array('header.inc', 'footer.inc', 'index', 'login', 'password', 'functions') AS $tab) foreach (array('header.inc', 'footer.inc', 'index', 'login', 'password', 'functions') as $tab)
{ {
$prefix_key = 'index'; $prefix_key = 'index';
$tab = _PS_ADMIN_DIR_.'/'.$tab.'.php'; $tab = _PS_ADMIN_DIR_.'/'.$tab.'.php';
@@ -976,26 +983,26 @@ class AdminTranslationsControllerCore extends AdminController
fclose($fd); fclose($fd);
$regex = '/translate\(\''._PS_TRANS_PATTERN_.'\'\)/U'; $regex = '/translate\(\''._PS_TRANS_PATTERN_.'\'\)/U';
preg_match_all($regex, $content, $matches); preg_match_all($regex, $content, $matches);
foreach ($matches[1] AS $key) foreach ($matches[1] as $key)
{ {
// Caution ! front has underscore between prefix key and md5, back has not // Caution ! front has underscore between prefix key and md5, back has not
if (isset($_LANGADM[$prefix_key.md5($key)])) if (isset($_LANGADM[$prefix_key.md5($key)]))
$tabsArray[$prefix_key][$key] = stripslashes(html_entity_decode($_LANGADM[$prefix_key.md5($key)], ENT_COMPAT, 'UTF-8')); $tabs_array[$prefix_key][$key] = stripslashes(html_entity_decode($_LANGADM[$prefix_key.md5($key)], ENT_COMPAT, 'UTF-8'));
else else
{ {
$tabsArray[$prefix_key][$key] = ''; $tabs_array[$prefix_key][$key] = '';
if (!isset($missing_translations[$prefix_key])) if (!isset($missing_translations[$prefix_key]))
$missing_translations[$prefix_key] = 1; $missing_translations[$prefix_key] = 1;
else else
$missing_translations[$prefix_key]++; $missing_translations[$prefix_key]++;
} }
} }
$count += isset($tabsArray['index']) ? sizeof($tabsArray['index']) : 0; $count += isset($tabs_array['index']) ? count($tabs_array['index']) : 0;
} }
/* List templates to parse */ /* List templates to parse */
$templates = $this->listFiles(_PS_ADMIN_DIR_.DIRECTORY_SEPARATOR.'themes'.DIRECTORY_SEPARATOR.'template'); $templates = $this->listFiles(_PS_ADMIN_DIR_.DIRECTORY_SEPARATOR.'themes'.DIRECTORY_SEPARATOR.'template');
foreach ($templates AS $template) foreach ($templates as $template)
if (preg_match('/^(.*).tpl$/', $template)) if (preg_match('/^(.*).tpl$/', $template))
{ {
//$tpl = _PS_ADMIN_DIR_.'/themes/template/'.$template; //$tpl = _PS_ADMIN_DIR_.'/themes/template/'.$template;
@@ -1007,7 +1014,7 @@ class AdminTranslationsControllerCore extends AdminController
// @todo retrompatibility : we assume here than files directly in template/ // @todo retrompatibility : we assume here than files directly in template/
// use the prefix "AdminTab (like old php files 'header', 'footer.inc', 'index', 'login', 'password', 'functions' // use the prefix "AdminTab (like old php files 'header', 'footer.inc', 'index', 'login', 'password', 'functions'
if( $prefix_key == 'Admin') if ( $prefix_key == 'Admin')
$prefix_key = 'AdminTab'; $prefix_key = 'AdminTab';
// and helpers in helper // and helpers in helper
@@ -1020,9 +1027,9 @@ class AdminTranslationsControllerCore extends AdminController
preg_match_all($regex, $content, $matches); preg_match_all($regex, $content, $matches);
/* Get string translation for each tpl file */ /* Get string translation for each tpl file */
foreach($matches[1] AS $english_string) foreach ($matches[1] as $english_string)
{ {
if(empty($english_string)) if (empty($english_string))
{ {
$this->_errors[] = $this->l('Error in template - Empty string found, please edit:').' <br />'.$tpl; $this->_errors[] = $this->l('Error in template - Empty string found, please edit:').' <br />'.$tpl;
$newLang[$english_string] = ''; $newLang[$english_string] = '';
@@ -1038,24 +1045,23 @@ class AdminTranslationsControllerCore extends AdminController
else else
{ {
$newLang[$english_string] = ''; $newLang[$english_string] = '';
if(!isset($missing_translations[$prefix_key])) if (!isset($missing_translations[$prefix_key]))
$missing_translations[$prefix_key] = 1; $missing_translations[$prefix_key] = 1;
else else
$missing_translations[$prefix_key]++; $missing_translations[$prefix_key]++;
} }
} }
} }
if( isset($tabsArray[$prefix_key])) if ( isset($tabs_array[$prefix_key]))
$tabsArray[$prefix_key] = array_merge($tabsArray[$prefix_key], $newLang); $tabs_array[$prefix_key] = array_merge($tabs_array[$prefix_key], $newLang);
else else
$tabsArray[$prefix_key] = $newLang; $tabs_array[$prefix_key] = $newLang;
$count += sizeof($newLang); $count += count($newLang);
} }
// with php then tpl files, order can be a mess // with php then tpl files, order can be a mess
asort($tabsArray); asort($tabs_array);
// @todo : something to make differences between .php and .tpl
$tpl = $this->context->smarty->createTemplate('translations/translation_form.tpl'); $this->tpl_view_vars = array(
$tpl->assign(array(
'lang' => Tools::strtoupper($lang), 'lang' => Tools::strtoupper($lang),
'translation_type' => $this->l('Back-Office translations'), 'translation_type' => $this->l('Back-Office translations'),
'count' => $count, 'count' => $count,
@@ -1064,12 +1070,14 @@ class AdminTranslationsControllerCore extends AdminController
'url_submit' => self::$currentIndex.'&submitTranslationsBack=1&token='.$this->token, 'url_submit' => self::$currentIndex.'&submitTranslationsBack=1&token='.$this->token,
'toggle_button' => $this->displayToggleButton(), 'toggle_button' => $this->displayToggleButton(),
'auto_translate' => $this->displayAutoTranslate(), 'auto_translate' => $this->displayAutoTranslate(),
'tabsArray' => $tabsArray, 'tabsArray' => $tabs_array,
'missing_translations' => $missing_translations, 'missing_translations' => $missing_translations,
'textarea_sized' => TEXTAREA_SIZED, 'textarea_sized' => TEXTAREA_SIZED,
'type' => 'back' 'type' => 'back'
)); );
return $tpl->fetch();
$this->initToolbar();
return parent::initView('translation_form.tpl');
} }
public function initFormErrors($lang) public function initFormErrors($lang)
@@ -1095,24 +1103,23 @@ class AdminTranslationsControllerCore extends AdminController
{ {
$count = 0; $count = 0;
foreach ($modules AS $module) foreach ($modules as $module)
if (is_dir(_PS_MODULE_DIR_.$module) && $module != '.' && $module != '..' && $module != '.svn' ) if (is_dir(_PS_MODULE_DIR_.$module) && $module != '.' && $module != '..' && $module != '.svn' )
$dirToParse[] = _PS_MODULE_DIR_.$module.'/'; $dirToParse[] = _PS_MODULE_DIR_.$module.'/';
} }
foreach ($dirToParse AS $dir) foreach ($dirToParse as $dir)
foreach (scandir($dir) AS $file) foreach (scandir($dir) as $file)
if (preg_match('/\.php$/', $file) AND file_exists($fn = $dir.$file) AND $file != 'index.php') if (preg_match('/\.php$/', $file) AND file_exists($fn = $dir.$file) AND $file != 'index.php')
{ {
if (!filesize($fn)) if (!filesize($fn))
continue; continue;
preg_match_all('/Tools::displayError\(\''._PS_TRANS_PATTERN_.'\'(, (true|false))?\)/U', fread(fopen($fn, 'r'), filesize($fn)), $matches); preg_match_all('/Tools::displayError\(\''._PS_TRANS_PATTERN_.'\'(, (true|false))?\)/U', fread(fopen($fn, 'r'), filesize($fn)), $matches);
foreach($matches[1] AS $key) foreach ($matches[1] as $key)
$stringToTranslate[$key] = (key_exists(md5($key), $_ERRORS)) ? html_entity_decode($_ERRORS[md5($key)], ENT_COMPAT, 'UTF-8') : ''; $stringToTranslate[$key] = (key_exists(md5($key), $_ERRORS)) ? html_entity_decode($_ERRORS[md5($key)], ENT_COMPAT, 'UTF-8') : '';
} }
$irow = 0; $irow = 0;
$tpl = $this->context->smarty->createTemplate('translations/translation_errors.tpl'); $this->tpl_view_vars = array(
$tpl->assign(array(
'lang' => Tools::strtoupper($lang), 'lang' => Tools::strtoupper($lang),
'translation_type' => $this->l('Error translations'), 'translation_type' => $this->l('Error translations'),
'count' => count($stringToTranslate), 'count' => count($stringToTranslate),
@@ -1121,9 +1128,11 @@ class AdminTranslationsControllerCore extends AdminController
'url_submit' => self::$currentIndex.'&submitTranslationsErrors=1&token='.$this->token, 'url_submit' => self::$currentIndex.'&submitTranslationsErrors=1&token='.$this->token,
'auto_translate' => $this->displayAutoTranslate(), 'auto_translate' => $this->displayAutoTranslate(),
'type' => 'errors', 'type' => 'errors',
'errorsArray' => $stringToTranslate, 'errorsArray' => $stringToTranslate
)); );
return $tpl->fetch();
$this->initToolbar();
return parent::initView('translation_errors.tpl');
} }
public function initFormFields($lang) public function initFormFields($lang)
@@ -1132,9 +1141,9 @@ class AdminTranslationsControllerCore extends AdminController
$missing_translations = array(); $missing_translations = array();
$str_output = ''; $str_output = '';
$classArray = array(); $classArray = array();
$tabsArray = array(); $tabs_array = array();
$count = 0; $count = 0;
foreach (scandir(_PS_CLASS_DIR_) AS $classFile) foreach (scandir(_PS_CLASS_DIR_) as $classFile)
{ {
if (!preg_match('/\.php$/', $classFile) OR $classFile == 'index.php') if (!preg_match('/\.php$/', $classFile) OR $classFile == 'index.php')
continue; continue;
@@ -1146,33 +1155,32 @@ class AdminTranslationsControllerCore extends AdminController
continue; continue;
$classArray[$prefix_key] = call_user_func(array($prefix_key, 'getValidationRules'), $prefix_key); $classArray[$prefix_key] = call_user_func(array($prefix_key, 'getValidationRules'), $prefix_key);
foreach ($classArray AS $prefix_key => $rules) foreach ($classArray as $prefix_key => $rules)
{ {
if (isset($rules['validate'])) if (isset($rules['validate']))
foreach ($rules['validate'] AS $key => $value) foreach ($rules['validate'] as $key => $value)
if (isset($_FIELDS[$prefix_key.'_'.md5($key)])) if (isset($_FIELDS[$prefix_key.'_'.md5($key)]))
// @todo check key : md5($key) was initially md5(addslashes($key)) // @todo check key : md5($key) was initially md5(addslashes($key))
$tabsArray[$prefix_key][$key] = html_entity_decode($_FIELDS[$prefix_key.'_'.md5($key)], ENT_COMPAT, 'UTF-8'); $tabs_array[$prefix_key][$key] = html_entity_decode($_FIELDS[$prefix_key.'_'.md5($key)], ENT_COMPAT, 'UTF-8');
else else
{ {
$tabsArray[$prefix_key][$key] = ''; $tabs_array[$prefix_key][$key] = '';
if (!isset($missing_translations[$prefix_key])) if (!isset($missing_translations[$prefix_key]))
$missing_translations[$prefix_key] = 1; $missing_translations[$prefix_key] = 1;
else else
$missing_translations[$prefix_key]++; $missing_translations[$prefix_key]++;
} }
if (isset($rules['validateLang'])) if (isset($rules['validateLang']))
foreach ($rules['validateLang'] AS $key => $value) foreach ($rules['validateLang'] as $key => $value)
$tabsArray[$prefix_key][$key] = array_key_exists($prefix_key.'_'.md5(addslashes($key)), $_FIELDS) ? html_entity_decode($_FIELDS[$prefix_key.'_'.md5(addslashes($key))], ENT_COMPAT, 'UTF-8') : ''; $tabs_array[$prefix_key][$key] = array_key_exists($prefix_key.'_'.md5(addslashes($key)), $_FIELDS) ? html_entity_decode($_FIELDS[$prefix_key.'_'.md5(addslashes($key))], ENT_COMPAT, 'UTF-8') : '';
} }
if (isset($classArray[$prefix_key]['validate'])) if (isset($classArray[$prefix_key]['validate']))
$count += sizeof($classArray[$prefix_key]['validate']); $count += count($classArray[$prefix_key]['validate']);
if (isset($classArray[$prefix_key]['validateLang'])) if (isset($classArray[$prefix_key]['validateLang']))
$count += sizeof($classArray[$prefix_key]['validateLang']); $count += count($classArray[$prefix_key]['validateLang']);
} }
$tpl = $this->context->smarty->createTemplate('translations/translation_form.tpl'); $this->tpl_view_vars = array(
$tpl->assign(array(
'lang' => Tools::strtoupper($lang), 'lang' => Tools::strtoupper($lang),
'translation_type' => $this->l('Field name translations'), 'translation_type' => $this->l('Field name translations'),
'count' => $count, 'count' => $count,
@@ -1181,12 +1189,14 @@ class AdminTranslationsControllerCore extends AdminController
'url_submit' => self::$currentIndex.'&submitTranslationsFields=1&token='.$this->token, 'url_submit' => self::$currentIndex.'&submitTranslationsFields=1&token='.$this->token,
'toggle_button' => $this->displayToggleButton(), 'toggle_button' => $this->displayToggleButton(),
'auto_translate' => $this->displayAutoTranslate(), 'auto_translate' => $this->displayAutoTranslate(),
'tabsArray' => $tabsArray, 'tabsArray' => $tabs_array,
'missing_translations' => $missing_translations, 'missing_translations' => $missing_translations,
'textarea_sized' => TEXTAREA_SIZED, 'textarea_sized' => TEXTAREA_SIZED,
'type' => 'fields' 'type' => 'fields'
)); );
return $tpl->fetch();
$this->initToolbar();
return parent::initView('translation_form.tpl');
} }
/** /**
@@ -1207,10 +1217,10 @@ class AdminTranslationsControllerCore extends AdminController
$arr_return['total_filled'] = 0; $arr_return['total_filled'] = 0;
$arr_return['directory'] = $dir; $arr_return['directory'] = $dir;
// $arr_return['subject'] = $this->getSubjectMailContent($dir.$lang); // $arr_return['subject'] = $this->getSubjectMailContent($dir.$lang);
if(file_exists($dir.'en')) if (file_exists($dir.'en'))
{ {
// Get all english files to compare with the language to translate // Get all english files to compare with the language to translate
foreach (scandir($dir.'en') AS $email_file) foreach (scandir($dir.'en') as $email_file)
{ {
if (strripos($email_file, '.html') > 0 || strripos($email_file, '.txt') > 0) if (strripos($email_file, '.html') > 0 || strripos($email_file, '.txt') > 0)
{ {
@@ -1285,7 +1295,7 @@ class AdminTranslationsControllerCore extends AdminController
<div name="mails_div" id="'.$id_html.'">'; <div name="mails_div" id="'.$id_html.'">';
if (!empty($mails['files'])) if (!empty($mails['files']))
{ {
foreach ($mails['files'] AS $mail_name => $mail_files) foreach ($mails['files'] as $mail_name => $mail_files)
{ {
if ((key_exists('html', $mail_files) OR key_exists('txt', $mail_files))) if ((key_exists('html', $mail_files) OR key_exists('txt', $mail_files)))
{ {
@@ -1417,7 +1427,7 @@ class AdminTranslationsControllerCore extends AdminController
public function getModulesHasMails() public function getModulesHasMails()
{ {
$arr_modules = array(); $arr_modules = array();
foreach (scandir(_PS_MODULE_DIR_) AS $module_dir) foreach (scandir(_PS_MODULE_DIR_) as $module_dir)
{ {
if ($module_dir[0] != '.' AND file_exists(_PS_MODULE_DIR_.$module_dir.'/mails')) if ($module_dir[0] != '.' AND file_exists(_PS_MODULE_DIR_.$module_dir.'/mails'))
{ {
@@ -1469,7 +1479,7 @@ class AdminTranslationsControllerCore extends AdminController
$core_mails = $this->getMailFiles(_PS_MAIL_DIR_, $lang, 'core_mail'); $core_mails = $this->getMailFiles(_PS_MAIL_DIR_, $lang, 'core_mail');
$core_mails['subject'] = $this->getSubjectMailContent(_PS_MAIL_DIR_.$lang); $core_mails['subject'] = $this->getSubjectMailContent(_PS_MAIL_DIR_.$lang);
foreach ($modules_has_mails AS $module_name=>$module_path) foreach ($modules_has_mails as $module_name=>$module_path)
{ {
$module_mails[$module_name] = $this->getMailFiles($module_path.'/mails/', $lang, 'module_mail'); $module_mails[$module_name] = $this->getMailFiles($module_path.'/mails/', $lang, 'module_mail');
$module_mails[$module_name]['subject'] = $core_mails['subject']; $module_mails[$module_name]['subject'] = $core_mails['subject'];
@@ -1479,16 +1489,16 @@ class AdminTranslationsControllerCore extends AdminController
// Before 1.4.0.14 each theme folder was parsed, // Before 1.4.0.14 each theme folder was parsed,
// This page was really to low to load. // This page was really to low to load.
// Now just use the current theme. // Now just use the current theme.
if(_THEME_NAME_ !== self::DEFAULT_THEME_NAME) if (_THEME_NAME_ !== self::DEFAULT_THEME_NAME)
{ {
if(file_exists(_PS_THEME_DIR_.'mails')) if (file_exists(_PS_THEME_DIR_.'mails'))
{ {
$theme_mails['theme_mail'] = $this->getMailFiles(_PS_THEME_DIR_.'mails/', $lang, 'theme_mail'); $theme_mails['theme_mail'] = $this->getMailFiles(_PS_THEME_DIR_.'mails/', $lang, 'theme_mail');
$theme_mails['theme_mail']['subject'] = $this->getSubjectMailContent(_PS_THEME_DIR_.'mails/'.$lang); $theme_mails['theme_mail']['subject'] = $this->getSubjectMailContent(_PS_THEME_DIR_.'mails/'.$lang);
} }
if (file_exists(_PS_THEME_DIR_.'/modules')) if (file_exists(_PS_THEME_DIR_.'/modules'))
{ {
foreach (scandir(_PS_THEME_DIR_.'/modules') AS $module_dir) foreach (scandir(_PS_THEME_DIR_.'/modules') as $module_dir)
{ {
if ($module_dir[0] != '.' AND file_exists(_PS_THEME_DIR_.'modules/'.$module_dir.'/mails')) if ($module_dir[0] != '.' AND file_exists(_PS_THEME_DIR_.'modules/'.$module_dir.'/mails'))
{ {
@@ -1520,8 +1530,7 @@ class AdminTranslationsControllerCore extends AdminController
return array('total' => $total, 'empty' => $empty); return array('total' => $total, 'empty' => $empty);
} }
$tpl = $this->context->smarty->createTemplate('translations/translation_mails.tpl'); $this->tpl_view_vars = array(
$tpl->assign(array(
'lang' => Tools::strtoupper($lang), 'lang' => Tools::strtoupper($lang),
'translation_type' => $this->l('E-mail template translations'), 'translation_type' => $this->l('E-mail template translations'),
'suoshin_exceeded' => $this->suhosin_limit_exceed, 'suoshin_exceeded' => $this->suhosin_limit_exceed,
@@ -1533,14 +1542,15 @@ class AdminTranslationsControllerCore extends AdminController
'mail_content' => $this->displayMailContent($core_mails, $subject_mail, $obj_lang, 'core', $this->l('Core e-mails')), 'mail_content' => $this->displayMailContent($core_mails, $subject_mail, $obj_lang, 'core', $this->l('Core e-mails')),
'module_mails' => $module_mails, 'module_mails' => $module_mails,
'theme_mails' => $theme_mails 'theme_mails' => $theme_mails
)); );
return $tpl->fetch();
//<input type="hidden" name="type" value="'.Tools::getValue('type').'" />'; $this->initToolbar();
return parent::initView('translation_mails.tpl');
} }
protected static function getSubjectMail($directory, $subject_mail) protected static function getSubjectMail($directory, $subject_mail)
{ {
foreach (scandir($directory) AS $filename) foreach (scandir($directory) as $filename)
{ {
if (strripos($filename, '.php') > 0 AND $filename != 'AdminTranslations.php') if (strripos($filename, '.php') > 0 AND $filename != 'AdminTranslations.php')
{ {
@@ -1572,15 +1582,15 @@ class AdminTranslationsControllerCore extends AdminController
protected function getSubjectMailContent($directory) protected function getSubjectMailContent($directory)
{ {
$subject_mail_content = array(); $subject_mail_content = array();
if (Tools::file_exists_cache($directory.'/lang.php')) if (Tools::file_exists_cache($directory.'/lang.php'))
{ {
// we need to include this even if already included // we need to include this even if already included
include($directory.'/lang.php'); include($directory.'/lang.php');
foreach($_LANGMAIL as $key => $subject) foreach ($_LANGMAIL as $key => $subject)
{ {
$subject = str_replace("\n", " ", $subject); $subject = str_replace('\n', ' ', $subject);
$subject = str_replace("\\'", "\'", $subject); $subject = str_replace("\\'", "\'", $subject);
$subject_mail_content[$key] = htmlentities($subject,ENT_QUOTES,'UTF-8'); $subject_mail_content[$key] = htmlentities($subject,ENT_QUOTES,'UTF-8');
@@ -1599,7 +1609,7 @@ class AdminTranslationsControllerCore extends AdminController
$tab = 'LANGMAIL'; $tab = 'LANGMAIL';
fwrite($fd, "<?php\n\nglobal \$_".$tab.";\n\$_".$tab." = array();\n"); fwrite($fd, "<?php\n\nglobal \$_".$tab.";\n\$_".$tab." = array();\n");
foreach($sub AS $key => $value) foreach ($sub as $key => $value)
{ {
// Magic Quotes shall... not.. PASS! // Magic Quotes shall... not.. PASS!
if (_PS_MAGIC_QUOTES_GPC_) if (_PS_MAGIC_QUOTES_GPC_)
@@ -1640,9 +1650,9 @@ class AdminTranslationsControllerCore extends AdminController
'theme' => ($is_default ? self::DEFAULT_THEME_NAME : _THEME_NAME_ ), 'theme' => ($is_default ? self::DEFAULT_THEME_NAME : _THEME_NAME_ ),
); );
$dir_module = $this->clearModuleFiles($files_module, 'directory', $path); $dir_module = $this->clearModuleFiles($files_module, 'directory', $path);
if(!empty($dir_module)) if (!empty($dir_module))
{ {
foreach ($dir_module AS $folder) foreach ($dir_module as $folder)
{ {
$this->recursiveGetModuleFiles($path.$folder.'/', $array_files, $module_name, $lang_file, $is_default); $this->recursiveGetModuleFiles($path.$folder.'/', $array_files, $module_name, $lang_file, $is_default);
} }
@@ -1662,7 +1672,7 @@ class AdminTranslationsControllerCore extends AdminController
protected function getAllModuleFiles($modules, $root_dir, $lang, $is_default = false) protected function getAllModuleFiles($modules, $root_dir, $lang, $is_default = false)
{ {
$array_files = array(); $array_files = array();
foreach ($modules AS $module) foreach ($modules as $module)
{ {
if ($module{0} != '.' AND is_dir($root_dir.$module)) if ($module{0} != '.' AND is_dir($root_dir.$module))
{ {
@@ -1696,7 +1706,7 @@ class AdminTranslationsControllerCore extends AdminController
$arr_files = $this->getAllModuleFiles($modules, _PS_MODULE_DIR_, $lang, true); $arr_files = $this->getAllModuleFiles($modules, _PS_MODULE_DIR_, $lang, true);
$arr_find_and_fill = array_merge($arr_find_and_fill, $arr_files); $arr_find_and_fill = array_merge($arr_find_and_fill, $arr_files);
if(file_exists(_PS_THEME_DIR_.'/modules/')) if (file_exists(_PS_THEME_DIR_.'/modules/'))
{ {
$modules = scandir(_PS_THEME_DIR_.'/modules/'); $modules = scandir(_PS_THEME_DIR_.'/modules/');
$arr_files = $this->getAllModuleFiles($modules, _PS_THEME_DIR_.'modules/', $lang); $arr_files = $this->getAllModuleFiles($modules, _PS_THEME_DIR_.'modules/', $lang);
@@ -1705,8 +1715,7 @@ class AdminTranslationsControllerCore extends AdminController
foreach ($arr_find_and_fill as $value) foreach ($arr_find_and_fill as $value)
$this->findAndFillTranslations($value['files'], $value['theme'], $value['module'], $value['dir'], $lang); $this->findAndFillTranslations($value['files'], $value['theme'], $value['module'], $value['dir'], $lang);
$tpl = $this->context->smarty->createTemplate('translations/translation_modules.tpl'); $this->tpl_view_vars = array(
$tpl->assign(array(
'default_theme_name' => self::DEFAULT_THEME_NAME, 'default_theme_name' => self::DEFAULT_THEME_NAME,
'lang' => Tools::strtoupper($lang), 'lang' => Tools::strtoupper($lang),
'translation_type' => $this->l('Modules translations'), 'translation_type' => $this->l('Modules translations'),
@@ -1718,9 +1727,11 @@ class AdminTranslationsControllerCore extends AdminController
'auto_translate' => $this->displayAutoTranslate(), 'auto_translate' => $this->displayAutoTranslate(),
'textarea_sized' => TEXTAREA_SIZED, 'textarea_sized' => TEXTAREA_SIZED,
'type' => 'modules', 'type' => 'modules',
'modules_translations' => isset($this->modules_translations) ? $this->modules_translations : array(), 'modules_translations' => isset($this->modules_translations) ? $this->modules_translations : array()
)); );
return $tpl->fetch();
$this->initToolbar();
return parent::initView('translation_modules.tpl');
} }
} }
@@ -1730,17 +1741,17 @@ class AdminTranslationsControllerCore extends AdminController
* @param string $regex regexp to use * @param string $regex regexp to use
* @param array $langArray contains expression in the chosen language * @param array $langArray contains expression in the chosen language
* @param string $tab name to use with the md5 key * @param string $tab name to use with the md5 key
* @param array $tabsArray * @param array $tabs_array
* @return array containing all datas needed for building the translation form * @return array containing all datas needed for building the translation form
* @since 1.4.5.0 * @since 1.4.5.0
*/ */
private function _parsePdfClass($filepath, $regex, $langArray, $tab, $tabsArray) private function _parsePdfClass($filepath, $regex, $langArray, $tab, $tabs_array)
{ {
$content = file_get_contents($filepath); $content = file_get_contents($filepath);
preg_match_all($regex, $content, $matches); preg_match_all($regex, $content, $matches);
foreach ($matches[1] as $key) foreach ($matches[1] as $key)
$tabsArray[$tab][$key] = stripslashes(key_exists($tab.md5(addslashes($key)), $langArray) ? html_entity_decode($langArray[$tab.md5(addslashes($key))], ENT_COMPAT, 'UTF-8') : ''); $tabs_array[$tab][$key] = stripslashes(key_exists($tab.md5(addslashes($key)), $langArray) ? html_entity_decode($langArray[$tab.md5(addslashes($key))], ENT_COMPAT, 'UTF-8') : '');
return $tabsArray; return $tabs_array;
} }
public function initFormPDF() public function initFormPDF()
@@ -1767,15 +1778,15 @@ class AdminTranslationsControllerCore extends AdminController
$files = array(); $files = array();
$count = 0; $count = 0;
$prefix_key = 'PDF'; $prefix_key = 'PDF';
$tabsArray = array($prefix_key=>array()); $tabs_array = array($prefix_key=>array());
$regex = '/self::l\(\''._PS_TRANS_PATTERN_.'\'[\)|\,]/U'; $regex = '/self::l\(\''._PS_TRANS_PATTERN_.'\'[\)|\,]/U';
// need to parse PDF.php in order to find $regex and add this to $tabsArray // need to parse PDF.php in order to find $regex and add this to $tabs_array
// this has to be done for the core class, and eventually for the override // this has to be done for the core class, and eventually for the override
foreach (glob(_PS_CLASS_DIR_.'pdf/'."*.php") as $filename) foreach (glob(_PS_CLASS_DIR_.'pdf/'."*.php") as $filename)
{ {
$tabsArray = $this->_parsePdfClass($filename, $regex, $_LANGPDF, $prefix_key, $tabsArray); $tabs_array = $this->_parsePdfClass($filename, $regex, $_LANGPDF, $prefix_key, $tabs_array);
if (file_exists(_PS_ROOT_DIR_.'/override/classes/pdf/'.basename($filename))) if (file_exists(_PS_ROOT_DIR_.'/override/classes/pdf/'.basename($filename)))
$tabsArray = $this->_parsePdfClass(_PS_ROOT_DIR_.'/override/classes/pdf/'.basename($filename), $regex, $_LANGPDF, $prefix_key, $tabsArray); $tabs_array = $this->_parsePdfClass(_PS_ROOT_DIR_.'/override/classes/pdf/'.basename($filename), $regex, $_LANGPDF, $prefix_key, $tabs_array);
} }
// parse pdf template // parse pdf template
@@ -1789,10 +1800,10 @@ class AdminTranslationsControllerCore extends AdminController
// Caution ! front has underscore between prefix key and md5, back has not // Caution ! front has underscore between prefix key and md5, back has not
if (isset($_LANGPDF[$prefix_key.md5($key)])) if (isset($_LANGPDF[$prefix_key.md5($key)]))
// @todo check key : md5($key) was initially md5(addslashes($key)) // @todo check key : md5($key) was initially md5(addslashes($key))
$tabsArray[$prefix_key][$key] = (html_entity_decode($_LANGPDF[$prefix_key.md5($key)], ENT_COMPAT, 'UTF-8')); $tabs_array[$prefix_key][$key] = (html_entity_decode($_LANGPDF[$prefix_key.md5($key)], ENT_COMPAT, 'UTF-8'));
else else
{ {
$tabsArray[$prefix_key][$key] = ''; $tabs_array[$prefix_key][$key] = '';
if (!isset($missing_translations[$prefix_key])) if (!isset($missing_translations[$prefix_key]))
$missing_translations[$prefix_key] = 1; $missing_translations[$prefix_key] = 1;
else else
@@ -1801,10 +1812,9 @@ class AdminTranslationsControllerCore extends AdminController
} }
} }
$count += isset($tabsArray[$prefix_key]) ? sizeof($tabsArray[$prefix_key]) : 0; $count += isset($tabs_array[$prefix_key]) ? count($tabs_array[$prefix_key]) : 0;
$tpl = $this->context->smarty->createTemplate('translations/translation_form.tpl'); $this->tpl_view_vars = array(
$tpl->assign(array(
'lang' => Tools::strtoupper($lang), 'lang' => Tools::strtoupper($lang),
'translation_type' => $this->l('PDF translations'), 'translation_type' => $this->l('PDF translations'),
'count' => $count, 'count' => $count,
@@ -1815,10 +1825,12 @@ class AdminTranslationsControllerCore extends AdminController
'auto_translate' => $this->displayAutoTranslate(), 'auto_translate' => $this->displayAutoTranslate(),
'textarea_sized' => TEXTAREA_SIZED, 'textarea_sized' => TEXTAREA_SIZED,
'type' => 'pdf', 'type' => 'pdf',
'tabsArray' => $tabsArray, 'tabsArray' => $tabs_array,
'missing_translations' => $missing_translations, 'missing_translations' => $missing_translations
)); );
return $tpl->fetch();
$this->initToolbar();
return parent::initView('translation_form.tpl');
} }
/** /**
@@ -1842,15 +1854,15 @@ class AdminTranslationsControllerCore extends AdminController
{ {
$fileext = 'tpl'; $fileext = 'tpl';
$res = true; $res = true;
$dir = rtrim($dir,'/').DIRECTORY_SEPARATOR; $dir = rtrim($dir, '/').DIRECTORY_SEPARATOR;
$toParse = scandir($dir); $to_parse = scandir($dir);
// copied (and kind of) adapted from AdminImages.php // copied (and kind of) adapted from AdminImages.php
foreach ($toParse AS $file) foreach ($to_parse as $file)
{ {
if ($file!='.' AND $file != '..' AND $file != '.svn') if ($file != '.' && $file != '..' && $file != '.svn')
{ {
if (preg_match('#'.preg_quote($fileext,'#').'$#i',$file)) if (preg_match('#'.preg_quote($fileext, '#').'$#i', $file))
$list[] = $dir.$file; $list[] = $dir.$file;
else if (is_dir($dir.$file)) else if (is_dir($dir.$file))
$list = $this->listFiles($dir.$file, $list); $list = $this->listFiles($dir.$file, $list);
@@ -1858,5 +1870,5 @@ class AdminTranslationsControllerCore extends AdminController
} }
return $list; return $list;
} }
} }