Could this be solve by just including a target="_top" or target="_blank" ? and if so where should be put? Here is the code:
Code:
<?php
/**
* @copyright Copyright (C) 2006 Kause Lotski. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
*/
// no direct access
defined( '_VALID_MOS' ) or die( 'Restricted access' );
$_MAMBOTS->registerFunction( 'onPrepareContent', 'botcomponentbot' );
function botcomponentbot( $published, &$row, &$params, $page=0 ) {
// simple performance check to determine whether bot should process further
if ( strpos( $row->text, 'component' ) === false ) {
return true;
}
// define the regular expression for the bot
$regex = "#{component}(.*?){/component}#s";
// check whether mambot has been unpublished
if ( !$published ) {
$row->text = preg_replace( $regex, '', $row->text );
return true;
}
// perform the replacement
$row->text = preg_replace_callback( $regex, 'botComponentCode_replacer', $row->text );
return true;
}
/**
* Replaces the matched tags an image
* @param array An array of matches (see preg_match_all)
* @return string
*/
function botComponentCode_replacer( &$matches ) {
global $database ;
$query = "SELECT params"
. "\n FROM #__mambots"
. "\n WHERE element = 'componentbot'"
. "\n AND folder = 'content'"
;
$database->setQuery( $query );
$database->loadObject($mambot);
$botParams = new mosParameters( $mambot->params );
$height = $botParams->def( 'height', '500' );
$width = $botParams->def( 'width', '500' );
$url = $matches[1];
$url = 'index2.php?' . $url;
$para = 'id="expose" '.
'src="'.$url.'" '.
'width="'.$width.'" '.
'height="'.$height.'" '.
'frameborder="0" '.
'allowtransparency="true" '.
'scrolling="no" ';
$url = "<iframe ".$para.">\n".
"<p>Sorry, your browser cannot display frames!</p>\n".
"</iframe>\n";
return $url;
}
?>