function bbcodeYoutube($dom, $contents, $arg) { global $mobileLayout; $contents = trim($contents); $id = getYoutubeIdFromUrl($contents); if ($id) { $contents = $id; } if (!preg_match("/^[\\-0-9_a-zA-Z]+\$/", $contents)) { return $dom->createTextNode("[Invalid youtube video ID]"); } if ($mobileLayout) { $link = $dom->createElement('a'); $link->setAttribute('href', "https://www.youtube.com/watch?v={$contents}"); $link->appendChild($dom->createTextNode(__('[View video]'))); return $link; } $args = ""; if ($arg == "loop") { $args .= "&loop=1"; } $frame = $dom->createElement('iframe'); $frame->setAttribute('width', 560); $frame->setAttribute('height', 315); $frame->setAttribute('src', "//www.youtube-nocookie.com/embed/{$contents}"); $frame->setAttribute('frameborder', 0); $frame->setAttribute('allowfullscreen', ""); return $frame; }
function wpt_destaque_midia($post) { $midia_destaque = get_post_meta($post->ID, 'midia_destaque', true); $modelo_destaque = get_post_meta($post->ID, 'modelo_destaque', true); $background_img_url = get_post_meta($post->ID, 'background_img_url', true); $midia_html = ''; $isVideo = $modelo_destaque == 'video_texto' || $modelo_destaque == 'video_full'; if ($isVideo) { $img = 'none'; $video = 'block'; } else { $img = 'block'; $video = 'none'; } $midia_html .= '<p class="midia_video" style="display:' . $video . ';">Coloque a url do vĂdeo no youtube na caixa abaixo.</p>'; $midia_html .= '<input id="midia_destaque" class="midia_video" type="text" size="80" name="midia_destaque" value="' . $midia_destaque . '" style="display:' . $video . ';" />'; $midia_html .= '<div class="midia_imagem" style="display:' . $img . '" id="img_preview" >'; if (!$isVideo) { if ($background_img_url) { $midia_html .= '<div class="fill has-background" style="max-width:100%;height:auto;width:auto;background-image:url(' . $background_img_url . ')">'; $midia_html .= '<a href="' . get_post_meta(get_the_ID(), 'destaque_link', true) . '">'; $midia_html .= get_the_post_thumbnail(null, 'post-thumbnail', array('style' => 'max-width:100%;height:auto;width:auto;')); $midia_html .= '</a></div>'; } else { $midia_html .= get_the_post_thumbnail(null, 'post-thumbnail', array('style' => 'max-width:100%;height:auto;width:auto;')); } } $midia_html .= '</div>'; if ($midia_destaque && $midia_destaque != '') { if ($isVideo && getYoutubeIdFromUrl($midia_destaque)) { echo do_shortcode('[youtube id="' . getYoutubeIdFromUrl($midia_destaque) . '"]'); } } $midia_html .= '</label>'; echo $midia_html; }
function bbcodeYoutube($contents, $arg, $parenttag) { $contents = trim($contents); $id = getYoutubeIdFromUrl($contents); if ($id) { $contents = $id; } if (!preg_match("/^[\\-0-9_a-zA-Z]+\$/", $contents)) { return "[Invalid youtube video ID]"; } return '[youtube]' . $contents . '[/youtube]'; }
$first_item = true; while ($destaques->have_posts()) { echo '<div class="item'; if ($first_item) { echo ' active'; $first_item = false; } echo '">'; $destaques->the_post(); $modelo_destaque = get_post_meta(get_the_ID(), 'modelo_destaque', true); $isVideo = $modelo_destaque == 'video_texto' || $modelo_destaque == 'video_full'; if ($isVideo) { ?> <div class="fill"> <?php echo do_shortcode('<iframe src="http://www.youtube.com/embed/' . getYoutubeIdFromUrl(get_post_meta(get_the_ID(), 'midia_destaque', true)) . '" width="100%" height="100%" frameborder="0" allowfullscreen></iframe>'); ?> </div> <?php } else { //is image :) $background_img_url = get_post_meta(get_the_ID(), 'background_img_url', true); $texto_destaque = get_post_meta(get_the_ID(), 'destaque_texto', true); if ($background_img_url) { ?> <div class="fill has-background" style="background-image:url(<?php echo $background_img_url; ?> )"> <a href=" <?php echo get_post_meta(get_the_ID(), 'destaque_link', true);
function youtubeminer() { global $db, $mybb, $templates; $previousLink = ''; $nextLink = ''; $start = 0; $length = 20; // build navigation link parse_str($_SERVER['QUERY_STRING'], $params); $start = 0; if (is_numeric($params['start'])) { $start = (int) $params['start']; } $next = $start + 20; $previous = $start > 20 ? $start - 20 : 0; $host = $_SERVER['HTTP_HOST']; $previousLink = "http://" . $host . '/youtubeminer.php?start=' . $previous; $nextLink = "http://" . $host . '/youtubeminer.php?start=' . $next; if ($start == 0) { $previousLink = '#'; } //build gallery $count = 0; $query = $db->query("SELECT p.pid,p.subject,p.message FROM " . TABLE_PREFIX . "posts p WHERE p.message LIKE \"%[video=youtube]%[/video]%\" ORDER BY p.subject LIMIT " . $start . "," . $length); $youtubeGallery = ''; $count = 0; while ($post = $db->fetch_array($query)) { preg_match("/\\[video=youtube\\](.*?)\\[\\/video\\]/m", $post['message'], $matches); if (is_array($matches) && count($matches) > 1) { //TODO: remove watch? from youtube link $videoid = getYoutubeIdFromUrl($matches[1]); if ($videoid == false) { continue; } $videolink = 'http://youtube.com/v/' . $videoid . '?autoplay=1&rel=0&enablejsapi=1&playerapiid=ytplayer"'; $imagelink = 'http://img.youtube.com/vi/' . $videoid . '/default.jpg'; $youtubeGallery .= '<a class="voverlay" href="' . $videolink . ' title="' . $post['subject'] . '"><img src="' . $imagelink . '" alt="' . $post['subject'] . '" /><span></span></a>'; $count++; } } if ($count < $length) { $nextLink = '#'; } $data = array('previousLink' => $previousLink, 'nextLink' => $nextLink, 'youtubeGallery' => $youtubeGallery); return $data; }