public static function playlist_object($id) { $playlist = get_post($id); if ($playlist) { $playlist_items = explode(",", get_post_meta($id, LONGTAIL_KEY . "playlist_items", true)); } if (is_array($playlist_items)) { $items = array(); foreach ($playlist_items as $playlist_item_id) { $playlist_item = get_post($playlist_item_id); $thumbnail = JWP6_Plugin::image_from_mediaid($playlist_item_id); $item = array('title' => $playlist_item->post_title, 'sources' => array(array('file' => JWP6_Plugin::url_from_post($playlist_item)))); if ($playlist_item->post_content) { $item['description'] = $playlist_item->post_content; } if ($thumbnail) { $item['image'] = $thumbnail; } $items[] = $item; } return $items; } return null; }
public function embedcode() { global $jwp6_global; $jwp6_global['player_embed_count'] = array_key_exists('player_embed_count', $jwp6_global) ? $jwp6_global['player_embed_count'] + 1 : 0; // Make the code a little easier to read foreach ($this->media_params as $param => $value) { ${$param} = $value; } // MAIN MEDIA $file_url = null; // mediaid if (is_int($mediaid) || ctype_digit($mediaid)) { $media_post = get_post($mediaid); $file_url = JWP6_Plugin::url_from_post($media_post); } // file parameter overrules the mediaid if ($file) { $file_url = $file; } // playlistid if (!$playlist) { if (is_int($playlistid) || ctype_digit($playlistid)) { $playlist = JWP6_Plugin::playlist_object($playlistid); } else { $playlist = null; } } // If someone sets playlist and file, playlist has priority if ($file_url && $playlist) { unset($file_url); } // THUMBNAIL $image_url = null; // Direct image setting has priority if ($image) { if (is_int($image) || ctype_digit($image)) { $image_post = get_post($image); $image_url = $image_post->guid; } else { $image_url = $image; } } else { if ($mediaid) { $image_url = JWP6_Plugin::image_from_mediaid($mediaid); } } return $this->player->embedcode($jwp6_global['player_embed_count'], $file_url, $playlist, $image_url, $this->config_params); }