Test Failed
Push — master ( dc11f8...b6268a )
by Stiofan
54s
created
geodirectory-admin/google-api-php-client/src/Google/Http/Batch.php 2 patches
Indentation   +82 added lines, -82 removed lines patch added patch discarded remove patch
@@ -41,105 +41,105 @@
 block discarded – undo
41 41
 
42 42
   public function __construct(Google_Client $client, $boundary = false, $rootUrl = '', $batchPath = '')
43 43
   {
44
-    $this->client = $client;
45
-    $this->root_url = rtrim($rootUrl ? $rootUrl : $this->client->getBasePath(), '/');
46
-    $this->batch_path = $batchPath ? $batchPath : 'batch';
47
-    $this->expected_classes = array();
48
-    $boundary = (false == $boundary) ? mt_rand() : $boundary;
49
-    $this->boundary = str_replace('"', '', $boundary);
44
+	$this->client = $client;
45
+	$this->root_url = rtrim($rootUrl ? $rootUrl : $this->client->getBasePath(), '/');
46
+	$this->batch_path = $batchPath ? $batchPath : 'batch';
47
+	$this->expected_classes = array();
48
+	$boundary = (false == $boundary) ? mt_rand() : $boundary;
49
+	$this->boundary = str_replace('"', '', $boundary);
50 50
   }
51 51
 
52 52
   public function add(Google_Http_Request $request, $key = false)
53 53
   {
54
-    if (false == $key) {
55
-      $key = mt_rand();
56
-    }
54
+	if (false == $key) {
55
+	  $key = mt_rand();
56
+	}
57 57
 
58
-    $this->requests[$key] = $request;
58
+	$this->requests[$key] = $request;
59 59
   }
60 60
 
61 61
   public function execute()
62 62
   {
63
-    $body = '';
63
+	$body = '';
64 64
 
65
-    /** @var Google_Http_Request $req */
66
-    foreach ($this->requests as $key => $req) {
67
-      $body .= "--{$this->boundary}\n";
68
-      $body .= $req->toBatchString($key) . "\n\n";
69
-      $this->expected_classes["response-" . $key] = $req->getExpectedClass();
70
-    }
65
+	/** @var Google_Http_Request $req */
66
+	foreach ($this->requests as $key => $req) {
67
+	  $body .= "--{$this->boundary}\n";
68
+	  $body .= $req->toBatchString($key) . "\n\n";
69
+	  $this->expected_classes["response-" . $key] = $req->getExpectedClass();
70
+	}
71 71
 
72
-    $body .= "--{$this->boundary}--";
72
+	$body .= "--{$this->boundary}--";
73 73
 
74
-    $url = $this->root_url . '/' . $this->batch_path;
75
-    $httpRequest = new Google_Http_Request($url, 'POST');
76
-    $httpRequest->setRequestHeaders(
77
-        array('Content-Type' => 'multipart/mixed; boundary=' . $this->boundary)
78
-    );
74
+	$url = $this->root_url . '/' . $this->batch_path;
75
+	$httpRequest = new Google_Http_Request($url, 'POST');
76
+	$httpRequest->setRequestHeaders(
77
+		array('Content-Type' => 'multipart/mixed; boundary=' . $this->boundary)
78
+	);
79 79
 
80
-    $httpRequest->setPostBody($body);
81
-    $response = $this->client->getIo()->makeRequest($httpRequest);
80
+	$httpRequest->setPostBody($body);
81
+	$response = $this->client->getIo()->makeRequest($httpRequest);
82 82
 
83
-    return $this->parseResponse($response);
83
+	return $this->parseResponse($response);
84 84
   }
85 85
 
86 86
   public function parseResponse(Google_Http_Request $response)
87 87
   {
88
-    $contentType = $response->getResponseHeader('content-type');
89
-    $contentType = explode(';', $contentType);
90
-    $boundary = false;
91
-    foreach ($contentType as $part) {
92
-      $part = (explode('=', $part, 2));
93
-      if (isset($part[0]) && 'boundary' == trim($part[0])) {
94
-        $boundary = $part[1];
95
-      }
96
-    }
97
-
98
-    $body = $response->getResponseBody();
99
-    if ($body) {
100
-      $body = str_replace("--$boundary--", "--$boundary", $body);
101
-      $parts = explode("--$boundary", $body);
102
-      $responses = array();
103
-
104
-      foreach ($parts as $part) {
105
-        $part = trim($part);
106
-        if (!empty($part)) {
107
-          list($metaHeaders, $part) = explode("\r\n\r\n", $part, 2);
108
-          $metaHeaders = $this->client->getIo()->getHttpResponseHeaders($metaHeaders);
109
-
110
-          $status = substr($part, 0, strpos($part, "\n"));
111
-          $status = explode(" ", $status);
112
-          $status = $status[1];
113
-
114
-          list($partHeaders, $partBody) = $this->client->getIo()->ParseHttpResponse($part, false);
115
-          $response = new Google_Http_Request("");
116
-          $response->setResponseHttpCode($status);
117
-          $response->setResponseHeaders($partHeaders);
118
-          $response->setResponseBody($partBody);
119
-
120
-          // Need content id.
121
-          $key = $metaHeaders['content-id'];
122
-
123
-          if (isset($this->expected_classes[$key]) &&
124
-              strlen($this->expected_classes[$key]) > 0) {
125
-            $class = $this->expected_classes[$key];
126
-            $response->setExpectedClass($class);
127
-          }
128
-
129
-          try {
130
-            $response = Google_Http_REST::decodeHttpResponse($response, $this->client);
131
-            $responses[$key] = $response;
132
-          } catch (Google_Service_Exception $e) {
133
-            // Store the exception as the response, so successful responses
134
-            // can be processed.
135
-            $responses[$key] = $e;
136
-          }
137
-        }
138
-      }
139
-
140
-      return $responses;
141
-    }
142
-
143
-    return null;
88
+	$contentType = $response->getResponseHeader('content-type');
89
+	$contentType = explode(';', $contentType);
90
+	$boundary = false;
91
+	foreach ($contentType as $part) {
92
+	  $part = (explode('=', $part, 2));
93
+	  if (isset($part[0]) && 'boundary' == trim($part[0])) {
94
+		$boundary = $part[1];
95
+	  }
96
+	}
97
+
98
+	$body = $response->getResponseBody();
99
+	if ($body) {
100
+	  $body = str_replace("--$boundary--", "--$boundary", $body);
101
+	  $parts = explode("--$boundary", $body);
102
+	  $responses = array();
103
+
104
+	  foreach ($parts as $part) {
105
+		$part = trim($part);
106
+		if (!empty($part)) {
107
+		  list($metaHeaders, $part) = explode("\r\n\r\n", $part, 2);
108
+		  $metaHeaders = $this->client->getIo()->getHttpResponseHeaders($metaHeaders);
109
+
110
+		  $status = substr($part, 0, strpos($part, "\n"));
111
+		  $status = explode(" ", $status);
112
+		  $status = $status[1];
113
+
114
+		  list($partHeaders, $partBody) = $this->client->getIo()->ParseHttpResponse($part, false);
115
+		  $response = new Google_Http_Request("");
116
+		  $response->setResponseHttpCode($status);
117
+		  $response->setResponseHeaders($partHeaders);
118
+		  $response->setResponseBody($partBody);
119
+
120
+		  // Need content id.
121
+		  $key = $metaHeaders['content-id'];
122
+
123
+		  if (isset($this->expected_classes[$key]) &&
124
+			  strlen($this->expected_classes[$key]) > 0) {
125
+			$class = $this->expected_classes[$key];
126
+			$response->setExpectedClass($class);
127
+		  }
128
+
129
+		  try {
130
+			$response = Google_Http_REST::decodeHttpResponse($response, $this->client);
131
+			$responses[$key] = $response;
132
+		  } catch (Google_Service_Exception $e) {
133
+			// Store the exception as the response, so successful responses
134
+			// can be processed.
135
+			$responses[$key] = $e;
136
+		  }
137
+		}
138
+	  }
139
+
140
+	  return $responses;
141
+	}
142
+
143
+	return null;
144 144
   }
145 145
 }
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
  */
17 17
 
18 18
 if (!class_exists('Google_Client')) {
19
-  require_once dirname(__FILE__) . '/../autoload.php';
19
+  require_once dirname(__FILE__).'/../autoload.php';
20 20
 }
21 21
 
22 22
 /**
@@ -65,16 +65,16 @@  discard block
 block discarded – undo
65 65
     /** @var Google_Http_Request $req */
66 66
     foreach ($this->requests as $key => $req) {
67 67
       $body .= "--{$this->boundary}\n";
68
-      $body .= $req->toBatchString($key) . "\n\n";
69
-      $this->expected_classes["response-" . $key] = $req->getExpectedClass();
68
+      $body .= $req->toBatchString($key)."\n\n";
69
+      $this->expected_classes["response-".$key] = $req->getExpectedClass();
70 70
     }
71 71
 
72 72
     $body .= "--{$this->boundary}--";
73 73
 
74
-    $url = $this->root_url . '/' . $this->batch_path;
74
+    $url = $this->root_url.'/'.$this->batch_path;
75 75
     $httpRequest = new Google_Http_Request($url, 'POST');
76 76
     $httpRequest->setRequestHeaders(
77
-        array('Content-Type' => 'multipart/mixed; boundary=' . $this->boundary)
77
+        array('Content-Type' => 'multipart/mixed; boundary='.$this->boundary)
78 78
     );
79 79
 
80 80
     $httpRequest->setPostBody($body);
Please login to merge, or discard this patch.
geodirectory-admin/google-api-php-client/src/Google/Http/REST.php 2 patches
Indentation   +89 added lines, -89 removed lines patch added patch discarded remove patch
@@ -36,14 +36,14 @@  discard block
 block discarded – undo
36 36
    */
37 37
   public static function execute(Google_Client $client, Google_Http_Request $req)
38 38
   {
39
-    $runner = new Google_Task_Runner(
40
-        $client,
41
-        sprintf('%s %s', $req->getRequestMethod(), $req->getUrl()),
42
-        array(get_class(), 'doExecute'),
43
-        array($client, $req)
44
-    );
39
+	$runner = new Google_Task_Runner(
40
+		$client,
41
+		sprintf('%s %s', $req->getRequestMethod(), $req->getUrl()),
42
+		array(get_class(), 'doExecute'),
43
+		array($client, $req)
44
+	);
45 45
 
46
-    return $runner->run();
46
+	return $runner->run();
47 47
   }
48 48
 
49 49
   /**
@@ -57,9 +57,9 @@  discard block
 block discarded – undo
57 57
    */
58 58
   public static function doExecute(Google_Client $client, Google_Http_Request $req)
59 59
   {
60
-    $httpRequest = $client->getIo()->makeRequest($req);
61
-    $httpRequest->setExpectedClass($req->getExpectedClass());
62
-    return self::decodeHttpResponse($httpRequest, $client);
60
+	$httpRequest = $client->getIo()->makeRequest($req);
61
+	$httpRequest->setExpectedClass($req->getExpectedClass());
62
+	return self::decodeHttpResponse($httpRequest, $client);
63 63
   }
64 64
 
65 65
   /**
@@ -72,65 +72,65 @@  discard block
 block discarded – undo
72 72
    */
73 73
   public static function decodeHttpResponse($response, Google_Client $client = null)
74 74
   {
75
-    $code = $response->getResponseHttpCode();
76
-    $body = $response->getResponseBody();
77
-    $decoded = null;
75
+	$code = $response->getResponseHttpCode();
76
+	$body = $response->getResponseBody();
77
+	$decoded = null;
78 78
 
79
-    if ((intVal($code)) >= 300) {
80
-      $decoded = json_decode($body, true);
81
-      $err = 'Error calling ' . $response->getRequestMethod() . ' ' . $response->getUrl();
82
-      if (isset($decoded['error']) &&
83
-          isset($decoded['error']['message'])  &&
84
-          isset($decoded['error']['code'])) {
85
-        // if we're getting a json encoded error definition, use that instead of the raw response
86
-        // body for improved readability
87
-        $err .= ": ({$decoded['error']['code']}) {$decoded['error']['message']}";
88
-      } else {
89
-        $err .= ": ($code) $body";
90
-      }
79
+	if ((intVal($code)) >= 300) {
80
+	  $decoded = json_decode($body, true);
81
+	  $err = 'Error calling ' . $response->getRequestMethod() . ' ' . $response->getUrl();
82
+	  if (isset($decoded['error']) &&
83
+		  isset($decoded['error']['message'])  &&
84
+		  isset($decoded['error']['code'])) {
85
+		// if we're getting a json encoded error definition, use that instead of the raw response
86
+		// body for improved readability
87
+		$err .= ": ({$decoded['error']['code']}) {$decoded['error']['message']}";
88
+	  } else {
89
+		$err .= ": ($code) $body";
90
+	  }
91 91
 
92
-      $errors = null;
93
-      // Specific check for APIs which don't return error details, such as Blogger.
94
-      if (isset($decoded['error']) && isset($decoded['error']['errors'])) {
95
-        $errors = $decoded['error']['errors'];
96
-      }
92
+	  $errors = null;
93
+	  // Specific check for APIs which don't return error details, such as Blogger.
94
+	  if (isset($decoded['error']) && isset($decoded['error']['errors'])) {
95
+		$errors = $decoded['error']['errors'];
96
+	  }
97 97
 
98
-      $map = null;
99
-      if ($client) {
100
-        $client->getLogger()->error(
101
-            $err,
102
-            array('code' => $code, 'errors' => $errors)
103
-        );
98
+	  $map = null;
99
+	  if ($client) {
100
+		$client->getLogger()->error(
101
+			$err,
102
+			array('code' => $code, 'errors' => $errors)
103
+		);
104 104
 
105
-        $map = $client->getClassConfig(
106
-            'Google_Service_Exception',
107
-            'retry_map'
108
-        );
109
-      }
110
-      throw new Google_Service_Exception($err, $code, null, $errors, $map);
111
-    }
105
+		$map = $client->getClassConfig(
106
+			'Google_Service_Exception',
107
+			'retry_map'
108
+		);
109
+	  }
110
+	  throw new Google_Service_Exception($err, $code, null, $errors, $map);
111
+	}
112 112
 
113
-    // Only attempt to decode the response, if the response code wasn't (204) 'no content'
114
-    if ($code != '204') {
115
-      if ($response->getExpectedRaw()) {
116
-        return $body;
117
-      }
113
+	// Only attempt to decode the response, if the response code wasn't (204) 'no content'
114
+	if ($code != '204') {
115
+	  if ($response->getExpectedRaw()) {
116
+		return $body;
117
+	  }
118 118
       
119
-      $decoded = json_decode($body, true);
120
-      if ($decoded === null || $decoded === "") {
121
-        $error = "Invalid json in service response: $body";
122
-        if ($client) {
123
-          $client->getLogger()->error($error);
124
-        }
125
-        throw new Google_Service_Exception($error);
126
-      }
119
+	  $decoded = json_decode($body, true);
120
+	  if ($decoded === null || $decoded === "") {
121
+		$error = "Invalid json in service response: $body";
122
+		if ($client) {
123
+		  $client->getLogger()->error($error);
124
+		}
125
+		throw new Google_Service_Exception($error);
126
+	  }
127 127
 
128
-      if ($response->getExpectedClass()) {
129
-        $class = $response->getExpectedClass();
130
-        $decoded = new $class($decoded);
131
-      }
132
-    }
133
-    return $decoded;
128
+	  if ($response->getExpectedClass()) {
129
+		$class = $response->getExpectedClass();
130
+		$decoded = new $class($decoded);
131
+	  }
132
+	}
133
+	return $decoded;
134 134
   }
135 135
 
