-
Notifications
You must be signed in to change notification settings - Fork 22
/
language-command.php
46 lines (37 loc) · 1.04 KB
/
language-command.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
if ( ! class_exists( 'WP_CLI' ) ) {
return;
}
$wpcli_language_autoloader = __DIR__ . '/vendor/autoload.php';
if ( file_exists( $wpcli_language_autoloader ) ) {
require_once $wpcli_language_autoloader;
}
$wpcli_language_check_requirements = function () {
if ( \WP_CLI\Utils\wp_version_compare( '4.0', '<' ) ) {
WP_CLI::error( 'Requires WordPress 4.0 or greater.' );
}
};
WP_CLI::add_command(
'language core',
'Core_Language_Command',
array( 'before_invoke' => $wpcli_language_check_requirements )
);
WP_CLI::add_command(
'language plugin',
'Plugin_Language_Command',
array( 'before_invoke' => $wpcli_language_check_requirements )
);
WP_CLI::add_command(
'language theme',
'Theme_Language_Command',
array( 'before_invoke' => $wpcli_language_check_requirements )
);
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' );
}