Variables deviennent magiques

This commit is contained in:
Alan Garcia 2014-03-20 13:27:33 +00:00
parent 9b240ebdcb
commit 463fc2b895
2 changed files with 28 additions and 0 deletions

View File

@ -133,6 +133,18 @@ foreach( $variables->variables_list_name() as $varname => $varcomment) { ?>
<br/>
<?php } // if $member_id && $fqdn_id ?>
<hr/>
<h3><?php __("Magical values");?></h3>
<?php __("Those var are automatically replaced by the value indicated"); ?>
<ul>
<?php
foreach ($variables->replace_array as $vrepk => $vrepvalue) {
echo "<li><code>$vrepk</code> => $vrepvalue</li>";
}
?>
</ul>
<script type="text/javascript">
$(document).ready(function()

View File

@ -36,6 +36,14 @@
class m_variables {
var $strata_order = array('DEFAULT','GLOBAL','FQDN_CREATOR','FQDN','CREATOR','MEMBER','DOMAIN');
var $cache_variable_list = false;
var $replace_array = array();
function m_variables() {
global $L_FQDN;
$this->replace_array = array(
"%%FQDN%%"=> $L_FQDN,
);
}
// used by get_impersonated to merge array. Son value overwrite father's value
private function variable_merge($father, $son) {
@ -135,6 +143,14 @@ class m_variables {
} //foreach
// Replace needed vars
foreach ($variables as $vv => $hh) {
if (!isset($hh['value'])) {
continue;
}
$variables[$vv]['value'] = strtr($hh['value'], $this->replace_array );
}
if ($var && isset($variables[$var])) {
return $variables[$var];
} else {