Re: Hook requests
footer.php (line 103)
- Hook to retrieve to modify the query.
You are not logged in. Please login or register.
PunBB Forums → PunBB 1.3 extensions → Hook requests
footer.php (line 103)
- Hook to retrieve to modify the query.
footer.php (line 103)
- Hook to retrieve to modify the query.
Added
At start of generate_crumbs function for modify crumbs array (i need it to add at start portal page)
edit: i didn't need this hook, because i can modify it from some header hooks
Can we get a hook in search.php after line 761 ("$db->free_result($result);") so an extension can do things with the $search_set array?
Rickard wrote:Anyone else have an idea?
if(count(array_intersect($perms_new, $perms_old)) != count($perms_new)) { if(count(array_intersect($perms_new, $perms_default)) == count($perms_new)) { // Delete } else { // Insert/Update } }
It should be quite easy to build the queries and the form directly from $perms. If done right, you will just have to add elements to $perms and $perms_default to add permissions. Forms, validation and queries are so similar that it will work most of the time, and when it doesn't you can always use some other hook. Depending on how it's all implemented you might have to use array_intersect_assoc() instead of array_intersect(), as the latter doesn't care about indexes.
Nice idea. I've committed it. I used regular array operators to do the comparison though.
A hook in functions.php outside the functions would allow to add custom ones.
I think I got all of them (that made sense anyway ): http://dev.punbb.org/changeset/1521
Strofanto: We can't do that in functions.php because by the time we include functions.php, the hooks system hasn't been initialized yet. I recommend you use co_common instead.
We can't do that in functions.php because by the time we include functions.php, the hooks system hasn't been initialized yet. I recommend you use co_common instead.
Gotcha. Thanks.
We need a hook in include/common_admin.php (function generate_admin_menu) to add main tabs to the admin menu.
Done.
i have a little idea about hooks ... i dont know how many hooks must be added to complete
a new hook may be needed any time ... even after the release .... so i came up with the idea ....
can it be possible to make hook page in admin area that places hooks in the files or into 1 file and then that file will spread to other files...
or
for extension you need specific hooks ... so post the hooks in the readme file and that hooks to the page of hooks in the admin area ...
just an idea
What? If I understand your post, which I doubt, no.
There's a vf_table_header_after_num_views and vf_table_contents_after_num_views, why not some for before num_views?
Wouldn't all the columns (including headers) be much more malleable if they were stored in an ordered numbered array rather than as associative array?
Wouldn't all the columns (including headers) be much more malleable if they were stored in an ordered numbered array rather than as associative array?
I don't see how.
In general, wouldn't it be good to keep the hook layout consistent (where applicable) between the topic-listing parts in viewforum.php, moderate.php, and search.php?
Today I'm wondering if you could add a hook in each somewhere after $pun_page['item_status'] is set but before $pun_page['item_style'] and $pun_page['item_indicator'] are generated.
Edit: By the way, why is the "($hook = get_hook(...)) ? eval($hook) : null;" boilerplate necessary? If you had get_hook return '' instead of false when there are no entries for a given hook, you could just do "eval(get_hook(...));". I think that would be good for readability.
You'd still be calling eval() uselessly then, which I'm sure is slower than a little check, even with false as the argument.
You're right, I must admit. I did some testing, and I found that while a "($hook = get_hook(...)) ? eval($hook) : null;" statement can execute on my computer almost 2.23 million times per second, "eval(get_hook(...));" can only execute a pathetic 1.26 million times.
(On a trip to viewtopic.php just now, I found that 159 undefined hooks were called. By my calculations, this means one second would be wasted after 18,294 calls to viewtopic.php. My moderately-high-traffic forum got 62,083 hits to viewtopic.php last month, which means that if the modified hook code had been used at the time, viewtopic.php would have wasted approximately 3.4 CPU-seconds over the month. Is this deemed acceptable or not?)
For forum software like this, it isn't very acceptable indeed =P 3.4 CPU seconds is actually quite alot.
I've already stated in another thread than "eval" function is one of SLOWEST call in php (and in other languages as well..).
Seeing the reacts at that time, i've stopped "informing" (as it was somehow considered as "complaining", which obviously was not).
The conclusion for me : let's "wait and see"...
Basically, it's obvious that an 'extension' will be slower than its corresponding 'mod'. But, is this really noticeable (or become a problem), we don't know as today.
And is the 'extension' system in a whole worth the slowdown, we don't know either, even if i'm tempted to think YES (before having testing any extension..), for the simplicity of extensions against mods.
Indeed. People tend to only think about how much CPU time it might waste, but think of all the programmer and administrator time saved by the extension system!
Oh, I don't have much against this extension system It should just be as optimised as possible.
Mpok: Nobody said you were complaining, or even answered your posts in a hostile manner.
If you have an alternative to calling eval, we would love to hear it. However, we have tested several methods and eval is not the slowest of them. It also has the advantage that any extension code is run in the global scope, which simplifies things for extension authors.
gud thanks .
When are the hooks in parser.php coming so that people can make there own bbcode?
When the new parser comes, I'd guess.
PunBB Forums → PunBB 1.3 extensions → Hook requests
Powered by PunBB, supported by Informer Technologies, Inc.