function get_video($url, $width = 640, $height = 480) { if (strpos($url, 'youtube')) { get_youtube($url, $width, $height); } else { if (strpos($url, 'youtu.be')) { get_youtube($url, $width, $height, 'youtu.be'); } else { get_vimeo($url, $width, $height); } } }
function get_video($url, $width = 640, $height = 360) { if (empty($width) && empty($height)) { $width = 640; $height = 360; } if (strpos($url, 'youtube')) { get_youtube($url, $width, $height); } else { if (strpos($url, 'youtu.be')) { get_youtube($url, $width, $height, 'youtu.be'); } else { if (strpos($url, 'vimeo')) { get_vimeo($url, $width, $height); } } } }
function gdl_youtube_shortcode($atts, $content = null) { extract(shortcode_atts(array("height" => '', "width" => ''), $atts)); $youtube = '<div style="max-width:' . $width . 'px;" >'; $youtube = $youtube . get_youtube($content, $width, $height, 'youtube', true); $youtube = $youtube . '</div>'; return $youtube; }
$o[$x]['id'] = $i->id; $o[$x]['title'] = $i->title; $o[$x]['description'] = $i->description; $x++; } return $o; } function get_flickr() { $jsonurl = 'http://api.flickr.com/services/rest/?method=flickr.photosets.getList&api_key=636a6afb01db7089334b86e4fb2a5e8d&user_id=38705147%40N00&format=json&nojsoncallback=1&auth_token=72157631215064726-e17fcdb0b95d0bdb&api_sig=4f3477b3c46523370a53792ca924f7d1'; $json = file_get_contents($jsonurl, 0, null, null); $v = json_decode($json); $x = 0; foreach ($v->photosets->photoset as $i) { $o[$x]['id'] = $i->id; $o[$x]['title'] = $i->title->_content; $o[$x]['description'] = $i->description->_content; $x++; } return $o; } $yt = get_youtube(5); $flickr = get_flickr(); ?> <pre> <?php print_r($yt); print_r($flickr); ?> </pre>
# # File : ADD VIDEO # Project : Game Magazine Project # Author : Béo Sagittarius # Created : 07/01/2015 # ##################################################################### --> <?php include '../includes/backend/mysqli_connect.php'; include '../includes/functions.php'; $vid = $_GET['vid']; if (empty($vid) || strlen($vid) != 11) { redirect_to('admin/list_videos.php'); } else { $title_page = 'Add Video'; $video = get_youtube($vid); $title = $video['title']; if ($_SERVER['REQUEST_METHOD'] == 'POST') { // create variable error $errors = array(); $uid = $_SESSION['uid']; // validate type if (isset($_POST['type']) && filter_var($_POST['type'], FILTER_VALIDATE_INT, array('min_range' => 1))) { $type_id = $_POST['type']; } else { $errors[] = 'type'; } // validate description if (empty($_POST['description'])) { $errors[] = "description"; } else {
function extract_items($site, $content) { switch ($site) { case 'flickr': //ok $items = get_flickr($content); break; case 'ffffound': //ok $items = get_ffffound($content); break; case 'dribbble': //ok $items = get_dribbble($content); break; case 'imgur': //ok $items = get_imgur($content); break; case 'picplz': //ok $items = get_picplz($content); break; case 'instagram': //ok $items = get_instagram($content); break; case 'delicious': //ok $items = get_delicious($content); break; case 'hn': //ok $items = get_delicious($content); break; case 'reddit': //ok $items = get_delicious($content); break; case 'pinboard': //ok $items = get_pinboard($content); break; case 'digg': //ok $items = get_digg($content); break; case 'youtube': //ok $items = get_youtube($content); break; case 'hulu': //ok $items = get_hulu($content); break; case 'yahoovideos': //ok $items = get_yahoovideos($content); break; case 'yahoobuzz': //ok $items = get_yahoobuzz($content); break; case 'googletrends': //ok $items = get_googletrends($content); break; case 'amazon': //ok $items = get_amazon($content); break; case 'itunes': //ok $items = get_itunes($content); break; case 'wearehunted': //ok $items = get_wearehunted($content); break; case 'twitter': //ok $items = get_twitter($content); break; case 'wordpress': //ok $items = get_delicious($content); break; } return $items; }