Page 1 of 1

[NEW] Digg Count

Posted: Sat Jul 15, 2006 7:18 pm
by kodewulf
This is my first try at creating a S9Y plugin. I probably broke all the rules and did everything wrong, but it seems to work for me. :)

The guys at Digg released an api to use the Dugg button. I fiddled a bit with the plugin api from Serendipity and came up with DiggCount.

I couldn't get Spartacus to recognise it after I extracted it into the plugin directory. If anybody else have that problem, please let me know.

Any comments and suggestions will be greatly appreciated.

DiggCount download

Thank you
Kodewulf

Re: [NEW] Digg Count

Posted: Mon Jul 17, 2006 11:05 am
by garvinhicking
Hi!

That is an awesome first plugin, I must say! Good work!

I would love to put this into Spartacus, however I have a minor suggestion to make. *g*

I try to keep the plugin count as low as possible, so I always look if new functionality can be put into any of existing plugins. For example, the "serendipity_event_findmore" plugin ("Show links to services like Digg, ...") already deals with showing something like that, so I wonder if you could merge your plugin into that one? (of course by appending your credits in the creator info!)

Would you like to have a try at that? I would love to see that. Of course I also offer help if you have any questions on how to bundle the two plugins? But I think you should easily be able to do that. :-)

Best regards,
Garvin

Posted: Tue Jul 18, 2006 7:14 am
by kodewulf
Thank you for the feedback. I'll have a look at trying to combine the two.

I do have a question or two if you don't mind. :)
Is it possible to set another plugin as a dependency? For DiggCount I use a custom field to determine to show the count. If the custom field contains the Digg article url, then it should show the count. I wondered if it is possible to check if the extended properties plugin is installed and then just allow DiggCount to check/add the required custom field behind the scenes.

Off course if you have another way of doing this, I'd appreciate any suggestions. I'm also having a look of changing the mechanism to provide you with some markup that you can include in your post where you would want the count displayed. Something like:

Code: Select all

<diggcount url=http://digg.com/article_url />
That will remove the need for the custom field.

Anyway, thanks for the feedback. And for creating a blog platform that is SO easy to extend.

Posted: Tue Jul 18, 2006 11:56 am
by garvinhicking
Hi!

Yes, you can check if a plugin is installed with this PHP code:

Code: Select all

if (class_exists('serendipity_event_entryproperties')) { ... }
However, it is currently not yet possible to make another plugin output additional customfields that are shown in the customfield section.

So it might be better to make the plugin emit its own input-textfield and store the property on its own. Have a look at serendipity_event_metadesc, this is a plugin that does it quite similarly!

I'm curious for your efforts, already many thanks for digging into this. I love to see people enjoy the flexibility of Serendipity. :-)

Best regards,
Garvin

Posted: Tue Jul 18, 2006 1:03 pm
by kodewulf
Hi,

Thanks for the quick input. I've thrown the DiggCount and Findmore plugin together. You can download it here.

I've also changed the way it works. You can now get the DiggCount to display by entering the following in your post

Code: Select all

[diggcount]http://www.digg.com/digg_article_url[/diggcount]
Please download it and have a look to make sure I've made the correct changes. It works on my blog, but I haven't been able to test it with a fresh install.

Download the plugin.

Posted: Tue Jul 18, 2006 1:50 pm
by garvinhicking
Hi!

That sounds good, howevr I still have two minor suggestions to make *g*

1: How about if your plugin could automatically check for <a href="http://www.digg.com/">... links and then also emit the count for those links? Then nobody would have to lear that new [digcount] markup?

2: If you stay with [diggcount], how about documenting this [diggcount] availablility in either the plugin description, or in the extended option section when you create an entry (backend_dislpay hook)?

Best regards,
Garvin

Posted: Tue Jul 18, 2006 6:00 pm
by kodewulf
garvinhicking wrote:
That sounds good, howevr I still have two minor suggestions to make *g*
Always welcome... :)
garvinhicking wrote: 1: How about if your plugin could automatically check for <a href="http://www.digg.com/">... links and then also emit the count for those links? Then nobody would have to lear that new [digcount] markup?
Done. It will now show the count for all Digg links in the post.
New download can be found here.
garvinhicking wrote: 2: If you stay with [diggcount], how about documenting this [diggcount] availablility in either the plugin description, or in the extended option section when you create an entry (backend_dislpay hook)?
Took your advice on the <a href> checking. Should be easier to use now.

Thank you for your patience and your advice.
You can find the new version here.

Posted: Thu Jul 20, 2006 10:41 am
by garvinhicking
Hi!

Thanks a lot! I just committed this with a few minor changes:

- Fixed "configuration" that was missing an array()
- Inserted the $tfile check from a commit from yesterday to that plugin
- Changed TABs to SPACEs for indentation.

Many thanks an dbest regards,
Garvin :)

Posted: Fri Jul 21, 2006 2:29 pm
by kodewulf
Hi,

Thanx. Sorry about the TABs. I think I've fixed my editor. :)

I'm working on creating a better layout if you have more than one Digg link in the post. My CSS sucks tho, so it might take a while... :)

Thank you for committing it.

Posted: Fri Jul 28, 2006 10:35 pm
by stm999999999
I installed it, but it makes an error on the plugin config page:

Warning: Invalid argument supplied for foreach() in /home/www/manske-net.de/blog.stephan.manske-net.de/htdocs/include/functions_plugins_admin.inc.php on line 317

And: The plugin should be placed in the article-footer.
And: it would be nice to be able to config whether it comes on all pages, the front page or only on the article page.