Esempio n. 1
0
/**
 * Function to clear a playlist video
 * This function is used to clear playlist video of current user
 * This function has watchUserId to hold current user id
 * This function has $videoId to hold video id
 * This function has $playlistId to hold playlist id
 * This function include playlistcontroller file
 * This function has controllerObj variable to hold PlaylistController object
 * This function call clearPlaylistVideoController method to get playlist videos of current user
 * wp_ajax hook is used to call clear_playlist_video
 * @return void
 */
function clear_playlist_video()
{
    global $frontControllerPath, $frontModelPath, $frontViewPath;
    $userId = get_current_user_id();
    $videoId = isset($_POST['vid']) && $_POST['vid'] != '' ? intval($_POST['vid']) : '';
    $playlistId = isset($_POST['pid']) && $_POST['pid'] != '' ? intval($_POST['pid']) : '';
    if (!empty($videoId) && is_user_logged_in() && !empty($playlistId)) {
        include_once $frontControllerPath . 'playlistcontroller.php';
        $controllerObj = new PlaylistController();
        $controllerObj->clearPlaylistVideoController($userId, $videoId, $playlistId);
    } else {
        echo json_encode(array());
        exitAction('');
    }
}