Changeset 1076529
- Timestamp:
- 01/27/2015 08:25:26 AM (11 years ago)
- Location:
- reaction-buttons
- Files:
-
- 2 added
- 3 edited
- 4 copied
-
assets/screenshot-3.png (added)
-
assets/screenshot-4.png (added)
-
tags/2.0.0 (copied) (copied from reaction-buttons/trunk)
-
tags/2.0.0/reaction_buttons.css (copied) (copied from reaction-buttons/trunk/reaction_buttons.css) (3 diffs)
-
tags/2.0.0/reaction_buttons.php (copied) (copied from reaction-buttons/trunk/reaction_buttons.php) (12 diffs)
-
tags/2.0.0/readme.txt (copied) (copied from reaction-buttons/trunk/readme.txt) (3 diffs)
-
trunk/reaction_buttons.css (modified) (3 diffs)
-
trunk/reaction_buttons.php (modified) (12 diffs)
-
trunk/readme.txt (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
reaction-buttons/tags/2.0.0/reaction_buttons.css
r1076493 r1076529 37 37 clear: both; 38 38 padding: 0; 39 width: 100%;39 width: 90%; 40 40 } 41 41 div.reaction_buttons ul.graph li.reaction_button { … … 47 47 padding-left: 10px; 48 48 text-align: left; 49 display: block; 49 50 50 51 background: #4ecdc4; … … 69 70 padding: 0; 70 71 width: 18%; 72 display: inline-block; 71 73 } 72 div.reaction_buttons ul.graph li.reaction_button > div{74 div.reaction_buttons ul.graph li.reaction_button span.button_name { 73 75 bottom: -4em; 74 76 position: absolute; 77 } 78 div.reaction_buttons ul.graph li.reaction_button span.braces { 79 display: none; 80 } 81 div.reaction_buttons ul.graph li.reaction_button span.count_number { 82 bottom: 3px; 83 position: absolute; 84 font-size: 2em; 85 font-weight: bold; 75 86 } 76 87 } -
reaction-buttons/tags/2.0.0/reaction_buttons.php
r1076493 r1076529 61 61 $use_percentages = get_option("reaction_buttons_percentages", false); 62 62 $use_percentages_precision = get_option("reaction_buttons_percentages_precision", 1); 63 $show_graphs = get_option("reaction_buttons_graphs", true) && $use_percentages; // todo63 $show_graphs = get_option("reaction_buttons_graphs", false); 64 64 $show_after_votes = get_option("reaction_buttons_show_after_votes"); 65 65 … … 105 105 106 106 // get overall count for this post for the percentage view 107 if($use_percentages ){107 if($use_percentages || $show_graphs){ 108 108 $count_all = 0; 109 109 foreach($buttons as $button_id => $button){ … … 119 119 $voted = array_key_exists($button_id, $cookie) && $cookie[$button_id]; 120 120 121 if($use_percentages ){121 if($use_percentages || $show_graphs){ 122 122 if(empty($count_all)){ 123 $ count= number_format(0, $use_percentages_precision) . "%";;123 $percentage = number_format(0, $use_percentages_precision) . "%";; 124 124 } 125 125 else{ 126 $count = number_format(100*$count/$count_all, $use_percentages_precision) . "%"; 127 } 128 } 129 130 $html .= $show_graphs?"<li style='height: $count'":"<li "; 126 $percentage = number_format(100*$count/$count_all, $use_percentages_precision) . "%"; 127 } 128 } 129 if($use_percentages){ 130 $count = $percentage; 131 } 132 133 $html .= $show_graphs?"<li style='height: $percentage'":"<li "; 131 134 $html .= "class='reaction_button reaction_button_" . $button_id; 132 135 … … 146 149 $html .= "<span class='button_name'>" . $button . "</span>"; 147 150 if(!$show_after_votes || $already_voted_other){ 148 $html .= " <span class=' count'>(<span class='count_number'>" . $count . "</span>)</span>";149 } 150 else{151 $html .= " <span class=' count' style='display: none;'>(<span class='count_number'>" . $count . "</span>)</span>";151 $html .= " <span class='braces'>(</span><span class='count_number'>" . $count . "</span><span class='braces'>)</span>"; 152 } 153 else{ 154 $html .= " <span class='braces' style='display: none;'>(<span class='count_number'></span><span class='braces' style='display: none;'>)</span>"; 152 155 } 153 156 $html .= "</div></li>"; … … 243 246 } 244 247 248 if ( $force or !( get_option('reaction_buttons_percentages')) ) { 249 update_option('reaction_buttons_percentages', false); 250 } 251 252 if ( $force or !( get_option('reaction_buttons_percentages_precision')) ) { 253 update_option('reaction_buttons_percentages_precision', 0); 254 } 255 256 if ( $force or !( get_option('reaction_buttons_graphs')) ) { 257 update_option('reaction_buttons_graphs', false); 258 } 259 245 260 if ( $force or !( get_option('reaction_buttons_show_after_votes')) ) { 246 261 update_option('reaction_buttons_show_after_votes', false); … … 251 266 } 252 267 253 if ( $force or !( get_option('reaction_buttons_use_as_counter')) ) {268 if ( $force or !( get_option('reaction_buttons_use_as_counter')) ) { 254 269 update_option('reaction_buttons_use_as_counter', false); 255 270 } … … 480 495 } 481 496 } 497 else if(show_after_votes){ 498 var i; 499 var b; 500 for(i = 0; i < buttons.length; ++i){ 501 b = buttons[i]; 502 jQuery("#reaction_buttons_post" + post_id + " .reaction_button_" + b + " .count_number").html(data['counts'][b]); 503 } 504 } 482 505 else{ 483 506 jQuery("#reaction_buttons_post" + post_id + " .reaction_button_" + button + " .count_number").html(data['count']); … … 489 512 jQuery("#reaction_buttons_post" + post_id + " .reaction_button_" + button).addClass('voted'); 490 513 } 491 if(show_after_votes){492 jQuery("#reaction_buttons_post" + post_id + " .reaction_button . count").removeAttr('style');514 if(show_after_votes){ 515 jQuery("#reaction_buttons_post" + post_id + " .reaction_button .braces").removeAttr('style'); 493 516 } 494 517 } … … 537 560 $use_percentages = get_option("reaction_buttons_percentages", false); 538 561 $use_percentages_precision = get_option("reaction_buttons_percentages_precision", 1); 562 $show_after_votes = get_option("reaction_buttons_show_after_votes"); 539 563 540 564 // get all the buttons, stripped of whitespaces … … 588 612 } 589 613 614 if($show_after_votes){ 615 foreach($buttons as $button){ 616 $result['counts'][$button] = intval(get_post_meta($post_id, "_reaction_buttons_" . $button, true)); 617 618 } 619 } 590 620 591 621 $result['count'] = $current; … … 688 718 689 719 // save the different settings (boolean, text, array of bool) 690 foreach ( array('activate', 'usecss', 'usecookies', 'only_one_vote', 'use_as_counter', 'show_after_votes', 'clear_supported_caches', 'percentages' ) as $val ) {720 foreach ( array('activate', 'usecss', 'usecookies', 'only_one_vote', 'use_as_counter', 'show_after_votes', 'clear_supported_caches', 'percentages', 'graphs') as $val ) { 691 721 if ( isset($_POST[$val]) && $_POST[$val] ) 692 722 update_option('reaction_buttons_'.$val,true); … … 843 873 <input type="checkbox" name="percentages" <?php checked( get_option('reaction_buttons_percentages')); ?> /> <?php _e("Show percentages instead of the number of votes", "reaction_buttons"); ?><br /> 844 874 <input type="number" min="0" max="9" name="percentages_precision" value="<?php echo get_option('reaction_buttons_percentages_precision', 1); ?>" /> <?php _e("Number of decimal points for the percentages", "reaction_buttons"); ?> 875 </td> 876 </tr> 877 <tr> 878 <th scope="row" valign="top"> 879 <?php _e("Show graphs:", "reaction_buttons"); ?> 880 </th> 881 <td> 882 <input type="checkbox" name="graphs" <?php checked( get_option('reaction_buttons_graphs')); ?> /> 883 <?php _e("Show the results as clickable graphs instead of buttons. Beware, this feature might need massive css changes to look remotely good. I included an example that worked fine on my test blog, but I suspect it'll need adaptation.", "reaction_buttons"); ?><br /> 845 884 </td> 846 885 </tr> -
reaction-buttons/tags/2.0.0/readme.txt
r1065133 r1076529 35 35 36 36 = My reaction buttons don't update = 37 * Do you use any special characters like exclamation marks in your button names?38 37 * Is your PHP installation new enough? Reaction buttons require at least PHP 5.2. 39 38 * Do you use a cache plugin? When the page is cached as soon as you reload the page your vote isn't shown anymore until the cache is cleared. See below. 39 * (This shouldn't apply since version 2.0.0 anymore.) Do you use any special characters like exclamation marks in your button names? 40 40 41 41 = I want to deactivate reaction buttons in certain situations = … … 61 61 1. Shows a german default installation with Reaction Buttons and some clicks on them. 62 62 2. Shows the sidebar widget with some dummy data. 63 3. The graph feature. 64 4. The graph feature on a small screen. 65 66 == Restrictions == 67 * When using plugins to cache the pages, the buttons won't be up to date. They will increment through the javascript, but when the page reloads the old count will show again, until the cache is deleted. Check the FAQ on possibilities how to change that. 68 69 == Upgrade Notice == 70 = 2.0.0 = 71 * This upgrade changes how the reaction data is saved and will convert automatically. But [saving your wordpress database](http://codex.wordpress.org/WordPress_Backups) just in case is never a bad idea, especially if you want to go back to the old system. 63 72 64 73 == Changelog == 74 = 2.0.0 = 75 * changed the way buttons are saved. They are simply numbered now, so there shouldn't be any problems with special characters. The plugin should automatically convert your reaction counts on the first run to the new system. 76 * New graph feature, display the votes as a graph instead of buttons. This will possibly look bad and need css updates to match your blogs style. 77 65 78 = 1.8.2 = 66 79 * bump for new wordpress version … … 189 202 * First public release. 190 203 191 == Restrictions ==192 * There cannot be spaces in html classes, so the plugin wouldn't work if there would be buttons named "great article" *and* "great___article", because it converts the spaces into three underscores.193 * Also the addon (at least the ajax part) doesn't work with certain special chars like exclamation marks.194 * When using plugins to cache the pages, the buttons won't be up to date. They will increment through the javascript, but when the page reloads the old count will show again, until the cache is deleted. Check the FAQ on possibilities how to change that. -
reaction-buttons/trunk/reaction_buttons.css
r1076493 r1076529 37 37 clear: both; 38 38 padding: 0; 39 width: 100%;39 width: 90%; 40 40 } 41 41 div.reaction_buttons ul.graph li.reaction_button { … … 47 47 padding-left: 10px; 48 48 text-align: left; 49 display: block; 49 50 50 51 background: #4ecdc4; … … 69 70 padding: 0; 70 71 width: 18%; 72 display: inline-block; 71 73 } 72 div.reaction_buttons ul.graph li.reaction_button > div{74 div.reaction_buttons ul.graph li.reaction_button span.button_name { 73 75 bottom: -4em; 74 76 position: absolute; 77 } 78 div.reaction_buttons ul.graph li.reaction_button span.braces { 79 display: none; 80 } 81 div.reaction_buttons ul.graph li.reaction_button span.count_number { 82 bottom: 3px; 83 position: absolute; 84 font-size: 2em; 85 font-weight: bold; 75 86 } 76 87 } -
reaction-buttons/trunk/reaction_buttons.php
r1076493 r1076529 61 61 $use_percentages = get_option("reaction_buttons_percentages", false); 62 62 $use_percentages_precision = get_option("reaction_buttons_percentages_precision", 1); 63 $show_graphs = get_option("reaction_buttons_graphs", true) && $use_percentages; // todo63 $show_graphs = get_option("reaction_buttons_graphs", false); 64 64 $show_after_votes = get_option("reaction_buttons_show_after_votes"); 65 65 … … 105 105 106 106 // get overall count for this post for the percentage view 107 if($use_percentages ){107 if($use_percentages || $show_graphs){ 108 108 $count_all = 0; 109 109 foreach($buttons as $button_id => $button){ … … 119 119 $voted = array_key_exists($button_id, $cookie) && $cookie[$button_id]; 120 120 121 if($use_percentages ){121 if($use_percentages || $show_graphs){ 122 122 if(empty($count_all)){ 123 $ count= number_format(0, $use_percentages_precision) . "%";;123 $percentage = number_format(0, $use_percentages_precision) . "%";; 124 124 } 125 125 else{ 126 $count = number_format(100*$count/$count_all, $use_percentages_precision) . "%"; 127 } 128 } 129 130 $html .= $show_graphs?"<li style='height: $count'":"<li "; 126 $percentage = number_format(100*$count/$count_all, $use_percentages_precision) . "%"; 127 } 128 } 129 if($use_percentages){ 130 $count = $percentage; 131 } 132 133 $html .= $show_graphs?"<li style='height: $percentage'":"<li "; 131 134 $html .= "class='reaction_button reaction_button_" . $button_id; 132 135 … … 146 149 $html .= "<span class='button_name'>" . $button . "</span>"; 147 150 if(!$show_after_votes || $already_voted_other){ 148 $html .= " <span class=' count'>(<span class='count_number'>" . $count . "</span>)</span>";149 } 150 else{151 $html .= " <span class=' count' style='display: none;'>(<span class='count_number'>" . $count . "</span>)</span>";151 $html .= " <span class='braces'>(</span><span class='count_number'>" . $count . "</span><span class='braces'>)</span>"; 152 } 153 else{ 154 $html .= " <span class='braces' style='display: none;'>(<span class='count_number'></span><span class='braces' style='display: none;'>)</span>"; 152 155 } 153 156 $html .= "</div></li>"; … … 243 246 } 244 247 248 if ( $force or !( get_option('reaction_buttons_percentages')) ) { 249 update_option('reaction_buttons_percentages', false); 250 } 251 252 if ( $force or !( get_option('reaction_buttons_percentages_precision')) ) { 253 update_option('reaction_buttons_percentages_precision', 0); 254 } 255 256 if ( $force or !( get_option('reaction_buttons_graphs')) ) { 257 update_option('reaction_buttons_graphs', false); 258 } 259 245 260 if ( $force or !( get_option('reaction_buttons_show_after_votes')) ) { 246 261 update_option('reaction_buttons_show_after_votes', false); … … 251 266 } 252 267 253 if ( $force or !( get_option('reaction_buttons_use_as_counter')) ) {268 if ( $force or !( get_option('reaction_buttons_use_as_counter')) ) { 254 269 update_option('reaction_buttons_use_as_counter', false); 255 270 } … … 480 495 } 481 496 } 497 else if(show_after_votes){ 498 var i; 499 var b; 500 for(i = 0; i < buttons.length; ++i){ 501 b = buttons[i]; 502 jQuery("#reaction_buttons_post" + post_id + " .reaction_button_" + b + " .count_number").html(data['counts'][b]); 503 } 504 } 482 505 else{ 483 506 jQuery("#reaction_buttons_post" + post_id + " .reaction_button_" + button + " .count_number").html(data['count']); … … 489 512 jQuery("#reaction_buttons_post" + post_id + " .reaction_button_" + button).addClass('voted'); 490 513 } 491 if(show_after_votes){492 jQuery("#reaction_buttons_post" + post_id + " .reaction_button . count").removeAttr('style');514 if(show_after_votes){ 515 jQuery("#reaction_buttons_post" + post_id + " .reaction_button .braces").removeAttr('style'); 493 516 } 494 517 } … … 537 560 $use_percentages = get_option("reaction_buttons_percentages", false); 538 561 $use_percentages_precision = get_option("reaction_buttons_percentages_precision", 1); 562 $show_after_votes = get_option("reaction_buttons_show_after_votes"); 539 563 540 564 // get all the buttons, stripped of whitespaces … … 588 612 } 589 613 614 if($show_after_votes){ 615 foreach($buttons as $button){ 616 $result['counts'][$button] = intval(get_post_meta($post_id, "_reaction_buttons_" . $button, true)); 617 618 } 619 } 590 620 591 621 $result['count'] = $current; … … 688 718 689 719 // save the different settings (boolean, text, array of bool) 690 foreach ( array('activate', 'usecss', 'usecookies', 'only_one_vote', 'use_as_counter', 'show_after_votes', 'clear_supported_caches', 'percentages' ) as $val ) {720 foreach ( array('activate', 'usecss', 'usecookies', 'only_one_vote', 'use_as_counter', 'show_after_votes', 'clear_supported_caches', 'percentages', 'graphs') as $val ) { 691 721 if ( isset($_POST[$val]) && $_POST[$val] ) 692 722 update_option('reaction_buttons_'.$val,true); … … 843 873 <input type="checkbox" name="percentages" <?php checked( get_option('reaction_buttons_percentages')); ?> /> <?php _e("Show percentages instead of the number of votes", "reaction_buttons"); ?><br /> 844 874 <input type="number" min="0" max="9" name="percentages_precision" value="<?php echo get_option('reaction_buttons_percentages_precision', 1); ?>" /> <?php _e("Number of decimal points for the percentages", "reaction_buttons"); ?> 875 </td> 876 </tr> 877 <tr> 878 <th scope="row" valign="top"> 879 <?php _e("Show graphs:", "reaction_buttons"); ?> 880 </th> 881 <td> 882 <input type="checkbox" name="graphs" <?php checked( get_option('reaction_buttons_graphs')); ?> /> 883 <?php _e("Show the results as clickable graphs instead of buttons. Beware, this feature might need massive css changes to look remotely good. I included an example that worked fine on my test blog, but I suspect it'll need adaptation.", "reaction_buttons"); ?><br /> 845 884 </td> 846 885 </tr> -
reaction-buttons/trunk/readme.txt
r1065133 r1076529 35 35 36 36 = My reaction buttons don't update = 37 * Do you use any special characters like exclamation marks in your button names?38 37 * Is your PHP installation new enough? Reaction buttons require at least PHP 5.2. 39 38 * Do you use a cache plugin? When the page is cached as soon as you reload the page your vote isn't shown anymore until the cache is cleared. See below. 39 * (This shouldn't apply since version 2.0.0 anymore.) Do you use any special characters like exclamation marks in your button names? 40 40 41 41 = I want to deactivate reaction buttons in certain situations = … … 61 61 1. Shows a german default installation with Reaction Buttons and some clicks on them. 62 62 2. Shows the sidebar widget with some dummy data. 63 3. The graph feature. 64 4. The graph feature on a small screen. 65 66 == Restrictions == 67 * When using plugins to cache the pages, the buttons won't be up to date. They will increment through the javascript, but when the page reloads the old count will show again, until the cache is deleted. Check the FAQ on possibilities how to change that. 68 69 == Upgrade Notice == 70 = 2.0.0 = 71 * This upgrade changes how the reaction data is saved and will convert automatically. But [saving your wordpress database](http://codex.wordpress.org/WordPress_Backups) just in case is never a bad idea, especially if you want to go back to the old system. 63 72 64 73 == Changelog == 74 = 2.0.0 = 75 * changed the way buttons are saved. They are simply numbered now, so there shouldn't be any problems with special characters. The plugin should automatically convert your reaction counts on the first run to the new system. 76 * New graph feature, display the votes as a graph instead of buttons. This will possibly look bad and need css updates to match your blogs style. 77 65 78 = 1.8.2 = 66 79 * bump for new wordpress version … … 189 202 * First public release. 190 203 191 == Restrictions ==192 * There cannot be spaces in html classes, so the plugin wouldn't work if there would be buttons named "great article" *and* "great___article", because it converts the spaces into three underscores.193 * Also the addon (at least the ajax part) doesn't work with certain special chars like exclamation marks.194 * When using plugins to cache the pages, the buttons won't be up to date. They will increment through the javascript, but when the page reloads the old count will show again, until the cache is deleted. Check the FAQ on possibilities how to change that.
Note: See TracChangeset
for help on using the changeset viewer.