示例#1
0
function axiom_sc_slider($atts, $content = null)
{
    if (axiom_sc_in_shortcode_blogger()) {
        return '';
    }
    extract(axiom_sc_html_decode(shortcode_atts(array("engine" => axiom_get_custom_option('substitute_slider_engine'), "custom" => "no", "alias" => "", "post_type" => "post", "ids" => "", "cat" => "", "count" => "0", "offset" => "", "orderby" => "date", "order" => 'desc', "controls" => "no", "pagination" => "no", "titles" => "no", "descriptions" => axiom_get_custom_option('slider_info_descriptions'), "links" => "no", "align" => "", "interval" => "", "date_format" => "", "crop" => "yes", "autoheight" => "no", "id" => "", "class" => "", "animation" => "", "css" => "", "width" => "", "height" => "", "top" => "", "bottom" => "", "left" => "", "right" => ""), $atts)));
    if (empty($width) && $pagination != 'full') {
        $width = "100%";
    }
    if (empty($height) && ($pagination == 'full' || $pagination == 'over')) {
        $height = 250;
    }
    if (!empty($height) && axiom_sc_param_is_on($autoheight)) {
        $autoheight = "off";
    }
    if (empty($interval)) {
        $interval = mt_rand(5000, 10000);
    }
    global $AXIOM_GLOBALS;
    $AXIOM_GLOBALS['sc_slider_engine'] = $engine;
    $AXIOM_GLOBALS['sc_slider_width'] = axiom_prepare_css_value($width);
    $AXIOM_GLOBALS['sc_slider_height'] = axiom_prepare_css_value($height);
    $AXIOM_GLOBALS['sc_slider_links'] = axiom_sc_param_is_on($links);
    $AXIOM_GLOBALS['sc_slider_bg_image'] = false;
    $AXIOM_GLOBALS['sc_slider_crop_image'] = $crop;
    if (empty($id)) {
        $id = "sc_slider_" . str_replace('.', '', mt_rand());
    }
    $ms = axiom_get_css_position_from_values($top, $right, $bottom, $left);
    $ws = axiom_get_css_position_from_values('', '', '', '', $width);
    $hs = axiom_get_css_position_from_values('', '', '', '', '', $height);
    $css .= (!in_array($pagination, array('full', 'over')) ? $ms : '') . $hs . $ws;
    if ($engine != 'swiper' && in_array($pagination, array('full', 'over'))) {
        $pagination = 'yes';
    }
    $output = (in_array($pagination, array('full', 'over')) ? '<div class="sc_slider_pagination_area sc_slider_pagination_' . esc_attr($pagination) . ($align != '' && $align != 'none' ? ' align' . esc_attr($align) : '') . '"' . (!axiom_sc_param_is_off($animation) ? ' data-animation="' . esc_attr(axiom_sc_get_animation_classes($animation)) . '"' : '') . ($ms . $hs ? ' style="' . esc_attr($ms . $hs) . '"' : '') . '>' : '') . '<div' . ($id ? ' id="' . esc_attr($id) . '"' : '') . ' class="sc_slider sc_slider_' . esc_attr($engine) . ($engine == 'swiper' ? ' swiper-slider-container' : '') . (!empty($class) ? ' ' . esc_attr($class) : '') . (axiom_sc_param_is_on($autoheight) ? ' sc_slider_height_auto' : '') . ($hs ? ' sc_slider_height_fixed' : '') . (axiom_sc_param_is_on($controls) ? ' sc_slider_controls' : ' sc_slider_nocontrols') . (axiom_sc_param_is_on($pagination) ? ' sc_slider_pagination' : ' sc_slider_nopagination') . (!in_array($pagination, array('full', 'over')) && $align != '' && $align != 'none' ? ' align' . esc_attr($align) : '') . '"' . (!in_array($pagination, array('full', 'over')) && !axiom_sc_param_is_off($animation) ? ' data-animation="' . esc_attr(axiom_sc_get_animation_classes($animation)) . '"' : '') . (!empty($width) && axiom_strpos($width, '%') === false ? ' data-old-width="' . esc_attr($width) . '"' : '') . (!empty($height) && axiom_strpos($height, '%') === false ? ' data-old-height="' . esc_attr($height) . '"' : '') . ((int) $interval > 0 ? ' data-interval="' . esc_attr($interval) . '"' : '') . ($css != '' ? ' style="' . esc_attr($css) . '"' : '') . '>';
    axiom_enqueue_slider($engine);
    if ($engine == 'revo') {
        if (axiom_exists_revslider() && !empty($alias)) {
            $output .= do_shortcode('[rev_slider ' . esc_attr($alias) . ']');
        } else {
            $output = '';
        }
    } else {
        if ($engine == 'swiper') {
            $caption = '';
            $output .= '<div class="slides' . ($engine == 'swiper' ? ' swiper-wrapper' : '') . '"' . ($engine == 'swiper' && $AXIOM_GLOBALS['sc_slider_bg_image'] ? ' style="' . esc_attr($hs) . '"' : '') . '>';
            $content = do_shortcode($content);
            if (axiom_sc_param_is_on($custom) && $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 = axiom_query_add_sort_order($args, $orderby, $order);
                $args = axiom_query_add_filters($args, 'thumbs');
                $args = axiom_query_add_posts_and_cats($args, $ids, $post_type, $cat);
                $query = new WP_Query($args);
                $post_number = 0;
                $pagination_items = '';
                $show_image = 1;
                $show_types = 0;
                $show_date = 1;
                $show_author = 0;
                $show_links = 0;
                $show_counters = 'views';
                //comments | rating
                while ($query->have_posts()) {
                    $query->the_post();
                    $post_number++;
                    $post_id = get_the_ID();
                    $post_type = get_post_type();
                    $post_title = get_the_title();
                    $post_link = get_permalink();
                    $post_link2 = $post_link;
                    $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 (axiom_sc_param_is_on($crop)) {
                        $post_attachment = $AXIOM_GLOBALS['sc_slider_bg_image'] ? axiom_get_resized_image_url($post_attachment, !empty($width) && (double) $width . ' ' == $width . ' ' ? $width : null, !empty($height) && (double) $height . ' ' == $height . ' ' ? $height : null) : axiom_get_resized_image_tag($post_attachment, !empty($width) && (double) $width . ' ' == $width . ' ' ? $width : null, !empty($height) && (double) $height . ' ' == $height . ' ' ? $height : null);
                    } else {
                        if (!$AXIOM_GLOBALS['sc_slider_bg_image']) {
                            $post_attachment = '<img src="' . esc_url($post_attachment) . '" alt="">';
                        }
                    }
                    $post_accent_color = '';
                    $post_category = '';
                    $post_category_link = '';
                    if (in_array($pagination, array('full', 'over'))) {
                        $old_output = $output;
                        $output = '';
                        require axiom_get_file_dir('templates/parts/widgets-posts.php');
                        $pagination_items .= $output;
                        $output = $old_output;
                    }
                    $output .= '<div' . ' class="' . esc_attr($engine) . '-slide"' . ' data-style="' . esc_attr($ws . $hs) . '"' . ' style="' . ($AXIOM_GLOBALS['sc_slider_bg_image'] ? 'background-image:url(' . esc_url($post_attachment) . ');' : '') . $ws . $hs . '"' . '>' . (axiom_sc_param_is_on($links) ? '<a href="' . esc_url($post_link2) . '" title="' . esc_attr($post_title) . '">' : '') . (!$AXIOM_GLOBALS['sc_slider_bg_image'] ? $post_attachment : '');
                    $caption = $engine == 'swiper' ? '' : $caption;
                    if (!axiom_sc_param_is_off($titles)) {
                        $post_hover_bg = axiom_get_custom_option('link_color', null, $post_id);
                        $post_bg = '';
                        if ($post_hover_bg != '' && !axiom_is_inherit_option($post_hover_bg)) {
                            $rgb = axiom_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 .= '<div class="sc_slider_info' . ($titles == 'fixed' ? ' sc_slider_info_fixed' : '') . ($engine == 'swiper' ? ' content-slide' : '') . '"' . ($post_bg != '' ? ' style="' . esc_attr($post_bg) . '"' : '') . '>';
                        $post_descr = axiom_get_post_excerpt();
                        if (axiom_get_custom_option("slider_info_category") == 'yes') {
                            // || empty($cat)) {
                            // Get all post's categories
                            $post_tax = axiom_get_taxonomy_categories_by_post_type($post_type);
                            if (!empty($post_tax)) {
                                $post_terms = axiom_get_terms_by_post_id(array('post_id' => $post_id, 'taxonomy' => $post_tax));
                                if (!empty($post_terms[$post_tax])) {
                                    if (!empty($post_terms[$post_tax]->closest_parent)) {
                                        $post_category = $post_terms[$post_tax]->closest_parent->name;
                                        $post_category_link = $post_terms[$post_tax]->closest_parent->link;
                                        //$post_accent_color = axiom_taxonomy_get_inherited_property($post_tax, $post_terms[$post_tax]->closest_parent->term_id, 'link_color');
                                    }
                                    /*
                                    if ($post_accent_color == '' && !empty($post_terms[$post_tax]->terms)) {
                                    	for ($i = 0; $i < count($post_terms[$post_tax]->terms); $i++) {
                                    		$post_accent_color = axiom_taxonomy_get_inherited_property($post_tax, $post_terms[$post_tax]->terms[$i]->term_id, 'link_color');
                                    		if ($post_accent_color != '') break;
                                    	}
                                    }
                                    */
                                    if ($post_category != '') {
                                        $caption .= '<div class="sc_slider_category"' . (axiom_substr($post_accent_color, 0, 1) == '#' ? ' style="background-color: ' . esc_attr($post_accent_color) . '"' : '') . '><a href="' . esc_url($post_category_link) . '">' . $post_category . '</a></div>';
                                    }
                                }
                            }
                        }
                        $output_reviews = '';
                        if (axiom_get_custom_option('show_reviews') == 'yes' && axiom_get_custom_option('slider_info_reviews') == 'yes') {
                            $avg_author = axiom_reviews_marks_to_display(get_post_meta($post_id, 'reviews_avg' . (axiom_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 post_rating reviews_summary blog_reviews' . (axiom_get_custom_option("slider_info_category") == 'yes' ? ' after_category' : '') . '">' . '<div class="criteria_summary criteria_row">' . trim(axiom_reviews_get_summary_stars($avg_author, false, false, 5)) . '</div>' . '</div>';
                            }
                        }
                        if (axiom_get_custom_option("slider_info_category") == 'yes') {
                            $caption .= $output_reviews;
                        }
                        $caption .= '<h3 class="sc_slider_subtitle"><a href="' . esc_url($post_link2) . '">' . $post_title . '</a></h3>';
                        if (axiom_get_custom_option("slider_info_category") != 'yes') {
                            $caption .= $output_reviews;
                        }
                        if ($descriptions > 0) {
                            $caption .= '<div class="sc_slider_descr">' . trim(axiom_strshort($post_descr, $descriptions)) . '</div>';
                        }
                        $caption .= '</div>';
                    }
                    $output .= ($engine == 'swiper' ? $caption : '') . (axiom_sc_param_is_on($links) ? '</a>' : '') . '</div>';
                }
                wp_reset_postdata();
            }
            $output .= '</div>';
            if ($engine == 'swiper') {
                if (axiom_sc_param_is_on($controls)) {
                    $output .= '<div class="sc_slider_controls_wrap"><a class="sc_slider_prev" href="#"></a><a class="sc_slider_next" href="#"></a></div>';
                }
                if (axiom_sc_param_is_on($pagination)) {
                    $output .= '<div class="sc_slider_pagination_wrap"></div>';
                }
            }
        } else {
            $output = '';
        }
    }
    if (!empty($output)) {
        $output .= '</div>';
        if (!isset($pagination_items)) {
            $pagination_items = '';
        }
        if ($pagination_items) {
            $output .= '
				<div class="sc_slider_pagination widget_area"' . ($hs ? ' style="' . esc_attr($hs) . '"' : '') . '>
					<div id="' . esc_attr($id) . '_scroll" class="sc_scroll sc_scroll_vertical swiper-slider-container scroll-container"' . ($hs ? ' style="' . esc_attr($hs) . '"' : '') . '>
						<div class="sc_scroll_wrapper swiper-wrapper">
							<div class="sc_scroll_slide swiper-slide">
								' . $pagination_items . '
							</div>
						</div>
						<div id="' . esc_attr($id) . '_scroll_bar" class="sc_scroll_bar sc_scroll_bar_vertical"></div>
					</div>
				</div>';
            $output .= '</div>';
        }
    }
    return apply_filters('axiom_shortcode_output', $output, 'trx_slider', $atts, $content);
}
示例#2
0
文件: type.post.php 项目: pcuervo/odc
 function axiom_post_show_custom_field_option($option, $id, $post_type, $post_id)
 {
     if ($id == 'reviews_marks') {
         $cat_list = axiom_get_categories_by_post_id($post_id);
         if (!empty($cat_list['category']->terms)) {
             foreach ($cat_list['category']->terms as $cat) {
                 $term_id = (int) $cat->term_id;
                 $prop = axiom_taxonomy_get_inherited_property('category', $term_id, 'reviews_criterias');
                 if (!empty($prop) && !axiom_is_inherit_option($prop)) {
                     $option['options'] = $prop;
                     break;
                 }
             }
         }
     }
     return $option;
 }
示例#3
0
 function axiom_add_mainmenu_classes($items, $args)
 {
     if (is_admin()) {
         return $items;
     }
     if ($args->menu_id == 'mainmenu' && axiom_get_theme_option('menu_colored') == 'yes') {
         foreach ($items as $k => $item) {
             if ($item->menu_item_parent == 0) {
                 if ($item->type == 'taxonomy' && $item->object == 'category') {
                     $cur_tint = axiom_taxonomy_get_inherited_property('category', $item->object_id, 'bg_tint');
                     if (!empty($cur_tint) && !axiom_is_inherit_option($cur_tint)) {
                         $items[$k]->classes[] = 'bg_tint_' . esc_attr($cur_tint);
                     }
                 }
             }
         }
     }
     return $items;
 }
示例#4
0
 function axiom_options_merge_new_values(&$post_options, &$custom_options, &$post_data, $mode, $override)
 {
     $need_save = false;
     foreach ($post_options as $id => $field) {
         if ($override != 'general' && (!isset($field['override']) || !in_array($override, explode(',', $field['override'])))) {
             continue;
         }
         if (!isset($field['std'])) {
             continue;
         }
         if ($override != 'general' && !isset($post_data[$id . '_inherit'])) {
             continue;
         }
         if ($id == 'reviews_marks' && $mode == 'export') {
             continue;
         }
         $need_save = true;
         if ($mode == 'save' || $mode == 'export') {
             if ($override != 'general' && axiom_is_inherit_option($post_data[$id . '_inherit'])) {
                 $new = '';
             } else {
                 if (isset($post_data[$id])) {
                     // Prepare specific (combined) fields
                     if (!empty($field['subset'])) {
                         $sbs = $post_data[$field['subset']];
                         $field['val'][$sbs] = $post_data[$id];
                         $post_data[$id] = $field['val'];
                     }
                     if ($field['type'] == 'socials') {
                         if (!empty($field['cloneable'])) {
                             foreach ($post_data[$id] as $k => $v) {
                                 $post_data[$id][$k] = array('url' => stripslashes($v), 'icon' => stripslashes($post_data[$id . '_icon'][$k]));
                             }
                         } else {
                             $post_data[$id] = array('url' => stripslashes($post_data[$id]), 'icon' => stripslashes($post_data[$id . '_icon']));
                         }
                     } else {
                         if (is_array($post_data[$id])) {
                             foreach ($post_data[$id] as $k => $v) {
                                 $post_data[$id][$k] = stripslashes($v);
                             }
                         } else {
                             $post_data[$id] = stripslashes($post_data[$id]);
                         }
                     }
                     // Add cloneable index
                     if (!empty($field['cloneable'])) {
                         $rez = array();
                         foreach ($post_data[$id] as $k => $v) {
                             $rez[$post_data[$id . '_numbers'][$k]] = $v;
                         }
                         $post_data[$id] = $rez;
                     }
                     $new = $post_data[$id];
                     // Post type specific data handling
                     if ($id == 'reviews_marks') {
                         $new = join(',', $new);
                         if (($avg = axiom_reviews_get_average_rating($new)) > 0) {
                             $new = axiom_reviews_marks_to_save($new);
                         }
                     }
                 } else {
                     $new = $field['type'] == 'checkbox' ? 'false' : '';
                 }
             }
         } else {
             $new = $field['std'];
         }
         $custom_options[$id] = $new !== '' || $override == 'general' ? $new : 'inherit';
     }
     return $need_save;
 }
示例#5
0
 function axiom_taxonomies_get_inherited_properties($tax, $list)
 {
     $tax_options = array();
     $tax_obj = get_taxonomy($tax);
     if (!empty($list->terms)) {
         foreach ($list->terms as $obj) {
             $new_options = axiom_taxonomy_get_inherited_properties($tax, $obj->term_id);
             foreach ($new_options as $k => $v) {
                 if (!empty($v) && !axiom_is_inherit_option($v) && (!isset($tax_options[$k]) || empty($tax_options[$k]) || axiom_is_inherit_option($tax_options[$k]))) {
                     $tax_options[$k] = $v;
                 }
             }
         }
     }
     return $tax_options;
 }
示例#6
0
 $max_level = max(5, (int) axiom_get_custom_option('reviews_max_level'));
 $allow_user_marks = (!$reviews_first_author || !$reviews_second_hide) && (!isset($_COOKIE['axiom_votes']) || axiom_strpos($_COOKIE['axiom_votes'], ',' . $post_data['post_id'] . ',') === false) && (axiom_get_theme_option('reviews_can_vote') == 'all' || is_user_logged_in());
 $reviews_markup = '<div class="reviews_block' . ($use_tabs ? ' sc_tabs sc_tabs_style_2' : '') . '">';
 $output = $marks = $users = '';
 if ($use_tabs) {
     $author_tab = '<li class="sc_tabs_title"><a href="#author_marks" class="theme_button">' . __('Author', 'axiom') . '</a></li>';
     $users_tab = '<li class="sc_tabs_title"><a href="#users_marks" class="theme_button">' . __('Users', 'axiom') . '</a></li>';
     $output .= '<ul class="sc_tabs_titles">' . ($reviews_first_author ? $author_tab . $users_tab : $users_tab . $author_tab) . '</ul>';
 }
 // Criterias list
 $field = array("options" => axiom_get_theme_option('reviews_criterias'));
 if (!empty($post_data['post_terms'][$post_data['post_taxonomy']]->terms)) {
     foreach ($post_data['post_terms'][$post_data['post_taxonomy']]->terms as $cat) {
         $id = (int) $cat->term_id;
         $prop = axiom_taxonomy_get_inherited_property($post_data['post_taxonomy'], $id, 'reviews_criterias');
         if (!empty($prop) && !axiom_is_inherit_option($prop)) {
             $field['options'] = $prop;
             break;
         }
     }
 }
 // Author marks
 if ($reviews_first_author || !$reviews_second_hide) {
     $field["id"] = "reviews_marks_author";
     $field["descr"] = strip_tags($post_data['post_excerpt']);
     $field["accept"] = false;
     $marks = axiom_reviews_marks_to_display(axiom_reviews_marks_prepare(axiom_get_custom_option('reviews_marks'), count($field['options'])));
     $output .= '<div id="author_marks" class="sc_tabs_content">' . trim(axiom_reviews_get_markup($field, $marks, false, false, $reviews_first_author)) . '</div>';
 }
 // Users marks
 if (!$reviews_first_author || !$reviews_second_hide) {
示例#7
0
文件: core.wp.php 项目: pcuervo/odc
 function axiom_get_nav_menu($slug = '', $custom_walker = false)
 {
     $menu = !empty($slug) ? axiom_get_custom_option($slug) : '';
     $args = array('menu' => empty($menu) || $menu == 'default' || axiom_is_inherit_option($menu) ? '' : $menu, 'container' => '', 'container_class' => '', 'container_id' => '', 'items_wrap' => '<ul id="%1$s" class="%2$s">%3$s</ul>', 'menu_class' => (!empty($slug) ? $slug : 'menu_main') . '_nav', 'menu_id' => !empty($slug) ? $slug : 'menu_main', 'echo' => false, 'fallback_cb' => '', 'before' => '', 'after' => '', 'link_before' => '', 'link_after' => '', 'depth' => 11);
     if (!empty($slug)) {
         $args['theme_location'] = $slug;
     }
     if ($custom_walker && class_exists('axiom_custom_menu_walker') && axiom_get_theme_option('custom_menu') == 'yes') {
         $args['walker'] = new axiom_custom_menu_walker();
     }
     return wp_nav_menu($args);
 }
示例#8
0
    function axiom_reviews_get_markup($field, $value, $editable = false, $clear = false, $snippets = false)
    {
        $max_level = max(5, (int) axiom_get_custom_option('reviews_max_level'));
        $step = $max_level < 100 ? 0.1 : 1;
        $prec = pow(10, axiom_strpos($step, '.') === false ? 0 : axiom_strlen($step) - axiom_strpos($step, '.') - 1);
        $output = '<div class="reviews_editor">';
        $criterias = $field['options'];
        $marks = explode(',', $value);
        if (is_array($criterias) && count($criterias) > 0) {
            $i = 0;
            foreach ($criterias as $num => $sb) {
                if (empty($sb)) {
                    continue;
                }
                if ($clear || !isset($marks[$i]) || $marks[$i] == '' || axiom_is_inherit_option($marks[$i])) {
                    $marks[$i] = 0;
                }
                $marks[$i] = min($max_level, max(0, round($marks[$i] * $prec) / $prec + 0));
                $output .= '<div class="reviews_item reviews_max_level_' . esc_attr($max_level) . '" data-max-level="' . esc_attr($max_level) . '" data-step="' . esc_attr($step) . '">' . '<div class="reviews_criteria">' . $sb . '</div>' . trim(axiom_reviews_get_summary_stars($marks[$i], $editable)) . '</div>';
                $i++;
            }
        }
        $output .= '</div>';
        $output .= isset($field['accept']) && $field['accept'] ? '<div class="reviews_accept">' . do_shortcode('[trx_button]' . __('Accept your votes', 'axiom') . '[/trx_button]') . '</div>' : '';
        $avg = axiom_reviews_get_average_rating($value);
        $avg = min($max_level, max(0, round($avg * $prec) / $prec + 0));
        $output .= '
            <div class="reviews_summary">
				<div class="reviews_item reviews_max_level_' . esc_attr($max_level) . '" data-step="' . esc_attr($step) . '">
					<div class="reviews_criteria">' . (isset($field['descr']) ? $field['descr'] : __('Summary', 'axiom')) . '</div>
					' . trim(axiom_reviews_get_summary_stars($avg, false, $snippets)) . '
				</div>
            </div>
		';
        return $output;
    }