本文整理汇总了PHP中FrmAppHelper::check_selected方法的典型用法代码示例。如果您正苦于以下问题:PHP FrmAppHelper::check_selected方法的具体用法?PHP FrmAppHelper::check_selected怎么用?PHP FrmAppHelper::check_selected使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FrmAppHelper
的用法示例。
在下文中一共展示了FrmAppHelper::check_selected方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: foreach
?>
—</option>
<?php
}
?>
</select>
<?php
} else {
if ($field['data_type'] == 'data' && is_numeric($field['hide_opt'])) {
echo FrmEntryMeta::get_entry_meta_by_field($field['hide_opt'], $field['form_select']);
} else {
if ($field['data_type'] == 'checkbox') {
$checked_values = $field['default_value'];
if ($field['options']) {
foreach ($field['options'] as $opt_key => $opt) {
$checked = FrmAppHelper::check_selected($checked_values, $opt_key) ? ' checked="checked"' : '';
?>
<label for="<?php
echo $field_name;
?>
"><input type="checkbox" name="<?php
echo $field_name;
?>
[]" id="<?php
echo $field_name;
?>
" value="<?php
echo esc_attr($opt_key);
?>
" <?php
echo $checked;
示例2: checked
function checked($values, $current)
{
if (FrmAppHelper::check_selected($values, $current)) {
echo ' checked="checked"';
}
}
示例3: do_action
?>
[]" />
<?php
}
}
if (isset($field['post_field']) && $field['post_field'] == 'post_category') {
do_action('frm_after_checkbox', array('field' => $field, 'field_name' => $field_name, 'type' => $field['type']));
} else {
if ($field['options']) {
foreach ($field['options'] as $opt_key => $opt) {
if (isset($atts) && isset($atts['opt']) && $atts['opt'] != $opt_key) {
continue;
}
$field_val = apply_filters('frm_field_value_saved', $opt, $opt_key, $field);
$opt = apply_filters('frm_field_label_seen', $opt, $opt_key, $field);
$checked = FrmAppHelper::check_selected($checked_values, $field_val) ? ' checked="checked"' : '';
// Check if other opt, and get values for other field if needed
$other_opt = false;
$other_args = FrmFieldsHelper::prepare_other_input(compact('field', 'field_name', 'opt_key'), $other_opt, $checked);
?>
<div class="<?php
echo esc_attr(apply_filters('frm_checkbox_class', 'frm_checkbox', $field, $field_val));
?>
" id="<?php
echo esc_attr(FrmFieldsHelper::get_checkbox_id($field, $opt_key));
?>
"><?php
if (!isset($atts) || !isset($atts['label']) || $atts['label']) {
?>
<label for="<?php
echo esc_attr($html_id);
示例4: get_graph_values
//.........这里部分代码省略.........
if (is_array($input)) {
$temp[$input['item_id']] = $input['meta_value'];
foreach ($ids as $d) {
if (!isset($f_values[$d][$input['item_id']])) {
$f_values[$d][$input['item_id']] = 0;
}
unset($d);
}
} else {
$temp[] = $input;
}
unset($input);
}
$f_inputs[$f_id] = apply_filters('frm_graph_value', $temp, $fields[$f_id], $args);
unset($temp);
unset($input);
unset($f);
}
if (in_array($field->type, array('select', 'checkbox', 'radio', '10radio', 'scale')) and (!isset($x_inputs) or !$x_inputs)) {
if ($limit == '') {
$limit = 10;
}
$field_opt_count = count($field_options);
if ($field_options) {
foreach ($field_options as $opt_key => $opt) {
$field_val = apply_filters('frm_field_value_saved', $opt, $opt_key, $field->field_options);
$opt = apply_filters('frm_field_label_seen', $opt, $opt_key, $field);
$count = 0;
if (empty($opt)) {
continue;
}
$opt = stripslashes_deep($opt);
foreach ($inputs as $in) {
if (FrmAppHelper::check_selected($in, $field_val)) {
if ($data_type == 'total') {
$count += $field_val;
} else {
$count++;
}
}
}
$new_val = FrmAppHelper::truncate($opt, $truncate_label, 2);
if ($count > 0 or $field_opt_count < $limit or !$count and $include_zero) {
$labels[$new_val] = $new_val;
$values[$new_val] = $count;
}
unset($count);
foreach ($f_inputs as $f_id => $f) {
foreach ($f as $in) {
if (!isset($f_values[$f_id])) {
$f_values[$f_id] = array();
}
if (!isset($f_values[$f_id][$new_val])) {
$f_values[$f_id][$new_val] = 0;
}
if (FrmAppHelper::check_selected($in, $field_val)) {
if ($data_type == 'total') {
$f_values[$f_id][$new_val] += $field_val;
} else {
$f_values[$f_id][$new_val]++;
}
}
unset($in);
}
unset($f_id);
unset($f);
示例5: esc_attr
echo esc_attr($field_name);
?>
" id="<?php
echo esc_attr($html_id);
?>
" <?php
do_action('frm_field_input_html', $field);
?>
>
<?php
}
$other_opt = $other_checked = false;
foreach ($field['options'] as $opt_key => $opt) {
$field_val = apply_filters('frm_field_value_saved', $opt, $opt_key, $field);
$opt = apply_filters('frm_field_label_seen', $opt, $opt_key, $field);
$selected = FrmAppHelper::check_selected($field['value'], $field_val);
if ($other_opt === false) {
$other_args = FrmFieldsHelper::prepare_other_input(compact('field', 'field_name', 'opt_key'), $other_opt, $selected);
if (FrmFieldsHelper::is_other_opt($opt_key) && $selected) {
$other_checked = true;
}
}
?>
<option value="<?php
echo esc_attr($field_val);
?>
" <?php
echo $selected ? ' selected="selected"' : '';
echo FrmFieldsHelper::is_other_opt($opt_key) ? ' class="frm_other_trigger"' : '';
?>
><?php
示例6: get_graph_values
//.........这里部分代码省略.........
}
unset($d);
}
} else {
$temp[] = $input;
}
unset($input);
}
$f_inputs[$f_id] = apply_filters('frm_graph_value', $temp, $fields[$f_id], $args);
unset($temp);
unset($input);
unset($f);
}
$tooltips = array();
if (in_array($field->type, array('select', 'checkbox', 'radio', 'scale')) and (!isset($x_inputs) or !$x_inputs)) {
if ($limit == '') {
$limit = 10;
}
if (!in_array($field->type, array('checkbox', 'scale'))) {
//and count($field_options) == 2
$pie = true;
}
//Set default type to pie if field is radio or select
$field_opt_count = count($field_options);
if ($field_options) {
foreach ($field_options as $opt_key => $opt) {
$field_val = apply_filters('frm_field_value_saved', $opt, $opt_key, $field->field_options);
$opt = apply_filters('frm_field_label_seen', $opt, $opt_key, $field);
$count = 0;
if (empty($opt)) {
continue;
}
foreach ($inputs as $in) {
if (FrmAppHelper::check_selected($in, $field_val)) {
if ($data_type == 'total') {
$count += $field_val;
} else {
$count++;
}
}
}
$new_val = FrmAppHelper::truncate($opt, $pie && ($type == 'default' || $type == 'pie') ? 50 : $truncate_label, 2);
//Prevent label truncation if type is pie
if ($count > 0 or $field_opt_count < $limit or !$count and $include_zero) {
$labels[$opt] = $new_val;
$values[$opt] = $count;
$tooltips[$opt] = $opt;
}
unset($count);
foreach ($f_inputs as $f_id => $f) {
foreach ($f as $in) {
if (!isset($f_values[$f_id])) {
$f_values[$f_id] = array();
}
if (!isset($f_values[$f_id][$new_val])) {
$f_values[$f_id][$new_val] = 0;
}
if (FrmAppHelper::check_selected($in, $field_val)) {
if ($data_type == 'total') {
$f_values[$f_id][$new_val] += $field_val;
} else {
$f_values[$f_id][$new_val]++;
}
}
unset($in);
}