Skip to content

Commit

Permalink
Merge pull request #6 from threadi/fix/errorOnValidateNumbers
Browse files Browse the repository at this point in the history
Fix/error on validate numbers
  • Loading branch information
threadi authored Oct 21, 2023
2 parents 737c45f + 4fb933c commit ed1f852
Show file tree
Hide file tree
Showing 15 changed files with 41 additions and 31 deletions.
1 change: 0 additions & 1 deletion classes/eml/Controller/class-cli.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,5 +135,4 @@ public function reset_plugin(): void {
// return ok-message.
\WP_CLI::success( 'Plugin has been reset.' );
}

}
1 change: 0 additions & 1 deletion classes/eml/Controller/class-external-files.php
Original file line number Diff line number Diff line change
Expand Up @@ -736,5 +736,4 @@ public function delete_file_from_cache( int $attachment_id ): void {
// call cache file deletion.
$external_file->delete_cache();
}

}
2 changes: 1 addition & 1 deletion classes/eml/Controller/class-init.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public function init(): void {
// misc.
add_action(
'cli_init',
function() {
function () {
\WP_CLI::add_command( 'eml', 'threadi\eml\Controller\Cli' );
}
);
Expand Down
3 changes: 1 addition & 2 deletions classes/eml/Model/class-external-file.php
Original file line number Diff line number Diff line change
Expand Up @@ -433,8 +433,7 @@ public function get_cached_file_content(): string {
*/
public function delete_cache(): void {
if ( $this->is_cached() ) {
unlink( $this->get_cache_file() );
wp_delete_file( $this->get_cache_file() );
}
}

}
2 changes: 1 addition & 1 deletion classes/eml/class-helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ public static function delete_directory_recursively( string $dir ): void {
if ( is_dir( $dir . DIRECTORY_SEPARATOR . $object ) && ! is_link( $dir . '/' . $object ) ) {
self::delete_directory_recursively( $dir . DIRECTORY_SEPARATOR . $object );
} else {
unlink( $dir . DIRECTORY_SEPARATOR . $object );
wp_delete_file( $dir . DIRECTORY_SEPARATOR . $object );
}
}
}
Expand Down
1 change: 0 additions & 1 deletion classes/eml/class-transients.php
Original file line number Diff line number Diff line change
Expand Up @@ -164,5 +164,4 @@ public function check_transients(): void {
public function get_transient_by_name( string $transient ): Transient {
return new Transient( $transient );
}

}
11 changes: 8 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
{
"name": "threadi/eml",
"require-dev": {
"wp-coding-standards/wpcs": "^2.3"
"wp-coding-standards/wpcs": "^3.0.0"
},
"scripts": {
"post-install-cmd": [
"\"vendor/bin/phpcs\" --config-set installed_paths vendor/wp-coding-standards/wpcs"
"\"vendor/bin/phpcs\" --config-set installed_paths vendor/wp-coding-standards/wpcs,vendor/phpcsstandards/phpcsutils,vendor/phpcsstandards/phpcsextra"
],
"post-update-cmd": [
"\"vendor/bin/phpcs\" --config-set installed_paths vendor/wp-coding-standards/wpcs"
"\"vendor/bin/phpcs\" --config-set installed_paths vendor/wp-coding-standards/wpcs,vendor/phpcsstandards/phpcsutils,vendor/phpcsstandards/phpcsextra"
]
},
"config": {
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true
}
}
}
2 changes: 2 additions & 0 deletions external-files-in-media-library.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@

// get plugin-path.
const EML_PLUGIN = __FILE__;

// set plugin-version.
const EML_PLUGIN_VERSION = '@@VersionNumber@@';

