Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Feature Roadmap etc Development Discussion
#7
Quite an extensive roadmap. If GS had all of these things....*drools*

Until then though, we shall try to accommodate for those goals through plugins :-P

Something of note regarding the Object Oriented PHP point shawn made (and others may already know): you can call class methods on plugin hooks (as singletons or instances).

Class:
PHP Code:
class YourPlugin {
  
/* define your methods */
  
public function contentHook() {
    
// example of a content hook within a class
  
}
  public function 
adminPanel() {
    
// example of an admin panel within a class
  
}


Singleton call:
PHP Code:
# register plugin
 
register_plugin(
  
'plugin id',
  
'plugin name',
  
'plugin version'
  
'author',
  
'website',
  
'description',
  
'page type',
  
'YourPlugin::adminPanel'
 
);

# content hook
 
add_filter('content''YourPlugin::contentHook'); 

Instantiation call:
PHP Code:
# instantiate plugin
 
$yourPlugin = new YourPlugin;
# register plugin
 
register_plugin(
  
'plugin id',
  
'plugin name',
  
'plugin version'
  
'author',
  
'website',
  
'description',
  
'page type',
  array(
$yourPlugin'adminPanel')
 );

# content hook
 
add_filter('content',   array($yourPlugin'contentHook')); 

(I prefer the latter method tbh, because the singleton way invokes a lot of faffing around with static property/method declarations that I'm not arsed enough to deal with).

So you can build the entire set of functions for the plugin within your plugin class without needing to create global functions to pass to the hooks (immediately giving you the benefits of OOP, e.g. you don't need to prefix your function names like 'yourplugin_contenthook').
Reply


Messages In This Thread
RE: Feature Roadmap etc Development Discussion - by Angryboy - 2013-06-08, 18:30:00



Users browsing this thread: 1 Guest(s)