-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathgenesis-config-exporter.php
46 lines (39 loc) · 1.15 KB
/
genesis-config-exporter.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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?php
/**
* Plugin Name: Genesis Config Exporter
* Plugin URI: https://github.com/seothemes/genesis-config-exporter
* Description: WP CLI command to export config file for child theme.
* Version: 1.0.0
* Author: SEO Themes
* Author URI: https://seothemes.com/
* License: GPL-2.0-or-later
* Text Domain: genesis-config-exporter
*/
declare( strict_types=1 );
namespace SeoThemes\GenesisConfigExporter;
// Prevent direct file access.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Autoload classes.
*
* @noinspection PhpUnhandledExceptionInspection
*/
\spl_autoload_register( function ( $class ) {
if ( strpos( $class, __NAMESPACE__ ) !== false ) {
require_once __DIR__ . '/src' . str_replace( '\\', DIRECTORY_SEPARATOR, substr( $class, strlen( __NAMESPACE__ ) ) ) . '.php';
}
} );
// Hook everything to after setup theme.
\add_action( 'after_setup_theme', function () {
$command = new Command( new Generator( new Plugin( __FILE__ ) ) );
if ( defined( 'WP_CLI' ) && WP_CLI ) {
/**
* Add WP CLI command.
*
* @var callable $command __invoke magic method.
*/
\WP_CLI::add_command( 'genesis config', $command );
}
}, 20 );