Plugin API documentation table of contents:
Plugins are installed into %root/plugins directory, the typical plugin directory structure is as follows:
Contains files which will be used in the admin interface. For further information see the Info file description/Menu section.
Contains language files for localizer
Contains hook files. For further information see the Hooks section.
Contains files which are used to display this plugin in sample templates.
Contains files needed for installation of database changes. How to apply database changes
Contains smarty extensions.
returns standard plugin path for $pluginName
CampMail is a static classed which is providing mailing functions to Newscoop and it's plugins.
static boolean ValidateAddress($p_email)
returns true if $p_email is a valid email address
static void MailMime($recipients, $text=false, $html=false, $hdrs)
$recipients - list of recipients divided by semicolon
$text - Body of the text message
$html - Body of the HTML message, if both $text and $html are set, both contents will also be sent to $recipients.
$hdrs - Message headers
Sends an email to list of $recipients.
This class provides functionality to build an form using Pear Quickform.
static void function ParseArr2Form(&$form, &$mask, $side='client')
&$form - object, reference to HTML_QuickForm object
&$mask - array, reference to array defining to form elements
$side - string, side where the validation should happen
CampContext::_get() and CampContext::_set() methods search for plugin defined objects in the plugins directoriesCampContext
CampContext::registerObjectType() registers new plugin custom objectsCampContext
CampContext::registerListObject() registers new plugin list objects
Hook, in the scope of plugin API, is a way to show part of the plugin in an existing core Newscoop admin screens.
Hooks are currently implemented in following PHP admin files:
Hooks are stored in newscoopRoot/plugins/yourPlugin/admin-files/include directory. When you want to make a hook on article edit screen, you create subdirectory "articles" and under this subdirectory you create a file "edit_html.php" which will be loaded everytime when someone opens an article edit screen.
New directory structure would look like this:
There should be $info array declared at the beginning of the %pluginname.info.php.
This part of $info variable array describes the plugin name. It should be the same as the plugin's containing folder.
Describes which Newscoop version is supported by a plugin.
Label is being used as the plugin name in the plugin manager.
This is being used as the plugin description in the plugin manager
string Handler functions
Those are function which are being called at a specific time during the plugin handling. They should also be defined in the info file.
This function is called after the plugin is install, it should run any SQL install scripts.
This function is called when plugin is enabled at the plugin administration. Plugin enable will work even if this function is not defined, it is an automatic process, plugin developer do not need to enable the plugin in code manually.
This function is called when plugin is disabled at the plugin administration. Plugin disable will work even if this function is not defined, it is an automatic process, plugin developer do not need to disable the plugin in code manually.
This function is called when a plugin is being updated, usually to run an upgrade SQL script.
This function is called when a plugin is being uninstalled. The plugin should undo any database changes which it made during or after installation.
Contains configuration for Localizer.
This part of the configuration describes the menu structure of the plugin. This menu structure will be created under the "Plugins" main menu. This configuration property is designed to be a nested array.
Internal menu name.
This is the label of the menu. Localizer strings will be added automatically.
Path to a Icon which will be displayed in the menu. The path's root is at plugin's root folder so if the path is "/css/%pluginname.png", the full path would be "newscoop_root/admin_files/plugins/%pluginname/css/%pluginname.png".
Path to a .php file which will be loaded after click on the menu item.
Name of permission which is required to show this menu item.
Submenu structure, it contains the same configuration element as a main menu structure.
Example for menu and submenu:
No menu script sections marks file, to which the menu and standard Newscoop admin header is not attached. This is useful specially for AJAX files.
This is the configuration that will be used in case that user doesn't have any configuration saved. It contains name-value configuration settings.
This configuration contains name value collection consisting of permission name and permission description/
Installer for plugins on the plugin managment page:
The 3.1 plugin API was implemented as follows:
Each plugin has an %pluginname.info.php file in it's base folder, which descripes a list of items: