Plugin Directory

Changeset 969689


Ignore:
Timestamp:
08/21/2014 01:03:33 PM (11 years ago)
Author:
multippt
Message:

Add: Ability to insert voting widget automatically
Fix: Layout for most voted widget plugin entries now positioned properly
Adjustments to plugin options layout

Location:
vote-it-up/trunk
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • vote-it-up/trunk/readme.txt

    r969632 r969689  
    33Tags: post, voting, popularity, feedback, ajax
    44Requires at least: 1.5
    5 Tested up to: 2.8
     5Tested up to: 3.9.2
    66Stable tag: 1.2.4
    77Donate link: http://www.onfry.com/donate.php
     
    4444
    45457. Editing votes can be done via the Wordpress Dashboard (`Options > Edit Votes` in Wordpress versions prior to 2.3, `Settings > Edit Votes` in Wordpress versions after 2.5).
     46
     478. Automatic insertion of voting widget to posts can be enabled via a setting in the plugin options
    4648
    4749== Requirements ==
     
    152154
    153155    1.2.4
     156    [Feature] - Add the ability to insert voting widget without editing the template
    154157    [Bug Fix] - Patch XSS vulnerability
    155     [Bug Fix] - Default skin option now checked properly
     158    [Bug Fix] - Default skin option now be selected properly
     159    [Bug Fix] - Most voted widget entries now formatted properly
     160    [Changed] - Plugin now dual licensed under LGPL and MIT
    156161
    157162    1.2.3
    158     Re-designate 1.2.x plugin as unstable.
     163    [Changed] - Re-designate 1.2.x plugin as unstable.
    159164
    160165    1.2.2
  • vote-it-up/trunk/skin.php

    r969632 r969689  
    5252?>
    5353<div style="clear:both">
    54 <div style="float:left; padding: 5px;">
     54<!--<div style="float:left; padding: 5px;">-->
    5555<input type="radio" name="voteiu_skin" id="voteiu_skin" value="" <?php IsChecked(''); ?> /> Default<br />
    56 </div>
     56<!--</div>-->
    5757<?php
    5858for ($i = 0; $i < count($skins); $i++) {
    5959?>
    60 <div style="float:left; padding: 5px"><input type="radio" name="voteiu_skin" id="voteiu_skin" value="<?php echo $skins[$i]; ?>" <?php IsChecked($skins[$i]); ?> /> <?php echo ucfirst(str_replace('_', ' ', $skins[$i])); ?></div>
     60<!--<div style="float:left; padding: 5px">-->
     61<input type="radio" name="voteiu_skin" id="voteiu_skin" value="<?php echo $skins[$i]; ?>" <?php IsChecked($skins[$i]); ?> /> <?php echo ucfirst(str_replace('_', ' ', $skins[$i])); ?><br>
     62<!--</div>-->
    6163<?php
    6264}
  • vote-it-up/trunk/skins/bar/votestyles.css

    r94309 r969689  
    9292    margin: 0px 5px 0px 0px;
    9393    vertical-align: middle;
    94     display: inline;
    95     float: left;
     94    display: inline-block;
     95    /*float: left;*/
    9696}
    9797.votemicrotext {
    9898    font-size: 1em; /* 12 */
    9999    vertical-align: middle;
     100    display: inline-block;
    100101}
  • vote-it-up/trunk/skins/orange_ticker/votestyles.css

    r94309 r969689  
    105105    margin: 0px 5px 0px 0px;
    106106    vertical-align: middle;
    107     display: inline;
    108     float: left;
     107    display: inline-block;
     108    /*float: left;*/
    109109}
    110110.votemicrotext {
    111111    font-size: 1em; /* 12 */
    112112    vertical-align: middle;
     113    display: inline-block;
    113114}
  • vote-it-up/trunk/skins/percent/votestyles.css

    r98204 r969689  
    124124    margin: 0px 5px 0px 0px;
    125125    vertical-align: middle;
    126     display: inline;
    127     float: left;
     126    display: inline-block;
     127    /*float: left;*/
    128128}
    129129.votemicrotext {
    130130    font-size: 1em; /* 12 */
    131131    vertical-align: middle;
     132    display: inline-block;
    132133}
    133 
  • vote-it-up/trunk/skins/text/votestyles.css

    r94309 r969689  
    7878    margin: 0px 5px 0px 0px;
    7979    vertical-align: middle;
    80     display: inline;
    81     float: left;
     80    display: inline-block;
     81    /*float: left;*/
    8282}
    8383.votemicrotext {
    8484    font-size: 1em; /* 12 */
    8585    vertical-align: middle;
     86    display: inline-block;
    8687}
  • vote-it-up/trunk/skins/ticker/votestyles.css

    r94309 r969689  
    33    border: 1px solid #E5E5E5;
    44    background-color: #F3F3F3;
    5     height: 18px;
     5    /*height: 18px;*/
    66    width: 40px;
    77    font-size: 18px;
     
    111111    margin: 0px 5px 0px 0px;
    112112    vertical-align: middle;
    113     display: inline;
    114     float: left;
     113    display: inline-block;
     114    /*float: left;*/
    115115}
    116116.votemicrotext {
    117117    font-size: 1em; /* 12 */
    118118    vertical-align: middle;
     119    display: inline-block;
    119120}
  • vote-it-up/trunk/voteconfig.php

    r969632 r969689  
    1414    function voteitup_alter_whitelist_options($whitelist) {
    1515        if(is_array($whitelist)) {
    16             $option_array = array('voteitup' => array('voteiu_initialoffset','voteiu_votetext','voteiu_sinktext','voteiu_aftervotetext','voteiu_allowguests','voteiu_allowownvote','voteiu_limit','voteiu_widgetcount','voteiu_skin'));
     16            $option_array = array('voteitup' => array('voteiu_initialoffset','voteiu_votetext','voteiu_sinktext','voteiu_aftervotetext','voteiu_allowguests','voteiu_allowownvote','voteiu_limit','voteiu_widgetcount','voteiu_skin','voteiu_autoinsert'));
    1717            $whitelist = array_merge($whitelist,$option_array);
    1818        }
     
    5959<td>
    6060<input type="text" name="voteiu_votetext" class="regular-text" id="voteiu_votetext" value="<?php echo htmlentities(get_option('voteiu_votetext')); ?>" /><br />
    61 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 />
     61You 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 />
    6262Default: <code>Vote</code>
    6363</td>
     
    6767<td>
    6868<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 />
    69 <?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 />
     69<?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 />
    7070If this is left blank two-way voting is disabled.<?php } else {
    7171?>Current widget template does not support two-way voting<?php } ?>
     
    7676<td>
    7777<input type="text" name="voteiu_aftervotetext" class="regular-text" id="voteiu_aftervotetext" value="<?php echo htmlentities(get_option('voteiu_aftervotetext')); ?>" /><br />
    78 You can use <code>&lt;img&gt;</code> to use images instead of text. Text is displayed after user casts a vote. Example: <code>&lt;img src=&quot;<?php echo VoteItUp_ExtPath(); ?>/disabledarrow.png&quot; /&gt;</code><br />
     78You 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 />
    7979If this is left blank the vote button disappears after a vote is cast.
    8080</td>
     
    100100<?php SkinsConfig(); ?>
    101101
    102 <h3>Widget</h3>
     102<h3>Top Post Widget</h3>
    103103<p>The widget shows posts which have the most votes. Only new posts are considered to keep the list fresh.</p>
    104104<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>
     
    118118</table>
    119119
     120<h3>Voting Widget</h3>
     121<?php
     122$options = array("Do not insert automatically", "Insert to top right");
     123/*$voteiu_insertoption_noinsert = "";
     124if (get_option('voteiu_autoinsert') == "0") {
     125
     126}*/
     127for ($i = 0; $i < count($options); $i++) {
     128    $checkedProperty = "";
     129    if (get_option('voteiu_autoinsert') == "".$i) {
     130            $checkedProperty = "checked";
     131    }
     132    ?><input type="radio" name="voteiu_autoinsert" id="voteiu_autoinsert" value="<?php echo $i; ?>" <?php echo $checkedProperty; ?> /> <?php echo $options[$i]; ?><br /><?php
     133}
     134
     135?>
     136
     137
     138<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>
     139<p><code>&lt;?php DisplayVotes(get_the_ID()); ?&gt;</code></p>
     140
    120141<input type="hidden" name="action" value="update" />
    121 <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" />
    122 
    123 <h3>Voting code</h3>
    124 <p>The following code should be added in your index.php and single.php. This displays the vote buttons.</p>
    125 <p><code>&lt;?php DisplayVotes(get_the_ID()); ?&gt;</code></p>
     142<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" />
    126143
    127144<h3>Database</h3>
  • vote-it-up/trunk/voteinstall.php

    r969632 r969689  
    1717    $voteiu_skin = '';
    1818    $voteiu_initialoffset = 0;
     19    $voteiu_autoinsert = "0";
    1920
    2021    //Begins adding options if not available
     
    3031    add_option('voteiu_dbversion', $voteitup_dbversion, 'Vote It Up db version');
    3132    add_option('voteiu_initialoffset', $voteiu_initialoffset, 'Vote offset');
     33    add_option('voteiu_autoinsert', $voteiu_autoinsert, 'Insert vote widget automatically');
    3234
    3335    //Change setting to default values if user left these fields blank
  • vote-it-up/trunk/voteitup.css

    r969632 r969689  
    6666    font-weight: bold;
    6767}
     68.votewrapper {
     69    float: right;
     70    margin-left: 10px;
     71    margin-bottom: 10px;
     72}
  • vote-it-up/trunk/voteitup.php

    r969632 r969689  
    8888function MostVotedAllTime($skinname = '', $mode = '') {
    8989    $voteiu_skin = get_option('voteiu_skin');
    90     $tempvar = $voteiu_skin;
     90    $currentskin = $voteiu_skin;
    9191    if ($skinname != '') {
    92         $tempvar = $skinname;
    93     }
    94     if ($tempvar == '' || $tempvar == 'default') {
     92        $currentskin = $skinname;
     93    }
     94    $usefallback = false;
     95   
     96    if ($currentskin == '' || $currentskin == 'default') {
     97        $usefallback = true;
     98    } else if (!LoadSkinWidget($currentskin, $mode)) { // Try to use a theme
     99        $usefallback = true; // Theme loading failed
     100    }
     101   
     102    // Use the predefined fallback theme
     103    if ($usefallback) {
    95104        if ($mode == 'sidebar') {
    96105            MostVotedAllTime_SidebarWidget();
     
    98107            MostVotedAllTime_Widget(); //Use default bar
    99108        }
    100     } else {
    101         if (!LoadSkinWidget($tempvar, $mode)) {
    102             if ($mode == 'sidebar') {
    103                 MostVotedAllTime_SidebarWidget();
    104             } else {
    105                 MostVotedAllTime_Widget(); //Use default bar
    106             }
    107         }
    108     }
    109 }
    110 
     109    }
     110}
     111
     112$currentPostObject = null;
     113
     114function DisplayVotesPrepareHook($postObject) {
     115    $currentPostObject = $postObject;
     116    return $postObject;
     117}
     118
     119function DisplayVotesHook($postContent) {
     120    echo "<div class=\"votewrapper\">";
     121    DisplayVotes($postObject->ID);
     122    echo "</div>";
     123    return $postContent;
     124}
    111125
    112126//Display the votes
    113127function DisplayVotes($postID, $type = '') {
    114128    global $user_ID, $guest_votes, $vote_text, $use_votetext, $allow_sinks, $voteiu_skin;
     129   
     130    $postID = wp_kses($postID, array()); // Sanitize, just in case
    115131
    116132    $voteiu_skin = get_option('voteiu_skin');
     
    118134    $barvotes = GetBarVotes($postID);
    119135    switch ($type) {
    120         case '': // In the event no theme selected, use the default theme
     136        case '': // In the event no theme selected, use the current theme
    121137            if ($voteiu_skin == '') {
    122                 DisplayVotes($postID, 'bar');
     138                return DisplayVotes($postID, 'bar');
    123139            } else if (!LoadSkin($voteiu_skin)) {
    124                 DisplayVotes($postID, 'bar');
     140                return DisplayVotes($postID, 'bar');
    125141            }
    126142            break;
     143        // The following themes below are pre-defined themes in the event there are no other themes found
    127144        case 'bar':
    128145            ?><span class="barcontainer"><span class="barfill" id="votecount<?php echo $postID ?>" style="width:<?php echo round($barvotes[0] * 2.5); ?>%;">&nbsp;</span></span><?php
     
    257274add_action('init', 'widget_MostVotedAllTime_init');
    258275
     276$autoAddVotingCode = false;
     277if (get_option('voteiu_autoinsert') == "1") {
     278    $autoAddVotingCode = true;
     279}
     280if ($autoAddVotingCode) {
     281    add_action('the_post', 'DisplayVotesPrepareHook');
     282    add_action('the_content', 'DisplayVotesHook');
     283}
     284
    259285?>
Note: See TracChangeset for help on using the changeset viewer.