├── CHANGELOG.md ├── LICENSE ├── README.md ├── assets └── js │ └── dobby.js ├── composer.json ├── dobby.php └── readme.txt /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Change Log 2 | 3 | All notable changes to this project will be documented in this file. 4 | 5 | The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). 6 | 7 | ## [Unreleased] 8 | 9 | ### Added 10 | 11 | - 12 | 13 | ### Changed 14 | 15 | - 16 | 17 | ### Fixed 18 | 19 | - 20 | 21 | ### Removed 22 | 23 | - 24 | 25 | ## [1.4.0] - 2021-03-16 26 | 27 | ### Changed 28 | 29 | - Update development dependencies. 30 | - Bump "Tested up to" header, see [issue #12](https://github.com/tfrommen/Dobby/issues/12). 31 | 32 | ## [1.3.0] - 2017-09-20 33 | 34 | ### Added 35 | 36 | - Add PHP_CodeSniffer. 37 | 38 | ### Changed 39 | 40 | - Adapt code according to PHP_CodeSniffer ruleset. 41 | - Pass custom selectors to JavaScript. 42 | 43 | ### Fixed 44 | 45 | - Fix dismissible notices not being able to get dismissed, see [issue #9](https://github.com/tfrommen/Dobby/issues/9). 46 | 47 | ## [1.2.1] - 2017-08-02 48 | 49 | ### Fixed 50 | 51 | - Fix output buffering priority. 52 | 53 | ## [1.2.0] - 2017-07-30 54 | 55 | WordPress.org release. 56 | 57 | ## [1.1.1] - 2017-07-23 58 | 59 | ### Fixed 60 | 61 | - Only ignore images for export (e.g., the generated ZIP file), see [#5](https://github.com/tfrommen/Dobby/issues/5). 62 | 63 | ## [1.1.0] - 2017-07-17 64 | 65 | ### Added 66 | 67 | - Add `\tfrommen\Dobby\FILTER_THRESHOLD` to filter the minimum number of admin notices required for Dobby to take action, see [#4](https://github.com/tfrommen/Dobby/issues/4). 68 | - Add ... ✨ MAGIC ✨. 69 | 70 | ### Changed 71 | 72 | - Make Dobby reveal the captured admin notices once and for all instead of toggling them. 73 | - Make Dobby pick up the according notice level based on what admin notices he captured—error wins over warning, otherwise it is an info—see [#3](https://github.com/tfrommen/Dobby/issues/3). 74 | 75 | ### Fixed 76 | 77 | - Make Dobby also capture admin notices with only the `error` or `updated` class, see [#2](https://github.com/tfrommen/Dobby/issues/2). 78 | 79 | ## [1.0.1] - 2017-07-17 80 | 81 | ### Changed 82 | 83 | - Move `load_plugin_textdomain()` call to where it actually is needed. 84 | 85 | ### Fixed 86 | 87 | - Add missing `Text Domain` information in plugin header. 88 | - Fix typos. 89 | 90 | ## 1.0.0 - 2017-07-16 91 | 92 | Initial release. 93 | 94 | ---- 95 | 96 | [Unreleased]: https://github.com/tfrommen/Dobby/compare/v1.4.0...HEAD 97 | [1.4.0]: https://github.com/tfrommen/Dobby/compare/v1.3.0...v1.4.0 98 | [1.3.0]: https://github.com/tfrommen/Dobby/compare/v1.2.1...v1.3.0 99 | [1.2.1]: https://github.com/tfrommen/Dobby/compare/v1.2.0...v1.2.1 100 | [1.2.0]: https://github.com/tfrommen/Dobby/compare/v1.1.1...v1.2.0 101 | [1.1.1]: https://github.com/tfrommen/Dobby/compare/v1.1.0...v1.1.1 102 | [1.1.0]: https://github.com/tfrommen/Dobby/compare/v1.0.1...v1.1.0 103 | [1.0.1]: https://github.com/tfrommen/Dobby/compare/v1.0.0...v1.0.1 104 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2017 Thorsten Frommen 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Dobby 2 | 3 | [![Version](https://img.shields.io/packagist/v/tfrommen/dobby.svg)](https://packagist.org/packages/tfrommen/dobby) 4 | [![Status](https://img.shields.io/badge/status-active-brightgreen.svg)](https://github.com/tfrommen/Dobby) 5 | [![Downloads](https://img.shields.io/packagist/dt/tfrommen/dobby.svg)](https://packagist.org/packages/tfrommen/dobby) 6 | [![License](https://img.shields.io/packagist/l/tfrommen/dobby.svg)](https://packagist.org/packages/tfrommen/dobby) 7 | 8 | > Dobby, the friendly Admin Elf, takes care of all your (unwanted) admin notices. 9 | 10 | ## Installation 11 | 12 | Install with [Composer](https://getcomposer.org): 13 | 14 | ```sh 15 | composer require tfrommen/dobby 16 | ``` 17 | 18 | Or: 19 | 20 | 1. [Download ZIP](https://github.com/tfrommen/Dobby/releases). 21 | 1. Upload contents to the `/wp-content/plugins/` directory on your web server. 22 | 1. Activate the plugin through the _Plugins_ menu in WordPress. 23 | 1. See only a single admin notice, if at all. 24 | 25 | ### Requirements 26 | 27 | This plugin **requires PHP 5.4** or higher, but you really **should be using PHP 7** or higher, as we all know. 28 | 29 | ## Usage 30 | 31 | Dobby captures everything that gets printed on one of the admin notice hooks (i.e., `network_admin_notices`, `user_admin_notices`, `admin_notices` and `all_admin_notices`), and hides it, for now. 32 | In case Dobby did capture anything, he will inform you (yes, via an admin notice). 33 | 34 | ![Dobby in Action](assets/images/dobby.gif) 35 | 36 | ### Filters 37 | 38 | In order to customize certain aspects of the plugin, it provides you with several filters. 39 | For each of these, a short description as well as a code example on how to alter the default behavior is given below. 40 | Just put the according code snippet in your theme's `functions.php` file or your _customization_ plugin, or to some other appropriate place. 41 | 42 | #### `\tfrommen\Dobby\FILTER_THRESHOLD` (`dobby.threshold`) 43 | 44 | This filter lets you customize the minimum number of admin notices required for Dobby to take action. 45 | The default value is `1`. 46 | 47 | **Usage Example:** 48 | 49 | ```php 50 | =5.4" 26 | }, 27 | "require-dev": { 28 | "dealerdirect/phpcodesniffer-composer-installer": "^0.7.1", 29 | "phpcompatibility/php-compatibility": "^9.0", 30 | "squizlabs/php_codesniffer": "^3.5", 31 | "wp-coding-standards/wpcs": "^2.3" 32 | }, 33 | "config": { 34 | "sort-packages": true 35 | }, 36 | "extra": { 37 | "branch-alias": { 38 | "dev-master": "1.4.x-dev" 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /dobby.php: -------------------------------------------------------------------------------- 1 | 81 |
82 |

