本文整理汇总了PHP中FrmFieldsHelper::value_meets_condition方法的典型用法代码示例。如果您正苦于以下问题:PHP FrmFieldsHelper::value_meets_condition方法的具体用法?PHP FrmFieldsHelper::value_meets_condition怎么用?PHP FrmFieldsHelper::value_meets_condition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FrmFieldsHelper
的用法示例。
在下文中一共展示了FrmFieldsHelper::value_meets_condition方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: action_conditions_met
public static function action_conditions_met($action, $entry)
{
$notification = $action->post_content;
$stop = false;
$met = array();
if (!isset($notification['conditions']) || empty($notification['conditions'])) {
return $stop;
}
foreach ($notification['conditions'] as $k => $condition) {
if (!is_numeric($k)) {
continue;
}
if ($stop && 'any' == $notification['conditions']['any_all'] && 'stop' == $notification['conditions']['send_stop']) {
continue;
}
if (is_array($condition['hide_opt'])) {
$condition['hide_opt'] = reset($condition['hide_opt']);
}
$observed_value = isset($entry->metas[$condition['hide_field']]) ? $entry->metas[$condition['hide_field']] : '';
if ($condition['hide_opt'] == 'current_user') {
$condition['hide_opt'] = get_current_user_id();
}
$stop = FrmFieldsHelper::value_meets_condition($observed_value, $condition['hide_field_cond'], $condition['hide_opt']);
if ($notification['conditions']['send_stop'] == 'send') {
$stop = $stop ? false : true;
}
$met[$stop] = $stop;
}
if ($notification['conditions']['any_all'] == 'all' && !empty($met) && isset($met[0]) && isset($met[1])) {
$stop = $notification['conditions']['send_stop'] == 'send';
} else {
if ($notification['conditions']['any_all'] == 'any' && $notification['conditions']['send_stop'] == 'send' && isset($met[0])) {
$stop = false;
}
}
return $stop;
}
示例2: action_conditions_met
public static function action_conditions_met($action, $entry)
{
$notification = $action->post_content;
$stop = false;
$met = array();
if (!isset($notification['conditions']) || empty($notification['conditions'])) {
return $stop;
}
foreach ($notification['conditions'] as $k => $condition) {
if (!is_numeric($k)) {
continue;
}
if ($stop && 'any' == $notification['conditions']['any_all'] && 'stop' == $notification['conditions']['send_stop']) {
continue;
}
self::prepare_logic_value($condition['hide_opt']);
$observed_value = self::get_value_from_entry($entry, $condition['hide_field']);
$stop = FrmFieldsHelper::value_meets_condition($observed_value, $condition['hide_field_cond'], $condition['hide_opt']);
if ($notification['conditions']['send_stop'] == 'send') {
$stop = $stop ? false : true;
}
$met[$stop] = $stop;
}
if ($notification['conditions']['any_all'] == 'all' && !empty($met) && isset($met[0]) && isset($met[1])) {
$stop = $notification['conditions']['send_stop'] == 'send';
} else {
if ($notification['conditions']['any_all'] == 'any' && $notification['conditions']['send_stop'] == 'send' && isset($met[0])) {
$stop = false;
}
}
return $stop;
}
示例3: is_field_hidden
public static function is_field_hidden($field, $values)
{
if ($field->type == 'user_id' || $field->type == 'hidden' || !isset($field->field_options['hide_field']) || empty($field->field_options['hide_field'])) {
return false;
}
$field->field_options['hide_field'] = (array) $field->field_options['hide_field'];
if (!isset($field->field_options['hide_field_cond'])) {
$field->field_options['hide_field_cond'] = array('==');
}
$field->field_options['hide_field_cond'] = (array) $field->field_options['hide_field_cond'];
$field->field_options['hide_opt'] = (array) $field->field_options['hide_opt'];
if (!isset($field->field_options['show_hide'])) {
$field->field_options['show_hide'] = 'show';
}
if (!isset($field->field_options['any_all'])) {
$field->field_options['any_all'] = 'any';
}
$hidden = false;
$hide = array();
foreach ($field->field_options['hide_field'] as $hide_key => $hide_field) {
if ($hidden && $field->field_options['any_all'] == 'any' && $field->field_options['show_hide'] == 'hide') {
continue;
}
$observed_value = '';
if (isset($values['item_meta'][$hide_field])) {
$observed_value = $values['item_meta'][$hide_field];
} else {
if (isset($field->temp_id) && $field->id != $field->temp_id) {
// this field depends on a field in a repeating section
$id_parts = explode('-', $field->temp_id);
if (isset($_POST['item_meta'][$id_parts[1]]) && isset($_POST['item_meta'][$id_parts[1]][$id_parts[2]]) && isset($_POST['item_meta'][$id_parts[1]][$id_parts[2]][$hide_field])) {
$observed_value = stripslashes_deep($_POST['item_meta'][$id_parts[1]][$id_parts[2]][$hide_field]);
}
}
}
if ($field->type == 'data') {
// Don't require a Dynamic Field with no available options
self::is_dynamic_field_empty($field, $hide_key, $hide_field, $observed_value);
}
$hidden = FrmFieldsHelper::value_meets_condition($observed_value, $field->field_options['hide_field_cond'][$hide_key], $field->field_options['hide_opt'][$hide_key]);
if ($field->field_options['show_hide'] == 'show') {
$hidden = $hidden ? false : true;
}
$hide[$hidden] = $hidden;
}
if ($field->field_options['any_all'] == 'all' && !empty($hide) && isset($hide[0]) && isset($hide[1])) {
$hidden = $field->field_options['show_hide'] == 'show' ? true : false;
} else {
if ($field->field_options['any_all'] == 'any' && $field->field_options['show_hide'] == 'show' && isset($hide[0])) {
$hidden = false;
}
}
return $hidden;
}