Skip to content

Commit

Permalink
whatever i changed
Browse files Browse the repository at this point in the history
  • Loading branch information
crutchy- committed May 3, 2015
1 parent 76a30cd commit c548362
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 18 deletions.
32 changes: 15 additions & 17 deletions scripts/link.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,21 +63,7 @@
}
else
{
if (isset($list[$trailing])==True)
{
$value=$list[$trailing];
privmsg(" └─ $trailing => $value");
return;
}
# TODO: ALLOW USE OF PCRE DELIMITERS & MODIFIERS
# http://php.net/manual/en/reference.pcre.pattern.syntax.php
# http://php.net/manual/en/reference.pcre.pattern.modifiers.php
/*if ((substr($trailing,0,1)<>substr($trailing,strlen($trailing)-1,1)) or (strlen($trailing)==1))
{
$trailing="~".$trailing."~";
}*/
$trailing="~".$trailing."~";
$results=array_merge(preg_match_keys($trailing,$list),preg_match_values($trailing,$list));
$results=array_merge(match_keys($trailing,$list),match_values($trailing,$list));
$n=count($results);
if ($n>0)
{
Expand Down Expand Up @@ -116,11 +102,17 @@ function max_key_len($array)

#####################################################################################################

function preg_match_keys($pattern,$subject)
function match_keys($query,$subject)
{
$result=array();
foreach ($subject as $key => $value)
{
if (strpos(strtolower($key),strtolower($query))!==False)
{
$result[$key]=$value;
continue;
}
$pattern="~".$query."~";
if (preg_match($pattern,$key)==1)
{
$result[$key]=$value;
Expand All @@ -131,11 +123,17 @@ function preg_match_keys($pattern,$subject)

#####################################################################################################

function preg_match_values($pattern,$subject)
function match_values($query,$subject)
{
$result=array();
foreach ($subject as $key => $value)
{
if (strpos(strtolower($value),strtolower($query))!==False)
{
$result[$key]=$value;
continue;
}
$pattern="~".$query."~";
if (preg_match($pattern,$value)==1)
{
$result[$key]=$value;
Expand Down
2 changes: 1 addition & 1 deletion scripts/title.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
require_once("lib.php");
$trailing=trim($argv[1]);
$url=$trailing;
#$url=get_redirected_url($url);
$url=get_redirected_url($url);
if ($url===False)
{
term_echo("get_redirected_url=false");
Expand Down

0 comments on commit c548362

Please sign in to comment.