Skip to content

Commit

Permalink
Merge branch 'trunk' into fix/251-add-plugin-editor-link
Browse files Browse the repository at this point in the history
  • Loading branch information
mukeshpanchal27 authored Oct 30, 2023
2 parents 5df8da4 + f526b60 commit 2c3a5a8
Show file tree
Hide file tree
Showing 9 changed files with 105 additions and 3 deletions.
31 changes: 31 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -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
34 changes: 34 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -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
Binary file added .wordpress-org/banner-1544x500.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .wordpress-org/banner-772x250.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions .wordpress-org/banner.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions .wordpress-org/icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions assets/js/plugin-check-admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
8 changes: 6 additions & 2 deletions includes/Admin/Admin_Page.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
}

Expand Down
2 changes: 1 addition & 1 deletion templates/admin-page.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
<fieldset>
<legend class="screen-reader-text"><?php echo esc_html( $category ); ?></legend>
<label for="<?php echo esc_attr( $category ); ?>">
<input type="checkbox" id="<?php echo esc_attr( $category ); ?>" name="categories" value="<?php echo esc_attr( $category ); ?>" checked="checked" />
<input type="checkbox" id="<?php echo esc_attr( $category ); ?>" name="categories" value="<?php echo esc_attr( $category ); ?>" <?php checked( in_array( $category, $user_enabled_categories, true ) ); ?> />
<?php echo esc_html( ucfirst( str_replace( '_', ' ', $category ) ) ); ?>
</label>
</fieldset>
Expand Down

0 comments on commit 2c3a5a8

Please sign in to comment.