// include necessary file.
Expand Down
21 changes: 11 additions & 10 deletions inc/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -623,7 +623,7 @@ function eml_admin_media_box(): void {
<p id="eml_url_file_state"><span class="dashicons dashicons-no-alt"></span>
<?php
/* translators: %1$s will be replaced by the URL for the logs */
echo sprintf( esc_html__( 'File-URL is NOT available! Check <a href="%1$s">the log</a> for details.', 'external-files-in-media-library' ), esc_url( $log_url ) );
printf( esc_html__( 'File-URL is NOT available! Check <a href="%1$s">the log</a> for details.', 'external-files-in-media-library' ), esc_url( $log_url ) );
?>
</p>
<?php
Expand Down Expand Up @@ -877,13 +877,13 @@ function eml_admin_number_field( array $attr ): void {

?>
<input type="number" id="<?php echo esc_attr( $attr['fieldId'] ); ?>"
name="<?php echo esc_attr( $attr['fieldId'] ); ?>"
value="<?php echo esc_attr( $value ); ?>"
step="1"
min="0"
max="10000"
class="eml-field-width"
title="<?php echo esc_attr( $title ); ?>"
name="<?php echo esc_attr( $attr['fieldId'] ); ?>"
value="<?php echo esc_attr( $value ); ?>"
step="1"
min="0"
max="10000"
class="eml-field-width"
title="<?php echo esc_attr( $title ); ?>"
<?php
echo esc_attr( $readonly );
?>
Expand Down Expand Up @@ -1154,9 +1154,10 @@ function eml_admin_dismiss(): void {
/**
* Validate the value from number-field.
*
* @param string $value Variable to validate.
* @param string|null $value Variable to validate.
* @return int
* @noinspection PhpUnused
*/
function eml_admin_validate_number( string $value ): int {
function eml_admin_validate_number( string|null $value ): int {
return absint( $value );
}
Binary file modified languages/external-files-in-media-library-de_DE.mo
Binary file not shown.
8 changes: 4 additions & 4 deletions languages/external-files-in-media-library-de_DE.po
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ msgstr ""
"Project-Id-Version: External files in Media Library @@VersionNumber@@\n"
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/external-files-in-"
"media-library\n"
"POT-Creation-Date: 2023-09-02T21:28:13+02:00\n"
"PO-Revision-Date: 2023-09-02 21:29+0200\n"
"POT-Creation-Date: 2023-10-21T17:25:08+02:00\n"
"PO-Revision-Date: 2023-10-21 17:34+0200\n"
"Last-Translator: Thomas Zwirner <[email protected]>\n"
"Language-Team: \n"
"Language: de_DE\n"
Expand Down Expand Up @@ -89,7 +89,7 @@ msgstr ""
#. translators: %1$s will be replaced by the url of the file.
#: classes/eml/Controller/class-external-files.php:359
msgid "Given URL %1$s is available."
msgstr "Die angegebene URL %1$s ist nicht erreichbar."
msgstr "Die angegebene URL %1$s ist erreichbar."

#. translators: %1$s will be replaced by the file-URL
#: classes/eml/Controller/class-external-files.php:381
Expand Down Expand Up @@ -337,7 +337,7 @@ msgstr "Füge externe Dateien <a href=\"%1$s\">hier</a> hinzu."
#: inc/admin.php:385
msgid "Enter an URL for a file you want to insert in your library"
msgstr ""
"Gib eine URL für eine Datei ein, die Du deiner Mediathek hinzufügen möchtest."
"Gib eine URL für eine Datei ein, die Du deiner Mediathek hinzufügen möchtest"

#: inc/admin.php:410
msgid "No URLs given to import."
Expand Down
Binary file modified languages/external-files-in-media-library-de_DE_formal.mo
Binary file not shown.
6 changes: 3 additions & 3 deletions languages/external-files-in-media-library-de_DE_formal.po
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ msgstr ""
"Project-Id-Version: External files in Media Library @@VersionNumber@@\n"
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/external-files-in-"
"media-library\n"
"POT-Creation-Date: 2023-09-02T21:28:13+02:00\n"
"PO-Revision-Date: 2023-09-02 21:30+0200\n"
"POT-Creation-Date: 2023-10-21T17:25:08+02:00\n"
"PO-Revision-Date: 2023-10-21 17:34+0200\n"
"Last-Translator: Thomas Zwirner <[email protected]>\n"
"Language-Team: \n"
"Language: de_DE\n"
Expand Down Expand Up @@ -89,7 +89,7 @@ msgstr ""
#. translators: %1$s will be replaced by the url of the file.
#: classes/eml/Controller/class-external-files.php:359
msgid "Given URL %1$s is available."
msgstr "Die angegebene URL %1$s ist nicht erreichbar."
msgstr "Die angegebene URL %1$s ist erreichbar."

#. translators: %1$s will be replaced by the file-URL
#: classes/eml/Controller/class-external-files.php:381
Expand Down
4 changes: 2 additions & 2 deletions languages/external-files-in-media-library.pot
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"POT-Creation-Date: 2023-09-02T21:28:13+02:00\n"
"POT-Creation-Date: 2023-10-21T17:25:08+02:00\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"X-Generator: WP-CLI 2.6.0\n"
"X-Generator: WP-CLI 2.8.1\n"
"X-Domain: external-files-in-media-library\n"

#. Plugin Name of the plugin
Expand Down
10 changes: 8 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.2.2
Tested up to: 6.4
Requires PHP: 8.0
License: GPL-2.0-or-later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Stable tag: 1.0.0
Stable tag: 1.0.1

== Description ==

Expand Down Expand Up @@ -41,3 +41,9 @@ No, only public files can be used.

= 1.0.0 =
* Initial release

= 1.0.1 =
* Updated compatibility-flag for WordPress 6.4
* Compatible with WordPress Coding Standards 3.0
* Fixed error in settings-save-process
* Fixed typo in translations

0 comments on commit ed1f852

Please sign in to comment.