From 0c0995f2e197a4a540cedbbf792114a77516fe85 Mon Sep 17 00:00:00 2001 From: Martin Rehberger Date: Wed, 14 Nov 2018 17:18:59 +0100 Subject: [PATCH] change to switch, add option for windows systems --- admin-command.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/admin-command.php b/admin-command.php index 9966921..25eac29 100644 --- a/admin-command.php +++ b/admin-command.php @@ -8,9 +8,15 @@ * Open /wp-admin/ in a browser. */ $wp_admin = function() { - $exec = 'xdg-open'; - if ( 'DAR' === strtoupper( substr( PHP_OS, 0, 3 ) ) ) { - $exec = 'open'; + switch ( strtoupper( substr( PHP_OS, 0, 3 ) ) ) { + case 'DAR': + $exec = 'open'; + break; + case 'WIN': + $exec = 'start ""'; + break; + default: + $exec = 'xdg-open'; } passthru( $exec . ' ' . escapeshellarg( admin_url() ) ); };