/** * Parse * * Parses short tags contained in the specified template, * replacing them with the data in the second param * * @param string * @param array * @param bool * @return string */ function _parse($string, $data, $return = FALSE, $inject_noparse = FALSE) { // Convert from object to array if (!is_array($data)) { $data = (array) $data; } // Global tags $data['site_url'] = trim(site_url(), '/'); $data['base_url'] = trim(base_url(), '/'); $data['theme_url'] = trim(theme_url(), '/'); if ($this->_ci->config->item('global_tags') && is_array($this->_ci->config->item('global_tags'))) { $data = array_merge($data, $this->_ci->config->item('global_tags')); } // Not sure if needed // ALERT THIS MAY CAUSE INFINITE LOOP $data = array_merge($data, $this->_ci->load->_ci_cached_vars); // Lex processing Lex_Autoloader::register(); $parser = new Lex_Parser(); $parser->scopeGlue(':'); $parsed = $parser->parse($string, $data, array($this, 'parser_callback'), TRUE); if ($inject_noparse) { $parsed = Lex_Parser::injectNoparse($parsed); } // Return results or not ? if (!$return) { $this->_ci->output->append_output($parsed); return; } return $parsed; }