[wp-trac] [WordPress Trac] #5234: WTF? Just use a FOR Loop

WordPress Trac wp-trac at lists.automattic.com
Fri Oct 19 03:10:35 GMT 2007


#5234: WTF? Just use a FOR Loop
--------------------------+-------------------------------------------------
 Reporter:  darkdragon    |       Owner:  anonymous   
     Type:  enhancement   |      Status:  new         
 Priority:  lowest        |   Milestone:  2.5         
Component:  Optimization  |     Version:  2.4         
 Severity:  trivial       |    Keywords:  widgets WTF?
--------------------------+-------------------------------------------------
 In widgets.php file, contained in register_sidebars(), lines 72-82, there
 is a while loop that uses $i. It first sets $i to a value, then checks to
 make sure it is in a range, then it increments $i. I repeat, this is a
 while loop.

 {{{
         for($i=1; $i <= $number; ++$i)
         {
                 $_args = $args;
                 if ( $number > 1 ) {
                         $_args['name'] = isset($args['name']) ?
 $args['name'] : sprintf(__('Sidebar %d'), $i);
                 } else {
                         $_args['name'] = isset($args['name']) ?
 $args['name'] : __('Sidebar');
                 }
                 $_args['id'] = isset($args['id']) ? $args['id'] :
 "sidebar-$i";
                 register_sidebar($_args);
         }
 }}}

-- 
Ticket URL: <http://trac.wordpress.org/ticket/5234>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list