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); }
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); }
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()); }
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); }
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); }
function setOptions($options = array()) { if (isset($options['cache']) && $options['cache']) { $this->cache = h2o_cache($options); } }