WordPress.org

Plugin Directory

Changeset 629206


Ignore:
Timestamp:
11/23/12 23:00:43 (17 months ago)
Author:
miqrogroove
Message:

HiDPI Gravatars v1.3.

Location:
hidpi-gravatars/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • hidpi-gravatars/trunk/hidpi-gravatars.php

    r626035 r629206  
    1111 * 
    1212 * @author: Robert Chapin (miqrogroove) 
    13  * @version: 1.2 
     13 * @version: 1.3 
    1414 * @copyright Copyright © 2012 by Robert Chapin 
    1515 * @license GPL 
     
    5656        } 
    5757 
    58     } elseif (is_singular() or function_exists('is_admin_bar_showing') and is_admin_bar_showing()) { 
     58    } elseif (function_exists('is_admin_bar_showing') and is_admin_bar_showing()) { 
    5959 
    6060        add_action('wp_footer', 'miqro_hidpi_gravatars_admin', 1001, 0); 
     61 
     62    } else { 
     63 
     64        add_filter('get_avatar', 'miqro_hidpi_gravatars_detect', 10, 1); 
     65        add_action('wp_footer', 'miqro_hidpi_gravatars_check', 1001, 0); 
    6166 
    6267    } 
     
    7580 
    7681    // Include the script. 
    77     $src = plugins_url('hidpi-gravatars.js', __FILE__) . '?ver=1.2'; 
     82    $src = plugins_url('hidpi-gravatars.js', __FILE__) . '?ver=1.3'; 
    7883    echo "<script type='text/javascript' src='$src'></script>\n"; 
    7984} 
     
    8287 * Performs sever-side avatar filtering. 
    8388 * 
     89 * @since 1.2 
     90 * 
    8491 * @param string $input The IMG element for one avatar. 
    8592 * @return string 
    86  * @since 1.2 
    8793 */ 
    8894function miqro_hidpi_gravatars_filter($input) { 
     
    103109    return $output; 
    104110} 
     111 
     112/** 
     113 * Detect if this page contains any Gravatars. 
     114 * 
     115 * This strategy should be more efficient than dumbly adding Javascript to every page. 
     116 * 
     117 * @since 1.3 
     118 * 
     119 * @param string $input Optional. The IMG element for one avatar. 
     120 * @return string 
     121 */ 
     122function miqro_hidpi_gravatars_detect($input = '') { 
     123    add_action('wp_footer', 'miqro_hidpi_gravatars_admin', 1001, 0); 
     124    remove_filter('get_avatar', 'miqro_hidpi_gravatars_detect', 10, 1); 
     125    remove_action('wp_footer', 'miqro_hidpi_gravatars_check', 1001, 0); 
     126    return $input; 
     127} 
     128 
     129/** 
     130 * Allow a theme or other plugin to trigger HiDPI. 
     131 * 
     132 * Implement like <?php define('MIQRO_HIDPI_THIS_PAGE', TRUE); ?> 
     133 * 
     134 * @since 1.3 
     135 */ 
     136function miqro_hidpi_gravatars_check() { 
     137    if (defined('MIQRO_HIDPI_THIS_PAGE')) miqro_hidpi_gravatars_admin(); 
     138} 
    105139?> 
  • hidpi-gravatars/trunk/readme.txt

    r626035 r629206  
    44Requires at least: 2.8 
    55Tested up to: 3.5 
    6 Stable tag: 1.2 
     6Stable tag: 1.3 
    77 
    88Enables high resolution Gravatar images on any browser that supports them. 
     
    2323Deactivation removes everything except the files you uploaded.  There is no "uninstall" necessary. 
    2424 
    25 Theme development note:  You may not omit the wp_footer() tag for this plugin to work correctly. 
    26  
    2725Personal avatar note:  For best results when uploading a new avatar, use an image at least 128 x 128 pixels in size.  The old "standard" size of 80 pixels will be inadequate on Retina displays. 
    2826 
    2927== Changelog == 
     28 
     29= 1.3 = 
     30* Compatibility improvement, released 23 November 2012. 
     31* Better detection of which pages have Gravatars. 
     32* Added a definable trigger for theme and plugin authors to use as needed. 
     33* Added troubleshooting documentation. 
     34* WordPress 3.5-RC1 tested. 
    3035 
    3136= 1.2 = 
     
    3338* Added support for the Gravatars in admin ajax actions, such as comment replies. 
    3439* Added support for the Mystery Man setting. 
    35 * WordPress 3.5-beta3 tested. 
    3640 
    3741= 1.1 = 
     
    4650= 0.2 = 
    4751* Beta version, released 31 October 2012. 
     52 
     53== Theme Requirements == 
     54 
     55You may not omit the [wp_head](http://codex.wordpress.org/Function_Reference/wp_head) and [wp_footer](http://codex.wordpress.org/Function_Reference/wp_footer) template tags for this plugin to work correctly. 
     56 
     57== Cache Compatibility == 
     58 
     59HiDPI Gravatars is designed to be fully compatible with page caching plugins such as WP Super Cache. 
     60 
     61Pages that were cached prior to activating HiDPI Gravatars will need to be refreshed.  Empty the cache to make sure the new Gravatars will appear. 
     62 
     63== Other Gravatar Plugins == 
     64 
     65HiDPI Gravatars might not detect customized Gravatar functions in other plugins.  If this is causing HiDPI Gravatars to miss pages that do have Gravatars on them, it will be necessary to add a line of code to your theme or plugin.  For most websites this will *not* be necessary. 
     66 
     67To forcibly trigger HiDPI Gravatars on a specific page, add this code at the appropriate place in your theme: 
     68 
     69` 
     70<?php define('MIQRO_HIDPI_THIS_PAGE', TRUE); ?> 
     71 
     72` 
     73 
     74Plugin authors: If you are not implementing the WordPress [get_avatar](http://codex.wordpress.org/Function_Reference/get_avatar) filter, then you will need to add my code (as above) whenever a Gravatar is output.  Either method should make your plugin compatible.  Note, however, only the get_avatar filter is ajax compatible.  Contact me if you need to use a different filter. 
     75 
     76In any case, HiDPI Gravatars is *not* compatible with any Gravatar cache plugins. 
Note: See TracChangeset for help on using the changeset viewer.