本文整理汇总了PHP中WP_Admin_Bar::initialize方法的典型用法代码示例。如果您正苦于以下问题:PHP WP_Admin_Bar::initialize方法的具体用法?PHP WP_Admin_Bar::initialize怎么用?PHP WP_Admin_Bar::initialize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WP_Admin_Bar
的用法示例。
在下文中一共展示了WP_Admin_Bar::initialize方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: test_add_post_edit_and_exit_links
/**
* Test misc admin bar extensions.
*
* @covers CustomizeSnapshots\Customize_Snapshot_Manager::add_post_edit_screen_link()
* @covers CustomizeSnapshots\Customize_Snapshot_Manager::add_snapshot_exit_link()
* @covers CustomizeSnapshots\Customize_Snapshot_Manager::add_resume_snapshot_link()
* @covers CustomizeSnapshots\Customize_Snapshot_Manager::remove_all_non_snapshot_admin_bar_links()
*/
public function test_add_post_edit_and_exit_links()
{
global $wp_admin_bar;
set_current_screen('front');
require_once ABSPATH . WPINC . '/class-wp-admin-bar.php';
$this->manager->post_type->save(array('uuid' => self::UUID, 'data' => array('blogname' => array('value' => 'Hello')), 'status' => 'draft'));
remove_all_actions('admin_bar_menu');
$manager = new Customize_Snapshot_Manager($this->plugin);
$manager->init();
$wp_admin_bar = new \WP_Admin_Bar();
// WPCS: Override OK.
$wp_admin_bar->initialize();
$wp_admin_bar->add_menus();
do_action_ref_array('admin_bar_menu', array(&$wp_admin_bar));
$this->assertEmpty($wp_admin_bar->get_node('inspect-customize-snapshot'));
$this->assertEmpty($wp_admin_bar->get_node('exit-customize-snapshot'));
$this->assertNotEmpty($wp_admin_bar->get_node('wporg'));
$this->assertNotEmpty($wp_admin_bar->get_node('resume-customize-snapshot'));
$this->go_to(home_url('?customize_snapshot_uuid=' . self::UUID));
$_REQUEST['customize_snapshot_uuid'] = self::UUID;
remove_all_actions('admin_bar_menu');
$manager = new Customize_Snapshot_Manager($this->plugin);
$manager->init();
$wp_admin_bar = new \WP_Admin_Bar();
// WPCS: Override OK.
$wp_admin_bar->initialize();
$wp_admin_bar->add_menus();
do_action_ref_array('admin_bar_menu', array(&$wp_admin_bar));
$this->assertNotEmpty($wp_admin_bar->get_node('inspect-customize-snapshot'));
$this->assertNotEmpty($wp_admin_bar->get_node('exit-customize-snapshot'));
$this->assertEmpty($wp_admin_bar->get_node('wporg'));
$this->assertNotEmpty($wp_admin_bar->get_node('resume-customize-snapshot'));
}