Skip to content

Commit

Permalink
add onerror support for srcset
Browse files Browse the repository at this point in the history
  • Loading branch information
pfefferle committed Jan 31, 2022
1 parent 8c58e94 commit 8c46266
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 6 deletions.
2 changes: 1 addition & 1 deletion includes/class-webmention-avatar-handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ public static function avatar_stored_in_comment( $args, $comment ) {
}

// Simple method to prevent broken images
$args['extra_attr'] .= sprintf( ' onerror="this.onerror=null;this.src=\'%s\';"', self::get_default_avatar() );
$args['extra_attr'] .= sprintf( ' onerror="this.onerror=null;this.src=\'%1$s\';this.srcset=\'%1$s\';"', self::get_default_avatar() );

// If another filter has already provided a url
if ( isset( $args['url'] ) && wp_http_validate_url( $args['url'] ) ) {
Expand Down
4 changes: 2 additions & 2 deletions languages/webmention.pot
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
# This file is distributed under the MIT.
msgid ""
msgstr ""
"Project-Id-Version: Webmention 4.0.7\n"
"Project-Id-Version: Webmention 4.0.8\n"
"Report-Msgid-Bugs-To: "
"https://wordpress.org/support/plugin/wordpress-webmention\n"
"POT-Creation-Date: 2022-01-31 12:38:31+00:00\n"
"POT-Creation-Date: 2022-01-31 17:01:43+00:00\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
Expand Down
6 changes: 5 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
**Tags:** webmention, pingback, trackback, linkback, indieweb, comment, response
**Requires at least:** 4.9
**Tested up to:** 5.9
**Stable tag:** 4.0.7
**Stable tag:** 4.0.8
**Requires PHP:** 5.6
**License:** MIT
**License URI:** https://opensource.org/licenses/MIT
Expand Down Expand Up @@ -91,6 +91,10 @@ Webmention headers are only shown if webmentions are available for that particul

Project and support maintained on github at [pfefferle/wordpress-webmention](https://github.com/pfefferle/wordpress-webmention).

### 4.0.8 ###

* Add `onerror` handling also for `srcset` ( props @florianbrinkmann for testing )

### 4.0.7 ###

* Re-add `onerror` handling for broken images ( props @snarfed )
Expand Down
6 changes: 5 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Donate link: https://notiz.blog/donate/
Tags: webmention, pingback, trackback, linkback, indieweb, comment, response
Requires at least: 4.9
Tested up to: 5.9
Stable tag: 4.0.7
Stable tag: 4.0.8
Requires PHP: 5.6
License: MIT
License URI: https://opensource.org/licenses/MIT
Expand Down Expand Up @@ -91,6 +91,10 @@ Webmention headers are only shown if webmentions are available for that particul

Project and support maintained on github at [pfefferle/wordpress-webmention](https://github.com/pfefferle/wordpress-webmention).

= 4.0.8 =

* Add `onerror` handling also for `srcset` ( props @florianbrinkmann for testing )

= 4.0.7 =

* Re-add `onerror` handling for broken images ( props @snarfed )
Expand Down
2 changes: 1 addition & 1 deletion webmention.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Description: Webmention support for WordPress posts
* Author: Matthias Pfefferle
* Author URI: https://notiz.blog/
* Version: 4.0.7
* Version: 4.0.8
* License: MIT
* License URI: https://opensource.org/licenses/MIT
* Text Domain: webmention
Expand Down

0 comments on commit 8c46266

Please sign in to comment.