메소드 |
설명 |
|
__construct ( ) |
|
|
activate_cron ( ) |
Activates widget update cron task. |
|
cron_task ( ) : boolean |
Main cron code. Updates all instances of the widget. |
|
deactivate_cron ( ) |
Deactivates widget update cron task. |
|
deactivate_cron_static ( ) |
Deactivates widget update cron task. |
|
enqueue_scripts ( ) |
Enqueue CSS and JavaScript. |
|
extract_errors_from_blog_data ( array | WP_Error $blog_data ) : string |
Scan and extract first error from blog data array. |
|
fetch_blog_data ( string $site, array $original_data = [], boolean $site_data_only = false ) : array |
Fetch site information and posts list for a site. |
|
fetch_posts_for_site ( integer $site_id ) : array | WP_Error |
Fetch list of posts from the WordPress public API. |
|
fetch_service_endpoint ( string $endpoint, integer $timeout = 15 ) : array | WP_Error |
Fetch a remote service endpoint and parse it. |
|
fetch_site_info ( string $site ) : array | WP_Error |
Fetch site information from the WordPress public API |
|
form ( array $instance ) : string | void |
Display the widget administration form. |
|
format_posts_for_storage ( object $parsed_data ) : array |
Format the posts for better storage. Drop all the data that is not used. |
|
get_blog_data ( string $site ) : array | WP_Error |
Gets blog data from the cache. |
|
get_instances_sites ( ) : array | boolean |
Get a list of unique sites from all instances of the widget. |
|
get_site_hash ( string $site ) : string |
Expiring transients have a name length maximum of 45 characters,
so this function returns an abbreviated MD5 hash to use instead of
the full URI. |
|
parse_posts_response ( object | WP_Error $service_response ) : array | WP_Error |
Parse external API response from the posts list request and handle errors if any occur. |
|
parse_service_response ( array $service_response ) : array | WP_Error |
Parse data from service response. |
|
parse_site_info_response ( array | WP_Error $service_response ) : array | WP_Error |
Parse external API response from the site info call and handle errors if they occur. |
|
should_cron_be_running ( ) : boolean |
Checks if the update cron should be running and returns appropriate result. |
|
update ( $new_instance, $old_instance ) |
|
|
update_instance ( string $site ) |
Update a widget instance. |
|
widget ( array $args, array $instance ) |
Set up the widget display on the front end. |
|
wp_add_option ( string $option_name, mixed $option_value ) : mixed |
This is just to make method mocks in the unit tests easier. |
|
wp_get_option ( string $param ) : mixed |
This is just to make method mocks in the unit tests easier. |
|
wp_update_option ( string $option_name, mixed $option_value ) : mixed |
This is just to make method mocks in the unit tests easier. |
|
wp_wp_remote_get ( string $url, array $args = [] ) : array | WP_Error |
This is just to make method mocks in the unit tests easier. |
|