|
@@ 692-708 (lines=17) @@
|
| 689 |
|
/** |
| 690 |
|
* If there is an error with the fetched site info, save the error and update the checked time. |
| 691 |
|
*/ |
| 692 |
|
if ( is_wp_error( $site_info_parsed_data ) ) { |
| 693 |
|
$widget_data['site_info']['error'] = $site_info_parsed_data; |
| 694 |
|
|
| 695 |
|
return $widget_data; |
| 696 |
|
} |
| 697 |
|
/** |
| 698 |
|
* If data is fetched successfully, update the data and set the proper time. |
| 699 |
|
* |
| 700 |
|
* Data is only updated if we have valid results. This is done this way so we can show |
| 701 |
|
* something if external service is down. |
| 702 |
|
* |
| 703 |
|
*/ |
| 704 |
|
else { |
| 705 |
|
$widget_data['site_info']['last_update'] = time(); |
| 706 |
|
$widget_data['site_info']['data'] = $site_info_parsed_data; |
| 707 |
|
$widget_data['site_info']['error'] = null; |
| 708 |
|
} |
| 709 |
|
|
| 710 |
|
|
| 711 |
|
/** |
|
@@ 730-746 (lines=17) @@
|
| 727 |
|
/** |
| 728 |
|
* If there is an error with the fetched posts, save the error and update the checked time. |
| 729 |
|
*/ |
| 730 |
|
if ( is_wp_error( $site_posts_parsed_data ) ) { |
| 731 |
|
$widget_data['posts']['error'] = $site_posts_parsed_data; |
| 732 |
|
|
| 733 |
|
return $widget_data; |
| 734 |
|
} |
| 735 |
|
/** |
| 736 |
|
* If data is fetched successfully, update the data and set the proper time. |
| 737 |
|
* |
| 738 |
|
* Data is only updated if we have valid results. This is done this way so we can show |
| 739 |
|
* something if external service is down. |
| 740 |
|
* |
| 741 |
|
*/ |
| 742 |
|
else { |
| 743 |
|
$widget_data['posts']['last_update'] = time(); |
| 744 |
|
$widget_data['posts']['data'] = $site_posts_parsed_data; |
| 745 |
|
$widget_data['posts']['error'] = null; |
| 746 |
|
} |
| 747 |
|
|
| 748 |
|
return $widget_data; |
| 749 |
|
} |