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


PHP WP_Admin_Bar::initialize方法代码示例

本文整理汇总了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'));
 }
开发者ID:xwp,项目名称:wp-customize-snapshots,代码行数:41,代码来源:test-class-customize-snapshot-manager.php


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