Only this pageAll pages
Powered by GitBook
1 of 51

Developer Guide

Loading...

Getting Started

Loading...

Loading...

Loading...

Loading...

Classes and methods

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Plugin development

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Theme development

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Templates, shortcodes & constants

Loading...

Loading...

Loading...

Loading...

Loading...

How-to's / FAQs

Loading...

Welcome

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.

Hello world example

To create a simple test script, create a new file called helloworld.php in your root folder with the following PHP code:

<?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; 

Then point your browser to www.yoursite.com/helloworld.phpand you're ready!

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.

Alerts

Please note: This page is under construction and has not been finished yet.

Introduction

Use the following to retrieve the alerts class object.

Alerts methods

addSuccess()

addError()

addWarning()

addInfo()

addDebug()

Messages assigned here will only be displayed when is active.

render()

None of the above methods will output anything, until you use this method to render them.

Redirection

Please note: This page is under construction and has not been finished yet.

  • You can redirect to a URL using the following static method:

Plugins

Please note: This page is under construction and has not been finished yet.

Introduction

Route

Please note: This page is under construction and has not been finished yet.

User Data

Please note: This page is under construction and has not been finished yet.

Returns an array of user data for a specific user. Input can be either a specific ID ($user_id) or use USERID for the currently logged in user.

Language

Please note: This page is under construction and has not been finished yet.

Introduction

Use the following to retrieve the language class object

$mes = e107::getMessage();

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 not normally 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.

e107_web

No

Contains core js and css packages.

https://github.com/e107inc/e107/issues/3912

Plugin shortcodes

myplugin_shortcodes.php

Introduction

Please note: This page is under construction and has not been finished yet.

Shortcodes

Please note: This page is under construction and has not been finished yet.

Theme shortcodes

Plugin shortcodes

How to...

Please note: This page is under construction and has not been finished yet.

debug mode
todo: add example output
e107::user($user_id);

$userData = e107::user(USERID); // Example - currently logged in user. 
$userData = e107::user(5); // Example  User ID #5.
Language methods

bcDefs()

$lng = e107::getLanguage()
To redirect to the homepage, simply leave the URL blank.
  • To redirect to the Admin Area, use the value 'admin'.

$url = "https://www.yourwebsite.com".
e107::redirect($url);
e107::redirect();
e107::redirect('admin');
$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();
Plugin methods

load()

Load specified plugin data, can be used in conjunction with other methods.

Parameter

Type

Description

Mandatory?

plugindir

string

Plugin name.

Could also be

Yes

Render

Please note: This page is under construction and has not been finished yet.

Introduction

Use the following to retrieve the render class object.

$ns = e107::getRender();

Render methods

tablerender()

Send HTML to the browser for output.

Logging

Please note: This page is under construction and has not been finished yet.

Introduction

You can log events to the admin System Logs by using the built in log class. Use the following to retrieve the alerts class object.

Logging methods

add()

Logging types

Preferences

Please note: This page is under construction and has not been finished yet.

Introduction

Use the following to retrieve the render class object.

$pref = e107::getPref();

Retrieving preferences

Developers may retrieve admin preferences for their theme or plugin, or a core preference using the following method:

Example: Load a stored value that was saved in the preferences admin area of the 'faqs' plugin

Or load a single preference value.

Type
Value (optional)

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

Folder structure

Example: blank plugin

  • images

    • sizes?

  • languages

Required files

  • plugin.xml

Optional files

  • admin_config.php

  • *_setup.php

  • *_sql.php

  • e_*.php addons

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

Meta

Please note: This page is under construction and has not been finished yet.

Include meta tags in the html header.

e107::meta($name, $content, $extended);

Parameter

Type

Description

name

Examples

TODO: add more examples

Database structure

Please note: This page is under construction and has not been finished yet.

Introduction

CSS

Please note: This page is under construction and has not been finished yet.

Introduction

...

Layout & templates

Please note: This page is under construction and has not been finished yet

Introduction

Theme Shortcodes

Please note: This page is under construction and has not been finished yet.

Introduction

......

Introduction

Please note: This page is under construction and has not been finished yet.

TODO:

$plg = e107::getPlug();
$plg->load($plugdir)
theme.php

Adding $CUSTOMPAGES to theme.php in e107 v2.x is deprecated and should be avoided!

theme.html

