function RulesPHPEvaluator::getUsedVars
Helper function to find variables in PHP code.
Parameters
string $text: The PHP code.
array $var_info: Array with variable names as keys.
2 calls to RulesPHPEvaluator::getUsedVars()
- RulesPHPEvaluator::prepare in modules/
php.eval.inc - Overrides RulesDataInputEvaluator::prepare().
- rules_execute_php_eval_process in modules/
php.rules.inc - Process the settings to prepare code execution.
File
-
modules/
php.eval.inc, line 32
Class
- RulesPHPEvaluator
- A class implementing a rules input evaluator processing PHP.
Code
public static function getUsedVars($text, $var_info) {
if (strpos($text, '<?') !== FALSE) {
$used_vars = array();
foreach ($var_info as $name => $info) {
if (strpos($text, '$' . $name) !== FALSE) {
$used_vars[] = $name;
}
}
return $used_vars;
}
}