Skip to content

Commit

Permalink
Merge pull request #18 from kingkero/windows-combability
Browse files Browse the repository at this point in the history
change to switch, add option for windows systems
  • Loading branch information
schlessera authored Nov 15, 2018
2 parents e8e2582 + 0c0995f commit 94a93b0
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions admin-command.php
Original file line number Diff line number Diff line change
Expand Up @@ -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() ) );
};
Expand Down

0 comments on commit 94a93b0

Please sign in to comment.