summaryrefslogtreecommitdiffstats
path: root/system/libraries/Parser.php
diff options
context:
space:
mode:
Diffstat (limited to 'system/libraries/Parser.php')
-rw-r--r--system/libraries/Parser.php42
1 files changed, 21 insertions, 21 deletions
diff --git a/system/libraries/Parser.php b/system/libraries/Parser.php
index 0e6ab63d8..321248277 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:
@@ -18,7 +18,7 @@
*
* @package CodeIgniter
* @author EllisLab Dev Team
- * @copyright Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
* @license http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
* @link http://codeigniter.com
* @since Version 1.0
@@ -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 @@ class CI_Parser {
*/
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 @@ class CI_Parser {
* @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 @@ class CI_Parser {
* 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 @@ class CI_Parser {
if ($return == FALSE)
{
- $CI =& get_instance();
- $CI->output->append_output($template);
+ $this->CI->output->append_output($template);
}
return $template;
@@ -133,7 +133,7 @@ class CI_Parser {
* @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 @@ class CI_Parser {
* @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 @@ class CI_Parser {
* @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 @@ class CI_Parser {
$str = '';
foreach ($data as $row)
{
- $temp = $match['1'];
+ $temp = $match[1];
foreach ($row as $key => $val)
{
if ( ! is_array($val))
@@ -194,7 +194,7 @@ class CI_Parser {
$str .= $temp;
}
- return str_replace($match['0'], $str, $string);
+ return str_replace($match[0], $str, $string);
}
// --------------------------------------------------------------------
@@ -207,7 +207,7 @@ class CI_Parser {
* @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))
{