Get properties of a plugin

Creating and modifying plugins.
Post Reply
munk
Regular
Posts: 15
Joined: Tue Dec 09, 2003 6:25 pm
Contact:

Get properties of a plugin

Post by munk »

Hi,

I'm trying to modify a spam statistics plugin to read entries from the spamblock plugin's log. To do this I need to work out what type of logging spamblock is using. How can I find the 'logtype' property of the spamblock plugin from within the spamstats plugin?

I noticed the spamblock logtype is stored in $serendipity, but with the class id(?) as the key:

["serendipity_event_spamblock:29da447ec2de49096452e6037c9a79aa/logtype"]=>
string(4) "file"

is there an efficient way to fetch the value from $serendipity (ie work out the clsid) or is there an easier/more efficient way?

Cheers.
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Get properties of a plugin

Post by garvinhicking »

Hi!

The most easy way would be:

Code: Select all

<?php
$q = "SELECT value FROM serendipity_config WHERE name LIKE 'serendipity_event_spamblock:%/logtype LIMIT 1";
$logtype = serendipity_db_query($q, true);
print_R($logtype);
The other way would involve fetching a list of all plugins, checking which ones are of the class 'serendipity_event_spamlog', then loading that plugin and gettin gthe config via API methods. That would be slower. :)

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/
munk
Regular
Posts: 15
Joined: Tue Dec 09, 2003 6:25 pm
Contact:

Post by munk »

Thanks garvin,

I didn't know if there was an easier way, it looks like there isn't :(

Many thanks!
Post Reply