EasyLinks<\/a>/si',$HTML)){die('Please add the Powered by EasyLinks branding to your template!');} $XML=preg_replace('/.*?<\/id>/si','',load('easylinks.xml')); $links=untag($XML,'link',1); $categories=explode(',',getHTMLswitch($HTML,'categories')); if (!preg_match('/\*all\*/',$c) and !$s){ $HTML=delHTMLelement($HTML,"categorydisplay");} // Upper navigation $category=getHTMLelement($HTML,'categoriestop'); $catact=getHTMLelement($category,'active'); $catinact=getHTMLelement($category,'inactive'); $link=getHTMLelement($HTML,'link'); $compactlink=getHTMLelement($HTML,'compactlink'); $HTML=$d==1?delHTMLelement($HTML,'showdescriptions'):delHTMLelement($HTML,'hidedescriptions'); $HTML=delHTMLelement($HTML,'addownlink'); $cataddon=''; foreach ($categories as $cat){ if ($cat!=$c){ $catt=preg_replace('/=%%category%%/','='.urlencode($cat),$catinact); $catt=preg_replace('/%%category%%/',str_replace("*all*","",$cat),$catt); $cataddon.=$catt; }else{ $catt=preg_replace('/=%%category%%/','='.urlencode($cat),$catact); $catt=preg_replace('/%%category%%/',str_replace("*all*","",$cat),$catt); $cataddon.=$catt; } } $HTML=replaceHTMLelement($HTML,'categoriestop',$cataddon); // No search if (!$s){ $HTML=delHTMLelement($HTML,'searchnotfound'); // display all categories if(preg_match('/\*all\*/',$c)){ if ($links[0]!=''){ usort($links, 'strnatcmp'). $linkaddon=''; foreach ($links as $l){ $url =preg_match('/\/\//',untag($l,'url',0))?untag($l,'url',0) : 'http://'.untag($l,'url',0); if($d==1){ $thislink=preg_replace('/%%text%%/',untag($l,'text',0),$link); $thislink=preg_replace('/%%url%%/',$url,$thislink); $thislink=preg_replace('/%%description%%/',untag($l,'description',0),$thislink); $thislink=preg_replace('/%%category%%/',untag($l,'category',0),$thislink); $HTML=delHTMLelement($HTML,'compactlink'); $HTML=delHTMLelement($HTML,'nolinksfound'); }else{ $thislink=preg_replace('/%%text%%/',untag($l,'text',0),$compactlink); $thislink=preg_replace('/%%url%%/',$url,$thislink); $thislink=preg_replace('/%%description%%/',untag($l,'description',0),$thislink); $thislink=preg_replace('/%%category%%/',untag($l,'category',0),$thislink); $HTML=delHTMLelement($HTML,'nolinksfound'); $HTML=delHTMLelement($HTML,'link'); } $linkaddon.=$thislink; } } // display one category }else{ if($links[0]!=""){foreach ($links as $l){ if(untag($l,'category',0)==$c){$reallinks[]=$l;} }} $links=$reallinks; if($links[0]!=""){ usort($links, 'strnatcmp'). $linkaddon=''; foreach ($links as $l){ if($d==1){ $thislink=preg_replace('/%%text%%/',untag($l,'text',0),$link); $thislink=preg_replace('/%%url%%/',untag($l,'url',0),$thislink); $thislink=preg_replace('/%%description%%/',untag($l,'description',0),$thislink); $HTML=delHTMLelement($HTML,'nolinksfound'); $HTML=delHTMLelement($HTML,'compactlink'); }else{ $thislink=preg_replace('/%%text%%/',untag($l,'text',0),$compactlink); $thislink=preg_replace('/%%url%%/',untag($l,'url',0),$thislink); $thislink=preg_replace('/%%description%%/',untag($l,'description',0),$thislink); $HTML=delHTMLelement($HTML,'nolinksfound'); $HTML=delHTMLelement($HTML,'link'); } $linkaddon.=$thislink; } } else { $linkaddon=getHTMLelement($HTML,'nolinksfound'); $HTML=delHTMLelement($HTML,'compactlink'); $HTML=delHTMLelement($HTML,'link'); } } $HTML=replaceHTMLelement($HTML,'compactlink',$linkaddon); $HTML=replaceHTMLelement($HTML,'link',$linkaddon); $HTML=replaceHTMLelement($HTML,'nolinksfound',$linkaddon); // Search initiated }else{ $c="all"; usort($links, 'strnatcmp'). $linkaddon=''; foreach ($links as $l){ if( preg_match('/'.$s.'/si',untag($l,'text',0)) || preg_match('/'.$s.'/si',untag($l,'description',0))){ if($d==1){ $thislink=preg_replace('/%%text%%/',untag($l,'text',0),$link); $thislink=preg_replace('/%%url%%/',untag($l,'url',0),$thislink); $thislink=preg_replace('/%%description%%/',untag($l,'description',0),$thislink); $thislink=preg_replace('/%%category%%/',untag($l,'category',0),$thislink); $HTML=delHTMLelement($HTML,'compactlink'); $HTML=delHTMLelement($HTML,'nolinksfound'); }else{ $thislink=preg_replace('/%%text%%/',untag($l,'text',0),$compactlink); $thislink=preg_replace('/%%url%%/',untag($l,'url',0),$thislink); $thislink=preg_replace('/%%description%%/',untag($l,'description',0),$thislink); $thislink=preg_replace('/%%category%%/',untag($l,'category',0),$thislink); $HTML=delHTMLelement($HTML,'nolinksfound'); $HTML=delHTMLelement($HTML,'link'); } $linkaddon.=$thislink; $HTML=delHTMLelement($HTML,'searchnotfound'); } } $HTML=replaceHTMLelement($HTML,'compactlink',$linkaddon); $HTML=replaceHTMLelement($HTML,'link',$linkaddon); $HTML=replaceHTMLelement($HTML,'nolinksfound',$linkaddon); } // Bottom navigation $category=getHTMLelement($HTML,'categoriesbottom'); $catact=getHTMLelement($category,'active'); $catinact=getHTMLelement($category,'inactive'); $link=getHTMLelement($HTML,'link'); $compactlink=getHTMLelement($HTML,'compactlink'); $HTML=$d==1?delHTMLelement($HTML,'showdescriptions'):delHTMLelement($HTML,'hidedescriptions'); $cataddon=''; foreach ($categories as $cat){ if ($cat!=$c){ $catt=preg_replace('/=%%category%%/','='.urlencode($cat),$catinact); $catt=preg_replace('/%%category%%/',str_replace("*all*","",$cat),$catt); $cataddon.=$catt; }else{ $catt=preg_replace('/=%%category%%/','='.urlencode($cat),$catact); $catt=preg_replace('/%%category%%/',str_replace("*all*","",$cat),$catt); $cataddon.=$catt; } } $HTML=replaceHTMLelement($HTML,'categoriesbottom',$cataddon); // Clean up HTML, print out $HTML=preg_replace('/%%category%%/',urlencode($c),$HTML); $HTML=preg_replace('/%%d%%/',$d,$HTML); $HTML=preg_replace('/%%s%%/',$s,$HTML); $HTML=preg_replace('//si','',$HTML); $HTML=preg_replace('/\s\r\n/si','',$HTML); echo $HTML; ?>