Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
<?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; $log = e107::getLog();
$log->add(name, details, type, code);
//Example:
$log->add('My Event Name', $myDetailedData, E_LOG_INFORMATIVE, 'MYCODE');e107::meta($name, $content, $extended);e107::user($user_id);
$userData = e107::user(USERID); // Example - currently logged in user.
$userData = e107::user(5); // Example User ID #5.$url = "https://www.yourwebsite.com".
e107::redirect($url);e107::redirect();e107::redirect('admin');e107::meta('keywords','some words');
e107::meta('apple-mobile-web-app-capable','yes'); $ns = e107::getRender();$ns->tablerender($caption, $text, $mode, $return);$pref = e107::getPref();e107::pref(type, value);$faqPrefs = e107::pref('faqs'); // returns an array.$FaqPerPage = e107::pref('faqs', 'faqs_per_page');<layout name='custom' title='Custom Pages'>
<custompages>FRONTPAGE</custompages>
<custompages>/forum/</custompages>
</layout>$plg = e107::getPlug();$plg->load($plugdir)$cache = e107::getCache();<?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);
// 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'.
}$mes = e107::getMessage();$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();$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)class theme_shortcodes extends e_shortcode
{
function sc_my_shortcode()
{
return "Something";
}
function sc_my_other_shortcode()
{
return "Something else";
}
}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$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
)
);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);
}
};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// 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();$gen->computeLapse($older_date, $newer_date = FALSE, $mode = FALSE, $show_secs = TRUE, $format = 'long') $gen->convert_date($datestamp, $mask = '')$gen->terms($type='month')<?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';$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');
'{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}",<?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;<?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>
";
}
}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);
}
}