示例#1
0
/**
 * Your Inspiration Themes
 * 
 * In this files there is a collection of a functions useful for the core
 * of the framework.   
 * 
 * @package WordPress
 * @subpackage Your Inspiration Themes
 * @author Your Inspiration Themes Team <*****@*****.**>
 *
 * This source file is subject to the GNU GENERAL PUBLIC LICENSE (GPL 3.0)
 * that is bundled with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://www.gnu.org/licenses/gpl-3.0.txt
 */
global $post, $is_extra_content;
wp_reset_query();
$is_extra_content = true;
//used to know if we are in extra content or not
$post_id = isset($post->ID) ? $post->ID : 0;
$extra_content = yit_clean_text(yit_get_post_meta($post_id, '_extra-content'));
if (!empty($extra_content)) {
    ?>
    <div class="extra-content margin-top group span12"><?php 
    echo $extra_content;
    ?>
</div>
<?php 
}
$is_extra_content = false;
 /**
  * Return JSON well formatted portfolio work
  * 
  * @param array $work
  * @return string
  * @since 1.0.0
  */
 function yit_ajax_portfolio_thumbs()
 {
     $work = $_POST['work'];
     $type = $_POST['type'];
     //thumb
     $thumb_output = '';
     $lightbox = $_POST['overlay'];
     if (isset($work['video_url']) && $work['video_url']) {
         list($video_type, $video_id) = explode(':', yit_video_type_by_url($work['video_url']));
         if ($video_type == 'youtube') {
             $video_url = 'http://www.youtube.com/embed/' . $video_id . '?width=640&height=480&iframe=true';
         } else {
             if ($video_type == 'vimeo') {
                 $video_url = 'http://player.vimeo.com/video/' . $video_id;
             }
         }
         $thumb_output = do_shortcode("[{$video_type} video_id=\"{$video_id}\" width=\"100%\" height=\"100%\"]");
     } elseif (!empty($work['extra-images'])) {
         $thumb_output = '<div class="extra-images-slider"><ul class="slides">';
         $thumb_size = $type == 'portfolio' ? 'thumb_medium_portfolio_thumbs' : 'section_portfolio';
         array_unshift($work['extra-images'], $work['item_id']);
         foreach ($work['extra-images'] as $image_id) {
             $thumb_output .= '<li><div class="picture_overlay">';
             $thumb_output .= yit_image("id={$image_id}&size={$thumb_size}", false);
             //wp_get_attachment_image( $image_id, $thumb_size );
             if ($lightbox) {
                 $thumb = yit_image("id={$image_id}&output=url", false);
                 $thumb_output .= '<div class="overlay"><div><p>';
                 $thumb_output .= '<a href="' . $thumb . '" rel="lightbox_thumbs"><img src="' . get_template_directory_uri() . '/images/icons/zoom.png" alt="' . __('Open Lightbox', 'yit') . '" /></a>';
                 $thumb_output .= '</p></div></div>';
             }
             $thumb_output .= '</div></li>';
         }
         $thumb_output .= '</ul></div>';
     } else {
         $thumb_size = $type == 'portfolio' ? 'thumb_medium_portfolio_thumbs' : 'section_portfolio';
         $thumb_output = '<div class="picture_overlay">';
         $thumb_output .= yit_image("id={$work['item_id']}&size={$thumb_size}", false);
         //wp_get_attachment_image( $work['item_id'], $thumb_size );
         if ($lightbox) {
             $thumb_output .= '<div class="overlay"><div><p>';
             $thumb_output .= '<a href="' . $work['image'] . '" rel="lightbox_thumbs"><img src="' . get_template_directory_uri() . '/images/icons/zoom.png" alt="' . __('Open Lightbox', 'yit') . '" /></a>';
             $thumb_output .= '</p></div></div>';
         }
         $thumb_output .= '</div>';
     }
     //content
     $thumb_content = '';
     if ($type != 'portfolio') {
         $thumb_content = '<h3 class="title">' . yit_decode_title($work['title']) . '</h3>';
         if (isset($work['subtitle']) && $work['subtitle']) {
             $thumb_content .= '<h4 class="subtitle">' . yit_decode_title($work['subtitle']) . '</h4>';
         }
     }
     $thumb_content .= yit_clean_text($work['text']);
     //meta
     $meta_content = '';
     $customer = $work['customer'];
     $skills = $work['skills'];
     $skills_label = empty($work['skills_label']) ? yit_string('<strong>', __('Skills: ', 'yit'), '</strong>', 0) : yit_string('<strong>', $work['skills_label'], '</strong>', 0) . ': ';
     $website = $work['website_name'] ? $work['website_name'] : $work['website_url'];
     $website_url = $work['website_url'];
     $year = $work['year'];
     $terms = isset($work['terms']) ? $work['terms'] : '';
     $meta_content = '<ul>';
     if ($terms) {
         $terms_plain = '';
         $categories = $work['categories'];
         foreach ($terms as $term) {
             $terms_plain .= $categories[$term] . ', ';
         }
         $terms_plain = substr($terms_plain, 0, strlen($terms_plain) - 2);
         $icon = '<span><img src="' . YIT_THEME_ASSETS_URL . '/images/categories.png" alt="categories" /></span>';
         $meta_content .= '<li class="categories">' . $icon . yit_string('<strong>', __('Categories: ', 'yit'), '</strong>', 0) . $terms_plain . '</li>';
     }
     if ($customer) {
         $icon = '<span><img src="' . YIT_THEME_ASSETS_URL . '/images/customer.png" alt="customer" /></span>';
         $meta_content .= '<li class="customer">' . $icon . yit_string('<strong>', __('Customer: ', 'yit'), '</strong>', 0) . $customer;
         if ($website_url) {
             $meta_content .= ' - <a href="' . $website_url . '">' . $website . '</a>';
         }
         $meta_content .= '</li>';
     }
     if ($skills) {
         $icon = '<span><img src="' . YIT_THEME_ASSETS_URL . '/images/project.png" alt="skills" /></span>';
         $meta_content .= '<li class="skills">' . $icon . $skills_label . $skills . '</li>';
     }
     if ($year) {
         $icon = '<span><img src="' . YIT_THEME_ASSETS_URL . '/images/year.png" alt="year" /></span>';
         $meta_content .= '<li class="year">' . $icon . yit_string('<strong>', __('Year: ', 'yit'), '</strong>', 0) . $year . '</li>';
     }
     echo json_encode(array('thumb' => $thumb_output, 'content' => $thumb_content, 'meta' => $meta_content, 'title' => yit_decode_title($work['title'])));
     die;
 }
