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


PHP EE_Admin_Page::_load_page_dependencies方法代码示例

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


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

示例1: _load_page_dependencies

 /**
  * overloading the EE_Admin_Page parent load_page_dependencies so we can get the cpt stuff added in appropriately
  *
  * @access protected
  * @return void
  */
 protected function _load_page_dependencies()
 {
     //we only add stuff if this is a cpt_route!
     if (!$this->_cpt_route) {
         parent::_load_page_dependencies();
         return;
     }
     //now let's do some automatic filters into the wp_system and we'll check to make sure the CHILD class automatically has the required methods in place.
     //the following filters are for setting all the redirects on DEFAULT WP custom post type actions
     //let's add a hidden input to the post-edit form so we know when we have to trigger our custom redirects!  Otherwise the redirects will happen on ALL post saves which wouldn't be good of course!
     add_action('edit_form_after_title', array($this, 'cpt_post_form_hidden_input'));
     //inject our Admin page nav tabs...
     //let's make sure the nav tabs are set if they aren't already
     //if ( empty( $this->_nav_tabs ) ) $this->_set_nav_tabs();
     add_action('post_edit_form_tag', array($this, 'inject_nav_tabs'));
     //modify the post_updated messages array
     add_action('post_updated_messages', array($this, 'post_update_messages'), 10);
     //add shortlink button to cpt edit screens.  We can do this as a universal thing BECAUSE, cpts use the same format for shortlinks as posts!
     add_filter('get_shortlink', array($this, 'add_shortlink_button_to_editor'), 10, 4);
     //This basically allows us to change the title of the "publish" metabox area on CPT pages by setting a 'publishbox' value in the $_labels property array in the child class.
     if (!empty($this->_labels['publishbox'])) {
         $box_label = is_array($this->_labels['publishbox']) && isset($this->_labels['publishbox'][$this->_req_action]) ? $this->_labels['publishbox'][$this->_req_action] : $this->_labels['publishbox'];
         remove_meta_box('submitdiv', __('Publish'), 'post_submit_meta_box', $this->_cpt_routes[$this->_req_action], 'side', 'core');
         add_meta_box('submitdiv', $box_label, 'post_submit_meta_box', $this->_cpt_routes[$this->_req_action], 'side', 'core');
     }
     //let's add page_templates metabox if this cpt added support for it.
     if ($this->_supports_page_templates($this->_cpt_object->name)) {
         add_meta_box('page_templates', __('Page Template', 'event_espresso'), array($this, 'page_template_meta_box'), $this->_cpt_routes[$this->_req_action], 'side', 'default');
     }
     /**/
     //this is a filter that allows the addition of extra html after the permalink field on the wp post edit-form
     if (method_exists($this, 'extra_permalink_field_buttons')) {
         add_filter('get_sample_permalink_html', array($this, 'extra_permalink_field_buttons'), 10, 4);
     }
     //add preview button
     add_filter('get_sample_permalink_html', array($this, 'preview_button_html'), 5, 4);
     //insert our own post_stati dropdown
     add_action('post_submitbox_misc_actions', array($this, 'custom_post_stati_dropdown'), 10);
     //This allows adding additional information to the publish post submitbox on the wp post edit form
     if (method_exists($this, 'extra_misc_actions_publish_box')) {
         add_action('post_submitbox_misc_actions', array($this, 'extra_misc_actions_publish_box'), 10);
     }
     //This allows for adding additional stuff after the title field on the wp post edit form.  This is also before the wp_editor for post description field.
     if (method_exists($this, 'edit_form_after_title')) {
         add_action('edit_form_after_title', array($this, 'edit_form_after_title'), 10);
     }
     /**
      * Filtering WP's esc_url to capture urls pointing to core wp routes so they point to our route.
      */
     add_filter('clean_url', array($this, 'switch_core_wp_urls_with_ours'), 10, 3);
     parent::_load_page_dependencies();
     //notice we are ALSO going to load the pagenow hook set for this route (see _before_page_setup for the reset of the pagenow global ). This is for any plugins that are doing things properly and hooking into the load page hook for core wp cpt routes.
     global $pagenow;
     do_action('load-' . $pagenow);
     $this->modify_current_screen();
     add_action('admin_enqueue_scripts', array($this, 'setup_autosave_hooks'), 30);
     //we route REALLY early.
     try {
         $this->_route_admin_request();
     } catch (EE_Error $e) {
         $e->get_error();
     }
 }
开发者ID:kaffiemetsuker,项目名称:event-espresso-core,代码行数:69,代码来源:EE_Admin_Page_CPT.core.php


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