Skip to content

Commit

Permalink
Merge pull request #31 from threadi/feature/updateCompatibilityForWp66
Browse files Browse the repository at this point in the history
update compatibility for WordPress 6.6 & fixed potential error on att…
  • Loading branch information
threadi authored Jul 5, 2024
2 parents 5cd6f64 + a7902d4 commit eb0ee8d
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 8 deletions.
4 changes: 2 additions & 2 deletions classes/eml/Controller/class-external-files.php
Original file line number Diff line number Diff line change
Expand Up @@ -709,7 +709,7 @@ public function get_file_by_url( string $url ): ?External_File {
$result = new WP_Query( $query );
if ( 1 === $result->post_count ) {
$external_file_obj = $this->get_file( $result->posts[0] );
if ( $external_file_obj->is_valid() ) {
if ( $external_file_obj && $external_file_obj->is_valid() ) {
return $external_file_obj;
}
}
Expand Down Expand Up @@ -742,7 +742,7 @@ public function get_file_by_title( string $title ): bool|External_File {
$result = new WP_Query( $query );
if ( 1 === $result->post_count ) {
$external_file_obj = $this->get_file( $result->posts[0] );
if ( $external_file_obj->is_valid() ) {
if ( $external_file_obj && $external_file_obj->is_valid() ) {
return $external_file_obj;
}
}
Expand Down
11 changes: 7 additions & 4 deletions classes/eml/Controller/class-init.php
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,8 @@ public function image_downsize( array|bool $result, int $attachment_id ): bool|a

// check if the file is an external file, an image and if it is really external hosted.
if (
$external_file_obj->is_valid()
$external_file_obj
&& $external_file_obj->is_valid()
&& false === $external_file_obj->is_locally_saved()
&& $external_file_obj->is_image()
) {
Expand Down Expand Up @@ -324,7 +325,8 @@ public function wp_calculate_image_srcset( array $sources, array $size_array, st

// check if the file is an external file, an image and if it is really external hosted.
if (
$external_file_obj->is_valid()
$external_file_obj
&& $external_file_obj->is_valid()
&& false === $external_file_obj->is_locally_saved()
&& $external_file_obj->is_image()
) {
Expand All @@ -349,7 +351,8 @@ public function prevent_external_attachment_in_export( array $value, array $para

// check if the file is an external file, an image and if it is really external hosted.
if (
$external_file_obj->is_valid()
$external_file_obj
&& $external_file_obj->is_valid()
&& false === $external_file_obj->is_locally_saved()
&& $external_file_obj->is_image()
) {
Expand Down Expand Up @@ -424,7 +427,7 @@ public function wp_get_attachment_metadata( array $data, int $attachment_id ): a
$external_file_obj = $this->external_files_obj->get_file( $attachment_id );

// check if the file is an external file.
if ( $external_file_obj->is_valid() ) {
if ( $external_file_obj && $external_file_obj->is_valid() ) {
$data['file'] = get_permalink( $attachment_id );
}
return $data;
Expand Down
9 changes: 7 additions & 2 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
Contributors: threadi
Tags: external files, media library, media
Requires at least: 6.2
Tested up to: 6.5.3
Tested up to: 6.6
Requires PHP: 8.0
License: GPL-2.0-or-later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Stable tag: 1.2.1
Stable tag: 1.2.2

Add external files to your media library to link or embed them in your website. They will be integrated as if they were locally available.

Expand Down Expand Up @@ -88,3 +88,8 @@ No, only public files can be used.
* Added support for hook of plugin "Download List Block with Icons" for mark external files with rel-external
* Updated compatibility-flag for WordPress 6.5.3
* Updated dependencies

= 1.2.2 =
* Updated compatibility-flag for WordPress 6.6
* Updated dependencies
* Fixed potential error on attachment pages

0 comments on commit eb0ee8d

Please sign in to comment.