Ejemplo n.º 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);
 }
Ejemplo n.º 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);
 }
Ejemplo n.º 3
0
 /**
  * @param string $name
  * @param int    $time
  *
  * @return bool
  */
 public function isFresh($name, $time)
 {
     return !(bool) $this->twiggy->getOption('debug', $this->twiggy->config, false, true);
 }
Ejemplo n.º 4
0
 /**
  * @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);
 }
Ejemplo n.º 5
0
 /**
  * @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);
 }