mirror of
https://gitlab.easter-eggs.com/ee/ldapsaisie.git
synced 2024-11-18 00:09:06 +01:00
Add compatibility to Smarty 3
This commit is contained in:
parent
1477f1378b
commit
702d53839d
6 changed files with 21 additions and 21 deletions
|
@ -149,7 +149,19 @@ class LSsession {
|
|||
}
|
||||
}
|
||||
|
||||
$GLOBALS['Smarty'] -> register_function('getFData','smarty_getFData');
|
||||
if (method_exists($GLOBALS['Smarty'],'register_function')) {
|
||||
define('SMARTY3',False);
|
||||
$GLOBALS['Smarty'] -> register_function('getFData','smarty_getFData');
|
||||
$GLOBALS['Smarty'] -> register_function('tr','smarty_tr');
|
||||
}
|
||||
elseif (method_exists($GLOBALS['Smarty'],'registerPlugin')) {
|
||||
define('SMARTY3',True);
|
||||
$GLOBALS['Smarty'] -> registerPlugin("function","getFData", "smarty_getFData");
|
||||
$GLOBALS['Smarty'] -> registerPlugin("function","tr", "smarty_tr");
|
||||
}
|
||||
else {
|
||||
die("Smarty : Can't register getFData fonction");
|
||||
}
|
||||
|
||||
$GLOBALS['Smarty'] -> assign('LS_CSS_DIR',LS_CSS_DIR);
|
||||
$GLOBALS['Smarty'] -> assign('LS_IMAGES_DIR',LS_IMAGES_DIR);
|
||||
|
|
|
@ -456,21 +456,9 @@ function LSdebugDefined() {
|
|||
return _($msg);
|
||||
}
|
||||
|
||||
function tr($msg,$key=null) {
|
||||
if (is_array($msg)) {
|
||||
echo __($msg[$key]);
|
||||
}
|
||||
else {
|
||||
$val = $GLOBALS['Smarty']->get_template_vars($msg);
|
||||
if (!$val)
|
||||
$val=$msg;
|
||||
if (is_array($val)) {
|
||||
echo __($val[$key]);
|
||||
}
|
||||
else {
|
||||
echo __($val);
|
||||
}
|
||||
}
|
||||
function smarty_tr($params) {
|
||||
extract($params);
|
||||
echo __($msg);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<!-- Tabs - Start Title -->
|
||||
<ul class='LSform_layout'>
|
||||
{foreach from=$LSform_layout item=tab key=tab_key}
|
||||
<li class='LSform_layout' id='LSform_layout_btn_{$tab_key}'><a href="#{$tab_key}">{php}tr('tab','label'){/php}</a></li>
|
||||
<li class='LSform_layout' id='LSform_layout_btn_{$tab_key}'><a href="#{$tab_key}">{tr msg=$tab.label}</a></li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
<!-- Tabs - End Title -->
|
||||
|
@ -12,7 +12,7 @@
|
|||
<!-- Tabs - Start Content -->
|
||||
{foreach from=$LSform_layout item=tab key=tab_key}
|
||||
<a name='{$tab_key}'></a>
|
||||
<h2 class='LSform_layout'>{php}tr('tab','label'){/php}</h2>
|
||||
<h2 class='LSform_layout'>{tr msg=$tab.label}</h2>
|
||||
<div class='LSform LSform_layout' id='LSform_layout_div_{$tab_key}'>
|
||||
{if $LSformElement_image!='' && $tab.img==1}
|
||||
<div class='LSformElement_image{if $LSformElement_image_errors} LSformElement_image_errors{/if}'>
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<!-- Tabs - Start Title -->
|
||||
<ul class='LSform_layout'>
|
||||
{foreach from=$LSform_layout item=tab key=tab_key}
|
||||
<li class='LSform_layout' id='LSform_layout_btn_{$tab_key}'><a href="#{$tab_key}">{php}tr('tab','label'){/php}</a></li>
|
||||
<li class='LSform_layout' id='LSform_layout_btn_{$tab_key}'><a href="#{$tab_key}">{tr msg=$tab.label}</a></li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
<!-- Tabs - End Title -->
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
{/if}
|
||||
<ul class='menu'>
|
||||
{foreach from=$LSaccess item=label key=LSobject_type}
|
||||
<li class='menu'><a href='view.php?LSobject={$LSobject_type}' class='menu'>{php}tr('label'){/php}</a></li>
|
||||
<li class='menu'><a href='view.php?LSobject={$LSobject_type}' class='menu'>{tr msg=$label}</a></li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
</td>
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
<ul class='LSview-actions'>
|
||||
{foreach from=$LSview_actions item=item}
|
||||
{if is_array($item)}
|
||||
<li class='LSview-actions'><a href='{$item.url}' class='LSview-actions'><img src='{$LS_IMAGES_DIR}/{$item.action}.png' alt='{php}tr('label');{/php}' title='{php}tr('label');{/php}' /> {php}tr('item','label');{/php}</a></li>
|
||||
<li class='LSview-actions'><a href='{$item.url}' class='LSview-actions'><img src='{$LS_IMAGES_DIR}/{$item.action}.png' alt='{tr msg=$label}' title='{tr msg=$label}' /> {tr msg=$item.label}</a></li>
|
||||
{/if}
|
||||
{/foreach}
|
||||
</ul>
|
||||
|
|
Loading…
Reference in a new issue