Plugin Directory

Changeset 1096723


Ignore:
Timestamp:
02/22/2015 11:35:37 PM (11 years ago)
Author:
DanielAGW
Message:

Version 1.2.1:

  • Fixed avatar placement in user dashboard
  • Optimized database readings (for plugin settings)
Location:
wp-first-letter-avatar/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • wp-first-letter-avatar/trunk/readme.txt

    r1096654 r1096723  
    11=== WP First Letter Avatar ===
    22Plugin Name: WP First Letter Avatar
    3 Version: 1.2
     3Version: 1.2.1
    44Plugin URI: https://github.com/DanielAGW/wp-first-letter-avatar
    55Contributors: DanielAGW
     
    6767== Changelog ==
    6868
     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
    6973= 1.2 =
    7074* Added round avatars option - you can turn it on in plugin settings
     
    7882== Upgrade Notice ==
    7983
     84= 1.2.1 =
     85This version fixes avatar placement in user dashboard and improves database reads - upgrade as soon as possible.
     86
    8087= 1.2 =
    81 Added new feature (rounded avatars, can be turned on in plugin setttings). Update not necessary.
     88Added new feature (rounded avatars, can be turned on in plugin settings). Update not necessary.
    8289
    8390= 1.1 =
  • wp-first-letter-avatar/trunk/wp-first-letter-avatar-config.php

    r1096654 r1096723  
    88
    99class WP_First_Letter_Avatar_Config {
     10   
     11   
     12    private $wpfla_options;
    1013
    1114
     
    1922
    2023
    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'));
    2427
    2528    }
     
    2932    public function wpfla_settings_init(  ) {
    3033
    31         register_setting( 'pluginPage', 'wpfla_settings' );
     34        register_setting('pluginPage', 'wpfla_settings');
    3235
    3336         add_settings_section(
     
    9295    public function wpfla_letter_index_render(){
    9396
    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']; ?>' />
    9799    <?php
    98100
     
    103105    public function wpfla_file_format_render(){
    104106
    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']; ?>' />
    108109    <?php
    109110
     
    114115    public function wpfla_unknown_image_render(){
    115116
    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']; ?>' />
    119119    <?php
    120120
     
    125125    public function wpfla_avatar_set_render(){
    126126
    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']; ?>' />
    130129    <?php
    131130
     
    136135    public function wpfla_use_gravatar_render(){
    137136
    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' />
    141139    <?php
    142140
     
    147145    public function wpfla_round_avatars_render(){
    148146
    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' />
    152149    <?php
    153150
     
    158155    public function wpfla_settings_section_callback(){
    159156
    160         // leaving this in case I want to add something here in future...
     157        $this->wpfla_options = get_option('wpfla_settings');
    161158
    162159    }
  • wp-first-letter-avatar/trunk/wp-first-letter-avatar.php

    r1096654 r1096723  
    55 * Contributors: DanielAGW
    66 * 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
    88 * Author: Daniel Wroblewski
    99 * Author URI: https://github.com/DanielAGW
     
    122122            if ($this->gravatar_exists($user_email)){
    123123                // 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);
    125125            } else {
    126126                // 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);
    128128            }
    129129        } else {
    130130            // 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;
    133152
    134153    }
     
    176195
    177196        // 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);
    198198
    199199    }
     
    209209
    210210        // output gravatar:
    211         $this->output_img($avatar, $size, $alt);
     211        return $this->output_img($avatar, $size, $alt);
    212212
    213213    }
Note: See TracChangeset for help on using the changeset viewer.