Example #1
0
 /**
  *
  */
 public static function ratings($atts = null, $content = null, $code = null)
 {
     if ($atts == 'generator') {
         $numbers = range(1, 10);
         $scores = array('0.5' => '0.5', '1' => '1', '1.5' => '1.5', '2' => '2', '2.5' => '2.5', '3' => '3', '3.5' => '3.5', '4' => '4', '4.5' => '4.5', '5' => '5');
         $option = array('name' => __('Stars', MISS_ADMIN_TEXTDOMAIN), 'value' => 'ratings', 'options' => array(array('name' => __('Number of Bars', MISS_ADMIN_TEXTDOMAIN), 'desc' => __('Select the number of slides you wish to display. Slides are the selectable areas which change the content.', MISS_ADMIN_TEXTDOMAIN), 'id' => 'multiply', 'default' => '', 'options' => $numbers, 'type' => 'select', 'shortcode_multiplier' => true), array('name' => __('Show Total', MISS_ADMIN_TEXTDOMAIN), 'desc' => __('Check this option to display total score.', MISS_ADMIN_TEXTDOMAIN), 'id' => 'show_overall', 'default' => '', 'type' => 'checkbox', 'options' => array('true' => __('Enable Total Score', MISS_ADMIN_TEXTDOMAIN)), 'shortcode_dont_multiply' => true, 'shortcode_optional_wrap' => false), array('name' => __('Icon', MISS_ADMIN_TEXTDOMAIN), 'desc' => __('Please select score icon type.', MISS_ADMIN_TEXTDOMAIN), 'id' => 'icon', 'default' => 'im-icon-accessibility', 'type' => 'icons', 'target' => 'all_icons', 'shortcode_dont_multiply' => true, 'shortcode_optional_wrap' => false), array('name' => __('Active Colour', MISS_ADMIN_TEXTDOMAIN), 'desc' => __('Please select active icon colour.', MISS_ADMIN_TEXTDOMAIN), 'id' => 'style_color', 'default' => '', 'type' => 'color', 'shortcode_dont_multiply' => true, 'shortcode_optional_wrap' => false), array('name' => __('Inactive Colour', MISS_ADMIN_TEXTDOMAIN), 'desc' => __('Please select inactive icon colour.', MISS_ADMIN_TEXTDOMAIN), 'id' => 'style_color2', 'default' => '', 'type' => 'color', 'shortcode_dont_multiply' => true, 'shortcode_optional_wrap' => false), array('name' => __('Icon size', MISS_ADMIN_TEXTDOMAIN), 'desc' => __('Change icon size.', MISS_ADMIN_TEXTDOMAIN), 'id' => 'size', 'default' => '18', 'type' => 'numeral', 'shortcode_dont_multiply' => true, 'shortcode_optional_wrap' => false), array('name' => __('Animation', MISS_ADMIN_TEXTDOMAIN), 'desc' => __('Turn on CSS3 transitions. You may specify animation effect.', MISS_ADMIN_TEXTDOMAIN), 'id' => 'animation', 'default' => 'im-icon-android', 'type' => 'select', 'target' => 'css_animation', 'shortcode_dont_multiply' => true, 'shortcode_optional_wrap' => false), array('name' => __('Criteria 1 Title', MISS_ADMIN_TEXTDOMAIN), 'desc' => __('Enter criteria title.', MISS_ADMIN_TEXTDOMAIN), 'id' => 'content', 'default' => '', 'type' => 'text', 'shortcode_multiply' => true), array('name' => __('Criteria 1 Value', MISS_ADMIN_TEXTDOMAIN), 'desc' => __('Define score value from 0.5 to 5.', MISS_ADMIN_TEXTDOMAIN), 'id' => 'score', 'default' => '', 'type' => 'select', 'options' => $scores, 'shortcode_multiply' => true), array('value' => 'score', 'nested' => true), 'shortcode_has_atts' => true));
         return $option;
     }
     if (!preg_match_all("/(.?)\\[(score)\\b(.*?)(?:(\\/))?\\](?:(.+?)\\[\\/score\\])?(.?)/s", $content, $matches)) {
         return miss_content_group($content);
     } else {
         for ($i = 0; $i < count($matches[0]); $i++) {
             $matches[3][$i] = shortcode_parse_atts($matches[3][$i]);
         }
         extract(shortcode_atts(array('size' => '18', 'animation' => '', 'icon' => 'im-icon-star'), $atts));
         $out = '';
         $out .= !empty($atts['caption']) ? '<h4><span>' . $atts['caption'] . '</span></h4>' : '';
         $atts['animation'] = !empty($atts['animation']) ? ' im-transform im-animate-element ' . $atts['animation'] : '';
         $atts['size'] = !empty($atts['size']) ? $atts['size'] : '18';
         $atts['style_color'] = !empty($atts['style_color']) ? $atts['style_color'] : '';
         $atts['style_color2'] = !empty($atts['style_color2']) ? $atts['style_color2'] : '';
         $out .= '<ul class="rates">';
         $overall = 0;
         $counter = 0;
         for ($i = 0; $i < count($matches[0]); $i++) {
             $counter++;
             $rating = $matches[3][$i]['score'];
             if (!isset($atts['icon'])) {
                 $atts['icon'] = 'im-icon-star-6';
             }
             $out .= '<li class="rating_row' . $atts['animation'] . '">';
             $out .= $matches[5][$i];
             $out .= '<div class="rating_right">';
             $out .= score_output($rating, $atts['size'], $atts['style_color'], $atts['style_color2'], $atts['icon']);
             $out .= '</div>';
             $out .= '</li>';
             $overall += $rating;
         }
         $out .= '</ul>';
         if (isset($atts['show_overall']) && $atts['show_overall'] == "true") {
             if ($counter > 1) {
                 $out .= '<div class="overall_rating' . $atts['animation'] . '">';
                 $overall = $overall / $counter;
                 $overget = $overall - floor($overall);
                 if ($overget >= 0.5) {
                     $overall = floor($overall) + 0.5;
                 } else {
                     $overall = floor($overall);
                 }
                 $out .= "<h4><span class='uppercase transform-uppercase'>" . __("Total", MISS_TEXTDOMAIN) . "</span></h4><div class='total-inner'><span class='score total'>" . $overall . "</span><span class='right'>" . score_output($overall, '40', $atts['style_color'], $atts['style_color2'], $atts['icon']) . "</span></div>";
                 $out .= '</div>';
             }
         }
         return '<div class="rating_box shortcode">' . $out . '</div>';
     }
 }
