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


PHP WPCF_Loader类代码示例

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


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

示例1: wpcf_fields_url_editor_callback

/**
 * Editor callback form.
 */
function wpcf_fields_url_editor_callback($field, $settings)
{
    if (empty($settings['target'])) {
        $settings['target'] = '_self';
    }
    $settings['target_options'] = array('_blank' => __('_blank: Opens in a new window or tab', 'wpcf'), '_self' => __('_self: Opens in the same frame as it was clicked', 'wpcf'), '_parent' => __('_parent: Opens in the parent frame', 'wpcf'), '_top' => __('_top: Opens in the full body of the window', 'wpcf'), 'framename' => __('framename: Opens in a named frame', 'wpcf'));
    return array('supports' => array('styling', 'style'), 'tabs' => array('display' => array('menu_title' => __('Display options', 'wpcf'), 'title' => __('Display options for this field:', 'wpcf'), 'content' => WPCF_Loader::template('editor-modal-url', $settings)), 'target' => array('menu_title' => __('Target', 'wpcf'), 'title' => __('Target', 'wpcf'), 'content' => '<div data-bind="template: {name:\'tpl-types-modal-url-target\'}"></div>')));
}
开发者ID:SpencerNeitzke,项目名称:types,代码行数:11,代码来源:url.php

示例2: init

 public static function init($settings = array())
 {
     self::$__settings = (array) $settings;
     self::__registerScripts();
     self::__registerStyles();
     self::__toolset();
     add_action('admin_print_scripts', array('WPCF_Loader', 'renderJsSettings'), 5);
     add_filter('the_posts', array('WPCF_Loader', 'wpcf_cache_complete_postmeta'));
 }
开发者ID:CrankMaster336,项目名称:FFW-TR,代码行数:9,代码来源:loader.php

示例3: wpcf_fields_checkboxes_editor_callback

/**
 * Editor callback form.
 */
function wpcf_fields_checkboxes_editor_callback($field, $settings)
{
    $data = array();
    if (!empty($field['data']['options'])) {
        $index = 0;
        foreach ($field['data']['options'] as $option_key => $option) {
            $data['checkboxes'][$option_key] = array('id' => $option_key, 'title' => $option['title'], 'selected' => isset($settings['options'][$index]['selected']) ? $settings['options'][$index]['selected'] : htmlspecialchars(stripslashes(strval($option['display_value_selected']))), 'not_selected' => isset($settings['options'][$index]['not_selected']) ? $settings['options'][$index]['not_selected'] : htmlspecialchars(stripslashes(strval($option['display_value_not_selected']))));
            $index++;
        }
    }
    return array('supports' => array('style'), 'tabs' => array('display' => array('menu_title' => __('Display', 'wpcf'), 'title' => __('Display', 'wpcf'), 'content' => WPCF_Loader::template('editor-modal-checkboxes', $data))));
}
开发者ID:CrankMaster336,项目名称:FFW-TR,代码行数:15,代码来源:checkboxes.php

示例4: wpcf_fields_checkbox_editor_callback

/**
 * Editor callback form.
 */
function wpcf_fields_checkbox_editor_callback($field, $settings)
{
    $value_not_selected = '';
    $value_selected = '';
    if (isset($field['data']['display_value_not_selected'])) {
        $value_not_selected = $field['data']['display_value_not_selected'];
    }
    if (isset($field['data']['display_value_selected'])) {
        $value_selected = $field['data']['display_value_selected'];
    }
    $data = array_merge(array('selected' => WPCF_Editor::sanitizeParams($value_selected), 'not_selected' => WPCF_Editor::sanitizeParams($value_not_selected)), $settings);
    return array('supports' => array('style'), 'tabs' => array('display' => array('menu_title' => __('Display', 'wpcf'), 'title' => __('Display', 'wpcf'), 'content' => WPCF_Loader::template('editor-modal-checkbox', $data))));
}
开发者ID:chrismathers,项目名称:premierplacement,代码行数:16,代码来源:checkbox.php

