PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Database » DB_Table » Bug #5029

[PATCH] HTML_QuickForm filter support

Details

Request #5029[PATCH] HTML_QuickForm filter support
Submitted2005-08-08 22:16 UTC
Fromieure at php dot net
Assignedwiesemann
StatusClosed
PackageDB_Table
PHP VersionIrrelevant
OSLinux
Roadmaps(Not assigned)

Comments

[2005-08-08 22:16 UTC] ieure at php dot net

Description:
------------
This patch implements filter support for
DB_Table-generated forms.

In the column definition, you can now add:

$col = array(
'someField' => array(
'type' => 'clob',
...
'qf_filters' => array(
'strtolower',
'htmlspecialchars',
array('some_class', 'some_function')
)
),
...
);

...and so on. Filters are applied in the order they are
declared.

Unfortunately, you can only add regular functions and
static class methods. There's no way to assign $this in
class var definitions. I wanted to add a special key like
_THIS_CLASS_, but it doesn't appear that there's any way
to know what the correct class is from any function in
DB_Table_QuickForm. I'm open to suggestions, if you have
any.


Patch:
http://atomized.org/PEAR/DB_Table-filters.patch

[2005-08-09 18:49 UTC] ieure at php dot net

Right, I know about get_class(), but that won't work
because you can't use the result of an expression for
assigning a member variable.

I'll see about implementing form-wide filtering in a
couple days.