@@ -96,20 +96,20 @@ discard block |
||
| 96 | 96 | //Need to check capitalisation of terms suggested that are different |
| 97 | 97 | |
| 98 | 98 | $chr = mb_substr ($possiblyUppercase, 0, 1, "UTF-8"); |
| 99 | - if (mb_strtolower($chr, "UTF-8") != $chr) { |
|
| 100 | - $upperLowercaseWord = $lowercaseWord; |
|
| 101 | - $upperLowercaseWord[0] = $chr; |
|
| 102 | - $withHighlights = str_replace($lowercaseWord, $upperLowercaseWord, $possiblyUppercaseHighlighted); |
|
| 103 | - $lowercaseWord[0] = $chr; |
|
| 104 | - array_push($plain, $lowercaseWord); |
|
| 105 | - array_push($highlighted, $withHighlights); |
|
| 106 | - } else { |
|
| 107 | - //No need to capitalise, so add suggested word |
|
| 108 | - array_push($plain, $lowercaseWord); |
|
| 109 | - |
|
| 110 | - //No need to capitalise, so add suggested highlighted word |
|
| 111 | - array_push($highlighted, $possiblyUppercaseHighlighted); |
|
| 112 | - } |
|
| 99 | + if (mb_strtolower($chr, "UTF-8") != $chr) { |
|
| 100 | + $upperLowercaseWord = $lowercaseWord; |
|
| 101 | + $upperLowercaseWord[0] = $chr; |
|
| 102 | + $withHighlights = str_replace($lowercaseWord, $upperLowercaseWord, $possiblyUppercaseHighlighted); |
|
| 103 | + $lowercaseWord[0] = $chr; |
|
| 104 | + array_push($plain, $lowercaseWord); |
|
| 105 | + array_push($highlighted, $withHighlights); |
|
| 106 | + } else { |
|
| 107 | + //No need to capitalise, so add suggested word |
|
| 108 | + array_push($plain, $lowercaseWord); |
|
| 109 | + |
|
| 110 | + //No need to capitalise, so add suggested highlighted word |
|
| 111 | + array_push($highlighted, $possiblyUppercaseHighlighted); |
|
| 112 | + } |
|
| 113 | 113 | } |
| 114 | 114 | } |
| 115 | 115 | |
@@ -140,38 +140,38 @@ discard block |
||
| 140 | 140 | */ |
| 141 | 141 | public static function parseSuggestionExplanation($explanation) { |
| 142 | 142 | $explanation = explode('-ConstantScore', $explanation)[0]; |
| 143 | - $bracketPos = strpos($explanation, ')~'); |
|
| 143 | + $bracketPos = strpos($explanation, ')~'); |
|
| 144 | 144 | |
| 145 | - if (substr($explanation, 0,2) == '((') { |
|
| 146 | - $explanation = substr($explanation, 2, $bracketPos-2); |
|
| 147 | - } elseif (substr($explanation, 0,1) == '(') { |
|
| 148 | - $explanation = substr($explanation, 1, $bracketPos-2); |
|
| 149 | - } |
|
| 145 | + if (substr($explanation, 0,2) == '((') { |
|
| 146 | + $explanation = substr($explanation, 2, $bracketPos-2); |
|
| 147 | + } elseif (substr($explanation, 0,1) == '(') { |
|
| 148 | + $explanation = substr($explanation, 1, $bracketPos-2); |
|
| 149 | + } |
|
| 150 | 150 | |
| 151 | - $terms = array(); |
|
| 151 | + $terms = array(); |
|
| 152 | 152 | |
| 153 | - //Field name(s) => terms |
|
| 154 | - $splits = explode(' ', $explanation); |
|
| 153 | + //Field name(s) => terms |
|
| 154 | + $splits = explode(' ', $explanation); |
|
| 155 | 155 | |
| 156 | - foreach ($splits as $fieldAndTerm) { |
|
| 157 | - $splits = explode(':', $fieldAndTerm); |
|
| 156 | + foreach ($splits as $fieldAndTerm) { |
|
| 157 | + $splits = explode(':', $fieldAndTerm); |
|
| 158 | 158 | |
| 159 | - // This is the no terms case |
|
| 160 | - if (sizeof($splits) < 2) { |
|
| 161 | - break; |
|
| 162 | - } |
|
| 159 | + // This is the no terms case |
|
| 160 | + if (sizeof($splits) < 2) { |
|
| 161 | + break; |
|
| 162 | + } |
|
| 163 | 163 | |
| 164 | - $fieldname = $splits[0]; |
|
| 165 | - $term = $splits[1]; |
|
| 164 | + $fieldname = $splits[0]; |
|
| 165 | + $term = $splits[1]; |
|
| 166 | 166 | |
| 167 | - if (!isset($terms[$fieldname])) { |
|
| 168 | - $terms[$fieldname] = array(); |
|
| 169 | - } |
|
| 167 | + if (!isset($terms[$fieldname])) { |
|
| 168 | + $terms[$fieldname] = array(); |
|
| 169 | + } |
|
| 170 | 170 | |
| 171 | - array_push($terms[$fieldname], $term); |
|
| 172 | - } |
|
| 171 | + array_push($terms[$fieldname], $term); |
|
| 172 | + } |
|
| 173 | 173 | |
| 174 | - return $terms; |
|
| 174 | + return $terms; |
|
| 175 | 175 | } |
| 176 | 176 | |
| 177 | 177 | /** |