public function save_output($output = '')
{
// mandatory parameter values for cached output
$this->EE->TMPL->tagparams['context'] = NULL;
$this->EE->TMPL->tagparams['scope'] = 'site';
$this->EE->TMPL->tagparams['replace'] = "no";
// static cached items cannot be replaced
$this->EE->TMPL->tagparams['bundle'] = 'static';
// cached pages in the static bundle are saved to file automatically by the model
// optional parameters
$this->EE->TMPL->tagparams['refresh'] = $this->EE->TMPL->fetch_param('refresh', 0);
// by default static cached items won't expire
// bundle determines the cache driver
$this->bundle_id = $this->EE->stash_model->get_bundle_by_name($this->EE->TMPL->tagparams['bundle']);
// set the entire template data as the tagdata, removing the placeholder for this tag from the output saved to file
// we need to parse remaining globals since unlike db cached pages, static pages won't pass through PHP/EE again
$this->EE->TMPL->tagdata = $this->EE->TMPL->parse_globals($output);
// parse ACTion id placeholders
$this->EE->TMPL->tagdata = $this->EE->functions->insert_action_ids($this->EE->TMPL->tagdata);
// as this is the full rendered output of a template, check that we should really be saving it
if (!$this->_is_cacheable()) {
$this->EE->TMPL->tagparams['save'] = 'no';
} else {
$this->EE->TMPL->tagparams['save'] = 'yes';
}
// permitted parameters for cached
$reserved_vars = array('name', 'context', 'scope', 'save', 'refresh', 'replace', 'bundle', 'trim', 'strip_tags', 'strip_curly_braces', 'strip_unparsed', 'compress', 'backspace', 'strip');
$this->_run_tag('set', $reserved_vars);
return $this->EE->TMPL->tagdata;
}