本文整理汇总了PHP中FrmFieldsHelper::setup_edit_vars方法的典型用法代码示例。如果您正苦于以下问题:PHP FrmFieldsHelper::setup_edit_vars方法的具体用法?PHP FrmFieldsHelper::setup_edit_vars怎么用?PHP FrmFieldsHelper::setup_edit_vars使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FrmFieldsHelper
的用法示例。
在下文中一共展示了FrmFieldsHelper::setup_edit_vars方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: import_options
function import_options()
{
if (!is_admin() or !current_user_can('frm_edit_forms')) {
return;
}
global $frm_field, $frm_ajax_url;
extract($_POST);
$field = $frm_field->getOne($field_id);
if (!in_array($field->type, array('radio', 'checkbox', 'select'))) {
return;
}
$field = FrmFieldsHelper::setup_edit_vars($field);
$opts = stripslashes($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' => $vals[0], 'value' => $vals[1]);
}
unset($vals);
}
unset($opt_key);
unset($opt);
}
}
$frm_field->update($field_id, array('options' => maybe_serialize($opts)));
$field['options'] = stripslashes_deep($opts);
$field_name = $field['name'];
if ($field['type'] == 'radio' or $field['type'] == 'checkbox') {
require FRM_VIEWS_PATH . '/frm-fields/radio.php';
} else {
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);
require FRM_VIEWS_PATH . '/frm-fields/single-option.php';
}
}
require FRM_VIEWS_PATH . '/frm-forms/new-field-js.php';
die;
}
示例3: _logic_row
public static function _logic_row()
{
if (!current_user_can('frm_edit_forms')) {
global $frm_settings;
die($frm_settings->admin_permission);
}
global $frm_field;
$meta_name = FrmAppHelper::get_param('meta_name');
$form_id = FrmAppHelper::get_param('form_id');
$field_id = FrmAppHelper::get_param('field_id');
$hide_field = '';
$form_fields = $frm_field->getAll(array('fi.form_id' => (int) $form_id), 'field_order');
$field = $frm_field->getOne($field_id);
$field = FrmFieldsHelper::setup_edit_vars($field);
if (!isset($field['hide_field_cond'][$meta_name])) {
$field['hide_field_cond'][$meta_name] = '==';
}
include FrmAppHelper::plugin_path() . '/pro/classes/views/frmpro-fields/_logic_row.php';
die;
}
示例4: _logic_row
public static function _logic_row()
{
check_ajax_referer('frm_ajax', 'nonce');
FrmAppHelper::permission_check('frm_edit_forms', 'show');
$meta_name = FrmAppHelper::get_post_param('meta_name', '', 'absint');
$field_id = FrmAppHelper::get_post_param('field_id', '', 'absint');
$form_id = FrmAppHelper::get_post_param('form_id', '', 'absint');
$hide_field = '';
$field = FrmField::getOne($field_id);
$field = FrmFieldsHelper::setup_edit_vars($field);
$form_fields = FrmField::get_all_for_form($form_id);
if (!isset($field['hide_field_cond'][$meta_name])) {
$field['hide_field_cond'][$meta_name] = '==';
}
include FrmAppHelper::plugin_path() . '/pro/classes/views/frmpro-fields/_logic_row.php';
wp_die();
}
示例5: import_options
public static function import_options()
{
if (!is_admin() or !current_user_can('frm_edit_forms')) {
return;
}
extract(stripslashes_deep($_POST));
$frm_field = new FrmField();
$field = $frm_field->getOne($field_id);
if (!in_array($field->type, array('radio', 'checkbox', 'select'))) {
return;
}
$field = FrmFieldsHelper::setup_edit_vars($field);
$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);
unset($opt);
}
}
$frm_field->update($field_id, array('options' => maybe_serialize($opts)));
$field['options'] = $opts;
$field_name = $field['name'];
if ($field['type'] == 'radio' || $field['type'] == 'checkbox') {
require FrmAppHelper::plugin_path() . '/classes/views/frm-fields/radio.php';
} else {
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);
require FrmAppHelper::plugin_path() . '/classes/views/frm-fields/single-option.php';
}
}
die;
}
示例6: _logic_row
function _logic_row()
{
global $frm_ajax_url;
$meta_name = FrmAppHelper::get_param('meta_name');
$form_id = FrmAppHelper::get_param('form_id');
$field_id = FrmAppHelper::get_param('field_id');
$hide_field = '';
$form_fields = FrmField::getAll("fi.form_id = " . $form_id . " and (type in ('select','radio','checkbox','10radio','scale','data') or (type = 'data' and (field_options LIKE '\"data_type\";s:6:\"select\"%' OR field_options LIKE '%\"data_type\";s:5:\"radio\"%' OR field_options LIKE '%\"data_type\";s:8:\"checkbox\"%') )) and fi.id != " . $field_id, " ORDER BY field_order");
$field = FrmField::getOne($field_id);
$field = FrmFieldsHelper::setup_edit_vars($field);
if (!isset($field['hide_field_cond'][$meta_name])) {
$field['hide_field_cond'][$meta_name] = '==';
}
include FRMPRO_VIEWS_PATH . '/frmpro-fields/_logic_row.php';
die;
}