Beispiel #1
0
 /**
  * Loads a template file from the skin folder.
  *
  * @param string $what
  *   Filename in the skin folder without the ".html" at the end.
  *
  * @return string
  *   The template file, without whitespaces.
  */
 protected function getTemplateFileContent($what)
 {
     static $fileCache = array();
     if (!isset($fileCache[$what])) {
         $fileCache[$what] = preg_replace('/\\s+/', ' ', $this->storage->getFileContents($this->storage->config->krexxdir . 'resources/skins/' . $this->storage->config->getSetting('skin') . '/' . $what . '.html'));
     }
     return $fileCache[$what];
 }
Beispiel #2
0
 /**
  * Gets the original data from the string.
  *
  * Reads the data from a file in the chunks folder.
  * The output may contain other chunk keys.
  * nothing more then a wrapper for file_get_contents()
  *
  * @param string $key
  *   The key of the chunk of which we want to get the data.
  *
  * @return string
  *   The original date
  *
  */
 protected function dechunkMe($key)
 {
     $filename = $this->krexxDir . 'chunks/' . $key . '.Krexx.tmp';
     if (is_writable($filename)) {
         // Read the file.
         $string = $this->storage->getFileContents($filename);
         // Delete it, we don't need it anymore.
         unlink($filename);
     } else {
         // Huh, we can not fully access this one.
         $string = 'Could not access chunk file ' . $filename;
         $this->storage->messages->addMessage('Could not access chunk file ' . $filename);
     }
     return $string;
 }
Beispiel #3
0
 /**
  * Outputs the CSS and JS.
  *
  * @return string
  *   The generated markup.
  */
 protected function outputCssAndJs()
 {
     $krexxDir = $this->storage->config->krexxdir;
     // Get the css file.
     $css = $this->storage->getFileContents($krexxDir . 'resources/skins/' . $this->storage->config->getSetting('skin') . '/skin.css');
     // Remove whitespace.
     $css = preg_replace('/\\s+/', ' ', $css);
     // Adding our DOM tools to the js.
     if (is_readable($krexxDir . 'resources/jsLibs/kdt.min.js')) {
         $jsFile = $krexxDir . 'resources/jsLibs/kdt.min.js';
     } else {
         $jsFile = $krexxDir . 'resources/jsLibs/kdt.js';
     }
     $js = $this->storage->getFileContents($jsFile);
     // Krexx.js is comes directly form the template.
     $path = $krexxDir . 'resources/skins/' . $this->storage->config->getSetting('skin');
     if (is_readable($path . '/krexx.min.js')) {
         $jsFile = $path . '/krexx.min.js';
     } else {
         $jsFile = $path . '/krexx.js';
     }
     $js .= $this->storage->getFileContents($jsFile);
     return $this->storage->render->renderCssJs($css, $js);
 }