Пример #1
0
 $i = 0;
 foreach ($recent_posts as $recent) {
     $i++;
     $recent['post_format'] = get_post_format($recent['ID']);
     $recent['post_icon'] = getPostFormatIcon($recent['post_format']);
     $recent['post_link'] = get_permalink($recent['ID']);
     $recent['comments_link'] = $counters == 'comments' ? get_comments_link($recent['ID']) : $recent['post_link'];
     $recent['post_thumb'] = getResizedImageTag($recent['ID'], 310, 310);
     $recent['attachment'] = wp_get_attachment_url(get_post_thumbnail_id($recent['ID']));
     if ($counters != 'none') {
         $recent['views'] = getPostViews($recent['ID']);
         $recent['comments'] = get_comments_number($recent['ID']);
     }
     $recent['post_protected'] = post_password_required($recent['ID']);
     $recent['post_content_prepared'] = do_shortcode($recent['post_content']);
     $recent['post_descr'] = $recent['post_format'] == 'quote' ? $recent['post_content_prepared'] : (!empty($recent['post_excerpt']) ? $recent['post_excerpt'] : getShortString(strip_tags(strip_shortcodes($recent['post_content'])), 300));
     $recent['post_gallery'] = $recent['post_video'] = $recent['post_audio'] = '';
     if ($recent['post_format'] == 'gallery') {
         $recent['post_gallery'] = buildGalleryTag(getPostGallery($recent['post_content'], $recent['ID']), 310, 310);
     } else {
         if ($recent['post_format'] == 'video') {
             $recent['post_video'] = getPostVideo($recent['post_content_prepared'], false);
             if ($recent['post_video'] == '') {
                 $src = getVideoPlayerURL(getPostVideo($recent['post_content_prepared'], true), $recent['post_thumb'] != '');
                 if ($src) {
                     $recent['post_video'] = substituteVideo('<video src="' . $src . '">', 310, 310);
                 }
             }
             if ($recent['post_video'] != '' && get_custom_option('substitute_video') == 'yes') {
                 $src = getVideoPlayerURL(getPostVideo($recent['post_video']), $recent['post_thumb'] != '');
                 if ($src) {
Пример #2
0
 function themerex_callback_send_contact_form()
 {
     global $_REQUEST;
     if (!wp_verify_nonce($_REQUEST['nonce'], 'ajax_nonce')) {
         die;
     }
     $response = array('error' => '');
     if (!($contact_email = get_theme_option('contact_email')) && !($contact_email = get_theme_option('admin_email'))) {
         $response['error'] = __('Unknown admin email!', 'themerex');
     } else {
         $type = themerex_substr($_REQUEST['type'], 0, 7);
         parse_str($_POST['data'], $post_data);
         if ($type == 'contact') {
             $user_name = themerex_substr($post_data['username'], 0, 20);
             $user_email = themerex_substr($post_data['email'], 0, 60);
             $user_subj = getShortString($post_data['subject'], 100);
             $user_msg = getShortString($post_data['message'], 300);
             $subj = sprintf(__('Site %s - Contact form message from %s', 'themerex'), get_bloginfo('site_name'), $user_name);
             $msg = "\n" . __('Name:', 'themerex') . ' ' . $user_name . "\n" . __('E-mail:', 'themerex') . ' ' . $user_email . "\n" . __('Subject:', 'themerex') . ' ' . $user_subj . "\n" . __('Message:', 'themerex') . ' ' . $user_msg;
         } else {
             $subj = sprintf(__('Site %s - Contact form message', 'themerex'), get_bloginfo('site_name'));
             $msg = '';
             foreach ($post_data as $k => $v) {
                 $msg .= "\n{$k}: {$v}";
             }
         }
         $msg .= "\n\n............. " . get_bloginfo('site_name') . " (" . home_url() . ") ............";
         $mail = get_theme_option('mail_function');
         if (!@$mail($contact_email, $subj, $msg)) {
             $response['error'] = __('Error send message!', 'themerex');
         }
         echo json_encode($response);
         die;
     }
 }
Пример #3
0
        ?>
		<div class="sc_<?php 
        echo in_array($opt['style'], array('accordion_1', 'accordion_2', 'accordion_3')) ? 'toggl' : 'blogger';
        ?>
_content">
		<?php 
    }
    if (in_array($opt['style'], array('date'))) {
        echo balanceTags($info);
    }
    if (in_array($opt['style'], array('image_small', 'image_medium')) && $thumb) {
        echo balanceTags($thumb);
    }
    if ($opt['style'] != 'date' && $opt['descr'] > 0) {
        if (!in_array($post_data['post_format'], array('quote', 'link')) && themerex_strlen($post_data['post_excerpt']) > $opt['descr']) {
            $post_data['post_excerpt'] = getShortString(strip_tags($post_data['post_excerpt']), $opt['descr'], $opt['readmore'] ? '' : '...');
        }
        echo balanceTags($post_data['post_excerpt']);
    }
    if (in_array($opt['style'], array('accordion_1', 'accordion_2', 'accordion_3'))) {
        echo balanceTags($info);
    }
    if ($opt['style'] != 'date') {
        ?>
		</div>
		<?php 
    }
    if (!in_array($opt['style'], array('date', 'accordion_1', 'accordion_2', 'accordion_3'))) {
        echo balanceTags($info);
    }
    ?>
">
					<span class="itInf">
						<span class="titleItem"><?php 
                _e('Previous item', 'themerex');
                ?>
</span>
						<?php 
                echo $desc;
                ?>
					</span>
				</a>
				<?php 
            }
            if ($next) {
                $link = get_permalink($next->ID) . '#topOfPage';
                $desc = getShortString($next->post_title, 30);
                ?>
				<a class="itemNext" href="<?php 
                echo $link;
                ?>
">
					<span class="itInf">
						<span class="titleItem"><?php 
                _e('Next item', 'themerex');
                ?>
</span>
						<?php 
                echo $desc;
                ?>
					</span>
				</a>
Пример #5
0
function sc_slider($atts, $content = null)
{
    if (in_shortcode_blogger()) {
        return '';
    }
    extract(shortcode_atts(array("id" => "", "class" => "", "engine" => get_custom_option('substitute_slider_engine'), "chop_effect" => "", "alias" => "", "ids" => "", "cat" => "", "count" => "0", "offset" => "", "orderby" => "date", "order" => 'desc', "border" => "none", "controls" => "no", "pagination" => "no", "titles" => "no", "descriptions" => get_custom_option('slider_descriptions'), "links" => "no", "align" => "", "interval" => "", "date_format" => "", "crop" => "on", "width" => "", "height" => "", "top" => "", "bottom" => "", "left" => "", "right" => ""), $atts));
    global $THEMEREX_sc_slider_engine, $THEMEREX_sc_slider_width, $THEMEREX_sc_slider_height, $THEMEREX_sc_slider_links;
    if (empty($width)) {
        $width = "100%";
    }
    if (empty($interval)) {
        $interval = mt_rand(5000, 10000);
    }
    if ($engine == 'chop' && !file_exists(themerex_get_file_dir('/js/chopslider/jquery.id.chopslider-2.0.0.free.min.js'))) {
        $engine = 'swiper';
    }
    if ($engine == 'chop' && empty($chop_effect)) {
        $effects2D = array("vertical", "horizontal", "half", "multi");
        $effects3D = array("3DBlocks", "3DFlips");
        $chop_effect = $effects2D[min(3, mt_rand(0, 3))] . '|' . $effects3D[min(1, mt_rand(0, 1))];
    }
    $THEMEREX_sc_slider_engine = $engine;
    $THEMEREX_sc_slider_width = getStyleValue($width);
    $THEMEREX_sc_slider_height = getStyleValue($height);
    $THEMEREX_sc_slider_links = sc_param_is_on($links);
    if (empty($id)) {
        $id = "sc_slider_" . str_replace('.', '', mt_rand());
    }
    $ms = getStyleString($top, $right, $bottom, $left);
    $ws = getStyleString('', '', '', '', $width);
    $hs = getStyleString('', '', '', '', '', $height);
    $s = ($border == 'none' && !in_array($pagination, array('full', 'over')) ? $ms : '') . $hs . $ws;
    if ($border != 'none' && in_array($pagination, array('full', 'over'))) {
        $pagination = 'yes';
    }
    if ($engine != 'flex' && $engine != 'chop' && $engine != 'swiper' && in_array($pagination, array('full', 'over'))) {
        $pagination = 'yes';
    }
    $output = ($border != 'none' ? '<div class="sc_border sc_border_' . $border . ($align != '' && $align != 'none' ? ' sc_align' . $align : '') . '"' . ($ms . $hs ? ' style="' . $ms . $hs . '"' : '') . '>' : '') . (in_array($pagination, array('full', 'over')) ? '<div class="sc_slider_pagination_area sc_slider_pagination_' . $pagination . '"' . ($ms . $hs ? ' style="' . $ms . $hs . '"' : '') . '>' : '') . '<div' . ($id ? ' id="' . $id . '"' : '') . ' class="sc_slider' . (!empty($class) ? ' ' . $class : '') . ' sc_slider_' . $engine . (sc_param_is_on($controls) ? ' sc_slider_controls' : ' sc_slider_nocontrols') . (sc_param_is_on($pagination) ? ' sc_slider_pagination' : ' sc_slider_nopagination') . ($border == 'none' && $align != '' && $align != 'none' ? ' sc_align' . $align : '') . ($engine == 'swiper' ? ' swiper-slider-container' : '') . '"' . ((int) $interval > 0 ? ' data-interval="' . $interval . '"' : '') . ($engine == 'chop' ? ' data-effect="' . $chop_effect . '"' : '') . ($s != '' ? ' style="' . $s . '"' : '') . '>';
    $pagination_items = '';
    if ($engine == 'revo') {
        if (revslider_exists() && !empty($alias)) {
            $output .= do_shortcode('[rev_slider ' . $alias . ']');
        } else {
            $output = '';
        }
    } else {
        if ($engine == 'royal') {
            if (royalslider_exists() && !empty($alias)) {
                $output .= do_shortcode('[[new_royalslider id="' . $alias . '"]');
            } else {
                $output = '';
            }
        } else {
            if ($engine == 'flex' || $engine == 'chop' || $engine == 'swiper') {
                $imageAsBackground = $engine != 'chop';
                $caption = '';
                $output .= '<ul class="slides' . ($engine == 'swiper' ? ' swiper-wrapper' : '') . '">';
                $content = do_shortcode($content);
                if ($content) {
                    $output .= $content;
                } else {
                    global $post;
                    if (!empty($ids)) {
                        $posts = explode(',', $ids);
                        $count = count($posts);
                    }
                    $args = array('post_type' => 'post', 'post_status' => 'publish', 'posts_per_page' => $count, 'ignore_sticky_posts' => 1, 'order' => $order == 'asc' ? 'asc' : 'desc');
                    if ($offset > 0 && empty($ids)) {
                        $args['offset'] = $offset;
                    }
                    $args = addSortOrderInQuery($args, $orderby, $order);
                    $args = addFiltersInQuery($args, array('thumbs'));
                    $args = addPostsAndCatsInQuery($args, $ids, $cat);
                    $query = new WP_Query($args);
                    $numSlide = 0;
                    while ($query->have_posts()) {
                        $query->the_post();
                        $numSlide++;
                        $post_id = get_the_ID();
                        $post_title = get_the_title();
                        $post_link = get_permalink();
                        $post_date = get_the_date(!empty($date_format) ? $date_format : 'd.m.y');
                        $post_attachment = wp_get_attachment_url(get_post_thumbnail_id($post_id));
                        if (sc_param_is_on($crop)) {
                            $post_attachment = $imageAsBackground ? getResizedImageURL($post_attachment, !empty($width) && themerex_strpos($width, '%') === false ? $width : null, !empty($height) && themerex_strpos($height, '%') === false ? $height : null) : getResizedImageTag($post_attachment, !empty($width) && themerex_strpos($width, '%') === false ? $width : null, !empty($height) && themerex_strpos($height, '%') === false ? $height : null);
                        } else {
                            if (!$imageAsBackground) {
                                $post_attachment = '<img src="' . $post_attachment . '" alt="">';
                            }
                        }
                        $post_accent_color = '';
                        $post_category = '';
                        $post_category_link = '';
                        if (in_array($pagination, array('full', 'over'))) {
                            // Get all post's tags
                            $post_tags_links = '';
                            if (($post_tags_list = get_the_tags()) != 0) {
                                $tag_number = 0;
                                foreach ($post_tags_list as $tag) {
                                    $tag_number++;
                                    $post_tags_links .= '<span class="slide_tag">' . $tag->name . ($tag_number == count($post_tags_list) ? '' : ',') . '</span> ';
                                }
                            }
                            $pagination_items .= '<li' . (empty($pagination_items) ? ' class="' . ($engine == 'chop' ? 'cs-active-pagination' : 'active') . '"' : '') . '>' . '<div class="slide_pager">' . '<div class="slide_date">' . $post_date . '</div>' . '<div class="slide_info">' . '<h4 class="slide_title">' . $post_title . '</h4>' . '<div class="slide_tags">' . $post_tags_links . '</div>' . '</div>' . '</div>' . '</li>';
                        }
                        $output .= '<li' . ' class="' . $engine . '-slide' . ($engine == 'chop' && $numSlide == 1 ? ' cs-activeSlide' : '') . '"' . ' style="' . ($engine == 'chop' && $numSlide == 1 ? 'display:block;' : '') . ($imageAsBackground ? 'background-image:url(' . $post_attachment . ');' : '') . $ws . $hs . '"' . '>' . (sc_param_is_on($links) ? '<a href="' . $post_link . '" title="' . htmlspecialchars($post_title) . '">' : '') . (!$imageAsBackground ? $post_attachment : '');
                        $caption = $engine == 'swiper' || $engine == 'flex' ? '' : $caption;
                        if (!sc_param_is_off($titles)) {
                            $post_hover_bg = get_custom_option('theme_color', null, $post_id);
                            $post_bg = '';
                            if ($post_hover_bg != '' && !is_inherit_option($post_hover_bg)) {
                                $rgb = Hex2RGB($post_hover_bg);
                                $post_hover_ie = str_replace('#', '', $post_hover_bg);
                                $post_bg = "background-color: rgba({$rgb['r']},{$rgb['g']},{$rgb['b']},0.8);";
                            }
                            $caption .= ($engine == 'chop' ? '<div class="sc_slider_info_item">' : '') . '<div class="sc_slider_info' . ($titles == 'fixed' ? ' sc_slider_info_fixed' : '') . ($engine == 'swiper' ? ' content-slide' : '') . '"' . ($post_bg != '' ? ' style="' . $post_bg . '"' : '') . '>';
                            $post_descr = getPostDescription();
                            if (get_custom_option("slider_info_category") == 'yes') {
                                // || empty($cat)) {
                                // Get all post's categories
                                $post_categories = getCategoriesByPostId($post_id);
                                $post_categories_str = '';
                                for ($i = 0; $i < count($post_categories); $i++) {
                                    if ($post_category == '') {
                                        if (get_theme_option('close_category') == 'parental') {
                                            $parent_cat_id = 0;
                                            //(int) get_custom_option('category_id');
                                            $parent_cat = getParentCategory($post_categories[$i]['term_id'], $parent_cat_id);
                                            if ($parent_cat) {
                                                $post_category = $parent_cat['name'];
                                                $post_category_link = $parent_cat['link'];
                                                if ($post_accent_color == '') {
                                                    $post_accent_color = get_category_inherited_property($parent_cat['term_id'], 'theme_color');
                                                }
                                            }
                                        } else {
                                            $post_category = $post_categories[$i]['name'];
                                            $post_category_link = $post_categories[$i]['link'];
                                            if ($post_accent_color == '') {
                                                $post_accent_color = get_category_inherited_property($post_categories[$i]['term_id'], 'theme_color');
                                            }
                                        }
                                    }
                                    if ($post_category != '' && $post_accent_color != '') {
                                        break;
                                    }
                                }
                                if ($post_category == '' && count($post_categories) > 0) {
                                    $post_category = $post_categories[0]['name'];
                                    $post_category_link = $post_categories[0]['link'];
                                    if ($post_accent_color == '') {
                                        $post_accent_color = get_category_inherited_property($post_categories[0]['term_id'], 'theme_color');
                                    }
                                }
                                if ($post_category != '') {
                                    $caption .= '<div class="sc_slider_category"' . (themerex_substr($post_accent_color, 0, 1) == '#' ? ' style="background-color: ' . $post_accent_color . '"' : '') . '><a href="' . $post_category_link . '">' . $post_category . '</a></div>';
                                }
                            }
                            $output_reviews = '';
                            if (get_custom_option('show_reviews') == 'yes' && get_custom_option('slider_reviews') == 'yes') {
                                $avg_author = marksToDisplay(get_post_meta($post_id, 'reviews_avg' . (get_theme_option('reviews_first') == 'author' && $orderby != 'users_rating' || $orderby == 'author_rating' ? '' : '2'), true));
                                if ($avg_author > 0) {
                                    $output_reviews .= '<div class="sc_slider_reviews reviews_summary blog_reviews' . (get_custom_option("slider_info_category") == 'yes' ? ' after_category' : '') . '">' . '<div class="criteria_summary criteria_row">' . getReviewsSummaryStars($avg_author) . '</div>' . '</div>';
                                }
                            }
                            if (get_custom_option("slider_info_category") == 'yes') {
                                $caption .= $output_reviews;
                            }
                            $caption .= '<h2 class="sc_slider_subtitle"><a href="' . $post_link . '">' . $post_title . '</a></h2>';
                            if (get_custom_option("slider_info_category") != 'yes') {
                                $caption .= $output_reviews;
                            }
                            if ($descriptions > 0) {
                                $caption .= '<div class="sc_slider_descr">' . getShortString($post_descr, $descriptions) . '</div>';
                            }
                            $caption .= '</div>' . ($engine == 'chop' ? '</div>' : '');
                        }
                        $output .= ($engine == 'swiper' || $engine == 'flex' ? $caption : '') . (sc_param_is_on($links) ? '</a>' : '') . '</li>';
                    }
                    wp_reset_postdata();
                }
                $output .= '</ul>';
                if ($engine == 'swiper' || $engine == 'chop') {
                    if (sc_param_is_on($controls)) {
                        $output .= '
					<ul class="flex-direction-nav">
					<li><a class="flex-prev" href="#"></a></li>
					<li><a class="flex-next" href="#"></a></li>
					</ul>';
                    }
                    if (sc_param_is_on($pagination)) {
                        $output .= '<div class="flex-control-nav"></div>';
                    }
                }
                if ($engine == 'chop') {
                    $output .= '
				<div class="sc_slider_info_slides">' . $caption . '</div>
				<div class="sc_slider_info_holder"></div>
				';
                }
            } else {
                $output = '';
            }
        }
    }
    if (!empty($output)) {
        $output .= '</div>' . ($border != 'none' ? '</div>' : '');
        if ($pagination_items) {
            $output .= '
				<div class="flex-control-nav manual"' . ($hs ? ' style="' . $hs . '"' : '') . '>
					<div id="' . $id . '_scroll" class="sc_scroll sc_scroll_vertical swiper-slider-container scroll-container"' . ($hs ? ' style="' . $hs . '"' : '') . '>
						<div class="sc_scroll_wrapper swiper-wrapper">
							<div class="sc_scroll_slide swiper-slide">
								<ul>' . $pagination_items . '</ul>
							</div>
						</div>
						<div id="' . $id . '_scroll_bar" class="sc_scroll_bar sc_scroll_bar_vertical"></div>
					</div>
				</div>';
            $output .= '</div>';
        }
    }
    return $output;
}
Пример #6
0
 function themerex_callback_send_contact_form()
 {
     global $_REQUEST;
     if (!wp_verify_nonce($_REQUEST['nonce'], 'ajax_nonce')) {
         die;
     }
     $response = array('error' => '');
     $user_name = themerex_substr($_REQUEST['user_name'], 0, 20);
     $user_email = themerex_substr($_REQUEST['user_email'], 0, 60);
     $user_msg = getShortString($_REQUEST['user_msg'], 300);
     if (!($contact_email = get_theme_option('contact_email')) && !($contact_email = get_theme_option('admin_email'))) {
         $response['error'] = __('Unknown admin email!', 'themerex');
     } else {
         $subj = sprintf(__('Site %s - Contact form message from %s', 'themerex'), get_bloginfo('site_name'), $user_name);
         $msg = "\n" . __('Name:', 'themerex') . " {$user_name}\n" . __('E-mail:', 'themerex') . " {$user_email}\n\t\n" . __('Message:', 'themerex') . " {$user_msg}\n\t\n............ " . get_bloginfo('site_name') . " (" . home_url() . ") ............";
         /*	
         			$head = "Content-Type: text/plain; charset=\"utf-8\"\n"
         				. "X-Mailer: PHP/" . phpversion() . "\n"
         				. "Reply-To: $user_email\n"
         				. "To: $contact_email\n"
         				. "From: $user_email\n"
         				. "Subject: $subj\n";
         */
         if (!@wp_mail($contact_email, $subj, $msg)) {
             //, $head
             $response['error'] = __('Error send message!', 'themerex');
         }
         echo json_encode($response);
         die;
     }
 }
     $user_votes_avg[$criteria] = $points / $user_total_votes;
 }
 $width = 137;
 $user_reviews_output = trex_vote_results($user_votes_avg, $vote_max, $width);
 $user_reviews_avg = array_sum($user_votes_avg) / count($user_criteria_points);
 $user_reviews_avg_to_view = marksToDisplay($user_reviews_avg, $vote_max);
 $user_reviews_output .= trex_avg_total_score($user_reviews_avg_to_view, $user_reviews_avg);
 /**/
 $criteria_points = array();
 foreach ($criterias_list as $key => $criteria) {
     $criteria_points[$criteria] = $votes_list[$key];
 }
 if ($use_tabs) {
     $users_total_block = trex_avg_total_score($author_avg_to_view, $author_avg);
 }
 $author_short_decs = '<div class="short_descr">' . getShortString(strip_tags($post_data['post_excerpt']), 100) . '</div>';
 $author_full_decs = '<div class="full_descr">' . $post_data['post_excerpt'] . '</div>';
 $user_short_desc = '<div class="short_descr">This section displays an average rating from all users according to specified criteria. Total number of ratings ' . $user_total_votes . '</div>';
 $user_reviews_output .= $user_short_desc;
 /**/
 $output = $marks = $users = '';
 if ($use_tabs) {
     $author_tab = '<li class="squareButton"><a href="#author-tabs"><span>' . $author_avg_to_view . '</span>' . __('Editor rating', 'themerex') . '</a></li>';
     $users_tab = '<li class="squareButton"><a href="#users-tabs"><span>' . $user_reviews_avg_to_view . '</span>' . __('Users rating', 'themerex') . '</a></li>';
     $output .= '<div class="popularFiltr"><ul>' . ($reviews_first_author ? $author_tab . $users_tab : $users_tab . $author_tab) . '</ul></div>';
 }
 // Criterias list
 $author_reviews_output = trex_vote_results($criteria_points, $vote_max, $width);
 $author_reviews_output .= !empty($users_total_block) ? $users_total_block : '';
 $output .= '<div class="ratingStars" id="author-tabs"><div class="tab_block_inner">' . $author_reviews_output . (count($criterias_list) <= 1 ? $author_full_decs : $author_short_decs) . '</div></div>';
 // Users marks
    /**
     * How to display the widget on the screen.
     */
    function widget($args, $instance)
    {
        extract($args);
        global $wp_query, $post;
        /* Our variables from the widget settings. */
        $title = apply_filters('widget_title', isset($instance['title']) ? $instance['title'] : '');
        $title_tabs = array(apply_filters('widget_title', isset($instance['title_latest']) ? $instance['title_latest'] : ''), apply_filters('widget_title', isset($instance['title_popular']) ? $instance['title_popular'] : ''), apply_filters('widget_title', isset($instance['title_commented']) ? $instance['title_commented'] : ''));
        $title_tabs = array_filter($title_tabs);
        $title_length = isset($instance['title_length']) ? (int) $instance['title_length'] : 0;
        $number = isset($instance['number']) ? (int) $instance['number'] : '';
        $show_info = isset($instance['show_info']) ? $instance['show_info'] : 0;
        $show_rating = isset($instance['show_rating']) ? (int) $instance['show_rating'] : 0;
        $show_cats = isset($instance['show_cats']) ? (int) $instance['show_cats'] : 0;
        $category = isset($instance['category']) ? (int) $instance['category'] : 0;
        $post_thumb = isset($instance['post_thumb']) ? $instance['post_thumb'] : 'hide';
        $output = $tabs = '';
        $titles_str = implode('', $title_tabs);
        for ($i = 0; $i < 3; $i++) {
            if (!empty($title_tabs[$i]) || $i == 0 && strlen($titles_str) == 0) {
                $args = array('post_type' => 'post', 'post_status' => current_user_can('read_private_pages') && current_user_can('read_private_posts') ? array('publish', 'private') : 'publish', 'post_password' => '', 'posts_per_page' => $number, 'ignore_sticky_posts' => 1, 'order' => 'DESC');
                if ($i == 0) {
                    // Latest
                    $args['orderby'] = 'date';
                    $args['order'] = 'DESC';
                } else {
                    if ($i == 1) {
                        // Most popular
                        $args['meta_key'] = 'post_views_count';
                        $args['orderby'] = 'meta_value_num';
                    } else {
                        // Most commented
                        $args['orderby'] = 'comment_count';
                    }
                }
                if ($category > 0) {
                    $args['cat'] = $category;
                }
                $ex = get_theme_option('exclude_cats');
                if (!empty($ex)) {
                    $args['category__not_in'] = explode(',', $ex);
                }
                query_posts($args);
                /* Loop posts */
                if (have_posts()) {
                    $abc_range = range('a', 'z');
                    $abc_shuffle = str_shuffle(implode('', $abc_range));
                    $unikey = substr($abc_shuffle, 10);
                    if (count($title_tabs) > 1) {
                        $tabs .= '<li><a href="#widget_popular_' . $i . '_' . $unikey . '" class="theme_button"><span>' . $title_tabs[$i] . '</span></a></li>';
                    }
                    $output .= '
						<div class="tab_content style_' . $post_thumb . '" id="widget_popular_' . $i . '_' . $unikey . '">
					';
                    $post_number = 0;
                    while (have_posts()) {
                        the_post();
                        $post_number++;
                        $post_id = get_the_ID();
                        $post_date = getDateOrDifference(get_the_date('Y-m-d H:i:s'));
                        $post_title = $post->post_title;
                        $post_title = !empty($title_length) ? getShortString($post_title, $title_length, '...') : $post_title;
                        $post_link = get_permalink();
                        $post_custom = get_post_custom($post_id);
                        $post_comments = wp_count_comments($post_id);
                        $post_comments_link = '<a href="' . $post_link . '#comments"><i class="icon-comment-1"></i>' . $post_comments->approved . '</a>';
                        $post_votes = !empty($post_custom['post_votes_data']) ? $post_custom['post_votes_data'] : '';
                        $votes_data = !empty($post_votes[0]) ? unserialize($post_votes[0]) : '';
                        $crit_points = !empty($votes_data['criterias_points']) ? $votes_data['criterias_points'] : '';
                        $total_votes = !empty($votes_data['total_votes']) ? $votes_data['total_votes'] : '';
                        $votes_sum = !empty($crit_points) ? array_sum($crit_points) : '';
                        $votes_avg = !empty($votes_sum) && !empty($total_votes) ? $votes_sum / $total_votes : '';
                        $votes_avg = !empty($votes_avg) ? number_format($votes_avg, 0) : '';
                        $cust_opt = !empty($post_custom['post_custom_options'][0]) ? unserialize($post_custom['post_custom_options'][0]) : '';
                        $author_review = !empty($cust_opt['reviews_marks']) ? explode(',', $cust_opt['reviews_marks']) : '';
                        $author_avg = count($author_review) > 0 ? number_format(array_sum($author_review) / count($author_review), 0) : 0;
                        $post_format = get_post_format($post_id);
                        $post_format = $post_format == false ? 'standard' : $post_format;
                        $format_icon = getPostFormatIcon($post_format);
                        $avg_arr = array();
                        $avg_arr[] = !empty($author_avg) ? $author_avg : '';
                        $avg_arr[] = !empty($votes_avg) ? $votes_avg : '';
                        $avg_arr = array_filter($avg_arr);
                        $total_avg = count($avg_arr) > 0 ? array_sum($avg_arr) / count($avg_arr) : '';
                        $post_categories_links = '';
                        if ($show_cats) {
                            $post_categories_list = getCategoriesByPostId($post_id);
                            $ex_cats = explode(',', get_theme_option('exclude_cats'));
                            $cat_count = count($post_categories_list);
                            for ($c = 0; $c < $cat_count; $c++) {
                                if (in_array($post_categories_list[$c]['term_id'], $ex_cats)) {
                                    continue;
                                }
                                $post_categories_ids[] = $post_categories_list[$c]['term_id'];
                                $category_color = get_category_inherited_property($post_categories_list[$c]['term_id'], 'category_color');
                                if (empty($category_color)) {
                                    $category_color = get_theme_option('category_color');
                                }
                                $post_categories_links .= '<a class="cat_link" href="' . $post_categories_list[$c]['link'] . '"' . (!empty($category_color) ? ' style="background:' . $category_color . '"' : '') . '	>' . $post_categories_list[$c]['name'] . '</a>';
                                $post_categories_links .= count($post_categories_list) > 1 && $c + 1 == $cat_count ? '<br>' : '';
                            }
                        }
                        $review = '';
                        if (!empty($total_avg) && $show_rating) {
                            $review = get_review_rating('5stars', min($total_avg, 100), 100, '#f2c574');
                        }
                        $post_info = '';
                        $post_info .= !empty($show_info) ? '<div class="widget_popular_post_info">' . $post_categories_links . (!empty($review) ? $review : '') . '<span class="post_date"><i class="icon-clock-1"></i>' . $post_date . '</span>' . '<span class="divider">|</span>' . $post_comments_link . '</div>' : '';
                        $output .= '
							<div class="post_item' . ($post_number == 1 ? ' first' : '') . (!empty($post_thumb) ? ' thumb_style_' . $post_thumb : '') . '">
						';
                        $thumb_size = $post_thumb == 'large_thumb' ? 100 : 64;
                        if (in_array($post_thumb, array('large_thumb', 'default_thumb'))) {
                            $post_thumbnail = getResizedImageTag($post_id, $thumb_size, $thumb_size);
                            if ($post_thumbnail) {
                                $output .= '
										<div class="post_thumb image_wrapper">' . $post_thumbnail . '</div>
								';
                            }
                        } else {
                            if ($post_thumb == 'post_format') {
                                $output .= '<i class="' . $format_icon . ' format-icon"></i>';
                            }
                        }
                        $output .= '
										<div class="post_wrapper">
											<h5 class="post_title theme_title"><a href="' . $post_link . '">' . $post_title . '</a></h5>
						';
                        $output .= $post_info . '
								</div>
							</div>
						';
                        if ($post_number >= $number) {
                            break;
                        }
                    }
                    $output .= '
						</div>';
                }
            }
        }
        /* Restore main wp_query and current post data in the global var $post */
        wp_reset_query();
        wp_reset_postdata();
        if (!empty($output)) {
            wp_enqueue_script('jquery-ui-tabs', false, array('jquery', 'jquery-ui-core'), null, true);
            /* Before widget (defined by themes). */
            echo $before_widget;
            /* Display the widget title if one was input (before and after defined by themes). */
            if ($title) {
                echo $before_title . $title . $after_title;
            }
            echo '
				<div class="popular_and_commented_tabs' . ($show_info || $show_rating ? '' : ' flat_list') . '">
					' . (strlen($titles_str) != 0 && count($title_tabs) > 1 ? '<ul class="tabs">' . $tabs . '</ul>' : '') . '
					' . $output . '
					<script type="text/javascript">
						jQuery(document).ready(function() {
							jQuery(\'.popular_and_commented_tabs\').tabs();
						});
					</script>
				</div>
			';
            /* After widget (defined by themes). */
            echo $after_widget;
        }
    }
    //				echo $post_data['post_audio'];
}
?>

	<?php 
if ($post_data['post_protected']) {
    echo $post_data['post_excerpt'];
} else {
    if ($post_data['post_excerpt']) {
        ?>
			<div class="post<?php 
        echo themerex_strtoproper($post_data['post_format']);
        ?>
">
				<?php 
        echo getShortString($post_data['post_excerpt'], $post_data['post_format'] == 'quote' ? 0 : get_theme_option('post_excerpt_maxlength'));
        ?>
			</div>
			<?php 
    }
}
?>
	</div>
	<footer>
		<?php 
if (!$post_data['post_protected']) {
    ?>
		<div class="postSharing">
			<?php 
    require get_template_directory() . '/templates/page-part-postinfo.php';
    ?>
					</div>
					<?php 
    }
    ?>
			</div>
		<?php 
}
?>
		
		<div class="post_text_area">
			<?php 
if ($post_protected) {
    echo $post_descr;
} else {
    if ($post_descr) {
        echo getShortString($post_descr, $post_format == 'quote' ? 0 : get_theme_option('post_excerpt_maxlength'));
        ?>
					<a href="<?php 
        echo $post_link;
        ?>
" class="more-link"><?php 
        _e('Read more', 'themerex');
        ?>
</a>
					<?php 
    }
    ?>
				<div class="post_info post_info_bottom theme_info">
					<?php 
    if ($post_tags_str != '') {
        ?>
Пример #11
0
	<?php 
}
?>

	<?php 
if ($post_data['post_protected']) {
    echo $post_data['post_excerpt'];
} else {
    if ($post_data['post_excerpt']) {
        ?>
			<div class="post<?php 
        echo themerex_strtoproper($post_data['post_format']);
        ?>
">
				<?php 
        echo in_array($post_data['post_format'], array('quote', 'link', 'chat')) ? $post_data['post_excerpt'] : getShortString($post_data['post_excerpt'], isset($opt['descr']) ? $opt['descr'] : get_custom_option('post_excerpt_maxlength'));
        ?>
			</div>
			<?php 
    }
}
?>
	<?php 
if (!$post_data['post_protected'] && get_custom_option('blog_counters') != 'none') {
    ?>
	<div class="postSharing">
		<?php 
    $postinfo_buttons = array('more', 'comments', 'views', 'likes', 'rating');
    // 'share'
    require themerex_get_file_dir('/templates/page-part-postinfo.php');
    ?>
        } else {
            ?>
<h4><?php 
            echo $post_data['post_title'];
            ?>
</h4><?php 
        }
        ?>
					</div>

					<?php 
        if ($post_data['post_excerpt']) {
            ?>
						<div class="post_format_wrap">
							<?php 
            echo getShortString($post_data['post_excerpt'], $opt['descr'], $opt['readmore'] ? '' : '...');
            ?>
						</div>
					<?php 
        }
        if ($opt['readmore'] != '') {
            ?>
						<a class="readmore_blogger" href="<?php 
            echo esc_url($post_data['post_link']);
            ?>
"><?php 
            echo esc_html($opt['readmore']);
            ?>
</a>
					<?php 
        }
Пример #13
0
function sc_blogger($atts, $content = null)
{
    extract(shortcode_atts(array("id" => "", "style" => "regular", "bubble_color" => "", "ids" => "", "cat" => "", "count" => "3", "offset" => "", "orderby" => "date", "order" => "desc", "descr" => "0", "readmore" => "0", "dir" => "horizontal", "border" => "0", "rating" => "1", "top" => "", "bottom" => "", "left" => "", "right" => ""), $atts));
    $s = ($top !== '' ? 'margin-top:' . $top . 'px;' : '') . ($bottom !== '' ? 'margin-bottom:' . $bottom . 'px;' : '') . ($left !== '' ? 'margin-left:' . $left . 'px;' : '') . ($right !== '' ? 'margin-right:' . $right . 'px;' : '');
    global $THEMEREX_sc_blogger_counter, $post;
    $THEMEREX_sc_blogger_counter = 0;
    if (!in_array($style, array('regular', 'date', 'image_large', 'image_medium', 'image_small', 'bubble_left', 'bubble_top', 'accordion', 'puzzles', 'underline'))) {
        $style = 'regular';
    }
    if (!empty($ids)) {
        $posts = explode(',', str_replace(' ', '', $ids));
        $count = count($posts);
    }
    if ($style == 'accordion') {
        $dir = 'vertical';
    }
    $output = $style == 'puzzles' ? '' : '<div' . ($id ? ' id="' . $id . '"' : '') . ' class="sc_blogger' . ' sc_blogger_' . ($dir == 'vertical' ? 'vertical' : 'horizontal') . ' style_' . $style . ($style == 'accordion' ? ' sc_accordion' : '') . ($dir != 'vertical' && $style != 'puzzles' ? ' sc_columns sc_columns_count_' . $count : '') . '"' . ($s != '' ? ' style="' . $s . '"' : '') . '>';
    $counters = get_theme_option("blog_counters");
    $args = array('post_status' => current_user_can('read_private_pages') && current_user_can('read_private_posts') ? array('publish', 'private') : 'publish', 'posts_per_page' => $count, 'ignore_sticky_posts' => 1, 'order' => $order == 'asc' ? 'asc' : 'desc', 'orderby' => 'date');
    if ($offset > 0 && empty($ids)) {
        $args['offset'] = $offset;
    }
    $args = addSortOrderInQuery($args, $orderby, $order);
    $args = addPostsAndCatsInQuery($args, $ids, $cat);
    $query = new WP_Query($args);
    while ($query->have_posts()) {
        $query->the_post();
        $post_id = get_the_ID();
        $post_protected = post_password_required();
        $post_format = get_post_format();
        $post_link = get_permalink();
        $post_comments_link = $counters == 'comments' ? get_comments_link($post_id) : $post_link;
        $post_comments = get_comments_number();
        $post_views = getPostViews($post_id);
        $post_date = prepareDateForTranslation(get_the_date());
        $post_date_sql = get_the_date('Y-m-d H:i:s');
        $post_date_diff = getDateOrDifference($post_date_sql);
        $post_icon = getPostFormatIcon($post_format);
        $post_author = get_the_author();
        $post_author_id = get_the_author_meta('ID');
        $post_author_url = get_author_posts_url($post_author_id, '');
        $post_title_tag = $dir == 'vertical' ? 'h3' : 'h4';
        $post_thumb_w = $post_thumb_h = 0;
        if (themerex_strpos($style, 'bubble') !== false) {
            $post_custom_options = get_post_meta($post_id, 'post_custom_options', true);
            $post_icon = isset($post_custom_options['page_icon']) ? $post_custom_options['page_icon'] : $post_icon;
            $post_title_tag = 'h2';
        } else {
            if ($style == 'image_small') {
                $post_thumb = getResizedImageTag($post_id, 120, 80);
            } else {
                if ($style == 'image_medium') {
                    $post_thumb = getResizedImageTag($post_id, $post_thumb_w = 279, $post_thumb_h = 186);
                } else {
                    if ($style == 'image_large') {
                        $post_thumb = getResizedImageTag($post_id, $post_thumb_w = 466, $post_thumb_h = 310);
                    } else {
                        if ($style == 'puzzles') {
                            $post_thumb = getResizedImageTag($post_id, $post_thumb_w = 310, $post_thumb_h = 310);
                        }
                    }
                }
            }
        }
        //$post_attachment = wp_get_attachment_url(get_post_thumbnail_id($post_id));
        if (get_theme_option('preserve_decoration') == 'no') {
            // -------------- Old way to get title, excerpt and content -----------------------
            $post_title = get_the_title();
            $post_content_full = $post->post_content;
            //get_the_content() not used, because it trim content up to <!-- more --> in each case!
            $post_content_prepared = strip_shortcodes($post_content_full);
            //do_shortcode($post_content_full); //do_shortcode() make a recursion if insert shortcode [blogger] in the posts!!!!
            $post_excerpt = in_array($post_format, array('quote', 'link')) && $style == 'puzzles' ? $post_content_prepared : ($descr > 0 ? strip_tags(strip_shortcodes(getPostDescription($descr, $readmore ? '' : '...'))) : '');
        } else {
            // ----------------- New way to get title, excerpt and content -----------------------
            $post_title = $post_title_plain = get_the_title();
            global $more;
            $old_more = $more;
            $more = -1;
            $post_content_full = get_the_content();
            $post_content_prepared = do_shortcode($post_content_full);
            $more = $old_more;
            $post_content = get_the_content(null);
            $post_excerpt = has_excerpt() || $post_protected ? get_the_excerpt() : '';
            if (empty($post_excerpt)) {
                if (($more_pos = themerex_strpos($post_content_full, '<span id="more-')) !== false) {
                    $post_excerpt = themerex_substr($post_content_full, 0, $more_pos);
                } else {
                    $post_excerpt = in_array($post_format, array('quote', 'link')) ? $post_content : get_the_excerpt();
                }
            }
            $post_excerpt = str_replace('[&hellip;]', '', $post_excerpt);
            if (!in_array($post_format, array('quote', 'link')) && $descr > 0 && themerex_strlen($post_excerpt) > $descr) {
                $post_excerpt = getShortString(strip_tags(do_shortcode($post_excerpt)), $descr, $readmore ? '' : '...');
            }
            $post_excerpt .= !in_array($post_format, array('quote', 'link')) && $readmore ? '&nbsp;<a href="' . $post_link . '" class="readmore">' . ($readmore == 1 ? '&raquo;' : $readmore) . '</a>' : '';
            //$post_content = apply_filters('the_content', $post_content);
            // ------------------  /New way to get title, excerpt and content -----------------------
        }
        $post_excerpt = apply_filters(in_array($post_format, array('quote', 'link')) ? 'the_content' : 'the_excerpt', force_balance_tags($post_excerpt));
        // Extract gallery, video and audio from full post content
        $post_gallery = $post_video = $post_audio = $post_url = $post_url_target = '';
        if (in_array($style, array('image_medium', 'image_large', 'puzzles'))) {
            if ($post_format == 'gallery') {
                $post_gallery = buildGalleryTag(getPostGallery($post_content_full, $post_id), $post_thumb_w, $post_thumb_h);
            } else {
                if ($post_format == 'video') {
                    $post_video = getPostVideo($post_content_full, false);
                    if ($post_video == '') {
                        $src = getVideoPlayerURL(getPostVideo($post_content_full, true), $post_thumb != '');
                        if ($src) {
                            $post_video = substituteVideo('<video src="' . $src . '">', $post_thumb_w, $post_thumb_h);
                        }
                    }
                    if ($post_video != '' && get_custom_option('substitute_video') == 'yes') {
                        $src = getVideoPlayerURL(getPostVideo($post_video), $post_thumb != '');
                        if ($src) {
                            $post_video = substituteVideo('<video src="' . $src . '">', $post_thumb_w, $post_thumb_h);
                        }
                    }
                } else {
                    if ($post_format == 'audio') {
                        $post_audio = getPostAudio($post_content_full, false);
                        if ($post_audio == '') {
                            $src = getPostAudio($post_content_full, true);
                            if ($src) {
                                $post_audio = substituteAudio('<audio src="' . $src . '">');
                            }
                        }
                        if ($post_audio != '' && get_custom_option('substitute_audio') == 'yes') {
                            $src = getPostAudio($post_audio);
                            if ($src) {
                                $post_audio = substituteAudio('<audio src="' . $src . '">');
                            }
                        }
                    } else {
                        if ($post_format == 'image' && !$post_thumb) {
                            if (($src = getPostImage($post_content_full)) != '') {
                                $post_thumb = getResizedImageTag($src, $post_thumb_w, $post_thumb_h);
                            }
                        } else {
                            if ($post_format == 'link') {
                                $post_url_data = getPostLink($post_content_full, false);
                                $post_url = $post_url_data['url'];
                                $post_url_target = $post_url_data['target'];
                            }
                        }
                    }
                }
            }
        }
        // Get all post's categories
        $post_categories = getCategoriesByPostId($post_id);
        $post_categories_str = '';
        $post_accent_color = '';
        $post_accent_category = '';
        $ex_cats = explode(',', get_theme_option('exclude_cats'));
        for ($i = 0; $i < count($post_categories); $i++) {
            if (in_array($post_categories[$i]['term_id'], $ex_cats)) {
                continue;
            }
            if ($post_accent_category == '') {
                if (get_theme_option('close_category') == 'parental') {
                    $parent_cat_id = 0;
                    //(int) get_custom_option('category_id');
                    $parent_cat = getParentCategory($post_categories[$i]['term_id'], $parent_cat_id);
                    if ($parent_cat) {
                        $post_accent_category = $parent_cat['name'];
                        if ($post_accent_color == '') {
                            $post_accent_color = getCategoryInheritedProperty($parent_cat['term_id'], 'theme_accent_color');
                        }
                    }
                } else {
                    $post_accent_category = $post_categories[$i]['name'];
                    if ($post_accent_color == '') {
                        $post_accent_color = getCategoryInheritedProperty($post_categories[$i]['term_id'], 'theme_accent_color');
                    }
                }
            }
            $post_categories_str .= '<a class="cat_link" href="' . $post_categories[$i]['link'] . '">' . $post_categories[$i]['name'] . ($i < count($post_categories) - 1 ? ',' : '') . '</a> ';
        }
        if ($post_accent_category == '' && count($post_categories) > 0) {
            $post_accent_category = $post_categories[0]['name'];
            if ($post_accent_color == '') {
                $post_accent_color = getCategoryInheritedProperty($post_categories[0]['term_id'], 'theme_accent_color');
            }
        }
        if ($style == 'puzzles') {
            $post_hover_bg = get_custom_option('puzzles_post_bg', null, $post_id);
            $post_hover_pos = get_custom_option('puzzles_post_position', null, $post_id);
        }
        // Prepare reviews block
        $reviewsBlock = '';
        $avg_author = 0;
        if ($rating > 0 && get_custom_option('show_reviews', null, $post_id) == 'yes') {
            $avg_author = marksToDisplay(get_post_meta($post_id, 'reviews_avg' . (get_theme_option('reviews_first') == 'author' ? '' : '2'), true));
            if ($avg_author > 0) {
                $reviewsBlock .= '<div class="reviews_summary blog_reviews' . ($style == 'puzzles' ? ' theme_puzzles' : '') . '"' . ($style == 'puzzles' && $post_hover_bg != '' && $post_hover_bg != 'default' ? ' style="background-color:' . $post_hover_bg . ';"' : '') . '>' . '<div class="criteria_summary criteria_row">' . getReviewsSummaryStars($avg_author) . '</div>' . '</div>';
            }
        }
        // Start output
        $THEMEREX_sc_blogger_counter++;
        $output .= '<div class="sc_blogger_item' . ($style == 'puzzles' ? ' sc_blogger_item_puzzles' : '') . ($style == 'date' ? ' sc_blogger_item_date' : '') . ($style == 'accordion' ? ' sc_accordion_item' : '') . ($dir != 'vertical' && $style != 'puzzles' ? ' sc_column_item sc_column_item_' . $THEMEREX_sc_blogger_counter : '') . ($border == 1 ? ' sc_blogger_item_bordered' : '') . ($THEMEREX_sc_blogger_counter % 2 == 1 ? ' odd' : ' even') . ($THEMEREX_sc_blogger_counter == 1 ? ' first' : '') . '">
			';
        if ($style == 'puzzles') {
            $show_content_block = !in_array($post_format, array('link', 'image')) || !$post_thumb;
            $puzzles_style = get_custom_option('puzzles_style');
            $no_thumb = in_array($post_format, array('quote', 'link', 'image')) || !$post_thumb && (!$post_gallery || $post_protected);
            $output .= '<div class="post_thumb image_wrapper post_format_' . $post_format . ' ' . ($no_thumb ? 'no_thumb' : $post_hover_pos) . '"' . ($post_video && !$post_protected ? ' data-video="' . htmlspecialchars($post_video) . '"' : '') . '>';
            if ($post_thumb && ($post_format != 'gallery' || !$post_gallery || get_custom_option('gallery_instead_image') == 'no')) {
                // If post have thumbnail - show it
                if ($post_format == 'link' && $post_url != '') {
                    $output .= '<a href="' . $post_url . '"' . ($post_url_target ? ' target="' . $post_url_target . '"' : '') . '>' . $post_thumb . '</a>';
                } else {
                    if ($post_link != '') {
                        $output .= '<a href="' . $post_link . '">' . $post_thumb . '</a>';
                    } else {
                        $output .= $post_thumb;
                    }
                }
                if ($post_format == 'video' && $post_video && !$post_protected) {
                    $output .= '<a href="#" class="post_video_play icon-play"></a>';
                }
            } else {
                if ($post_gallery && !$post_protected) {
                    // If post have gallery - show it
                    if ($post_link != '') {
                        $output .= '<a href="' . $post_link . '">' . $post_gallery . '</a>';
                    } else {
                        $output .= $post_gallery;
                    }
                } else {
                    if ($post_video && !$post_protected) {
                        // If post have video - show it
                        $output .= $post_video;
                        $show_content_block = false;
                    }
                }
            }
            $output .= '<span class="post_format theme_accent_bg ' . $post_icon . '"' . (themerex_substr($post_accent_color, 0, 1) == '#' ? ' style="background-color: ' . $post_accent_color . '"' : '') . '></span>';
            if ($puzzles_style == 'heavy') {
                if ($post_accent_category != '') {
                    $output .= '<span class="post_category theme_accent_bg"' . (themerex_substr($post_accent_color, 0, 1) == '#' ? ' style="background-color: ' . $post_accent_color . '"' : '') . '>' . $post_accent_category . '</span>';
                }
            } else {
                if ($show_content_block) {
                    $output .= '<div class="post_content_light">' . ($post_accent_category != '' ? '<span class="post_category theme_accent_bg"' . (themerex_substr($post_accent_color, 0, 1) == '#' ? ' style="background-color: ' . $post_accent_color . '"' : '') . '>' . $post_accent_category . '</span><br>' : '') . '<h2 class="post_subtitle theme_puzzles"' . ($post_hover_bg != '' && $post_hover_bg != 'default' ? ' style="background-color:' . $post_hover_bg . ';"' : '') . '><a href="' . $post_link . '">' . $post_title . '</a></h2><br>' . $reviewsBlock . '</div>';
                }
            }
            if ($show_content_block) {
                $output .= '<div class="post_content_wrapper theme_puzzles"' . ($post_hover_bg != '' && $post_hover_bg != 'default' ? ' style="background-color:' . $post_hover_bg . ';"' : '') . '>';
                if (!in_array($post_format, array('quote', 'aside'))) {
                    $output .= '<h2 class="post_subtitle"><a href="' . $post_link . '">' . $post_title . '</a></h2>';
                    $output .= $reviewsBlock;
                }
                $output .= '<div class="post_descr">' . $post_excerpt . '</div>' . '<div class="post_content_padding theme_puzzles"';
                if ($post_hover_bg != '' && $post_hover_bg != 'default') {
                    $rgb = Hex2RGB($post_hover_bg);
                    $post_hover_ie = str_replace('#', '', $post_hover_bg);
                    $output .= " style=\"\n\t\t\t\t\t\tbackground: -moz-linear-gradient(top,  rgba({$rgb['r']},{$rgb['g']},{$rgb['b']},0) 0%, rgba({$rgb['r']},{$rgb['g']},{$rgb['b']},0.01) 1%, rgba({$rgb['r']},{$rgb['g']},{$rgb['b']},1) 50%);\n\t\t\t\t\t\tbackground: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba({$rgb['r']},{$rgb['g']},{$rgb['b']},0)), color-stop(1%,rgba({$rgb['r']},{$rgb['g']},{$rgb['b']},0.01)), color-stop(50%,rgba({$rgb['r']},{$rgb['g']},{$rgb['b']},1)));\n\t\t\t\t\t\tbackground: -webkit-linear-gradient(top,  rgba({$rgb['r']},{$rgb['g']},{$rgb['b']},0) 0%,rgba({$rgb['r']},{$rgb['g']},{$rgb['b']},0.01) 1%,rgba({$rgb['r']},{$rgb['g']},{$rgb['b']},1) 50%);\n\t\t\t\t\t\tbackground: -o-linear-gradient(top,  rgba({$rgb['r']},{$rgb['g']},{$rgb['b']},0) 0%,rgba({$rgb['r']},{$rgb['g']},{$rgb['b']},0.01) 1%,rgba({$rgb['r']},{$rgb['g']},{$rgb['b']},1) 50%);\n\t\t\t\t\t\tbackground: -ms-linear-gradient(top,  rgba({$rgb['r']},{$rgb['g']},{$rgb['b']},0) 0%,rgba({$rgb['r']},{$rgb['g']},{$rgb['b']},0.01) 1%,rgba({$rgb['r']},{$rgb['g']},{$rgb['b']},1) 50%);\n\t\t\t\t\t\tbackground: linear-gradient(to bottom,  rgba({$rgb['r']},{$rgb['g']},{$rgb['b']},0) 0%,rgba({$rgb['r']},{$rgb['g']},{$rgb['b']},0.01) 1%,rgba({$rgb['r']},{$rgb['g']},{$rgb['b']},1) 50%);\n\t\t\t\t\t\tfilter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#00{$post_hover_ie}', endColorstr='#{$post_hover_ie}',GradientType=0 );\n\t\t\t\t\t\t\"";
                }
                $output .= '></div></div>';
            }
            if (!$post_protected) {
                if ($post_audio) {
                    // If post have audio - show it
                    $output .= $post_audio;
                }
            }
            $output .= '</div>';
        } else {
            $title = '<' . $post_title_tag . ' class="sc_blogger_title sc_title entry-title' . ($style == 'accordion' ? ' sc_accordion_title' : '') . ($style == 'underline' ? ' sc_title_underline' : '') . (themerex_strpos($style, 'bubble') !== false ? ' sc_title_bubble sc_title_' . $style : '') . '">' . '<a href="' . ($style == 'accordion' ? '#' : $post_link) . '">' . (themerex_substr($style, 0, 6) == 'bubble' ? '<span class="sc_title_bubble_icon ' . ($post_icon != '' ? ' ' . $post_icon : '') . '"' . ($bubble_color != '' ? ' style="background-color:' . $bubble_color . '"' : '') . '></span>' : '') . ($style == 'accordion' ? '<span class="sc_accordion_icon"></span>' : '') . $post_title . ($style == 'accordion' ? '' : $reviewsBlock) . '</a>' . '</' . $post_title_tag . '>';
            if ($style == 'date') {
                $output .= '<div class="date_area">' . '<div class="date_month">' . prepareDateForTranslation(date('M', strtotime($post_date_sql))) . '</div>' . '<div class="date_day">' . date('d', strtotime($post_date)) . '</div>' . '</div>';
            } else {
                if (themerex_strpos($style, 'image') !== false) {
                    $output .= ($style == 'image_small' ? '<div class="title_area">' . $title . '</div>' : ($post_thumb ? '<div class="sc_blogger_image image_wrapper">' . ($post_link != '' ? '<a href="' . $post_link . '">' : '') . $post_thumb . ($post_link != '' ? '</a>' : '') . '</div>' : '')) . '<div class="post_wrapper">' . '<div class="post_info theme_info">' . __('Posted', 'themerex') . ' <span class="post_date theme_text">' . $post_date_diff . '</span> ' . '<span class="post_author">' . __('by', 'themerex') . ' <a href="' . $post_author_url . '" class="post_author">' . $post_author . '</a></span>' . '<br />' . ($post_categories_str != '' ? '<span class="post_cats">' . __('in', 'themerex') . ' ' . $post_categories_str . '</span>' : '') . ($counters == 'none' ? '' : '<span class="post_comments"><a href="' . $post_comments_link . '"><span class="comments_icon theme_info icon-' . ($orderby == 'comments' || $counters == 'comments' ? 'chat-1' : 'eye') . '"></span><span class="comments_number">' . ($orderby == 'comments' || $counters == 'comments' ? $post_comments : $post_views) . '</span></a></span>') . '</div>' . ($style == 'image_small' ? '' : '<div class="title_area">');
                }
            }
            $output .= $style == 'image_small' ? '' : $title;
            if (themerex_strpos($style, 'image') !== false) {
                $output .= $style == 'image_small' ? $post_thumb ? '<div class="sc_blogger_image image_wrapper">' . ($post_link != '' ? '<a href="' . $post_link . '">' : '') . $post_thumb . ($post_link != '' ? '</a>' : '') . '</div>' : '' : '</div>';
            }
            if ($descr > 0) {
                $output .= '<div class="sc_blogger_content' . ($style == 'accordion' ? ' sc_accordion_content' : '') . '">' . $post_excerpt . '</div>';
            }
            if (themerex_strpos($style, 'image') !== false) {
                $output .= '</div>';
            }
        }
        $output .= '</div>';
    }
    wp_reset_postdata();
    if ($style !== 'puzzles') {
        $output .= '</div>';
    }
    if ($style == 'accordion') {
        wp_enqueue_script('jquery-ui-accordion', false, array('jquery', 'jquery-ui-core'), null, true);
        $output .= '<script type="text/javascript">
				jQuery(document).ready(function() {
					jQuery(\'div' . ($id ? '#' . $id : '') . '.sc_blogger.sc_accordion\').accordion({
						header: "h3",
						collapsible: true,
						heightStyle: "content"
					});
				});
			</script>';
    }
    if ($border == 1) {
        $output .= '<script type="text/javascript">
				jQuery(document).ready(function() {
					var maxHeight = 0;
					for (var i=0; i<2; i++) {
						jQuery(\'.sc_blogger_item_bordered\').each(function(){
							if (i > 0) {
								if (maxHeight>0) jQuery(this).height(maxHeight);
							} else if (jQuery(this).height() > maxHeight)
								maxHeight = jQuery(this).height();
						});
					}
				});
			</script>';
    }
    return $output;
}
Пример #14
0
					<?php 
if ($show_title) {
    ?>
					<h4 class="isotopeTitle"><a href="<?php 
    echo esc_url($post_data['post_link']);
    ?>
"><?php 
    echo balanceTags($post_data['post_title']);
    ?>
</a></h4>
					<?php 
}
?>
					
					<?php 
echo balanceTags($post_data['post_excerpt'] ? '<div class="isotopeExcerpt">' . getShortString(strip_tags($post_data['post_excerpt']), 100) . '</div>' : '');
?>
					
					<?php 
if ($post_data['post_categories_links'] != '') {
    ?>
						<div class="isotopeCats hoverUnderline"><?php 
    echo balanceTags($post_data['post_categories_links']);
    ?>
</div>
					<?php 
}
?>
				</div>
			</div>
		</div>
    if ($show_title) {
        ?>
					<h4><a href="<?php 
        echo $post_data['post_link'];
        ?>
"><?php 
        echo $post_data['post_title'];
        ?>
</a></h4>
					<?php 
    }
    ?>
					<p>
					<?php 
    if (!in_array($post_data['post_format'], array('quote', 'link'))) {
        $post_data['post_excerpt'] = getShortString(strip_tags($post_data['post_excerpt']), $columns == 2 ? 400 : 90);
    }
    echo $post_data['post_excerpt'];
    ?>
					</p>
					<div class="masonryInfo">
						<?php 
    _e('Posted ', 'themerex');
    ?>
<a href="<?php 
    echo $post_data['post_link'];
    ?>
" class="post_date"><?php 
    echo $post_data['post_date'];
    ?>
</a>
"><?php 
                echo $post_data['post_title'];
                ?>
</a></h4><?php 
            } else {
                ?>
<h4><?php 
                echo $post_data['post_title'];
                ?>
</h4><?php 
            }
        }
        ?>
						<p>
						<?php 
        echo in_array($post_data['post_format'], array('quote', 'link', 'chat')) ? $post_data['post_excerpt'] : getShortString($post_data['post_excerpt'], min($columns == 2 ? 400 : 90, isset($opt['descr']) ? $opt['descr'] : get_custom_option('post_excerpt_maxlength_masonry')));
        ?>
						</p>
						<?php 
        if (!isset($opt['info']) || $opt['info']) {
            ?>
						<div class="masonryInfo">
							<?php 
            _e('Posted ', 'themerex');
            ?>
<a href="<?php 
            echo $post_data['post_link'];
            ?>
" class="post_date"><?php 
            echo $post_data['post_date'];
            ?>
Пример #17
0
function getPostDescription($maxlength = 0, $add = '...')
{
    $descr = get_the_excerpt();
    $descr = trim(str_replace(array('[...]', '[&hellip;]'), array($add, $add), $descr));
    if (!empty($descr) && themerex_strpos(',.:;-', themerex_substr($descr, -1)) !== false) {
        $descr = themerex_substr($descr, 0, -1);
    }
    if ($maxlength > 0) {
        $descr = getShortString($descr, $maxlength, $add);
    }
    return $descr;
}
">
				<span class="itInf">
					<span class="titleItem"><?php 
    _e('Previous item', 'themerex');
    ?>
</span>
					<?php 
    echo $desc;
    ?>
				</span>
			</a>
			<?php 
}
if (isset($attachments[$k + 1])) {
    $link = get_permalink($attachments[$k + 1]->ID) . '#topOfPage';
    $desc = getShortString(!empty($attachments[$k + 1]->post_excerpt) ? $attachments[$k + 1]->post_excerpt : $attachments[$k + 1]->post_title, 30);
    ?>
			<a class="itemNext" href="<?php 
    echo $link;
    ?>
">
				<span class="itInf">
					<span class="titleItem"><?php 
    _e('Next item', 'themerex');
    ?>
</span>
					<?php 
    echo $desc;
    ?>
				</span>
			</a>
Пример #19
0
        ?>
"><?php 
        echo $post_data['post_title'];
        ?>
</a></h4><?php 
    } else {
        ?>
<h4><?php 
        echo $post_data['post_title'];
        ?>
</h4><?php 
    }
    echo $reviewsBlock;
}
if (!in_array($post_data['post_format'], array('quote', 'link', 'chat'))) {
    $post_data['post_excerpt'] = getShortString($post_data['post_excerpt'], isset($opt['descr']) ? $opt['descr'] : get_custom_option('post_excerpt_maxlength_masonry'));
}
echo themerex_substr($post_data['post_excerpt'], 0, 2) != '<p' ? '<p>' . $post_data['post_excerpt'] . '</p>' : $post_data['post_excerpt'];
?>

	<?php 