136 136
   /**
@@ -144,35 +144,35 @@  discard block
 block discarded – undo
144 144
    */
145 145
   public static function createRequestUri($servicePath, $restPath, $params)
146 146
   {
147
-    $requestUrl = $servicePath . $restPath;
148
-    $uriTemplateVars = array();
149
-    $queryVars = array();
150
-    foreach ($params as $paramName => $paramSpec) {
151
-      if ($paramSpec['type'] == 'boolean') {
152
-        $paramSpec['value'] = ($paramSpec['value']) ? 'true' : 'false';
153
-      }
154
-      if ($paramSpec['location'] == 'path') {
155
-        $uriTemplateVars[$paramName] = $paramSpec['value'];
156
-      } else if ($paramSpec['location'] == 'query') {
157
-        if (isset($paramSpec['repeated']) && is_array($paramSpec['value'])) {
158
-          foreach ($paramSpec['value'] as $value) {
159
-            $queryVars[] = $paramName . '=' . rawurlencode(rawurldecode($value));
160
-          }
161
-        } else {
162
-          $queryVars[] = $paramName . '=' . rawurlencode(rawurldecode($paramSpec['value']));
163
-        }
164
-      }
165
-    }
147
+	$requestUrl = $servicePath . $restPath;
148
+	$uriTemplateVars = array();
149
+	$queryVars = array();
150
+	foreach ($params as $paramName => $paramSpec) {
151
+	  if ($paramSpec['type'] == 'boolean') {
152
+		$paramSpec['value'] = ($paramSpec['value']) ? 'true' : 'false';
153
+	  }
154
+	  if ($paramSpec['location'] == 'path') {
155
+		$uriTemplateVars[$paramName] = $paramSpec['value'];
156
+	  } else if ($paramSpec['location'] == 'query') {
157
+		if (isset($paramSpec['repeated']) && is_array($paramSpec['value'])) {
158
+		  foreach ($paramSpec['value'] as $value) {
159
+			$queryVars[] = $paramName . '=' . rawurlencode(rawurldecode($value));
160
+		  }
161
+		} else {
162
+		  $queryVars[] = $paramName . '=' . rawurlencode(rawurldecode($paramSpec['value']));
163
+		}
164
+	  }
165
+	}
166 166
 
167
-    if (count($uriTemplateVars)) {
168
-      $uriTemplateParser = new Google_Utils_URITemplate();
169
-      $requestUrl = $uriTemplateParser->parse($requestUrl, $uriTemplateVars);
170
-    }
167
+	if (count($uriTemplateVars)) {
168
+	  $uriTemplateParser = new Google_Utils_URITemplate();
169
+	  $requestUrl = $uriTemplateParser->parse($requestUrl, $uriTemplateVars);
170
+	}
171 171
 
172
-    if (count($queryVars)) {
173
-      $requestUrl .= '?' . implode($queryVars, '&');
174
-    }
172
+	if (count($queryVars)) {
173
+	  $requestUrl .= '?' . implode($queryVars, '&');
174
+	}
175 175
 
176
-    return $requestUrl;
176
+	return $requestUrl;
177 177
   }
178 178
 }
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
  */
17 17
 
18 18
 if (!class_exists('Google_Client')) {
19
-  require_once dirname(__FILE__) . '/../autoload.php';
19
+  require_once dirname(__FILE__).'/../autoload.php';
20 20
 }
21 21
 
22 22
 /**
@@ -78,9 +78,9 @@  discard block
 block discarded – undo
78 78
 
79 79
     if ((intVal($code)) >= 300) {
80 80
       $decoded = json_decode($body, true);
81
-      $err = 'Error calling ' . $response->getRequestMethod() . ' ' . $response->getUrl();
81
+      $err = 'Error calling '.$response->getRequestMethod().' '.$response->getUrl();
82 82
       if (isset($decoded['error']) &&
83
-          isset($decoded['error']['message'])  &&
83
+          isset($decoded['error']['message']) &&
84 84
           isset($decoded['error']['code'])) {
85 85
         // if we're getting a json encoded error definition, use that instead of the raw response
86 86
         // body for improved readability
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
    */
145 145
   public static function createRequestUri($servicePath, $restPath, $params)
146 146
   {
147
-    $requestUrl = $servicePath . $restPath;
147
+    $requestUrl = $servicePath.$restPath;
148 148
     $uriTemplateVars = array();
149 149
     $queryVars = array();
150 150
     foreach ($params as $paramName => $paramSpec) {
@@ -156,10 +156,10 @@  discard block
 block discarded – undo
156 156
       } else if ($paramSpec['location'] == 'query') {
157 157
         if (isset($paramSpec['repeated']) && is_array($paramSpec['value'])) {
158 158
           foreach ($paramSpec['value'] as $value) {
159
-            $queryVars[] = $paramName . '=' . rawurlencode(rawurldecode($value));
159
+            $queryVars[] = $paramName.'='.rawurlencode(rawurldecode($value));
160 160
           }
161 161
         } else {
162
-          $queryVars[] = $paramName . '=' . rawurlencode(rawurldecode($paramSpec['value']));
162
+          $queryVars[] = $paramName.'='.rawurlencode(rawurldecode($paramSpec['value']));
163 163
         }
164 164
       }
165 165
     }
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
     }
171 171
 
172 172
     if (count($queryVars)) {
173
-      $requestUrl .= '?' . implode($queryVars, '&');
173
+      $requestUrl .= '?'.implode($queryVars, '&');
174 174
     }
175 175
 
176 176
     return $requestUrl;
Please login to merge, or discard this patch.
geodirectory-admin/google-api-php-client/src/Google/IO/Curl.php 2 patches
Indentation   +92 added lines, -92 removed lines patch added patch discarded remove patch
@@ -34,13 +34,13 @@  discard block
 block discarded – undo
34 34
 
35 35
   public function __construct(Google_Client $client)
36 36
   {
37
-    if (!extension_loaded('curl')) {
38
-      $error = 'The cURL IO handler requires the cURL extension to be enabled';
39
-      $client->getLogger()->critical($error);
40
-      throw new Google_IO_Exception($error);
41
-    }
37
+	if (!extension_loaded('curl')) {
38
+	  $error = 'The cURL IO handler requires the cURL extension to be enabled';
39
+	  $client->getLogger()->critical($error);
40
+	  throw new Google_IO_Exception($error);
41
+	}
42 42
 
43
-    parent::__construct($client);
43
+	parent::__construct($client);
44 44
   }
45 45
 
46 46
   /**
@@ -52,83 +52,83 @@  discard block
 block discarded – undo
52 52
    */
53 53
   public function executeRequest(Google_Http_Request $request)
54 54
   {
55
-    $curl = curl_init();
56
-
57
-    if ($request->getPostBody()) {
58
-      curl_setopt($curl, CURLOPT_POSTFIELDS, $request->getPostBody());
59
-    }
60
-
61
-    $requestHeaders = $request->getRequestHeaders();
62
-    if ($requestHeaders && is_array($requestHeaders)) {
63
-      $curlHeaders = array();
64
-      foreach ($requestHeaders as $k => $v) {
65
-        $curlHeaders[] = "$k: $v";
66
-      }
67
-      curl_setopt($curl, CURLOPT_HTTPHEADER, $curlHeaders);
68
-    }
69
-    curl_setopt($curl, CURLOPT_URL, $request->getUrl());
70
-
71
-    curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $request->getRequestMethod());
72
-    curl_setopt($curl, CURLOPT_USERAGENT, $request->getUserAgent());
73
-
74
-    curl_setopt($curl, CURLOPT_FOLLOWLOCATION, false);
75
-    curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, true);
76
-    // 1 is CURL_SSLVERSION_TLSv1, which is not always defined in PHP.
77
-    curl_setopt($curl, CURLOPT_SSLVERSION, 1);
78
-    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
79
-    curl_setopt($curl, CURLOPT_HEADER, true);
80
-
81
-    if ($request->canGzip()) {
82
-      curl_setopt($curl, CURLOPT_ENCODING, 'gzip,deflate');
83
-    }
55
+	$curl = curl_init();
56
+
57
+	if ($request->getPostBody()) {
58
+	  curl_setopt($curl, CURLOPT_POSTFIELDS, $request->getPostBody());
59
+	}
60
+
61
+	$requestHeaders = $request->getRequestHeaders();
62
+	if ($requestHeaders && is_array($requestHeaders)) {
63
+	  $curlHeaders = array();
64
+	  foreach ($requestHeaders as $k => $v) {
65
+		$curlHeaders[] = "$k: $v";
66
+	  }
67
+	  curl_setopt($curl, CURLOPT_HTTPHEADER, $curlHeaders);
68
+	}
69
+	curl_setopt($curl, CURLOPT_URL, $request->getUrl());
70
+
71
+	curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $request->getRequestMethod());
72
+	curl_setopt($curl, CURLOPT_USERAGENT, $request->getUserAgent());
73
+
74
+	curl_setopt($curl, CURLOPT_FOLLOWLOCATION, false);
75
+	curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, true);
76
+	// 1 is CURL_SSLVERSION_TLSv1, which is not always defined in PHP.
77
+	curl_setopt($curl, CURLOPT_SSLVERSION, 1);
78
+	curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
79
+	curl_setopt($curl, CURLOPT_HEADER, true);
80
+
81
+	if ($request->canGzip()) {
82
+	  curl_setopt($curl, CURLOPT_ENCODING, 'gzip,deflate');
83
+	}
84 84
     
85
-    $options = $this->client->getClassConfig('Google_IO_Curl', 'options');
86
-    if (is_array($options)) {
87
-      $this->setOptions($options);
88
-    }
85
+	$options = $this->client->getClassConfig('Google_IO_Curl', 'options');
86
+	if (is_array($options)) {
87
+	  $this->setOptions($options);
88
+	}
89 89
     
90
-    foreach ($this->options as $key => $var) {
91
-      curl_setopt($curl, $key, $var);
92
-    }
93
-
94
-    if (!isset($this->options[CURLOPT_CAINFO])) {
95
-      curl_setopt($curl, CURLOPT_CAINFO, dirname(__FILE__) . '/cacerts.pem');
96
-    }
97
-
98
-    $this->client->getLogger()->debug(
99
-        'cURL request',
100
-        array(
101
-            'url' => $request->getUrl(),
102
-            'method' => $request->getRequestMethod(),
103
-            'headers' => $requestHeaders,
104
-            'body' => $request->getPostBody()
105
-        )
106
-    );
107
-
108
-    $response = curl_exec($curl);
109
-    if ($response === false) {
110
-      $error = curl_error($curl);
111
-      $code = curl_errno($curl);
112
-      $map = $this->client->getClassConfig('Google_IO_Exception', 'retry_map');
113
-
114
-      $this->client->getLogger()->error('cURL ' . $error);
115
-      throw new Google_IO_Exception($error, $code, null, $map);
116
-    }
117
-    $headerSize = curl_getinfo($curl, CURLINFO_HEADER_SIZE);
118
-
119
-    list($responseHeaders, $responseBody) = $this->parseHttpResponse($response, $headerSize);
120
-    $responseCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
121
-
122
-    $this->client->getLogger()->debug(
123
-        'cURL response',
124
-        array(
125
-            'code' => $responseCode,
126
-            'headers' => $responseHeaders,
127
-            'body' => $responseBody,
128
-        )
129
-    );
130
-
131
-    return array($responseBody, $responseHeaders, $responseCode);
90
+	foreach ($this->options as $key => $var) {
91
+	  curl_setopt($curl, $key, $var);
92
+	}
93
+
94
+	if (!isset($this->options[CURLOPT_CAINFO])) {
95
+	  curl_setopt($curl, CURLOPT_CAINFO, dirname(__FILE__) . '/cacerts.pem');
96
+	}
97
+
98
+	$this->client->getLogger()->debug(
99
+		'cURL request',
100
+		array(
101
+			'url' => $request->getUrl(),
102
+			'method' => $request->getRequestMethod(),
103
+			'headers' => $requestHeaders,
104
+			'body' => $request->getPostBody()
105
+		)
106
+	);
107
+
108
+	$response = curl_exec($curl);
109
+	if ($response === false) {
110
+	  $error = curl_error($curl);
111
+	  $code = curl_errno($curl);
112
+	  $map = $this->client->getClassConfig('Google_IO_Exception', 'retry_map');
113
+
114
+	  $this->client->getLogger()->error('cURL ' . $error);
115
+	  throw new Google_IO_Exception($error, $code, null, $map);
116
+	}
117
+	$headerSize = curl_getinfo($curl, CURLINFO_HEADER_SIZE);
118
+
119
+	list($responseHeaders, $responseBody) = $this->parseHttpResponse($response, $headerSize);
120
+	$responseCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
121
+
122
+	$this->client->getLogger()->debug(
123
+		'cURL response',
124
+		array(
125
+			'code' => $responseCode,
126
+			'headers' => $responseHeaders,
127
+			'body' => $responseBody,
128
+		)
129
+	);
130
+
131
+	return array($responseBody, $responseHeaders, $responseCode);
132 132
   }
133 133
 
134 134
   /**
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
    */
138 138
   public function setOptions($options)
139 139
   {
140
-    $this->options = $options + $this->options;
140
+	$this->options = $options + $this->options;
141 141
   }
142 142
 
143 143
   /**
@@ -146,12 +146,12 @@  discard block
 block discarded – undo
146 146
    */
147 147
   public function setTimeout($timeout)
148 148
   {
149
-    // Since this timeout is really for putting a bound on the time
150
-    // we'll set them both to the same. If you need to specify a longer
151
-    // CURLOPT_TIMEOUT, or a higher CONNECTTIMEOUT, the best thing to
152
-    // do is use the setOptions method for the values individually.
153
-    $this->options[CURLOPT_CONNECTTIMEOUT] = $timeout;
154
-    $this->options[CURLOPT_TIMEOUT] = $timeout;
149
+	// Since this timeout is really for putting a bound on the time
150
+	// we'll set them both to the same. If you need to specify a longer
151
+	// CURLOPT_TIMEOUT, or a higher CONNECTTIMEOUT, the best thing to
152
+	// do is use the setOptions method for the values individually.
153
+	$this->options[CURLOPT_CONNECTTIMEOUT] = $timeout;
154
+	$this->options[CURLOPT_TIMEOUT] = $timeout;
155 155
   }
156 156
 
157 157
   /**
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
    */
161 161
   public function getTimeout()
162 162
   {
163
-    return $this->options[CURLOPT_TIMEOUT];
163
+	return $this->options[CURLOPT_TIMEOUT];
164 164
   }
165 165
 
166 166
   /**
@@ -172,8 +172,8 @@  discard block
 block discarded – undo
172 172
    */
173 173
   protected function needsQuirk()
174 174
   {
175
-    $ver = curl_version();
176
-    $versionNum = $ver['version_number'];
177
-    return $versionNum < Google_IO_Curl::NO_QUIRK_VERSION;
175
+	$ver = curl_version();
176
+	$versionNum = $ver['version_number'];
177
+	return $versionNum < Google_IO_Curl::NO_QUIRK_VERSION;
178 178
   }
179 179
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
  */
23 23
 
24 24
 if (!class_exists('Google_Client')) {
25
-  require_once dirname(__FILE__) . '/../autoload.php';
25
+  require_once dirname(__FILE__).'/../autoload.php';
26 26
 }
27 27
 
28 28
 class Google_IO_Curl extends Google_IO_Abstract
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
     }
93 93
 
94 94
     if (!isset($this->options[CURLOPT_CAINFO])) {
95
-      curl_setopt($curl, CURLOPT_CAINFO, dirname(__FILE__) . '/cacerts.pem');
95
+      curl_setopt($curl, CURLOPT_CAINFO, dirname(__FILE__).'/cacerts.pem');
96 96
     }
