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


PHP WP_Customize_Control::check_capabilities方法代码示例

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


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

示例1: array

 /**
  * Test WP_Customize_Control::check_capabilities().
  *
  * @see WP_Customize_Control::check_capabilities()
  */
 function test_check_capabilities()
 {
     do_action('customize_register', $this->wp_customize);
     $control = new WP_Customize_Control($this->wp_customize, 'blogname', array('settings' => array('blogname')));
     $this->assertTrue($control->check_capabilities());
     $control = new WP_Customize_Control($this->wp_customize, 'blogname', array('settings' => array('blogname', 'non_existing')));
     $this->assertFalse($control->check_capabilities());
     $this->wp_customize->add_setting('top_secret_message', array('capability' => 'top_secret_clearance'));
     $control = new WP_Customize_Control($this->wp_customize, 'blogname', array('settings' => array('blogname', 'top_secret_clearance')));
     $this->assertFalse($control->check_capabilities());
     $control = new WP_Customize_Control($this->wp_customize, 'no_setting', array('settings' => array()));
     $this->assertTrue($control->check_capabilities());
     $control = new WP_Customize_Control($this->wp_customize, 'no_setting', array('settings' => array(), 'capability' => 'top_secret_clearance'));
     $this->assertFalse($control->check_capabilities());
     $control = new WP_Customize_Control($this->wp_customize, 'no_setting', array('settings' => array(), 'capability' => 'edit_theme_options'));
     $this->assertTrue($control->check_capabilities());
 }
开发者ID:aaemnnosttv,项目名称:develop.git.wordpress.org,代码行数:22,代码来源:control.php

示例2: array

 /**
  * Test WP_Customize_Control::check_capabilities().
  *
  * @see WP_Customize_Control::check_capabilities()
  */
 function test_check_capabilities()
 {
     wp_set_current_user(self::factory()->user->create(array('role' => 'administrator')));
     do_action('customize_register', $this->wp_customize);
     $control = new WP_Customize_Control($this->wp_customize, 'blogname', array('settings' => array('blogname')));
     $this->assertTrue($control->check_capabilities());
     $control = new WP_Customize_Control($this->wp_customize, 'blogname', array('settings' => array('blogname', 'non_existing')));
     $this->assertFalse($control->check_capabilities());
     $this->wp_customize->add_setting('top_secret_message', array('capability' => 'top_secret_clearance'));
     $control = new WP_Customize_Control($this->wp_customize, 'blogname', array('settings' => array('blogname', 'top_secret_clearance')));
     $this->assertFalse($control->check_capabilities());
     $control = new WP_Customize_Control($this->wp_customize, 'no_setting', array('settings' => array()));
     $this->assertTrue($control->check_capabilities());
     $control = new WP_Customize_Control($this->wp_customize, 'no_setting', array('settings' => array(), 'capability' => 'top_secret_clearance'));
     $this->assertFalse($control->check_capabilities());
     $control = new WP_Customize_Control($this->wp_customize, 'no_setting', array('settings' => array(), 'capability' => 'edit_theme_options'));
     $this->assertTrue($control->check_capabilities());
 }
开发者ID:atimmer,项目名称:wordpress-develop-mirror,代码行数:23,代码来源:control.php


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