├── .github ├── ISSUE_TEMPLATE │ ├── A.md │ ├── bug_report.md │ └── feature_request.md ├── PULL_REQUEST_TEMPLATE.md ├── SUPPORT.md └── workflows │ └── license-audit.yml ├── .gitignore ├── .styleci.yml ├── CHANGELOG.md ├── CONTRIBUTING.md ├── LICENSE.txt ├── README.md ├── SECURITY.md ├── Thorfile ├── bugsnag.php ├── composer.json ├── example ├── .gitignore ├── README.md └── docker-compose.yml ├── readme.txt └── views └── settings.php /.github/ISSUE_TEMPLATE/A.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Having trouble getting started? 3 | about: Please contact us at support@bugsnag.com for assistance with integrating BugSnag 4 | into your application. 5 | title: '' 6 | labels: '' 7 | assignees: '' 8 | 9 | --- 10 | Please check out our [documentation](https://docs.bugsnag.com/platforms/php/wordpress/) for guides, references and tutorials. 11 | 12 | If you have questions about your integration, please contact us at [support@bugsnag.com](mailto:support@bugsnag.com). 13 | 14 | Alternatively, view additional options at [SUPPORT.md](../SUPPORT.md). -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve the library 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | 11 | 12 | ### Describe the bug 13 | A clear and concise description of what the bug is. 14 | 15 | ### Steps to reproduce 16 | 1. Go to '...' 17 | 2. Click on '....' 18 | 3. Scroll down to '....' 19 | 4. See error 20 | 21 | ### Environment 22 | * BugSnag version: 23 | * PHP version: 24 | * Wordpress version: 25 | 26 | 27 | 32 | 33 | ### Example Repo 34 | 35 | - [ ] Create a minimal repository that can reproduce the issue 36 | - [ ] Link to it here: 37 | 38 | ### Example code snippet 39 | 40 | ``` 41 | # (Insert code sample to reproduce the problem) 42 | ``` 43 | 44 | 45 |
Error messages: 46 | 47 | ``` 48 | 49 | ``` 50 |
-------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | 11 | 12 | ### Description 13 | 16 | 17 | **Describe the solution you'd like** 18 | 19 | 20 | **Describe alternatives you've considered** 21 | 22 | 23 | **Additional context** 24 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ## Goal 2 | 3 | 4 | 5 | ## Design 6 | 7 | 8 | 9 | ## Changeset 10 | 11 | 12 | 13 | ## Testing 14 | 15 | -------------------------------------------------------------------------------- /.github/SUPPORT.md: -------------------------------------------------------------------------------- 1 | ## Are you having trouble getting started? 2 | If you haven't already, please check out our [documentation](https://docs.bugsnag.com/platforms/php/wordpress/) for guides, references and tutorials. 3 | 4 | Or, if you wish, you can [contact us directly](mailto:support@bugsnag.com) for assistance on integrating BugSnag into your application, troubleshooting an issue, or if you have a question about our supported features. 5 | 6 | When contacting support, please include as much information as necessary, including: 7 | 8 | - example code snippet 9 | - steps to reproduce 10 | - expected/actual behaviour 11 | 12 | * BugSnag version: 13 | * PHP version: 14 | * Wordpress version: 15 | 16 | 17 | ## Bug or Feature Requests 18 | If you would like to raise a bug or feature request, please do so by creating a [New Issue](https://github.com/bugsnag/bugsnag-wordpress/issues/new/choose) and selecting bug or feature. 19 | Please note: we cannot promise that we will fulfil all requests 20 | 21 | ## Pull Requests 22 | If you have made a fix and would like to raise a pull request, please read our [CONTRIBUTING.md](../CONTRIBUTING.md) file before creating the pull request. 23 | -------------------------------------------------------------------------------- /.github/workflows/license-audit.yml: -------------------------------------------------------------------------------- 1 | name: Audit bugsnag-wordpress dependency licenses 2 | 3 | on: [push, pull_request] 4 | 5 | jobs: 6 | license-audit: 7 | runs-on: ubuntu-latest 8 | 9 | steps: 10 | - uses: actions/checkout@v2 11 | 12 | - name: install PHP 13 | uses: shivammathur/setup-php@v2 14 | with: 15 | php-version: '8.0' 16 | coverage: none 17 | extensions: intl, mbstring 18 | 19 | - name: Fetch decisions.yml 20 | run: curl https://raw.githubusercontent.com/bugsnag/license-audit/master/config/decision_files/global.yml -o decisions.yml 21 | 22 | - name: Install composer dependencies 23 | run: composer install --no-dev 24 | 25 | - name: Run License Finder 26 | # for some reason license finder doesn't run without a login shell (-l) 27 | run: > 28 | docker run -v $PWD:/scan licensefinder/license_finder /bin/bash -lc " 29 | cd /scan && 30 | license_finder --decisions-file decisions.yml --composer-check-require-only=true --enabled-package-managers=composer 31 | " -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | build 2 | vendor 3 | composer.lock 4 | svn 5 | decisions.yml -------------------------------------------------------------------------------- /.styleci.yml: -------------------------------------------------------------------------------- 1 | disabled: 2 | - align_double_arrow 3 | - phpdoc_align 4 | - no_blank_lines_after_throw 5 | - short_array_syntax 6 | - die_to_exit 7 | 8 | enabled: 9 | - unalign_double_arrow 10 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | Changelog 2 | ========= 3 | 4 | ## v1.6.3 (2023-07-13) 5 | 6 | * Fix PHP 8.2 deprecation notice 7 | 8 | ## v1.6.2 (2023-01-26) 9 | 10 | * Fix broken url in notifier configuration & add docs link to test notification [#60](https://github.com/bugsnag/bugsnag-wordpress/pull/60) 11 | * Bump "tested up to" WordPress version 12 | 13 | ## v1.6.1 (2021-09-21) 14 | 15 | * Bump "tested up to" WordPress version 16 | 17 | ## v1.6.0 (2020-11-17) 18 | 19 | ### Enhancements 20 | 21 | * Use `wp_get_environment_type` to set the release stage, when it's available [bhubbard](https://github.com/bhubbard) [#53](https://github.com/bugsnag/bugsnag-wordpress/pull/53) 22 | * Update bundled bugsnag-php version to v2.10.1 23 | 24 | ## 1.5.0 (2020-04-29) 25 | 26 | ### Enhancements 27 | 28 | * Clarify the "Test Bugsnag" form action [#46](https://github.com/bugsnag/bugsnag-wordpress/pull/46) 29 | * Improve error message when methods are called with no api key set [#47](https://github.com/bugsnag/bugsnag-wordpress/pull/47) 30 | * Add a constant to control setting error handlers [#45](https://github.com/bugsnag/bugsnag-wordpress/pull/45) 31 | 32 | ## 1.4.0 (2019-07-02) 33 | 34 | ### Enhancements 35 | 36 | * Add WordPress version string to report payloads (device.runtimeVersions) [#39](https://github.com/bugsnag/bugsnag-wordpress/pull/39) 37 | 38 | ### Fixes 39 | 40 | * Added ability to define API key as constant [chrisatomix](https://github.com/chrisatomix) [#18](https://github.com/bugsnag/bugsnag-wordpress/issues/18) [#40](https://github.com/bugsnag/bugsnag-wordpress/pull/40) 41 | * Removed form action to prevent deprecation warnings [fiskhandlarn](https://github.com/fiskhandlarn) [#36](https://github.com/bugsnag/bugsnag-wordpress/issues/36) [#40](https://github.com/bugsnag/bugsnag-wordpress/pull/40) 42 | * Fixed broken links on settings page bugsnag.com [#40](https://github.com/bugsnag/bugsnag-wordpress/pull/40) 43 | * Made bugsnagWordpress global to make available for CLI scripts [#23](https://github.com/bugsnag/bugsnag-wordpress/issues/23) [#40](https://github.com/bugsnag/bugsnag-wordpress/pull/40) 44 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | * [Fork](https://help.github.com/articles/fork-a-repo) the 4 | [library on GitHub](https://github.com/bugsnag/bugsnag-wordpress) 5 | * Commit and push until you are happy with your contribution 6 | * [Make a pull request](https://help.github.com/articles/using-pull-requests) 7 | * Thanks! 8 | 9 | 10 | ## Building from source 11 | 12 | If you would like to build a new zip file of the plugin from source, you can 13 | run our build script using [Thor](http://whatisthor.com/). You'll need both 14 | `ruby` and the `thor` gem installed (`gem install thor`). Then you can 15 | generate a new zip by running: 16 | 17 | ```shell 18 | thor wordpress:zip bugsnag-wordpress.zip 19 | ``` 20 | 21 | ## Releasing 22 | 23 | In order to make a release your WordPress account must have committer access on the [Bugsnag WordPress plugin](https://wordpress.org/plugins/bugsnag), otherwise the SVN release will fail. 24 | 25 | 1. Update the changelog in `readme.txt` 26 | 1. Run the [Thor](http://whatisthor.com/) `release` command to update version numbers, create a Git tag, update SVN and create an SVN tag: 27 | ``` 28 | $ thor wordpress:release 29 | ``` 30 | 31 | Where `` is the version number you're updating to with no leading 'v' (e.g. use "1.6.0" rather than "v1.6.0") and `` is your [WordPress.org](https://wordpress.org) account username 32 | 1. [Build the release from source](#building-from-source) 33 | 1. Attach the release zip to the GitHub releases page for the new tag 34 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 2, June 1991 3 | 4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc., 5 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 6 | Everyone is permitted to copy and distribute verbatim copies 7 | of this license document, but changing it is not allowed. 8 | 9 | Preamble 10 | 11 | The licenses for most software are designed to take away your 12 | freedom to share and change it. By contrast, the GNU General Public 13 | License is intended to guarantee your freedom to share and change free 14 | software--to make sure the software is free for all its users. This 15 | General Public License applies to most of the Free Software 16 | Foundation's software and to any other program whose authors commit to 17 | using it. (Some other Free Software Foundation software is covered by 18 | the GNU Lesser General Public License instead.) You can apply it to 19 | your programs, too. 20 | 21 | When we speak of free software, we are referring to freedom, not 22 | price. Our General Public Licenses are designed to make sure that you 23 | have the freedom to distribute copies of free software (and charge for 24 | this service if you wish), that you receive source code or can get it 25 | if you want it, that you can change the software or use pieces of it 26 | in new free programs; and that you know you can do these things. 27 | 28 | To protect your rights, we need to make restrictions that forbid 29 | anyone to deny you these rights or to ask you to surrender the rights. 30 | These restrictions translate to certain responsibilities for you if you 31 | distribute copies of the software, or if you modify it. 32 | 33 | For example, if you distribute copies of such a program, whether 34 | gratis or for a fee, you must give the recipients all the rights that 35 | you have. You must make sure that they, too, receive or can get the 36 | source code. And you must show them these terms so they know their 37 | rights. 38 | 39 | We protect your rights with two steps: (1) copyright the software, and 40 | (2) offer you this license which gives you legal permission to copy, 41 | distribute and/or modify the software. 42 | 43 | Also, for each author's protection and ours, we want to make certain 44 | that everyone understands that there is no warranty for this free 45 | software. If the software is modified by someone else and passed on, we 46 | want its recipients to know that what they have is not the original, so 47 | that any problems introduced by others will not reflect on the original 48 | authors' reputations. 49 | 50 | Finally, any free program is threatened constantly by software 51 | patents. We wish to avoid the danger that redistributors of a free 52 | program will individually obtain patent licenses, in effect making the 53 | program proprietary. To prevent this, we have made it clear that any 54 | patent must be licensed for everyone's free use or not licensed at all. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | GNU GENERAL PUBLIC LICENSE 60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 61 | 62 | 0. This License applies to any program or other work which contains 63 | a notice placed by the copyright holder saying it may be distributed 64 | under the terms of this General Public License. The "Program", below, 65 | refers to any such program or work, and a "work based on the Program" 66 | means either the Program or any derivative work under copyright law: 67 | that is to say, a work containing the Program or a portion of it, 68 | either verbatim or with modifications and/or translated into another 69 | language. (Hereinafter, translation is included without limitation in 70 | the term "modification".) Each licensee is addressed as "you". 71 | 72 | Activities other than copying, distribution and modification are not 73 | covered by this License; they are outside its scope. The act of 74 | running the Program is not restricted, and the output from the Program 75 | is covered only if its contents constitute a work based on the 76 | Program (independent of having been made by running the Program). 77 | Whether that is true depends on what the Program does. 78 | 79 | 1. You may copy and distribute verbatim copies of the Program's 80 | source code as you receive it, in any medium, provided that you 81 | conspicuously and appropriately publish on each copy an appropriate 82 | copyright notice and disclaimer of warranty; keep intact all the 83 | notices that refer to this License and to the absence of any warranty; 84 | and give any other recipients of the Program a copy of this License 85 | along with the Program. 86 | 87 | You may charge a fee for the physical act of transferring a copy, and 88 | you may at your option offer warranty protection in exchange for a fee. 89 | 90 | 2. You may modify your copy or copies of the Program or any portion 91 | of it, thus forming a work based on the Program, and copy and 92 | distribute such modifications or work under the terms of Section 1 93 | above, provided that you also meet all of these conditions: 94 | 95 | a) You must cause the modified files to carry prominent notices 96 | stating that you changed the files and the date of any change. 97 | 98 | b) You must cause any work that you distribute or publish, that in 99 | whole or in part contains or is derived from the Program or any 100 | part thereof, to be licensed as a whole at no charge to all third 101 | parties under the terms of this License. 102 | 103 | c) If the modified program normally reads commands interactively 104 | when run, you must cause it, when started running for such 105 | interactive use in the most ordinary way, to print or display an 106 | announcement including an appropriate copyright notice and a 107 | notice that there is no warranty (or else, saying that you provide 108 | a warranty) and that users may redistribute the program under 109 | these conditions, and telling the user how to view a copy of this 110 | License. (Exception: if the Program itself is interactive but 111 | does not normally print such an announcement, your work based on 112 | the Program is not required to print an announcement.) 113 | 114 | These requirements apply to the modified work as a whole. If 115 | identifiable sections of that work are not derived from the Program, 116 | and can be reasonably considered independent and separate works in 117 | themselves, then this License, and its terms, do not apply to those 118 | sections when you distribute them as separate works. But when you 119 | distribute the same sections as part of a whole which is a work based 120 | on the Program, the distribution of the whole must be on the terms of 121 | this License, whose permissions for other licensees extend to the 122 | entire whole, and thus to each and every part regardless of who wrote it. 123 | 124 | Thus, it is not the intent of this section to claim rights or contest 125 | your rights to work written entirely by you; rather, the intent is to 126 | exercise the right to control the distribution of derivative or 127 | collective works based on the Program. 128 | 129 | In addition, mere aggregation of another work not based on the Program 130 | with the Program (or with a work based on the Program) on a volume of 131 | a storage or distribution medium does not bring the other work under 132 | the scope of this License. 133 | 134 | 3. You may copy and distribute the Program (or a work based on it, 135 | under Section 2) in object code or executable form under the terms of 136 | Sections 1 and 2 above provided that you also do one of the following: 137 | 138 | a) Accompany it with the complete corresponding machine-readable 139 | source code, which must be distributed under the terms of Sections 140 | 1 and 2 above on a medium customarily used for software interchange; or, 141 | 142 | b) Accompany it with a written offer, valid for at least three 143 | years, to give any third party, for a charge no more than your 144 | cost of physically performing source distribution, a complete 145 | machine-readable copy of the corresponding source code, to be 146 | distributed under the terms of Sections 1 and 2 above on a medium 147 | customarily used for software interchange; or, 148 | 149 | c) Accompany it with the information you received as to the offer 150 | to distribute corresponding source code. (This alternative is 151 | allowed only for noncommercial distribution and only if you 152 | received the program in object code or executable form with such 153 | an offer, in accord with Subsection b above.) 154 | 155 | The source code for a work means the preferred form of the work for 156 | making modifications to it. For an executable work, complete source 157 | code means all the source code for all modules it contains, plus any 158 | associated interface definition files, plus the scripts used to 159 | control compilation and installation of the executable. However, as a 160 | special exception, the source code distributed need not include 161 | anything that is normally distributed (in either source or binary 162 | form) with the major components (compiler, kernel, and so on) of the 163 | operating system on which the executable runs, unless that component 164 | itself accompanies the executable. 165 | 166 | If distribution of executable or object code is made by offering 167 | access to copy from a designated place, then offering equivalent 168 | access to copy the source code from the same place counts as 169 | distribution of the source code, even though third parties are not 170 | compelled to copy the source along with the object code. 171 | 172 | 4. You may not copy, modify, sublicense, or distribute the Program 173 | except as expressly provided under this License. Any attempt 174 | otherwise to copy, modify, sublicense or distribute the Program is 175 | void, and will automatically terminate your rights under this License. 176 | However, parties who have received copies, or rights, from you under 177 | this License will not have their licenses terminated so long as such 178 | parties remain in full compliance. 179 | 180 | 5. You are not required to accept this License, since you have not 181 | signed it. However, nothing else grants you permission to modify or 182 | distribute the Program or its derivative works. These actions are 183 | prohibited by law if you do not accept this License. Therefore, by 184 | modifying or distributing the Program (or any work based on the 185 | Program), you indicate your acceptance of this License to do so, and 186 | all its terms and conditions for copying, distributing or modifying 187 | the Program or works based on it. 188 | 189 | 6. Each time you redistribute the Program (or any work based on the 190 | Program), the recipient automatically receives a license from the 191 | original licensor to copy, distribute or modify the Program subject to 192 | these terms and conditions. You may not impose any further 193 | restrictions on the recipients' exercise of the rights granted herein. 194 | You are not responsible for enforcing compliance by third parties to 195 | this License. 196 | 197 | 7. If, as a consequence of a court judgment or allegation of patent 198 | infringement or for any other reason (not limited to patent issues), 199 | conditions are imposed on you (whether by court order, agreement or 200 | otherwise) that contradict the conditions of this License, they do not 201 | excuse you from the conditions of this License. If you cannot 202 | distribute so as to satisfy simultaneously your obligations under this 203 | License and any other pertinent obligations, then as a consequence you 204 | may not distribute the Program at all. For example, if a patent 205 | license would not permit royalty-free redistribution of the Program by 206 | all those who receive copies directly or indirectly through you, then 207 | the only way you could satisfy both it and this License would be to 208 | refrain entirely from distribution of the Program. 209 | 210 | If any portion of this section is held invalid or unenforceable under 211 | any particular circumstance, the balance of the section is intended to 212 | apply and the section as a whole is intended to apply in other 213 | circumstances. 214 | 215 | It is not the purpose of this section to induce you to infringe any 216 | patents or other property right claims or to contest validity of any 217 | such claims; this section has the sole purpose of protecting the 218 | integrity of the free software distribution system, which is 219 | implemented by public license practices. Many people have made 220 | generous contributions to the wide range of software distributed 221 | through that system in reliance on consistent application of that 222 | system; it is up to the author/donor to decide if he or she is willing 223 | to distribute software through any other system and a licensee cannot 224 | impose that choice. 225 | 226 | This section is intended to make thoroughly clear what is believed to 227 | be a consequence of the rest of this License. 228 | 229 | 8. If the distribution and/or use of the Program is restricted in 230 | certain countries either by patents or by copyrighted interfaces, the 231 | original copyright holder who places the Program under this License 232 | may add an explicit geographical distribution limitation excluding 233 | those countries, so that distribution is permitted only in or among 234 | countries not thus excluded. In such case, this License incorporates 235 | the limitation as if written in the body of this License. 236 | 237 | 9. The Free Software Foundation may publish revised and/or new versions 238 | of the General Public License from time to time. Such new versions will 239 | be similar in spirit to the present version, but may differ in detail to 240 | address new problems or concerns. 241 | 242 | Each version is given a distinguishing version number. If the Program 243 | specifies a version number of this License which applies to it and "any 244 | later version", you have the option of following the terms and conditions 245 | either of that version or of any later version published by the Free 246 | Software Foundation. If the Program does not specify a version number of 247 | this License, you may choose any version ever published by the Free Software 248 | Foundation. 249 | 250 | 10. If you wish to incorporate parts of the Program into other free 251 | programs whose distribution conditions are different, write to the author 252 | to ask for permission. For software which is copyrighted by the Free 253 | Software Foundation, write to the Free Software Foundation; we sometimes 254 | make exceptions for this. Our decision will be guided by the two goals 255 | of preserving the free status of all derivatives of our free software and 256 | of promoting the sharing and reuse of software generally. 257 | 258 | NO WARRANTY 259 | 260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN 262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED 264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS 266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE 267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, 268 | REPAIR OR CORRECTION. 269 | 270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR 272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING 274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED 275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY 276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER 277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE 278 | POSSIBILITY OF SUCH DAMAGES. 279 | 280 | END OF TERMS AND CONDITIONS 281 | 282 | How to Apply These Terms to Your New Programs 283 | 284 | If you develop a new program, and you want it to be of the greatest 285 | possible use to the public, the best way to achieve this is to make it 286 | free software which everyone can redistribute and change under these terms. 287 | 288 | To do so, attach the following notices to the program. It is safest 289 | to attach them to the start of each source file to most effectively 290 | convey the exclusion of warranty; and each file should have at least 291 | the "copyright" line and a pointer to where the full notice is found. 292 | 293 | 294 | Copyright (C) 295 | 296 | This program is free software; you can redistribute it and/or modify 297 | it under the terms of the GNU General Public License as published by 298 | the Free Software Foundation; either version 2 of the License, or 299 | (at your option) any later version. 300 | 301 | This program is distributed in the hope that it will be useful, 302 | but WITHOUT ANY WARRANTY; without even the implied warranty of 303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 304 | GNU General Public License for more details. 305 | 306 | You should have received a copy of the GNU General Public License along 307 | with this program; if not, write to the Free Software Foundation, Inc., 308 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 309 | 310 | Also add information on how to contact you by electronic and paper mail. 311 | 312 | If the program is interactive, make it output a short notice like this 313 | when it starts in an interactive mode: 314 | 315 | Gnomovision version 69, Copyright (C) year name of author 316 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 317 | This is free software, and you are welcome to redistribute it 318 | under certain conditions; type `show c' for details. 319 | 320 | The hypothetical commands `show w' and `show c' should show the appropriate 321 | parts of the General Public License. Of course, the commands you use may 322 | be called something other than `show w' and `show c'; they could even be 323 | mouse-clicks or menu items--whatever suits your program. 324 | 325 | You should also get your employer (if you work as a programmer) or your 326 | school, if any, to sign a "copyright disclaimer" for the program, if 327 | necessary. Here is a sample; alter the names: 328 | 329 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program 330 | `Gnomovision' (which makes passes at compilers) written by James Hacker. 331 | 332 | , 1 April 1989 333 | Ty Coon, President of Vice 334 | 335 | This General Public License does not permit incorporating your program into 336 | proprietary programs. If your program is a subroutine library, you may 337 | consider it more useful to permit linking proprietary applications with the 338 | library. If this is what you want to do, use the GNU Lesser General 339 | Public License instead of this License. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Bugsnag Notifier for WordPress 2 | ============================== 3 | 4 | The Bugsnag Notifier for WordPress gives you instant notification of errors 5 | in your WordPress sites. 6 | 7 | [Bugsnag](https://www.bugsnag.com/) captures errors in real-time from your web, 8 | mobile and desktop applications, helping you to understand and resolve them 9 | as fast as possible. Create a free account to start 10 | capturing errors from your applications. Learn more about [error monitoring and error reporting](https://www.bugsnag.com/) with Bugsnag. 11 | 12 | The Bugsnag Notifier for WordPress supports WordPress 2.0+, PHP 5.2+ and 13 | requires the cURL extension to be available in PHP. 14 | 15 | You can always read about the plugin or download it from the 16 | [WordPress Plugin Directory](http://wordpress.org/plugins/bugsnag/). 17 | 18 | 19 | How to Install 20 | -------------- 21 | 22 | 1. Download the latest [bugsnag.zip](https://github.com/bugsnag/bugsnag-wordpress/releases/latest). 23 | 24 | 2. Unzip `bugsnag.zip`. 25 | 26 | 3. Upload the `bugsnag` folder using ftp or scp to the `wp-content/plugins` 27 | folder of your WordPress site. 28 | 29 | 4. Click *Activate* on the *Bugsnag* plugin inside the *Plugins* section of 30 | your WordPress admin dashboard. 31 | 32 | 5. Click *Configure* and enter your Bugsnag API Key from your 33 | [Bugsnag Dashboard](https://bugsnag.com). 34 | 35 | 36 | Building from Source 37 | -------------------- 38 | 39 | If you would like to build a new zip file of the plugin from source, you can 40 | run our build script using [Thor](http://whatisthor.com/). You'll need both 41 | `ruby` and the `thor` gem installed (`gem install thor`). Then you can 42 | generate a new zip by running: 43 | 44 | ```shell 45 | thor wordpress:zip bugsnag-wordpress.zip 46 | ``` 47 | 48 | 49 | Reporting Bugs or Feature Requests 50 | ---------------------------------- 51 | 52 | Please report any bugs or feature requests on the github issues page for this 53 | project here: 54 | 55 | 56 | 57 | 58 | Contributing 59 | ------------ 60 | 61 | - [Fork](https://help.github.com/articles/fork-a-repo) the [notifier on github](https://github.com/bugsnag/bugsnag-wordpress) 62 | - Commit and push until you are happy with your contribution 63 | - [Make a pull request](https://help.github.com/articles/using-pull-requests) 64 | - Thanks! 65 | 66 | 67 | License 68 | ------- 69 | 70 | The Bugsnag WordPress notifier is free software released under the WordPress-friendly GPLv2 License. 71 | See [LICENSE.txt](https://github.com/bugsnag/bugsnag-wordpress/blob/master/LICENSE.txt) for details. 72 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | # Security Policy 2 | 3 | ## Supported Versions 4 | 5 | | Version | Supported | 6 | | ------- | --------------------- | 7 | | 1.x | Critical patches only | 8 | 9 | ## Reporting a Vulnerability 10 | 11 | If you find a vulnerability in this SDK, please report it to our [Support Team](mailto:support@bugsnag.com) for review. -------------------------------------------------------------------------------- /Thorfile: -------------------------------------------------------------------------------- 1 | require "fileutils" 2 | 3 | class Wordpress < Thor 4 | PLUGIN_NAME = "bugsnag" 5 | PLUGIN_FILES = %W{bugsnag.php readme.txt views LICENSE.txt} 6 | BUILD_FILES = %W{build vendor composer.lock svn} 7 | VENDORED_BUGSNAG_PHP = "vendor/bugsnag/bugsnag/src/Bugsnag" 8 | VERSION_REGEX = /^\d+\.\d+\.\d+$/ 9 | 10 | desc "build", "create a clean build of the plugin" 11 | def build(build_dir="build") 12 | bugsnag_php_dir = File.join(build_dir, 'bugsnag-php') 13 | 14 | # Prepare the build directory 15 | FileUtils.mkdir_p bugsnag_php_dir 16 | 17 | # Install dependencies 18 | puts "- Installing dependencies" 19 | `composer install` 20 | 21 | # Copy plugin files to the build directory 22 | puts "- Copying plugin files" 23 | FileUtils.cp_r PLUGIN_FILES, build_dir 24 | 25 | # Copy vendored bugsnag to the build directory 26 | puts "- Copying vendored bugsnag-php" 27 | `cp -r #{VENDORED_BUGSNAG_PHP}/* #{bugsnag_php_dir}` 28 | end 29 | 30 | desc "update_version ", "update the plugin to the given version" 31 | def update_version(version) 32 | return $stderr.puts "Invalid version number #{version}" unless version =~ VERSION_REGEX 33 | 34 | replace_in_file("readme.txt", /Stable tag: \d\.\d\.\d/, "Stable tag: #{version}") 35 | replace_in_file("bugsnag.php", /Version: \d\.\d\.\d/, "Version: #{version}") 36 | replace_in_file("bugsnag.php", /'version' => '\d\.\d\.\d'/, "'version' => '#{version}'") 37 | end 38 | 39 | desc "release_svn ", "perform a release to svn" 40 | def release_svn(version, username) 41 | # Checkout a fresh copy of the svn repo 42 | checkout_svn(username) 43 | 44 | # Build a release copy into svn/trunk 45 | build "svn/trunk" 46 | 47 | # Move into the svn repo 48 | Dir.chdir "svn" do 49 | # Commit changes to svn 50 | `svn add trunk/*` 51 | `svn ci -m "Release version #{version}" --username #{username}` 52 | 53 | # Tag in svn 54 | `svn cp trunk tags/#{version}` 55 | `svn ci -m "Tagging version #{version}" --username #{username}` 56 | end 57 | 58 | # Remove temporary files 59 | FileUtils.rm_rf "svn" 60 | end 61 | 62 | desc "release_git ", "perform a release to git" 63 | def release_git(version) 64 | # Commit version changes 65 | `git add readme.txt bugsnag.php` 66 | `git commit -m "Release version #{version}"` 67 | 68 | # Tag release 69 | `git tag v#{version}` 70 | 71 | # Push to git 72 | `git push origin master && git push --tags` 73 | end 74 | 75 | desc "release ", "perform a release to git and svn" 76 | def release(version, wordpress_username) 77 | # Update version number 78 | update_version(version) 79 | 80 | # Release and tag in git 81 | release_git(version) 82 | 83 | # Release a new version via svn to wordpress.org/plugins 84 | release_svn(version, wordpress_username) 85 | end 86 | 87 | desc "zip ", "create a zip of the plugin" 88 | def zip(zip_name="bugsnag-wordpress.zip", build_dir="build") 89 | # Build a clean plugin 90 | build File.join(build_dir, PLUGIN_NAME) 91 | 92 | # Zip up the build 93 | puts "- Generating #{zip_name}" 94 | Dir.chdir build_dir do 95 | `zip -r #{zip_name} #{PLUGIN_NAME}` 96 | FileUtils.cp zip_name, "../" 97 | end 98 | 99 | # Remove temporary files 100 | FileUtils.rm_rf build_dir 101 | end 102 | 103 | desc "clean", "clean up any build files" 104 | def clean() 105 | FileUtils.rm_rf BUILD_FILES 106 | end 107 | 108 | desc "checkout_svn ", "checkout a copy of the svn repo" 109 | def checkout_svn(username) 110 | `svn co http://plugins.svn.wordpress.org/bugsnag svn --username #{username}` 111 | end 112 | 113 | private 114 | def replace_in_file(filename, find, replace) 115 | str = File.read(filename) 116 | File.open(filename, 'w') {|f| f.write(str.gsub(find, replace)) } 117 | end 118 | end 119 | -------------------------------------------------------------------------------- /bugsnag.php: -------------------------------------------------------------------------------- 1 | 'Bugsnag Wordpress (Official)', 20 | 'version' => '1.6.3', 21 | 'url' => 'https://github.com/bugsnag/bugsnag-wordpress', 22 | ); 23 | 24 | private $client; 25 | private $apiKey; 26 | private $notifySeverities; 27 | private $filterFields; 28 | private $pluginBase; 29 | 30 | public function __construct() 31 | { 32 | // Activate bugsnag error monitoring as soon as possible 33 | $this->activateBugsnag(); 34 | 35 | $this->pluginBase = 'bugsnag/bugsnag.php'; 36 | 37 | // Run init actions (loading wp user) 38 | add_action('init', array($this, 'initActions')); 39 | 40 | // Load admin actions (admin links and pages) 41 | add_action('admin_menu', array($this, 'adminMenuActions')); 42 | 43 | // Load network admin menu if using multisite 44 | add_action('network_admin_menu', array($this, 'networkAdminMenuActions')); 45 | 46 | add_action('wp_ajax_test_bugsnag', array($this, 'testBugsnag')); 47 | } 48 | 49 | private function activateBugsnag() 50 | { 51 | $is_load_success = $this->requireBugsnagPhp(); 52 | if (!$is_load_success) { 53 | error_log("Bugsnag Error: Couldn't activate Bugsnag Error Monitoring due to missing Bugsnag library!"); 54 | 55 | return; 56 | } 57 | 58 | // Load bugsnag settings 59 | if (!get_site_option('bugsnag_network')) { 60 | // Regular 61 | $this->apiKey = get_option('bugsnag_api_key'); 62 | $this->notifySeverities = get_option('bugsnag_notify_severities'); 63 | $this->filterFields = get_option('bugsnag_filterfields'); 64 | } else { 65 | // Multisite 66 | $this->apiKey = get_site_option('bugsnag_api_key'); 67 | $this->notifySeverities = get_site_option('bugsnag_notify_severities'); 68 | $this->filterFields = get_site_option('bugsnag_filterfields'); 69 | } 70 | 71 | $this->constructBugsnag(); 72 | } 73 | 74 | private function constructBugsnag() 75 | { 76 | // Activate the bugsnag client 77 | if (!empty($this->apiKey)) { 78 | $this->client = new Bugsnag_Client($this->apiKey); 79 | 80 | $this->client->setReleaseStage($this->releaseStage()) 81 | ->setErrorReportingLevel($this->errorReportingLevel()) 82 | ->setFilters($this->filterFields()); 83 | 84 | $this->client->mergeDeviceData(['runtimeVersions' => ['wordpress' => get_bloginfo('version')]]); 85 | 86 | $this->client->setNotifier(self::$NOTIFIER); 87 | 88 | // If handlers are not set, errors are still going to be reported 89 | // to bugsnag, difference is execution will not stop. 90 | // 91 | // Can be useful to see inline errors and traces with xdebug too. 92 | $set_error_and_exception_handlers = apply_filters( 93 | 'bugsnag_set_error_and_exception_handlers', 94 | defined('BUGSNAG_SET_EXCEPTION_HANDLERS') ? BUGSNAG_SET_EXCEPTION_HANDLERS : true 95 | ); 96 | 97 | if ($set_error_and_exception_handlers === true) { 98 | // Hook up automatic error handling 99 | set_error_handler(array($this->client, 'errorHandler')); 100 | set_exception_handler(array($this->client, 'exceptionHandler')); 101 | } 102 | } 103 | } 104 | 105 | private function requireBugsnagPhp() 106 | { 107 | // Bugsnag-php was already loaded by some 3rd-party code, don't need to load it again. 108 | if (class_exists('Bugsnag_Client')) { 109 | return true; 110 | } 111 | 112 | // Try loading bugsnag-php with composer autoloader. 113 | $composer_autoloader_path = $this->relativePath(self::$COMPOSER_AUTOLOADER); 114 | $composer_autoloader_path_filtered = apply_filters('bugsnag_composer_autoloader_path', $composer_autoloader_path); 115 | if (file_exists($composer_autoloader_path_filtered)) { 116 | require_once $composer_autoloader_path_filtered; 117 | 118 | return true; 119 | } 120 | 121 | // Try loading bugsnag-php from packaged autoloader. 122 | $packaged_autoloader_path = $this->relativePath(self::$PACKAGED_AUTOLOADER); 123 | $packaged_autoloader_path_filtered = apply_filters('bugsnag_packaged_autoloader_path', $packaged_autoloader_path); 124 | if (file_exists($packaged_autoloader_path_filtered)) { 125 | require_once $packaged_autoloader_path_filtered; 126 | 127 | return true; 128 | } 129 | 130 | return false; 131 | } 132 | 133 | private function relativePath($path) 134 | { 135 | return dirname(__FILE__).'/'.$path; 136 | } 137 | 138 | private function errorReportingLevel() 139 | { 140 | $notifySeverities = empty($this->notifySeverities) ? self::$DEFAULT_NOTIFY_SEVERITIES : $this->notifySeverities; 141 | $level = 0; 142 | 143 | $severities = explode(',', $notifySeverities); 144 | foreach ($severities as $severity) { 145 | $level |= Bugsnag_ErrorTypes::getLevelsForSeverity($severity); 146 | } 147 | 148 | return $level; 149 | } 150 | 151 | private function filterFields() 152 | { 153 | $filter_fields = apply_filters('bugsnag_filter_fields', $this->filterFields); 154 | 155 | // Array with empty string will break things. 156 | if ($filter_fields === '') { 157 | return array(); 158 | } 159 | 160 | return array_map('trim', explode("\n", $filter_fields)); 161 | } 162 | 163 | /** 164 | * Set Release Stage. 165 | * 166 | * @return $release_stage_filtered Release Stage Filtered. 167 | */ 168 | private function releaseStage() 169 | { 170 | if (function_exists('wp_get_environment_type')) { 171 | $release_stage = wp_get_environment_type(); // Defaults to production when not set. 172 | } else { 173 | $release_stage = defined('WP_ENV') ? WP_ENV : 'production'; 174 | } 175 | $release_stage_filtered = apply_filters('bugsnag_release_stage', $release_stage); 176 | 177 | return $release_stage_filtered; 178 | } 179 | 180 | // Action hooks 181 | public function initActions() 182 | { 183 | // This should be handled on stage of initializing, 184 | // not even adding action if init failed. 185 | // 186 | // Leaving it here for now. 187 | if (empty($this->client)) { 188 | return; 189 | } 190 | 191 | // Set the bugsnag user using the current WordPress user if available, 192 | // set as anonymous otherwise. 193 | $user = array(); 194 | if (is_user_logged_in()) { 195 | $wp_user = wp_get_current_user(); 196 | 197 | // Removed checks for !empty($wp_user->display_name), it should not be required. 198 | $user['id'] = $wp_user->user_login; 199 | $user['email'] = $wp_user->user_email; 200 | $user['name'] = $wp_user->display_name; 201 | } else { 202 | $use_unsafe_spoofable_ip_address_getter = apply_filters('bugsnag_use_unsafe_spoofable_ip_address_getter', true); 203 | $user['id'] = $use_unsafe_spoofable_ip_address_getter ? 204 | $this->getClientIpAddressUnsafe() : 205 | $this->getClientIpAddress(); 206 | $user['name'] = 'anonymous'; 207 | } 208 | 209 | $this->client->setUser($user); 210 | } 211 | 212 | // Unsafe: client can spoof address. 213 | // http://stackoverflow.com/questions/1634782/what-is-the-most-accurate-way-to-retrieve-a-users-correct-ip-address-in-php 214 | private function getClientIpAddressUnsafe() 215 | { 216 | foreach (array('HTTP_CLIENT_IP', 'HTTP_X_FORWARDED_FOR', 'HTTP_X_FORWARDED', 'HTTP_X_CLUSTER_CLIENT_IP', 'HTTP_FORWARDED_FOR', 'HTTP_FORWARDED', 'REMOTE_ADDR') as $key) { 217 | if (array_key_exists($key, $_SERVER) === true) { 218 | foreach (explode(',', $_SERVER[$key]) as $ip) { 219 | $ip = trim($ip); 220 | if (filter_var($ip, FILTER_VALIDATE_IP) !== false) { 221 | return $ip; 222 | } 223 | } 224 | } 225 | } 226 | } 227 | 228 | // Can not be spoofed, but can show ip of NAT or proxies. 229 | private function getClientIpAddress() 230 | { 231 | return $_SERVER['REMOTE_ADDR']; 232 | } 233 | 234 | public function adminMenuActions() 235 | { 236 | if (!function_exists('is_plugin_active_for_network') || !is_plugin_active_for_network($this->pluginBase)) { 237 | // Add the "settings" link to the Bugsnag row of plugins.php 238 | add_filter('plugin_action_links', array($this, 'pluginActionLinksFilter'), 10, 2); 239 | 240 | // Create the settings page 241 | add_options_page('Bugsnag Settings', 'Bugsnag', 'manage_options', 'bugsnag', array($this, 'renderSettings')); 242 | } 243 | } 244 | 245 | public function networkAdminMenuActions() 246 | { 247 | if (function_exists('is_plugin_active_for_network') && is_plugin_active_for_network($this->pluginBase)) { 248 | // Create the network settings page 249 | add_submenu_page('settings.php', 'Bugsnag Settings', 'Bugsnag', 'manage_network_options', 'bugsnag', array($this, 'renderSettings')); 250 | } 251 | } 252 | 253 | private function updateNetworkSettings($settings) 254 | { 255 | // Update options 256 | update_site_option('bugsnag_api_key', isset($_POST['bugsnag_api_key']) ? $_POST['bugsnag_api_key'] : ''); 257 | update_site_option('bugsnag_notify_severities', isset($_POST['bugsnag_notify_severities']) ? $_POST['bugsnag_notify_severities'] : ''); 258 | update_site_option('bugsnag_filterfields', isset($_POST['bugsnag_filterfields']) ? $_POST['bugsnag_filterfields'] : ''); 259 | update_site_option('bugsnag_network', true); 260 | 261 | // Update variables 262 | $this->apiKey = get_site_option('bugsnag_api_key'); 263 | $this->notifySeverities = get_site_option('bugsnag_notify_severities'); 264 | $this->filterFields = get_site_option('bugsnag_filterfields'); 265 | 266 | echo '

Settings saved.

'; 267 | } 268 | 269 | // Filter hooks 270 | public function pluginActionLinksFilter($links, $file) 271 | { 272 | // Add the "settings" link to the Bugsnag plugin row 273 | if (basename($file) == basename(__FILE__)) { 274 | $settings_link = 'Settings'; 275 | array_push($links, $settings_link); 276 | } 277 | 278 | return $links; 279 | } 280 | 281 | public function testBugsnag() 282 | { 283 | $this->apiKey = $_POST['bugsnag_api_key']; 284 | $this->notifySeverities = $_POST['bugsnag_notify_severities']; 285 | $this->filterFields = $_POST['bugsnag_filterfields']; 286 | 287 | $this->constructBugsnag(); 288 | $this->client->notifyError( 289 | 'BugsnagTest', 290 | 'Testing bugsnag', 291 | array( 292 | 'notifier' => self::$NOTIFIER, 293 | 'docs' => array('url' => 'https://docs.bugsnag.com/platforms/php/wordpress/'), 294 | ) 295 | ); 296 | 297 | die(); 298 | } 299 | 300 | // Renderers 301 | public function renderSettings() 302 | { 303 | if (!empty($_POST['action']) && $_POST['action'] == 'update') { 304 | $this->updateNetworkSettings($_POST); 305 | } 306 | 307 | include $this->relativePath('views/settings.php'); 308 | } 309 | 310 | private function renderOption($name, $value, $current) 311 | { 312 | $selected = ($value == $current) ? ' selected="selected"' : ''; 313 | echo ""; 314 | } 315 | 316 | /** 317 | * Fluent interface to $this->client, simply call the methods on this object and this will proxy them through. 318 | * 319 | * @param string $method 320 | * @param array $arguments 321 | * 322 | * @return mixed 323 | */ 324 | public function __call($method, $arguments) 325 | { 326 | // If we don't have an API key here then the plugin has not been setup, but 327 | // methods are already being called. We can't forward these calls through 328 | // because the client needs an API key on construction and we need to fail 329 | // loudly so the user knows their site isn't setup correctly. 330 | if (empty($this->apiKey)) { 331 | throw new BadMethodCallException( 332 | 'No Bugsnag API Key set. Please enter your API Key on the Bugsnag Settings page.' 333 | ); 334 | } 335 | 336 | if (method_exists($this->client, $method)) { 337 | return call_user_func_array(array($this->client, $method), $arguments); 338 | } 339 | 340 | throw new BadMethodCallException(sprintf('Method %s does not exist on %s or Bugsnag_Client', $method, __CLASS__)); 341 | } 342 | } 343 | 344 | /** 345 | * Add ability to define Bugsnag API Key as constant in wp-config.php. 346 | * 347 | * @return either the API from wp-config or false (to use the option value) 348 | */ 349 | function bugsnag_define_api_key() 350 | { 351 | return defined('BUGSNAG_API_KEY') ? BUGSNAG_API_KEY : false; 352 | } 353 | add_filter('pre_option_bugsnag_api_key', 'bugsnag_define_api_key'); 354 | add_filter('pre_site_option_bugsnag_api_key', 'bugsnag_define_api_key'); 355 | 356 | global $bugsnagWordpress; 357 | $bugsnagWordpress = new Bugsnag_Wordpress(); 358 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "bugsnag/bugsnag-wordpress", 3 | "type": "wordpress-plugin", 4 | "require": { 5 | "bugsnag/bugsnag": "^2.10.2", 6 | "composer/installers": "^1.0" 7 | }, 8 | "license": "MIT", 9 | "authors": [ 10 | { 11 | "name": "James Smith", 12 | "email": "james@loopj.com" 13 | } 14 | ], 15 | "config": { 16 | "allow-plugins": { 17 | "composer/installers": true 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /example/.gitignore: -------------------------------------------------------------------------------- 1 | app/ 2 | .env 3 | -------------------------------------------------------------------------------- /example/README.md: -------------------------------------------------------------------------------- 1 | # Bugsnag WordPress demo 2 | 3 | This docker application provides a worked example of how to install Bugsnag into a wordpress installation. 4 | 5 | Try this out with [your own Bugsnag account](https://app.bugsnag.com/user/new)! 6 | 7 | ## Starting the WordPress app 8 | 9 | Create a `.env` file in the root of this directory. This file should specify two passwords: 10 | ``` 11 | MYSQL_PASSWORD="your-password-here" 12 | MYSQL_ROOT_PASSWORD="your-root-password-here" 13 | ``` 14 | 15 | These are used to setup the WordPress database on the MYSQL server. 16 | 17 | Start the docker application using: 18 | ``` 19 | docker-compose up -d 20 | ``` 21 | 22 | Once the application is running navigate to `http://localhost:8080` and follow the on-screen instructions to finalize the settings of your local wordpress application. 23 | 24 | ## Installing Bugsnag 25 | 26 | First Bugsnag needs to be added to your WordPress app. This can be accomplished in one of two ways: 27 | 28 | ### Using the plugin installer 29 | 30 | - Inside the admin dashboard of your WordPress app, navigate to the `Plugins` section. 31 | - From there, select the `Add New` button next to the `Plugins` title. 32 | - Search for `Bugsnag` in the `Search plugins...` search field in the top right. 33 | - Select `Install Now` on the plugin titled `WordPress Error Monitoring by Bugsnag` By `Bugsnag Inc.` 34 | 35 | ### Manual install 36 | 37 | - Visit the [WordPress plugin index](https://wordpress.org/plugins/bugsnag/) and search for `Bugsnag`. 38 | - Download the Bugsnag ZIP file and unzip it. 39 | - Move the `bugsnag` folder from the unzipped file to the `app/wp-content/plugins` folder. 40 | 41 | ## Activating and testing Bugsnag 42 | 43 | On your WordPress admin dashboard visit the `Plugins` section. In the list of plugins, find `Bugsnag Error Monitoring` and press `activate`. 44 | Once activated, press `settings` and enter your Bugsnag API key in the resulting screen. 45 | 46 | You can test your installation by sending an example notification from your WordPress app to Bugsnag using the `Test Bugsnag` button on the settings page. 47 | 48 | 49 | For more information, see our documentation: 50 | https://docs.bugsnag.com/platforms/php/wordpress/ 51 | 52 | ### Notes on docker-volumes 53 | The docker-compose file in this example exposes the `/var/www/html/` folder of the WordPress app within the `app` folder in this directory. This allows you to easily modify various aspects of your WordPress installation and see the result instantly on your local machine. 54 | -------------------------------------------------------------------------------- /example/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '3.4' 2 | services: 3 | db: 4 | image: mysql:8.0 5 | environment: 6 | - MYSQL_DATABASE=wordpress 7 | - MYSQL_USER=wp_admin 8 | - MYSQL_PASSWORD 9 | - MYSQL_ROOT_PASSWORD 10 | restart: "no" 11 | app: 12 | image: wordpress 13 | environment: 14 | - WORDPRESS_DB_USER=wp_admin 15 | - WORDPRESS_DB_PASSWORD=$MYSQL_PASSWORD 16 | links: 17 | - db:mysql 18 | ports: 19 | - 8080:80 20 | volumes: 21 | - ./app/:/var/www/html 22 | -------------------------------------------------------------------------------- /readme.txt: -------------------------------------------------------------------------------- 1 | === WordPress Error Monitoring by Bugsnag === 2 | Contributors: loopj 3 | Tags: bugsnag, error, monitoring, exception, logging 4 | Requires at least: 2.0 5 | Tested up to: 6.3 6 | Stable tag: 1.6.3 7 | License: GPLv2 or later 8 | 9 | Bugsnag is a WordPress plugin that automatically detects errors & crashes on your WordPress site, and notifies you by email, chat or issues system 10 | 11 | 12 | == Description == 13 | 14 | Bugsnag is a WordPress plugin that automatically detects errors & crashes on your WordPress site, and notifies you by email, chat or ticket system. 15 | 16 | All websites crash from time to time, including WordPress sites! The *WordPress Error Monitoring* plugin by Bugsnag automatically detects crashes, exceptions and other errors in your WordPress PHP code as well as any errors in plugins you are using. 17 | 18 | Errors are sent to your [Bugsnag Dashboard](https://bugsnag.com) for you to view and debug, and we'll also notify you by email, chat, sms or create a ticket in your issue tracking system if you use one. We'll also show you exactly how many times each error occurred, and how many users were impacted by each crash. 19 | 20 | 21 | == Installation == 22 | 23 | Bugsnag is available through the [WordPress Plugins Directory](http://wordpress.org/plugins/), so you can download and install automatically from the Plugins menu on your WordPress admin page. 24 | 25 | To manually install Bugsnag: 26 | 27 | 1. Unzip `bugsnag-wordpress.zip` 28 | 1. Upload the `bugsnag` directory from the zip file to the `/wp-content/plugins/` directory 29 | 1. Activate the plugin through the 'Plugins' menu in WordPress 30 | 1. Click the 'configure' link next to the Bugsnag plugin, and follow the instructions 31 | 32 | 33 | == Screenshots == 34 | 35 | 1. Bugsnag dashboard list of errors 36 | 2. Bugsnag dashboard error details 37 | 38 | 39 | == Changelog == 40 | 41 | = 1.6.3 = 42 | * Fix PHP 8.2 deprecation notice 43 | 44 | = 1.6.2 = 45 | * Fix broken url in notifier configuration & add docs link to test notification. 46 | * Bump "tested up to" WordPress version 47 | 48 | = 1.6.1 = 49 | * Bump "tested up to" WordPress version 50 | 51 | = 1.6.0 = 52 | * Add support for setting the release stage using the new "wp_get_environment_type" function 53 | * Update bugsnag-php to v2.10.1 54 | 55 | = 1.5.0 = 56 | * Clarify the "Test Bugsnag" form action 57 | * Improve error message when methods are called with no api key set 58 | * Add a constant to control setting error handlers 59 | 60 | = 1.4.0 = 61 | * Add WordPress version string to report payloads (device.runtimeVersions) 62 | * Added ability to define API key as constant 63 | * Removed form action to prevent deprecation warnings 64 | * Fixed broken links on settings page bugsnag.com 65 | * Made bugsnagWordpress global to make available for CLI scripts 66 | 67 | = 1.3.1 = 68 | * Remove deprecated screen_icon function from settings page 69 | 70 | = 1.3.0 = 71 | * Fix version constraints 72 | * General fixes for WP 4.5 compatibility 73 | 74 | = 1.2.1 = 75 | * Add support for WordPress Multisite installations. 76 | 77 | = 1.2.0 = 78 | * Update bugsnag-php to allow cURL or fopen. 79 | 80 | = 1.1.2 = 81 | * Allow configuration of filter fields. 82 | * Add a 'Test Bugsnag' button to the settings page. 83 | 84 | = 1.1.1 = 85 | * Identify as wordpress notifier instead of PHP. 86 | * Allow configuration of error reporting levels. 87 | 88 | = 1.0.1 = 89 | * Fix bug where bugsnag-php library wasn't being included in zip file 90 | 91 | = 1.0.0 = 92 | * Initial release 93 | -------------------------------------------------------------------------------- /views/settings.php: -------------------------------------------------------------------------------- 1 |
2 |

Bugsnag Settings

3 | 4 |

5 | Bugsnag automatically detects errors & crashes on your WordPress site, plugins & themes. 6 |

7 | 8 |

9 | Errors are sent to your Bugsnag Dashboard for you to view and debug, and we'll also notify you by email, chat, sms or create a ticket in your issue tracking system if you use one. We'll also show you exactly how many times each error occurred, and how many users were impacted by each crash. 10 |

11 | 12 |
13 | apiKey)) { ?> 14 | 15 |
16 |

Please configure your Bugsnag API Key to enable this plugin

17 | 18 |

19 | Sign up for a Bugsnag Account and create a project with type WordPress,
20 | you'll then be shown your API Key, which you should paste here: 21 |

22 | 23 |
24 | 25 | 26 |
27 | 28 |
29 |
30 | 31 | 32 | 33 | 34 | 35 | 38 | 45 | 46 | 47 | 48 | 51 | 58 | 59 | 60 | 61 | 62 | 65 | 72 | 73 |
36 | 37 | 39 |
40 | 41 |

42 | You can find your API Key on your Bugsnag Dashboard. 43 |

44 |
49 | 50 | 52 | 57 |
63 | 64 | 66 | 67 |

68 | The information to remove from Bugsnag reports, one per line. 69 | Use this if you want to ensure you don't send sensitive data such as passwords, and credit card numbers to our servers. 70 |

71 |
74 | 75 |
76 | 77 |
78 | 79 | 80 | 81 | 82 | 83 | 84 |
85 |
86 | 87 | apiKey)) { ?> 88 |
89 |

Test your connection to Bugsnag

90 | 91 |

Use this button to send a test event that can be viewed in your Bugsnag Dashboard.

92 | 93 |

Note - any configuration options applied in code will not be applied to this test event.

94 | 95 | 98 |
99 | 100 | 101 | 121 | --------------------------------------------------------------------------------