/** * Call the Magic Tabs function * * Method is called by the view * * @param object The article object. Note $article->text is also available * @param object The article params * @param int The 'page' number */ function onPrepareContent(&$article, &$params, $limitstart = 0) { // regular expression $regex = "#{magictabs(?:\\s?(.*?)?)?}(.*?){/magictabs}#is"; if (!preg_match($regex, $article->text)) { return false; } // Scriptegrator check if (!class_exists('JScriptegrator')) { JError::raiseNotice('', JText::_('CDMT_ENABLE_SCRIPTEGRATOR')); return false; } else { $message = JScriptegrator::check('1.3.8', 'jquery', 'site'); if ($message) { JError::raiseNotice('', $message); return false; } } $document =& JFactory::getDocument(); // set document for next usage $live_path = JURI::base(true) . '/'; // define live site // $document->addScript($live_path."plugins/system/cdscriptegrator/libraries/jquery/js/ui/ui.tabs.js"); // $document->addScript($live_path."plugins/system/cdscriptegrator/libraries/jquery/js/ui/ui.core.js"); $document->addStyleSheet($live_path . 'plugins/content/cdmagictabs/css/cdmagictabs.css', 'text/css'); // add general stylesheet JScriptegrator::importUI('ui.tabs'); // Explication: // $match[1] -> parameters // $match[2] -> text to tabs // replacement regular expression $article->text = preg_replace_callback($regex, array($this, 'replacer'), $article->text); }