Пример #1
0
 public function renderTemplate($context, $filename = null)
 {
     $filename = is_null($filename) ? $this->options->filename : $filename;
     $filepath = $this->options->dirpath . Gongo_File_Path::make($filename . '.html');
     $template = file_get_contents($filepath);
     return $this->renderer->render($template, $context);
 }
Пример #2
0
 function _cachePath()
 {
     if (!$this->path->temp) {
         return false;
     }
     $path = $this->path->temp . Gongo_File_Path::make('/twig/');
     Gongo_File::makeDir($path);
     return $path;
 }
Пример #3
0
 public function renderTemplate($context, $filename = null)
 {
     $filename = is_null($filename) ? $this->options->filename : $filename;
     $filepath = $this->options->dirpath . Gongo_File_Path::make($filename . '.php');
     extract($context);
     ob_start();
     include $filepath;
     return ob_get_clean();
 }
Пример #4
0
 function _compiledTemplatePath()
 {
     if (!$this->path->temp) {
         return false;
     }
     $path = $this->path->temp . Gongo_File_Path::make('/smarty2/templates_c/');
     Gongo_File::makeDir($path);
     return $path;
 }
Пример #5
0
 function cachePath($name = null)
 {
     if (!$this->path->temp) {
         return false;
     }
     $name = is_null($name) ? $this->name : $name;
     $path = $this->path->temp . Gongo_File_Path::make('/' . $name . '/');
     Gongo_File::makeDir($path);
     return $path;
 }
Пример #6
0
 public function renderTemplate($context, $filename = null)
 {
     $filename = is_null($filename) ? $this->options->filename : $filename;
     $filepath = $this->options->dirpath . Gongo_File_Path::make($filename . '.html');
     $this->renderer->setTemplate($filepath);
     foreach ($context as $key => $value) {
         $this->renderer->{$key} = $value;
     }
     return $this->renderer->execute();
 }
Пример #7
0
 public function renderTemplate($context, $filename = null)
 {
     $filename = is_null($filename) ? $this->options->filename : $filename;
     $filepath = $this->options->dirpath . Gongo_File_Path::make($filename . '.haml');
     $cachepath = Gongo_App::$environment->path->phamlp->cachePath . Gongo_File_Path::make($filename . '.php');
     $this->cache->updateFile($filepath, $cachepath, $this->_compile());
     extract($context);
     ob_start();
     include $cachepath;
     return ob_get_clean();
 }
Пример #8
0
 public function initSmarty($smarty)
 {
     $envpath = Gongo_App::$environment->path;
     if ($this->dirpath()) {
         $smarty->template_dir = Gongo_File_Path::make($this->dirpath());
     } else {
         $smarty->template_dir = $envpath->smarty3->templatePath;
     }
     $smarty->compile_dir = $envpath->smarty3->compiledTemplatePath;
     $smarty->config_dir = $envpath->smarty3->configPath;
     $smarty->cache_dir = $envpath->smarty3->cachePath;
     return $smarty;
 }
Пример #9
0
Файл: App.php Проект: no22/gongo
 static function autoload($className)
 {
     $ns = '';
     if (false !== ($lastNsPos = strrpos($className, '\\'))) {
         $ns = Gongo_File_Path::make(strtr(substr($className, $lastNsPos), array('\\' => '/')));
         $className = substr($className, $lastNsPos + 1);
     }
     $filePath = Gongo_File_Path::make('/' . strtr($className, array('_' => '/')) . '.php');
     $paths = self::$environment->autoloadPaths;
     foreach ($paths as $path) {
         if (is_file($path . $ns . $filePath)) {
             require $path . $ns . $filePath;
             return;
         }
     }
 }
Пример #10
0
 public function download($path, $filename = null, $nosniff = true)
 {
     $filename = is_null($filename) ? Gongo_File_Path::basename($path) : $filename;
     if ($nosniff) {
         header('X-Content-Type-Options: nosniff');
     }
     header("Content-Type: application/force-download");
     header("Content-Type: application/octet-stream");
     header("Content-Type: application/download");
     header("Content-Description: File Transfer");
     header("Content-Disposition: attachment; filename={$filename}");
     header("Content-Transfer-Encoding: binary");
     header("Content-Length: " . filesize($path));
     readfile($path);
     exit;
 }
Пример #11
0
 function _libraryPath()
 {
     return $this->path->lib . Gongo_File_Path::make('/Mustache/Autoloader.php');
 }
Пример #12
0
 function _libraryPath()
 {
     return $this->path->lib . Gongo_File_Path::make('/PHPTAL/PHPTAL.php');
 }
Пример #13
0
Файл: Doo.php Проект: no22/gongo
 function _libraryPath()
 {
     return $this->path->lib . Gongo_File_Path::make('/dwoo/dwooAutoload.php');
 }
Пример #14
0
 function _libraryPath()
 {
     return $this->path->lib . Gongo_File_Path::make('/Fammel/fammel.php');
 }
Пример #15
0
 function _lib()
 {
     return $this->webapp . Gongo_File_Path::make('/lib');
 }
Пример #16
0
 static function mvDir($src, $dst, $overwrite = false)
 {
     $success = true;
     if (!file_exists($src)) {
         return false;
     }
     if (!file_exists($dst)) {
         self::makeDir($dst);
     }
     if (!is_dir($dst)) {
         return false;
     }
     $dstpath = rtrim($dst, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . Gongo_File_Path::basename($src);
     if (!$overwrite && file_exists($dstpath)) {
         return false;
     }
     if (is_file($src)) {
         if (!self::mv($src, $dstpath)) {
             return false;
         }
     } else {
         if (is_dir($src)) {
             self::makeDir($dstpath);
             $src = rtrim($src, DIRECTORY_SEPARATOR);
             foreach (scandir($src) as $filename) {
                 if ($filename === '.' || $filename === '..') {
                     continue;
                 }
                 if ($filename[0] === '.') {
                     continue;
                 }
                 if (!self::mvDir($src . DIRECTORY_SEPARATOR . $filename, $dstpath, $overwrite)) {
                     $success = false;
                 }
             }
             self::rmDir($src);
         }
     }
     return $success;
 }
Пример #17
0
 public function makeControllerClassPath($className)
 {
     $appPath = Gongo_App::$environment->path->app;
     return $appPath . Gongo_File_Path::make('/' . strtr($className, array('_' => '/'))) . '.php';
 }
Пример #18
0
 public function renderTemplate($context, $filename = null)
 {
     $filename = is_null($filename) ? $this->options->filename : $filename;
     $filepath = $this->options->dirpath . Gongo_File_Path::make($filename . '.tpl');
     return $this->renderer->get($filepath, $context);
 }
Пример #19
0
 function _libraryPath()
 {
     return $this->path->lib . Gongo_File_Path::make('/phamlp/haml/HamlParser.php');
 }
Пример #20
0
 function _img()
 {
     return $this->assets . Gongo_File_Path::make('/img');
 }
Пример #21
0
 function _preloadPaths()
 {
     $paths = $this->config->Path->preload;
     return Gongo_File_Path::preparePaths($paths, $this->path->root);
 }