Example #1
0
 /**
  * Pushes data to the debug console
  */
 function log()
 {
     $vars = func_get_args();
     sLog()->log($vars);
 }
Example #2
0
 /**
  * Calls a specific Extension hook Callback method
  *
  * @param string $callbackName
  * @param mixed ... (any type of parameters)
  */
 public function callExtensionHook()
 {
     $args = func_get_args();
     $callbackName = array_shift($args);
     if (method_exists($this, $callbackName)) {
         try {
             return call_user_func_array(array($this, $callbackName), $args);
         } catch (Exception $e) {
             $msg = $e->getMessage();
             if (strlen($msg) == 0) {
                 $msg = $itext['TXT_EXCEPTION_HAS_OCCURED'] . "<br />";
                 $msg .= $itext['TXT_EXCEPTION_FILE'] . ": " . $e->getFile() . "<br />";
                 $msg .= $itext['TXT_EXCEPTION_LINE'] . ": " . $e->getLine();
             }
             if ($this->frontendMode != 'true') {
                 sKoala()->alert(addslashes($msg));
             } else {
                 sLog()->error($msg);
             }
             return false;
         }
     }
 }
Example #3
0
if ($this->rawdata['name']) {
    $this->reponsedata[$indexname]->name = $this->rawdata['name'];
}
$this->reponsedata[$indexname]->value = strlen($this->rawdata['value']) || is_array($this->rawdata['value']) ? $this->rawdata['value'] : null;
$this->reponsedata[$indexname]->type = $this->rawdata['yg_type'] ? $this->rawdata['yg_type'] : null;
$this->reponsedata[$indexname]->property = $this->rawdata['yg_property'] ? $this->rawdata['yg_property'] : null;
$this->reponsedata[$indexname]->yg_id = $this->rawdata['yg_id'] ? $this->rawdata['yg_id'] : null;
$this->reponsedata[$indexname]->wid = $this->rawdata['wid'] ? $this->rawdata['wid'] : null;
if ($this->fields) {
    $this->reponsedata = array_merge($this->reponsedata, $this->fields);
}
// NEW Parameter-API:
$this->params = $this->rawdata['params'];
$koala = new Koala();
if ($this->code != '') {
    sLog()->debug($action);
    // Create AJAX-Responder Object
    $koala->setResponderData($this->reponsedata);
    $koala->setResponderHandler($this->handler);
    require_once $this->approot . $this->code;
    // Initiate sending of data
} else {
    // Throw error when no matching code found...
    $koala->log('No matching method found for "' . strtoupper($this->handler) . '"!');
    $koala->log('XX $this->id: ' . $this->id);
    $koala->log('XX $this->name: ' . $this->name);
    $koala->log('XX $this->value: ' . $this->value);
    $koala->log('XX $this->event: ' . $this->event);
    $koala->log('XX $this->handler: ' . $this->handler);
    $koala->log('XX $this->type: ' . $this->type);
    $koala->log('XX $this->property: ' . $this->property);
Example #4
0
 /**
  * Returns an instance of the specified Extension
  *
  * @param string $code Extension code
  * @param int $objectId (optional) Object Id
  * @param int $objectVersion (optional) Object version
  * @param int $objectSite (optional) Object Site
  * @return Extension|false Extension or FALSE in case of an error
  */
 function getExtension($code, $objectId = NULL, $objectVersion = NULL, $objectSite = NULL)
 {
     $id = $this->getIdByCode($code);
     $extInfo = $this->get($id);
     if ($extInfo['INTERNAL'] == 1) {
         // Internal extension, search in yeager/extensions
         $dir = getrealpath(sApp()->app_root) . '/extensions/';
     } else {
         // Normal extension, search in configured extension directory
         $dir = getrealpath(sApp()->app_root . sApp()->extensiondir) . '/';
     }
     $path = $extInfo["PATH"];
     if (file_exists($dir . $path . "/extension.php") && file_exists($dir . $path . "/extension.xml")) {
         $extConfig = new \framework\Config($dir . $path . "/extension.xml");
         $extApiVersion = explode('.', (string) $extConfig->getVar("extension/api"));
         if ($extApiVersion[0] != EXTENSION_VERSION_MAJOR) {
             sLog()->error('Extension-API Version mismatch. Expected v' . EXTENSION_VERSION_MAJOR . '.x, Extension has v' . $extApiVersion[0] . '.x!');
             return false;
         }
         require_once $dir . $path . "/extension.php";
         $namespace = (string) $extConfig->getVar("extension/namespace");
         $classname = $namespace . "\\" . (string) $extConfig->getVar("extension/class");
         try {
             return new $classname($code, $objectId, $objectVersion, $objectSite);
         } catch (Exception $e) {
             $msg = $e->getMessage();
             if (strlen($msg) == 0) {
                 $msg = $itext['TXT_EXCEPTION_HAS_OCCURED'] . "<br />";
                 $msg .= $itext['TXT_EXCEPTION_FILE'] . ": " . $e->getFile() . "<br />";
                 $msg .= $itext['TXT_EXCEPTION_LINE'] . ": " . $e->getLine();
             }
             sLog()->error($msg);
             return false;
         }
     }
 }