Exemple #1
0
 public function push($file)
 {
     $_ = array();
     if (is_file($file)) {
         require $file;
         $this->data = array_deap_merge($this->data, $_);
     }
     return $this->data;
 }
Exemple #2
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;
     }
 }
Exemple #3
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;
     }
 }
Exemple #4
0
function array_deap_merge($arr1, $arr2)
{
    foreach ($arr2 as $k => $v) {
        if (array_key_exists($k, $arr1) && is_array($v)) {
            $arr1[$k] = array_deap_merge($arr1[$k], $arr2[$k]);
        } else {
            $arr1[$k] = $v;
        }
    }
    return $arr1;
}
Exemple #5
0
 public function loadPageRevision($revision_id)
 {
     $q = $this->_db->query("select * from #__ams_revisions where ams_revision_id = '" . (int) $revision_id . "'");
     $return = array();
     if ($q->row) {
         $this->loadPageObject($q->row['ams_page_id']);
         $data = $this->toArray();
         $revision = json_decode($q->row['pagedata'], 1);
         $return = array_deap_merge($data, $revision);
         $this->populate($return);
     }
     //  debugPre($return);
     //  exit;
     return $return;
 }