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


PHP WPCF_Loader::template方法代码示例

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


在下文中一共展示了WPCF_Loader::template方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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

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

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

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

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

示例7: wpcf_fields_image_editor_callback

/**
 * Editor callback form.
 *
 * @global object $wpdb
 *
 */
function wpcf_fields_image_editor_callback($field, $data, $context, $post)
{
    // Get post_ID
    $post_ID = !empty($post->ID) ? $post->ID : false;
    // Get attachment
    $image = false;
    $attachment_id = false;
    if ($post_ID) {
        $image = get_post_meta($post_ID, wpcf_types_get_meta_prefix($field) . $field['slug'], true);
        if (empty($image)) {
            $user_id = wpcf_usermeta_get_user();
            $image = get_user_meta($user_id, wpcf_types_get_meta_prefix($field) . $field['slug'], true);
        }
        if (!empty($image)) {
            // Get attachment by guid
            global $wpdb;
            $attachment_id = $wpdb->get_var($wpdb->prepare("SELECT ID FROM {$wpdb->posts} WHERE post_type = 'attachment' AND guid=%s", $image));
        }
    }
    $data['image'] = $image;
    $data['attachment_id'] = $attachment_id;
    // Set post type
    $post_type = !empty($post->post_type) ? $post->post_type : '';
    // Set image_data
    $image_data = wpcf_fields_image_get_data($image);
    if (!in_array($post_type, array('view', 'view-template'))) {
        // We must ignore errors here and treat image as outsider
        if (!empty($image_data['error'])) {
            $image_data['is_outsider'] = 1;
            $image_data['is_attachment'] = 0;
        }
    } else {
        if (!empty($image_data['error'])) {
            $image_data['is_outsider'] = 0;
            $image_data['is_attachment'] = 0;
        }
    }
    $data['preview'] = $attachment_id ? wp_get_attachment_image($attachment_id, 'thumbnail') : '';
    // Title and Alt
    if ($attachment_id) {
        $alt = trim(strip_tags(get_post_meta($attachment_id, '_wp_attachment_image_alt', true)));
        $attachment_post = get_post($attachment_id);
        if (!empty($attachment_post)) {
            $title = trim(strip_tags($attachment_post->post_title));
        } else {
            if (!empty($alt)) {
                $title = $alt;
            }
        }
        if (empty($alt)) {
            $alt = $title;
        }
        if (!isset($data['title'])) {
            $data['title'] = $title;
        }
        if (!isset($data['alt'])) {
            $data['alt'] = $alt;
        }
    }
    // Align options
    $data['alignment_options'] = array('none' => __('None', 'wpcf'), 'left' => __('Left', 'wpcf'), 'center' => __('Center', 'wpcf'), 'right' => __('Right', 'wpcf'));
    // Remote images settings
    $fetch_remote = (bool) wpcf_get_settings('images_remote');
    $data['warning_remote'] = false;
    if (!types_is_repetitive($field) && $image_data['is_outsider'] && !$fetch_remote && !empty($data['image'])) {
        $data['warning_remote'] = true;
    }
    // Size settings
    $data['size_options'] = array('thumbnail' => sprintf(__('Thumbnail - %s', 'wpcf'), get_option('thumbnail_size_w') . 'x' . get_option('thumbnail_size_h')), 'medium' => sprintf(__('Medium - %s', 'wpcf'), get_option('medium_size_w') . 'x' . get_option('medium_size_h')), 'large' => sprintf(__('Large - %s', 'wpcf'), get_option('large_size_w') . 'x' . get_option('large_size_h')), 'full' => __('Original image', 'wpcf'));
    $wp_image_sizes = (array) get_intermediate_image_sizes();
    foreach ($wp_image_sizes as $wp_size) {
        if ($wp_size != 'post-thumbnail' && !array_key_exists($wp_size, $data['size_options'])) {
            $data['size_options'][$wp_size] = $wp_size;
        }
    }
    $data['size_options']['wpcf-custom'] = __('Custom size...', 'wpcf');
    // Get saved settings
    $data = array_merge(wpcf_admin_fields_get_field_last_settings($field['id']), $data);
    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-image', $data))), 'settings' => $data);
}
开发者ID:torch2424,项目名称:Team-No-Comply-Games-Wordpress,代码行数:86,代码来源:image.php

