htmlawed core plugin

Hi,

I would like my htmlawed plugin to add a "rel='nofollow'" attribute to all urls on my website instead of removing all 'a' tags.

According to an instruction I rewrited my /mod/htmlawed/start.php file. I added two lines to the default htmlawed_init() function.

    $CONFIG->htmlawed_config = array(
            // seems to handle about everything we need.
            'safe' => true,
            'deny_attribute' => 'class, on*',
            'hook_tag' => 'htmlawed_hook',
            'elements' => 'a, em, strong, p, br',
            'anti_link_spam' => array("/.*/", "/://\W*(?!(abc\.com|xyz\.org))/"),
            'schemes' => '*:http,https,ftp,news,mailto,rtsp,teamspeak,gopher,mms,callto'
                // apparent this doesn't work.
                //. 'style:color,cursor,text-align,font-size,font-weight,font-style,border,margin,padding,float'
        );

The new lines are

    'elements' => 'a, em, strong, p, br',
    'anti_link_spam' => array("/.*/", "/://\W*(?!(abc\.com|xyz\.org))/"),

Nothing changed. I discovered that my mod/htmlawed/vendors/htmLawed/htmLawedTest.php is working properly with these settings.

I discovered one more thing: when I am debugging the code I can see that in my function hl_tag($t)
variable $C['elements'] contains only three elements (object, embed, param) when I am debugging my application
and 86 elements (with 'a' element) when I am debugging the htmLawedTest.php - maybe there is a problem with this?

Regards,
Robert

  • Something like that is working - if anybody's interested:

    function htmlawed_init() {
        global $CONFIG;
        $CONFIG->htmlawed_config = array(
            'safe' => true,
            'deny_attribute' => 'class, on*',
            'hook_tag' => 'htmlawed_hook',
            'anti_link_spam'=>array('`.`', ''),
            'schemes' => '*:http,https,ftp,news,mailto,rtsp,teamspeak,gopher,mms,callto',
            'elements'=>'object, embed, param, b, i, ul,li, u, img, alt, a, blockquote, span,style, p, strong, em, s, ol, br'
        );

        register_plugin_hook('validate', 'input', 'htmlawed_filter_tags', 1);
    }