Plugin Directory

Changeset 928294


Ignore:
Timestamp:
06/07/2014 09:45:06 PM (12 years ago)
Author:
kylereicks
Message:

updating to version 1.3.3

Location:
picturefillwp/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • picturefillwp/trunk/inc/class-model-picturefill-wp.php

    r888529 r928294  
    1919
    2020    static function syntax_present($DOMDocument, $html){
     21      $libxml_previous_error_state = libxml_use_internal_errors(true);
    2122      $DOMDocument->loadHTML('<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />' . $html);
     23      apply_filters('picturefill_wp_syntax_present_libxml_errors', libxml_get_errors(), $html, $DOMDocument);
     24      libxml_clear_errors();
     25      libxml_use_internal_errors($libxml_previous_error_state);
    2226      $spans = $DOMDocument->getElementsByTagName('span');
    2327      if(0 === $spans->length){
     
    3337
    3438    static function get_images($DOMDocument, $html){
     39      $libxml_previous_error_state = libxml_use_internal_errors(true);
    3540      $DOMDocument->loadHTML('<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />' . $html);
     41      apply_filters('picturefill_wp_get_images_libxml_errors', libxml_get_errors(), $html, $DOMDocument);
     42      libxml_clear_errors();
     43      libxml_use_internal_errors($libxml_previous_error_state);
    3644      return $DOMDocument->getElementsByTagName('img');
    3745    }
  • picturefillwp/trunk/inc/class-picturefill-wp.php

    r888529 r928294  
    6161    }
    6262
    63     public function cache_picturefill_output($html, $content_type){
    64       global $wp_scripts, $page;
    65       if(!isset($content_type)){
    66         return $html;
    67       }
    68       $post_id = get_the_ID();
     63    public function cache_picturefill_output($html, $content_type = 'depreciated'){
     64      global $wp_scripts;
     65      $html_hash = md5($html);
    6966      $cache_duration = apply_filters('picturefill_wp_cache_duration', 86400);
    70       $cached_output = get_transient('picturefill_wp_' . $content_type . '_output_' . $post_id . '_p' . $page);
    71       if(is_singular() && is_main_query() && !empty($cached_output) && (get_option('_transient_timeout_picturefill_wp_' . $content_type . '_output_' . $post_id . '_p' . $page) - $cache_duration) > get_the_modified_time('U') && (get_option('picturefill_wp_update_timestamp') - $cache_duration) > get_the_modified_time('U')){
     67      $cached_output = get_transient('picturefill_wp_output_' . $html_hash);
     68      if(!empty($cached_output)){
    7269        wp_enqueue_script('picturefill');
    7370        return $cached_output;
    7471      }else{
    7572        $output = $this->replace_images($html);
    76         if(is_singular() && is_main_query() && in_array('picturefill', $wp_scripts->queue)){
    77           set_transient('picturefill_wp_' . $content_type . '_output_' . $post_id . '_p' . $page, $output, $cache_duration);
     73        if($output !== $html){
     74          set_transient('picturefill_wp _output_' . $html_hash, $output, $cache_duration);
    7875        }
    7976        return $output;
  • picturefillwp/trunk/picturefill-wp.php

    r888529 r928294  
    66Description: A wordpress plugin to load responsive/retina images via picturefill.js.
    77Author: Kyle Reicks
    8 Version: 1.3.2
     8Version: 1.3.3
    99Author URI: http://github.com/kylereicks/
    1010*/
     
    1212define('PICTUREFILL_WP_PATH', plugin_dir_path(__FILE__));
    1313define('PICTUREFILL_WP_URL', plugins_url('/', __FILE__));
    14 define('PICTUREFILL_WP_VERSION', '1.3.2');
     14define('PICTUREFILL_WP_VERSION', '1.3.3');
    1515
    1616require_once(PICTUREFILL_WP_PATH . 'inc/class-picturefill-wp.php');
  • picturefillwp/trunk/readme.txt

    r888529 r928294  
    44Tags: images, retina, retina images, responsive images, picturefill, picturefillJS, picturefill.js, HDPI, High DPI
    55Requires at least: 3.2
    6 Tested up to: 3.9
    7 Stable tag: 1.3.2
     6Tested up to: 3.9.1
     7Stable tag: 1.3.3
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    2525If you are installing Picturefill.WP on a large and image heavy site, you may want to consider using another plugin like [Regenerate Thumbnails](http://wordpress.org/plugins/regenerate-thumbnails/) to create the new image sizes for existing posts and pages.
    2626
     27####500 or 504 server errors
     28
     29These errors are related to the slow loading listed above. If the server reaches its timeout limit before it is finished processing new images, it will return a 500 or 504 error. Refreshing the page usually gives the server the time it needs to finish processing the images. On some image-heavy posts, it may take more than one refresh.
     30
    2731####Image Sizes
    2832
     
    3539####Errors and Warnings
    3640
    37 When using Picturefill.WP with your website, you may occasionally notice a warning very much like the following:
    38 
    39     [Mon Jan 01 12:00:00 2000] [error] [client 999.999.99.99] PHP Warning: DOMDocument::loadHTML() [domdocument.loadhtml]: Unexpected end tag : a in Entity, line: 17 in /server/www/wp-content/plugins/picturefill/inc/class-model-picturefill-wp.php on line 20
    40 
    41 This error indicates improperly formed HTML. In this case, the `Unexpected end tag : a` comes from nested links. If you are seeing errors like this on your WordPress site, you may want to consider implementing an [error logging](http://codex.wordpress.org/Editing_wp-config.php#Configure_Error_Logging) system, or alternatively suppressing errors by adding `error_reporting(0);` and `@ini_set('display_errors', 0);` to `wp-config.php`.
    42 
    43 Additionally, the PHP DOM parser `DOMDocument` often has trouble with HTML5 elements and may throw an error if your post includes a `<canvas>` element, or a `<section>` element, for example. All the more reason to implement an error handling system on production sites.
     41As of version 1.3.3 Picturefill.WP suppresses errors and warnings in parsing the DOM. Errors and warnings can now be collected via the `picturefill_wp_syntax_present_libxml_errors` and `picturefill_wp_get_images_libxml_errors` filters.
     42
     43    add_filter('picturefill_wp_get_images_libxml_errors', 'handle_errors');
     44
     45    function handle_errors($errors){
     46      foreach($errors as $error){
     47        // Handle errors here.
     48      }
     49    }
    4450
    4551####Theme CSS
     
    116122The standard version of [picturefill.js](https://github.com/scottjehl/picturefill) will work well enough with Picturefill.WP; however, Picturefill.WP has a slightly diferent goal than picturefill.js. Picturefill.js aims to pollyfill the proposed `<picture>` element. It expects a special `<picture>` like markup, and outputs the appropriate `<img>`, but the resulting `<img>` does not include a class, id or other attribute. The generated `<img>` tags can only be targeted by the attributes of its parent elements. Picturefill.WP aims to take an `<img>` and then output an `<img>` exactly like it, apart form the width or pixel density. This way, `<img>` tags can be targeted without regard to the `<picture>` syntax.
    117123
    118 = Is the picture element really the direction responsive images are heading? =
    119 
    120 The debate over what to do about responsive images has been long and vigorous, but the `picture` element is happening. The major browsers have anounced that they will be adding support in the very near future. The future of this plugin will depend on what that support looks like, both in the browser and in the WordPress core. Picturefill.WP was never intended to be a permanent solution for responsive images. One day soon, it may be completely unnecessary. In the mean time, Picturefill.WP provides a serviceable solution that can be turned off at any time. Once deactivated, all images return to normal, as though the plugin had never been used.
     124= Are there any plans to update this plugin to Picturefill 2.0 =
     125
     126A new version of Picturefill.WP using Picturefill 2.x is in the works. Because of significant diferences between Picturefill 1.x and Picturefill 2.x, the new Picturefill.WP 2 will be maintained alongside the original Picteufill.WP 1.3.x. I will update this plugin with more details as they become available.
     127
    121128
    122129== Advanced Use ==
     
    137144
    138145== Changelog ==
     146
     147= 1.3.3 =
     148* [Suppress warnings](https://github.com/kylereicks/picturefill.js.wp/issues/29) from DOM parsing
     149* [Update transient caching](https://github.com/kylereicks/picturefill.js.wp/issues/31) to use a hash as an identifier.
    139150
    140151= 1.3.1 =
     
    196207== Upgrade Notice ==
    197208
    198 = 1.3.2 =
    199 Corrects an issue with IE7 and below, and enqueues picturefill.js when manual picturefill syntax is present.
     209= 1.3.3 =
     210[Suppress warnings](https://github.com/kylereicks/picturefill.js.wp/issues/29) from DOM parsing and [update transient caching](https://github.com/kylereicks/picturefill.js.wp/issues/31) to use a hash as an identifier.
Note: See TracChangeset for help on using the changeset viewer.