Example #1
0
 public function __toString()
 {
     // check php errors.
     $this->errorCheck();
     $this->parseElements();
     $this->parseModules();
     $this->parseParameters();
     // set page metadata.
     $this->setMetaTags($this->settings['metadata']);
     // load CSS Styles
     $css_files = $this->settings['css'];
     if ($this->registry->component_css) {
         $css_files = array_merge($css_files, $this->registry->component_css);
     }
     foreach ($css_files as $filename) {
         if (!$this->settings['general']['dbug'] && !$this->settings['general']['cache']) {
             $styles[] = file_get_contents(SITE_PATH . $filename);
         } else {
             $styles[] = array($filename, 'text/css', null);
         }
     }
     $this->loadStyles($styles);
     // load in JavaScript
     $js = new JsLoader($this->registry);
     $js_end_files = $this->settings['js'];
     // add any component javascript.
     if ($this->registry->component_js) {
         $js_end_files = array_merge($js_end_files, $this->registry->component_js);
     }
     if ($js_end_files) {
         foreach ($js_end_files as $key => $files) {
             $js_end_files[$key] = $files;
         }
     }
     if ($this->settings['general']['cache']) {
         $js->dbug = true;
         $js->scripts = array($this->settings['cacheJS']);
     } else {
         $js->scripts = $this->settings['mootools'];
         if ($js->scripts) {
             foreach ($js->scripts as $key => $files) {
                 $js->scripts[$key] = $files;
             }
         }
     }
     if ($js_end_files) {
         $js->scripts = array_merge($js->scripts, $js_end_files);
     }
     $this->loadJavaScript($js->load_js());
     $this->addScriptDeclaration('if (!Uthando) var Uthando = $H({}); Uthando.server = "' . $this->registry->server . '"; Uthando.resolve = "' . $this->registry->get('settings.resolve') . '";');
     //adjust page columns
     $columns = $this->body[0]->getElementsByTagName('section');
     foreach ($columns as $col) {
         if ($col->getAttribute('id') == $this->cols) {
             $col->parentNode->removeChild($col);
             break;
         }
     }
     return $this->toHTML();
 }
Example #2
0
     foreach ($files as $section => $values) {
         foreach ($values as $key => $value) {
             $value = str_replace('.js', '', $value);
             $template_files->set($key, $value, $section);
         }
     }
     $template_files->save();
     $js->scripts = $template_files->get('mootools_js');
     foreach ($js->scripts as $key => $files) {
         $js->scripts[$key] = $this->registry->config->get('web_url', 'SERVER') . $files;
     }
     $js->dbug = false;
     $js->compress_file = true;
     $cache_file = $_SERVER['DOCUMENT_ROOT'] . '/Common/tmp/UthandoJsCache.js';
     $ftp = new File_FTP($this->registry);
     $script = $js->load_js();
     file_put_contents($cache_file, $script);
     if ($template_name == 'admin') {
         $dir = explode('/', $_SERVER['DOCUMENT_ROOT']);
         $ftp->put($cache_file, $ftp->public_html . '/' . end($dir) . '/templates/' . $template_name . '/js/UthandoJsCache.js', true, FTP_ASCII);
     } else {
         $ftp->put($cache_file, $ftp->public_html . '/templates/' . $template_name . '/js/UthandoJsCache.js', true, FTP_ASCII);
     }
     $ftp->disconnect();
     unlink($cache_file);
 }
 $menuBar = array('cancel' => '/admin/overview', 'save' => '');
 $this->content .= $this->makeToolbar($menuBar, 24);
 $this->content .= '<form id="mooTemplate" method="post" action="' . $_SERVER['REQUEST_URI'] . '">';
 $this->content .= '<select id="template_select" name="template">';
 foreach ($templates as $k => $t) {