From de07276a49c5e7223b9e6ac0bb63c847f32b0368 Mon Sep 17 00:00:00 2001
From: jrfnl <jrfnl@users.noreply.github.com>
Date: Thu, 18 Jul 2019 08:12:02 +0200
Subject: [PATCH] Simplify & modernize WP_Customize_*::check_capabilities()
---
src/wp-includes/class-wp-customize-panel.php | 4 ++--
src/wp-includes/class-wp-customize-section.php | 4 ++--
src/wp-includes/class-wp-customize-setting.php | 4 ++--
3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/wp-includes/class-wp-customize-panel.php b/src/wp-includes/class-wp-customize-panel.php
index 17d3640f8d..92761d729b 100644
|
a
|
b
|
class WP_Customize_Panel { |
| 224 | 224 | * @return bool False if theme doesn't support the panel or the user doesn't have the capability. |
| 225 | 225 | */ |
| 226 | 226 | final public function check_capabilities() { |
| 227 | | if ( $this->capability && ! call_user_func_array( 'current_user_can', (array) $this->capability ) ) { |
| | 227 | if ( $this->capability && ! current_user_can( $this->capability ) ) { |
| 228 | 228 | return false; |
| 229 | 229 | } |
| 230 | 230 | |
| 231 | | if ( $this->theme_supports && ! call_user_func_array( 'current_theme_supports', (array) $this->theme_supports ) ) { |
| | 231 | if ( $this->theme_supports && ! current_theme_supports( ... (array) $this->theme_supports ) ) { |
| 232 | 232 | return false; |
| 233 | 233 | } |
| 234 | 234 | |
diff --git a/src/wp-includes/class-wp-customize-section.php b/src/wp-includes/class-wp-customize-section.php
index 6a7b812f2d..40d9ae37fe 100644
|
a
|
b
|
class WP_Customize_Section { |
| 242 | 242 | * @return bool False if theme doesn't support the section or user doesn't have the capability. |
| 243 | 243 | */ |
| 244 | 244 | final public function check_capabilities() { |
| 245 | | if ( $this->capability && ! call_user_func_array( 'current_user_can', (array) $this->capability ) ) { |
| | 245 | if ( $this->capability && ! current_user_can( $this->capability ) ) { |
| 246 | 246 | return false; |
| 247 | 247 | } |
| 248 | 248 | |
| 249 | | if ( $this->theme_supports && ! call_user_func_array( 'current_theme_supports', (array) $this->theme_supports ) ) { |
| | 249 | if ( $this->theme_supports && ! current_theme_supports( ... (array) $this->theme_supports ) ) { |
| 250 | 250 | return false; |
| 251 | 251 | } |
| 252 | 252 | |
diff --git a/src/wp-includes/class-wp-customize-setting.php b/src/wp-includes/class-wp-customize-setting.php
index 3e0a1c0770..08d5b1c348 100644
|
a
|
b
|
class WP_Customize_Setting { |
| 815 | 815 | * @return bool False if theme doesn't support the setting or user can't change setting, otherwise true. |
| 816 | 816 | */ |
| 817 | 817 | final public function check_capabilities() { |
| 818 | | if ( $this->capability && ! call_user_func_array( 'current_user_can', (array) $this->capability ) ) { |
| | 818 | if ( $this->capability && ! current_user_can( $this->capability ) ) { |
| 819 | 819 | return false; |
| 820 | 820 | } |
| 821 | 821 | |
| 822 | | if ( $this->theme_supports && ! call_user_func_array( 'current_theme_supports', (array) $this->theme_supports ) ) { |
| | 822 | if ( $this->theme_supports && ! current_theme_supports( ... (array) $this->theme_supports ) ) { |
| 823 | 823 | return false; |
| 824 | 824 | } |
| 825 | 825 | |