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