Skip to content

Instantly share code, notes, and snippets.

@zombor
Created May 24, 2010 18:55
Show Gist options
  • Save zombor/412275 to your computer and use it in GitHub Desktop.
Save zombor/412275 to your computer and use it in GitHub Desktop.
<?php defined('SYSPATH') or die('No direct script access.');
/**
* Acts as an object wrapper for HTML output with embedded PHP, called "views".
* Variables can be assigned with the view object and referenced locally within
* the view.
*
* @package Kohana
* @category Base
* @author Kohana Team
* @copyright (c) 2010 Kohana Team
* @license http://kohanaphp.com/license
*/
class Kohana_View_HTML extends Kohana_View {
/**
* Same as Kohana_View::set(), except all echo-able data is passed through
* html::chars()
*
* @param string variable name or an array of variables
* @param mixed value
* @return $this
*/
public function set($key, $value = NULL)
{
if (is_array($key))
{
foreach ($key as $name => $value)
{
$this->set($name, $value);
}
}
else
{
if ( ! (is_object($value) OR is_array($value)))
$this->_data[$key] = html::chars($value);
else
$this->_data[$key] = $value;
$this->_orig_data['o_'.$key] = $value;
}
return $this;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment