• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP wpcf_admin_fields_get_field函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中wpcf_admin_fields_get_field函数的典型用法代码示例。如果您正苦于以下问题:PHP wpcf_admin_fields_get_field函数的具体用法?PHP wpcf_admin_fields_get_field怎么用?PHP wpcf_admin_fields_get_field使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了wpcf_admin_fields_get_field函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: wpcf_cd_field_pre_save_filter

/**
 * Field pre-save filter.
 *
 * @param array $data
 * @return array
 */
function wpcf_cd_field_pre_save_filter($data)
{
    if (empty($data['conditional_display'])) {
        $data['conditional_display'] = array();
    } else {
        if (!empty($data['conditional_display']['conditions'])) {
            foreach ($data['conditional_display']['conditions'] as $k => $condition) {
                if (!array_key_exists('field', $condition)) {
                    continue;
                }
                $field = wpcf_admin_fields_get_field($condition['field']);
                if (!empty($field)) {
                    // Date conversions
                    if ($field['type'] == 'date' && isset($condition['date']) && isset($condition['month']) && isset($condition['year'])) {
                        $time = adodb_mktime(0, 0, 0, $condition['month'], $condition['date'], $condition['year']);
                        if (wpcf_fields_date_timestamp_is_valid($time)) {
                            $condition['value'] = $time;
                        }
                        /*
                                            $date = date( wpcf_get_date_format(), $time );
                                            if ( $date !== false ) {
                                                $condition['value'] = $date;
                                            }
                        */
                    }
                    if (isset($condition['date']) && isset($condition['month']) && isset($condition['year'])) {
                        unset($condition['date'], $condition['month'], $condition['year']);
                    }
                    $data['conditional_display']['conditions'][$k] = $condition;
                }
            }
        }
    }
    return $data;
}
开发者ID:CrankMaster336,项目名称:FFW-TR,代码行数:41,代码来源:conditional-display.php


示例2: wpcf_fields_checkboxes_editor_submit

/**
 * Editor callback form submit.
 */
function wpcf_fields_checkboxes_editor_submit()
{
    $add = '';
    $field = wpcf_admin_fields_get_field($_GET['field_id']);
    $shortcode = '';
    if (!empty($field)) {
        if (!empty($_POST['options'])) {
            if ($_POST['display'] == 'display_all') {
                $separator = !empty($_POST['separator']) ? $_POST['separator'] : '';
                $shortcode .= '[types field="' . $field['slug'] . '" separator="' . $separator . '"]' . '[/types] ';
            } else {
                $i = 0;
                foreach ($_POST['options'] as $option_key => $option) {
                    if ($_POST['display'] == 'value') {
                        $shortcode .= '[types field="' . $field['slug'] . '" option="' . $i . '" state="checked"]' . $option['display_value_selected'] . '[/types] ';
                        $shortcode .= '[types field="' . $field['slug'] . '" option="' . $i . '" state="unchecked"]' . $option['display_value_not_selected'] . '[/types] ';
                    } else {
                        $add = ' option="' . $i . '"';
                        $shortcode .= wpcf_fields_get_shortcode($field, $add) . ' ';
                    }
                    $i++;
                }
            }
        }
        echo editor_admin_popup_insert_shortcode_js($shortcode);
        die;
    }
}
开发者ID:dewavi,项目名称:occupysandy.net,代码行数:31,代码来源:checkboxes.php


示例3: types_get_field

/**
 * Gets field.
 *
 * @param string $field
 * @param string $meta_type
 * @return array
 */
function types_get_field($field, $meta_type = 'postmeta')
{
    static $cache = array();
    $cache_key = md5(strval($field) . strval($meta_type));
    if (isset($cache[$cache_key])) {
        return $cache[$cache_key];
    }
    WPCF_Loader::loadInclude('fields');
    $meta_type = $meta_type == 'usermeta' ? 'wpcf-usermeta' : 'wpcf-fields';
    $cache[$cache_key] = wpcf_admin_fields_get_field(strval($field), false, false, false, $meta_type);
    return $cache[$cache_key];
}
开发者ID:sonvq,项目名称:passioninvestment,代码行数:19,代码来源:api.php


