Skip to content

Commit

Permalink
better display errors
Browse files Browse the repository at this point in the history
  • Loading branch information
u451f committed Oct 20, 2015
1 parent f197d26 commit 70e387c
Showing 1 changed file with 15 additions and 16 deletions.
31 changes: 15 additions & 16 deletions wp-blocked.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,26 +73,25 @@ function format_results($URL, $fetch_stats=false) {
// create table
$output .= '<div class="blocked-results-table-wrapper">'."\n";
$output .= '<div id="table-results">'."\n";

foreach ($status['results'] as $country) {
if($country['error']) {
$output .= '<div class="error">'.$country['country'].': '.$country['error'].'</div>';
} else if($country['success'] == 1 && $country['results']) {
if(count($country['results']) > 0) {
$status['url'] = $country['results']['url'];
$output .= '<h2 class="url-searched">'.__("Results for", 'wp-blocked').' '. $status['url'].'</h2>'."\n";
// we might have a global request
$output .= '<h2 class="url-searched">'.__("Results for", 'wp-blocked').' '. $URL.'</h2>'."\n";

if($status['results'][0]['success'] || $status['results'][0]['error']) {
// global request
foreach ($status['results'] as $country) {
if($country['error']) {
$output .= '<div class="error">'.$country['country'].': '.$country['error'].'</div>';
} else if($country['success'] == 1 && count($country['results']) > 0) {
$output .= format_results_table($country['results'], $country['country']);
} else {
$output .= '<div class="error">'.$country['country'].': '.__('No results', 'wp-blocked').'</div>';
}
} else {
if(count($country['results']) > 0) {
$output .= '<h2 class="url-searched">'.__("Results for", 'wp-blocked').' '. $status['url'].'</h2>'."\n";
$output .= format_results_table($country);
} else {
$output .= '<div class="error">'.$country['country'].': '.__('No results', 'wp-blocked').'</div>';
}
}
} else {
// simple request
if(count($status['results']) > 0) {
$output .= format_results_table($status['results']);
} else {
$output .= '<div class="error">'.$status['results'].': '.__('No results', 'wp-blocked').'</div>';
}
}

Expand Down

0 comments on commit 70e387c

Please sign in to comment.