{eac}Doojigger: Base Plugin for WordPress

{eac}Doojigger - A new path to rapid plugin development. A Powerful, extensible, multi-function framework and utility plugin for WordPress.

Document Header

Homepage:https://eacDoojigger.earthasylum.com/ Author:EarthAsylum Consulting Current Version:1.2.0 Last Updated:14-Sep-2022 Requires WordPress Version:5.4.0 Compatible up to:6.0 Requires PHP Version:7.2 Contributors:Kevin Burkholder License:EarthAsylum Consulting Proprietary License - {eac}PLv1 License URI:https://eacDoojigger.earthasylum.com/end-user-license-agreement/ Tags:multi-function, encryption, debugging, security, administration, session management, maintenance mode, custom plugin framework, plugin derivative, toolkit, extensions, rapid development

Description

Summary

{eac}Doojigger by EarthAsylum Consulting is a multi functional and extensible plugin that provides existing extensions covering security, debugging/logging, encryption, session management, easy maintenance mode, administration tools, and more.

{eac}Doojigger is both a fully functional plugin and a framework (using shared/abstract code) supporting the easy creation of full featured...

  1. Custom Derivative plugins.
    • Build your own plugin using a strong, efficient, clean, foundation.
  2. Custom {eac}Doojigger Extensions.
    • Add your extensions using the {eac}Doojigger extension framework.
  3. Custom Extension Plugins.
    • Load your custom extension(s) (for {eac}Doojigger or your derivative) as their own WordPress plugin(s).

Rather than updating or customizing themes and functions, it is often better to isolate your custom code in a plugin or plugin extension so that code is not lost when the theme is changed or updated. Themes (parent or child) should only be used and customized with code pertinent to the look and feel of your site. Any code that should be retained after changing a theme belongs in a plugin or plugin extension. This keeps your code reusable and theme independent.

{eac}Doojigger makes theme-independent code easy to maintain...

...as a Derivative Plugin, as an Extension, or as an Extension Plugin.

Provided With {eac}Doojigger

Pre-Loaded Extensions

  • security extension - adds a number of security options to your WordPress installation.
  • debugging extension - adds powerful debugging/logging tools.
  • encryption extension - adds easy to use encryption/decryption filters.
  • session extension - manages PHP sessions using well-known session managers or through WordPress transients.
  • maintenance mode extension - enables a custom "Maintenance Mode" when you need to disable front-end access to your site(s).
  • admin tools extension - adds cache management and dashboard option backup/restore.
  • ajaxaction extension - adds a simple ajax responder that can be used by any extension.
  • material icons extension - adds Google's Material Icons to WordPress.

Included Extras

  • myAwesomePlugin example, a skeleton plugin derivative. See Plugin Derivatives
  • myAwesomeExtension example, a skeleton plugin extension. See Custom Extensions
  • myFunctions a functional skeleton extension plugin intended to replace (or augment) custom theme functions.php, with optional custom stylesheet and javascript.
  • Several useful, usable PHP traits such as plugin loader, plugin updater, standard (common) dashboard options, date/time methods, version compare methods, and zip archive.
  • A debugging test api extension that provides testing via url through the debugging extension (not recommended for production sites).
  • The required auto-loader utility ({eac}DoojiggerAutoloader) to automatically load {eac}Doojigger (and derivative) classes and traits.
  • The Environment Switcher ({eac}DoojiggerEnvironment) to set WP environment from the network (multi-site) or general settings page.
  • The timer/tracking utility ({eac}DoojiggerActionTimer) to track the load/execution timing of WordPress Actions, as well as custom events, when WordPress loads.

Available Derivative Plugins

  • {eac}SoftwareRegistry - A full-featured Software Registration/Licensing Server (used by {eac}Doojigger).

Available Extension Plugins

  • {eac}SimpleSMTP - Configure WordPress wp_mail and phpmailer to use your SMTP (outgoing) mail server when sending email.
  • {eac}Readme - Translates a WordPress style markdown 'readme.txt' file and provides shortcodes to access header lines, section blocks, or the entire document.
  • {eac}MetaPixel - installs the Facebook/Meta Pixel to enable tracking of PageView, ViewContent, AddToCart, InitiateCheckout and Purchase events.

Custom Derivative Plugins

Once {eac}Doojigger is installed and registered, you, the developer, can create your own plugin using the abstract classes and traits provided.

  • First, create a simple plugin loader using your plugin class name (myAwesomePlugin.php). This is the primary plugin file and must contain the required WordPress headers; it will use the plugin_loader trait provided by {eac}Doojigger.
  • Second, create your actual plugin class (myAwesomePlugin.class.php) that gets loaded by your plugin loader. This class extends the {eac}Doojigger abstract classes (abstract_context, abstract_frontend, abstract_backend) which include all of the management and utility code needed for a full-featured, full-functioning plugin.
  • Third, upload and install your plugin.

