Пример #1
0
    function axiom_template_excerpt_output($post_options, $post_data)
    {
        $show_title = true;
        //!in_array($post_data['post_format'], array('aside', 'chat', 'status', 'link', 'quote'));
        $tag = axiom_sc_in_shortcode_blogger(true) ? 'div' : 'article';
        ?>
		<<?php 
        echo $tag;
        ?>
 <?php 
        post_class('post_item post_item_excerpt post_featured_' . esc_attr($post_options['post_class']) . ' post_format_' . esc_attr($post_data['post_format']) . ($post_options['number'] % 2 == 0 ? ' even' : ' odd') . ($post_options['number'] == 0 ? ' first' : '') . ($post_options['number'] == $post_options['posts_on_page'] ? ' last' : '') . ($post_options['add_view_more'] ? ' viewmore' : ''));
        ?>
>

			<?php 
        $post_icon = axiom_get_custom_option('show_post_icon') == 'yes' ? '<span class="post_icon ' . esc_attr($post_data['post_icon']) . '"></span>' : '';
        ?>

			<?php 
        if ($post_data['post_flags']['sticky']) {
            ?>
<span class="sticky_label"></span><?php 
        }
        if ($show_title && $post_options['location'] == 'center' && !empty($post_data['post_title'])) {
            ?>
<h3 class="post_title"><a href="<?php 
            echo esc_url($post_data['post_link']);
            ?>
"><?php 
            echo balanceTags($post_icon);
            echo $post_data['post_title'];
            ?>
</a></h3><?php 
        }
        if (!$post_data['post_protected'] && (!empty($post_options['dedicated']) || $post_data['post_thumb'] || $post_data['post_gallery'] || $post_data['post_video'] || $post_data['post_audio'])) {
            ?>
				<div class="post_featured">
				<?php 
            if (!empty($post_options['dedicated'])) {
                echo $post_options['dedicated'];
            } else {
                if ($post_data['post_thumb'] || $post_data['post_gallery'] || $post_data['post_video'] || $post_data['post_audio']) {
                    require axiom_get_file_dir('templates/parts/post-featured.php');
                }
            }
            ?>
				</div>
			<?php 
        }
        ?>
	
			<div class="post_content clearfix">
				<?php 
        if ($show_title && $post_options['location'] != 'center' && !empty($post_data['post_title'])) {
            ?>
<h3 class="post_title"><a href="<?php 
            echo esc_url($post_data['post_link']);
            ?>
"><?php 
            echo balanceTags($post_icon);
            echo $post_data['post_title'];
            ?>
</a></h3><?php 
        }
        if (!$post_data['post_protected'] && $post_options['info']) {
            require axiom_get_file_dir('templates/parts/post-info.php');
        }
        ?>
		
				<div class="post_descr">
				<?php 
        if ($post_data['post_protected']) {
            echo $post_data['post_excerpt'];
        } else {
            if ($post_data['post_excerpt']) {
                echo in_array($post_data['post_format'], array('quote', 'link', 'chat', 'aside', 'status')) ? $post_data['post_excerpt'] : '<p>' . trim(axiom_strshort($post_data['post_excerpt'], isset($post_options['descr']) ? $post_options['descr'] : axiom_get_custom_option('post_excerpt_maxlength'))) . '</p>';
            }
        }
        if (empty($post_options['readmore'])) {
            $post_options['readmore'] = __('READ MORE', 'axiom');
        }
        if (!axiom_sc_param_is_off($post_options['readmore']) && !in_array($post_data['post_format'], array('quote', 'link', 'chat', 'aside', 'status'))) {
            echo do_shortcode('[trx_button link="' . esc_url($post_data['post_link']) . '"]' . $post_options['readmore'] . '[/trx_button]');
        }
        ?>
				</div>

			</div>	<!-- /.post_content -->

		</<?php 
        echo $tag;
        ?>
>	<!-- /.post_item -->

	<?php 
    }