示例5: wpcf_fields_entry_editor_callback

/**
 * Editor callback form.
 */
function wpcf_fields_entry_editor_callback($field, $settings)
{
    $post_type = get_post_type_object($field['data']['post_type']);
    if (null == $post_type) {
        return;
    }
    $data = wpcf_fields_entry_get_options();
    foreach ($data['options'] as $key => $field_data) {
        if (wpcf_fields_entry_check_is_available($field['data']['post_type'], $field_data)) {
            continue;
        }
        unset($data['options'][$key]);
    }
    return array('supports' => array('style'), 'tabs' => array('display' => array('menu_title' => __('Display options', 'wpcf'), 'title' => __('Display options for this field:', 'wpcf'), 'content' => WPCF_Loader::template('editor-modal-entry', $data))));
}
开发者ID:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:18,代码来源:entry.php

示例6: wpcf_fields_radio_editor_callback

/**
 * Editor callback form.
 */
function wpcf_fields_radio_editor_callback($field, $data)
{
    if (!isset($data['options'])) {
        $data['options'] = array();
    }
    if (!empty($field['data']['options'])) {
        foreach ($field['data']['options'] as $option_id => $option) {
            if ($option_id == 'default') {
                continue;
            }
            if (isset($data['options'][$option_id])) {
                $value = $data['options'][$option_id];
                $data['options'][$option_id] = array('title' => $option['title'], 'value' => $value);
                continue;
            }
            $value = isset($option['display_value']) ? $option['display_value'] : $option['value'];
            $data['options'][$option_id] = array('title' => $option['title'], 'value' => $value);
        }
    }
    return array('supports' => array('style'), 'tabs' => array('display' => array('menu_title' => __('Display options', 'wpcf'), 'title' => __('Display options for this field:', 'wpcf'), 'content' => WPCF_Loader::template('editor-modal-radio', $data))));
}
开发者ID:nhainam,项目名称:wordpress4,代码行数:24,代码来源:radio.php

示例7: wpcf_fields_embed_editor_callback

/**
 * Editor callback form.
 */
function wpcf_fields_embed_editor_callback($field, $data, $meta_type, $post)
{
    // Get attachment
    $attachment_id = false;
    if (!empty($post->ID)) {
        $file = get_post_meta($post->ID, wpcf_types_get_meta_prefix($field) . $field['slug'], true);
        if (empty($file)) {
            $user_id = wpcf_usermeta_get_user();
            $file = get_user_meta($user_id, wpcf_types_get_meta_prefix($field) . $field['slug'], true);
        }
        if (!empty($file)) {
            // Get attachment by guid
            global $wpdb;
            $attachment_id = $wpdb->get_var($wpdb->prepare("SELECT ID FROM {$wpdb->posts}\n    WHERE post_type = 'attachment' AND guid=%s", $file));
        }
    }
    // Set data
    $data['attachment_id'] = $attachment_id;
    $data['file'] = !empty($file) ? $file : '';
    return array('supports' => array(), 'tabs' => array('display' => array('menu_title' => __('Display', 'wpcf'), 'title' => __('Display', 'wpcf'), 'content' => WPCF_Loader::template('editor-modal-embed', $data))), 'settings' => $data);
}
开发者ID:CrankMaster336,项目名称:FFW-TR,代码行数:24,代码来源:embed.php

示例8: 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

示例9: evaluate