示例8: taxonomy_form

 /**
  * Returns HTML formatted Taxonomy form.
  *
  * @param type $taxonomy
  * @return type
  */
 function taxonomy_form($taxonomy, $simple = false)
 {
     // SIMPLIFIED VERSION
     if ($simple) {
         $terms = wp_get_post_terms($this->child->ID, $taxonomy->name, array());
         $selected = !empty($terms) ? array_shift($terms)->term_id : -1;
         $output = wp_dropdown_categories(array('taxonomy' => $taxonomy->name, 'selected' => $selected, 'echo' => false, 'hide_empty' => false, 'hide_if_empty' => true, 'show_option_none' => sprintf(__('No %s', 'wpcf'), $taxonomy->name), 'name' => 'wpcf_post_relationship[' . $this->parent->ID . '][' . $this->child->ID . '][taxonomies][' . $taxonomy->name . ']', 'id' => 'wpcf_pr_' . $this->child->ID . '_' . $taxonomy->name, 'hierarchical' => true, 'depth' => 9999));
         return empty($output) ? sprintf(__('No %s', 'wpcf'), $taxonomy->label) : $output;
     }
     $data = array('post' => $this->child, 'taxonomy' => $taxonomy->name);
     if ($taxonomy->name == 'category') {
         $data['_wpcf_name'] = "wpcf_post_relationship[{$this->parent->ID}][{$this->child->ID}][taxonomies][{$taxonomy->name}][]";
         $output = WPCF_Loader::template('child-tax-category', $data);
         // Reduce JS processing
         return str_replace("name=\"post_category[]", "name=\"{$data['_wpcf_name']}", $output);
     }
     if ($taxonomy->hierarchical) {
         $data['_wpcf_name'] = "wpcf_post_relationship[{$this->parent->ID}][{$this->child->ID}][taxonomies][{$taxonomy->name}][]";
         $output = WPCF_Loader::template('child-tax-category', $data);
         // Reduce JS processing
         return str_replace("name=\"tax_input[{$taxonomy->name}][]", "name=\"{$data['_wpcf_name']}", $output);
     }
     $data['_wpcf_name'] = "wpcf_post_relationship[{$this->parent->ID}][{$this->child->ID}][taxonomies][{$taxonomy->name}]";
     $output = WPCF_Loader::template('child-tax-tag', $data);
     // Reduce JS processing
     return str_replace("name=\"tax_input[{$taxonomy->name}]", "name=\"{$data['_wpcf_name']}", $output);
 }
开发者ID:phuocdungit,项目名称:fundy,代码行数:33,代码来源:form-child.php

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

示例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'), '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');
    $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', 'wpcf'), 'title' => __('Display', 'wpcf'), 'content' => WPCF_Loader::template('editor-modal-date', $data))));
}
开发者ID:CrankMaster336,项目名称:FFW-TR,代码行数:19,代码来源:date.php

示例11: wpcf_fields_email_editor_callback

/**
 * Editor callback form.
 */
function wpcf_fields_email_editor_callback($field, $settings)
{
    return array('supports' => array('styling', 'style'), 'tabs' => array('display' => array('menu_title' => __('Display', 'wpcf'), 'title' => __('Display', 'wpcf'), 'content' => WPCF_Loader::template('editor-modal-email', $settings))));
}
开发者ID:reginaldojunior,项目名称:blog,代码行数:7,代码来源:email.php

示例12: wpcf_fields_audio_editor_callback

/**
 * Editor callback form.
 */
function wpcf_fields_audio_editor_callback($field, $data, $meta_type, $post)
{
    return array('supports' => array(), 'tabs' => array('display' => array('menu_title' => __('Display', 'wpcf'), 'title' => __('Display', 'wpcf'), 'content' => WPCF_Loader::template('editor-modal-audio', $data))), 'settings' => $data);
}
开发者ID:CrankMaster336,项目名称:FFW-TR,代码行数:7,代码来源:audio.php

示例13: wpcf_fields_numeric_editor_callback

/**
 * Editor callback form.
 */
function wpcf_fields_numeric_editor_callback($field, $settings)
{
    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-numeric', $settings))));
}
开发者ID:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:7,代码来源:numeric.php

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


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