diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 000000000..a3659bba8 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,31 @@ +/.git export-ignore +/.github export-ignore +/.wordpress-org export-ignore +/node_modules export-ignore + +/docs export-ignore +/tests export-ignore +/build-cs export-ignore + +/*.DS_store export-ignore +/.DS_store? export-ignore + +/.editorconfig export-ignore +/.eslintrc.js export-ignore +/.nvmrc export-ignore +/.wp-env.json export-ignore +/composer.json export-ignore +/composer.lock export-ignore +/package.json export-ignore +/package-lock.json export-ignore +/phpcs.xml.dist export-ignore +/phpstan.neon.dist export-ignore +/phpunit.xml.dist export-ignore + +/CODE_OF_CONDUCT.md export-ignore +/CONTRIBUTING.md export-ignore +/SECURITY.md export-ignore +/README.md export-ignore + +/.gitattributes export-ignore +/.gitignore export-ignore diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 000000000..e451b5d1f --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,34 @@ +name: Deploy + +# Run deploy only on published releases. +on: + release: + types: [published] + +jobs: + + deploy: + name: Deploy to WordPress.org + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: WordPress Plugin Deploy + id: deploy + uses: 10up/action-wordpress-plugin-deploy@stable + with: + generate-zip: true + env: + #SVN_USERNAME: ${{ secrets.SVN_USERNAME }} + #SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }} + + - name: Upload release asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ github.event.release.upload_url }} + asset_path: ${{ steps.deploy.outputs.zip-path }} + asset_name: ${{ github.event.repository.name }}.zip + asset_content_type: application/zip diff --git a/.wordpress-org/banner-1544x500.png b/.wordpress-org/banner-1544x500.png new file mode 100644 index 000000000..fa08d1d2b Binary files /dev/null and b/.wordpress-org/banner-1544x500.png differ diff --git a/.wordpress-org/banner-772x250.png b/.wordpress-org/banner-772x250.png new file mode 100644 index 000000000..e8b54a7e3 Binary files /dev/null and b/.wordpress-org/banner-772x250.png differ diff --git a/.wordpress-org/banner.svg b/.wordpress-org/banner.svg new file mode 100644 index 000000000..2e4d362e2 --- /dev/null +++ b/.wordpress-org/banner.svg @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.wordpress-org/icon.svg b/.wordpress-org/icon.svg new file mode 100644 index 000000000..d49322898 --- /dev/null +++ b/.wordpress-org/icon.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/assets/js/plugin-check-admin.js b/assets/js/plugin-check-admin.js index d864d38c3..45b35d03d 100644 --- a/assets/js/plugin-check-admin.js +++ b/assets/js/plugin-check-admin.js @@ -35,6 +35,29 @@ canRunChecks(); pluginsList.addEventListener( 'change', canRunChecks ); + function saveUserSettings() { + const selectedCategories = []; + + // Assuming you have a list of category checkboxes, find the selected ones. + categoriesList.forEach( function ( checkbox ) { + if ( checkbox.checked ) { + selectedCategories.push( checkbox.value ); + } + } ); + + // Join the selected category slugs with '__' and save it as a user setting. + const settingValue = selectedCategories.join( '__' ); + window.setUserSetting( + 'plugin_check_category_preferences', + settingValue + ); + } + + // Attach the saveUserSettings function when a category checkbox is clicked. + categoriesList.forEach( function ( checkbox ) { + checkbox.addEventListener( 'change', saveUserSettings ); + } ); + // When the Check it button is clicked. checkItButton.addEventListener( 'click', ( e ) => { e.preventDefault(); diff --git a/includes/Admin/Admin_Page.php b/includes/Admin/Admin_Page.php index c942633c5..ba790c737 100644 --- a/includes/Admin/Admin_Page.php +++ b/includes/Admin/Admin_Page.php @@ -186,16 +186,20 @@ private function get_available_plugins() { * Renders the "Plugin Check" page. * * @since n.e.x.t + * + * @SuppressWarnings(PHPMD.UnusedLocalVariable) */ public function render_page() { - global $available_plugins, $selected_plugin_basename, $categories; - $available_plugins = $this->get_available_plugins(); $selected_plugin_basename = filter_input( INPUT_GET, 'plugin', FILTER_SANITIZE_FULL_SPECIAL_CHARS ); $categories = Check_Categories::get_categories(); + // Get user settings for category preferences and set a default value to check all categories by default. + $user_enabled_categories = get_user_setting( 'plugin_check_category_preferences', 'all_categories' ); + $user_enabled_categories = 'all_categories' === $user_enabled_categories ? $categories : explode( '__', $user_enabled_categories ); + require WP_PLUGIN_CHECK_PLUGIN_DIR_PATH . 'templates/admin-page.php'; } diff --git a/templates/admin-page.php b/templates/admin-page.php index 2188fa656..37445e1c8 100644 --- a/templates/admin-page.php +++ b/templates/admin-page.php @@ -45,7 +45,7 @@