Пример #2
0
    function axiom_template_related_output($post_options, $post_data)
    {
        $show_title = true;
        //!in_array($post_data['post_format'], array('aside', 'chat', 'status', 'link', 'quote'));
        $parts = explode('_', $post_options['layout']);
        $style = $parts[0];
        $columns = max(1, min(4, empty($parts[1]) ? $post_options['columns_count'] : (int) $parts[1]));
        $tag = axiom_sc_in_shortcode_blogger(true) ? 'div' : 'article';
        //require(axiom_get_file_dir('templates/parts/reviews-summary.php'));
        if ($columns > 1) {
            ?>
			<div class="<?php 
            echo 'column-1_' . esc_attr($columns);
            ?>
 column_padding_bottom">
			<?php 
        }
        ?>
		<<?php 
        echo $tag;
        ?>
 class="post_item post_item_<?php 
        echo esc_attr($style);
        ?>
 post_item_<?php 
        echo esc_attr($post_options['number']);
        ?>
">

			<div class="post_content">
				<?php 
        if ($post_data['post_video'] || $post_data['post_thumb'] || $post_data['post_gallery']) {
            ?>
				<div class="post_featured">
					<?php 
            require axiom_get_file_dir('templates/parts/post-featured.php');
            ?>
				</div>
				<?php 
        }
        ?>

				<?php 
        if ($show_title) {
            ?>
					<div class="post_content_wrap">
					<?php 
            if (!isset($post_options['links']) || $post_options['links']) {
                ?>
						<h4 class="post_title"><a href="<?php 
                echo esc_url($post_data['post_link']);
                ?>
"><?php 
                echo $post_data['post_title'];
                ?>
</a></h4>
					<?php 
            } else {
                ?>
						<h4 class="post_title"><?php 
                echo $post_data['post_title'];
                ?>
</h4>
					<?php 
            }
            //echo ($reviews_summary);
            ?>
					</div>
				<?php 
        }
        ?>
			</div>	<!-- /.post_content -->
		</<?php 
        echo $tag;
        ?>
>	<!-- /.post_item -->
		<?php 
        if ($columns > 1) {
            ?>
			</div>
			<?php 
        }
    }
