function _votingapi_process_action_set in Voting API 5
1 call to _votingapi_process_action_set()
- _votingapi_process_actions in ./votingapi_actions.module
File
- ./votingapi_actions.module, line 115
Code
function _votingapi_process_action_set($content = NULL, $votes = array(), $results = array(), $action_set = NULL, &$actions) {
if (!isset($action_set['conditions'])) {
$action_set['conditions'] = array();
}
if (!isset($action_set['actions'])) {
$action_set['actions'] = array();
}
if (!isset($action_set['subsets'])) {
$action_set['subsets'] = array();
}
foreach ($action_set['conditions'] as $condition) {
$function = $condition['handler'];
if (function_exists($function)) {
$conditions_result = $function('process', $content, $votes, $results, $condition);
}
else {
$conditions_result = FALSE;
}
if ($action_set['condition_mask'] == 'AND') {
if ($conditions_result === FALSE) {
return FALSE;
}
else {
if (isset($set_result)) {
$set_result = $set_result && $conditions_result;
}
else {
$set_result = $conditions_result;
}
}
}
else {
if ($action_set['condition_mask'] == 'OR') {
$set_result = $set_result || $conditions_result;
}
}
}
if ($set_result == TRUE) {
foreach ($action_set['subsets'] as $subset) {
if ($subset['required'] == TRUE) {
$set_result = $set_result && _votingapi_process_action_set($content, $votes, $results, $subset, $actions);
if ($set_result == FALSE) {
return FALSE;
}
}
}
if ($set_result == TRUE) {
foreach ($action_set['actions'] as $action) {
$actions[] = $action;
}
foreach ($action_set['subsets'] as $subset) {
if ($subset['required'] == FALSE) {
_votingapi_process_action_set($content, $votes, $results, $subset, $actions);
}
}
}
}
return $set_result;
}