Crazy Custom iFrame Code

This was found in a plugin and used as a way to create a custom iFrame. To be perfectly honest, I’m not even entirely sure what all of this does, but I assure you it is not the best way to do it:

global $wpdb;
require( dirname( __FILE__ ) .'../../../../wp-load.php');

	$html=get_option('xyz_lbx_html');


$pattern1='/(.*)/is';
if(!preg_match($pattern1,$html))
{
	$html=''.$html;//
}
$pattern2='/(.*?)(.*?)/is';
if(!preg_match($pattern2,$html))
{
$html=preg_replace('/(.*)/is','$2',$html);	
}
$pattern3='/(.?)(.*?)(.*?)(.*?)/is';
if(!preg_match($pattern3,$html))
{
	$html=preg_replace('/(.*?)(.*?)/is','$1$3',$html);	
}
// else {
// 	$html=preg_replace('/(.*?)(.*?)(.*?)(.*?)/is','$1$3$4$5',$html);
// }
$pattern4='/(.*?)(.*?)(.*?)(.*)/is';
if(!preg_match($pattern4,$html))
{
	$html=preg_replace('/(.*?)(.*?)/is','$1$2',$html);	
}
preg_match('/(.*?)(.*?)(.*?)(.*?)(.*)/is',$html,$matches);

echo $matches[1].'';
wp_head();
echo $matches[2].'html,* html body {padding:0 !important;margin: 0 !important;}'.$matches[3].'';
echo do_shortcode($matches[5]);
echo '';
echo $matches[6];
// echo '';

Submitted by Chris McCoy.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s