97 97
 
98 98
     $this->client->getLogger()->debug(
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
       $code = curl_errno($curl);
112 112
       $map = $this->client->getClassConfig('Google_IO_Exception', 'retry_map');
113 113
 
114
-      $this->client->getLogger()->error('cURL ' . $error);
114
+      $this->client->getLogger()->error('cURL '.$error);
115 115
       throw new Google_IO_Exception($error, $code, null, $map);
116 116
     }
117 117
     $headerSize = curl_getinfo($curl, CURLINFO_HEADER_SIZE);
Please login to merge, or discard this patch.
geodirectory-admin/google-api-php-client/src/Google/IO/Stream.php 2 patches
Indentation   +140 added lines, -140 removed lines patch added patch discarded remove patch
@@ -34,24 +34,24 @@  discard block
 block discarded – undo
34 34
   private $trappedErrorString;
35 35
 
36 36
   private static $DEFAULT_HTTP_CONTEXT = array(
37
-    "follow_location" => 0,
38
-    "ignore_errors" => 1,
37
+	"follow_location" => 0,
38
+	"ignore_errors" => 1,
39 39
   );
40 40
 
41 41
   private static $DEFAULT_SSL_CONTEXT = array(
42
-    "verify_peer" => true,
42
+	"verify_peer" => true,
43 43
   );
44 44
 
45 45
   public function __construct(Google_Client $client)
46 46
   {
47
-    if (!ini_get('allow_url_fopen')) {
48
-      $error = 'The stream IO handler requires the allow_url_fopen runtime ' .
49
-               'configuration to be enabled';
50
-      $client->getLogger()->critical($error);
51
-      throw new Google_IO_Exception($error);
52
-    }
53
-
54
-    parent::__construct($client);
47
+	if (!ini_get('allow_url_fopen')) {
48
+	  $error = 'The stream IO handler requires the allow_url_fopen runtime ' .
49
+			   'configuration to be enabled';
50
+	  $client->getLogger()->critical($error);
51
+	  throw new Google_IO_Exception($error);
52
+	}
53
+
54
+	parent::__construct($client);
55 55
   }
56 56
 
57 57
   /**
@@ -63,119 +63,119 @@  discard block
 block discarded – undo
63 63
    */
64 64
   public function executeRequest(Google_Http_Request $request)
65 65
   {
66
-    $default_options = stream_context_get_options(stream_context_get_default());
67
-
68
-    $requestHttpContext = array_key_exists('http', $default_options) ?
69
-        $default_options['http'] : array();
70
-
71
-    if ($request->getPostBody()) {
72
-      $requestHttpContext["content"] = $request->getPostBody();
73
-    }
74
-
75
-    $requestHeaders = $request->getRequestHeaders();
76
-    if ($requestHeaders && is_array($requestHeaders)) {
77
-      $headers = "";
78
-      foreach ($requestHeaders as $k => $v) {
79
-        $headers .= "$k: $v\r\n";
80
-      }
81
-      $requestHttpContext["header"] = $headers;
82
-    }
83
-
84
-    $requestHttpContext["method"] = $request->getRequestMethod();
85
-    $requestHttpContext["user_agent"] = $request->getUserAgent();
86
-
87
-    $requestSslContext = array_key_exists('ssl', $default_options) ?
88
-        $default_options['ssl'] : array();
89
-
90
-    if (!array_key_exists("cafile", $requestSslContext)) {
91
-      $requestSslContext["cafile"] = dirname(__FILE__) . '/cacerts.pem';
92
-    }
93
-
94
-    $options = array(
95
-        "http" => array_merge(
96
-            self::$DEFAULT_HTTP_CONTEXT,
97
-            $requestHttpContext
98
-        ),
99
-        "ssl" => array_merge(
100
-            self::$DEFAULT_SSL_CONTEXT,
101
-            $requestSslContext
102
-        )
103
-    );
104
-
105
-    $context = stream_context_create($options);
106
-
107
-    $url = $request->getUrl();
108
-
109
-    if ($request->canGzip()) {
110
-      $url = self::ZLIB . $url;
111
-    }
112
-
113
-    $this->client->getLogger()->debug(
114
-        'Stream request',
115
-        array(
116
-            'url' => $url,
117
-            'method' => $request->getRequestMethod(),
118
-            'headers' => $requestHeaders,
119
-            'body' => $request->getPostBody()
120
-        )
121
-    );
122
-
123
-    // We are trapping any thrown errors in this method only and
124
-    // throwing an exception.
125
-    $this->trappedErrorNumber = null;
126
-    $this->trappedErrorString = null;
127
-
128
-    // START - error trap.
129
-    set_error_handler(array($this, 'trapError'));
130
-    $fh = fopen($url, 'r', false, $context);
131
-    restore_error_handler();
132
-    // END - error trap.
133
-
134
-    if ($this->trappedErrorNumber) {
135
-      $error = sprintf(
136
-          "HTTP Error: Unable to connect: '%s'",
137
-          $this->trappedErrorString
138
-      );
139
-
140
-      $this->client->getLogger()->error('Stream ' . $error);
141
-      throw new Google_IO_Exception($error, $this->trappedErrorNumber);
142
-    }
143
-
144
-    $response_data = false;
145
-    $respHttpCode = self::UNKNOWN_CODE;
146
-    if ($fh) {
147
-      if (isset($this->options[self::TIMEOUT])) {
148
-        stream_set_timeout($fh, $this->options[self::TIMEOUT]);
149
-      }
150
-
151
-      $response_data = stream_get_contents($fh);
152
-      fclose($fh);
153
-
154
-      $respHttpCode = $this->getHttpResponseCode($http_response_header);
155
-    }
156
-
157
-    if (false === $response_data) {
158
-      $error = sprintf(
159
-          "HTTP Error: Unable to connect: '%s'",
160
-          $respHttpCode
161
-      );
162
-
163
-      $this->client->getLogger()->error('Stream ' . $error);
164
-      throw new Google_IO_Exception($error, $respHttpCode);
165
-    }
166
-
167
-    $responseHeaders = $this->getHttpResponseHeaders($http_response_header);
168
-
169
-    $this->client->getLogger()->debug(
170
-        'Stream response',
171
-        array(
172
-            'code' => $respHttpCode,
173
-            'headers' => $responseHeaders,
174
-            'body' => $response_data,
175
-        )
176
-    );
177
-
178
-    return array($response_data, $responseHeaders, $respHttpCode);
66
+	$default_options = stream_context_get_options(stream_context_get_default());
67
+
68
+	$requestHttpContext = array_key_exists('http', $default_options) ?
69
+		$default_options['http'] : array();
70
+
71
+	if ($request->getPostBody()) {
72
+	  $requestHttpContext["content"] = $request->getPostBody();
73
+	}
74
+
75
+	$requestHeaders = $request->getRequestHeaders();
76
+	if ($requestHeaders && is_array($requestHeaders)) {
77
+	  $headers = "";
78
+	  foreach ($requestHeaders as $k => $v) {
79
+		$headers .= "$k: $v\r\n";
80
+	  }
81
+	  $requestHttpContext["header"] = $headers;
82
+	}
83
+
84
+	$requestHttpContext["method"] = $request->getRequestMethod();
85
+	$requestHttpContext["user_agent"] = $request->getUserAgent();
86
+
87
+	$requestSslContext = array_key_exists('ssl', $default_options) ?
88
+		$default_options['ssl'] : array();
89
+
90
+	if (!array_key_exists("cafile", $requestSslContext)) {
91
+	  $requestSslContext["cafile"] = dirname(__FILE__) . '/cacerts.pem';
92
+	}
93
+
94
+	$options = array(
95
+		"http" => array_merge(
96
+			self::$DEFAULT_HTTP_CONTEXT,
97
+			$requestHttpContext
98
+		),
99
+		"ssl" => array_merge(
100
+			self::$DEFAULT_SSL_CONTEXT,
101
+			$requestSslContext
102
+		)
103
+	);
104
+
105
+	$context = stream_context_create($options);
106
+
107
+	$url = $request->getUrl();
108
+
109
+	if ($request->canGzip()) {
110
+	  $url = self::ZLIB . $url;
111
+	}
112
+
113
+	$this->client->getLogger()->debug(
114
+		'Stream request',
115
+		array(
116
+			'url' => $url,
117
+			'method' => $request->getRequestMethod(),
118
+			'headers' => $requestHeaders,
119
+			'body' => $request->getPostBody()
120
+		)
121
+	);
122
+
123
+	// We are trapping any thrown errors in this method only and
124
+	// throwing an exception.
125
+	$this->trappedErrorNumber = null;
126
+	$this->trappedErrorString = null;
127
+
128
+	// START - error trap.
129
+	set_error_handler(array($this, 'trapError'));
130
+	$fh = fopen($url, 'r', false, $context);
131
+	restore_error_handler();
132
+	// END - error trap.
133
+
134
+	if ($this->trappedErrorNumber) {
135
+	  $error = sprintf(
136
+		  "HTTP Error: Unable to connect: '%s'",
137
+		  $this->trappedErrorString
138
+	  );
139
+
140
+	  $this->client->getLogger()->error('Stream ' . $error);
141
+	  throw new Google_IO_Exception($error, $this->trappedErrorNumber);
142
+	}
143
+
144
+	$response_data = false;
145
+	$respHttpCode = self::UNKNOWN_CODE;
146
+	if ($fh) {
147
+	  if (isset($this->options[self::TIMEOUT])) {
148
+		stream_set_timeout($fh, $this->options[self::TIMEOUT]);
149
+	  }
150
+
151
+	  $response_data = stream_get_contents($fh);
152
+	  fclose($fh);
153
+
154
+	  $respHttpCode = $this->getHttpResponseCode($http_response_header);
155
+	}
156
+
157
+	if (false === $response_data) {
158
+	  $error = sprintf(
159
+		  "HTTP Error: Unable to connect: '%s'",
160
+		  $respHttpCode
161
+	  );
162
+
163
+	  $this->client->getLogger()->error('Stream ' . $error);
164
+	  throw new Google_IO_Exception($error, $respHttpCode);
165
+	}
166
+
167
+	$responseHeaders = $this->getHttpResponseHeaders($http_response_header);
168
+
169
+	$this->client->getLogger()->debug(
170
+		'Stream response',
171
+		array(
172
+			'code' => $respHttpCode,
173
+			'headers' => $responseHeaders,
174
+			'body' => $response_data,
175
+		)
176
+	);
177
+
178
+	return array($response_data, $responseHeaders, $respHttpCode);
179 179
   }
180 180
 
181 181
   /**
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
    */
185 185
   public function setOptions($options)
186 186
   {
187
-    $this->options = $options + $this->options;
187
+	$this->options = $options + $this->options;
188 188
   }
189 189
 
190 190
   /**
@@ -193,8 +193,8 @@  discard block
 block discarded – undo
193 193
    */
194 194
   public function trapError($errno, $errstr)
195 195
   {
196
-    $this->trappedErrorNumber = $errno;
197
-    $this->trappedErrorString = $errstr;
196
+	$this->trappedErrorNumber = $errno;
197
+	$this->trappedErrorString = $errstr;
198 198
   }
199 199
 
200 200
   /**
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
    */
204 204
   public function setTimeout($timeout)
205 205
   {
206
-    $this->options[self::TIMEOUT] = $timeout;
206
+	$this->options[self::TIMEOUT] = $timeout;
207 207
   }
208 208
 
209 209
   /**
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
    */
213 213
   public function getTimeout()
214 214
   {
215
-    return $this->options[self::TIMEOUT];
215
+	return $this->options[self::TIMEOUT];
216 216
   }
217 217
 
218 218
   /**
@@ -224,20 +224,20 @@  discard block
 block discarded – undo
224 224
    */
225 225
   protected function needsQuirk()
226 226
   {
227
-    return false;
227
+	return false;
228 228
   }
229 229
 
230 230
   protected function getHttpResponseCode($response_headers)
231 231
   {
232
-    $header_count = count($response_headers);
233
-
234
-    for ($i = 0; $i < $header_count; $i++) {
235
-      $header = $response_headers[$i];
236
-      if (strncasecmp("HTTP", $header, strlen("HTTP")) == 0) {
237
-        $response = explode(' ', $header);
238
-        return $response[1];
239
-      }
240
-    }
241
-    return self::UNKNOWN_CODE;
232
+	$header_count = count($response_headers);
233
+
234
+	for ($i = 0; $i < $header_count; $i++) {
235
+	  $header = $response_headers[$i];
236
+	  if (strncasecmp("HTTP", $header, strlen("HTTP")) == 0) {
237
+		$response = explode(' ', $header);
238
+		return $response[1];
239
+	  }
240
+	}
241
+	return self::UNKNOWN_CODE;
242 242
   }
243 243
 }
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
  */
23 23
 
24 24
 if (!class_exists('Google_Client')) {
25
-  require_once dirname(__FILE__) . '/../autoload.php';
25
+  require_once dirname(__FILE__).'/../autoload.php';
26 26
 }
27 27
 
28 28
 class Google_IO_Stream extends Google_IO_Abstract
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
   public function __construct(Google_Client $client)
46 46
   {
47 47
     if (!ini_get('allow_url_fopen')) {
48
-      $error = 'The stream IO handler requires the allow_url_fopen runtime ' .
48
+      $error = 'The stream IO handler requires the allow_url_fopen runtime '.
49 49
                'configuration to be enabled';
50 50
       $client->getLogger()->critical($error);
51 51
       throw new Google_IO_Exception($error);
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
         $default_options['ssl'] : array();
89 89
 
90 90
     if (!array_key_exists("cafile", $requestSslContext)) {
91
-      $requestSslContext["cafile"] = dirname(__FILE__) . '/cacerts.pem';
91
+      $requestSslContext["cafile"] = dirname(__FILE__).'/cacerts.pem';
92 92
     }
93 93
 
94 94
     $options = array(
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
     $url = $request->getUrl();
108 108
 
109 109
     if ($request->canGzip()) {
110
-      $url = self::ZLIB . $url;
110
+      $url = self::ZLIB.$url;
111 111
     }
112 112
 
113 113
     $this->client->getLogger()->debug(
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
           $this->trappedErrorString
138 138
       );
139 139
 
140
-      $this->client->getLogger()->error('Stream ' . $error);
140
+      $this->client->getLogger()->error('Stream '.$error);
141 141
       throw new Google_IO_Exception($error, $this->trappedErrorNumber);
142 142
     }
143 143
 
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
           $respHttpCode
161 161
       );
162 162
 
163
-      $this->client->getLogger()->error('Stream ' . $error);
163
+      $this->client->getLogger()->error('Stream '.$error);
164 164
       throw new Google_IO_Exception($error, $respHttpCode);
165 165
     }
166 166
 
Please login to merge, or discard this patch.
geodirectory-admin/google-api-php-client/src/Google/IO/Exception.php 2 patches
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -35,20 +35,20 @@  discard block
 block discarded – undo
35 35
    * @param array|null $retryMap Map of errors with retry counts.
36 36
    */
37 37
   public function __construct(
38
-      $message,
39
-      $code = 0,
40
-      Exception $previous = null,
41
-      array $retryMap = null
38
+	  $message,
39
+	  $code = 0,
40
+	  Exception $previous = null,
41
+	  array $retryMap = null
42 42
   ) {
43
-    if (version_compare(PHP_VERSION, '5.3.0') >= 0) {
44
-      parent::__construct($message, $code, $previous);
45
-    } else {
46
-      parent::__construct($message, $code);
47
-    }
43
+	if (version_compare(PHP_VERSION, '5.3.0') >= 0) {
44
+	  parent::__construct($message, $code, $previous);
45
+	} else {
46
+	  parent::__construct($message, $code);
47
+	}
48 48
 
49
-    if (is_array($retryMap)) {
50
-      $this->retryMap = $retryMap;
51
-    }
49
+	if (is_array($retryMap)) {
50
+	  $this->retryMap = $retryMap;
51
+	}
52 52
   }
