[dev] Re: [cvs] commit: kronolith month.php [patch attached]

Derek P. Moore derekm at hackunix.org
Mon Nov 29 21:03:16 PST 2004


Quoting Chuck Hagenbuch <chuck at horde.org>:

>> I'll attempt to integrate grepping of the $attr string for 'title=', 
>> if nobody else gets around to it first.
>
> I thought about this and decided not to bother. First of all, this is no
> different from before. Second, it would go for alt and src tags, too. So
> basically this way of specifying attributes is deprecated, and no code that
> previously worked is now broken.

I had already implemented title grepping before you send out this response.
And your pointing out the cases of alt and src got me thinking...

I've added just a few simple lines which in a very simple fashion causes both
string and array modes of attribute handling to behave identically.

As is, the two modes behave logically different.

For example:  In array mode, the programmer can cleanly overwrite the 
src, alt,
and title attributes; and he won't have any problems of duplicate (and 
invalid)
output.  In string mode, if the programmer is used to using the array
overwriting trick, but wants to use string mode for some reason, he should be
able to expect reasonably similar results.  If Horde::img() can handle these
cases simply and cleanly, and not output duplicates in string mode, this is
potentially a Feature(TM) for the programmer.

As Horde hopes to be a general purpose web application framework, hopefully
lots of people will get to know lots of its parts, and use it in lots 
of places
in lots of ways.

The programmer should be able to expect both modes of the function to operate
similarly, and if they do, this really helps the programmer.  The programmer
can then exploit these Features of Horde(tm) consistently and with Reasonably
Similar Results(tm).

See the patch for how simple this level of consistency is.

Also...  Clean ups in this patch:

In implementing the $attributes array, you got rid of 'global $browser'.  This
patch also gets rid of 'global $registry'.

The Horde::img() now uses the more readable function-based tests, instead of
traditional comparisons, in all 'if' cases but the null test for $dir.
is_null() and '=== null' are identical, but one is more consistent with its
neighboring code.  I see these sorts of code clean-ups as worthwhile.

And lets not forget documentation!  This patch also spruces up the
documentation of the new API a bit.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: Horde.php.diff
Type: text/x-patch
Size: 1903 bytes
Desc: not available
Url : http://lists.horde.org/archives/dev/attachments/20041129/5e4bb1be/Horde.php.bin


More information about the dev mailing list