Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'master' of github.com:pyrocms/pyrocms

  • Loading branch information...
commit 7f0af42d2f1244bfbb3cac4e66d63840ef1b0ee0 2 parents ddeddff + 345ce27
@dhrrgn dhrrgn authored
View
2  README.textile
@@ -2,7 +2,7 @@ h1. PyroCMS
* Website: "http://pyrocms.com/":http://pyrocms.com/
* Documentation: "http://pyrocms.com/documentation":http://pyrocms.com/documentation
-* Version: 0.9.9.6-dev
+* Version: 0.9.9.6
h2. The Team
View
2  application/config/constants.php
@@ -123,7 +123,7 @@
|
*/
-define('CMS_DATE', '19/07/2010');
+define('CMS_DATE', '22/07/2010');
/* End of file constants.php */
/* Location: ./system/application/config/constants.php */
View
2  application/controllers/upgrade.php
@@ -80,7 +80,7 @@ function upgrade_0996()
$this->db->where('slug', 'pages');
$this->db->update('modules', array('skip_xss' => 1));
- return FALSE; // Change this when we go live
+ return TRUE;
}
function upgrade_0995()
View
90 application/libraries/Template.php
@@ -39,7 +39,6 @@ class Template
private $_metadata = array();
private $_partials = array();
- private $_injected = array();
private $_breadcrumbs = array();
@@ -64,12 +63,13 @@ class Template
*/
function __construct($config = array())
{
+ $this->_ci =& get_instance();
+
if (!empty($config))
{
$this->initialize($config);
}
- $this->_ci =& get_instance();
log_message('debug', 'Template class Initialized');
// Work out the controller and method
@@ -102,6 +102,11 @@ function initialize($config = array())
{
$this->_theme_locations = array(APPPATH . 'themes/' => '../themes/');
}
+
+ if ($this->_parser_enabled === TRUE)
+ {
+ $this->_ci->load->library('parser');
+ }
}
// --------------------------------------------------------------------
@@ -135,7 +140,23 @@ public function build($view = '', $data = array(), $return = FALSE)
foreach( $this->_partials as $name => $partial )
{
- $template['partials'][$name] = $this->_load_view( $partial['view'] , $partial['search']);
+ // If its an array, use details to find it.
+ if (isset($partial['view']))
+ {
+ $template['partials'][$name] = $this->_load_view($partial['view'], $partial['search']);
+ }
+
+ // Otherwise, jam that bloody string in!
+ else
+ {
+ if($this->_parser_enabled === TRUE)
+ {
+ $partial['string'] = $this->_ci->parser->parse_string($partial['string'], $this->data + $partial['data'], TRUE, TRUE);
+ }
+
+ $template['partials'][$name] = $partial['string'];
+ }
+
}
// Disable sodding IE7's constant cacheing!!
@@ -175,13 +196,12 @@ public function build($view = '', $data = array(), $return = FALSE)
// Parse if parser is enabled, or its a theme view
if($this->_parser_enabled === TRUE || $this->_theme)
{
- $this->_ci->load->library('parser');
- $this->_body = $this->_ci->parser->parse( $layout_view, $this->data, TRUE );
+ $this->_body = $this->_ci->parser->parse($layout_view, $this->data, TRUE, TRUE);
}
else
{
- $this->_body = $this->_ci->load->view( $layout_view, $this->data, TRUE );
+ $this->_body = $this->_ci->load->view($layout_view, $this->data, TRUE);
}
}
@@ -266,16 +286,14 @@ public function set_metadata($name, $content, $type = 'meta')
switch($type)
{
case 'meta':
- $meta = '<meta name="'.$name.'" content="'.$content.'" />';
+ $this->_metadata[$name] = '<meta name="'.$name.'" content="'.$content.'" />';
break;
case 'link':
- $meta = '<link rel="'.$name.'" href="'.$content.'" />';
+ $this->_metadata[$content] = '<link rel="'.$name.'" href="'.$content.'" />';
break;
}
- $this->append_metadata($meta);
-
return $this;
}
@@ -316,61 +334,24 @@ public function set_layout($view = '')
* @param boolean
* @return void
*/
- public function set_partial( $name, $view, $search = TRUE )
+ public function set_partial($name, $view, $search = TRUE)
{
$this->_partials[$name] = array('view' => $view, 'search' => $search);
return $this;
}
-
/**
- * Returns a partial
- *
- * Instead of evaluating the partial internally
- * this method returns the value of the partial
- * in order for you to perform your own logic
- * on it, caching for instance.
- *
- * WARNING: Any variables pushed to the template
- * library after this point will NOT be available
- * in the specified partial, as it is parsed
- * immediately!
- *
- * @author Per Sikker Hansen <lord@heavenquake.net>
- * @access public
- * @param string
- * @param boolean
- * @return string
- */
- public function return_partial( $view, $data = array(), $search = TRUE )
- {
- $this->data = array_merge($this->data, $data);
- return $this->_load_view( $view, $search );
- }
-
-
- /**
- * Inject output data directly
- *
- * Intended for use with data prepped after
- * return_partial(), but possible to use for
- * other purposes. Injects the data directly
- * into the partial tree.
- *
- * WARNING: Any variables pushed to the template
- * library after the injection will NOT be
- * available in the data you have injected as
- * the data is already parsed!
+ * Set a view partial
*
- * @author Per Sikker Hansen <lord@heavenquake.net>
* @access public
* @param string
* @param string
+ * @param boolean
* @return void
*/
- public function inject_partial( $name, $data )
+ public function inject_partial($name, $string, $data = array())
{
- $this->_injected[$name] = $data;
+ $this->_partials[$name] = array('string' => $string, 'data' => $data);
return $this;
}
@@ -455,7 +436,7 @@ public function add_theme_location($location, $offset)
public function theme_exists($theme = NULL)
{
$theme || $theme = $this->_theme;
-
+
foreach ($this->_theme_locations as $location => $offset)
{
if( is_dir($location.$theme) )
@@ -525,7 +506,6 @@ private function _load_view($view = '', $search = TRUE, $parse_view = TRUE)
{
if($this->_parser_enabled === TRUE && $parse_view === TRUE)
{
- $this->_ci->load->library('parser');
return $this->_ci->parser->parse( $view, $this->data, TRUE );
}
@@ -546,7 +526,6 @@ private function _load_view($view = '', $search = TRUE, $parse_view = TRUE)
{
if($this->_parser_enabled === TRUE && $parse_view === TRUE)
{
- $this->_ci->load->library('parser');
return $this->_ci->parser->parse( $offset.$theme_view, $this->data, TRUE );
}
@@ -561,7 +540,6 @@ private function _load_view($view = '', $search = TRUE, $parse_view = TRUE)
// Not found it yet? Just load, its either in the module or root view
if($this->_parser_enabled === TRUE && $parse_view === TRUE)
{
- $this->_ci->load->library('parser');
return $this->_ci->parser->parse( $this->_module.'/'.$view, $this->data, TRUE );
}
Please sign in to comment.
Something went wrong with that request. Please try again.