I am performing out buffereing in a wordpress site. I developed using OOP (MVC) structure. My code for buffering section is
Class RPController{
public function __construct()
{
add_action('wp_head', array($this,'rpl_buffer_start'));
add_action('wp_footer', array($this,'rpl_buffer_end'));
}
public function rpl_buffer_start()
{
ob_start(array($this,"rpl_callback"));
}
public function rpl_buffer_end()
{
ob_end_flush();
}
public function rpl_callback($buffer)
{
$data = get_option('rpl_form_data');
if(isset($data)):
for ($i=0; $i < count($data['rimg']); $i++)
{
$buffer = str_replace($data['oimg'][$i], $data['rimg'][$i], $buffer);
}
endif;
return $buffer;
}
}
$RPController = new RPController();
its not buffereing the output.
the data
from db is saved in the foolowing format a 2 dimetional array
Array ( [oimg] => Array ( [0] => RightStyle Profile [1] => Admin Test ) [rimg] => Array ( [0] => Profile [1] => Test ) )
When i manually create this kind of array not from db , this buffering works perfectly fine.
Can anyone tell me why this is not working on db data ?