|
@@ 662-678 (lines=17) @@
|
| 659 |
|
/** |
| 660 |
|
* If there is an error with the fetched site info, save the error and update the checked time. |
| 661 |
|
*/ |
| 662 |
|
if ( is_wp_error( $site_info_parsed_data ) ) { |
| 663 |
|
$widget_data['site_info']['error'] = $site_info_parsed_data; |
| 664 |
|
|
| 665 |
|
return $widget_data; |
| 666 |
|
} |
| 667 |
|
/** |
| 668 |
|
* If data is fetched successfully, update the data and set the proper time. |
| 669 |
|
* |
| 670 |
|
* Data is only updated if we have valid results. This is done this way so we can show |
| 671 |
|
* something if external service is down. |
| 672 |
|
* |
| 673 |
|
*/ |
| 674 |
|
else { |
| 675 |
|
$widget_data['site_info']['last_update'] = time(); |
| 676 |
|
$widget_data['site_info']['data'] = $site_info_parsed_data; |
| 677 |
|
$widget_data['site_info']['error'] = null; |
| 678 |
|
} |
| 679 |
|
|
| 680 |
|
|
| 681 |
|
/** |
|
@@ 700-716 (lines=17) @@
|
| 697 |
|
/** |
| 698 |
|
* If there is an error with the fetched posts, save the error and update the checked time. |
| 699 |
|
*/ |
| 700 |
|
if ( is_wp_error( $site_posts_parsed_data ) ) { |
| 701 |
|
$widget_data['posts']['error'] = $site_posts_parsed_data; |
| 702 |
|
|
| 703 |
|
return $widget_data; |
| 704 |
|
} |
| 705 |
|
/** |
| 706 |
|
* If data is fetched successfully, update the data and set the proper time. |
| 707 |
|
* |
| 708 |
|
* Data is only updated if we have valid results. This is done this way so we can show |
| 709 |
|
* something if external service is down. |
| 710 |
|
* |
| 711 |
|
*/ |
| 712 |
|
else { |
| 713 |
|
$widget_data['posts']['last_update'] = time(); |
| 714 |
|
$widget_data['posts']['data'] = $site_posts_parsed_data; |
| 715 |
|
$widget_data['posts']['error'] = null; |
| 716 |
|
} |
| 717 |
|
|
| 718 |
|
return $widget_data; |
| 719 |
|
} |