echo getPostShare(get_custom_option('set_post_info', null, $post_data['post_id']), $post_data); //read more $show_all = !isset($postinfo_buttons) || !is_array($postinfo_buttons); $show_button_format = $post_data['post_format'] != 'aside' && $post_data['post_format'] != 'chat' && $post_data['post_format'] != 'link' && $post_data['post_format'] != 'quote'; if (($show_all || in_array('more', $postinfo_buttons)) && !$post_data['post_protected'] && $show_button_format && get_custom_option('show_read_more', null, $post_data['post_id']) == 'yes') { echo balanceTags('<div class="readMore">' . do_shortcode('[trx_button skin="dark" style="bg" size="big" fullsize="no" link="' . $post_data['post_link'] . '" ]' . __('Read more', 'themerex') . '[/trx_button]') . '</div>'); } } else { //read more $show_all = !isset($postinfo_buttons) || !is_array($postinfo_buttons); $show_button_format = $post_data['post_format'] != 'aside' && $post_data['post_format'] != 'chat' && $post_data['post_format'] != 'link' && $post_data['post_format'] != 'quote'; if (($show_all || in_array('more', $postinfo_buttons)) && !$post_data['post_protected'] && $show_button_format && get_custom_option('show_read_more', null, $post_data['post_id']) == 'yes') { echo balanceTags('<div class="readMore">' . do_shortcode('[trx_button skin="dark" style="bg" size="big" fullsize="no" link="' . $post_data['post_link'] . '" ]' . __('Continue reading...', 'themerex') . '[/trx_button]') . '</div>'); } //postshare echo getPostShare(get_custom_option('set_post_info', null, $post_data['post_id']), $post_data); } //main block in full Width echo $fullwidth && $streampage_columns || $layout_isotope ? '</div><!--/.sc_columns-->' : ''; //main block echo $main_div ? '</div><!-- /.main -->' : ''; if (in_shortcode_blogger(true)) { ?> </div><?php } else { //main block in full Width echo $fullwidth && $streampage_columns || $layout_isotope ? '</div>' : ''; ?> </article> <?php }
function sc_video($atts, $content = null) { if (in_shortcode_blogger()) { return ''; } extract(shortcode_atts(array("id" => "", "url" => '', "src" => '', "image" => '', "title" => 'off', "autoplay" => 'off', "width" => '100%', "height" => '295', "top" => "", "bottom" => "", "left" => "", "right" => ""), $atts)); if ($src == '' && $url == '' && isset($atts[0])) { $src = $atts[0]; } if ($image > 0) { $attach = wp_get_attachment_image_src($image, 'full'); if (isset($attach[0]) && $attach[0] != '') { $image = $attach[0]; } } $s = ($top !== '' ? 'margin-top:' . $top . 'px;' : '') . ($bottom !== '' ? 'margin-bottom:' . $bottom . 'px;' : '') . ($left !== '' ? 'margin-left:' . $left . 'px;' : '') . ($right !== '' ? 'margin-right:' . $right . 'px;' : '') . ($width !== '' ? 'width:' . $width . 'px;' : '') . ($height !== '' ? 'height:' . $height . 'px;' : ''); $url = getVideoPlayerURL($src != '' ? $src : $url); $output = ''; $video = '<video' . ($id ? ' id="' . $id . '"' : '') . ' class="sc_video" src="' . $url . '" width="' . $width . '" height="' . $height . '"' . ($image || sc_param_is_on($autoplay) && is_single() ? ' autoplay="autoplay"' : '') . ($s != '' ? ' style="' . $s . '"' : '') . ' controls="controls"><source type="video/mp4" src="' . $url . '"></source></video>'; if ($image) { $video = substituteVideo($video, $width, $height); $output = getVideoFrame($video, $image, sc_param_is_on($title), $s); } else { $output = $video; } return $output; /* return '<iframe' . ($id ? ' id="' . $id . '"' : '') . ' class="sc_video" src="' . $url . '" width="' . $width . '" height="' . $height . '"'.($s!='' ? ' style="'.$s.'"' : '').' frameborder="0" webkitAllowFullScreen="webkitAllowFullScreen" mozallowfullscreen="mozallowfullscreen" allowFullScreen="allowFullScreen"></iframe>'; */ }
function sc_zoom($atts, $content = null) { if (in_shortcode_blogger()) { return ''; } extract(shortcode_atts(array("id" => "", "class" => "", "src" => "", "url" => "", "over" => "", "border" => "none", "align" => "", "width" => "", "height" => "", "top" => "", "bottom" => "", "left" => "", "right" => ""), $atts)); $s = getStyleString('!' . $top, '!' . $right, '!' . $bottom, '!' . $left, $width, $height); $width = getStyleValue($width); $height = getStyleValue($height); if (empty($id)) { $id = 'sc_zoom_' . str_replace('.', '', mt_rand()); } themerex_enqueue_script('elevate-zoom', themerex_get_file_url('/js/jquery.elevateZoom-3.0.4.min.js'), array(), null, true); $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]; } } return empty($src) ? '' : (!sc_param_is_off($border) ? '<div class="sc_border sc_border_' . $border . '">' : '') . '<div' . ($id ? ' id="' . $id . '"' : '') . ' class="sc_zoom' . (!empty($class) ? ' ' . $class : '') . '"' . ($s != '' ? ' style="' . $s . '"' : '') . '>' . '<img src="' . $src . '"' . ($height != '' ? ' style="height:' . $height . ';"' : '') . ' data-zoom-image="' . $over . '" alt="" />' . '</div>' . (!sc_param_is_off($border) ? '</div>' : ''); }
function sc_graph_item($atts, $content = null) { if (in_shortcode_blogger()) { return ''; } extract(shortcode_atts(array("datas" => "10,40,60,30,70", "color" => "#5ea281"), $atts)); if ($content == '') { $content = "Attribute"; } return '<li data-datas="' . $datas . '" data-fill-color="' . $color . '" data-fill-text="' . $content . '"></li>'; }
function sc_sidebar($atts, $content = null) { if (in_shortcode_blogger()) { return ''; } extract(shortcode_atts(array('name' => '', "top" => "", "bottom" => "", "left" => "", "layout" => "", "right" => ""), $atts)); $class = ''; $class .= getStyleMargin($top, $right, $bottom, $left); $s = ($top > 0 ? 'padding-top:' . $top . 'px;' : '') . ($bottom > 0 ? 'padding-bottom:' . $bottom . 'px;' : '') . ($left > 0 ? 'padding-left:' . $left . 'px;' : '') . ($right > 0 ? 'padding-right:' . $right . 'px;' : ''); global $THEMEREX_CURRENT_SIDEBAR; $THEMEREX_CURRENT_SIDEBAR = 'footer'; do_action('before_sidebar'); if (!empty($name)) { ob_start(); dynamic_sidebar($name); $sidebar_content = ob_get_contents(); ob_end_clean(); } return '<div class="widget_area sidebarStyleLight sc_sidebar_selector' . (!empty($class) ? $class : '') . '"' . (!empty($s) ? ' style="' . $s . '"' : '') . '>' . $sidebar_content . '</div>'; }
function getPostData(&$opt, $post_obj = null) { $opt = getPostDataOptions($opt); if (empty($opt['layout'])) { $opt['layout'] = !empty($opt['thumb_size']) ? $opt['thumb_size'] : 'excerpt'; } 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_protected = post_password_required(); $post_format = get_post_format(); if (empty($post_format)) { $post_format = 'standard'; } $post_icon = getPostFormatIcon($post_format); $post_type = get_post_type(); $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 = getDateOrDifference($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_date_part1 = get_the_date('j M'); } $post_comments = $post_views = $post_likes = 0; if ($opt['counters'] != 'none') { $post_comments = get_comments_number(); $post_views = getPostViews($post_id); $post_likes = getPostLikes($post_id); } $post_reviews_author = $post_reviews_users = 0; if ($opt['reviews']) { $post_reviews_author = ''; $post_reviews_users = ''; } $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 = 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 = getThumbSizes(array('thumb_size' => $opt['thumb_size'], 'thumb_crop' => $opt['thumb_crop'], 'sidebar' => $opt['sidebar'])); if ($opt['content']) { if ($opt['substitute_gallery']) { $post_content = substituteGallery($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 = substituteVideo($post_content, $thumb_sizes['w'], $thumb_sizes['h_crop']); } if ($opt['substitute_audio']) { $post_content = substituteAudio($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 = themerex_strpos($post_content_plain, '<span id="more-')) !== false) { $post_excerpt = themerex_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 = substituteGallery($post_excerpt, $post_id, $thumb_sizes['w'], $thumb_sizes['h_crop']); } $post_excerpt = apply_filters('themerex_sc_clear_around', $post_excerpt); $post_excerpt = apply_filters('the_excerpt', $post_excerpt); $post_excerpt = apply_filters('themerex_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 = substituteVideo($post_excerpt, $thumb_sizes['w'], $thumb_sizes['h_crop']); } if ($opt['substitute_audio']) { $post_excerpt = substituteAudio($post_excerpt); } $post_excerpt = trim(chop(str_replace(array('[...]', '[…]'), 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'] = get_dedicated_content(); //$opt['location'] = !empty($opt['location']) ? $opt['location'] : get_custom_option('dedicated_location'); $opt['location'] = !empty($opt['location']) ? $opt['location'] : 'left'; if (empty($opt['location']) || $opt['location'] == 'default') { $opt['location'] = get_custom_option('dedicated_location', '', $post_id); } 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 = getTagAttrib($opt['dedicated'], '<div class="sc_section>', 'class'); if ($opt['location'] == 'default') { if (($pos = themerex_strpos($class, 'sc_align')) !== false) { $pos += 8; $pos2 = themerex_strpos($class, ' ', $pos); $opt['location'] = $pos2 === false ? themerex_substr($class, $pos) : themerex_substr($class, $pos, $pos2 - $pos); } if ($opt['location'] == '' || $opt['location'] == 'default') { $opt['location'] = 'center'; } } if (!is_singular() || in_shortcode_blogger(true) || themerex_strpos($class, 'sc_align') !== false && themerex_strpos($class, 'columns') === false) { $class = str_replace(array('sc_alignright', 'sc_alignleft', 'sc_aligncenter'), array('', '', ''), $class) . ' sc_align' . $opt['location']; if ($opt['location'] == 'center' && themerex_strpos($class, 'columns2_3') === false && $opt['sidebar']) { $class = str_replace('columns', '_columns', $class) . ' columns2_3'; } else { if (($opt['location'] == 'left' || $opt['location'] == 'right') && themerex_strpos($class, 'columns1_2') === false) { // && $opt['sidebar']) $class = str_replace('columns', '_columns', $class) . ' columns1_2'; } } $opt['dedicated'] = setTagAttrib($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'] = themerex_strtoproper($opt['location']); // Substitute <video> tags to <iframe> in dedicated content if ($opt['substitute_video']) { $opt['dedicated'] = substituteVideo($opt['dedicated'], $thumb_sizes['w'], $thumb_sizes['h_crop']); } // Substitute <audio> tags with src from soundcloud to <iframe> if ($opt['substitute_audio']) { $opt['dedicated'] = substituteAudio($opt['dedicated']); } // Extract gallery, video and audio from full post content $post_thumb = $post_attachment = $post_gallery = $post_video = $post_audio = $post_url = $post_url_target = ''; if (themerex_substr($opt['layout'], 0, 6) == 'single') { $post_thumb = getResizedImageTag($post_id, $thumb_sizes['w'], $thumb_sizes['h'], null, false, false, true); } else { $post_thumb = getResizedImageTag($post_id, $thumb_sizes['w'], $post_type == 'product' && get_theme_option('crop_product_thumb') == 'no' ? null : $thumb_sizes['h']); } $post_attachment = wp_get_attachment_url(get_post_thumbnail_id($post_id)); if ($post_format == 'gallery') { $post_gallery = buildGalleryTag(getPostGallery($post_content_plain, $post_id, max(2, get_custom_option('gallery_max_slides'))), $thumb_sizes['w'], $thumb_sizes['h_crop'], false, get_custom_option('substitute_slider_engine') != 'flex' ? '' : $post_link); } else { if ($post_format == 'video') { $post_video = getPostVideo($post_content_original, false); if ($post_video == '') { $src = getVideoPlayerURL(getPostVideo($post_content_original, true), $post_thumb != ''); if ($src) { $post_video = substituteVideo('<video src="' . $src . '">', $thumb_sizes['w'], round($thumb_sizes['w'] / 16 * 9), false); } //$thumb_sizes['h_crop']); } if ($post_video != '' && $opt['substitute_video']) { $src = getVideoPlayerURL(getPostVideo($post_video), $post_thumb != ''); if ($src) { $post_video = substituteVideo('<video src="' . $src . '">', $thumb_sizes['w'], round($thumb_sizes['w'] / 16 * 9), false); } //$thumb_sizes['h_crop']); } } else { if ($post_format == 'audio') { $post_audio = getPostAudio($post_content_original, false); if ($post_audio == '') { $src = getPostAudio($post_content_original, true); if ($src) { $post_audio = substituteAudio('<audio src="' . $src . '"></audio>'); } } if ($post_audio != '' && $opt['substitute_audio'] == 'yes') { $src = getPostAudio($post_audio); $tag_t = getTagAttrib($post_audio, '[trx_audio]', 'title'); $tag_t = $tag_t == '' ? getTagAttrib($post_audio, '[audio]', 'title') : $tag_t; $tag_at = getTagAttrib($post_audio, '[trx_audio]', 'author'); $tag_at = $tag_at == '' ? getTagAttrib($post_audio, '[audio]', 'author') : $tag_at; if ($src) { $post_audio = substituteAudio('<audio title="' . $tag_t . '" author="' . $tag_at . '" src="' . $src . '"></audio>'); } } } } } if ($post_format == 'image' && !$post_thumb) { if (($src = getPostImage($post_content_original)) != '') { $post_thumb = getResizedImageTag($src, $thumb_sizes['w'], $thumb_sizes['h_crop']); } } if ($post_format == 'link') { $post_url_data = getPostLink($post_content_original, false); $post_link = $post_url = $post_url_data['url']; $post_url_target = $post_url_data['target']; } // Get all post's categories $post_categories_list = array(); $post_categories_ids = array(); $post_categories_slugs = array(); $post_categories_links = ''; $post_root_category = ''; if ($opt['categories_list']) { $post_categories_list = getCategoriesByPostId($post_id); $ex_cats = explode(',', get_theme_option('exclude_cats')); for ($i = 0; $i < count($post_categories_list); $i++) { if (in_array($post_categories_list[$i]['term_id'], $ex_cats)) { continue; } if ($post_root_category == '') { if (get_theme_option('close_category') == 'parental') { $parent_cat = getParentCategory($post_categories_list[$i]['term_id'], $opt['parent_cat_id']); if ($parent_cat) { $post_root_category = $parent_cat['name']; } } else { $post_root_category = $post_categories_list[$i]['name']; } } $post_categories_ids[] = $post_categories_list[$i]['term_id']; $post_categories_slugs[] = $post_categories_list[$i]['slug']; $post_categories_links .= '<a class="cat_link" href="' . $post_categories_list[$i]['link'] . '">' . $post_categories_list[$i]['name'] . ($i < count($post_categories_list) - 1 ? ',' : '') . '</a> '; } if ($post_root_category == '' && count($post_categories_list) > 0) { $post_root_category = $post_categories_list[0]['name']; } } // Get all post's tags $post_tags_list = array(); $post_tags_ids = array(); $post_tags_slugs = array(); $post_tags_links = ''; if ($opt['tags_list']) { if (($post_tags_list = get_the_tags()) != 0) { $tag_number = 0; foreach ($post_tags_list as $tag) { $tag_number++; $post_tags_links .= '<a class="tag_link" href="' . get_tag_link($tag->term_id) . '">' . $tag->name . ($tag_number == count($post_tags_list) ? '' : ',') . '</a> '; $post_tags_ids[] = $tag->term_id; $post_tags_slugs[] = $tag->slug; } } else { if (!is_array($post_tags_list)) { $post_tags_list = array(); } } } if ($old_post != null) { $post = $old_post; setup_postdata($post); } $post_data = compact('post_id', 'post_protected', 'post_type', '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_attachment', 'post_gallery', 'post_video', 'post_audio', 'post_url', 'post_url_target', 'post_categories_list', 'post_categories_slugs', 'post_categories_ids', 'post_categories_links', 'post_root_category', 'post_tags_list', 'post_tags_ids', 'post_tags_slugs', 'post_tags_links', 'post_edit_enable', 'post_delete_enable'); return apply_filters('themerex_get_post_data', $post_data, $opt, $post_obj); }
echo esc_url($post_data['post_link']); ?> "><?php echo esc_html($post_data['post_title']); ?> </a></h4><?php } else { ?> <h4><?php echo esc_html($post_data['post_title']); ?> </h4><?php } } if (!isset($opt['info']) || $opt['info']) { if (!empty($post_data['post_tags_links']) && get_custom_option('show_post_info') == 'yes' || in_shortcode_blogger(true) && !empty($post_data['post_tags_links']) && $opt['info'] == 'yes') { ?> <span class="infoTags"><?php echo balanceTags($post_data['post_tags_links']); ?> </span> <?php } ?> <?php } ?> </div> <?php } ?>
?> <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 echo esc_attr(get_the_date('Y-m-d')); ?> "><?php echo esc_html($post_data['post_date']); ?> </a></span> <?php if (!in_array($post_data['post_format'], array('status', 'link'))) { ?>