To redirect to the homepage, simply leave the URL blank.
To redirect to the Admin Area, use the value 'admin'.
e107::redirect();
e107::redirect('admin');
Constants
Please note: This page is under construction and has not been finished yet.
Introduction
.....
Directory constants
In the table below (hash) refers to the 👉 generated upon installation of e107.
Path constants
User constants
General Site Constants
Userclass constants
......
Userclass constants ID's 243 - 245 are reserved for future predefined user classes
Language constants
Development constants
// define('eDEBUG', true); // Enable debug mode to allow displaying of errors
// define('e_HTTP_STATIC', ''); // Use a static subdomain for js/css/images etc.
// define('e_MOD_REWRITE_STATIC', true); // Rewrite static image urls.
// define('e_LOG_CRITICAL', true); // log critical errors but do not display them to user.
// define('e_GIT', 'path-to-git'); // Path to GIT for developers
// define('X-FRAME-SAMEORIGIN', false); // Option to override X-Frame-Options
// define('e_PDO, true); // Enable PDO mode (used in PHP > 7 and when mysql* methods are not available)
Please note: This page is under construction and has not been finished yet.
Introduction
Please note: This page is under construction and has not been finished yet.
Plugins extended the functionality of e107 and allow for endless possibilities.
CORE/THIRD PARTY - LINK TO USER GUIDE
ARCHITECTURE
The plugin architecture is developed to be as simple as possible. Often you can copy a file from an existing plugin and simply modify a few parameters in order to get similar functionality in your own plugin
$mes = e107::getMessage();
$mes->addSuccess('You did it!');
$mes = e107::getMessage();
$mes->addError('There was a problem!');
$mes = e107::getMessage();
$mes->addWarning('You do not have access to this area!');
$mes = e107::getMessage();
$mes->addInfo('Please take note!');
$mes = e107::getMessage();
$mes->addInfo('Please take note!');
$mes = e107::getMessage();
$mes->addInfo('Please take note!');
echo $mes->render();
Cache
Please note: This page is under construction and has not been finished yet.
Introduction
Cache methods
retrieve()
retrieve_sys()
set()
clear()
clear_sys()
Cache types
Work in progress
Type
content?
Folder structure
The table below provides an overview of the default folder structure of an e107 installation:
Folder
Can be modified
Description
e107_admin
No
Contains main files used for the admin area.
e107_core
No
Contains core assets.
You should not make changes within this folder.
Debugging & problem solving
Introduction
Your code should not produce any PHP warnings or notices during normal usage. This primarily implies that all variables must be defined before being used. It also implies that a corrupted installation may produce errors, although as far as practicable the code should accommodate this.
$cache = e107::getCache();
e107_handlers
No
Contains core functions and classes.
You should not make changes within this folder.
e107_images
Not usually
Contains core images.
You should notnormally need to make changes within this folder.
e107_languages
Not the English folder.
Contains core language files.
Themes and plugins have their own language folder
e107_media
Not usually
Contains Media such as downloadable images or files which are specific to your installation.
e107_plugins
Yes
Contains all plugins, installed and uninstalled.
You may manually add plugins to this folder if need be.
e107_system
Not usually
Contains private files such as logs, plugin and theme downloads which are specific to your installation.
e107_theme
Yes
Contains all themes, installed and uninstalled.
You may manually add themes to this folder if need be.
By default, all PHP errors, warnings and notices are suppressed and not visible to the public. You can use debugging to show them.
A blank page or a page that has not been fully loaded, usually indicates a PHP fatal error. Server logs (such as Apache Error Logs) often also provide useful information.
Browser addon
We recommend this collection of 👉Firefox Addons. The most important being the e107 Debugger. If you don't wish to use the debugger, you can still activate various debugging modes manually, by changing the query string of the URL and adding the debug mode. For example: directly after .php add ?[debug=xxxx]
Example:yourwebsite.com/news.php?[debug=basic!]
Debug modes
Query
Description
[debug=basic!]
Display basic error information
[debug=traffic!]
Display traffic information
[debug=showsql!]
Display basic SQL queries
[debug=time!]
Display load/processing times
[debug=notice!]
Display PHP Notices
As of e107 v2.3.1 - the + sign has been changed to an exclamation mark !.
For example: [debug=basic!] instead of [debug=basic+]
Plugin Builder
Please note: This page is under construction and has not been finished yet.
Introduction
By far, the quickest and easiest way to develop a plugin for e107 is to use the , because:
It allows you to select the database file () file from the plugin folder, or directly from the database table list, and it will generate most of the new code for the of your plugin.
It will generate the new meta-file, which is used during installation of your plugin and also when sharing plugins via this site.
The Plugin Builder can be found in Admin Area > Manage > Plugin Manager > Plugin Builder.
How to use the Plugin Builder
Create an empty plugin folder in e107_plugins (eg. "myplugin")
Create a new text file with the *_sql.php extension. (eg. "myplugin_sql.php")
Using a tool such as phpMyAdmin, create your database table structure, and then export it in SQL format.
Basic info
This section has not been finished yet!
Database tables
This section has not been finished yet!
field
caption
type
data
width
batch
filter
inline
validate
display
R/O
Helptip
ReadParms
WriteParms
Preferences
This section has not been finished yet!
Addons
This section has not been finished yet!
[debug=warn!]
Display PHP Warnings
[debug=backtrace!]
Display PHP Backtraces
[debug=deprecated!]
Display deprecated method or function calls
[debug=inc!]
Display included files
[debug=paths!]
Display paths and variables
[debug=bbsc!]
Display BBCodes and Shortcodes
[debug=sc!]
Display Shortcode placement
[debug=sql!]
Display detailed SQL analysis
[debug=everything!]
Display all debugging details
[debug=off!]
Disable debugging
Copy and paste the database structure ("CREATE TABLE") to your your *_sql.php file. (see other plugins for examples)
Go to Admin Area > Manage > > Plugin Builder and choose "myplugin" from the dropdown menu and then follow the prompts.
Thoroughly check the details of each Table Tab (and Preferences Tab if you need them) before proceeding with the creation process.
Please note: This page is under construction and has not been finished yet.
CSS
Please note: This page is under construction and has not been finished yet.
Introduction
...
Basic CSS methods
Including css in your plugin or theme may be achieved by using the following function:
Type
Value
Description
Examples
TODO: add examples
Templates
Please note: This page is under construction and has not been finished yet.
Introduction
theme
path relative to the theme's folder
Include a theme css file in the header of the site
url
full url to css file
Include a remote css file in the header of the site
inline
css code
Include raw css code in the header of every page of the site
Templates and shortcodes function together to allow a developer to place dynamic content into their code.
Templates are portions of HTML which contain markers that are replaced by dynamic content when parsed e107's parseTemplate()function.
These markers are called 'shortcodes'.
A shortcode is always CAPITALIZED and is surrounded by curly brackets and it may contain letters and underscores. For example: {MY_SHORTCODE}
Each shortcode has a corresponding function/method which is run during the parsing of the template. These functions are always lowercase and begin with the prefix sc_ . eg. sc_my_shortcode(). This means that {MY_SHORTCODE} is replaced by what is returned by sc_my_shortcode().
Shortcodes may also contain parameters which are sent to the corresponding method. For example: {MY_SHORTCODE: x=foo&y=bar}
Creating templates
Create a folder called templates inside your plugin directory, and inside create an empty file using the name of your plugin folder, followed by _template.php. eg. myplugin_template.php Inside this file add an array by the same name, but in UPPERCASE: eg. $MYPLUGIN_TEMPLATE['xxxx']xxxx can be anything you want, but we suggest using start, item, end etc. when applicable. This value should always be lowercase. Here's a simple example of the contents of myplugin_template.php:
If your plugin will use several different types of templates, eg. a listing page and an input form. You can do something like this:
Loading templates
You may load a template file in the following way:
You can now use the $template code array for parsing:
Overriding Core Templates
All templates that are used in e107 can be overridden by copying them into specific folders within your current theme folder.
Core themes (located in e107_core/templates/ ) should be copied into e107_themes/YOURTHEME/templates/
Plugin templates should be copied into e107_themes/YOURTHEME/templates/PLUGIN-FOLDER
Note: Older plugins may look for templates in the root folder of your theme. ie. e107_theme/YOURTHEME/
Examples
1) The comment template is a core template, as it is located in e107_core/templates/. To override this template, copy the file to e107_themes/your_theme_folder/templates/.
2) The news template is located in e107_plugins/news/. To override this template, copy the file over to e107_themes/your_theme_folder/templates/news/.
3) The same for, for example, the chatbox menu template. The chatbox_menu template is located in e107_plugins/chatbox_menu. Copy the template over to e107_themes/your_theme_folder/templates/chatbox_menu/
Important: For overriding plugin templates, the folder name within your_theme_folder/templates/ directory must match the exact plugin folder name.
Please note: This page is under construction and has not been finished yet.
Introduction
Themes developed for v1.x of e107 will continue to work using v2.x. However, to get the most out of v2.x, it is recommended to make the following changes to bring your theme up to date with the new v2.x standards.
theme.php
Replace $HEADER and $FOOTER with $HEADER['default'] and $FOOTER['default']
Replace any occurrences of $CUSTOMHEADER and $CUSTOMFOOTER with $HEADER['custom'] and $FOOTER['custom']
If you have used index.php in your $CUSTOMPAGES list, use FRONTPAGE instead (see above)
The function theme_head() has been deprecated. Instead, use either or to include what you require in the header. (see bootstrap or other new core theme for examples)
Shortcodes need to be set to
Theme shortcodes
TIP: As of e107 v2.x, you no longer need separate xxxxxx.sc files inside your theme's folder. You can now include all your theme-specific shortcodes in a single file called.
Read more on theme shortcodes here:
Styling (CSS)
Please note: This page is under construction and has not been finished yet.
Introduction
e107 v2.x is designed for Bootstrap styling. It is therefore encouraged for developers to use bootstrap as their guide for their HTML markup.
A default Bootstrap 3 is provided with e107. For html markup and examples, please refer to the and for snippets: .
If you find markup in the core templates of e107 which does not work well with bootstrap, please let us know in the Github issue tracker, so that we may correct it.
style.css
Plugins
Please note: This page is under construction and has not been finished yet.
If your theme contains links to external social media pages such as Facebook, Twitter or YouTube, use the core definitions for them. ie. XURL_FACEBOOK, XURL_TWITTER, XURL_YOUTUBE.
Remove any reference to $CUSTOMPAGES and place them inside theme.xml in the layouts section.
Back in September 2015, . Currently, any older version of e107 (such as version 1.0.4) is considered to be Legacy, and is also referred to as e107 v1.x.
Plugins and themes developed for e107 v1.x will continue to work on v2.x. However, to get the most out of v2.x, it is strongly recommended for developers to make changes to their code and bring the code up to the new v2.x standards.
This way, developers can:
Ensure continued functionality of their plugins and themes in future versions of e107
Benefit from major performance and security enhancements.
Benefit from all new features and functionalities that are being developed in v2.x.
👍 Even though a lot of effort has been put in retaining backwards compatibility with older versions of e107, developers are strongly encouraged to update their code to new standards.
PHP and MySQL versions
The functionality of plugins also depends on the PHP and MySQL versions that are being used.
Plugins that are not regularly updated may make use of deprecated and/or removed PHP/MySQL functionality. In this case, plugins can cause a website to malfunction, or plugins appear to be broken.
TIP: When updating plugins, take into consideration the latest PHP/MySQL developments to ensure continued functionality.
Check the 👉requirements page for more information on the minimal and recommended requirements for an e107 installation.
In e107 v2.x, numerous classes and methods were introduced in order to standardize functionality across installations, ensure continued functionality and to minimize performance issues and security risks.
Developers are strongly encouraged to make use of e107's standard classes & methods
Plugin templates should be stored in e107_plugins/yourplugin/templates/ by default. The template file should contain a variable with the same name as your template file. Instead of including the template, below is the difference:
eg. If your file is called myplugin_template.php , within this file you might see something like this:
Shortcode Wrappers.
In v2.x there are two methods to add wrappers around your shortcodes. The way to declare them differs slightly from v1 in that we use a kind of 'shortcode-wildcard' {---}.
A global shortcode wrapper. ie for shortcodes which are available site-wide. (for example those registered globally for use in menus or found in e107_core/shortcodes/single/)
Example:
Template-Specific Shortcodes
v2.x introduces a template-specific shortcode wrapper. ie. as used on a single page of your site.
Example:
In the Plugin Manager you will find something called "Plugin Builder". It allows you to select your e107 *_sql file from your plugin folder and will generate most of the new code for the Admin Area of your plugin. It will also generate the new plugin.xml meta-file, which is used during installation of your plugin.
👍 It is strongly recommended for plugin developers to upgrade their Admin Area using the Plugin Builder.
Migrating plugin preferences
👍 In e107 v.2x, it is strongly recommended for plugins to save their preferences in their own table row. Older plugins may still store plugin preferences in the core preference table.
migrateData()
To easily migrate from one to the other, one can use the method called migrateData().
Example of migrating plugin preferences to their own row in the database:
// v1.x way of doing it.
$sc_style['CONTACT_PERSON']['pre'] = "<small>".LANCONTACT_14."</small><div>";
$sc_style['CONTACT_PERSON']['post'] = "</div>";
// v2.x way of doing it.
$SC_WRAPPER['CONTACT_PERSON']= "<small>".LANCONTACT_14."</small><div>{---}</div>";
Please note: This page is under construction and has not been finished yet.
Welcome to the new Developer Guide for e107.
The Developer Guide is still under construction but more and more information is added over time.
You can use the menu on the left to navigate to the underlying pages.
<?php
require_once("class2.php"); // Load e107's main classes and functionalities
require_once(HEADERF); // Load and output the theme's HTML for the $HEADER.
// Option 1:
echo "Hello World";
// Option 2:
$ns = e107::getRender(); // Load rendering object.
$ns->tablerender("My Caption", "Hello World"); // Render Caption and Text according to Theme style.
require_once(FOOTERF); // Load and output the theme's HTML for the $FOOTER.
exit;
Internationalisation (LAN)
Introduction
Your website can be used in different languages. In order for your plugin or theme areas to be displayed in a specific language, it needs to be translated.
👍You should always include the English language files in your plugin!
Language files
File Types
There are three types of language files that can be used in your plugin.
Defining Language Terms
Language Terms are more commonly known as LAN's. You can define LAN's by using PHP constants:
Best practices
👍Always use the format LAN_PLUGIN_{FOLDER}_{TYPE} to prevent conflicts.
Avoid duplicating terms, particularly in the admin area.
👍 If defining terms for admin, always search lan_admin.php for existing LANs which may match what you require.
Never use HTML or URLs inside LAN definitions.
👍 Use double quotes within the defines and use str_replace() or 👉 for where needed.
Avoid short language strings for common words
Examples are words such as 'and', 'to' and so on. There aren't always equivalents in other languages.
👍 If embedding values into a phrase, use .
Avoid using terms which are real words or known BBCodes.
👍 Use brackets [..] and values such as x, y, z. See below.
Examples
Good
Bad
Substitution
Loading Language Files
e107::lan()
To load a language file from a plugin folder, use e107::lan():
This will include the following paths:
Language File
Usage
English_front.php
Used only for the frontend of your plugin
English_admin.php
Used only for the Admin Area of your plugin
English_global.php
Used site-wide, for example in 👉 , files such asxxxx_menu.phpor 👉 .
define("LAN_PLUGIN_MYPLUGIN_NAME", "Blank Plugin");
define("LAN_PLUGIN_MYPLUGIN_DIZ", "A Blank Plugin to help you get started in plugin development. More details can be added here.");
define("LAN_PLUGIN_MYPLUGIN_LINK", "Blank Link");
define("LAN_XXX", "Thank you Firstname");
define("LAN_XXX", "Go to [x] to see the results."); // Good - replace [ and ] with <a href='...'> and </a> using str_replace()
define("LAN_XXX", "I want to [quote] here"); // Good - replace [ and ] with " " using str_replace()
define("LAN_XXX", "Thank you <b>Firstname</b>"); // Bad contains HTML
define("LAN_XXX", "Thank you <a href='http://somewhere.com'>Firstname</a>"); // Bad contains HTML and allows translator to modify link.
define("LAN_EXAMPLE_01", "Update results: [x] records changed, [y] errors, [z] not changed");
$repl = array($changed, $errors, $unchanged);
$text = e107::getParser()->lanVars(LAN_EXAMPLE_01, $repl);
Please note: This page is under construction and has not been finished yet.
Introduction
Best practices
Do not modify the core database structure
👍 Use your own tables (for example by ) if you want to work with additional data in the database.
Do not (ab)use database tables and fields for other purposes
👍 Stick to purposes overview, or create your own database tables
Database prefix
The default database table prefix is e107_ and can be customized by the user during the installation of e107. The prefix that is used on an installation can always be found in the e107_config.php file.
There are several ways the database prefix is used:
Recommended: It is strongly recommend to make use of the . Using these methods, the database table prefix is processed automatically.
By using the # sign, one can automatically refer to the database prefix. This is generally used when using the method, to manually construct an SQL query.
Database tables overview
TODO: Finish table below.
The following table provides an overview of all database tables in a clean e107 installation, with their respective purposes.
Table name
Description
URLs
Please note: This page is under construction and has not been finished yet.
Introduction
You can generate a Search Engine Friendly (SEF) URLs using the following method:
Parameter
Type
Description
Mandatory?
Examples
Example 1: Forum topic URLs
In this example we will generate search-engine-friendly URLs for a forum topic with the following code: .
The code above loads the following file: e107_plugins/forum/e_url.php and generates a URL from the following array data with the unique key topic:
Only the value of 'sef' is used in this array. it substitutes the values {forum_sef},{thread_id} and {thread_sef} with the variables in the $data array.
The end result would look something like this:
Example 2: Using optional parameters
TODO: Add examples using the options parameter
Admin-UI (User Interface)
Please note: This page is under construction and has not been finished yet.
Introduction
In rare cases, you may reference the
MPREFIX
constant. Its use is deprecated and
not
encouraged.
core_media
core_media_cat
cron
dblog
generic
Table for generic purposes. Generally used to store temporary date. Currently also used by welcome message.
Developers are discouraged to use this table!
👍 The advantages of using the new Admin-UI are numerous - including, but not limited to:
No need to code in the HTML or the process of reading or writing to your database.
Consistent interface with the rest of Admin Area
Users can select which fields from your database table they wish to view - based on your predefined list.
The Media-Manager is integrated into the system.
Easily add drag and drop sorting/re-ordering to your plugin.
Easily add batch functionality such as deleting, copying, featurebox creation, sitelink creation, userclass modification, etc.
Easily add inline editing to your data.
Easily add tabs to keep your plugin's admin-area well organized.
👍TIP: The Plugin Builder is very useful tool to use for the Admin-UI as it will generate most of the new code for the Admin-UI of your plugin.
File structure
Below you can find the basic file structure of of the admin_config.php file. This file serves the Admin-UI to the administrators.
It is strongly recommended to use admin_config.php as the filename!
Classes, methods, variables
This section will summarize the various options which may be used while utilizing the Admin-UI class.
Please note that the documentation for this section is a work-in-progress.
Thank you for your patience!
class plugin_blank_admin
extends e_admin_dispatcher
$modes
...
class plugin_blank_admin_ui
extends e_admin_ui
$fields
Database fields are defined by the $fields value in the Admin-UI class.
Example:
Key
Format
Description
title
string
Field Title
type
string
Type of Field
data
string
Data Type
type
Type
Description
text
text box
number
text box (number)
checkbox
checkbox (0 or 1 is returned)
icon
icon (from media manager)
textarea
text area (text only)
data
Value
Description
str
Posted data is converted to string before saving to the database
safestr
Posted data is run through a filter (using filter_var(FILTER_SANITIZE_STRING)) and thus strips HTML.
int
Posted data is converted to integer before saving to the database
array
Posted data is converted to an e107 array format. (use e107::unserialize() to decode)
json
Posted data is converted to json format before saving to the database
readParms (list mode)
Key
Value
Field-type
Comments
thumb
(integer)
image
Set the thumbnail width
url
(string) e_url.php key value or a field key.
number, text, tags, null
Wrap value in a link
target
writeParms (create/edit mode)
Key
Value
Field-type
Comments
pre
(html)
(all)
Render html just before the field
post
(html)
(all)
Render html just after the field
media
Creating a tree structure
The Admin-UI allows to automatically create a tree structure based on parent/child relationship tables. In order to add a tree structure, add the following code:
In this case:
field1 represents the field which determines the order (for example an ID field).
field2 represents the field which is the parent
field3 represents the field which is the child
Examples
Examples can be found in the forum and download plugin.
Including Javascript in your plugin or theme may be achieved by using the following function:
Parameter
Value
Description
Mandatory?
type
See
Yes
data
See
Yes
parm
type & data
Type
Data
Description
core
path relative to the core folder
Include a core js file
url
full URL to javascript file
Include a remote js file
inline
javascript code
Include raw javascript code
Examples
Example #1
Load a script in the 'faqs' plugin directory and auto-load jQuery if not already loaded.
Example #2
Load a theme script in the footer
Example #3
Load a theme script in the header
settings
An associative array with configuration options.
The array is merged directly into e107.settings.
All plugins should wrap their actual configuration settings in another variable to prevent conflicts in the e107.settings namespace.
Items added with a string key will replace existing settings with that key; items with numeric array keys will be added to the existing settings array.
Remember that loading from URL may take more time than local resources. Use dependency if needed!
JavaScript Behaviors
Behaviors are event-triggered actions that attach to page elements, enhancing default non-JavaScript UI's.
Behaviors are registered in the e107.behaviors object using the method 'attach' and optionally also 'detach' as follows:
e107.attachBehaviors is added to the jQuery ready event and so runs on initial page load. Developers implementing Ajax in their solutions should also call this function after new page content has been loaded, feeding in an element to be processed, in order to attach all behaviors to the new content.
See the e107_web/js/core/all.jquery.js file for more information.
Using jQuery
jQuery is now namespaced to avoid conflicts with other Javascript libraries such as Prototype. All your code that expects to use jQuery as $ should be wrapped in an outer context like so.
If you don't, you may see the following error:Uncaught TypeError: Property '$' of object [object DOMWindow] is not a function or similar
jQuery Once
e107.behaviors will often be called multiple times on a page. For example, core/custom plugin performs some Ajax operation, all e107 behaviors will be executed again after page load, in order to attach any relevant JavaScript to the newly loaded elements.
This can have the undesired affect of applying JavaScript to elements each time e107 behaviors are executed, resulting in the same code being applied multiple times. To ensure that the JavaScript is applied only once, we can use the jQuery $.once() function. This function will ensure that the code inside the function is not executed if it has already been executed for the given element.
Using jQuery $.once() (integrated into e107 core), the developer experience of applying these effects is improved. Note that there is also the $.removeOnce() method that will only take effect on elements that have already applied the behaviors.
Settings passed locally to JavaScript Behaviors
How to override a JavaScript Behavior
If you want to override a bit of core (or third party) e107 JavaScript Behavior, just copy the behavior to your Javascript file (e.g in your plugin or theme), then load it after the original code using "zones".
Core Shortcodes
Please note: This page is under construction and has not been finished yet.
Renders a specific custom menu item as defined in admin -> Pages/Menus. xxxxxx = menu name.
{LOGO}
The site's logo as defined in the admin preferences.
{MENU=1}
Menu Area as allocated using the media-manager in admin. Add multiple areas by incrementing the numeric value.
{MENU: type=xxxxxx}
When xxxxxx is NOT a number, it will attempt to render a specific menu with the name xxxxxx. eg. {MENU=contact} will render e107_plugins/contact/contact_menu.php
Please note: This page is under construction and has not been finished yet.
Theme shortcodes
Plugin shortcodes
Theme Shortcodes
Please note: This page is under construction and has not been finished yet.
Introduction
......
Common theme shortcodes
Please refer the the section
theme_shortcodes.php
👍TIP: As of e107 v2.x, you no longer need separate xxxxxx.sc files inside your theme's folder. You can now include all your theme-specific shortcodes in a single file called .
These shortcodes may be used in your theme.html and layout/xxx _layout.html files which reside inside your theme's folder. eg. Using the example below: {MY_SHORTCODE} and {MY_OTHER_SHORTCODE} will be substituted with "Something" and "Something else".
Please note: This page is under construction and has not been finished yet.
Introduction
Use the following to retrieve the form class object
Forms methods
open()
Returns a form opening tag.
close()
Returns a form closing tag
text()
Returns a text field form element
textarea()
bbarea()
select()
checkbox()
hidden()
button()
carousel()
Render a Bootstrap carousel
tabs()
Render Bootstrap tabs
datepicker()
Date field with popup calendar. Returns UNIX timestamp or string value on submit.
TODO: Clarify possible options and add more examples
Examples:
The request URL
e_REQUEST_URI by default
No
options
array
Specify options such as class or autocomplete
autocomplete - on/off (boolean)
class - (any string)
No
Specifies the maxlength element of the text field
options
array
Specify options such as class, size or selectize
class: (any string)
size: mini, small, medium, large, xlarge, xxlarge
selectize: array with selectize.js options
A string defining the button template to use with bbarea. Included in the core are the following: news, submitnews, extended, admin, mailout, page, comment, signature
But you can also use the name of the plugin (e.g. forum) if the plugin provides a bbcode_template.php
No
mediaCat
string
Name of the media catalog to use
(default: _common)
Is only used by TinyMCE plugin (if installed and used)
No
size
string
Size of the bbarea/editor.
Use one of the following values: tiny, small, medium, large
(default: large)
No
options
array
Array with options to use with the editor:
id: string - In case the bbarea/editor id should be different to the name
class: string - the css classes to use
counter: boolean - Show a character counter
wysiwyg: boolean/string -
False in case you want disable the wysiwyg editor for this field and use the default bbcode editor.
True to enable the current installed (and enabled) wysiwyg editor
No
Available options (see below):
mode - 'date' or 'datetime'
format -
timezone
No
Parameter
Type
Description
Mandatory
name
string
Name of the form
Yes
mode
string
post | get
'post' by default
No
target
Parameter
Type
Description
Mandatory
name
string
Name of the text field
value
string
Value of the text field
maxlength
Parameter
Type
Description
Mandatory
name
string
Name of the field
Yes
value
string
Contents of the field
Yes
template
Parameter
Type
Description
Mandatory?
name
string
The name of the field
Yes
datestamp
integer|boolean
UNIX timestamp. Set the default value of the field.
Please note: This page is under construction and has not been finished yet.
Introduction
TODO:
overview of install & config files (theme.xml & theme_config.php)
highlight some options
theme.xml
This file contains information about the theme. and is used during installation and also during configuration of the theme.
👍TIP: To create a new theme.xml file or derive one from an existing v1.x theme.php file use the in the Admin Area > Theme Manager > Tools
(/e107_admin/theme.php?mode=convert)
Please note: Unlike , the theme.xml file is not intended to replace the file. Instead, theme.xml works alongside to provide (meta)data about the theme itself.
Example#1: Full theme.xml
The below example uses the theme.xml from the Bootstrap3 theme included in e107 by default. Each section of the XML file is elaborated upon below.
Example #2: Minimal theme.xml
TODO: Provide minimal required theme.xml example
e107Theme
This is the namespace the configuration lives in. All theme.xml files must begin and end with this tag.
The following attributes of the theme are defined here:
Attribute
Description
Example
Mandatory?
👍Tip: If you are developing a commercial theme, you'll want to add a few extra attributes so that it displays correctly in the admin area under "".
Just package the theme's zip file with only the and any images (including screenshots), excluding .php, .css files etc. before sharing it in the 👉 .
When the user clicks to download the theme, it will display the URL you have provided.
In previous versions of e107, the attribute releaseUrl was used. This attribute is deprecated and should be removed.
Author
Identifies the theme author and highlights some information.
👍Note the / to close the tag at the end.
The following attributes of the author are defined here:
Attribute
Description
Example
Mandatory?
Summary
A text that shortly summarises the theme.
TODO: Check if using LAN is possible
Description
A text that provides a more elaborate description of the theme.
TODO: Check if using LAN is possible.
Category
The category that a theme belongs to. Possible values are:
Generic
Adult
Blog
Plugins
In this section, theme designers can include plugins that they intend to be used with the theme. In the 👉 "" > > "" section with buttons for those plugins that the user can click on to install them.
plugin
Attribute
Description
Example
Mandatory?
TODO: check format for third-party plugins.
Keywords
The keywords associated with the theme. They are used when searching for plugins either through the Admin Area or on 👉 .
word
Screenshots
Each theme can contain one or more screenshots. These screenshots are displayed in the Admin Area and on 👉 .
image
Refers to the location of the image file, relative to the root of the theme folder
Libraries
TODO: provide explanation
library
Stylesheets
css
TODO: asterix (*) usage?
Layouts
Each theme can contain various layouts. Additionally, each layout can be used for specific and each layout can have specific .
Layout
Attribute
Description
Example
Mandatory?
Custom Pages
Each layout can assign specific pages which then, by default, make use of this specific layout. The user can modify the pages used by each layout in the 👉 "" > > >
👍 You can use the constant FRONTPAGE to refer to the currently set 👉 setting.
constant
Adding $CUSTOMPAGES to in e107 v2.x is deprecated and should be avoided!
Menu Presets
Theme authors can create buttons for menus that can be activated by the user from "Menu Manager" or "Theme Manager". These are placed between and and should be enclosed in the and tags with the opening area tag naming the menu area it corresponds to; the example below would be for a layout with two (2) menu areas ({MENU=1} = and {MENU=2} = ). The tag "menu name" must contain the name of a valid and installed menu.
ThemePrefs
Set default theme preferences?
TODO: also refer to
pref
name, (value)
theme_config.php
This file can be used to add information and user-selectable options to the theme's configuration page.
👍 If you want users to b e able to set specific theme preferences, use the theme_config.php file.
Example
Favicon
Automatically, e107 is looking for the favicon.ico file in the following locatons in this specificorder:
inside the root of the theme folder (e107_themes/yourtheme)
inside the root of the e107 installation (/)
This way, theme authors can override the default favicon, and users can upload their own favicon to the theme folder.
👍TIP: To insert more favicons, you can use the 👉
refer to example themes (bootstrap3)
2020-30-12
Yes
compatibility
The minimum version of e107 required to use the theme.
(semantic versioning)
2.1.0
Yes
price
In case of a commercial theme: the sales price of the theme.
(xx.xx format)
25
No
currency
In case of a commercial theme: the abbreviation of the currency in which the theme is sold for (see price).
EUR
No
url
In case of a commercial theme: the direct URL to the specific theme.
When the user clicks to download your theme, the URL you have provided will be loaded.
❗Note: do not add the URL to the generic homepage of your website, but only the URL to the specific page for that specific theme.
No
https://www.e107.org
Yes
description
A brief description of your theme. Displayed on the Admin Area > page.
Example description of your choice.
No
Corporate
Gaming
News
admin
Yes
A high-contrast light skin
No
thumbnail
images/admin_modern-light.webp
No
scope
admin
Yes
exclude
bootstrap
No
true
No
preview
A preview image (thumbnail) of the layout.
(recommended dimensions?)
preview.png
No
previewFull
A preview image of the layout (full size)
(recommended dimensions?)
preview_full.png
No
name
The name of your theme. This can be text or a constant defined from your themes's language file.
Bootstrap3
Yes
version
The version of the theme
(semantic versioning)
3.0
Yes
date
name
The author's name, e107 user name or nickname.
e107 Inc.
Yes
email
E-mail address. Useful to get feedback and bug reports on the theme. A mailto link to it is displayed on the Admin Area > Theme Manager page.
Please note: This page is under construction and has not been finished yet.
Introduction
Plugin developers can hook into various e107 core events and . Typically, an file is used to store this information since it is loaded with every page.
From e107 version 2.1.2 onwardsyou can use addon to catch the events instead of using
Events methods
register()
Parameter
Description
Mandatory?
Example 1: trigger myFunction() on user login.
Example 2: trigger myFunction() on user login. Function in external file.
Example 3: trigger a class and method on user login.
trigger()
Triggers an event. This can be used by plugin authors to create their own plugin events that other developers can hook into.
Parameter
Description
Mandatory?
Core Event triggers
User Event Triggers
Basic user functions
Trigger Name
Description
Data
Custom page
Trigger function
Description
Data
News
Trigger Name
Description
Data
Private Messenger
Trigger name
Description
Data
Forum
Trigger Name
Description
Data
Chatbox
Trigger function
Description
Data
Admin Event Triggers
Admin changes their password
Trigger Name
Description
Data
Comments Manager
Trigger Name
Description
Data
Downloads
Trigger Name
Description
Data
News
Trigger Name
Description
Data
Pages
Trigger Name
Description
Data
Users
Trigger Name
Description
Data
User submits signup form
Array of user data
user_signup_activated
User activates newly created account. (email link)
Array of user data
user_xup_login
User signs in via a social media account. eg. Facebook, Twitter etc.
Array of user data
user_xup_signup
User creates an account using their social media login. Facebook, Twitter etc.
Array of user data
user_profile_display
User has viewed a profile
Array of data
user_profile_edit
User has edited their profile
Array of data of user who changed the settings
user_comment_posted
User has posted a new comment
Array of data
preuserset
Before usersettings are updated
Array of new user settings ($_POST)
postuserset
After usersettings are updated
Array of new user settings ($_POST)
userdatachanged
After usersettings are updated (same time and data as user_profile_edit)
e107::getEvent()->trigger($eventname, $data = '');
// Example for plugin authors to create their own plugin event:
e107::getEvent()->trigger("plugindir_customevent", $data = ''); // plugindir is the name of the plugin folder
Installation & configuration
Please note: This page is under construction and has not been finished yet.
Introduction
Folder structure & files
The table below lists the files that can be used in a plugin. Only few of them are mandatory.
Note: Please replace the cursive plugin with the name of the plugin folder.
(*menu.php, *_setup.php, *_shortcodes.php, *_sql.php).
TIP: the _blank plugin contains useful examples as reference material.
Filename / Foldername
Description
Mandatory?
plugin.xml
Elements & attributes
Element
Sub
Attributes
Text / Value
Mandatory?
Examples
Simple
Advanced
Commercial plugins
Commercial plugins can make use of a few extra attributes to the <e107Plugin> element, so that this information will be displayed correctly in the admin area under 👉 "".
Attribute
Description
Example
plugin_menu.php
....
plugin_setup.php
Do not forget to use your plugin name in the filename, e.g. "myplugin_setup.php"
TODO: Add this section, provide example.
plugin_shortcodes.php
Please refer to the page
plugin_sql.php
Do not forget to use your plugin name in the filename, e.g. "myplugin_sql.php"
This file contains the SQL database structure of the plugin. It will be analyzed on plugin install and missing tables will be installed automatically.
Any differences between the defined structure here and the table structure on the server will be detected and the user will be informed in the Admin Area.
👍TIP: To check if the table structure is still valid, run 👉"Admin Area > Tools > Database > "
Supported operations
For the moment, the following operations are supported:
Create table
Change field type, field size, field null or not, field default value
Add index
Unsupported operations
Operations that are currently NOT supported are:
Rename table: by renaming the tablename, e.g. "blank" > "blank2"). The renamed table will be considered as new!
Drop a table: e.g. if you remove the "blank" table definition from this file, the table will NOT be deleted from the database!)
Rename or drop a field: a renamed field will be considered new, a missing field definition will NOT be recognized at all!
👍TIP: Check the blank_setup.php file or the forum_setup.php file for examples on renaming/dropping/modifying tables, fields and indexes.
Example
admin_config.php
Please refer to the
No
Allow to run code before or after (un)installing the plugin, or to set checks for newer plugin versions.
No
...
No
Contains the database structure.
No
Contains the configuration.
No
e_*.php addons
.
No
Yes
version
Yes
date
Yes
lan
No
compatibility
Yes
installRequired
Yes
<author>
name
Yes
url
Yes
email
Yes
<description>
Textual description of the plugin
Yes
lan
LAN reference to the description
No
<copyright>
Copyright text
?
<category>
Plugin category. Choose from:
- settings
- users
- content
- tools
- manage
- misc
- menu
- about
Yes
<keywords>
No
<word>
Keyword
No
<adminLinks>
No
<link>
Yes
url
URL of the link
Yes
description
Description of the link
Yes
icons
icon path
Yes
<sitelinks>
No
<link>
Link name
Yes
url
URL of the link
Yes
<pluginPrefs>
No
<pref>
Value of the pref
Yes
name
Name of the pref
Yes
<dependencies>
No
<plugin>
No
name
Yes
min_version
No
<PHP>
No
name
Yes (= core)
min_version
Yes
<MySQL>
No
name
Yes (= server)
min_version
Yes
<extension>
No
name
Yes
min version
No
<userClasses>
No
<class>
Yes
name
class_name (lowercase)
Yes
description
Description of the userclass
Yes
<extendedFields>
No
<field>
Yes
name
Name of the EUF
Yes
type
Type of the EUF. Choose from:
EUF_TEXT
EUF_RADIO
EUF_DROPDOWN
Yes
default
Yes
active
true/false
Yes
Change an index/key: the change is recognized, but leads to an error message and the change is not applied.
Rename or drop an index/key: rename is recognized as a new index and the missing index is not recognized at all!)
A field definition containing "NULL DEFAULT NULL". The "Check for updates" method will always detect a change.
but fails silently when trying to update. In that case remove the first "NULL" and run the the "Check for updates" again.
Please note: This page is under construction and has not been finished yet.
Introduction
Use the following to retrieve the parser class object.
Parser methods
toHTML()
Parse HTML in various ways. eg. replace constants, convert bbcode etc.
Parameter
Type
Description
Mandatory?
Example
toDate()
Convert a UNIX timestamp into a readable format.
Parameter
Type
Description
Mandatory?
toText()
Convert html to plain text.
createConstants()
Convert e_xxxxx paths to their equivalent shortcodes. eg. e_PLUGIN becomes {e_PLUGIN}
replaceConstants()
Convert {e_XXXX} shortcode paths to their equivalent constants. eg. {e_PLUGIN} becomes e_PLUGIN
parseTemplate()
Parse an e107 template using core and/or custom shortcodes. ie. replaces all instances of {XXXXX_XXXX} etc.
Parameter
Type
Description
thumbUrl()
Use to convert {e_MEDIA_IMAGE} and other image paths to an auto-sized image path for use inside an <img> tag.
setThumbSize()
Set the width, height and crop of the thumbUrl function.
toGlyph()
Convert a glyph name into Html. Just choose an icon from and remove the first 'fa'
Templates may also use the following shortcode: which calls the same function.
Advanced settings:
toIcon()
Render an icon. If a .glyph extension is found, it will automatically use the toGlyph() function above.
toAvatar()
Render a user avatar. If empty, the current user's avatar will be displayed if found or a generic avatar image.
toImage()
Render an image.
lanVars()
Used for of variables, in for example.
Parser options
TODO: Convert below code into readable tables with proper descriptions
Parser modifiers
TODO: Convert below code into readable tables with proper descriptions
Database
Please note: This page is under construction and has not been finished yet.
Introduction
Choose from pre-defined .
No
postID
No
wrap
boolean
Default: false
No
text
string
text or HTML to be parsed
Yes
bparseBB
boolean
set to true to parse BBcodes into HTML
No
modifiers
datestamp
unix
timestamp
Yes
format
string
short - Short date format as defined in admin preferences
long - Long date format as defined in admin preferences
relative - relative time format. eg. "2 days ago"
Default: short
Comma separated list of fields or "*" or a single field name (get one);
If $fields is of type boolean and $where is not found, $fields overrides $multi
where
string
WHERE/ORDER/LIMIT etc. clause.
Example #1: Get a single value
Example #2: Get multiple table-row values
Example #3: Fetch all, don't append WHERE to the query, index by user_id, noWhere auto detected (string starts with upper case ORDER)
Example #4: Same as above but retrieve() is only used to fetch, not useable for single return value
Example #5: Using whole query example, in this case default mode is 'one'
Example #6: Using whole query example, multi mode - $fields argument mapped to $multi
delete()
Delete a record from a database table.
gen()
Generic query function to use various SQL commands.
Example: perform a JOIN with gen():
Advanced database methods
connect()
Parameter
Type
Description
mySQLserver
string
IP or hostname of the SQL server
mySQLuser
string
SQL username
mySQLpassword
string
SQL password
count()
database()
Parameter
Type
Description
database
string
Database name
prefix
string
Prefix of the database tables (e.g. "e107_"). Defaults to .
multiple
boolean
Set to true to maintain connection to a secondary database
echo $tp->toAvatar(); // render avatar of the current user.
$userData = e107::user(5); // Get User data for user-id #5.
echo $tp->toAvatar($userData); // requires as a minimum $userData['user_image'].
$url = "{e_MEDIA_IMAGE}2012-04/someimage.jpg";
$parms = array('w'=>500, 'h'=>200,'crop'=>1, 'alt'=>'my image'); // if not width/height set, the default as set by {SETIMAGE} will be used.
echo $tp->toImage($url,$parms);
define("LAN_EXAMPLE_01", "Update results: [x] records changed, [y] errors, [z] not changed");
$repl = array($changed, $errors, $unchanged);
$text = $tp->lanVars(LAN_EXAMPLE_01, $repl);
// Set up the defaults
private $e_optDefault = array(
// default context: reflects legacy settings (many items enabled)
'context' => 'OLDDEFAULT',
//
'fromadmin' => false,
// Enable emote display
'emotes' => true,
// Convert defines(constants) within text.
'defs' => false,
// replace all {e_XXX} constants with their e107 value - 'rel' or 'abs'
'constants' => false,
// Enable hooked parsers
'hook' => true,
// Allow scripts through (new for 0.8)
'scripts' => true,
// Make links clickable
'link_click' => true,
// Substitute on clickable links (only if link_click == TRUE)
'link_replace' => true,
// Parse shortcodes - TRUE enables parsing
'parse_sc' => false,
// remove HTML tags.
'no_tags' => false,
// Restore entity form of quotes and such to single characters - TRUE disables
'value' => false,
// Line break compression - TRUE removes newline characters
'nobreak' => false,
// Retain newlines - wraps to \n instead of <br /> if TRUE (for non-HTML email text etc)
'retain_nl' => false
);
// Super modifiers override default option values
private $e_SuperMods = array(
//text is part of a title (e.g. news title)
'TITLE' =>
array(
'nobreak' => true, 'retain_nl' => true, 'link_click' => false, 'emotes' => false, 'defs' => true, 'parse_sc' => true
),
'TITLE_PLAIN' =>
array(
'nobreak' => true, 'retain_nl' => true, 'link_click' => false, 'emotes' => false, 'defs' => true, 'parse_sc' => true, 'no_tags' => true
),
//text is user-entered (i.e. untrusted) and part of a title (e.g. forum title)
'USER_TITLE' =>
array(
'nobreak' => true, 'retain_nl' => true, 'link_click' => false, 'scripts' => false, 'emotes' => false, 'hook' => false
),
// text is 'body' of email or similar - being sent 'off-site' so don't rely on server availability
'E_TITLE' =>
array(
'nobreak' => true, 'retain_nl' => true, 'defs' => true, 'parse_sc' => true, 'emotes' => false, 'scripts' => false, 'link_click' => false
),
// text is part of the summary of a longer item (e.g. content summary)
'SUMMARY' =>
array(
'defs' => true, 'constants' => 'full', 'parse_sc' => true
),
// text is the description of an item (e.g. download, link)
'DESCRIPTION' =>
array(
'defs' => true, 'constants' => 'full', 'parse_sc' => true
),
// text is 'body' or 'bulk' text (e.g. custom page body, content body)
'BODY' =>
array(
'defs' => true, 'constants' => 'full', 'parse_sc' => true
),
// text is parsed by the Wysiwyg editor. eg. TinyMce
'WYSIWYG' =>
array(
'hook' => false, 'link_click' => false, 'link_replace' => false, 'retain_nl' => true
),
// text is user-entered (i.e. untrusted)'body' or 'bulk' text (e.g. custom page body, content body)
'USER_BODY' =>
array(
'constants' => 'full', 'scripts' => false, 'nostrip' => false
),
// text is 'body' of email or similar - being sent 'off-site' so don't rely on server availability
'E_BODY' =>
array(
'defs' => true, 'constants' => 'full', 'parse_sc' => true, 'emotes' => false, 'scripts' => false, 'link_click' => false
),
// text is text-only 'body' of email or similar - being sent 'off-site' so don't rely on server availability
'E_BODY_PLAIN' =>
array(
'defs' => true, 'constants' => 'full', 'parse_sc' => true, 'emotes' => false, 'scripts' => false, 'link_click' => false, 'retain_nl' => true, 'no_tags' => true
),
// text is the 'content' of a link (A tag, etc)
'LINKTEXT' =>
array(
'nobreak' => true, 'retain_nl' => true, 'link_click' => false, 'emotes' => false, 'hook' => false, 'defs' => true, 'parse_sc' => true
),
// text is used (for admin edit) without fancy conversions or html.
'RAWTEXT' =>
array(
'nobreak' => true, 'retain_nl' => true, 'link_click' => false, 'emotes' => false, 'hook' => false, 'no_tags' => true
),
'NODEFAULT' =>
array('context' => false, 'fromadmin' => false, 'emotes' => false, 'defs' => false, 'constants' => false, 'hook' => false,
'scripts' => false, 'link_click' => false, 'link_replace' => false, 'parse_sc' => false, 'no_tags' => false, 'value' => false,
'nobreak' => false, 'retain_nl' => false
)
);
$array = $sql->retrieve('
SELECT p., u.user_email, u.user_name
FROM `#user` AS u
LEFT JOIN `#myplug_table` AS p
ON p.myplug_table = u.user_id
ORDER BY u.user_email LIMIT 0,20
');
$array = $sql->retrieve('SELECT u.user_email, u.user_name FROM #user AS U ORDER BY user_email LIMIT 0,20', true);
$sql->delete("user", "user_id = 2");
$sql->gen("SELECT f.*,u.user_name FROM #faqs AS f LEFT JOIN #users as u ON f.faq_author = u.user_id ");
Please note: This page is under construction and has not been finished yet.
Introduction
There are several ways to extend the core functionality of e107. One of those ways is by using so-called "addons". These addons are files which reside in each plugin's folder and allow a plugin to embed itself inside e107's core pages and functions.
The addons can be recognised by their e_xxxxx.php naming format. By simply placing them inside your plugin's folder, they will be auto-detected during installation and integrated into the system.
Please note: If addons are added after plugin installation, you may need to run the 👉 "" option in Admin Area > Tools > .
TIP: The _blank plugin in the e107_plugins folder contains example addons that may be an easy reference for you.
Overview of all plugin addons
Plugin addons
👍 Be sure to replace plugindir with your plugin's directory name in all examples below.
e_admin.php
TODO: Add example. See social plugin for an example.
e_bb.php
TODO: Add example.
e_comment.php
TODO: Add example. See social plugin for an example.
e_cron.php
This addon allows a plugin to add additional scheduled task options to e107. (see Admin Area > Tools > ).
Example:
e_dashboard.php
This addon adds custom plugin information to the dashboard of e107's admin area. The 'latest', 'status' and 'website stats' areas may all contain information from your plugin.
Previously, the e_latest and e_status addons were used separately for this. They have now been incorporated into the e_dashboard addon.
Example:
e_emailprint.php
Deprecated!
This addon has been deprecated. Use instead.
e_event.php
This addon allows a plugin to easily hook into system events and trigger their own methods and functions using data provided by those events.
You can make use of the and .
Example:
e_featurebox.php
TODO: Add example.
e_footer.php
This addon allows a plugin to include code in the footer of every page of the site.
Please find an example in the "tinymce4" plugin.
e_frontpage.php
This addon allows a plugin developer to add their plugin as a 👉 option.
Example:
e_gsitemap.php
TODO: Add example. See "news" plugin folder for an example.
e_header.php
This addon allows a plugin developer to add data to the <head> of every page. This file is loaded in the header of each page of your site. ie. Wherever you see require_once(HEADERF) in a script.
Typically you would use one or all of the following functions within this file: , or
Warning: Output should never be echoed or printed from this file!
Example:
e_help.php
Deprecated!
This addon allowed plugin developers to add information to the plugin configuration page sidebar.
This has now been integrated within the through the renderHelp() method.
e_latest.php
Deprecated!
This addon has been deprecated. Use instead.
e_library.php
Please find an example in the "_blank" plugin.
e_linkgen.php
Deprecated!
This addon has been deprecated. Use instead.
e_list.php
TODO: Add example.
e_mailout.php
This addon allows a plugin to use e107's mailout feature for bulk mailing.
Please find an example in the "newsletter" plugin.
e_menu.php
This addon provides configuration options for each instance of the plugin's menus.
The e_menu.php addon is a replacement for the old config.php file used in e107 v1.x.
Example:
e_meta.php
Deprecated!
This addon has been deprecated. Use instead.
e_module.php
This addon is loaded every time the core of e107 is included. ie. Wherever you see require_once("class2.php") in a script.
It allows a developer to modify or define constants, parameters etc. which should be loaded prior to the header or anything that is sent to the browser as output. It may also be included in Ajax calls.
e_notify.php
This addon adds the plugin to the 👉 section in the Admin Area and allows a plugin to send notifications.
Example:
The notification can then be triggered by using:
e_output.php
This addon allows to hook into all pages at the very end (after the closing </html>). This is useful for example when capturing 👉.
e_parse.php
This addon allows to hook into e107's
Example:
e_print.php
This addon allows a plugin developer to specify content that is displayed in printer-friendly format
Example:
e_rss.php
This addon adds the plugin to the RSS plugin, and generates RSS feeds for the plugin.
Example:
e_related.php
This addon adds the plugin to the search which generates 'related' links in news items and pages of e107.
Example:
e_search.php
This addon adds the plugin to the 'search page' of e107.
Example:
e_shortcode.php
This addon allows a plugin to make their shortcodes available to core templates and templates of other plugins.
It's content is identical to that of a regular shortcode class except that all the methods must follow the following naming convention: sc_plugindir_name()
The $override property can be used to override existing core/plugin shortcodes. When set to true existing core/plugin shortcodes matching methods below will be overridden.
Example:
e_sitelink.php
This addon adds a sitelink sublink-generating function for your plugin. An example is auto-generated navigation drop-down menus for 'latest articles'.
Example:
e_status.php
Deprecated!
This addon has been deprecated. Use instead.
e_tohtml.php
Deprecated!
This addon has been deprecated. Use instead.
e_upload.php
TODO: Add example.
e_url.php
This addon provides a simple way to add mod-rewrite redirects to the plugin's pages, without having to edit the .htaccess file. This addon is used to create Search-Engine-Friendly (SEF) URLs through the method.
Example:
TODO: add 'legacy' example and explanation
TODO: e_ROUTE -
e_user.php
This addon allows to:
add information about a specific user to the user's profile page
add and save fields to the user configuration page (/usersettings.php)
specify a routine that is run upon user deletion
Example:
Deprecated!
Use instead.
Allows a plugin to easily hook into system events and trigger their own methods/functions.
Allows a plugin to generate content for the 👉.
Allows a plugin to include code in the footer of every page of the site
Allows a plugin developer to add their plugin as a 👉 option.
Allows a plugin to create automated entries for the 👉.
Allows a plugin developer to add data to <head> of every page.
Deprecated!
Allowed plugin developers to add information to the plugin configuration page sidebar. This has now been integrated within the through the renderHelp() method.
Deprecated!
Use instead.
Allows a plugin to include a third-party library.
Deprecated!
Use instead.
Allows a plugin to hook into the 👉
Allows a plugin to use e107's mailout feature for bulk mailing.
Provide configuration options for each instance of the plugin's menus.
Deprecated!
Use instead.
Is loaded every time the core of e107 is included and allows a developer to modify or define code which should be loaded prior to the header or anything that is sent to the browser as output.
Adds a plugin to the section in e107's admin area.
Allows a plugin to hook into all pages at the end (after closing </html>)
Allows a plugin to hook into e107's
Allows a plugin developer to specify content that is displayed in printer-friendly format.
Adds a plugin to the RSS plugin, and generates RSS feeds.
Adds a plugin to the search which generates 'related' links in news items and pages.
Adds a plugin to the 👉.
Allows a plugin to make their shortcodes available to core templates and templates of other plugins.
Allows a plugin to automatically generate 👉 links
Deprecated!
Use instead.
Deprecated!
Use instead.
Allows a plugin to set categories for 👉
Provides a simple way to add mod-rewrite redirects to a plugin's page. Used to create search-engine-friendly URLs through the method.
Adds information about a specific user to the user's profile page, allows to add fields to the user settings page and allows to specify a routine that is run upon user deletion.
class plugindir_cron // plugin-folder name + '_cron'
{
function config() // Setup
{
$cron = array();
$cron[] = array(
'name' => "Name of my function", // Displayed in admin area. .
'function' => "myFunction", // Name of the function which is defined below.
'category' => 'mail', // Choose between: mail, user, content, notify, or backup
'description' => "Description of what my function does" // Displayed in admin area.
);
return $cron;
}
public function myFunction()
{
// Do something.
}
}
class plugindir_dashboard // plugin-folder name + '_dashboard'
{
private $title; // dynamic title.
function chart()
{
$config = array();
$config[] = array(
'text' => $this->activity(),
'caption' => $this->title,
);
return $config;
}
/**
* Non-functional example.
*/
function activity()
{
// do something
}
function status() // Status Panel in the admin area
{
$var[0]['icon'] = "<img src='".e_PLUGIN."plugindir/images/blank_16.png' alt='' />";
$var[0]['title'] = "My Title";
$var[0]['url'] = e_PLUGIN_ABS."plugindir/plugin.php";
$var[0]['total'] = 10;
return $var;
}
function latest() // Latest panel in the admin area.
{
$var[0]['icon'] = "<img src='".e_PLUGIN."plugindir/images/blank_16.png' alt='' />";
$var[0]['title'] = "My Title";
$var[0]['url'] = e_PLUGIN_ABS."plugindir/plugin.php";
$var[0]['total'] = 10;
return $var;
}
}
class plugindir_event // plugin-folder + '_event'
{
function config()
{
$event = array();
// Hook into a core event, in this case "login".
$event[] = array(
'name' => "login", // when this is triggered...
'function' => "myfunction", // ..run this function (see below).
);
// Hook into a custom plugin event (created by that plugin author)
$event[] = array(
'name' => "pluginfolder_customevent", // hook into a custom plugin event
'function' => "otherfunction", // ..run another function (see below).
);
return $event;
}
function myfunction($data) // the method to run.
{
// var_dump($data);
}
function otherfunction($data) // the method to run.
{
// var_dump($data);
}
}
if(deftrue('USER_AREA')) // prevents inclusion of JS/CSS/meta in the admin area.
{
e107::js('_blank', 'js/blank.js'); // loads e107_plugins/_blank/js/blank.js on every page.
e107::css('_blank', 'css/blank.css'); // loads e107_plugins/_blank/css/blank.css on every page
e107::meta('keywords', 'blank,words'); // sets meta keywords on every page.
}
class plugindir_menu // plugin-folder name + '_menu'
{
function __construct()
{
}
/**
* Configuration Fields.
* See Admin-UI field configurations (https://devguide.e107.org/plugin-development/admin-ui)
* @return array
*/
public function config($menu='')
{
$fields = array();
$fields['blankCaption'] = array('title' => "Caption", 'type' => 'text', 'multilan'=>true, 'writeParms'=>array('size'=>'xxlarge'));
$fields['blankCount'] = array('title' => "Enabled", 'type' => 'number');
$fields['blankCustom'] = array('title' => "Enabled", 'type' => 'method'); // see below.
return $fields;
}
}
// optional - for when using custom methods above.
class plugindir_menu_form extends e_form
{
function blankCustom($curVal)
{
$frm = e107::getForm();
$opts = array(1, 2, 3, 4);
$frm->select('blankCustom', $opts, $curVal);
}
}
class plugindir_notify extends notify // plugin-folder name + '_notify'
{
function config()
{
$config = array();
$config[] = array(
'name' => "New Trigger Name", // Displayed in admin area.
'function' => "plugindir_mytrigger",
'category' => ''
);
return $config;
}
function plugindir_mytrigger($data)
{
$message = print_a($data,true);
$this->send('plugindir_mytrigger', "My Subject", $message);
}
}
class plugindir_parse // plugin-folder name + '_parse'
{
/**
* Process a string before it is sent to the browser as html.
* @param string $text html/text to be processed.
* @param string $context Current context ie. OLDDEFAULT | BODY | TITLE | SUMMARY | DESCRIPTION | WYSIWYG etc.
* @return string
*/
function toHTML($text, $context = '')
{
$text = str_replace('****', '<hr>', $text);
return $text;
}
/**
* Process a string before it is saved to the database.
* @param string $text html/text to be processed.
* @param array $param nostrip, noencode etc.
* @return string
*/
function toDB($text, $param = array())
{
$text = str_replace('<hr>', '****', $text);
return $text;
}
}
class plugindir_print // plugin-folder + '_print'
{
public function render($parm)
{
$text = "Hello {$parm}!";
return $text;
}
}
class plugindir_url // plugin-folder name + '_url'
{
function config()
{
$config = array();
$config['index'] = array(
'regex' => '^_blank/?$', // matched against url, and if true, redirected to 'redirect' below.
'sef' => '_blank', // used by e107::url(); to create a url from the db table.
'redirect' => '{e_PLUGIN}_blank/blank.php', // file-path of what to load when the regex returns true.
);
$config['other'] = array(
'alias' => '_blank', // the below {alias} is substituted with this value. Default alias '_blank', w which can be customized within the admin area.
'regex' => '^{alias}/other/?$', // matched against url, and if true, redirected to 'redirect' below.
'sef' => '{alias}/other/', // used by e107::url(); to create a url from the db table.
'redirect' => '{e_PLUGIN}_blank/_blank.php?other=1', // file-path of what to load when the regex returns true.
);
return $config;
}
}
class plugindir_user // plugin-folder + '_user'
{
/**
* Display information on the user profile page
*/
function profile($udata)
{
$var = array(
0 => array(
'label' => "Label",
'text' => "Some text to display",
'url' => e_PLUGIN_ABS."_blank/blank.php")
);
return $var;
}
/**
* This allows to show field on the usersettings.php page
* The same field format as admin-ui, with the addition of 'fieldType', 'read', 'write', 'appliable' and 'required' as used in extended fields table.
*
* @return array
*/
function settings()
{
$fields = array();
$fields['field1'] = array(
'title' => "Field 1",
'fieldType' => 'varchar(30)',
'read' => e_UC_ADMIN,
'write' => e_UC_MEMBER,
'type' => 'text',
'writeParms' => array('size' => 'xxlarge')
);
$fields['field2'] = array(
'title' => "Field 2",
'fieldType' => 'int(2)',
'type' => 'number',
'data' => 'int'
);
$fields['field3'] = array(
'title' => "Field 3",
'fieldType' => 'int(1)',
'type' => 'method', // see method below.
'data' => 'str',
'required' => true
);
return $fields;
}
/**
* This routine is run upon user deletion
* Experimental and subject to change without notice.
* @return mixed
*/
function delete()
{
$config['user'] = array(
'user_id' => '[primary]',
'user_name' => '[unique]',
'user_loginname' => '[unique]',
'user_email' => '[unique]',
'user_ip' => '',
// etc.
'WHERE' => 'user_id = '.USERID,
'MODE' => 'update'
);
$config['user_extended'] = array(
'WHERE' => 'user_extended_id = '.USERID,
'MODE' => 'delete'
);
return $config;
}
}
// (plugin-folder)_user_form - only required when using custom methods.
class plugindir_user_form extends e_form
{
// user_plugin_(plugin-folder)_(fieldname)
public function user_plugin_plugindir_field3($curVal, $mode, $att = array())
{
$opts = array(1, 2, 3, 4);
return $this->select('user_plugin_plugindir_field3', $opts, $curVal);
}
}