//.........这里部分代码省略.........
                 remove_filter('get_post_metadata', array('WPCF_Evaluate', 'relationship_custom_statement_meta_ajax_validation_filter'), 10, 4);
             } else {
                 remove_filter('get_post_metadata', array('WPCF_Evaluate', 'meta_ajax_validation_filter'), 10, 4);
             }
         } else {
             /*
              * 
              * 
              * 
              * 
              * 
              * 
              * 
              * 
              * TYPES
              * 
              * If not custom code, use Types built-in check.
              * wpcf_cd_admin_compare()
              */
             $passed_all = true;
             $passed_one = false;
             // Basic check
             if (empty($field['data']['conditional_display']['conditions'])) {
                 return false;
             }
             // Keep count to see if OR/AND relation needed
             $count = count($field['data']['conditional_display']['conditions']);
             foreach ($field['data']['conditional_display']['conditions'] as $condition) {
                 /*
                  * 
                  * 
                  * Malformed condition and should be treated as forbidden
                  */
                 if (!isset($condition['field']) || !isset($condition['operation']) || !isset($condition['value'])) {
                     $passed_one = false;
                     continue;
                 }
                 /*
                  * 
                  * 
                  * This field value is checked
                  */
                 $f = wpcf_admin_fields_get_field(trim(strval($condition['field'])));
                 if (empty($f)) {
                     return false;
                 }
                 $c = new WPCF_Field();
                 $c->set($post, $f);
                 /*
                  * 
                  * Since Types 1.2
                  * meta is property of WPCF_Field::$__meta
                  * 
                  * BREAKPOINT
                  * This is where values for evaluation are set.
                  * Please do not allow other places - use hooks.
                  * 
                  * TODO Monitor this
                  * 1.3 Change use of $c->_get_meta( 'POST' )
                  * to $c->get_submitted_data()
                  */
                 //                $value = defined( 'DOING_AJAX' ) ? $c->_get_meta( 'POST' ) : $c->__meta;
                 $value = defined('DOING_AJAX') ? $c->get_submitted_data() : $c->__meta;
                 /*
                  * 
                  * Apply filters
                  */
                 $value = apply_filters('wpcf_conditional_display_compare_meta_value', $value, $c->cf['id'], $condition['operation'], $c->slug, $post);
                 $condition['value'] = apply_filters('wpcf_conditional_display_compare_condition_value', $condition['value'], $c->cf['id'], $condition['operation'], $c->slug, $post);
                 /*
                  * 
                  * 
                  * Call built-in Types compare func
                  */
                 WPCF_Loader::loadInclude('conditional-display');
                 $passed = wpcf_cd_admin_compare($condition['operation'], $value, $condition['value']);
                 if (!$passed) {
                     $passed_all = false;
                 } else {
                     $passed_one = true;
                 }
             }
             /*
              * 
              * 
              * Check OR/AND relation
              */
             if ($count > 1) {
                 if ($field['data']['conditional_display']['relation'] == 'AND') {
                     $passed = $passed_all;
                 } else {
                     if ($field['data']['conditional_display']['relation'] == 'OR') {
                         $passed = $passed_one;
                     }
                 }
             }
         }
     }
     return (bool) $passed;
 }
开发者ID:sonvq,项目名称:passioninvestment,代码行数:101,代码来源:evaluate.php

示例10: wpcf_fields_date_editor_callback

/**
 * TinyMCE editor form.
 */
function wpcf_fields_date_editor_callback($field, $settings)
{
    $data = array('date_formats' => array());
    $date_formats = apply_filters('date_formats', array(__('F j, Y', 'wpcf'), 'Y/m/d', 'm/d/Y', 'd/m/Y', 'd/m/y'));
    // Custom format
    $data['custom'] = isset($settings['custom']) ? $settings['custom'] : get_option('date_format');
    /**
     * date with hour and minutes
     */
    if (isset($field['data']) && isset($field['data']['date_and_time']) && 'and_time' == $field['data']['date_and_time']) {
        $date_formats = apply_filters('date_formats', array(__('F j, Y g:i a', 'wpcf'), 'Y/m/d g:i a', 'm/d/Y h:i a', 'd/m/Y G:i', 'd/m/y H:i'));
        // Custom format
        $data['custom'] = sprintf('%s %s', get_option('date_format'), get_option('time_format'));
    }
    $data['default'] = 'custom';
    foreach ($date_formats as $k => $format) {
        $title = date($format, time());
        $data['date_formats'][$k] = array('id' => sanitize_title($format), 'title' => $title, 'format' => $format, 'default' => isset($settings['format']) && $format == $settings['format'] ? true : false);
        if ($data['date_formats'][$k]['default']) {
            $data['default'] = $data['date_formats'][$k]['id'];
        }
    }
    return array('supports' => array('styling'), 'tabs' => array('display' => array('menu_title' => __('Display options', 'wpcf'), 'title' => __('Display options for this field:', 'wpcf'), 'content' => WPCF_Loader::template('editor-modal-date', $data))));
}
开发者ID:axeljohansson1988,项目名称:oddcv,代码行数:27,代码来源:date.php