Overview of folder structure with files

  • Note on upgrading v1 to v2 themes (legacy) - link to upgrading

  • Note on styling (bootstrap)

  • English
    • ...

  • templates

  • addon files

  • *_shortcodes.php

  • ADMIN-UI
    addons
    Bootstrap documentation
    bootsnipp.com
    e_CURRENT_PLUGIN

    Unique name for what is being rendered. eg contact-menu Used in themes and plugins.

    Default: default

    No

    return

    boolean

    When set to true the content is returned instead of being echoed

    Default: false

    No

    Parameter

    Type

    Description

    Mandatory

    caption

    string

    Text for header/caption

    Yes

    text

    string

    Actual text/content

    Yes

    mode

    string

    Parameter

    Description

    name

    Title or name for the log event.

    details

    Details for the log event - can be either a string of text or an array.

    type

    The type of event. (see table below)

    code

    Custom reference code for your type of event. It should be short, ALL CAPITALS and not contain spaces.

    Type

    Description

    E_LOG_INFORMATIVE

    Informational event

    E_LOG_NOTICE

    Notice event

    E_LOG_WARNING

    Warning event

    E_LOG_FATAL

    Fatal event

    e107::pref(type, value);

    core

    all core preference values.

    theme

    preferences of the currently selected front-end theme.

    (any plugin folder name)

    preferences of a particular plugin

    ...

    ..

    content

    ...

    ...

    extended

    ...

    ...

    e107::meta('keywords','some words'); 
    e107::meta('apple-mobile-web-app-capable','yes'); 
    Basic CSS methods

    Including css in your plugin or theme may be achieved by using the following function:

    Type
    Value
    Description

    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

    Examples

    TODO: add examples

    Common theme shortcodes

    Please refer the the Theme shortcodes 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 theme_shortcodes.php.

    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".

    $ns->tablerender($caption, $text, $mode, $return);
    $log = e107::getLog();
    $log = e107::getLog();
    $log->add(name, details, type, code);
    
    //Example: 
    $log->add('My Event Name', $myDetailedData, E_LOG_INFORMATIVE, 'MYCODE');
    $faqPrefs = e107::pref('faqs'); // returns an array.
    $FaqPerPage = e107::pref('faqs', 'faqs_per_page');
    e107::css($type, $value);
    class theme_shortcodes extends e_shortcode
    {
    	
        function sc_my_shortcode()
        {
            return "Something";
        }
    
        function sc_my_other_shortcode()
        {
            return "Something else";
        }
    
    }
    Best practices
    • Do not modify the core database structure

    👍 Use your own tables (for example by creating a plugin) 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 defined in the database tables 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:

    1. Recommended: It is strongly recommend to make use of the database methods. Using these methods, the database table prefix is processed automatically.

    2. By using the # sign, one can automatically refer to the database prefix. This is generally used when using the e107::getDB()->gen() method, to manually construct an SQL query.

    3. In rare cases, you may reference the MPREFIX constant. Its use is deprecated and not encouraged.

    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

    admin_log

    audit_log

    banlist

    comments

    core

    Introduction

    Please note: This page is under construction and has not been finished yet.

    Overview

    The table below provides a quick overview of all classes that are used in e107 and are commonly used by developers.

    Class
    Description

    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?

    Upgrading legacy themes

    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 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,

    • 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 UPPERCASE in all occurrences in your file. ($register[]

    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:

    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 Plugin Builder, 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

    1. Create an empty plugin folder in e107_plugins (eg. "myplugin")

    2. Create a new text file with the *_sql.php extension. (eg. "myplugin_sql.php")

    3. 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!

    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.

    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:

    $cache = e107::getCache();

    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!

    links

    mail_recipients

    mail_content

    menus

    news

    news_category

    online

    page

    page_chapters

    plugin

    rate

    submitnews

    tmp

    upload

    user

    userclass_classes

    user_extended

    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 Manager > 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.

  • plugin_sql.php
    Admin-UI
    plugin.xml

    'nq_news_latest_menu_'.md5(serialize($parm).USERCLASS_LIST.e_LANGUAGE);

    'nq_news_categories_menu_'.md5(serialize($parm).USERCLASS_LIST.e_LANGUAGE);

    'nq_news_months_menu_'.md5(serialize($parm).USERCLASS_LIST.e_LANGUAGE);

    'news.php_default_'

    'news.php_'.e_QUERY

    comment.php?{$table}.{$id}

    nq_chatbox

    nomd5_linkwords

    nomd5_user_ranks

    'menus_'.USERCLASS_LIST.'_'.md5(e_LANGUAGE.$menu_layout_field)

    online_menu_totals

    wmessage

    news

    'newsarchive'

    _caption,_title,_diz,_rows

    "nq_othernews"

    news_php_extend_'.$id.'_'

    XURL_YOUTUBE.
  • Remove any reference to $CUSTOMPAGES and place them inside theme.xml in the layouts section.

  • and everywhere else in
    )
    e107::css()
    e107::js()
    theme.php
    theme_shortcodes.php
    Theme Shortcodes
    theme.php
    <layout name='custom' title='Custom Pages'>
    	<custompages>FRONTPAGE</custompages>
    	<custompages>/forum/</custompages>
    </layout>

    Database

    All methods related to interaction with a database

    Forms

    Parser

    .

    Render

    Preferences

    Javascript

    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+]

    Parameter
    Type
    Description
    Mandatory?

    plugin

    string

    Folder name of the plugin. (will use data from )

    Yes

    key

    string

    Unique key

    Yes

    row

    array

    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: http://sitename.com/forum/my-sef-forum-name/2-my-forum-topic

    Example 2: Using optional parameters

    TODO: Add examples using the options parameter

    Date

    Please note: This page is under construction and has not been finished yet.

    Introduction

    Date methods

    computeLapse()

    Calculate difference between two dates for display in terms of years/months/weeks....

    Parameter
    Type
    Description
    Mandatory?

    convert_date()

    Convert datestamp to human readable date. System time offset is considered.

    Parameter
    Type
    Description
    Mandatory?

    The configuration of the mask formats are specified in 👉 Admin Area > Preferences > .

    terms()

    Return an array of language terms representing months

    Parameter
    Type
    Description
    Mandatory?

    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:

    Templates

    Please note: This page is under construction and has not been finished yet.

    Introduction

    • 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.

    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.

    e107::url($plugin, $key, $row, $options);
    // these values are usually loaded from the database. 
    $data = array(
    	'forum_sef'		=>	'my-sef-forum-name', 
    	'thread_id'		=>  2, 
    	'thread_sef'	=>	'my-forum-topic'
    ); 
    
    $url = e107::url('forum','topic', $data);
    $config['topic'] = array(
    	'regex'    => '^forum/(.*)/(d*)-([w-]*)/???(.*)',
    	'sef'      => 'forum/{forum_sef}/{thread_id}-{thread_sef}/',
    	'redirect' => '/e107_plugins/forum/forum_viewtopic.php?id=$2'
     );
    $gen = e107::getDate();

    [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

    CSS
    User Data
    Meta
    Events
    Alerts
    Logging
    Redirection
    URLs
    Cache

    Array of variable data such as id, title etc. eg. user_id, user_name

    No

    options

    array

    An associative array of additional options, with the following elements:

    • mode: abs | full (returning the absolute path or full URL)

    • query: an array of query key/value-pairs (without any URL-encoding) to append to the URL.

    • fragment: a fragment identifier (named anchor) to append to the URL. Do not include the leading '#' character.

    (optional)

    No

    e_url.php

    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 👉 plugin.xml, files such asxxxx_menu.phpor 👉 addons.

    lanVars()
    variables
    substitution
    substitution
    examples
    e107_theme/YOURTHEME/
    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);
    e107::lan('faqs');
    e107::lan('faqs', true);
    e107::lan('faqs', false, true);
    e107::lan('faqs', true, true);
    e107_plugins/faqs/languages/English_front.php
    e107_plugins/faqs/languages/English_admin.php
    e107_plugins/faqs/languages/English/English_front.php
    e107_plugins/faqs/languages/English/English_admin.php
    <?php
    
    $MYPLUGIN_TEMPLATE['start'] = "<ul>";
    $MYPLUGIN_TEMPLATE['item'] = "<li>{MYPLUGIN_ITEM}</li>";
    $MYPLUGIN_TEMPLATE['end'] = "</ul>";
    
    ?>
    <?php
    
    $MYPLUGIN_TEMPLATE['list']['start'] = "<ul>";
    $MYPLUGIN_TEMPLATE['list']['item'] = "<li>{MYPLUGIN_ITEM}</li>";
    $MYPLUGIN_TEMPLATE['list']['end'] = "</ul>";
    
    $MYPLUGIN_TEMPLATE['form']['start'] = "<form>";
    $MYPLUGIN_TEMPLATE['form']['body'] = "<div>{MYPLUGIN_FORMINPUT}</divi>";
    $MYPLUGIN_TEMPLATE['form']['end'] = "</form>";
    
    ?>
    $template   = e107::getTemplate('myplugin'); // loads e107_plugins/myplugin/templates/myplugin_template.php
    $text = e107::getParser()->parseTemplate($template['start'], true, $scObj);
    
    // or
    
    $text = e107::getParser()->parseTemplate($template['form']['start'], true, $scObj);
    

    if true return value is an array. Otherwise return value is a string

    Default: false

    No

    show_secs

    boolean

    Default: true

    No

    format

    string

    Format of the human readable date. Options:

    • long

    • short (omits the year)

    Default: long

    No

    older_date

    integer

    UNIX timestamp

    Yes

    newer_date

    integer

    UNIX timestamp

    Default: current time

    No

    mode

    datestamp

    integer

    UNIX timestamp

    Yes

    mask

    string

    Format of the human readable date. Options:

    • long

    • short

    • forum

    • relative

    • (any 👉valid string)

    Default: long

    No

    type

    string

    Options:

    • month (August)

    • month-short (Aug)

    • day (Tuesday)

    • day-short (Tue)

    • day-shortest (Tu)

    Default: month

    Yes

    Date Display options

    boolean

    $gen->computeLapse($older_date, $newer_date = FALSE, $mode = FALSE, $show_secs = TRUE, $format = 'long') 
    $gen->convert_date($datestamp, $mask = '')
    $gen->terms($type='month')
    strftime()

    Javascript

    Please note: This page is under construction and has not been finished yet.

    Introduction

    ....

    Basic Javascript methods

    Including Javascript in your plugin or theme may be achieved by using the following function:

    Parameter
    Value
    Description
    Mandatory?

    type & data

    Type
    Data
    Description

    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".

    Specifies dependencies or other parameters

    No

    zone

    Specifies the zone in which the javascript is loaded

    No

    pre

    No

    post

    No

    path to js file, relative to the current theme's folder

    Include a theme js file

    (any plugin folder name)

    path to js file, relative to the plugin's folder

    Include a plugin js file

    array

    Adds settings to e107's global storage of JavaScript settings.

    type

    See type & data

    Yes

    data

    See type & data

    Yes

    parm

    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

    jquery | array

    theme

    Upgrading legacy plugins

    Introduction

    Back in September 2015, e107 v2.0.0 was officially released. 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 👉 for more information on the minimal and recommended requirements for an e107 installation.

    Minimum and recommended changes

    Minimum Changes:

    • Include a file

    Recommended Changes:

    • Include a file

    • Use e107's class for all form elements.

    • Use 👉 in your templates and/or HTML markup

    Classes & methods

    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

    TODO: Provide examples of legacy methods

    Frontend

    HTML & CSS

    e107 v2.x follows the for . Some examples:

    • <input class='button' should become <input class='btn button'

    • <table class='fborder' should become <table class='table fborder'

    • <table>

    Templates

    👍 TIP: Read more about

    Loading Templates

    e107 v2.x uses a new template loading system.

    Plugin templates should be stored in /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:

    ..and then you can parse it the same way:

    👍 TIP: Read more about the

    Declaring the HTML Template

    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' {---}.

    👍 TIP: Read more about

    Global Shortcodes

    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:

    Admin Area

    In e107 v2.x, the Admin Area uses a special admin "handler", the .

    In the Plugin Manager you will find something called "". It allows you to select your e107 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 meta-file, which is used during of your plugin.

    👍 It is strongly recommended for plugin developers to upgrade their Admin Area using the .

    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 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:

    e107::js($type, $data, $parm = null, $zone = null, $pre = '', $post = '')
    e107::js('faqs','js/faqs.js', 'jquery')
    e107::js("theme", "js/scripts.js", 'jquery');  // no 'zone' value, loaded in the footer by default. 
    e107::js("theme", "js/scripts.js", 'jquery', 2); // including a 'zone' value loads it in the header 
    var e107 = e107 || {'settings': {}, 'behaviors': {}};
    
    (function ($)
    {
      e107.behaviors.myBehavior = {
        attach: function (context, settings)
        {
    
        },
        detach: function (context, settings, trigger)
        {
    
        }
      };
    })(jQuery);
    (function ($) {
      // All your code here.
    })(jQuery);
    var e107 = e107 || {'settings': {}, 'behaviors': {}};
    
    (function ($)
    {
    
      e107.behaviors.myBehavior = {
        attach: function (context, settings)
        {
          $(context).find(".some-element").once('my-behavior').each(function ()
          {
            // All your code here.
          });
        }
      };
    
    })(jQuery);
    e107.behaviors.myBehavior = {
      attach: function(context, settings) {
        $('#example', context).html(settings.myvar);
      }
    };
    settings
    Upgrade e107 addons (e_xxxx.php files) to v2.x standards
  • Upgrade language-files to new standards

  • which use the class
    'fcaption'
    on
    <td>
    should change the
    <td>
    to
    <th>
    .
  • Using the forumheader3 class in the Admin Area is obsolete and can be removed.

  • requirements page
    plugin.xml
    plugin.xml
    Forms
    Bootstrap HTML/CSS standards
    classes & methods
    Introduction
    bootstrap standard
    CSS
    templates & shortcodes
    e107_plugins
    parsing methods
    shortcodes
    Core Shortcodes
    Shortcodes
    Admin User Interface (Admin-UI)
    Plugin Builder
    *_sql
    plugin.xml
    installation
    Plugin Builder
    Plugin Builder
    core
    // e107 v1.x and older
    require_once(e_PLUGIN."myplugin/templates/myplugin_template.php"); // v1.x
    
    // from e107 v2.x onwards
    $MYPLUGIN_TEMPLATE = e107::getTemplate('myplugin');
    $text = $tp->parseTemplate($MYPLUGIN_TEMPLATE['start'], false, $my_shortcodes);
    $MYPLUGIN_TEMPLATE['start'] = "<div>";
    $MYPLUGIN_TEMPLATE['end'] = "</div>";
    // 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>";
    $CONTACT_WRAPPER['form']['CONTACT_PERSON'] = "<small>".LANCONTACT_14."</small><div>{---}</div>";
    $oldPluginPrefs = array(
        'myplugin_caption' => 'caption', // old-pref-name => new-pref-name 
        'myplugin_display' => 'display',
        'myplugin_maxage'  => 'maxage',
    );
    
    if($newPrefs = e107::getConfig()->migrateData($oldPluginPrefs,true)) // returns new array with values and deletes core pref. 
    {
        $result = e107::getPlugConfig('myplugin')->setPref($newPrefs)->save(false,true,false); // save new prefs to 'myplugin'. 
    }

    Database

    Please note: This page is under construction and has not been finished yet.

    Introduction

    Use the following to retrieve the database class object

    Basic database methods

    select()

    Selecting data from a database table

    Parameter
    Type
    Description
    Mandatory?

    Example #1: Simple select

    Example #2: Using arguments

    Example #3: Using arguments with noWhere option

    Example #4: BIND support

    fetch()

    Selecting, looping through and displaying selected data with the fetch() method:

    insert()

    Inserting data into a database table:

    update()

    Updating information in a database:

    retrieve()

    Combined and method.

    Parameter
    Type
    Description

    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

    count()

    database()

    Parameter
    Type
    Description

    getLastErrorNumber()

    getLastErrorText()

    Forms

    Please note: This page is under construction and has not been finished yet.

    Introduction

    Use the following to retrieve the form class object

    $sql = e107::getDb();

    ....

    noWhere

    boolean

    debug

    boolean

    log type

    log_remark

    string

    If set to true, fetch all (multi mode)

    Default: false

    indexField

    boolean

    Field name to be used for indexing when in multi mode

    Default: null

    debug

    boolean

    ....

    Default: false

    boolean

    force a new link connection if set to true Default: false

    boolean

    force a new link connection if set to true Default: false

    table

    string

    Name of the database table

    Yes

    fields

    string

    Comma separated list of fields or "*" or a single field name (get one);

    arg

    table

    string

    Name of the database table to retrieve data from.

    If empty, enters fetch only mode

    fields

    string

    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.

    mySQLserver

    string

    IP or hostname of the SQL server

    mySQLuser

    string

    SQL username

    mySQLpassword

    string

    SQL password

    database

    string

    Database name

    prefix

    string

    Prefix of the database tables (e.g. "e107_"). Defaults to MPREFIX.

    multiple

    boolean

    Set to true to maintain connection to a secondary database

    select()
    fetch()

    string|array

    multi

    newLink

    newLink

    $sql->select($table, $fields = '*', $arg = '', $noWhere = false, $debug = false, $log_type = '', $log_remark = '')
    $sql->select('tablename', 'field1, field2', 'field_id = 1');
    $sql->select("comments", "*", "comment_item_id = '$id' AND comment_type = '1' ORDER BY comment_datestamp");
    $sql->select("chatbox", "*", "ORDER BY cb_datestamp DESC LIMIT $from, ".$view, true);
    $sql->select('user', 'user_id, user_name', 'user_id=:id OR user_name=:name ORDER BY user_name', array('id' => 999, 'name'=>'e107'))
    $sql->select('tablename', 'field1, field2', 'field_id = 1');
    
    while($row = $sql->fetch())
    {
        echo $row['field1'];
    }
    $insert = array(
       'data'  => array('field1' => 'value1', 'field2' => 'value2'),
       'WHERE' => 'field_id = 1'
    );
    
    $sql->insert('tablename', $insert);
    $update = array(
       'data'  => array('field1' => 'value1', 'field2' => 'value2'),
       'WHERE' => 'id = 1'
    );
    
    $sql->update('tablename', $update);
    $sql->retrieve($table = null, $fields = null, $where = null, $multi = false, $indexField = null, $debug = false)
    $string = $sql->retrieve('user', 'user_email', 'user_id = 1');
    if($allRows = $sql->retrieve('user', 'user_name, user_email', '', true))
    {
    	foreach($allRows as $row)
    	{
    		echo $row["user_name"]." - ".$row["user_email"]."<br/>";  
    	}
    }
    $array = $sql->retrieve('user', 'user_id, user_email, user_name', 'ORDER BY user_email LIMIT 0,20', true, 'user_id');
    if($sql->select('user', 'user_id, user_email, user_name', 'ORDER BY user_email LIMIT 0,20', true))
    {
         $array = $sql->retrieve(null, null, null,  true, 'user_id');
    }
    $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 ");
    $sql->connect($mySQLserver, $mySQLuser, $mySQLpassword, $newLink = false)
    $sql->database($database, $prefix = MPREFIX, $multiple=false)
    Forms methods

    open()

    Returns a form opening tag.

    Parameter

    Type

    Description

    Mandatory

    name

    string

    Name of the form

    Yes

    mode

    string

    post | get 'post' by default

    No

    target

    close()

    Returns a form closing tag

    text()

    Returns a text field form element

    Parameter

    Type

    Description

    Mandatory

    name

    string

    Name of the text field

    value

    string

    Value of the text field

    maxlength

    textarea()

    bbarea()

    Parameter

    Type

    Description

    Mandatory

    name

    string

    Name of the field

    Yes

    value

    string

    Contents of the field

    Yes

    template

    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.

    Parameter

    Type

    Description

    Mandatory?

    name

    string

    The name of the field

    Yes

    datestamp

    integer|boolean

    UNIX timestamp. Set the default value of the field.

    Default: false

    No

    options

    TODO: Clarify possible options and add more examples

    Examples:

    Parser

    Please note: This page is under construction and has not been finished yet.

    Introduction

    Use the following to retrieve the parser class object.

    $frm = e107::getForm();
    $frm->open('myform'); 
    $frm->open('myform', 'get', 'myscript.php', array('autocomplete' => 'on', 'class' => 'formclass'));
    $frm->close();
    $frm->text('my-field', 'current_value', 100, array('size' => 'large')); // returns <input class="tbox input-large" id="my-field" maxlength="100" name="my-field" type="text" value="current_value"></input>
    $frm->textarea($name, $value, $rows, $cols, $options, $counter);
    $frm->bbarea($name, $value, $template, $mediaCat, $size, $options);
    $frm->select($name,$option_array,$selected,$options,$defaultBlank);
    $frm->checkbox($name,$value,$checked,$options);
    $frm->hidden($name,$value,$options);
    $frm->button($name,$value,$action,$label,$options);
    $frm->carousel($name, $array, $options);
    $array = array(
          'slide1' => array('caption' => 'Slide 1', 'text' => 'first slide content' ),
          'slide2' => array('caption' => 'Slide 2', 'text' => 'second slide content' ),
          'slide3' => array('caption' => 'Slide 3', 'text' => 'third slide content' )
      );
    
    echo $frm->carousel('my-carousel', $array);
    $frm->tabs($array,$options);
    $array = array(
       'home'  => array('caption' => 'Home', 'text' => 'some tab content' ),
       'other' => array('caption' => 'Other', 'text' => 'second tab content' )
    );
    
    echo $frm->tabs($array);
    
    echo $frm->tabs($array, array('active' => 'other')); // make 'other' the initial active tab. 
    $frm->datepicker($name, $datestamp = false, $options = null)
    $frm->datepicker('my_field',time(),'mode=date');
    $frm->datepicker('my_field',time(),'mode=datetime&inline=1');
    $frm->datepicker('my_field',time(),'mode=date&format=yyyy-mm-dd');
    $frm->datepicker('my_field',time(),'mode=datetime&format=MM, dd, yyyy hh:ii');
    $frm->datepicker('my_field',time(),'mode=datetime&return=string');

    string

    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

    integer

    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

    string

    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

    • Name of the editor (e.g. tinymce4 or simplemde) to use, in case wysiwyg is generally enabled and the supplied editor is installed.

    No

    array|string

    Available options (see examples below):

    • mode - 'date' or 'datetime'

    • format -

    • timezone

    • size

    • required (true/false)

    • firstDay

    • disabled

    • placeholder

    Default: null

    No

    Parser methods

    toHTML()

    Parse HTML in various ways. eg. replace constants, convert bbcode etc.

    Parameter
    Type
    Description
    Mandatory?

    text

    string

    text or HTML to be parsed

    Yes

    bparseBB

    boolean

    set to true to parse BBcodes into HTML

    No

    modifiers

    Example

    toDate()

    Convert a UNIX timestamp into a readable format.

    Parameter
    Type
    Description
    Mandatory?

    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

    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

    template

    string

    ...

    user core shortcodes

    boolean

    ...

    custom shortcodes

    object

    ...

    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 Font Awesome 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 substitution of variables, in language files 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

    Core Shortcodes

    Please note: This page is under construction and has not been finished yet.

    Theme shortcodes

    $tp = e107::getParser();
    $tp->toHTML($text, $parseBB = false, $modifiers = '', $postID = '', $wrap = false)
    $tp->toHtml("<strong class="bbcode bold bbcode-b bbcode-b-page">Bold print</strong>", true, 'BODY'); 
    $tp->toDate($datestamp = null, $format = 'short')
    $tp->toText(string);
    $tp->createConstants(string);
    $tp->replaceConstants(string);
    $tp->parseTemplate($template, true, $custom_shortcodes);
    $url   = "{e_MEDIA_IMAGE}2012-04/someimage.jpg";
    $image = $tp->thumbUrl($url);
    
    echo "<img src='".$image."' />
    $tp->setThumbSize($width, $height, $crop);
    $tp->toGlyph("fa-anchor");
    $tp->toGlyph("fa-anchor", array('size'=>'2x'));
    $iconPath = "{e_MEDIA}myicon.png";
    $tp->toIcon($iconPath);
    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
    			)
    	);

    string

    Choose from pre-defined Parser modifiers.

    No

    postID

    No

    wrap

    boolean

    Default: false

    No

    Shortcode

    Description

    {---}

    Renders the main content of the current page.

    {CMENU=xxxxxx}

    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

    {NAVIGATION=xxxxx}

    Page / Menu Shortcodes

    Shortcode

    Description

    Optional Parameters

    {CPAGEANCHOR}

    {CPAGETITLE}

    Title of the page

    {CPAGEBODY}

    Main text body of the page

    {CPAGEAUTHOR}

    News Shortcodes

    Shortcode

    Description

    Optional Parameters

    {NEWS_ID}

    Unique ID for the current news item (news_id)

    {NEWS_TITLE}

    News Title

    {NEWS_SUMMARY}

    News item summary

    {NEWS_DATE}

    Directory & path Shortcodes

    Shortcode

    Description

    Default value

    {e_MEDIA_FILE}

    {e_MEDIA_VIDEO}

    {e_MEDIA_IMAGE}

    
    				'{e_MEDIA_ICON}',
    				'{e_AVATAR}',
    				'{e_WEB_JS}',
    				'{e_WEB_CSS}',
    				'{e_WEB_IMAGE}',
    		//		'{e_WEB_PACK}',
    				"{e_IMAGE_ABS}",
    				"{e_THEME_ABS}",
    				"{e_IMAGE}",
    				"{e_PLUGIN}",
    				"{e_FILE}",
    				"{e_THEME}",
    				//,"{e_DOWNLOAD}"
    				"{e_HANDLER}",
    				"{e_MEDIA}",
    				"{e_WEB}",
    				"{THEME}",
    				"{THEME_ABS}",
    				"{e_ADMIN}",
    				"{e_BASE}",
    				"{e_CORE}",
    				"{e_SYSTEM}",

    Bootstrap-style navigation. Where xxxxx is one of: main, side, footer, alt, alt5, alt6 eg. {NAVIGATION=footer}

    {SETSTYLE=xxxxxx}

    A special shortcode which is used to dynamically change the value of $style as used inside tablerender() to the value of xxxxxx.

    {SETIMAGE: w=x}

    A special shortcode which is used to dynamically change the size of avatars and other images. x= numerical value. eg. {SETIMAGE: w=100&h=200&crop=1}

    {SITEDESCRIPTION}

    The description of the website as defined in the admin preferences.

    {SITEDISCLAIMER}

    The site disclaimer as defined in the admin preferences. Typically used in the footer of the site.

    {SITENAME}

    The name of the website as defined in the admin preferences.

    {WMESSAGE}

    Renders the welcome message as defined in admin-> Welcome Message.

    Author of the page

    {CPAGEDATE}

    Creation date of the page

    {CPAGEDATE=x} default: long. 'short' and 'relative'

    {CPAGEMETADIZ}

    Meta description of the page.

    {CPAGEBUTTON}

    {BOOK_ANCHOR}

    {BOOK_DESCRIPTION}

    {BOOK_ICON}

    {BOOK_ID}

    {BOOK_NAME}

    {BOOK_URL}

    {CHAPTER_ANCHOR}

    {CHAPTER_BREADCRUMB}

    {CHAPTER_BUTTON}

    {CHAPTER_DESCRIPTION}

    {CHAPTER_ICON}

    {CHAPTER_ID}

    {CHAPTER_NAME}

    {CHAPTER_URL}

    News Date

    {NEWS_BODY}

    News Body (main content)

    {NEWS_TAGS}

    New Keywords/Meta-Keywords

    {NEWS_URL}

    News URL (current URL)

    {NEWS_AUTHOR}

    Name of the Author of the news item

    {NEWS_AUTHOR_AVATAR}

    Avatar of the Author of the news item

    {NEWS_AUTHOR_SIGNATURE}

    Signature text of the Author of the news item. eg. a short bio about the user.

    {NEWS_AUTHOR_ITEMS_URL}

    Link to a News page listing all items by the same author.

    {NEWS_CATEGORY_NAME}

    News Category Name

    {NEWS_CATEGORY_DESCRIPTION}

    News Category Description

    {NEWS_CATEGORY_ICON}

    News Category Icon

    {NEWS_RELATED}

    Related news items based on keyword matches

    types: news | page limit: (integer) (default is 5)

    Events

    Please note: This page is under construction and has not been finished yet.

    Introduction

    Plugin developers can hook into various e107 core events and trigger functions of their own. Typically, an e_event.php file is used to store this information since it is loaded with every page.

    From e107 version 2.1.2 onwards you 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)

    Array of data of user who changed the settings

    User deletes a forum topic

    Array of data

    user_forum_topic_moved

    User has moved forum topic to a different forum

    Array of data

    user_forum_topic_split

    User has split the forum topic

    Array of data

    user_forum_post_created

    User creates a forum post/reply

    Array of data

    user_forum_post_updated

    User updates a forum post/reply

    Array of data

    user_forum_post_deleted

    User deletes a forum post/reply

    Array of data

    user_forum_post_report

    User has reported a forum post/reply

    Array of data

    Admin creates a news category

    Array of news data

    admin_news_category_update

    Admin updates a news category

    Array of news data

    admin_news_category_delete

    Admin deletes a news category

    Array of news data

    Admin activates an unverified user

    Array of user data

    admin_user_loginas

    Admin logs in as another user

    Array of user data

    admin_user_logoutas

    Admin logs out as another user

    Array of user data

    name

    The event you wish to hook into. (see tables below)

    Yes

    function

    Your function or class/method to trigger when this event occurs. string for function, or for classes use an array (class, method).

    Yes

    include

    include (optional) path: a file to include if required.

    No

    eventname

    The name of the event you wish to trigger (new event name). Format: plugindir_eventname (see example above).

    Yes

    data

    The data that you wish to send alongside the event

    No

    login

    User login/signin

    Array of user data

    logout

    User logout/signout

    Notice event

    user_file_upload

    User uploads a file

    Array of file information

    user_page_item_viewed

    User has viewed a custom page

    Array of data

    user_news_item_viewed

    User viewed a news item

    Array of data

    user_news_submit

    User submitted a news item

    Array of data

    user_pm_sent

    User has sent a private message

    Array of data

    user_pm_read

    User has read a private message

    Array of data

    user_forum_topic_created

    User creates a forum topic

    Array of data

    user_forum_topic_created_probationary

    New user creates a forum topic

    Array of data

    user_forum_topic_updated

    User updates a forum topic

    Array of data

    user_chatbox_post_created

    User has posted a chatbox message

    Array of data (ip and message)

    admin_password_update

    Admin updates their password

    Array containing user_id and time of change.

    admin_comment_update

    Admin updates a comment

    Array of comment data

    admin_comment_delete

    Admin deletes a comment

    Array of comment data

    admin_download_create

    Admin creates a download item

    Array of download data

    admin_download_update

    Admin updates a download item

    Array of download data

    admin_download_delete

    Admin deletes a download item

    Array of download data

    admin_news_create

    Admin creates a news item

    Array of news data

    admin_news_update

    Admin updates a news item

    Array of news data

    admin_news_delete

    Admin deletes a news item

    Array of news data

    admin_page_create

    Admin creates a page/menu item

    Array of page data

    admin_page_update

    Admin updates a page/menu item

    Array of page data (new and old)

    admin_page_delete

    Admin deletes a page/menu item

    Array of page data

    admin_user_create

    Admin creates a new user

    Array of user data

    admin_user_update

    Admin modifies user data

    Array of user data (new and old)

    admin_user_delete

    Admin deletes a user

    Array of user data

    e_event.php
    e_module.php

    user_signup_submitted

    user_forum_topic_deleted

    admin_news_category_create

    admin_user_activate

    e107::getEvent()->register(name, function, include);
    e107::getEvent()->register('login', 'myFunction'); 
    
    function myFunction($data)
    {
       // do something    
    }
    e107::getEvent()->register('login', 'myFunction',  e_PLUGIN."myplugin/myFunctions.php");
    e107::getEvent()->register('login', array('myClass', 'myMethod'),  e_PLUGIN."myplugin/myClass.php");
    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

    Admin-UI (User Interface)

    Please note: This page is under construction and has not been finished yet.

    Introduction

    The Admin-UI (Admin User Interface) is .....

    TODO: explain what it is and what it does

    Advantages of the Admin-UI

    👍 The advantages of using the new 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.

    👍 TIP: The 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

    type

    Type
    Description

    data

    Value
    Description

    readParms (list mode)

    Key
    Value
    Field-type
    Comments

    writeParms (create/edit mode)

    Key
    Value
    Field-type
    Comments

    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.

    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.

  • string

    width of the column (List View)

    inline

    boolean | string

    Enable or disable inline editing.

    help

    string

    Popup helper text (tooltip)

    readParms

    array

    Parameters specific to the 'list' mode.

    writeParms

    array

    Parameters specific to the 'edit' and 'create' modes.

    radio buttons with enable/disable

    bbarea

    right text area (html)

    dropdown

    dropdown list (ie. <select></select> )

    userclass

    drop-down list of userclasses

    userclasses

    checkboxes for multiple userclasses

    datestamp

    date / time text box

    user

    user selection text box. (type 3 letters to find/search)

    hidden

    hidden field

    ip

    text field with ip decoding

    email

    text field for email addresses

    url

    text field for urls (becomes clickable in list mode)

    password

    password field (with optional generator)

    image

    Media-manager image selection tool for a single image

    images

    Media-manager image selection tool for multiple images

    file

    Media-manager file selection tool for a single file

    files

    Media-manager file selection tool for multiple files

    media

    Media-Manager selection tool for images, mp4, youtube and gylphs. (requires type=json)

    method

    custom method

    lanlist

    drop-down list of installed languages

    language

    drop-down list of all languages

    templates

    Dropdown list of templates (from a template file)

    null (without quotes)

    Ignore this field and do not save it's data

    false (without quotes)

    Hide this field but save it's data if a posted key value is found.

    Posted data from this field is not saved to the database

    number, text, tags, null

    Target for 'url' above.

    bbarea

    Sets the media-owner category to be used by the media-manager

    video

    0 or 1

    image

    Show video selector tab in media-manager

    path

    'plugin' or null

    image

    When set to 'plugin', images will be stored in the 'plugin' folder within e107_media

    glyphs

    0 or 1

    icon

    Show glyph selector tab in media-manager

    size

    large, xlarge, xxlarge, block-level

    text, url, email, textarea, dropdown

    Set the size (width) of input field

    optArray

    (array of key=>value pairs)

    dropdown, checkboxes

    Set the keys/values to be used in the dropdown or checkboxes.

    placeholder

    (string)

    text, url, email, textarea

    Placeholder text

    pattern

    (regexp)

    text, url, email

    Regular expression validation

    type

    date or datetime

    datestamp

    Choose between date or date and time

    readonly

    0 or 1

    datestamp

    Make element read-only

    auto

    0 or 1

    datestamp

    Insert current date/time automatically

    label

    yesno

    boolean

    Change "Enabled" and "Disabled" to "Yes" and "No".

    inverse

    0 or 1

    boolean

    Invert the values of 0 and 1. ie. "Disabled" = 1 and "Enabled" = 0.

    enabled

    (string)

    boolean

    Alternate text to replace "Enabled"

    disabled

    (string)

    boolean

    Alternate text to replace "Disabled"

    classlist

    public, guest, nobody, member, admin, main, classes (comma separated)

    userclass

    Set which userclasses should be displayed.

    tdClassLeft

    (string)

    (all)

    Set the css class for the left-side table cell.

    tdClassRight

    (string)

    (all)

    Set the css class for the right-side table cell.

    trClass

    (string)

    (all)

    Set the css class for the table row.

    nolabel

    0 or 1

    (all)

    Hide the left table cell

    title

    string

    Field Title

    type

    string

    Type of Field

    data

    string

    Data Type

    text

    text box

    number

    text box (number)

    checkbox

    checkbox (0 or 1 is returned)

    icon

    icon (from media manager)

    textarea

    text area (text only)

    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

    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

    pre

    (html)

    (all)

    Render html just before the field

    post

    (html)

    (all)

    Render html just after the field

    media

    Admin-UI
    Plugin Builder
    Plugin Builder

    width

    boolean

    false (no quotes)

    (string) blank | dialog

    (string)

    <?php
    
    require_once("../../class2.php");
    if (!getperms("P"))
    {
    	e107::redirect('admin');
    	exit;
    }
    
    
    class plugin_blank_admin extends e_admin_dispatcher
    {
    
    	protected $menuTitle 	= 'blank Menu';
    	protected $modes 		= array(...);
    	protected $adminMenu 	= array(....);
    
    	// optional
    	protected $adminMenuAliases = array(...);
    }
     
    
    class plugin_blank_admin_ui extends e_admin_ui
    {
    	protected $pluginTitle 	= "...";
    	protected $pluginName 	= '_blank';
    	protected $table 		= "blank"; 
    	protected $listQry 		= "";
    	protected $listQry 		= "";
    	protected $listOrder	= 'blank_id DESC';
    	protected $listGroup	= 'somefield';  
    	protected $pid 			= "blank_id";
    
    	// optional
    	// protected $perPage 			= 20;
    	// protected $batchDelete 		= true;
    	// protected \$sortField		= 'somefield_order';
    	// protected \$sortParent      	= 'somefield_parent';
    	// protected \$treePrefix      	= 'somefield_title';
    	// protected $editQry 			= "SELECT * FROM #blank WHERE blank_id = {ID}";
    	
    
    	protected  $fields = array(...)
    
    
    	//required - default column user prefs
    	protected $fieldpref = array(...);
    	protected $prefs = array(...);
    
    	// optional
    	public function init()
    	{
    
    	}
    	
    	
    	public function customPage()
    	{
    
    	}
    
    	public function beforePrefsSave($new_data, $old_data)
    	{
    
    	}
    }
    
    class plugin_blank_admin_form_ui extends e_admin_form_ui
    {
    	
    	function blank_type($curVal, $mode) 
    	{
    		$frm = e107::getForm();
    		
    		$types = array('type_1'=>"Type 1", 'type_2' => 'Type 2');
    		
    		if($mode == 'read')
    		{
    			return vartrue($types[$curVal]).' (custom!)';
    		}
    
    		if($mode == 'batch') // Custom Batch List for blank_type
    		{
    			return $types;
    		}
    
    		if($mode == 'filter') // Custom Filter List for blank_type
    		{
    			return $types;
    		}
    
    		return $frm->select('blank_type', $types, $curVal);
    	}
    	
    }
    
    new plugin_blank_admin();
    require_once(e_ADMIN."auth.php");
    e107::getAdminUI()->runPage();
    
    require_once(e_ADMIN."footer.php");
    protected $fields = array(
    	
    	'myfield_id'  => array(
       		"title" 	=> "My Title", 
       		"type"		=> "text", 
       		"data"		=> "str", 
       		"width"		=> "auto", 
       		"inline"	=>	true
       	),
    
       // .....
    );
    protected $sortField  = 'field1';
    protected $sortParent = 'field2';
    protected $treePrefix = 'field3';
    protected $sortField  = 'download_category_order';
    protected $sortParent = 'download_category_parent';
    protected $treePrefix = 'download_category_name';

    Installation & configuration

    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

    • refer to example themes (bootstrap3)

    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

    • Corporate

    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 specific order:

    1. inside the root of the theme folder (e107_themes/yourtheme)

    2. 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 👉

    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

    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.

    [email protected]

    Yes

    url

    name

    Refers to the plugin folder name of the recommended plugin.

    featurebox

    Yes

    url

    For plugins that are included in e107 by default, use "core".

    For third-party plugins ....

    core

    Yes

    Attribute

    Description

    Example

    Mandatory?

    name

    Name of the library

    bootstrap.editable

    Yes

    version

    Version of the library. (semantic versioning)

    3

    No

    scope

    Attribute

    Description

    Example

    Mandatory?

    file

    css/modern-light.css

    Yes

    name

    Modern Light

    Yes

    description

    name

    Shortname of the layout

    (use underscores)

    jumbotron_home

    Yes

    title

    Descriptive title of the layout

    Home page carousel with fixed custom-menus

    Yes

    default

    conversion tool
    plugin.xml
    theme.php
    theme.php
    Find Themes
    theme.xml
    developers area on e107.org
    Theme Manager
    Site Theme
    Suggested Plugin
    https://www.e107.org/themes
    https://www.e107.org/themes
    custom pages
    menu presets
    Theme Manager
    Site Theme
    Layouts section
    frontpage
    Using the e_ROUTE
    theme.php
    theme_config.php
    Meta Tags

    The date when the theme was released (latest version). (yyyy-mm-dd)

    A link to the author's website. A link to it is displayed on the Admin Area > page.

    The area in which the library is included. Possible values:

    • front

    • admin

    • wysiwyg

    Can be multiple if separated by comma

    Indicates whether a layout is the default layout to be used. There can only be one default layout.

    Boolean - defaults to 'false'

    <?xml version="1.0" encoding="utf-8"?>
    <e107Theme name="Bootstrap 3" version="1.0" date="2013-12-25" compatibility="2.0">
    	<author name="e107 Inc" email="[email protected]" url="http://e107.org" />
    	<summary>Bootstrap3 e107 theme</summary>
    	<description>a simple bootstrap 3 template for the frontend</description>
    	<category>generic</category>
    	<plugins>
    		<plugin name='featurebox' url='core' />
    		<plugin name='gallery' url='core' />
            <plugin name='rss_menu' url='core' />
            <plugin name='tinymce4' url='core' />
    		<plugin name='social' url='core' />
    	</plugins>
    	<keywords>
    		<word>bootstrap</word>
    		<word>clean</word>
    	</keywords>
    	<screenshots>
    		<image>preview_frontend.png</image>
    	</screenshots>
    	<libraries>
    		<library name="bootstrap" version="3" scope="front,admin,wysiwyg"/>
    		<library name="fontawesome" version="5"  scope="front,admin,wysiwyg"/>
    		<library name="bootstrap.editable" scope="admin"/>
    	</libraries>
    	<stylesheets>
    		<css file="style.css" name="Default" scope="front" />
    		<css file="css/modern-light.css" name="Modern Light" description="A high-contrast light skin" thumbnail='images/admin_modern-light.webp' scope='admin' exclude='bootstrap'/>
    	</stylesheets>
    	<layouts>
    		<layout name='jumbotron_home' title='Jumbotron (home)' default='false'>
    			<custompages>FRONTPAGE</custompages>	
    		</layout>
    		<layout name='modern_business_home' title='Modern Business: Home page carousel with fixed custom-menus' />
    		<layout name='jumbotron_full' title='Jumbotron (full-width)'  >
          <custompages>forum</custompages>
    		</layout>
    		<layout name='jumbotron_sidebar_right' title='Jumbotron (sidebar-right)' default='true' >
    			<custompages>/news</custompages>
    			<menuPresets>
    				<area id='1'>
    					<menu name='search' />
    					<menu name='news_categories' />
    					<menu name='other_news' />
    					<menu name='other_news2' />
    					<menu name='blogcalendar' />
    				</area>
    			</menuPresets>	
    		</layout>
    	</layouts>
    	<themePrefs>
    		<pref name='branding'>sitename</pref>
    		<pref name='nav_alignment'>right</pref>
    		<pref name='usernav_placement'>top</pref>
    	</themePrefs>
    </e107Theme>
    <e107Theme name="" version="3.0" date="2012-01-07" compatibility="2.0">
    ... all content belongs here ...
    </e107Theme>
    <author name="e107 Inc" email="[email protected]" url="https//e107.org" />
    <summary>Bootstrap3 e107 theme</summary>
    <description>a simple bootstrap 3 template for the frontend</description>
    <category>generic</category>
    <plugins>
        ...
    </plugins>
    <plugins>
    		<plugin name='featurebox' url='core' />
    </plugins>
    <keywords>
    		...
    </keywords>
    	<keywords>
    		<word>bootstrap</word>
    	</keywords>
    	<screenshots>
    		...
    	</screenshots>
    	<screenshots>
    		<image>preview_frontend.png</image>
    	</screenshots>
    <libraries>
    		<library name="bootstrap" version="3" scope="front,admin,wysiwyg"/>
    		<library name="fontawesome" version="5"  scope="front,admin,wysiwyg"/>
    		<library name="bootstrap.editable" scope="admin"/>
    </libraries>
    <libraries>
    		<library name="fontawesome" version="5"  scope="front,admin,wysiwyg"/>
    </libraries>
    	<stylesheets>
    		...
    	</stylesheets>
    <css file="css/modern-light.css" name="Modern Light" description="A high-contrast light skin" thumbnail='images/admin_modern-light.webp' scope='admin' exclude='bootstrap'/>
    <layouts>
        ...
    </layouts>
    <layout name='modern_business_home' title='Modern Business: Home page carousel with fixed custom-menus' />
    <layouts>
    		<layout name='jumbotron_home' title='Jumbotron (home)' default='false'>
    			<custompages>FRONTPAGE</custompages>	
    		</layout>
    </layouts>
    class theme_mytheme implements e_theme_config
    {
        function process() // Save posted values from config() fields. 
        {
            $pref = e107::getConfig();
    		
            $theme_pref 					  = array();
            $theme_pref['example']	= $_POST['_blank_example'];
            $theme_pref['example2']	= intval($_POST['_blank_example2']);
    
            $pref->set('sitetheme_pref', $theme_pref);
            return $pref->dataHasChanged();
        }
    
        function config()
        {
            $tp = e107::getParser();
    		
            $var[0]['caption'] = "Sample configuration field";
            $var[0]['html']    = $tp->text('_blank_example', e107::getThemePref('example', 'default'));
    
            $var[1]['caption'] = "Sample configuration field";
            $var[1]['html']    = $tp->text('_blank_example2', e107::getThemePref('example2', 'default'));
    		
            return $var;
        }
    
        function help()
        {
            return "
                    <div class='well'>
                            Some information about my theme. 
                    </div>
            ";
        }
    }
    https://direct-path-to-purchase-page.com
    Theme Manager
    Theme Manager

    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.

  • languages (folder)

    Contains the language files

    English language files

    templates (folder)

    plugin.xml

    Contains all the meta data needed for the plugin to be installed and configured on a basic level.

    Yes

    <e107Plugin>

    Yes

    name

    Price

    Purchasing price of the plugin (in xx.xx format). Example: 25.00

    Currency

    Currency codes (ISO 4217) Example: EUR

    URL

    Direct path to the website page where the plugin can be purchased. When the user clicks to download your plugin, the URL will be displayed.

    ❗Note: do not add the URL to the generic homepage of your website, but only the URL to the specific page for that specific plugin.

    Find Plugins
    Plugin shortcodes
    Plugin shortcodes
    Check for Updates
    Admin-UI (User Interface) page.
    Admin-UI (User Interface)

    <?xml version="1.0" encoding="utf-8"?>
    <e107Plugin name="Newsfeeds" version="2.0" date="2012-08-01" compatibility="2.0" installRequired="true">
    	<author name="e107 Inc." url="http://e107.org" email="@" />
    	<description>This plugin's description.</description>
    	<category>content</category>
    	<adminLinks>
    		<link url='admin_config.php' description='Configure Newsfeeds' icon='images/icon_32.png' iconSmall='images/icon_16.png' >LAN_CONFIGURE</link>	
    	</adminLinks>
    	<siteLinks>
    		<link url="/e107_plugins/newsfeed/newsfeed.php" >Newsfeeds</link>
    	</siteLinks>	
    </e107Plugin>
    <?xml version="1.0" encoding="utf-8"?>
    <e107Plugin name="FAQs" version="1.1"  lan="LAN_PLUGIN_XXX_NAME" date="2012-08-01" compatibility="2.0" installRequired="true">
    	 <author name="e107 Inc" url="http://www.e107.org" email="@" />
    	<summary>Add frequently asked questions to your e107 website.</summary>
    	<description  lan="LAN_PLUGIN_XXX_DESCRIPTION">A simple plugin to add Frequently Asked Questions to your website.</description>
    	 <copyright>Copyright e107 Inc e107.org, Licensed under GPL</copyright>
    	<category>content</category>
    	<keywords>
    		<word>faq</word>
    		<word>question</word>
    		<word>answer</word>
    	</keywords>
    	<adminLinks>
    		<link url='admin_config.php' description='Configure FAQs' icon='images/icon_32.png' iconSmall='images/icon_16.png' primary='true'>LAN_CONFIGURE</link>		
    	</adminLinks>
    	<siteLinks>
    		<link url='/e107_plugins/faqs/faqs.php' description='FAQs' icon='images/icon_32.png' iconSmall='images/icon_16.png' function="faqCategories">LAN_PLUGIN_FAQS_NAME</link>		
    	</siteLinks>
    	<pluginPrefs>
    		<pref name="add_faq">255</pref>
    		<pref name="submit_question">255</pref>
    		<pref name="classic_look">0</pref>
    	</pluginPrefs>
    	<dependencies>
    		<plugin name='chatbox_menu' />
    		<plugin name='calendar_menu' min_version='3.70' />
    		<PHP name='core' min_version='5.2.5' />
    		<MySQL name='server' min_version='4.9' />
    		<extension name='curl' min_version='1.3' />
    		<extension name='mb_string' />
    	</dependencies>
    	<userClasses>
    		<class name="faq_moderator" description="FAQ moderator" />		
    	</userClasses>
    	<extendedFields>
    		<field name="viewed" type='EUF_TEXTAREA' default='0' active="true" />
    		<field name="posts" type='EUF_INTEGER' default='0' active="true" />
    	</extendedFields>	
    </e107Plugin>
    <e107Plugin name="FAQs" .... price="25.00" currency="EUR" url="http://direct-path-to-my-plugin-purchase-page.com" >
    CREATE TABLE blank (
      `blank_id` int(10) NOT NULL AUTO_INCREMENT,
      `blank_icon` varchar(255) NOT NULL,
      `blank_type` varchar(10) NOT NULL,
      `blank_name` varchar(50) NOT NULL,
      `blank_folder` varchar(50) DEFAULT NULL,
      `blank_version` varchar(5) NOT NULL,
      `blank_author` varchar(50) NOT NULL,
      `blank_authorURL` varchar(255) NOT NULL,
      `blank_date` int(10) NOT NULL,
      `blank_compatibility` varchar(5) NOT NULL,
      `blank_url` varchar(255) NOT NULL,
      `blank_media` json DEFAULT NULL,
      `blank_class` int(10) NOT NULL,
      PRIMARY KEY (`blank_id`)
    ) ENGINE=MyISAM;
    EUF_DB_FIELD
  • EUF_TEXTAREA

  • EUF_INTEGER

  • EUF_DATE

  • EUF_LANGUAGE

  • EUF_PREDEFINED

  • EUF_CHECKBOX

  • EUF_PREFIELD

  • EUF_ADDON

  • EUF_COUNTRY

  • EUF_RICHTEXTAREA

  • plugin_menu.php
    plugin_setup.php
    plugin_shortcodes.php
    plugin_sql.php
    admin_config.php
    Admin UI
    See addons

    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)

    Theme constants

    Plugin constants

    Core plugins

    Social plugin

    /e107_media/(hash)/avatars/

    e_AVATAR_DEFAULT

    ./e107_media/(hash)/avatars/default/

    e_AVATAR_DEFAULT_ABS

    /e107_media/(hash)/avatars/default/

    e_AVATAR_UPLOAD

    ./e107_media/(hash)/avatars/upload/

    e_AVATAR_UPLOAD_ABS

    /e107_media/(hash)/avatars/upload/

    e_BACKUP

    ./e107_system/(hash)/backup/

    e_BOOTSTRAP

    ./e107_web/bootstrap/

    e_CACHE

    ./e107_system/(hash)/cache/

    e_CACHE_CONTENT

    ./e107_system/(hash)/cache/content/

    e_CACHE_DB

    ./e107_system/(hash)/cache/db/

    e_CACHE_IMAGE

    ./e107_system/(hash)/cache/images/

    e_CACHE_IMAGE_ABS

    /e107_system/(hash)/cache/images/

    e_CACHE_URL

    ./e107_system/(hash)/cache/url/

    e_CORE

    ./e107_core/

    e_CSS

    /e107_web/css/

    e_CSS_ABS

    /e107_web/css/

    e_DOCROOT

    C:/webdev/www/

    e_DOCS

    ./e107_docs/help/

    e_DOCS_ABS

    /e107_docs/

    e_DOWNLOAD

    ./e107_media/(hash)/files/

    e_FILE

    ./e107_files/

    e_FILE_ABS

    /e107_files/

    e_HANDLER

    ./e107_handlers/

    e_HELP

    ./e107_docs/help/

    e_HELP_ABS

    /e107_docs/help/

    e_IMAGE

    ./e107_images/

    e_IMAGE_ABS

    /e107_images/

    e_IMPORT

    ./e107_system/(hash)/import/

    e_IMPORT_ABS

    e_JS

    /e107_web/js/

    e_JS_ABS

    /e107_web/js/

    e_LANGUAGEDIR

    ./e107_languages/

    e_LOG

    ./e107_system/(hash)/logs/

    e_MEDIA

    ./e107_media/(hash)/

    e_MEDIA_ABS

    /e107_media/(hash)/

    e_MEDIA_BASE

    ./e107_media/

    e_MEDIA_FILE

    ./e107_media/(hash)/files/

    e_MEDIA_FILE_ABS

    /e107_media/(hash)/files/

    e_MEDIA_ICON

    ./e107_media/(hash)/icons/

    e_MEDIA_ICON_ABS

    /e107_media/(hash)/icons/

    e_MEDIA_IMAGE

    ./e107_media/(hash)/images/

    e_MEDIA_IMAGE_ABS

    /e107_media/(hash)/images/

    e_MEDIA_VIDEO

    ./e107_media/(hash)/videos/

    e_MEDIA_VIDEO_ABS

    /e107_media/(hash)/videos/

    e_PLUGIN

    ./e107_plugins/

    e_PLUGIN_ABS

    /e107_plugins/

    e_ROOT

    C:\webdev\www\

    e_SYSTEM

    ./e107_system/(hash)/

    e_SYSTEM_BASE

    ./e107_system/

    e_TEMP

    ./e107_system/(hash)/temp/

    e_THEME

    ./e107_themes/

    e_THEME_ABS

    /e107_themes/

    e_UPLOAD

    ./e107_system/(hash)/temp/

    e_WEB

    ./e107_web/

    e_WEB_ABS

    /e107_web/

    e_WEB_CSS

    ./e107_web/css/

    e_WEB_IMAGE

    ./e107_web/images/

    e_WEB_IMAGE_ABS

    /e107_web/images/

    e_WEB_JS

    ./e107_web/js/

    e_BASE_SELF

    e_SELF

    THEME

    THEME_ABS

    e_ROOT

    e_ROUTE

    e_PAGE

    e_LOGIN

    1615651180

    USEREMAIL

    [email protected]

    USERID

    1

    USERIMAGE

    zaqRWcP-_400x400.jpg

    USERIP

    0000:0000:0000:0000:0000:ffff:7f00:0001

    USERJOINED

    1588259340

    USERLAN

    English

    USERLV

    1615499410

    USERNAME

    Administrator

    USERPHOTO

    USERSIGNATURE

    USERTHEME

    USERTIMEZONE

    UTC

    USERURL

    USERVISITS

    82

    <strong class='bbcode bold bbcode-b'>My Company</strong><br />13 My Address St.<br />City, State, Country<br /><strong class='bbcode bold bbcode-b'>Phone:</strong> 555-555-5555<br /><strong class='bbcode bold bbcode-b'>Email:</strong> [email protected]

    SITEDESCRIPTION

    SITEDISCLAIMER

    SITEEMAIL

    [email protected]

    SITENAME

    MyWebsite

    SITETAG

    e107 Website System

    SITEURL

    http://clean3004.test/

    SITEURLBASE

    http://clean3004.test

    e_UC_MEMBER

    253

    e_UC_ADMIN

    254

    e_UC_NOBODY

    255

    e_UC_ADMINMOD

    249

    Admins (includes main admins)

    e_UC_MODS

    248

    Moderators (who aren't admins)

    e_UC_NEWUSER

    247

    Users in 'probationary' period

    e_UC_BOTS

    246

    Reserved to identify search bots

    e_UC_SPECIAL_BASE

    243

    Assign class IDs 243 and above for fixed/special purposes

    e_UC_SPECIAL_END

    255

    Highest 'special' class

    e_LANQRY

    1

    e_MENU

    e_MOD_REWRITE

    1

    e_MOD_REWRITE_MEDIA

    1

    e_MOD_REWRITE_STATIC

    1

    e_NOCACHE

    e_SECURITY_LEVEL

    5

    e_SINGLE_ENTRY

    e_TOKEN

    THEME_STYLE

    style.css

    THEME_VERSION

    2.3

    XURL_LINKEDIN

    XURL_GITHUB

    XURL_FLICKR

    XURL_INSTAGRAM

    XURL_PINTEREST

    XURL_STEAM

    XURL_VIMEO

    Constant

    Description

    Example value

    e_ADMIN

    /e107_admin/

    e_ADMIN_ABS

    /e107_admin/

    e_AVATAR

    ./e107_media/(hash)/avatars/

    e_AVATAR_ABS

    Constant

    Description

    Example value

    e_HTTP

    SITEURLBASE

    SITEURL

    e_BASE

    Constant

    Description

    Example value

    USER

    Shows if a user is logged in (boolean)

    1

    USERCLASS

    USERCLASS_LIST

    Userclasses the user belongs to

    253,254,250,251,0

    USERCURRENTVISIT

    Constant

    Description

    Example value

    SITEADMIN

    Administrator

    SITEADMINEMAIL

    [email protected]

    SITEBUTTON

    /e107_images/button.png

    SITECONTACTINFO

    Constant

    ID

    Description

    e_UC_PUBLIC

    0

    e_UC_MAINADMIN

    250

    e_UC_READONLY

    251

    e_UC_GUEST

    Constant

    Description

    Example value

    e_LAN

    e_LANCODE

    e_LANGUAGE

    e_LANLIST

    Constant

    Description

    Example value

    e_DEBUG

    1

    e_DEBUG_CANONICAL

    e_DEBUG_JS_FOOTER

    e_DEVELOPER

    Constant

    Description

    Example value

    THEME

    ./e107_themes/bootstrap3/

    THEME_ABS

    /e107_themes/bootstrap3/

    THEME_LAYOUT

    jumbotron_home

    THEME_LEGACY

    Constant

    Description

    Example value

    e_PLUGIN_DIR_ABS

    Constant

    Description

    Example value

    XURL_FACEBOOK

    XURL_TWITTER

    XURL_YOUTUBE

    XURL_GOOGLE

    hash
    https://static.mydomain.com/

    UNIX timestamp....

    252

    Extending core functionality (addons)

    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.

    Name

    Description

    e_admin

    Allows to extend areas of the Admin UI

    e_bb

    Allows a plugin to add customized BBCodes.

    e_comment

    Allows a plugin to override the default 👉comments 'engine'

    e_cron

    Allows a plugin to add additional 👉Scheduled Tasks (or 'cronjobs') to e107.

    e_dashboard

    Adds custom plugin information to the dashboard of e107's admin area.

    Scan plugin directories
    Database
    Scheduled Tasks
    e_print.php
    event methods
    event triggers
    Frontpage
    e107::js()
    e107::css()
    e107::meta()
    Admin-UI
    e_dashboard.php
    e_sitelink.php
    e_header.php
    Notify
    output buffering
    parser methods
    e_dashboard.php
    e_parse.php
    e107::url()
    https://github.com/e107inc/e107/issues/3912

    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);
    	}
    }
    class plugindir_frontpage // plugin-folder + '_frontpage'
    {
    	// Option 1: individual item
    	function config()
    	{
    
    		$frontPage = array(
    			'page' 	=> '{e_PLUGIN}_blank/_blank.php', 
    			'title' => LAN_PLUGIN__BLANK_NAME
    		);
    
    		return $frontPage;
    	}
    
    	
    	// Option 2: multiple items
    	function config()
    	{
    		$config = array();
    
    		$config['title']    = LAN_PLUGIN__BLANK_NAME;
    		$config['page']     = array(
    			0   => array(
    				'page' => '{e_PLUGIN}_blank/_blank.php', 
    				'title'=>'Main Page'
    			),
    		);
    
    		return $config;
    	}
    }
    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);
    	}
    }
    e107::getEvent()->trigger("plugindir_mytrigger", $data);
    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_rss // plugin-folder name + '_rss'
    {
    	/**
    	 * Admin RSS Configuration
    	 */
    	function config()
    	{
    		$config = array();
    
    		$config[] = array(
    			'name'			  => 'Feed Name',
    			'url'			    => 'blank',
    			'topic_id'		=> '',
    			'description'	=> 'This is the RSS feed for the blank plugin', // that's 'description' not 'text'
    			'class'			  => e_UC_MEMBER,
    			'limit'			  => '9'
    		);
    
    		return $config;
    	}
    
    	/**
    	 * Compile RSS Data
    	 * @param array $parms
    	 * @param string $parms['url']
    	 * @param int $parms['limit']
    	 * @param int $parms['id']
    	 * @return array
    	 */
    	function data($parms=array())
    	{
    		$sql = e107::getDb();
    
    		$rss = array();
    		$i = 0;
    
    		if($items = $sql->select('blank', "*", "blank_field = 1 LIMIT 0,".$parms['limit']))
    		{
    			while($row = $sql->fetch())
    			{
    				$rss[$i]['author']			  = $row['blank_user_id'];
    				$rss[$i]['author_email']	= $row['blank_user_email'];
    				$rss[$i]['link']			    = "_blank/_blank.php?";
    				$rss[$i]['linkid']			  = $row['blank_id'];
    				$rss[$i]['title']			    = $row['blank_title'];
    				$rss[$i]['description']		= $row['blank_message'];
    				$rss[$i]['category_name']	= '';
    				$rss[$i]['category_link']	= '';
    				$rss[$i]['datestamp']		  = $row['blank_datestamp'];
    				$rss[$i]['enc_url']			  = "";
    				$rss[$i]['enc_leng']		  = "";
    				$rss[$i]['enc_type']		  = "";
    				$i++;
    			}
    
    		}
    
    		return $rss;
    	}
    }
    class plugindir_related // plugin-folder name + '_menu'
    {
    	function compile($tags,$parm=array()) 
    	{
    		$sql 	= e107::getDb();
    		$items 	= array();
    			
    		$tag_regexp = "'(^|,)(".str_replace(",", "|", $tags).")(,|$)'";
    		
    		$query = "SELECT * FROM `#_blank` WHERE _blank_id != ".$parm['current']." AND _blank_keywords REGEXP ".$tag_regexp."  ORDER BY _blank_datestamp DESC LIMIT ".$parm['limit'];
    			
    		if($sql->gen($query))
    		{		
    			while($row = $sql->fetch())
    			{
    
    				$items[] = array(
    					'title'			=> varset($row['blank_title']),
    					'url'			=> e107::url('other',$row),
    					'summary'		=> varset($row['blank_summary']),
    					'image'			=> '{e_PLUGIN}_blank/images/image.png'
    				);
    			}
    			
    			return $items;
    	    }
    	
    	}
    }
    class plugindir_search extends e_search // plugin-folder name + '_search'
    {
    	function config()
    	{	
    		$search = array(
    			'name'			=> "Blank Plugin",
    			'table'			=> 'blank',
    
    			'advanced' 		=> array(
    								'date'	=> array('type'	=> 'date', 		'text' => LAN_DATE_POSTED),
    								'author'=> array('type'	=> 'author',	'text' => LAN_SEARCH_61)
    							),
    							
    			'return_fields'	=> array('blank_id', 'blank_nick', 'blank_message', 'blank_datestamp'),
    			'search_fields'	=> array('blank_nick' => '1', 'blank_message' => '1'), // fields and weights.
    			
    			'order'			=> array('blank_datestamp' => 'DESC'),
    			'refpage'		=> 'chat.php'
    		);
    
    		return $search;
    	}
    
    	/* Compile Database data for output */
    	function compile($row)
    	{
    		preg_match("/([0-9]+)\.(.*)/", $row['blank_nick'], $user);
    
    		$res = array();
    	
    		$res['link'] 		  = e_PLUGIN."blank_menu/_blank.php?".$row['blank_id'].".fs";
    		$res['pre_title'] = LAN_SEARCH_7;
    		$res['title'] 		= $user[2];
    		$res['summary'] 	= $row['blank_message'];
    		$res['detail'] 		= e107::getParser()->toDate($row['blank_datestamp'], "long");
    
    		return $res;		
    	}
    
    	/**
    	 * Optional - Advanced Where
    	 * @param $parm - data returned from $_GET (ie. advanced fields included. in this case 'date' and 'author' )
    	 */
    	function where($parm=null)
    	{
    		$tp = e107::getParser();
    
    		$qry = "";
    		
    		if (vartrue($parm['time']) && is_numeric($parm['time'])) 
    		{
    			$qry .= " blank_datestamp ".($parm['on'] == 'new' ? '>=' : '<=')." '".(time() - $parm['time'])."' AND";
    		}
    
    		if (vartrue($parm['author'])) 
    		{
    			$qry .= " blank_nick LIKE '%".$tp->toDB($parm['author'])."%' AND";
    		}
    		
    		return $qry;
    	}
    }
    class plugindir_shortcodes extends e_shortcode
    {
    	public $override = false; // when set to true, existing core/plugin shortcodes matching methods below will be overridden. 
    
    	// Example: {PLUGINDIR_CUSTOM} shortcode - available site-wide.
    	function sc_plugindir_custom($parm = null)  // Naming:  "sc_" + [plugin-directory] + '_uniquename'
    	{
    		return "Hello World!";
    	}
    }
    class plugindir_sitelink // plugin-folder name + '_sitelink' 
    {
    	function config()
    	{
    		$links = array();	
    		
    		$links[]  = array(
    			'name'        => 'Drop-Down MegaMenu',
    			'function'    => 'megaMenu' // see method below
    		);
    
    		$links[] = array(
    			'name'			  => "Drop-Down Links",
    			'function'		=> "myCategories" // see method below
    		);
    	
    		return $links;
    	}
    	
    
    	function megaMenu() 
    	{
    		$text = '<div class="dropdown-menu mega-dropdown-menu">
                        <div class="container-fluid2">
                                <ul class="nav-list list-inline">
                                    <li><a data-filter="#" href="#"><img src="#><span>#</span></a></li>
                                    <li><a data-filter="#" href="#"><img src="#><span>#</span></a></li>
                                    <li><a data-filter="#" href="#"><img src="#><span>#</span></a></li>
                                    <li><a data-filter="#" href="#"><img src="#><span>#</span></a></li>
                                    <li><a data-filter="#" href="#"><img src="#><span>#</span></a></li>
                                    <li><a data-filter="#" href="#"><img src="#><span>#</span></a></li>
                                </ul>
                        </div>
    				</div>			
    				';
    
    		return $text;
    	}
    
    	function myCategories()
    	{
    		$sublinks 	= array();
    		
    		e107::getDb()->select("blank","*","blank_id != '' ");
    		
    		while($row = e107::getDb()->fetch())
    		{
    			$sublinks[] = array(
    				'link_name'			    => e107::getParser()->toHTML($row['blank_name'],'','TITLE'),
    				'link_url'			    => e107::url('_blank', 'other', $row),
    				'link_description'	=> '',
    				'link_button'		    => $row['blank_icon'],
    				'link_category'		  => '',
    				'link_order'		    => '',
    				'link_parent'		    => '',
    				'link_open'			    => '',
    				'link_class'		    => e_UC_PUBLIC
    			);
    		}
    		
    		return $sublinks;
    	}
    }
    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);
    	}
    }
    e_emailprint
    e_print
    e_event
    e_featurebox
    Featurebox plugin
    e_footer
    e_frontpage
    Frontpage
    e_gsitemap
    Google Sitemap plugin
    e_header
    e_help
    Admin-UI
    e_latest
    e_dashboard
    e_library
    e_linkgen
    e_sitelink
    e_list
    List Latest plugin
    e_mailout
    e_menu
    e_meta
    e_header
    e_module
    e_notify
    notifications
    e_output
    e_parse
    parser methods
    e_print
    e_rss
    e_related
    e_search
    Search page
    e_shortcode
    e_sitelink
    Navigation
    e_status
    e_dashboard
    e_tohtml
    e_parse
    e_upload
    Public Uploads
    e_url
    e107::url()
    e_user