[wp-hackers] plugin framework class (was ]RE: [wp-hackers] [help]sink plugin hooks for $this) [s]

John Ha [c] mailing-lists at netspace.net.au
Sun Jan 15 14:53:35 GMT 2006


Yes, this would make life easier.

John
----- Original Message ----- 
From: "Per Soderlind" <per at soderlind.no>
To: <wp-hackers at lists.automattic.com>
Sent: Sunday, January 15, 2006 8:32 AM
Subject: [wp-hackers] plugin framework class (was ]RE: [wp-hackers]
[help]sink plugin hooks for $this)


> > Owen Winkler wrote:
> > While I'm thinking about it, would it be useful to produce a
> > plugin framework class, if not for the core then for general use?
> > Something like (LIKE this, NOT this):
> >
> > class pluginFramework {
> > function pluginFramework() {
> > // Do generic init stuff here?
> > }
> > function register_sinks() {
> > $sinks = array_filter(get_class_methods($this),
> > array(&$this, 'filterSinks'));
> > foreach($sinks as $sink) {
> > add_filter($sink, array(&$this, '__'.$sink))
> > }
> > }
> > function filterSinks($name) {
> > return(substr($name, 0, 2) == '__');
> > }
> > function debug() {
> > // Generic plugin debug stuff here...
> > }
> > }
> >
> > And then you could do simple stuff like:
> >
> > class myPlugin extends pluginFramework {
> > funciton myPlugin() {
> > $this->register_sinks();
> > }
> > function __admin_head() {
> > // Output stuff in the admin head
> > }
> > function __admin_footer() {
> > $this->debug($_GLOBALS);
> > }
> > }
> > $myplugin = new myPlugin();
> >
> > Such a framework could include functions to do more
> > complicated things like mess with TinyMCE, handle Ajax
> > requests ($this->handle_ajax('function_name'); //!!), or
> > respond differently when the plugin file is requested
> > directly, and would save me from having to package those
> > generic functions into every plugin I produce.
>
>
> I agree, this is a nice idea. Anyone else been working on this?
>
> ../Per
>
>
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>



-- 
------------------------ [ SECURITY NOTICE ]
------------------------
To: wp-hackers at lists.automattic.com.
For your security, mailing-lists at netspace.net.au
digitally signed this message on 15 January 2006 at 14:54:44 UTC.
Verify this digital signature at http://www.ciphire.com/verify.
------------------- [ CIPHIRE DIGITAL SIGNATURE ]
-------------------
Q2lwaGlyZSBTaWcuAjh3cC1oYWNrZXJzQGxpc3RzLmF1dG9tYXR0aWMuY29tAG1haWxpb
mctbGlzdHNAbmV0c3BhY2UubmV0LmF1AGVtYWlsIGJvZHkALQYAAHwAfAAAAAEAAAA0Ys
pDLQYAAFMCAAIAAgACACAe5TcBbmIU6owNe1xZd/iId1LWxoic0s8JYnXeBrMqZgEAoH7
uzw9IZPyJ563ZYHUtH1HUo9KSbjEaKJV3swG1UnqHtbxrGsCBxwZbh/K41Wn7VpvSGYoj
PlEmVWHMCfpaTbwTd7pMU2lnRW5k
--------------------- [ END DIGITAL SIGNATURE ]
---------------------



More information about the wp-hackers mailing list