WordPress.org

Make WordPress Core

Changes between Initial Version and Version 2 of Ticket #27315


Ignore:
Timestamp:
06/18/2014 05:24:55 AM (5 years ago)
Author:
westonruter
Comment:

Agreed. get_class_vars( __CLASS__ ) should be replaced with get_object_vars( $this ). This would actually bring WP_Customize_Section in line WP_Customize_Control which initially did use get_class_vars() but in [20319] was changed to use get_object_vars().

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #27315

    • Property Focuses ui removed
    • Property Component changed from Administration to Appearance
    • Property Version changed from 3.8.1 to 3.4
    • Property Milestone changed from Awaiting Review to Future Release
    • Property Keywords good-first-bug needs-patch added
  • Ticket #27315 – Description

    initial v2  
    1 WP_Customize_Section uses `$keys = array_keys( get_class_vars( __CLASS__ ) );` to set class variables, but WP_Customize_Control uses `$keys = array_keys( get_object_vars( $this ) );` to set class variables.
     1`WP_Customize_Section` uses `$keys = array_keys( get_class_vars( __CLASS__ ) );` to set class variables, but `WP_Customize_Control` uses `$keys = array_keys( get_object_vars( $this ) );` to set class variables.
    22
    3 The difference is that if you extend WP_Customize_Control you can add new class variables by setting them in the extended class and passing them to the args array in the constructor.
    4 In WP_Customize_Section one has to override the constructor to do the same.
     3The difference is that if you extend `WP_Customize_Control` you can add new class variables by setting them in the extended class and passing them to the args array in the constructor.
     4In `WP_Customize_Section` one has to override the constructor to do the same.
    55
    66changing
    7 `$keys = array_keys( get_class_vars( __CLASS__ ) );`
     7{{{
     8$keys = array_keys( get_class_vars( __CLASS__ ) );
     9}}}
    810to
    9 `$keys = array_keys( get_object_vars( $this ) );`
    10 in WP_Customize_Section would solve the problem (or use the static keyword which would raise the requirements to PHP 5.3)
     11{{{
     12$keys = array_keys( get_object_vars( $this ) );
     13}}}
     14in `WP_Customize_Section` would solve the problem (or use the static keyword which would raise the requirements to PHP 5.3)