Changeset 3462142
- Timestamp:
- 02/16/2026 01:47:42 AM (6 weeks ago)
- Location:
- disable-blog
- Files:
-
- 2 added
- 28 edited
- 1 copied
-
tags/0.5.5 (copied) (copied from disable-blog/trunk)
-
tags/0.5.5/CHANGELOG.md (modified) (13 diffs)
-
tags/0.5.5/README.md (modified) (2 diffs)
-
tags/0.5.5/disable-blog.php (modified) (3 diffs)
-
tags/0.5.5/includes/class-disable-blog-activator.php (modified) (1 diff)
-
tags/0.5.5/includes/class-disable-blog-admin.php (modified) (22 diffs)
-
tags/0.5.5/includes/class-disable-blog-deactivator.php (modified) (1 diff)
-
tags/0.5.5/includes/class-disable-blog-functions.php (modified) (3 diffs)
-
tags/0.5.5/includes/class-disable-blog-i18n.php (modified) (1 diff)
-
tags/0.5.5/includes/class-disable-blog-integrations.php (modified) (3 diffs)
-
tags/0.5.5/includes/class-disable-blog-loader.php (modified) (1 diff)
-
tags/0.5.5/includes/class-disable-blog-public.php (modified) (3 diffs)
-
tags/0.5.5/includes/class-disable-blog.php (modified) (1 diff)
-
tags/0.5.5/includes/functions.php (modified) (3 diffs)
-
tags/0.5.5/phpcs.xml (added)
-
tags/0.5.5/uninstall.php (modified) (2 diffs)
-
trunk/CHANGELOG.md (modified) (13 diffs)
-
trunk/README.md (modified) (2 diffs)
-
trunk/disable-blog.php (modified) (3 diffs)
-
trunk/includes/class-disable-blog-activator.php (modified) (1 diff)
-
trunk/includes/class-disable-blog-admin.php (modified) (22 diffs)
-
trunk/includes/class-disable-blog-deactivator.php (modified) (1 diff)
-
trunk/includes/class-disable-blog-functions.php (modified) (3 diffs)
-
trunk/includes/class-disable-blog-i18n.php (modified) (1 diff)
-
trunk/includes/class-disable-blog-integrations.php (modified) (3 diffs)
-
trunk/includes/class-disable-blog-loader.php (modified) (1 diff)
-
trunk/includes/class-disable-blog-public.php (modified) (3 diffs)
-
trunk/includes/class-disable-blog.php (modified) (1 diff)
-
trunk/includes/functions.php (modified) (3 diffs)
-
trunk/phpcs.xml (added)
-
trunk/uninstall.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
disable-blog/tags/0.5.5/CHANGELOG.md
r3010321 r3462142 1 1 # Changelog 2 2 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 3 12 ## 0.5.4 13 4 14 - Tested up to WordPress 6.4.2. 5 15 - Bump minimum WordPress version to 5.3, aligning with minimum PHP support. 6 16 - Test to PHP 8.2. 7 17 - 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 10 20 - Increase accuracy of CSS selector used to hide blog related items in Settings > Reading, closes [#69](https://github.com/joshuadavidnelson/disable-blog/issues/69) 11 21 - Add `.wp-env.json` for local development. 12 22 13 23 ## 0.5.3 24 14 25 - Fix `typeof` typo in `disable-blog-customizer.js` from 0.5.2 updates for #59. 15 26 - Fix uninstall error to allow for the plugin to be deleted correctly. … … 21 32 22 33 ## 0.5.2 34 23 35 - Test up to WP 6.1.1 24 36 - Increase minimum PHP to v7.4 25 37 - Test to PHP 8.1 26 38 - 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 28 40 - Adds a check to the customizer script to avoid a TypeError. Closes #59 29 41 - 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 30 42 31 43 ## 0.5.1 44 32 45 - Update to documentation, readmes, and doc blocks. 33 46 - Fix `.distignore` to remove itself and .gitignore from WP-dot-org repo. … … 38 51 - Test up to WordPress v6.0.2 39 52 - 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. 41 54 - Update loader class to provide a `remove_filter` method. Closes [#58](https://github.com/joshuadavidnelson/disable-blog/issues/58). 42 55 - Alter permalink settings based on if categories and author archives are supported. … … 45 58 ## 0.5.0 46 59 47 **New** 60 ### New 61 48 62 - 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). 49 63 - 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. … … 59 73 - 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 60 74 - 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 66 81 - 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) 67 82 - 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). … … 70 85 - 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. 71 86 72 **Improvements/Updates** 87 ### Improvements/Updates 88 73 89 - 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). 87 103 - 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`). 94 110 - Bump minimum PHP to 5.6. 95 111 - Tested up to WP Core version 5.9.3. … … 98 114 99 115 ## 0.4.10 116 100 117 - 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. 101 118 102 119 ## 0.4.9 120 103 121 - **Notice:** We've added the minimum PHP version requirement of 5.3, which was not explicitly set before now. 104 122 - **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.** … … 114 132 - Remove header feed urls, unless supported by another post type. 115 133 - 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. 119 137 - **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. 123 141 124 142 ## 0.4.8.1 143 125 144 - Do'h! Forgot to update the version number in the main plugin file. Bump. 126 145 127 146 ## 0.4.8 147 128 148 - Fixed typo in variable name for current vs redirect url check. (h/t @chesio, PR #30) 129 149 - Update function names from template to `disable_blog`. (h/t @szepeviktor, PR #31) … … 133 153 134 154 ## 0.4.7 155 135 156 - Using GitHub actions publish on WP.org from github releases. 136 157 - Cleaned up the Reading settings, adding admin notices if front page is not set. … … 140 161 141 162 ## 0.4.6 163 142 164 - Added check on disable feed functionality to confirm post type prior to disabling feed. 143 165 144 166 ## 0.4.5 167 145 168 - 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). 146 169 - Correct misspelled dwpb_redirect_options_tools filter. 147 170 148 171 ## 0.4.4 172 149 173 - Hide the Settings > Writing menu item, which shows up with Disable Comments enabled everywhere. Thanks to @dater for identifying. 150 174 151 175 ## 0.4.3 176 152 177 - 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. 153 178 - Add de/activation hooks to clear comment caches … … 155 180 156 181 ## 0.4.2 182 157 183 - Disable the REST API for 'post' post type. Props to @shawnhooper. 158 184 159 185 ## 0.4.1 186 160 187 - Fix unintended redirect for custom admin pages under tools.php. Props to @greatislander for the catch. 161 188 162 189 ## 0.4.0 190 163 191 - 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. 167 195 - Expanded inline documentation. 168 196 - Add another failsafe for potential redirect loops. … … 177 205 178 206 ## 0.3.3 207 179 208 - Weird issue with svn, same as version 0.3.2. 180 209 181 210 ## 0.3.2 211 182 212 - Fix potential loop issue with `home_url` in redirection function. 183 213 - Fix custom taxonomy save redirect (used to redirect to dashboard, now it saves correctly). 184 214 185 215 ## 0.3.1 216 186 217 - Add/update readme.txt. 187 218 188 219 ## 0.3.0 220 189 221 - Singleton Class. 190 222 - Clean up documentation. 191 223 - Add filters. 192 224 193 225 ## 0.2.0 226 194 227 More improvements: 195 228 … … 211 244 212 245 ## 0.1.0 246 213 247 Initial beta release. -
disable-blog/tags/0.5.5/README.md
r3010321 r3462142 4 4 [](https://wordpress.org/plugins/disable-blog/)   5 5 6 **Requires at least WordPress:** 5.3 7 **Tested up to WordPress:** 6.4.2 8 **Stable version:** 0.5.4 6 [](https://plugintests.com/plugins/wporg/disable-blog/latest) [](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 9 11 **License:** GPLv2 or later 10 12 **Requires PHP:** 7.4 11 **Tested up to PHP:** 8. 213 **Tested up to PHP:** 8.4 12 14 13 15 All the power of WordPress, without a blog. … … 104 106 All 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. 105 107 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`108 For 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` 107 109 108 110 All 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 9 9 * 10 10 * @link https://github.com/joshuadavidnelson/disable-blog 11 * @since 0.4.012 11 * @package Disable_Blog 13 12 * … … 16 15 * Plugin URI: https://wordpress.org/plugins/disable-blog/ 17 16 * Description: Go blog-less with WordPress. This plugin disables all blog-related functionality (by hiding, removing, and redirecting). 18 * Version: 0.5. 417 * Version: 0.5.5 19 18 * Author: Joshua David Nelson 20 19 * Author URI: http://joshuadnelson.com … … 60 59 define( 'DWPB_URL', plugins_url( '/', __FILE__ ) ); 61 60 define( 'DWPB_PLUGIN_NAME', 'disable-blog' ); 62 define( 'DWPB_VERSION', '0.5. 4' );61 define( 'DWPB_VERSION', '0.5.5' ); 63 62 64 63 /** -
disable-blog/tags/0.5.5/includes/class-disable-blog-activator.php
r3010321 r3462142 149 149 */ 150 150 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' ); 157 152 } 158 153 } -
disable-blog/tags/0.5.5/includes/class-disable-blog-admin.php
r3010321 r3462142 54 54 */ 55 55 public function __construct( $plugin_name, $version ) { 56 57 56 $this->plugin_name = $plugin_name; 58 57 $this->version = $version; … … 94 93 * @since 0.4.9 removed rest api specific filter and updated function 95 94 * for disabling all public-facing aspects of the 'post' post type. 95 * @return void 96 96 */ 97 97 public function modify_post_type_arguments() { … … 126 126 // remove supports. 127 127 $wp_post_types['post']->supports = array(); 128 129 128 } 130 129 } … … 408 407 */ 409 408 public function redirect_admin_options_discussion() { 410 411 409 return $this->redirect_admin_edit_comments(); 412 410 } … … 422 420 // Redirect writing options to general options. 423 421 if ( $this->remove_writing_options() ) { 424 425 422 return admin_url( 'options-general.php' ); 426 427 423 } 428 424 … … 554 550 * @param bool $bool Defaults to false, keeping the writing page visible. 555 551 */ 556 return apply_filters( 'dwpb_remove_options_writing', false );552 return (bool) apply_filters( 'dwpb_remove_options_writing', false ); 557 553 } 558 554 … … 704 700 */ 705 701 public function has_front_page() { 706 707 702 return 'page' === get_option( 'show_on_front' ) && absint( get_option( 'page_on_front' ) ); 708 703 } … … 715 710 */ 716 711 public function disable_press_this() { 717 718 712 wp_die( '"Press This" functionality has been disabled.' ); 719 713 } … … 795 789 */ 796 790 public function enqueue_styles() { 797 798 791 wp_enqueue_style( $this->plugin_name, plugin_dir_url( __FILE__ ) . '../assets/css/disable-blog-admin.css', array(), $this->version, 'all' ); 799 792 } … … 829 822 */ 830 823 public function is_admin_page( $page ) { 831 832 824 global $pagenow; 833 834 825 return is_admin() && isset( $pagenow ) && is_string( $pagenow ) && $page . '.php' === $pagenow; 835 826 } … … 1002 993 */ 1003 994 public function filter_existing_comments( $comments, $post_id ) { 1004 1005 995 return ( 'post' === get_post_type( $post_id ) ) ? array() : $comments; 1006 996 } … … 1034 1024 public function site_status_tests( $tests ) { 1035 1025 1036 if ( isset( $tests['direct']['rest_availability'] ) && is_callable( array( $this, 'get_test_rest_availability' ) )) {1026 if ( isset( $tests['direct']['rest_availability'] ) ) { 1037 1027 $tests['direct']['rest_availability']['test'] = array( $this, 'get_test_rest_availability' ); 1038 1028 } … … 1055 1045 1056 1046 $result = array( 1057 'label' => __( 'The REST API is available' ), 1047 'label' => __( 'The REST API is available' ), // phpcs:ignore WordPress.WP.I18n.MissingArgDomain 1058 1048 'status' => 'good', 1059 1049 'badge' => array( 1060 'label' => __( 'Performance' ), 1050 'label' => __( 'Performance' ), // phpcs:ignore WordPress.WP.I18n.MissingArgDomain 1061 1051 'color' => 'blue', 1062 1052 ), 1063 1053 'description' => sprintf( 1064 1054 '<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 1066 1056 ), 1067 1057 'actions' => '', … … 1069 1059 ); 1070 1060 1071 $cookies = wp_unslash( $_COOKIE ); 1061 $cookies = wp_unslash( $_COOKIE ); // phpcs:ignore WordPressVIPMinimum.Variables.RestrictedVariables.cache_constraints___COOKIE 1072 1062 $timeout = 10; 1073 1063 $headers = array( … … 1097 1087 ); 1098 1088 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 1100 1090 1101 1091 if ( is_wp_error( $r ) ) { 1102 1092 $result['status'] = 'critical'; 1103 1093 1104 $result['label'] = __( 'The REST API encountered an error' ); 1094 $result['label'] = __( 'The REST API encountered an error' ); // phpcs:ignore WordPress.WP.I18n.MissingArgDomain 1105 1095 1106 1096 $result['description'] .= sprintf( … … 1108 1098 sprintf( 1109 1099 '%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 1111 1101 sprintf( 1112 1102 /* 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 1114 1104 $r->get_error_message(), 1115 1105 $r->get_error_code() … … 1120 1110 $result['status'] = 'recommended'; 1121 1111 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 1123 1113 1124 1114 $result['description'] .= sprintf( … … 1126 1116 sprintf( 1127 1117 /* 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 1129 1119 wp_remote_retrieve_response_code( $r ), 1130 1120 esc_html( wp_remote_retrieve_body( $r ) ) … … 1137 1127 $result['status'] = 'recommended'; 1138 1128 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 1140 1130 1141 1131 $result['description'] .= sprintf( … … 1143 1133 sprintf( 1144 1134 /* 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 1146 1136 '<code>context</code>' 1147 1137 ) … … 1188 1178 $args = array( 1189 1179 'fields' => 'ids', 1190 'posts_per_page' => 500,1180 'posts_per_page' => 100, 1191 1181 'post_type' => $post_type, 1192 1182 'no_found_rows' => true, 1193 1183 'update_post_meta_cache' => false, 1194 'tax_query' => array( 1184 'tax_query' => array( // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_tax_query 1195 1185 array( 1196 1186 'taxonomy' => $taxonomy, … … 1443 1433 return $available_tags; 1444 1434 } 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 } 1445 1457 } -
disable-blog/tags/0.5.5/includes/class-disable-blog-deactivator.php
r3010321 r3462142 149 149 */ 150 150 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' ); 157 152 } 158 153 } -
disable-blog/tags/0.5.5/includes/class-disable-blog-functions.php
r3010321 r3462142 77 77 wp_parse_str( $_SERVER['QUERY_STRING'], $query_vars ); // phpcs:ignore 78 78 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. 81 108 * 82 109 * @since 0.5.0 … … 84 111 * @return array 85 112 */ 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 ) ); 102 117 } 103 118 … … 138 153 * 139 154 * @since 0.5.0 140 * @param string $url the fallback url.155 * @param string $url the fallback url. 141 156 * @return string 142 157 */ -
disable-blog/tags/0.5.5/includes/class-disable-blog-i18n.php
r3010321 r3462142 29 29 */ 30 30 public function load_plugin_textdomain() { 31 32 31 load_plugin_textdomain( 33 32 'disable-blog', -
disable-blog/tags/0.5.5/includes/class-disable-blog-integrations.php
r3010321 r3462142 34 34 35 35 // 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 ); 41 37 } 42 38 … … 48 44 */ 49 45 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' ) ); 57 47 } 58 48 … … 64 54 */ 65 55 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' ) ); 73 57 } 74 58 -
disable-blog/tags/0.5.5/includes/class-disable-blog-loader.php
r3010321 r3462142 45 45 */ 46 46 public function __construct() { 47 48 47 $this->actions = array(); 49 48 $this->filters = array(); -
disable-blog/tags/0.5.5/includes/class-disable-blog-public.php
r3010321 r3462142 53 53 */ 54 54 public function __construct( $plugin_name, $version ) { 55 56 55 $this->plugin_name = $plugin_name; 57 56 $this->version = $version; … … 325 324 */ 326 325 public function feed_links_show_posts_feed( $show ) { 327 328 326 return false; 329 327 } … … 551 549 // Only show the sitemap if there are post types support on the archives. 552 550 $disable_sitemap = empty( $author_archives_supported ); 553 554 551 } 555 552 -
disable-blog/tags/0.5.5/includes/class-disable-blog.php
r3010321 r3462142 267 267 $this->loader->add_filter( 'available_permalink_structure_tags', $plugin_admin, 'available_permalink_structure_tags', 10, 1 ); 268 268 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 269 272 // Only run comment related functions if comments are supported. 270 273 if ( dwpb_post_types_with_feature( 'comments' ) ) { -
disable-blog/tags/0.5.5/includes/functions.php
r3010321 r3462142 53 53 54 54 wp_cache_set( $cache_name, $post_types_with_feature, 'post-types-by-feature' ); 55 56 55 } 57 56 … … 91 90 function dwpb_post_types_with_tax( $taxonomy, $args = array(), $output = 'names' ) { 92 91 93 $post_types = get_post_types( $args, $output ); 92 if ( ! $taxonomy || ( ! is_object( $taxonomy ) && ! is_string( $taxonomy ) ) ) { 93 return false; 94 } 94 95 95 96 // We just need the taxonomy name. 96 97 if ( is_object( $taxonomy ) ) { 97 98 $taxonomy = $taxonomy->name; 99 } 98 100 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 ); 103 103 104 104 // setup the finished product. … … 110 110 $type = $post_type->name; 111 111 // If post types are strings. 112 } elseif ( is_string( $post_type ) ) {113 $type = $post_type;114 112 } else { 115 $type = '';113 $type = (string) $post_type; 116 114 } 117 115 -
disable-blog/tags/0.5.5/uninstall.php
r2887738 r3462142 34 34 || ! isset( $_REQUEST['plugin'] ) 35 35 || ! 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 37 37 || 'delete-plugin' !== $_REQUEST['action'] 38 38 || ! check_ajax_referer( 'updates', '_ajax_nonce' ) … … 107 107 108 108 // 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 110 110 111 111 if ( $blogs ) { -
disable-blog/trunk/CHANGELOG.md
r3010321 r3462142 1 1 # Changelog 2 2 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 3 12 ## 0.5.4 13 4 14 - Tested up to WordPress 6.4.2. 5 15 - Bump minimum WordPress version to 5.3, aligning with minimum PHP support. 6 16 - Test to PHP 8.2. 7 17 - 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 10 20 - Increase accuracy of CSS selector used to hide blog related items in Settings > Reading, closes [#69](https://github.com/joshuadavidnelson/disable-blog/issues/69) 11 21 - Add `.wp-env.json` for local development. 12 22 13 23 ## 0.5.3 24 14 25 - Fix `typeof` typo in `disable-blog-customizer.js` from 0.5.2 updates for #59. 15 26 - Fix uninstall error to allow for the plugin to be deleted correctly. … … 21 32 22 33 ## 0.5.2 34 23 35 - Test up to WP 6.1.1 24 36 - Increase minimum PHP to v7.4 25 37 - Test to PHP 8.1 26 38 - 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 28 40 - Adds a check to the customizer script to avoid a TypeError. Closes #59 29 41 - 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 30 42 31 43 ## 0.5.1 44 32 45 - Update to documentation, readmes, and doc blocks. 33 46 - Fix `.distignore` to remove itself and .gitignore from WP-dot-org repo. … … 38 51 - Test up to WordPress v6.0.2 39 52 - 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. 41 54 - Update loader class to provide a `remove_filter` method. Closes [#58](https://github.com/joshuadavidnelson/disable-blog/issues/58). 42 55 - Alter permalink settings based on if categories and author archives are supported. … … 45 58 ## 0.5.0 46 59 47 **New** 60 ### New 61 48 62 - 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). 49 63 - 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. … … 59 73 - 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 60 74 - 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 66 81 - 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) 67 82 - 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). … … 70 85 - 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. 71 86 72 **Improvements/Updates** 87 ### Improvements/Updates 88 73 89 - 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). 87 103 - 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`). 94 110 - Bump minimum PHP to 5.6. 95 111 - Tested up to WP Core version 5.9.3. … … 98 114 99 115 ## 0.4.10 116 100 117 - 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. 101 118 102 119 ## 0.4.9 120 103 121 - **Notice:** We've added the minimum PHP version requirement of 5.3, which was not explicitly set before now. 104 122 - **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.** … … 114 132 - Remove header feed urls, unless supported by another post type. 115 133 - 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. 119 137 - **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. 123 141 124 142 ## 0.4.8.1 143 125 144 - Do'h! Forgot to update the version number in the main plugin file. Bump. 126 145 127 146 ## 0.4.8 147 128 148 - Fixed typo in variable name for current vs redirect url check. (h/t @chesio, PR #30) 129 149 - Update function names from template to `disable_blog`. (h/t @szepeviktor, PR #31) … … 133 153 134 154 ## 0.4.7 155 135 156 - Using GitHub actions publish on WP.org from github releases. 136 157 - Cleaned up the Reading settings, adding admin notices if front page is not set. … … 140 161 141 162 ## 0.4.6 163 142 164 - Added check on disable feed functionality to confirm post type prior to disabling feed. 143 165 144 166 ## 0.4.5 167 145 168 - 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). 146 169 - Correct misspelled dwpb_redirect_options_tools filter. 147 170 148 171 ## 0.4.4 172 149 173 - Hide the Settings > Writing menu item, which shows up with Disable Comments enabled everywhere. Thanks to @dater for identifying. 150 174 151 175 ## 0.4.3 176 152 177 - 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. 153 178 - Add de/activation hooks to clear comment caches … … 155 180 156 181 ## 0.4.2 182 157 183 - Disable the REST API for 'post' post type. Props to @shawnhooper. 158 184 159 185 ## 0.4.1 186 160 187 - Fix unintended redirect for custom admin pages under tools.php. Props to @greatislander for the catch. 161 188 162 189 ## 0.4.0 190 163 191 - 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. 167 195 - Expanded inline documentation. 168 196 - Add another failsafe for potential redirect loops. … … 177 205 178 206 ## 0.3.3 207 179 208 - Weird issue with svn, same as version 0.3.2. 180 209 181 210 ## 0.3.2 211 182 212 - Fix potential loop issue with `home_url` in redirection function. 183 213 - Fix custom taxonomy save redirect (used to redirect to dashboard, now it saves correctly). 184 214 185 215 ## 0.3.1 216 186 217 - Add/update readme.txt. 187 218 188 219 ## 0.3.0 220 189 221 - Singleton Class. 190 222 - Clean up documentation. 191 223 - Add filters. 192 224 193 225 ## 0.2.0 226 194 227 More improvements: 195 228 … … 211 244 212 245 ## 0.1.0 246 213 247 Initial beta release. -
disable-blog/trunk/README.md
r3010321 r3462142 4 4 [](https://wordpress.org/plugins/disable-blog/)   5 5 6 **Requires at least WordPress:** 5.3 7 **Tested up to WordPress:** 6.4.2 8 **Stable version:** 0.5.4 6 [](https://plugintests.com/plugins/wporg/disable-blog/latest) [](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 9 11 **License:** GPLv2 or later 10 12 **Requires PHP:** 7.4 11 **Tested up to PHP:** 8. 213 **Tested up to PHP:** 8.4 12 14 13 15 All the power of WordPress, without a blog. … … 104 106 All 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. 105 107 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`108 For 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` 107 109 108 110 All 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 9 9 * 10 10 * @link https://github.com/joshuadavidnelson/disable-blog 11 * @since 0.4.012 11 * @package Disable_Blog 13 12 * … … 16 15 * Plugin URI: https://wordpress.org/plugins/disable-blog/ 17 16 * Description: Go blog-less with WordPress. This plugin disables all blog-related functionality (by hiding, removing, and redirecting). 18 * Version: 0.5. 417 * Version: 0.5.5 19 18 * Author: Joshua David Nelson 20 19 * Author URI: http://joshuadnelson.com … … 60 59 define( 'DWPB_URL', plugins_url( '/', __FILE__ ) ); 61 60 define( 'DWPB_PLUGIN_NAME', 'disable-blog' ); 62 define( 'DWPB_VERSION', '0.5. 4' );61 define( 'DWPB_VERSION', '0.5.5' ); 63 62 64 63 /** -
disable-blog/trunk/includes/class-disable-blog-activator.php
r3010321 r3462142 149 149 */ 150 150 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' ); 157 152 } 158 153 } -
disable-blog/trunk/includes/class-disable-blog-admin.php
r3010321 r3462142 54 54 */ 55 55 public function __construct( $plugin_name, $version ) { 56 57 56 $this->plugin_name = $plugin_name; 58 57 $this->version = $version; … … 94 93 * @since 0.4.9 removed rest api specific filter and updated function 95 94 * for disabling all public-facing aspects of the 'post' post type. 95 * @return void 96 96 */ 97 97 public function modify_post_type_arguments() { … … 126 126 // remove supports. 127 127 $wp_post_types['post']->supports = array(); 128 129 128 } 130 129 } … … 408 407 */ 409 408 public function redirect_admin_options_discussion() { 410 411 409 return $this->redirect_admin_edit_comments(); 412 410 } … … 422 420 // Redirect writing options to general options. 423 421 if ( $this->remove_writing_options() ) { 424 425 422 return admin_url( 'options-general.php' ); 426 427 423 } 428 424 … … 554 550 * @param bool $bool Defaults to false, keeping the writing page visible. 555 551 */ 556 return apply_filters( 'dwpb_remove_options_writing', false );552 return (bool) apply_filters( 'dwpb_remove_options_writing', false ); 557 553 } 558 554 … … 704 700 */ 705 701 public function has_front_page() { 706 707 702 return 'page' === get_option( 'show_on_front' ) && absint( get_option( 'page_on_front' ) ); 708 703 } … … 715 710 */ 716 711 public function disable_press_this() { 717 718 712 wp_die( '"Press This" functionality has been disabled.' ); 719 713 } … … 795 789 */ 796 790 public function enqueue_styles() { 797 798 791 wp_enqueue_style( $this->plugin_name, plugin_dir_url( __FILE__ ) . '../assets/css/disable-blog-admin.css', array(), $this->version, 'all' ); 799 792 } … … 829 822 */ 830 823 public function is_admin_page( $page ) { 831 832 824 global $pagenow; 833 834 825 return is_admin() && isset( $pagenow ) && is_string( $pagenow ) && $page . '.php' === $pagenow; 835 826 } … … 1002 993 */ 1003 994 public function filter_existing_comments( $comments, $post_id ) { 1004 1005 995 return ( 'post' === get_post_type( $post_id ) ) ? array() : $comments; 1006 996 } … … 1034 1024 public function site_status_tests( $tests ) { 1035 1025 1036 if ( isset( $tests['direct']['rest_availability'] ) && is_callable( array( $this, 'get_test_rest_availability' ) )) {1026 if ( isset( $tests['direct']['rest_availability'] ) ) { 1037 1027 $tests['direct']['rest_availability']['test'] = array( $this, 'get_test_rest_availability' ); 1038 1028 } … … 1055 1045 1056 1046 $result = array( 1057 'label' => __( 'The REST API is available' ), 1047 'label' => __( 'The REST API is available' ), // phpcs:ignore WordPress.WP.I18n.MissingArgDomain 1058 1048 'status' => 'good', 1059 1049 'badge' => array( 1060 'label' => __( 'Performance' ), 1050 'label' => __( 'Performance' ), // phpcs:ignore WordPress.WP.I18n.MissingArgDomain 1061 1051 'color' => 'blue', 1062 1052 ), 1063 1053 'description' => sprintf( 1064 1054 '<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 1066 1056 ), 1067 1057 'actions' => '', … … 1069 1059 ); 1070 1060 1071 $cookies = wp_unslash( $_COOKIE ); 1061 $cookies = wp_unslash( $_COOKIE ); // phpcs:ignore WordPressVIPMinimum.Variables.RestrictedVariables.cache_constraints___COOKIE 1072 1062 $timeout = 10; 1073 1063 $headers = array( … … 1097 1087 ); 1098 1088 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 1100 1090 1101 1091 if ( is_wp_error( $r ) ) { 1102 1092 $result['status'] = 'critical'; 1103 1093 1104 $result['label'] = __( 'The REST API encountered an error' ); 1094 $result['label'] = __( 'The REST API encountered an error' ); // phpcs:ignore WordPress.WP.I18n.MissingArgDomain 1105 1095 1106 1096 $result['description'] .= sprintf( … … 1108 1098 sprintf( 1109 1099 '%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 1111 1101 sprintf( 1112 1102 /* 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 1114 1104 $r->get_error_message(), 1115 1105 $r->get_error_code() … … 1120 1110 $result['status'] = 'recommended'; 1121 1111 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 1123 1113 1124 1114 $result['description'] .= sprintf( … … 1126 1116 sprintf( 1127 1117 /* 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 1129 1119 wp_remote_retrieve_response_code( $r ), 1130 1120 esc_html( wp_remote_retrieve_body( $r ) ) … … 1137 1127 $result['status'] = 'recommended'; 1138 1128 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 1140 1130 1141 1131 $result['description'] .= sprintf( … … 1143 1133 sprintf( 1144 1134 /* 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 1146 1136 '<code>context</code>' 1147 1137 ) … … 1188 1178 $args = array( 1189 1179 'fields' => 'ids', 1190 'posts_per_page' => 500,1180 'posts_per_page' => 100, 1191 1181 'post_type' => $post_type, 1192 1182 'no_found_rows' => true, 1193 1183 'update_post_meta_cache' => false, 1194 'tax_query' => array( 1184 'tax_query' => array( // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_tax_query 1195 1185 array( 1196 1186 'taxonomy' => $taxonomy, … … 1443 1433 return $available_tags; 1444 1434 } 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 } 1445 1457 } -
disable-blog/trunk/includes/class-disable-blog-deactivator.php
r3010321 r3462142 149 149 */ 150 150 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' ); 157 152 } 158 153 } -
disable-blog/trunk/includes/class-disable-blog-functions.php
r3010321 r3462142 77 77 wp_parse_str( $_SERVER['QUERY_STRING'], $query_vars ); // phpcs:ignore 78 78 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. 81 108 * 82 109 * @since 0.5.0 … … 84 111 * @return array 85 112 */ 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 ) ); 102 117 } 103 118 … … 138 153 * 139 154 * @since 0.5.0 140 * @param string $url the fallback url.155 * @param string $url the fallback url. 141 156 * @return string 142 157 */ -
disable-blog/trunk/includes/class-disable-blog-i18n.php
r3010321 r3462142 29 29 */ 30 30 public function load_plugin_textdomain() { 31 32 31 load_plugin_textdomain( 33 32 'disable-blog', -
disable-blog/trunk/includes/class-disable-blog-integrations.php
r3010321 r3462142 34 34 35 35 // 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 ); 41 37 } 42 38 … … 48 44 */ 49 45 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' ) ); 57 47 } 58 48 … … 64 54 */ 65 55 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' ) ); 73 57 } 74 58 -
disable-blog/trunk/includes/class-disable-blog-loader.php
r3010321 r3462142 45 45 */ 46 46 public function __construct() { 47 48 47 $this->actions = array(); 49 48 $this->filters = array(); -
disable-blog/trunk/includes/class-disable-blog-public.php
r3010321 r3462142 53 53 */ 54 54 public function __construct( $plugin_name, $version ) { 55 56 55 $this->plugin_name = $plugin_name; 57 56 $this->version = $version; … … 325 324 */ 326 325 public function feed_links_show_posts_feed( $show ) { 327 328 326 return false; 329 327 } … … 551 549 // Only show the sitemap if there are post types support on the archives. 552 550 $disable_sitemap = empty( $author_archives_supported ); 553 554 551 } 555 552 -
disable-blog/trunk/includes/class-disable-blog.php
r3010321 r3462142 267 267 $this->loader->add_filter( 'available_permalink_structure_tags', $plugin_admin, 'available_permalink_structure_tags', 10, 1 ); 268 268 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 269 272 // Only run comment related functions if comments are supported. 270 273 if ( dwpb_post_types_with_feature( 'comments' ) ) { -
disable-blog/trunk/includes/functions.php
r3010321 r3462142 53 53 54 54 wp_cache_set( $cache_name, $post_types_with_feature, 'post-types-by-feature' ); 55 56 55 } 57 56 … … 91 90 function dwpb_post_types_with_tax( $taxonomy, $args = array(), $output = 'names' ) { 92 91 93 $post_types = get_post_types( $args, $output ); 92 if ( ! $taxonomy || ( ! is_object( $taxonomy ) && ! is_string( $taxonomy ) ) ) { 93 return false; 94 } 94 95 95 96 // We just need the taxonomy name. 96 97 if ( is_object( $taxonomy ) ) { 97 98 $taxonomy = $taxonomy->name; 99 } 98 100 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 ); 103 103 104 104 // setup the finished product. … … 110 110 $type = $post_type->name; 111 111 // If post types are strings. 112 } elseif ( is_string( $post_type ) ) {113 $type = $post_type;114 112 } else { 115 $type = '';113 $type = (string) $post_type; 116 114 } 117 115 -
disable-blog/trunk/uninstall.php
r2887738 r3462142 34 34 || ! isset( $_REQUEST['plugin'] ) 35 35 || ! 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 37 37 || 'delete-plugin' !== $_REQUEST['action'] 38 38 || ! check_ajax_referer( 'updates', '_ajax_nonce' ) … … 107 107 108 108 // 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 110 110 111 111 if ( $blogs ) {
Note: See TracChangeset
for help on using the changeset viewer.