示例4: wpcf_fields_numeric_editor_submit

/**
 * Editor callback form submit.
 */
function wpcf_fields_numeric_editor_submit()
{
    $add = '';
    if (!empty($_POST['format'])) {
        $add .= ' format="' . strval($_POST['format']) . '"';
    }
    $field = wpcf_admin_fields_get_field($_GET['field_id']);
    if (!empty($field)) {
        $shortcode = wpcf_fields_get_shortcode($field, $add);
        wpcf_admin_fields_save_field_last_settings($_GET['field_id'], array('format' => $_POST['format']));
        echo editor_admin_popup_insert_shortcode_js($shortcode);
        die;
    }
}
开发者ID:adisonc,项目名称:MaineLearning,代码行数:17,代码来源:numeric.php


示例5: wpcf_fields_url_editor_submit

/**
 * Editor callback form submit.
 */
function wpcf_fields_url_editor_submit()
{
    $add = '';
    if (!empty($_POST['title'])) {
        $add .= ' title="' . strval($_POST['title']) . '"';
    }
    $add .= ' class=""';
    $field = wpcf_admin_fields_get_field($_GET['field_id']);
    if (!empty($field)) {
        $shortcode = wpcf_fields_get_shortcode($field, $add);
        echo wpcf_admin_fields_popup_insert_shortcode_js($shortcode);
        die;
    }
}
开发者ID:Netsoro,项目名称:gdnlteamgroup,代码行数:17,代码来源:url.php


示例6: wpcf_fields_email_editor_submit

/**
 * Editor callback form submit.
 */
function wpcf_fields_email_editor_submit()
{
    $add = '';
    if (!empty($_POST['title'])) {
        $add = ' title="' . strval($_POST['title']) . '"';
    }
    $field = wpcf_admin_fields_get_field($_GET['field_id']);
    if (!empty($field)) {
        $shortcode = wpcf_fields_get_shortcode($field, $add);
        wpcf_admin_fields_save_field_last_settings($_GET['field_id'], $_POST);
        echo wpcf_admin_fields_popup_insert_shortcode_js($shortcode);
        die;
    }
}
开发者ID:rdbartlett,项目名称:kellyspencer.co.nz,代码行数:17,代码来源:email.php


示例7: wpcf_fields_checkbox_editor_submit

/**
 * Editor callback form submit.
 */
function wpcf_fields_checkbox_editor_submit()
{
    $add = '';
    $field = wpcf_admin_fields_get_field($_GET['field_id']);
    if (!empty($field)) {
        if ($_POST['display'] == 'value') {
            $shortcode = '[types field="' . $field['slug'] . '" state="checked"]' . $_POST['display_value_selected'] . '[/types] ';
            $shortcode .= '[types field="' . $field['slug'] . '" state="unchecked"]' . $_POST['display_value_not_selected'] . '[/types]';
        } else {
            $shortcode = wpcf_fields_get_shortcode($field, $add);
        }
        echo wpcf_admin_fields_popup_insert_shortcode_js($shortcode);
        die;
    }
}
开发者ID:sriram911,项目名称:pls,代码行数:18,代码来源:checkbox.php


示例8: wpcf_fields_radio_editor_submit

/**
 * Editor callback form submit.
 */
function wpcf_fields_radio_editor_submit()
{
    $add = '';
    $field = wpcf_admin_fields_get_field($_GET['field_id']);
    if (!empty($field)) {
        if ($_POST['display'] == 'value' && !empty($_POST['options'])) {
            $shortcode = '';
            foreach ($_POST['options'] as $option_id => $value) {
                $shortcode .= '[types field="' . $field['slug'] . '" option="' . $option_id . '"]' . $value . '[/types] ';
            }
        } else {
            $shortcode = wpcf_fields_get_shortcode($field, $add);
        }
        echo wpcf_admin_fields_popup_insert_shortcode_js($shortcode);
        die;
    }
}
开发者ID:rdbartlett,项目名称:kellyspencer.co.nz,代码行数:20,代码来源:radio.php


