Пример #1
0
	public function process($item) {
		$template = SSViewer::parseTemplateContent($this->content);

		$tmpFile = tempnam(TEMP_FOLDER,"");
		$fh = fopen($tmpFile, 'w');
		fwrite($fh, $template);
		fclose($fh);

		if(isset($_GET['showtemplate']) && $_GET['showtemplate']) {
			$lines = file($tmpFile);
			echo "<h2>Template: $tmpFile</h2>";
			echo "<pre>";
			foreach($lines as $num => $line) {
				echo str_pad($num+1,5) . htmlentities($line);
			}
			echo "</pre>";
		}

		$itemStack = array();
		$val = "";

		include($tmpFile);
		unlink($tmpFile);
		

		return $val;
	}
Пример #2
0
 public function process($item, $arguments = null)
 {
     if ($arguments && $arguments instanceof Zend_Cache_Core) {
         Deprecation::notice('3.0', 'Use setPartialCacheStore to override the partial cache storage backend, ' . 'the second argument to process is now an array of variables.');
         $this->setPartialCacheStore($arguments);
         $arguments = null;
     }
     $template = SSViewer::parseTemplateContent($this->content, "string sha1=" . sha1($this->content));
     $tmpFile = tempnam(TEMP_FOLDER, "");
     $fh = fopen($tmpFile, 'w');
     fwrite($fh, $template);
     fclose($fh);
     $val = $this->includeGeneratedTemplate($tmpFile, $item, $arguments, null);
     unlink($tmpFile);
     return $val;
 }
 public function process($item, $cache = null)
 {
     $template = SSViewer::parseTemplateContent($this->content, "string sha1=" . sha1($this->content));
     $tmpFile = tempnam(TEMP_FOLDER, "");
     $fh = fopen($tmpFile, 'w');
     fwrite($fh, $template);
     fclose($fh);
     if (isset($_GET['showtemplate']) && $_GET['showtemplate']) {
         $lines = file($tmpFile);
         echo "<h2>Template: {$tmpFile}</h2>";
         echo "<pre>";
         foreach ($lines as $num => $line) {
             echo str_pad($num + 1, 5) . htmlentities($line);
         }
         echo "</pre>";
     }
     $itemStack = array();
     $val = "";
     $valStack = array();
     $cache = SS_Cache::factory('cacheblock');
     include $tmpFile;
     unlink($tmpFile);
     return $val;
 }