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

PHP wpcf_unique_id函数代码示例

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

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



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

示例1: wpcf_fields_skype_meta_box_form

/**
 * Form data for post edit page.
 *
 * @param type $field
 */
function wpcf_fields_skype_meta_box_form($field)
{
    add_thickbox();
    if (isset($field['value'])) {
        $field['value'] = maybe_unserialize($field['value']);
    }
    $form = array();
    add_filter('wpcf_fields_shortcode_slug_' . $field['slug'], 'wpcf_fields_skype_shortcode_filter', 10, 2);
    $rand = wpcf_unique_id(serialize($field));
    $form['skypename'] = array('#type' => 'textfield', '#value' => isset($field['value']['skypename']) ? $field['value']['skypename'] : '', '#name' => 'wpcf[' . $field['slug'] . '][skypename]', '#id' => 'wpcf-fields-skype-' . $field['slug'] . '-' . $rand . '-skypename', '#inline' => true, '#suffix' => '&nbsp;' . __('Skype name', 'wpcf'), '#description' => '', '#prefix' => !empty($field['description']) ? wpcf_translate('field ' . $field['id'] . ' description', $field['description']) . '<br /><br />' : '', '#attributes' => array('style' => 'width:60%;'), '#_validate_this' => true, '#before' => '<div class="wpcf-skype">');
    $form['style'] = array('#type' => 'hidden', '#value' => isset($field['value']['style']) ? $field['value']['style'] : 'btn2', '#name' => 'wpcf[' . $field['slug'] . '][style]', '#id' => 'wpcf-fields-skype-' . $field['slug'] . '-' . $rand . '-style');
    $preview_skypename = !empty($field['value']['skypename']) ? $field['value']['skypename'] : '--not--';
    $preview_style = !empty($field['value']['style']) ? $field['value']['style'] : 'btn2';
    $preview = wpcf_fields_skype_get_button_image($preview_skypename, $preview_style);
    // Set button
    // TODO WPML move
    if (isset($field['disable']) || wpcf_wpml_field_is_copied($field)) {
        $edit_button = '';
    } else {
        $edit_button = '' . '<a href="' . admin_url('admin-ajax.php?action=wpcf_ajax&amp;' . 'wpcf_action=insert_skype_button&amp;_wpnonce=' . wp_create_nonce('insert_skype_button') . '&amp;update=wpcf-fields-skype-' . $field['slug'] . '-' . $rand . '&amp;skypename=' . $preview_skypename . '&amp;button_style=' . $preview_style . '&amp;keepThis=true&amp;TB_iframe=true&amp;width=500&amp;height=500') . '"' . ' class="thickbox wpcf-fields-skype button-secondary"' . ' title="' . __('Edit Skype button', 'wpcf') . '"' . '>' . __('Edit Skype button', 'wpcf') . '</a>';
    }
    $form['markup'] = array('#type' => 'markup', '#markup' => '<div class="wpcf-form-item">' . '<div id="wpcf-fields-skype-' . $field['slug'] . '-' . $rand . '-preview">' . $preview . '</div>' . $edit_button . '</div>');
    $form['markup-close'] = array('#type' => 'markup', '#markup' => '</div>');
    return $form;
}
开发者ID:SpencerNeitzke,项目名称:types,代码行数:30,代码来源:skype.php


示例2: wpcf_fields_checkboxes_meta_box_form

/**
 * Form data for post edit page.
 * 
 * @param type $field 
 */
function wpcf_fields_checkboxes_meta_box_form($field, $data)
{
    $options = array();
    if (!empty($field['data']['options'])) {
        global $pagenow;
        foreach ($field['data']['options'] as $option_key => $option) {
            // Set value
            $options[$option_key] = array('#value' => $option['set_value'], '#title' => wpcf_translate('field ' . $field['id'] . ' option ' . $option_key . ' title', $option['title']), '#default_value' => !empty($data['#value'][$option_key]) || $pagenow == 'post-new.php' && !empty($option['checked']) ? 1 : 0, '#name' => 'wpcf[' . $field['id'] . '][' . $option_key . ']', '#id' => $option_key . '_' . wpcf_unique_id(serialize($field) . serialize($data)));
        }
    }
    return array('#type' => 'checkboxes', '#options' => $options);
}
开发者ID:dewavi,项目名称:occupysandy.net,代码行数:17,代码来源:checkboxes.php


示例3: wpcf_fields_select_get_option