示例9: wpcf_ajax_embedded

/**
 * All AJAX calls go here.
 */
function wpcf_ajax_embedded()
{
    if (!current_user_can('manage_options') || (!isset($_REQUEST['_wpnonce']) || !wp_verify_nonce($_REQUEST['_wpnonce'], $_REQUEST['wpcf_action']))) {
        die('Verification failed');
    }
    switch ($_REQUEST['wpcf_action']) {
        case 'editor_insert_date':
            require_once WPCF_EMBEDDED_INC_ABSPATH . '/fields/date.php';
            wpcf_fields_date_editor_form();
            break;
        case 'insert_skype_button':
            require_once WPCF_EMBEDDED_INC_ABSPATH . '/fields/skype.php';
            wpcf_fields_skype_meta_box_ajax();
            break;
        case 'editor_callback':
            require_once WPCF_EMBEDDED_INC_ABSPATH . '/fields.php';
            $field = wpcf_admin_fields_get_field($_GET['field_id']);
            if (!empty($field)) {
                // TODO Remove
                //                $file = WPCF_EMBEDDED_INC_ABSPATH . '/fields/' . $field['type'] . '.php';
                //                if (file_exists($file)) {
                //                    require_once $file;
                $function = 'wpcf_fields_' . $field['type'] . '_editor_callback';
                if (function_exists($function)) {
                    call_user_func($function);
                }
                //                }
            }
            break;
        case 'dismiss_message':
            if (isset($_GET['id'])) {
                $messages = get_option('wpcf_dismissed_messages', array());
                $messages[] = $_GET['id'];
                update_option('wpcf_dismissed_messages', $messages);
            }
            break;
        default:
            break;
    }
    if (function_exists('wpcf_ajax')) {
        wpcf_ajax();
    }
    die;
}
开发者ID:nuevomediagroup,项目名称:nmg-code,代码行数:47,代码来源:ajax.php


示例10: set

 /**
  * Set current post and field.
  * 
  * @param type $post
  * @param type $cf 
  */
 function set($user_id, $cf)
 {
     global $wpcf;
     /*
      * 
      * Check if $cf is string
      */
     if (is_string($cf)) {
         WPCF_Loader::loadInclude('fields');
         $cf = wpcf_admin_fields_get_field($this->__get_slug_no_prefix($cf));
         if (empty($cf)) {
             $this->_reset();
             return false;
         }
     }
     $this->currentUID = $user_id;
     $this->ID = $cf['id'];
     $this->cf = $cf;
     $this->slug = wpcf_types_get_meta_prefix($this->cf) . $this->cf['slug'];
     $this->meta = $this->_get_meta();
     $this->config = $this->_get_config();
     $this->unique_id = wpcf_unique_id(serialize((array) $this));
     $this->cf['value'] = $this->meta;
     // Debug
     $wpcf->debug->fieds[$this->unique_id] = $this->cf;
     $wpcf->debug->meta[$this->slug][] = $this->meta;
     // Load files
     if (isset($this->cf['type'])) {
         $file = WPCF_EMBEDDED_INC_ABSPATH . '/fields/' . $this->cf['type'] . '.php';
         if (file_exists($file)) {
             include_once $file;
         }
         if (defined('WPCF_INC_ABSPATH')) {
             $file = WPCF_INC_ABSPATH . '/fields/' . $this->cf['type'] . '.php';
             if (file_exists($file)) {
                 include_once $file;
             }
         }
     }
 }
开发者ID:CrankMaster336,项目名称:FFW-TR,代码行数:46,代码来源:usermeta_field.php


示例11: types_get_field

/**
 * Gets field.
 *
 * @param string $field
 * @param string $meta_type
 * @return array
 */