示例#3
0
文件: slider.php 项目: zgomotos/Bazar
}
?>
">
    <div id="<?php 
echo $slider_id;
?>
"<?php 
yit_slider_class($slider_class);
?>
> 
        <div class="shadowWrapper">
            <?php 
echo do_shortcode('[rev_slider ' . yit_slide_get('slider_name') . ']');
?>
        </div>          
    </div>      
    
    <?php 
if (!empty($slider_text)) {
    ?>
    <div class="revolution-slider-text">
        <?php 
    echo yit_clean_text($slider_text);
    ?>
    </div>
    <div class="clear"></div>
    <?php 
}
?>
</div>
<!-- END SLIDER -->
示例#4
0
 /**
  * Retrieve the parameter of the current slide.
  *
  * @since 1.0.0
  *
  * @param string $var Parameter name.
  */
 public function get($var, $args = array())
 {
     $default = array('before' => '', 'after' => '', 'container' => true, 'video_width' => 425, 'video_height' => 356, 'content_type' => 'image');
     $args = wp_parse_args($args, $default);
     $output = '';
     $slide = stripslashes_deep($this->_current_slide);
     switch ($var) {
         case 'title':
             $slide['title'] = isset($slide['title']) ? $slide['title'] : '';
             $slide['title'] = apply_filters('yit_slide_title', do_shortcode($slide['title']));
             $output = $this->_a_before . $slide['title'] . $this->_a_after;
             break;
         case 'subtitle':
             $slide['subtitle'] = isset($slide['subtitle']) ? $slide['subtitle'] : '';
             $slide['subtitle'] = apply_filters('yit_slide_subtitle', do_shortcode($slide['subtitle']));
             $output = $slide['subtitle'];
             break;
         case 'content':
             $slide['text'] = isset($slide['text']) ? $slide['text'] : '';
             $slide['text'] = apply_filters('yit_slide_content', $slide['text']);
             $content_slide = yit_clean_text($slide['text']);
             $output = $content_slide . $this->get_more_text();
             break;
         case 'clean-content':
             $slide['text'] = isset($slide['text']) ? $slide['text'] : '';
             $slide['text'] = apply_filters('yit_slide_clean', $slide['text']);
             $output = $slide['text'];
             break;
         case 'image-url':
         case 'image_url':
             $image_id = $slide['item_id'];
             $output = wp_get_attachment_url($image_id);
             break;
         case 'featured-content':
             $featured_args = apply_filters('yit_slide_featured', $args);
             $featured_args['echo'] = false;
             $output = $this->featured_content($featured_args['content_type'], $featured_args);
             break;
         case 'slide-link-url':
             $output = $this->_url_slide;
             break;
         default:
             if (isset($slide[$var])) {
                 $output = apply_filters('yit_slide_default', $slide[$var]);
             } elseif (isset($this->shortcode_atts[$var])) {
                 $output = $this->shortcode_atts[$var];
             } else {
                 $output = $this->_theSliderObj->get_setting($var, $this->_current_slider);
                 if (empty($output)) {
                     $output = $this->_theSliderObj->get_setting($var . '_' . $this->_theSliderObj->get_setting('slider_type', $this->_current_slider), $this->_current_slider);
                 }
             }
             break;
     }
     return $output;
 }
 /**
  * Retrieve the parameter of the current slide.
  *
  * @since 1.0.0
  *
  * @param string $var Parameter name.
  */
 public function get($var, $args = array())
 {
     $default = array('before' => '', 'after' => '', 'container' => true, 'video_width' => 425, 'video_height' => 356, 'content_type' => 'image');
     $args = wp_parse_args($args, $default);
     $output = '';
     $slide = stripslashes_deep($this->_current_item);
     switch ($var) {
         case 'title':
             $slide['title'] = isset($slide['title']) ? apply_filters('yit_work_title', $slide['title']) : '';
             $output = $slide['title'];
             break;
         case 'content':
             $slide['text'] = isset($slide['text']) ? apply_filters('yit_work_content', $slide['text']) : '';
             $content_slide = yit_clean_text($slide['text']);
             $output = $slide['text'];
             break;
         case 'clean-content':
             $slide['text'] = isset($slide['text']) ? apply_filters('yit_work_clean', $slide['text']) : '';
             $output = $slide['text'];
             break;
         case 'image-url':
         case 'image_url':
             $image_id = $slide['item_id'];
             $output = wp_get_attachment_url($image_id);
             break;
         case 'featured-content':
             $featured_args = apply_filters('yit_work_featured', $args);
             $featured_args['echo'] = false;
             $output = $this->featured_content($featured_args['content_type'], $featured_args);
             break;
         default:
             if (isset($slide[$var])) {
                 $output = apply_filters('yit_work_default', $slide[$var]);
             } elseif (isset($this->shortcode_atts[$var])) {
                 $output = $this->shortcode_atts[$var];
             } else {
                 $output = $this->_thePortfolioObj->get_setting($var, $this->_current_portfolio);
                 if (empty($output)) {
                     $output = $this->_thePortfolioObj->get_setting($var . '_' . $this->_thePortfolioObj->get_setting($this->_fieldTypeName, $this->_current_portfolio), $this->_current_portfolio);
                 }
             }
             break;
     }
     return $output;
 }
