Skip to content

Commit

Permalink
Remove buffering :'(
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew Powers committed Mar 21, 2012
1 parent d32596e commit 14ec883
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 47 deletions.
100 changes: 56 additions & 44 deletions includes/class.template.php
Original file line number Diff line number Diff line change
Expand Up @@ -394,60 +394,58 @@ function print_section_html( $hook ){
foreach( $this->$hook as $key => $sid ){

/**
* Check for buffered version, use if that exists; then unset.
* This goes through and buffers sections so we can add classes to sections that 'tell the future'
* proved to be extremely hard to implement, and harder to work w/ all wp plugins (get_sidebars conflict)
* Leaving here for now, enabled by action.
* Original idea was for themers to use classes based on adjacent sections to style, instead, recommend using section hooks + options
*
*/
if(isset($plbuffer[$sid])){
$render = $plbuffer[$sid];
unset($plbuffer[$sid]);
}else
$render = $this->buffer_template($sid);



// RENDER //
if($render){

//$this->render_template($render, $sid, $markup_type);
if( has_action('buffer_sections') ){

/**
* Check for buffered version, use if that exists; then unset.
*/
if(isset($plbuffer[$sid])){
$render = $plbuffer[$sid];
unset($plbuffer[$sid]);
}else
$render = $this->buffer_template($sid);

// RENDER //
if($render){

//$this->render_template($render, $sid, $markup_type);

// PREVIOUS //
$last_sid = $this->get_last_rendered($hook);

// NEXT //
$next_sid = $this->buffer_next_section($hook, $key, $sid);

// DRAW APPROPRIATE SECTION //
$this->render_template($render, $sid, $markup_type, $this->conc($sid, $next_sid), $this->conc($sid, $last_sid, 'previous'));

// SET AS LAST RENDERED //
$this->last_rendered = array('sid' => $sid, 'hook' => $hook);

}

// PREVIOUS //
$last_sid = $this->get_last_rendered($hook);

// NEXT //
$next_sid = $this->buffer_next_section($hook, $key, $sid);
} else {

// DRAW APPROPRIATE SECTION //
$this->render_template($render, $sid, $markup_type, $this->conc($sid, $next_sid), $this->conc($sid, $last_sid, 'previous'));
$render = $this->buffer_template( $sid );

if($render)
$this->render_template($render, $sid, $markup_type);

// SET AS LAST RENDERED //
$this->last_rendered = array('sid' => $sid, 'hook' => $hook);

}

}


}
}

function get_last_rendered($hook){

$order = array('header', 'templates', 'morefoot', 'footer');

$k = array_search($hook, $order);


if($k && isset($this->last_rendered)){
return $this->last_rendered['sid'];
} elseif(isset($this->last_rendered) && ($hook == $this->last_rendered['hook'])){
return $this->last_rendered['sid'];
} else {
return 'top';
}

}



/**
* Renders the HTML template and adds surrounding 'standardized' markup and hooks
*/
Expand Down Expand Up @@ -518,6 +516,22 @@ function buffer_template( $sid ){

}

function get_last_rendered($hook){

$order = array('header', 'templates', 'morefoot', 'footer');

$k = array_search($hook, $order);


if($k && isset($this->last_rendered)){
return $this->last_rendered['sid'];
} elseif(isset($this->last_rendered) && ($hook == $this->last_rendered['hook'])){
return $this->last_rendered['sid'];
} else {
return 'top';
}

}
/**
* Concatenation used in classes
*/
Expand Down Expand Up @@ -601,8 +615,6 @@ function next_section($hook, $key){
}




return $data;

}
Expand Down
3 changes: 1 addition & 2 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,5 @@
* @todo Update inline documentation
* @todo Define dates of releases; add to changelog?
*/
?>

<?php setup_pagelines_template();
setup_pagelines_template();
1 change: 0 additions & 1 deletion sections/content/section.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ class PageLinesContent extends PageLinesSection {
*/
function section_template() {
global $pagelines_layout;

?>
<div id="pagelines_content" class="<?php echo $pagelines_layout->layout_mode;?> fix">

Expand Down

0 comments on commit 14ec883

Please sign in to comment.