/** * Tries to guess the install path to the provided program. * @access public * @param string $program The program to check for. * @return string */ public static function guess_path($program) { $os = Revisr_Compatibility::get_os(); $program = Revisr_Admin::escapeshellarg($program); if ($os['code'] !== 'WIN') { $path = exec("which {$program}"); } else { $path = exec("where {$program}"); } if ($path) { return $path; } else { return __('Not Found', 'revisr'); } }
/** * Tests the get_os() method. */ function test_get_os() { $os = Revisr_Compatibility::get_os(); $this->assertArrayHasKey('code', $os); $this->assertArrayHasKey('name', $os); }
/** * Escapes a shell arguement. * @access public * @param string $string The string to escape. * @return string $string The escaped string. */ public static function escapeshellarg($string) { $os = Revisr_Compatibility::get_os(); if ('WIN' !== $os['code']) { return escapeshellarg($string); } else { // Windows-friendly workaround. return '"' . str_replace("'", "'\\''", $string) . '"'; } }
_e('Found a bug or have a feature request? Please open an issue on <a href="https://github.com/ExpandedFronts/revisr" target="_blank">GitHub</a>!', 'revisr'); ?> </p> <table id="revisr-debug-table" class="wp-list-table widefat fixed striped"> <tbody> <tr> <td><label><strong><?php _e('Operating System', 'revisr'); ?> </strong></label></td> <td> <?php $os = Revisr_Compatibility::get_os(); echo $os['name']; ?> </td> </tr> <tr> <td><label><strong><?php _e('Exec() Enabled', 'revisr'); ?> </strong></label></td> <td><?php echo Revisr_Compatibility::server_has_exec(); ?> </td> </tr>