Exemplo n.º 1
0
 function render_wcr($widget)
 {
     global $gdsr;
     $widget = apply_filters('gdsr_widget_parameters_wcr', $widget);
     $template = GDSRRenderT2::get_template($widget["template_id"], "WCR");
     $tpl_render = html_entity_decode($template->elm["header"]);
     $tpl_render = apply_filters('gdsr_t2render_wcr_header', $tpl_render, $template, $widget, "header");
     $rt = html_entity_decode($template->elm["item"]);
     $all_rows = GDSRRenderT2::prepare_wcr($widget, $rt);
     $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_wcr_item', $rt, $template, $widget, $row, "item");
             if (isset($widget["source"]) && $widget["source"] == "thumbs" && $row->rating > 0) {
                 $row->rating = "+" . $row->rating;
             }
             $auto_css = " t2-row-" . $rank_id;
             if ($rank_id == 1) {
                 $auto_css .= " t2-first";
             }
             if ($rank_id == $total_rows) {
                 $auto_css .= " t2-last";
             }
             $rt = str_replace('%AUTO_ROW_CLASS%', $auto_css, $rt);
             $rt = str_replace('%CMM_RATING%', $row->rating, $rt);
             $rt = str_replace('%MAX_RATING%', $gdsr->o["cmm_stars"], $rt);
             $rt = str_replace('%CMM_VOTES%', $row->voters, $rt);
             $rt = str_replace('%COMMENT%', $row->comment_content, $rt);
             $rt = str_replace('%PERMALINK%', $row->permalink, $rt);
             $rt = str_replace('%AUTHOR_NAME%', $row->comment_author, $rt);
             $rt = str_replace('%AUTHOR_AVATAR%', $row->comment_author_email, $rt);
             $rt = str_replace('%AUTHOR_LINK%', $row->comment_author_url, $rt);
             $rt = str_replace('%ID%', $row->comment_id, $rt);
             $rt = str_replace('%RANK_ID%', $rank_id, $rt);
             $rt = str_replace('%POST_ID%', $gdsr->widget_post_id, $rt);
             $rt = str_replace('%CMM_STARS%', $row->rating_stars, $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;
         }
     }
     $rt = html_entity_decode($template->elm["footer"]);
     $rt = apply_filters('gdsr_t2render_wcr_footer', $rt, $template, $widget, "footer");
     $tpl_render .= $rt;
     return $tpl_render;
 }
Exemplo n.º 2
0
 function render_wcr($widget)
 {
     global $gdsr;
     $template = GDSRRenderT2::get_template($widget["template_id"], "WCR");
     $tpl_render = html_entity_decode($template->elm["header"]);
     $rt = html_entity_decode($template->elm["item"]);
     $all_rows = GDSRRenderT2::prepare_wcr($widget, $rt);
     if (count($all_rows) > 0) {
         foreach ($all_rows as $row) {
             $rt = html_entity_decode($template->elm["item"]);
             $rt = str_replace('%CMM_RATING%', $row->rating, $rt);
             $rt = str_replace('%MAX_RATING%', $gdsr->o["cmm_stars"], $rt);
             $rt = str_replace('%CMM_VOTES%', $row->voters, $rt);
             $rt = str_replace('%COMMENT%', $row->comment_content, $rt);
             $rt = str_replace('%PERMALINK%', $row->permalink, $rt);
             $rt = str_replace('%AUTHOR_NAME%', $row->comment_author, $rt);
             $rt = str_replace('%AUTHOR_AVATAR%', $row->comment_author_email, $rt);
             $rt = str_replace('%AUTHOR_LINK%', $row->comment_author_url, $rt);
             $rt = str_replace('%ID%', $row->comment_id, $rt);
             $rt = str_replace('%POST_ID%', $post->ID, $rt);
             $rt = str_replace('%CMM_STARS%', $row->rating_stars, $rt);
             $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;
         }
     }
     $tpl_render .= html_entity_decode($template->elm["footer"]);
     return $tpl_render;
 }