function wpcf_fields_select_get_option($parent_name = '', $form_data = array())
{
    $id = isset($form_data['key']) ? $form_data['key'] : 'wpcf-fields-select-option-' . wpcf_unique_id(serialize($form_data));
    $form = array();
    $value = isset($_GET['count']) ? __('Option title', 'wpcf') . ' ' . intval($_GET['count']) : __('Option title', 'wpcf') . ' 1';
    $value = isset($form_data['title']) ? $form_data['title'] : $value;
    $form[$id . '-title'] = array('#type' => 'textfield', '#id' => $id . '-title', '#name' => $parent_name . '[options][' . $id . '][title]', '#value' => $value, '#inline' => true, '#attributes' => array('placeholder' => __('Title', 'wpcf')), '#before' => sprintf('<span class="js-types-sortable hndle"><i title="%s" class="js-types-sort-button fa fa-arrows-v"></i></span>', esc_attr__('Move this option', 'wpcf')), '#pattern' => '<tr><td class="num"><BEFORE></td><td><ELEMENT><AFTER></td>');
    $value = isset($_GET['count']) ? intval($_GET['count']) : 1;
    $value = isset($form_data['value']) ? $form_data['value'] : $value;
    $form[$id . '-value'] = array('#type' => 'textfield', '#id' => $id . '-value', '#name' => $parent_name . '[options][' . $id . '][value]', '#value' => $value, '#inline' => true, '#attributes' => array('class' => 'wpcf-compare-unique-value', 'placeholder' => __('Value', 'wpcf')), '#pattern' => '<td><BEFORE><ELEMENT><AFTER></td>');
    $form[$id . '-default'] = array('#type' => 'radio', '#id' => $id . '-default', '#inline' => true, '#title' => __('Default', 'wpcf'), '#after' => '</div>', '#name' => $parent_name . '[options][default]', '#value' => $id, '#default_value' => isset($form_data['default']) ? $form_data['default'] : false, '#pattern' => '<td class="num"><BEFORE><ELEMENT></td><td class="num"><AFTER></td></tr>', '#after' => sprintf('<span><a href="#" class="js-wpcf-button-delete" data-message-delete-confirm="%s" data-id="%s"><i title="%s" class="fa fa-trash"></i></span>', esc_attr__('Are you sure?', 'wpcf'), esc_attr(sprintf('%s-title-display-value-wrapper', $id)), esc_attr__('Delete this option', 'wpcf')));
    return $form;
}
开发者ID:phuocdungit,项目名称:fundy,代码行数:13,代码来源:select.php


示例4: wpcf_fields_select_get_option

function wpcf_fields_select_get_option($parent_name = '', $form_data = array())
{
    $id = isset($form_data['key']) ? $form_data['key'] : 'wpcf-fields-select-option-' . wpcf_unique_id(serialize($form_data));
    $form = array();
    $value = isset($_GET['count']) ? __('Option title', 'wpcf') . ' ' . intval($_GET['count']) : __('Option title', 'wpcf') . ' 1';
    $value = isset($form_data['title']) ? $form_data['title'] : $value;
    $form[$id . '-title'] = array('#type' => 'textfield', '#id' => $id . '-title', '#name' => $parent_name . '[options][' . $id . '][title]', '#value' => $value, '#inline' => true, '#attributes' => array('style' => 'width:80px;', 'placeholder' => __('Title', 'wpcf')), '#before' => '<div class="js-types-sortable"><img src="' . WPCF_RES_RELPATH . '/images/move.png" class="js-types-sort-button" alt="' . __('Move this option', 'wpcf') . '" /><img src="' . WPCF_RES_RELPATH . '/images/delete.png"' . ' class="wpcf-fields-select-delete-option wpcf-pointer"' . ' onclick="if (confirm(\'' . __('Are you sure?', 'wpcf') . '\')) { jQuery(this).parent().fadeOut(function(){jQuery(this).remove();}); }"' . 'alt="' . __('Delete this option', 'wpcf') . '" />');
    $value = isset($_GET['count']) ? intval($_GET['count']) : 1;
    $value = isset($form_data['value']) ? $form_data['value'] : $value;
    $form[$id . '-value'] = array('#type' => 'textfield', '#id' => $id . '-value', '#name' => $parent_name . '[options][' . $id . '][value]', '#value' => $value, '#inline' => true, '#attributes' => array('style' => 'width:80px;', 'class' => 'wpcf-compare-unique-value', 'placeholder' => __('Value', 'wpcf')));
    $form[$id . '-default'] = array('#type' => 'radio', '#id' => $id . '-default', '#inline' => true, '#title' => __('Default', 'wpcf'), '#after' => '</div>', '#name' => $parent_name . '[options][default]', '#value' => $id, '#default_value' => isset($form_data['default']) ? $form_data['default'] : false);
    return $form;
}
开发者ID:olechka1505,项目名称:hungrylemur,代码行数:13,代码来源:select.php


示例5: wpcf_fields_radio_get_option

/**
 * Returns form data for radio.
 * 
 * @param type $parent_name Used for AJAX adding options
 * @param type $form_data
 * @return type 
 */
