-
-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #708 from lucatume/v4-airplane-mode
Add AirplaneMode module
- Loading branch information
Showing
40 changed files
with
2,264 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#! /usr/bin/env sh | ||
|
||
set -eu | ||
|
||
script_dir=$(dirname "$0") | ||
root_dir=$(cd "$script_dir/.." && pwd) | ||
plugin_file_src="https://downloads.wordpress.org/plugin/airplane-mode.zip"; | ||
# Download the zip file and unzip it in the includes/airplane-mode directory | ||
curl -L "$plugin_file_src" -o "$root_dir/includes/airplane-mode.zip" | ||
unzip -o "$root_dir/includes/airplane-mode.zip" -d "$root_dir/includes/" | ||
# Remove the zip file | ||
rm "$root_dir/includes/airplane-mode.zip" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
#! /usr/bin/env sh | ||
|
||
set -eux | ||
set -eu | ||
|
||
script_dir=$(dirname "$0") | ||
root_dir=$(cd "$script_dir/.." && pwd) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
## AirplaneMode module | ||
|
||
This module allows you to easily put the website under test in "airplane mode", preventing it from making any network requests. | ||
|
||
The module uses <a href="https://github.com/norcross/airplane-mode" target="_blank">the `norcross/airplane-mode` plugin</a> to add or remove it from the website must-use plugins directory when activated. | ||
|
||
This module should be used together with [the `WPWebDriver`][1] or [`WPBrowser`][2] modules. | ||
|
||
## Configuration | ||
|
||
* `muPluginsDir` - **required**; the path to the WordPress must-use plugins directory. | ||
* `symlink` - whether to symlink the plugin or copy it. By default, the plugin is **copied** in the must-use plugins directory and `symlink` is set to `false`. If you're **not** using containers, that will ignore symlinked plugins, you can set `symlink` to `true` to symlink the plugin in the must-use plugins directory. Symbolic linking is faster and uses less disk space than copying the plugin. | ||
|
||
Example configuration to symlink the plugin in the `muPluginsDir` directory before the tests: | ||
|
||
```yaml | ||
modules: | ||
enabled: | ||
lucatume\WPBrowser\Module\AirplaneMode: | ||
muPluginsDir: 'var/wordpress/wp-content/mu-plugins' | ||
symlink: true | ||
``` | ||
Example configuration to copy the plugin in the `muPluginsDir` directory before the tests: | ||
|
||
```yaml | ||
modules: | ||
enabled: | ||
lucatume\WPBrowser\Module\AirplaneMode: | ||
muPluginsDir: 'var/wordpress/wp-content/mu-plugins' | ||
symlink: false | ||
``` | ||
|
||
The module will either symlink or copy the plugin in the `muPluginsDir` directory, depending on the `symlink` configuration parameter before the test suite runs, and will remove it after the test suite has run. | ||
|
||
[1]: ./WPWebDriver.md | ||
[2]: ./WPBrowser.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
#### Version 0.2.5 - 2019/11/15 | ||
* Remove usage of method that's been deprecated in WordPress trunk. props @johnbillion | ||
|
||
#### Version 0.2.4 - 2017/12/13 | ||
* Added localhost bypass for loading CSS and JS files when hot reloading. props @shadyvb | ||
* Added additional hook removals for new automated updates and language packs. | ||
* Removed outdated `create_function` call for PHP 7.2 compatibility. props @geminorum | ||
* General cleanup | ||
|
||
#### Version 0.2.3 - 2017/03/05 | ||
* Adding option to force transient purge | ||
* Adding `clean` action to WP-CLI functions | ||
|
||
#### Version 0.2.2 - 2016/12/07 | ||
* Adding WP-CLI support. props @markjaquith | ||
|
||
#### Version 0.2.1 - 2016/10/19 | ||
* Fix settings page language drowdown when used offline. props @onnimonni | ||
|
||
#### Version 0.2.0 - 2016/08/26 | ||
* modify CSS loading for front-end, removed loading for login page. props @barryceelen | ||
* fixed WP.org theme API call request to avoid `WP_Error` return. props @onnimonni | ||
|
||
#### Version 0.1.9 - 2016/07/25 | ||
* prevent BuddyPress from falling back to Gravatar. props @johnbillion | ||
|
||
#### Version 0.1.8 - 2016/07/12 | ||
* allow `JETPACK_DEV_DEBUG` constant to take priority over filter. props @kopepasah | ||
* added additional CSS for upcoming 4.6. change to upload tab. | ||
|
||
#### Version 0.1.7 - 2016/05/18 | ||
* allow local HTTP calls with optional filter. props @johnbillion | ||
* add back index.php link to main dashboard menu item | ||
* bumped minimum WP version requirement to 4.4 | ||
|
||
#### Version 0.1.6 - 2016/04/25 | ||
* minor tweak to include CSS for new icon font | ||
|
||
#### Version 0.1.5 - 2016/04/24 | ||
* adding custom icon font for display and removing label. props @barryceelen | ||
|
||
#### Version 0.1.4 - 2016/02/26 | ||
* better setup for blocked external assets. props @johnbillion | ||
|
||
#### Version 0.1.3 - 2016/02/22 | ||
* modified CSS rules to fix media bulk actions bar from disappearing | ||
* moved `airplane_mode_status_change` action to run before redirect, and now includes the status being run. | ||
|
||
#### Version 0.1.2 - 2016/01/09 | ||
* added back HTTP count when inactive | ||
* removed HTTP count completely when Query Monitor is active | ||
|
||
#### Version 0.1.1 - 2016/01/06 | ||
* fixed incorrect nonce check that was breaking toggle | ||
* changed CSS and JS checks to include all themes and plugins as well as core | ||
|
||
#### Version 0.1.0 - 2015/12/30 | ||
* added `airplane_mode_purge_transients` filter to bypass transient purge | ||
|
||
#### Version 0.0.9 - 2015/12/07 | ||
* changed from colored circle to actual airplane icon for usability | ||
* fixed dashboard link icon for multisite | ||
* changed to exclude all external stylesheets, not just Open Sans | ||
* added language files for translateable goodness | ||
* general cleanup for WP coding standards | ||
|
||
#### Version 0.0.8 - 2015/05/18 | ||
* added `class_exists` as now included in DesktopServer and collisions could result | ||
* fixed `if ( ! defined ...` for `AIRMDE_BASE` constant | ||
* add `.gitattributes` to remove certain files from updates | ||
|
||
#### Version 0.0.7 - 2015/04/21 | ||
* fixed some CSS from hiding plugins page bar | ||
* moved changelog to it's own file | ||
* added `composer.json` | ||
* added contributors to readme | ||
* clarified license (MIT) | ||
|
||
#### Version 0.0.6 - 2015/04/02 | ||
* version bump for GitHub updater | ||
|
||
#### Version 0.0.5 - 2015/04/02 | ||
* fixed bug in update logic that was preventing checks when disabled (but activated). props @johnbillion | ||
|
||
#### Version 0.0.3 - 2015/01/23 | ||
* added `airplane_mode_status_change` hook for functions to fire on status change | ||
* purge update related transients on disable | ||
* added WordPress formatted readme file | ||
|
||
#### Version 0.0.2 - 2015/01/21 | ||
* added GitHub Updater support | ||
* fixed update capabilities when status is disabled | ||
|
||
#### Version 0.0.1 - 2014/06/01 | ||
* lots of stuff. I wasn't keeping a changelog. I apologize. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2014 Norcross | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
Airplane Mode | ||
======================== | ||
|
||
## Contributors | ||
* [Andrew Norcross](https://github.com/norcross) | ||
* [John Blackbourn](https://github.com/johnbillion) | ||
* [Andy Fragen](https://github.com/afragen) | ||
* [Viktor Szépe](https://github.com/szepeviktor) | ||
* [Chris Christoff](https://github.com/chriscct7) | ||
* [Mark Jaquith](https://github.com/markjaquith) | ||
|
||
## About | ||
Control loading of external files when developing locally. WP loads certain external files (fonts, Gravatar, etc.) and makes external HTTP calls. This isn't usually an issue, unless you're working in an evironment without a web connection. This plugin removes/unhooks those actions to reduce load time and avoid errors due to missing files. | ||
|
||
## Current Actions | ||
* removes external JS and CSS files from loading | ||
* replaces all instances of Gravatar with a local image to remove external call | ||
* removes all HTTP requests | ||
* disables all WP update checks for core, languages, themes, and plugins | ||
* includes toggle in admin bar for quick enable / disable | ||
|
||
## Changelog | ||
|
||
See [CHANGES.md](CHANGES.md). | ||
|
||
## Notes | ||
If you need offline activation, see [this script](https://gist.github.com/solepixel/e1d03f4dcd1b9e86552b3cc6937325bf) written by [Brian DiChiara](https://github.com/solepixel) | ||
|
||
## Roadmap | ||
* fine tune HTTP request removal | ||
* find other calls from core | ||
* add other requests from popular plugins | ||
|
||
#### [Pull requests](https://github.com/norcross/airplane-mode/pulls) are very much welcome and encouraged. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?php | ||
/** | ||
* Airplane Mode Loader added by the AirplaneMode wp-browser module. | ||
*/ | ||
|
||
require_once WPMU_PLUGIN_DIR . '/airplane-mode/airplane-mode.php'; |
Oops, something went wrong.