Make WordPress Core

Opened 17 years ago

Closed 17 years ago

Last modified 17 years ago

#5234 closed enhancement (fixed)

widgets.php a while that should be a for loop

Reported by: darkdragon's profile darkdragon Owned by:
Milestone: 2.5 Priority: lowest
Severity: trivial Version: 2.5
Component: Optimization Keywords: widgets has-patch commit
Focuses: Cc:

Description

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);
	}

Attachments (1)

5234.diff (615 bytes) - added by DD32 17 years ago.

Download all attachments as: .zip

Change History (6)

@DD32
17 years ago

#1 @DD32
17 years ago

  • Keywords has-patch added; WTF? removed

#2 @foolswisdom
17 years ago

  • Keywords commit added
  • Milestone changed from 2.5 to 2.4

#3 @westi
17 years ago

  • Resolution set to fixed
  • Status changed from new to closed

(In [6275]) Use a for loop where it's more appropriate. Fixes #5234 props darkdragon and DD32.

#4 @foolswisdom
17 years ago

  • Summary changed from WTF? Just use a FOR Loop to widgets.php a while that should be a for loop

#5 @santosj
17 years ago

Sorry, I'll pull my head out of my ass the next time I make a ticket and see something I don't like.

Much better Summary!

Note: See TracTickets for help on using tickets.