83 | 84 | 85 | 86 |

87 |
88 |
89 | 93 |
94 | true ] 101 | ); 102 | 103 | /** 104 | * Filter the minimum number of admin notices required for Dobby to take action. 105 | * 106 | * @since 1.1.0 107 | * 108 | * @param int $threshold Required minimum number of admin notices. 109 | */ 110 | $threshold = (int) apply_filters( FILTER_THRESHOLD, 1 ); 111 | wp_localize_script( 112 | 'dobby', 113 | 'dobbySettings', 114 | [ 115 | 'selectorCloset' => "#{$closet_id}", 116 | 'selectorDobby' => "#{$dobby_id}", 117 | 'threshold' => max( 1, $threshold ), 118 | ] 119 | ); 120 | }, 121 | PHP_INT_MAX 122 | ); 123 | } 124 | 125 | add_action( 'plugins_loaded', __NAMESPACE__ . '\\bootstrap' ); 126 | -------------------------------------------------------------------------------- /readme.txt: -------------------------------------------------------------------------------- 1 | === Dobby === 2 | Contributors: tfrommen 3 | Tags: admin, notices 4 | Requires at least: 3.1.0 5 | Tested up to: 5.7 6 | Stable tag: 1.4.0 7 | Requires PHP: 5.4 8 | 9 | Dobby, the friendly Admin Elf, takes care of all your (unwanted) admin notices. 10 | 11 | == Description == 12 | 13 | Dobby, the friendly Admin Elf, takes care of all your (unwanted) admin notices. 14 | 15 | = Contribution = 16 | 17 | To **contribute** to this plugin, please see its **GitHub repository**. 18 | 19 | If you have a feature request, or if you have developed the feature already, please feel free to use the Issues and/or Pull Requests section. 20 | 21 | Of course, you can also provide me with translations if you would like to use the plugin in another not yet included language. 22 | 23 | == Installation == 24 | 25 | This plugin requires **PHP 5.4**. 26 | 27 | 1. Upload the `wp-dobby` folder to the `/wp-content/plugins/` directory on your web server. 28 | 1. Activate the plugin through the _Plugins_ menu in WordPress. 29 | 1. See only a single admin notice, if at all. 30 | 31 | == Changelog == 32 | 33 | = 1.4.0 = 34 | * Bump "Tested up to" header, see [issue #12](https://github.com/tfrommen/Dobby/issues/12). 35 | 36 | = 1.3.0 = 37 | * Fix dismissible notices not being able to get dismissed, see [issue #9](https://github.com/tfrommen/Dobby/issues/9). 38 | * Add PHP_CodeSniffer, and adapt code. 39 | * Pass custom selectors to JavaScript. 40 | 41 | = 1.2.1 = 42 | * Fix output buffering priority. 43 | 44 | = 1.2.0 = 45 | * WordPress.org release. 46 | 47 | = 1.1.1 = 48 | * Only ignore images for export (e.g., the generated ZIP file). 49 | 50 | = 1.1.0 = 51 | * Add `\tfrommen\Dobby\FILTER_THRESHOLD` to filter the minimum number of admin notices required for Dobby to take action. 52 | * Add ... MAGIC. 53 | * Make Dobby reveal the captured admin notices once and for all instead of toggling them. 54 | * Make Dobby pick up the according notice level based on what admin notices he captured—error wins over warning, otherwise it is an info. 55 | * Make Dobby also capture admin notices with only the `error` or `updated` class. 56 | 57 | = 1.0.1 = 58 | * Move `load_plugin_textdomain()` call to where it actually is needed. 59 | * Add missing `Text Domain` information in plugin header. 60 | * Fix typos. 61 | 62 | = 1.0.0 = 63 | * Initial release. 64 | --------------------------------------------------------------------------------