[wp-trac] [WordPress Trac] #18785: Modernize screen functions

WordPress Trac wp-trac at lists.automattic.com
Sat Oct 8 18:25:24 UTC 2011


#18785: Modernize screen functions
----------------------------+------------------------------
 Reporter:  nacin           |       Owner:  nacin
     Type:  enhancement     |      Status:  assigned
 Priority:  normal          |   Milestone:  Awaiting Review
Component:  Administration  |     Version:  3.3
 Severity:  normal          |  Resolution:
 Keywords:  needs-patch     |
----------------------------+------------------------------

Comment (by azaozz):

 Been reviewing WP_Screen in its current form and see some shortcomings:

 1. It goes against the notion of OOP. Base classes like this one should be
 easily extendable and have the basic methods that handle common usage.

 However WP_Screen is just a collection of private and semi-private
 functions that rely on filters and globals. It has no methods to handle
 the most common usage and has no methods that can be extended easily for
 handling more advanced usage. On top of that it can be re-initialized and
 loose all processed data.

 In that terms we have three options:

 - Forget about OOP and separate the functions. There's no benefits of them
 being in a class (and it will make the code shorter).

 - Make WP_Screen a pseudo-singleton, mark it as private and discourage
 plugins of ever trying to use it directly.

 - Add methods for the most common usage and make it easily extendable.

 2. It is a (very) bad idea to derive HTML IDs from translatable strings.
 They end up being useless as they are unpredictable and change from
 translation to translation. Also they are often illegal. What IDs will be
 derived from 官方中文站点 and 为您提供最新最全的 or हिन्दी अनुवाद and यहां उपलब्ध, and
 wouldn't they be the same (i.e. illegal in HTML context)?

 Looking at http://core.trac.wordpress.org/browser/trunk/wp-
 admin/includes/screen.php#L613 we should either require the ID or drop it
 completely.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/18785#comment:38>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list