Plugin Directory

Changeset 3462142


Ignore:
Timestamp:
02/16/2026 01:47:42 AM (6 weeks ago)
Author:
joshuadnelson
Message:

Update to version 0.5.5 from GitHub

Location:
disable-blog
Files:
2 added
28 edited
1 copied

Legend:

Unmodified
Added
Removed
  • disable-blog/tags/0.5.5/CHANGELOG.md

    r3010321 r3462142  
    11# Changelog
    22
     3## 0.5.5
     4
     5- Tested up to WordPress 6.9.1
     6- Tested up to PHP 8.4
     7- Bump minimum WordPress version to 5.9
     8- Add composer support, move over to composer for phpcs, phpstan, and linting checks
     9- Upgrade Github actions to `actions/checkout@v4` running on php `8.4`
     10- Fix issue with Query Loop block, now defaults to `page` type instead of 'post' when 'post' is disabled.
     11
    312## 0.5.4
     13
    414- Tested up to WordPress 6.4.2.
    515- Bump minimum WordPress version to 5.3, aligning with minimum PHP support.
    616- Test to PHP 8.2.
    717- Update Github actions.
    8 - Add Code Standard fixer Github Action, h/t @szepeviktor 
    9 - Fix coding standards and a bunch of typos, h/t @szepeviktor 
     18- Add Code Standard fixer Github Action, h/t @szepeviktor
     19- Fix coding standards and a bunch of typos, h/t @szepeviktor
    1020- Increase accuracy of CSS selector used to hide blog related items in Settings > Reading, closes [#69](https://github.com/joshuadavidnelson/disable-blog/issues/69)
    1121- Add `.wp-env.json` for local development.
    1222
    1323## 0.5.3
     24
    1425- Fix `typeof` typo in `disable-blog-customizer.js` from 0.5.2 updates for #59.
    1526- Fix uninstall error to allow for the plugin to be deleted correctly.
     
    2132
    2233## 0.5.2
     34
    2335- Test up to WP 6.1.1
    2436- Increase minimum PHP to v7.4
    2537- Test to PHP 8.1
    2638- Update Github Actions to current versions.
    27 - Fix some bugs introduced in v0.5.1: Reverts "Remove core post-related blocks in editor" - WP core handles the missing taxonomy endpoints (noted in issue 53) fine without any intervention and pulling these blocks out causes other issues. Also removes `dwpb_disabled_blocks` filter. Closes #60 Closes #53 
     39- Fix some bugs introduced in v0.5.1: Reverts "Remove core post-related blocks in editor" - WP core handles the missing taxonomy endpoints (noted in issue 53) fine without any intervention and pulling these blocks out causes other issues. Also removes `dwpb_disabled_blocks` filter. Closes #60 Closes #53
    2840- Adds a check to the customizer script to avoid a TypeError. Closes #59
    2941- Increase specificity in permalinks page to correctly target and remove "optional" section when category and post tags are not supported by any post type (default condition). Closes #62
    3042
    3143## 0.5.1
     44
    3245- Update to documentation, readmes, and doc blocks.
    3346- Fix `.distignore` to remove itself and .gitignore from WP-dot-org repo.
     
    3851- Test up to WordPress v6.0.2
    3952- Remove core post-related blocks in editor Closes [#53](https://github.com/joshuadavidnelson/disable-blog/issues/53). Adds `dwpb_disabled_blocks` passing array of blocks being disabled by the plugin.
    40 - Add scripts and styles to change Customizer view of homepage settings, matching the static homepage settings and updated text. 
     53- Add scripts and styles to change Customizer view of homepage settings, matching the static homepage settings and updated text.
    4154- Update loader class to provide a `remove_filter` method. Closes [#58](https://github.com/joshuadavidnelson/disable-blog/issues/58).
    4255- Alter permalink settings based on if categories and author archives are supported.
     
    4558## 0.5.0
    4659
    47 **New**
     60### New
     61
    4862- New disable author archive functionality via new `dwpb_disable_author_archives` filter. Pass `true` to disable author archives entirely. Default does not disable author archives because numerous other plugins use author archives for other purposes. (A future settings page will provide more flexibility here).
    4963- New `dwpb_author_archive_post_types` filter to provide author archive support for custom post types. Pass an array of post type slugs to this filter to modify the post types queried on author archives, if not removed by filter above.
     
    5973- New `dwpb_pass_query_string_on_redirect` filter, returning `true` enables all valid url query params to be passed during redirects. Default is false. Use the `dwpb_allowed_query_vars` to limit the vars passed in the redirect by passing an array of keys (e.g. return array( 'utm' ) to only pass utm query variables in the query string). Closes #52
    6074- Add javascript to hide admin screen items not easily selected by CSS, include:
    61     - Hiding toggle comment link on welcome screen (if they are not supported by other post types),
    62     - Hiding the category and tag permalink base options (if not supported by other post types), and
    63     - Hiding the default category & default post format on Writing options page.
    64 
    65 **Fixes**
     75  - Hiding toggle comment link on welcome screen (if they are not supported by other post types),
     76  - Hiding the category and tag permalink base options (if not supported by other post types), and
     77  - Hiding the default category & default post format on Writing options page.
     78
     79### Fixes
     80
    6681- Add `dwpb_disabled_xmlpc_methods` filter to extend the methods being disabled by the plugin. Pass `false` to remove the functionality entirely. Closes [#50](https://github.com/joshuadavidnelson/disable-blog/issues/50)
    6782- Bring back some admin page redirects to account for use cases where direct access to `post.php`, `post-new.php`, etc occur. Closes [#45](https://github.com/joshuadavidnelson/disable-blog/issues/45).
     
    7085- In order to account for multiple subpages of a common parent page being removed the `dwpb_menu_subpages_to_remove` param has been updated to support an array of subpages in the format of `$remove_subpages['parent-page-slug.php'] = array( 'subpage-1.php', 'subpage-2.php' );`, though it still supports subpages as strings for backwards compatibility. Fixes bugs were `options-writing.php` and `options-discussion.php` were conflicting.
    7186
    72 **Improvements/Updates**
     87### Improvements/Updates
     88
    7389- Update admin filters to a common format and removing redundant filters. Filter changes include:
    74     - New filter: `dwpb_redirect_admin_url` filters the final url used in admin redirects.
    75     - `dwpb_redirect_admin` only accepts 1 parameter, the previous version accepted 3 (dropping `$redirect_url` & `$current_url`).
    76     - `dwpb_redirect_admin_edit_post` is now `dwpb_redirect_admin_edit`.
    77     - `dwpb_redirect_single_post_edit` is now `dwpb_redirect_admin_post`.
    78     - `dwpb_redirect_admin_edit_single_post` is now `dwpb_redirect_admin_edit`.
    79     - `dwpb_redirect_edit_tax` has been removed. Use `dwpb_redirect_admin_edit_tags` or `dwpb_redirect_admin_term` instead, depending on the context.
    80     - `dwpb_redirect_edit_comments` has been removed. use `dwpb_redirect_admin_edit_comments` instead.
    81     - `dwpb_redirect_options_discussion` has been removed. Use `dwpb_redirect_admin_options_discussion` instead.
    82     - The filter `dwpb_redirect_admin_options_writing` that would pass a boolean to toggle off the options writing page has been remained `dwpb_remove_options_writing` and must be passed with `true` in order to have the page redirect _and_ the admin menu item removed. By default the value filtered is false and the options Writing page does not go away, as numerous other plugins use this page for non-blog related settings. Now `dwpb_redirect_admin_options_writing` is used to filter the redirect url itself, replacing the previously named `dwpb_redirect_options_writing` filter. 
    83     - `dwpb_redirect_options_tools` has been removed. Use `dwpb_redirect_admin_options_tools` instead.
    84     - New filter: `dwpb_disabled_xmlpc_methods` (see above).
    85     - New filter: `dwpb_author_archive_post_types` (see above).
    86     - New filter: `dwpb_disable_author_archives` (see above).
     90  - New filter: `dwpb_redirect_admin_url` filters the final url used in admin redirects.
     91  - `dwpb_redirect_admin` only accepts 1 parameter, the previous version accepted 3 (dropping `$redirect_url` & `$current_url`).
     92  - `dwpb_redirect_admin_edit_post` is now `dwpb_redirect_admin_edit`.
     93  - `dwpb_redirect_single_post_edit` is now `dwpb_redirect_admin_post`.
     94  - `dwpb_redirect_admin_edit_single_post` is now `dwpb_redirect_admin_edit`.
     95  - `dwpb_redirect_edit_tax` has been removed. Use `dwpb_redirect_admin_edit_tags` or `dwpb_redirect_admin_term` instead, depending on the context.
     96  - `dwpb_redirect_edit_comments` has been removed. use `dwpb_redirect_admin_edit_comments` instead.
     97  - `dwpb_redirect_options_discussion` has been removed. Use `dwpb_redirect_admin_options_discussion` instead.
     98  - The filter `dwpb_redirect_admin_options_writing` that would pass a boolean to toggle off the options writing page has been remained `dwpb_remove_options_writing` and must be passed with `true` in order to have the page redirect _and_ the admin menu item removed. By default the value filtered is false and the options Writing page does not go away, as numerous other plugins use this page for non-blog related settings. Now `dwpb_redirect_admin_options_writing` is used to filter the redirect url itself, replacing the previously named `dwpb_redirect_options_writing` filter. 
     99  - `dwpb_redirect_options_tools` has been removed. Use `dwpb_redirect_admin_options_tools` instead.
     100  - New filter: `dwpb_disabled_xmlpc_methods` (see above).
     101  - New filter: `dwpb_author_archive_post_types` (see above).
     102  - New filter: `dwpb_disable_author_archives` (see above).
    87103- Update public redirect filters to match the pattern used for the new admin redirects. Filer changes include:
    88     - New filter: `dwpb_front_end_redirect_url` filters the final url used in front end redirects.
    89     - New filter: `dwpb_redirect_author_archive` to change the redirect used on author archives, if they are disabled.
    90     - New filter: `dwpb_disable_user_sitemap` to change the user sitemap default, pass `true` to keep disable the sitmap. Note that if author archives are disabled by the above filter, user sitemps will be also be disabled regardless of this filter.
    91     - `dwpb_redirect_posts` is now `dwpb_redirect_post`.
    92     - `dwpb_redirect_post_{$post->ID}` filter has been removed. Use `dwpb_redirect_post` and check for the post id to target a specific post.
    93     - `dwpb_redirect_front_end` only accepts 1 parameter, the previous version accepted 3 (dropping `$redirect_url` & `$current_url`).
     104  - New filter: `dwpb_front_end_redirect_url` filters the final url used in front end redirects.
     105  - New filter: `dwpb_redirect_author_archive` to change the redirect used on author archives, if they are disabled.
     106  - New filter: `dwpb_disable_user_sitemap` to change the user sitemap default, pass `true` to keep disable the sitmap. Note that if author archives are disabled by the above filter, user sitemps will be also be disabled regardless of this filter.
     107  - `dwpb_redirect_posts` is now `dwpb_redirect_post`.
     108  - `dwpb_redirect_post_{$post->ID}` filter has been removed. Use `dwpb_redirect_post` and check for the post id to target a specific post.
     109  - `dwpb_redirect_front_end` only accepts 1 parameter, the previous version accepted 3 (dropping `$redirect_url` & `$current_url`).
    94110- Bump minimum PHP to 5.6.
    95111- Tested up to WP Core version 5.9.3.
     
    98114
    99115## 0.4.10
     116
    100117- Fix a bug from v0.4.9 that caused redirects on custom post type archives, correcting the `modify_query` function to only remove posts from built-in taxonomy archives, as that was the original intent.
    101118
    102119## 0.4.9
     120
    103121- **Notice:** We've added the minimum PHP version requirement of 5.3, which was not explicitly set before now.
    104122- **Big change:** the plugin now changes the `post_type` arguments for posts so they are no longer public and removes all post_type support parameters. This disables the post-related admin redirects, as WordPress will now show users an error page stating "Sorry, you are not allowed to edit posts in this post type." It also pulls posts out of a lot of other locations (menus, etc) and is a much more efficient method of "disabling" the post type. This method is also used on built-in taxonomies, unless another post type supports them. **This change may impact other plugins or themes, be sure to back up your site and, if you can, test these changes prior to updating the plugin on a production site.**
     
    114132- Remove header feed urls, unless supported by another post type.
    115133- WordPress 5.5 support:
    116     - Remove 'post' post type from XML sitemaps.
    117     - Remove built-in taxonomies from XML sitemaps, if not being used by a custom post type.
    118     - Fix sitemap redirect issues.
     134  - Remove 'post' post type from XML sitemaps.
     135  - Remove built-in taxonomies from XML sitemaps, if not being used by a custom post type.
     136  - Fix sitemap redirect issues.
    119137- **Developers:** Filters were removed and altered in this version:
    120     - The `dwpb_redirect_feeds` filter now has (3) params, to match those in the `dwpb_disable_feed` filter: $bool, $post, $is_comment_feed.
    121     - The `dwpb_author_post_types` filter is now `dwpb_archive_post_types`, as the query modification now includes all pages passing `is_archive`.
    122     - Removed filters: `dwpb_disable_rest_api`, `dwpb_remove_post_comment_support`, `dwpb_remove_post_trackback_support`, `dwpb_redirect_admin_edit_single_post`, `dwpb_redirect_single_post_edit`, `dwpb_redirect_admin_edit_post`, `dwpb_redirect_edit`, `dwpb_redirect_admin_post_new`, `dwpb_redirect_post_new` as these are rendered obsolete by above changes.
     138  - The `dwpb_redirect_feeds` filter now has (3) params, to match those in the `dwpb_disable_feed` filter: $bool, $post, $is_comment_feed.
     139  - The `dwpb_author_post_types` filter is now `dwpb_archive_post_types`, as the query modification now includes all pages passing `is_archive`.
     140  - Removed filters: `dwpb_disable_rest_api`, `dwpb_remove_post_comment_support`, `dwpb_remove_post_trackback_support`, `dwpb_redirect_admin_edit_single_post`, `dwpb_redirect_single_post_edit`, `dwpb_redirect_admin_edit_post`, `dwpb_redirect_edit`, `dwpb_redirect_admin_post_new`, `dwpb_redirect_post_new` as these are rendered obsolete by above changes.
    123141
    124142## 0.4.8.1
     143
    125144- Do'h! Forgot to update the version number in the main plugin file. Bump.
    126145
    127146## 0.4.8
     147
    128148- Fixed typo in variable name for current vs redirect url check. (h/t @chesio, PR #30)
    129149- Update function names from template to `disable_blog`. (h/t @szepeviktor, PR #31)
     
    133153
    134154## 0.4.7
     155
    135156- Using GitHub actions publish on WP.org from github releases.
    136157- Cleaned up the Reading settings, adding admin notices if front page is not set.
     
    140161
    141162## 0.4.6
     163
    142164- Added check on disable feed functionality to confirm post type prior to disabling feed.
    143165
    144166## 0.4.5
     167
    145168- Remove the functionality hiding the Settings > Writing admin page, allow this option to be re-enabled via the older filter. This page used to be entirely related to posts, but is also used to select the editor type (Gutenberg vs Classic).
    146169- Correct misspelled dwpb_redirect_options_tools filter.
    147170
    148171## 0.4.4
     172
    149173- Hide the Settings > Writing menu item, which shows up with Disable Comments enabled everywhere. Thanks to @dater for identifying.
    150174
    151175## 0.4.3
     176
    152177- Fix fatal error conflict with WooCommerce versions older than 2.6.3 (props to @Mahjouba91 for the heads up), no returns an array of comments in the filter for those older WooCommerce versions.
    153178- Add de/activation hooks to clear comment caches
     
    155180
    156181## 0.4.2
     182
    157183- Disable the REST API for 'post' post type. Props to @shawnhooper.
    158184
    159185## 0.4.1
     186
    160187- Fix unintended redirect for custom admin pages under tools.php. Props to @greatislander for the catch.
    161188
    162189## 0.4.0
     190
    163191- Refactor code to match WP Plugin Boilerplate structure, including:
    164  - Move hooks and filters into loader class.
    165  - Separate Admin and Public hooks.
    166  - Add support for internationalization.
     192- Move hooks and filters into loader class.
     193- Separate Admin and Public hooks.
     194- Add support for internationalization.
    167195- Expanded inline documentation.
    168196- Add another failsafe for potential redirect loops.
     
    177205
    178206## 0.3.3
     207
    179208- Weird issue with svn, same as version 0.3.2.
    180209
    181210## 0.3.2
     211
    182212- Fix potential loop issue with `home_url` in redirection function.
    183213- Fix custom taxonomy save redirect (used to redirect to dashboard, now it saves correctly).
    184214
    185215## 0.3.1
     216
    186217- Add/update readme.txt.
    187218
    188219## 0.3.0
     220
    189221- Singleton Class.
    190222- Clean up documentation.
    191223- Add filters.
    192     
     224  
    193225## 0.2.0
     226
    194227More improvements:
    195228
     
    211244
    212245## 0.1.0
     246
    213247Initial beta release.
  • disable-blog/tags/0.5.5/README.md

    r3010321 r3462142  
    44[![WordPress Plugin Version](https://img.shields.io/wordpress/plugin/v/disable-blog)](https://wordpress.org/plugins/disable-blog/) ![Downloads](https://img.shields.io/wordpress/plugin/dt/disable-blog.svg) ![Rating](https://img.shields.io/wordpress/plugin/r/disable-blog.svg)
    55
    6 **Requires at least WordPress:** 5.3 
    7 **Tested up to WordPress:** 6.4.2 
    8 **Stable version:** 0.5.4 
     6[![WP compatibility](https://plugintests.com/plugins/wporg/disable-blog/wp-badge.svg)](https://plugintests.com/plugins/wporg/disable-blog/latest) [![PHP compatibility](https://plugintests.com/plugins/wporg/disable-blog/php-badge.svg)](https://plugintests.com/plugins/wporg/disable-blog/latest)
     7
     8**Requires at least WordPress:** 5.9 
     9**Tested up to WordPress:** 6.9 
     10**Stable version:** 0.5.5 
    911**License:** GPLv2 or later 
    1012**Requires PHP:** 7.4 
    11 **Tested up to PHP:** 8.2 
     13**Tested up to PHP:** 8.4 
    1214
    1315All the power of WordPress, without a blog.
     
    104106All pull requests should be directed at the `develop` branch, and will be reviewed prior to merging. No pull requests will be merged with failing tests, but it's okay if you don't initially pass tests. Please create a draft pull request for proof of concept code or changes you'd like to have input on prior to review.
    105107
    106 Please make on a branch specific to a single issue or feature. For instance, if you are suggest a solution to an issue, please create fork with a branch like `issue-894`. Or if you are proposing a new feature, create a fork with the branch name indicating the feature like `feature-example-bananas`
     108For instance, to suggest a solution to an issue please create fork with a branch like `issue-42`. Or, if you're proposing a new feature, create a fork with the branch name indicating the feature like `feature-example-bananas`
    107109
    108110All improvements are merged into `develop` and then queued up for release before being merged into `stable`. Releases are deployed via github actions to wordpress.org on tagging a new release.
  • disable-blog/tags/0.5.5/disable-blog.php

    r3010321 r3462142  
    99 *
    1010 * @link    https://github.com/joshuadavidnelson/disable-blog
    11  * @since   0.4.0
    1211 * @package Disable_Blog
    1312 *
     
    1615 * Plugin URI:  https://wordpress.org/plugins/disable-blog/
    1716 * Description: Go blog-less with WordPress. This plugin disables all blog-related functionality (by hiding, removing, and redirecting).
    18  * Version:     0.5.4
     17 * Version:     0.5.5
    1918 * Author:      Joshua David Nelson
    2019 * Author URI:  http://joshuadnelson.com
     
    6059define( 'DWPB_URL', plugins_url( '/', __FILE__ ) );
    6160define( 'DWPB_PLUGIN_NAME', 'disable-blog' );
    62 define( 'DWPB_VERSION', '0.5.4' );
     61define( 'DWPB_VERSION', '0.5.5' );
    6362
    6463/**
  • disable-blog/tags/0.5.5/includes/class-disable-blog-activator.php

    r3010321 r3462142  
    149149     */
    150150    private static function check_caps() {
    151 
    152         if ( current_user_can( 'activate_plugins' ) ) {
    153             return true;
    154         }
    155 
    156         return false;
     151        return current_user_can( 'activate_plugins' );
    157152    }
    158153}
  • disable-blog/tags/0.5.5/includes/class-disable-blog-admin.php

    r3010321 r3462142  
    5454     */
    5555    public function __construct( $plugin_name, $version ) {
    56 
    5756        $this->plugin_name = $plugin_name;
    5857        $this->version     = $version;
     
    9493     * @since 0.4.9 removed rest api specific filter and updated function
    9594     *              for disabling all public-facing aspects of the 'post' post type.
     95     * @return void
    9696     */
    9797    public function modify_post_type_arguments() {
     
    126126            // remove supports.
    127127            $wp_post_types['post']->supports = array();
    128 
    129128        }
    130129    }
     
    408407     */
    409408    public function redirect_admin_options_discussion() {
    410 
    411409        return $this->redirect_admin_edit_comments();
    412410    }
     
    422420        // Redirect writing options to general options.
    423421        if ( $this->remove_writing_options() ) {
    424 
    425422            return admin_url( 'options-general.php' );
    426 
    427423        }
    428424
     
    554550         * @param bool $bool Defaults to false, keeping the writing page visible.
    555551         */
    556         return apply_filters( 'dwpb_remove_options_writing', false );
     552        return (bool) apply_filters( 'dwpb_remove_options_writing', false );
    557553    }
    558554
     
    704700     */
    705701    public function has_front_page() {
    706 
    707702        return 'page' === get_option( 'show_on_front' ) && absint( get_option( 'page_on_front' ) );
    708703    }
     
    715710     */
    716711    public function disable_press_this() {
    717 
    718712        wp_die( '"Press This" functionality has been disabled.' );
    719713    }
     
    795789     */
    796790    public function enqueue_styles() {
    797 
    798791        wp_enqueue_style( $this->plugin_name, plugin_dir_url( __FILE__ ) . '../assets/css/disable-blog-admin.css', array(), $this->version, 'all' );
    799792    }
     
    829822     */
    830823    public function is_admin_page( $page ) {
    831 
    832824        global $pagenow;
    833 
    834825        return is_admin() && isset( $pagenow ) && is_string( $pagenow ) && $page . '.php' === $pagenow;
    835826    }
     
    1002993     */
    1003994    public function filter_existing_comments( $comments, $post_id ) {
    1004 
    1005995        return ( 'post' === get_post_type( $post_id ) ) ? array() : $comments;
    1006996    }
     
    10341024    public function site_status_tests( $tests ) {
    10351025
    1036         if ( isset( $tests['direct']['rest_availability'] ) && is_callable( array( $this, 'get_test_rest_availability' ) ) ) {
     1026        if ( isset( $tests['direct']['rest_availability'] ) ) {
    10371027            $tests['direct']['rest_availability']['test'] = array( $this, 'get_test_rest_availability' );
    10381028        }
     
    10551045
    10561046        $result = array(
    1057             'label'       => __( 'The REST API is available' ),
     1047            'label'       => __( 'The REST API is available' ), // phpcs:ignore WordPress.WP.I18n.MissingArgDomain
    10581048            'status'      => 'good',
    10591049            'badge'       => array(
    1060                 'label' => __( 'Performance' ),
     1050                'label' => __( 'Performance' ), // phpcs:ignore WordPress.WP.I18n.MissingArgDomain
    10611051                'color' => 'blue',
    10621052            ),
    10631053            'description' => sprintf(
    10641054                '<p>%s</p>',
    1065                 __( 'The REST API is one way WordPress, and other applications, communicate with the server. One example is the block editor screen, which relies on this to display, and save, your posts and pages.' )
     1055                __( 'The REST API is one way WordPress, and other applications, communicate with the server. One example is the block editor screen, which relies on this to display, and save, your posts and pages.' ) // phpcs:ignore WordPress.WP.I18n.MissingArgDomain
    10661056            ),
    10671057            'actions'     => '',
     
    10691059        );
    10701060
    1071         $cookies = wp_unslash( $_COOKIE );
     1061        $cookies = wp_unslash( $_COOKIE ); // phpcs:ignore WordPressVIPMinimum.Variables.RestrictedVariables.cache_constraints___COOKIE
    10721062        $timeout = 10;
    10731063        $headers = array(
     
    10971087        );
    10981088
    1099         $r = wp_remote_get( $url, compact( 'cookies', 'headers', 'timeout', 'sslverify' ) );
     1089        $r = wp_remote_get( $url, compact( 'cookies', 'headers', 'timeout', 'sslverify' ) ); // phpcs:ignore WordPressVIPMinimum.Functions.RestrictedFunctions.wp_remote_get_wp_remote_get
    11001090
    11011091        if ( is_wp_error( $r ) ) {
    11021092            $result['status'] = 'critical';
    11031093
    1104             $result['label'] = __( 'The REST API encountered an error' );
     1094            $result['label'] = __( 'The REST API encountered an error' ); // phpcs:ignore WordPress.WP.I18n.MissingArgDomain
    11051095
    11061096            $result['description'] .= sprintf(
     
    11081098                sprintf(
    11091099                    '%s<br>%s',
    1110                     __( 'The REST API request failed due to an error.' ),
     1100                    __( 'The REST API request failed due to an error.' ), // phpcs:ignore WordPress.WP.I18n.MissingArgDomain
    11111101                    sprintf(
    11121102                        /* translators: 1: The WordPress error message. 2: The WordPress error code. */
    1113                         __( 'Error: %1$s (%2$s)' ),
     1103                        __( 'Error: %1$s (%2$s)' ), // phpcs:ignore WordPress.WP.I18n.MissingArgDomain
    11141104                        $r->get_error_message(),
    11151105                        $r->get_error_code()
     
    11201110            $result['status'] = 'recommended';
    11211111
    1122             $result['label'] = __( 'The REST API encountered an unexpected result' );
     1112            $result['label'] = __( 'The REST API encountered an unexpected result' ); // phpcs:ignore WordPress.WP.I18n.MissingArgDomain
    11231113
    11241114            $result['description'] .= sprintf(
     
    11261116                sprintf(
    11271117                    /* translators: 1: The HTTP error code. 2: The HTTP error message. */
    1128                     __( 'The REST API call gave the following unexpected result: (%1$d) %2$s.' ),
     1118                    __( 'The REST API call gave the following unexpected result: (%1$d) %2$s.' ), // phpcs:ignore WordPress.WP.I18n.MissingArgDomain
    11291119                    wp_remote_retrieve_response_code( $r ),
    11301120                    esc_html( wp_remote_retrieve_body( $r ) )
     
    11371127                $result['status'] = 'recommended';
    11381128
    1139                 $result['label'] = __( 'The REST API did not behave correctly' );
     1129                $result['label'] = __( 'The REST API did not behave correctly' ); // phpcs:ignore WordPress.WP.I18n.MissingArgDomain
    11401130
    11411131                $result['description'] .= sprintf(
     
    11431133                    sprintf(
    11441134                        /* translators: %s: The name of the query parameter being tested. */
    1145                         __( 'The REST API did not process the %s query parameter correctly.' ),
     1135                        __( 'The REST API did not process the %s query parameter correctly.' ), // phpcs:ignore WordPress.WP.I18n.MissingArgDomain
    11461136                        '<code>context</code>'
    11471137                    )
     
    11881178        $args  = array(
    11891179            'fields'                 => 'ids',
    1190             'posts_per_page'         => 500,
     1180            'posts_per_page'         => 100,
    11911181            'post_type'              => $post_type,
    11921182            'no_found_rows'          => true,
    11931183            'update_post_meta_cache' => false,
    1194             'tax_query'              => array(
     1184            'tax_query'              => array( // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_tax_query
    11951185                array(
    11961186                    'taxonomy' => $taxonomy,
     
    14431433        return $available_tags;
    14441434    }
     1435
     1436    /**
     1437     * Filter the block settings to change the post type from 'post' to 'page'.
     1438     *
     1439     * @since 0.5.5
     1440     * @param array $metadata The block metadata.
     1441     * @return array
     1442     */
     1443    public function filter_block_type_metadata( $metadata ) {
     1444
     1445        // Bail if the metadata is not configured as expected.
     1446        if ( ! isset( $metadata['name'] ) || ! is_string( $metadata['name'] ) ) {
     1447            return $metadata;
     1448        }
     1449
     1450        // If the block is the query block, change the post type to 'page'.
     1451        if ( 'core/query' === $metadata['name'] && isset( $metadata['attributes']['query']['default'] ) ) {
     1452            $metadata['attributes']['query']['default']['postType'] = 'page';
     1453        }
     1454
     1455        return $metadata;
     1456    }
    14451457}
  • disable-blog/tags/0.5.5/includes/class-disable-blog-deactivator.php

    r3010321 r3462142  
    149149     */
    150150    private static function check_caps() {
    151 
    152         if ( current_user_can( 'activate_plugins' ) ) {
    153             return true;
    154         }
    155 
    156         return false;
     151        return current_user_can( 'activate_plugins' );
    157152    }
    158153}
  • disable-blog/tags/0.5.5/includes/class-disable-blog-functions.php

    r3010321 r3462142  
    7777        wp_parse_str( $_SERVER['QUERY_STRING'], $query_vars ); // phpcs:ignore
    7878
    79         /**
    80          * Filter for allowed queary string variables.
     79        // Only allow specific query vars.
     80        $allowed_query_vars = $this->get_allowed_query_vars();
     81        if ( ! empty( $allowed_query_vars ) ) {
     82
     83            // Only keep the allowed query vars, if there are any.
     84            // Sanitizing the keys and filtering out any empty values.
     85            // Let add_query_arg handle the sanitization of the values.
     86            $valid_query_var_keys = array_flip( $allowed_query_vars );
     87            $query_vars           = array_filter( array_intersect_key( $query_vars, $valid_query_var_keys ) );
     88
     89            // if we have any query variables, add it to the url.
     90            if ( ! empty( $query_vars ) ) {
     91                $url = add_query_arg( $query_vars, $url );
     92            }
     93        }
     94
     95        return $url;
     96    }
     97
     98    /**
     99     * Get the allowed query vars.
     100     *
     101     * @since 0.5.5
     102     * @return array
     103     */
     104    private function get_allowed_query_vars() {
     105
     106        /**
     107         * Filter for allowed query string variables.
    81108         *
    82109         * @since 0.5.0
     
    84111         * @return array
    85112         */
    86         $allowed_query_vars = apply_filters( 'dwpb_allowed_query_vars', array() );
    87         if ( ! empty( $allowed_query_vars ) && is_array( $allowed_query_vars ) ) {
    88             $allowed_query_vars = array_filter( $allowed_query_vars, 'esc_html' );
    89             $query_vars         = array_intersect_key( $query_vars, array_flip( $allowed_query_vars ) );
    90         }
    91 
    92         // Escaping and sanitization are important.
    93         $query_vars = array_filter( $query_vars, 'esc_html' );
    94         $query_vars = array_filter( $query_vars, 'esc_html', ARRAY_FILTER_USE_KEY );
    95 
    96         // if we have any query variables, add it to the url.
    97         if ( ! empty( $query_vars ) && is_array( $query_vars ) ) {
    98             $url = add_query_arg( $query_vars, $url );
    99         }
    100 
    101         return $url;
     113        $allowed_query_vars = (array) apply_filters( 'dwpb_allowed_query_vars', array() );
     114
     115        // Sanitizing the keys and filtering out any empty values.
     116        return array_filter( array_map( 'sanitize_key', $allowed_query_vars ) );
    102117    }
    103118
     
    138153     *
    139154     * @since 0.5.0
    140      * @param string $url    the fallback url.
     155     * @param string $url the fallback url.
    141156     * @return string
    142157     */
  • disable-blog/tags/0.5.5/includes/class-disable-blog-i18n.php

    r3010321 r3462142  
    2929     */
    3030    public function load_plugin_textdomain() {
    31 
    3231        load_plugin_textdomain(
    3332            'disable-blog',
  • disable-blog/tags/0.5.5/includes/class-disable-blog-integrations.php

    r3010321 r3462142  
    3434
    3535        // Check if the the plugin is active.
    36         if ( is_plugin_active( $plugin ) ) {
    37             return true;
    38         }
    39 
    40         return false;
     36        return is_plugin_active( $plugin );
    4137    }
    4238
     
    4844     */
    4945    public function is_disable_comments_active() {
    50 
    51         // Check if the Disable Comments plugin is active.
    52         if ( $this->is_plugin_active( 'disable-comments/disable-comments.php' ) || class_exists( 'Disable_Comments' ) ) {
    53             return true;
    54         }
    55 
    56         return false;
     46        return ( $this->is_plugin_active( 'disable-comments/disable-comments.php' ) || class_exists( 'Disable_Comments' ) );
    5747    }
    5848
     
    6454     */
    6555    public function is_woocommerce_active() {
    66 
    67         // Check if the Disable Comments plugin is active.
    68         if ( $this->is_plugin_active( 'woocommerce/woocommerce.php' ) || function_exists( 'WC' ) ) {
    69             return true;
    70         }
    71 
    72         return false;
     56        return ( $this->is_plugin_active( 'woocommerce/woocommerce.php' ) || function_exists( 'WC' ) );
    7357    }
    7458
  • disable-blog/tags/0.5.5/includes/class-disable-blog-loader.php

    r3010321 r3462142  
    4545     */
    4646    public function __construct() {
    47 
    4847        $this->actions = array();
    4948        $this->filters = array();
  • disable-blog/tags/0.5.5/includes/class-disable-blog-public.php

    r3010321 r3462142  
    5353     */
    5454    public function __construct( $plugin_name, $version ) {
    55 
    5655        $this->plugin_name = $plugin_name;
    5756        $this->version     = $version;
     
    325324     */
    326325    public function feed_links_show_posts_feed( $show ) {
    327 
    328326        return false;
    329327    }
     
    551549            // Only show the sitemap if there are post types support on the archives.
    552550            $disable_sitemap = empty( $author_archives_supported );
    553 
    554551        }
    555552
  • disable-blog/tags/0.5.5/includes/class-disable-blog.php

    r3010321 r3462142  
    267267        $this->loader->add_filter( 'available_permalink_structure_tags', $plugin_admin, 'available_permalink_structure_tags', 10, 1 );
    268268
     269        // Remove the "post" post type from the query block in the metadata settings.
     270        $this->loader->add_filter( 'block_type_metadata', $plugin_admin, 'filter_block_type_metadata', 10, 1 );
     271
    269272        // Only run comment related functions if comments are supported.
    270273        if ( dwpb_post_types_with_feature( 'comments' ) ) {
  • disable-blog/tags/0.5.5/includes/functions.php

    r3010321 r3462142  
    5353
    5454        wp_cache_set( $cache_name, $post_types_with_feature, 'post-types-by-feature' );
    55 
    5655    }
    5756
     
    9190function dwpb_post_types_with_tax( $taxonomy, $args = array(), $output = 'names' ) {
    9291
    93     $post_types = get_post_types( $args, $output );
     92    if ( ! $taxonomy || ( ! is_object( $taxonomy ) && ! is_string( $taxonomy ) ) ) {
     93        return false;
     94    }
    9495
    9596    // We just need the taxonomy name.
    9697    if ( is_object( $taxonomy ) ) {
    9798        $taxonomy = $taxonomy->name;
     99    }
    98100
    99         // If it's not an object or a string, it won't work, so send it back.
    100     } elseif ( ! is_string( $taxonomy ) ) {
    101         return false;
    102     }
     101    // Get all the post types.
     102    $post_types = get_post_types( $args, $output );
    103103
    104104    // setup the finished product.
     
    110110            $type = $post_type->name;
    111111            // If post types are strings.
    112         } elseif ( is_string( $post_type ) ) {
    113             $type = $post_type;
    114112        } else {
    115             $type = '';
     113            $type = (string) $post_type;
    116114        }
    117115
  • disable-blog/tags/0.5.5/uninstall.php

    r2887738 r3462142  
    3434        || ! isset( $_REQUEST['plugin'] )
    3535        || ! isset( $_REQUEST['action'] )
    36         || strpos( $_REQUEST['plugin'], 'disable-blog.php' ) === false
     36        || strpos( $_REQUEST['plugin'], 'disable-blog.php' ) === false // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
    3737        || 'delete-plugin' !== $_REQUEST['action']
    3838        || ! check_ajax_referer( 'updates', '_ajax_nonce' )
     
    107107
    108108        // Get array of Site/Blog IDs from the database.
    109         $blogs = $wpdb->get_results( "SELECT blog_id FROM {$wpdb->blogs}", ARRAY_A );
     109        $blogs = $wpdb->get_results( "SELECT blog_id FROM {$wpdb->blogs}", ARRAY_A ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
    110110
    111111        if ( $blogs ) {
  • disable-blog/trunk/CHANGELOG.md

    r3010321 r3462142  
    11# Changelog
    22
     3## 0.5.5
     4
     5- Tested up to WordPress 6.9.1
     6- Tested up to PHP 8.4
     7- Bump minimum WordPress version to 5.9
     8- Add composer support, move over to composer for phpcs, phpstan, and linting checks
     9- Upgrade Github actions to `actions/checkout@v4` running on php `8.4`
     10- Fix issue with Query Loop block, now defaults to `page` type instead of 'post' when 'post' is disabled.
     11
    312## 0.5.4
     13
    414- Tested up to WordPress 6.4.2.
    515- Bump minimum WordPress version to 5.3, aligning with minimum PHP support.
    616- Test to PHP 8.2.
    717- Update Github actions.
    8 - Add Code Standard fixer Github Action, h/t @szepeviktor 
    9 - Fix coding standards and a bunch of typos, h/t @szepeviktor 
     18- Add Code Standard fixer Github Action, h/t @szepeviktor
     19- Fix coding standards and a bunch of typos, h/t @szepeviktor
    1020- Increase accuracy of CSS selector used to hide blog related items in Settings > Reading, closes [#69](https://github.com/joshuadavidnelson/disable-blog/issues/69)
    1121- Add `.wp-env.json` for local development.
    1222
    1323## 0.5.3
     24
    1425- Fix `typeof` typo in `disable-blog-customizer.js` from 0.5.2 updates for #59.
    1526- Fix uninstall error to allow for the plugin to be deleted correctly.
     
    2132
    2233## 0.5.2
     34
    2335- Test up to WP 6.1.1
    2436- Increase minimum PHP to v7.4
    2537- Test to PHP 8.1
    2638- Update Github Actions to current versions.
    27 - Fix some bugs introduced in v0.5.1: Reverts "Remove core post-related blocks in editor" - WP core handles the missing taxonomy endpoints (noted in issue 53) fine without any intervention and pulling these blocks out causes other issues. Also removes `dwpb_disabled_blocks` filter. Closes #60 Closes #53 
     39- Fix some bugs introduced in v0.5.1: Reverts "Remove core post-related blocks in editor" - WP core handles the missing taxonomy endpoints (noted in issue 53) fine without any intervention and pulling these blocks out causes other issues. Also removes `dwpb_disabled_blocks` filter. Closes #60 Closes #53
    2840- Adds a check to the customizer script to avoid a TypeError. Closes #59
    2941- Increase specificity in permalinks page to correctly target and remove "optional" section when category and post tags are not supported by any post type (default condition). Closes #62
    3042
    3143## 0.5.1
     44
    3245- Update to documentation, readmes, and doc blocks.
    3346- Fix `.distignore` to remove itself and .gitignore from WP-dot-org repo.
     
    3851- Test up to WordPress v6.0.2
    3952- Remove core post-related blocks in editor Closes [#53](https://github.com/joshuadavidnelson/disable-blog/issues/53). Adds `dwpb_disabled_blocks` passing array of blocks being disabled by the plugin.
    40 - Add scripts and styles to change Customizer view of homepage settings, matching the static homepage settings and updated text. 
     53- Add scripts and styles to change Customizer view of homepage settings, matching the static homepage settings and updated text.
    4154- Update loader class to provide a `remove_filter` method. Closes [#58](https://github.com/joshuadavidnelson/disable-blog/issues/58).
    4255- Alter permalink settings based on if categories and author archives are supported.
     
    4558## 0.5.0
    4659
    47 **New**
     60### New
     61
    4862- New disable author archive functionality via new `dwpb_disable_author_archives` filter. Pass `true` to disable author archives entirely. Default does not disable author archives because numerous other plugins use author archives for other purposes. (A future settings page will provide more flexibility here).
    4963- New `dwpb_author_archive_post_types` filter to provide author archive support for custom post types. Pass an array of post type slugs to this filter to modify the post types queried on author archives, if not removed by filter above.
     
    5973- New `dwpb_pass_query_string_on_redirect` filter, returning `true` enables all valid url query params to be passed during redirects. Default is false. Use the `dwpb_allowed_query_vars` to limit the vars passed in the redirect by passing an array of keys (e.g. return array( 'utm' ) to only pass utm query variables in the query string). Closes #52
    6074- Add javascript to hide admin screen items not easily selected by CSS, include:
    61     - Hiding toggle comment link on welcome screen (if they are not supported by other post types),
    62     - Hiding the category and tag permalink base options (if not supported by other post types), and
    63     - Hiding the default category & default post format on Writing options page.
    64 
    65 **Fixes**
     75  - Hiding toggle comment link on welcome screen (if they are not supported by other post types),
     76  - Hiding the category and tag permalink base options (if not supported by other post types), and
     77  - Hiding the default category & default post format on Writing options page.
     78
     79### Fixes
     80
    6681- Add `dwpb_disabled_xmlpc_methods` filter to extend the methods being disabled by the plugin. Pass `false` to remove the functionality entirely. Closes [#50](https://github.com/joshuadavidnelson/disable-blog/issues/50)
    6782- Bring back some admin page redirects to account for use cases where direct access to `post.php`, `post-new.php`, etc occur. Closes [#45](https://github.com/joshuadavidnelson/disable-blog/issues/45).
     
    7085- In order to account for multiple subpages of a common parent page being removed the `dwpb_menu_subpages_to_remove` param has been updated to support an array of subpages in the format of `$remove_subpages['parent-page-slug.php'] = array( 'subpage-1.php', 'subpage-2.php' );`, though it still supports subpages as strings for backwards compatibility. Fixes bugs were `options-writing.php` and `options-discussion.php` were conflicting.
    7186
    72 **Improvements/Updates**
     87### Improvements/Updates
     88
    7389- Update admin filters to a common format and removing redundant filters. Filter changes include:
    74     - New filter: `dwpb_redirect_admin_url` filters the final url used in admin redirects.
    75     - `dwpb_redirect_admin` only accepts 1 parameter, the previous version accepted 3 (dropping `$redirect_url` & `$current_url`).
    76     - `dwpb_redirect_admin_edit_post` is now `dwpb_redirect_admin_edit`.
    77     - `dwpb_redirect_single_post_edit` is now `dwpb_redirect_admin_post`.
    78     - `dwpb_redirect_admin_edit_single_post` is now `dwpb_redirect_admin_edit`.
    79     - `dwpb_redirect_edit_tax` has been removed. Use `dwpb_redirect_admin_edit_tags` or `dwpb_redirect_admin_term` instead, depending on the context.
    80     - `dwpb_redirect_edit_comments` has been removed. use `dwpb_redirect_admin_edit_comments` instead.
    81     - `dwpb_redirect_options_discussion` has been removed. Use `dwpb_redirect_admin_options_discussion` instead.
    82     - The filter `dwpb_redirect_admin_options_writing` that would pass a boolean to toggle off the options writing page has been remained `dwpb_remove_options_writing` and must be passed with `true` in order to have the page redirect _and_ the admin menu item removed. By default the value filtered is false and the options Writing page does not go away, as numerous other plugins use this page for non-blog related settings. Now `dwpb_redirect_admin_options_writing` is used to filter the redirect url itself, replacing the previously named `dwpb_redirect_options_writing` filter. 
    83     - `dwpb_redirect_options_tools` has been removed. Use `dwpb_redirect_admin_options_tools` instead.
    84     - New filter: `dwpb_disabled_xmlpc_methods` (see above).
    85     - New filter: `dwpb_author_archive_post_types` (see above).
    86     - New filter: `dwpb_disable_author_archives` (see above).
     90  - New filter: `dwpb_redirect_admin_url` filters the final url used in admin redirects.
     91  - `dwpb_redirect_admin` only accepts 1 parameter, the previous version accepted 3 (dropping `$redirect_url` & `$current_url`).
     92  - `dwpb_redirect_admin_edit_post` is now `dwpb_redirect_admin_edit`.
     93  - `dwpb_redirect_single_post_edit` is now `dwpb_redirect_admin_post`.
     94  - `dwpb_redirect_admin_edit_single_post` is now `dwpb_redirect_admin_edit`.
     95  - `dwpb_redirect_edit_tax` has been removed. Use `dwpb_redirect_admin_edit_tags` or `dwpb_redirect_admin_term` instead, depending on the context.
     96  - `dwpb_redirect_edit_comments` has been removed. use `dwpb_redirect_admin_edit_comments` instead.
     97  - `dwpb_redirect_options_discussion` has been removed. Use `dwpb_redirect_admin_options_discussion` instead.
     98  - The filter `dwpb_redirect_admin_options_writing` that would pass a boolean to toggle off the options writing page has been remained `dwpb_remove_options_writing` and must be passed with `true` in order to have the page redirect _and_ the admin menu item removed. By default the value filtered is false and the options Writing page does not go away, as numerous other plugins use this page for non-blog related settings. Now `dwpb_redirect_admin_options_writing` is used to filter the redirect url itself, replacing the previously named `dwpb_redirect_options_writing` filter. 
     99  - `dwpb_redirect_options_tools` has been removed. Use `dwpb_redirect_admin_options_tools` instead.
     100  - New filter: `dwpb_disabled_xmlpc_methods` (see above).
     101  - New filter: `dwpb_author_archive_post_types` (see above).
     102  - New filter: `dwpb_disable_author_archives` (see above).
    87103- Update public redirect filters to match the pattern used for the new admin redirects. Filer changes include:
    88     - New filter: `dwpb_front_end_redirect_url` filters the final url used in front end redirects.
    89     - New filter: `dwpb_redirect_author_archive` to change the redirect used on author archives, if they are disabled.
    90     - New filter: `dwpb_disable_user_sitemap` to change the user sitemap default, pass `true` to keep disable the sitmap. Note that if author archives are disabled by the above filter, user sitemps will be also be disabled regardless of this filter.
    91     - `dwpb_redirect_posts` is now `dwpb_redirect_post`.
    92     - `dwpb_redirect_post_{$post->ID}` filter has been removed. Use `dwpb_redirect_post` and check for the post id to target a specific post.
    93     - `dwpb_redirect_front_end` only accepts 1 parameter, the previous version accepted 3 (dropping `$redirect_url` & `$current_url`).
     104  - New filter: `dwpb_front_end_redirect_url` filters the final url used in front end redirects.
     105  - New filter: `dwpb_redirect_author_archive` to change the redirect used on author archives, if they are disabled.
     106  - New filter: `dwpb_disable_user_sitemap` to change the user sitemap default, pass `true` to keep disable the sitmap. Note that if author archives are disabled by the above filter, user sitemps will be also be disabled regardless of this filter.
     107  - `dwpb_redirect_posts` is now `dwpb_redirect_post`.
     108  - `dwpb_redirect_post_{$post->ID}` filter has been removed. Use `dwpb_redirect_post` and check for the post id to target a specific post.
     109  - `dwpb_redirect_front_end` only accepts 1 parameter, the previous version accepted 3 (dropping `$redirect_url` & `$current_url`).
    94110- Bump minimum PHP to 5.6.
    95111- Tested up to WP Core version 5.9.3.
     
    98114
    99115## 0.4.10
     116
    100117- Fix a bug from v0.4.9 that caused redirects on custom post type archives, correcting the `modify_query` function to only remove posts from built-in taxonomy archives, as that was the original intent.
    101118
    102119## 0.4.9
     120
    103121- **Notice:** We've added the minimum PHP version requirement of 5.3, which was not explicitly set before now.
    104122- **Big change:** the plugin now changes the `post_type` arguments for posts so they are no longer public and removes all post_type support parameters. This disables the post-related admin redirects, as WordPress will now show users an error page stating "Sorry, you are not allowed to edit posts in this post type." It also pulls posts out of a lot of other locations (menus, etc) and is a much more efficient method of "disabling" the post type. This method is also used on built-in taxonomies, unless another post type supports them. **This change may impact other plugins or themes, be sure to back up your site and, if you can, test these changes prior to updating the plugin on a production site.**
     
    114132- Remove header feed urls, unless supported by another post type.
    115133- WordPress 5.5 support:
    116     - Remove 'post' post type from XML sitemaps.
    117     - Remove built-in taxonomies from XML sitemaps, if not being used by a custom post type.
    118     - Fix sitemap redirect issues.
     134  - Remove 'post' post type from XML sitemaps.
     135  - Remove built-in taxonomies from XML sitemaps, if not being used by a custom post type.
     136  - Fix sitemap redirect issues.
    119137- **Developers:** Filters were removed and altered in this version:
    120     - The `dwpb_redirect_feeds` filter now has (3) params, to match those in the `dwpb_disable_feed` filter: $bool, $post, $is_comment_feed.
    121     - The `dwpb_author_post_types` filter is now `dwpb_archive_post_types`, as the query modification now includes all pages passing `is_archive`.
    122     - Removed filters: `dwpb_disable_rest_api`, `dwpb_remove_post_comment_support`, `dwpb_remove_post_trackback_support`, `dwpb_redirect_admin_edit_single_post`, `dwpb_redirect_single_post_edit`, `dwpb_redirect_admin_edit_post`, `dwpb_redirect_edit`, `dwpb_redirect_admin_post_new`, `dwpb_redirect_post_new` as these are rendered obsolete by above changes.
     138  - The `dwpb_redirect_feeds` filter now has (3) params, to match those in the `dwpb_disable_feed` filter: $bool, $post, $is_comment_feed.
     139  - The `dwpb_author_post_types` filter is now `dwpb_archive_post_types`, as the query modification now includes all pages passing `is_archive`.
     140  - Removed filters: `dwpb_disable_rest_api`, `dwpb_remove_post_comment_support`, `dwpb_remove_post_trackback_support`, `dwpb_redirect_admin_edit_single_post`, `dwpb_redirect_single_post_edit`, `dwpb_redirect_admin_edit_post`, `dwpb_redirect_edit`, `dwpb_redirect_admin_post_new`, `dwpb_redirect_post_new` as these are rendered obsolete by above changes.
    123141
    124142## 0.4.8.1
     143
    125144- Do'h! Forgot to update the version number in the main plugin file. Bump.
    126145
    127146## 0.4.8
     147
    128148- Fixed typo in variable name for current vs redirect url check. (h/t @chesio, PR #30)
    129149- Update function names from template to `disable_blog`. (h/t @szepeviktor, PR #31)
     
    133153
    134154## 0.4.7
     155
    135156- Using GitHub actions publish on WP.org from github releases.
    136157- Cleaned up the Reading settings, adding admin notices if front page is not set.
     
    140161
    141162## 0.4.6
     163
    142164- Added check on disable feed functionality to confirm post type prior to disabling feed.
    143165
    144166## 0.4.5
     167
    145168- Remove the functionality hiding the Settings > Writing admin page, allow this option to be re-enabled via the older filter. This page used to be entirely related to posts, but is also used to select the editor type (Gutenberg vs Classic).
    146169- Correct misspelled dwpb_redirect_options_tools filter.
    147170
    148171## 0.4.4
     172
    149173- Hide the Settings > Writing menu item, which shows up with Disable Comments enabled everywhere. Thanks to @dater for identifying.
    150174
    151175## 0.4.3
     176
    152177- Fix fatal error conflict with WooCommerce versions older than 2.6.3 (props to @Mahjouba91 for the heads up), no returns an array of comments in the filter for those older WooCommerce versions.
    153178- Add de/activation hooks to clear comment caches
     
    155180
    156181## 0.4.2
     182
    157183- Disable the REST API for 'post' post type. Props to @shawnhooper.
    158184
    159185## 0.4.1
     186
    160187- Fix unintended redirect for custom admin pages under tools.php. Props to @greatislander for the catch.
    161188
    162189## 0.4.0
     190
    163191- Refactor code to match WP Plugin Boilerplate structure, including:
    164  - Move hooks and filters into loader class.
    165  - Separate Admin and Public hooks.
    166  - Add support for internationalization.
     192- Move hooks and filters into loader class.
     193- Separate Admin and Public hooks.
     194- Add support for internationalization.
    167195- Expanded inline documentation.
    168196- Add another failsafe for potential redirect loops.
     
    177205
    178206## 0.3.3
     207
    179208- Weird issue with svn, same as version 0.3.2.
    180209
    181210## 0.3.2
     211
    182212- Fix potential loop issue with `home_url` in redirection function.
    183213- Fix custom taxonomy save redirect (used to redirect to dashboard, now it saves correctly).
    184214
    185215## 0.3.1
     216
    186217- Add/update readme.txt.
    187218
    188219## 0.3.0
     220
    189221- Singleton Class.
    190222- Clean up documentation.
    191223- Add filters.
    192     
     224  
    193225## 0.2.0
     226
    194227More improvements:
    195228
     
    211244
    212245## 0.1.0
     246
    213247Initial beta release.
  • disable-blog/trunk/README.md

    r3010321 r3462142  
    44[![WordPress Plugin Version](https://img.shields.io/wordpress/plugin/v/disable-blog)](https://wordpress.org/plugins/disable-blog/) ![Downloads](https://img.shields.io/wordpress/plugin/dt/disable-blog.svg) ![Rating](https://img.shields.io/wordpress/plugin/r/disable-blog.svg)
    55
    6 **Requires at least WordPress:** 5.3 
    7 **Tested up to WordPress:** 6.4.2 
    8 **Stable version:** 0.5.4 
     6[![WP compatibility](https://plugintests.com/plugins/wporg/disable-blog/wp-badge.svg)](https://plugintests.com/plugins/wporg/disable-blog/latest) [![PHP compatibility](https://plugintests.com/plugins/wporg/disable-blog/php-badge.svg)](https://plugintests.com/plugins/wporg/disable-blog/latest)
     7
     8**Requires at least WordPress:** 5.9 
     9**Tested up to WordPress:** 6.9 
     10**Stable version:** 0.5.5 
    911**License:** GPLv2 or later 
    1012**Requires PHP:** 7.4 
    11 **Tested up to PHP:** 8.2 
     13**Tested up to PHP:** 8.4 
    1214
    1315All the power of WordPress, without a blog.
     
    104106All pull requests should be directed at the `develop` branch, and will be reviewed prior to merging. No pull requests will be merged with failing tests, but it's okay if you don't initially pass tests. Please create a draft pull request for proof of concept code or changes you'd like to have input on prior to review.
    105107
    106 Please make on a branch specific to a single issue or feature. For instance, if you are suggest a solution to an issue, please create fork with a branch like `issue-894`. Or if you are proposing a new feature, create a fork with the branch name indicating the feature like `feature-example-bananas`
     108For instance, to suggest a solution to an issue please create fork with a branch like `issue-42`. Or, if you're proposing a new feature, create a fork with the branch name indicating the feature like `feature-example-bananas`
    107109
    108110All improvements are merged into `develop` and then queued up for release before being merged into `stable`. Releases are deployed via github actions to wordpress.org on tagging a new release.
  • disable-blog/trunk/disable-blog.php

    r3010321 r3462142  
    99 *
    1010 * @link    https://github.com/joshuadavidnelson/disable-blog
    11  * @since   0.4.0
    1211 * @package Disable_Blog
    1312 *
     
    1615 * Plugin URI:  https://wordpress.org/plugins/disable-blog/
    1716 * Description: Go blog-less with WordPress. This plugin disables all blog-related functionality (by hiding, removing, and redirecting).
    18  * Version:     0.5.4
     17 * Version:     0.5.5
    1918 * Author:      Joshua David Nelson
    2019 * Author URI:  http://joshuadnelson.com
     
    6059define( 'DWPB_URL', plugins_url( '/', __FILE__ ) );
    6160define( 'DWPB_PLUGIN_NAME', 'disable-blog' );
    62 define( 'DWPB_VERSION', '0.5.4' );
     61define( 'DWPB_VERSION', '0.5.5' );
    6362
    6463/**
  • disable-blog/trunk/includes/class-disable-blog-activator.php

    r3010321 r3462142  
    149149     */
    150150    private static function check_caps() {
    151 
    152         if ( current_user_can( 'activate_plugins' ) ) {
    153             return true;
    154         }
    155 
    156         return false;
     151        return current_user_can( 'activate_plugins' );
    157152    }
    158153}
  • disable-blog/trunk/includes/class-disable-blog-admin.php

    r3010321 r3462142  
    5454     */
    5555    public function __construct( $plugin_name, $version ) {
    56 
    5756        $this->plugin_name = $plugin_name;
    5857        $this->version     = $version;
     
    9493     * @since 0.4.9 removed rest api specific filter and updated function
    9594     *              for disabling all public-facing aspects of the 'post' post type.
     95     * @return void
    9696     */
    9797    public function modify_post_type_arguments() {
     
    126126            // remove supports.
    127127            $wp_post_types['post']->supports = array();
    128 
    129128        }
    130129    }
     
    408407     */
    409408    public function redirect_admin_options_discussion() {
    410 
    411409        return $this->redirect_admin_edit_comments();
    412410    }
     
    422420        // Redirect writing options to general options.
    423421        if ( $this->remove_writing_options() ) {
    424 
    425422            return admin_url( 'options-general.php' );
    426 
    427423        }
    428424
     
    554550         * @param bool $bool Defaults to false, keeping the writing page visible.
    555551         */
    556         return apply_filters( 'dwpb_remove_options_writing', false );
     552        return (bool) apply_filters( 'dwpb_remove_options_writing', false );
    557553    }
    558554
     
    704700     */
    705701    public function has_front_page() {
    706 
    707702        return 'page' === get_option( 'show_on_front' ) && absint( get_option( 'page_on_front' ) );
    708703    }
     
    715710     */
    716711    public function disable_press_this() {
    717 
    718712        wp_die( '"Press This" functionality has been disabled.' );
    719713    }
     
    795789     */
    796790    public function enqueue_styles() {
    797 
    798791        wp_enqueue_style( $this->plugin_name, plugin_dir_url( __FILE__ ) . '../assets/css/disable-blog-admin.css', array(), $this->version, 'all' );
    799792    }
     
    829822     */
    830823    public function is_admin_page( $page ) {
    831 
    832824        global $pagenow;
    833 
    834825        return is_admin() && isset( $pagenow ) && is_string( $pagenow ) && $page . '.php' === $pagenow;
    835826    }
     
    1002993     */
    1003994    public function filter_existing_comments( $comments, $post_id ) {
    1004 
    1005995        return ( 'post' === get_post_type( $post_id ) ) ? array() : $comments;
    1006996    }
     
    10341024    public function site_status_tests( $tests ) {
    10351025
    1036         if ( isset( $tests['direct']['rest_availability'] ) && is_callable( array( $this, 'get_test_rest_availability' ) ) ) {
     1026        if ( isset( $tests['direct']['rest_availability'] ) ) {
    10371027            $tests['direct']['rest_availability']['test'] = array( $this, 'get_test_rest_availability' );
    10381028        }
     
    10551045
    10561046        $result = array(
    1057             'label'       => __( 'The REST API is available' ),
     1047            'label'       => __( 'The REST API is available' ), // phpcs:ignore WordPress.WP.I18n.MissingArgDomain
    10581048            'status'      => 'good',
    10591049            'badge'       => array(
    1060                 'label' => __( 'Performance' ),
     1050                'label' => __( 'Performance' ), // phpcs:ignore WordPress.WP.I18n.MissingArgDomain
    10611051                'color' => 'blue',
    10621052            ),
    10631053            'description' => sprintf(
    10641054                '<p>%s</p>',
    1065                 __( 'The REST API is one way WordPress, and other applications, communicate with the server. One example is the block editor screen, which relies on this to display, and save, your posts and pages.' )
     1055                __( 'The REST API is one way WordPress, and other applications, communicate with the server. One example is the block editor screen, which relies on this to display, and save, your posts and pages.' ) // phpcs:ignore WordPress.WP.I18n.MissingArgDomain
    10661056            ),
    10671057            'actions'     => '',
     
    10691059        );
    10701060
    1071         $cookies = wp_unslash( $_COOKIE );
     1061        $cookies = wp_unslash( $_COOKIE ); // phpcs:ignore WordPressVIPMinimum.Variables.RestrictedVariables.cache_constraints___COOKIE
    10721062        $timeout = 10;
    10731063        $headers = array(
     
    10971087        );
    10981088
    1099         $r = wp_remote_get( $url, compact( 'cookies', 'headers', 'timeout', 'sslverify' ) );
     1089        $r = wp_remote_get( $url, compact( 'cookies', 'headers', 'timeout', 'sslverify' ) ); // phpcs:ignore WordPressVIPMinimum.Functions.RestrictedFunctions.wp_remote_get_wp_remote_get
    11001090
    11011091        if ( is_wp_error( $r ) ) {
    11021092            $result['status'] = 'critical';
    11031093
    1104             $result['label'] = __( 'The REST API encountered an error' );
     1094            $result['label'] = __( 'The REST API encountered an error' ); // phpcs:ignore WordPress.WP.I18n.MissingArgDomain
    11051095
    11061096            $result['description'] .= sprintf(
     
    11081098                sprintf(
    11091099                    '%s<br>%s',
    1110                     __( 'The REST API request failed due to an error.' ),
     1100                    __( 'The REST API request failed due to an error.' ), // phpcs:ignore WordPress.WP.I18n.MissingArgDomain
    11111101                    sprintf(
    11121102                        /* translators: 1: The WordPress error message. 2: The WordPress error code. */
    1113                         __( 'Error: %1$s (%2$s)' ),
     1103                        __( 'Error: %1$s (%2$s)' ), // phpcs:ignore WordPress.WP.I18n.MissingArgDomain
    11141104                        $r->get_error_message(),
    11151105                        $r->get_error_code()
     
    11201110            $result['status'] = 'recommended';
    11211111
    1122             $result['label'] = __( 'The REST API encountered an unexpected result' );
     1112            $result['label'] = __( 'The REST API encountered an unexpected result' ); // phpcs:ignore WordPress.WP.I18n.MissingArgDomain
    11231113
    11241114            $result['description'] .= sprintf(
     
    11261116                sprintf(
    11271117                    /* translators: 1: The HTTP error code. 2: The HTTP error message. */
    1128                     __( 'The REST API call gave the following unexpected result: (%1$d) %2$s.' ),
     1118                    __( 'The REST API call gave the following unexpected result: (%1$d) %2$s.' ), // phpcs:ignore WordPress.WP.I18n.MissingArgDomain
    11291119                    wp_remote_retrieve_response_code( $r ),
    11301120                    esc_html( wp_remote_retrieve_body( $r ) )
     
    11371127                $result['status'] = 'recommended';
    11381128
    1139                 $result['label'] = __( 'The REST API did not behave correctly' );
     1129                $result['label'] = __( 'The REST API did not behave correctly' ); // phpcs:ignore WordPress.WP.I18n.MissingArgDomain
    11401130
    11411131                $result['description'] .= sprintf(
     
    11431133                    sprintf(
    11441134                        /* translators: %s: The name of the query parameter being tested. */
    1145                         __( 'The REST API did not process the %s query parameter correctly.' ),
     1135                        __( 'The REST API did not process the %s query parameter correctly.' ), // phpcs:ignore WordPress.WP.I18n.MissingArgDomain
    11461136                        '<code>context</code>'
    11471137                    )
     
    11881178        $args  = array(
    11891179            'fields'                 => 'ids',
    1190             'posts_per_page'         => 500,
     1180            'posts_per_page'         => 100,
    11911181            'post_type'              => $post_type,
    11921182            'no_found_rows'          => true,
    11931183            'update_post_meta_cache' => false,
    1194             'tax_query'              => array(
     1184            'tax_query'              => array( // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_tax_query
    11951185                array(
    11961186                    'taxonomy' => $taxonomy,
     
    14431433        return $available_tags;
    14441434    }
     1435
     1436    /**
     1437     * Filter the block settings to change the post type from 'post' to 'page'.
     1438     *
     1439     * @since 0.5.5
     1440     * @param array $metadata The block metadata.
     1441     * @return array
     1442     */
     1443    public function filter_block_type_metadata( $metadata ) {
     1444
     1445        // Bail if the metadata is not configured as expected.
     1446        if ( ! isset( $metadata['name'] ) || ! is_string( $metadata['name'] ) ) {
     1447            return $metadata;
     1448        }
     1449
     1450        // If the block is the query block, change the post type to 'page'.
     1451        if ( 'core/query' === $metadata['name'] && isset( $metadata['attributes']['query']['default'] ) ) {
     1452            $metadata['attributes']['query']['default']['postType'] = 'page';
     1453        }
     1454
     1455        return $metadata;
     1456    }
    14451457}
  • disable-blog/trunk/includes/class-disable-blog-deactivator.php

    r3010321 r3462142  
    149149     */
    150150    private static function check_caps() {
    151 
    152         if ( current_user_can( 'activate_plugins' ) ) {
    153             return true;
    154         }
    155 
    156         return false;
     151        return current_user_can( 'activate_plugins' );
    157152    }
    158153}
  • disable-blog/trunk/includes/class-disable-blog-functions.php

    r3010321 r3462142  
    7777        wp_parse_str( $_SERVER['QUERY_STRING'], $query_vars ); // phpcs:ignore
    7878
    79         /**
    80          * Filter for allowed queary string variables.
     79        // Only allow specific query vars.
     80        $allowed_query_vars = $this->get_allowed_query_vars();
     81        if ( ! empty( $allowed_query_vars ) ) {
     82
     83            // Only keep the allowed query vars, if there are any.
     84            // Sanitizing the keys and filtering out any empty values.
     85            // Let add_query_arg handle the sanitization of the values.
     86            $valid_query_var_keys = array_flip( $allowed_query_vars );
     87            $query_vars           = array_filter( array_intersect_key( $query_vars, $valid_query_var_keys ) );
     88
     89            // if we have any query variables, add it to the url.
     90            if ( ! empty( $query_vars ) ) {
     91                $url = add_query_arg( $query_vars, $url );
     92            }
     93        }
     94
     95        return $url;
     96    }
     97
     98    /**
     99     * Get the allowed query vars.
     100     *
     101     * @since 0.5.5
     102     * @return array
     103     */
     104    private function get_allowed_query_vars() {
     105
     106        /**
     107         * Filter for allowed query string variables.
    81108         *
    82109         * @since 0.5.0
     
    84111         * @return array
    85112         */
    86         $allowed_query_vars = apply_filters( 'dwpb_allowed_query_vars', array() );
    87         if ( ! empty( $allowed_query_vars ) && is_array( $allowed_query_vars ) ) {
    88             $allowed_query_vars = array_filter( $allowed_query_vars, 'esc_html' );
    89             $query_vars         = array_intersect_key( $query_vars, array_flip( $allowed_query_vars ) );
    90         }
    91 
    92         // Escaping and sanitization are important.
    93         $query_vars = array_filter( $query_vars, 'esc_html' );
    94         $query_vars = array_filter( $query_vars, 'esc_html', ARRAY_FILTER_USE_KEY );
    95 
    96         // if we have any query variables, add it to the url.
    97         if ( ! empty( $query_vars ) && is_array( $query_vars ) ) {
    98             $url = add_query_arg( $query_vars, $url );
    99         }
    100 
    101         return $url;
     113        $allowed_query_vars = (array) apply_filters( 'dwpb_allowed_query_vars', array() );
     114
     115        // Sanitizing the keys and filtering out any empty values.
     116        return array_filter( array_map( 'sanitize_key', $allowed_query_vars ) );
    102117    }
    103118
     
    138153     *
    139154     * @since 0.5.0
    140      * @param string $url    the fallback url.
     155     * @param string $url the fallback url.
    141156     * @return string
    142157     */
  • disable-blog/trunk/includes/class-disable-blog-i18n.php

    r3010321 r3462142  
    2929     */
    3030    public function load_plugin_textdomain() {
    31 
    3231        load_plugin_textdomain(
    3332            'disable-blog',
  • disable-blog/trunk/includes/class-disable-blog-integrations.php

    r3010321 r3462142  
    3434
    3535        // Check if the the plugin is active.
    36         if ( is_plugin_active( $plugin ) ) {
    37             return true;
    38         }
    39 
    40         return false;
     36        return is_plugin_active( $plugin );
    4137    }
    4238
     
    4844     */
    4945    public function is_disable_comments_active() {
    50 
    51         // Check if the Disable Comments plugin is active.
    52         if ( $this->is_plugin_active( 'disable-comments/disable-comments.php' ) || class_exists( 'Disable_Comments' ) ) {
    53             return true;
    54         }
    55 
    56         return false;
     46        return ( $this->is_plugin_active( 'disable-comments/disable-comments.php' ) || class_exists( 'Disable_Comments' ) );
    5747    }
    5848
     
    6454     */
    6555    public function is_woocommerce_active() {
    66 
    67         // Check if the Disable Comments plugin is active.
    68         if ( $this->is_plugin_active( 'woocommerce/woocommerce.php' ) || function_exists( 'WC' ) ) {
    69             return true;
    70         }
    71 
    72         return false;
     56        return ( $this->is_plugin_active( 'woocommerce/woocommerce.php' ) || function_exists( 'WC' ) );
    7357    }
    7458
  • disable-blog/trunk/includes/class-disable-blog-loader.php

    r3010321 r3462142  
    4545     */
    4646    public function __construct() {
    47 
    4847        $this->actions = array();
    4948        $this->filters = array();
  • disable-blog/trunk/includes/class-disable-blog-public.php

    r3010321 r3462142  
    5353     */
    5454    public function __construct( $plugin_name, $version ) {
    55 
    5655        $this->plugin_name = $plugin_name;
    5756        $this->version     = $version;
     
    325324     */
    326325    public function feed_links_show_posts_feed( $show ) {
    327 
    328326        return false;
    329327    }
     
    551549            // Only show the sitemap if there are post types support on the archives.
    552550            $disable_sitemap = empty( $author_archives_supported );
    553 
    554551        }
    555552
  • disable-blog/trunk/includes/class-disable-blog.php

    r3010321 r3462142  
    267267        $this->loader->add_filter( 'available_permalink_structure_tags', $plugin_admin, 'available_permalink_structure_tags', 10, 1 );
    268268
     269        // Remove the "post" post type from the query block in the metadata settings.
     270        $this->loader->add_filter( 'block_type_metadata', $plugin_admin, 'filter_block_type_metadata', 10, 1 );
     271
    269272        // Only run comment related functions if comments are supported.
    270273        if ( dwpb_post_types_with_feature( 'comments' ) ) {
  • disable-blog/trunk/includes/functions.php

    r3010321 r3462142  
    5353
    5454        wp_cache_set( $cache_name, $post_types_with_feature, 'post-types-by-feature' );
    55 
    5655    }
    5756
     
    9190function dwpb_post_types_with_tax( $taxonomy, $args = array(), $output = 'names' ) {
    9291
    93     $post_types = get_post_types( $args, $output );
     92    if ( ! $taxonomy || ( ! is_object( $taxonomy ) && ! is_string( $taxonomy ) ) ) {
     93        return false;
     94    }
    9495
    9596    // We just need the taxonomy name.
    9697    if ( is_object( $taxonomy ) ) {
    9798        $taxonomy = $taxonomy->name;
     99    }
    98100
    99         // If it's not an object or a string, it won't work, so send it back.
    100     } elseif ( ! is_string( $taxonomy ) ) {
    101         return false;
    102     }
     101    // Get all the post types.
     102    $post_types = get_post_types( $args, $output );
    103103
    104104    // setup the finished product.
     
    110110            $type = $post_type->name;
    111111            // If post types are strings.
    112         } elseif ( is_string( $post_type ) ) {
    113             $type = $post_type;
    114112        } else {
    115             $type = '';
     113            $type = (string) $post_type;
    116114        }
    117115
  • disable-blog/trunk/uninstall.php

    r2887738 r3462142  
    3434        || ! isset( $_REQUEST['plugin'] )
    3535        || ! isset( $_REQUEST['action'] )
    36         || strpos( $_REQUEST['plugin'], 'disable-blog.php' ) === false
     36        || strpos( $_REQUEST['plugin'], 'disable-blog.php' ) === false // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
    3737        || 'delete-plugin' !== $_REQUEST['action']
    3838        || ! check_ajax_referer( 'updates', '_ajax_nonce' )
     
    107107
    108108        // Get array of Site/Blog IDs from the database.
    109         $blogs = $wpdb->get_results( "SELECT blog_id FROM {$wpdb->blogs}", ARRAY_A );
     109        $blogs = $wpdb->get_results( "SELECT blog_id FROM {$wpdb->blogs}", ARRAY_A ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
    110110
    111111        if ( $blogs ) {
Note: See TracChangeset for help on using the changeset viewer.