{eac}Doojigger: Base Plugin for WordPress

Document Header

Homepage:https://eacDoojigger.earthasylum.com/ Author:EarthAsylum Consulting Current Version:1.1.1 Last Updated:17-Jun-2022 Requires WordPress Version:5.4.0 Compatible up to:5.9.3 Requires PHP Version:7.2 Contributors:Kevin Burkholder License:EarthAsylum Consulting Proprietary License (EACPLv1) 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

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

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 code) supporting the easy creation of full featured...

  • Custom Derivative plugins. Build your own plugin using a strong, efficient, clean, foundation.
  • Custom Extensions to {eac}Doojigger (or derivatives). Add simple to complex extensions using the {eac}Doojigger extension framework.
  • Custom Extension Plugins. Load your custom extensions as their own WordPress plugin.

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 to {eac}Doojigger, 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 simple 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 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.
  • myAwesomeExtension example, a skeleton plugin extension.
  • {eac}CodeInjection is both an example and useful group of extensions that adds code-injection filters for CSS, HTML, JavaScript and PHP.
  • Sample extensions for shortcodes and WooCommerce Cart customization.
  • Several useful, usable traits such as plugin loader, plugin updater, standard (common) options, date/time 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/general settings page.
  • The timer/tracking utility ({eac}DoojiggerActionTimer) to track 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.

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 and Extras/Extensions folders 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 Extension Plugins

Since using the above method of adding new extensions to a plugin risks overwriting those extensions when upgrading or re-installing the plugin, it is very easy to add extensions as their own 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 can also provide automatic updates simply by using the plugin_update trait provided by {eac}Doojigger.

Using {eac}Doojigger

{eac}Doojigger provides many usefull methods which can be accessed from your custom plugins or extensions, as well as from your template 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() or callExtension()...

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

Filters and Shortcodes

{eac}Doojigger (and derivatives) provides a front-end filter and 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

Installation of the plugin can be managed through WordPress on the 'Plugins' page » 'Add New' » 'Upload Plugin' and then selecting the eacDoojigger.zip file from your computer. You can also install the plugin manually by extracting the file and uploading the 'eacDoojigger' folder to the 'wp-content/plugins' folder on your WordPress server.

See Managing Plugins -> Upload via WordPress Admin

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

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

Updates are also managed from the '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 detail 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.

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

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.0 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 files 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.

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. Tools settings Tools

  3. Debugging settings Debugging

  4. Security settings (1) Security

  5. Security settings (2) Security

  6. Maintenance Mode Maintenance

  7. My Awesome Plugin with My Awesome Extension myAwesomePlugin

Top
Other Notes
  • {eac}Doojigger should be Network Enabled on multi-site installations. Individual extensions and options may be configured on each site.
  • {eac}Doojigger has been developed and used by EarthAsylum Consulting for several years to develop proprietary client plugins and extensions.

See Also

{eac}SoftwareRegistry

A full-featured Software Registration/Licensing Server.

<span class='eac-product'>{<span class='eac-brand'>eac</span>}SoftwareRegistry</span> General Settings

{eac}SimpleSMTP

Configure WordPress wp_mail, and phpmailer, to use your SMTP (outgoing) mail server when sending email.

<span class='eac-product'>{<span class='eac-brand'>eac</span>}SimpleSmtp</span>

{eac}Readme

Translates a WordPress style markdown 'readme.txt' file and provides shortcodes to access header lines, section blocks, or the entire document.

<span class='eac-product'>{<span class='eac-brand'>eac</span>}Readme</span> Extension

Top Top
Change Log

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
Upgrade Notice
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>