Thanks to BRATS-SplatterGuts, he pointed out a glitch that I haven't come across and now I'm trying to fix. It seems to only affect the custom xcode tags, but I'm running into some trouble.
Just to highlight the issue...
For example, if you search the forum for "targetname" (without quotes), you will get results. One of the first results you should get is the thread "Teleport help for Dude" when you click the thread and look at the first post with the [xcode] tags, you will notice this
local.trig targetname port1
display as
local.trig <span class="highlight">targetname</span> port1
This is because the word we searched for in the forums matches the word in the xcode tags so it highlights it, and the embedded code to highlight is
Code:
<span class="highlight">some text</span>
furthermore, if you look at the class in the css you will see
.highlight {
color: #417394;
background: #FFEB90 none repeat-x ;
}
Any way... The "simple", but annoying fix is, when you do a search for that keyword, it appends "?highlight=keyword" to the URL of the thread.
In our case
http://www.x-null.net/forums/showthr...ght=targetname
So it tries to highlight the word wherever it is displayed in that thread.
What I'm trying to do is fix this glitch.
What we know is the thread results are displayed in "showthread.php", so after some searching I have come across this function
// *********************************************************************************
// words to highlight from the search engine
if (!empty($vbulletin->GPC['highlight']))
{
$highlight = preg_replace('#\*+#s', '*', $vbulletin->GPC['highlight']);
if ($highlight != '*')
{
$regexfind = array('\*', '\<', '\>');
$regexreplace = array('[\w.:@*/?=]*?', '<', '>');
$highlight = preg_quote(strtolower($highlight), '#');
$highlight = explode(' ', $highlight);
$highlight = str_replace($regexfind, $regexreplace, $highlight);
foreach ($highlight AS $val)
{
if ($val = trim($val))
{
$replacewords[] = htmlspecialchars_uni($val);
}
}
}
}
This line:
$replacewords[] = htmlspecialchars_uni($val);
...is what does the highlighting of the keyword, so I need to put in a line somewhere within the foreach() (I'm assuming).
My issue is I'm not sure how to do this. I tried this
Code:
//preg_match_all('/[[\s]*xcode=[\s]*' . '[\s]*content="?[0-9]*;[\s]*URL[\s]*=[\s]*([^]"]*)"?' . '[\s]*[\/]?[\s]*>/si', $contents, $match);
preg_match('/[xcode=*', $val, $match );
if(isset(tag_list['option']["$tagname"]['xcode']))
if(isset(tag_list['option']["$pre_tag"]))
The results are it either highlights keywords, or I break something and it doesn't highlight anything at all.
Any suggestions?