function types_get_field($field, $meta_type = 'postmeta')
{
    static $cache = array();
    $cache_key = md5(strval($field) . strval($meta_type));
    if (isset($cache[$cache_key])) {
        return $cache[$cache_key];
    }
    WPCF_Loader::loadInclude('fields');
    switch ($meta_type) {
        case 'usermeta':
            $meta_type_key = 'wpcf-usermeta';
            break;
        case 'termmeta':
            $meta_type_key = 'wpcf-termmeta';
            break;
        default:
            $meta_type_key = 'wpcf-fields';
            break;
    }
    $cache[$cache_key] = wpcf_admin_fields_get_field(strval($field), false, false, false, $meta_type_key);
    return $cache[$cache_key];
}
开发者ID:lytranuit,项目名称:wordpress,代码行数:29,代码来源:api.php


示例12: wpcf_fields_date_custom_conditional_statement_filter

/**
 * Custom Conditinal Statement hook returns timestamp if array.
 * 
 * NOTE that $null is already filtered to use $_POST values
 * at priority 10.
 * 
 * @param type $null
 * @param type $object_id
 * @param type $meta_key
 * @param type $single
 * @return mixed timestamp or $null
 */
function wpcf_fields_date_custom_conditional_statement_filter($null, $object_id, $meta_key, $single)
{
    global $wpcf;
    $field = wpcf_admin_fields_get_field($wpcf->field->__get_slug_no_prefix($meta_key));
    if (!empty($null) && !empty($field) && isset($field['type']) && $field['type'] == 'date') {
        if (is_array($null) && !isset($null['datepicker'])) {
            $null = array_shift($null);
        }
        $null = wpcf_fields_date_value_get_filter($null, $field, 'timestamp');
        if (!is_numeric($null)) {
            $null = -1;
        }
        /**
         * be sure do not return string if array is expected!
         */
        if (!$single && !is_array($null)) {
            return array($null);
        }
    }
    return $null;
}
开发者ID:nhainam,项目名称:wordpress4,代码行数:33,代码来源:functions.php


