Skip to content

Commit

Permalink
Issue #1 - move non-main plugin files to includes. Add readme.txt
Browse files Browse the repository at this point in the history
  • Loading branch information
bobbingwide committed Mar 6, 2019
1 parent 9e795fb commit 97e2a28
Show file tree
Hide file tree
Showing 5 changed files with 105 additions and 1 deletion.
40 changes: 40 additions & 0 deletions includes/oik-loader-admin.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?php
/**
* Admin functions for oik-loader.php
*/

//oik_loader_activate_mu( true );


/**
* Activate / deactivate oik-loader-mu processing
*
* @param bool $activate true to activate, false to deactivate
*/
function oik_loader_activate_mu( $activate=true ) {
$source = oik_path( 'includes/oik-loader-mu.php', "oik-loader" );
if ( defined( 'WPMU_PLUGIN_DIR' ) ) {
$target = WPMU_PLUGIN_DIR;
} else {
$target = ABSPATH . '/wp-content/mu-plugins';
}
bw_trace2( $target, "target dir", true, BW_TRACE_DEBUG );
//var_dump( debug_backtrace() );
//echo "Target: $target";
if ( is_dir( $target ) ) {
$target .= "/oik-loader-mu.php";
if ( $activate ) {
if ( !file_exists( $target ) ) {
copy( $source, $target );
}
} else {
if ( file_exists( $target ) ) {
unlink( $target );
}
}
} else {
// Do we need to make this ourselves?
bw_trace2( $target, "Not a dir?", true, BW_TRACE_ERROR );
//gobang();
}
}
File renamed without changes.
File renamed without changes.
7 changes: 6 additions & 1 deletion oik-loader.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
function oik_loader_loaded() {

add_action( "run_oik-loader.php", "oik_loader_run_oik_loader");
add_action( "oik_admin_menu", "oik_loader_oik_admin_menu");

}

Expand All @@ -41,10 +42,14 @@ function oik_loader_loaded() {
*
*/
function oik_loader_run_oik_loader() {
oik_require( "oik-loader-map.php", "oik-loader");
oik_require( "includes/oik-loader-map.php", "oik-loader");
oik_loader_map();

}

function oik_loader_oik_admin_menu() {
oik_require( "includes/oik-loader-admin.php", "oik-loader");
}


oik_loader_loaded();
59 changes: 59 additions & 0 deletions readme.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
=== oik-loader ===
Contributors: bobbingwide, vsgloik
Donate link: https://www.oik-plugins.com/oik/oik-donate/
Tags: oik, plugin, loader
Requires at least: 5.1
Tested up to: 5.1
Stable tag: 0.0.0

WordPress Must Use plugin to load required plugins.

== Description ==




== Installation ==
1. Upload the contents of the oik-loader plugin to the `/wp-content/plugins/oik-loader' directory
1. Activate the oik-loader plugin through the 'Plugins' menu in WordPress
1. Generate the oik-loader.csv file in the mu-plugins folder

Note: The oik-loader-mu.php file is automatically copied to the mu-plugins folder



== Frequently Asked Questions ==

= What is this plugin for? =
It helps to reduce the number of activated plugins in blocks.wp-a2z.org
It dynamically loads the required plugin for a block.

= Which plugins can I deactivate? =
Once all the blocks for a plugin have been generated then the plugin can be deactived.

With the following exceptions:
- oik-blocks - since these blocks are used in all content
- plugins upon which oik-blocks depends for server side rendering

Gutenberg is optional.


== Screenshots ==
1. None

== Upgrade Notice ==
= 0.0.0 =
Prototype version developed with oik-magnetic-poetry.
oik-blocks needs to be activated since these blocks are used by the block CPT.

== Changelog ==
= 0.0.0 =
* Added: includes/oik-loader-mu.php to automatically load the required plugin
* Added: oik-loader.php - the main plugin file

== Further reading ==
If you want to read more about oik plugins and themes then please visit
[oik-plugins](https://www.oik-plugins.com/)



0 comments on commit 97e2a28

Please sign in to comment.