Your plugin code need only focus on your particular requirements. The WordPress code and many utility functions have been taken care of for you.

Detailed instructions and examples can be found in the Extras/Plugins folder distributed with {eac}Doojigger.

Custom {eac}Doojigger Extensions

An extension is a PHP program class that adds functionality to the base plugin. Extensions can be coded for specific needs and can be as simple or complex as needed.

  • First, create an extension class (myAwesomeExtension.extension.php) that extends the extension abstract class (abstract_extension).
  • Second, upload your extension to the plugin's 'Extensions' folder.

Custom extensions may also be uploaded to your theme folder (preferable a child theme), in the ../eacDoojigger/Extensions folder.

Detailed instructions and examples can be found in the Extras/Extensions folder distributed with {eac}Doojigger.

Custom Extension Plugins

Since uploading extensions to the plugin or theme folder risks overwriting those extensions when upgrading or re-installing the plugin or theme, it is very easy to add extensions as their own WordPress plugin. The plugin simply answers a filter from the base plugin telling it where to load additional extensions. These extensions then exist in their own plugin folder with no risk of being overwritten.

These extension plugins may also provide automatic updates through WordPress simply by using the plugin_update trait provided by {eac}Doojigger. See the readme.txt file in the Extras/AutoUpdate folder.

Using {eac}Doojigger

{eac}Doojigger provides many usefull methods which can be accessed from your custom plugins or extensions, as well as from your theme functions or any code in WordPress.

Method Access

Public methods in eacDoojigger.class.php (including abstract classes) may be accessed through the static plugin loader class ("eacDoojigger").

\EarthAsylumConsulting\eacDoojigger::{methodName}(...$arguments);

For example, to write an entry to the debugging log...

\EarthAsylumConsulting\eacDoojigger::logDebug($myVariable,'Logging myVariable');

To access a plugin option...

\EarthAsylumConsulting\eacDoojigger::get_option('my_option_name');

To execute a plugin action...

\EarthAsylumConsulting\eacDoojigger::do_action('my_action_name',$arg1,$arg2,...);

To execute a method in a plugin extension, use callMethod()...

\EarthAsylumConsulting\eacDoojigger::callMethod( [extensionName, extensionMethodName], ...$arguments )

Filters and Shortcodes

{eac}Doojigger (and derivatives) provides a front-end filter and a shortcode that gives access to (nearly) all public methods in the plugin and extensions, WordPress options, and blog info.

The filter and shortcode name is the plugin class name ('eacDoojigger'). Arguments include 'method={methodName}', 'option={optionName}', and 'bloginfo={bloginfoName}'

Filter Examples:

\apply_filters('eacDoojigger', null, [ method='getVariable' args='session_manager' ]);  //  expecting session manager stored variable
\apply_filters('eacDoojigger', null, [ method='session.sessionId' ]);                   //  expecting session id from session extension
\apply_filters('eacDoojigger', null, [ method='_SERVER' args='server_name' ]);          //  expecting server name from $_SERVER
\apply_filters('eacDoojigger', null, [ method='get_option' args='siteEnvironment' ]);   //  expecting siteEnvironment
\apply_filters('eacDoojigger', null, [ option='siteEnvironment' ]);                     //  expecting siteEnvironment
\apply_filters('eacDoojigger', null, [ option='blogdescription' ]);                     //  expecting WordPress blogdescription
\apply_filters('eacDoojigger', null, [ option='woocommerce_cybersource_credit_card_settings' index='description' default='not installed' ]);    //  expecting cybersource description
\apply_filters('eacDoojigger', null, [ bloginfo='name' ]);                              //  expecting WordPress Site Title

Shortcode Examples:

['eacDoojigger' method='getVariable' args='session_manager']    //  expecting session manager stored variable
['eacDoojigger' method='session.sessionId']                     //  expecting session id from session extension
['eacDoojigger' method='_SERVER' args='server_name']            //  expecting server name from $_SERVER
['eacDoojigger' method='get_option' args='siteEnvironment']     //  expecting siteEnvironment
['eacDoojigger' option='siteEnvironment']                       //  expecting siteEnvironment
['eacDoojigger' option='blogdescription']                       //  expecting WordPress blogdescription
['eacDoojigger' option='woocommerce_cybersource_credit_card_settings' index='description' default='not installed']  //  expecting cybersource description
['eacDoojigger' bloginfo='name' ]                               //  expecting WordPress Site Title

Filters, Options, and Transients