Пример #3
0
function axiom_sc_zoom($atts, $content = null)
{
    if (axiom_sc_in_shortcode_blogger()) {
        return '';
    }
    extract(axiom_sc_html_decode(shortcode_atts(array("effect" => "zoom", "src" => "", "url" => "", "over" => "", "align" => "", "bg_image" => "", "bg_top" => '', "bg_bottom" => '', "bg_left" => '', "bg_right" => '', "id" => "", "class" => "", "animation" => "", "css" => "", "width" => "", "height" => "", "top" => "", "bottom" => "", "left" => "", "right" => ""), $atts)));
    axiom_enqueue_script('axiom-elevate-zoom-script', axiom_get_file_url('js/jquery.elevateZoom-3.0.4.js'), array(), null, true);
    $css .= axiom_get_css_position_from_values('!' . $top, '!' . $right, '!' . $bottom, '!' . $left);
    $css_dim = axiom_get_css_position_from_values('', '', '', '', $width, $height);
    $css_bg = axiom_get_css_paddings_from_values($bg_top, $bg_right, $bg_bottom, $bg_left);
    $width = axiom_prepare_css_value($width);
    $height = axiom_prepare_css_value($height);
    if (empty($id)) {
        $id = 'sc_zoom_' . str_replace('.', '', mt_rand());
    }
    $src = $src != '' ? $src : $url;
    if ($src > 0) {
        $attach = wp_get_attachment_image_src($src, 'full');
        if (isset($attach[0]) && $attach[0] != '') {
            $src = $attach[0];
        }
    }
    if ($over > 0) {
        $attach = wp_get_attachment_image_src($over, 'full');
        if (isset($attach[0]) && $attach[0] != '') {
            $over = $attach[0];
        }
    }
    if ($effect == 'lens' && ((int) $width > 0 && axiom_substr($width, -2, 2) == 'px') || (int) $height > 0 && axiom_substr($height, -2, 2) == 'px') {
        if ($src) {
            $src = axiom_get_resized_image_url($src, (int) $width > 0 && axiom_substr($width, -2, 2) == 'px' ? (int) $width : null, (int) $height > 0 && axiom_substr($height, -2, 2) == 'px' ? (int) $height : null);
        }
        if ($over) {
            $over = axiom_get_resized_image_url($over, (int) $width > 0 && axiom_substr($width, -2, 2) == 'px' ? (int) $width : null, (int) $height > 0 && axiom_substr($height, -2, 2) == 'px' ? (int) $height : null);
        }
    }
    if ($bg_image > 0) {
        $attach = wp_get_attachment_image_src($bg_image, 'full');
        if (isset($attach[0]) && $attach[0] != '') {
            $bg_image = $attach[0];
        }
    }
    if ($bg_image) {
        $css_bg .= $css . 'background-image: url(' . esc_url($bg_image) . ');';
        $css = $css_dim;
    } else {
        $css .= $css_dim;
    }
    $output = empty($src) ? '' : (!empty($bg_image) ? '<div class="sc_zoom_wrap' . (!empty($class) ? ' ' . esc_attr($class) : '') . ($align && $align != 'none' ? ' align' . esc_attr($align) : '') . '"' . (!axiom_sc_param_is_off($animation) ? ' data-animation="' . esc_attr(axiom_sc_get_animation_classes($animation)) . '"' : '') . ($css_bg != '' ? ' style="' . esc_attr($css_bg) . '"' : '') . '>' : '') . '<div' . ($id ? ' id="' . esc_attr($id) . '"' : '') . ' class="sc_zoom' . (empty($bg_image) && !empty($class) ? ' ' . esc_attr($class) : '') . (empty($bg_image) && $align && $align != 'none' ? ' align' . esc_attr($align) : '') . '"' . (empty($bg_image) && !axiom_sc_param_is_off($animation) ? ' data-animation="' . esc_attr(axiom_sc_get_animation_classes($animation)) . '"' : '') . ($css != '' ? ' style="' . esc_attr($css) . '"' : '') . '>' . '<img src="' . esc_url($src) . '"' . ($css_dim != '' ? ' style="' . esc_attr($css_dim) . '"' : '') . ' data-zoom-image="' . esc_url($over) . '" alt="" />' . '</div>' . (!empty($bg_image) ? '</div>' : '');
    return apply_filters('axiom_shortcode_output', $output, 'trx_zoom', $atts, $content);
}
Пример #4
0
    function axiom_template_portfolio_output($post_options, $post_data)
    {
        $show_title = !in_array($post_data['post_format'], array('aside', 'chat', 'status', 'link', 'quote'));
        $parts = explode('_', $post_options['layout']);
        $style = $parts[0];
        $columns = max(1, min(4, empty($parts[1]) ? 1 : (int) $parts[1]));
        $tag = axiom_sc_in_shortcode_blogger(true) ? 'div' : 'article';
        if ($post_options['hover'] == 'square effect4') {
            $post_options['hover'] = 'square effect5';
        }
        $link_start = !isset($post_options['links']) || $post_options['links'] ? '<a href="' . esc_url($post_data['post_link']) . '">' : '';
        $link_end = !isset($post_options['links']) || $post_options['links'] ? '</a>' : '';
        ?>
			<div class="isotope_item isotope_item_<?php 
        echo esc_attr($style);
        ?>
 isotope_item_<?php 
        echo esc_attr($post_options['layout']);
        ?>
 isotope_column_<?php 
        echo esc_attr($columns);
        ?>
						<?php 
        if ($post_options['filters'] != '') {
            if ($post_options['filters'] == 'categories' && !empty($post_data['post_terms'][$post_data['post_taxonomy']]->terms_ids)) {
                echo ' flt_' . join(' flt_', $post_data['post_terms'][$post_data['post_taxonomy']]->terms_ids);
            } else {
                if ($post_options['filters'] == 'tags' && !empty($post_data['post_terms'][$post_data['post_taxonomy_tags']]->terms_ids)) {
                    echo ' flt_' . join(' flt_', $post_data['post_terms'][$post_data['post_taxonomy_tags']]->terms_ids);
                }
            }
        }
        ?>
">
				<<?php 
        echo $tag;
        ?>
 class="post_item post_item_<?php 
        echo esc_attr($style);
        ?>
 post_item_<?php 
        echo esc_attr($post_options['layout']);
        ?>
					<?php 
        echo 'post_format_' . esc_attr($post_data['post_format']) . ($post_options['number'] % 2 == 0 ? ' even' : ' odd') . ($post_options['number'] == 0 ? ' first' : '') . ($post_options['number'] == $post_options['posts_on_page'] ? ' last' : '');
        ?>
">
	
					<div class="post_content isotope_item_content ih-item colored<?php 
        echo ($post_options['hover'] ? ' ' . esc_attr($post_options['hover']) : '') . ($post_options['hover_dir'] ? ' ' . esc_attr($post_options['hover_dir']) : '');
        ?>
">
						<?php 
        if ($post_options['hover'] == 'circle effect1') {
            ?>
<div class="spinner"></div><?php 
        }
        if ($post_options['hover'] == 'square effect4') {
            ?>
<div class="mask1"></div><div class="mask2"></div><?php 
        }
        if ($post_options['hover'] == 'circle effect8') {
            ?>
<div class="img-container"><?php 
        }
        ?>
						<div class="post_featured img">
							<?php 
        /*
        if ($post_data['post_video'] || $post_data['post_audio'] || $post_data['post_thumb'] ||  $post_data['post_gallery']) {
        	require(axiom_get_file_dir('templates/parts/post-featured.php'));
        }
        */
        echo $link_start . $post_data['post_thumb'] . $link_end;
        ?>
						</div>
						<?php 
        if ($post_options['hover'] == 'circle effect8') {
            ?>
							</div>	<!-- .img-container -->
							<div class="info-container">
							<?php 
        }
        ?>
	
						<div class="post_info_wrap info"><div class="info-back">
	
							<?php 
        if ($show_title) {
            ?>
<h4 class="post_title"><?php 
            echo $link_start . $post_data['post_title'] . $link_end;
            ?>
</h4><?php 
        }
        /*
        if (!$post_data['post_protected'] && $post_options['info']) {
        	$info_parts = array('counters'=>false, 'terms'=>false);
        	require(axiom_get_file_dir('templates/parts/post-info.php'));
        }
        */
        ?>
	
							<div class="post_descr">
							<?php 
        if ($post_data['post_protected']) {
            echo $link_start . $post_data['post_excerpt'] . $link_end;
        } else {
            if ($post_data['post_excerpt']) {
                echo in_array($post_data['post_format'], array('quote', 'link', 'chat', 'aside', 'status')) ? $link_start . $post_data['post_excerpt'] . $link_end : '<p>' . $link_start . trim(axiom_strshort($post_data['post_excerpt'], isset($post_options['descr']) ? $post_options['descr'] : axiom_get_custom_option('post_excerpt_maxlength_masonry'))) . $link_end . '</p>';
            }
            echo $link_start;
            ?>
									<span class="hover_icon icon-plus-2"></span>
									<?php 
            echo $link_end;
        }
        ?>
							</div>
						</div></div>	<!-- /.info-back /.info -->
						<?php 
        if ($post_options['hover'] == 'circle effect8') {
            ?>
						</div>			<!-- /.info-container -->
						<?php 
        }
        ?>
					</div>				<!-- /.post_content -->
				</<?php 
        echo $tag;
        ?>
>	<!-- /.post_item -->
			</div>						<!-- /.isotope_item -->
			<?php 
    }
