Esempio n. 1
0
function VoteItUp_optionspage()
{
    ?>
<div class="wrap">
	<div id="icon-options-general" class="icon32"><br /></div>
<h2><?php 
    _e('Voting options');
    ?>
</h2>
<form method="post" action="options.php">
<?php 
    /* bugfix for wordpress mu */
    if (function_exists('wpmu_create_blog')) {
        wp_nonce_field('voteitup-options');
        echo '<input type="hidden" name="option_page" value="voteitup" />';
    } else {
        wp_nonce_field('update-options');
    }
    ?>

<h3>General</h3>
<table class="form-table" border="0">
<tr valign="top">
<th scope="row" style="text-align: left;">Initial vote count</th>
<td>
<input type="text" name="voteiu_initialoffset" id="voteiu_initialoffset" value="<?php 
    if (get_option('voteiu_initialoffset') == '') {
        echo '0';
    } else {
        echo get_option('voteiu_initialoffset');
    }
    ?>
" />
</td></tr>
<tr valign="top">
<th scope="row" style="text-align: left;">Name of positive votes</th>
<td>
<input type="text" name="voteiu_votetext" id="voteiu_votetext" value="<?php 
    echo htmlentities(get_option('voteiu_votetext'));
    ?>
" /><br />
You can use <code>&lt;img&gt;</code> to use images instead of text. Example: <code>&lt;img src=&quot;<?php 
    echo VoteItUp_ExtPath();
    ?>
/uparrow.png&quot; /&gt;</code><br />
Default: <code>Vote</code>
</td>
</tr>
<tr valign="top">
<th scope="row" style="text-align: left;">Name of negative votes</th>
<td>
<input type="text" name="voteiu_sinktext" id="voteiu_sinktext" value="<?php 
    echo htmlentities(get_option('voteiu_sinktext'));
    ?>
" <?php 
    if (!GetCurrentSkinInfo('supporttwoway')) {
        echo 'disabled="disabled" ';
    }
    ?>
/><br />
<?php 
    if (GetCurrentSkinInfo('supporttwoway')) {
        ?>
You can use <code>&lt;img&gt;</code> to use images instead of text. Example: <code>&lt;img src=&quot;<?php 
        echo VoteItUp_ExtPath();
        ?>
/downarrow.png&quot; /&gt;</code><br />
If this is left blank two-way voting is disabled.<?php 
    } else {
        ?>
Current widget template does not support two-way voting<?php 
    }
    ?>
</td>
</tr>
<tr valign="top">
<th scope="row" style="text-align: left;">Text displayed after vote is cast</th>
<td>
<input type="text" name="voteiu_aftervotetext" id="voteiu_aftervotetext" value="<?php 
    echo htmlentities(get_option('voteiu_aftervotetext'));
    ?>
" /><br />
You can use <code>&lt;img&gt;</code> to use images instead of text. Text is displayed after user casts a vote. If this is left blank the vote button disappears.
</td>
</tr>
</table>

<h3>Permissions</h3>
<table class="form-table" border="0">
<tr valign="top">
<th scope="row" style="text-align: left;">Allow guests to vote</th>
<td>
<input type="checkbox" name="voteiu_allowguests" id="voteiu_allowguests" value="true" <?php 
    if (get_option('voteiu_allowguests') == 'true') {
        echo ' checked="checked"';
    }
    ?>
 />
</td></tr>
<tr valign="top">
<th scope="row" style="text-align: left;">Post author can vote own post</th>
<td>
<input type="checkbox" name="voteiu_allowownvote" id="voteiu_allowownvote" value="true" <?php 
    if (get_option('voteiu_allowownvote') == 'true') {
        echo ' checked="checked"';
    }
    ?>
 />
</td></tr>
</table>

<h3>Theming</h3>
<p>External templates for the voting widgets can be installed via the &quot;skin&quot; directory. Voting widgets using <code>&lt;?php DisplayVotes(get_the_ID()); ?&gt;</code> will use the new themes. Setting this to &quot;none&quot; will result in the default bar theme being used.</p>
<?php 
    SkinsConfig();
    ?>

<h3>Widget</h3>
<p>The widget shows posts which have the most votes. Only new posts are considered to keep the list fresh.</p>
<p>The widget can be displayed to where you want by using the following code: <code>&lt;?php MostVotedAllTime(); ?&gt;</code>, or if your template supports widgets it can be added via the <a href="widgets.php" title="Widgets">widgets panel</a>.</p>
<table class="form-table" border="0">
<tr valign="top">
<th scope="row" style="text-align: left;">No. of most recent posts to be considered</th>
<td><input type="text" name="voteiu_limit" id="voteiu_limit" value="<?php 
    echo get_option('voteiu_limit');
    ?>
" /><br />
Default: <code>100</code>
</td>
</tr>
<tr valign="top">
<th scope="row" style="text-align: left;">No. of posts shown in widget</th>
<td><input type="text" name="voteiu_widgetcount" id="voteiu_widgetcount" value="<?php 
    if (get_option('voteiu_widgetcount') == '') {
        echo '10';
    } else {
        echo get_option('voteiu_widgetcount');
    }
    ?>
" /><br />
Default: <code>10</code>
</td>
</tr>
</table>

<input type="hidden" name="action" value="update" />
<input type="hidden" name="page_options" value="voteiu_initialoffset,voteiu_votetext,voteiu_sinktext,voteiu_aftervotetext,voteiu_allowguests,voteiu_allowownvote,voteiu_limit,voteiu_widgetcount,voteiu_skin" />

<h3>Voting code</h3>
<p>The following code should be added in your index.php and single.php. This displays the vote buttons.</p>
<p><strong>Themable Version</strong><br />
<code>&lt;?php DisplayVotes(get_the_ID()); ?&gt;</code></p>

<p class="submit">
<input type="submit" name="Submit" value="<?php 
    _e('Update Options &raquo;');
    ?>
" />
</p>
</form>


</div>
<?php 
}
Esempio n. 2
0
function LoadVote()
{
    global $user_ID, $user_login;
    $postID = get_the_ID();
    $votes = GetVotes($postID);
    $barvotes = GetBarVotes($postID);
    if (function_exists('VoteItUp_options')) {
        ?>
<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'))) {
                ?>
	<?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 
                }
            } else {
                ?>
		<?php 
                if (get_option('voteiu_aftervotetext') != '') {
                    ?>
<span class="bartext" id="voteid<?php 
                    the_ID();
                    ?>
"><?php 
                    echo get_option('voteiu_aftervotetext');
                    ?>
</span><?php 
                }
            }
        } else {
            if (get_option('voteiu_allowguests') == 'true') {
                ?>
	<?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 
                } else {
                    ?>
	<?php 
                    if (get_option('voteiu_aftervotetext') != '') {
                        ?>
<span class="bartext" id="voteid<?php 
                        the_ID();
                        ?>
"><?php 
                        echo get_option('voteiu_aftervotetext');
                        ?>
</span><?php 
                    }
                    ?>
	<?php 
                }
                ?>
	<?php 
            } else {
                /*Guest voting disabled*/
                ?>
	<span class="bartext" id="voteid<?php 
                the_ID();
                ?>
">
			<a href="javascript:regboxopen();"><?php 
                echo get_option('voteiu_votetext');
                ?>
</a><?php 
                if (get_option('voteiu_sinktext') != '') {
                    ?>
<a href="javascript:regboxopen();"><?php 
                    echo get_option('voteiu_sinktext');
                    ?>
</a><?php 
                }
                ?>
	</span>
<?php 
            }
        }
    }
}
Esempio n. 3
0
function LoadVote()
{
    global $user_ID, $user_login;
    $postID = get_the_ID();
    $votes = GetVotes($postID, true);
    if (function_exists('VoteItUp_options')) {
        ?>
<span class="vote-it-up">
<span class="tickercontainer" id="votecount<?php 
        the_ID();
        ?>
"><?php 
        echo $votes == false ? "Vote" : $votes;
        ?>
</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="tickertext">
			<span class="votelink" 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();
                    ?>
');" class="voteuplink"><?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();
                        ?>
');" class="votedownlink"><?php 
                        echo get_option('voteiu_sinktext');
                        ?>
</a></span>
			<?php 
                    }
                    ?>

		</span>
	<?php 
                } else {
                    ?>
	<?php 
                    if (get_option('voteiu_aftervotetext') != '') {
                        ?>
<span class="tickertext" id="voteid<?php 
                        the_ID();
                        ?>
"><span class="votelink"><?php 
                        echo get_option('voteiu_aftervotetext');
                        ?>
</span></span><?php 
                    }
                    ?>
	<?php 
                }
                ?>
	</span>
