This repository has been archived on 2023-08-16. You can view files and clone it, but cannot push or open issues or pull requests.
footnotes/includes.php

40 lines
1.1 KiB
PHP
Raw Normal View History

2021-02-23 16:00:59 +00:00
<?php
/**
* Includes all common files.
*
* @filesource
* @package footnotes
2021-02-23 16:00:59 +00:00
* @since 1.5.0 14.09.14 13:40
*/
/**
* Requires (`require_once`) all `*.php` files inside a specific Directory.
2021-02-23 16:00:59 +00:00
*
* @author Stefan Herndler
* @since 1.5.0
* @param string $directory Absolute Directory path to lookup for `*.php` files.
2021-02-23 16:00:59 +00:00
*/
function mci_footnotes_require_php_files( $directory ) {
// Append slash at the end of the Directory if not exist.
if ( '/' !== substr( $directory, -1 ) ) {
$directory .= '/';
2021-02-23 16:00:59 +00:00
}
// Get all PHP files inside Directory.
$files = scandir( $directory );
// Iterate through each class.
foreach ( $files as $file_name ) {
// Skip all non-PHP files.
if ( '.php' !== strtolower( substr( $file_name, -4 ) ) ) {
2021-02-23 16:00:59 +00:00
continue;
}
// phpcs:disable Generic.Commenting.DocComment.MissingShort
2021-02-23 16:00:59 +00:00
/** @noinspection PhpIncludeInspection */
require_once $directory . $file_name;
// phpcs:enable
2021-02-23 16:00:59 +00:00
}
}
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' );