# Extending core functionality (addons)

{% hint style="danger" %}
**Please note:** This page is under construction and has not been finished yet.
{% endhint %}

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

{% hint style="warning" %}
**Please note:** If addons are added after plugin installation, you may need to run the :point\_right: "[Scan plugin directories](https://userguide.e107.org/administration/tools/database#scan-plugin-directories)" option in Admin Area > Tools > [Database](https://userguide.e107.org/administration/tools/database).&#x20;
{% endhint %}

{% hint style="info" %}
**TIP:** The `_blank` plugin in the e107\_plugins folder contains example addons that may be an easy reference for you.&#x20;
{% endhint %}

### Overview of all plugin addons

| Name                               | Description                                                                                                                                                                                                                                                       |
| ---------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [e\_admin](#e_admin.php)           | Allows to extend areas of the [Admin UI](https://devguide.e107.org/plugin-development/admin-ui)                                                                                                                                                                   |
| [e\_bb](#e_bb.php)                 | Allows a plugin to add customized BBCodes.                                                                                                                                                                                                                        |
| [e\_comment](#e_comment.php)       | Allows a plugin to override the default :point\_right:[comments 'engine'](https://userguide.e107.org/administration/manage/comments-manager#engine)                                                                                                               |
| [e\_cron](#e_cron.php)             | Allows a plugin to add additional :point\_right:[Scheduled Tasks](https://userguide.e107.org/administration/tools/schedule-tasks) (or 'cronjobs') to e107.                                                                                                        |
| [e\_dashboard](#e_dashboard.php)   | Adds custom plugin information to the dashboard of e107's admin area.                                                                                                                                                                                             |
| [e\_emailprint](#e_emailprint.php) | <p><strong>Deprecated!</strong> <br>Use <a href="#e_print-php">e\_print</a> instead.</p>                                                                                                                                                                          |
| [e\_event](#e_event.php)           | Allows a plugin to easily hook into system events and trigger their own methods/functions.                                                                                                                                                                        |
| [e\_featurebox](#e_featurebox.php) | Allows a plugin to generate content for the :point\_right:[Featurebox plugin](https://userguide.e107.org/core-plugins/featurebox).                                                                                                                                |
| [e\_footer](#e_footer.php)         | Allows a plugin to include code in the footer of every page of the site                                                                                                                                                                                           |
| [e\_frontpage](#e_frontpage.php)   | Allows a plugin developer to add their plugin as a :point\_right:[Frontpage](https://userguide.e107.org/administration/settings/front-page) option.                                                                                                               |
| [e\_gsitemap](#e_gsitemap.php)     | Allows a plugin to create automated entries for the :point\_right:[Google Sitemap plugin](https://userguide.e107.org/core-plugins/google-sitemap).                                                                                                                |
| [e\_header](#e_header.php)         | Allows a plugin developer to add data to `<head>` of every page.                                                                                                                                                                                                  |
| [e\_help](#e_help.php)             | <p><strong>Deprecated!</strong> </p><p>Allowed plugin developers to add information to the plugin configuration page <em>sidebar</em>. This has now been integrated within the <a href="admin-ui">Admin-UI</a> through the <code>renderHelp()</code> method. </p> |
| [e\_latest](#e_latest.php)         | <p><strong>Deprecated!</strong> <br>Use <a href="#e_dashboard-php">e\_dashboard</a> instead.</p>                                                                                                                                                                  |
| [e\_library](#e_library.php)       | Allows a plugin to include a third-party library.                                                                                                                                                                                                                 |
| [e\_linkgen](#e_linkgen.php)       | <p><strong>Deprecated!</strong> </p><p>Use <a href="#e_sitelink-php">e\_sitelink</a> instead.</p>                                                                                                                                                                 |
| [e\_list](#e_list.php)             | Allows a plugin to hook into the :point\_right:[List Latest plugin](https://app.gitbook.com/@e107/s/user-guide/core-plugins/list-latest)                                                                                                                          |
| [e\_mailout](#e_mailout.php)       | Allows a plugin to use e107's mailout feature for bulk mailing.                                                                                                                                                                                                   |
| [e\_menu](#e_menu.php)             | Provide configuration options for each instance of the plugin's menus.                                                                                                                                                                                            |
| [e\_meta](#e_meta.php)             | <p><strong>Deprecated!</strong> </p><p>Use <a href="#e_header-php">e\_header</a> instead.</p>                                                                                                                                                                     |
| [e\_module](#e_module.php)         | 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.                                                                   |
| [e\_notify](#e_notify.php)         | Adds a plugin to the [notifications](https://userguide.e107.org/administration/tools/notify) section in e107's admin area.                                                                                                                                        |
| [e\_output](#e_output.php)         | Allows a plugin to hook into all pages at the end (after closing `</html>`)                                                                                                                                                                                       |
| [e\_parse](#e_parse.php)           | Allows a plugin to hook into e107's [parser methods](https://devguide.e107.org/classes-and-methods/parser#parser-methods)                                                                                                                                         |
| [e\_print](#e_print.php)           | Allows a plugin developer to specify content that is displayed in printer-friendly format.                                                                                                                                                                        |
| [e\_rss](#e_rss.php)               | Adds a plugin to the RSS plugin, and generates RSS feeds.                                                                                                                                                                                                         |
| [e\_related](#e_related.php)       | Adds a plugin to the search which generates 'related' links in news items and pages.                                                                                                                                                                              |
| [e\_search](#e_search.php)         | Adds a plugin to the :point\_right:[Search page](https://userguide.e107.org/administration/settings/search).                                                                                                                                                      |
| [e\_shortcode](#e_shortcode.php)   | Allows a plugin to make their shortcodes available to core templates and templates of other plugins.                                                                                                                                                              |
| [e\_sitelink](#e_sitelink.php)     | Allows a plugin to automatically generate :point\_right:[Navigation](https://userguide.e107.org/administration/settings/navigation) links                                                                                                                         |
| [e\_status](#e_status.php)         | <p><strong>Deprecated!</strong><br>Use <a href="#e_dashboard-php">e\_dashboard</a> instead.</p>                                                                                                                                                                   |
| [e\_tohtml](#e_tohtml.php)         | <p><strong>Deprecated!</strong><br>Use <a href="#e_parse-php">e\_parse</a> instead.</p>                                                                                                                                                                           |
| [e\_upload](#e_upload.php)         | Allows a plugin to set categories for :point\_right:[Public Uploads](https://userguide.e107.org/administration/content/public-uploads)                                                                                                                            |
| [e\_url](#e_url.php)               | Provides a simple way to add mod-rewrite redirects to  a plugin's page. Used to create  search-engine-friendly URLs through the [e107::url()](https://devguide.e107.org/classes-and-methods/urls) method.                                                         |
| [e\_user](#e_user.php)             | 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.                                                                                 |

## Plugin addons&#x20;

{% hint style="warning" %}
:thumbsup: Be sure to replace `plugindir` with your plugin's directory name in all examples below.
{% endhint %}

### e\_admin.php

{% hint style="info" %}
**TODO**: Add example. See social plugin for an example.&#x20;
{% endhint %}

### e\_bb.php

{% hint style="info" %}
**TODO**: Add example.
{% endhint %}

### e\_comment.php

{% hint style="info" %}
**TODO**: Add example. See social plugin for an example.&#x20;
{% endhint %}

### e\_cron.php

This addon allows a plugin to add additional scheduled task options to e107. (see Admin Area > Tools > [Scheduled Tasks](https://userguide.e107.org/administration/tools/schedule-tasks)).&#x20;

#### *Example:*

```php
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. 
    }

}
```

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

{% hint style="info" %}
Previously, the `e_latest` and `e_status` addons were used separately for this. They have now been incorporated into the e\_dashboard addon.&#x20;
{% endhint %}

#### &#x20;*Example:*

```php
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;
	}	
}
```

### e\_emailprint.php

{% hint style="warning" %}
**Deprecated!**\
This addon has been deprecated. Use [e\_print.php](#e_print-php) instead.&#x20;
{% endhint %}

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

{% hint style="success" %}
You can make use of the [event methods](https://devguide.e107.org/classes-and-methods/events#events-methods) and [event triggers](https://devguide.e107.org/classes-and-methods/events#event-triggers).
{% endhint %}

#### *Example:*

```php
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);
	}
}
```

### e\_featurebox.php

{% hint style="info" %}
**TODO:** Add example.
{% endhint %}

### e\_footer.php

This addon allows a plugin to include code in the footer of every page of the site.

{% hint style="info" %}
Please find an example in the "tinymce4" plugin.&#x20;
{% endhint %}

### e\_frontpage.php

This addon allows a plugin developer to add their plugin as a :point\_right:[Frontpage](https://userguide.e107.org/administration/settings/front-page) option.

#### ***Example:***

```php
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;
	}
}
```

### e\_gsitemap.php

{% hint style="info" %}
**TODO:** Add example. See "news" plugin folder for an example.&#x20;
{% endhint %}

### 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: [`e107::js()`](https://devguide.e107.org/classes-and-methods/javascript), [`e107::css()`](https://devguide.e107.org/classes-and-methods/css) or [`e107::meta()`](https://devguide.e107.org/classes-and-methods/meta)

{% hint style="danger" %}
**Warning:** Output should never be echoed or printed from this file!
{% endhint %}

#### *Example:*

```php
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.
}
```

### e\_help.php

{% hint style="warning" %}
**Deprecated!** \
This addon allowed plugin developers to add information to the plugin configuration page *sidebar*. \
\
This has now been integrated within the [Admin-UI](https://devguide.e107.org/plugin-development/admin-ui) through the `renderHelp()` method.&#x20;
{% endhint %}

### e\_latest.php

{% hint style="warning" %}
**Deprecated!**\
This addon has been deprecated. Use [e\_dashboard.php](#e_dashboard-php) instead.&#x20;
{% endhint %}

### e\_library.php

{% hint style="info" %}
Please find an example in the "\_blank" plugin.&#x20;
{% endhint %}

### e\_linkgen.php

{% hint style="warning" %}
**Deprecated!**\
This addon has been deprecated. Use [e\_sitelink.php](#e_sitelink-php) instead.&#x20;
{% endhint %}

### e\_list.php

{% hint style="info" %}
**TODO:** Add example.
{% endhint %}

### e\_mailout.php

This addon allows a plugin to use e107's mailout feature for bulk mailing.

{% hint style="info" %}
Please find an example in the "newsletter" plugin.&#x20;
{% endhint %}

### e\_menu.php

This addon provides configuration options for each instance of the plugin's menus.&#x20;

{% hint style="info" %}
The `e_menu.php` addon is a replacement for the old `config.php` file used in e107 v1.x.&#x20;
{% endhint %}

#### *Example:*

```php
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);
	}
}
```

### e\_meta.php

{% hint style="warning" %}
**Deprecated!**\
This addon has been deprecated. Use [e\_header.php](#e_header-php) instead.&#x20;
{% endhint %}

### 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.&#x20;

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 :point\_right: [Notify](https://userguide.e107.org/administration/tools/notify) section in the Admin Area and allows a plugin to send notifications.&#x20;

#### *Example:*

```php
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);
	}
}
```

The notification can then be triggered by using:

```php
e107::getEvent()->trigger("plugindir_mytrigger", $data);
```

### 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 :point\_right: [*output buffering*](https://www.php.net/manual/en/book.outcontrol.php)*.*

### e\_parse.php

This addon allows to hook into e107's [parser methods](https://devguide.e107.org/classes-and-methods/parser#parser-methods)

#### *Example:*

```php
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;
	}
}
```

### e\_print.php

This addon allows a plugin developer to specify content that is displayed in printer-friendly format

#### ***Example:***

```php
class plugindir_print // plugin-folder + '_print'
{
	public function render($parm)
	{
		$text = "Hello {$parm}!"; 

		return $text;
	}	
}
```

### e\_rss.php

This addon adds the plugin to the RSS plugin, and generates RSS feeds for the plugin.

#### *Example:*

```php
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;
	}
}
```

### e\_related.php

This addon adds the plugin to the search which generates 'related' links in news items and pages of e107.&#x20;

#### *Example:*

```php
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;
	    }
	
	}
}
```

### e\_search.php

This addon adds the plugin to the 'search page' of e107.

#### *Example:*

```php
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;
	}
}
```

### e\_shortcode.php

This addon allows a plugin to make their shortcodes available to core templates and templates of other plugins.&#x20;

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.&#x20;

#### *Example:*

```php
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!";
	}
}
```

### 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'.&#x20;

#### *Example:*

```php
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;
	}
}
```

### e\_status.php

{% hint style="warning" %}
**Deprecated!**\
This addon has been deprecated. Use [e\_dashboard.php](#e_dashboard-php) instead.&#x20;
{% endhint %}

### e\_tohtml.php

{% hint style="warning" %}
**Deprecated!**\
This addon has been deprecated. Use [e\_parse.php](#e_parse-php) instead.&#x20;
{% endhint %}

### e\_upload.php

{% hint style="info" %}
**TODO:** Add example.
{% endhint %}

### 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 [e107::url()](https://devguide.e107.org/classes-and-methods/urls) method.

#### *Example:*

{% hint style="info" %}
*TODO: add 'legacy' example and explanation*
{% endhint %}

{% hint style="info" %}
TODO: *e\_ROUTE -* <https://github.com/e107inc/e107/issues/3912>
{% endhint %}

```php
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;
	}
}
```

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

```php
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);
	}
}
```