<?php 
            } else {
                ?>
	<?php 
                if (get_option('voteiu_aftervotetext') != '') {
                    ?>
<span class="tickertext" id="voteid<?php 
                    the_ID();
                    ?>
"><span class="votelink"><?php 
                    echo get_option('voteiu_aftervotetext');
                    ?>
</span></span><?php 
                }
            }
        } else {
            if (get_option('voteiu_allowguests') == 'true') {
                ?>
	<span id="voteid<?php 
                the_ID();
                ?>
">
	<?php 
                if (!GuestVoted($postID, md5($_SERVER['REMOTE_ADDR']))) {
                    ?>
<span class="tickertext">
			<span class="votelink" 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();
                    ?>
');" class="voteuplink"><?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();
                        ?>
');" class="votedownlink"><?php 
                        echo get_option('voteiu_sinktext');
                        ?>
</a></span><?php 
                    }
                    ?>
			</span>
	<?php 
                } else {
                    ?>
		<?php 
                    if (get_option('voteiu_aftervotetext') != '') {
                        ?>
<span class="tickertext" id="voteid<?php 
                        the_ID();
                        ?>
"><span class="votelink"><?php 
                        echo get_option('voteiu_aftervotetext');
                        ?>
</span></span><?php 
                    }
                    ?>
		<?php 
                }
            } else {
                /*Guest voting disabled*/
                ?>
<span class="tickertext">
			<span class="votelink" id="voteid<?php 
                the_ID();
                ?>
"><a href="javascript:regboxopen();"><?php 
                echo get_option('voteiu_votetext');
                ?>
</a><?php 
                if (get_option('voteiu_sinktext') != '') {
                    ?>
<a href="javascript:regboxopen();"><?php 
                    echo get_option('voteiu_sinktext');
                    ?>
</a></span><?php 
                }
                ?>


	</span>
</span>
<?php 
            }
            ?>
	<?php 
        }
    }
}
Esempio n. 4
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;
    }
}
Esempio n. 5
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;
    }
}
Esempio n. 6
0
function LoadVote()
{
    global $user_ID, $user_login;
    $postID = get_the_ID();
    $votes = GetVotes($postID);
    if (function_exists('VoteItUp_options')) {
        if ($user_ID != '') {
            if (!($user_login == get_the_author_login() && !get_option('voteiu_allowownvote'))) {
                /* Post author can vote own post */
                if (!UserVoted($postID, $user_ID)) {
                    /* User has not voted */
                    ?>
				<div class="post_postvote"><div class="post_votewidget" id="votewidget<?php 
                    the_ID();
                    ?>
">
					<div class="post_votecount" id="votecount<?php 
                    the_ID();
                    ?>
"><?php 
                    echo $votes;
                    ?>
</div>
				<div class="post_votebuttoncontainer"><span class="post_votebutton" 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></div>
				</div></div>
			<?php 
                } else {
                    /* User has voted */
                    if (get_option('voteiu_aftervotetext') != '') {
                        /* After-vote text was set */
                        ?>
					<div class="post_postvote"><div class="post_votewidget" id="votewidget<?php 
                        the_ID();
                        ?>
">
						<div class="post_votecount" id="votecount<?php 
                        the_ID();
                        ?>
"><?php 
                        echo $votes;
                        ?>
</div>
					<div id="voteid<?php 
                        the_ID();
                        ?>
" class="post_votebuttoncontainer"><span class="post_votebutton"><?php 
                        echo get_option('voteiu_aftervotetext');
                        ?>
</span></div>
					</div></div>
				<?php 
                    } else {
                        /* After-vote text not set */
                        ?>
					<div class="post_postvote"><div class="post_votewidget_closed" id="votewidget<?php 
                        the_ID();
                        ?>
">
						<div class="post_votecount" id="votecount<?php 
                        the_ID();
                        ?>
"><?php 
                        echo $votes;
                        ?>
</div>
					</div></div>
					<?php 
                    }
                }
            } else {
                /* Post author cannot vote own post */
                if (get_option('voteiu_aftervotetext') != '') {
                    /* After-vote text was set */
                    ?>
				<div class="post_postvote"><div class="post_votewidget" id="votewidget<?php 
                    the_ID();
                    ?>
">
					<div class="post_votecount" id="votecount<?php 
                    the_ID();
                    ?>
"><?php 
                    echo $votes;
                    ?>
</div>
				<div class="post_votebuttoncontainer"><span class="post_votebutton" id="voteid<?php 
                    the_ID();
                    ?>
"><?php 
                    echo get_option('voteiu_aftervotetext');
                    ?>
</span></div>
				</div></div>
				<?php 
                } else {
                    /* After-vote text not set */
                    ?>
				<div class="post_postvote"><div class="post_votewidget_closed" id="votewidget<?php 
                    the_ID();
                    ?>
">
					<div class="post_votecount" id="votecount<?php 
                    the_ID();
                    ?>
"><?php 
                    echo $votes;
                    ?>
</div>
				</div></div>
				<?php 
                }
            }
        } else {
            /* Guest is attempting to vote */
            if (get_option('voteiu_allowguests') == 'true') {
                /* Guest voting allowed */
                if (!GuestVoted($postID, md5($_SERVER['REMOTE_ADDR']))) {
                    /* Guest has not voted */
                    ?>
				<div class="post_postvote"><div class="post_votewidget" id="votewidget<?php 
                    the_ID();
                    ?>
">
					<div class="post_votecount" id="votecount<?php 
                    the_ID();
                    ?>
"><?php 
                    echo $votes;
                    ?>
</div>
					<div class="post_votebuttoncontainer">
							<span class="post_votebutton" 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>
					</div></div></div>
					<?php 
                } else {
                    /* Guest has voted */
                    if (get_option('voteiu_aftervotetext') != '') {
                        /* After vote text was set */
                        ?>
<div class="post_postvote"><div class="post_votewidget" id="votewidget<?php 
                        the_ID();
                        ?>
">
					<div class="post_votecount" id="votecount<?php 
                        the_ID();
                        ?>
"><?php 
                        echo $votes;
                        ?>
</div>
					<div class="post_votebuttoncontainer">
					<span class="post_votebutton" id="voteid<?php 
                        the_ID();
                        ?>
"><?php 
                        echo get_option('voteiu_aftervotetext');
                        ?>
</span>
					</div></div></div>
				<?php 
                    } else {
                        /* After vote text was not set */
                        ?>
					<div class="post_postvote"><div class="post_votewidget_closed" id="votewidget<?php 
                        the_ID();
                        ?>
">
						<div class="post_votecount" id="votecount<?php 
                        the_ID();
                        ?>
"><?php 
                        echo $votes;
                        ?>
</div>
					</div></div>
					<?php 
                    }
                }
            } else {
                /* Guest voting disabled */
                ?>
				<div class="post_postvote"><div class="post_votewidget" id="votewidget<?php 
                the_ID();
                ?>
">
					<div class="post_votecount" id="votecount<?php 
                the_ID();
                ?>
"><?php 
                echo $votes;
                ?>
</div>
					<div class="post_votebuttoncontainer">
							<span class="post_votebutton" id="voteid<?php 
                the_ID();
                ?>
"><a href="javascript:regboxopen();"><?php 
                echo get_option('voteiu_votetext');
                ?>
</a><?php 
                if (get_option('voteiu_sinktext') != '') {
                    ?>
<a href="javascript:regboxopen();"><?php 
                    echo get_option('voteiu_sinktext');
                    ?>
</a><?php 
                }
                ?>
							</span>
					</div></div></div>
				
				
					<?php 
            }
        }
    }
}
Esempio n. 7
0
function VoteLink($postid, $userid)
{
    $urlstring = "javascript:vote('votecount" . $postid . "'voteid" . $postid . "',voteiu_aftervotetext," . $postid . "," . $userid . ",'" . VoteItUp_ExtPath() . "');";
}
Esempio n. 8
0
function LoadSkinHeader($skin)
{
    if ($skin != '') {
        ?>
<link rel="stylesheet" href="<?php 
        echo VoteItUp_ExtPath();
        ?>
/skins/<?php 
        echo $skin;
        ?>
/votestyles.css" type="text/css" />
<script type="text/javascript" src="<?php 
        echo VoteItUp_ExtPath();
        ?>
/skins/<?php 
        echo $skin;
        ?>
/voterajax.js"></script>
<?php 
    }
}
Esempio n. 9
0
function VoteItUp_optionspage()
{
    ?>
	<div class="wrap">
	<div id="icon-options-general" class="icon32"><br /></div>
	<h2><?php 
    _e('Voting options');
    ?>
</h2>
	<?php 
    include 'importdb.php';
    if (Voteiu_Dbneedupdate()) {
        ?>
<form method="get" action="">
<input type="hidden" name="page" value="voteitupconfig" />
<p>This plugin requires you to <input type="submit" name="action" value="update" class="button-secondary action" /> the database for some new features to work.</p>
</form>
<?php 
    }
    if ($_GET['action'] == '') {
        ?>
<form method="post" action="options.php">
<?php 
        /* bugfix for wordpress mu */
        if (function_exists('wpmu_create_blog')) {
            wp_nonce_field('voteitup-options');
            echo '<input type="hidden" name="option_page" value="voteitup" />';
        } else {
            wp_nonce_field('update-options');
        }
        ?>

<h3>General</h3>
<table class="form-table" border="0">
<tr valign="top">
<th scope="row" style="text-align: left;">Initial vote count</th>
<td>
<input type="text" name="voteiu_initialoffset" class="small-text" id="voteiu_initialoffset" value="<?php 
        if (get_option('voteiu_initialoffset') == '') {
            echo '0';
        } else {
            echo get_option('voteiu_initialoffset');
        }
        ?>
" />
</td></tr>
<tr valign="top">
<th scope="row" style="text-align: left;">Name of positive votes</th>
<td>
<input type="text" name="voteiu_votetext" class="regular-text" id="voteiu_votetext" value="<?php 
        echo htmlentities(get_option('voteiu_votetext'));
        ?>
" /><br />
You can use <code>&lt;img&gt;</code> to use images instead of text. <br>Example: <code>&lt;img src=&quot;<?php 
        echo VoteItUp_ExtPath();
        ?>
/uparrow.png&quot; /&gt;</code><br />
Default: <code>Vote</code>
</td>
</tr>
<tr valign="top">
<th scope="row" style="text-align: left;">Name of negative votes</th>
<td>
<input type="text" name="voteiu_sinktext" class="regular-text" id="voteiu_sinktext" value="<?php 
        echo htmlentities(get_option('voteiu_sinktext'));
        ?>
" <?php 
        if (!GetCurrentSkinInfo('supporttwoway')) {
            echo 'disabled="disabled" ';
        }
        ?>
/><br />
<?php 
        if (GetCurrentSkinInfo('supporttwoway')) {
            ?>
You can use <code>&lt;img&gt;</code> to use images instead of text. <br>Example: <code>&lt;img src=&quot;<?php 
            echo VoteItUp_ExtPath();
            ?>
/downarrow.png&quot; /&gt;</code><br />
If this is left blank two-way voting is disabled.<?php 
        } else {
            ?>
Current widget template does not support two-way voting<?php 
        }
        ?>
</td>
</tr>
<tr valign="top">
<th scope="row" style="text-align: left;">Text displayed after vote is cast</th>
<td>
<input type="text" name="voteiu_aftervotetext" class="regular-text" id="voteiu_aftervotetext" value="<?php 
        echo htmlentities(get_option('voteiu_aftervotetext'));
        ?>
" /><br />
You can use <code>&lt;img&gt;</code> to use images instead of text. Text is displayed after user casts a vote. <br>Example: <code>&lt;img src=&quot;<?php 
        echo VoteItUp_ExtPath();
        ?>
/disabledarrow.png&quot; /&gt;</code><br />
If this is left blank the vote button disappears after a vote is cast.
</td>
</tr>
</table>

<h3>Permissions</h3>
<table class="form-table" border="0">
<tr valign="top">
<th scope="row" style="text-align: left;">Allow guests to vote</th>
<td>
<input type="checkbox" name="voteiu_allowguests" id="voteiu_allowguests" value="true" <?php 
        if (get_option('voteiu_allowguests') == 'true') {
            echo ' checked="checked"';
        }
        ?>
 />
</td></tr>
<tr valign="top">
<th scope="row" style="text-align: left;">Post author can vote own post</th>
<td>
<input type="checkbox" name="voteiu_allowownvote" id="voteiu_allowownvote" value="true" <?php 
        if (get_option('voteiu_allowownvote') == 'true') {
            echo ' checked="checked"';
        }
        ?>
 />
</td></tr>
</table>

<h3>Theming</h3>
<p>External templates for the voting widgets can be installed via the &quot;skin&quot; directory. Voting widgets using <code>&lt;?php DisplayVotes(get_the_ID()); ?&gt;</code> will use the new themes. Setting this to &quot;none&quot; will result in the default bar theme being used.</p>
<?php 
        SkinsConfig();
        ?>

<h3>Top Post Widget</h3>
<p>The widget shows posts which have the most votes. Only new posts are considered to keep the list fresh.</p>
<p>The widget can be displayed to where you want by using the following code: <code>&lt;?php MostVotedAllTime(); ?&gt;</code>, or if your template supports widgets it can be added via the <a href="widgets.php" title="Widgets">widgets panel</a>.</p>
<table class="form-table" border="0">
<tr valign="top">
<th scope="row" style="text-align: left;">No. of most recent posts to be considered</th>
<td><input type="text" class="small-text" name="voteiu_limit" id="voteiu_limit" value="<?php 
        echo get_option('voteiu_limit');
        ?>
" /><br />
Default: <code>100</code>
</td>
</tr>
<tr valign="top">
<th scope="row" style="text-align: left;">No. of posts shown in widget</th>
<td><input type="text" class="small-text" name="voteiu_widgetcount" id="voteiu_widgetcount" value="<?php 
        if (get_option('voteiu_widgetcount') == '') {
            echo '10';
        } else {
            echo get_option('voteiu_widgetcount');
        }
        ?>
" /><br />
Default: <code>10</code>
</td>
</tr>
</table>

<h3>Voting Widget</h3>
<?php 
        $options = array("Do not insert automatically", "Insert to top right");
        /*$voteiu_insertoption_noinsert = "";
        if (get_option('voteiu_autoinsert') == "0") {
        
        }*/
        for ($i = 0; $i < count($options); $i++) {
            $checkedProperty = "";
            if (get_option('voteiu_autoinsert') == "" . $i) {
                $checkedProperty = "checked";
            }
            ?>
<input type="radio" name="voteiu_autoinsert" id="voteiu_autoinsert" value="<?php 
            echo $i;
            ?>
" <?php 
            echo $checkedProperty;
            ?>
 /> <?php 
            echo $options[$i];
            ?>
<br /><?php 
        }
        ?>


<p>If auto-insertion is disabled, the following code should be added in your <code>index.php</code> and <code>single.php</code> theme files to display the voting widget.</p>
<p><code>&lt;?php DisplayVotes(get_the_ID()); ?&gt;</code></p>

<input type="hidden" name="action" value="update" />
<input type="hidden" name="page_options" value="voteiu_initialoffset,voteiu_votetext,voteiu_sinktext,voteiu_aftervotetext,voteiu_allowguests,voteiu_allowownvote,voteiu_limit,voteiu_widgetcount,voteiu_skin,voteiu_autoinsert" />

<h3>Database</h3>
<p>Current database version: <?php 
        echo Voteiu_Dbversion();
        ?>
</p>
<p>Click <a href="?page=voteitupconfig&action=rollback" title="Roll back database">here</a> to roll-back to the last database version. Use this if upgrade appears to have failed.</p>

<p class="submit">
<input type="submit" name="Submit" value="<?php 
        _e('Update Options &raquo;');
        ?>
" />
</p>
</form>
<?php 
    }
    ?>

</div>
<?php 
}