foreach ( $data['issue_ids'] as $issue_id ) { $tmp = $ignores->set_ignore( $issue_id ); if ( ! $tmp ) { $status = false; } } return $status; } /** * Purges ignores from the Hub action handler. * Purges local ignores list when the Hub storage is purged. */ public function ajax_purge_ignores() { Logger::info( 'Received ignores purging request' ); $status = $this->purge_ignores(); ! empty( $status ) ? wp_send_json_success() : wp_send_json_error(); } /** * Purges ignores from the Hub action handler * * Purges local ignores list when the Hub storage is purged. * * @return bool Status */ public function purge_ignores() { $ignores = new Ignores(); return $ignores->clear(); } /** * Freshes extras from the Hub action handler * * Updates local extra URLs list when the Hub storage is updated. * * @param object $params Hub-provided parameters. * @param string $action Action called. */ public function ajax_sync_extras( $params, $action = '' ) { Logger::info( 'Received extras syncing request' ); $status = $this->sync_extras( (array) $params, $action ); ! empty( $status ) ? wp_send_json_success() : wp_send_json_error(); } /** * Freshes extras from the Hub action handler * * Updates local extra URLs list when the Hub storage is updated. * * @param array $params Hub-provided parameters. * @param string $action Action called. * * @return bool Status */ public function sync_extras( $params, $action = '' ) { $data = stripslashes_deep( (array) $params ); if ( empty( $data['urls'] ) || ! is_array( $data['urls'] ) ) { return false; } $existing = Utils::get_extra_urls(); foreach ( $data['urls'] as $url ) { $existing[] = esc_url( $url ); } return Utils::set_extra_urls( $existing ); } /** * Purges extras from the Hub action handler. * Purges local extra URLs list when the Hub storage is updated. */ public function ajax_purge_extras() { $status = $this->purge_extras(); ! empty( $status ) ? wp_send_json_success() : wp_send_json_error(); } /** * Purges extras from the Hub action handler * * Purges local extra URLs list when the Hub storage is updated. * * @return bool Status */ public function purge_extras() { return Utils::set_extra_urls( array() ); } }