Exemplo n.º 1
0
 function block($instance)
 {
     extract($instance);
     $id = !empty($id) ? ' id="' . esc_attr($id) . '"' : '';
     $userclass = !empty($class) ? ' ' . esc_attr($class) : '';
     $style = !empty($style) ? esc_attr($style) : '';
     switch ($imagetype) {
         case 'none':
             $imageclass = '';
             break;
         case 'rounded':
             $imageclass = ' class="img-rounded"';
             break;
         case 'circle':
             $imageclass = ' class="img-circle"';
             break;
         case 'polaroid':
             $imageclass = ' class="img-polaroid"';
             break;
     }
     $imageid = get_image_id(esc_url($media));
     $image = wp_get_attachment_image_src($imageid, $imagesize);
     $btnclass = 'btn';
     switch ($btncolor) {
         case 'grey':
             $btnclass .= '';
             break;
         case 'blue':
             $btnclass .= ' btn-primary';
             break;
         case 'lightblue':
             $btnclass .= ' btn-info';
             break;
         case 'green':
             $btnclass .= ' btn-success';
             break;
         case 'yellow':
             $btnclass .= ' btn-warning';
             break;
         case 'red':
             $btnclass .= ' btn-danger';
             break;
         case 'black':
             $btnclass .= ' btn-inverse';
             break;
     }
     switch ($btnsize) {
         case 'default':
             $btnclass .= '';
             break;
         case 'large':
             $btnclass .= ' btn-large';
             break;
         case 'small':
             $btnclass .= ' btn-small';
             break;
         case 'mini':
             $btnclass .= ' btn-mini';
             break;
         case 'block':
             $btnclass .= ' btn-block';
             break;
     }
     switch ($align) {
         case 'left':
             $alignclass = ' align-left';
             break;
         case 'center':
             $alignclass = ' align-center';
             break;
         case 'right':
             $alignclass = ' align-right';
             break;
     }
     $output = '';
     $output .= '<div' . $id . ' class="features well well-shadow' . $alignclass . $userclass . '" style="background: ' . $bgcolor . ';color: ' . $textcolor . ';' . $style . '">';
     $output .= '<img src="' . $image[0] . '"' . $imageclass . ' />';
     $output .= '<div class="clear padding5"></div>';
     $output .= '<' . $heading . '>' . strip_tags($title) . '</' . $heading . '>';
     $output .= '<div class="opacity8">' . wpautop(do_shortcode(mpt_content_kses(htmlspecialchars_decode($text)))) . '</div>';
     if ($enablebtn == '1') {
         $output .= '<a href="' . esc_url($btnlink) . '"' . ($btnlinkopen == 'new' ? ' target="_blank"' : '') . '>';
         $output .= '<button class="' . $btnclass . '">' . esc_attr($btntext) . '</button>';
         $output .= '</a>';
     }
     $output .= '</div>';
     echo $output;
 }
Exemplo n.º 2
0
function mpt_load_image_carousel($id, $imagesize = 'tb-360', $prettyphoto = false)
{
    $themefolder = get_template_directory_uri();
    $output = '';
    $image1 = get_post_meta($id, '_mpt_video_featured_image_2', true);
    $imageurl1 = esc_url($image1);
    $attachid1 = get_image_id($imageurl1);
    $image2 = get_post_meta($id, '_mpt_video_featured_image_3', true);
    $imageurl2 = esc_url($image2);
    $attachid2 = get_image_id($imageurl2);
    $fullimage = wp_get_attachment_image_src(get_post_thumbnail_id($id), 'full');
    if ($imagesize == 'tb-860') {
        $style = ' style="max-width: 860px;"';
    } else {
        $style = '';
    }
    $output .= '<div id="image-carousel-' . $id . '" class="image-carousel carousel slide add-shadow-effect"' . $style . '>';
    $output .= '<div class="carousel-inner">';
    $output .= '<div class="active item">';
    if ($prettyphoto == 'true') {
        $output .= '<a href="' . $fullimage[0] . '" rel="prettyPhoto[carousel-' . $id . ']">';
    } else {
        $output .= '<a href="' . get_permalink($id) . '">';
    }
    $output .= get_the_post_thumbnail($id, $imagesize);
    $output .= '</a></div>';
    if (!empty($image1)) {
        $output .= '<div class="item">';
        if ($prettyphoto == 'true') {
            $output .= '<a href="' . $imageurl1 . '" rel="prettyPhoto[carousel-' . $id . ']">';
        } else {
            $output .= '<a href="' . get_permalink($id) . '">';
        }
        $output .= wp_get_attachment_image($attachid1, $imagesize);
        $output .= '</a></div>';
    }
    if (!empty($image2)) {
        $output .= '<div class="item">';
        if ($prettyphoto == 'true') {
            $output .= '<a href="' . $imageurl2 . '" rel="prettyPhoto[carousel-' . $id . ']">';
        } else {
            $output .= '<a href="' . get_permalink($id) . '">';
        }
        $output .= wp_get_attachment_image($attachid2, $imagesize);
        $output .= '</a></div>';
    }
    $output .= '</div>';
    $output .= '<a class="carousel-control left" href="#image-carousel-' . $id . '" data-slide="prev"><img src="' . $themefolder . '/img/back.png"></a>';
    $output .= '<a class="carousel-control right" href="#image-carousel-' . $id . '" data-slide="next"><img src="' . $themefolder . '/img/next.png"></a>';
    $output .= '</div>';
    $output .= '<script type="text/javascript">';
    $output .= 'jQuery(document).ready(function () {jQuery("#image-carousel-' . $id . '").carousel({interval: 3000,pause: "hover"})});';
    $output .= '</script>';
    echo $output;
}
            }
            ?>
