本文整理匯總了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();
}
}