53 53
 
54 54
   /**
@@ -60,10 +60,10 @@  discard block
 block discarded – undo
60 60
    */
61 61
   public function allowedRetries()
62 62
   {
63
-    if (isset($this->retryMap[$this->code])) {
64
-      return $this->retryMap[$this->code];
65
-    }
63
+	if (isset($this->retryMap[$this->code])) {
64
+	  return $this->retryMap[$this->code];
65
+	}
66 66
 
67
-    return 0;
67
+	return 0;
68 68
   }
69 69
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@
 block discarded – undo
16 16
  */
17 17
 
18 18
 if (!class_exists('Google_Client')) {
19
-  require_once dirname(__FILE__) . '/../autoload.php';
19
+  require_once dirname(__FILE__).'/../autoload.php';
20 20
 }
21 21
 
22 22
 class Google_IO_Exception extends Google_Exception implements Google_Task_Retryable
Please login to merge, or discard this patch.
geodirectory-admin/google-api-php-client/src/Google/IO/Abstract.php 2 patches
Indentation   +165 added lines, -165 removed lines patch added patch discarded remove patch
@@ -28,19 +28,19 @@  discard block
 block discarded – undo
28 28
   const UNKNOWN_CODE = 0;
29 29
   const FORM_URLENCODED = 'application/x-www-form-urlencoded';
30 30
   private static $CONNECTION_ESTABLISHED_HEADERS = array(
31
-    "HTTP/1.0 200 Connection established\r\n\r\n",
32
-    "HTTP/1.1 200 Connection established\r\n\r\n",
31
+	"HTTP/1.0 200 Connection established\r\n\r\n",
32
+	"HTTP/1.1 200 Connection established\r\n\r\n",
33 33
   );
34 34
   private static $ENTITY_HTTP_METHODS = array("POST" => null, "PUT" => null);
35 35
   private static $HOP_BY_HOP = array(
36
-    'connection' => true,
37
-    'keep-alive' => true,
38
-    'proxy-authenticate' => true,
39
-    'proxy-authorization' => true,
40
-    'te' => true,
41
-    'trailers' => true,
42
-    'transfer-encoding' => true,
43
-    'upgrade' => true
36
+	'connection' => true,
37
+	'keep-alive' => true,
38
+	'proxy-authenticate' => true,
39
+	'proxy-authorization' => true,
40
+	'te' => true,
41
+	'trailers' => true,
42
+	'transfer-encoding' => true,
43
+	'upgrade' => true
44 44
   );
45 45
 
46 46
 
@@ -49,11 +49,11 @@  discard block
 block discarded – undo
49 49
 
50 50
   public function __construct(Google_Client $client)
51 51
   {
52
-    $this->client = $client;
53
-    $timeout = $client->getClassConfig('Google_IO_Abstract', 'request_timeout_seconds');
54
-    if ($timeout > 0) {
55
-      $this->setTimeout($timeout);
56
-    }
52
+	$this->client = $client;
53
+	$timeout = $client->getClassConfig('Google_IO_Abstract', 'request_timeout_seconds');
54
+	if ($timeout > 0) {
55
+	  $this->setTimeout($timeout);
56
+	}
57 57
   }
58 58
 
59 59
   /**
@@ -102,13 +102,13 @@  discard block
 block discarded – undo
102 102
    */
103 103
   public function setCachedRequest(Google_Http_Request $request)
104 104
   {
105
-    // Determine if the request is cacheable.
106
-    if (Google_Http_CacheParser::isResponseCacheable($request)) {
107
-      $this->client->getCache()->set($request->getCacheKey(), $request);
108
-      return true;
109
-    }
105
+	// Determine if the request is cacheable.
106
+	if (Google_Http_CacheParser::isResponseCacheable($request)) {
107
+	  $this->client->getCache()->set($request->getCacheKey(), $request);
108
+	  return true;
109
+	}
110 110
 
111
-    return false;
111
+	return false;
112 112
   }
113 113
 
114 114
   /**
@@ -121,37 +121,37 @@  discard block
 block discarded – undo
121 121
    */
122 122
   public function makeRequest(Google_Http_Request $request)
123 123
   {
124
-    // First, check to see if we have a valid cached version.
125
-    $cached = $this->getCachedRequest($request);
126
-    if ($cached !== false && $cached instanceof Google_Http_Request) {
127
-      if (!$this->checkMustRevalidateCachedRequest($cached, $request)) {
128
-        return $cached;
129
-      }
130
-    }
131
-
132
-    if (array_key_exists($request->getRequestMethod(), self::$ENTITY_HTTP_METHODS)) {
133
-      $request = $this->processEntityRequest($request);
134
-    }
135
-
136
-    list($responseData, $responseHeaders, $respHttpCode) = $this->executeRequest($request);
137
-
138
-    if ($respHttpCode == 304 && $cached) {
139
-      // If the server responded NOT_MODIFIED, return the cached request.
140
-      $this->updateCachedRequest($cached, $responseHeaders);
141
-      return $cached;
142
-    }
143
-
144
-    if (!isset($responseHeaders['Date']) && !isset($responseHeaders['date'])) {
145
-      $responseHeaders['date'] = date("r");
146
-    }
147
-
148
-    $request->setResponseHttpCode($respHttpCode);
149
-    $request->setResponseHeaders($responseHeaders);
150
-    $request->setResponseBody($responseData);
151
-    // Store the request in cache (the function checks to see if the request
152
-    // can actually be cached)
153
-    $this->setCachedRequest($request);
154
-    return $request;
124
+	// First, check to see if we have a valid cached version.
125
+	$cached = $this->getCachedRequest($request);
126
+	if ($cached !== false && $cached instanceof Google_Http_Request) {
127
+	  if (!$this->checkMustRevalidateCachedRequest($cached, $request)) {
128
+		return $cached;
129
+	  }
130
+	}
131
+
132
+	if (array_key_exists($request->getRequestMethod(), self::$ENTITY_HTTP_METHODS)) {
133
+	  $request = $this->processEntityRequest($request);
134
+	}
135
+
136
+	list($responseData, $responseHeaders, $respHttpCode) = $this->executeRequest($request);
137
+
138
+	if ($respHttpCode == 304 && $cached) {
139
+	  // If the server responded NOT_MODIFIED, return the cached request.
140
+	  $this->updateCachedRequest($cached, $responseHeaders);
141
+	  return $cached;
142
+	}
143
+
144
+	if (!isset($responseHeaders['Date']) && !isset($responseHeaders['date'])) {
145
+	  $responseHeaders['date'] = date("r");
146
+	}
147
+
148
+	$request->setResponseHttpCode($respHttpCode);
149
+	$request->setResponseHeaders($responseHeaders);
150
+	$request->setResponseBody($responseData);
151
+	// Store the request in cache (the function checks to see if the request
152
+	// can actually be cached)
153
+	$this->setCachedRequest($request);
154
+	return $request;
155 155
   }
156 156
 
157 157
   /**
@@ -162,11 +162,11 @@  discard block
 block discarded – undo
162 162
    */
163 163
   public function getCachedRequest(Google_Http_Request $request)
164 164
   {
165
-    if (false === Google_Http_CacheParser::isRequestCacheable($request)) {
166
-      return false;
167
-    }
165
+	if (false === Google_Http_CacheParser::isRequestCacheable($request)) {
166
+	  return false;
167
+	}
168 168
 
169
-    return $this->client->getCache()->get($request->getCacheKey());
169
+	return $this->client->getCache()->get($request->getCacheKey());
170 170
   }
171 171
 
172 172
   /**
@@ -177,28 +177,28 @@  discard block
 block discarded – undo
177 177
    */
178 178
   public function processEntityRequest(Google_Http_Request $request)
179 179
   {
180
-    $postBody = $request->getPostBody();
181
-    $contentType = $request->getRequestHeader("content-type");
182
-
183
-    // Set the default content-type as application/x-www-form-urlencoded.
184
-    if (false == $contentType) {
185
-      $contentType = self::FORM_URLENCODED;
186
-      $request->setRequestHeaders(array('content-type' => $contentType));
187
-    }
188
-
189
-    // Force the payload to match the content-type asserted in the header.
190
-    if ($contentType == self::FORM_URLENCODED && is_array($postBody)) {
191
-      $postBody = http_build_query($postBody, '', '&');
192
-      $request->setPostBody($postBody);
193
-    }
194
-
195
-    // Make sure the content-length header is set.
196
-    if (!$postBody || is_string($postBody)) {
197
-      $postsLength = strlen($postBody);
198
-      $request->setRequestHeaders(array('content-length' => $postsLength));
199
-    }
200
-
201
-    return $request;
180
+	$postBody = $request->getPostBody();
181
+	$contentType = $request->getRequestHeader("content-type");
182
+
183
+	// Set the default content-type as application/x-www-form-urlencoded.
184
+	if (false == $contentType) {
185
+	  $contentType = self::FORM_URLENCODED;
186
+	  $request->setRequestHeaders(array('content-type' => $contentType));
187
+	}
188
+
189
+	// Force the payload to match the content-type asserted in the header.
190
+	if ($contentType == self::FORM_URLENCODED && is_array($postBody)) {
191
+	  $postBody = http_build_query($postBody, '', '&');
192
+	  $request->setPostBody($postBody);
193
+	}
194
+
195
+	// Make sure the content-length header is set.
196
+	if (!$postBody || is_string($postBody)) {
197
+	  $postsLength = strlen($postBody);
198
+	  $request->setRequestHeaders(array('content-length' => $postsLength));
199
+	}
200
+
201
+	return $request;
202 202
   }
203 203
 
204 204
   /**
@@ -211,21 +211,21 @@  discard block
 block discarded – undo
211 211
    */
212 212
   protected function checkMustRevalidateCachedRequest($cached, $request)
213 213
   {
214
-    if (Google_Http_CacheParser::mustRevalidate($cached)) {
215
-      $addHeaders = array();
216
-      if ($cached->getResponseHeader('etag')) {
217
-        // [13.3.4] If an entity tag has been provided by the origin server,
218
-        // we must use that entity tag in any cache-conditional request.
219
-        $addHeaders['If-None-Match'] = $cached->getResponseHeader('etag');
220
-      } elseif ($cached->getResponseHeader('date')) {
221
-        $addHeaders['If-Modified-Since'] = $cached->getResponseHeader('date');
222
-      }
223
-
224
-      $request->setRequestHeaders($addHeaders);
225
-      return true;
226
-    } else {
227
-      return false;
228
-    }
214
+	if (Google_Http_CacheParser::mustRevalidate($cached)) {
215
+	  $addHeaders = array();
216
+	  if ($cached->getResponseHeader('etag')) {
217
+		// [13.3.4] If an entity tag has been provided by the origin server,
218
+		// we must use that entity tag in any cache-conditional request.
219
+		$addHeaders['If-None-Match'] = $cached->getResponseHeader('etag');
220
+	  } elseif ($cached->getResponseHeader('date')) {
221
+		$addHeaders['If-Modified-Since'] = $cached->getResponseHeader('date');
222
+	  }
223
+
224
+	  $request->setRequestHeaders($addHeaders);
225
+	  return true;
226
+	} else {
227
+	  return false;
228
+	}
229 229
   }
230 230
 
231 231
   /**
@@ -235,19 +235,19 @@  discard block
 block discarded – undo
235 235
    */
236 236
   protected function updateCachedRequest($cached, $responseHeaders)
237 237
   {
238
-    $hopByHop = self::$HOP_BY_HOP;
239
-    if (!empty($responseHeaders['connection'])) {
240
-      $connectionHeaders = array_map(
241
-          'strtolower',
242
-          array_filter(
243
-              array_map('trim', explode(',', $responseHeaders['connection']))
244
-          )
245
-      );
246
-      $hopByHop += array_fill_keys($connectionHeaders, true);
247
-    }
248
-
249
-    $endToEnd = array_diff_key($responseHeaders, $hopByHop);
250
-    $cached->setResponseHeaders($endToEnd);
238
+	$hopByHop = self::$HOP_BY_HOP;
239
+	if (!empty($responseHeaders['connection'])) {
240
+	  $connectionHeaders = array_map(
241
+		  'strtolower',
242
+		  array_filter(
243
+			  array_map('trim', explode(',', $responseHeaders['connection']))
244
+		  )
245
+	  );
246
+	  $hopByHop += array_fill_keys($connectionHeaders, true);
247
+	}
248
+
249
+	$endToEnd = array_diff_key($responseHeaders, $hopByHop);
250
+	$cached->setResponseHeaders($endToEnd);
251 251
   }
252 252
 
253 253
   /**
@@ -259,33 +259,33 @@  discard block
 block discarded – undo
259 259
    */
260 260
   public function parseHttpResponse($respData, $headerSize)
261 261
   {
262
-    // check proxy header
263
-    foreach (self::$CONNECTION_ESTABLISHED_HEADERS as $established_header) {
264
-      if (stripos($respData, $established_header) !== false) {
265
-        // existed, remove it
266
-        $respData = str_ireplace($established_header, '', $respData);
267
-        // Subtract the proxy header size unless the cURL bug prior to 7.30.0
268
-        // is present which prevented the proxy header size from being taken into
269
-        // account.
270
-        if (!$this->needsQuirk()) {
271
-          $headerSize -= strlen($established_header);
272
-        }
273
-        break;
274
-      }
275
-    }
276
-
277
-    if ($headerSize) {
278
-      $responseBody = substr($respData, $headerSize);
279
-      $responseHeaders = substr($respData, 0, $headerSize);
280
-    } else {
281
-      $responseSegments = explode("\r\n\r\n", $respData, 2);
282
-      $responseHeaders = $responseSegments[0];
283
-      $responseBody = isset($responseSegments[1]) ? $responseSegments[1] :
284
-                                                    null;
285
-    }
286
-
287
-    $responseHeaders = $this->getHttpResponseHeaders($responseHeaders);
288
-    return array($responseHeaders, $responseBody);
262
+	// check proxy header
263
+	foreach (self::$CONNECTION_ESTABLISHED_HEADERS as $established_header) {
264
+	  if (stripos($respData, $established_header) !== false) {
265
+		// existed, remove it
266
+		$respData = str_ireplace($established_header, '', $respData);
267
+		// Subtract the proxy header size unless the cURL bug prior to 7.30.0
268
+		// is present which prevented the proxy header size from being taken into
269
+		// account.
270
+		if (!$this->needsQuirk()) {
271
+		  $headerSize -= strlen($established_header);
272
+		}
273
+		break;
274
+	  }
275
+	}
276
+
277
+	if ($headerSize) {
278
+	  $responseBody = substr($respData, $headerSize);
279
+	  $responseHeaders = substr($respData, 0, $headerSize);
280
+	} else {
281
+	  $responseSegments = explode("\r\n\r\n", $respData, 2);
282
+	  $responseHeaders = $responseSegments[0];
283
+	  $responseBody = isset($responseSegments[1]) ? $responseSegments[1] :
284
+													null;
285
+	}
286
+
287
+	$responseHeaders = $this->getHttpResponseHeaders($responseHeaders);
288
+	return array($responseHeaders, $responseBody);
289 289
   }
290 290
 
291 291
   /**
@@ -295,45 +295,45 @@  discard block
 block discarded – undo
295 295
    */
296 296
   public function getHttpResponseHeaders($rawHeaders)
