Ejemplo n.º 1
0
 /**
  * Hoovered gallery.
  *
  * @param array $attachments_data Attachments data array.
  * @param array $options Gallery options.
  *
  * @return string HTML.
  */
 function presscore_get_images_gallery_hoovered($attachments_data, $options = array())
 {
     if (empty($attachments_data)) {
         return '';
     }
     // clear attachments_data
     foreach ($attachments_data as $index => $data) {
         if (empty($data['full'])) {
             unset($attachments_data[$index]);
         }
     }
     unset($data);
     if (empty($attachments_data)) {
         return '';
     }
     static $gallery_counter = 0;
     $gallery_counter++;
     $id_mark_prefix = 'pp-gallery-hoovered-media-content-' . $gallery_counter . '-';
     $default_options = array('echo' => false, 'class' => array(), 'links_rel' => '', 'style' => '', 'share_buttons' => false, 'exclude_cover' => false, 'title_img_options' => array(), 'title_image_args' => array(), 'attachments_count' => null, 'show_preview_on_hover' => true, 'video_icon' => true);
     $options = wp_parse_args($options, $default_options);
     $class = implode(' ', (array) $options['class']);
     $small_images = array_slice($attachments_data, 1);
     $big_image = current($attachments_data);
     if (!is_array($options['attachments_count']) || count($options['attachments_count']) < 2) {
         $attachments_count = presscore_get_attachments_data_count($options['exclude_cover'] ? $small_images : $attachments_data);
     } else {
         $attachments_count = $options['attachments_count'];
     }
     list($images_count, $videos_count) = $attachments_count;
     $count_text = array();
     if ($images_count) {
         $count_text[] = sprintf(_n('1 image', '%s images', $images_count, 'the7mk2'), $images_count);
     }
     if ($videos_count) {
         $count_text[] = sprintf(__('%s video', 'the7mk2'), $videos_count);
     }
     $count_text = implode(',&nbsp;', $count_text);
     $image_args = array('img_class' => 'preload-me', 'class' => $class, 'custom' => implode(' ', array($options['links_rel'], $options['style'])), 'echo' => false);
     $image_hover = '';
     $mini_count = 3;
     $html = '';
     $share_buttons = '';
     if ($options['share_buttons']) {
         $share_buttons = presscore_get_share_buttons_for_prettyphoto('photo');
     }
     // medium images
     if (!empty($small_images)) {
         $html .= '<div class="dt-gallery-container mfp-hide"' . $share_buttons . '>';
         foreach ($attachments_data as $key => $data) {
             if ($options['exclude_cover'] && 0 == $key) {
                 continue;
             }
             $small_image_args = array('img_meta' => $data['thumbnail'], 'img_id' => empty($data['ID']) ? $data['ID'] : 0, 'alt' => $data['title'], 'title' => $data['description'], 'href' => esc_url($data['full']), 'custom' => '', 'class' => 'mfp-image');
             if ($options['share_buttons']) {
                 $small_image_args['custom'] = 'data-dt-location="' . esc_attr($data['permalink']) . '" ';
             }
             $mini_image_args = array('img_meta' => $data['thumbnail'], 'img_id' => empty($data['ID']) ? $data['ID'] : 0, 'alt' => $data['title'], 'title' => $data['description'], 'wrap' => '<img %IMG_CLASS% %SRC% %ALT% %IMG_TITLE% width="90" />');
             if ($mini_count && !(!$options['exclude_cover'] && 0 == $key) && $options['show_preview_on_hover']) {
                 $image_hover = '<span class="r-thumbn-' . $mini_count . '">' . dt_get_thumb_img(array_merge($image_args, $mini_image_args)) . '<i>' . $count_text . '</i></span>' . $image_hover;
                 $mini_count--;
             }
             if (!empty($data['video_url'])) {
                 $small_image_args['href'] = $data['video_url'];
                 $small_image_args['class'] = 'mfp-iframe';
             }
             $html .= sprintf('<a href="%s" title="%s" class="%s" data-dt-img-description="%s" %s></a>', esc_url($small_image_args['href']), esc_attr($small_image_args['alt']), esc_attr($small_image_args['class'] . ' dt-mfp-item'), esc_attr($small_image_args['title']), $small_image_args['custom']);
         }
         $html .= '</div>';
     }
     unset($image);
     if ($image_hover && $options['show_preview_on_hover']) {
         $image_hover = '<span class="rollover-thumbnails">' . $image_hover . '</span>';
     }
     // big image
     $big_image_args = array('img_meta' => array($big_image['full'], $big_image['width'], $big_image['height']), 'img_id' => empty($big_image['ID']) ? $big_image['ID'] : 0, 'wrap' => '<a %HREF% %CLASS% %CUSTOM% %TITLE%><img %SRC% %IMG_CLASS% %ALT% %IMG_TITLE% %SIZE% />' . $image_hover . '</a>', 'alt' => $big_image['alt'], 'title' => $big_image['title'], 'class' => $class, 'options' => $options['title_img_options']);
     if (empty($small_images)) {
         $big_image_args['custom'] = ' data-dt-img-description="' . esc_attr($big_image['description']) . '"' . $share_buttons;
         if ($options['share_buttons']) {
             $big_image_args['custom'] = ' data-dt-location="' . esc_attr($big_image['permalink']) . '"' . $big_image_args['custom'];
         }
         $big_image_args['class'] .= ' dt-single-mfp-popup dt-mfp-item mfp-image';
     } else {
         $big_image_args['custom'] = $image_args['custom'];
         $big_image_args['class'] .= ' dt-gallery-mfp-popup';
     }
     $big_image_args = apply_filters('presscore_get_images_gallery_hoovered-title_img_args', $big_image_args, $image_args, $options, $big_image);
     if ($options['video_icon'] && !empty($big_image['video_url']) && !$options['exclude_cover']) {
         $big_image_args['href'] = $big_image['video_url'];
         $blank_image = presscore_get_blank_image();
         $video_link_classes = 'video-icon';
         if (empty($small_images)) {
             $video_link_classes .= ' mfp-iframe dt-single-mfp-popup dt-mfp-item';
         } else {
             $video_link_classes .= ' dt-gallery-mfp-popup';
         }
         $video_link_custom = $big_image_args['custom'];
         $big_image_args['class'] = str_replace(array('rollover', 'mfp-image'), array('rollover-video', ''), $class);
         $big_image_args['custom'] = $options['style'];
         $big_image_args['wrap'] = '<div %CLASS% %CUSTOM%><img %IMG_CLASS% %SRC% %ALT% %IMG_TITLE% %SIZE% /><a %HREF% %TITLE% class="' . $video_link_classes . '"' . $video_link_custom . '></a></div>';
     }
     $image = dt_get_thumb_img(array_merge($image_args, $big_image_args, $options['title_image_args']));
     $html = $image . $html;
     return $html;
 }
