Changeset 1258811
- Timestamp:
- 10/03/2015 02:29:40 PM (10 years ago)
- Location:
- thumbar/trunk
- Files:
-
- 2 edited
-
readme.txt (modified) (3 diffs)
-
thumbar-wp.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
thumbar/trunk/readme.txt
r1257056 r1258811 5 5 Requires at least: 2.6 6 6 Tested up to: 4.3 7 Stable tag: 2.0017 Stable tag: 3.000 8 8 License: GPLv2 or later 9 9 … … 26 26 == Installation == 27 27 28 1. Download plugin (path will be /wp-content/plugins/thumbar/thumbar-wp.php).28 1. Download plugin and click on Activate Plugin. 29 29 30 2. At Thumbar.com, click SIGN IN - JOIN to provide email where to send your plugin activation uid.30 2. At Thumbar.com, click SIGN IN - JOIN to provide email where to send your plugin activation User ID. 31 31 32 3. In WordPress Dashboard / Plugins, under Thumbar click Edit, set uid="x" to your uid, and click Update File.32 3. Under WordPress Dashboard \ Settings \ Thumbar, set Thumbar User ID to your uid (sent in your signup email) and click Save Changes. 33 33 34 4. Customize your up and down bar colors by changing uc=99cc99 and dc=ff9999, and click Update File.34 4. Optionally, customize your Up and Down Bar Colors and click Save Changes. 35 35 36 5. Still in WordPress Dashboard / Plugins, under Thumbar click Activate. 37 38 6. Refresh your blog's home page and rate one of your posts - done! 36 5. Refresh your blog's home page and rate one of your posts - done! 39 37 40 38 == Changelog == … … 195 193 = 2.001 = 196 194 * flat security model 195 196 = 3.000 = 197 * plugin admin page 198 * persists plugin settings 199 * supports excerpts -
thumbar/trunk/thumbar-wp.php
r1256068 r1258811 4 4 Plugin URI: https://www.thumbar.com 5 5 Description: Rates your posts and mirrors them and their ratings in real time for free at Thumbar.com to maximize their exposure. Replaces search engines and SEO for generating traffic. 6 Version: 2.0006 Version: 3.000 7 7 Author: Thumbar, Inc. 8 8 Author URI: https://www.thumbar.com 9 9 */ 10 10 11 add_filter('the_excerpt', 'thumbar'); 11 12 add_filter('the_content', 'thumbar'); 12 13 add_action('init', 'register_tb_script'); 13 14 add_action('wp_footer', 'print_tb_script'); 14 15 16 add_action('admin_init', 'tb_options_init'); 17 add_action('admin_menu', 'tb_options_add_page'); 18 19 // Init plugin options to white list our options 20 function tb_options_init(){ 21 register_setting('wp_tb_options', 'tb_option', 'tb_options_validate'); 22 } 23 24 // Add menu page 25 function tb_options_add_page() { 26 add_options_page('Thumbar Settings', 'Thumbar', 'manage_options', 'tb_options', 'tb_options_do_page'); 27 } 28 29 // Draw the menu page 30 function tb_options_do_page() { 31 ?> 32 <div class="wrap"> 33 <h2>Thumbar Settings</h2> 34 <form method="post" action="options.php"> 35 <?php settings_fields('wp_tb_options'); ?> 36 <?php $options = get_option('tb_option'); ?> 37 <table class="form-table"> 38 <tr valign="top"><th scope="row">Thumbar User ID</th> 39 <td><input type="text" name="tb_option[uid]" value="<?php echo $options['uid'] ? $options['uid'] : 'x'; ?>" /></td> 40 </tr> 41 <tr valign="top"><th scope="row">Up Bar Color</th> 42 <td><input type="text" name="tb_option[uc]" value="<?php echo $options['uc'] ? $options['uc'] : '99cc99'; ?>" /></td> 43 </tr> 44 <tr valign="top"><th scope="row">Down Bar Color</th> 45 <td><input type="text" name="tb_option[dc]" value="<?php echo $options['dc'] ? $options['dc'] : 'ff9999'; ?>" /></td> 46 </tr> 47 </table> 48 <p class="submit"> 49 <input type="submit" class="button-primary" value="<?php _e('Save Changes') ?>" /> 50 </p> 51 </form> 52 </div> 53 <?php 54 } 55 56 // Sanitize input array and return sanitized array 57 function tb_options_validate($input) { 58 // Our first value is either 0 or 1 59 $input['option1'] = ( $input['option1'] == 1 ? 1 : 0 ); 60 61 // Say our second option must be safe text with no HTML tags 62 $input['sometext'] = wp_filter_nohtml_kses($input['sometext']); 63 64 return $input; 65 } 66 15 67 function thumbar($content) { 16 68 global $add_tb_script; 69 global $wp_query; 17 70 18 $thumbar_add_on = '<style type="text/css"> .thumbar {margin:0px;border:0px;padding:0px;width:150px;height:25px;}</style><div class="thumbar" uid="x" uc=99cc99 dc=ff9999></div><br>'; 71 $options = get_option('tb_option'); 72 73 $uid = $options['uid']; 74 $uc = $options['uc']; 75 $dc = $options['dc']; 76 $post = $wp_query->post; 77 $id = $post->ID; 78 $shim = is_singular() ? '' : '<br>'; 79 80 $thumbar_add_on = '<style type="text/css"> .thumbar {margin:0px;border:0px;padding:0px;width:150px;height:25px;}</style>'.$shim.'<div class="thumbar" uid='.$uid.' uc="'.$uc.'" dc="'.$dc.'" id="tb-post-'.$id.'"></div><br>'; 19 81 $theContent = $content.$thumbar_add_on; 20 82 $add_tb_script = true; … … 31 93 32 94 while (!$add_tb_script) 33 return;95 return; 34 96 35 97 wp_print_scripts('tb-script');
Note: See TracChangeset
for help on using the changeset viewer.