function wpcf_fields_radio_get_option($parent_name = '', $form_data = array())
{
    $id = isset($form_data['key']) ? $form_data['key'] : 'wpcf-fields-radio-option-' . wpcf_unique_id(serialize($form_data));
    $form = array();
    $value = isset($_GET['count']) ? __('Option title', 'wpcf') . ' ' . $_GET['count'] : __('Option title', 'wpcf') . ' 1';
    $value = isset($form_data['title']) ? $form_data['title'] : $value;
    $form[$id . '-id'] = $id;
    $form[$id . '-title'] = array('#type' => 'textfield', '#id' => $id . '-title', '#name' => $parent_name . '[options][' . $id . '][title]', '#value' => $value, '#inline' => true, '#attributes' => array('style' => 'width:80px;', 'class' => 'wpcf-form-groups-radio-update-title-display-value'), '#before' => '<div class="wpcf-fields-radio-draggable"><img src="' . WPCF_RES_RELPATH . '/images/move.png" class="wpcf-fields-form-radio-move-field" alt="' . __('Move this option', 'wpcf') . '" /><img src="' . WPCF_RES_RELPATH . '/images/delete.png"' . ' class="wpcf-fields-radio-delete-option wpcf-pointer"' . ' onclick="if (confirm(\'' . __('Are you sure?', 'wpcf') . '\')) { jQuery(this).parent().fadeOut(function(){jQuery(this).remove(); ' . '}); ' . 'jQuery(\'#\'+jQuery(this).parent().find(\'input\').attr(\'id\')+\'' . '-display-value-wrapper\').fadeOut(function(){jQuery(this).remove();}); }"' . 'alt="' . __('Delete this option', 'wpcf') . '" />');
    $value = isset($_GET['count']) ? $_GET['count'] : 1;
    $value = isset($form_data['value']) ? $form_data['value'] : $value;
    $form[$id . '-value'] = array('#type' => 'textfield', '#id' => $id . '-value', '#name' => $parent_name . '[options][' . $id . '][value]', '#value' => $value, '#inline' => true, '#attributes' => array('style' => 'width:80px;', 'class' => 'wpcf-compare-unique-value'));
    $form[$id . '-default'] = array('#type' => 'radio', '#id' => $id . '-default', '#inline' => true, '#title' => __('Default', 'wpcf'), '#after' => '</div>', '#name' => $parent_name . '[options][default]', '#value' => $id, '#default_value' => isset($form_data['default']) ? $form_data['default'] : '');
    return $form;
}
开发者ID:dewavi,项目名称:occupysandy.net,代码行数:21,代码来源:radio.php


示例6: wpcf_fields_file_meta_box_form

/**
 * Form data for post edit page.
 *
 * @global object $wpdb
 *
 * @param type $field
 */
function wpcf_fields_file_meta_box_form($field)
{
    add_thickbox();
    $button_text = sprintf(__('Select %s', 'wpcf'), $field['type']);
    // Set ID
    $element_id = 'wpcf-fields-' . wpcf_unique_id(serialize(func_get_args()));
    $attachment_id = false;
    // Get attachment by guid
    global $wpdb;
    if (!empty($field['value'])) {
        $attachment_id = $wpdb->get_var($wpdb->prepare("SELECT ID FROM {$wpdb->posts} WHERE post_type = 'attachment' AND guid=%s", $field['value']));
    }
    // Set preview
    $preview = '';
    // TODO WPML move
    if (!wpcf_wpml_field_is_copied($field)) {
        if (!empty($attachment_id)) {
            $preview = wp_get_attachment_image($attachment_id, 'thumbnail');
        } else {
            // If external image set preview
            $file_path = parse_url($field['value']);
            if ($file_path && isset($file_path['path'])) {
                $file = pathinfo($file_path['path']);
            } else {
                $file = pathinfo($field['value']);
            }
            if (isset($file['extension']) && in_array(strtolower($file['extension']), array('jpg', 'jpeg', 'gif', 'png'))) {
                $preview = '<img alt="" src="' . $field['value'] . '" />';
            }
        }
    }
    // Set button
    // TODO WPML move
    if (!wpcf_wpml_field_is_copied($field)) {
        if (!empty($field['#attributes']['readonly']) || !empty($field['#attributes']['disabled'])) {
            $button = '';
        } else {
            $button = '<a href="javascript:void(0);"' . ' class="wpcf-fields-' . ($field['type'] == 'image' ? 'image' : 'file') . '-upload-link button-secondary"' . ' id="' . $element_id . '-upload" ' . "data-types='{\"type\":\"{$field['type']}\",\"id\":\"{$field['id']}\"}'>" . $button_text . '</a>';
        }
    } else {
        $button = '';
    }
    // Set form
    $form = array('#type' => 'textfield', '#id' => $element_id . '-upload-holder', '#name' => 'wpcf[' . $field['slug'] . ']', '#suffix' => '&nbsp;' . $button, '#after' => '<div id="' . $element_id . '-upload-holder-preview"' . ' class="wpcf-fields-file-preview">' . $preview . '</div>', '#attributes' => array('class' => 'wpcf-fields-file-textfield'));
    return $form;
}
开发者ID:olechka1505,项目名称:hungrylemur,代码行数:53,代码来源:file.php


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


示例8: wpcf_admin_usermeta_form


