Skip to content

Commit

Permalink
Improve PHPDoc for config_eval()
Browse files Browse the repository at this point in the history
  • Loading branch information
dregad committed Mar 28, 2020
1 parent 35b1296 commit 4800cfb
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions core/config_api.php
Expand Up @@ -608,11 +608,15 @@ function env_obsolete( $p_env_variable, $p_new_env_variable ) {
}

/**
* check for recursion in defining configuration variables
* If there is a %text% in the returned value, re-evaluate the "text" part and replace the string
* Check for recursion in defining configuration variables.
*
* If there is a %text% in the returned value, re-evaluate the "text" part and
* replace the string. It is possible to escape the '%' with backslash when
* evaluation is not wanted, e.g. '\%test\%'.
*
* @param string $p_value Configuration variable to evaluate.
* @param boolean $p_global If true, gets %text% as a global configuration, defaults to false.
*
* @return string
*/
function config_eval( $p_value, $p_global = false ) {
Expand Down Expand Up @@ -641,6 +645,7 @@ function config_eval( $p_value, $p_global = false ) {
$t_value = str_replace( $t_matches[1][$i], $t_repl, $t_value );
}
}
# Remove escaped '%'
$t_value = str_replace( '\\%', '%', $t_value );
}
return $t_value;
Expand Down Expand Up @@ -809,4 +814,4 @@ function config_get_type_string( $p_type ) {
} else {
return $t_config_types[CONFIG_TYPE_DEFAULT];
}
}
}

0 comments on commit 4800cfb

Please sign in to comment.