/** * Add database table base prefix to batch. * * @param Batch $batch */ private function add_table_prefix(Batch $batch) { $batch->add_custom_data('sme_table_base_prefix', $this->custom_dao->get_table_base_prefix()); }
/** * Add GUIDs of deleted posts to batch. * * @param Batch $batch */ public function prepare(Batch $batch) { if (!isset($_POST['delete_posts']) || empty($_POST['delete_posts'])) { $batch->add_custom_data($this->extension, array()); return; } // Posts selected for deletion. $selected = array_map('intval', $_POST['delete_posts']); /** * @var Custom_DAO $custom_dao */ $custom_dao = Helper_Factory::get_instance()->get_dao('Custom'); $deleted_posts = $custom_dao->get_deleted_posts(); $deleted_posts = array_filter($deleted_posts, function ($post) use($selected) { return isset($post['id']) && in_array($post['id'], $selected); }); $batch->add_custom_data($this->extension, $deleted_posts); }