Theme Customizer: Improve WP_Customize_Setting->check_capabilities(). Add support for arrays in WP_Customize_Setting->capability and WP_Customize_Setting->theme_supports. Don't bail when WP_Customize_Setting->capability is empty. see #19910.

git-svn-id: http://svn.automattic.com/wordpress/trunk@20232 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
koopersmith 2012-03-21 04:59:57 +00:00
parent 359ed454b7
commit 61d7f6a476
2 changed files with 4 additions and 4 deletions

View File

@ -46,10 +46,10 @@ class WP_Customize_Section {
* @return bool False if theme doesn't support the section or user doesn't have the capability.
*/
function check_capabilities() {
if ( ! $this->capability || ! current_user_can( $this->capability ) )
if ( $this->capability && ! call_user_func_array( 'current_user_can', (array) $this->capability ) )
return false;
if ( $this->theme_supports && ! current_theme_supports( $this->theme_supports ) )
if ( $this->theme_supports && ! call_user_func_array( 'current_theme_supports', (array) $this->theme_supports ) )
return false;
return true;

View File

@ -267,10 +267,10 @@ class WP_Customize_Setting {
public final function check_capabilities() {
global $customize;
if ( ! $this->capability || ! current_user_can( $this->capability ) )
if ( $this->capability && ! call_user_func_array( 'current_user_can', (array) $this->capability ) )
return false;
if ( $this->theme_supports && ! current_theme_supports( $this->theme_supports ) )
if ( $this->theme_supports && ! call_user_func_array( 'current_theme_supports', (array) $this->theme_supports ) )
return false;
$section = $customize->get_section( $this->section );