示例#6
0
$slider_class = '';
$slider_class .= yit_slide_get('align') != '' ? ' align' . yit_slide_get('align') : '';
$slider_class .= ' ' . $the_slider->getParam('slider_type');

$is_fixed = false;
if ( ! $is_primary && in_array( $the_slider->getParam('slider_type'), array( 'fixed', 'responsitive' ) ) ) $is_fixed = true;

if ( $is_fixed && ! has_action( 'yit_after_header', 'yit_slider_space' ) ) add_action( 'yit_after_header', 'yit_slider_space' );

// text align
$slider_text = yit_slide_get( 'slider_text' );
if ( $is_primary && $the_slider->getParam('slider_type') == 'fullwidth' ) $slider_text = '';
if ( !empty( $slider_text ) ) $slider_class .= ' align' . ( yit_slide_get( 'slider_align' ) == 'left' ? 'right' : 'left' ); 
?>
 
<!-- START SLIDER -->
<div class="revolution-wrapper<?php if ( $the_slider->getParam('slider_type') != 'fullwidth' ) echo ' container'; ?>">
    <div id="<?php echo $slider_id ?>"<?php yit_slider_class($slider_class) ?>> 
        <div class="shadowWrapper">
            <?php echo do_shortcode('[rev_slider ' . yit_slide_get( 'slider_name' ) . ']'); ?>
        </div>          
    </div>      
    
    <?php if ( !empty( $slider_text ) ) : ?>
    <div class="revolution-slider-text">
        <?php echo yit_clean_text( $slider_text ) ?>
    </div>
    <div class="clear"></div>
    <?php endif; ?>
</div>
<!-- END SLIDER -->