/** * Remove excluded item action */ public function remove_excluded_item_action() { $this->bridge->check_ajax_referer('bwp_gxs_remove_excluded_item'); if (($group = BWP_Framework_Util::get_request_var('group')) && ($id = BWP_Framework_Util::get_request_var('id'))) { $excluded_items = $this->excluder->get_excluded_items($group); $key = array_search($id, $excluded_items); if ($key !== false) { unset($excluded_items[$key]); $this->excluder->update_excluded_items($group, $excluded_items); $this->succeed(); } } $this->fail(); }
private function _handle_exclude_items($group, array $items_to_exclude, BWP_Sitemaps_Excluder $excluder) { // merge currently excluded items with new items to exclude $excluded_items = $excluder->get_excluded_items($group); $excluded_items = array_unique(array_merge($excluded_items, $items_to_exclude)); $excluder->update_excluded_items($group, $excluded_items); $this->add_notice_flash(sprintf(__('Successfully excluded <strong>%d</strong> items.', $this->domain), count($items_to_exclude))); }