if (!isset($opt['info']) || $opt['info']) {
    ?>
		<div class="relatedInfo">
			<?php 
    _e('Posted ', 'themerex');
    ?>
			<a href="<?php 
    echo $post_data['post_link'];
    ?>
" class="post_date"><?php 
    } else {
        ?>
<h4><?php 
        echo esc_html($post_data['post_title']);
        ?>
</h4><?php 
    }
}
if ($post_data['post_excerpt']) {
    ?>
				<div class="post_format_wrap post<?php 
    echo esc_attr(themerex_strtoproper($post_data['post_format']));
    ?>
">
					<?php 
    echo in_array($post_data['post_format'], array('quote', 'link', 'chat')) ? balanceTags($post_data['post_excerpt']) : getShortString($post_data['post_excerpt'], isset($opt['descr']) ? $opt['descr'] : get_custom_option('post_excerpt_maxlength' . ($columns > 1 ? '_masonry' : '')));
    ?>
				</div>
			<?php 
}
?>

			<?php 
if (!isset($opt['info']) || $opt['info']) {
    if (get_custom_option('show_post_info') == 'yes' || in_shortcode_blogger(true)) {
        ?>
					<div class="bog_post_info infoPost">
						<span class="datePost"><a href="<?php 
        echo esc_url($post_data['post_link']);
        ?>
" class="post_date" itemprop="datePublished" content="<?php