//.........这里部分代码省略.........
        $options[$role]['#inline'] = TRUE;
        $options[$role]['#suffix'] = '<br />';
        $options[$role]['#id'] = 'wpcf-form-groups-show-for-' . $role;
        $options[$role]['#attributes'] = array('class' => 'wpcf-form-groups-support-post-type');
        if ($update && !empty($update['show_for']) && in_array($role, $update['show_for'])) {
            $users_currently_supported[] = ucwords($role);
        }
    }
    if (empty($users_currently_supported)) {
        $users_currently_supported[] = __('Displayed for all users roles', 'wpcf');
    }
    /*
     * Show for FILTER
     */
    $temp = array('#type' => 'checkboxes', '#options' => $options, '#name' => 'wpcf[group][supports]', '#inline' => true);
    /*
     * 
     * Here we use unique function for all filters
     * Since Types 1.1.4
     */
    $form_users = _wpcf_filter_wrap('custom_post_types', __('Show For:', 'wpcf'), implode(', ', $users_currently_supported), __('Displayed for all users roles', 'wpcf'), $temp);
    /*
     * Now starting form
     */
    $access_notification = '';
    if (function_exists('wpcf_access_register_caps')) {
        $access_notification = '<div class="message custom wpcf-notif"><span class="wpcf-notif-congrats">' . __('This groups visibility is also controlled by the Access plugin.', 'wpcf') . '</span></div>';
    }
    $form['supports-table-open'] = array('#type' => 'markup', '#markup' => '<table class="widefat"><thead><tr><th>' . __('Where to display this group', 'wpcf') . '</th></tr></thead><tbody><tr><td>' . '<p>' . __('Each usermeta group can display different fields for user roles.', 'wpcf') . $access_notification . '</p>');
    /*
     * Join filter forms
     */
    // User Roles
    $form['p_wrap_1_' . wpcf_unique_id(serialize($form_users))] = array('#type' => 'markup', '#markup' => '<p class="wpcf-filter-wrap">');
    $form = $form + $form_users;
    $form['supports-table-close'] = array('#type' => 'markup', '#markup' => '</td></tr></tbody></table><br />');
    /** Admin styles**/
    $form['adminstyles-table-open'] = array('#type' => 'markup', '#markup' => '<table class="widefat" id="wpcf-admin-styles-box"><thead><tr><th>' . __('Styling Editor', 'wpcf') . '</th></tr></thead><tbody><tr><td>' . '<p>' . __('Customize Fields for admin panel.', 'wpcf') . '</p>');
    $admin_styles_value = $preview_profile = $edit_profile = '';
    if (isset($update['admin_styles'])) {
        $admin_styles_value = $update['admin_styles'];
    }
    $temp = '';
    if ($update) {
        require_once WPCF_EMBEDDED_INC_ABSPATH . '/fields.php';
        require_once WPCF_EMBEDDED_INC_ABSPATH . '/usermeta.php';
        require_once WPCF_EMBEDDED_INC_ABSPATH . '/fields-post.php';
        require_once WPCF_EMBEDDED_INC_ABSPATH . '/usermeta-post.php';
        $user_id = wpcf_usermeta_get_user();
        $preview_profile = wpcf_usermeta_preview_profile($user_id, $update, 1);
        $group = $update;
        $group['fields'] = wpcf_admin_usermeta_process_fields($user_id, $group['fields'], true, false);
        $edit_profile = wpcf_admin_render_fields($group, $user_id, 1);
        add_action('admin_enqueue_scripts', 'wpcf_admin_fields_form_fix_styles', PHP_INT_MAX);
    }
    $temp[] = array('#type' => 'radio', '#suffix' => '<br />', '#value' => 'edit_mode', '#title' => 'Edit mode', '#name' => 'wpcf[group][preview]', '#default_value' => '', '#before' => '<div class="wpcf-admin-css-preview-style-edit">', '#inline' => true, '#attributes' => array('onclick' => 'changePreviewHtml(\'editmode\')', 'checked' => 'checked'));
    $temp[] = array('#type' => 'radio', '#title' => 'Read Only', '#name' => 'wpcf[group][preview]', '#default_value' => '', '#after' => '</div>', '#inline' => true, '#attributes' => array('onclick' => 'changePreviewHtml(\'readonly\')'));
    $temp[] = array('#type' => 'textarea', '#name' => 'wpcf[group][admin_html_preview]', '#inline' => true, '#value' => '', '#id' => 'wpcf-form-groups-admin-html-preview', '#before' => '<h3>Field group HTML</h3>');
    $temp[] = array('#type' => 'textarea', '#name' => 'wpcf[group][admin_styles]', '#inline' => true, '#value' => $admin_styles_value, '#default_value' => '', '#id' => 'wpcf-form-groups-css-fields-editor', '#after' => '
		<div class="wpcf-update-preview-btn"><input type="button" value="Update preview" onclick="wpcfPreviewHtml()" style="float:right;" class="button-secondary"></div>
		<h3>Field group preview</h3>
		<div id="wpcf-update-preview-div">Preview here</div>
		<script type="text/javascript">
			var wpcfReadOnly = ' . json_encode($preview_profile) . ';
			var wpcfEditMode = ' . json_encode($edit_profile) . ';
			var wpcfDefaultCss = ' . json_encode($admin_styles_value) . ';
开发者ID:sandum150,项目名称:cheltuieli,代码行数:67,代码来源:usermeta-form.php


示例9: wpcf_admin_render_fields

function wpcf_admin_render_fields($group, $user_id, $echo = '')
{
    global $wpcf;
    $output = '<div class="wpcf-group-area wpcf-group-area_' . $group['slug'] . '">' . "\n\n";
    $output .= '<h3>' . wpcf_translate('group ' . $group['id'] . ' name', $group['name']) . '</h3>' . "\n\n";
    if (!empty($group['fields'])) {
        // Display description
        if (!empty($group['description'])) {
            $output .= '<span>' . wpautop(wpcf_translate('group ' . $group['id'] . ' description', $group['description'])) . '</span>' . "\n\n";
        }
        $output .= '<div class="wpcf-profile-field-line">' . "\n\n";
        foreach ($group['fields'] as $field_slug => $field) {
            if (empty($field) || !is_array($field)) {
                continue;
            }
            $field = $wpcf->usermeta_field->_parse_cf_form_element($field);
            if (!isset($field['#id'])) {
                $field['#id'] = wpcf_unique_id(serialize($field));
            }
            if (isset($field['wpcf-type'])) {
                // May be ignored
                $field = apply_filters('wpcf_fields_' . $field['wpcf-type'] . '_meta_box_form_value_display', $field);
            }
            // Render form elements
            if (wpcf_compare_wp_version() && $field['#type'] == 'wysiwyg') {
                $field['#editor_settings']['media_buttons'] = '';
                if (!empty($echo)) {
                    $field['#editor_settings']['wpautop'] = true;
                }
                // Especially for WYSIWYG
                $output .= "\n" . '<div class="wpcf-profile-field-line">' . "\n\n";
                $output .= '<div class="wpcf-wysiwyg">' . "\n\n";
                $output .= '<div id="wpcf-textarea-textarea-wrapper" class="form-item form-item-textarea wpcf-form-item wpcf-form-item-textarea">' . "\n\n";
                $output .= isset($field['#before']) ? $field['#before'] : '';
                $output .= '<label class="wpcf-form-label wpcf-form-textarea-label">' . $field['#title'] . '</label>' . "\n\n";
                $output .= '<div class="description wpcf-form-description wpcf-form-description-textarea description-textarea">' . "\n\n" . wpautop($field['#description']) . '</div>' . "\n\n";
                ob_start();
                wp_editor($field['#value'], $field['#id'], $field['#editor_settings']);
                $output .= ob_get_clean() . "\n\n";
                $field['slug'] = str_replace(WPCF_META_PREFIX . 'wysiwyg-', '', $field_slug);
                $field['type'] = 'wysiwyg';
                $output .= '</div>' . "\n\n";
                $output .= isset($field['#after']) ? $field['#after'] : '';
                $output .= '</div>' . "\n\n";
                $output .= '</div>' . "\n\n";
            } else {
                if ($field['#type'] == 'wysiwyg') {
                    $field['#type'] = 'textarea';
                }
                $field['#pattern'] = "\n" . '<div class="wpcf-profile-field-line">
	<div class="wpcf-profile-line-left">
		<LABEL><DESCRIPTION>
	</div>
	<div class="wpcf-profile-line-right"><BEFORE><ERROR><PREFIX><ELEMENT><SUFFIX><AFTER></div>
</div>' . "\n\n";
                if (isset($field['#name']) && (strpos($field['#name'], '[hour]') !== false || strpos($field['#name'], '[minute]') !== false)) {
                    if (isset($field['#attributes']) && $field['#attributes']['class'] == 'wpcf-repetitive') {
                        $field['#pattern'] = strpos($field['#name'], '[hour]') !== false ? __('Hour', 'wpcf') : __('Minute', 'wpcf');
                        $field['#pattern'] .= '<LABEL><DESCRIPTION><ERROR><PREFIX><ELEMENT><SUFFIX><AFTER>' . "\n\n";
                    } else {
                        if (strpos($field['#name'], '[hour]') !== false) {
                            $field['#pattern'] = "\n" . '<div class="wpcf-profile-field-line">
	<div class="wpcf-profile-line-left">&nbsp;&nbsp;&nbsp;&nbsp;' . __('Time', 'wpcf') . '</div>
	<div class="wpcf-profile-line-right">
	<LABEL><DESCRIPTION><ERROR><PREFIX><ELEMENT><SUFFIX><AFTER>' . "\n";
                        } else {
                            $field['#pattern'] = "\n" . '
	<LABEL><DESCRIPTION><ERROR><PREFIX><ELEMENT><SUFFIX><AFTER></div>
</div>' . "\n\n";
                        }
                    }
                }
                if (!empty($echo)) {
                    $field['#validate'] = '';
                }
                $output .= wpcf_form_simple(array($field['#id'] => $field));
            }
        }
        $output .= '</div>';
    }
    /*
     * TODO Move to Conditional code
     *
     * This is already checked. Use hook to add wrapper DIVS and apply CSS.
     */
    if (!empty($group['_conditional_display'])) {
        $output .= '</div>';
    }
    $output .= "\n\n" . '</div>';
    if (!empty($echo)) {
        return $output;
    } else {
        echo $output;
    }
}
开发者ID:sonvq,项目名称:passioninvestment,代码行数:95,代码来源:usermeta-post.php


示例10: wpcf_filds_checkboxes_relationship_form_filter

/**
 * This marks child posts checkboxes.
 * 
 * Because if all unchecked, on submit there won't be any data.
 * 
 * @param string $form
 * @param type $cf
 * @return string
 */
function wpcf_filds_checkboxes_relationship_form_filter($form, $cf)
{
    if ($cf->cf['type'] == 'checkboxes') {
        $form[wpcf_unique_id(serialize($cf) . 'rel_child')] = array('#type' => 'hidden', '#name' => '_wpcf_check_checkboxes[' . $cf->post->ID . '][' . $cf->slug . ']', '#value' => '1');
    }
    return $form;
}
开发者ID:CrankMaster336,项目名称:FFW-TR,代码行数:16,代码来源:checkboxes.php


示例11: 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:olechka1505,项目名称:hungrylemur,代码行数:54,代码来源:field.php


示例12: array

<?php

/*
 * Child table taxonomy non-hierarchical form.
 */
$defaults = array('taxonomy' => 'category');
extract(wp_parse_args($data, $defaults), EXTR_SKIP);
$tax = get_taxonomy($taxonomy);
$html_id = "wpcf-reltax-{$taxonomy}-" . wpcf_unique_id($taxonomy);
?>

	<div id="<?php 
echo $html_id;
?>
" class="js-types-child-categorydiv types-child-categorydiv" data-types-reltax="<?php 
echo $taxonomy;
?>
">
		<!--<ul id="<?php 
echo $html_id;
?>
-tabs" class="category-tabs">
			<li class="tabs"><a href="#<?php 
echo $taxonomy;
?>
-all"><?php 
echo $tax->labels->all_items;
?>
</a></li>
			<li class="hide-if-no-js"><a href="#<?php 
echo $taxonomy;
开发者ID:sonvq,项目名称:passioninvestment,代码行数:31,代码来源:child-tax-category.tpl.php


示例13: add_admin_style

    /**
     * deprecated
     */
    private function add_admin_style($form)
    {
        $admin_styles_value = $preview_profile = $edit_profile = '';
        if (isset($this->update['admin_styles'])) {
            $admin_styles_value = $this->update['admin_styles'];
        }
        $temp = '';
        if ($this->update) {
            require_once WPCF_EMBEDDED_INC_ABSPATH . '/fields.php';
            // require_once WPCF_EMBEDDED_INC_ABSPATH . '/usermeta.php';
            require_once WPCF_EMBEDDED_INC_ABSPATH . '/fields-post.php';
            require_once WPCF_EMBEDDED_INC_ABSPATH . '/usermeta-post.php';
            //Get sample post
            $post = query_posts('posts_per_page=1');
            if (!empty($post) && count($post) != '') {
                $post = $post[0];
            }
            $preview_profile = wpcf_admin_post_meta_box_preview($post, $this->update, 1);
            $group = $this->update;
            $group['fields'] = wpcf_admin_post_process_fields($post, $group['fields'], true, false);
            $edit_profile = wpcf_admin_post_meta_box($post, $group, 1, true);
            add_action('admin_enqueue_scripts', 'wpcf_admin_fields_form_fix_styles', PHP_INT_MAX);
        }
        $temp[] = array('#type' => 'radio', '#suffix' => '<br />', '#value' => 'edit_mode', '#title' => 'Edit mode', '#name' => 'wpcf[group][preview]', '#default_value' => '', '#before' => '<div class="wpcf-admin-css-preview-style-edit">', '#inline' => true, '#attributes' => array('onclick' => 'changePreviewHtml(\'editmode\')', 'checked' => 'checked'));
        $temp[] = array('#type' => 'radio', '#title' => 'Read Only', '#name' => 'wpcf[group][preview]', '#default_value' => '', '#after' => '</div>', '#inline' => true, '#attributes' => array('onclick' => 'changePreviewHtml(\'readonly\')'));
        $temp[] = array('#type' => 'textarea', '#name' => 'wpcf[group][admin_html_preview]', '#inline' => true, '#id' => 'wpcf-form-groups-admin-html-preview', '#before' => '<h3>Field group HTML</h3>');
        $temp[] = array('#type' => 'textarea', '#name' => 'wpcf[group][admin_styles]', '#inline' => true, '#value' => $admin_styles_value, '#default_value' => '', '#id' => 'wpcf-form-groups-css-fields-editor', '#after' => '
                <div class="wpcf-update-preview-btn"><input type="button" value="Update preview" onclick="wpcfPreviewHtml()" style="float:right;" class="button-secondary"></div>
                <h3>' . __('Field group preview', 'wpcf') . '</h3>
                <div id="wpcf-update-preview-div">Preview here</div>
                <script type="text/javascript">
var wpcfReadOnly = ' . json_encode(base64_encode($preview_profile)) . ';
var wpcfEditMode = ' . json_encode(base64_encode($edit_profile)) . ';
var wpcfDefaultCss = ' . json_encode(base64_encode($admin_styles_value)) . ';
        </script>
        ', '#before' => sprintf('<h3>%s</h3>', __('Your CSS', 'wpcf')));
        $admin_styles = _wpcf_filter_wrap('admin_styles', __('Admin styles for fields:', 'wpcf'), '', '', $temp, __('Open style editor', 'wpcf'));
        $form['p_wrap_1_' . wpcf_unique_id(serialize($admin_styles))] = array('#type' => 'markup', '#markup' => '<p class="wpcf-filter-wrap">');
        $form = $form + $admin_styles;
        $form['adminstyles-table-close'] = array('#type' => 'markup', '#markup' => '</td></tr></tbody></table><br />');
        return $form;
    }
开发者ID:phuocdungit,项目名称:fundy,代码行数:45,代码来源:class.types.admin.edit.meta.fields.group.php


示例14: pagination

 /**
  * Pagination
  */
 function pagination()
 {
     global $wpcf;
     // Pagination
     $total_items = count($this->children);
     $per_page = $wpcf->relationship->get_items_per_page($this->parent_post_type, $this->child_post_type);
     $page = isset($_GET['page']) ? intval($_GET['page']) : 1;
     $offset = $page == 1 ? 0 : ($page - 1) * $per_page;
     $next = $total_items > $offset + $per_page;
     $prev = $page == 1 ? false : true;
     if ($total_items > $per_page) {
         $this->children = array_splice($this->children, $offset, $per_page);
     }
     $this->pagination_top = wpcf_pr_admin_has_pagination($this->parent, $this->child_post_type, $page, $prev, $next, $per_page, $total_items);
     /*
      *
      *
      * Add pagination bottom
      */
     $options = array(__('All', 'wpcf') => 'all', 5 => 5, 10 => 10, 15 => 15);
     // Add sorting
     $add_data = isset($_GET['sort']) && isset($_GET['field']) ? '&sort=' . sanitize_text_field($_GET['sort']) . '&field=' . sanitize_text_field($_GET['field']) : '';
     if (isset($_GET['post_type_sort_parent'])) {
         $add_data .= '&post_type_sort_parent=' . sanitize_text_field($_GET['post_type_sort_parent']);
     }
     $this->pagination_bottom = wpcf_form_simple(array('pagination' => array('#type' => 'select', '#before' => __('Show', 'wpcf'), '#after' => $this->child_post_type_object->labels->name, '#id' => 'wpcf_relationship_num_' . wpcf_unique_id(serialize($this->children)), '#name' => $wpcf->relationship->items_per_page_option_name, '#options' => $options, '#default_value' => $per_page, '#attributes' => array('class' => 'wpcf-relationship-items-per-page', 'data-action' => 'action=wpcf_ajax&wpcf_action=pr_pagination' . '&post_id=' . $this->parent->ID . '&post_type=' . $this->child_post_type . '&_wpnonce=' . wp_create_nonce('pr_pagination') . $add_data))));
 }
开发者ID:phuocdungit,项目名称:fundy,代码行数:30,代码来源:form-child.php


示例15: wpcf_cd_fields_form_additional_filters

/**
 * Group coditional display filter.
 *
 * @param type $filters
 * @param type $update
 * @return type
 */
function wpcf_cd_fields_form_additional_filters($filters, $update)
{
    $data = array();
    $data['id'] = !empty($update) && isset($update['name']) ? $update['name'] : wpcf_unique_id(serialize($filters));
    $data['group_id'] = $update['id'];
    if ($update) {
        $data['data']['conditional_display'] = maybe_unserialize(get_post_meta($update['id'], '_wpcf_conditional_display', true));
    } else {
        $data['data']['conditional_display'] = array();
    }
    $data['meta_type'] = isset($update['meta_type']) ? $update['meta_type'] : 'unknown';
    $filters = $filters + wpcf_cd_admin_form_filter(array(), $data, true);
    return $filters;
}
开发者ID:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:21,代码来源:conditional-display.php


示例16: wpcf_fields_checkboxes_get_option

/**
 * Returns form data for radio.
 * 
 * @param type $parent_name Used for AJAX adding options
 * @param type $form_data
 * @return type 
 */
function wpcf_fields_checkboxes_get_option($parent_name = '', $form_data = array())
{
    $id = isset($form_data['key']) ? $form_data['key'] : 'wpcf-fields-checkboxes-option-' . wpcf_unique_id(serialize($form_data) . $parent_name);
    $form = array();
    $count = isset($_GET['count']) ? $_GET['count'] : 1;
    $title = isset($_GET['count']) ? __('Checkbox title', 'wpcf') . ' ' . $_GET['count'] : __('Checkbox title', 'wpcf') . ' 1';
    $title = isset($form_data['title']) ? $form_data['title'] : $title;
    $form[$id . '-id'] = $id;
    $form[$id . '-drag'] = array('#type' => 'markup', '#markup' => '<div class="wpcf-fields-checkboxes-draggable"><div class="wpcf-checkboxes-drag"><img src="' . WPCF_RES_RELPATH . '/images/move.png" class="wpcf-fields-form-checkboxes-move-field" alt="' . __('Move this option', 'wpcf') . '" /><img src="' . WPCF_RES_RELPATH . '/images/delete.png"' . ' class="wpcf-fields-checkboxes-delete-option wpcf-pointer"' . ' onclick="if (confirm(\'' . __('Are you sure?', 'wpcf') . '\')) { jQuery(this).parent().fadeOut().next().fadeOut(function(){jQuery(this).remove(); ' . '}); }"' . 'alt="' . __('Delete this checkbox', 'wpcf') . '" /></div>');
    $form[$id] = array('#type' => 'fieldset', '#title' => $title, '#collapsed' => isset($form_data['key']) ? true : false, '#collapsible' => true);
    $form[$id]['title'] = array('#type' => 'textfield', '#title' => __('Title', 'wpcf'), '#id' => $id . '-title', '#name' => $parent_name . '[options][' . $id . '][title]', '#value' => $title, '#inline' => true, '#attributes' => array('class' => 'wpcf-form-groups-check-update-title-display-value'), '#before' => '<br />');
    $form[$id]['value'] = array('#type' => 'textfield', '#title' => __('Value to store', 'wpcf'), '#name' => $parent_name . '[options][' . $id . '][set_value]', '#value' => isset($form_data['set_value']) ? $form_data['set_value'] : 1);
    $form[$id]['checked'] = array('#id' => 'checkboxes-' . wpcf_unique_id(serialize($form_data) . $parent_name), '#type' => 'checkbox', '#title' => __('Set checked by default (on new post)?', 'wpcf'), '#name' => $parent_name . '[options][' . $id . '][checked]', '#default_value' => !empty($form_data['checked']) ? 1 : 0);
    $form[$id]['display'] = array('#type' => 'radios', '#default_value' => !empty($form_data['display']) ? $form_data['display'] : 'db', '#name' => $parent_name . '[options][' . $id . '][display]', '#options' => array('display_from_db' => array('#title' => __('Display the value of this field from the database', 'wpcf'), '#name' => $parent_name . '[options][' . $id . '][display]', '#value' => 'db', '#inline' => true, '#after' => '<br />'), 'display_values' => array('#title' => __('Show one of these two values:', 'wpcf'), '#name' => $parent_name . '[options][' . $id . '][display]', '#value' => 'value')), '#inline' => true);
    $form[$id]['display-value'] = array('#type' => 'textfield', '#title' => __('Not selected:', 'wpcf'), '#name' => $parent_name . '[options][' . $id . '][display_value_not_selected]', '#value' => isset($form_data['display_value_not_selected']) ? $form_data['display_value_not_selected'] : '', '#inline' => true);
    $form[$id]['display-value-2'] = array('#type' => 'textfield', '#title' => __('Selected:', 'wpcf'), '#name' => $parent_name . '[options][' . $id . '][display_value_selected]', '#value' => isset($form_data['display_value_selected']) ? $form_data['display_value_selected'] : '');
    $form[$id . 'drag-close'] = array('#type' => 'markup', '#markup' => '</div>');
    return $form;
}
开发者ID:adisonc,项目名称:MaineLearning,代码行数:26,代码来源:checkboxes.php


示例17: wpcf_fields_checkboxes_get_option

/**
 * Returns form data for radio.
 * 
 * @param type $parent_name Used for AJAX adding options
 * @param type $form_data
 * @return type 
 */
function wpcf_fields_checkboxes_get_option($parent_name = '', $form_data = array(), $field = array())
{
    $id = isset($form_data['key']) ? $form_data['key'] : 'wpcf-fields-checkboxes-option-' . wpcf_unique_id(serialize($form_data) . $parent_name);
    $form = array();
    $count = isset($_GET['count']) ? intval($_GET['count']) : 1;
    $title = isset($_GET['count']) ? __('Checkbox title', 'wpcf') . ' ' . intval($_GET['count']) : __('Checkbox title', 'wpcf') . ' 1';
    $title = isset($form_data['title']) ? $form_data['title'] : $title;
    $form[$id . '-id'] = $id;
    $form[$id . '-drag'] = array('#type' => 'markup', '#markup' => '<div class="js-types-sortable wpcf-fields-checkboxes-draggable"><div class="wpcf-checkboxes-drag"><img src="' . WPCF_RES_RELPATH . '/images/move.png" class="js-types-sort-button wpcf-fields-form-checkboxes-move-field" alt="' . __('Move th 

鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP wpcf_usermeta_get_shortcode函数代码示例发布时间:2022-05-23
下一篇:
PHP wpcf_types_get_meta_prefix函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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