array ("none" => "no votes cast", "one" => "vote cast", "many" => "votes cast", "use" => "no votes cast"), 'star_width' => 20, 'current' => 2, 'exclusive' => true, 'max_stars' => 5, 'field' => 'image', 'hidden' => true, 'vote_image_url' => $PubDirUrl . "/images/pagerankstars.gif")); $FmtPV['$RatingCount'] = '$page["RatingCount"]'; $FmtPV['$RatingAverage'] = 'number_format($page["RatingAverage"],2)'; $FmtPV['$RatingSum'] = '$page["RatingSum"]'; //$FmtPV['$RatingMessage'] = 'if ($page["Rating_$Author"]) {"Your previous rating is $page["Rating_$Author"].";} else {"You have never voted.";}'; $HTMLStylesFmt[] = " /* styles for the star rater */ .star-rating{ list-style:none; margin: 0px; padding:0px; width: " . $PRS_Vote['star_width'] * 5 . "px; height: " . $PRS_Vote['star_width'] . "px; position: relative; background: url(" . $PRS_Vote['vote_image_url'] . ") top left repeat-x; } .star-rating ul{ top: 0px; } .star-rating li{ padding:0px; margin:0px; /*\*/ float: left; /* */ } .star-rating li a{ top: 0px; display:block; width:" . $PRS_Vote['star_width'] . "px; height: " . $PRS_Vote['star_width'] . "px; text-decoration: none; text-indent: -9000px; z-index: 20; position: absolute; padding: 0px; } .star-rating li.current-rating{ background: url(PRS_Vote['vote_image_url']) left bottom; position: absolute; height: " . $PRS_Vote['star_width'] . "px; display: block; text-indent: -9000px; z-index: 1; } .star-rating li a:hover{ background: url(" . $PRS_Vote['vote_image_url'] . ") left bottom; z-index: 1; left: 0px; } .star-rating a.one-star{ left: 0px; } .star-rating a.one-star:hover{ width:" . $PRS_Vote['star_width'] . "px; } .star-rating a.two-stars{ left:" . $PRS_Vote['star_width'] . "px; } .star-rating a.two-stars:hover{ width: " . $PRS_Vote['star_width'] * 2 . "px; } .star-rating a.three-stars:hover{ width: " . $PRS_Vote['star_width'] * 3 . "px; } .star-rating a.three-stars{ left: " . $PRS_Vote['star_width'] * 2 . "px; } .star-rating a.four-stars{ left: " . $PRS_Vote['star_width'] * 3 . "px; } .star-rating a.four-stars:hover{ width: " . $PRS_Vote['star_width'] * 4 . "px; } .star-rating a.five-stars{ left: " . $PRS_Vote['star_width'] * 4 . "px; } .star-rating a.five-stars:hover{ width: " . $PRS_Vote['star_width'] * 5 . "px; } "; //

Rating: ".@number_format($current_rating/$count,2)." {{$count} {$wording} cast}
You have previously voted.

Markup('PageRankResults', 'directive', '/\\(:PageRankResults:\\)/e', Keep("
")); Markup('PageRankStars', 'directive', '/\\(:PageRankStars:\\)/e', Keep("

Rate this page:

")); //

Rating: ".@number_format($RatingAverage,2)." ({$RatingCount} " . $PRS_Vote['wording']['use'] . " )

function PRS_SaveRatings () { global $pagename, $PRS_Vote, $MessagesFmt,$Author; // validate vote info if ((!is_numeric($_GET['vote'])) || $_GET['vote'] < 1 || $_GET['vote'] > $PRS_Vote['max_stars']) { $MessagesFmt[] = "Only a vote from 1 to $PRS_Vote[max_stars] may be assigned."; HandleBrowse($pagename); exit(); } // Read the old page, set up the new page $oldpage = ReadPage($pagename); $newpage = $oldpage; // Setting up search patterns and replace patterns // if the vote is "exclusive" users may only vote once. We must track usernames and votes to be sure people don't re-vote. if ($PRS_Vote['exclusive']) { $newtext = "Rating_$Author:$_GET[vote]"; $pattern = '/Rating_' . $Author . ':(\d+)/'; if (preg_match($pattern, $newpage['text'],$matches)) { $newpage['text'] = preg_replace($pattern, $newtext, $newpage['text'], 1); // if the vote is exclusive, don't increase the #votes or add the sum incorrectly $newpage['RatingSum'] = $newpage['RatingSum'] - $matches[1] + $_GET['vote']; } else { $newpage['RatingCount']++; $newpage['RatingSum'] = $newpage['RatingSum'] + $_GET['vote']; } } else { // if the vote is not exclusive, we're not tracking votes by usernames. $newtext = 'Rating:' . $_GET['vote']; $newpage['RatingCount']++; $newpage['RatingSum'] = $newpage['RatingSum'] + $_GET['vote']; } // Add markup to page // and if the vote should be private if ($PRS_Vote['hidden']) { $newpage['text'] = $newpage['text'] . "\n(:$newtext:)"; // or the vote should be public } else { $newpage['text'] = $newpage['text'] . "\n$newtext"; } // copying page values to variables $PRS_Vote['count'] = $newpage['RatingCount'];//how many votes total @$newpage['RatingAverage'] = $newpage['RatingSum'] / $newpage['RatingCount']; // calculate the average // This is not really being used!! $PRS_Vote['wording']['use']=($PRS_Vote['count']==1) ? $PRS_Vote['wording']['one'] : $PRS_Vote['wording']['many'];//plural form votes/vote // Make the page changes UpdatePage($pagename, $oldpage, $newpage); unset($_POST); HandleBrowse($pagename); exit(); }