297 297
   {
298
-    if (is_array($rawHeaders)) {
299
-      return $this->parseArrayHeaders($rawHeaders);
300
-    } else {
301
-      return $this->parseStringHeaders($rawHeaders);
302
-    }
298
+	if (is_array($rawHeaders)) {
299
+	  return $this->parseArrayHeaders($rawHeaders);
300
+	} else {
301
+	  return $this->parseStringHeaders($rawHeaders);
302
+	}
303 303
   }
304 304
 
305 305
   private function parseStringHeaders($rawHeaders)
306 306
   {
307
-    $headers = array();
308
-    $responseHeaderLines = explode("\r\n", $rawHeaders);
309
-    foreach ($responseHeaderLines as $headerLine) {
310
-      if ($headerLine && strpos($headerLine, ':') !== false) {
311
-        list($header, $value) = explode(': ', $headerLine, 2);
312
-        $header = strtolower($header);
313
-        if (isset($headers[$header])) {
314
-          $headers[$header] .= "\n" . $value;
315
-        } else {
316
-          $headers[$header] = $value;
317
-        }
318
-      }
319
-    }
320
-    return $headers;
307
+	$headers = array();
308
+	$responseHeaderLines = explode("\r\n", $rawHeaders);
309
+	foreach ($responseHeaderLines as $headerLine) {
310
+	  if ($headerLine && strpos($headerLine, ':') !== false) {
311
+		list($header, $value) = explode(': ', $headerLine, 2);
312
+		$header = strtolower($header);
313
+		if (isset($headers[$header])) {
314
+		  $headers[$header] .= "\n" . $value;
315
+		} else {
316
+		  $headers[$header] = $value;
317
+		}
318
+	  }
319
+	}
320
+	return $headers;
321 321
   }
322 322
 
323 323
   private function parseArrayHeaders($rawHeaders)
324 324
   {
325
-    $header_count = count($rawHeaders);
326
-    $headers = array();
327
-
328
-    for ($i = 0; $i < $header_count; $i++) {
329
-      $header = $rawHeaders[$i];
330
-      // Times will have colons in - so we just want the first match.
331
-      $header_parts = explode(': ', $header, 2);
332
-      if (count($header_parts) == 2) {
333
-        $headers[strtolower($header_parts[0])] = $header_parts[1];
334
-      }
335
-    }
336
-
337
-    return $headers;
325
+	$header_count = count($rawHeaders);
326
+	$headers = array();
327
+
328
+	for ($i = 0; $i < $header_count; $i++) {
329
+	  $header = $rawHeaders[$i];
330
+	  // Times will have colons in - so we just want the first match.
331
+	  $header_parts = explode(': ', $header, 2);
332
+	  if (count($header_parts) == 2) {
333
+		$headers[strtolower($header_parts[0])] = $header_parts[1];
334
+	  }
335
+	}
336
+
337
+	return $headers;
338 338
   }
339 339
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -4 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
  */
21 21
 
22 22
 if (!class_exists('Google_Client')) {
23
-  require_once dirname(__FILE__) . '/../autoload.php';
23
+  require_once dirname(__FILE__).'/../autoload.php';
24 24
 }
25 25
 
26 26
 abstract class Google_IO_Abstract
@@ -280,8 +280,7 @@  discard block
 block discarded – undo
280 280
     } else {
281 281
       $responseSegments = explode("\r\n\r\n", $respData, 2);
282 282
       $responseHeaders = $responseSegments[0];
283
-      $responseBody = isset($responseSegments[1]) ? $responseSegments[1] :
284
-                                                    null;
283
+      $responseBody = isset($responseSegments[1]) ? $responseSegments[1] : null;
285 284
     }
286 285
 
287 286
     $responseHeaders = $this->getHttpResponseHeaders($responseHeaders);
@@ -311,7 +310,7 @@  discard block
 block discarded – undo
311 310
         list($header, $value) = explode(': ', $headerLine, 2);
312 311
         $header = strtolower($header);
313 312
         if (isset($headers[$header])) {
314
-          $headers[$header] .= "\n" . $value;
313
+          $headers[$header] .= "\n".$value;
315 314
         } else {
316 315
           $headers[$header] = $value;
317 316
         }
Please login to merge, or discard this patch.
geodirectory-functions/compatibility/Twenty_Seventeen.php 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -1,12 +1,12 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 
4
-add_filter('post_thumbnail_html','geodir_2017_remove_header',10,5);
5
-function geodir_2017_remove_header($html, $post_ID, $post_thumbnail_id, $size, $attr){
6
-	if($size=='twentyseventeen-featured-image'){
4
+add_filter('post_thumbnail_html', 'geodir_2017_remove_header', 10, 5);
5
+function geodir_2017_remove_header($html, $post_ID, $post_thumbnail_id, $size, $attr) {
6
+	if ($size == 'twentyseventeen-featured-image') {
7 7
 
8
-		if(geodir_is_page('detail') || geodir_is_page('add-listing')){
9
-			$html = '';// nothing up top
8
+		if (geodir_is_page('detail') || geodir_is_page('add-listing')) {
9
+			$html = ''; // nothing up top
10 10
 		}
11 11
 
12 12
 	}
@@ -63,19 +63,19 @@  discard block
 block discarded – undo
63 63
 
64 64
 }
65 65
 
66
-function geodir_twentyseventeen_body_classes($classes){
66
+function geodir_twentyseventeen_body_classes($classes) {
67 67
 
68
-	if(geodir_is_page('add-listing')
68
+	if (geodir_is_page('add-listing')
69 69
 	   || geodir_is_page('preview')
70 70
 	   || geodir_is_page('home')
71 71
 	   || geodir_is_page('location')
72 72
 	   || geodir_is_page('listing')
73 73
 	   || geodir_is_page('search')
74 74
 	   || geodir_is_page('author')
75
-	){
75
+	) {
76 76
 		$classes[] = 'has-sidebar';
77 77
 	}
78 78
 	return $classes;
79 79
 }
80
-add_filter( 'body_class', 'geodir_twentyseventeen_body_classes' );
80
+add_filter('body_class', 'geodir_twentyseventeen_body_classes');
81 81
 
Please login to merge, or discard this patch.
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -46,17 +46,13 @@
 block discarded – undo
46 46
 
47 47
 	if (is_page_geodir_home() || geodir_is_page('location')) {
48 48
 		add_action('geodir_wrapper_open', 'geodir_action_geodir_sidebar_home_top', 8);
49
-	}
50
-	elseif (geodir_is_page('listing')) {
49
+	} elseif (geodir_is_page('listing')) {
51 50
 		add_action('geodir_wrapper_open', 'geodir_action_geodir_sidebar_listings_top', 8);
52
-	}
53
-	elseif (geodir_is_page('detail')) {
51
+	} elseif (geodir_is_page('detail')) {
54 52
 		add_action('geodir_wrapper_open', 'geodir_action_geodir_sidebar_detail_top', 8);
55
-	}
56
-	elseif (geodir_is_page('search')) {
53
+	} elseif (geodir_is_page('search')) {
57 54
 		add_action('geodir_wrapper_open', 'geodir_action_geodir_sidebar_search_top', 8);
58
-	}
59
-	elseif (geodir_is_page('author')) {
55
+	} elseif (geodir_is_page('author')) {
60 56
 		add_action('geodir_wrapper_open', 'geodir_action_geodir_sidebar_author_top', 8);
61 57
 	}
62 58
 
Please login to merge, or discard this patch.
geodirectory-admin/option-pages/create_field.php 3 patches
Indentation   +65 added lines, -65 removed lines patch added patch discarded remove patch
@@ -16,100 +16,100 @@
 block discarded – undo
16 16
 
17 17
 $field_ids = array();
18 18
 if (!empty($_REQUEST['licontainer']) && is_array($_REQUEST['licontainer'])) {
19
-    foreach ($_REQUEST['licontainer'] as $lic_id) {
20
-        $field_ids[] = sanitize_text_field($lic_id);
21
-    }
19
+	foreach ($_REQUEST['licontainer'] as $lic_id) {
20
+		$field_ids[] = sanitize_text_field($lic_id);
21
+	}
22 22
 }
23 23
 
24 24
 /* ------- check nonce field ------- */
25 25
 if (isset($_REQUEST['update']) && $_REQUEST['update'] == "update" && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'custom_fields') {
26
-    echo godir_set_field_order($field_ids);
26
+	echo godir_set_field_order($field_ids);
27 27
 }
28 28
 
29 29
 if (isset($_REQUEST['update']) && $_REQUEST['update'] == "update" && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'sorting_options') {
30
-    $response = godir_set_sort_field_order($field_ids);
31
-    if (is_array($response)) {
32
-        wp_send_json($response);
33
-    } else {
34
-        echo $response;
35
-    }
30
+	$response = godir_set_sort_field_order($field_ids);
31
+	if (is_array($response)) {
32
+		wp_send_json($response);
33
+	} else {
34
+		echo $response;
35
+	}
36 36
 }
37 37
 
38 38
 /* ---- Show field form in admin ---- */
39 39
 if ($field_type != '' && $field_id != '' && $field_action == 'new' && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'custom_fields') {
40
-    geodir_custom_field_adminhtml($field_type, $field_id, $field_action,$field_type_key);
40
+	geodir_custom_field_adminhtml($field_type, $field_id, $field_action,$field_type_key);
41 41
 }
42 42
 
43 43
 if ($field_type != '' && $field_id != '' && $field_action == 'new' && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'sorting_options') {
44
-    geodir_custom_sort_field_adminhtml($field_type, $field_id, $field_action,$field_type_key);
44
+	geodir_custom_sort_field_adminhtml($field_type, $field_id, $field_action,$field_type_key);
45 45
 }
46 46
 
47 47
 /* ---- Delete field ---- */
48 48
 if ($field_id != '' && $field_action == 'delete' && isset($_REQUEST['_wpnonce']) && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'custom_fields') {
49
-    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id))
50
-        return;
49
+	if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id))
50
+		return;
51 51
     
52
-    echo geodir_custom_field_delete($field_id);
52
+	echo geodir_custom_field_delete($field_id);
53 53
 }
54 54
 
55 55
 if ($field_id != '' && $field_action == 'delete' && isset($_REQUEST['_wpnonce']) && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'sorting_options') {
56
-    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id))
57
-        return;
56
+	if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id))
57
+		return;
58 58
     
59
-    echo geodir_custom_sort_field_delete($field_id);
59
+	echo geodir_custom_sort_field_delete($field_id);
60 60
 }
61 61
 
62 62
 /* ---- Save field  ---- */
63 63
 if ($field_id != '' && $field_action == 'submit' && isset($_REQUEST['_wpnonce']) && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'custom_fields') {
64
-    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id))
65
-        return;
66
-
67
-    foreach ($_REQUEST as $pkey => $pval) {
68
-        if (is_array($_REQUEST[$pkey]) || $pkey=='default_value') {
69
-            $tags = 'skip_field';
70
-        } else {
71
-            $tags = '';
72
-        }
73
-
74
-        if ($tags != 'skip_field') {
75
-            $_REQUEST[$pkey] = strip_tags($_REQUEST[$pkey], $tags);
76
-        }
77
-    }
78
-
79
-    $return = geodir_custom_field_save($_REQUEST);
80
-
81
-    if (is_int($return)) {
82
-        $lastid = $return;
83
-        geodir_custom_field_adminhtml($field_type, $lastid, 'submit',$field_type_key);
84
-    } else {
85
-        echo $return;
86
-    }
64
+	if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id))
65
+		return;
66
+
67
+	foreach ($_REQUEST as $pkey => $pval) {
68
+		if (is_array($_REQUEST[$pkey]) || $pkey=='default_value') {
69
+			$tags = 'skip_field';
70
+		} else {
71
+			$tags = '';
72
+		}
73
+
74
+		if ($tags != 'skip_field') {
75
+			$_REQUEST[$pkey] = strip_tags($_REQUEST[$pkey], $tags);
76
+		}
77
+	}
78
+
79
+	$return = geodir_custom_field_save($_REQUEST);
80
+
81
+	if (is_int($return)) {
82
+		$lastid = $return;
83
+		geodir_custom_field_adminhtml($field_type, $lastid, 'submit',$field_type_key);
84
+	} else {
85
+		echo $return;
86
+	}
87 87
 }
88 88
 
89 89
 /* ---- Save sort field  ---- */
90 90
 if ($field_id != '' && $field_action == 'submit' && isset($_REQUEST['_wpnonce']) && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'sorting_options') {
91
-    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id))
92
-        return;
93
-
94
-    foreach ($_REQUEST as $pkey => $pval) {
95
-        if (is_array($_REQUEST[$pkey])) {
96
-            $tags = 'skip_field';
97
-        } else {
98
-            $tags = '';
99
-        }
100
-
101
-        if ($tags != 'skip_field') {
102
-            $_REQUEST[$pkey] = strip_tags($_REQUEST[$pkey], $tags);
103
-        }
104
-    }
105
-
106
-    $return = geodir_custom_sort_field_save($_REQUEST);
107
-
108
-    if (is_int($return)) {
109
-        $lastid = $return;
110
-        $default = false;
111
-        geodir_custom_sort_field_adminhtml($field_type, $lastid, 'submit', $default);
112
-    } else {
113
-        echo $return;
114
-    }
91
+	if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id))
92
+		return;
93
+
94
+	foreach ($_REQUEST as $pkey => $pval) {
95
+		if (is_array($_REQUEST[$pkey])) {
96
+			$tags = 'skip_field';
97
+		} else {
98
+			$tags = '';
99
+		}
100
+
101
+		if ($tags != 'skip_field') {
102
+			$_REQUEST[$pkey] = strip_tags($_REQUEST[$pkey], $tags);
103
+		}
104
+	}
105
+
106
+	$return = geodir_custom_sort_field_save($_REQUEST);
107
+
108
+	if (is_int($return)) {
109
+		$lastid = $return;
110
+		$default = false;
111
+		geodir_custom_sort_field_adminhtml($field_type, $lastid, 'submit', $default);
112
+	} else {
113
+		echo $return;
114
+	}
115 115
 }
116 116
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -37,23 +37,23 @@  discard block
 block discarded – undo
37 37
 
38 38
 /* ---- Show field form in admin ---- */
39 39
 if ($field_type != '' && $field_id != '' && $field_action == 'new' && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'custom_fields') {
40
-    geodir_custom_field_adminhtml($field_type, $field_id, $field_action,$field_type_key);
40
+    geodir_custom_field_adminhtml($field_type, $field_id, $field_action, $field_type_key);
41 41
 }
42 42
 
43 43
 if ($field_type != '' && $field_id != '' && $field_action == 'new' && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'sorting_options') {
44
-    geodir_custom_sort_field_adminhtml($field_type, $field_id, $field_action,$field_type_key);
44
+    geodir_custom_sort_field_adminhtml($field_type, $field_id, $field_action, $field_type_key);
45 45
 }
46 46
 
47 47
 /* ---- Delete field ---- */
48 48
 if ($field_id != '' && $field_action == 'delete' && isset($_REQUEST['_wpnonce']) && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'custom_fields') {
49
-    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id))
49
+    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_'.$field_id))
50 50
         return;
51 51
     
52 52
     echo geodir_custom_field_delete($field_id);
53 53
 }
54 54
 
55 55
 if ($field_id != '' && $field_action == 'delete' && isset($_REQUEST['_wpnonce']) && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'sorting_options') {
56
-    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id))
56
+    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_'.$field_id))
57 57
         return;
58 58
     
59 59
     echo geodir_custom_sort_field_delete($field_id);
@@ -61,11 +61,11 @@  discard block
 block discarded – undo
61 61
 
62 62
 /* ---- Save field  ---- */
63 63
 if ($field_id != '' && $field_action == 'submit' && isset($_REQUEST['_wpnonce']) && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'custom_fields') {
64
-    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id))
64
+    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_'.$field_id))
65 65
         return;
66 66
 
