예제 #1
0
 /**
  * Find all post_ids associated with this feed.
  * 
  * @return array
  */
 function post_ids()
 {
     global $wpdb;
     $allowed_status = array("publish");
     $allowed_status = apply_filters("podlove_feed_post_ids_allowed_status", $allowed_status);
     $sql = "\n\t\t\tSELECT\n\t\t\t\tp.ID\n\t\t\tFROM\n\t\t\t\t" . $wpdb->posts . " p\n\t\t\t\tINNER JOIN " . Episode::table_name() . " e ON e.post_id = p.ID\n\t\t\t\tINNER JOIN " . MediaFile::table_name() . " mf ON mf.`episode_id` = e.id\n\t\t\t\tINNER JOIN " . EpisodeAsset::table_name() . " a ON a.id = mf.`episode_asset_id`\n\t\t\tWHERE\n\t\t\t\ta.id = %d\n\t\t\t\tAND\n\t\t\t\tp.post_status IN (" . implode(',', array_map(function ($s) {
         return "'{$s}'";
     }, $allowed_status)) . ")\n\t\t\tORDER BY\n\t\t\t\tp.post_date DESC\n\t\t";
     return $wpdb->get_col($wpdb->prepare($sql, $this->episode_asset()->id));
 }
 /**
  * Fetch all valid feeds.
  * 
  * A feed is valid if...
  * 
  * - it has an asset assigned (and the asset has a filetype assigned)
  * - the slug in not empty
  * 
  * @return array list of feeds
  */
 public function feeds()
 {
     return $this->with_blog_scope(function () {
         $sql = "\n\t\t\t\tSELECT\n\t\t\t\t\tf.*\n\t\t\t\tFROM\n\t\t\t\t\t" . Feed::table_name() . " f\n\t\t\t\t\tJOIN " . EpisodeAsset::table_name() . " a ON a.id = f.episode_asset_id\n\t\t\t\t\tJOIN " . FileType::table_name() . " ft ON ft.id = a.file_type_id\n\t\t\t\tWHERE\n\t\t\t\t\tf.slug IS NOT NULL\n\t\t\t\tORDER BY \n\t\t\t\t\tposition ASC\n\t\t\t";
         return Feed::find_all_by_sql($sql);
     });
 }