diff --git a/assets/css/aspire-update.css b/assets/css/aspire-update.css index 3ba7e935..c8d18259 100644 --- a/assets/css/aspire-update.css +++ b/assets/css/aspire-update.css @@ -1,3 +1,4 @@ + @keyframes glow { 0% { background-color: rgba(255, 223, 0, 0.1); diff --git a/assets/js/aspire-update.js b/assets/js/aspire-update.js index 8b450bff..e9f9f42a 100644 --- a/assets/js/aspire-update.js +++ b/assets/js/aspire-update.js @@ -1,3 +1,4 @@ + jQuery(document).ready(function () { new ApiRewrites(); new ApiDebug(); @@ -237,3 +238,4 @@ class Fields { }); } } + diff --git a/composer.json b/composer.json index f5508269..d2a49e53 100644 --- a/composer.json +++ b/composer.json @@ -13,6 +13,7 @@ "php": ">=7.4.0" }, "require-dev": { + "squizlabs/php_codesniffer": "3.10.3", "wp-coding-standards/wpcs": "~3.1.0", "yoast/phpunit-polyfills": "^1.1.0" @@ -28,4 +29,5 @@ "test": [ "Composer\\Config::disableProcessTimeout", "@php ./vendor/phpunit/phpunit/phpunit" ] } + } diff --git a/composer.lock b/composer.lock index 7dd37a28..0af7c9cd 100644 --- a/composer.lock +++ b/composer.lock @@ -4,6 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], + "content-hash": "ee8f3669b94f591108fa37dfcf3db475", "packages": [], "packages-dev": [ @@ -86,6 +87,7 @@ "time": "2023-01-05T11:28:13+00:00" }, { + "name": "doctrine/instantiator", "version": "1.5.0", "source": { @@ -392,6 +394,7 @@ "time": "2022-02-21T01:04:05+00:00" }, { + "name": "phpcsstandards/phpcsextra", "version": "1.2.1", "source": { @@ -558,6 +561,7 @@ "time": "2024-05-20T13:34:27+00:00" }, { + "name": "phpunit/php-code-coverage", "version": "9.2.32", "source": { @@ -1943,6 +1947,7 @@ "time": "2020-09-28T06:39:44+00:00" }, { + "name": "squizlabs/php_codesniffer", "version": "3.10.3", "source": { @@ -2023,6 +2028,7 @@ "time": "2024-09-18T10:38:58+00:00" }, { + "name": "theseer/tokenizer", "version": "1.2.3", "source": { @@ -2073,6 +2079,7 @@ "time": "2024-03-03T12:36:25+00:00" }, { + "name": "wp-coding-standards/wpcs", "version": "3.1.0", "source": { @@ -2139,6 +2146,7 @@ "time": "2024-03-25T16:39:00+00:00" }, { + "name": "yoast/phpunit-polyfills", "version": "1.1.2", "source": { diff --git a/includes/class-admin-settings.php b/includes/class-admin-settings.php index b472e71f..1105ad95 100644 --- a/includes/class-admin-settings.php +++ b/includes/class-admin-settings.php @@ -44,6 +44,7 @@ class Admin_Settings { * The Constructor. */ public function __construct() { + add_action( is_multisite() ? 'network_admin_menu' : 'admin_menu', [ $this, 'register_admin_menu' ] ); add_action( 'admin_init', [ $this, 'reset_settings' ] ); add_action( 'admin_init', [ $this, 'register_settings' ] ); @@ -52,6 +53,7 @@ public function __construct() { add_action( 'admin_init', [ $this, 'update_settings' ] ); add_action( 'network_admin_edit_aspireupdate-settings', [ $this, 'update_settings' ] ); + } /** @@ -98,7 +100,9 @@ public function reset_settings() { [ 'reset-success' => 'success', 'reset-success-nonce' => wp_create_nonce( 'aspireupdate-reset-success-nonce' ), + ], + network_admin_url( 'index.php?page=aspireupdate-settings' ) ) ); @@ -241,7 +245,9 @@ public function update_settings() { update_site_option( $this->option_name, $this->sanitize_settings( wp_unslash( $_POST['aspireupdate_settings'] ) ) ); wp_safe_redirect( + add_query_arg( [ network_admin_url( 'index.php?page=aspireupdate-settings' ) ] ) + ); exit; } @@ -275,7 +281,9 @@ public function register_admin_menu() { * @return void */ public function admin_enqueue_scripts( $hook ) { + if ( ! in_array( $hook, [ 'dashboard_page_aspireupdate-settings', 'index_page_aspireupdate-settings' ], true ) ) { + return; } wp_enqueue_style( 'aspire_update_settings_css', plugin_dir_url( __DIR__ ) . 'assets/css/aspire-update.css', [], AP_VERSION ); @@ -283,7 +291,9 @@ public function admin_enqueue_scripts( $hook ) { wp_localize_script( 'aspire_update_settings_js', 'aspireupdate', + [ + 'ajax_url' => network_admin_url( 'admin-ajax.php' ), 'nonce' => wp_create_nonce( 'aspireupdate-ajax' ), 'domain' => Utilities::get_top_level_domain(), @@ -301,7 +311,9 @@ public function the_settings_page() { [ 'reset' => 'reset', 'reset-nonce' => wp_create_nonce( 'aspireupdate-reset-nonce' ), + ], + network_admin_url( 'index.php?page=aspireupdate-settings' ) ); ?> diff --git a/includes/class-controller.php b/includes/class-controller.php index 32110e13..60997363 100644 --- a/includes/class-controller.php +++ b/includes/class-controller.php @@ -20,7 +20,9 @@ public function __construct() { Themes_Screens::get_instance(); $this->api_rewrite(); + add_action( 'init', [ $this, 'load_textdomain' ] ); + } /** @@ -55,4 +57,5 @@ private function api_rewrite() { public function load_textdomain() { \load_plugin_textdomain( 'AspireUpdate', false, AP_PATH . '/languages/' ); } + } diff --git a/languages/AspireUpdate-de_DE.I10n.php b/languages/AspireUpdate-de_DE.I10n.php index 2d2c3e56..900ff0a8 100644 --- a/languages/AspireUpdate-de_DE.I10n.php +++ b/languages/AspireUpdate-de_DE.I10n.php @@ -1,5 +1,6 @@ 'AspireUpdate','report-msgid-bugs-to'=>'','pot-creation-date'=>'2024-11-04 00:29+0000','po-revision-date'=>'2024-11-04 00:29+0000','last-translator'=>'','language-team'=>'German (Germany)','language'=>'de_DE','plural-forms'=>'nplurals=2; plural=n != 1;','mime-version'=>'1.0','content-type'=>'text/plain; charset=UTF-8','content-transfer-encoding'=>'8bit','x-generator'=>'Loco https://localise.biz/','x-loco-version'=>'2.6.11; wp-6.6.2','x-domain'=>'AspireUpdate','messages'=>[ + 'API Configuration'=>'API-Konfiguration', 'API Debug Configuration'=>'API-Debug-Konfiguration', 'API Host'=>'API-Host', @@ -22,4 +23,5 @@ 'String'=>'Zeichenkette', 'Update plugins and themes for WordPress.'=>'Aktualisiert Plugins und Themes für WordPress.', 'Your new API Host.'=>'Ihr neuer API-Host' + ]]; diff --git a/languages/AspireUpdate-zh_TW.l10n.php b/languages/AspireUpdate-zh_TW.l10n.php index 59749485..609d2ec5 100644 --- a/languages/AspireUpdate-zh_TW.l10n.php +++ b/languages/AspireUpdate-zh_TW.l10n.php @@ -1,2 +1,4 @@ NULL,'plural-forms'=>NULL,'language'=>'zh_TW','project-id-version'=>'AspireUpdate','pot-creation-date'=>'2024-11-02 12:34-0700','po-revision-date'=>'2024-11-02 12:40-0700','x-generator'=>'Poedit 3.5','messages'=>['Settings have been reset to default.'=>'設定已重設為預設值。','AspireUpdate Settings'=>'AspireUpdate 設定','Save Changes'=>'儲存設定','Reset'=>'重設','API Configuration'=>'API 組態','Enable AspireUpdate API Rewrites'=>'啟用 AspireUpdate API 重寫','API Host'=>'API 主機','Your new API Host.'=>'設定新的 API 主機。','Other'=>'其他主機','API Key'=>'API 金鑰','Provides an API key for repositories that may require authentication.'=>'為需要驗證的存放庫提供 API 金鑰。','API Debug Configuration'=>'API 偵錯組態','Enable Debug Mode'=>'啟用偵錯模式','Enables debug mode for the plugin.'=>'為外掛啟用偵錯模式。','Enable Debug Type'=>'啟用偵錯類型','Request'=>'要求','Response'=>'回應','String'=>'字串','Outputs the request URL and headers / response headers and body / string that is being rewritten.'=>'輸出經過重寫的要求網址、標頭、回應標頭、內容及字串。','Disable SSL Verification'=>'停用 SSL 驗證','Disables the verification of SSL to allow local testing.'=>'停用 SSL 驗證,便能在本機環境進行測試。','Generate API Key'=>'產生 API 金鑰','AspireUpdate'=>'AspireUpdate','https://aspirepress.org/'=>'https://aspirepress.org/','Update plugins and themes for WordPress.'=>'更新 WordPress 的外掛及佈景主題。','AspirePress'=>'AspirePress','https://docs.aspirepress.org/aspireupdate/'=>'https://docs.aspirepress.org/aspireupdate/']]; + diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 1f8efc6a..b8515697 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -31,7 +31,9 @@ * Manually load the plugin being tested. */ function _manually_load_plugin() { + require dirname( __DIR__ ) . '/aspire-update.php'; + } tests_add_filter( 'muplugins_loaded', '_manually_load_plugin' );