-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathloader.php
30 lines (28 loc) · 1.44 KB
/
loader.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<?php
// Replace {$redux_opt_name} with your opt_name.
// Also be sure to change this function name!
if(!function_exists('redux_register_custom_extension_loader')) :
function redux_register_custom_extension_loader($ReduxFramework) {
$path = dirname( __FILE__ ) . '/extensions/';
$folders = scandir( $path, 1 );
foreach ( $folders as $folder ) {
if ( $folder === '.' or $folder === '..' or ! is_dir( $path . $folder ) ) {
continue;
}
$extension_class = 'ReduxFramework_Extension_' . $folder;
if ( ! class_exists( $extension_class ) ) {
// In case you wanted override your override, hah.
$class_file = $path . $folder . '/extension_' . $folder . '.php';
$class_file = apply_filters( 'redux/extension/' . $ReduxFramework->args['opt_name'] . '/' . $folder, $class_file );
if ( $class_file ) {
require_once( $class_file );
}
}
if ( ! isset( $ReduxFramework->extensions[ $folder ] ) ) {
$ReduxFramework->extensions[ $folder ] = new $extension_class( $ReduxFramework );
}
}
}
// Modify {$redux_opt_name} to match your opt_name
add_action("redux/extensions/{$redux_opt_name}/before", 'redux_register_custom_extension_loader', 0);
endif;