Example #1
0
 function render($context, $stream)
 {
     $cache = h2o_cache($context->options);
     $term = $context->resolve(':term');
     $hack = $context->resolve(':hack');
     $url = $this->get_api_url($term, $hack);
     $feed = @$this->fetch($context, $url)->xpath('/searchresult/section/documentset/document');
     $context->set("images", $feed);
 }
Example #2
0
 function render($context, $stream)
 {
     $cache = h2o_cache($context->options);
     $term = $context->resolve(':term');
     $hack = 'site:youtube.com';
     $url = $this->get_api_url($term, $hack);
     $feed = @$this->fetch($context, $url)->xpath('//channel/item');
     $context->set("videos", $feed);
 }
Example #3
0
 function render($context, $stream)
 {
     $cache = h2o_cache($context->options);
     $term = $context->resolve(':term');
     $hack = $context->resolve(':hack');
     $url = $this->get_api_url($term, $hack);
     $feed = @$this->fetch($context, $url);
     $feed = @$this->filter($feed);
     $context->set("images", $feed);
     $context->set("is_single_image", $this->is_single_image());
 }
Example #4
0
 function render($context, $stream)
 {
     $cache = h2o_cache($context->options);
     $term = $context->resolve(':term');
     $hack = $context->resolve(':hack');
     $url = $this->get_api_url($term, $hack);
     $feed = @$this->fetch($context, $url)->xpath('//channel/item');
     $feed = @$this->filter($feed);
     $context->set("api", $feed);
     $context->set("api_url", $url);
 }
Example #5
0
 function __construct($argstring, $parser, $pos = 0)
 {
     if (!empty($argstring) && !preg_match($this->syntax, $argstring)) {
         throw TemplateSyntaxError('Please specify time to live value for this cache block');
     }
     $this->body = $parser->parse('endcache');
     $this->uid = md5($parser->filename . $pos);
     $this->ttl = (int) $argstring;
     $options = $parser->options;
     if ($this->ttl) {
         $options['cache_ttl'] = $this->ttl;
     }
     if (!$options['cache']) {
         $options['cache'] = 'file';
     }
     $this->cache = h2o_cache($options);
 }
Example #6
0
 function setOptions($options = array())
 {
     if (isset($options['cache']) && $options['cache']) {
         $this->cache = h2o_cache($options);
     }
 }