Make WordPress Core

Opened 18 years ago

Closed 18 years ago

Last modified 3 months ago

#2888 closed enhancement (fixed)

New function to reset vars

Reported by: sewar's profile Sewar Owned by: sewar's profile Sewar
Milestone: 2.1 Priority: normal
Severity: normal Version: 2.1
Component: Optimization Keywords: bg|has-patch bg|needs-testing
Focuses: Cc:

Description

Most files in wordpress/wp-admin/*.php start with 15-lines-code to reset vars in an array. So, just move this code to new function and put it in admin-functions.php. This is better than write same code in +10 files.

In the patch i used $_REQUEST because it contain both of $_POST and $_GET, this will offer some lines. Also, the var unseted according to #2595.

Also, isn't "foreach" better than "for"? or at least more cleaner?

Attachments (2)

wp_reset_vars.diff (15.2 KB) - added by Sewar 18 years ago.
comment.php.diff (789 bytes) - added by Sewar 18 years ago.
Patch for comment.php file

Download all attachments as: .zip

Change History (9)

@Sewar
18 years ago

#1 @Sewar
18 years ago

  • Keywords bg|has-patch bg|needs-testing added
  • Owner changed from anonymous to Sewar

#2 @robmiller
18 years ago

Ha! I was just planning on doing this today. Nice work :)

#3 @ryan
18 years ago

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

(In [3946]) wp_reset_vars() from Sewar. fixes #2888

#4 @ryan
18 years ago

I've been wanting to do this for some time but never got around to it. Committed, thanks. A nice followup patch would be to audit the vars and remove those that are no longer relevant.

@Sewar
18 years ago

Patch for comment.php file

#5 @Sewar
18 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

The new patch is for comment.php file, i forget to merge it in the first patch. i just seen that it wasn't merged after updating SVN. Sorry for this.

#6 @ryan
18 years ago

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

(In [3956]) wp_reset_vars(). Props Sewar. fixes #2888

#7 @ryan
18 years ago

(In [3969]) Use POST and GET instead of REQUEST since they are sanitized. fixes #2888

Note: See TracTickets for help on using tickets.