Пример #5
0
 function axiom_get_post_data(&$opt, $post_obj = null)
 {
     $opt = axiom_get_post_data_options($opt);
     global $post, $wp_query;
     $old_post = null;
     if (!empty($post) && is_object($post)) {
         $old_post = clone $post;
     }
     if ($post_obj != null) {
         $post = $post_obj;
         setup_postdata($post);
     }
     $cur_post = clone $post;
     $post_id = get_the_ID();
     $post_parent_id = wp_get_post_parent_id($post_id);
     if (!$post_parent_id) {
         $post_parent_id = 0;
     }
     $post_type = get_post_type();
     $post_protected = post_password_required();
     $post_format = get_post_format();
     if (empty($post_format)) {
         $post_format = 'standard';
     }
     $post_icon = axiom_get_custom_option('icon', axiom_get_post_format_icon($post_format), $post_id, $post_type);
     //!!!!! Get option from specified post
     $post_flags = array('sticky' => is_sticky());
     $post_link = get_permalink();
     $post_comments_link = get_comments_link();
     $post_date_sql = get_the_date('Y-m-d H:i:s');
     $post_date_stamp = get_the_date('U');
     $post_date = axiom_get_date_or_difference($post_date_sql);
     if (!empty($opt['date_format'])) {
         $parts = explode('+', $opt['date_format']);
         $post_date_part1 = empty($parts[0]) ? '' : date($parts[0], $post_date_stamp);
         $post_date_part2 = empty($parts[1]) ? '' : date($parts[1], $post_date_stamp);
         if ($post_date_part1 . $post_date_part2 != '') {
             $post_date = $post_date_part1 . ($post_date_part2 != '' ? ' ' . $post_date_part2 : '');
         }
     }
     $post_comments = $post_views = $post_likes = 0;
     if ($opt['counters'] != '') {
         $post_comments = get_comments_number();
         $post_views = axiom_get_post_views($post_id);
         $post_likes = axiom_get_post_likes($post_id);
     }
     $post_reviews_author = $post_reviews_users = 0;
     if ($opt['reviews']) {
         $post_reviews_author = axiom_reviews_marks_to_display(get_post_meta($post_id, 'reviews_avg', true));
         $post_reviews_users = axiom_reviews_marks_to_display(get_post_meta($post_id, 'reviews_avg2', true));
     }
     $post_author = get_the_author();
     $post_author_id = get_the_author_meta('ID');
     $post_author_url = get_author_posts_url($post_author_id, '');
     // Is user can edit and/or delete this post?
     $allow_editor = axiom_get_theme_option("allow_editor") == 'yes';
     $post_edit_enable = $allow_editor && ($post_type == 'post' && current_user_can('edit_posts', $post_id) || $post_type == 'page' && current_user_can('edit_pages', $post_id));
     $post_delete_enable = $allow_editor && ($post_type == 'post' && current_user_can('delete_posts', $post_id) || $post_type == 'page' && current_user_can('delete_pages', $post_id));
     // Post content
     global $more;
     $old_more = $more;
     $more = -1;
     $post_content_original = trim(chop($post->post_content));
     $post_content_plain = trim(chop(get_the_content()));
     $more = $old_more;
     $post_content = trim(chop(get_the_content($opt['more_tag'], $opt['strip_teaser'])));
     // Substitute WP [gallery] shortcode
     $thumb_sizes = axiom_get_thumb_sizes(array('layout' => $opt['layout']));
     if ($opt['content']) {
         if ($opt['substitute_gallery']) {
             $post_content = axiom_substitute_gallery($post_content, $post_id, $thumb_sizes['w'], $thumb_sizes['h_crop'], 'none', true);
         }
         $post_content = apply_filters('the_content', $post_content);
         if ($post_id != get_the_ID()) {
             // Fix bug in the WPML
             $post = $cur_post;
             setup_postdata($post);
         }
         if ($opt['substitute_video']) {
             $post_content = axiom_substitute_video($post_content, $thumb_sizes['w'], $thumb_sizes['h_crop']);
         }
         if ($opt['substitute_audio']) {
             $post_content = axiom_substitute_audio($post_content);
         }
     }
     // Post excerpt
     $post_excerpt_original = $post->post_excerpt;
     $post_excerpt = has_excerpt() || $post_protected ? get_the_excerpt() : '';
     if (empty($post_excerpt)) {
         if (($more_pos = axiom_strpos($post_content_plain, '<span id="more-')) !== false) {
             $post_excerpt = axiom_substr($post_content_plain, 0, $more_pos);
         } else {
             $post_excerpt = in_array($post_format, array('quote', 'link')) ? $post_content : strip_shortcodes(strip_tags(get_the_excerpt()));
         }
     }
     if ($opt['substitute_gallery']) {
         $post_excerpt = axiom_substitute_gallery($post_excerpt, $post_id, $thumb_sizes['w'], $thumb_sizes['h_crop']);
     }
     $post_excerpt = apply_filters('axiom_filter_sc_clear_around', $post_excerpt);
     $post_excerpt = apply_filters('the_excerpt', $post_excerpt);
     $post_excerpt = apply_filters('axiom_filter_p_clear_around', $post_excerpt);
     if ($post_id != get_the_ID()) {
         // Fix bug in the WPML
         $post = $cur_post;
         setup_postdata($post);
     }
     if ($opt['substitute_video']) {
         $post_excerpt = axiom_substitute_video($post_excerpt, $thumb_sizes['w'], $thumb_sizes['h_crop']);
     }
     if ($opt['substitute_audio']) {
         $post_excerpt = axiom_substitute_audio($post_excerpt);
     }
     $post_excerpt = trim(chop(str_replace(array('[...]', '[&hellip;]'), array('', ''), $post_excerpt)));
     // Post Title
     $post_title = $post_title_plain = trim(chop(get_the_title()));
     $post_title = apply_filters('the_title', $post_title);
     if ($post_id != get_the_ID()) {
         // Fix bug in the WPML
         $post = $cur_post;
         setup_postdata($post);
     }
     // Prepare dedicated content
     $opt['dedicated'] = axiom_sc_get_dedicated_content();
     $opt['location'] = !empty($opt['location']) ? $opt['location'] : axiom_get_custom_option('dedicated_location');
     if (empty($opt['location']) || $opt['location'] == 'default') {
         $opt['location'] = axiom_get_custom_option('dedicated_location', '', $post_id, $post_type);
     }
     //!!!!! Get option from specified post
     if ($opt['location'] == 'alter' && !is_single() && (!is_page() || isset($wp_query->is_posts_page) && $wp_query->is_posts_page == 1)) {
         $loc = array('center', 'right', 'left');
         $opt['location'] = $loc[($opt['number'] - 1) % count($loc)];
     }
     if (!empty($opt['dedicated'])) {
         $class = axiom_get_tag_attrib($opt['dedicated'], '<div class="sc_section>', 'class');
         if ($opt['location'] == 'default') {
             if (($pos = axiom_strpos($class, 'sc_align')) !== false) {
                 $pos += 8;
                 $pos2 = axiom_strpos($class, ' ', $pos);
                 $opt['location'] = $pos2 === false ? axiom_substr($class, $pos) : axiom_substr($class, $pos, $pos2 - $pos);
             }
             if ($opt['location'] == '' || $opt['location'] == 'default') {
                 $opt['location'] = 'center';
             }
         }
         if (!is_singular() || axiom_get_global('blog_streampage') || axiom_sc_in_shortcode_blogger(true) || axiom_strpos($class, 'sc_align') !== false && axiom_strpos($class, 'columns') === false) {
             $class = str_replace(array('sc_alignright', 'sc_alignleft', 'sc_aligncenter'), array('', '', ''), $class) . ' sc_align' . esc_attr($opt['location']);
             //if ($opt['location'] == 'center' && axiom_strpos($class, 'column-2_3')===false && $opt['sidebar'])
             //	$class = str_replace('columns', '_columns', $class) . ' column-2_3';
             //else if (($opt['location'] == 'left' || $opt['location'] == 'right') && axiom_strpos($class, 'column-1_2')===false)// && $opt['sidebar'])
             //	$class = str_replace('columns', '_columns', $class) . ' column-1_2';
             $opt['dedicated'] = axiom_set_tag_attrib($opt['dedicated'], '<div class="sc_section>', 'class', $class);
         }
     }
     //else if ($opt['location']=='' || $opt['location']=='default')
     //$opt['location'] = 'center';
     //if ($opt['location']=='default') $opt['location']='center';
     $opt['post_class'] = $opt['location'];
     // Substitute <video> tags to <iframe> in dedicated content
     if ($opt['substitute_video']) {
         $opt['dedicated'] = axiom_substitute_video($opt['dedicated'], $thumb_sizes['w'], $thumb_sizes['h_crop']);
     }
     // Substitute <audio> tags with src from soundcloud to <iframe>
     if ($opt['substitute_audio']) {
         $opt['dedicated'] = axiom_substitute_audio($opt['dedicated']);
     }
     // Extract gallery, video and audio from full post content
     $post_thumb = $post_thumb_url = $post_attachment = $post_gallery = $post_video = $post_video_image = $post_audio = $post_audio_image = $post_url = $post_url_target = '';
     $post_attachment = wp_get_attachment_url(get_post_thumbnail_id($post_id));
     if (axiom_substr($opt['layout'], 0, 6) == 'single') {
         $post_thumb = axiom_get_resized_image_tag($post_id, $thumb_sizes['w'], $thumb_sizes['h'], null, false, false, true);
     } else {
         if (axiom_substr($opt['layout'], 0, 10) == 'attachment') {
             $post_thumb = axiom_get_resized_image_tag($post_attachment, $thumb_sizes['w'], $thumb_sizes['h'], null, false, false, true);
         } else {
             $post_thumb = axiom_get_resized_image_tag($post_id, $thumb_sizes['w'], $post_type == 'product' && axiom_get_theme_option('crop_product_thumb') == 'no' ? null : $thumb_sizes['h']);
         }
     }
     $post_thumb_url = axiom_get_tag_attrib($post_thumb, '<img>', 'src');
     if ($post_format == 'gallery') {
         $post_gallery = axiom_build_gallery_tag(axiom_get_post_gallery($post_content_plain, $post_id, max(2, axiom_get_custom_option('gallery_max_slides'))), $thumb_sizes['w'], $thumb_sizes['h_crop'], false, $post_link);
     } else {
         if ($post_format == 'video') {
             $src = '';
             $post_video = axiom_get_post_video($post_content_original, false);
             if ($post_video == '') {
                 $src = axiom_get_post_video($post_content_original, true);
                 if (!axiom_is_youtube_url($src) && !axiom_is_vimeo_url($src)) {
                     $src = '';
                 }
             } else {
                 if (axiom_substr($post_video, 0, 1) == '[') {
                     $src = axiom_get_tag_attrib($post_video, '[trx_video]', 'src');
                     if (empty($src)) {
                         $src = axiom_get_tag_attrib($post_video, '[trx_video]', 'url');
                     }
                     if (empty($src)) {
                         $src = axiom_get_post_video($post_video, true);
                     }
                     $post_video_image = axiom_get_tag_attrib($post_video, '[trx_video]', 'image');
                     if ($post_video_image > 0) {
                         $attach = wp_get_attachment_image_src($post_video_image, 'full');
                         if (isset($attach[0]) && $attach[0] != '') {
                             $post_video_image = $attach[0];
                         }
                     }
                     if (empty($post_video_image)) {
                         $post_video_image = axiom_get_video_cover_image($src);
                     }
                     if (empty($post_video_image)) {
                         $post_video_image = $post_thumb;
                     }
                     $post_video_image = axiom_get_resized_image_tag($post_video_image, $thumb_sizes['w'], $thumb_sizes['h']);
                 } else {
                     $src = axiom_get_post_video($post_video, true);
                 }
             }
             if ($src) {
                 $src = axiom_get_video_player_url($src, $post_thumb != '' || $post_video_image != '');
                 $post_video = '<video src="' . esc_url($src) . '" width="' . esc_attr($thumb_sizes['w']) . '" height="' . round($thumb_sizes['w'] / 16 * 9) . '"></video>';
             }
             if ($post_video != '' && $opt['substitute_video']) {
                 $post_video = axiom_substitute_video($post_video, $thumb_sizes['w'], round($thumb_sizes['w'] / 16 * 9), false);
                 //$thumb_sizes['h_crop']);
             }
         } else {
             if ($post_format == 'audio') {
                 $src = $data = '';
                 $post_audio = axiom_get_post_audio($post_content_original, false);
                 if ($post_audio == '') {
                     $src = axiom_get_post_audio($post_content_original, true);
                 } else {
                     if (axiom_substr($post_audio, 0, 1) == '[') {
                         $src = axiom_get_tag_attrib($post_audio, '[trx_audio]', 'src');
                         if (empty($src)) {
                             $src = axiom_get_tag_attrib($post_audio, '[trx_audio]', 'url');
                         }
                         if (empty($src)) {
                             $src = axiom_get_post_audio($post_audio, true);
                         }
                         $post_audio_image = axiom_get_tag_attrib($post_audio, '[trx_audio]', 'image');
                         if ($post_audio_image > 0) {
                             $attach = wp_get_attachment_image_src($post_audio_image, 'full');
                             if (isset($attach[0]) && $attach[0] != '') {
                                 $post_audio_image = $attach[0];
                             }
                         }
                         if (empty($post_audio_image)) {
                             $post_audio_image = $post_thumb;
                         }
                         if ($post_audio_image) {
                             $post_audio_image = axiom_get_resized_image_url($post_audio_image, $thumb_sizes['w'], $thumb_sizes['h']);
                         }
                         $post_audio_title = axiom_get_tag_attrib($post_audio, '[trx_audio]', 'title');
                         $post_audio_author = axiom_get_tag_attrib($post_audio, '[trx_audio]', 'author');
                         $data = ($post_audio_title != '' ? ' data-title="' . esc_attr($post_audio_title) . '"' : '') . ($post_audio_author != '' ? ' data-author="' . esc_attr($post_audio_author) . '"' : '') . ($post_audio_image != '' ? ' data-image="' . esc_attr($post_audio_image) . '"' : '');
                     } else {
                         $src = axiom_get_post_audio($post_audio, true);
                     }
                 }
                 if ($src) {
                     $post_audio = '<audio class="sc_audio" src="' . esc_url($src) . '"' . $data . '></audio>';
                 }
                 if ($post_audio != '' && $opt['substitute_audio'] == 'yes') {
                     $post_audio = axiom_substitute_audio($post_audio, false);
                 }
             }
         }
     }
     if ($post_format == 'image' && !$post_thumb && !is_single()) {
         if (($src = axiom_get_post_image($post_content_original, $post_id)) != '') {
             $post_thumb = axiom_get_resized_image_tag($src, $thumb_sizes['w'], $thumb_sizes['h_crop']);
         }
     }
     if ($post_format == 'link') {
         $post_url_data = axiom_get_post_link($post_content_original, false);
         $post_link = $post_url = $post_url_data['url'];
         $post_url_target = $post_url_data['target'];
     }
     // Get all post's terms
     $post_taxonomy = axiom_get_taxonomy_categories_by_post_type($post_type);
     $post_taxonomy_tags = axiom_get_taxonomy_tags_by_post_type($post_type);
     $post_terms = array();
     if ($opt['terms_list']) {
         $post_terms = axiom_get_terms_by_post_id(array('post_id' => $post_id, 'parent_id' => $post_type == 'post' ? $opt['parent_tax_id'] : 0, 'exclude' => $post_type == 'post' ? explode(',', axiom_get_theme_option('exclude_cats')) : array()));
     }
     if ($old_post != null) {
         $post = $old_post;
         setup_postdata($post);
     }
     $post_data = compact('post_id', 'post_parent_id', 'post_protected', 'post_type', 'post_taxonomy', 'post_taxonomy_tags', 'post_format', 'post_flags', 'post_icon', 'post_link', 'post_comments_link', 'post_date_sql', 'post_date_stamp', 'post_date', 'post_date_part1', 'post_date_part2', 'post_comments', 'post_views', 'post_likes', 'post_reviews_author', 'post_reviews_users', 'post_author', 'post_author_id', 'post_author_url', 'post_title', 'post_title_plain', 'post_content_plain', 'post_content_original', 'post_content', 'post_excerpt_original', 'post_excerpt', 'post_thumb', 'post_thumb_url', 'post_attachment', 'post_gallery', 'post_video', 'post_video_image', 'post_audio', 'post_audio_image', 'post_url', 'post_url_target', 'post_terms', 'post_edit_enable', 'post_delete_enable');
     return apply_filters('axiom_filter_get_post_data', $post_data, $opt, $post_obj);
 }