Ejemplo n.º 2
0
 /**
  * Portfolio media slider.
  *
  * Based on royal slider. Properly works only in the loop.
  *
  * @return string HTML.
  */
 function presscore_get_project_media_slider($class = array())
 {
     global $post;
     // slideshow dimensions
     $slider_proportions = get_post_meta($post->ID, '_dt_project_options_slider_proportions', true);
     $slider_proportions = wp_parse_args($slider_proportions, array('width' => '', 'height' => ''));
     $width = $slider_proportions['width'];
     $height = $slider_proportions['height'];
     // get slideshow
     $media_items = get_post_meta($post->ID, '_dt_project_media_items', true);
     $slideshow = '';
     if (!$media_items) {
         $media_items = array();
     }
     // if we have post thumbnail and it's not hidden
     if (has_post_thumbnail()) {
         if (is_single()) {
             if (!get_post_meta($post->ID, '_dt_project_options_hide_thumbnail', true)) {
                 array_unshift($media_items, get_post_thumbnail_id());
             }
         } else {
             array_unshift($media_items, get_post_thumbnail_id());
         }
     }
     $attachments_data = presscore_get_attachment_post_data($media_items);
     // TODO: make it clean and simple
     if (count($attachments_data) > 1) {
         $slideshow = presscore_get_royal_slider($attachments_data, array('width' => $width, 'height' => $height, 'class' => $class, 'style' => ' style="width: 100%"'));
     } elseif (!empty($attachments_data)) {
         $image = current($attachments_data);
         $thumb_id = $image['ID'];
         $thumb_meta = array($image['full'], $image['width'], $image['height']);
         $video_url = esc_url(get_post_meta($thumb_id, 'dt-video-url', true));
         $thumb_args = array('img_meta' => $thumb_meta, 'img_id' => $thumb_id, 'img_class' => 'preload-me', 'class' => 'alignnone rollover', 'href' => get_permalink($post->ID), 'wrap' => '<a %CLASS% %HREF% %TITLE% %CUSTOM%><img %IMG_CLASS% %SRC% %ALT% %SIZE% /></a>', 'echo' => false);
         if ($video_url) {
             $blank_image = presscore_get_blank_image();
             $thumb_args['class'] = 'alignnone rollover-video';
             $thumb_args['wrap'] = '<div %CLASS% %CUSTOM%><img %IMG_CLASS% %SRC% %ALT% %IMG_TITLE% %SIZE% /><a %HREF% %TITLE% class="video-icon"><img src="' . $blank_image . '" %ALT% style="display: none;" /></a></div>';
         }
         $thumb_args = apply_filters('dt_portfolio_thumbnail_args', $thumb_args);
         $slideshow = dt_get_thumb_img($thumb_args);
     }
     return $slideshow;
 }
Ejemplo n.º 3
0
    $before_content = '<div class="rollover-project' . (!$show_content ? ' rollover-project-empty' : '') . '">';
    $after_content = '</div>';
    if (in_array($description, array('on_hoover', 'on_dark_gradient', 'from_bottom'))) {
        $before_description = '<div class="rollover-content">';
        $after_description = '</div>';
    } else {
        if ('on_hoover_centered' == $description) {
            $before_description = '<div class="rollover-content"><div class="wf-table"><div class="wf-td">';
            $after_description = '</div></div></div>';
        }
    }
    $link_classes = 'link show-content';
} else {
    $link_classes = 'rollover rollover-zoom';
}
$blank_img = presscore_get_blank_image();
$zoom_link = '';
do_action('presscore_before_post');
?>

<article id="post-<?php 
the_ID();
?>
" <?php 
post_class('post');
?>
>

<?php 
echo $before_content;
$is_pass_protected = post_password_required();