Ejemplo n.º 1
0
                        <?php 
                }
                ?>
						                                               
					<?php 
            } else {
                ?>
                        <?php 
                if (!empty($gallery_img['gallery_post_video'])) {
                    ?>
                            <li data-thumb="<?php 
                    echo parse_video_url($gallery_img['gallery_post_video'], 'hqthumb');
                    ?>
" class="play3">
                                <?php 
                    echo parse_video_url($gallery_img['gallery_post_video'], 'embed', '765', '478');
                    ?>
                            </li>                                            
                        <?php 
                } else {
                    ?>
							<li data-thumb="<?php 
                    $params = array('width' => 80, 'height' => 80, 'crop' => true);
                    echo bfi_thumb($gallery_img['gallery_post_image'], $params);
                    ?>
">
								<?php 
                    if (!empty($gallery_img['gallery_post_image_caption'])) {
                        ?>
<div class="bigcaption"><?php 
                        echo $gallery_img['gallery_post_image_caption'];
Ejemplo n.º 2
0
    function wpsm_thumb($size = 'small')
    {
        global $post;
        if ($size == 'medium_news') {
            $width = 370;
            $height = 220;
            $nothumb = get_template_directory_uri() . '/images/default/noimage_370_220.png';
        } elseif ($size == 'med_thumbs') {
            $width = 123;
            $height = 90;
            $nothumb = get_template_directory_uri() . '/images/default/noimage_123_90.png';
        } elseif ($size == 'feature_slider') {
            $width = 765;
            $height = 460;
            $nothumb = get_template_directory_uri() . '/images/default/noimage_765_460.jpg';
        } elseif ($size == 'video_big') {
            $width = 474;
            $height = 342;
            $nothumb = get_template_directory_uri() . '/images/default/noimage_474_342.png';
        } elseif ($size == 'video_narrow') {
            $width = 270;
            $height = 110;
            $nothumb = get_template_directory_uri() . '/images/default/noimage_270_110.png';
        } elseif ($size == 'news_big') {
            $width = 378;
            $height = 310;
            $nothumb = get_template_directory_uri() . '/images/default/noimage_378_310.png';
        } elseif ($size == 'grid_news') {
            $width = 336;
            $height = 220;
            $nothumb = get_template_directory_uri() . '/images/default/noimage_336_220.png';
        } else {
            $width = 123;
            $height = 90;
            $nothumb = get_template_directory_uri() . '/images/default/noimage_123_90.png';
        }
        if (rehub_option('aq_resize') == 1) {
            if (rehub_option('aq_resize_crop') == '1') {
                $params = array('width' => $width, 'quality' => '90');
            } else {
                $params = array('width' => $width, 'height' => $height, 'crop' => true, 'quality' => '90');
            }
            $img = get_post_thumb();
            if (!empty($img)) {
                ?>
			<img src="<?php 
                echo bfi_thumb($img, $params);
                ?>
" alt="<?php 
                the_title_attribute();
                ?>
" />
	    <?php 
            } elseif (vp_metabox('rehub_post.rehub_framework_post_type') == 'video' && vp_metabox('rehub_post.video_post.0.video_post_embed_url') != '') {
                ?>
	
	     	<?php 
                $img_video_url = vp_metabox('rehub_post.video_post.0.video_post_embed_url');
                $img_video = parse_video_url($img_video_url, 'hqthumb');
                ?>
	
        	<img src="<?php 
                echo $img_video;
                ?>
" alt="<?php 
                the_title_attribute();
                ?>
" />
        <?php 
            } else {
                ?>
			<img src="<?php 
                echo $nothumb;
                ?>
" alt="<?php 
                the_title_attribute();
                ?>
" />
		<?php 
            }
        } else {
            $image_id = get_post_thumbnail_id($post->ID);
            $image_url = wp_get_attachment_image($image_id, $size, false, array('alt' => get_the_title(), 'title' => get_the_title()));
            if (!empty($image_url)) {
                ?>
			<?php 
                echo $image_url;
                ?>
	    <?php 
            } elseif (vp_metabox('rehub_post.rehub_framework_post_type') == 'video' && vp_metabox('rehub_post.video_post.0.video_post_embed_url') != '') {
                ?>
	
	     	<?php 
                $img_video_url = vp_metabox('rehub_post.video_post.0.video_post_embed_url');
                $img_video = parse_video_url($img_video_url, 'hqthumb');
                ?>
	
        	<img src="<?php 
                echo $img_video;
                ?>
" alt="<?php 
                the_title_attribute();
                ?>
"/>
        <?php 
            } else {
                ?>
			<img src="<?php 
                echo $nothumb;
                ?>
" alt="<?php 
                the_title_attribute();
                ?>
" />
		<?php 
            }
        }
    }
Ejemplo n.º 3
0
 function wpsm_shortcode_AddVideo($atts, $content = null)
 {
     $schema = $width = $height = $title = $description = '';
     @extract($atts);
     if ($schema == 'yes') {
         $width = $width ? $width : '703';
         $height = $height ? $height : '395';
     } else {
         $width = $width ? $width : '765';
         $height = $height ? $height : '430';
     }
     $title = $title ? $title : get_the_title();
     $description = $description ? $description : get_the_title();
     if ($schema == 'yes') {
         $out = '<div class="media_video clearfix" itemscope itemtype="http://schema.org/VideoObject"><meta content="' . $title . '" itemprop="name"><meta itemprop="thumbnail" content="' . parse_video_url($content, "hqthumb") . '"><div class="clearfix inner"><div class="video-container">' . parse_video_url($content, "embed", "{$width}", "{$height}") . '</div><h4 itemprop="name">' . $title . '</h4><p itemprop="description">' . $description . '</p></div></div>';
     } else {
         $out = '<div class="video-container">' . parse_video_url($content, "embed", "{$width}", "{$height}") . '</div>';
     }
     return $out;
 }
/**
 * Read short urls text file tumblr_likes.txt
 * deal with every short url:
 *     1 read the unwanted_files.txt for name of files that we don't need
 *     2 fetch out long url of short url, if failed write the short url to invalid_urls.txt
 *     3 fetch out resource uris inside html content of long url, filter this uris by the content of unwanted_files.txt
 *     4 write out the resource uris to resource_urls.txt
 * @param null $direct_url if specific deal with this single url instead of reading tumblr_likes.txt
 */
function main($direct_url = null)
{
    $txt = $direct_url ? $direct_url : file_get_contents('tumblr_likes.txt');
    if (preg_match_all('#http://ift.tt/.*#', $txt, $matches)) {
        $unwanted = file_get_contents('unwanted_files.txt');
        #deal with each short url
        foreach ($matches[0] as $ori_url) {
            try {
                echo str_repeat('-', 30), "\n";
                echo "Start: {$ori_url}\n";
                #get long url
                $redirect_url = get_redirect_target($ori_url);
                if (!$redirect_url) {
                    file_put_contents('invalid_urls.txt', "{$ori_url}\n", FILE_APPEND);
                    throw new exception("invalid original URL {$ori_url}");
                } else {
                    #file_put_contents('real_post_urls.txt', "$redirect_url\n", FILE_APPEND);
                }
                echo "Location fetched: {$redirect_url}\n";
                #get html page content
                $page_src = get_page_src($redirect_url);
                if (!$page_src) {
                    throw new exception("zero length page_src");
                }
                printf("Page fetched: length(%d)\n", strlen($page_src));
                #fetch out resource urls
                $resource_urls = array();
                $post_type = get_post_type($page_src);
                switch ($post_type) {
                    case 'photo':
                    case 'photoset':
                        $resource_urls = parse_img_urls($page_src);
                        break;
                    case 'audio':
                        echo "fetching audio\n";
                        $resource_urls = parse_audio_url($page_src);
                        break;
                    case 'video':
                        echo "fetching video\n";
                        $resource_urls = parse_video_url($page_src);
                        break;
                    default:
                        echo 'unknown resource, trying images', "\n";
                        $resource_urls = parse_img_urls($page_src);
                }
                if (is_array($resource_urls)) {
                    foreach ($resource_urls as $index => $url) {
                        if (strpos($unwanted, basename($url)) !== false) {
                            unset($resource_urls[$index]);
                        }
                    }
                    $resource_urls = implode("\n", $resource_urls);
                }
                echo $resource_urls .= "\n";
                file_put_contents('resource_urls.txt', $resource_urls, FILE_APPEND);
            } catch (exception $e) {
                echo 'Exception: ', $e->getMessage(), "\n";
            }
        }
    }
}
Ejemplo n.º 5
0
    $image_id = get_post_thumbnail_id($post->ID);
    $size = 'feature_slider';
    $image_url = wp_get_attachment_image($image_id, $size, false, array('alt' => get_the_title(), 'title' => get_the_title()));
    $nothumb = get_stylesheet_directory_uri() . '/images/default/noim.png';
    if (!empty($image_url)) {
        ?>
                    <?php 
        echo $image_url;
        ?>
                <?php 
    } elseif (vp_metabox('rehub_post.rehub_framework_post_type') == 'video' && vp_metabox('rehub_post.video_post.0.video_post_embed_url') != '') {
        ?>
   
                    <?php 
        $img_video_url = vp_metabox('rehub_post.video_post.0.video_post_embed_url');
        $img_video = parse_video_url($img_video_url, 'hqthumb');
        ?>
   
                    <img src="<?php 
        echo $img_video;
        ?>
" alt="<?php 
        the_title_attribute();
        ?>
"/>
                <?php 
    } else {
        ?>
                    <img src="<?php 
        echo $nothumb;
        ?>