示例13: buildRawFieldToEdit

 /**
  * buildRawFieldToEdit function
  *
  * @param array $field
  * @param array $settings
  * @return array
  * @author Riccardo Strobbia
  **/
 private function buildRawFieldToEdit($field, $settings = array())
 {
     $opts = $settings ? $settings : get_post_meta($this->view_id, '_wpv_settings', true);
     $ret = array();
     $index = self::get_param_index_cmp($settings, $field);
     //print "index first method " . $index ."\n";
     //FIXME: fall back for retrocompatibility
     if ($index === -1) {
         //	$index = self::get_param_index($settings, $field);
     }
     $index = self::get_param_index($settings, $field);
     if ($index > -1) {
         $field['url_param'] = self::$tmp_settings['filter_controls_param'][$index];
         $field['can_force_zero'] = false;
         self::$tmp_settings = null;
         if (isset($field['taxonomy'])) {
             $name = $settings['filter_controls_field_name'][$index];
             $id = $name;
             $id = $settings['filter_controls_label'][$index];
             $ret['is_types'] = false;
             $ret['group'] = 'taxonomy';
             ///do processing for taxes and return
         } else {
             if (isset($field['field'])) {
                 $g = '';
                 $name = $field['field'];
                 $nice_name = explode('wpcf-', $name);
                 $id = isset($nice_name[1]) ? $nice_name[1] : $name;
                 $field_options = array();
                 if (function_exists('wpcf_admin_fields_get_groups_by_field')) {
                     $field_options = wpcf_admin_fields_get_field($id);
                     foreach (wpcf_admin_fields_get_groups_by_field($id) as $gs) {
                         $g = $gs['name'];
                     }
                 }
                 $ret['group'] = $g ? $g : "Custom fields";
                 $name = $g ? $name : $field['field'];
                 $ret['is_types'] = $g ? true : false;
                 if (!empty($field_options) && isset($field_options['meta_key'])) {
                     $name = $field_options['meta_key'];
                 }
                 if (!empty($field_options) && $field_options['type'] == 'checkbox' && $field_options['data']['save_empty'] == 'yes') {
                     $ret['can_force_zero'] = true;
                 }
                 $id = $g ? $id : $field['field'];
             } else {
                 if (isset($field['relationship'])) {
                     $name = 'relationship';
                     $id = __('Post relationship', 'wpv-views');
                     // TODO what are we doing here??
                     $id = $settings['filter_controls_label'][$index];
                     $ret['is_types'] = false;
                     $ret['group'] = 'basic_filters';
                     $ret['kind'] = 'relationship';
                     $ret['basic_filter_type'] = 'relationship';
                 } else {
                     $name = $settings['filter_controls_field_name'][$index];
                     $id = $name;
                     $ret['is_types'] = false;
                     $ret['group'] = 'Custom fields';
                 }
             }
         }
         //	print "\n'custom-field-'.$name.'_value'\n";
         //	print_r( $settings['custom-field-'.$name.'_value'] );
         $ret['field'] = $name;
         $ret['id'] = $id;
         if (isset($field['taxonomy'])) {
             $ret['kind'] = 'taxonomy';
             $ret['group'] = $ret['kind'];
             $ret['compare'] = isset($settings['taxonomy-' . $name . '-attribute-operator']) ? $settings['taxonomy-' . $name . '-attribute-operator'] : 'IN';
             //	$ret['hide_empty'] = isset( $field['hide_empty'] ) ? $field['hide_empty'] : 'false';
         } else {
             if (isset($field['relationship'])) {
                 $ret['group'] = 'basic_filters';
             } else {
                 $ret['compare'] = isset($settings['custom-field-' . $name . '_compare']) ? $settings['custom-field-' . $name . '_compare'] : '=';
                 $ret['data_type'] = isset($settings['custom-field-' . $name . '_type']) ? $settings['custom-field-' . $name . '_type'] : 'CHAR';
                 $ret['relation'] = isset($settings['custom-field-' . $name . '_relationship']) ? $settings['custom-field-' . $name . '_relationship'] : 'AND';
                 $ret['kind'] = 'field';
             }
         }
         $ret['name'] = $ret['is_types'] ? $settings['filter_controls_label'][$index] : $id;
         $ret['type'] = $settings['filter_controls_type'][$index];
         $ret['values'] = $settings['filter_controls_values'][$index];
         $ret['enabled'] = $settings['filter_controls_enable'][$index];
         $ret['index'] = $index;
         /*	$ret_aux = $settings['filter_controls_values'][$index];
         			$ret['taxonomy_order'] = isset( $ret_aux['taxonomy_order'] ) ? $ret_aux['taxonomy_order'] : 'ASC';
         			$ret['taxonomy_orderby'] = isset( $ret_aux['taxonomy_orderby'] ) ? $ret_aux['taxonomy_orderby'] : 'name';
         			$ret['hide_empty'] = isset( $ret_aux['hide_empty'] ) ? $ret_aux['hide_empty'] : 'false';*/
         //implement for tax
//.........这里部分代码省略.........
开发者ID:supahseppe,项目名称:path-of-gaming,代码行数:101,代码来源:editor-addon-parametric.class.php


示例14: set

 /**
  * Set current post and field.
  *
  * @param type $post
  * @param type $cf
  */
 function set($post, $cf)
 {
     global $wpcf;
     /*
      *
      * Check if $cf is string
      */
     if (is_string($cf)) {
         WPCF_Loader::loadInclude('fields');
         $_cf = wpcf_admin_fields_get_field($this->__get_slug_no_prefix($cf));
         // Check if found without prefix
         if (empty($_cf)) {
             $_cf = wpcf_admin_fields_get_field($cf);
         }
         if (empty($_cf)) {
             /*
              * TODO Check what happens if field is not found
              */
             $this->_reset();
             return false;
         }
         $cf = $_cf;
     }
     $this->post = is_integer($post) ? get_post($post) : $post;
     // If empty post it is new
     if (empty($this->post->ID)) {
         $this->post = new stdClass();
         $this->post->ID = 0;
     }
     $this->ID = $cf['id'];
     $this->cf = $cf;
     $this->slug = wpcf_types_get_meta_prefix($this->cf) . $this->cf['slug'];
     $this->meta = $this->_get_meta();
     $this->config = $this->_get_config();
     $this->unique_id = wpcf_unique_id(serialize((array) $this));
     $this->cf['value'] = $this->meta;
     // Debug
     $wpcf->debug->fields[$this->unique_id] = $this->cf;
     $wpcf->debug->meta[$this->slug][] = $this->meta;
     // Load files
     $this->_include_file_by_field_type($this->cf['type']);
     if (defined('WPCF_INC_ABSPATH')) {
         $file = WPCF_INC_ABSPATH . '/fields/' . preg_replace('/[^\\w]+/', '', $this->cf['type']) . '.php';
         if (file_exists($file)) {
             include_once $file;
         }
     }
 }
开发者ID:phuocdungit,项目名称:fundy,代码行数:54,代码来源:field.php


示例15: wpcf_admin_post_add_attachment_hook

/**
 *
 * Only for attachments, only default checkboxes!
 *
 * @internal breakpoint
 * @param type $post_ID
 * @param type $post
 */
function wpcf_admin_post_add_attachment_hook($post_ID, $post)
{
    global $wpcf;
    /**
     * Basic check: only attachment
     */
    if ('attachment' != $post->post_type) {
        return false;
    }
    /**
     * Get all groups connected to this $post
     */
    $groups = wpcf_admin_post_get_post_groups_fields($post);
    if (empty($groups)) {
        return false;
    }
    $all_fields = array();
    $_not_valid = array();
    $_error = false;
    /**
     * Loop over each group
     *
     * TODO Document this
     * Connect 'wpcf-invalid-fields' with all fields
     */
    foreach ($groups as $group) {
        if (isset($group['fields'])) {
            // Process fields
            $fields = wpcf_admin_post_process_fields($post, $group['fields'], true, false, 'validation');
            // Validate fields
            $form = wpcf_form_simple_validate($fields);
            $all_fields = $all_fields + $fields;
            // Collect all not valid fields
            if ($form->isError()) {
                $_error = true;
                // Set error only to true
                $_not_valid = array_merge($_not_valid, (array) $form->get_not_valid());
            }
        }
    }
    // Set fields
    foreach ($all_fields as $k => $v) {
        // only Types field
        if (empty($v['wpcf-id'])) {
            continue;
        }
        $_temp = new WPCF_Field();
        $_temp->set($wpcf->post, $v['wpcf-id']);
        $all_fields[$k]['_field'] = $_temp;
    }
    foreach ($_not_valid as $k => $v) {
        // only Types field
        if (empty($v['wpcf-id'])) {
            continue;
        }
        $_temp = new WPCF_Field();
        $_temp->set($wpcf->post, $v['wpcf-id']);
        $_not_valid[$k]['_field'] = $_temp;
    }
    /**
     * Process all checkbox fields
     */
    foreach ($all_fields as $field) {
        /**
         * only checkbox
         */
        if (!isset($field['#type']) || 'checkbox' != $field['#type']) {
            continue;
        }
        $field_data = wpcf_admin_fields_get_field($field['wpcf-id']);
        /**
         * check is checked for new!
         */
        $checked = array_key_exists('checked', $field_data['data']) && $field_data['data']['checked'];
        /**
         * do not save empty and not checked? fine, go away...
         */
        if ('no' == $field_data['data']['save_empty'] && !$checked) {
            continue;
        }
        /**
         * all other just save...
         */
        $update_data = 0;
        if ($checked) {
            $update_data = $field_data['data']['set_value'];
        }
        add_post_meta($post_ID, wpcf_types_get_meta_prefix($field) . $field['wpcf-slug'], $update_data);
    }
    do_action('wpcf_attachement_add', $post_ID);
}
开发者ID:SpencerNeitzke,项目名称:types,代码行数:99,代码来源:fields-post.php


示例16: wpcf_usermeta_insert_existing_ajax

/**
 * Dynamically adds existing field on AJAX call.
 * 
 * @param type $form_data 
 */
function wpcf_usermeta_insert_existing_ajax()
{
    $field = wpcf_admin_fields_get_field($_GET['field'], false, true, false, 'wpcf-usermeta');
    if (!empty($field)) {
        echo wpcf_fields_get_field_form($field['type'], $field);
    } else {
        echo '<div>' . __("Requested field don't exist", 'wpcf') . '</div>';
    }
}
开发者ID:sandum150,项目名称:cheltuieli,代码行数:14,代码来源:usermeta-form.php


示例17: wpcf_fields_google_map_editor_submit

/**
 * Processes editor popup submit
 */
function wpcf_fields_google_map_editor_submit()
{
    // Get field
    $field = wpcf_admin_fields_get_field(strval($_GET['field_id']));
    if (!empty($field)) {
        $add = '';
        // Add parameters
        if (!empty($_POST['width'])) {
            $add .= ' width="' . strval($_POST['width']) . '"';
        }
        if (!empty($_POST['height'])) {
            $add .= ' height="' . strval($_POST['height']) . '"';
        }
        // Generate shortcode
        $shortcode = wpcf_fields_get_shortcode($field, $add);
        // Save settings
        wpcf_admin_fields_save_field_last_settings($_GET['field_id'], $_POST);
        // Trigger inserting shortcode in parent editor
        echo editor_admin_popup_insert_shortcode_js($shortcode);
    }
    die;
}
开发者ID:pwillems,项目名称:mimosa-contents,代码行数:25,代码来源:google-map.php


示例18: field_condition_get

 /**
  * Summary.
  *
  * Description.
  *
  * @since x.x.x
  * @access (for functions: only use if private)
  *
  * @see Function/method/class relied on
  * @link URL
  * @global type $varname Description.
  * @global type $varname Description.
  *
  * @param type $var Description.
  * @param type $var Optional. Description.
  * @return type Description.
  */
 public function field_condition_get()
 {
     /**
      * check nonce
      */
     if (0 || !isset($_REQUEST['_wpnonce']) || !isset($_REQUEST['id']) || !wp_verify_nonce($_REQUEST['_wpnonce'], 'wpcf-conditional-get-' . $_REQUEST['id'])) {
         $this->verification_failed_and_die();
     }
     /**
      * get field definition
      */
     require_once WPCF_EMBEDDED_INC_ABSPATH . '/fields.php';
     $field = wpcf_admin_fields_get_field(sanitize_text_field($_REQUEST['id']), false, true);
     if (empty($field)) {
         __('Wrong field.', 'wpcf');
         die;
     }
     /**
      * define conditional
      */
     require_once WPCF_INC_ABSPATH . '/classes/class.types.fields.conditional.php';
     new Types_Fields_Conditional();
     /**
      * get form data
      */
     /**
      * Summary.
      *
      * Description.
      *
      * @since x.x.x
      *
      * @param type  $var Description.
      * @param array $args {
      *     Short description about this hash.
      *
      *     @type type $var Description.
      *     @type type $var Description.
      * }
      * @param type  $var Description.
      */
     $form = $this->get_field_conditionals(array(), $field);
     if (empty($form)) {
         __('Wrong field.', 'wpcf');
         die;
     }
     /**
      * produce form
      */
     echo wpcf_form_simple($form);
     die;
 }
开发者ID:lytranuit,项目名称:wordpress,代码行数:69,代码来源:class.types.fields.conditional.php


示例19: item_exists

 /**
  * Checks if item exists.
  *
  * @param type $type
  * @param type $item_id
  * @return boolean
  */
 function item_exists($type, $item_id)
 {
     switch ($type) {
         case 'group':
             $check = wpcf_admin_fields_get_group($item_id);
             break;
         case 'field':
             $check = wpcf_admin_fields_get_field($item_id);
             break;
         case 'custom_post_type':
             $check = wpcf_get_custom_post_type_settings($item_id);
             break;
         case 'custom_taxonomy':
             $check = wpcf_get_custom_taxonomy_settings($item_id);
             break;
         default:
             return false;
             break;
     }
     return !empty($check);
 }
开发者ID:zoran180,项目名称:wp_szf,代码行数:28,代码来源:class.wpcf-import-export.php


示例20: wpcf_admin_userprofilesave_init

function wpcf_admin_userprofilesave_init($user_id)
{
    if (defined('WPTOOLSET_FORMS_VERSION')) {
        global $wpcf;
        $errors = false;
        /**
         * check checkbox type fields to delete or save empty if needed
         */
        $groups = wpcf_admin_usermeta_get_groups_fields();
        foreach ($groups as $group) {
            if (!array_key_exists('fields', $group) || empty($group['fields'])) {
                continue;
            }
            foreach ($group['fields'] as $field) {
                switch ($field['type']) {
                    case 'checkboxes':
                        if (!array_key_exists('wpcf', $_POST) || !array_key_exists($field['slug'], $_POST['wpcf'])) {
                            delete_user_meta($user_id, $field['meta_key']);
                        }
                        break;
                    case 'checkbox':
                        if (!array_key_exists('wpcf', $_POST) || !array_key_exists($field['slug'], $_POST['wpcf'])) {
                            if ('yes' == $field['data']['save_empty']) {
                                $_POST['wpcf'][$field['slug']] = 0;
                            } else {
                                delete_user_meta($user_id, $field['meta_key']);
                            }
                        }
                        break;
                }
            }
        }
        // Save meta fields
        if (!empty($_POST['wpcf'])) {
            foreach ($_POST['wpcf'] as $field_slug => $field_value) {
                // Get field by slug
                $field = wpcf_fields_get_field_by_slug($field_slug, 'wpcf-usermeta');
                if (empty($field)) {
                    continue;
                }
                // Skip copied fields
                if (isset($_POST['wpcf_repetitive_copy'][$field['slug']])) {
                    continue;
                }
                $_field_value = !types_is_repetitive($field) ? array($field_value) : $field_value;
                // Set config
                $config = wptoolset_form_filter_types_field($field, $user_id);
                foreach ($_field_value as $_k => $_val) {
                    // Check if valid
                    $valid = wptoolset_form_validate_field('your-profile', $config, $_val);
                    if (is_wp_error($valid)) {
                        $errors = true;
                        $_errors = $valid->get_error_data();
                        $_msg = sprintf(__('Field "%s" not updated:', 'wpcf'), $field['name']);
                        wpcf_admin_message_store($_msg . ' ' . implode(', ', $_errors), 'error');
                        if (types_is_repetitive($field)) {
                            unset($field_value[$_k]);
                        } else {
                            break;
                        }
                    }
                }
                // Save field
                if (types_is_repetitive($field)) {
                    $wpcf->usermeta_repeater->set($user_id, $field);
                    $wpcf->usermeta_repeater->save($field_value);
                } else {
                    $wpcf->usermeta_field->set($user_id, $field);
                    $wpcf->usermeta_field->usermeta_save($field_value);
                }
                do_action('wpcf_user_field_saved', $user_id, $field);
                // TODO Move to checkboxes
                if ($field['type'] == 'checkboxes') {
                    $field_data = wpcf_admin_fields_get_field($field['id'], false, false, false, 'wpcf-usermeta');
                    if (!empty($field_data['data']['options'])) {
                        $update_data = array();
                        foreach ($field_data['data']['options'] as $option_id => $option_data) {
                            if (!isset($_POST['wpcf'][$field['id']][$option_id])) {
                                if (isset($field_data['data']['save_empty']) && $field_data['data']['save_empty'] == 'yes') {
                                    $update_data[$option_id] = 0;
                                }
                            } else {
                                $update_data[$option_id] = $_POST['wpcf'][$field['id']][$option_id];
                            }
                        }
                        update_user_meta($user_id, $field['meta_key'], $update_data);
                    }
                }
            }
        }
        if ($errors) {
            update_post_meta($user_id, '__wpcf-invalid-fields', true);
        }
        do_action('wpcf_user_saved', $user_id);
        return;
    }
    global $wpcf;
    $all_fields = array();
    $_not_valid = array();
    $_error = false;
//.........这里部分代码省略.........
开发者ID:sonvq,项目名称:passioninvestment,代码行数:101,代码来源:usermeta-post.php



注:本文中的wpcf_admin_fields_get_field函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap