コード例 #1
0
 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
0
ファイル: show-build.php プロジェクト: mazykin46/portfolio
    <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>