PDA

View Full Version : URL length Mod


paul41598
07-21-2005, 11:48 AM
Can anyone code it so theres an text field in admincp, to choose the lengfth of URL
?


heck if thats not possible, then help me with the code. I want only admins to be able to use longer URLs.


if ($bbuserinfo[usergroupid] == "6") {
if (!trim($link) OR $text == $rightlink)
{
$tmp = unhtmlspecialchars($rightlink);
if (strlen($tmp) > 105 AND !$wysiwygparse)
{
$text = htmlspecialchars_uni(substr($tmp, 0, 35) . '...' . substr($tmp, -15));
}
}
}

else {
if (!trim($link) OR $text == $rightlink)
{
$tmp = unhtmlspecialchars($rightlink);
if (strlen($tmp) > 55 AND !$wysiwygparse)
{
$text = htmlspecialchars_uni(substr($tmp, 0, 35) . '...' . substr($tmp, -15));
}
}

}

Marco van Herwaarden
07-21-2005, 07:09 PM
Create a new vBulletin Option called 'max_url_display' and set it to the length you want.
then use the following:
if ($bbuserinfo[usergroupid] == "6") {
if (!trim($link) OR $text == $rightlink)
{
$tmp = unhtmlspecialchars($rightlink);
if (strlen($tmp) > 105 AND !$wysiwygparse)
{
$text = htmlspecialchars_uni(substr($tmp, 0, 35) . '...' . substr($tmp, -15));
}
}
}

else {
if (!trim($link) OR $text == $rightlink)
{
$tmp = unhtmlspecialchars($rightlink);
if (strlen($tmp) > $vboption['max_url_lenght'] AND !$wysiwygparse)
{
$text = htmlspecialchars_uni(substr($tmp, 0, $vboption['max_url_lenght'] - 20) . '...' . substr($tmp, -15));
}
}

}Not tested.