function processSnippet($id, $vars) { $item = isset($this->items[$id]) ? $this->items[$id] : isset($this->items[html_entity_decode($id, ENT_COMPAT, 'UTF-8')]) ? $this->items[html_entity_decode($id, ENT_COMPAT, 'UTF-8')] : ''; if (!$item) { if ($this->params->place_comments) { return $this->params->message_start . JText::_('SNP_OUTPUT_REMOVED_NOT_FOUND') . $this->params->message_end; } else { return ''; } } if (!$item->published) { if ($this->params->place_comments) { return $this->params->message_start . JText::_('SNP_OUTPUT_REMOVED_NOT_ENABLED') . $this->params->message_end; } else { return ''; } } $html = $item->content; if ($vars) { $unprotected = array('\\|', '\\{', '\\}'); $protected = nnProtect::protectArray($unprotected); nnProtect::protectInString($vars, $unprotected, $protected); $vars = explode('|', $vars); foreach ($vars as $i => $var) { if ($i) { nnProtect::unprotectInString($var, array('|', '{', '}'), $protected); $html = preg_replace('#\\\\' . $i . '(?![0-9])#', $var, $html); } } } if (strpos($html, '[[escape]]') !== false) { if (preg_match_all('#\\[\\[escape\\]\\](.*?)\\[\\[/escape\\]\\]#s', $html, $matches, PREG_SET_ORDER) > 0) { foreach ($matches as $match) { $replace = addslashes($match['1']); $html = str_replace($match['0'], $replace, $html); } } } return $html; }