Improve the Parser library
diff --git a/system/libraries/Parser.php b/system/libraries/Parser.php
index 0e6ab63..39aa61e 100644
--- a/system/libraries/Parser.php
+++ b/system/libraries/Parser.php
@@ -1,13 +1,13 @@
-<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
 /**
  * CodeIgniter
  *
  * An open source application development framework for PHP 5.1.6 or newer
  *
  * NOTICE OF LICENSE
- * 
+ *
  * Licensed under the Open Software License version 3.0
- * 
+ *
  * This source file is subject to the Open Software License (OSL 3.0) that is
  * bundled with this package in the files license.txt / license.rst.  It is
  * also available through the world wide web at this URL:
@@ -38,9 +38,10 @@
  */
 class CI_Parser {
 
-	var $l_delim = '{';
-	var $r_delim = '}';
-	var $object;
+	public $l_delim = '{';
+	public $r_delim = '}';
+	public $object;
+	private $CI;
 
 	/**
 	 *  Parse a template
@@ -56,8 +57,8 @@
 	 */
 	public function parse($template, $data, $return = FALSE)
 	{
-		$CI =& get_instance();
-		$template = $CI->load->view($template, $data, TRUE);
+		$this->CI =& get_instance();
+		$template = $this->CI->load->view($template, $data, TRUE);
 
 		return $this->_parse($template, $data, $return);
 	}
@@ -76,7 +77,7 @@
 	 * @param	bool
 	 * @return	string
 	 */
-	function parse_string($template, $data, $return = FALSE)
+	public function parse_string($template, $data, $return = FALSE)
 	{
 		return $this->_parse($template, $data, $return);
 	}
@@ -89,13 +90,13 @@
 	 * Parses pseudo-variables contained in the specified template,
 	 * replacing them with the data in the second param
 	 *
-	 * @access	public
+	 * @access	private
 	 * @param	string
 	 * @param	array
 	 * @param	bool
 	 * @return	string
 	 */
-	function _parse($template, $data, $return = FALSE)
+	private function _parse($template, $data, $return = FALSE)
 	{
 		if ($template == '')
 		{
@@ -116,8 +117,7 @@
 
 		if ($return == FALSE)
 		{
-			$CI =& get_instance();
-			$CI->output->append_output($template);
+			$this->CI->output->append_output($template);
 		}
 
 		return $template;
@@ -133,7 +133,7 @@
 	 * @param	string
 	 * @return	void
 	 */
-	function set_delimiters($l = '{', $r = '}')
+	public function set_delimiters($l = '{', $r = '}')
 	{
 		$this->l_delim = $l;
 		$this->r_delim = $r;
@@ -150,9 +150,9 @@
 	 * @param	string
 	 * @return	string
 	 */
-	function _parse_single($key, $val, $string)
+	private function _parse_single($key, $val, $string)
 	{
-		return str_replace($this->l_delim.$key.$this->r_delim, $val, $string);
+		return str_replace($this->l_delim.$key.$this->r_delim, (string) $val, $string);
 	}
 
 	// --------------------------------------------------------------------
@@ -168,7 +168,7 @@
 	 * @param	string
 	 * @return	string
 	 */
-	function _parse_pair($variable, $data, $string)
+	private function _parse_pair($variable, $data, $string)
 	{
 		if (FALSE === ($match = $this->_match_pair($string, $variable)))
 		{
@@ -178,7 +178,7 @@
 		$str = '';
 		foreach ($data as $row)
 		{
-			$temp = $match['1'];
+			$temp = $match[1];
 			foreach ($row as $key => $val)
 			{
 				if ( ! is_array($val))
@@ -194,7 +194,7 @@
 			$str .= $temp;
 		}
 
-		return str_replace($match['0'], $str, $string);
+		return str_replace($match[0], $str, $string);
 	}
 
 	// --------------------------------------------------------------------
@@ -207,7 +207,7 @@
 	 * @param	string
 	 * @return	mixed
 	 */
-	function _match_pair($string, $variable)
+	private function _match_pair($string, $variable)
 	{
 		if ( ! preg_match("|" . preg_quote($this->l_delim) . $variable . preg_quote($this->r_delim) . "(.+?)". preg_quote($this->l_delim) . '/' . $variable . preg_quote($this->r_delim) . "|s", $string, $match))
 		{