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


PHP WPCF_Loader::view方法代码示例

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


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

示例1: frame

 /**
  * Renders Thickbox content.
  *
  * Field should provide callback function
  * that will be called automatically.
  *
  * Function should be named like:
  * 'wpcf_fields_' . $field_type . '_editor_callback'
  * e.g. 'wpcf_fields_checkbox__editor_callback'
  *
  * Function should return array with elements:
  * 'supports' - parameters or other feature supported, e.g. 'styling' will
  *     enable 'Styling' options
  *
  * Tabs is array with elements:
  * 'menu_title' - used for menu title
  * 'title' - used for main title
  * 'content' - HTML content of tab
  *
  * @param type $field
  * @param type $meta_type
  * @param type $post_id
  * @param string $shortcode
  */
 function frame($field, $meta_type = 'postmeta', $post_id = -1, $shortcode = null, $callback = false, $views_usermeta = false)
 {
     global $wp_version, $wpcf;
     // Queue rendering JS settings
     add_action('admin_print_footer_scripts', array($this, 'renderTedSettings'), 1);
     wp_enqueue_script('types');
     wp_enqueue_script('types-knockout');
     wp_enqueue_script('types-editor');
     wp_enqueue_script('wp-pointer');
     wp_enqueue_style('types-editor');
     wp_enqueue_style('wp-pointer');
     wp_enqueue_style('toolset-font-awesome');
     // Load cloned WP Media Modal CSS
     if (version_compare($wp_version, '3.5', '<')) {
         wp_enqueue_style('types-editor-cloned');
     }
     $this->field = $field;
     $this->_meta_type = $meta_type;
     $this->_post = get_post($post_id);
     $this->_settings = is_null($shortcode) ? array() : $this->shortcodeToParameters($shortcode);
     $this->callback = $callback;
     $this->_data = array('meta_type' => $meta_type, 'field' => $field, 'field_type_data' => WPCF_Fields::getFieldTypeData($field['type']), 'settings' => array(), 'tabs' => array(), 'supports' => array(), 'post' => $this->_post, 'post_types' => get_post_types(array('show_ui' => true)), 'style' => isset($this->_settings['style']) ? $this->_settings['style'] : '', 'class' => isset($this->_settings['class']) ? $this->_settings['class'] : '', 'output' => 'html', 'user_form' => '');
     // Set title if updated
     if (!is_null($shortcode)) {
         $this->_data['title'] = sprintf(__('Update %s', 'wpcf'), $this->_data['field_type_data']['title']);
         $this->_data['submit_button_title'] = __('Update shortcode', 'wpcf');
     }
     // Exclude post types
     foreach ($wpcf->excluded_post_types as $_post_type) {
         unset($this->_data['post_types'][$_post_type]);
     }
     /*
      * Callback
      */
     $function = 'wpcf_fields_' . $field['type'] . '_editor_callback';
     if (function_exists($function)) {
         // Main callback
         $callback = call_user_func($function, $field, $this->_settings, $this->_meta_type, $this->_post);
         // Add supports
         if (!empty($callback['supports']) && is_array($callback['supports'])) {
             $this->_data['supports'] = $callback['supports'];
         }
         // Add tabs
         if (!empty($callback['tabs']) && is_array($callback['tabs'])) {
             $this->_data['tabs'] = $callback['tabs'];
         }
         // Unify settings
         if (!empty($callback['settings']) && is_array($callback['settings'])) {
             $this->_settings = array_merge($this->_settings, self::sanitizeParams($callback['settings'], 'array'));
         }
     }
     // If no tabs
     if (empty($this->_data['tabs'])) {
         $this->_data['tabs']['display'] = array('menu_title' => __('Display', 'wpcf'), 'title' => __('Display', 'wpcf'), 'content' => sprintf(__('There are no additional display options for the %s field.', 'wpcf'), $this->_data['field_type_data']['title']));
     }
     // Add User ID form
     if ($this->_meta_type == 'usermeta') {
         if (!$views_usermeta) {
             $this->_data['user_form'] = wpcf_form_simple(wpcf_get_usermeta_form_addon($this->_settings));
             $this->_data['supports'][] = 'user_id';
         }
     } else {
         // Add Post ID form
         $this->_data['supports'][] = 'post_id';
     }
     // Get parents
     if (!empty($this->_post->ID)) {
         $this->_data['parents'] = WPCF_Relationship::get_parents($this->_post);
     }
     // Set icons
     $icons = array('audio' => 'icon-music', 'checkbox' => 'icon-check', 'checkboxes' => 'icon-checkboxes', 'colorpicker' => 'icon-tint', 'date' => 'icon-calendar', 'email' => 'icon-envelope-alt', 'embed' => 'icon-youtube-play', 'file' => 'icon-file-alt', 'image' => 'icon-picture', 'map' => 'icon-map-marker', 'numeric' => 'icon-numeric', 'phone' => 'icon-phone', 'radio' => 'icon-radio-button', 'select' => 'icon-select-box', 'skype' => 'icon-skype', 'textarea' => 'icon-text-area', 'textfield' => 'icon-text-field', 'url' => 'icon-link', 'video' => 'icon-film', 'wysiwyg' => 'icon-wysiwyg');
     $this->_data['icon_class'] = isset($icons[$field['type']]) ? $icons[$field['type']] : 'icon-text-field';
     // Is repetitive
     $this->_data['is_repetitive'] = (bool) types_is_repetitive($field);
     if ($this->_data['is_repetitive']) {
         $this->_data['supports'][] = 'separator';
//.........这里部分代码省略.........
开发者ID:santikrass,项目名称:apache,代码行数:101,代码来源:editor.php


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