[wp-trac] [WordPress Trac] #36335: Next generation: core autoloader proposal
WordPress Trac
noreply at wordpress.org
Sat Sep 24 05:39:43 UTC 2016
#36335: Next generation: core autoloader proposal
-----------------------------+------------------
Reporter: dnaber-de | Owner:
Type: feature request | Status: new
Priority: normal | Milestone: 4.7
Component: General | Version:
Severity: normal | Resolution:
Keywords: has-patch | Focuses:
-----------------------------+------------------
Comment (by MikeSchinkel):
'''One Class Per File vs. Multiple Classes per File'''
Next we consider classes that are contained in a file by themselves vs.
files that contain multiple classes.
There appear to be `57` classes that are each contained in a file that
contains at least one other class. These are all in the `wp-includes`
directory. Most of these come from externally included projects such as:
1. `IXR` - ''The Incutio XML-RPC Library''
2. `Text/Diff` - ''General API for generating and formatting diffs''
3. `pomo` - ''Translations''
4. `SimplePie` - ''RSS and Atom feed parsing''
5. `ID3` - ''Extracts information from MP3s & other multimedia files''
6. `MagpieRSS` - ''RSS and Atom parser (deprecated in WP)''
7. `Services_JSON` - ''Converts to and from JSON format''
8. `AtomLib` - ''Atom Syndication Format PHP Library''
9. `PHPMailer` - ''PHP email creation and transport class''
Some of these include constant declarations inside the class files
''(ugh!)'' including `MagpieRSS`, `Test/Diff`, `SimplePie`, `ID3`, and
`pomo`. That means to autoload these we'd have to extract the defines and
decide where and when to include them ''(my huge patch from a last week
moved them into `/wp-includes/constants` and `/wp-admin/contstants` and
then loaded them from `/wp-settings.php` and .`/wp-
admin/includes/admin/php`, respectively.)''
Some of these would be easy to break out since they do not perform any
`require()/require_once()` or `include()/include_once` and are not loaded
with dynamic name generation, such as `PHPMailer`, `AtomLib`, and
`Services_JSON`, but '''since they came from external code I don't know
what the core team's opinion is on restructuring their code?'''
Other files containing classes would be really easy to break out but since
I analyzed WP `4.6.1` as I write this I am discovering that someone
already has done this in `trunk`. So no need for a patch for these as I
had planned!
As for the ones above that would not be easy I expect we will tackle them
last, or maybe not at all, all depending on what the core team decides.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/36335#comment:206>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list