/** * 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 server_has_exec() method. */ function test_server_has_exec() { $this->assertEquals('true', Revisr_Compatibility::server_has_exec()); }
/** * 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) . '"'; } }
<p><?php _e('Support is available on the <a href="https://wordpress.org/support/plugin/revisr" target="_blank">plugin support forums</a>.', 'revisr'); ?> </p> <p><?php _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> </form> <form class="revisr-settings-form" action="<?php echo esc_url(admin_url('admin-post.php')); ?> " method="post"> <textarea readonly="readonly" onclick="this.focus(); this.select()" style="width:750px;height:500px;font-family:Menlo,Monaco,monospace;" name='revisr-sysinfo'><?php echo Revisr_Compatibility::get_sysinfo(); ?> </textarea> <p class="submit"> <input type="hidden" name="action" value="revisr_download_sysinfo" /> <?php wp_nonce_field('process_download_sysinfo', 'revisr_info_nonce'); ?> <?php submit_button('Download System Info', 'primary', 'revisr-download-sysinfo', false); ?> <?php if (revisr()->git->is_repo) { $status_text = __('View Status', 'revisr'); $status_nonce = wp_create_nonce('revisr_view_status'); printf('<a href="%s" title="%s" class="button thickbox">%s</a>', get_admin_url() . 'admin-post.php?action=process_view_status&revisr_status_nonce=' . $status_nonce . '&TB_iframe=true', $status_text, $status_text);
echo Revisr_Compatibility::guess_path('mysql'); ?> </td> </tr> <?php if ($revisr->git->is_repo) { ?> <tr> <td><label><strong><?php _e('File Permissions', 'revisr'); ?> </strong></label></td> <td><?php echo Revisr_Compatibility::server_has_permissions($revisr->git->get_git_dir()); ?> </td> </tr> <tr> <td><label><strong><?php _e('Repository Path', 'revisr'); ?> </strong></label></td> <td><?php echo $revisr->git->get_git_dir(); ?> </td> </tr>