Example #2
0
 /**
  * Rating System
  * @since 1.3
  */
 function the_score($post)
 {
     $out = '';
     $fields = '';
     $overall = 0;
     $counter = 0;
     $criteria = miss_get_setting('criteria');
     $star_image = miss_get_setting('star_image') ? miss_get_setting('star_image') : 'star';
     $star_color = miss_get_setting('star_color');
     if (isset($criteria['keys']) && $criteria['keys'] != '#') {
         $criteria_keys = explode(',', $criteria['keys']);
         foreach ($criteria_keys as $ckey) {
             if ($ckey != '#') {
                 // $counter++;
                 $criteria_name = !empty($criteria[$ckey]['link']) ? $criteria[$ckey]['link'] : '#';
                 $rating_get = get_post_meta($post, '_review_' . $ckey);
                 if (isset($rating_get[0])) {
                     $rating = $rating_get[0];
                 } else {
                     $rating = 0;
                 }
                 $overall += $rating;
                 // if rating is 0 don't display that field
                 if ($rating != 0) {
                     $counter++;
                     $fields .= '<li class="rating_row">';
                     $fields .= '<em>' . $criteria_name . ':</em><div class="rating_right">' . score_output($rating) . '</div>';
                     $fields .= '</li>';
                 }
             }
         }
     }
     if ($fields != '') {
         $out .= '<div class="rating_box">';
         $out .= '<h4><span>' . __('Review', MISS_TEXTDOMAIN) . '</span></h4>';
         $out .= '<ul class="rates">';
         $out .= $fields;
         $out .= '</ul><!-- rates -->';
         if ($counter > 1) {
             $out .= '<div class="overall_rating">';
             //smart overall calculations
             $overall = $overall / $counter;
             $overget = $overall - floor($overall);
             if ($overget >= 0.5) {
                 $overall = floor($overall) + 0.5;
             } else {
                 $overall = floor($overall);
             }
             $out .= '<h4><span>' . __("Total", MISS_TEXTDOMAIN) . ':</span></h4><span class="score total">' . $overall . '</span> ' . score_output($overall, 40);
             $out .= '<div class="clearboth"></div>';
             $out .= '</div><!-- overall -->';
         }
         $out .= '</div><!-- rating box -->';
     }
     return $out;
 }
