From 6e3affeca15aa578ecb15035c2538b7a3e45df43 Mon Sep 17 00:00:00 2001 From: Thomas Zwirner Date: Sun, 10 Nov 2024 16:07:43 +0100 Subject: [PATCH 1/3] fixed typoes --- app/ExternalFiles/Files.php | 2 +- app/ExternalFiles/Forms.php | 2 +- app/ExternalFiles/Protocols/Http.php | 2 +- app/ExternalFiles/Proxy.php | 2 +- app/ExternalFiles/Queue.php | 4 ++-- app/Plugin/Settings.php | 2 +- readme.txt | 5 ++++- 7 files changed, 11 insertions(+), 8 deletions(-) diff --git a/app/ExternalFiles/Files.php b/app/ExternalFiles/Files.php index b38f97f..57ed2b4 100644 --- a/app/ExternalFiles/Files.php +++ b/app/ExternalFiles/Files.php @@ -387,7 +387,7 @@ public function add_url( string $url, bool $add_to_queue = false ): bool { // bail if file is given, but has an error. if ( ! empty( $file_data['tmp-file'] ) && is_wp_error( $file_data['tmp-file'] ) ) { /* translators: %1$s will be replaced by an error-code. */ - $log->create( sprintf( __( 'Given URL results in error during request:
%1$s
', 'external-files-in-media-library' ), wp_json_encode( $file_data['tmp-file'] ) ), esc_url( $url ), 'error', 0 ); + $log->create( sprintf( __( 'Given URL results in error during request: %1$s', 'external-files-in-media-library' ), '' . wp_json_encode( $file_data['tmp-file'] ) . '' ), esc_url( $url ), 'error', 0 ); // show progress. $progress ? $progress->tick() : ''; diff --git a/app/ExternalFiles/Forms.php b/app/ExternalFiles/Forms.php index fcce2f9..2955e15 100644 --- a/app/ExternalFiles/Forms.php +++ b/app/ExternalFiles/Forms.php @@ -679,7 +679,7 @@ private function get_fields( bool $single = false ): array { } // add credentials fields. - $fields[] = '
' . __( 'Add credentials to access this URL', 'external-files-in-media-library' ) . '

' . __( 'Hint:', 'external-files-in-media-library' ) . ' ' . __( 'files with credentials will be saved locally.', 'external-files-in-media-library' ) . '

'; + $fields[] = '
' . __( 'Add credentials to access this URL', 'external-files-in-media-library' ) . '

' . __( 'Hint:', 'external-files-in-media-library' ) . ' ' . __( 'Files with credentials will be saved locally.', 'external-files-in-media-library' ) . '

'; /** * Filter the fields for the dialog. diff --git a/app/ExternalFiles/Protocols/Http.php b/app/ExternalFiles/Protocols/Http.php index d7e1c8b..11be0c4 100644 --- a/app/ExternalFiles/Protocols/Http.php +++ b/app/ExternalFiles/Protocols/Http.php @@ -53,7 +53,7 @@ public function check_url( string $url ): bool { if ( false === filter_var( $url, FILTER_VALIDATE_URL ) ) { // log event. /* translators: %1$s will be replaced by the file-URL */ - Log::get_instance()->create( sprintf( __( 'Given string %1$s is not a valid url.', 'external-files-in-media-library' ), esc_html( $url ) ), esc_html( $url ), 'error', 0 ); + Log::get_instance()->create( sprintf( __( 'Given string %1$s is not a valid URL.', 'external-files-in-media-library' ), esc_html( $url ) ), esc_html( $url ), 'error', 0 ); // return that given string is not a valid URL. return false; diff --git a/app/ExternalFiles/Proxy.php b/app/ExternalFiles/Proxy.php index b95e1b7..4358905 100644 --- a/app/ExternalFiles/Proxy.php +++ b/app/ExternalFiles/Proxy.php @@ -153,7 +153,7 @@ public function run( string $template ): string { if ( false === $external_file_obj || ( $external_file_obj && false === $external_file_obj->is_valid() ) ) { // log this event. /* translators: %1$s will be replaced by the detected filename. */ - Log::get_instance()->create( sprintf( __( 'Proxy could not load load the filename %1$s as external file.', 'external-files-in-media-library' ), '' . $title . '' ), '', 'info', 2 ); + Log::get_instance()->create( sprintf( __( 'Proxy could not load the filename %1$s as external file.', 'external-files-in-media-library' ), '' . $title . '' ), '', 'info', 2 ); // fallback to 404. return $template; diff --git a/app/ExternalFiles/Queue.php b/app/ExternalFiles/Queue.php index 247bc3a..480a5ca 100644 --- a/app/ExternalFiles/Queue.php +++ b/app/ExternalFiles/Queue.php @@ -312,7 +312,7 @@ public function process_queue(): void { // log event. /* translators: %1$d will be replaced by a number. */ - Log::get_instance()->create( sprintf( _n( 'Processing the import of %1$d URL from queue ended.', 'Processing the import of %1$d URLs from queue.', count( $urls_to_import ), 'external-files-in-media-library' ), count( $urls_to_import ) ), '', 'info', 2 ); + Log::get_instance()->create( sprintf( _n( 'Processing the import of %1$d URL from queue ended.', 'Processing the import of %1$d URLs from queue ended.', count( $urls_to_import ), 'external-files-in-media-library' ), count( $urls_to_import ) ), '', 'info', 2 ); } /** @@ -627,7 +627,7 @@ private function db_error_handling( \mysqli_result|bool|int|null $result, string // log this event. /* translators: %1$s is replaced by an error-code. */ - Log::get_instance()->create( sprintf( __( 'Database-Error: %1$s', 'external-files-in-media-library' ), wp_json_encode( $wpdb->last_error ) ), $url, 'error', 0 ); + Log::get_instance()->create( sprintf( __( 'Database-Error: %1$s', 'external-files-in-media-library' ), '' . wp_json_encode( $wpdb->last_error ) . '' ), $url, 'error', 0 ); } /** diff --git a/app/Plugin/Settings.php b/app/Plugin/Settings.php index 7983e72..69bcfb6 100644 --- a/app/Plugin/Settings.php +++ b/app/Plugin/Settings.php @@ -298,7 +298,7 @@ public function add_settings(): void { $setting->set_field( array( 'type' => 'Checkbox', - 'title' => __( 'Switch external files to local hosting during uninstallation', 'external-files-in-media-library' ), + 'title' => __( 'Switch external files to local hosting during uninstallation', 'external-files-in-media-library' ), 'description' => __( 'If this option is enabled all external files will be saved local during uninstallation of this plugin.', 'external-files-in-media-library' ), ) ); diff --git a/readme.txt b/readme.txt index 634d06b..5bcfb50 100644 --- a/readme.txt +++ b/readme.txt @@ -6,7 +6,7 @@ Tested up to: 6.7 Requires PHP: 8.0 License: GPL-2.0-or-later License URI: https://www.gnu.org/licenses/gpl-2.0.html -Stable tag: 2.0.0 +Stable tag: 2.0.1 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. @@ -192,3 +192,6 @@ Yes, there are many options on WP CLI, see [our documentation](https://github.co * Move support for already supported plugins in new wrapper * Fixed some typos * Fixed error with import of multiple files via WP CLI + += 2.0.1 = +* Small optimizations on texts for better translations From 664c574b3287455560aa49de1176cac447c50762 Mon Sep 17 00:00:00 2001 From: Thomas Zwirner Date: Sun, 10 Nov 2024 16:32:00 +0100 Subject: [PATCH 2/3] fixed update handler for WP 6.7 --- app/Plugin/Uninstall.php | 1 + app/Plugin/Update.php | 12 +----------- readme.txt | 1 + 3 files changed, 3 insertions(+), 11 deletions(-) diff --git a/app/Plugin/Uninstall.php b/app/Plugin/Uninstall.php index 465ca25..45d1f7d 100644 --- a/app/Plugin/Uninstall.php +++ b/app/Plugin/Uninstall.php @@ -116,6 +116,7 @@ public function run(): void { 'eml_import_title', 'eml_import_errors', 'eml_transients', + 'efmlVersion', ); foreach ( $options as $option ) { delete_option( $option ); diff --git a/app/Plugin/Update.php b/app/Plugin/Update.php index 47b1fa4..3920c17 100644 --- a/app/Plugin/Update.php +++ b/app/Plugin/Update.php @@ -49,17 +49,7 @@ public static function get_instance(): Update { * @return void */ public function init(): void { - add_action( 'plugins_loaded', array( $this, 'run' ) ); - } - - /** - * Wrapper to run all version-specific updates, which are in this class. - * - * @return void - */ - public static function run_all_updates(): void { - $obj = self::get_instance(); - $obj->version200(); + add_action( 'init', array( $this, 'run' ) ); } /** diff --git a/readme.txt b/readme.txt index 5bcfb50..60dfa8e 100644 --- a/readme.txt +++ b/readme.txt @@ -195,3 +195,4 @@ Yes, there are many options on WP CLI, see [our documentation](https://github.co = 2.0.1 = * Small optimizations on texts for better translations +* Fixed update handler for WordPress 6.7 From 7b5a07a0e7e3bf44d434ae83ec03952bde3adf9c Mon Sep 17 00:00:00 2001 From: Thomas Zwirner Date: Sun, 10 Nov 2024 16:51:45 +0100 Subject: [PATCH 3/3] fixed set capabilities for playground --- assets/blueprints/blueprint.json | 4 ++++ readme.txt | 1 + 2 files changed, 5 insertions(+) diff --git a/assets/blueprints/blueprint.json b/assets/blueprints/blueprint.json index 76c3c6f..5ec670c 100644 --- a/assets/blueprints/blueprint.json +++ b/assets/blueprints/blueprint.json @@ -21,6 +21,10 @@ "activate": true } }, + { + "step": "runPHP", + "code": "