Ejemplo n.º 1
0
function s3_video_show_playlists()
{
    $pluginSettings = s3_video_check_plugin_settings();
    require_once WP_PLUGIN_DIR . '/s3-video/includes/playlist_management.php';
    $playlistManagement = new s3_playlist_management();
    if (!empty($_GET['delete'])) {
        $playlistId = preg_replace('/[^0-9]/Uis', '', $_GET['delete']);
        $playlistManagement->deletePlaylist($playlistId);
    }
    if (!empty($_GET['edit']) && is_numeric($_GET['edit']) || !empty($_GET['reorder']) && is_numeric($_GET['reorder'])) {
        if (!empty($_GET['edit'])) {
            $playlistId = preg_replace('/[^0-9]/Uis', '', $_GET['edit']);
            if (!empty($_POST['playlist_contents'])) {
                $playlistManagement->deletePlaylistVideos($playlistId);
                $playlistManagement->updatePlaylistVideos($playlistId, $_POST['playlist_contents']);
                $playlistUpdated = 1;
            }
            $existingVideos = $playlistManagement->getPlaylistVideos($playlistId);
            $s3Videos = s3_video_get_all_existing_video($pluginSettings);
            require_once WP_PLUGIN_DIR . '/s3-video/views/playlist-management/edit_playlist.php';
        }
        if (!empty($_GET['reorder'])) {
            $playlistId = preg_replace('/[^0-9]/Uis', '', $_GET['reorder']);
            $playlistVideos = $playlistManagement->getPlaylistVideos($playlistId);
            require_once WP_PLUGIN_DIR . '/s3-video/views/playlist-management/reorder_playlist.php';
        }
    } else {
        /*
         * If we don't have a playlist to display a list of them all  
         */
        $existingPlaylists = $playlistManagement->getAllPlaylists();
        require_once WP_PLUGIN_DIR . '/s3-video/views/playlist-management/playlist_management.php';
    }
}
Ejemplo n.º 2
0
function s3_video_embed_playlist($embedDetails)
{
    // Load the required modules
    require_once WP_PLUGIN_DIR . '/s3-video/includes/playlist_management.php';
    $playlistManagement = new s3_playlist_management();
    $playlistVideos = $playlistManagement->getPlaylistVideos($embedDetails['id']);
    $pluginSettings = s3_video_check_plugin_settings();
    $playerContent = s3_video_configure_player();
    $playerContent = str_replace('{playerId}', s3_plugin_player_id(), $playerContent);
    $baseUrl = 'http://' . $pluginSettings['amazon_video_bucket'] . '.' . $pluginSettings['amazon_url'] . '/';
    // Define the playlist to support a video still
    $playlistHtml = 'playlist: [' . "\r\n";
    $x = 0;
    foreach ($playlistVideos as $playlistVideo) {
        $playlistHtml .= '{
					url: "' . $baseUrl . $playlistVideo['video_file'] . '", ' . "\r\n" . 'title: "' . $playlistVideo['video_file'] . '",' . "\r\n";
        if ($x == 0 && $pluginSettings['amazon_s3_video_autoplay'] == 0) {
            $playlistHtml .= 'autoPlay: false' . "\r\n";
            $playerContent = str_replace('{videoFile}', $baseUrl . $playlistVideo['video_file'], $playerContent);
        } else {
            $x++;
            $playlistHtml .= 'autoPlay: true' . "\r\n";
        }
        $playlistHtml .= '},' . "\r\n";
    }
    $playlistHtml = substr($playlistHtml, 0, -1);
    $playerContent = str_replace('{videoPlaylist}', $playlistHtml . ']', $playerContent);
    print_r($playerContent);
    exit;
    return $playerContent;
}