Changeset 1680735
- Timestamp:
- 06/18/2017 07:11:27 PM (9 years ago)
- Location:
- emojized
- Files:
-
- 11 added
- 4 edited
-
tags/0.1 (added)
-
tags/0.1/emojized-endpoints.php (added)
-
tags/0.1/emojized-metabox.php (added)
-
tags/0.1/emojized-post.php (added)
-
tags/0.1/emojized.php (added)
-
tags/0.1/js (added)
-
tags/0.1/js/emojized.js (added)
-
tags/0.1/readme.txt (added)
-
trunk/css (added)
-
trunk/css/emojized.css (added)
-
trunk/emojized-endpoints.php (modified) (1 diff)
-
trunk/emojized-metabox.php (modified) (3 diffs)
-
trunk/emojized.php (modified) (2 diffs)
-
trunk/index.php (added)
-
trunk/readme.txt (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
emojized/trunk/emojized-endpoints.php
r1432680 r1680735 23 23 24 24 $count = get_post_meta($id, 'count', true); 25 $count++; 25 $counted_once = get_post_meta($id, 'counted_once', true); 26 27 if 28 ($counted_once == 'on') 29 { 30 $voters = get_post_meta($id, 'voters', true); 31 $ip = $_SERVER['REMOTE_ADDR']; 32 $ip_hashed = substr(base_convert(md5($ip), 16, 32), 0, 12); 33 $voters_array = explode(';', $voters); 34 if 35 (!in_array( $ip_hashed, $voters_array)) 36 { 37 $count++; 38 $voters_and_new_vote = array_merge($voters, array($ip_hashed)); 39 update_post_meta($id, 'voters', $voters.$ip_hashed.';'); 40 } 41 } 42 else 43 { 44 $count++; 45 } 26 46 update_post_meta($id, 'count', $count); 27 47 28 48 return $count; 29 49 } 50 30 51 ?> -
emojized/trunk/emojized-metabox.php
r1432680 r1680735 1 1 <?php 2 3 function emojized_wp_admin_style() 4 { 5 wp_enqueue_style( 'emojized-backend' , plugin_dir_url( __FILE__ ) . 'css/emojized.css'); 6 } 7 8 add_action( 'admin_enqueue_scripts', 'emojized_wp_admin_style' ); 2 9 function emojized_meta_boxes( $post ) 3 10 { … … 18 25 global $post; 19 26 wp_nonce_field( plugin_basename( __FILE__ ), 'emojized_nonce' ); 20 echo '<table>'; 21 echo '<tr><th>ID</th><th>Emoji</th><th>Count</th><th>Initial Count</th><th>Shortcode</th></tr>'; 22 echo '<tr><td><h1>ID : '.$post->ID.'</h1></td>'; 23 echo '<td>'; 27 echo '<div class="emojized-table">'; 28 29 echo '<div class="row">'; 30 // row start 31 echo '<div class="column head">ID</div>'; 32 echo '<div class="column head">Emoji</div>'; 33 echo '<div class="column head">Count</div>'; 34 echo '<div class="column head">Initial Count</div>'; 35 echo '<div class="column head">Shortcode</div>'; 36 echo '</div>'; 37 // row end 38 echo '<div class="row">'; 39 // row start 40 echo '<div class="column"><h1>ID : '.$post->ID.'</h1></div>'; 41 42 echo '<div class="column">'; 24 43 $emoji = get_post_meta($post->ID, 'emoji', true); 25 echo '<input name="emoji" type="text" style="font-size:64px;height:75px;width:75px;" value="' .esc_attr($emoji). '" /></td>'; 44 echo '<input name="emoji" type="text" class="emoji" value="' .esc_attr($emoji). '" /></div>'; 45 26 46 $count = get_post_meta($post->ID, 'count', true); 27 echo '<td><input name="count" type="number" style="font-size:64px;height:75px;width:300px;" value="' .esc_attr($count). '" /></td>'; 47 echo '<div class="column"><input name="count" type="number" class="count" value="' .esc_attr($count). '" /></div>'; 48 28 49 $initial_count = get_post_meta($post->ID, 'initial_count', true); 29 echo '<td><input name="initial_count" type="number" style="font-size:64px;height:75px;width:300px;" value="' .esc_attr($initial_count). '" /></td>'; 30 echo '<td><h2>[emojized id="' .$post->ID . '" count="true"]</h3></td>'; 31 echo '</tr></table>'; 50 echo '<div class="column"><input name="initial_count" type="number"class="count" value="' .esc_attr($initial_count). '" /></div>'; 32 51 52 echo '<div class="column"><h2>[emojized id="' .$post->ID . '" count="true"]</h3></div>'; 53 echo '</div>'; 54 // row end 55 echo '<div class="row">'; 56 echo '<div class="column head">Settings</div>'; 57 echo '</div>'; 58 59 echo '<div class="row">'; 60 echo '<div class="column">one vote per user</div>'; 61 $counted_once = get_post_meta($post->ID, 'counted_once', true); 62 echo '<div class="column"><input type="checkbox" name="counted_once" '; 63 if 64 ($counted_once) echo 'checked=checked '; 65 echo '/>'; 66 echo '</div>'; 67 echo '</div>'; 68 69 echo '</div>'; 70 // table end 33 71 } 34 72 … … 44 82 $count = sanitize_text_field( $_POST['count'] ); 45 83 $initial_count = sanitize_text_field( $_POST['initial_count'] ); 84 $counted_once = $_POST['counted_once']; 46 85 47 86 update_post_meta($post->ID, 'emoji', $emoji); 48 87 update_post_meta($post->ID, 'count', $count); 49 88 update_post_meta($post->ID, 'initial_count', $initial_count); 89 update_post_meta($post->ID, 'counted_once', $counted_once); 50 90 } 51 91 -
emojized/trunk/emojized.php
r1432680 r1680735 5 5 Description: This is a plugin which is making emojis automatically 6 6 Author: Emojized 7 Version: 0. 17 Version: 0.2 8 8 Author URI: http://emojized.com 9 9 Licence: GPL2 10 10 */ 11 12 11 13 12 include 'emojized-metabox.php'; … … 15 14 include 'emojized-endpoints.php'; 16 15 17 18 19 16 ?> -
emojized/trunk/readme.txt
r1432680 r1680735 3 3 Tags: reactions, emoji, voting, poll 4 4 Requires at least: 4.5 5 Tested up to: 4. 5.25 Tested up to: 4.9 6 6 Stable tag: 0.1 7 7 License: GPLv2 … … 15 15 So you install the plugin and create new emoji with a title an emoji itself, a count field and an initial count, to fake the initial value of the clicked emoji. 16 16 The shortcake is [emojized id=“8” count=“true”] (or false or empty) 17 18 In the new version you can limit votes to one per user. 19 20 This plugin demands WP REST API plugin. 17 21 18 22 It has the same approach as the plugin “Emoji Reactions” … … 47 51 = 0.1 = 48 52 * initial release 53 54 = 0.2 = 55 * Vote once update
Note: See TracChangeset
for help on using the changeset viewer.