diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..3322548 Binary files /dev/null and b/.DS_Store differ diff --git a/.github/ISSUE_TEMPLATE/BugReport.yml b/.github/ISSUE_TEMPLATE/BugReport.yml new file mode 100644 index 0000000..ddbdcab --- /dev/null +++ b/.github/ISSUE_TEMPLATE/BugReport.yml @@ -0,0 +1,148 @@ +name: Bug Report +description: File a bug report. +title: "[Bug]: " +labels: ["bug", "needs triage"] +body: + - type: markdown + attributes: + value: | + Thanks for taking the time to fill out this bug report! You can use the Site Health option in your website to collect a lot of the data requested below. + - type: input + id: contact + attributes: + label: Contact Details + description: How can we get in touch with you if we need more info? + placeholder: ex. email@example.com + validations: + required: false + - type: textarea + id: what-happened + attributes: + label: What happened? + description: Also tell us, what did you expect to happen? + placeholder: Tell us what you are seeing or experiencing. + value: "A bug was witnessed!" + + validations: + required: true + - type: dropdown + id: version + attributes: + label: Version + description: What version of AspireUpdate are you running? + options: + - 0.5 (Default) + - 1.0 + - Nightly + default: 0 + validations: + required: true + + - type: dropdown + id: os + attributes: + label: 'OS' + description: 'The operating system you are running on (Linux, Windows, Mac, etc).' + options: + - Windows + - MacOS + - iOS + - Android + - Linux + - Other + + + - type: dropdown + id: browsers + attributes: + label: What browsers are you seeing the problem on? + multiple: true + options: + - Firefox + - Chrome + - Safari + - Microsoft Edge + - Opera + - Other + + - type: input + id: wordpress + attributes: + label: 'WordPress' + description: 'The version of WordPress that your site uses.' + + - type: input + id: php + attributes: + label: 'PHP' + description: 'The version of PHP your site runs on.' + + - type: input + id: server + attributes: + label: 'Server' + description: 'The server your site runs on (apache, nginx, etc).' + + - type: input + id: database + attributes: + label: 'Database' + description: 'The database engine used by your site.' + + - type: input + id: theme + attributes: + label: 'Theme' + description: 'The currently active theme.' + + - type: input + id: must_use_plugins + attributes: + label: 'Must-Use Plugins' + description: 'A list of Must-Use Plugins.' + + - type: input + id: plugins + attributes: + label: 'Plugins' + description: 'A list of active plugins.' + + + + - type: textarea + id: sitehealth + attributes: + label: WordPress Site Health Output (optional) + description: Please copy and paste a SiteHealth report with details of your WordPress configuration. This will be automatically formatted into code, so no need for backticks. + render: shell + + + - type: textarea + id: logs + attributes: + label: Relevant debug log output + description: Please copy and paste any relevant debug log output. This will be automatically formatted into code, so no need for backticks. + render: shell + - type: textarea + attributes: + label: Screenshots/Live demo link + description: Add some screenshots to help explain the problem. + validations: + required: false + + - type: textarea + id: additional_notes + attributes: + label: 'Additional Notes' + description: 'Any additional details worth mentioning.' + + - type: checkboxes + id: terms + attributes: + label: Code of Conduct + description: By submitting this issue, you agree to follow the AspirePress [Code of Conduct](https://github.com/aspirepress/AspireUpdate?tab=coc-ov-file). + + options: + - label: I agree to follow the Code of Conduct. + required: true + diff --git a/.github/ISSUE_TEMPLATE/FeatureRequest.yml b/.github/ISSUE_TEMPLATE/FeatureRequest.yml new file mode 100644 index 0000000..b88c719 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/FeatureRequest.yml @@ -0,0 +1,26 @@ +name: Feature Request +description: Suggest an idea for this project. +labels: ['enhancement', 'needs triage'] +body: + - type: checkboxes + attributes: + label: 'I have checked the following:' + options: + - label: I've searched existing issues and found nothing related to my issue. + required: true + - type: markdown + attributes: + value: | + Suggest an idea for this project. + - type: textarea + attributes: + label: Describe the feature you want to add + description: A clear and concise description of the feature you want to be added. + validations: + required: true + - type: textarea + attributes: + label: Mockups or Images of the feature + description: Add some images to support your feature. + validations: + required: true \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 0000000..ef57f72 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,5 @@ +blank_issues_enabled: true +contact_links: + - name: Discussions & Support + url: https://aspirepress.org/slack/ + about: You can ask general questions or give feedback on the AspirePress community. diff --git a/.github/workflows/phpunit-tests.yml b/.github/workflows/phpunit-tests.yml index 2a935a1..5df4efc 100644 --- a/.github/workflows/phpunit-tests.yml +++ b/.github/workflows/phpunit-tests.yml @@ -11,11 +11,12 @@ on: jobs: phpunit: - name: Run tests + name: Run tests (PHP ${{ matrix.php-version }}, ${{ matrix.multisite && 'Multisite' || 'Single Site' }}) runs-on: ubuntu-latest strategy: matrix: php-version: ['7.4', '8.3'] + multisite: [ true, false ] services: database: image: mysql:latest @@ -38,4 +39,4 @@ jobs: run: bash bin/install-wp-tests.sh wordpress_tests root root 127.0.0.1 latest true - name: Run tests - run: phpunit + run: XDEBUG_MODE=off phpunit${{ matrix.multisite && ' -c tests/multisite.xml' || '' }} diff --git a/.github/workflows/playground-blueprint.yml b/.github/workflows/playground-blueprint.yml new file mode 100644 index 0000000..55ebae0 --- /dev/null +++ b/.github/workflows/playground-blueprint.yml @@ -0,0 +1,44 @@ +name: Update Blueprint Blueprint with Repository and Branch + +on: + push: + branches: + - main + - playground-ready + tags: + - "**" + +jobs: + update-blueprint: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set Branch or Tag Name + id: branch-name + run: | + if [ "${{ github.ref_type }}" == "branch" ]; then + echo "CURRENT_REF=${{ github.ref_name }}" >> $GITHUB_ENV + elif [ "${{ github.ref_type }}" == "tag" ]; then + echo "CURRENT_REF=${{ github.ref_name }}" >> $GITHUB_ENV + fi + + - name: Update Blueprint JSON + run: | + jq --tab '.plugins[0] |= "https://github-proxy.com/proxy/?repo='$GITHUB_REPOSITORY'&branch='$CURRENT_REF'"' assets/playground/blueprint.json > assets/playground/blueprint.json.tmp + mv assets/playground/blueprint.json.tmp assets/playground/blueprint.json + + - name: Commit and Push Changes + run: | + if git diff --cached --quiet; then + git config --global user.name "github-actions[bot]" + git config --global user.email "github-actions[bot]@users.noreply.github.com" + git add assets/playground/blueprint.json + git commit -m "Update blueprint.json for branch/tag ${{ env.name }}" + git push + fi + env: + name: ${{ env.name }} + diff --git a/aspire-update.php b/aspire-update.php index 6866e83..aca98c5 100644 --- a/aspire-update.php +++ b/aspire-update.php @@ -20,7 +20,8 @@ * License URI: https://www.gnu.org/licenses/old-licenses/gpl-2.0.txt * Text Domain: AspireUpdate * Domain Path: /languages - * Network: true + * GitHub Plugin URI: https://github.com/aspirepress/AspireUpdate + * Primary Branch: main */ if ( ! defined( 'ABSPATH' ) ) { diff --git a/assets/playground/blueprint.json b/assets/playground/blueprint.json index d9e8453..193f5b9 100644 --- a/assets/playground/blueprint.json +++ b/assets/playground/blueprint.json @@ -17,7 +17,7 @@ "blogname": "AspireUpdate Demo Site" }, "plugins": [ - "https://github-proxy.com/proxy/?repo=AspirePress/AspireUpdate&branch=playground-ready", + "https://github-proxy.com/proxy/?repo=namithj/AspireUpdate&branch=main", "error-log-viewer", "plugin-check" ], diff --git a/composer.json b/composer.json index f7f6a35..40c90f8 100644 --- a/composer.json +++ b/composer.json @@ -26,7 +26,8 @@ "scripts": { "format": "@php ./vendor/squizlabs/php_codesniffer/bin/phpcbf --report=summary,source", "lint": "@php ./vendor/squizlabs/php_codesniffer/bin/phpcs --report=summary, source", - "test": [ "Composer\\Config::disableProcessTimeout", "@php ./vendor/phpunit/phpunit/phpunit" ] + "test": [ "Composer\\Config::disableProcessTimeout", "@php ./vendor/phpunit/phpunit/phpunit" ], + "test:multisite": [ "Composer\\Config::disableProcessTimeout", "@php ./vendor/phpunit/phpunit/phpunit -c tests/multisite.xml" ] } diff --git a/includes/class-branding.php b/includes/class-branding.php index 83c3ae3..85714d5 100644 --- a/includes/class-branding.php +++ b/includes/class-branding.php @@ -24,7 +24,8 @@ class Branding { public function __construct() { $admin_settings = Admin_Settings::get_instance(); if ( $admin_settings->get_setting( 'enable', false ) ) { - add_action( 'admin_notices', [ $this, 'output_admin_notice' ] ); + $admin_notices_hook = is_multisite() ? 'network_admin_notices' : 'admin_notices'; + add_action( $admin_notices_hook, [ $this, 'output_admin_notice' ] ); add_action( 'admin_enqueue_scripts', [ $this, 'admin_enqueue_scripts' ] ); } } @@ -53,14 +54,15 @@ public function admin_enqueue_scripts( $hook ) { } $allowed_screens = [ - 'update-core.php', - 'plugins.php', - 'plugin-install.php', - 'themes.php', - 'theme-install.php', + 'update-core', + 'plugins', + 'plugin-install', + 'themes', + 'theme-install', ]; - if ( in_array( $hook, $allowed_screens, true ) ) { + $screen = \WP_Screen::get( $hook ); + if ( in_array( $screen->id, $allowed_screens, true ) ) { wp_enqueue_style( 'aspire_update_settings_css', plugin_dir_url( __DIR__ ) . 'assets/css/aspire-update.css', [], AP_VERSION ); } } @@ -81,9 +83,15 @@ public function output_admin_notice() { } $message = ''; - switch ( $current_screen->base ) { + switch ( $current_screen->id ) { case 'plugins': case 'plugin-install': + if ( is_multisite() ) { + break; + } + // Fall-through. + case 'plugins-network': + case 'plugin-install-network': $message = sprintf( /* translators: 1: The name of the plugin, 2: The documentation URL. */ __( 'Your plugin updates are now powered by %1$s. Learn more', 'AspireUpdate' ), @@ -93,6 +101,12 @@ public function output_admin_notice() { break; case 'themes': case 'theme-install': + if ( is_multisite() ) { + break; + } + // Fall-through. + case 'themes-network': + case 'theme-install-network': $message = sprintf( /* translators: 1: The name of the plugin, 2: The documentation URL. */ __( 'Your theme updates are now powered by %1$s. Learn more', 'AspireUpdate' ), @@ -101,6 +115,11 @@ public function output_admin_notice() { ); break; case 'update-core': + if ( is_multisite() ) { + break; + } + // Fall-through. + case 'update-core-network': $message = sprintf( /* translators: 1: The name of the plugin, 2: The documentation URL. */ __( 'Your WordPress, plugin, theme and translation updates are now powered by %1$s. Learn more', 'AspireUpdate' ), diff --git a/languages/AspireUpdate-ca_ES.po b/languages/AspireUpdate-ca_ES.po new file mode 100644 index 0000000..d1baa27 --- /dev/null +++ b/languages/AspireUpdate-ca_ES.po @@ -0,0 +1,162 @@ +# Copyright (C) 2024 AspirePress +# This file is distributed under the GPLv2. +msgid "" +msgstr "" +"Project-Id-Version: AspireUpdate 0.5\n" +"Report-Msgid-Bugs-To: https://github.com/aspirepress/AspireUpdate\n" +"POT-Creation-Date: \n" +"PO-Revision-Date: 2024-11-08 11:23+0100\n" +"Last-Translator: Joan López \n" +"Language-Team: \n" +"Language: ca\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: Poedit 3.4.4\n" +"X-Domain: AspireUpdate\n" + +#. Plugin Name of the plugin +#: aspire-update.php +msgid "AspireUpdate" +msgstr "AspireUpdate" + +#. Plugin URI of the plugin +#: aspire-update.php +msgid "https://aspirepress.org/" +msgstr "https://aspirepress.org/" + +#. Description of the plugin +#: aspire-update.php +msgid "Update plugins and themes for WordPress." +msgstr "Actualitza plugins i temes per WordPress." + +#. Author of the plugin +#: aspire-update.php +msgid "AspirePress" +msgstr "AspirePress" + +#. Author URI of the plugin +#: aspire-update.php includes/class-branding.php:91 +#: includes/class-branding.php:100 includes/class-branding.php:108 +msgid "https://docs.aspirepress.org/aspireupdate/" +msgstr "https://docs.aspirepress.org/aspireupdate/" + +#: includes/class-admin-settings.php:133 +msgid "Settings have been reset to default." +msgstr "La configuració s’ha restablert al valor predeterminat." + +#: includes/class-admin-settings.php:298 +msgid "Unexpected Error:" +msgstr "Error inesperat:" + +#: includes/class-admin-settings.php:319 +msgid "AspireUpdate Settings" +msgstr "Configuració d’AspireUpdate" + +#: includes/class-admin-settings.php:329 +msgid "Reset" +msgstr "Restableix" + +#: includes/class-admin-settings.php:428 +msgid "API Configuration" +msgstr "Configuració de l’API" + +#: includes/class-admin-settings.php:439 +msgid "Enable AspireUpdate API Rewrites" +msgstr "Activa les reescriptures de l’API d’AspireUpdate" + +#: includes/class-admin-settings.php:452 +msgid "API Host" +msgstr "Host de l’API" + +#: includes/class-admin-settings.php:460 +msgid "Your new API Host." +msgstr "El teu nou host de l’API" + +#: includes/class-admin-settings.php:470 +msgid "Other" +msgstr "Altres" + +#: includes/class-admin-settings.php:479 +msgid "API Key" +msgstr "Clau de l’API" + +#: includes/class-admin-settings.php:487 +msgid "Provides an API key for repositories that may require authentication." +msgstr "" +"Proporciona una clau d’API pels repositoris que requereixin autenticació" + +#: includes/class-admin-settings.php:493 +msgid "API Debug Configuration" +msgstr "Configuració de depuració de l’API" + +#: includes/class-admin-settings.php:504 +msgid "Enable Debug Mode" +msgstr "Activa el mode de depuració" + +#: includes/class-admin-settings.php:512 +msgid "Enables debug mode for the plugin." +msgstr "Activa el mode de depuració del plugin" + +#: includes/class-admin-settings.php:518 +msgid "Enable Debug Type" +msgstr "Activa el tipus de depuració" + +#: includes/class-admin-settings.php:527 +msgid "Request" +msgstr "Petició" + +#: includes/class-admin-settings.php:528 +msgid "Response" +msgstr "Resposta" + +#: includes/class-admin-settings.php:529 +msgid "String" +msgstr "Cadena de text" + +#: includes/class-admin-settings.php:531 +msgid "" +"Outputs the request URL and headers / response headers and body / string " +"that is being rewritten." +msgstr "" +"Emet l’URL de la petició i les capçaleres / encapçalaments de resposta i " +"el cos / cadena que s’està reescrivint." + +#: includes/class-admin-settings.php:537 +msgid "Disable SSL Verification" +msgstr "Desactiva la verificació SSL" + +#: includes/class-admin-settings.php:546 +msgid "Disables the verification of SSL to allow local testing." +msgstr "Desactiva la verificació de SSL per permetre proves locals." + +#: includes/class-admin-settings.php:609 +msgid "Generate API Key" +msgstr "Genera la clau de l’API" + +#. translators: 1: The name of the plugin, 2: The documentation URL. +#: includes/class-branding.php:89 +msgid "" +"Your plugin updates are now powered by %1$s. Learn more" +msgstr "" +"L’actualització dels teus plugins funciona ara amb %1$s. " +"Més informació" + +#. translators: 1: The name of the plugin, 2: The documentation URL. +#: includes/class-branding.php:98 +msgid "" +"Your theme updates are now powered by %1$s. Learn more" +msgstr "" +"L’actualització dels teus temes funciona funcionen ara amb %1$s. Més informació" + +#. translators: 1: The name of the plugin, 2: The documentation URL. +#: includes/class-branding.php:106 +msgid "" +"Your WordPress, plugin, theme and translation updates are now powered by " +"%1$s. Learn more" +msgstr "" +"L’actualització de WordPress, els teus plugins i temes funciona ara amb " +"%1$s. Més informació" diff --git a/languages/AspireUpdate-de_DE.mo b/languages/AspireUpdate-de_DE.mo index b5e15cc..f0c491b 100644 Binary files a/languages/AspireUpdate-de_DE.mo and b/languages/AspireUpdate-de_DE.mo differ diff --git a/languages/AspireUpdate-de_DE.po b/languages/AspireUpdate-de_DE.po index 75ef6f2..201dcfd 100644 --- a/languages/AspireUpdate-de_DE.po +++ b/languages/AspireUpdate-de_DE.po @@ -3,7 +3,7 @@ msgstr "" "Project-Id-Version: AspireUpdate\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-11-04 00:29+0000\n" -"PO-Revision-Date: 2024-11-04 00:29+0000\n" +"PO-Revision-Date: 2024-11-07 18:22+0000\n" "Last-Translator: \n" "Language-Team: German (Germany)\n" "Language: de_DE\n" @@ -108,3 +108,35 @@ msgstr "Aktualisiert Plugins und Themes für WordPress." #: includes/class-admin-settings.php:345 msgid "Your new API Host." msgstr "Ihr neuer API-Host" + +#: includes/class-admin-settings.php:133 +msgid "Settings have been reset to default." +msgstr "Einstellungen wurden auf die Standardwerte zurückgesetzt." + +#: includes/class-admin-settings.php:298 +msgid "Unexpected Error:" +msgstr "Unerwarteter Fehler:" + +#: includes/class-admin-settings.php:329 +msgid "Reset" +msgstr "Zurücksetzen" + +#: includes/class-admin-settings.php:470 +msgid "Other" +msgstr "Andere" + +#: includes/class-admin-settings.php:609 +msgid "Generate API Key" +msgstr "API-Schlüssel generieren" + +#: includes/class-branding.php:89 +msgid "Your plugin updates are now powered by %1$s. Learn more" +msgstr "Ihre Plugin-Updates werden jetzt von %1$s bereitgestellt. Mehr erfahren" + +#: includes/class-branding.php:98 +msgid "Your theme updates are now powered by %1$s. Learn more" +msgstr "Ihre Theme-Updates werden jetzt von %1$s bereitgestellt. Mehr erfahren" + +#: includes/class-branding.php:106 +msgid "Your WordPress, plugin, theme and translation updates are now powered by %1$s. Learn more" +msgstr "Ihre WordPress, Plugin, Theme und Übersetzungs updates werden jetzt von %1$s bereitgestellt. Mehr erfahren" diff --git a/languages/AspireUpdate-es_ES.po b/languages/AspireUpdate-es_ES.po index bc544e1..c5670f4 100644 --- a/languages/AspireUpdate-es_ES.po +++ b/languages/AspireUpdate-es_ES.po @@ -1,18 +1,17 @@ -#, fuzzy msgid "" msgstr "" "Project-Id-Version: AspireUpdate 0.5\n" "Report-Msgid-Bugs-To: https://github.com/aspirepress/AspireUpdate\n" "Last-Translator: David Marín Carreño \n" "Language-Team: es_ES\n" -"Language: es_ES \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "POT-Creation-Date: \n" -"PO-Revision-Date: 2024-11-07 06:00+0100\n" +"PO-Revision-Date: 2024-11-07 14:05+0100\n" +"Language: es_ES \n" "X-Generator: WP-CLI 2.11.0\n" -"X-Domain: AspireUpdate" +"X-Domain: AspireUpdate\n" #. Plugin Name of the plugin #: aspire-update.php @@ -36,6 +35,9 @@ msgstr "AspirePress" #. Author URI of the plugin #: aspire-update.php +#: includes/class-branding.php:91 +#: includes/class-branding.php:100 +#: includes/class-branding.php:108 msgid "https://docs.aspirepress.org/aspireupdate/" msgstr "https://docs.aspirepress.org/aspireupdate/" @@ -69,7 +71,7 @@ msgstr "Host de API" #: includes/class-admin-settings.php:460 msgid "Your new API Host." -msgstr "Su nuevo host de API" +msgstr "Tu nuevo host de API" #: includes/class-admin-settings.php:470 msgid "Other" @@ -126,3 +128,18 @@ msgstr "Desactiva la verificación de SSL para permitir pruebas locales." #: includes/class-admin-settings.php:609 msgid "Generate API Key" msgstr "Generar clave de API" + +#. translators: 1: The name of the plugin, 2: The documentation URL. +#: includes/class-branding.php:89 +msgid "Your plugin updates are now powered by %1$s. Learn more" +msgstr "La actualización de tus plugins ahora funciona con %1$s. Leer más " + +#. translators: 1: The name of the plugin, 2: The documentation URL. +#: includes/class-branding.php:98 +msgid "Your theme updates are now powered by %1$s. Learn more" +msgstr "La actualización de tus temas ahora funciona con %1$s. Leer más" + +#. translators: 1: The name of the plugin, 2: The documentation URL. +#: includes/class-branding.php:106 +msgid "Your WordPress, plugin, theme and translation updates are now powered by %1$s. Learn more" +msgstr "La actualización de WordPress, plugins, temas y traducciones ahora funciona con %1$s. Leer más" diff --git a/languages/AspireUpdate-fr_FR.l10n.php b/languages/AspireUpdate-fr_FR.l10n.php index cf65182..597964d 100644 --- a/languages/AspireUpdate-fr_FR.l10n.php +++ b/languages/AspireUpdate-fr_FR.l10n.php @@ -1,2 +1,2 @@ 'AspireUpdate','report-msgid-bugs-to'=>'','pot-creation-date'=>'2024-11-03 17:59+0000','po-revision-date'=>'2024-11-04 06:23+0000','last-translator'=>'','language-team'=>'Français','language'=>'fr_FR','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'=>'Configuration de l’API','API Debug Configuration'=>'Configuration du débogage de l’API','API Host'=>'Hôte de l’API','API Key'=>'Clé API','AspirePress'=>'AspirePress','AspireUpdate'=>'AspireUpdate','AspireUpdate Settings'=>'Réglages d’AspireUpdate','Disable SSL Verification'=>'Désactiver la vérification du SSL','Disables the verification of SSL to allow local testing.'=>'Désactive la vérification du SSL pour autoriser le test en local.','Enable AspireUpdate API Rewrites'=>'Activer la réécriture de l’API AspireUpdate','Enable Debug Mode'=>'Activer le mode débogage','Enable Debug Type'=>'Activer le type de débogage','Enables debug mode for the plugin.'=>'Active le mode débogage de l’extension.','Generate API Key'=>'Générer une clé API','https://aspirepress.org/'=>'https://aspirepress.org/','https://docs.aspirepress.org/aspireupdate/'=>'https://docs.aspirepress.org/aspireupdate/','Other'=>'Autre','Outputs the request URL and headers / response headers and body / string that is being rewritten.'=>'Affiche l’URL et les en-têtes de la requête/les en-têtes et le corps de la réponse/la chaîne qui est en train d\'être réécrite.','Provides an API key for repositories that may require authentication.'=>'Fournit une clé API pour les dépôts qui peuvent nécessiter une authentification.','Request'=>'Rquête','Reset'=>'Réinitialiser','Response'=>'Réponse','Save Changes'=>'Enregistrer les changements','Settings have been reset to default.'=>'Les réglages ont été réinitialisés à ceux par défaut.','String'=>'Chaine','Update plugins and themes for WordPress.'=>'Mets à jour les extensions et thème pour WordPress','Your new API Host.'=>'Votre nouvel hôte pour l’API']]; +return ['project-id-version'=>'AspireUpdate','report-msgid-bugs-to'=>'','pot-creation-date'=>'2024-11-03 17:59+0000','po-revision-date'=>'2024-11-08 08:14+0000','last-translator'=>'','language-team'=>'Français','language'=>'fr_FR','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'=>'Configuration de l’API','API Debug Configuration'=>'Configuration du débogage de l’API','API Host'=>'Hôte de l’API','API Key'=>'Clé API','AspirePress'=>'AspirePress','AspireUpdate'=>'AspireUpdate','AspireUpdate Settings'=>'Réglages d’AspireUpdate','Disable SSL Verification'=>'Désactiver la vérification du SSL','Disables the verification of SSL to allow local testing.'=>'Désactive la vérification du SSL pour autoriser le test en local.','Enable AspireUpdate API Rewrites'=>'Activer la réécriture de l’API AspireUpdate','Enable Debug Mode'=>'Activer le mode débogage','Enable Debug Type'=>'Activer le type de débogage','Enables debug mode for the plugin.'=>'Active le mode débogage de l’extension.','Generate API Key'=>'Générer une clé API','https://aspirepress.org/'=>'https://aspirepress.org/','https://docs.aspirepress.org/aspireupdate/'=>'https://docs.aspirepress.org/aspireupdate/','Other'=>'Autre','Outputs the request URL and headers / response headers and body / string that is being rewritten.'=>'Affiche l’URL et les en-têtes de la requête/les en-têtes et le corps de la réponse/la chaîne qui est en train d\'être réécrite.','Provides an API key for repositories that may require authentication.'=>'Fournit une clé API pour les dépôts qui peuvent nécessiter une authentification.','Request'=>'Rquête','Reset'=>'Réinitialiser','Response'=>'Réponse','Settings have been reset to default.'=>'Les réglages ont été réinitialisés à ceux par défaut.','String'=>'Chaine','Unexpected Error:'=>'Erreur inattendue :','Update plugins and themes for WordPress.'=>'Mets à jour les extensions et thème pour WordPress','Your new API Host.'=>'Votre nouvel hôte pour l’API','Your plugin updates are now powered by %1$s. Learn more'=>'Vos mises à jour d’extension sont maintenant propulsées par %1$s. En savoir plus','Your theme updates are now powered by %1$s. Learn more'=>'Vos mises à jour de thèmes sont maintenant propulsés par %1$s. En savoir plus','Your WordPress, plugin, theme and translation updates are now powered by %1$s. Learn more'=>'Vos mises à jour de WordPress, d’extensions et de thèmes sont maintenant propulsés par %1$s. En savoir plus']]; diff --git a/languages/AspireUpdate-fr_FR.mo b/languages/AspireUpdate-fr_FR.mo index 2a24e7b..d79a187 100644 Binary files a/languages/AspireUpdate-fr_FR.mo and b/languages/AspireUpdate-fr_FR.mo differ diff --git a/languages/AspireUpdate-fr_FR.po b/languages/AspireUpdate-fr_FR.po index b509d4c..6dbf0a3 100644 --- a/languages/AspireUpdate-fr_FR.po +++ b/languages/AspireUpdate-fr_FR.po @@ -3,7 +3,7 @@ msgstr "" "Project-Id-Version: AspireUpdate\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-11-03 17:59+0000\n" -"PO-Revision-Date: 2024-11-04 06:23+0000\n" +"PO-Revision-Date: 2024-11-08 08:14+0000\n" "Last-Translator: \n" "Language-Team: Français\n" "Language: fr_FR\n" @@ -15,75 +15,80 @@ msgstr "" "X-Loco-Version: 2.6.11; wp-6.6.2\n" "X-Domain: AspireUpdate" -#: includes/class-admin-settings.php:313 +#: includes/class-admin-settings.php:428 msgid "API Configuration" msgstr "Configuration de l’API" -#: includes/class-admin-settings.php:378 +#: includes/class-admin-settings.php:493 msgid "API Debug Configuration" msgstr "Configuration du débogage de l’API" -#: includes/class-admin-settings.php:337 +#: includes/class-admin-settings.php:452 msgid "API Host" msgstr "Hôte de l’API" -#: includes/class-admin-settings.php:364 +#: includes/class-admin-settings.php:479 msgid "API Key" msgstr "Clé API" #. Author of the plugin +#: aspire-update.php msgid "AspirePress" msgstr "AspirePress" -#. Name of the plugin +#. Plugin Name of the plugin +#: aspire-update.php msgid "AspireUpdate" msgstr "AspireUpdate" -#: includes/class-admin-settings.php:272 +#: includes/class-admin-settings.php:319 msgid "AspireUpdate Settings" msgstr "Réglages d’AspireUpdate" -#: includes/class-admin-settings.php:422 +#: includes/class-admin-settings.php:537 msgid "Disable SSL Verification" msgstr "Désactiver la vérification du SSL" -#: includes/class-admin-settings.php:431 +#: includes/class-admin-settings.php:546 msgid "Disables the verification of SSL to allow local testing." msgstr "Désactive la vérification du SSL pour autoriser le test en local." -#: includes/class-admin-settings.php:324 +#: includes/class-admin-settings.php:439 msgid "Enable AspireUpdate API Rewrites" msgstr "Activer la réécriture de l’API AspireUpdate" -#: includes/class-admin-settings.php:389 +#: includes/class-admin-settings.php:504 msgid "Enable Debug Mode" msgstr "Activer le mode débogage" -#: includes/class-admin-settings.php:403 +#: includes/class-admin-settings.php:518 msgid "Enable Debug Type" msgstr "Activer le type de débogage" -#: includes/class-admin-settings.php:397 +#: includes/class-admin-settings.php:512 msgid "Enables debug mode for the plugin." msgstr "Active le mode débogage de l’extension." -#: includes/class-admin-settings.php:494 +#: includes/class-admin-settings.php:609 msgid "Generate API Key" msgstr "Générer une clé API" -#. URI of the plugin +#. Plugin URI of the plugin +#: aspire-update.php msgid "https://aspirepress.org/" msgstr "https://aspirepress.org/" #. Author URI of the plugin +#: aspire-update.php includes/class-branding.php:91 +#: includes/class-branding.php:100 includes/class-branding.php:108 msgid "https://docs.aspirepress.org/aspireupdate/" msgstr "https://docs.aspirepress.org/aspireupdate/" -#: includes/class-admin-settings.php:355 +#: includes/class-admin-settings.php:470 msgid "Other" msgstr "Autre" -#: includes/class-admin-settings.php:416 +#: includes/class-admin-settings.php:531 msgid "" "Outputs the request URL and headers / response headers and body / string " "that is being rewritten." @@ -91,40 +96,68 @@ msgstr "" "Affiche l’URL et les en-têtes de la requête/les en-têtes et le corps de la " "réponse/la chaîne qui est en train d'être réécrite." -#: includes/class-admin-settings.php:372 +#: includes/class-admin-settings.php:487 msgid "Provides an API key for repositories that may require authentication." msgstr "" "Fournit une clé API pour les dépôts qui peuvent nécessiter une " "authentification." -#: includes/class-admin-settings.php:412 +#: includes/class-admin-settings.php:527 msgid "Request" msgstr "Rquête" -#: includes/class-admin-settings.php:280 +#: includes/class-admin-settings.php:329 msgid "Reset" msgstr "Réinitialiser" -#: includes/class-admin-settings.php:413 +#: includes/class-admin-settings.php:528 msgid "Response" msgstr "Réponse" -#: includes/class-admin-settings.php:279 -msgid "Save Changes" -msgstr "Enregistrer les changements" - -#: includes/class-admin-settings.php:119 +#: includes/class-admin-settings.php:133 msgid "Settings have been reset to default." msgstr "Les réglages ont été réinitialisés à ceux par défaut." -#: includes/class-admin-settings.php:414 +#: includes/class-admin-settings.php:529 msgid "String" msgstr "Chaine" +#: includes/class-admin-settings.php:298 +msgid "Unexpected Error:" +msgstr "Erreur inattendue :" + #. Description of the plugin +#: aspire-update.php msgid "Update plugins and themes for WordPress." msgstr "Mets à jour les extensions et thème pour WordPress" -#: includes/class-admin-settings.php:345 +#: includes/class-admin-settings.php:460 msgid "Your new API Host." msgstr "Votre nouvel hôte pour l’API" + +#. translators: 1: The name of the plugin, 2: The documentation URL. +#: includes/class-branding.php:89 +msgid "" +"Your plugin updates are now powered by %1$s. Learn more" +msgstr "" +"Vos mises à jour d’extension sont maintenant propulsées par " +"%1$s. En savoir plus" + +#. translators: 1: The name of the plugin, 2: The documentation URL. +#: includes/class-branding.php:98 +msgid "" +"Your theme updates are now powered by %1$s. Learn more" +msgstr "" +"Vos mises à jour de thèmes sont maintenant propulsés par " +"%1$s. En savoir plus" + +#. translators: 1: The name of the plugin, 2: The documentation URL. +#: includes/class-branding.php:106 +msgid "" +"Your WordPress, plugin, theme and translation updates are now powered by " +"%1$s. Learn more" +msgstr "" +"Vos mises à jour de WordPress, d’extensions et de thèmes sont maintenant " +"propulsés par %1$s. En savoir plus" diff --git a/phpunit.xml.dist b/phpunit.xml.dist index d6751ac..72d0b05 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -14,6 +14,11 @@ ./tests/ + + + ms-required + + ./aspire-update.php diff --git a/readme.txt b/readme.txt index 278a104..2fe50de 100644 --- a/readme.txt +++ b/readme.txt @@ -1,41 +1,41 @@ -=== AspireUpdate === -Contributors: sarah-savage, namithj, asirota -Donate link: https://github.com/sponsors/aspirepress -Tags: -Requires at least: 5.3 -Tested up to: 6.7 -Stable tag: 0.5 -Requires PHP: 7.4 -License: GPLv2 -License URI: https://www.gnu.org/licenses/old-licenses/gpl-2.0.txt - -This plugin allows a WordPress user to automatically rewrite certain URLs and URL paths to a new URL. - -== Description == - -This plugin allows a WordPress user to automatically rewrite certain URLs and URL paths to a new URL. This is helpful because it allows for the rewriting of api.wordpress.org to some other repository that contains the plugins the user wants. - -The plugin supports multiple rewrites, and also supports rewriting the URL paths of the requests on a per-host basis. This improves the capacity of the plugin to adequately support newer or different repositories. -. - -== Frequently Asked Questions == - -= A question that someone might have = - -An answer to that question. - -= What about foo bar? = - -Answer to foo bar dilemma. - -== Screenshots == - -1. This screen shot description corresponds to screenshot-1.(png|jpg|jpeg|gif). Screenshots are stored in the /assets directory. -2. This is the second screen shot - -== Changelog == - -= 0.5 = -* first stable version, connects to api.wordpress.org or an alternative AspireCloud repository - -== Upgrade Notice == +=== AspireUpdate === +Contributors: sarah-savage, namithj, asirota +Donate link: https://github.com/sponsors/aspirepress +Tags: +Requires at least: 5.3 +Tested up to: 6.7 +Stable tag: 0.5 +Requires PHP: 7.4 +License: GPLv2 +License URI: https://www.gnu.org/licenses/gpl-2.0.html + +This plugin allows a WordPress user to automatically rewrite certain URLs and URL paths to a new URL. + +== Description == + +This plugin allows a WordPress user to automatically rewrite certain URLs and URL paths to a new URL. This is helpful because it allows for the rewriting of api.wordpress.org to some other repository that contains the plugins the user wants. + +The plugin supports multiple rewrites, and also supports rewriting the URL paths of the requests on a per-host basis. This improves the capacity of the plugin to adequately support newer or different repositories. + +== Frequently Asked Questions == + += A question that someone might have = + +An answer to that question. + += What about foo bar? = + +Answer to foo bar dilemma. + +== Screenshots == + +1. This screen shot description corresponds to screenshot-1.(png|jpg|jpeg|gif). Screenshots are stored in the /assets directory. +2. This is the second screen shot + +== Changelog == + += 0.5 = +* first stable version, connects to api.wordpress.org or an alternative AspireCloud repository + +== Upgrade Notice == + diff --git a/tests/Branding/Branding_AdminEnqueueScriptsTest.php b/tests/Branding/Branding_AdminEnqueueScriptsTest.php index f93c654..9176483 100644 --- a/tests/Branding/Branding_AdminEnqueueScriptsTest.php +++ b/tests/Branding/Branding_AdminEnqueueScriptsTest.php @@ -41,11 +41,11 @@ public function test_should_enqueue_style_on_certain_screens( $hook ) { public function data_hooks() { return self::text_array_to_dataprovider( [ - 'update-core.php', - 'plugins.php', - 'plugin-install.php', - 'themes.php', - 'theme-install.php', + 'update-core', + 'plugins', + 'plugin-install', + 'themes', + 'theme-install', ] ); } @@ -58,6 +58,10 @@ public function data_hooks() { * @param string $hook The current screen's hook. */ public function test_should_not_enqueue_style_on_adjacent_screens( $hook ) { + if ( is_multisite() ) { + $hook .= '-network'; + } + $branding = new AspireUpdate\Branding(); $branding->admin_enqueue_scripts( $hook ); $this->assertFalse( wp_style_is( 'aspire_update_settings_css' ) ); @@ -71,9 +75,9 @@ public function test_should_not_enqueue_style_on_adjacent_screens( $hook ) { public function data_adjacent_screens() { return self::text_array_to_dataprovider( [ - 'index.php', - 'nav-menus.php', - 'plugin-editor.php', + 'dashboard', + 'nav-menus', + 'plugin-editor', ] ); } @@ -97,8 +101,9 @@ public function test_should_not_enqueue_style_when_ap_remove_ui_is_true() { // Prevent the notice from being displayed. define( 'AP_REMOVE_UI', true ); + $hook = is_multisite() ? 'plugins-network' : 'plugins'; $branding = new AspireUpdate\Branding(); - $branding->admin_enqueue_scripts( 'plugins.php' ); + $branding->admin_enqueue_scripts( $hook ); $this->assertFalse( wp_style_is( 'aspire_update_settings_css' ) ); } } diff --git a/tests/Branding/Branding_ConstructTest.php b/tests/Branding/Branding_ConstructTest.php index 1c00791..bb05fc1 100644 --- a/tests/Branding/Branding_ConstructTest.php +++ b/tests/Branding/Branding_ConstructTest.php @@ -12,9 +12,11 @@ */ class Branding_ConstructTest extends WP_UnitTestCase { /** - * Test that hooks are added when API rewriting is enabled. + * Test that hooks are added when API rewriting is enabled in single site. * - * @dataProvider data_hooks_and_methods + * @dataProvider data_single_site_hooks_and_methods + * + * @group ms-excluded * * @runInSeparateProcess * @preserveGlobalState disabled @@ -22,7 +24,7 @@ class Branding_ConstructTest extends WP_UnitTestCase { * @string $hook The hook's name. * @string $method The method to hook. */ - public function test_should_add_hooks( $hook, $method ) { + public function test_should_add_hooks_in_single_site( $hook, $method ) { define( 'AP_ENABLE', true ); $branding = new AspireUpdate\Branding(); @@ -30,9 +32,11 @@ public function test_should_add_hooks( $hook, $method ) { } /** - * Test that hooks are not added when API rewriting is disabled. + * Test that hooks are not added when API rewriting is disabled in single-site. + * + * @dataProvider data_single_site_hooks_and_methods * - * @dataProvider data_hooks_and_methods + * @group ms-excluded * * @runInSeparateProcess * @preserveGlobalState disabled @@ -40,7 +44,7 @@ public function test_should_add_hooks( $hook, $method ) { * @string $hook The hook's name. * @string $method The method to hook. */ - public function test_should_not_add_hooks( $hook, $method ) { + public function test_should_not_add_hooks_in_single_site( $hook, $method ) { define( 'AP_ENABLE', false ); $branding = new AspireUpdate\Branding(); @@ -52,7 +56,7 @@ public function test_should_not_add_hooks( $hook, $method ) { * * @return array[] */ - public function data_hooks_and_methods() { + public function data_single_site_hooks_and_methods() { return [ 'admin_notices -> output_admin_notice' => [ 'hook' => 'admin_notices', @@ -64,4 +68,62 @@ public function data_hooks_and_methods() { ], ]; } + + /** + * Test that hooks are added when API rewriting is enabled in multisite. + * + * @dataProvider data_multisite_hooks_and_methods + * + * @group ms-required + * + * @runInSeparateProcess + * @preserveGlobalState disabled + * + * @string $hook The hook's name. + * @string $method The method to hook. + */ + public function test_should_add_hooks_in_multisite( $hook, $method ) { + define( 'AP_ENABLE', true ); + + $branding = new AspireUpdate\Branding(); + $this->assertIsInt( has_action( $hook, [ $branding, $method ] ) ); + } + + /** + * Test that hooks are not added when API rewriting is disabled in multisite. + * + * @dataProvider data_multisite_hooks_and_methods + * + * @group ms-required + * + * @runInSeparateProcess + * @preserveGlobalState disabled + * + * @string $hook The hook's name. + * @string $method The method to hook. + */ + public function test_should_not_add_hooks_in_multisite( $hook, $method ) { + define( 'AP_ENABLE', false ); + + $branding = new AspireUpdate\Branding(); + $this->assertFalse( has_action( $hook, [ $branding, $method ] ) ); + } + + /** + * Data provider. + * + * @return array[] + */ + public function data_multisite_hooks_and_methods() { + return [ + 'network_admin_notices -> output_admin_notice' => [ + 'hook' => 'network_admin_notices', + 'method' => 'output_admin_notice', + ], + 'admin_enqueue_scripts -> admin_enqueue_scripts' => [ + 'hook' => 'admin_enqueue_scripts', + 'method' => 'admin_enqueue_scripts', + ], + ]; + } } diff --git a/tests/Branding/Branding_OutputAdminNoticeTest.php b/tests/Branding/Branding_OutputAdminNoticeTest.php index 745535a..7e5ffb9 100644 --- a/tests/Branding/Branding_OutputAdminNoticeTest.php +++ b/tests/Branding/Branding_OutputAdminNoticeTest.php @@ -20,12 +20,31 @@ class Branding_OutputAdminNoticeTest extends WP_UnitTestCase { * @param string $expected The expected substring to find. */ public function test_should_output_admin_notice( $hook, $expected ) { + if ( is_multisite() ) { + $hook .= '-network'; + } set_current_screen( $hook ); $branding = new AspireUpdate\Branding(); $this->assertStringContainsString( $expected, get_echo( [ $branding, 'output_admin_notice' ] ) ); } + /** + * Test that no admin notice is output on adjacent screens. + * + * @dataProvider data_screen_specific_messages + * + * @group ms-required + * + * @param string $hook The current screen's hook. + */ + public function test_should_not_output_notice_on_single_site_screens_in_multisite( $hook ) { + set_current_screen( $hook ); + + $branding = new AspireUpdate\Branding(); + $this->assertSame( '', get_echo( [ $branding, 'output_admin_notice' ] ) ); + } + /** * Data provider. * @@ -33,24 +52,24 @@ public function test_should_output_admin_notice( $hook, $expected ) { */ public function data_screen_specific_messages() { return [ - 'update-core.php' => [ - 'hook' => 'update-core.php', + 'update-core' => [ + 'hook' => 'update-core', 'expected' => 'WordPress, plugin, theme and translation updates', ], - 'plugins.php' => [ - 'hook' => 'plugins.php', + 'plugins' => [ + 'hook' => 'plugins', 'expected' => 'plugin updates', ], - 'plugin-install.php' => [ - 'hook' => 'plugin-install.php', + 'plugin-install' => [ + 'hook' => 'plugin-install', 'expected' => 'plugin updates', ], - 'themes.php' => [ - 'hook' => 'themes.php', + 'themes' => [ + 'hook' => 'themes', 'expected' => 'theme updates', ], - 'theme-install.php' => [ - 'hook' => 'theme-install.php', + 'theme-install' => [ + 'hook' => 'theme-install', 'expected' => 'theme updates', ], ]; @@ -64,6 +83,9 @@ public function data_screen_specific_messages() { * @param string $hook The current screen's hook. */ public function test_should_not_output_notice_on_adjacent_screens( $hook ) { + if ( is_multisite() ) { + $hook .= '-network'; + } set_current_screen( $hook ); $branding = new AspireUpdate\Branding(); @@ -78,9 +100,9 @@ public function test_should_not_output_notice_on_adjacent_screens( $hook ) { public function data_adjacent_screens() { return self::text_array_to_dataprovider( [ - 'index.php', - 'nav-menus.php', - 'plugin-editor.php', + 'dashboard', + 'nav-menus', + 'plugin-editor', ] ); } @@ -108,7 +130,7 @@ public function test_should_not_output_notice_when_there_is_no_screen() { */ public function test_should_not_output_notice_when_ap_remove_ui_is_true() { // Set to a screen that should display an admin notice. - set_current_screen( 'plugins.php' ); + set_current_screen( is_multisite() ? 'plugins-network' : 'plugins' ); // Prevent the notice from being displayed. define( 'AP_REMOVE_UI', true ); diff --git a/tests/multisite.xml b/tests/multisite.xml new file mode 100644 index 0000000..1536460 --- /dev/null +++ b/tests/multisite.xml @@ -0,0 +1,41 @@ + + + + + + + + + ./ + + + + + ms-excluded + + + + + ../includes + + + ../includes/autoload.php + + + + + + +