function youtubeVideoThumbMaker($content = null) { preg_match("#(?<=v=)[a-zA-Z0-9-]+(?=&)|(?<=[0-9]/)[^&\n]+|(?<=v=)[^&\n]+#", $content, $results); $videoid = $results[0]; $someurl = "http://gdata.youtube.com/feeds/api/videos/" . $videoid; $somedoc = new DOMDocument(); $somedoc->load($someurl); $ourtitle = $somedoc->getElementsByTagName("title")->item(0)->nodeValue; $videolink = "http://www.youtube.com/watch?v=" . $videoid; $videoimagelink = "http://img.youtube.com/vi/" . $videoid . "/0.jpg"; $linkimage = videoThumb($videoimagelink, 'youtube_smallthumbstored' . $videoid); $linkimageblur = videoThumb($videoimagelink, 'youtube_smallthumbstoredblur' . $videoid, 460, 180, 'True'); return '<div id="hidden' . $videoid . '" style="display:none; height:180px;width:460px;visibility:false"> <a data-fb-options="width:1280 height:745 autoFitMedia:true enableDragResize:false outerBorder:0 innerBorder:0 padding:0 roundCornders:none showClose:false imageClickCloses:true" class="floatbox" href="' . $videolink . '"><img style="height:180px;width:460px" src="' . $linkimage . '"/></a> </div> <a data-fb-tooltip="source:#hidden' . $videoid . ' moveWithMouse:true placeAbove:true" data-fb-options="width:1280 height:745 autoFitMedia:true enableDragResize:false outerBorder:0 innerBorder:0 padding:0 panelPadding:0 roundCorners:none showClose:false imageClickCloses:true" class="floatbox fbTooltip" href="' . $videolink . '"> <div class="jdyoutubethumb" style="background:url(' . $linkimageblur . ') center center no-repeat;"></div> </a>'; }
function jdVideoPlayerFunction($atts, $content = null) { try { if (preg_match("/youtube/", $content)) { preg_match("#(?<=v=)[a-zA-Z0-9-]+(?=&)|(?<=[0-9]/)[^&\n]+|(?<=v=)[^&\n]+#", $content, $results); $videoid = $results[0]; $someurl = "http://gdata.youtube.com/feeds/api/videos/" . $videoid; $somedoc = new DOMDocument(); @$somedoc->load($someurl); if (@$somedoc->validate()) { @($ourtitle = $somedoc->getElementsByTagName("title")->item(0)->nodeValue); } else { $ourtitle = "Title"; } $service = "youtube"; $videolink = "http://www.youtube.com/watch?v=" . $videoid; $videoimagelink = "http://img.youtube.com/vi/" . $videoid . "/0.jpg"; } elseif (preg_match("/vimeo/", $content)) { preg_match("/(?<=vimeo\\.com\\/)\\d+/", $content, $results); $videoid = $results[0]; $url = 'http://vimeo.com/api/v2/video/' . $videoid . '.php'; $array = unserialize(file_get_contents($url)); $anotherarray = $array[0]; $thumbnail = $anotherarray["thumbnail_large"]; $height = $anotherarray["height"]; $width = $anotherarray["width"]; $service = "vimeo"; $ourtitle = $anotherarray["title"]; $videolink = 'http://vimeo.com/moogaloop.swf?clip_id=' . $videoid; $videoimagelink = $thumbnail; } $linkimage = videoThumb($videoimagelink, 'made_thumbstored' . $videoid); return '<div class="jddivclass"> <a data-fb-options="width:1280 height:745 autoFitMedia:true enableDragResize:true outerBorder:0 innerBorder:0 padding:0 panelPadding:0 roundCorners:none showClose:false imageClickCloses:true" class="floatbox" href="' . $videolink . '"> <div style="position:absolute;right:4px;bottom:4px;"> <img style="border:0 !important;" src="http://redesigndavid.com/wp-content/themes/redesigndavid-wp/socialicons/24/' . $service . '.png"/></div> <img class="imageclass" width="620px" src="' . $linkimage . '" > </a> </div>'; } catch (Exception $e) { echo "helloworld"; } }