protected function api_request($_action, $_data) { $time_key = $this->slug . '-plugin_updater_api_request_last_checked'; $api_key = $this->slug . '-plugin_updater_api_request'; $entity = new WPFront_User_Role_Editor_Entity_Options(); $time = $entity->get_option($time_key); if ($time === NULL || $time < time() - 6 * 3600) { $api = NULL; } else { $api = $entity->get_option($api_key); } if ($api === NULL) { $api = parent::api_request($_action, $_data); if ($api) { $entity->update_option($api_key, serialize($api)); $entity->update_option($time_key, time()); } } else { $api = unserialize($api); } return $api; }