Beispiel #1
0
 protected static function _registerShortcodes($path)
 {
     $files = GLOB($path . '*/shortcode.php');
     foreach ($files as $file) {
         include_once __modification($file);
     }
 }
Beispiel #2
0
 protected function getChild($child, $args = array())
 {
     $action = new \Core\Action($child, $args);
     if (file_exists($action->getFile())) {
         require_once __modification($action->getFile());
         $class = $action->getClass();
         $controller = new $class();
         $controller->{$action->getMethod()}($action->getArgs());
         return $controller->getOutput();
     } else {
         return '';
     }
 }
Beispiel #3
0
 /**
  * load an additional configuration file from the config directory (3rd party intergrations)
  * @param string $filename
  */
 public function load($filename, $path = false)
 {
     if (!$path) {
         $path = DIR_CONFIG;
     }
     $file = $path . $filename . '.php';
     if (file_exists($file)) {
         $_ = array();
         require __modification($file);
         $this->data = array_deap_merge($this->data, $_);
     } else {
         trigger_error('Error: Could not load config ' . $file . '!');
         exit;
     }
 }
Beispiel #4
0
 public function trigger($key, &$arg = array())
 {
     if (isset($this->data[$key])) {
         usort($this->data[$key], array("\\Core\\Event", "cmpByPriority"));
         foreach ($this->data[$key] as $event) {
             $action = $this->createAction($event['action'], $arg);
             if ($action->getFile()) {
                 require_once __modification($action->getFile());
                 $class = $action->getClass();
                 $controller = new $class();
                 if (method_exists($controller, $action->getMethod())) {
                     $controller->{$action->getMethod()}($arg);
                 }
             }
         }
     }
 }
Beispiel #5
0
 /**
  * Executes the current action
  * @param \Core\Action $action
  * @return string
  */
 private function execute($action)
 {
     if (file_exists($action->getFile())) {
         require_once __modification($action->getFile());
         $class = $action->getClass();
         $controller = new $class();
         if (is_callable(array($controller, $action->getMethod()))) {
             $action = call_user_func_array(array($controller, $action->getMethod()), $action->getArgs());
         } else {
             $action = $this->error;
             $this->error = '';
         }
     } else {
         $action = $this->error;
         $this->error = '';
     }
     return $action;
 }
Beispiel #6
0
 public function load($filename)
 {
     $file = DIR_LANGUAGE . $this->directory . '/' . $filename . '.php';
     if (file_exists($file)) {
         $_ = array();
         require __modification($file);
         $data = $_;
         require $file;
         $new = array_deap_merge($data, $_);
         require __modification($file);
         $this->data = array_deap_merge($this->data, $new);
         return $this->data;
     }
     $file = DIR_LANGUAGE . $this->default . '/' . $filename . '.php';
     if (file_exists($file)) {
         $_ = array();
         require __modification($file);
         $this->data = array_deap_merge($this->data, $_);
         return $this->data;
     }
 }
Beispiel #7
0
 /**
  * @deprecated since version number
  * initialize the database
  * @param string $driver
  * @param string $hostname
  * @param string $username
  * @param string $password
  * @param string $database
  */
 public function database($driver, $hostname, $username, $password, $database)
 {
     $file = DIR_SYSTEM . 'database/' . $driver . '.php';
     $class = 'Database' . preg_replace('/[^a-zA-Z0-9]/', '', $driver);
     if (file_exists($file)) {
         include_once __modification($file);
         \Core\Core::$registry->set(str_replace('/', '_', $driver), new $class($hostname, $username, $password, $database));
     } else {
         trigger_error('Error: Could not load database ' . $driver . '!');
         exit;
     }
 }
Beispiel #8
0
 /**
  * Returns the output
  * @return string
  */
 protected function render($tpl = false, $data = array())
 {
     if ($tpl) {
         $this->template = $tpl;
     }
     if ($data) {
         $this->data = array_deap_merge($data, $this->data);
     }
     foreach ($this->children as $child) {
         $this->data[basename($child)] = $this->getChild($child);
     }
     $template = DIR_TEMPLATE;
     if (NS != 'admin' && NS != 'installer') {
         $theme = $this->config->get('config_template');
         if ($theme) {
             if (is_file($template . $theme . '/' . $this->template)) {
                 $template .= $theme . '/';
             } else {
                 $template .= 'default/';
             }
         } elseif (!is_file($template . $this->template)) {
             $template .= 'default/';
         }
     }
     //is there an override ???
     if (file_exists($template . $this->template)) {
         $this->fillTranslations();
         extract($this->data);
         ob_start();
         require __modification($template . $this->template);
         $this->output = ob_get_contents();
         ob_end_clean();
         return $this->output;
     } else {
         trigger_error('Error: Could not load template ' . $template . $this->template . '!');
         exit;
     }
 }
Beispiel #9
0
 public function execute()
 {
     // Stop any magical methods being called
     if (substr($this->method, 0, 2) == '__') {
         return false;
     }
     if (is_file($this->file)) {
         include_once __modification($this->file);
         $class = $this->class;
         $controller = new $class();
         if (is_callable(array($controller, $this->method))) {
             return call_user_func(array($controller, $this->method), $this->args);
         } else {
             return false;
         }
     } else {
         return false;
     }
 }
Beispiel #10
0
 public function loadParent($id)
 {
     $path = DIR_APPLICATION;
     $row = $this->_db->query("select * from #__ams_pages where ams_page_id='" . (int) $id . "'");
     // var_dump($row);
     $file = $path . 'model/' . str_replace(".", "/", $row->row['namespace']) . '.php';
     $class = 'Model' . preg_replace('/[^a-zA-Z0-9]/', '', $row->row['namespace']);
     if (file_exists($file)) {
         include_once __modification($file);
         return new $class($id);
     }
     return false;
 }