Ticket #5234 (closed enhancement: fixed)

Opened 1 year ago

Last modified 1 year ago

widgets.php a while that should be a for loop

Reported by: darkdragon Assigned to: anonymous
Priority: lowest Milestone: 2.5
Component: Optimization Version: 2.5
Severity: trivial Keywords: widgets has-patch commit
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

5234.diff (0.6 kB) - added by DD32 on 10/19/07 05:45:41.

Change History

10/19/07 05:45:41 changed by DD32

  • attachment 5234.diff added.

10/19/07 05:46:21 changed by DD32

  • keywords changed from widgets WTF? to widgets has-patch.

10/19/07 07:07:38 changed by foolswisdom

  • keywords changed from widgets has-patch to widgets has-patch commit.
  • milestone changed from 2.5 to 2.4.

10/19/07 16:32:56 changed by westi

  • status changed from new to closed.
  • resolution set to fixed.

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

10/19/07 16:34:51 changed by foolswisdom

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

10/19/07 17:16:22 changed by santosj

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!