Changeset 1096723
- Timestamp:
- 02/22/2015 11:35:37 PM (11 years ago)
- Location:
- wp-first-letter-avatar/trunk
- Files:
-
- 3 edited
-
readme.txt (modified) (3 diffs)
-
wp-first-letter-avatar-config.php (modified) (10 diffs)
-
wp-first-letter-avatar.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wp-first-letter-avatar/trunk/readme.txt
r1096654 r1096723 1 1 === WP First Letter Avatar === 2 2 Plugin Name: WP First Letter Avatar 3 Version: 1.2 3 Version: 1.2.1 4 4 Plugin URI: https://github.com/DanielAGW/wp-first-letter-avatar 5 5 Contributors: DanielAGW … … 67 67 == Changelog == 68 68 69 = 1.2.1 = 70 * Avatar is now in the right position in dashboard (in previous versions it used to be in bottom left corner instead of upper right corner) 71 * Optimized database readings (for plugin settings) 72 69 73 = 1.2 = 70 74 * Added round avatars option - you can turn it on in plugin settings … … 78 82 == Upgrade Notice == 79 83 84 = 1.2.1 = 85 This version fixes avatar placement in user dashboard and improves database reads - upgrade as soon as possible. 86 80 87 = 1.2 = 81 Added new feature (rounded avatars, can be turned on in plugin sett tings). Update not necessary.88 Added new feature (rounded avatars, can be turned on in plugin settings). Update not necessary. 82 89 83 90 = 1.1 = -
wp-first-letter-avatar/trunk/wp-first-letter-avatar-config.php
r1096654 r1096723 8 8 9 9 class WP_First_Letter_Avatar_Config { 10 11 12 private $wpfla_options; 10 13 11 14 … … 19 22 20 23 21 public function wpfla_add_admin_menu( ) {22 23 add_options_page( 'WP First Letter Avatar', 'WP First Letter Avatar', 'manage_options', 'wp_first_letter_avatar', array($this, 'wpfla_options_page'));24 public function wpfla_add_admin_menu() { 25 26 add_options_page('WP First Letter Avatar', 'WP First Letter Avatar', 'manage_options', 'wp_first_letter_avatar', array($this, 'wpfla_options_page')); 24 27 25 28 } … … 29 32 public function wpfla_settings_init( ) { 30 33 31 register_setting( 'pluginPage', 'wpfla_settings');34 register_setting('pluginPage', 'wpfla_settings'); 32 35 33 36 add_settings_section( … … 92 95 public function wpfla_letter_index_render(){ 93 96 94 $options = get_option('wpfla_settings'); 95 ?> 96 <input style="width:40px;" type='text' name='wpfla_settings[wpfla_letter_index]' value='<?php echo $options['wpfla_letter_index']; ?>' /> 97 ?> 98 <input style="width:40px;" type='text' name='wpfla_settings[wpfla_letter_index]' value='<?php echo $this->wpfla_options['wpfla_letter_index']; ?>' /> 97 99 <?php 98 100 … … 103 105 public function wpfla_file_format_render(){ 104 106 105 $options = get_option('wpfla_settings'); 106 ?> 107 <input style="width: 100px;" type='text' name='wpfla_settings[wpfla_file_format]' value='<?php echo $options['wpfla_file_format']; ?>' /> 107 ?> 108 <input style="width: 100px;" type='text' name='wpfla_settings[wpfla_file_format]' value='<?php echo $this->wpfla_options['wpfla_file_format']; ?>' /> 108 109 <?php 109 110 … … 114 115 public function wpfla_unknown_image_render(){ 115 116 116 $options = get_option('wpfla_settings'); 117 ?> 118 <input type='text' name='wpfla_settings[wpfla_unknown_image]' value='<?php echo $options['wpfla_unknown_image']; ?>' /> 117 ?> 118 <input type='text' name='wpfla_settings[wpfla_unknown_image]' value='<?php echo $this->wpfla_options['wpfla_unknown_image']; ?>' /> 119 119 <?php 120 120 … … 125 125 public function wpfla_avatar_set_render(){ 126 126 127 $options = get_option('wpfla_settings'); 128 ?> 129 <input type='text' name='wpfla_settings[wpfla_avatar_set]' value='<?php echo $options['wpfla_avatar_set']; ?>' /> 127 ?> 128 <input type='text' name='wpfla_settings[wpfla_avatar_set]' value='<?php echo $this->wpfla_options['wpfla_avatar_set']; ?>' /> 130 129 <?php 131 130 … … 136 135 public function wpfla_use_gravatar_render(){ 137 136 138 $options = get_option('wpfla_settings'); 139 ?> 140 <input type='checkbox' name='wpfla_settings[wpfla_use_gravatar]' <?php checked( $options['wpfla_use_gravatar'], 1 ); ?> value='1' /> 137 ?> 138 <input type='checkbox' name='wpfla_settings[wpfla_use_gravatar]' <?php checked( $this->wpfla_options['wpfla_use_gravatar'], 1 ); ?> value='1' /> 141 139 <?php 142 140 … … 147 145 public function wpfla_round_avatars_render(){ 148 146 149 $options = get_option('wpfla_settings'); 150 ?> 151 <input type='checkbox' name='wpfla_settings[wpfla_round_avatars]' <?php checked( $options['wpfla_round_avatars'], 1 ); ?> value='1' /> 147 ?> 148 <input type='checkbox' name='wpfla_settings[wpfla_round_avatars]' <?php checked( $this->wpfla_options['wpfla_round_avatars'], 1 ); ?> value='1' /> 152 149 <?php 153 150 … … 158 155 public function wpfla_settings_section_callback(){ 159 156 160 // leaving this in case I want to add something here in future...157 $this->wpfla_options = get_option('wpfla_settings'); 161 158 162 159 } -
wp-first-letter-avatar/trunk/wp-first-letter-avatar.php
r1096654 r1096723 5 5 * Contributors: DanielAGW 6 6 * Description: Set custom avatars for users with no Gravatar. The avatar will be a first (or any other) letter of the users's name, just like in Discourse. 7 * Version: 1.2 7 * Version: 1.2.1 8 8 * Author: Daniel Wroblewski 9 9 * Author URI: https://github.com/DanielAGW … … 122 122 if ($this->gravatar_exists($user_email)){ 123 123 // gravatar is set, output the gravatar img 124 $ this->output_gravatar_img($user_email, $size, $alt);124 $avatar_output = $this->output_gravatar_img($user_email, $size, $alt); 125 125 } else { 126 126 // gravatar is not set, proceed to choose custom avatar: 127 $ this->choose_custom_avatar($avatar_params);127 $avatar_output = $this->choose_custom_avatar($avatar_params); 128 128 } 129 129 } else { 130 130 // Gravatar is not used as default option, only custom avatars will be used; proceed to choose custom avatar: 131 $this->choose_custom_avatar($avatar_params); 132 } 131 $avatar_output = $this->choose_custom_avatar($avatar_params); 132 } 133 134 return $avatar_output; 135 136 } 137 138 139 140 private function output_img($avatar, $size, $alt){ 141 142 // prepare extra classes for <img> tag depending on plugin settings: 143 $extra_img_class = ''; 144 if ($this->round_avatars == TRUE){ 145 $extra_img_class .= 'round-avatars'; 146 } 147 148 $output_data = "<img alt='{$alt}' src='{$avatar}' class='avatar avatar-{$size} photo wpfla {$extra_img_class}' height='{$size}' width='{$size}' />"; 149 150 // echo the <img> tag: 151 return $output_data; 133 152 134 153 } … … 176 195 177 196 // output the final HTML img code: 178 $this->output_img($avatar, $size, $alt); 179 180 } 181 182 183 184 private function output_img($avatar, $size, $alt){ 185 186 // prepare extra classes for <img> tag depending on plugin settings: 187 $extra_img_class = ''; 188 if ($this->round_avatars == TRUE){ 189 $extra_img_class .= 'round-avatars'; 190 } 191 192 $output_data = "<img alt='{$alt}' src='{$avatar}' class='avatar avatar-{$size} photo wpfla {$extra_img_class}' height='{$size}' width='{$size}' />"; 193 194 // echo the <img> tag: 195 echo $output_data; 196 197 return; 197 return $this->output_img($avatar, $size, $alt); 198 198 199 199 } … … 209 209 210 210 // output gravatar: 211 $this->output_img($avatar, $size, $alt);211 return $this->output_img($avatar, $size, $alt); 212 212 213 213 }
Note: See TracChangeset
for help on using the changeset viewer.