|
@@ 117-119 (lines=3) @@
|
| 114 |
|
} |
| 115 |
|
|
| 116 |
|
$action = isset( $args[0] ) ? $args[0] : 'prompt'; |
| 117 |
|
if ( ! in_array( $action, array( 'blog', 'user', 'prompt' ) ) ) { |
| 118 |
|
WP_CLI::error( sprintf( __( '%s is not a valid command.', 'jetpack' ), $action ) ); |
| 119 |
|
} |
| 120 |
|
|
| 121 |
|
if ( in_array( $action, array( 'user' ) ) ) { |
| 122 |
|
if ( isset( $args[1] ) ) { |
|
@@ 263-265 (lines=3) @@
|
| 260 |
|
*/ |
| 261 |
|
public function module( $args, $assoc_args ) { |
| 262 |
|
$action = isset( $args[0] ) ? $args[0] : 'list'; |
| 263 |
|
if ( ! in_array( $action, array( 'list', 'activate', 'deactivate', 'toggle' ) ) ) { |
| 264 |
|
WP_CLI::error( sprintf( __( '%s is not a valid command.', 'jetpack' ), $action ) ); |
| 265 |
|
} |
| 266 |
|
if ( in_array( $action, array( 'activate', 'deactivate', 'toggle' ) ) ) { |
| 267 |
|
if ( isset( $args[1] ) ) { |
| 268 |
|
$module_slug = $args[1]; |
|
@@ 346-348 (lines=3) @@
|
| 343 |
|
*/ |
| 344 |
|
public function protect( $args, $assoc_args ) { |
| 345 |
|
$action = isset( $args[0] ) ? $args[0] : 'prompt'; |
| 346 |
|
if ( ! in_array( $action, array( 'whitelist' ) ) ) { |
| 347 |
|
WP_CLI::error( sprintf( __( '%s is not a valid command.', 'jetpack' ), $action ) ); |
| 348 |
|
} |
| 349 |
|
// Check if module is active |
| 350 |
|
if ( ! Jetpack::is_module_active( __FUNCTION__ ) ) { |
| 351 |
|
WP_CLI::error( sprintf( _x( '%s is not active. You can activate it with "wp jetpack module activate %s"', '"wp jetpack module activate" is a command - do not translate', 'jetpack' ), __FUNCTION__, __FUNCTION__ ) ); |