[pLog-svn] r5861 - plog/branches/lifetype-1.2/class/data
Jon Daley
plogworld at jon.limedaley.com
Fri Aug 24 09:42:20 EDT 2007
On Fri, 24 Aug 2007, Oscar Renalias wrote:
> We can remove the $filter parameter from Properties::getValue() if
> it's true that it is not being used.
The problem is that doesn't make a difference, since there is the
"|| isset(filterclass) inside getValue()
> We don't need to implement Properties::getUnfilteredValue() because we
> already have the opposite, Properties::getFilteredValue().
getValue and getFilteredValue are basically the same thing.
> But what would you need Properties::filterData() for?
Because the data should always be filtered, just after the
stripslashes() call. So, request->getValue would look like:
getunfilteredata();
if(magic_quotes)
stripslashes();
filterData();
> Why don't we just process all values in the request inside the Request
> constructor, and perform the call to strip_slashes in there rather
> than in the get[Filtered]Value() methods? In that case we wouldn't
> need to worry about doing it later, and we could be sure that the data
> has already been filtered.
That sounds fine, it is just duplicating code from inside the
parent class.
I think you are proposing:
function getValue( $key, $defaultValue = null)
{
if( !isset($this->_props[$key]) ) {
$value = $defaultValue;
} else {
$value = $this->_props[$key];
}
if( get_magic_quotes_gpc() && !is_array( $value ))
$value = stripslashes( $value );
if(isset( $this->_keyFilters[$key] ))
$value = $this->_keyFilters[$key]->filter($value);
return( $value );
}
I think it would be better to not duplicate the code from properties and
only reference the _props and _keyFilters from inside Properties with a
getUnfilteredValue() and filterData() which would do the first and third
blocks of the above code.
More information about the pLog-svn
mailing list