[wp-trac] [WordPress Trac] #15327: Strip down admin-ajax.php to be a bare bones ajax handler.

WordPress Trac wp-trac at lists.automattic.com
Fri Jan 20 20:36:22 UTC 2012


#15327: Strip down admin-ajax.php to be a bare bones ajax handler.
------------------------------------------------+--------------------------
 Reporter:  westi                               |       Owner:  kurtpayne
     Type:  enhancement                         |      Status:  accepted
 Priority:  normal                              |   Milestone:  Future
Component:  Administration                      |  Release
 Severity:  normal                              |     Version:  3.1
 Keywords:  westi-likes has-patch dev-feedback  |  Resolution:
------------------------------------------------+--------------------------

Comment (by nacin):

 Resounding +1.

 ----

 Notes:

 1. It looks like indentation is off in ajax-actions.

 2. We would be well-served to do a svn cp admin-ajax.php includes/ajax-
 actions.php, to keep the history of individual actions, particularly since
 we can get away with it in terms of indentation being the same.

 3. I would normally like the abstraction in the handler, but since it is a
 nice heads up display, I would vote it become a bit more obvious,
 something like:

 {{{
 add_action( 'wp_ajax_nopriv_autosave', 'wp_ajax_nopriv_autosave' ), 1 );

 $core_actions = array( ... );
 foreach ( $core_actions as $action ) {
     add_action( 'wp_ajax_' . $action, 'wp_ajax_' . str_replace( '-', '_',
 $action ), 1 );
 }
 unset( $core_actions, $action );
 }}}

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


More information about the wp-trac mailing list