public static function escapeShellArgument( $argument )
    {
        $escapeChar = self::instance()->ShellEscapeCharacter;
        if ( $escapeChar == "'" )
        {
            $argument = str_replace( "'", "'\\''", $argument );
        }
        else
        {
            $argument = str_replace( $escapeChar, "\\" . $escapeChar, addcslashes( $argument, '\\' ) );
        }
        return $escapeChar . $argument . $escapeChar;
    }