/** * (non-PHPdoc) * @see WP_Widget::widget() */ function widget($args, $instance) { extract($args); $title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base); $limit = empty($instance['limit']) ? 10 : intval($instance['limit']); $taxonomy = empty($instance['taxonomy']) ? '' : $instance['taxonomy']; $term_id = 0; if (!empty($instance['term_id']) && is_numeric($instance['term_id'])) { $term_id = intval($instance['term_id']); } $show_filter = empty($instance['show_filter']) ? false : $instance['show_filter']; $show_featured_img = empty($instance['show_featured_img']) ? false : $instance['show_featured_img']; $image_size = empty($instance['image_size']) ? 'thumbnail' : $instance['image_size']; $header = empty($instance['header']) ? 'h3' : $instance['header']; $sort_by = empty($instance['sort_by']) ? 'highest_rated' : $instance['sort_by']; $filter_label_text = $instance['filter_label_text']; $show_rank = empty($instance['show_rank']) ? false : $instance['show_rank']; $result_type = empty($instance['result_type']) ? 'star_rating' : $instance['result_type']; $before_title = '<' . $header . ' class="widget-title">'; $after_title = '</' . $header . '>'; $title = apply_filters('widget_title', $title); $custom_text_settings = (array) get_option(Multi_Rating::CUSTOM_TEXT_SETTINGS); echo $before_widget; Multi_Rating_API::display_rating_results_list(array('limit' => $limit, 'title' => $title, 'show_filter' => $show_filter, 'taxonomy' => $taxonomy, 'term_id' => $term_id, 'class' => 'mr-widget', 'before_title' => $before_title, 'after_title' => $after_title, 'show_featured_img' => $show_featured_img, 'image_size' => $image_size, 'sort_by' => $sort_by, 'show_rank' => $show_rank, 'filter_label_text' => $filter_label_text, 'result_type' => $result_type)); echo $after_widget; }
/** @deprecated */ public static function display_top_rating_results($params = array()) { return Multi_Rating_API::display_rating_results_list($params); }
/** * Shortcode function for displaying rating results list * * @param $atts * @return string */ function mr_rating_results_list($atts = array(), $content = null, $tag) { $can_do_shortcode = !(is_admin() && (!defined('DOING_AJAX') || !DOING_AJAX)); if (!apply_filters('mr_can_do_shortcode', $can_do_shortcode, 'mr_rating_results_list', $atts)) { return; } $general_settings = (array) get_option(Multi_Rating::GENERAL_SETTINGS); $custom_text_settings = (array) get_option(Multi_Rating::CUSTOM_TEXT_SETTINGS); extract(shortcode_atts(array('title' => $custom_text_settings[Multi_Rating::RATING_RESULTS_LIST_TITLE_TEXT_OPTION], 'before_title' => '<h4>', 'after_title' => '</h4>', 'no_rating_results_text' => $custom_text_settings[Multi_Rating::NO_RATING_RESULTS_TEXT_OPTION], 'show_count' => true, 'show_category_filter' => true, 'limit' => 10, 'result_type' => Multi_Rating::STAR_RATING_RESULT_TYPE, 'show_rank' => true, 'show_title' => true, 'class' => '', 'category_id' => 0, 'taxonomy' => null, 'term_id' => 0, 'filter_button_text' => $custom_text_settings[Multi_Rating::FILTER_BUTTON_TEXT_OPTION], 'category_label_text' => $custom_text_settings[Multi_Rating::FILTER_LABEL_TEXT_OPTION], 'show_featured_img' => true, 'image_size' => 'thumbnail', 'show_filter' => false, 'filter_label_text' => $custom_text_settings[Multi_Rating::FILTER_LABEL_TEXT_OPTION], 'sort_by' => 'highest_rated'), $atts)); // temp if (is_string($show_category_filter)) { $show_category_filter = $show_category_filter == 'true' ? true : false; $show_filter = $show_filter; } if (is_string($show_filter)) { $show_filter = $show_filter == 'true' ? true : false; } if (is_string($show_count)) { $show_count = $show_count == 'true' ? true : false; } if (is_string($show_title)) { $show_title = $show_title == 'true' ? true : false; } if (is_string($show_featured_img)) { $show_featured_img = $show_featured_img == 'true' ? true : false; } if ($category_id != 0) { $term_id = $category_id; $taxonomy = 'category'; } return Multi_Rating_API::display_rating_results_list(array('no_rating_results_text' => $no_rating_results_text, 'show_count' => $show_count, 'echo' => false, 'title' => $title, 'show_filter' => $show_filter, 'limit' => $limit, 'result_type' => $result_type, 'show_rank' => $show_rank, 'show_title' => $show_title, 'class' => $class . ' mr-shortcode', 'before_title' => $before_title, 'after_title' => $after_title, 'taxonomy' => $taxonomy, 'term_id' => $term_id, 'filter_button_text' => $filter_button_text, 'filter_label_text' => $filter_label_text, 'show_featured_img' => $show_featured_img, 'image_size' => $image_size, 'sort_by' => $sort_by)); }