Exemplo n.º 1
0
function DisplayVotes($postID, $type = '')
{
    global $user_ID, $guest_votes, $vote_text, $use_votetext, $allow_sinks, $voteiu_skin;
    $postID = wp_kses($postID, array());
    // Sanitize, just in case
    $voteiu_skin = get_option('voteiu_skin');
    $votes = GetVotes($postID);
    $barvotes = GetBarVotes($postID);
    switch ($type) {
        case '':
            // In the event no theme selected, use the current theme
            if ($voteiu_skin == '') {
                return DisplayVotes($postID, 'bar');
            } else {
                if (!LoadSkin($voteiu_skin)) {
                    return DisplayVotes($postID, 'bar');
                }
            }
            break;
            // The following themes below are pre-defined themes in the event there are no other themes found
        // The following themes below are pre-defined themes in the event there are no other themes found
        case 'bar':
            ?>
<span class="barcontainer"><span class="barfill" id="votecount<?php 
            echo $postID;
            ?>
" style="width:<?php 
            echo round($barvotes[0] * 2.5);
            ?>
%;">&nbsp;</span></span><?php 
            if ($user_ID != '') {
                if (!($user_login == get_the_author_login() && !get_option('voteiu_allowownvote'))) {
                    ?>
<span><?php 
                    if (!UserVoted($postID, $user_ID)) {
                        ?>
<span class="bartext" id="voteid<?php 
                        the_ID();
                        ?>
">
						<a href="javascript:vote('votecount<?php 
                        the_ID();
                        ?>
','voteid<?php 
                        the_ID();
                        ?>
','<?php 
                        echo get_option('voteiu_aftervotetext');
                        ?>
',<?php 
                        the_ID();
                        ?>
,<?php 
                        echo $user_ID;
                        ?>
,'<?php 
                        echo VoteItUp_ExtPath();
                        ?>
');"><?php 
                        echo get_option('voteiu_votetext');
                        ?>
</a><?php 
                        if (get_option('voteiu_sinktext') != '') {
                            ?>
<a href="javascript:sink('votecount<?php 
                            the_ID();
                            ?>
','voteid<?php 
                            the_ID();
                            ?>
','<?php 
                            echo get_option('voteiu_aftervotetext');
                            ?>
',<?php 
                            the_ID();
                            ?>
,<?php 
                            echo $user_ID;
                            ?>
,'<?php 
                            echo VoteItUp_ExtPath();
                            ?>
');"><?php 
                            echo get_option('voteiu_sinktext');
                            ?>
</a><?php 
                        }
                        ?>
</span><?php 
                    } else {
                        if (get_option('voteiu_aftervotetext') != '') {
                            ?>
<span class="bartext" id="voteid<?php 
                            the_ID();
                            ?>
"><?php 
                            echo get_option('voteiu_aftervotetext');
                            ?>
</span><?php 
                        }
                    }
                    ?>
</span><?php 
                }
            } else {
                if (get_option('voteiu_allowguests') == 'true') {
                    ?>
<span><?php 
                    if (!GuestVoted($postID, md5($_SERVER['REMOTE_ADDR']))) {
                        ?>
<span class="bartext" id="voteid<?php 
                        the_ID();
                        ?>
">
						<a href="javascript:vote('votecount<?php 
                        the_ID();
                        ?>
','voteid<?php 
                        the_ID();
                        ?>
','<?php 
                        echo get_option('voteiu_aftervotetext');
                        ?>
',<?php 
                        the_ID();
                        ?>
,0,'<?php 
                        echo VoteItUp_ExtPath();
                        ?>
');"><?php 
                        echo get_option('voteiu_votetext');
                        ?>
</a><?php 
                        if (get_option('voteiu_sinktext') != '') {
                            ?>
<a href="javascript:sink('votecount<?php 
                            the_ID();
                            ?>
','voteid<?php 
                            the_ID();
                            ?>
','<?php 
                            echo get_option('voteiu_aftervotetext');
                            ?>
',<?php 
                            the_ID();
                            ?>
,0,'<?php 
                            echo VoteItUp_ExtPath();
                            ?>
');"><?php 
                            echo get_option('voteiu_sinktext');
                            ?>
</a><?php 
                        }
                        ?>
</span><?php 
                    }
                    ?>
</span><?php 
                }
            }
            break;
        case 'ticker':
            ?>
<span class="tickercontainer" id="votes<?php 
            the_ID();
            ?>
"><?php 
            echo $votes;
            ?>
</span><?php 
            if ($user_ID != '') {
                ?>
<span id="voteid<?php 
                the_ID();
                ?>
"><?php 
                if (!UserVoted($postID, $user_ID)) {
                    ?>
<span class="tickertext"><?php 
                    if ($use_votetext == 'true') {
                        ?>
<a class="votelink" href="javascript:vote_ticker(<?php 
                        echo $postID;
                        ?>
,<?php 
                        echo $postID;
                        ?>
,<?php 
                        echo $user_ID;
                        ?>
,'<?php 
                        echo VoteItUp_ExtPath();
                        ?>
');"><?php 
                        echo $vote_text;
                        ?>
</a><?php 
                    } else {
                        ?>
<span class="imagecontainer"><?php 
                        if ($allow_sinks == 'true') {
                            ?>
<a href="javascript:sink_ticker(<?php 
                            echo $postID;
                            ?>
,<?php 
                            echo $postID;
                            ?>
,<?php 
                            echo $user_ID;
                            ?>
,'<?php 
                            echo VoteItUp_ExtPath();
                            ?>
');">
							<img class="votedown" src="<?php 
                            echo VoteItUp_ExtPath();
                            ?>
/votedown.png" alt="Vote down" border="0" />
							</a><?php 
                        }
                        ?>
<a href="javascript:vote_ticker(<?php 
                        echo $postID;
                        ?>
,<?php 
                        echo $postID;
                        ?>
,<?php 
                        echo $user_ID;
                        ?>
,'<?php 
                        echo VoteItUp_ExtPath();
                        ?>
');">
						<img class="voteup" src="<?php 
                        echo VoteItUp_ExtPath();
                        ?>
/voteup.png" alt="Vote up" border="0" />
						</a>
						</span><?php 
                    }
                    ?>
</span><?php 
                }
                ?>
</span><?php 
            } else {
                if ($guest_votes == 'true') {
                    ?>
<span id="voteid<?php 
                    the_ID();
                    ?>
"><?php 
                    if (!GuestVoted($postID, md5($_SERVER['REMOTE_ADDR']))) {
                        ?>
<span class="tickertext"><?php 
                        if ($use_votetext == 'true') {
                            ?>
<a class="votelink" href="javascript:vote_ticker(<?php 
                            echo $postID;
                            ?>
,<?php 
                            echo $postID;
                            ?>
,0,'<?php 
                            echo VoteItUp_ExtPath();
                            ?>
');"><?php 
                            echo $vote_text;
                            ?>
</a></span><?php 
                        } else {
                            ?>
<span class="imagecontainer"><?php 
                            if ($allow_sinks == 'true') {
                                ?>
<a href="javascript:sink_ticker(<?php 
                                echo $postID;
                                ?>
,<?php 
                                echo $postID;
                                ?>
,0,'<?php 
                                echo VoteItUp_ExtPath();
                                ?>
');">
								<img class="votedown" src="<?php 
                                echo VoteItUp_ExtPath();
                                ?>
/votedown.png" alt="Vote down" border="0" />
								</a><?php 
                            }
                            ?>
<a href="javascript:vote_ticker(<?php 
                            echo $postID;
                            ?>
,<?php 
                            echo $postID;
                            ?>
,0,'<?php 
                            echo VoteItUp_ExtPath();
                            ?>
');">
							<img class="voteup" src="<?php 
                            echo VoteItUp_ExtPath();
                            ?>
/voteup.png" alt="Vote up" border="0" />
							</a>
							</span><?php 
                        }
                        ?>
</span><?php 
                    }
                    ?>
</span><?php 
                }
            }
            break;
    }
}
Exemplo n.º 2
0
function DisplayVotes($postID, $type = '')
{
    global $user_ID, $guest_votes, $vote_text, $use_votetext, $allow_sinks, $voteiu_skin, $user_login;
    $voteiu_skin = get_option('voteiu_skin');
    $votes = GetVotes($postID);
    $barvotes = GetBarVotes($postID);
    switch ($type) {
        case '':
            if ($voteiu_skin == '') {
                DisplayVotes($postID, 'bar');
                //Use default bar
            } else {
                if (!LoadSkin($voteiu_skin)) {
                    DisplayVotes($postID, 'bar');
                    //Use default bar
                }
            }
            break;
        case 'bar':
            ?>
<span class="barcontainer"><span class="barfill" id="votecount<?php 
            echo $postID;
            ?>
" style="width:<?php 
            echo round($barvotes[0] * 2.5);
            ?>
%;">&nbsp;</span></span>
<?php 
            if ($user_ID != '') {
                if (!($user_login == get_the_author_meta('login') && !get_option('voteiu_allowownvote'))) {
                    ?>
	<span>
	<?php 
                    if (!UserVoted($postID, $user_ID)) {
                        ?>
<span class="bartext" id="voteid<?php 
                        the_ID();
                        ?>
">
			<a href="javascript:vote('votecount<?php 
                        the_ID();
                        ?>
','voteid<?php 
                        the_ID();
                        ?>
','<?php 
                        echo get_option('voteiu_aftervotetext');
                        ?>
',<?php 
                        the_ID();
                        ?>
,<?php 
                        echo $user_ID;
                        ?>
,'<?php 
                        echo VoteItUp_ExtPath();
                        ?>
');"><?php 
                        echo get_option('voteiu_votetext');
                        ?>
</a><?php 
                        if (get_option('voteiu_sinktext') != '') {
                            ?>
<a href="javascript:sink('votecount<?php 
                            the_ID();
                            ?>
','voteid<?php 
                            the_ID();
                            ?>
','<?php 
                            echo get_option('voteiu_aftervotetext');
                            ?>
',<?php 
                            the_ID();
                            ?>
,<?php 
                            echo $user_ID;
                            ?>
,'<?php 
                            echo VoteItUp_ExtPath();
                            ?>
');"><?php 
                            echo get_option('voteiu_sinktext');
                            ?>
</a>
			<?php 
                        }
                        ?>

		</span>
	<?php 
                    } else {
                        ?>
	<?php 
                        if (get_option('voteiu_aftervotetext') != '') {
                            ?>
<span class="bartext" id="voteid<?php 
                            the_ID();
                            ?>
"><?php 
                            echo get_option('voteiu_aftervotetext');
                            ?>
</span><?php 
                        }
                        ?>
	<?php 
                    }
                    ?>
	</span>
<?php 
                }
            } else {
                if (get_option('voteiu_allowguests') == 'true') {
                    ?>
	<span>
	<?php 
                    if (!GuestVoted($postID, md5($_SERVER['REMOTE_ADDR']))) {
                        ?>
<span class="bartext" id="voteid<?php 
                        the_ID();
                        ?>
">
			<a href="javascript:vote('votecount<?php 
                        the_ID();
                        ?>
','voteid<?php 
                        the_ID();
                        ?>
','<?php 
                        echo get_option('voteiu_aftervotetext');
                        ?>
',<?php 
                        the_ID();
                        ?>
,0,'<?php 
                        echo VoteItUp_ExtPath();
                        ?>
');"><?php 
                        echo get_option('voteiu_votetext');
                        ?>
</a><?php 
                        if (get_option('voteiu_sinktext') != '') {
                            ?>
<a href="javascript:sink('votecount<?php 
                            the_ID();
                            ?>
','voteid<?php 
                            the_ID();
                            ?>
','<?php 
                            echo get_option('voteiu_aftervotetext');
                            ?>
',<?php 
                            the_ID();
                            ?>
,0,'<?php 
                            echo VoteItUp_ExtPath();
                            ?>
');"><?php 
                            echo get_option('voteiu_sinktext');
                            ?>
</a>
			<?php 
                        }
                        ?>

		</span>
	<?php 
                    }
                    ?>
	</span>
	<?php 
                }
            }
            break;
        case 'ticker':
            ?>
<span class="tickercontainer" id="votes<?php 
            the_ID();
            ?>
"><?php 
            echo $votes;
            ?>
</span>
<?php 
            if ($user_ID != '') {
                ?>
<span id="voteid<?php 
                the_ID();
                ?>
">
	<?php 
                if (!UserVoted($postID, $user_ID)) {
                    ?>
<span class="tickertext">
		<?php 
                    if ($use_votetext == 'true') {
                        ?>
		<a class="votelink" href="javascript:vote_ticker(<?php 
                        echo $postID;
                        ?>
,<?php 
                        echo $postID;
                        ?>
,<?php 
                        echo $user_ID;
                        ?>
,'<?php 
                        echo VoteItUp_ExtPath();
                        ?>
');"><?php 
                        echo $vote_text;
                        ?>
</a>
		<?php 
                    } else {
                        ?>
			<span class="imagecontainer">
			<?php 
                        if ($allow_sinks == 'true') {
                            ?>
			<a href="javascript:sink_ticker(<?php 
                            echo $postID;
                            ?>
,<?php 
                            echo $postID;
                            ?>
,<?php 
                            echo $user_ID;
                            ?>
,'<?php 
                            echo VoteItUp_ExtPath();
                            ?>
');">
			<img class="votedown" src="<?php 
                            echo VoteItUp_ExtPath();
                            ?>
/votedown.png" alt="Vote down" border="0" />
			</a>
			<?php 
                        }
                        ?>
			<a href="javascript:vote_ticker(<?php 
                        echo $postID;
                        ?>
,<?php 
                        echo $postID;
                        ?>
,<?php 
                        echo $user_ID;
                        ?>
,'<?php 
                        echo VoteItUp_ExtPath();
                        ?>
');">
			<img class="voteup" src="<?php 
                        echo VoteItUp_ExtPath();
                        ?>
/voteup.png" alt="Vote up" border="0" />
			</a>
			</span>
		<?php 
                    }
                    ?>
		</span>
	<?php 
                }
                ?>
</span>
<?php 
            } else {
                if ($guest_votes == 'true') {
                    ?>
	<span id="voteid<?php 
                    the_ID();
                    ?>
">
	<?php 
                    if (!GuestVoted($postID, md5($_SERVER['REMOTE_ADDR']))) {
                        ?>
		<span class="tickertext">
		<?php 
                        if ($use_votetext == 'true') {
                            ?>
			<a class="votelink" href="javascript:vote_ticker(<?php 
                            echo $postID;
                            ?>
,<?php 
                            echo $postID;
                            ?>
,0,'<?php 
                            echo VoteItUp_ExtPath();
                            ?>
');"><?php 
                            echo $vote_text;
                            ?>
</a></span>
		<?php 
                        } else {
                            ?>
			<span class="imagecontainer">
			<?php 
                            if ($allow_sinks == 'true') {
                                ?>
			<a href="javascript:sink_ticker(<?php 
                                echo $postID;
                                ?>
,<?php 
                                echo $postID;
                                ?>
,0,'<?php 
                                echo VoteItUp_ExtPath();
                                ?>
');">
			<img class="votedown" src="<?php 
                                echo VoteItUp_ExtPath();
                                ?>
/votedown.png" alt="Vote down" border="0" />
			</a>
			<?php 
                            }
                            ?>
			<a href="javascript:vote_ticker(<?php 
                            echo $postID;
                            ?>
,<?php 
                            echo $postID;
                            ?>
,0,'<?php 
                            echo VoteItUp_ExtPath();
                            ?>
');">
			<img class="voteup" src="<?php 
                            echo VoteItUp_ExtPath();
                            ?>
/voteup.png" alt="Vote up" border="0" />
			</a>
			</span>
		<?php 
                        }
                        ?>
		</span>
	<?php 
                    }
                    ?>
</span>

<?php 
                }
            }
            break;
    }
}