I have "written" a plugin for Joomla! I say "written" because it is actually someone else's, but it was for Joomla 1.5, and I'm trying to upgrade it to run in Joomla 1.7. However, it's installed and it doesn't want to run. I have tried making it generate an error out of nothing, but it wouldn't give me anything. I'm not even sure if it is Joomla 1.7 code or not, but I'm hoping you could help with that too.
<?php
// no direct access
defined( '_VALID_MOS' ) or die( 'Restricted access' );
jimport('joomla.plugin.plugin');
class plgContentRegisteredTags extends JPlugin
{
function plgContentRegisteredTags (&$subject, $params)
{
parent::__construct($subject,$params);
}
function onPrepareContent ( $context, &$article, &$params, $page=0 )
{
global $mainframe;
//if ( !$published ) return true;
// define the regular expression for the bot
$regex1 = "#{reg}(.*?){/reg}#s";
$regex2 = "#{noreg}(.*?){/noreg}#s";
// perform the replacement
$article->text = preg_replace_callback(
$regex1,
create_function(
'$matches',
'global $my;
if($my->id) return $matches[1];
return "";'
),
$article->text
);
$article->text = preg_replace_callback(
$regex2,
create_function(
'$matches',
'global $my;
if(!$my->id) return $matches[1];
return "";'
),
$article->text
);
return true;
}
}
Note: it just doesn't want to run at all (no error, no code execution), even though it is enabled and installed.
Any help would be appreciated.
componentname.php. So it would beregisteredtags.phpinstead ofhelloworld.php. - Nobody moving away from SEmy.domain/index.php?option=com_registeredtags. But from your definition it sounds like you want to have a plugin instead of a component? - Nobody moving away from SE