|
@@ 516-532 (lines=17) @@
|
| 513 |
|
/** |
| 514 |
|
* If there is an error with the fetched posts, save the error and update the checked time. |
| 515 |
|
*/ |
| 516 |
|
if ( is_wp_error( $site_posts_parsed_data ) ) { |
| 517 |
|
$widget_data['posts']['error'] = $site_posts_parsed_data; |
| 518 |
|
|
| 519 |
|
return $widget_data; |
| 520 |
|
} |
| 521 |
|
/** |
| 522 |
|
* If data is fetched successfully, update the data and set the proper time. |
| 523 |
|
* |
| 524 |
|
* Data is only updated if we have valid results. This is done this way so we can show |
| 525 |
|
* something if external service is down. |
| 526 |
|
* |
| 527 |
|
*/ |
| 528 |
|
else { |
| 529 |
|
$widget_data['posts']['last_update'] = time(); |
| 530 |
|
$widget_data['posts']['data'] = $site_posts_parsed_data; |
| 531 |
|
$widget_data['posts']['error'] = null; |
| 532 |
|
} |
| 533 |
|
|
| 534 |
|
return $widget_data; |
| 535 |
|
} |
|
@@ 478-494 (lines=17) @@
|
| 475 |
|
/** |
| 476 |
|
* If there is an error with the fetched site info, save the error and update the checked time. |
| 477 |
|
*/ |
| 478 |
|
if ( is_wp_error( $site_info_parsed_data ) ) { |
| 479 |
|
$widget_data['site_info']['error'] = $site_info_parsed_data; |
| 480 |
|
|
| 481 |
|
return $widget_data; |
| 482 |
|
} |
| 483 |
|
/** |
| 484 |
|
* If data is fetched successfully, update the data and set the proper time. |
| 485 |
|
* |
| 486 |
|
* Data is only updated if we have valid results. This is done this way so we can show |
| 487 |
|
* something if external service is down. |
| 488 |
|
* |
| 489 |
|
*/ |
| 490 |
|
else { |
| 491 |
|
$widget_data['site_info']['last_update'] = time(); |
| 492 |
|
$widget_data['site_info']['data'] = $site_info_parsed_data; |
| 493 |
|
$widget_data['site_info']['error'] = null; |
| 494 |
|
} |
| 495 |
|
|
| 496 |
|
|
| 497 |
|
/** |