<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[BuddyPress][13315] trunk: Media: add support for the `.webp` image file type</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { white-space: pre-line; overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="http://buddypress.trac.wordpress.org/changeset/13315">13315</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"http://buddypress.trac.wordpress.org/changeset/13315","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>imath</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2022-08-13 12:16:46 +0000 (Sat, 13 Aug 2022)</dd>
</dl>
<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>Media: add support for the `.webp` image file type
NB: this support will only be available when the community site uses WP >= 5.8.
Props dcavins
Fixes <a href="http://buddypress.trac.wordpress.org/ticket/8643">#8643</a></pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcbpcorebpcoreattachmentsphp">trunk/src/bp-core/bp-core-attachments.php</a></li>
<li><a href="#trunksrcbpcoreclassesclassbpattachmentavatarphp">trunk/src/bp-core/classes/class-bp-attachment-avatar.php</a></li>
<li><a href="#trunksrcbpcoreclassesclassbpattachmentcoverimagephp">trunk/src/bp-core/classes/class-bp-attachment-cover-image.php</a></li>
<li><a href="#trunksrcbpcoreclassesclassbpattachmentphp">trunk/src/bp-core/classes/class-bp-attachment.php</a></li>
<li><a href="#trunksrcbpcorejsbppluploadjs">trunk/src/bp-core/js/bp-plupload.js</a></li>
<li><a href="#trunktestsphpunittestcasescoreavatarsphp">trunk/tests/phpunit/testcases/core/avatars.php</a></li>
<li><a href="#trunktestsphpunittestcasescorefunctionsphp">trunk/tests/phpunit/testcases/core/functions.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcbpcorebpcoreattachmentsphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/bp-core/bp-core-attachments.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/bp-core/bp-core-attachments.php 2022-08-13 08:58:51 UTC (rev 13314)
+++ trunk/src/bp-core/bp-core-attachments.php 2022-08-13 12:16:46 UTC (rev 13315)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -156,6 +156,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * Get allowed types for any attachment.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 2.4.0
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @since 11.0.0 Adds the support for .webp images to Avatars and Cover images.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @param string $type The extension types to get.
</span><span class="cx" style="display: block; padding: 0 10px"> * Default: 'avatar'.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -163,16 +164,16 @@
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function bp_attachments_get_allowed_types( $type = 'avatar' ) {
</span><span class="cx" style="display: block; padding: 0 10px"> // Defaults to BuddyPress supported image extensions.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $exts = array( 'jpeg', 'gif', 'png' );
- $wp_exts = wp_get_ext_types();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $exts = array( 'jpg', 'jpeg', 'jpe', 'gif', 'png' );
+ if ( bp_is_running_wp( '5.8.0', '>=' ) ) {
+ $exts[] = 'webp';
+ }
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- /**
- * It's not a BuddyPress feature, get the allowed extensions
- * matching the $type requested.
- */
- if ( 'avatar' !== $type && 'cover_image' !== $type ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Avatar and cover image are images.
+ if ( 'image' !== $type && 'avatar' !== $type && 'cover_image' !== $type ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> // Reset the default exts.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $exts = array();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $exts = array();
+ $wp_exts = wp_get_ext_types();
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( 'video' === $type ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $exts = wp_get_video_extensions();
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -689,6 +690,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 'dismiss' => __( 'Dismiss', 'buddypress' ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'crunching' => __( 'Crunching…', 'buddypress' ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'unique_file_warning' => __( 'Make sure to upload a unique file', 'buddypress' ),
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'noneditable_image' => __( 'This image cannot be processed by the web server. Convert it to JPEG or PNG before uploading.', 'buddypress' ),
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /* translators: %s: File name. */
</span><span class="cx" style="display: block; padding: 0 10px"> 'error_uploading' => __( '“%s” has failed to upload.', 'buddypress' ),
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -779,6 +781,15 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $defaults['filters']['max_file_size'] = $args['max_file_size'] . 'b';
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( isset( $args['mime_types'] ) && $args['mime_types'] ) {
+ $defaults['filters']['mime_types'] = array( array( 'extensions' => $args['mime_types'] ) );
+ }
+
+ // Check if WebP images can be edited.
+ if ( bp_is_running_wp( '5.8.0', '>=' ) && ! wp_image_editor_supports( array( 'mime_type' => 'image/webp' ) ) ) {
+ $defaults['webp_upload_error'] = true;
+ }
+
</ins><span class="cx" style="display: block; padding: 0 10px"> // Specific to BuddyPress Avatars.
</span><span class="cx" style="display: block; padding: 0 10px"> if ( 'bp_avatar_upload' === $defaults['multipart_params']['action'] ) {
</span><span class="cx" style="display: block; padding: 0 10px">
</span></span></pre></div>
<a id="trunksrcbpcoreclassesclassbpattachmentavatarphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/bp-core/classes/class-bp-attachment-avatar.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/bp-core/classes/class-bp-attachment-avatar.php 2022-08-13 08:58:51 UTC (rev 13314)
+++ trunk/src/bp-core/classes/class-bp-attachment-avatar.php 2022-08-13 12:16:46 UTC (rev 13315)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -399,6 +399,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> // Get default script data.
</span><span class="cx" style="display: block; padding: 0 10px"> $script_data = parent::script_data();
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Adds the list of supported image types.
+ $script_data['mime_types'] = implode( ',', bp_core_get_allowed_avatar_types() );
+
</ins><span class="cx" style="display: block; padding: 0 10px"> // Defaults to Avatar Backbone script.
</span><span class="cx" style="display: block; padding: 0 10px"> $js_scripts = array( 'bp-avatar' );
</span><span class="cx" style="display: block; padding: 0 10px">
</span></span></pre></div>
<a id="trunksrcbpcoreclassesclassbpattachmentcoverimagephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/bp-core/classes/class-bp-attachment-cover-image.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/bp-core/classes/class-bp-attachment-cover-image.php 2022-08-13 08:58:51 UTC (rev 13314)
+++ trunk/src/bp-core/classes/class-bp-attachment-cover-image.php 2022-08-13 12:16:46 UTC (rev 13315)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -196,6 +196,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> // Get default script data.
</span><span class="cx" style="display: block; padding: 0 10px"> $script_data = parent::script_data();
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Adds the list of supported image types.
+ $script_data['mime_types'] = implode( ',', bp_attachments_get_allowed_types( 'cover_image' ) );
+
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( bp_is_user() ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $item_id = bp_displayed_user_id();
</span><span class="cx" style="display: block; padding: 0 10px">
</span></span></pre></div>
<a id="trunksrcbpcoreclassesclassbpattachmentphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/bp-core/classes/class-bp-attachment.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/bp-core/classes/class-bp-attachment.php 2022-08-13 08:58:51 UTC (rev 13314)
+++ trunk/src/bp-core/classes/class-bp-attachment.php 2022-08-13 12:16:46 UTC (rev 13315)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -493,17 +493,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $check_types['dst_file'] = array( 'file' => $r['dst_file'], 'error' => _x( 'destination file', 'Attachment destination file', 'buddypress' ) );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- /**
- * WordPress image supported types.
- * @see wp_attachment_is()
- */
- $supported_image_types = array(
- 'jpg' => 1,
- 'jpeg' => 1,
- 'jpe' => 1,
- 'gif' => 1,
- 'png' => 1,
- );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Set supported image types.
+ $supported_image_types = array_fill_keys( bp_attachments_get_allowed_types( 'image' ), 1 );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> foreach ( $check_types as $file ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $is_image = wp_check_filetype( $file['file'] );
</span></span></pre></div>
<a id="trunksrcbpcorejsbppluploadjs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/bp-core/js/bp-plupload.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/bp-core/js/bp-plupload.js 2022-08-13 08:58:51 UTC (rev 13314)
+++ trunk/src/bp-core/js/bp-plupload.js 2022-08-13 12:16:46 UTC (rev 13315)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -162,6 +162,13 @@
</span><span class="cx" style="display: block; padding: 0 10px"> return;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( file.type === 'image/webp' && uploader.settings.webp_upload_error ) {
+ // Disallow uploading of WebP images if the server cannot edit them.
+ $( self ).trigger( 'bp-uploader-warning', self.strings.noneditable_image );
+ uploader.removeFile( file );
+ return;
+ }
+
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( max > hundredmb && file.size > hundredmb && uploader.runtime !== 'html5' ) {
</span><span class="cx" style="display: block; padding: 0 10px"> _this.uploadSizeError( uploader, file, true );
</span><span class="cx" style="display: block; padding: 0 10px"> } else {
</span></span></pre></div>
<a id="trunktestsphpunittestcasescoreavatarsphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/testcases/core/avatars.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/testcases/core/avatars.php 2022-08-13 08:58:51 UTC (rev 13314)
+++ trunk/tests/phpunit/testcases/core/avatars.php 2022-08-13 12:16:46 UTC (rev 13315)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -257,19 +257,19 @@
</span><span class="cx" style="display: block; padding: 0 10px"> public function test_bp_core_get_allowed_avatar_types_filter() {
</span><span class="cx" style="display: block; padding: 0 10px"> add_filter( 'bp_core_get_allowed_avatar_types', array( $this, 'avatar_types_filter_add_type' ) );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $this->assertEquals( array( 'jpeg', 'gif', 'png' ), bp_core_get_allowed_avatar_types() );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $this->assertEquals( array( 'jpg', 'jpeg', 'jpe', 'gif', 'png', 'webp' ), bp_core_get_allowed_avatar_types() );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> remove_filter( 'bp_core_get_allowed_avatar_types', array( $this, 'avatar_types_filter_add_type' ) );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> add_filter( 'bp_core_get_allowed_avatar_types', array( $this, 'avatar_types_filter_remove_type' ) );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $this->assertEquals( array( 'gif', 'png' ), bp_core_get_allowed_avatar_types() );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $this->assertEquals( array( 'jpeg', 'jpe', 'gif', 'png', 'webp' ), bp_core_get_allowed_avatar_types() );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> remove_filter( 'bp_core_get_allowed_avatar_types', array( $this, 'avatar_types_filter_remove_type' ) );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> add_filter( 'bp_core_get_allowed_avatar_types', '__return_empty_array' );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $this->assertEquals( array( 'jpeg', 'gif', 'png' ), bp_core_get_allowed_avatar_types() );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $this->assertEquals( array( 'jpg', 'jpeg', 'jpe', 'gif', 'png', 'webp' ), bp_core_get_allowed_avatar_types() );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> remove_filter( 'bp_core_get_allowed_avatar_types', '__return_empty_array' );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -281,24 +281,24 @@
</span><span class="cx" style="display: block; padding: 0 10px"> public function test_bp_core_get_allowed_avatar_mimes() {
</span><span class="cx" style="display: block; padding: 0 10px"> $mimes = bp_core_get_allowed_avatar_mimes();
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $this->assertEqualSets( array( 'jpeg', 'gif', 'png', 'jpg' ), array_keys( $mimes ) );
- $this->assertEqualSets( array( 'image/jpeg', 'image/gif', 'image/png', 'image/jpeg' ), array_values( $mimes ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $this->assertEqualSets( array( 'jpg', 'jpeg', 'jpe', 'gif', 'png', 'webp' ), array_keys( $mimes ) );
+ $this->assertEqualSets( array( 'image/jpeg', 'image/jpeg', 'image/jpeg', 'image/gif', 'image/png', 'image/webp' ), array_values( $mimes ) );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> add_filter( 'bp_core_get_allowed_avatar_types', array( $this, 'avatar_types_filter_add_type' ) );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $this->assertEqualSets( array( 'image/jpeg', 'image/gif', 'image/png', 'image/jpeg' ), array_values( bp_core_get_allowed_avatar_mimes() ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $this->assertEqualSets( array( 'image/jpeg', 'image/jpeg', 'image/jpeg', 'image/gif', 'image/png', 'image/webp' ), array_values( bp_core_get_allowed_avatar_mimes() ) );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> remove_filter( 'bp_core_get_allowed_avatar_types', array( $this, 'avatar_types_filter_add_type' ) );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> add_filter( 'bp_core_get_allowed_avatar_types', array( $this, 'avatar_types_filter_remove_type' ) );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $this->assertEqualSets( array( 'image/gif', 'image/png' ), array_values( bp_core_get_allowed_avatar_mimes() ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $this->assertEqualSets( array( 'image/jpeg', 'image/jpeg', 'image/gif', 'image/png', 'image/webp', 'image/jpeg' ), array_values( bp_core_get_allowed_avatar_mimes() ) );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> remove_filter( 'bp_core_get_allowed_avatar_types', array( $this, 'avatar_types_filter_remove_type' ) );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> add_filter( 'bp_core_get_allowed_avatar_types', '__return_empty_array' );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $this->assertEqualSets( array( 'image/jpeg', 'image/gif', 'image/png', 'image/jpeg' ), array_values( bp_core_get_allowed_avatar_mimes() ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $this->assertEqualSets( array( 'image/jpeg', 'image/jpeg', 'image/jpeg', 'image/gif', 'image/png', 'image/webp' ), array_values( bp_core_get_allowed_avatar_mimes() ) );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> remove_filter( 'bp_core_get_allowed_avatar_types', '__return_empty_array' );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre></div>
<a id="trunktestsphpunittestcasescorefunctionsphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/testcases/core/functions.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/testcases/core/functions.php 2022-08-13 08:58:51 UTC (rev 13314)
+++ trunk/tests/phpunit/testcases/core/functions.php 2022-08-13 12:16:46 UTC (rev 13315)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -784,7 +784,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @group bp_attachments
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function test_bp_attachments_get_allowed_types() {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $supported = array( 'jpeg', 'gif', 'png' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $supported = array( 'jpg', 'jpeg', 'jpe', 'gif', 'png', 'webp' );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $avatar = bp_attachments_get_allowed_types( 'avatar' );
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertSame( $supported, $avatar );
</span></span></pre>
</div>
</div>
</body>
</html>