Example #3
0
 /**
  *
  */
 function widget($args, $instance)
 {
     global $wpdb, $shortname, $irish_framework_params;
     $prefix = MISS_PREFIX;
     extract($args);
     $title = apply_filters('widget_title', empty($instance['title']) ? __('Recent News', MISS_TEXTDOMAIN) : $instance['title'], $instance, $this->id_base);
     $tagline = apply_filters('widget_tagline', empty($instance['tagline']) ? '' : '<h6>' . $instance['tagline'] . '</h6>', $instance, $this->id_base);
     if (!($number = (int) $instance['number'])) {
         $number = 3;
     } else {
         if ($number < 1) {
             $number = 1;
         } else {
             if ($number > 15) {
                 $number = 15;
             }
         }
     }
     $out = $before_widget;
     $out .= $before_title . $title . $after_title . $tagline;
     $disable_thumb = $instance['disable_thumb'] ? '1' : '0';
     $show_rating = isset($instance['show_rating']) ? '1' : '0';
     $recent_query = new WP_Query(array('showposts' => $number, 'nopaging' => 0, 'post_type' => 'vacancy', 'post_status' => 'publish', 'category__not_in' => array(miss_exclude_category_string($minus = false)), 'ignore_sticky_posts' => 1));
     if ($recent_query->have_posts()) {
         $out .= '<ul class="post_list small_post_list">';
         while ($recent_query->have_posts()) {
             $recent_query->the_post();
             $out .= '<li class="post_list_module">';
             $out .= '<div class="month pull-left">';
             $out .= '<span class="day">';
             $out .= get_the_date('d');
             $out .= '</span>';
             $out .= get_the_date('M');
             $out .= '</div>';
             $out .= '<p class="post_title">';
             $out .= '<a rel="bookmark" href="' . esc_url(get_permalink()) . '" title="' . esc_attr(get_the_title()) . '">' . get_the_title() . '</a>';
             $out .= '</p>';
             $out .= '<div class="post_excerpt">';
             $out .= miss_excerpt(get_the_excerpt(), apply_filters('miss_home_spotlight_excerpt', 55), apply_filters('miss_excerpt', THEME_ELLIPSIS));
             $out .= '</div>';
             if ($show_rating && score_value(get_the_ID()) != 0) {
                 $postid = get_the_ID();
                 $score = score_value($postid);
                 $out .= '<div class="rating_box">' . score_output($score, 'small') . '</div>';
             }
             $out .= '</li>';
         }
         $out .= '</ul>';
     }
     $out .= $after_widget;
     wp_reset_postdata();
     echo $out;
 }
Example #4
0
 /**
  *
  */
 function widget($args, $instance)
 {
     global $wpdb, $shortname, $irish_framework_params;
     $prefix = MISS_PREFIX;
     extract($args);
     $title = apply_filters('widget_title', empty($instance['title']) ? __('Top Rated', MISS_TEXTDOMAIN) : $instance['title'], $instance, $this->id_base);
     if (!($number = (int) $instance['number'])) {
         $number = 3;
     } else {
         if ($number < 1) {
             $number = 1;
         } else {
             if ($number > 15) {
                 $number = 15;
             }
         }
     }
     $out = $before_widget;
     $out .= $before_title . $title . $after_title;
     $disable_thumb = $instance['disable_thumb'] ? '1' : '0';
     $show_rating = $instance['show_rating'] ? '1' : '0';
     $top_query = new WP_Query(array('showposts' => $number, 'nopaging' => 0, 'meta_key' => '_review_0', 'orderby' => 'meta_value', 'order' => 'DESC', 'post_status' => 'publish', 'category__not_in' => array(miss_exclude_category_string($minus = false)), 'ignore_sticky_posts' => 1));
     if ($top_query->have_posts()) {
         $out .= '<ul class="post_list small_post_list">';
         while ($top_query->have_posts()) {
             $top_query->the_post();
             $out .= '<li class="post_list_module">';
             if (!$disable_thumb) {
                 $widget_thumb_img = $irish_framework_params->layout['big_sidebar_images']['small_post_list'];
                 $out .= miss_get_post_image(array('width' => $widget_thumb_img[0], 'height' => $widget_thumb_img[1], 'img_class' => 'post_list_image', 'preload' => false, 'placeholder' => true, 'echo' => false, 'wp_resize' => miss_get_setting('image_resize_type') == 'wordpress' ? true : false));
             }
             $out .= '<div class="post_list_content">';
             $out .= '<p class="post_title">';
             $out .= '<a rel="bookmark" href="' . esc_url(get_permalink()) . '" title="' . esc_attr(get_the_title()) . '">' . get_the_title() . '</a>';
             $out .= '</p>';
             $get_year = get_the_time('Y', get_the_ID());
             $get_month = get_the_time('m', get_the_ID());
             if ($show_rating && score_value(get_the_ID()) != 0) {
                 $postid = get_the_ID();
                 $score = score_value($postid);
                 $out .= '<div class="rating_box">' . score_output($score, 'small') . '</div>';
             }
             $out .= '</div>';
             $out .= '</li>';
         }
         $out .= '</ul>';
     }
     $out .= $after_widget;
     wp_reset_postdata();
     echo $out;
 }