When using class methods to access filters and actions, options, and transients, all names are prefixed with the plugin name ('eacDoojigger_*). These functions are extended wrappers around WordPress methods...

  • $this->add_filter(...) rather than add_filter(...)
  • $this->add_option(...) rather than add_option(...)
  • $this->add_network_option(...) rather than add_network_option(...)
  • $this->add_site_option(...) rather than add_site_option(...)
  • $this->set_transient(...) rather than set_transient(...)
  • $this->set_site_transient(...) rather than set_site_transient(...)

Table Names

For custom table names, use $this->prefixTableName('my_table_name') to ensure uniqueness of your table name(s).

Multi-Site / Network

{eac}Doojigger is well aware of multi-site/network environments where only a network administrator may install plugins and plugins may be network-enabled (enabled for all sites) or site-enabled (enabled for/by individual sites within the network).

{eac}Doojigger manages installation, activation, deactivation and un-installing properly based on the type of installation and activation.

{eac}Doojigger also manages options and transients on network installations differently than the WordPress defaults...

The WordPress ***_network_option and ***_site_option methods are essentially the same (with the exception of the $network_id argument) and fallback to ***_option (single-site) methods if not on a multi-site (network) installation. As well, ***_site_transient methods fallback to ***_transient when not on a multi-site installation. WordPress does not check (nor should it) for the type of plugin activation (network wide vs. individual site).

{eac}Doojigger methods are different...

  • $this->***_network_option methods only work on a multi-site installation when the plugin is network-enabled and do nothing (return default value) on a single-site installation.
  • $this->***_site_option methods only use network methods if the plugin was activated network wide on a multi-site installation, otherwise these methods fallback to ***_option (single-site) methods.
  • $this->***_site_transient methods only use network methods if the plugin was activated network wide or if invoked by the network administrator, otherwise these methods fallback to ***_transient (single-site) methods.

These are key, important, differences and help make managing options and transients more effective in a network environment.

Top
Installation

Automatic Plugin Installation

Due to the nature of this plugin, it is NOT available from the WordPress Plugin Repository and can not be installed from the WordPress Dashboard » Plugins » Add New » Search feature.

Upload via WordPress Dashboard

Installation of this plugin can be managed from the WordPress Dashboard » Plugins » Add New page. Click the [Upload Plugin] button, then select the eacDoojigger.zip file from your computer.

See Managing Plugins -> Upload via WordPress Admin

Manual Plugin Installation

You can install the plugin manually by extracting the eacDoojigger.zip file and uploading the 'eacDoojigger' folder to the 'wp-content/plugins' folder on your WordPress server.

See Managing Plugins -> Manual Plugin Installation

Activation

On activation, custom tables and default settings/options are created. Be sure to visit the 'Settings' page to ensure proper configuration.

{eac}Doojigger should be Network Activated on multi-site installations.

Updates

Updates are managed from the WordPress Dashboard » 'Plugins' » 'Installed Plugins' page. When a new version is available, a notice is presented under this plugin. Clicking on the 'update now' link will install the update; clicking on the 'View details' will provide more information on the update from which you can click on the 'Install Update Now' button.

When updated, any custom tables and/or option changes are applied. Be sure to visit the 'Settings' page.

Deactivation

On deactivation, the plugin makes no changes to the system but will not be loaded until reactivated.

Uninstall

When uninstalled, the plugin will delete custom tables, settings, and transient data based on the options selected in the general settings. If settings have been backed up, the backup is retained and can be restored if/when re-installed. Tables are not backed up.

Top
FAQ

This is version 1.x of {eac}Doojigger, is it stable and reliable?

Yes. Although this is an early version, the code base has been in proprietary use (and in development) over years and on several websites. However, there is a nearly infinte number of website configurations and uses that can't possibly be tested. If you run into any issues, problems, bugs or simply change requests, I'd be more than happy to address them and to work with you.

Where can I find more information about creating a derivative plugin?

Please see the readme.txt file in the Extras/Plugins folder.

Where can I find more information about creating a custom extension?

Please see the readme.txt file in the Extras/Extensions folder.

How do I define and use options in my plugin or extension?

Please see the readme.txt file in the Extras/OptionMetaData folder.

How do I provide automatic updates for my plugin?

Please see the readme.txt file in the Extras/AutoUpdate folder.

Who is EarthAsylum Consulting?

EarthAsylum Consulting is a one-person consulting agency in business since 2005. I have some 30 years experience in technology and software development for a disperse range of businesses.

Currently, and for the last decade or more, my focus has been on internet-based business software & technology management.

In developing {eac}Doojigger, and other plugins based on it, I hope to find a small revenue stream to help keep me going.

To that end, your support is greatly appreciated. It will enable me to continue developing quality software and provide support to current and future clients (and to enjoy a cup of coffee occasionally).

Learn more here...

Thank you! Kevin Burkholder

Top
Screen Shots
  1. General settings General

  2. General settings - Maintenance Mode General

  3. General settings - Material Icons General

  4. General settings - Session Extension General

  5. Tools settings Tools

  6. Debugging settings Debugging

  7. Security settings (1) Security

  8. Security settings (2) Security

  9. My Awesome Plugin with My Awesome Extension myAwesomePlugin

Top
Other Notes

Additional Information

{eac}Doojigger should be Network Activated on multi-site installations. Individual extensions and options may be configured on each site.

See Also

Top Top
Change Log

Version 1.2.0 – September 14, 2022

  • Improved plugin_loader_environment and isversion traits.
  • Updated plugin_update.trait for WP 5.8+ (using update-plugins-{$hostname} filter).
  • Moved plugin upgrade notice to (new) plugin_update_notice.trait.php.
  • Added upgrade_notice support to abstract_context_wp, abstract_backend, and abstract_extension.
  • Added 'registry_title' to swRegistrationUI.
  • Updated Extras and readme docs.
  • Added support for extension plugin auto-updates in abstract_extension class.
  • Auto-load extensions from theme directory /eacDoojigger/Extensions.
  • Standardized settings link url with $this->getSettingsLink().
  • Added $this->getSettingsLink(), $this->getDocumentationLink(), $this->getSupportLink().
  • Fixed admin css class name for extensions with unexpected registered name.

Version 1.1.4 – August 5, 2022

  • Allow extensions loaded from plugins or themes directories.
  • Updated documentation and directory structure.

Version 1.1.3 – July 18, 2022

  • Removed code injection extension.

Version 1.1.2 – July 8, 2022

  • Improved sanitization of option input fields.
  • Added $this->_COOKIE() for cookie filtering.
  • Replaced default (depreciated) FILTER_SANITIZE_STRING with WP sanitize_textarea_field() callback.
  • Removed FILTER_PATTERN and FILTER_REPLACE (no longer used).

Version 1.1.1 – June 17, 2022

  • Check headers sent before setting cookie.

Version 1.1.0 – May 27, 2022

  • Completed name change from eacBasePlugin to eacDoojigger.
  • Fixed debug log purging (use modification time).
  • Add ability to override prefix (classname) for options/tables/transients when calling directly.
  • Add ability to override option prefix in getSavedPluginOptions() and getSavedNetworkOptions()

Version 1.0.9 – May 23, 2022

  • Fix bug in update trait.
  • Fixed network enabled check in abstract.extension.
  • Don't register extensions if not in admin settings page.

Version 1.0.8 – May 17, 2022

  • Updated documentation (phpdoc).
  • Changed log file location to wp-content (for proper file permissions).
  • Minor change to debugging log format on request start/end lines.
  • Fixed fatal email notification reset.
  • Added 'safeEcho' to prevent notices being output when running from ajax request. Prevents interference with multiple/auto installs.
  • Removed derivative tracking.

Version 1.0.7 – May 9, 2022

  • Fixed issue with isPHP() function with '.' in request uri.

Version 1.0.6 – April 28, 2022

  • Updated external requirements.
  • Updated Software Registry SDK.
  • Fixed plugin_loader_environment notice
  • Prevent auto loader and environment switcher update for each site in multi-site.

Version 1.0.5 – April 21, 2022

  • New 'Material Icons' extension.
  • Several minor "notice" fixes.
  • Fix environment error in WP pre-5.5 versions.
  • Updated for WordPress 5.9.3.
  • Fixed ajaxaction error when no parameters passed.

Version 1.0.4 – March 13, 2022

  • Fix debugging log across derivatives (not load-order dependent)
  • Fix proper capitalization of the word 'WordPress' (as opposed to 'Wordpress').
  • Added {eac}DoojiggerEnvironment utility to set WP_ENVIRONMENT_TYPE from settings page.
  • Added option to install/uninstall {eac}DoojiggerEnvironment utility.
  • Changed siteEnvironment standard option and core code to recognize {eac}DoojiggerEnvironment utility.
  • Cosmetic changes to plugin settings page.
  • Updated for WordPress 5.9.2.

Version 1.0.3 – March 3, 2022

  • Added upgrade notice to admin plugins screen.
  • Added option encryption/decryption.
  • Updates and fixes for WordPress 5.9.1 compatibility.
  • Updated maintenance mode extension.
  • Fixed registration refresh scheduling.
  • Support Admin Color Schemes.
  • Fixed is_network_admin_request() in abstract_context.
  • Registration/scheduling only on main site for network installations.
  • Fixed activation/deactivation, install/upgrade for network installations.
    • Lessen reliance on activation/deactivation.
    • Activation/Deactivation run across all active sites in network.
    • Install/Upgrade run across all active sites in network.
  • Updated internal and external documentation.
  • Fixed bug that allowed disabled extension to be enabled on admin pages.
  • Fixed several PHP Notices.
  • Other miscellaneous fixes and updates.
Top

    Write a Reply or Comment

    Your email address will not be published.


    You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>