modPlugin Extend your OsDate capabilities
modPlugin is an API alowing you to extend OsDate's capabilities without modifing OsDate itself. Plugins can be written in packages that can be distributed, uploaded and installed from a single zip file.
Tables to be used exclusively for the plugin should be named in the format DB_PREFIX_PluginName_tableName. (DB_PREFIX is the table prefix given in configs/config.php. PluginName is the name of the plugin and tableName is the name of the table.) e.g. osdate_speedDater_speeddater.
Plugin File Structure
pluginTemplate - Plugin Directory. Must be named the same as the plugin.
pluginTemplate/language - Language directory. Containts language definitions.
pluginTemplate/language/lang_spanish
pluginTemplate/language/lang_spanish/lang_main.php - Spanish language definitions.
pluginTemplate/language/lang_german
pluginTemplate/language/lang_german/lang_main.php - German language definitions.
pluginTemplate/language/lang_english
pluginTemplate/language/lang_english/lang_main.php - English language definitions.
pluginTemplate/language/lang_portuguese
pluginTemplate/language/lang_portuguese/lang_main.php - Portuguese language definitions.
pluginTemplate/language/lang_greek
pluginTemplate/language/lang_greek/lang_main.php - Greek language definitions.
pluginTemplate/language/lang_turkish
pluginTemplate/language/lang_turkish/lang_main.php - Turkish language definitions.
pluginTemplate/language/lang_romanian
pluginTemplate/language/lang_romanian/lang_main.php - Romanian language definitions.
pluginTemplate/language/lang_russian
pluginTemplate/language/lang_russian/lang_main.php - Russian language definitions.
pluginTemplate/language/lang_dutch
pluginTemplate/language/lang_dutch/lang_main.php - Dutch language definitions.
pluginTemplate/language/lang_french
pluginTemplate/language/lang_french/lang_main.php - French language definitions.
pluginTemplate/images - Plugin specific images.
pluginTemplate/sql
pluginTemplate/sql/install.sql - Table creation SQL.
pluginTemplate/includes
pluginTemplate/includes/default_config.php - Default configuration values.
pluginTemplate/templates - Plugin templage directory.
pluginTemplate/templates/default
pluginTemplate/templates/default/helloworld.tpl - User template.
pluginTemplate/templates/default/admin
pluginTemplate/templates/default/admin/helloworld.tpl - Admin template
pluginTemplate/libs - Classes related to plugin.
pluginTemplate/libs/pluginTemplate.php - Main plugin class. Must be named the same as the plugin.
Displaying Content
There are four methods to display content on the OsDate site, displayPluginPage, displayPluginContent, displayLeftCol and displayMain. These methods return HTML to be displayed. The modPlugin logic handles the actual display of the HTML.
displayPluginPage
displayPluginPage is used when you need a new page on the osdate site. HTML returned by displayPluginPage is displayed in the main content area of OsDate. When you set the $user_menu_text variable to the text to appear on the menu, and set user_menu_appear to true, a link to your page will appear on the user menu. You can also access the page directly using the link plugin.php?plugin=pluginTemplate (assuming your plugin naem is pluginTemplate).
displayPluginContent
displayPluginContent is used when you need a new page with only your content. For example if you need a popup window that displays a simple message. The HTML returned by displayPluginContent is displayed on the new page. You can also access the page directly using the link pluginraw.php?plugin=pluginTemplate (assuming your plugin naem is pluginTemplate).
displayLeftCol
displayLeftCol will display your content in the left column of OsDate. The HTML returned by displayLeftCol is displayed.
displayMain
displayMain will display your content in the main content area of OsDate below the existing main content. The HTML returned by displayMain is displayed.
Getting Started
To get started on your first plugin, make a directory inside the plugins directory the name of your new plugin (ex. mkdir plugins/myNewPlugin). Then copy all the files in the plugins/pluginTemplate directory to your new directory (ex. cp -r plugins/pluginTemplate/. plugins/myNewPlugin/). Now rename pluginTemplate.php to the name of your plugin (ex. mv pluginTemplate.php myNewPlugin.php. Lastly, open myNewPlugin.php and rename all instances of pluginTemplate to myNewPlugin.
Now that you have all the files you need, start writing your code using the methods and documentation listed below.
Located in /modPlugin.php (line 83)
Constructor, called by modOsDate to initialize plugin class. There should never be a need to call this directly.
Clears all error messages
Returns the content that will appear in the left column of a page. Override this method in yor class if you have content that needs displayed in the left column.
Returns the content that will appear in the main content area of the page. This content will appear after the existing main content. Override this method in yor class if you have content that needs displayed in after the existing main content.
Returns the content to display a custom admin page. Override this method in your class if you need a new page for your plugin.
WARNING: USER IS NOT VALIDATED HERE. BE CAREFUL
Returns all the html for a page. Override this method in your class if you need a page with only your content. Often used in downloads
Returns the content to display a custom user page. Override this method in your class if you need a new page for your plugin.
Returns the admin menu entry for a plugin.
Returns all error messages
Returns the images directory for this plugin
Returns the includes directory for this plugin
Returns the language directory for this plugin
Returns the libs directory for this plugin
Returns the main directory for this plugin
Returns the sql directory for this plugin
Returns the sql directory for this plugin
Returns the user menu entry for a plugin.
add an event to calendar X, event details specified in parameter
adds a profile rating for user X
Adds a record from the provided table with the provided data. The table must belong to the plugin or this will return false.
return a list of permissions available to a particular user
returns the registration status of a particular user
clear a ban of user X for user Y
Deletes record(s) from the provided table using the search. The table must belong to the plugin or this will return false.
Edits a record from the provided table with the provided data. The table must belong to the plugin or this will return false.
Gets a admin's record
gets an array of all affiliate statistics for affiliate X
Returns the picture album that match the provided keys.
Gets all records from the provided table using the search. The table must belong to the plugin or this will return false.
returns all available picture albums or if params are provide, returns all the albums that match those keys.
Returns all featured user profiles
returns all configured languages
returns all available pictures for a user / album
Gets all user's records matching provided parameters
get all current articles
gets a list of all current banners
gets the click statistics for banner X
get details on a specific blog
get details on a specific blog post
returns a list of all available calendars
Returns the current error messages
returns a list of all available events for calendar X
Returns the language phrase or the entire language array from class's language definitions.
returns the currently loaded language
get data for the currently logged in admin
get data for the currently logged in user
gets the membership settings for any particular level
get all current news items
get information related to the currently-loaded payment modules
Given a picture id, returns the picture
get details on a plugin
gets a list of current polls
gets a list of poll statistics for poll X
Returns a profile matching the search params.
gets a list of all profile ratings for user X
Gets a record from the provided table using the search. The table must belong to the plugin or this will return false.
returns the value of any particular global configuration setting
Returns the current template skin name
get payment transaction information for a particular transaction search by one or many paramaters
Gets a user's record
get all transactions for a particular user
check to see if the user has permission to access resource X
check to see if user X is banned for user Y
determines if a user's profile is featured
check to see if user with id is logged in
determines if a zip code CSV file is loaded for a country
logout the current user
sets/unsets a user's profile as featured
remove album X from the user's albums
remove a specific blog comment
remove a specific blog post
Given a picture id, remove the picture from the users album
send an email
send a message to a single user or group of users
send a wink to a single user or group of users
set a ban of user X for user Y
sets the currently loaded language
sets the current news list (all at once).
data provided in a multidensional array of the format:
$news = array (
returns the site home url
Assigns a varible for use in smarty templates
Returns a parsed Smarty template from this plugins template directory
Documentation generated on Mon, 31 Jul 2006 10:26:07 -0600 by phpDocumentor 1.3.0RC3