forked from wp-cli/language-command
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlanguage-command.php
More file actions
43 lines (35 loc) · 1.12 KB
/
language-command.php
File metadata and controls
43 lines (35 loc) · 1.12 KB
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
<?php
if ( ! class_exists( 'WP_CLI' ) ) {
return;
}
$autoload = dirname( __FILE__ ) . '/vendor/autoload.php';
if ( file_exists( $autoload ) ) {
require_once $autoload;
}
WP_CLI::add_command( 'language core', 'Core_Language_Command', array(
'before_invoke' => function() {
if ( \WP_CLI\Utils\wp_version_compare( '4.0', '<' ) ) {
WP_CLI::error( "Requires WordPress 4.0 or greater." );
}
})
);
WP_CLI::add_command( 'language plugin', 'Plugin_Language_Command', array(
'before_invoke' => function() {
if ( \WP_CLI\Utils\wp_version_compare( '4.0', '<' ) ) {
WP_CLI::error( "Requires WordPress 4.0 or greater." );
}
})
);
WP_CLI::add_command( 'language theme', 'Theme_Language_Command', array(
'before_invoke' => function() {
if ( \WP_CLI\Utils\wp_version_compare( '4.0', '<' ) ) {
WP_CLI::error( "Requires WordPress 4.0 or greater." );
}
})
);
WP_CLI::add_hook( 'after_add_command:site', function () {
WP_CLI::add_command( 'site switch-language', 'Site_Switch_Language_Command' );
} );
if ( class_exists( 'WP_CLI\Dispatcher\CommandNamespace' ) ) {
WP_CLI::add_command( 'language', 'Language_Namespace' );
}