ca_pull_trigger
- 6
ca_pull_trigger()
Pull a trigger and evaluate any predicates associated with that trigger.
Parameters
...
Accepts a variable number of arguments. The first should always be the
string name of the trigger to pull with any additional arguments being
the arguments expected by the trigger and used for evaluation.
Return value
TRUE or FALSE indicating if at least one predicate was evaluated.
Code
contributions/ubercart/ca/ca.module, line 162
<?php
function ca_pull_trigger() {
static $locked;
$args = func_get_args();
$trigger = array_shift($args);
$trigger_data = ca_load_trigger($trigger);
if (!$trigger_data) {
return FALSE;
}
$predicates = ca_load_trigger_predicates($trigger);
if (!$predicates || count($predicates) == 0) {
return FALSE;
}
$arguments = ca_parse_trigger_args($trigger_data, $args);
if (!$arguments) {
return FALSE;
}
foreach ($predicates as $pid => $predicate) {
$key = $pid . serialize($arguments);
if (!isset($locked[$key])) {
if (ca_evaluate_conditions($predicate, $arguments)) {
ca_perform_actions($predicate, $arguments);
}
}
$locked[$key] = TRUE;
}
return TRUE;
}
?>