[wp-trac] [WordPress Trac] #33413: most PHP classes should be in their own file
WordPress Trac
noreply at wordpress.org
Wed Sep 9 05:30:51 UTC 2015
#33413: most PHP classes should be in their own file
----------------------------+-----------------------------
Reporter: wonderboymusic | Owner: wonderboymusic
Type: enhancement | Status: assigned
Priority: normal | Milestone: 4.4
Component: General | Version: trunk
Severity: normal | Resolution:
Keywords: dev-feedback | Focuses:
----------------------------+-----------------------------
Comment (by westonruter):
Replying to [comment:57 wonderboymusic]:
> [attachment:33413.3.diff 33413.3.diff] handles the Customizer, […]
`_wp_customize_include()` now loads `wp-includes/customize-functions.php`
and `wp-includes/customize/class-wp-customize-manager.php` - I found no
use cases of these files being loaded by plugins:
https://github.com/search?utf8=%E2%9C%93&q=user%3Awp-plugins+class-wp-
customize&type=Code&ref=searchresults .... compared to:
https://github.com/search?utf8=%E2%9C%93&q=user%3Awp-plugins+class-
http&type=Code&ref=searchresults
I've actually required it directly in my plugins, ''however'', this was
done specifically in PHPUnit tests: https://github.com/xwp/wp-customize-
widgets-plus/search?utf8=%E2%9C%93&q=class-wp-customize-
manager.php&type=Code
If you search GitHub across all repos, you'll see many examples of this
(though many are just clones of Core): https://github.com/search?l=php&q
=class-wp-customize-manager.php&type=Code
I suppose it is acceptable to break plugin unit tests with this re-
organization if this is all that breaks… but, loading other class files is
not limited to unit tests. I see [https://github.com/search?l=php&q=class-
wp-customize-control.php&ref=searchresults&type=Code&utf8=%E2%9C%93
examples] of directly loading the control class file `require_once(
ABSPATH . WPINC . '/class-wp-customize-control.php' )`:
*
https://github.com/nathancorbier/condemnationlaw/blob/631af9ba9a9cf9b2b09c58e3c9ead930081b55a4
/wp-content/themes/stacy/includes/class-fonts-customizer.php#L2
* https://github.com/xwp/wp-settings-
revisions/blob/231ba0ff2991d15980c9ec34c180f20b26dea489/php/meta-
control.php#L3
* https://github.com/engrnvd/Wordpress-
Sandbox/blob/ac31a58db97df411b3dc3b698ad80379907bb93b/wp-content/themes
/dw-fixel/inc/class-customization.php#L2
These plugins would all break.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/33413#comment:59>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list