<?php
echo "test";
/**
* @version $Id: mosdirections.php 2574 2006-02-23 18:48:16Z stingrey $
* @package Joomla
* @copyright Copyright (C) 2005 Open Source Matters. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
* Joomla! is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*/
// no direct access
defined( '_VALID_MOS' ) or die( 'Restricted access' );
$_MAMBOTS->registerFunction( 'onPrepareContent', 'botMosDirections' );
/**
* Code Highlighting Mambot
*
* <b>Usage:</b>
* <code>{moscode}...some code...{/moscode}</code>
*/
function botMosDirections( $published, &$row, &$params, $page=0 ) {
// simple performance check to determine whether bot should process further
if ( strpos( $row->text, 'mosdirections' ) === false ) {
return true;
}
// define the regular expression for the bot
$regex = "#{mosdirections}(.*?){/mosdirections}#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, 'botMosDirections_replacer', $row->text );
return true;
}
/**
* Replaces the matched tags an image
* @param array An array of matches (see preg_match_all)
* @return string
*/
function botMosDirections_replacer( &$matches ) {
$text = $matches[1];
$mdarr = preg_split('/, |=/', $matches[1], -1);
for ( $x = 0, $newarr = array() ; $x < count($mdarr) ; $x += 2 ) { $newarr[$mdarr[$x]] = $mdarr[$x + 1]; }
print_r($newarr);
$text = ("<b>".$newarr['test1']."</b>" );
return $text;
}
?>