">
            <?php 
            if (has_post_thumbnail()) {
                the_post_thumbnail($thumb_type);
            } else {
                $post_type = get_post_type();
                if ($post_type == 'post') {
                    $image_id = get_image_id('News Default Image');
                }
                if ($post_type == 'public_notice') {
                    $image_id = get_image_id('Public Notice Default Image');
                }
                if ($post_type == 'tribe_events') {
                    $image_id = get_image_id('Events Default Image');
                }
                $atts = array('class' => 'wp-post-image');
                echo wp_get_attachment_image($image_id, $thumb_type, false, $atts);
            }
            ?>
            <h3><a href="<?php 
            the_permalink();
            ?>
"><?php 
            the_title();
            ?>
</a></h3>
            <?php 
            if ($i == 1) {
                ?>
Exemplo n.º 4
0
    $thumbs[] = $bw_gallery->get_thumb_for_slide(1);
    $thumbs[] = $bw_gallery->get_thumb_for_slide(2);
    $thumbs[] = $bw_gallery->get_thumb_for_slide(3);
    $urls = array();
    $urls[] = $bw_gallery->get_url_for_slide(0);
    $urls[] = $bw_gallery->get_url_for_slide(1);
    $urls[] = $bw_gallery->get_url_for_slide(2);
    $urls[] = $bw_gallery->get_url_for_slide(3);
    wp_reset_query();
    ?>
	<div style="width: 100%; clear: both;">
		<?php 
    $x = 0;
    foreach ($thumbs as $thumb) {
        if ($thumb != '') {
            $id = get_image_id($thumb);
            $img = wp_get_attachment_image($id, 'bw-main-featured-small');
            ?>

				<div class="gallery_article_thumb" style="width: 25%;"><a href="<?php 
            echo $urls[$x];
            ?>
"><?php 
            echo $img;
            ?>
</a></div>
				<?php 
        }
        $x++;
    }
    ?>
Exemplo n.º 5
0
    function block($instance)
    {
        extract($instance);
        $id = !empty($id) ? ' id="' . esc_attr($id) . '"' : '';
        $userclass = !empty($class) ? ' ' . esc_attr($class) : '';
        $style = !empty($style) ? ' ' . esc_attr($style) : '';
        ?>

		<div id="staff-block">
			<div<?php 
        echo $id;
        ?>
 class="well well-small<?php 
        echo $userclass;
        ?>
" style="background: <?php 
        echo $bgcolor;
        ?>
; color: <?php 
        echo $textcolor;
        ?>
;<?php 
        echo $style;
        ?>
">

				<?php 
        if (!empty($media)) {
            $attachid = get_image_id(esc_url($media));
            ?>
 
					<center>
						<?php 
            echo wp_get_attachment_image($attachid, 'tb-360');
            ?>
					</center>
				<?php 
        }
        ?>

				<div class="inner">		
					
					<h3 style="color: <?php 
        echo $textcolor;
        ?>
;"><?php 
        echo strip_tags($title);
        ?>
 <small style="color: <?php 
        echo $textcolor;
        ?>
;"><?php 
        echo strip_tags($position);
        ?>
</small></h3>

					<?php 
        echo wpautop(do_shortcode(mpt_content_kses(htmlspecialchars_decode($text))));
        ?>
					
					<center><div class="btn-group">
				    
						<?php 
        if (!empty($fb)) {
            ?>
 
						    <a href="<?php 
            echo esc_url($fb);
            ?>
" class="btn"><img src="<?php 
            echo get_template_directory_uri();
            ?>
/img/icon/14/facebook.png" height="14" width="14"></a>
					    <?php 
        }
        ?>
						   
						<?php 
        if (!empty($twitter)) {
            ?>
 
						    <a href="<?php 
            echo esc_url($twitter);
            ?>
" class="btn"><img src="<?php 
            echo get_template_directory_uri();
            ?>
/img/icon/14/twitter.png" height="14" width="14"></a>
					    <?php 
        }
        ?>

					    <?php 
        if (!empty($email) && is_email($email) != 'false') {
            ?>
 
						    <a href="mailto:<?php 
            echo is_email($email);
            ?>
" class="btn"><i class="icon-envelope"></i></a>
					    <?php 
        }
        ?>
			    	
			    	</div></center>

			    </div>

			</div>

		</div>

		<?php 
    }
Exemplo n.º 6
0
 function block($instance)
 {
     extract($instance);
     $classoutput = '';
     $id = !empty($id) ? ' id="' . esc_attr($id) . '"' : '';
     $userclass = !empty($class) ? esc_attr($class) : '';
     $style = !empty($style) ? ' style="' . esc_attr($style) . '"' : '';
     switch ($type) {
         case 'none':
             $classoutput .= '';
             break;
         case 'rounded':
             $classoutput .= 'img-rounded ';
             break;
         case 'circle':
             $classoutput .= 'img-circle ';
             break;
         case 'polaroid':
             $classoutput .= 'img-polaroid ';
             break;
     }
     switch ($align) {
         case 'none':
             $classoutput .= '';
             $frontdiv = '';
             $enddiv = '';
             break;
         case 'left':
             $classoutput .= 'pull-left ';
             $frontdiv = '';
             $enddiv = '';
             break;
         case 'center':
             $frontdiv = '<center>';
             $enddiv = '</center>';
             break;
         case 'right':
             $classoutput .= 'pull-right ';
             $frontdiv = '';
             $enddiv = '';
             break;
     }
     $classoutput .= $userclass;
     $imageid = get_image_id(esc_url($media));
     $fullimage = wp_get_attachment_image_src($imageid, 'full');
     $image = wp_get_attachment_image_src($imageid, $imagesize);
     $output = '';
     $output .= $frontdiv;
     $output .= !empty($link) ? '<a href="' . esc_url($link) . '">' : '<a href="' . $fullimage[0] . '" rel="prettyPhoto[image-block]">';
     $output .= '<img src="' . $image[0] . '"' . $id . (!empty($classoutput) ? ' class="' . $classoutput . '"' : '') . $style . ' />';
     $output .= '</a>';
     $output .= $enddiv;
     echo $output;
 }
function get_backup_images()
{
    $args = array('fields' => 'slugs');
    $cats = wp_get_object_terms(get_the_ID(), 'tribe_events_cat', $args);
    $atts = array('class' => 'wp-post-image');
    if (in_array('arts', $cats)) {
        $image_id = get_image_id('Arts Default Image');
        echo wp_get_attachment_image($image_id, 'module-lowerx2', false, $atts);
    }
    if (in_array('city-meetings', $cats)) {
        $image_id = get_image_id('City Meetings Default Image');
        echo wp_get_attachment_image($image_id, 'module-lowerx2', false, $atts);
    }
    if (in_array('community', $cats)) {
        $image_id = get_image_id('Community Default Image');
        echo wp_get_attachment_image($image_id, 'module-lowerx2', false, $atts);
    }
    if (in_array('library', $cats)) {
        $image_id = get_image_id('Library Default Image');
        echo wp_get_attachment_image($image_id, 'module-lowerx2', false, $atts);
    }
    if (in_array('music', $cats)) {
        $image_id = get_image_id('Music Default Image');
        echo wp_get_attachment_image($image_id, 'module-lowerx2', false, $atts);
    }
    if (in_array('parks-adult-sports-tournamentsspecial-events', $cats)) {
        $image_id = get_image_id('Sports Default Image');
        echo wp_get_attachment_image($image_id, 'module-lowerx2', false, $atts);
    }
    if (in_array('parks-youthteen-sports-tournamentsspecial-events', $cats)) {
        $image_id = get_image_id('Sports Default Image');
        echo wp_get_attachment_image($image_id, 'module-lowerx2', false, $atts);
    }
    if (in_array('sports', $cats)) {
        $image_id = get_image_id('Sports Default Image');
        echo wp_get_attachment_image($image_id, 'module-lowerx2', false, $atts);
    }
}
Exemplo n.º 8
0
function get_image_by_template($template = '', $before = '', $after = '')
{
    if ($template == '' || $template == 'default') {
        $template = '<img width="%IMAGE_WIDTH%" height="%IMAGE_HEIGHT%" id="%IMAGE_ID%" src="%IMAGE_URL%" alt="%IMAGE_FILENAME%" />';
    }
    $template = $before . $template . $after;
    $patterns = array('IMAGE_ID' => get_image_id(), 'IMAGE_REAL_ID' => get_image_real_id(), 'IMAGE_FILENAME' => get_image_filename(), 'IMAGE_URL' => get_image_url(), 'IMAGE_VIEWER' => get_image_viewer(), 'IMAGE_SHORTURL' => get_image_shorturl(), 'IMAGE_WIDTH' => get_image_width(), 'IMAGE_HEIGHT' => get_image_height(), 'IMAGE_SIZE' => get_image_size(), 'IMAGE_SIZE_BYTES' => get_image_size_bytes(), 'IMAGE_THUMB_WIDTH' => get_image_thumb_width(), 'IMAGE_THUMB_HEIGHT' => get_image_thumb_height(), 'IMAGE_THUMB_URL' => get_image_thumb_url());
    return preg_replace('/%([a-z_]+)%/ie', '$patterns["$1"]', $template);
}
Exemplo n.º 9
0
function get_image_file_by_name($dbc, $name)
{
    $image_id = get_image_id($dbc, $name);
    return get_image_file_by_id($dbc, $image_id);
}