Ejemplo n.º 1
0
function catch_that_image_id($post)
{
    $first_img = '';
    $url = wp_get_attachment_url(get_post_thumbnail_id($post->ID, 'thumbnail'));
    if (empty($url)) {
        ob_start();
        ob_end_clean();
        $output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches);
        $first_img = $matches[1][0];
        if (empty($first_img)) {
            $first_img = find_img_src($post);
            if (empty($first_img)) {
                $first_img = get_template_directory_uri() . "/images/no-image.jpg";
            }
        }
    } else {
        $first_img = $url;
    }
    return remove_http($first_img);
}
Ejemplo n.º 2
0
get_header();
?>
<div class="site-download">
	<div id="site-breadcrumbs">
		<?php 
NQD_breadcrumbs();
?>
	</div>
		<div class="post-container">
			<div class="post-info" itemscope itemtype="http://data-vocabulary.org/Recipe">
				<div class="post_thumb">
					<img itemprop="photo" src="<?php 
bloginfo('home');
?>
/media/resizer/57x57/r/<?php 
echo remove_http(catch_that_image());
?>
" title="<?php 
the_title();
?>
">
				</div>
				<h1 itemprop="name"><?php 
the_title();
?>
</h1>
				<div class="info">
					<span class="post_date"><?php 
echo time_stamp(get_post_time('U', true));
?>
</span>
Ejemplo n.º 3
0
		<span class="ribbon ribbon_<?php 
if (strtotime($post->post_date_gmt) == strtotime($post->post_modified_gmt)) {
    echo 'new';
} else {
    echo 'update';
}
?>
"></span>
		<span class="shadown"><img alt="<?php 
the_title();
?>
" src="<?php 
bloginfo('home');
?>
/media/resizer/64x64/r/<?php 
echo remove_http(catch_that_image($post));
?>
"></span>
		<span class="comment"><a href="<?php 
the_permalink();
?>
" title="<?php 
the_title();
?>
">
		<?php 
