Changeset 40975

Show
Ignore:
Timestamp:
04/16/08 17:30:25 (3 months ago)
Author:
peterwsterling
Message:

fixed user URL wrapping breaking comment editing

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • add-local-avatar/trunk/avatars.php

    r39565 r40975  
    55      Description:      A plugin to manage public and private avatars. 
    66      Author:                 Peter Sterling 
    7       Version:          3.0 
     7      Version:          3.2 
    88      Changes:          0.1 - Initial version. 
    99                              1.0 - Added pagination of users list. 
     
    1111                              2.1 - Added example formatting information. 
    1212                              3.0 - Added ability to place avatars in written post content (plus other tweaks). 
     13                              3.1 - Minor tweaks to usage text and options. 
     14                              3.2 - Added check for administration pages to stop user URL wrapping breaking comment editing. 
    1315      Author URI:       http://www.sterling-adventures.co.uk/ 
    1416*/ 
     
    101103                  $out = 'http://www.gravatar.com/avatar/'; 
    102104                  $out .= md5(strtolower($email)); 
    103                   $out .= '?s='.$size; 
     105                  $out .= '?s=' . $size; 
    104106                  $out .= '&d=' . urlencode($default); 
    105107       
     
    113115      } 
    114116 
    115       // If there is a URL wrap the avatar markup with an anchor. 
    116       if(!empty($url) && $url != 'http://') $avatar = "<a alt='Avatar' href='" . attribute_escape($url) . "' title='" . (empty($name) ? '' : "Visit $name&rsquo;s website.") . "' " . ($avatar_options['snapshots'] == 'on' ? '>' : "class='snap_noshots'>") . $avatar . "</a>"; 
     117      // If not in admin pages and there is a URL wrap the avatar markup with an anchor. 
     118      if(!empty($url) && $url != 'http://' && !is_admin()) $avatar = "<a alt='Avatar' href='" . attribute_escape($url) . "' title='" . (empty($name) ? '' : "Visit $name&rsquo;s website.") . "' " . ($avatar_options['snapshots'] == 'on' ? '>' : "class='snap_noshots'>") . $avatar . "</a>"; 
    117119 
    118120      // Return the filtered result. 
     
    297299                        <tr> 
    298300                              <td><label for="show_avatars">Show avatars:</label><br /><small>Repeated from Settings &raquo; Discussion</small></td> 
    299                               <td><input type="checkbox" name="show_avatars" <?php echo (get_option('show_avatars') ? 'checked' : ''); ?> /></td> 
     301                              <td colspan=2><input type="checkbox" name="show_avatars" <?php echo (get_option('show_avatars') ? 'checked' : ''); ?> /></td> 
    300302                        </tr> 
    301303                        <tr> 
    302304                              <td>Avatar rating:<br /><small>Repeated from Settings &raquo; Discussion</small></td> 
    303305                              <td> 
    304                                     <label><input type='radio' name='avatar_rating' value='G'  <?php echo (get_option('avatar_rating') == 'G'  ? 'checked="checked"' : ''); ?>> G  &#8212; Suitable for all audiences</label><br /> 
    305                                     <label><input type='radio' name='avatar_rating' value='PG' <?php echo (get_option('avatar_rating') == 'PG' ? 'checked="checked"' : ''); ?>> PG &#8212; Possibly offensive, usually for audiences 13 and above</label><br /> 
    306                                     <label><input type='radio' name='avatar_rating' value='R'  <?php echo (get_option('avatar_rating') == 'R'  ? 'checked="checked"' : ''); ?>> R  &#8212; Intended for adult audiences above 17</label><br /> 
    307                                     <label><input type='radio' name='avatar_rating' value='X'  <?php echo (get_option('avatar_rating') == 'X'  ? 'checked="checked"' : ''); ?>> X  &#8212; Even more mature than above</label><br /> 
     306                                    <input type='radio' name='avatar_rating' value='G'  <?php echo (get_option('avatar_rating') == 'G'  ? 'checked="checked"' : ''); ?> /> G <br /> 
     307                                    <input type='radio' name='avatar_rating' value='PG' <?php echo (get_option('avatar_rating') == 'PG' ? 'checked="checked"' : ''); ?> /> PG<br /> 
     308                                    <input type='radio' name='avatar_rating' value='R'  <?php echo (get_option('avatar_rating') == 'R'  ? 'checked="checked"' : ''); ?> /> R <br /> 
     309                                    <input type='radio' name='avatar_rating' value='X'  <?php echo (get_option('avatar_rating') == 'X'  ? 'checked="checked"' : ''); ?> /> X 
    308310                              </td> 
    309                         </tr> 
    310                         <tr> 
    311                               <td><label for='size'>Size:</label></td> 
    312311                              <td> 
     312                                    - Suitable for all audiences<br /> 
     313                                    - Possibly offensive, usually for audiences 13 and above<br /> 
     314                                    - Intended for adult audiences above 17<br /> 
     315                                    - Even more mature than above 
     316                              </td> 
     317                        </tr> 
     318                        <tr> 
     319                              <td>Size:</td> 
     320                              <td colspan=2> 
    313321                                    <select name='size'><?php 
    314322                                          for ($i = 10; $i <= 80; $i = $i + 10) { 
     
    321329                        </tr> 
    322330                        <tr> 
    323                               <td><label for='default'>Default image:</label></td> 
     331                              <td>Default image:</td> 
     332                              <td><?php echo get_avatar('default'); ?></td> 
    324333                              <td><input type='text' name='default' value='<?php echo $avatar_options['default']; ?>' size='70' /></td> 
    325334                        </tr> 
    326335                        <tr> 
    327                               <td><label for="snapshots">Use Snapshots:</label></td> 
    328                               <td><input type="checkbox" name="snapshots" <?php echo $avatar_options['snapshots'] == 'on' ? 'checked' : ''; ?> /> <small>if you have enabled <a href="http://www.snap.com">snapshots</a>, clearing this will disable them for avatar links</small></td> 
    329                         </tr> 
    330                         <tr> 
    331                               <td><label for="in_posts">Replace <code>&lt;!-- avatar <b>e-mail</b> --&gt;</code> with avatar in posts:</label></td> 
     336                              <td>Use Snapshots:</td> 
     337                              <td><input type="checkbox" name="snapshots" <?php echo $avatar_options['snapshots'] == 'on' ? 'checked' : ''; ?> /></td> 
     338                              <td><small>If you have enabled <a href="http://www.snap.com">snapshots</a>, clearing this will disable them for avatar links</small></td> 
     339                        </tr> 
     340                        <tr> 
     341                              <td>Avatars in posts:</td> 
    332342                              <td><input type="checkbox" name="in_posts" <?php echo $avatar_options['in_posts'] == 'on' ? 'checked' : ''; ?> /></td> 
     343                              <td><small>Replaces </small><code>&lt;!-- avatar <b>e-mail</b> --&gt;</code><small> with an avatar for that email address in post content</small></td> 
    333344                        </tr> 
    334345                  </table>