示例#1
0
 /**
  * @param Twiggy $Twiggy
  */
 public function __construct(Twiggy &$Twiggy)
 {
     $this->twiggy =& $Twiggy;
     $this->modx =& $Twiggy->modx;
     $paths = $this->twiggy->explodeAndClean($this->twiggy->getOption('path_templates', null, '', true));
     $this->setPaths($paths);
 }
示例#2
0
 /**
  * @param string $parentTag
  * @param string $content
  * @param bool   $processUncacheable
  * @param bool   $removeUnprocessed
  * @param string $prefix
  * @param string $suffix
  * @param array  $tokens
  * @param int    $depth
  *
  * @return int
  */
 public function processElementTags($parentTag, &$content, $processUncacheable = false, $removeUnprocessed = false, $prefix = "[[", $suffix = "]]", $tokens = array(), $depth = 0)
 {
     if (is_string($content) and $processUncacheable and preg_match('#\\{.*\\}#', $content)) {
         $content = $this->twiggy->process($content, $this->modx->placeholders);
     }
     if ($processUncacheable and $removeUnprocessed and !empty($this->modx->resource) and is_object($this->modx->resource)) {
         if ($this->modx->resource->get('_jscripts')) {
             $this->modx->jscripts = $this->modx->resource->get('_jscripts');
         }
     }
     return parent::processElementTags($parentTag, $content, $processUncacheable, $removeUnprocessed, $prefix, $suffix, $tokens, $depth);
 }
 /**
  * @param string $name
  * @param int    $time
  *
  * @return bool
  */
 public function isFresh($name, $time)
 {
     return !(bool) $this->twiggy->getOption('debug', $this->twiggy->config, false, true);
 }
 /**
  * @param $data
  * @param $key
  * @param $time
  *
  * @return string
  */
 public function setCache($data, $key, $time)
 {
     $options = array('cache_key' => 'cache/html/' . $key, 'cacheTime' => $time);
     return $this->twiggy->setCache($data, $options);
 }
 /**
  * @param string $name
  * @param array  $properties
  * @param string $prefix
  * @param string $suffix
  *
  * @return mixed|string
  */
 public static function parseChunk($name = '', array $properties = array(), $prefix = '[[+', $suffix = ']]')
 {
     return self::$twiggy->parseChunk($name, $properties, $prefix, $suffix);
 }