refactor: use proper dependency tracking
As you can see, there is quite a tangled web of dependency in this project, which is something to look at later. Fix #33
This commit is contained in:
parent
42b4fa03d3
commit
cd0c6bc295
11 changed files with 46 additions and 44 deletions
|
@ -7,6 +7,9 @@
|
|||
* @since 1.5.0
|
||||
*/
|
||||
|
||||
require_once dirname( __FILE__, 2) . '/settings.php';
|
||||
require_once dirname( __FILE__ ) . '/subpage-main.php';
|
||||
|
||||
/**
|
||||
* Handles the Settings interface of the Plugin.
|
||||
*
|
||||
|
|
|
@ -13,6 +13,11 @@
|
|||
*
|
||||
* @since 2.5.5 Bugfix: Stylesheets: minify to shrink the carbon footprint, increase speed and implement best practice, thanks to @docteurfitness issue report.
|
||||
*/
|
||||
|
||||
require_once dirname( __FILE__, 2) . '/config.php';
|
||||
require_once dirname( __FILE__, 2) . '/convert.php';
|
||||
require_once dirname( __FILE__, 2) . '/settings.php';
|
||||
require_once dirname( __FILE__ ) . '/init.php';
|
||||
|
||||
/**
|
||||
* Layout Engine for the administration dashboard.
|
||||
|
|
|
@ -40,6 +40,12 @@
|
|||
* @since 2.5.0 Shortcode syntax validation: add more information around the setting, thanks to @andreasra
|
||||
* @link https://wordpress.org/support/topic/warning-unbalanced-footnote-start-tag-short-code-before/
|
||||
*/
|
||||
|
||||
require_once dirname( __FILE__, 2) . '/config.php';
|
||||
require_once dirname( __FILE__, 2) . '/convert.php';
|
||||
require_once dirname( __FILE__, 2) . '/settings.php';
|
||||
require_once dirname( __FILE__, 2) . '/template.php';
|
||||
require_once dirname( __FILE__ ) . '/layout.php';
|
||||
|
||||
/**
|
||||
* Displays and handles all Settings of the Plugin.
|
||||
|
|
|
@ -6,6 +6,16 @@
|
|||
* @since 1.5.0
|
||||
*/
|
||||
|
||||
require_once dirname( __FILE__ ) . '/config.php';
|
||||
require_once dirname( __FILE__ ) . '/convert.php';
|
||||
require_once dirname( __FILE__ ) . '/hooks.php';
|
||||
require_once dirname( __FILE__ ) . '/language.php';
|
||||
require_once dirname( __FILE__ ) . '/settings.php';
|
||||
require_once dirname( __FILE__ ) . '/task.php';
|
||||
require_once dirname( __FILE__ ) . '/wysiwyg.php';
|
||||
require_once dirname( __FILE__ ) . '/dashboard/init.php';
|
||||
require_once dirname( __FILE__ ) . '/widgets/reference-container.php';
|
||||
|
||||
/**
|
||||
* Provides an entry point to the Plugin.
|
||||
*
|
||||
|
|
|
@ -10,6 +10,8 @@
|
|||
* @since 2.1.6 Bugfix: Localization: conform to WordPress plugin language file name scheme, thanks to @nikelaos bug report.
|
||||
*/
|
||||
|
||||
require_once dirname( __FILE__ ) . '/config.php';
|
||||
|
||||
/**
|
||||
* Loads text domain of current or default language for localization.
|
||||
*
|
||||
|
|
|
@ -13,6 +13,8 @@
|
|||
* @since 2.1.3 Bugfix: Hooks: disable the_excerpt hook by default to fix issues, thanks to @nikelaos bug report.
|
||||
*/
|
||||
|
||||
require_once dirname( __FILE__ ) . '/convert.php';
|
||||
|
||||
/**
|
||||
* Loads the settings values, sets to default values if undefined.
|
||||
*
|
||||
|
|
|
@ -87,6 +87,11 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||
die;
|
||||
}
|
||||
|
||||
require_once dirname( __FILE__ ) . '/config.php';
|
||||
require_once dirname( __FILE__ ) . '/convert.php';
|
||||
require_once dirname( __FILE__ ) . '/settings.php';
|
||||
require_once dirname( __FILE__ ) . '/template.php';
|
||||
|
||||
/**
|
||||
* Searches and replaces the footnotes and generates the reference container.
|
||||
*
|
||||
|
|
|
@ -7,6 +7,10 @@
|
|||
* @since 1.5.0
|
||||
*/
|
||||
|
||||
require_once dirname( __FILE__, 2 ) . '/config.php';
|
||||
require_once dirname( __FILE__, 2 ) . '/settings.php';
|
||||
require_once dirname( __FILE__ ) . '/base.php';
|
||||
|
||||
/**
|
||||
* Registers a Widget to put the Reference Container to the widget area.
|
||||
*
|
||||
|
|
|
@ -7,6 +7,10 @@
|
|||
* @since 1.5.0
|
||||
*/
|
||||
|
||||
require_once dirname( __FILE__ ) . '/config.php';
|
||||
require_once dirname( __FILE__ ) . '/settings.php';
|
||||
require_once dirname( __FILE__ ) . '/template.php';
|
||||
|
||||
/**
|
||||
* Handles the WSYIWYG-Buttons.
|
||||
*
|
||||
|
|
|
@ -21,9 +21,9 @@
|
|||
* License: GPL v3
|
||||
* License URI: https://www.gnu.org/licenses/gpl-3.0.html
|
||||
*/
|
||||
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
|
||||
/**
|
||||
* Defines the current Plugin version.
|
||||
*
|
||||
|
@ -50,11 +50,11 @@ const PRODUCTION_ENV = false;
|
|||
*/
|
||||
const PLUGIN_ENTRYPOINT = 'footnotes/footnotes.php';
|
||||
|
||||
// Get all common classes and functions.
|
||||
require_once dirname( __FILE__ ) . '/includes.php';
|
||||
// Requires the core Plugin file.
|
||||
require_once dirname( __FILE__ ) . '/class/init.php';
|
||||
|
||||
// Add links to the ‘Installed Plugins’ page on the WordPress dashboard.
|
||||
add_filter( "plugin_action_links_" . PLUGIN_ENTRYPOINT, array( 'Footnotes_Hooks', 'get_plugin_links' ), 10, 2 );
|
||||
add_filter( 'plugin_action_links_' . PLUGIN_ENTRYPOINT, array( 'Footnotes_Hooks', 'get_plugin_links' ), 10, 2 );
|
||||
|
||||
// Initialize the Plugin.
|
||||
$g_obj_mci_footnotes = new Footnotes();
|
||||
|
|
|
@ -1,39 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* Includes all common files.
|
||||
*
|
||||
* @filesource
|
||||
* @package footnotes
|
||||
* @since 1.5.0 14.09.14 13:40
|
||||
*/
|
||||
|
||||
/**
|
||||
* Requires (`require_once`) all `*.php` files inside a specific Directory.
|
||||
*
|
||||
* @author Stefan Herndler
|
||||
* @since 1.5.0
|
||||
* @param string $p_str_directory Absolute Directory path to lookup for `*.php` files.
|
||||
*/
|
||||
function mci_footnotes_require_php_files( $p_str_directory ) {
|
||||
// Append slash at the end of the Directory if not exist.
|
||||
if ( '/' !== substr( $p_str_directory, -1 ) ) {
|
||||
$p_str_directory .= '/';
|
||||
}
|
||||
// Get all PHP files inside Directory.
|
||||
$l_arr_files = scandir( $p_str_directory );
|
||||
// Iterate through each class.
|
||||
foreach ( $l_arr_files as $l_str_file_name ) {
|
||||
// Skip all non-PHP files.
|
||||
if ( '.php' !== strtolower( substr( $l_str_file_name, -4 ) ) ) {
|
||||
continue;
|
||||
}
|
||||
// phpcs:disable Generic.Commenting.DocComment.MissingShort
|
||||
/** @noinspection PhpIncludeInspection */
|
||||
require_once $p_str_directory . $l_str_file_name;
|
||||
// phpcs:enable
|
||||
}
|
||||
}
|
||||
|
||||
mci_footnotes_require_php_files( dirname( __FILE__ ) . '/class' );
|
||||
mci_footnotes_require_php_files( dirname( __FILE__ ) . '/class/dashboard' );
|
||||
mci_footnotes_require_php_files( dirname( __FILE__ ) . '/class/widgets' );
|
Reference in a new issue