mirror of
https://fast.feibisi.com/https://github.com/wp-cli/scaffold-command.git
synced 2025-10-04 17:01:28 +08:00
reject .
and ..
from scaffold *
This commit is contained in:
parent
c2781c052d
commit
0558dcc916
1 changed files with 15 additions and 0 deletions
|
@ -239,6 +239,10 @@ class Scaffold_Command extends WP_CLI_Command {
|
|||
$url = "http://underscores.me";
|
||||
$timeout = 30;
|
||||
|
||||
if ( in_array( $theme_slug, array( '.', '..' ) ) ) {
|
||||
WP_CLI::error( "Invalid theme slug specified." );
|
||||
}
|
||||
|
||||
$data = wp_parse_args( $assoc_args, array(
|
||||
'theme_name' => ucfirst( $theme_slug ),
|
||||
'author' => "Me",
|
||||
|
@ -354,6 +358,10 @@ class Scaffold_Command extends WP_CLI_Command {
|
|||
function child_theme( $args, $assoc_args ) {
|
||||
$theme_slug = $args[0];
|
||||
|
||||
if ( in_array( $theme_slug, array( '.', '..' ) ) ) {
|
||||
WP_CLI::error( "Invalid theme slug specified." );
|
||||
}
|
||||
|
||||
$data = wp_parse_args( $assoc_args, array(
|
||||
'theme_name' => ucfirst( $theme_slug ),
|
||||
'author' => "Me",
|
||||
|
@ -495,6 +503,10 @@ class Scaffold_Command extends WP_CLI_Command {
|
|||
$plugin_name = ucwords( str_replace( '-', ' ', $plugin_slug ) );
|
||||
$plugin_package = str_replace( ' ', '_', $plugin_name );
|
||||
|
||||
if ( in_array( $plugin_slug, array( '.', '..' ) ) ) {
|
||||
WP_CLI::error( "Invalid plugin slug specified." );
|
||||
}
|
||||
|
||||
$data = wp_parse_args( $assoc_args, array(
|
||||
'plugin_slug' => $plugin_slug,
|
||||
'plugin_name' => $plugin_name,
|
||||
|
@ -662,6 +674,9 @@ class Scaffold_Command extends WP_CLI_Command {
|
|||
|
||||
if ( ! empty( $args[0] ) ) {
|
||||
$slug = $args[0];
|
||||
if ( in_array( $slug, array( '.', '..' ) ) ) {
|
||||
WP_CLI::error( "Invalid {$type} slug specified." );
|
||||
}
|
||||
if ( 'theme' === $type ) {
|
||||
$theme = wp_get_theme( $slug );
|
||||
if ( $theme->exists() ) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue