diff --git a/phpstan.neon.dist b/phpstan.neon.dist index c56865b..52d5354 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -1,5 +1,5 @@ parameters: - level: 3 + level: 4 paths: - wp-multi-network/includes - wpmn-loader.php diff --git a/wp-multi-network/includes/classes/class-wp-ms-network-command.php b/wp-multi-network/includes/classes/class-wp-ms-network-command.php index 282e286..5bdb52f 100644 --- a/wp-multi-network/includes/classes/class-wp-ms-network-command.php +++ b/wp-multi-network/includes/classes/class-wp-ms-network-command.php @@ -86,10 +86,6 @@ public function create( $args, $assoc_args ) { if ( ! empty( $clone_network ) && ! get_network( $clone_network ) ) { WP_CLI::error( sprintf( "Clone network %s doesn't exist.", $clone_network ) ); - - if ( ! empty( $assoc_args['options_to_clone'] ) ) { - $options_to_clone = explode( ',', $assoc_args['options_to_clone'] ); - } } $network_id = add_network( diff --git a/wp-multi-network/includes/classes/class-wp-ms-networks-admin-bar.php b/wp-multi-network/includes/classes/class-wp-ms-networks-admin-bar.php index a4c4dd2..67bfe66 100644 --- a/wp-multi-network/includes/classes/class-wp-ms-networks-admin-bar.php +++ b/wp-multi-network/includes/classes/class-wp-ms-networks-admin-bar.php @@ -17,15 +17,17 @@ class WP_MS_Networks_Admin_Bar { /** - * Constructor. + * Registers WordPress hooks for the plugin. * - * Hooks in the necessary methods. + * Adds actions to: + * - Modify the admin bar menu + * - Add custom styles to the admin area + * - Add custom styles to the front-end * - * @since 2.2.0 + * @return void */ - public function __construct() { + public function add_hooks(): void { add_action( 'admin_bar_menu', array( $this, 'admin_bar' ), 20 ); - add_action( 'admin_print_styles', array( $this, 'admin_print_styles' ) ); add_action( 'wp_print_styles', array( $this, 'admin_print_styles' ) ); } diff --git a/wp-multi-network/includes/compat.php b/wp-multi-network/includes/compat.php index 01892ce..61eadf8 100644 --- a/wp-multi-network/includes/compat.php +++ b/wp-multi-network/includes/compat.php @@ -56,6 +56,7 @@ function wp_sanitize_site_path( $path = '' ) { * @param string $domain Site domain. * @param string $path Site path. * @param string $site_id Optional. Site ID, if an existing site. Default 0. + * * @return bool True if the site URL is valid, false otherwise. */ function wp_validate_site_url( $domain, $path, $site_id = '0' ) { @@ -66,7 +67,8 @@ function wp_validate_site_url( $domain, $path, $site_id = '0' ) { if ( (int) $exists === (int) $site_id ) { return true; } - if ( true === $exists ) { + + if ( true === (bool) $exists ) { return false; } diff --git a/wpmn-loader.php b/wpmn-loader.php index 9728bbc..7e72c37 100644 --- a/wpmn-loader.php +++ b/wpmn-loader.php @@ -165,6 +165,7 @@ private function includes() { $this->capabilities->add_hooks(); $this->admin_bar = new WP_MS_Networks_Admin_Bar(); + $this->admin_bar->add_hooks(); if ( defined( 'WPMN_DEPRECATED' ) && ( true === WPMN_DEPRECATED ) ) { require $this->plugin_dir . 'includes/deprecated.php';