예제 #1
0
/**
 * Function to store playlist
 * This function is used to store playlist
 * This function has watchUserId to hold current user id
 * This function has videoId to hold video id
 * This function has playlistName to hold playlist name
 * This function include playlistcontroller file
 * This function has controllerObj variable to hold PlaylistController object
 * This function call storePlaylistController method to load videos of playlist
 * wp_ajax hook is used to call storePlaylist
 * @return void
 */
function storePlaylist()
{
    global $frontControllerPath, $frontModelPath, $frontViewPath;
    $watchUserId = get_current_user_id();
    $videoId = isset($_POST['vid']) && $_POST['vid'] != '' ? intval($_POST['vid']) : '';
    $playlistName = isset($_POST['pname']) && $_POST['pname'] != '' ? strip_tags($_POST['pname']) : '';
    if (!empty($videoId) && is_user_logged_in()) {
        include_once $frontControllerPath . 'playlistcontroller.php';
        $controllerObj = new PlaylistController();
        $controllerObj->storePlaylistController($watchUserId, $videoId, $playlistName);
    }
}