PDA

View Full Version : Trying to underline via bb-code... (Using Kalls NO-FOLLOW Plug-in)


Razasharp
10-06-2005, 06:44 PM
I want to underline all links via BBcode which I can do it by modifying the php file, however I'd much prefer to use plug-ins because it makes upgrading a whole lot easier :)

I've seen Kalls plug-in for for adding the no-follow attribute and so thought I could bolt on the underlines to it. As Kall hasn't checked the 'supported' box in his thread I thought I'd be better post here.

Kalls plug-in and xml code is as follows:

<?xml version="1.0" encoding="ISO-8859-1"?>

<plugins>
<plugin active="1" product="vbulletin">
<title>nofollow</title>
<hookname>bbcode_create</hookname>
<phpcode><![CDATA[$this->tag_list['no_option']['url']['callback'] = 'handle_external';
$this->tag_list['no_option']['url']['external_callback'] = 'handle_bbcode_url_relnofollow';
$this->tag_list['option']['url']['callback'] = 'handle_external';
$this->tag_list['option']['url']['external_callback'] = 'handle_bbcode_url_relnofollow';

if (!function_exists('handle_bbcode_url_relnofollow') )
{
function handle_bbcode_url_relnofollow(&$parser, $text, $link)
{
global $post;
// Excempt Mods+ and Users with mor then 50 Posts
$parsedurl = $parser->handle_bbcode_url($text, $link);
if (is_member_of($post, 5, 6, 7) OR $post['posts'] > 50)
{
return $parsedurl;
}
else
{
return str_replace('href="', 'rel="nofollow" href="', $parsedurl);
}
}
}]]></phpcode>
</plugin>
</plugins>



I'm trying to modify it to add an underline to the links (but also have taken out the If statement as I'd rather the no-follow affect all urls), so far I've tried the below - Am I close? it doesn't work :( Please help!


(bits I've added in bold -probably totally off, but least Im trying!)

--------------
---------------


$this->tag_list['no_option']['url']['callback'] = 'handle_external';
$this->tag_list['no_option']['url']['external_callback'] = 'handle_bbcode_url_relnofollow';
$this->tag_list['option']['url']['callback'] = 'handle_external';
$this->tag_list['option']['url']['external_callback'] = 'handle_bbcode_url_relnofollow';

if (!function_exists('handle_bbcode_url_relnofollow') )
{
function handle_bbcode_url_relnofollow(&$parser, $mystyleunderline, $text, $link)
{
global $post;

$mystyleunderline = style=\"text-decoration:underline\"

$parsedurl = $parser->handle_bbcode_url($mystyleunderline, $text, $link);

return str_replace('href="', 'rel="nofollow" href="', $parsedurl);

}
}

--------------


Hope someone can help!

ggggggggggggggggggggggggggot it!!!!!!!!!!!!!! :lol:

I surprised myself! got my book out and looked up some stuff and wah hey!

return str_replace('href="', 'rel="nofollow" style="text-decoration:underline" href="', $parsedurl);

did the trick!