mirror of
https://github.com/e107inc/e107.git
synced 2025-04-20 04:32:01 +02:00
Example addons added to _blank plugin.
This commit is contained in:
parent
5e862682be
commit
a05d127375
33
e107_plugins/_blank/e_cron.php
Normal file
33
e107_plugins/_blank/e_cron.php
Normal file
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* e107 website system
|
||||
*
|
||||
* Copyright (C) 2008-2016 e107 Inc (e107.org)
|
||||
* Released under the terms and conditions of the
|
||||
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
||||
*
|
||||
*/
|
||||
|
||||
class _blank_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.
|
||||
}
|
||||
|
||||
}
|
38
e107_plugins/_blank/e_dashboard.php
Normal file
38
e107_plugins/_blank/e_dashboard.php
Normal file
@ -0,0 +1,38 @@
|
||||
<?php
|
||||
if (!defined('e107_INIT')) { exit; }
|
||||
|
||||
|
||||
class _blank_dashboard // include plugin-folder in the name.
|
||||
{
|
||||
|
||||
function chart()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
function status() // Status Panel in the admin area
|
||||
{
|
||||
|
||||
$var[0]['icon'] = "<img src='' alt='' />";
|
||||
$var[0]['title'] = "My Title";
|
||||
$var[0]['url'] = e_PLUGIN_ABS."_blank/_blank.php";
|
||||
$var[0]['total'] = 10;
|
||||
|
||||
return $var;
|
||||
}
|
||||
|
||||
|
||||
function latest() // Latest panel in the admin area.
|
||||
{
|
||||
$var[0]['icon'] = "<img src='' alt='' />";
|
||||
$var[0]['title'] = "My Title";
|
||||
$var[0]['url'] = e_PLUGIN_ABS."_blank/_blank.php";
|
||||
$var[0]['total'] = 10;
|
||||
|
||||
return $var;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
?>
|
26
e107_plugins/_blank/e_header.php
Normal file
26
e107_plugins/_blank/e_header.php
Normal file
@ -0,0 +1,26 @@
|
||||
<?php
|
||||
/*
|
||||
* e107 website system
|
||||
*
|
||||
* Copyright (C) 2008-2014 e107 Inc (e107.org)
|
||||
* Released under the terms and conditions of the
|
||||
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
||||
*
|
||||
* Related configuration module - News
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
if (!defined('e107_INIT')) { exit; }
|
||||
|
||||
|
||||
if(USER_AREA) // do not include JS in the admin area.
|
||||
{
|
||||
e107::js('_blank', 'js/blank.js'); // loads e107_plugins/_blank/js/blank.js
|
||||
e107::css('_blank', 'css/blank.css'); // loads e107_plugins/_blank/css/blank.css
|
||||
e107::meta('keywords', 'blank,words');
|
||||
}
|
||||
|
||||
|
||||
|
||||
?>
|
60
e107_plugins/_blank/e_menu.php
Normal file
60
e107_plugins/_blank/e_menu.php
Normal file
@ -0,0 +1,60 @@
|
||||
<?php
|
||||
/*
|
||||
* e107 website system
|
||||
*
|
||||
* Copyright (C) 2008-2015 e107 Inc (e107.org)
|
||||
* Released under the terms and conditions of the
|
||||
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
if (!defined('e107_INIT')) { exit; }
|
||||
|
||||
//v2.x Standard for extending menu configuration within Menu Manager. (replacement for v1.x config.php)
|
||||
|
||||
class _blank_menu
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
// e107::lan('_blank','menu',true); // English_menu.php or {LANGUAGE}_menu.php
|
||||
}
|
||||
|
||||
/**
|
||||
* Configuration Fields.
|
||||
* @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 _blank_menu_form extends e_form
|
||||
{
|
||||
|
||||
function blankCustom($curVal)
|
||||
{
|
||||
|
||||
$frm = e107::getForm();
|
||||
$opts = array(1,2,3,4);
|
||||
$frm->select('blankCustom', $opts, $curVal);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
?>
|
49
e107_plugins/_blank/e_notify.php
Normal file
49
e107_plugins/_blank/e_notify.php
Normal file
@ -0,0 +1,49 @@
|
||||
<?php
|
||||
/*
|
||||
* e107 website system
|
||||
*
|
||||
* Copyright (C) 2008-2013 e107 Inc (e107.org)
|
||||
* Released under the terms and conditions of the
|
||||
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
if (!defined('e107_INIT')) { exit; }
|
||||
|
||||
// e107::lan('_blank','notify',true);
|
||||
|
||||
// v2.x Standard
|
||||
class _blank_notify extends notify
|
||||
{
|
||||
function config()
|
||||
{
|
||||
|
||||
$config = array();
|
||||
|
||||
$config[] = array(
|
||||
'name' => "Notify about something",
|
||||
'function' => "customNotify",
|
||||
'category' => ''
|
||||
);
|
||||
|
||||
|
||||
|
||||
return $config;
|
||||
}
|
||||
|
||||
|
||||
function customNotify($data)
|
||||
{
|
||||
$subject = "My Notification";
|
||||
$message = print_a($data,true);
|
||||
$this->send('customNotify', $subject, $message);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
?>
|
56
e107_plugins/_blank/e_related.php
Normal file
56
e107_plugins/_blank/e_related.php
Normal file
@ -0,0 +1,56 @@
|
||||
<?php
|
||||
/*
|
||||
* e107 website system
|
||||
*
|
||||
* Copyright (C) 2008-2014 e107 Inc (e107.org)
|
||||
* Released under the terms and conditions of the
|
||||
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
||||
*
|
||||
* Related configuration module - News
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
if (!defined('e107_INIT')) { exit; }
|
||||
|
||||
|
||||
|
||||
class _blank_related // include plugin-folder in the name.
|
||||
{
|
||||
|
||||
|
||||
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), // '{e_BASE}news.php?extend.'.$row['news_id'],
|
||||
'summary' => varset($row['blank_summary']),
|
||||
'image' => '{e_PLUGIN}_blank/images/image.png'
|
||||
);
|
||||
}
|
||||
|
||||
return $items;
|
||||
}
|
||||
elseif(ADMIN)
|
||||
{
|
||||
// return array(array('title'=>$query,'url'=>''));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
?>
|
72
e107_plugins/_blank/e_rss.php
Normal file
72
e107_plugins/_blank/e_rss.php
Normal file
@ -0,0 +1,72 @@
|
||||
<?php
|
||||
|
||||
if (!defined('e107_INIT')) { exit; }
|
||||
|
||||
|
||||
// v2.x Standard
|
||||
|
||||
class _blank_rss // plugin-folder + '_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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
91
e107_plugins/_blank/e_search.php
Normal file
91
e107_plugins/_blank/e_search.php
Normal file
@ -0,0 +1,91 @@
|
||||
<?php
|
||||
/*
|
||||
* e107 website system
|
||||
*
|
||||
* Copyright (C) 2008-2014 e107 Inc (e107.org)
|
||||
* Released under the terms and conditions of the
|
||||
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
||||
*
|
||||
* blank e_search addon
|
||||
*/
|
||||
|
||||
|
||||
if (!defined('e107_INIT')) { exit; }
|
||||
|
||||
// v2.x e_search addon.
|
||||
|
||||
|
||||
class _blank_search extends e_search // include plugin-folder in the name.
|
||||
{
|
||||
|
||||
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)
|
||||
{
|
||||
$tp = e107::getParser();
|
||||
|
||||
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'] = $tp->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='')
|
||||
{
|
||||
$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;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
25
e107_plugins/_blank/e_shortcode.php
Normal file
25
e107_plugins/_blank/e_shortcode.php
Normal file
@ -0,0 +1,25 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright (c) e107 Inc e107.org, Licensed under GNU GPL (http://www.gnu.org/licenses/gpl.txt)
|
||||
* $Id: e_shortcode.php 12438 2011-12-05 15:12:56Z secretr $
|
||||
*
|
||||
* Featurebox shortcode batch class - shortcodes available site-wide. ie. equivalent to multiple .sc files.
|
||||
*/
|
||||
|
||||
if(!defined('e107_INIT'))
|
||||
{
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
|
||||
class _blank_shortcodes extends e_shortcode
|
||||
{
|
||||
|
||||
// Example: {_BLANK_CUSTOM} shortcode - available site-wide.
|
||||
function sc__blank_custom($parm = null) // Naming: "sc_" + [plugin-directory] + '_uniquename'
|
||||
{
|
||||
return "Hello World!";
|
||||
}
|
||||
|
||||
}
|
49
e107_plugins/_blank/e_url.php
Normal file
49
e107_plugins/_blank/e_url.php
Normal file
@ -0,0 +1,49 @@
|
||||
<?php
|
||||
/*
|
||||
* e107 Bootstrap CMS
|
||||
*
|
||||
* Copyright (C) 2008-2015 e107 Inc (e107.org)
|
||||
* Released under the terms and conditions of the
|
||||
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
||||
*
|
||||
* IMPORTANT: Make sure the redirect script uses the following code to load class2.php:
|
||||
*
|
||||
* if (!defined('e107_INIT'))
|
||||
* {
|
||||
* require_once("../../class2.php");
|
||||
* }
|
||||
*
|
||||
*/
|
||||
|
||||
if (!defined('e107_INIT')) { exit; }
|
||||
|
||||
// v2.x Standard - Simple mod-rewrite module.
|
||||
|
||||
class _blank_url // plugin-folder + '_url'
|
||||
{
|
||||
function config()
|
||||
{
|
||||
$config = array();
|
||||
|
||||
$config['other'] = array(
|
||||
'alias' => '_blank', // default alias '_blank'. {alias} is substituted with this value below. Allows for customization within the admin area.
|
||||
'regex' => '^{alias}/?$', // matched against url, and if true, redirected to 'redirect' below.
|
||||
'sef' => '{alias}', // 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['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.
|
||||
|
||||
);
|
||||
|
||||
return $config;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
27
e107_plugins/_blank/e_user.php
Normal file
27
e107_plugins/_blank/e_user.php
Normal file
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
/*
|
||||
* e107 website system
|
||||
*
|
||||
* Copyright (C) 2008-2014 e107 Inc (e107.org)
|
||||
* Released under the terms and conditions of the
|
||||
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
||||
*
|
||||
*/
|
||||
|
||||
if (!defined('e107_INIT')) { exit; }
|
||||
|
||||
// v2.x Standard
|
||||
class _blank_user // plugin-folder + '_user'
|
||||
{
|
||||
|
||||
function profile($udata) // display on user profile page.
|
||||
{
|
||||
|
||||
$var = array(
|
||||
0 => array('label' => "Label", 'text' => "Some text to display", 'url'=> e_PLUGIN_ABS."_blank/blank.php")
|
||||
);
|
||||
|
||||
return $var;
|
||||
}
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user