67 67
     foreach ($_REQUEST as $pkey => $pval) {
68
-        if (is_array($_REQUEST[$pkey]) || $pkey=='default_value') {
68
+        if (is_array($_REQUEST[$pkey]) || $pkey == 'default_value') {
69 69
             $tags = 'skip_field';
70 70
         } else {
71 71
             $tags = '';
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 
81 81
     if (is_int($return)) {
82 82
         $lastid = $return;
83
-        geodir_custom_field_adminhtml($field_type, $lastid, 'submit',$field_type_key);
83
+        geodir_custom_field_adminhtml($field_type, $lastid, 'submit', $field_type_key);
84 84
     } else {
85 85
         echo $return;
86 86
     }
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 
89 89
 /* ---- Save sort field  ---- */
90 90
 if ($field_id != '' && $field_action == 'submit' && isset($_REQUEST['_wpnonce']) && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'sorting_options') {
91
-    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id))
91
+    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_'.$field_id))
92 92
         return;
93 93
 
94 94
     foreach ($_REQUEST as $pkey => $pval) {
Please login to merge, or discard this patch.
Braces   +12 added lines, -8 removed lines patch added patch discarded remove patch
@@ -46,23 +46,26 @@  discard block
 block discarded – undo
46 46
 
47 47
 /* ---- Delete field ---- */
48 48
 if ($field_id != '' && $field_action == 'delete' && isset($_REQUEST['_wpnonce']) && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'custom_fields') {
49
-    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id))
50
-        return;
49
+    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id)) {
50
+            return;
51
+    }
51 52
     
52 53
     echo geodir_custom_field_delete($field_id);
53 54
 }
54 55
 
55 56
 if ($field_id != '' && $field_action == 'delete' && isset($_REQUEST['_wpnonce']) && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'sorting_options') {
56
-    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id))
57
-        return;
57
+    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id)) {
58
+            return;
59
+    }
58 60
     
59 61
     echo geodir_custom_sort_field_delete($field_id);
60 62
 }
61 63
 
62 64
 /* ---- Save field  ---- */
63 65
 if ($field_id != '' && $field_action == 'submit' && isset($_REQUEST['_wpnonce']) && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'custom_fields') {
64
-    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id))
65
-        return;
66
+    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id)) {
67
+            return;
68
+    }
66 69
 
67 70
     foreach ($_REQUEST as $pkey => $pval) {
68 71
         if (is_array($_REQUEST[$pkey]) || $pkey=='default_value') {
@@ -88,8 +91,9 @@  discard block
 block discarded – undo
88 91
 
89 92
 /* ---- Save sort field  ---- */
90 93
 if ($field_id != '' && $field_action == 'submit' && isset($_REQUEST['_wpnonce']) && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'sorting_options') {
91
-    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id))
92
-        return;
94
+    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id)) {
95
+            return;
96
+    }
93 97
 
