WordPress.org

Make WordPress Core

Ticket #47678: 47678-WP_Customize_-check_capabilities.patch

File 47678-WP_Customize_-check_capabilities.patch, 3.1 KB (added by jrf, 7 months ago)

Simplify & modernize WP_Customize_*::check_capabilities()

  • src/wp-includes/class-wp-customize-panel.php

    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 { 
    224224         * @return bool False if theme doesn't support the panel or the user doesn't have the capability.
    225225         */
    226226        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 ) ) {
    228228                        return false;
    229229                }
    230230
    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 ) ) {
    232232                        return false;
    233233                }
    234234
  • src/wp-includes/class-wp-customize-section.php

    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 { 
    242242         * @return bool False if theme doesn't support the section or user doesn't have the capability.
    243243         */
    244244        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 ) ) {
    246246                        return false;
    247247                }
    248248
    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 ) ) {
    250250                        return false;
    251251                }
    252252
  • src/wp-includes/class-wp-customize-setting.php

    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 { 
    815815         * @return bool False if theme doesn't support the setting or user can't change setting, otherwise true.
    816816         */
    817817        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 ) ) {
    819819                        return false;
    820820                }
    821821
    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 ) ) {
    823823                        return false;
    824824                }
    825825