Example #5
0
 /**
  *
  */
 function widget($args, $instance)
 {
     global $irish_framework_params;
     $prefix = MISS_PREFIX;
     extract($args);
     $title = apply_filters('widget_title', empty($instance['title']) ? __('Popular Posts', MISS_TEXTDOMAIN) : $instance['title'], $instance, $this->id_base);
     if (!($number = (int) $instance['number'])) {
         $number = 3;
     } else {
         if ($number < 1) {
             $number = 1;
         } else {
             if ($number > 15) {
                 $number = 15;
             }
         }
     }
     echo $before_widget;
     echo $before_title . $title . $after_title;
     $count = !empty($count) ? trim($count) : '3';
     $disable_thumb = $instance['disable_thumb'] ? '1' : '0';
     $show_rating = !empty($instance['show_rating']) ? '1' : '0';
     $show_date = !empty($instance['show_date']) ? '1' : '0';
     $popular_query = new WP_Query(array('showposts' => $number, 'nopaging' => 0, 'orderby' => 'comment_count', 'post_status' => 'publish', 'category__not_in' => array(miss_exclude_category_string($minus = false)), 'ignore_sticky_posts' => 1));
     $out = '<ul class="post_list small_post_list">';
     while ($popular_query->have_posts()) {
         $popular_query->the_post();
         $out .= '<li class="post_list_module">';
         if (!$disable_thumb) {
             $widget_thumb_img = $irish_framework_params->layout['small_sidebar_images']['small_post_list'];
             $out .= miss_get_post_image(array('width' => $widget_thumb_img[0], 'height' => $widget_thumb_img[1], 'img_class' => 'image', 'preload' => false, 'placeholder' => true, 'echo' => false, 'wp_resize' => miss_get_setting('image_resize_type') == 'wordpress' ? true : false));
         }
         $out .= '<div class="post_list_content">';
         if ($show_rating && score_value(get_the_ID()) != 0) {
             $postid = get_the_ID();
             $score = score_value($postid);
             $out .= '<div class="rating_box">' . score_output($score, 'small') . '</div>';
         }
         $out .= '<p class="post_title">';
         $out .= '<a rel="bookmark" href="' . esc_url(get_permalink()) . '" title="' . esc_attr(get_the_title()) . '">' . get_the_title() . '</a>';
         $out .= '</p>';
         $out .= '<div class="post_excerpt">';
         $out .= miss_excerpt(get_the_excerpt(), apply_filters('miss_home_spotlight_excerpt', 55), apply_filters('miss_excerpt', THEME_ELLIPSIS));
         $out .= '</div>';
         $out .= '<div class="clearboth"></div>';
         /*
         			$get_year = get_the_time( 'Y', get_the_ID() );
         			$get_month = get_the_time( 'm', get_the_ID() );
         */
         if ($show_date) {
             $out .= '<p class="post_meta">';
             $out .= apply_filters('miss_widget_meta', do_shortcode('[post_date]'));
             $out .= '</p>';
         }
         $out .= '</div>';
         $out .= '</li>';
     }
     $out .= '</ul>';
     echo $out;
     echo $after_widget;
     wp_reset_postdata();
 }