当前位置: 首页>>代码示例>>PHP>>正文


PHP wpcf_admin_fields_get_field函数代码示例

本文整理汇总了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函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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


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