[How to] Add nofollow attribute to URL tags in messages/post/topic content

Started by Xhanch Studio, March 12, 2011, 01:00:39 AM

previous topic - next topic
Go Down

Xhanch Studio

To add rel="nofollow" attribute to URL tag (BBC code) in messages/post/topic content, you need to edit Sources/Subs.php.

Around line 1598, find these codes:

Code Select
array(
    'tag' => 'url',
    'type' => 'unparsed_content',
    'content' => '<a href="$1" class="bbc_link" target="_blank">$1</a>',
    'validate' => create_function('&$tag, &$data, $disabled', '
        $data = strtr($data, array(\'<br />\' => \'\'));
        if (strpos($data, \'http://\') !== 0 && strpos($data, \'https://\') !== 0)
            $data = \'http://\' . $data;
    '),
),
array(
    'tag' => 'url',
    'type' => 'unparsed_equals',
    'before' => '<a href="$1" class="bbc_link" target="_blank">',
    'after' => '</a>',
    'validate' => create_function('&$tag, &$data, $disabled', '
        if (strpos($data, \'http://\') !== 0 && strpos($data, \'https://\') !== 0)
            $data = \'http://\' . $data;
    '),
    'disallow_children' => array('email', 'ftp', 'url', 'iurl'),
    'disabled_after' => ' ($1)',
),


and change it to

Code Select
array(
    'tag' => 'url',
    'type' => 'unparsed_content',
    'content' => '<a href="$1" class="bbc_link" target="_blank" rel="nofollow">$1</a>',
    'validate' => create_function('&$tag, &$data, $disabled', '
        $data = strtr($data, array(\'<br />\' => \'\'));
        if (strpos($data, \'http://\') !== 0 && strpos($data, \'https://\') !== 0)
            $data = \'http://\' . $data;
    '),
),
array(
    'tag' => 'url',
    'type' => 'unparsed_equals',
    'before' => '<a href="$1" class="bbc_link" target="_blank" rel="nofollow">',
    'after' => '</a>',
    'validate' => create_function('&$tag, &$data, $disabled', '
        if (strpos($data, \'http://\') !== 0 && strpos($data, \'https://\') !== 0)
            $data = \'http://\' . $data;
    '),
    'disallow_children' => array('email', 'ftp', 'url', 'iurl'),
    'disabled_after' => ' ($1)',
),
Best Regards,
Susanto B.Sc
----------------------------------------------------------------------------
Web development services, WordPress plugin and theme development, PSD to XHTML conversion - http://xhanch.com
Read free manga online - http://authrone.com

Go Up