[wp-hackers] using translated strings for action names
iacobs at m0n5t3r.info
Sun Jul 1 07:23:43 GMT 2007
FUJINAKA Tohru wrote:
>> This seems reasonable (although it looks like a textbook case for the
>> YAFL antipattern), but...
> How come is it reasonable?
> It isn't enough that just using $file argument of add_xxx_page() to
> build action names?
the mechanism seems thought out for people that put everything (almost
everything... I haven't seen someone retarded enough to also put images)
in one gigantic file; otherwise, it is really YAFL (Yet Another Layer -
to use the description from Wikipedia which avoids the F :D):
> a. in case add_xxx_page() without the last argument $function,
> $file must be unique among WP and related files.
in this case, $file should be a plugin_basename and that's it. no more
action hook lookup, just include it if possible; this is similar to the
current behaviour for options pages
> b. in case add_xxx_page() with the last argument $function set,
> $file is used just for action names, not used by `include'.
> so plugin developer could set $file freely like as an unique ID.
> Without framework's help that adding prefix from parent's menu
> text and `_page_', developers still make hook tags to be unique.
... or make sure the name is predictible (build $admin_page_hooks before
More information about the wp-hackers