event hook for plugin configuration save?

Creating and modifying plugins.
Post Reply
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: event hook for plugin configuration save?

Post by garvinhicking »

There'd be two ways to do that:

1. Use PEAR::Cache_Lite to only parse the key/value pairs once in frontend_display and then fetch the return array to operate on

2. Serialize the result of your variable munging into an array and then store that array via set_config which you can then later user

Apart from that, your Plugin will also improve pretty much when using the entryproperties caching; then it will parse your glossary/definitions only once per entry and the next time only when you modify the entry. :)

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi Rob!

Yes, the entryproperties caching is a seperate plugin, bundled. It's called "Extended Properties" and has a config option for caching. That's also what the "cachable events" hooks are for. You can look at the contentrewrite plugin or the bbcode plugin, both properly define those events and are skipped if a cached presentation of your entry is used.

About suggestion 2, that's not exactly what I meant. It would be more like:

1. Leave introspection as is
2. When your frontend_display is called you do things like:
foreach ($config AS $bla) {
...
}
And after that you'll do a str_replace($from, $to, $entry['body']) or something like that, right?
What I image now would be that you put the whole foreach() stuff where you fetch items like this:
- require the PEAR::Cache Lite
- Use the Function cache (I don't know the commands by hand; look at the DNSURBL spamblock plugins, they use the PEAR Lite Function cache)
- Store $from and $to in the cache
- Use $frmo and $to from the cache, if PEAR Cache returns that to you; only if it's not existing do the repetition

Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

There is no propper guide, so I'd just follow the example of bbcode. I think the easiest cache-supporting plugin is the serendipity_event_nl2br plugin. That does not have as much overhead like bbcode or emoticate...

Regards and have fun,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Post Reply