if (in_category('1')) {
    $url = get_the_title();
    echo '<strong>' . $url . '</strong>';
} else {
    $url = get_the_title();
Ejemplo n.º 4
0
    if ($image_info || $ad_bookmarker || $ad_showsubmitter) {
        $bc = $ad_showcomment ? '' : ' style="border-bottom:1px solid #DCDCDC"';
        ?>
<table width="100%" cellpadding="0" cellspacing="0" border="0" class="dg_body_background_details"<?php 
        echo $bc;
        ?>
>
  <tr>
    <?php 
        if ($image_info) {
            ?>
    <td class="details">
      <?php 
            if ($ad_showimgauthor) {
                if ($obj->imgauthor && $obj->imgauthorurl) {
                    $link = '<a rel="nofollow" class="dgtip" href="http://' . remove_http($obj->imgauthorurl) . '" target="_blank" class="dgtip" id="' . JText::_('COM_DATSOGALLERY_GOTO_AUTHOR_URL') . '">' . $obj->imgauthor . '</a>';
                }
                if (!$obj->imgauthorurl) {
                    $link = $obj->imgauthor;
                }
                if (!$obj->imgauthor) {
                    $link = JText::_('COM_DATSOGALLERY_UNKNOWN_AUTHOR');
                }
                echo '<strong>' . JText::_('COM_DATSOGALLERY_AUTHOR') . '</strong>: ' . $link . '<br />';
            }
            echo $ad_showfimgdate ? '<strong>' . JText::_('COM_DATSOGALLERY_DATE_ADD') . '</strong>: ' . strftime($ad_datef, $obj->imgdate) . '<br />' : '';
            echo $ad_showimgcounter ? '<strong>' . JText::_('COM_DATSOGALLERY_HITS') . '</strong>: ' . $obj->imgcounter . '<br />' : '';
            echo $ad_showdownloads ? '<strong>' . JText::_('COM_DATSOGALLERY_DOWNLOADS') . '</strong>: ' . $obj->imgdownloaded . '<br />' : '';
            echo $ad_showres ? '<strong>' . JText::_('COM_DATSOGALLERY_SIZE') . '</strong>: ' . $res . ' / ' . $type . '<br />' : '';
            echo $ad_showfimgsize ? '<strong>' . JText::_('COM_DATSOGALLERY_FILESIZE') . '</strong>: ' . $dgfilesize . '<br />' : '';
            echo $ad_showrating ? showVote($obj->id, $obj->imgvotes, $obj->imgvotesum, true) : '';
Ejemplo n.º 5
0
/**
	* Function wc_slideshow.

	* Produces a slider from list of image URLs 
	* Uses Nivo-Slider Scripts / Library 
	* http://nivo.dev7studios.com/

	* @slider_height (string) - height of the slider in px
	* @slider_width (string) - width of the slider in px
	* @effect (string) - use different effects
	
	* Returns timthumb URL.
*/
function wc_slideshow($atts, $content = null)
{
    global $sa_general;
    extract(shortcode_atts(array('slider_height' => '0', 'slider_width' => '668', 'effect' => 'boxRandom', 'showtitle' => true), $atts));
    $title = '';
    $preStyle = '';
    $IMG_TAGS = '';
    $general_options = get_option('sa_general', $sa_general);
    $use_timthumb = $general_options['use_timthumb'];
    $slider_height_att = '';
    if ($slider_height > 0) {
        $slider_height_att = "height:'" . $slider_height . "'";
    }
    wp_print_scripts('jquery.nivo.slider');
    $effect = strtolower($effect);
    /* Allows User to select their own slider effect. They pass this in with the effect=boxRain attribute. */
    switch ($effect) {
        case 'slicedown':
            $effect = "sliceDown";
            break;
        case 'sliceup':
            $effect = "sliceUp";
            break;
        case 'sliceupdown':
            $effect = "sliceUpDown";
            break;
        case 'fold':
            $effect = "fold";
            break;
        case 'fade':
            $effect = "fade";
            break;
        case 'boxrain':
            $effect = "boxRain";
            break;
        default:
            $effect = "boxRandom";
    }
    // Trim all space off $content.
    $content = trim($content);
    if ($content > "") {
        $doc = new DOMDocument();
        $doc->loadHTML($content);
        $imageTags = $doc->getElementsByTagName('img');
        //$imageHref = $doc->getElementsByTagName('a');
        foreach ($imageTags as $tag) {
            // $content .= $tag->getAttribute('src') ."\n";
            $IMG_TAGS .= $tag->getAttribute('src') . "\n";
        }
    }
    // Remove all IMG TAGS
    $content = preg_replace("/<img[^>]+\\>/i", "", $content);
    // Remove all HREF TAGS
    $content = preg_replace("/<\\/?a(\\s+.*?>|>)/", "", $content);
    // ADD Everything together.
    $content = $content . "\n" . $IMG_TAGS;
    // Organize each line of content into an array.
    $images = !empty($content) ? preg_split("/(\r?\n)/", $content) : '';
    //print_r($images);
    // Check if something exists and that it is an array.
    if (!empty($images) && is_array($images)) {
        // Clear the $content string.
        $content = '';
        // For each image in the array, check for URL's and create the Nivo Slider Content.
        foreach ($images as $image) {
            // Strip any HTML Tags
            $image = trim(strip_tags($image));
            // Separate the image path and link url (looks for comma to distinguish).
            $pos = strpos($image, ',');
            // Look for , and if it exists then we have to split URL and Image path.
            if ($pos === false) {
                $imagePath = $image;
                $imageLink = '';
            } else {
                list($imagePath, $imageLink) = split(',', $image);
            }
            // Clean up any leading or trailing spaces. Make sure to remove http:// and https://
            $imageLink = trim($imageLink);
            $imageLink = remove_http($imageLink);
            // If image path is no empty and it's great than nothing, continue...
            if (!empty($imagePath) && $imagePath > '') {
                // We now use get_attachment_id_from_src() to find the postID of the image attachement (custom function under /functions/common.php).
                $postid = get_attachment_id_from_src($imagePath);
                // Get the image size.
                $image_attributes = wp_get_attachment_image_src($postid, 'full');
                // returns an array
                // Return the post object and title
                $postid = get_post($postid);
                if ($showtitle) {
                    $title = $postid->post_title;
                }
                // Clear tmp vars.
                $imageLinkOpen = "";
                $imageLinkClose = "";
                // Build the tmp vars for the image link (if one was supplied)
                if ($imageLink > "") {
                    $imageLinkOpen = "<a href='http://" . $imageLink . "'>";
                    $imageLinkClose = "</a>";
                }
                // TIMTHUMB OPTION
                if ($use_timthumb) {
                    // Build and add on to the $content string.
                    $content .= $imageLinkOpen . "<img src='" . resize_img($image_attributes[0], $slider_width, $slider_height) . "' width='" . $slider_width . "' " . $slider_height_att . " alt='" . $title . "' title='" . $title . "' data-transition='" . $effect . "' />" . $imageLinkClose;
                } else {
                    // DEFAULT RESIZING OPTION
                    $content .= $imageLinkOpen . "<img src='" . $imagePath . "' width='" . $slider_width . "' " . $slider_height_att . " alt='" . $title . "' title='" . $title . "' data-transition='" . $effect . "' />" . $imageLinkClose;
                }
            }
            //end IF
        }
        // END FOR EACH
        $preHTML = "<div class=\"slider-wrapper theme-default\">\r\n\t\t\t\t\t<div class=\"ribbon\"></div>\r\n\t\t\t\t\t<div id=\"slider\" class=\"nivoSlider\"  style=\"max-width:" . $slider_width . "px\">";
        $postHTML = "</div>\n</div>";
        return $preStyle . $preHTML . $content . $postHTML;
    }
    // END IF
}
Ejemplo n.º 6
0
            if ($pdf != "") {
                $pdf = $pdf['url'];
            }
            $url = get_sub_field('url');
            $lang = get_sub_field('language');
        }
        while (have_rows('media')) {
            the_row();
            $media = get_sub_field('media');
            $url_media = get_sub_field('url');
        }
        if ($pdf != "") {
            echo '<a target="_blank" class="title_article" href="' . $pdf . '">' . $title . '</a>';
        } elseif ($url != "") {
            echo '<a target="_blank" class="title_article" href="//' . remove_http($url) . '">' . $title . '</a>';
        } else {
            echo '<span class="title_article">' . $title . '</span>';
        }
        echo '<br><span class="author">' . implode(', ', $authors) . '</span>';
        if ($media != "") {
            if ($url_media != "") {
                echo '<a target="_blank" class="media" href="//' . remove_http($url_media) . '">' . $media . '</a>';
            } else {
                echo '<span class="media">' . $media . '</span>';
            }
        }
        echo '</li>';
    }
    echo '</ul></article>';
}
echo '</div></section>';