Variables deviennent magiques
This commit is contained in:
parent
9b240ebdcb
commit
463fc2b895
|
@ -133,6 +133,18 @@ foreach( $variables->variables_list_name() as $varname => $varcomment) { ?>
|
||||||
|
|
||||||
<br/>
|
<br/>
|
||||||
<?php } // if $member_id && $fqdn_id ?>
|
<?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">
|
<script type="text/javascript">
|
||||||
|
|
||||||
$(document).ready(function()
|
$(document).ready(function()
|
||||||
|
|
|
@ -36,6 +36,14 @@
|
||||||
class m_variables {
|
class m_variables {
|
||||||
var $strata_order = array('DEFAULT','GLOBAL','FQDN_CREATOR','FQDN','CREATOR','MEMBER','DOMAIN');
|
var $strata_order = array('DEFAULT','GLOBAL','FQDN_CREATOR','FQDN','CREATOR','MEMBER','DOMAIN');
|
||||||
var $cache_variable_list = false;
|
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
|
// used by get_impersonated to merge array. Son value overwrite father's value
|
||||||
private function variable_merge($father, $son) {
|
private function variable_merge($father, $son) {
|
||||||
|
@ -135,6 +143,14 @@ class m_variables {
|
||||||
|
|
||||||
} //foreach
|
} //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])) {
|
if ($var && isset($variables[$var])) {
|
||||||
return $variables[$var];
|
return $variables[$var];
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue