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


PHP WP_Customize_Manager::customize_preview_init方法代码示例

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


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

示例1:

 /**
  * Do Customizer boot actions.
  */
 function do_customize_boot_actions()
 {
     $_SERVER['REQUEST_METHOD'] = 'POST';
     do_action('setup_theme');
     do_action('after_setup_theme');
     do_action('init');
     do_action('customize_register', $this->wp_customize);
     $this->wp_customize->customize_preview_init();
     do_action('wp', $GLOBALS['wp']);
 }
开发者ID:aaemnnosttv,项目名称:develop.git.wordpress.org,代码行数:13,代码来源:selective-refresh-ajax.php

示例2:

 /**
  * Do Customizer boot actions.
  */
 function do_customize_boot_actions()
 {
     // Remove actions that call add_theme_support( 'title-tag' ).
     remove_action('after_setup_theme', 'twentyfifteen_setup');
     remove_action('after_setup_theme', 'twentysixteen_setup');
     $_SERVER['REQUEST_METHOD'] = 'POST';
     do_action('setup_theme');
     do_action('after_setup_theme');
     do_action('init');
     do_action('customize_register', $this->wp_customize);
     $this->wp_customize->customize_preview_init();
     do_action('wp', $GLOBALS['wp']);
 }
开发者ID:ntwb,项目名称:wordpress-travis,代码行数:16,代码来源:selective-refresh-ajax.php

示例3: array

 /**
  * Test WP_Customize_Manager::customize_preview_init().
  *
  * @ticket 30937
  * @covers WP_Customize_Manager::customize_preview_init()
  */
 function test_customize_preview_init()
 {
     // Test authorized admin user.
     wp_set_current_user(self::$admin_user_id);
     $did_action_customize_preview_init = did_action('customize_preview_init');
     $wp_customize = new WP_Customize_Manager();
     $wp_customize->customize_preview_init();
     $this->assertEquals($did_action_customize_preview_init + 1, did_action('customize_preview_init'));
     $this->assertEquals(10, has_action('wp_head', 'wp_no_robots'));
     $this->assertEquals(10, has_action('wp_head', array($wp_customize, 'remove_frameless_preview_messenger_channel')));
     $this->assertEquals(10, has_filter('wp_headers', array($wp_customize, 'filter_iframe_security_headers')));
     $this->assertEquals(10, has_filter('wp_redirect', array($wp_customize, 'add_state_query_params')));
     $this->assertTrue(wp_script_is('customize-preview', 'enqueued'));
     $this->assertEquals(10, has_action('wp_head', array($wp_customize, 'customize_preview_loading_style')));
     $this->assertEquals(20, has_action('wp_footer', array($wp_customize, 'customize_preview_settings')));
     // Test unauthorized user outside preview (no messenger_channel).
     wp_set_current_user(self::$subscriber_user_id);
     $wp_customize = new WP_Customize_Manager();
     $wp_customize->register_controls();
     $this->assertNotEmpty($wp_customize->controls());
     $wp_customize->customize_preview_init();
     $this->assertEmpty($wp_customize->controls());
     // Test unauthorized user inside preview (with messenger_channel).
     wp_set_current_user(self::$subscriber_user_id);
     $wp_customize = new WP_Customize_Manager(array('messenger_channel' => 'preview-0'));
     $exception = null;
     try {
         $wp_customize->customize_preview_init();
     } catch (WPDieException $e) {
         $exception = $e;
     }
     $this->assertNotNull($exception);
     $this->assertContains('Unauthorized', $exception->getMessage());
 }
开发者ID:CompositeUK,项目名称:clone.WordPress-Develop,代码行数:40,代码来源:manager.php


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