Common Plugin Functions and Constants Available for Development of Seo Panel Plugin
Common Plugin Functions
The common plugin functions available to create seo panel plugins are
1) pluginGETMethod($args='', $area='content')
Function to create an plugin ajax GET method using automatically created plugin url according to corresponding plugin.
$args
The arguments to be send with ajax GET request
Eg:
“&id=2&col=refid”
$area
The area(div id) to be updated with result of ajax request.
The default value is “content”, the content div will be updated with result of ajax request.
Return
Returns ajax GET request function call and can be used in javascript trigger events like “onClick”
Eg:
<a href="javascript:void(0);' onclick="<?php echo pluginGETMethod('action=settings', 'content'); ?>">Click</a>
It will create a code like below according to plugin
<a href="javascript:void(0);" onclick="scriptDoLoad('seo-plugins.php?pid=18', 'content', 'action=settings')">Click</a>
while click on above link the method “settings” of plugin id 18 is called and result after the execution of request will be updated in the div “content”.
2) pluginPOSTMethod($formName, $area='content', $args='')
Function to create an plugin ajax POST method to post elements of particular form to plugin method.
$formName
The name of the form element should be submitted
$area
The area(div id) to be updated with result of ajax request.
The default value is “content”, the content div will be updated with result of ajax request.
$args
Using this we can pass extra arguments with form submission.
Eg:
“&action=submitmsg&val=1”
Return
Returns ajax POST request function call and can be used in javascript trigger events like “onClick”
Eg:
<a href="javascript:void(0);" onclick="<?php echo pluginPOSTMethod('projectform', 'content', 'action=createproject'); ?>" >Click</a>
It will create a code like below according to plugin
<a href="javascript:void(0);" onclick="scriptDoLoadPost('seo-plugins.php', 'projectform', 'content', '&pid=18&action=createproject')">
While click on above link, it will submit elements of form with name “projectform” to the method “createproject” of plugin id 18 and result after the execution of request will be updated in the div “content”.
3) pluginConfirmGETMethod($args='', $area='content')
Same as “pluginGETMethod” but before execution of request a confirm box is displayed to confirm the user to allow action. Used while delete a project,user etc.
4) pluginConfirmPOSTMethod($formName, $area='content', $args='')
Same as “pluginPOSTMethod” but before execution of request a confirm box is displayed to confirm the user to allow action. Used while edit,update project,user etc.
5) pluginMenu($args='', $area='content')
Same as “pluginGETMethod” and used to create plugin left submenus while loading a plugin first.
Eg:
<li><a href="javascript:void(0);" onclick="<?php echo pluginMenu('action=viewreports'); ?>">Reports Manager</a></li>
Plugin Constants
1) PLUGIN_PATH
The absolute path to plugin directory
Eg:
/opt/lampp/htdocs/seopanel/plugins/TestPlugin
2) PLUGIN_VIEWPATH
The absolute path to plugin views folder
Eg: /opt/lampp/htdocs/seopanel/plugins/TestPlugin/views
3) PLUGIN_ID
The id of the plugin, can used to create plugin specific urls
4) PLUGIN_WEBPATH
The web path to directory of a plugin.
Eg: http://localhost/seopanel/plugins/TestPlugin
5) PLUGIN_IMGPATH
The web path to plugin image directory
Eg: http://localhost/seopanel/plugins/TestPlugin/images/
6) PLUGIN_CSSPATH
The web path to plugin css directory
Eg: http://localhost/seopanel/plugins/TestPlugin/css
7) PLUGIN_JSPATH
The web path to plugin javascript directory
Eg: http://localhost/seopanel/plugins/TestPlugin/js
8) PLUGIN_SCRIPT_URL
The web url to access a specific plugin
Eg: http://localhost/seopanel/seo-plugins.php?pid=18