Example #1
0
 private function isCached($fileName)
 {
     if (N2Filesystem::existsFile($this->getStorageFilePath($fileName))) {
         return true;
     }
     return false;
 }
Example #2
0
 public function renderInline($fileName, $params = array(), $path = null, $absolutePathInFilename = false)
 {
     if ($absolutePathInFilename) {
         $path = "";
     } elseif (is_null($path)) {
         $path = $this->appType->path . NDS . "inline" . NDS;
     }
     if (!strpos($fileName, ".php")) {
         $fileName = $fileName . ".php";
     }
     /**
      * Hack for something
      *
      * @todo write an example, maybe a bug
      */
     /*
     if (strlen($path) < 3 && $path != '') {
         $path = "";
     }
     */
     if (!N2Filesystem::existsFile($path . $fileName)) {
         throw new N2ViewException("View file ({$fileName}) not found in {$path}");
     }
     extract($params);
     /** @noinspection PhpIncludeInspection */
     include $path . $fileName;
 }
Example #3
0
 private function isCached($file)
 {
     if (N2Filesystem::existsFile($file)) {
         return true;
     }
     return false;
 }
Example #4
0
 public function makeCache($fileName, $hash, $callable)
 {
     $variations = 1;
     if (N2Filesystem::existsFile($this->getManifestFilePath('variations'))) {
         $variations = intval(N2Filesystem::readFile($this->getManifestFilePath('variations')));
     }
     return parent::makeCache($fileName . mt_rand(1, $variations), $hash, $callable);
 }
Example #5
0
 public function clean($fileName)
 {
     if (N2Filesystem::existsFile($this->getManifestFilePath($fileName))) {
         unlink($this->getManifestFilePath($fileName));
     }
     if (N2Filesystem::existsFile($this->getStorageFilePath($fileName))) {
         unlink($this->getStorageFilePath($fileName));
     }
 }
Example #6
0
 function loadXMLFile($file)
 {
     if (!N2Filesystem::existsFile($file)) {
         echo "xml file not found ('{$file}')! <br /><strong>" . __FILE__ . ":" . __LINE__ . "</strong>";
         n2_exit(true);
         //throw new Exception("xml file not found ('{$file}')! <br /><strong>" . __FILE__ . ":" . __LINE__."</strong>");
     }
     // @fix Warning: simplexml_load_file(): I/O warning : failed to load external entity
     $this->_xml = simplexml_load_string(file_get_contents($file));
     $this->_xmlfile = $file;
     $this->xmlFolder = dirname($file);
 }
Example #7
0
 public function render($params = array(), $layoutName = false)
 {
     $controller = strtolower($this->appType->controllerName);
     $path = $this->appType->path . NDS . "views" . NDS . $controller . NDS;
     $call = false;
     if (N2Filesystem::existsFile($path . NDS . "_view.php")) {
         require_once $path . NDS . "_view.php";
         $call = array("class" => "N2{$this->appType->app->name}{$this->appType->type}{$controller}View", "method" => $this->appType->actionName);
         $this->viewObject = $this->preCall($call, $this->appType);
     }
     if ($layoutName) {
         $this->renderLayout($layoutName, $params);
     }
 }
Example #8
0
 /**
  * @param array $data
  */
 private function editForm($data = array())
 {
     $this->simpleEditForm($data);
     $slidersModel = new N2SmartsliderSlidersModel();
     $slider = $slidersModel->get(N2Request::getInt('sliderid', 0));
     $slidersSliderXml = call_user_func(array('N2SSPluginType' . $slider['type'], "getPath")) . '/slide.xml';
     if ((!isset($data['static-slide']) || $data['static-slide'] != 1) && N2Filesystem::existsFile($slidersSliderXml)) {
         $form = new N2Form();
         $form->loadArray($data);
         $form->loadXMLFile($slidersSliderXml);
         echo $form->render('slide');
     }
     if (isset($data['generator_id']) && $data['generator_id'] > 0) {
         $form = new N2Form();
         $form->loadArray($data);
         $form->loadXMLFile(dirname(__FILE__) . '/forms/slide_generator.xml');
         echo $form->render('slide');
     }
     N2JS::addFirstCode("new NextendForm('smartslider-form','', {});");
 }