Skip to content

Commit

Permalink
Clean up PHP warnings
Browse files Browse the repository at this point in the history
Noticed them while checking my test server
  • Loading branch information
flodolo committed Dec 28, 2015
1 parent 591d3f3 commit dc219c9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
9 changes: 1 addition & 8 deletions app/models/mainsearch_glossary.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,6 @@
// Limit results to 200
array_splice($locale1_strings, 200);

// Get the locale results
$results = [];

foreach ($locale1_strings as $key => $str) {
$results[$key] = $tmx_target[$key];
}

$perfect = $imperfect = [];

// We want to test compound words as well, /ex: 'switch to'
Expand Down Expand Up @@ -77,7 +70,7 @@ function ($element) use ($word) {
$get_results = function ($arr) use ($tmx_target) {
$results = [];
foreach ($arr as $val) {
if ($tmx_target[$val] != '') {
if (isset($tmx_target[$val]) && $tmx_target[$val] != '') {
$results[$val] = $tmx_target[$val];
}
}
Expand Down
11 changes: 9 additions & 2 deletions app/views/gaia.php
Original file line number Diff line number Diff line change
Expand Up @@ -309,16 +309,23 @@ function ($str) {
. '</tr>';

foreach ($common_keys as $key => $val) {
$get_localized_string = function ($id) use ($key, $strings) {
// Avoid warnings if the string is not localized

return isset($strings[$id][$key]) ?
$strings[$id][$key] :
'<em class="error">missing string</em>';
};
if (trim(strtolower($strings[$englishchanges[0] . '-en-US'][$key])) != trim(strtolower($strings[$englishchanges[1] . '-en-US'][$key]))) {
$table .=
'<tr>'
. '<td><span class="celltitle">Key</span><div class="string">' . ShowResults::formatEntity($key) . '</div></td>'
. '<td><span class="celltitle">Gaia' . $repo_one . '</span><div class="string">'
. ShowResults::highlight(Utils::secureText($strings[$englishchanges[0] . '-en-US'][$key]), 'en-US')
. '<br><small>' . Utils::secureText($strings[$englishchanges[0]][$key]) . '</small></div></td>'
. '<br><small>' . $get_localized_string($englishchanges[0]) . '</small></div></td>'
. '<td><span class="celltitle">Gaia' . $repo_two . '</span><div class="string">'
. ShowResults::highlight(Utils::secureText($strings[$englishchanges[1] . '-en-US'][$key]), 'en-US')
. '<br><small>' . Utils::secureText($strings[$englishchanges[1]][$key]) . '</small></div></td>'
. '<br><small>' . $get_localized_string($englishchanges[1]) . '</small></div></td>'
. '</tr>';
}
}
Expand Down

0 comments on commit dc219c9

Please sign in to comment.