diff --git a/.github/workflows/build-zip.yml b/.github/workflows/build-zip.yml index d4f4760..bdfb030 100644 --- a/.github/workflows/build-zip.yml +++ b/.github/workflows/build-zip.yml @@ -22,10 +22,10 @@ jobs: composer update - name: Run WordPress Coding Standard fixes - run: vendor/bin/phpcbf --extensions=php --ignore=*/vendor/*,*/doc/*,*/svn/*,*/node_modules/*,*/gettext-helper.php,*/classes/multilingual-plugins/easy-language/pagebuilder/divi/build/,*/classes/multilingual-plugins/easy-language/blocks/*/build/,*translatepress* --standard=ruleset.xml . + run: vendor/bin/phpcbf --extensions=php --ignore=*/vendor/*,*/doc/*,*/svn/*,*/node_modules/* --standard=ruleset.xml . - name: Run WordPress Coding Standard checks - run: vendor/bin/phpcs --extensions=php --ignore=*/vendor/*,*/doc/*,*/svn/*,*/node_modules/*,*/gettext-helper.php,*/classes/multilingual-plugins/easy-language/pagebuilder/divi/build/,*/classes/multilingual-plugins/easy-language/blocks/*/build/,*translatepress* --standard=ruleset.xml . + run: vendor/bin/phpcs --extensions=php --ignore=*/vendor/*,*/doc/*,*/svn/*,*/node_modules/* --standard=ruleset.xml . - name: Set version number 1 uses: richardrigutins/replace-in-files@v2 @@ -47,8 +47,8 @@ jobs: rm -fr build rm -fr releases rm -fr languages - rm -fr changelog.md rm -fr svn + rm changelog.md rm readme.md cd .. zip -r -q ${{ github.event.repository.name }}_${{ github.ref_name }}.zip ${{ github.event.repository.name }}/* -x "*/.git/*" "*/.github/*" "*/blocks/*/src/*" "*/doc/*" "*/phpcs.xml" "*/composer.json" "*/composer.lock" "*/package.json" "*/package-lock.json" "*/.gitignore" "*/vendor/*" "*/node_modules/*" "/.editorconfig" diff --git a/auto-category-for-posts.php b/auto-category-for-posts.php index 299c9d5..efd4fdf 100644 --- a/auto-category-for-posts.php +++ b/auto-category-for-posts.php @@ -84,22 +84,22 @@ function auto_category_save_post( int $post_id, WP_Post $post, bool $update ): v * @return array */ function auto_category_add_term_action( array $actions, WP_Term $tag ): array { - // bail if it is not the category taxonomy. + // bail if it is not the category taxonomy. if ( 'category' !== $tag->taxonomy ) { - return $actions; - } - - // get taxonomy as object. - $tax = get_taxonomy('category'); - if (current_user_can($tax->cap->manage_terms)) { - $text = __('Set as default', 'auto-category-for-posts'); - $value = ''; - if (absint(get_option(AUTOCATEGORY_OPTIONNAME)) === $tag->term_id) { - $text = __('Default category', 'auto-category-for-posts'); - $value = ' class="default_category"'; - } - $actions['auto_category'] = '' . esc_html( $text ) . ''; - } + return $actions; + } + + // get taxonomy as object. + $tax = get_taxonomy( 'category' ); + if ( current_user_can( $tax->cap->manage_terms ) ) { + $text = __( 'Set as default', 'auto-category-for-posts' ); + $value = ''; + if ( absint( get_option( AUTOCATEGORY_OPTIONNAME ) ) === $tag->term_id ) { + $text = __( 'Default category', 'auto-category-for-posts' ); + $value = ' class="default_category"'; + } + $actions['auto_category'] = '' . esc_html( $text ) . ''; + } return $actions; } add_filter( 'tag_row_actions', 'auto_category_add_term_action', 10, 2 ); diff --git a/readme.md b/readme.md index 2f476a0..ffa81ca 100644 --- a/readme.md +++ b/readme.md @@ -50,8 +50,8 @@ OR use ant in build/-directory: `ant json-translations` ### Run -`vendor/bin/phpcs --standard=WordPress file` +`vendor/bin/phpcs --extensions=php --ignore=*/vendor/*,*/doc/*,*/svn/*,*/node_modules/* --standard=ruleset.xml .` ### Repair -`vendor/bin/phpcbf --standard=WordPress file` \ No newline at end of file +`vendor/bin/phpcbf --extensions=php --ignore=*/vendor/*,*/doc/*,*/svn/*,*/node_modules/* --standard=ruleset.xml .` \ No newline at end of file diff --git a/ruleset.xml b/ruleset.xml new file mode 100644 index 0000000..c127447 --- /dev/null +++ b/ruleset.xml @@ -0,0 +1,20 @@ + + + + Auto Category For Posts Coding Standards + + + + + + + + + + + + + + + +