Skip to content

Instantly share code, notes, and snippets.

@aercolino
Last active May 2, 2017 16:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aercolino/26a2358d828fd482d30f to your computer and use it in GitHub Desktop.
Save aercolino/26a2358d828fd482d30f to your computer and use it in GitHub Desktop.
Plugin Suspension: suspend and resume any WP plugin (draft)

Plugin Suspension: suspend and resume any WP plugin

This is a set of two dynamic enzymes useful for suspending and resuming another plugin.

Work in progress...

Example

This would be the content of a post of yours. The thingy plugin would be filtering content as usual.

{[ =thingy/thingy.php= | @plugin-suspension.suspend(1) ]}

Here the thingy plugin would be suspended.

{[ =thingy/thingy.php= | @plugin-suspension.resume(1) ]}

Here the thingy plugin would be resumed and working as usual again.

version: 1_0_0
list($plugin) = $arguments;
if (is_plugin_active($plugin)) {
// if the $plugin is not listening on the current filter at a priority > $plugin's priority in $this->extra
// then we can
// 1. mark the current position in the content with a unique ending ID
// 3. if not already done, replace $plugin's listener with a wrapper that
// a. will extract all the content between all the starting / ending pairs of unique IDs
// b. will apply the original $plugin's listener to the result of a.
// c. will restore all extracted content
}
list($plugin) = $arguments;
if (is_plugin_active($plugin)) {
// if the $plugin is listening on the current filter at a priority > current priority
// then we can hide the content from here up to the corresponding resume like this:
// 1. mark the current position in the content with a unique starting ID
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment