mirror of
https://github.com/e107inc/e107.git
synced 2025-07-31 11:50:30 +02:00
Support for new admin event trigger, using e_admin_events.php file in plugins
This commit is contained in:
12
class2.php
12
class2.php
@@ -11,8 +11,8 @@
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/class2.php,v $
|
||||
| $Revision: 1.81 $
|
||||
| $Date: 2008-12-02 18:27:35 $
|
||||
| $Revision: 1.82 $
|
||||
| $Date: 2008-12-03 00:43:00 $
|
||||
| $Author: mcfly_e107 $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
@@ -342,6 +342,10 @@ e107_require_once(e_HANDLER.'arraystorage_class.php');
|
||||
$e107->arrayStorage =& new ArrayData();
|
||||
$eArrayStorage = &$e107->arrayStorage;
|
||||
|
||||
e107_require_once(e_HANDLER.'event_class.php');
|
||||
$e107->e_event = new e107_event;
|
||||
$e_event = &$e107->e_event;
|
||||
|
||||
$PrefCache = ecache::retrieve_sys('SitePrefs', 24 * 60, true);
|
||||
if(!$PrefCache)
|
||||
{
|
||||
@@ -633,10 +637,6 @@ e107_require_once(e_HANDLER.'override_class.php');
|
||||
$e107->override = new override;
|
||||
$override = &$e107->override;
|
||||
|
||||
e107_require_once(e_HANDLER.'event_class.php');
|
||||
$e107->e_event = new e107_event;
|
||||
$e_event = &$e107->e_event;
|
||||
|
||||
e107_require_once(e_HANDLER.'userclass_class.php');
|
||||
$e107->e_userclass = new user_class;
|
||||
$e_userclass = &$e107->e_userclass;
|
||||
|
@@ -12,9 +12,9 @@
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_handlers/cache_handler.php,v $
|
||||
| $Revision: 1.8 $
|
||||
| $Date: 2008-01-16 10:54:33 $
|
||||
| $Author: e107coders $
|
||||
| $Revision: 1.9 $
|
||||
| $Date: 2008-12-03 00:43:00 $
|
||||
| $Author: mcfly_e107 $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
@@ -24,8 +24,8 @@ if (!defined('e107_INIT')) { exit; }
|
||||
* Class to cache data as files, improving site speed and throughput.
|
||||
*
|
||||
* @package e107
|
||||
* @version $Revision: 1.8 $
|
||||
* @author $Author: e107coders $
|
||||
* @version $Revision: 1.9 $
|
||||
* @author $Author: mcfly_e107 $
|
||||
*/
|
||||
class ecache {
|
||||
|
||||
@@ -173,8 +173,10 @@ class ecache {
|
||||
*/
|
||||
function clear($CacheTag = '', $syscache = false)
|
||||
{
|
||||
global $pref;
|
||||
$e107 = e107::getInstance();
|
||||
// global $pref;
|
||||
$file = ($CacheTag) ? preg_replace("#\W#", "_", $CacheTag)."*.cache.php" : "*.cache.php";
|
||||
$e107->e_event->triggerAdminEvent('cache_clear', "cachetag=$CacheTag&file=$file&syscache=$syscache");
|
||||
$ret = ecache::delete(e_CACHE, $file, $syscache);
|
||||
return $ret;
|
||||
}
|
||||
|
@@ -11,38 +11,49 @@
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_handlers/event_class.php,v $
|
||||
| $Revision: 1.1.1.1 $
|
||||
| $Date: 2006-12-02 04:33:44 $
|
||||
| $Revision: 1.2 $
|
||||
| $Date: 2008-12-03 00:43:00 $
|
||||
| $Author: mcfly_e107 $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
if (!defined('e107_INIT')) { exit; }
|
||||
|
||||
class e107_event {
|
||||
class e107_event
|
||||
{
|
||||
var $functions = array();
|
||||
var $includes = array();
|
||||
|
||||
function register($eventname, $function, $include='') {
|
||||
if ($include!='') {
|
||||
function register($eventname, $function, $include='')
|
||||
{
|
||||
if ($include!='')
|
||||
{
|
||||
$this->includes[$eventname][] = $include;
|
||||
}
|
||||
$this->functions[$eventname][] = $function;
|
||||
}
|
||||
|
||||
function trigger($eventname, &$data) {
|
||||
if (isset($this -> includes[$eventname])) {
|
||||
foreach($this->includes[$eventname] as $evt_inc) {
|
||||
if (file_exists($evt_inc)) {
|
||||
function trigger($eventname, &$data)
|
||||
{
|
||||
if (isset($this -> includes[$eventname]))
|
||||
{
|
||||
foreach($this->includes[$eventname] as $evt_inc)
|
||||
{
|
||||
if (file_exists($evt_inc))
|
||||
{
|
||||
include_once($evt_inc);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isset($this -> functions[$eventname])) {
|
||||
foreach($this->functions[$eventname] as $evt_func) {
|
||||
if (function_exists($evt_func)) {
|
||||
if (isset($this -> functions[$eventname]))
|
||||
{
|
||||
foreach($this->functions[$eventname] as $evt_func)
|
||||
{
|
||||
if (function_exists($evt_func))
|
||||
{
|
||||
$ret = $evt_func($data);
|
||||
if ($ret!='') {
|
||||
if ($ret!='')
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -50,6 +61,33 @@ class e107_event {
|
||||
}
|
||||
return (isset($ret) ? $ret : false);
|
||||
}
|
||||
function triggerAdminEvent($type, $parms=array())
|
||||
{
|
||||
global $pref;
|
||||
if(!is_array($parms))
|
||||
{
|
||||
$_tmp = parse_str($parms, $parms);
|
||||
}
|
||||
if(isset($pref['e_admin_events_list']) && is_array($pref['e_admin_events_list']))
|
||||
{
|
||||
foreach($pref['e_admin_events_list'] as $plugin)
|
||||
{
|
||||
$func = 'plugin_'.$plugin.'_admin_events';
|
||||
if(!function_exists($func))
|
||||
{
|
||||
$fname = e_PLUGIN.$plugin.'/e_admin_events.php';
|
||||
if(is_readable($fname))
|
||||
{
|
||||
include_once($fname);
|
||||
}
|
||||
}
|
||||
if(function_exists($func))
|
||||
{
|
||||
call_user_func($func, $type, $parms);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
10
e107_plugins/forum/e_admin_events.php
Executable file
10
e107_plugins/forum/e_admin_events.php
Executable file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
function plugin_forum_admin_events($type, $parms)
|
||||
{
|
||||
echo "type = $type <br />";
|
||||
var_dump($parms);
|
||||
}
|
||||
|
||||
|
||||
?>
|
Reference in New Issue
Block a user