This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License, version 2, as
    published by the Free Software Foundation.
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.
    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
*/
class Gitium_Requirements {
	private $req = array();
	private $msg = array();
	/**
	 * Gitium requires:
	 * git min version
	 * the function proc_open available
	 * PHP min version
	 * can exec the file inc/ssh-git
	 */
	public function __construct() {
		$this->_check_req();
		add_action( GITIUM_ADMIN_NOTICES_ACTION, array( $this, 'admin_notices' ) );
	}
	private function _check_req() {
		list($this->req['is_git_version'],       $this->msg['is_git_version']       ) = $this->is_git_version();
		list($this->req['is_proc_open'],         $this->msg['is_proc_open']         ) = $this->is_proc_open();
		list($this->req['is_php_verion'],        $this->msg['is_php_verion']        ) = $this->is_php_version();
		list($this->req['can_exec_ssh_git_file'],$this->msg['can_exec_ssh_git_file']) = $this->can_exec_ssh_git_file();
		return $this->req;
	}
	public function admin_notices() {
		if ( ! current_user_can( GITIUM_MANAGE_OPTIONS_CAPABILITY ) ) {
			return;
		}
		foreach ( $this->req as $key => $value ) {
			if ( false === $value ) {
				echo "
Gitium Requirement: {$this->msg[$key]}