94 98
     foreach ($_REQUEST as $pkey => $pval) {
95 99
         if (is_array($_REQUEST[$pkey])) {
Please login to merge, or discard this patch.
geodirectory-functions/map-functions/map_template_tags.php 3 patches
Braces   +8 added lines, -6 removed lines patch added patch discarded remove patch
@@ -225,10 +225,11 @@  discard block
 block discarded – undo
225 225
                     <input type="hidden" id="<?php echo $map_canvas_name;?>_jason_enabled" value="0"/>
226 226
                 <?php }
227 227
 
228
-                if (!$geodir_map_options['enable_text_search'] && !$geodir_map_options['enable_cat_filters'])
229
-                    $show_entire_cat_panel = "none";
230
-                else
231
-                    $show_entire_cat_panel = "''";
228
+                if (!$geodir_map_options['enable_text_search'] && !$geodir_map_options['enable_cat_filters']) {
229
+                                    $show_entire_cat_panel = "none";
230
+                } else {
231
+                                    $show_entire_cat_panel = "''";
232
+                }
232 233
                 ?>
233 234
 
234 235
                 <?php if ($geodir_map_options['enable_map_direction']) { ?>
@@ -302,8 +303,9 @@  discard block
 block discarded – undo
302 303
 				}
303 304
 				
304 305
 				$geodir_default_map_search_pt = get_option('geodir_default_map_search_pt');
305
-				if (empty($geodir_default_map_search_pt))
306
-					$geodir_default_map_search_pt = 'gd_place';
306
+				if (empty($geodir_default_map_search_pt)) {
307
+									$geodir_default_map_search_pt = 'gd_place';
308
+				}
307 309
 
308 310
                 global $gd_session;
309 311
                 $homemap_catlist_ptype = $gd_session->get('homemap_catlist_ptype');
Please login to merge, or discard this patch.
Indentation   +145 added lines, -145 removed lines patch added patch discarded remove patch
@@ -67,80 +67,80 @@  discard block
 block discarded – undo
67 67
  */
68 68
 function geodir_draw_map($map_args = array())
69 69
 {
70
-    global $map_canvas_arr;
71
-    $map_canvas_name = (!empty($map_args) && $map_args['map_canvas_name'] != '') ? $map_args['map_canvas_name'] : 'home_map_canvas';
72
-    $map_class_name = (!empty($map_args) && isset($map_args['map_class_name'])) ? $map_args['map_class_name'] : '';
73
-
74
-    $default_location = geodir_get_default_location();
75
-
76
-    $map_default_lat = isset($default_location->city_latitude) ? $default_location->city_latitude : '';
77
-    $map_default_lng = isset($default_location->city_longitude) ? $default_location->city_longitude : '';
78
-    $map_default_zoom = 12;
79
-    // map options default values
80
-    $width = 950;
81
-    $height = 450;
82
-    $child_collapse = '0';
83
-    $sticky = '';
84
-    $enable_cat_filters = false;
85
-    $enable_text_search = false;
86
-    $enable_post_type_filters = false;
87
-    $enable_location_filters = false;
88
-    $enable_jason_on_load = false;
89
-    $enable_map_direction = false;
90
-    $enable_marker_cluster = false;
91
-    $enable_map_resize_button = false;
92
-    $maptype = 'ROADMAP';
93
-
94
-    $geodir_map_options = array(
95
-        'width' => $width,
96
-        'height' => $height,
97
-        'child_collapse' => $child_collapse,
98
-        'sticky' => $sticky,
99
-        'enable_map_resize_button' => $enable_map_resize_button,
100
-        'enable_cat_filters' => $enable_cat_filters,
101
-        'enable_text_search' => $enable_text_search,
102
-        'enable_post_type_filters' => $enable_post_type_filters,
103
-        'enable_location_filters' => $enable_location_filters,
104
-        'enable_jason_on_load' => $enable_jason_on_load,
105
-        'enable_map_direction' => $enable_map_direction,
106
-        'enable_marker_cluster' => $enable_marker_cluster,
107
-        'ajax_url' => geodir_get_ajax_url(),
108
-        'map_canvas_name' => $map_canvas_name,
109
-        'inputText' => __('Title or Keyword', 'geodirectory'),
110
-        'latitude' => $map_default_lat,
111
-        'longitude' => $map_default_lng,
112
-        'zoom' => $map_default_zoom,
113
-        'scrollwheel' => true,
114
-        'streetViewControl' => true,
115
-        'fullscreenControl' => false,
116
-        'maptype' => $maptype,
117
-        'showPreview' => '0',
118
-        'maxZoom' => 21,
119
-        'autozoom' => true,
120
-        'bubble_size' => 'small',
121
-        'token' => '68f48005e256696074e1da9bf9f67f06',
122
-        'navigationControlOptions' => array('position' => 'TOP_LEFT', 'style' => 'ZOOM_PAN')
123
-    );
124
-
125
-
126
-
127
-    if (!empty($map_args)) {
128
-        foreach ($map_args as $map_option_key => $map_option_value) {
129
-            $geodir_map_options[$map_option_key] = $map_option_value;
130
-        }
131
-    }
132
-
133
-    if (strpos($geodir_map_options['height'], '%') !== false || strpos($geodir_map_options['height'], 'px') !== false || strpos($geodir_map_options['height'], 'vh') !== false) {
134
-    } else {
135
-        $geodir_map_options['height'] = $geodir_map_options['height'] . 'px';
136
-    }
137
-
138
-    if (strpos($geodir_map_options['width'], '%') !== false || strpos($geodir_map_options['width'], 'px') !== false) {
139
-    } else {
140
-        $geodir_map_options['width'] = $geodir_map_options['width'] . 'px';
141
-    }
142
-
143
-    /**
70
+	global $map_canvas_arr;
71
+	$map_canvas_name = (!empty($map_args) && $map_args['map_canvas_name'] != '') ? $map_args['map_canvas_name'] : 'home_map_canvas';
72
+	$map_class_name = (!empty($map_args) && isset($map_args['map_class_name'])) ? $map_args['map_class_name'] : '';
73
+
74
+	$default_location = geodir_get_default_location();
75
+
76
+	$map_default_lat = isset($default_location->city_latitude) ? $default_location->city_latitude : '';
77
+	$map_default_lng = isset($default_location->city_longitude) ? $default_location->city_longitude : '';
78
+	$map_default_zoom = 12;
79
+	// map options default values
80
+	$width = 950;
81
+	$height = 450;
82
+	$child_collapse = '0';
83
+	$sticky = '';
84
+	$enable_cat_filters = false;
85
+	$enable_text_search = false;
86
+	$enable_post_type_filters = false;
87
+	$enable_location_filters = false;
88
+	$enable_jason_on_load = false;
89
+	$enable_map_direction = false;
90
+	$enable_marker_cluster = false;
91
+	$enable_map_resize_button = false;
92
+	$maptype = 'ROADMAP';
93
+
94
+	$geodir_map_options = array(
95
+		'width' => $width,
96
+		'height' => $height,
97
+		'child_collapse' => $child_collapse,
98
+		'sticky' => $sticky,
99
+		'enable_map_resize_button' => $enable_map_resize_button,
100
+		'enable_cat_filters' => $enable_cat_filters,
101
+		'enable_text_search' => $enable_text_search,
102
+		'enable_post_type_filters' => $enable_post_type_filters,
103
+		'enable_location_filters' => $enable_location_filters,
104
+		'enable_jason_on_load' => $enable_jason_on_load,
105
+		'enable_map_direction' => $enable_map_direction,
106
+		'enable_marker_cluster' => $enable_marker_cluster,
107
+		'ajax_url' => geodir_get_ajax_url(),
108
+		'map_canvas_name' => $map_canvas_name,
109
+		'inputText' => __('Title or Keyword', 'geodirectory'),
110
+		'latitude' => $map_default_lat,
111
+		'longitude' => $map_default_lng,
112
+		'zoom' => $map_default_zoom,
113
+		'scrollwheel' => true,
114
+		'streetViewControl' => true,
115
+		'fullscreenControl' => false,
116
+		'maptype' => $maptype,
117
+		'showPreview' => '0',
118
+		'maxZoom' => 21,
119
+		'autozoom' => true,
120
+		'bubble_size' => 'small',
121
+		'token' => '68f48005e256696074e1da9bf9f67f06',
122
+		'navigationControlOptions' => array('position' => 'TOP_LEFT', 'style' => 'ZOOM_PAN')
123
+	);
124
+
125
+
126
+
127
+	if (!empty($map_args)) {
128
+		foreach ($map_args as $map_option_key => $map_option_value) {
129
+			$geodir_map_options[$map_option_key] = $map_option_value;
130
+		}
131
+	}
132
+
133
+	if (strpos($geodir_map_options['height'], '%') !== false || strpos($geodir_map_options['height'], 'px') !== false || strpos($geodir_map_options['height'], 'vh') !== false) {
134
+	} else {
135
+		$geodir_map_options['height'] = $geodir_map_options['height'] . 'px';
136
+	}
137
+
138
+	if (strpos($geodir_map_options['width'], '%') !== false || strpos($geodir_map_options['width'], 'px') !== false) {
139
+	} else {
140
+		$geodir_map_options['width'] = $geodir_map_options['width'] . 'px';
141
+	}
142
+
143
+	/**
144 144
 	 * Filter the options to use in google map.
145 145
 	 *
146 146
 	 * @since 1.0.0
@@ -149,9 +149,9 @@  discard block
 block discarded – undo
149 149
 	 */
150 150
 	$geodir_map_options = apply_filters("geodir_map_options_{$map_canvas_name}", $geodir_map_options);
151 151
 
152
-    $map_canvas_arr[$map_canvas_name] = array();
152
+	$map_canvas_arr[$map_canvas_name] = array();
153 153
 
154
-    /**
154
+	/**
155 155
 	 * Filter the post types to display data on map.
156 156
 	 *
157 157
 	 * @since 1.0.0
@@ -169,20 +169,20 @@  discard block
 block discarded – undo
169 169
 	 */
170 170
 	$exclude_post_types = apply_filters("geodir_exclude_post_type_on_map_{$map_canvas_name}", get_option('geodir_exclude_post_type_on_map'));
171 171
 
172
-    if (count((array)$post_types) != count($exclude_post_types) || ($enable_jason_on_load)):
173
-        // Set default map options
172
+	if (count((array)$post_types) != count($exclude_post_types) || ($enable_jason_on_load)):
173
+		// Set default map options
174 174
 
175
-        wp_enqueue_script('geodir-map-widget', geodir_plugin_url() . '/geodirectory-functions/map-functions/js/map.min.js',array(),false,true);
175
+		wp_enqueue_script('geodir-map-widget', geodir_plugin_url() . '/geodirectory-functions/map-functions/js/map.min.js',array(),false,true);
176 176
 
177
-        wp_localize_script('geodir-map-widget', $map_canvas_name, $geodir_map_options);
177
+		wp_localize_script('geodir-map-widget', $map_canvas_name, $geodir_map_options);
178 178
 
179
-        if ($map_canvas_name == 'detail_page_map_canvas' || $map_canvas_name == 'preview_map_canvas') {
180
-            $map_width = '100%';
181
-        } else {
182
-            $map_width = $geodir_map_options['width'];
183
-        }
179
+		if ($map_canvas_name == 'detail_page_map_canvas' || $map_canvas_name == 'preview_map_canvas') {
180
+			$map_width = '100%';
181
+		} else {
182
+			$map_width = $geodir_map_options['width'];
183
+		}
184 184
 
185
-        /**
185
+		/**
186 186
 		 * Filter the width of map.
187 187
 		 *
188 188
 		 * @since 1.0.0
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
 		 * @param int $map_width Width of map box, eg: gd_place.
191 191
 		 */
192 192
 		$map_width = apply_filters('geodir_change_map_width', $map_width);
193
-        ?>
193
+		?>
194 194
         <div id="catcher_<?php echo $map_canvas_name;?>"></div>
195 195
         <div class="stick_trigger_container">
196 196
             <div class="trigger_sticky triggeroff_sticky"></div>
@@ -224,15 +224,15 @@  discard block
 block discarded – undo
224 224
                 <?php if ($geodir_map_options['enable_jason_on_load']) { ?>
225 225
                     <input type="hidden" id="<?php echo $map_canvas_name;?>_jason_enabled" value="1"/>
226 226
                 <?php } else {
227
-                    ?>
227
+					?>
228 228
                     <input type="hidden" id="<?php echo $map_canvas_name;?>_jason_enabled" value="0"/>
229 229
                 <?php }
230 230
 
231
-                if (!$geodir_map_options['enable_text_search'] && !$geodir_map_options['enable_cat_filters'])
232
-                    $show_entire_cat_panel = "none";
233
-                else
234
-                    $show_entire_cat_panel = "''";
235
-                ?>
231
+				if (!$geodir_map_options['enable_text_search'] && !$geodir_map_options['enable_cat_filters'])
232
+					$show_entire_cat_panel = "none";
233
+				else
234
+					$show_entire_cat_panel = "''";
235
+				?>
236 236
 
237 237
                 <?php if ($geodir_map_options['enable_map_direction']) { ?>
238 238
                     <div class="gd-input-group gd-get-directions">
@@ -295,8 +295,8 @@  discard block
 block discarded – undo
295 295
                         <select id="travel-units" onchange="calcRoute('<?php echo $map_canvas_name; ?>')">
296 296
                             <option value="miles"><?php _e('Miles', 'geodirectory'); ?></option>
297 297
                             <option <?php if (get_option('geodir_search_dist_1') == 'km') {
298
-                                echo 'selected="selected"';
299
-                            } ?> value="kilometers"><?php _e('Kilometers', 'geodirectory'); ?></option>
298
+								echo 'selected="selected"';
299
+							} ?> value="kilometers"><?php _e('Kilometers', 'geodirectory'); ?></option>
300 300
                         </select>
301 301
                     </div>
302 302
 
@@ -308,12 +308,12 @@  discard block
 block discarded – undo
308 308
 				if (empty($geodir_default_map_search_pt))
309 309
 					$geodir_default_map_search_pt = 'gd_place';
310 310
 
311
-                global $gd_session;
312
-                $homemap_catlist_ptype = $gd_session->get('homemap_catlist_ptype');
311
+				global $gd_session;
312
+				$homemap_catlist_ptype = $gd_session->get('homemap_catlist_ptype');
313 313
 
314
-                if ($homemap_catlist_ptype) {
315
-                    $geodir_default_map_search_pt = $homemap_catlist_ptype;
316
-                }
314
+				if ($homemap_catlist_ptype) {
315
+					$geodir_default_map_search_pt = $homemap_catlist_ptype;
316
+				}
317 317
 
318 318
 				/**
319 319
 				 * Filter the post type to retrieve data for map
@@ -326,13 +326,13 @@  discard block
 block discarded – undo
326 326
 				?>
327 327
                 <div class="map-category-listing-main" style="display:<?php echo $show_entire_cat_panel;?>">
328 328
                     <?php
329
-                    $exclude_post_types = get_option('geodir_exclude_post_type_on_map');
330
-                    $geodir_available_pt_on_map = count(geodir_get_posttypes('array')) - count($exclude_post_types);
329
+					$exclude_post_types = get_option('geodir_exclude_post_type_on_map');
330
+					$geodir_available_pt_on_map = count(geodir_get_posttypes('array')) - count($exclude_post_types);
331 331
 					$map_cat_class = '';
332 332
 					if ($geodir_map_options['enable_post_type_filters']) {
333 333
 						$map_cat_class = $geodir_available_pt_on_map > 1 ? ' map-cat-ptypes' : ' map-cat-floor';
334 334
 					}
335
-                    ?>
335
+					?>
336 336
                     <div
337 337
                         class="map-category-listing<?php echo $map_cat_class;?>">
338 338
                         <div class="gd-trigger gd-triggeroff"><i class="fa fa-compress"></i><i class="fa fa-expand"></i></div>
@@ -350,7 +350,7 @@  discard block
 block discarded – undo
350 350
                                 <?php if ($geodir_map_options['child_collapse']) { $child_collapse = "1"; ?>
351 351
                                     <input type="hidden" id="<?php echo $map_canvas_name; ?>_child_collapse" value="1"/>
352 352
                                 <?php } else {$child_collapse = "0";
353
-                                    ?>
353
+									?>
354 354
                                     <input type="hidden" id="<?php echo $map_canvas_name;?>_child_collapse" value="0"/>
355 355
                                 <?php } ?>
356 356
                                 <input type="hidden" id="<?php echo $map_canvas_name; ?>_cat_enabled" value="1"/>
@@ -372,18 +372,18 @@  discard block
 block discarded – undo
372 372
                 <!-- map-category-listings-->
373 373
 
374 374
                 <?php
375
-                if ($geodir_map_options['enable_location_filters']) {
376
-                    $country = get_query_var('gd_country');
375
+				if ($geodir_map_options['enable_location_filters']) {
376
+					$country = get_query_var('gd_country');
377 377
 					$region = get_query_var('gd_region');
378 378
 					$city = get_query_var('gd_city');
379
-                    $gd_neighbourhood = get_query_var('gd_neighbourhood');
379
+					$gd_neighbourhood = get_query_var('gd_neighbourhood');
380 380
                     
381
-                    //fix for location/me page
382
-                    $country = $country != 'me' ? $country : '';
381
+					//fix for location/me page
382
+					$country = $country != 'me' ? $country : '';
383 383
 					$region = $region != 'me' ? $region : '';
384 384
 					$city = $country != 'me' ? $city : '';
385
-                    $gd_neighbourhood = $country != 'me' ? $gd_neighbourhood : '';
386
-                    ?>
385
+					$gd_neighbourhood = $country != 'me' ? $gd_neighbourhood : '';
386
+					?>
387 387
                     <input type="hidden" id="<?php echo $map_canvas_name;?>_location_enabled" value="1"/>
388 388
                     <input type="hidden" id="<?php echo $map_canvas_name;?>_country" name="gd_country"
389 389
                            value="<?php echo $country;?>"/>
@@ -394,7 +394,7 @@  discard block
 block discarded – undo
394 394
                     <input type="hidden" id="<?php echo $map_canvas_name;?>_neighbourhood" name="gd_neighbourhood"
395 395
                            value="<?php echo $gd_neighbourhood;?>"/>
396 396
                 <?php } else { //end of location filter
397
-                    ?>
397
+					?>
398 398
                     <input type="hidden" id="<?php echo $map_canvas_name;?>_location_enabled" value="0"/>
399 399
                 <?php }?>
400 400
 
@@ -405,16 +405,16 @@  discard block
 block discarded – undo
405 405
 
406 406
 
407 407
                 <?php if ($geodir_map_options['enable_post_type_filters']) {
408
-                    $post_types = geodir_get_posttypes('object');
409
-                    $all_post_types = geodir_get_posttypes('names');
410
-                    $exclude_post_types = get_option('geodir_exclude_post_type_on_map');
411
-                    if (is_array($exclude_post_types)) {
412
-                        $map_post_types = array_diff($all_post_types, $exclude_post_types);
413
-                    } else {
414
-                        $map_post_types = $all_post_types;
415
-                    }
416
-                    if (count($map_post_types) > 1) {
417
-                        ?>
408
+					$post_types = geodir_get_posttypes('object');
409
+					$all_post_types = geodir_get_posttypes('names');
410
+					$exclude_post_types = get_option('geodir_exclude_post_type_on_map');
411
+					if (is_array($exclude_post_types)) {
412
+						$map_post_types = array_diff($all_post_types, $exclude_post_types);
413
+					} else {
414
+						$map_post_types = $all_post_types;
415
+					}
416
+					if (count($map_post_types) > 1) {
417
+						?>
418 418
                         <div class="map-places-listing" id="<?php echo $map_canvas_name;?>_posttype_menu"
419 419
                              style="max-width:<?php echo $map_width;?>!important;">
420 420
 
@@ -424,13 +424,13 @@  discard block
 block discarded – undo
424 424
                                     <?php
425 425
 
426 426
 
427
-                                    foreach ($post_types as $post_type => $args) {
428
-                                        if (!in_array($post_type, $exclude_post_types)) {
429
-                                            $class = $map_search_pt == $post_type ? 'class="gd-map-search-pt"' : '';
427
+									foreach ($post_types as $post_type => $args) {
428
+										if (!in_array($post_type, $exclude_post_types)) {
429
+											$class = $map_search_pt == $post_type ? 'class="gd-map-search-pt"' : '';
430 430
 											echo '<li id="' . $post_type . '" ' . $class . '><a href="javascript:void(0);" onclick="jQuery(\'#' . $map_canvas_name . '_posttype\').val(\'' . $post_type . '\');build_map_ajax_search_param(\'' . $map_canvas_name . '\', true)">' . __($args->labels->name, 'geodirectory') . '</a></li>';
431
-                                        }
432
-                                    }
433
-                                    ?>
431
+										}
432
+									}
433
+									?>
434 434
                                 </ul>
435 435
                                 <?php if (isset($geodir_map_options['is_geodir_home_map_widget']) && $map_args['is_geodir_home_map_widget']) { ?>
436 436
                             </div><?php } ?>
@@ -444,8 +444,8 @@  discard block
 block discarded – undo
444 444
 
445 445
                         </div> <!-- map-places-listings-->
446 446
                     <?php }
447
-                } // end of post type filter if
448
-                ?>
447
+				} // end of post type filter if
448
+				?>
449 449
 
450 450
             </div>
451 451
         </div> <!--end of stick trigger container-->
@@ -460,8 +460,8 @@  discard block
 block discarded – undo
460 460
         </script>
461 461
         <?php
462 462
 
463
-        if (strpos($geodir_map_options['height'], 'vh')) {
464
-            ?>
463
+		if (strpos($geodir_map_options['height'], 'vh')) {
464
+			?>
465 465
             <script>
466 466
                 (function () {
467 467
                     var screenH = jQuery(window).height();
@@ -483,8 +483,8 @@  discard block
 block discarded – undo
483 483
 
484 484
         <?php
485 485
 
486
-        } elseif (strpos($geodir_map_options['height'], 'px')) {
487
-            ?>
486
+		} elseif (strpos($geodir_map_options['height'], 'px')) {
487
+			?>
488 488
             <script>
489 489
                 (function () {
490 490
                     var screenH = jQuery(window).height();
@@ -499,20 +499,20 @@  discard block
 block discarded – undo
499 499
                 }());
500 500
             </script>
501 501
         <?php
502
-        }
502
+		}
503 503
 
504
-        /**
505
-         * Action that runs after all the map code has been output;
506
-         *
507
-         * @since 1.5.3
508
-         *
509
-         * @param array $geodir_map_options Array of map settings.
510
-         * @param string $map_canvas_name The canvas name and ID for the map.
511
-         */
512
-        do_action('geodir_map_after_render',$geodir_map_options,$map_canvas_name);
504
+		/**
505
+		 * Action that runs after all the map code has been output;
506
+		 *
507
+		 * @since 1.5.3
508
+		 *
509
+		 * @param array $geodir_map_options Array of map settings.
510
+		 * @param string $map_canvas_name The canvas name and ID for the map.
511
+		 */
512
+		do_action('geodir_map_after_render',$geodir_map_options,$map_canvas_name);
513 513
 
514 514
 
515
-    endif; // Exclude posttypes if end
515
+	endif; // Exclude posttypes if end
516 516
 }
517 517
 
518 518
 /**
Please login to merge, or discard this patch.
Spacing   +61 added lines, -61 removed lines patch added patch discarded remove patch
@@ -132,12 +132,12 @@  discard block
 block discarded – undo
132 132
 
133 133
     if (strpos($geodir_map_options['height'], '%') !== false || strpos($geodir_map_options['height'], 'px') !== false || strpos($geodir_map_options['height'], 'vh') !== false) {
134 134
     } else {
135
-        $geodir_map_options['height'] = $geodir_map_options['height'] . 'px';
135
+        $geodir_map_options['height'] = $geodir_map_options['height'].'px';
136 136
     }
137 137
 
138 138
     if (strpos($geodir_map_options['width'], '%') !== false || strpos($geodir_map_options['width'], 'px') !== false) {
139 139
     } else {
140
-        $geodir_map_options['width'] = $geodir_map_options['width'] . 'px';
140
+        $geodir_map_options['width'] = $geodir_map_options['width'].'px';
141 141
     }
142 142
 
143 143
     /**
@@ -169,10 +169,10 @@  discard block
 block discarded – undo
169 169
 	 */
170 170
 	$exclude_post_types = apply_filters("geodir_exclude_post_type_on_map_{$map_canvas_name}", get_option('geodir_exclude_post_type_on_map'));
171 171
 
172
-    if (count((array)$post_types) != count($exclude_post_types) || ($enable_jason_on_load)):
172
+    if (count((array) $post_types) != count($exclude_post_types) || ($enable_jason_on_load)):
173 173
         // Set default map options
174 174
 
175
-        wp_enqueue_script('geodir-map-widget', geodir_plugin_url() . '/geodirectory-functions/map-functions/js/map.min.js',array(),false,true);
175
+        wp_enqueue_script('geodir-map-widget', geodir_plugin_url().'/geodirectory-functions/map-functions/js/map.min.js', array(), false, true);
176 176
 
177 177
         wp_localize_script('geodir-map-widget', $map_canvas_name, $geodir_map_options);
178 178
 
@@ -191,41 +191,41 @@  discard block
 block discarded – undo
191 191
 		 */
192 192
 		$map_width = apply_filters('geodir_change_map_width', $map_width);
193 193
         ?>
194
-        <div id="catcher_<?php echo $map_canvas_name;?>"></div>
194
+        <div id="catcher_<?php echo $map_canvas_name; ?>"></div>
195 195
         <div class="stick_trigger_container">
196 196
             <div class="trigger_sticky triggeroff_sticky"></div>
197
-            <div class="top_banner_section geodir_map_container <?php echo $map_class_name;?>"
198
-                 id="sticky_map_<?php echo $map_canvas_name;?>"
199
-                 style="min-height:<?php echo $geodir_map_options['height'];?>;width:<?php echo $map_width;?>;">
197
+            <div class="top_banner_section geodir_map_container <?php echo $map_class_name; ?>"
198
+                 id="sticky_map_<?php echo $map_canvas_name; ?>"
199
+                 style="min-height:<?php echo $geodir_map_options['height']; ?>;width:<?php echo $map_width; ?>;">
200 200
 
201 201
                 <div class="map_background">
202 202
                     <div class="top_banner_section_in clearfix">
203
-                        <div class="<?php echo $map_canvas_name;?>_TopLeft TopLeft"><span class="triggermap" id="<?php echo $map_canvas_name;?>_triggermap" <?php if (!$geodir_map_options['enable_map_resize_button']) { ?> <?php }?>><i class="fa fa-arrows-alt"></i></span></div>
204
-                        <div class="<?php echo $map_canvas_name;?>_TopRight TopRight"></div>
205
-                        <div id="<?php echo $map_canvas_name;?>_wrapper" class="main_map_wrapper"
206
-                             style="height:<?php echo $geodir_map_options['height'];?>;width:<?php echo $map_width;?>;">
203
+                        <div class="<?php echo $map_canvas_name; ?>_TopLeft TopLeft"><span class="triggermap" id="<?php echo $map_canvas_name; ?>_triggermap" <?php if (!$geodir_map_options['enable_map_resize_button']) { ?> <?php }?>><i class="fa fa-arrows-alt"></i></span></div>
204
+                        <div class="<?php echo $map_canvas_name; ?>_TopRight TopRight"></div>
205
+                        <div id="<?php echo $map_canvas_name; ?>_wrapper" class="main_map_wrapper"
206
+                             style="height:<?php echo $geodir_map_options['height']; ?>;width:<?php echo $map_width; ?>;">
207 207
                             <!-- new map start -->
208 208
                             <div class="iprelative">
209
-                                <div class="geodir_marker_cluster" id="<?php echo $map_canvas_name;?>"
210
-                                     style="height:<?php echo $geodir_map_options['height'];?>;width:<?php echo $map_width;?>;"></div>
211
-                                <div id="<?php echo $map_canvas_name;?>_loading_div" class="loading_div"
212
-                                     style=" height:<?php echo $geodir_map_options['height'];?>;width:<?php echo $map_width;?>;"></div>
209
+                                <div class="geodir_marker_cluster" id="<?php echo $map_canvas_name; ?>"
210
+                                     style="height:<?php echo $geodir_map_options['height']; ?>;width:<?php echo $map_width; ?>;"></div>
211
+                                <div id="<?php echo $map_canvas_name; ?>_loading_div" class="loading_div"
212
+                                     style=" height:<?php echo $geodir_map_options['height']; ?>;width:<?php echo $map_width; ?>;"></div>
213 213
                                 <!--<div id="home_map_counter"></div>        -->
214
-                                <div id="<?php echo $map_canvas_name;?>_map_nofound"
214
+                                <div id="<?php echo $map_canvas_name; ?>_map_nofound"
215 215
                                      class="advmap_nofound"><?php echo MAP_NO_RESULTS; ?></div>
216
-                                <div id="<?php echo $map_canvas_name;?>_map_notloaded"
216
+                                <div id="<?php echo $map_canvas_name; ?>_map_notloaded"
217 217
                                      class="advmap_notloaded"><?php _e('<h3>Google Map Not Loaded</h3><p>Sorry, unable to load Google Maps API.', 'geodirectory'); ?></div>
218 218
                             </div>
219 219
                             <!-- new map end -->
220 220
                         </div>
221
-                        <div class="<?php echo $map_canvas_name;?>_BottomLeft BottomLeft"></div>
221
+                        <div class="<?php echo $map_canvas_name; ?>_BottomLeft BottomLeft"></div>
222 222
                     </div>
223 223
                 </div>
224 224
                 <?php if ($geodir_map_options['enable_jason_on_load']) { ?>
225
-                    <input type="hidden" id="<?php echo $map_canvas_name;?>_jason_enabled" value="1"/>
225
+                    <input type="hidden" id="<?php echo $map_canvas_name; ?>_jason_enabled" value="1"/>
226 226
                 <?php } else {
227 227
                     ?>
228
-                    <input type="hidden" id="<?php echo $map_canvas_name;?>_jason_enabled" value="0"/>
228
+                    <input type="hidden" id="<?php echo $map_canvas_name; ?>_jason_enabled" value="0"/>
229 229
                 <?php }
230 230
 
231 231
                 if (!$geodir_map_options['enable_text_search'] && !$geodir_map_options['enable_cat_filters'])
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
                       <div class="gd-input-group-addon gd-directions-right gd-mylocation-go"><input type="button" value="<?php _e('Get Directions', 'geodirectory'); ?>" class="<?php echo $map_canvas_name; ?>_getdirection" id="directions" onclick="calcRoute('<?php echo $map_canvas_name; ?>')" /></div>
246 246
                     </div>
247 247
                     <script>
248
-                        <?php if(geodir_is_page('detail')){?>
248
+                        <?php if (geodir_is_page('detail')) {?>
249 249
                         jQuery(function () {
250 250
                             gd_initialize_ac();
251 251
                         });
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
                                 // Create the autocomplete object, restricting the search
257 257
                                 // to geographical location types.
258 258
                                 autocomplete = new google.maps.places.Autocomplete(
259
-                                    /** @type {HTMLInputElement} */(document.getElementById('<?php echo $map_canvas_name;?>_fromAddress')),
259
+                                    /** @type {HTMLInputElement} */(document.getElementById('<?php echo $map_canvas_name; ?>_fromAddress')),
260 260
                                     {types: ['geocode']});
261 261
                                 // When the user selects an address from the dropdown,
262 262
                                 // populate the address fields in the form.
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
                                 
271 271
                                 if (window.gdMaps == 'osm') {
272 272
                                     window.setTimeout(function() {
273
-                                        calcRoute('<?php echo $map_canvas_name;?>');
273
+                                        calcRoute('<?php echo $map_canvas_name; ?>');
274 274
                                     }, 1000);
275 275
                                 }
276 276
                             }
@@ -324,7 +324,7 @@  discard block
 block discarded – undo
324 324
 				 */
325 325
 				$map_search_pt = apply_filters('geodir_default_map_search_pt', $geodir_default_map_search_pt);
326 326
 				?>
327
-                <div class="map-category-listing-main" style="display:<?php echo $show_entire_cat_panel;?>">
327
+                <div class="map-category-listing-main" style="display:<?php echo $show_entire_cat_panel; ?>">
328 328
                     <?php
329 329
                     $exclude_post_types = get_option('geodir_exclude_post_type_on_map');
330 330
                     $geodir_available_pt_on_map = count(geodir_get_posttypes('array')) - count($exclude_post_types);
@@ -334,12 +334,12 @@  discard block
 block discarded – undo
334 334
 					}
335 335
                     ?>
336 336
                     <div
337
-                        class="map-category-listing<?php echo $map_cat_class;?>">
337
+                        class="map-category-listing<?php echo $map_cat_class; ?>">
338 338
                         <div class="gd-trigger gd-triggeroff"><i class="fa fa-compress"></i><i class="fa fa-expand"></i></div>
339
-                        <div id="<?php echo $map_canvas_name;?>_cat"
340
-                             class="<?php echo $map_canvas_name;?>_map_category  map_category"
341
-                             <?php if ($child_collapse){ ?>checked="checked" <?php }?>
342
-                             style="max-height:<?php echo $geodir_map_options['height'];?>;">
339
+                        <div id="<?php echo $map_canvas_name; ?>_cat"
340
+                             class="<?php echo $map_canvas_name; ?>_map_category  map_category"
341
+                             <?php if ($child_collapse) { ?>checked="checked" <?php }?>
342
+                             style="max-height:<?php echo $geodir_map_options['height']; ?>;">
343 343
                             <input
344 344
                                 onkeydown="if(event.keyCode == 13){build_map_ajax_search_param('<?php echo $map_canvas_name; ?>', false)}"
345 345
                                 type="text"
@@ -351,11 +351,11 @@  discard block
 block discarded – undo
351 351
                                     <input type="hidden" id="<?php echo $map_canvas_name; ?>_child_collapse" value="1"/>
352 352
                                 <?php } else {$child_collapse = "0";
353 353
                                     ?>
354
-                                    <input type="hidden" id="<?php echo $map_canvas_name;?>_child_collapse" value="0"/>
354
+                                    <input type="hidden" id="<?php echo $map_canvas_name; ?>_child_collapse" value="0"/>
355 355
                                 <?php } ?>
