Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
Franz Josef Kaiser committed Oct 19, 2015
2 parents b46a4be + 351d4d0 commit ad4ed4d
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/Services/AvatarMIMELimitService.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class AvatarMIMELimitService implements ServiceInterface
private $allowed;

/** @var array */
private $where;
private $where = [ ];


/**
Expand All @@ -48,17 +48,22 @@ public function __construct( $cap = '', Array $allowed = [ ], Array $where = [ ]
* @link http://www.iana.org/assignments/media-types/media-types.xhtml
* To implement WebP, use 'webp'
* @param array $mimes
* @param int|\WP_User|null $user User ID, User object or null
* if not provided (indicates current user).
* @return array
*/
public function setup( Array $mimes = [ ] )
public function setup( Array $mimes = [ ], $user = null )
{
$mimes['webp'] = 'image/webp';

if (
empty( $this->where )
or current_user_can( $this->cap )
or is_admin()
&& ! in_array( get_current_screen()->base, $this->where )
or ( defined( 'DOING_CRON' ) and DOING_CRON )
or (
is_admin()
&& ! in_array( get_current_screen()->base, $this->where )
)
)
return $mimes;

Expand Down

0 comments on commit ad4ed4d

Please sign in to comment.