Make WordPress Core

Opened 19 years ago

Closed 19 years ago

Last modified 19 years ago

#5234 closed enhancement (fixed)

widgets.php a while that should be a for loop

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

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 19 years ago.

Download all attachments as: .zip

Change History (6)

@DD32
19 years ago

#1 @DD32
19 years ago

  • Keywords has-patch added; WTF? removed

#2 @foolswisdom
19 years ago

  • Keywords commit added
  • Milestone 2.52.4

#3 @westi
19 years ago

  • Resolutionfixed
  • Status newclosed

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

#4 @foolswisdom
19 years ago

  • Summary WTF? Just use a FOR Loopwidgets.php a while that should be a for loop

#5 @anonymized_218323
19 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.