Created
November 18, 2015 14:12
-
-
Save geggleto/dd076d71f3c01875d92e to your computer and use it in GitHub Desktop.
production code atm
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function ew_GetKeyword(&$src, &$kwlist, &$x, &$y, &$kw) { | |
| $thisy = -1; | |
| $thiskw = ""; | |
| foreach ($kwlist as $wrkkw) { | |
| $wrkkw = trim($wrkkw); | |
| if (EW_HIGHLIGHT_COMPARE) { // Case-insensitive | |
| if (function_exists('stripos')) { // PHP 5 | |
| $wrky = stripos($src, $wrkkw, $x); | |
| } else { | |
| $wrky = strpos(strtoupper($src), strtoupper($wrkkw), $x); | |
| } | |
| } else { | |
| $wrky = strpos($src, $wrkkw, $x); | |
| } | |
| if ($wrky !== FALSE) { | |
| if ($thisy == -1) { | |
| $thisy = $wrky; | |
| $thiskw = $wrkkw; | |
| } elseif ($wrky < $thisy) { | |
| $thisy = $wrky; | |
| $thiskw = $wrkkw; | |
| } | |
| } | |
| } | |
| $y = $thisy; | |
| $kw = $thiskw; | |
| } | |
| ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment