/**
  * Checks if a taxonomy is allowed by the settings of the current job.
  *
  * @param string $taxonomy Name of the taxonomy.
  *
  * @return bool True if the taxonomy is allowed, false otherwise
  */
 protected function allowed_taxonomy($taxonomy)
 {
     // Is the taxonomy in the list of user-chosen taxonomies?
     if (!in_array($taxonomy, $this->job->get_taxonomies(), true)) {
         return false;
         // No.
     }
     return true;
     // Yes.
 }
 /**
  * Save the aggregator job.
  *
  * @param int     $post_id ID of the Aggregator post.
  * @param WP_Post $post Post object of the Aggregator post.
  */
 public function publish_aggregator_job($post_id, $post)
 {
     // Find the portal ID.
     if (isset($_POST['portal'])) {
         // Input var okay.
         $portal = intval($_POST['portal']);
         // Input var okay.
     } else {
         return;
     }
     // Create a new aggregator job. If one already exists for this porta/source combination
     // the following will load the existing settings.
     $sync_job = new Aggregator_Job($portal, get_current_blog_id());
     // Set the post ID. If a post already exists for this job, it will be deleted.
     $sync_job->set_post_id($post_id);
     // Defaults for the post types and taxonomies.
     $cpts = $sync_job->get_post_types();
     $taxos = $sync_job->get_taxonomies();
     // Get any selected post types.
     if (isset($_POST['cpts'])) {
         // Input var okay.
         $cpts = array_map('sanitize_text_field', wp_unslash($_POST['cpts']));
         // Input var okay.
     }
     // Save the new/changed post types.
     $sync_job->set_post_types($cpts);
     // Get any selected taxonomies.
     if (isset($_POST['taxos'])) {
         // Input var okay.
         $taxos = array_map('sanitize_text_field', wp_unslash($_POST['taxos']));
         // Input var okay.
     }
     // Save the new/changed taxonomies.
     $sync_job->set_taxonomies($taxos);
     // Save the portal ID as post meta.
     $sync_job->set_portal_blog_id_meta();
     // Set the author.
     $sync_job->set_author($post->post_author);
     // Update the network options for network admin pages.
     $sync_job->update_network_options();
     // Redirect back to network admin settings, with a success message.
     wp_redirect(network_admin_url('settings.php?page=aggregator'));
     exit;
 }