snippet_type = $snippet_type;
}
/**
* Render snippet with thumbs rating.
*
* @param array $options settings for snippet
* @return string rendered snippet code
*/
function snippet_stars_percentage($options = array()) {
$default = array("title" => "", "rating" => 0, "votes" => "", "review_excerpt" => "", "hidden" => true);
$options = wp_parse_args($options, $default);
$tpl = '';
if ($this->snippet_type == "microformat") {
$tpl.= '';
$tpl.= '%TITLE%, ';
$tpl.= '';
$tpl.= '%RATING%%';
$tpl.= ' %WORD_BASEDON% %VOTES% %WORD_VOTES% ';
$tpl.= '%REVIEW_EXCERPT%';
$tpl.= '';
$tpl.= '';
} else if ($this->snippet_type == "microdata") {
$tpl.= '';
$tpl.= '%TITLE%, ';
$tpl.= '';
$tpl.= '%RATING%%';
$tpl.= ' %WORD_BASEDON% %VOTES% %WORD_VOTES% ';
$tpl.= '';
$tpl.= '';
} else if ($this->snippet_type == "rdf") {
$tpl.= '
';
$tpl.= '%TITLE%, ';
$tpl.= '';
$tpl.= '';
$tpl.= '%RATING%%';
$tpl.= '';
$tpl.= '';
$tpl.= ' %WORD_BASEDON% %VOTES% %WORD_VOTES% ';
$tpl.= '%REVIEW_EXCERPT%';
$tpl.= '
';
}
$tpl = apply_filters("gdsr_snippet_template_stars_percentage", $tpl, $this->snippet_type);
$votes = $options["votes"];
$hidden = $options["hidden"] ? ' style="display: none !important;"' : '';
$tpl = str_replace("%HIDDEN%", $hidden, $tpl);
$tpl = str_replace("%WORD_BASEDON%", __("based on", "gd-star-rating"), $tpl);
$tpl = str_replace("%WORD_VOTES%", _n("rating", "ratings", $votes, "gd-star-rating"), $tpl);
$tpl = str_replace("%TITLE%", $options["title"], $tpl);
$tpl = str_replace("%RATING%", $options["rating"], $tpl);
$tpl = str_replace("%VOTES%", $votes, $tpl);
$tpl = str_replace("%REVIEW_EXCERPT%", $options["review_excerpt"], $tpl);
return $tpl;
}
/**
* Render snippet with rating.
*
* @param array $options settings for snippet
* @return string rendered snippet code
*/
function snippet_stars_rating($options = array()) {
$default = array("title" => "", "rating" => 0, "max_rating" => 5, "votes" => "", "review_excerpt" => "", "hidden" => true);
$options = wp_parse_args($options, $default);
$tpl = '';
if ($this->snippet_type == "microformat") {
$tpl.= '';
$tpl.= '%TITLE%, ';
$tpl.= '';
$tpl.= '%RATING% %WORD_OUTOF% ';
$tpl.= '%MAX_RATING%';
$tpl.= ' %WORD_BASEDON% %VOTES% %WORD_VOTES% ';
$tpl.= '%REVIEW_EXCERPT%';
$tpl.= '';
$tpl.= '';
} else if ($this->snippet_type == "microdata") {
$tpl.= '';
$tpl.= '%TITLE%, ';
$tpl.= '';
$tpl.= '%RATING% %WORD_OUTOF% ';
$tpl.= '%MAX_RATING%';
$tpl.= ' %WORD_BASEDON% %VOTES% %WORD_VOTES% ';
$tpl.= '';
$tpl.= '';
} else if ($this->snippet_type == "rdf") {
$tpl.= '';
$tpl.= '%TITLE%, ';
$tpl.= '';
$tpl.= '';
$tpl.= '%RATING% %WORD_OUTOF% ';
$tpl.= '%MAX_RATING%';
$tpl.= '';
$tpl.= '';
$tpl.= ' %WORD_BASEDON% %VOTES% %WORD_VOTES% ';
$tpl.= '%REVIEW_EXCERPT%';
$tpl.= '
';
}
$tpl = apply_filters("gdsr_snippet_template_stars_rating", $tpl, $this->snippet_type);
$votes = $options["votes"];
$hidden = $options["hidden"] ? ' style="display: none !important;"' : '';
$tpl = str_replace("%HIDDEN%", $hidden, $tpl);
$tpl = str_replace("%WORD_BASEDON%", __("based on", "gd-star-rating"), $tpl);
$tpl = str_replace("%WORD_OUTOF%", __("out of", "gd-star-rating"), $tpl);
$tpl = str_replace("%WORD_VOTES%", _n("rating", "ratings", $votes, "gd-star-rating"), $tpl);
$tpl = str_replace("%TITLE%", $options["title"], $tpl);
$tpl = str_replace("%RATING%", $options["rating"], $tpl);
$tpl = str_replace("%MAX_RATING%", $options["max_rating"], $tpl);
$tpl = str_replace("%VOTES%", $votes, $tpl);
$tpl = str_replace("%REVIEW_EXCERPT%", $options["review_excerpt"], $tpl);
return $tpl;
}
/**
* Render snippet with review.
*
* @param array $options settings for snippet
* @return string rendered snippet code
*/
function snippet_stars_review($options = array()) {
$default = array("title" => "", "rating" => 0, "max_rating" => 5, "reviewer" => "", "review_date" => "", "review_excerpt" => "", "hidden" => true);
$options = wp_parse_args($options, $default);
$tpl = '';
if ($this->snippet_type == "microformat") {
$tpl.= '';
$tpl.= '%TITLE%, ';
$tpl.= '';
$tpl.= '%WORD_REVIEWEDBY% %REVIEWER%';
$tpl.= ' %WORD_ON% %REVIEW_DATE%';
$tpl.= '%REVIEW_EXCERPT%';
$tpl.= ' %WORD_RATING% %RATING%';
$tpl.= ' %WORD_OUTOF% %MAX_RATING%';
$tpl.= '';
$tpl.= '';
} else if ($this->snippet_type == "microdata") {
$tpl.= '';
$tpl.= '%TITLE%, ';
$tpl.= '%WORD_REVIEWEDBY% %REVIEWER%';
$tpl.= ' %WORD_ON% ';
$tpl.= '%REVIEW_EXCERPT%';
$tpl.= ' %WORD_RATING% %RATING%';
$tpl.= ' %WORD_OUTOF% %MAX_RATING%';
$tpl.= '';
} else if ($this->snippet_type == "rdf") {
$tpl.= '';
$tpl.= '%TITLE%, ';
$tpl.= '%WORD_REVIEWEDBY% %REVIEWER%';
$tpl.= ' %WORD_ON% %REVIEW_DATE%';
$tpl.= '%REVIEW_EXCERPT%';
$tpl.= ' %WORD_RATING% %RATING%';
$tpl.= ' %WORD_OUTOF%%MAX_RATING%';
$tpl.= '
';
}
$tpl = apply_filters("gdsr_snippet_template_stars_review", $tpl, $this->snippet_type);
$hidden = $options["hidden"] ? ' style="display: none !important;"' : '';
$tpl = str_replace("%HIDDEN%", $hidden, $tpl);
$tpl = str_replace("%WORD_REVIEWEDBY%", __("reviewed by", "gd-star-rating"), $tpl);
$tpl = str_replace("%WORD_ON%", __("on", "gd-star-rating"), $tpl);
$tpl = str_replace("%WORD_RATING%", __("rating", "gd-star-rating"), $tpl);
$tpl = str_replace("%WORD_OUTOF%", __("out of", "gd-star-rating"), $tpl);
$tpl = str_replace("%TITLE%", $options["title"], $tpl);
$tpl = str_replace("%RATING%", $options["rating"], $tpl);
$tpl = str_replace("%MAX_RATING%", $options["max_rating"], $tpl);
$tpl = str_replace("%REVIEWER%", $options["reviewer"], $tpl);
$tpl = str_replace("%REVIEW_DATE%", $options["review_date"], $tpl);
$tpl = str_replace("%REVIEW_EXCERPT%", $options["review_excerpt"], $tpl);
return $tpl;
}
}
}
?>