示例11: conditionalVerify

 /**
  * Process AJAX conditional verify.
  * 
  * @global type $wpcf
  * @param type $data
  * @return boolean|string
  */
 public static function conditionalVerify($data)
 {
     WPCF_Loader::loadInclude('fields');
     WPCF_Loader::loadInclude('fields-post');
     WPCF_Loader::loadInclude('conditional-display');
     global $wpcf;
     $js_execute = '';
     $_flag_relationship = false;
     /*
      * 
      * Determine post.
      */
     if (empty($data['wpcf']) && !empty($data['wpcf_post_relationship'])) {
         /*
          * Relationship case
          */
         $_temp = $data['wpcf_post_relationship'];
         $parent_id = key($_temp);
         $_data = array_shift($_temp);
         $post_id = key($_data);
         $post = get_post($post_id);
         $posted_fields = $_data[$post_id];
         $_flag_relationship = true;
         /*
          * 
          * Regular submission
          */
     } else {
         if (isset($data['wpcf_main_post_id'])) {
             $post_id = intval($data['wpcf_main_post_id']);
             $post = get_post($post_id);
         }
     }
     // No post
     if (empty($post->ID)) {
         return false;
     }
     // Get Groups (Fields) for current post
     $groups = wpcf_admin_post_get_post_groups_fields($post);
     $_processed = array();
     foreach ($groups as $group) {
         if (!empty($group['fields'])) {
             foreach ($group['fields'] as $field_id => $field) {
                 // Check if already processed
                 if (isset($_processed[$field_id])) {
                     continue;
                 }
                 if ($wpcf->conditional->is_conditional($field_id)) {
                     if ($_flag_relationship) {
                         // Process only submitted fields
                         if (!isset($posted_fields[WPCF_META_PREFIX . $field_id])) {
                             continue;
                         }
                         $wpcf->conditional->set($post, $field_id);
                         $wpcf->conditional->context = 'relationship';
                         $_relationship_name = false;
                         // Set name and other values processed by hooks
                         $parent = get_post($parent_id);
                         if (!empty($parent->ID)) {
                             $wpcf->relationship->set($parent, $post);
                             $wpcf->relationship->cf->set($post, $field_id);
                             $_child = $wpcf->relationship->get_child();
                             $_child->form->cf->set($post, $field_id);
                             $_relationship_name = $_child->form->alter_form_name('wpcf[' . $wpcf->conditional->cf['id'] . ']');
                         }
                         if (!$_relationship_name) {
                             continue;
                         }
                         /*
                          * BREAKPOINT
                          * Adds filtering regular evaluation (not wpv_conditional)
                          */
                         add_filter('types_field_get_submitted_data', 'wpcf_relationship_ajax_data_filter', 10, 2);
                         $name = $_relationship_name;
                     } else {
                         $wpcf->conditional->set($post, $field_id);
                         $name = 'wpcf[' . $wpcf->conditional->cf['id'] . ']';
                     }
                     // Evaluate
                     $passed = $wpcf->conditional->evaluate();
                     if ($passed) {
                         $js_execute .= 'jQuery(\'[name^="' . $name . '"]\').parents(\'.' . 'wpcf-conditional' . '\').show().removeClass(\'' . 'wpcf-conditional' . '-failed\').addClass(\'' . 'wpcf-conditional' . '-passed\');' . " ";
                         $js_execute .= 'jQuery(\'[name^="' . $name . '"]\').parents(\'.wpcf-repetitive-wrapper\').show();';
                     } else {
                         $js_execute .= 'jQuery(\'[name^="' . $name . '"]\').parents(\'.wpcf-repetitive-wrapper\').hide();';
                         $js_execute .= 'jQuery(\'[name^="' . $name . '"]\').parents(\'.' . 'wpcf-conditional' . '\').hide().addClass(\'' . 'wpcf-conditional' . '-failed\').removeClass(\'' . 'wpcf-conditional' . '-passed\');' . " ";
                     }
                 }
                 $_processed[$field_id] = true;
             }
         }
     }
     return $js_execute;
//.........这里部分代码省略.........
开发者ID:santikrass,项目名称:apache,代码行数:101,代码来源:helper.ajax.php

示例12: wpcf_ajax_embedded

/**
 * All AJAX calls go here.
 *
 * @todo auth
 */
function wpcf_ajax_embedded()
{
    if (isset($_REQUEST['_typesnonce'])) {
        if (!wp_verify_nonce($_REQUEST['_typesnonce'], '_typesnonce')) {
            die('Verification failed');
        }
    } else {
        if (!isset($_REQUEST['_wpnonce']) || !wp_verify_nonce($_REQUEST['_wpnonce'], $_REQUEST['wpcf_action'])) {
            die('Verification failed');
        }
    }
    global $wpcf;
    switch ($_REQUEST['wpcf_action']) {
        case 'insert_skype_button':
            if (!current_user_can('edit_posts')) {
                die('Authentication failed');
            }
            require_once WPCF_EMBEDDED_INC_ABSPATH . '/fields/skype.php';
            wpcf_fields_skype_meta_box_ajax();
            break;
        case 'editor_callback':
            if (!current_user_can('edit_posts')) {
                die('Authentication failed');
            }
            // Determine Field type and context
            $views_usermeta = false;
            $field_id = sanitize_text_field($_GET['field_id']);
            // todo this could be written in like four lines
            if (isset($_GET['field_type']) && $_GET['field_type'] == 'usermeta') {
                // Group filter
                wp_enqueue_script('suggest');
                $field = types_get_field($field_id, 'usermeta');
                $meta_type = 'usermeta';
            } elseif (isset($_GET['field_type']) && $_GET['field_type'] == 'views-usermeta') {
                $field = types_get_field($field_id, 'usermeta');
                $meta_type = 'usermeta';
                $views_usermeta = true;
            } else {
                $field = types_get_field($field_id);
                $meta_type = 'postmeta';
            }
            $parent_post_id = isset($_GET['post_id']) ? intval($_GET['post_id']) : null;
            $shortcode = isset($_GET['shortcode']) ? urldecode($_GET['shortcode']) : null;
            $callback = isset($_GET['callback']) ? sanitize_text_field($_GET['callback']) : false;
            if (!empty($field)) {
                // Editor
                WPCF_Loader::loadClass('editor');
                $editor = new WPCF_Editor();
                $editor->frame($field, $meta_type, $parent_post_id, $shortcode, $callback, $views_usermeta);
            }
            break;
        case 'dismiss_message':
            if (!is_user_logged_in()) {
                die('Authentication failed');
            }
            if (isset($_GET['id'])) {
                $messages = get_option('wpcf_dismissed_messages', array());
                $messages[] = sanitize_text_field($_GET['id']);
                update_option('wpcf_dismissed_messages', $messages);
            }
            break;
        case 'pr_add_child_post':
            $output = 'Passed wrong parameters';
            if (current_user_can('edit_posts') && isset($_GET['post_id']) && isset($_GET['post_type_child']) && isset($_GET['post_type_parent'])) {
                $relationships = get_option('wpcf_post_relationship', array());
                $parent_post_id = intval($_GET['post_id']);
                $parent_post = get_post($parent_post_id);
                if (!empty($parent_post->ID)) {
                    $post_type = sanitize_text_field($_GET['post_type_child']);
                    $parent_post_type = sanitize_text_field($_GET['post_type_parent']);
                    // @todo isset & error handling
                    $data = $relationships[$parent_post_type][$post_type];
                    /*
                     * Since Types 1.1.5
                     * 
                     * We save new post
                     * CHECKPOINT
                     */
                    $id = $wpcf->relationship->add_new_child($parent_post->ID, $post_type);
                    if (is_wp_error($id)) {
                        $output = $id->get_error_message();
                    } else {
                        /*
                         * Here we set Relationship
                         * CHECKPOINT
                         */
                        $parent = get_post($parent_post_id);
                        $child = get_post($id);
                        if (!empty($parent->ID) && !empty($child->ID)) {
                            // Set post
                            $wpcf->post = $child;
                            // Set relationship :)
                            $wpcf->relationship->_set($parent, $child, $data);
                            // Render new row
                            $output = $wpcf->relationship->child_row($parent_post->ID, $id, $data);
//.........这里部分代码省略.........
开发者ID:KryvunRoman,项目名称:yobko,代码行数:101,代码来源:ajax.php

示例13: wpcf_cd_admin_form_single_filter

/**
 * Single condition form elements.
 *
 * @param type $data
 * @param type $condition
 * @param type $key
 * @return string
 */
function wpcf_cd_admin_form_single_filter($data, $condition, $key = null, $group = false, $force_multi = false)
{
    global $wpcf;
    if ($group) {
        $name = 'wpcf[group][conditional_display]';
    } else {
        $name = 'wpcf[fields][' . $data['id'] . '][conditional_display]';
    }
    $group_id = isset($_GET['group_id']) ? intval($_GET['group_id']) : false;
    /*
     *
     *
     * TODO Review this allowing fields from same group as conditional (self loop)
     * I do not remember allowing fields from same group as conditional (self loop)
     * on Group Fields edit screen.
     */
    //    if ( $group_id && !$group ) {// Allow group to use other fields
    //        $fields = wpcf_admin_fields_get_fields_by_group( $group_id );
    //    } else {
    $fields = wpcf_admin_fields_get_fields(true, false, true);
    ksort($fields, SORT_STRING);
    //    }
    if ($group) {
        $_distinct = wpcf_admin_fields_get_fields_by_group($group_id);
        foreach ($_distinct as $_field_id => $_field) {
            if (isset($fields[$_field_id])) {
                unset($fields[$_field_id]);
            }
        }
    }
    $options = array();
    $ignore_field_type_array = array('audio', 'checkboxes', 'embed', 'file', 'image', 'video', 'wysiwyg');
    $flag_repetitive = false;
    foreach ($fields as $field_id => $field) {
        if (!$group && $data['id'] == $field_id) {
            continue;
        }
        // WE DO NOT ALLOW repetitive fields to be compared.
        if (wpcf_admin_is_repetitive($field)) {
            $flag_repetitive = true;
            continue;
        }
        /**
         * Skip some files
         */
        if (in_array($field['type'], $ignore_field_type_array)) {
            continue;
        }
        /**
         * build options
         */
        $options[$field_id] = array('#value' => $field_id, '#title' => stripslashes($field['name']), '#attributes' => array('class' => 'wpcf-conditional-select-' . $field['type']));
    }
    /*
     * Special case
     * https://icanlocalize.basecamphq.com/projects/7393061-wp-views/todo_items/153565054/comments
     *
     * When field is new and only one diff field in list - that
     * means one field is saved but other not yet.
     */
    $is_new = isset($data['id']) && isset($fields[$data['id']]) ? false : true;
    $special_stop = false;
    if ($is_new) {
        if (count($options) == 1) {
            $special_stop = true;
        }
    }
    /*
     *
     * This means all fields are repetitive and no one left to compare with.
     * WE DO NOT ALLOW repetitive fields to be compared.
     */
    if (!$group && empty($options) && $flag_repetitive) {
        return array('cd' => array('#type' => 'markup', '#markup' => '<p class="wpcf-error">' . __('Conditional display is only working based on non-repeating fields. All fields in this group are repeating, so you cannot set their display based on other fields.', 'wpcf') . '</p>' . wpcf_conditional_disable_add_js($data['id'])));
    } else {
        if (!$group && (empty($options) || $special_stop)) {
            return array('cd' => array('#type' => 'markup', '#markup' => '<p>' . __('You will be able to set conditional field display when you save more fields.', 'wpcf') . '</p>'));
        }
    }
    $id = !is_null($key) ? $key : strval('condition_' . wpcf_unique_id(serialize($data) . serialize($condition) . $key . $group));
    $form = array();
    $before = '<div class="wpcf-cd-entry"><br />';
    $form['cd']['field_' . $id] = array('#type' => 'select', '#name' => $name . '[conditions][' . $id . '][field]', '#options' => $options, '#inline' => true, '#before' => $before, '#default_value' => isset($condition['field']) ? $condition['field'] : null, '#attributes' => array('class' => 'wpcf-cd-field'));
    $form['cd']['operation_' . $id] = array('#type' => 'select', '#name' => $name . '[conditions][' . $id . '][operation]', '#options' => array_flip(wpcf_cd_admin_operations()), '#inline' => true, '#default_value' => isset($condition['operation']) ? $condition['operation'] : null, '#attributes' => array('class' => 'wpcf-cd-operation'));
    $form['cd']['value_' . $id] = array('#type' => 'textfield', '#name' => $name . '[conditions][' . $id . '][value]', '#inline' => true, '#value' => isset($condition['value']) ? $condition['value'] : '', '#attributes' => array('class' => 'wpcf-cd-value'));
    /*
     *
     * Adjust for date
     */
    if (!empty($condition['value'])) {
        WPCF_Loader::loadInclude('fields/date/functions.php');
        $timestamp = wpcf_fields_date_convert_datepicker_to_timestamp($condition['value']);
//.........这里部分代码省略.........
开发者ID:CrankMaster336,项目名称:FFW-TR,代码行数:101,代码来源:conditional-display.php

示例14: evaluate

 /**
  * Evaluates if check passed.
  *
  * @return type
  */
 function evaluate()
 {
     WPCF_Loader::loadClass('evaluate');
     $this->passed = WPCF_Evaluate::evaluate($this);
     return $this->passed;
 }
开发者ID:zoran180,项目名称:wp_szf,代码行数:11,代码来源:conditional.php

示例15: wpcf_fields_skype_meta_box_ajax

/**
 * Edit Skype button AJAX call.
 */
function wpcf_fields_skype_meta_box_ajax()
{
    if (isset($_POST['_wpnonce_wpcf_form']) && wp_verify_nonce($_POST['_wpnonce_wpcf_form'], 'wpcf-form')) {
        add_action('admin_head_wpcf_ajax', 'wpcf_fields_skype_meta_box_submit');
    }
    wp_enqueue_script('jquery');
    wpcf_admin_ajax_head(__('Insert skype button', 'wpcf'));
    ?>
    <form method="post" action="">
        <h2><?php 
    _e('Enter your Skype Name', 'wpcf');
    ?>
</h2>
        <p>
            <input id="btn-skypename" name="skypename" value="<?php 
    esc_attr_e($_GET['skypename']);
    ?>
" type="text" />
        </p>
        <?php 
    echo WPCF_Loader::template('skype-select-button', $_GET);
    ?>
        <?php 
    wp_nonce_field('wpcf-form', '_wpnonce_wpcf_form');
    ?>
        <br /><br />
        <input type="submit" class="button-primary" value="<?php 
    _e('Insert skype button', 'wpcf');
    ?>
" />
    </form>
    <?php 
    $update = esc_attr($_GET['update']);
    ?>
    <script type="text/javascript">
        //<![CDATA[
        jQuery(document).ready(function(){
            jQuery('#btn-skypename').val(window.parent.jQuery('#<?php 
    echo $update;
    ?>
-skypename').val());
        });
        //]]>
    </script>
    <?php 
    wpcf_admin_ajax_footer();
}
开发者ID:SpencerNeitzke,项目名称:types,代码行数:50,代码来源:skype.php


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