From ea55838d4885b028d71b7c5f5f67b66656ccf9ed Mon Sep 17 00:00:00 2001 From: Nikhil Date: Tue, 12 Jan 2021 12:14:37 +0530 Subject: [PATCH 01/12] Make sure the post-ID is choses as an integer for strict in_array checks --- class-unlist-posts-admin.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/class-unlist-posts-admin.php b/class-unlist-posts-admin.php index 24f4783..117d4eb 100644 --- a/class-unlist-posts-admin.php +++ b/class-unlist-posts-admin.php @@ -83,7 +83,7 @@ function metabox_render( $post ) { $checked = ''; - if ( in_array( $post->ID, $hidden_posts, true ) ) { + if ( in_array( (int) $post->ID, $hidden_posts, true ) ) { $checked = 'checked'; } From 2dfe1621542c1075026ae5fb61d9e8be44ffa0a6 Mon Sep 17 00:00:00 2001 From: Nikhil Date: Tue, 12 Jan 2021 12:17:06 +0530 Subject: [PATCH 02/12] Add changelog for v1.1.2 --- README.md | 5 ++++- readme.txt | 5 ++++- unlist-posts.php | 4 ++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 26c37d3..b696674 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ **Tags:** post, unlist posts, hide posts, **Requires at least:** 4.4 **Tested up to:** 5.6 -**Stable tag:** 1.1.1 +**Stable tag:** 1.1.2 **License:** GPLv2 or later **License URI:** http://www.gnu.org/licenses/gpl-2.0.html @@ -37,6 +37,9 @@ Just select option "Unlist Post" in any post of any type and that post will be h ## Changelog ## +### 1.1.2 ### +- Fix: Post metabox did not show the correct status if the post is unlisted or not in the classic editor. + ### 1.1.1 ### - Improvement: Added the WordPress 5.6 compatibilty. diff --git a/readme.txt b/readme.txt index 31be65c..4a0de61 100644 --- a/readme.txt +++ b/readme.txt @@ -4,7 +4,7 @@ Donate link: https://www.paypal.me/BrainstormForce Tags: post, unlist posts, hide posts, Requires at least: 4.4 Tested up to: 5.6 -Stable tag: 1.1.1 +Stable tag: 1.1.2 License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html @@ -37,6 +37,9 @@ Just select option "Unlist Post" in any post of any type and that post will be h == Changelog == += 1.1.2 = +- Fix: Post metabox did not show the correct status if the post is unlisted or not in the classic editor. + = 1.1.1 = - Improvement: Added the WordPress 5.6 compatibilty. diff --git a/unlist-posts.php b/unlist-posts.php index 58e7834..3930b9e 100644 --- a/unlist-posts.php +++ b/unlist-posts.php @@ -7,7 +7,7 @@ * Author URI: https://www.nikhilchavan.com/ * Text Domain: unlist-posts * Domain Path: /languages - * Version: 1.1.1 + * Version: 1.1.2 * * @package Hide_Post */ @@ -16,6 +16,6 @@ define( 'UNLIST_POSTS_DIR', plugin_dir_path( __FILE__ ) ); define( 'UNLIST_POSTS_URI', plugins_url( '/', __FILE__ ) ); -define( 'UNLIST_POSTS_VER', '1.1.1' ); +define( 'UNLIST_POSTS_VER', '1.1.2' ); require_once UNLIST_POSTS_DIR . 'class-unlist-posts.php'; From 5b4bae7f2a5825a930d628653d9a16dd1e69b059 Mon Sep 17 00:00:00 2001 From: Nikhil Date: Tue, 12 Jan 2021 13:42:29 +0530 Subject: [PATCH 03/12] Add phpcs github action --- .github/workflows/phpcs.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 .github/workflows/phpcs.yml diff --git a/.github/workflows/phpcs.yml b/.github/workflows/phpcs.yml new file mode 100644 index 0000000..68869dc --- /dev/null +++ b/.github/workflows/phpcs.yml @@ -0,0 +1,14 @@ +name: PHPCS check + +on: pull_request + +jobs: + phpcs: + name: PHPCS + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: PHPCS check + uses: chekalsky/phpcs-action@v1 + with: + enable_warnings: true From fd067a71987fe9d819c6c121891d2b121b6763c8 Mon Sep 17 00:00:00 2001 From: Nikhil Date: Tue, 12 Jan 2021 13:52:30 +0530 Subject: [PATCH 04/12] Remove phpcs rulesets as we already have phpcs config --- phpcs.ruleset.xml | 10 ---------- 1 file changed, 10 deletions(-) delete mode 100644 phpcs.ruleset.xml diff --git a/phpcs.ruleset.xml b/phpcs.ruleset.xml deleted file mode 100644 index 210c25a..0000000 --- a/phpcs.ruleset.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - Generally-applicable sniffs for WordPress plugins - - - - - */node_modules/* - */vendor/* - From 3d05c38e4be8fa148393a4c02e0c708094416aca Mon Sep 17 00:00:00 2001 From: Nikhil Date: Tue, 12 Jan 2021 13:52:40 +0530 Subject: [PATCH 05/12] Add phpcs dependencies --- composer.json | 15 ++++++++------- unlist-posts.php | 2 +- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/composer.json b/composer.json index 567436d..45699fc 100644 --- a/composer.json +++ b/composer.json @@ -1,9 +1,10 @@ { - "require-dev": { - "dealerdirect/phpcodesniffer-composer-installer": "^0.7.0", - "wp-coding-standards/wpcs": "dev-master", - "phpcompatibility/phpcompatibility-wp": "*" - }, - "require": { - } + "name": "brainstormforce/unlist-posts", + "description": "Unlist Posts from displaying anywhere on the site, only access the post with a direct link.", + "require-dev": { + "dealerdirect/phpcodesniffer-composer-installer": "^0.7.0", + "phpcompatibility/phpcompatibility-wp": "*", + "wp-coding-standards/wpcs": "^2" + }, + "require": {} } diff --git a/unlist-posts.php b/unlist-posts.php index 3930b9e..bf74e40 100644 --- a/unlist-posts.php +++ b/unlist-posts.php @@ -16,6 +16,6 @@ define( 'UNLIST_POSTS_DIR', plugin_dir_path( __FILE__ ) ); define( 'UNLIST_POSTS_URI', plugins_url( '/', __FILE__ ) ); -define( 'UNLIST_POSTS_VER', '1.1.2' ); +define( 'UNLIST_POSTS_VER', '1.1.2'); require_once UNLIST_POSTS_DIR . 'class-unlist-posts.php'; From 44488468f45eca201475eabe9bc48d87255ba4ea Mon Sep 17 00:00:00 2001 From: Nikhil Date: Tue, 12 Jan 2021 13:56:42 +0530 Subject: [PATCH 06/12] Install composer dependencies in the GA action --- .github/workflows/phpcs.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/phpcs.yml b/.github/workflows/phpcs.yml index 68869dc..c4b14d9 100644 --- a/.github/workflows/phpcs.yml +++ b/.github/workflows/phpcs.yml @@ -7,6 +7,9 @@ jobs: name: PHPCS runs-on: ubuntu-latest steps: + - name: Install dependencies + run: composer install --dev --prefer-dist --no-progress --no-suggest + - uses: actions/checkout@v2 - name: PHPCS check uses: chekalsky/phpcs-action@v1 From f4e4dd99420a27655187603037101ce007a5bd33 Mon Sep 17 00:00:00 2001 From: Nikhil Date: Tue, 12 Jan 2021 13:59:28 +0530 Subject: [PATCH 07/12] Checkout the code before running composer install --- .github/workflows/phpcs.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/phpcs.yml b/.github/workflows/phpcs.yml index c4b14d9..0725069 100644 --- a/.github/workflows/phpcs.yml +++ b/.github/workflows/phpcs.yml @@ -8,9 +8,9 @@ jobs: runs-on: ubuntu-latest steps: - name: Install dependencies - run: composer install --dev --prefer-dist --no-progress --no-suggest - - uses: actions/checkout@v2 + - run: ls -l && composer install --dev --prefer-dist --no-progress --no-suggest + - name: PHPCS check uses: chekalsky/phpcs-action@v1 with: From 14efd38e947b7ae4571379accee6f8c85a4ee182 Mon Sep 17 00:00:00 2001 From: Nikhil Date: Tue, 12 Jan 2021 14:01:17 +0530 Subject: [PATCH 08/12] Checkout the code in a separate action --- .github/workflows/phpcs.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/phpcs.yml b/.github/workflows/phpcs.yml index 0725069..56eafc8 100644 --- a/.github/workflows/phpcs.yml +++ b/.github/workflows/phpcs.yml @@ -7,8 +7,10 @@ jobs: name: PHPCS runs-on: ubuntu-latest steps: - - name: Install dependencies + - name: Checkout the code - uses: actions/checkout@v2 + + - name: Install dependencies - run: ls -l && composer install --dev --prefer-dist --no-progress --no-suggest - name: PHPCS check From 865887b6cec8df68d0efac249b689ad80c791508 Mon Sep 17 00:00:00 2001 From: Nikhil Date: Tue, 12 Jan 2021 14:03:32 +0530 Subject: [PATCH 09/12] Fix syntax for the GitHub action --- .github/workflows/phpcs.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/phpcs.yml b/.github/workflows/phpcs.yml index 56eafc8..7f819a6 100644 --- a/.github/workflows/phpcs.yml +++ b/.github/workflows/phpcs.yml @@ -7,7 +7,6 @@ jobs: name: PHPCS runs-on: ubuntu-latest steps: - - name: Checkout the code - uses: actions/checkout@v2 - name: Install dependencies From 7ca22fd05b98f2f3d23504876fb5f61d28232cf2 Mon Sep 17 00:00:00 2001 From: Nikhil Date: Tue, 12 Jan 2021 14:05:28 +0530 Subject: [PATCH 10/12] Update GitHub action syntax for steps --- .github/workflows/phpcs.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/phpcs.yml b/.github/workflows/phpcs.yml index 7f819a6..76c650a 100644 --- a/.github/workflows/phpcs.yml +++ b/.github/workflows/phpcs.yml @@ -7,10 +7,11 @@ jobs: name: PHPCS runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - name: Checkout + uses: actions/checkout@v2 - name: Install dependencies - - run: ls -l && composer install --dev --prefer-dist --no-progress --no-suggest + run: ls -l && composer install --dev --prefer-dist --no-progress --no-suggest - name: PHPCS check uses: chekalsky/phpcs-action@v1 From 25f99e7e3b712d3132ae0ba3ea449f2df46878a0 Mon Sep 17 00:00:00 2001 From: Nikhil Date: Tue, 12 Jan 2021 14:07:27 +0530 Subject: [PATCH 11/12] Use the phpcs bin from the project --- .github/workflows/phpcs.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/phpcs.yml b/.github/workflows/phpcs.yml index 76c650a..2301b64 100644 --- a/.github/workflows/phpcs.yml +++ b/.github/workflows/phpcs.yml @@ -17,3 +17,4 @@ jobs: uses: chekalsky/phpcs-action@v1 with: enable_warnings: true + phpcs_bin_path: './vendor/bin/phpcs' From 21ecf540cefd2b122713e41d8f284b5f66cb6f78 Mon Sep 17 00:00:00 2001 From: Nikhil Date: Tue, 12 Jan 2021 14:08:51 +0530 Subject: [PATCH 12/12] Remove the code used for debugging --- .github/workflows/phpcs.yml | 2 +- unlist-posts.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/phpcs.yml b/.github/workflows/phpcs.yml index 2301b64..ceb2443 100644 --- a/.github/workflows/phpcs.yml +++ b/.github/workflows/phpcs.yml @@ -11,7 +11,7 @@ jobs: uses: actions/checkout@v2 - name: Install dependencies - run: ls -l && composer install --dev --prefer-dist --no-progress --no-suggest + run: composer install --dev --prefer-dist --no-progress --no-suggest - name: PHPCS check uses: chekalsky/phpcs-action@v1 diff --git a/unlist-posts.php b/unlist-posts.php index bf74e40..3930b9e 100644 --- a/unlist-posts.php +++ b/unlist-posts.php @@ -16,6 +16,6 @@ define( 'UNLIST_POSTS_DIR', plugin_dir_path( __FILE__ ) ); define( 'UNLIST_POSTS_URI', plugins_url( '/', __FILE__ ) ); -define( 'UNLIST_POSTS_VER', '1.1.2'); +define( 'UNLIST_POSTS_VER', '1.1.2' ); require_once UNLIST_POSTS_DIR . 'class-unlist-posts.php';