function form($instance)
 {
     global $gdsr;
     $instance = wp_parse_args((array) $instance, $gdsr->default_widget);
     $custom_post_types = gdsr_get_public_post_types();
     $select_post_types = gdsr_widget_convert_select($instance);
     $wptr = $gdsr->g->trend;
     $wpst = $gdsr->g->stars;
     $wptt = $gdsr->g->thumbs;
     $wpvr = $gdsr->wp_version;
     $wpml = GDSRDBMulti::get_multis_tinymce();
     echo '<div class="gdsr-widget-controls">';
     include STARRATING_PATH . 'widgets/rating_28/part_basic.php';
     include STARRATING_PATH . 'widgets/rating_28/part_trend.php';
     include STARRATING_PATH . 'widgets/rating_28/part_filter.php';
     include STARRATING_PATH . 'widgets/rating_28/part_image.php';
     include STARRATING_PATH . 'widgets/rating_28/part_stars.php';
     echo '</div>';
 }
예제 #2
0
 function render_wsr($widget, $section = 'WSR')
 {
     global $gdsr;
     $widget['select'] = gdsr_widget_convert_select($widget);
     $widget = apply_filters('gdsr_widget_parameters_wsr', $widget);
     $template = GDSRRenderT2::get_template($widget['template_id'], $section);
     $tpl_render = html_entity_decode($template->elm['header']);
     $tpl_render = apply_filters('gdsr_t2render_' . strtolower($section) . '_header', $tpl_render, $template, $widget, 'header');
     $rt = html_entity_decode($template->elm['item']);
     $all_rows = GDSRRenderT2::prepare_wsr($widget, $rt);
     $is_thumb = $widget['source'] == 'thumbs';
     $total_rows = count($all_rows);
     if ($total_rows > 0) {
         $rank_id = 1;
         foreach ($all_rows as $row) {
             $rt = html_entity_decode($template->elm['item']);
             $rt = apply_filters('gdsr_t2render_' . strtolower($section) . '_item', $rt, $template, $widget, $row, 'item');
             $title = $row->title;
             if (strlen($title) == 0) {
                 $title = __('(no title)', 'gd-star-rating');
             }
             if ($widget['source'] == 'thumbs' && $row->rating > 0) {
                 $row->rating = '+' . $row->rating;
             }
             $auto_css = ' t2-row-' . $rank_id;
             $row_id = isset($row->post_id) ? $row->post_id : (isset($row->term_id) ? $row->term_id : $row->id);
             if ($rank_id == 1) {
                 $auto_css .= ' t2-first';
             }
             if ($rank_id == $total_rows) {
                 $auto_css .= ' t2-last';
             }
             $rt = str_replace('%AUTO_ROW_CLASS%', trim($auto_css), $rt);
             $rt = str_replace('%THUMB%', $row->rating_thumb, $rt);
             $rt = str_replace('%RATING%', $row->rating, $rt);
             $rt = str_replace('%MAX_RATING%', $gdsr->o['stars'], $rt);
             $rt = str_replace('%EXCERPT%', $row->excerpt, $rt);
             $rt = str_replace('%CONTENT%', $row->content, $rt);
             $rt = str_replace('%VOTES%', $row->voters, $rt);
             $rt = str_replace('%REVIEW%', $row->review, $rt);
             $rt = str_replace('%MAX_REVIEW%', $gdsr->o['review_stars'], $rt);
             $rt = str_replace('%TITLE%', __($title), $rt);
             $rt = str_replace('%SLUG%', $row->slug, $rt);
             $rt = str_replace('%TAXONOMY%', $widget['taxonomy'], $rt);
             $rt = str_replace('%PERMALINK%', $row->permalink, $rt);
             $rt = str_replace('%RANK_ID%', $rank_id, $rt);
             $rt = str_replace('%ID%', $row_id, $rt);
             $rt = str_replace('%COUNT%', $row->counter, $rt);
             $rt = str_replace('%VOTES_UP%', $row->votes_plus, $rt);
             $rt = str_replace('%VOTES_DOWN%', $row->votes_minus, $rt);
             $rt = str_replace('%BAYES_RATING%', $row->bayesian, $rt);
             $rt = str_replace('%BAYES_STARS%', $row->bayesian_stars, $rt);
             $rt = str_replace('%STARS%', $row->rating_stars, $rt);
             $rt = str_replace('%REVIEW_STARS%', $row->review_stars, $rt);
             $rt = str_replace('%RATE_TREND%', $row->item_trend_rating, $rt);
             $rt = str_replace('%VOTE_TREND%', $row->item_trend_voting, $rt);
             $rt = str_replace('%IMAGE%', $row->image, $rt);
             $rt = str_replace('%AUTHOR_NAME%', $row->author_name, $rt);
             $rt = str_replace('%AUTHOR_LINK%', $row->author_url, $rt);
             $rank_id++;
             $word_votes = $template->dep['EWV'];
             $tense = $row->voters == 1 ? $word_votes->elm['singular'] : $word_votes->elm['plural'];
             $rt = str_replace('%WORD_VOTES%', __($tense), $rt);
             $table_row = $template->dep['ETR'];
             $row_css = $row->table_row_class == 'odd' ? $table_row->elm['odd'] : $table_row->elm['even'];
             $rt = str_replace('%TABLE_ROW_CLASS%', $row_css, $rt);
             $tpl_render .= $rt;
         }
     } else {
         $tpl_render .= apply_filters('gdsr_no_results', __("No results.", "gd-star-rating"));
     }
     $rt = html_entity_decode($template->elm["footer"]);
     $rt = apply_filters('gdsr_t2render_' . strtolower($section) . '_footer', $rt, $template, $widget, "footer");
     $tpl_render .= $rt;
     return $tpl_render;
 }