356 356
                                 <input type="hidden" id="<?php echo $map_canvas_name; ?>_cat_enabled" value="1"/>
357 357
                                 <div class="geodir_toggle">
358
-                                    <?php echo home_map_taxonomy_walker(array($map_search_pt.'category'),0,true,0,$map_canvas_name,$child_collapse,true); ?>
358
+                                    <?php echo home_map_taxonomy_walker(array($map_search_pt.'category'), 0, true, 0, $map_canvas_name, $child_collapse, true); ?>
359 359
                                     <script>jQuery( document ).ready(function() {
360 360
                                             geodir_show_sub_cat_collapse_button();
361 361
                                         });</script>
@@ -384,21 +384,21 @@  discard block
 block discarded – undo
384 384
 					$city = $country != 'me' ? $city : '';
385 385
                     $gd_neighbourhood = $country != 'me' ? $gd_neighbourhood : '';
386 386
                     ?>
387
-                    <input type="hidden" id="<?php echo $map_canvas_name;?>_location_enabled" value="1"/>
388
-                    <input type="hidden" id="<?php echo $map_canvas_name;?>_country" name="gd_country"
389
-                           value="<?php echo $country;?>"/>
390
-                    <input type="hidden" id="<?php echo $map_canvas_name;?>_region" name="gd_region"
391
-                           value="<?php echo $region;?>"/>
392
-                    <input type="hidden" id="<?php echo $map_canvas_name;?>_city" name="gd_city"
393
-                           value="<?php echo $city;?>"/>
394
-                    <input type="hidden" id="<?php echo $map_canvas_name;?>_neighbourhood" name="gd_neighbourhood"
395
-                           value="<?php echo $gd_neighbourhood;?>"/>
387
+                    <input type="hidden" id="<?php echo $map_canvas_name; ?>_location_enabled" value="1"/>
388
+                    <input type="hidden" id="<?php echo $map_canvas_name; ?>_country" name="gd_country"
389
+                           value="<?php echo $country; ?>"/>
390
+                    <input type="hidden" id="<?php echo $map_canvas_name; ?>_region" name="gd_region"
391
+                           value="<?php echo $region; ?>"/>
392
+                    <input type="hidden" id="<?php echo $map_canvas_name; ?>_city" name="gd_city"
393
+                           value="<?php echo $city; ?>"/>
394
+                    <input type="hidden" id="<?php echo $map_canvas_name; ?>_neighbourhood" name="gd_neighbourhood"
395
+                           value="<?php echo $gd_neighbourhood; ?>"/>
396 396
                 <?php } else { //end of location filter
397 397
                     ?>
398
-                    <input type="hidden" id="<?php echo $map_canvas_name;?>_location_enabled" value="0"/>
398
+                    <input type="hidden" id="<?php echo $map_canvas_name; ?>_location_enabled" value="0"/>
399 399
                 <?php }?>
400 400
 
401
-                <input type="hidden" id="<?php echo $map_canvas_name;?>_posttype" name="gd_posttype" value="<?php echo $map_search_pt;?>"/>
401
+                <input type="hidden" id="<?php echo $map_canvas_name; ?>_posttype" name="gd_posttype" value="<?php echo $map_search_pt; ?>"/>
402 402
 
403 403
                 <input type="hidden" name="limitstart" value=""/>
404 404
 
@@ -415,8 +415,8 @@  discard block
 block discarded – undo
415 415
                     }
416 416
                     if (count($map_post_types) > 1) {
417 417
                         ?>
418
-                        <div class="map-places-listing" id="<?php echo $map_canvas_name;?>_posttype_menu"
419
-                             style="max-width:<?php echo $map_width;?>!important;">
418
+                        <div class="map-places-listing" id="<?php echo $map_canvas_name; ?>_posttype_menu"
419
+                             style="max-width:<?php echo $map_width; ?>!important;">
420 420
 
421 421
                             <?php if (isset($geodir_map_options['is_geodir_home_map_widget']) && $map_args['is_geodir_home_map_widget']) { ?>
422 422
                             <div class="geodir-map-posttype-list"><?php } ?>
@@ -427,7 +427,7 @@  discard block
 block discarded – undo
427 427
                                     foreach ($post_types as $post_type => $args) {
428 428
                                         if (!in_array($post_type, $exclude_post_types)) {
429 429
                                             $class = $map_search_pt == $post_type ? 'class="gd-map-search-pt"' : '';
430
-											echo '<li id="' . $post_type . '" ' . $class . '><a href="javascript:void(0);" onclick="jQuery(\'#' . $map_canvas_name . '_posttype\').val(\'' . $post_type . '\');build_map_ajax_search_param(\'' . $map_canvas_name . '\', true)">' . __($args->labels->name, 'geodirectory') . '</a></li>';
430
+											echo '<li id="'.$post_type.'" '.$class.'><a href="javascript:void(0);" onclick="jQuery(\'#'.$map_canvas_name.'_posttype\').val(\''.$post_type.'\');build_map_ajax_search_param(\''.$map_canvas_name.'\', true)">'.__($args->labels->name, 'geodirectory').'</a></li>';
431 431
                                         }
432 432
                                     }
433 433
                                     ?>
@@ -452,8 +452,8 @@  discard block
 block discarded – undo
452 452
         <script type="text/javascript">
453 453
 
454 454
             jQuery(document).ready(function () {
455
-                build_map_ajax_search_param('<?php echo $map_canvas_name;?>', false);
456
-                map_sticky('<?php echo $map_canvas_name;?>');
455
+                build_map_ajax_search_param('<?php echo $map_canvas_name; ?>', false);
456
+                map_sticky('<?php echo $map_canvas_name; ?>');
457 457
             });
458 458
 
459 459
         </script>
@@ -464,18 +464,18 @@  discard block
 block discarded – undo
464 464
             <script>
465 465
                 (function () {
466 466
                     var screenH = jQuery(window).height();
467
-                    var heightVH = "<?php echo str_replace("vh", "", $geodir_map_options['height']);?>";
467
+                    var heightVH = "<?php echo str_replace("vh", "", $geodir_map_options['height']); ?>";
468 468
 
469 469
                     var ptypeH = '';
470
-                    if (jQuery("#<?php echo $map_canvas_name;?>_posttype_menu").length) {
471
-                        ptypeH = jQuery("#<?php echo $map_canvas_name;?>_posttype_menu").outerHeight();
470
+                    if (jQuery("#<?php echo $map_canvas_name; ?>_posttype_menu").length) {
471
+                        ptypeH = jQuery("#<?php echo $map_canvas_name; ?>_posttype_menu").outerHeight();
472 472
                     }
473 473
 
474
-                    jQuery("#sticky_map_<?php echo $map_canvas_name;?>").css("min-height", screenH * (heightVH / 100) + 'px');
475
-                    jQuery("#<?php echo $map_canvas_name;?>_wrapper").height(screenH * (heightVH / 100) + 'px');
476
-                    jQuery("#<?php echo $map_canvas_name;?>").height(screenH * (heightVH / 100) + 'px');
477
-                    jQuery("#<?php echo $map_canvas_name;?>_loading_div").height(screenH * (heightVH / 100) + 'px');
478
-                    jQuery("#<?php echo $map_canvas_name;?>_cat").css("max-height", (screenH * (heightVH / 100)) - ptypeH + 'px');
474
+                    jQuery("#sticky_map_<?php echo $map_canvas_name; ?>").css("min-height", screenH * (heightVH / 100) + 'px');
475
+                    jQuery("#<?php echo $map_canvas_name; ?>_wrapper").height(screenH * (heightVH / 100) + 'px');
476
+                    jQuery("#<?php echo $map_canvas_name; ?>").height(screenH * (heightVH / 100) + 'px');
477
+                    jQuery("#<?php echo $map_canvas_name; ?>_loading_div").height(screenH * (heightVH / 100) + 'px');
478
+                    jQuery("#<?php echo $map_canvas_name; ?>_cat").css("max-height", (screenH * (heightVH / 100)) - ptypeH + 'px');
479 479
 
480 480
                 }());
481 481
             </script>
@@ -487,13 +487,13 @@  discard block
 block discarded – undo
487 487
             <script>
488 488
                 (function () {
489 489
                     var screenH = jQuery(window).height();
490
-                    var heightVH = "<?php echo str_replace("px", "", $geodir_map_options['height']);?>";
490
+                    var heightVH = "<?php echo str_replace("px", "", $geodir_map_options['height']); ?>";
491 491
                     var ptypeH = '';
492
-                    if (jQuery("#<?php echo $map_canvas_name;?>_posttype_menu").length) {
493
-                        ptypeH = jQuery("#<?php echo $map_canvas_name;?>_posttype_menu").outerHeight();
492
+                    if (jQuery("#<?php echo $map_canvas_name; ?>_posttype_menu").length) {
493
+                        ptypeH = jQuery("#<?php echo $map_canvas_name; ?>_posttype_menu").outerHeight();
494 494
                     }
495 495
 
496
-                    jQuery("#<?php echo $map_canvas_name;?>_cat").css("max-height", heightVH - ptypeH + 'px');
496
+                    jQuery("#<?php echo $map_canvas_name; ?>_cat").css("max-height", heightVH - ptypeH + 'px');
497 497
 
498 498
                 }());
499 499
             </script>
@@ -508,7 +508,7 @@  discard block
 block discarded – undo
508 508
          * @param array $geodir_map_options Array of map settings.
509 509
          * @param string $map_canvas_name The canvas name and ID for the map.
510 510
          */
511
-        do_action('geodir_map_after_render',$geodir_map_options,$map_canvas_name);
511
+        do_action('geodir_map_after_render', $geodir_map_options, $map_canvas_name);
512 512
 
513 513
 
514 514
     endif; // Exclude posttypes if end
Please login to merge, or discard this patch.