Ejemplo n.º 1
0
 /**
  * Trigger event
  * TODO - admin log for failed callback attempts?
  * 
  * @param string $eventname
  * @param mixed $data
  * @return mixed
  */
 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 $i => $evt_func) {
             $location = '';
             if (isset($this->includes[$eventname][$i])) {
                 $location = $this->includes[$eventname][$i];
                 e107_include_once($location);
                 unset($this->includes[$eventname][$i]);
             }
             if (is_array($evt_func)) {
                 $class = $evt_func[0];
                 $method = $evt_func[1];
                 try {
                     $tmp = new $class($eventname);
                     $ret = $tmp->{$method}($data, $eventname);
                     //let callback know what event is calling it
                     unset($tmp);
                     if (!empty($ret)) {
                         break;
                     }
                 } catch (Exception $e) {
                     //TODO log errors $eventname, $location, $class, $method
                     //	echo "event didn't work. Class=".$class." Method=".$method;
                     //	echo "<br />".$e;
                     //exit;
                     continue;
                 }
             } elseif (function_exists($evt_func)) {
                 $ret = $evt_func($data, $eventname);
                 //let callback know what event is calling it
                 if (!empty($ret)) {
                     break;
                 }
             }
             //TODO log errors $eventname, $location, $evt_func
         }
     }
     return isset($ret) ? $ret : false;
 }
Ejemplo n.º 2
0
 /**
  * Trigger event
  *
  * @param string $eventname
  * @param mixed $data
  * @return mixed
  */
 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 $i => $evt_func) {
             $location = '';
             if (isset($this->includes[$eventname][$i])) {
                 $location = $this->includes[$eventname][$i];
                 e107_include_once($location);
                 unset($this->includes[$eventname][$i]);
             }
             if (is_array($evt_func)) {
                 $class = $evt_func[0];
                 $method = $evt_func[1];
                 try {
                     $tmp = new $class($eventname);
                     $ret = $tmp->{$method}($data, $eventname);
                     //let callback know what event is calling it
                     unset($tmp);
                     if (!empty($ret)) {
                         break;
                     }
                 } catch (Exception $e) {
                     e107::getLog()->add('Event Trigger failed', array('name' => $eventname, 'location' => $location, 'class' => $class, 'method' => $method, 'error' => $e), E_LOG_WARNING, 'EVENT_01');
                     continue;
                 }
             } elseif (function_exists($evt_func)) {
                 $ret = $evt_func($data, $eventname);
                 //let callback know what event is calling it
                 if (!empty($ret)) {
                     break;
                 }
             } else {
                 e107::getLog()->add('Event Trigger failed', array('name' => $eventname, 'location' => $location, 'function' => $evt_func), E_LOG_WARNING, 'EVENT_01');
             }
         }
     }
     return isset($ret) ? $ret : false;
 }
Ejemplo n.º 3
0
    foreach ($e_headers as $val) {
        // no checks fore existing file - performance
        e107_include(e_PLUGIN . $val . "/e_header.php");
    }
}
unset($e_headers);
// re-initalize in case globals are destroyed from $e_headers includes
$e_js = e107::getJs();
$e_pref = e107::getConfig('core');
// --- Load plugin Meta files - now possible to add to all zones!  --------
$e_meta_content = '';
if (is_array($pref['e_meta_list'])) {
    ob_start();
    foreach ($pref['e_meta_list'] as $val) {
        // no checks fore existing file - performance
        e107_include_once(e_PLUGIN . $val . "/e_meta.php");
    }
    // content will be added later
    // NOTE: not wise to do e_meta output, use JS Manager!
    $e_meta_content = ob_get_contents();
    ob_end_clean();
}
// Register Plugin specific CSS
// DEPRECATED, use $e_js->pluginCSS('myplug', 'style/myplug.css'[, $media = 'all|screen|...']);
if (isset($eplug_css) && $eplug_css) {
    if (!is_array($eplug_css)) {
        $eplug_css = array($eplug_css);
    }
    foreach ($eplug_css as $kcss) {
        // echo ($kcss[0] == "<") ? $kcss : "<link rel='stylesheet' href='{$kcss}' type='text/css' />\n";
        $e_js->otherCSS($kcss);