本文整理汇总了PHP中FrmFieldsHelper::show_single_option方法的典型用法代码示例。如果您正苦于以下问题:PHP FrmFieldsHelper::show_single_option方法的具体用法?PHP FrmFieldsHelper::show_single_option怎么用?PHP FrmFieldsHelper::show_single_option使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FrmFieldsHelper
的用法示例。
在下文中一共展示了FrmFieldsHelper::show_single_option方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: import_options
public static function import_options()
{
check_ajax_referer('frm_ajax', 'nonce');
if (!is_admin() || !current_user_can('frm_edit_forms')) {
return;
}
$field_id = absint($_POST['field_id']);
$field = FrmField::getOne($field_id);
if (!in_array($field->type, array('radio', 'checkbox', 'select'))) {
return;
}
$field = FrmFieldsHelper::setup_edit_vars($field);
$opts = stripslashes_deep($_POST['opts']);
$opts = explode("\n", rtrim($opts, "\n"));
if ($field['separate_value']) {
foreach ($opts as $opt_key => $opt) {
if (strpos($opt, '|') !== false) {
$vals = explode('|', $opt);
if ($vals[0] != $vals[1]) {
$opts[$opt_key] = array('label' => trim($vals[0]), 'value' => trim($vals[1]));
}
unset($vals);
}
unset($opt_key, $opt);
}
}
//Keep other options after bulk update
if (isset($field['field_options']['other']) && $field['field_options']['other'] == true) {
$other_array = array();
foreach ($field['options'] as $opt_key => $opt) {
if ($opt_key && strpos($opt_key, 'other') !== false) {
$other_array[$opt_key] = $opt;
}
unset($opt_key, $opt);
}
if (!empty($other_array)) {
$opts = array_merge($opts, $other_array);
}
}
FrmField::update($field_id, array('options' => maybe_serialize($opts)));
$field['options'] = $opts;
$field_name = $field['name'];
// Get html_id which will be used in single-option.php
$html_id = FrmFieldsHelper::get_html_id($field);
if ($field['type'] == 'radio' || $field['type'] == 'checkbox') {
require FrmAppHelper::plugin_path() . '/classes/views/frm-fields/radio.php';
} else {
FrmFieldsHelper::show_single_option($field);
}
wp_die();
}
示例2: do_action
<div class="frm-show-click frm_small_top_margin">
<?php
if (!isset($field['post_field']) || !in_array($field['post_field'], array('post_category'))) {
?>
<?php
do_action('frm_add_multiple_opts_labels', $field);
?>
<ul id="frm_field_<?php
echo esc_attr($field['id']);
?>
_opts" class="frm_sortable_field_opts<?php
echo count($field['options']) > 10 ? ' frm_field_opts_list' : '';
?>
">
<?php
FrmFieldsHelper::show_single_option($field);
?>
</ul>
<?php
}
?>
</div>
<?php
} else {
if ($field['type'] == 'captcha') {
if (empty($frm_settings->pubkey)) {
?>
<div class="howto frm_no_captcha_text"><?php
printf(__('Your captcha will not appear on your form until you %1$sset up%2$s the Site and Private Keys', 'formidable'), '<a href="?page=formidable-settings">', '</a>');
?>
</div>