Ticket #4546 (closed defect: fixed)

Opened 1 year ago

Last modified 1 year ago

Sanitizing sanitization and filter invocation

Reported by: ryan Assigned to: anonymous
Priority: normal Milestone: 2.3
Component: Administration Version: 2.3
Severity: normal Keywords: filters santize
Cc:

Description

I think some better API would help eliminate having to apply filters by hand in so many places. see #4516, #4050, ...

The term API introduced santize_term() and sanitize_term_field() which sanitizes term fields and applies filters based upon the context in which the term is used. This could be augmented and extended to other objects. Using terms as an example, ...

Add a 'the' context to sanitize_term() and sanitize_term_field(). 'the' will trigger the_term_$field and the_$taxonomy_$field filters in addition to the existing term_$field and $taxonomy_$field filters. We'll need to map the_$taxonomy_name to the_$taxonomy for back compat.

Add a filter argument to get_term(). If filter is specified, get_term() will use it to sanitize_term. The cache should store only unfiltered terms, so filtering should be done after the cache add.

Add a filter option to get_terms(). If a filter is specified, get_terms() will run sanitize_term() against each fetched term object.

Do the same for posts and other objects. Create sanitize_post() and sanitize_post_field() and add a filter argument to get_post().

In those places where we have to filter a field by hand, use sanitize_*_field() to trigger the filters instead of calling apply_filters directly.

Attachments

post_filter.diff (7.2 kB) - added by ryan on 07/03/07 21:52:59.
Post filtering example
sanitize_and_filter.diff (19.4 kB) - added by ryan on 08/19/07 18:43:20.
Add sanitize_bookmark_field; cleanup default filters

Change History

07/03/07 21:52:59 changed by ryan

  • attachment post_filter.diff added.

Post filtering example

07/03/07 21:53:35 changed by ryan

Patch introduces sanitize_post() and sanitize_post_field() and adds a filter option to get_post().

07/11/07 19:57:43 changed by ryan

(In [5796]) Post filter rework. see #4546

08/19/07 18:43:20 changed by ryan

  • attachment sanitize_and_filter.diff added.

Add sanitize_bookmark_field; cleanup default filters

08/19/07 18:43:46 changed by ryan

Patch adds some bookmark sanitization API and cleans up default filters.

08/20/07 22:50:07 changed by ryan

(In [5906]) bookmark sanitizer funcs and default filter cleanup. see #4546

09/03/07 16:24:39 changed by ryan

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