Пример #6
0
    function axiom_template_masonry_output($post_options, $post_data)
    {
        $show_title = !in_array($post_data['post_format'], array('aside', 'chat', 'status', 'link', 'quote'));
        $parts = explode('_', $post_options['layout']);
        $style = $parts[0];
        $columns = max(1, min(4, empty($parts[1]) ? $post_options['columns_count'] : (int) $parts[1]));
        $tag = axiom_sc_in_shortcode_blogger(true) ? 'div' : 'article';
        ?>
		<div class="isotope_item isotope_item_<?php 
        echo esc_attr($style);
        ?>
 isotope_item_<?php 
        echo esc_attr($post_options['layout']);
        ?>
 isotope_column_<?php 
        echo esc_attr($columns);
        ?>
					<?php 
        if ($post_options['filters'] != '') {
            if ($post_options['filters'] == 'categories' && !empty($post_data['post_terms'][$post_data['post_taxonomy']]->terms_ids)) {
                echo ' flt_' . join(' flt_', $post_data['post_terms'][$post_data['post_taxonomy']]->terms_ids);
            } else {
                if ($post_options['filters'] == 'tags' && !empty($post_data['post_terms'][$post_data['post_taxonomy_tags']]->terms_ids)) {
                    echo ' flt_' . join(' flt_', $post_data['post_terms'][$post_data['post_taxonomy_tags']]->terms_ids);
                }
            }
        }
        ?>
">
			<<?php 
        echo $tag;
        ?>
 class="post_item post_item_<?php 
        echo esc_attr($style);
        ?>
 post_item_<?php 
        echo esc_attr($post_options['layout']);
        ?>
				 <?php 
        echo ' post_format_' . esc_attr($post_data['post_format']) . ($post_options['number'] % 2 == 0 ? ' even' : ' odd') . ($post_options['number'] == 0 ? ' first' : '') . ($post_options['number'] == $post_options['posts_on_page'] ? ' last' : '');
        ?>
">
				
				<?php 
        if ($post_data['post_video'] || $post_data['post_audio'] || $post_data['post_thumb'] || $post_data['post_gallery']) {
            ?>
					<div class="post_featured">
						<?php 
            require axiom_get_file_dir('templates/parts/post-featured.php');
            ?>
					</div>
				<?php 
        }
        ?>

				<div class="post_content isotope_item_content">
					
					<?php 
        if ($show_title) {
            if (!isset($post_options['links']) || $post_options['links']) {
                ?>
							<h4 class="post_title"><a href="<?php 
                echo esc_url($post_data['post_link']);
                ?>
"><?php 
                echo $post_data['post_title'];
                ?>
</a></h4>
							<?php 
            } else {
                ?>
							<h4 class="post_title"><?php 
                echo $post_data['post_title'];
                ?>
</h4>
							<?php 
            }
        }
        ?>

					<div class="post_descr">
						<?php 
        if ($post_data['post_protected']) {
            echo $post_data['post_excerpt'];
        } else {
            if ($post_data['post_excerpt']) {
                echo in_array($post_data['post_format'], array('quote', 'link', 'chat', 'aside', 'status')) ? $post_data['post_excerpt'] : '<p>' . trim(axiom_strshort($post_data['post_excerpt'], isset($post_options['descr']) ? $post_options['descr'] : axiom_get_custom_option('post_excerpt_maxlength_masonry'))) . '</p>';
            }
        }
        ?>
					</div>
					<?php 
        if (!$post_data['post_protected'] && $post_options['info']) {
            $info_parts = array('counters' => false, 'terms' => false);
            require axiom_get_file_dir('templates/parts/post-info.php');
        }
        if (empty($post_options['readmore'])) {
            $post_options['readmore'] = __('MORE', 'axiom');
        }
        if (!axiom_sc_param_is_off($post_options['readmore']) && !in_array($post_data['post_format'], array('quote', 'link', 'chat', 'aside', 'status'))) {
            echo do_shortcode('[trx_button style="filled" bg_style="menu" link="' . esc_url($post_data['post_link']) . '"]' . $post_options['readmore'] . '[/trx_button] [trx_button link="' . esc_url($post_data['post_link']) . '"]' . esc_html($post_data['post_views']) . '[/trx_button]');
        }
        ?>

				</div>				<!-- /.post_content -->
			</<?php 
        echo $tag;
        ?>
>	<!-- /.post_item -->
		</div>						<!-- /.isotope_item -->
		<?php 
    }