Test Failed
Pull Request — master (#473)
by Kiran
12:54
created
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.
geodirectory-functions/map-functions/map_on_add_listing_page.php 3 patches
Braces   +7 added lines, -5 removed lines patch added patch discarded remove patch
@@ -46,9 +46,10 @@  discard block
 block discarded – undo
46 46
 $default_lat = isset($default_location->city_latitude) ? $default_location->city_latitude : '';
47 47
 if (is_admin() && isset($_REQUEST['tab']) && $mapzoom == '') {
48 48
     $mapzoom = 4;
49
-    if (isset($_REQUEST['add_hood']))
50
-        $mapzoom = 10;
51
-}
49
+    if (isset($_REQUEST['add_hood'])) {
50
+            $mapzoom = 10;
51
+    }
52
+    }
52 53
 
53 54
 /**
54 55
  * Filter the auto change address fields values
@@ -737,8 +738,9 @@  discard block
 block discarded – undo
737 738
 </script>
738 739
 <?php
739 740
 $set_button_class = 'geodir_button';
740
-if (is_admin())
741
-    $set_button_class = 'button-primary';
741
+if (is_admin()) {
742
+    $set_button_class = 'button-primary';
743
+}
742 744
 ?>
743 745
 <input type="button" id="<?php echo $prefix; ?>set_address_button" class="<?php echo $set_button_class; ?>" value="<?php esc_attr_e($map_title, 'geodirectory'); ?>" style="float:none;"/>
744 746
 <div id="<?php echo $prefix; ?>d_mouseClick"></div>
Please login to merge, or discard this patch.
Indentation   +70 added lines, -70 removed lines patch added patch discarded remove patch
@@ -35,19 +35,19 @@  discard block
 block discarded – undo
35 35
 $defaultcity = isset($default_location->city) ? $default_location->city : '';
36 36
 $lat_lng_blank = false;
37 37
 if ($lat == '' && $lng == '') {
38
-    $lat_lng_blank = true;
39
-    $city = $defaultcity;
40
-    $region = isset($default_location->region) ? $default_location->region : '';
41
-    $country = isset($default_location->country) ? $default_location->country : '';
42
-    $lng = isset($default_location->city_longitude) ? $default_location->city_longitude : '';
43
-    $lat = isset($default_location->city_latitude) ? $default_location->city_latitude : '';
38
+	$lat_lng_blank = true;
39
+	$city = $defaultcity;
40
+	$region = isset($default_location->region) ? $default_location->region : '';
41
+	$country = isset($default_location->country) ? $default_location->country : '';
42
+	$lng = isset($default_location->city_longitude) ? $default_location->city_longitude : '';
43
+	$lat = isset($default_location->city_latitude) ? $default_location->city_latitude : '';
44 44
 }
45 45
 $default_lng = isset($default_location->city_longitude) ? $default_location->city_longitude : '';
46 46
 $default_lat = isset($default_location->city_latitude) ? $default_location->city_latitude : '';
47 47
 if (is_admin() && isset($_REQUEST['tab']) && $mapzoom == '') {
48
-    $mapzoom = 4;
49
-    if (isset($_REQUEST['add_hood']))
50
-        $mapzoom = 10;
48
+	$mapzoom = 4;
49
+	if (isset($_REQUEST['add_hood']))
50
+		$mapzoom = 10;
51 51
 }
52 52
 
53 53
 /**
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 	 * Fires at the start of the add javascript on the add lsitings map.
69 69
 	 *
70 70
 	 * @since 1.0.0
71
-     * @param string $prefix The prefix for all elements.
71
+	 * @param string $prefix The prefix for all elements.
72 72
 	 */
73 73
 	do_action('geodir_add_listing_js_start', $prefix);
74 74
 	?>
@@ -290,12 +290,12 @@  discard block
 block discarded – undo
290 290
             // fix for regions in GB
291 291
 
292 292
             $country_arr = <?php
293
-            /**
294
-             * Filter the regions array that uses administrative_area_level_2 instead of administrative_area_level_1.
295
-             *
296
-             * @since 1.6.16
297
-             */
298
-            echo apply_filters("geodir_geocode_region_level",'["GB","ES"]');?>;
293
+			/**
294
+			 * Filter the regions array that uses administrative_area_level_2 instead of administrative_area_level_1.
295
+			 *
296
+			 * @since 1.6.16
297
+			 */
298
+			echo apply_filters("geodir_geocode_region_level",'["GB","ES"]');?>;
299 299
             if (jQuery.inArray(rr, $country_arr) !== -1) {
300 300
                 if (administrative_area_level_2.long_name) {
301 301
                     getState = administrative_area_level_2.long_name;
@@ -396,13 +396,13 @@  discard block
 block discarded – undo
396 396
                 getZip = postal_code.long_name;
397 397
             }
398 398
             <?php 
399
-            /**
400
-             * Fires to add javascript variable to use in google map.
401
-             *
402
-             * @since 1.0.0
403
-             */
404
-            do_action('geodir_add_listing_geocode_js_vars');
405
-            ?>
399
+			/**
400
+			 * Fires to add javascript variable to use in google map.
401
+			 *
402
+			 * @since 1.0.0
403
+			 */
404
+			do_action('geodir_add_listing_geocode_js_vars');
405
+			?>
406 406
             <?php if ($is_map_restrict) { ?>
407 407
             if (getCity.toLowerCase() != '<?php echo geodir_strtolower(addslashes_gpc($city));?>') {
408 408
                 alert('<?php echo addslashes_gpc(wp_sprintf(__('Please choose any address of the (%s) city only.','geodirectory'), $city));?>');
@@ -483,15 +483,15 @@  discard block
 block discarded – undo
483 483
             }
484 484
         }
485 485
         <?php
486
-        /**
487
-         * Fires when marker address updated on map.
488
-         *
489
-         * @since 1.0.0
490
-         * @param string $prefix Identifier used as a prefix for field name
491
-         */
492
-        do_action('geodir_update_marker_address', $prefix);
493
-        echo $updateMarkerAddress = ob_get_clean();
494
-        ?>
486
+		/**
487
+		 * Fires when marker address updated on map.
488
+		 *
489
+		 * @since 1.0.0
490
+		 * @param string $prefix Identifier used as a prefix for field name
491
+		 */
492
+		do_action('geodir_update_marker_address', $prefix);
493
+		echo $updateMarkerAddress = ob_get_clean();
494
+		?>
495 495
     }
496 496
     function geodir_codeAddress(set_on_map) {
497 497
         var address = jQuery('#<?php echo $prefix.'address';?>').val();
@@ -506,17 +506,17 @@  discard block
 block discarded – undo
506 506
         }
507 507
         if(!ISO2){
508 508
             <?php
509
-            if(!defined('GEODIRLOCATION_TEXTDOMAIN')){
510
-                global $wpdb;
511
-                $location_result = geodir_get_default_location();
512
-                if(!empty($location_result)){
513
-                    $ISO2 = $wpdb->get_var($wpdb->prepare("SELECT ISO2 FROM " . GEODIR_COUNTRIES_TABLE . " WHERE Country=%s",$location_result->country));
514
-                    echo "ISO2 = '$ISO2';";
515
-                }
516
-            }
509
+			if(!defined('GEODIRLOCATION_TEXTDOMAIN')){
510
+				global $wpdb;
511
+				$location_result = geodir_get_default_location();
512
+				if(!empty($location_result)){
513
+					$ISO2 = $wpdb->get_var($wpdb->prepare("SELECT ISO2 FROM " . GEODIR_COUNTRIES_TABLE . " WHERE Country=%s",$location_result->country));
514
+					echo "ISO2 = '$ISO2';";
515
+				}
516
+			}
517 517
 
518 518
 
519
-            ?>
519
+			?>
520 520
         }
521 521
         if (ISO2 == '--') {
522 522
             ISO2 = '';
@@ -536,9 +536,9 @@  discard block
 block discarded – undo
536 536
         }
537 537
         var is_restrict = '<?php echo $is_map_restrict; ?>';
538 538
         <?php ob_start();
539
-        $defaultregion = isset($default_location->region) ? $default_location->region : '';
540
-        $defaultcountry = isset($default_location->country) ? $default_location->country : '';
541
-        ?>
539
+		$defaultregion = isset($default_location->region) ? $default_location->region : '';
540
+		$defaultcountry = isset($default_location->country) ? $default_location->country : '';
541
+		?>
542 542
         if (set_on_map && is_restrict) {
543 543
             if (zip != '' && address != '') {
544 544
                 address = address + ',' + zip;
@@ -550,12 +550,12 @@  discard block
 block discarded – undo
550 550
             if( address == city || address == region || address == country || address == zip )
551 551
                 address = '';
552 552
             <?php
553
-            if(is_admin() && isset($_REQUEST['tab'])){?>
553
+			if(is_admin() && isset($_REQUEST['tab'])){?>
554 554
             if (jQuery.trim(city) == '' || jQuery.trim(region) == '') {
555 555
                 address = '';
556 556
             }
557 557
             <?php
558
-               }?>
558
+			   }?>
559 559
 
560 560
             if (ISO2 == 'GB') {
561 561
                 if(ISO2){
@@ -579,15 +579,15 @@  discard block
 block discarded – undo
579 579
             address =  address.replace(",null,", ",");
580 580
         }
581 581
         <?php $codeAddress = ob_get_clean();
582
-        /**
583
-         * Filter the address variable
584
-         *
585
-         * @since 1.0.0
586
-         *
587
-         * @param string $codeAddress Row of address to use in google map.
588
-         */
589
-        echo apply_filters('geodir_codeaddress', $codeAddress);
590
-        ?>
582
+		/**
583
+		 * Filter the address variable
584
+		 *
585
+		 * @since 1.0.0
586
+		 *
587
+		 * @param string $codeAddress Row of address to use in google map.
588
+		 */
589
+		echo apply_filters('geodir_codeaddress', $codeAddress);
590
+		?>
591 591
         if (!window.gdMaps) { // No Google Map Loaded
592 592
             return;
593 593
         }
@@ -614,13 +614,13 @@  discard block
 block discarded – undo
614 614
                         updateMarkerPosition(baseMarker.getPosition());
615 615
                         //if(set_on_map && is_restrict) {
616 616
                         <?php 
617
-                        /**
618
-                         * Fires before set geocode position.
619
-                         *
620
-                         * @since 1.0.0
621
-                         */
622
-                        do_action('geodir_add_listing_codeaddress_before_geocode');
623
-                        ?>
617
+						/**
618
+						 * Fires before set geocode position.
619
+						 *
620
+						 * @since 1.0.0
621
+						 */
622
+						do_action('geodir_add_listing_codeaddress_before_geocode');
623
+						?>
624 624
                         geocodePosition(baseMarker.getPosition(), {'address': address, 'country': ISO2});
625 625
                         //}
626 626
                     } else {
@@ -666,13 +666,13 @@  discard block
 block discarded – undo
666 666
                 updateMarkerPositionOSM(baseMarker.getLatLng());
667 667
             }
668 668
             <?php 
669
-            /**
670
-             * Fires to add javascript variable to use in google map.
671
-             *
672
-             * @since 1.0.0
673
-             */
674
-            do_action('geodir_add_listing_geocode_js_vars');
675
-            ?>
669
+			/**
670
+			 * Fires to add javascript variable to use in google map.
671
+			 *
672
+			 * @since 1.0.0
673
+			 */
674
+			do_action('geodir_add_listing_geocode_js_vars');
675
+			?>
676 676
             <?php if ($is_map_restrict) { ?>
677 677
             if (getCity.toLowerCase() != '<?php echo geodir_strtolower(addslashes_gpc($city));?>') {
678 678
                 alert('<?php echo addslashes_gpc(wp_sprintf(__('Please choose any address of the (%s) city only.','geodirectory'), $city));?>');
@@ -821,7 +821,7 @@  discard block
 block discarded – undo
821 821
 <?php
822 822
 $set_button_class = 'geodir_button';
823 823
 if (is_admin())
824
-    $set_button_class = 'button-primary';
824
+	$set_button_class = 'button-primary';
825 825
 ?>
826 826
 <input type="button" id="<?php echo $prefix; ?>set_address_button" class="<?php echo $set_button_class; ?>" value="<?php esc_attr_e($map_title, 'geodirectory'); ?>" style="float:none;"/>
827 827
 <div id="<?php echo $prefix; ?>d_mouseClick"></div>
Please login to merge, or discard this patch.
Spacing   +82 added lines, -82 removed lines patch added patch discarded remove patch
@@ -82,16 +82,16 @@  discard block
 block discarded – undo
82 82
     window.gdMaps = window.gdMaps || gdMaps;
83 83
     
84 84
     user_address = false;
85
-    jQuery('#<?php echo $prefix.'address';?>').keypress(function () {
85
+    jQuery('#<?php echo $prefix.'address'; ?>').keypress(function () {
86 86
         user_address = true;
87 87
     });
88 88
 
89 89
     baseMarker = '';
90 90
     geocoder = '';
91
-    var <?php echo $prefix;?>CITY_MAP_CENTER_LAT = <?php echo ($lat) ? $lat :  '39.952484'; ?>;
92
-    var <?php echo $prefix;?>CITY_MAP_CENTER_LNG = <?php echo ($lng) ? $lng :  '-75.163786'; ?>;
93
-    <?php if($lat_lng_blank){$lat='';$lng='';}?>
94
-    var <?php echo $prefix;?>CITY_MAP_ZOOMING_FACT = <?php echo ($mapzoom) ? $mapzoom : 12;?>;
91
+    var <?php echo $prefix; ?>CITY_MAP_CENTER_LAT = <?php echo ($lat) ? $lat : '39.952484'; ?>;
92
+    var <?php echo $prefix; ?>CITY_MAP_CENTER_LNG = <?php echo ($lng) ? $lng : '-75.163786'; ?>;
93
+    <?php if ($lat_lng_blank) {$lat = ''; $lng = ''; }?>
94
+    var <?php echo $prefix; ?>CITY_MAP_ZOOMING_FACT = <?php echo ($mapzoom) ? $mapzoom : 12; ?>;
95 95
     var minZoomLevel = <?php echo ($is_map_restrict) ? 5 : 0; ?>;
96 96
     var oldstr_address;
97 97
     var oldstr_zip;
@@ -295,7 +295,7 @@  discard block
 block discarded – undo
295 295
              *
296 296
              * @since 1.6.16
297 297
              */
298
-            echo apply_filters("geodir_geocode_region_level",'["GB","ES"]');?>;
298
+            echo apply_filters("geodir_geocode_region_level", '["GB","ES"]'); ?>;
299 299
             if (jQuery.inArray(rr, $country_arr) !== -1) {
300 300
                 if (administrative_area_level_2.long_name) {
301 301
                     getState = administrative_area_level_2.long_name;
@@ -404,9 +404,9 @@  discard block
 block discarded – undo
404 404
             do_action('geodir_add_listing_geocode_js_vars');
405 405
             ?>
406 406
             <?php if ($is_map_restrict) { ?>
407
-            if (getCity.toLowerCase() != '<?php echo geodir_strtolower(addslashes_gpc($city));?>') {
408
-                alert('<?php echo addslashes_gpc(wp_sprintf(__('Please choose any address of the (%s) city only.','geodirectory'), $city));?>');
409
-                jQuery("#<?php echo $prefix.'map';?>").goMap();
407
+            if (getCity.toLowerCase() != '<?php echo geodir_strtolower(addslashes_gpc($city)); ?>') {
408
+                alert('<?php echo addslashes_gpc(wp_sprintf(__('Please choose any address of the (%s) city only.', 'geodirectory'), $city)); ?>');
409
+                jQuery("#<?php echo $prefix.'map'; ?>").goMap();
410 410
                 jQuery.goMap.map.setCenter(new google.maps.LatLng('<?php echo $default_lat; ?>', '<?php echo $default_lng; ?>'));
411 411
                 baseMarker.setPosition(new google.maps.LatLng('<?php echo $default_lat; ?>', '<?php echo $default_lng; ?>'));
412 412
                 updateMarkerPosition(baseMarker.getPosition());
@@ -415,11 +415,11 @@  discard block
 block discarded – undo
415 415
             <?php } ?>
416 416
             updateMarkerAddress(getAddress, getZip, getCity, getState, getCountry);
417 417
         } else {
418
-            updateMarkerAddress('<?php echo addslashes_gpc(__('Cannot determine address at this location.','geodirectory'));?>');
418
+            updateMarkerAddress('<?php echo addslashes_gpc(__('Cannot determine address at this location.', 'geodirectory')); ?>');
419 419
         }
420 420
     }
421 421
     function centerMap(latlng) {
422
-        jQuery("#<?php echo $prefix.'map';?>").goMap();
422
+        jQuery("#<?php echo $prefix.'map'; ?>").goMap();
423 423
         if (window.gdMaps == 'google') {
424 424
             jQuery.goMap.map.panTo(baseMarker.getPosition());
425 425
         } else if (window.gdMaps == 'osm') {
@@ -428,7 +428,7 @@  discard block
 block discarded – undo
428 428
         }
429 429
     }
430 430
     function centerMarker() {
431
-        jQuery("#<?php echo $prefix.'map';?>").goMap();
431
+        jQuery("#<?php echo $prefix.'map'; ?>").goMap();
432 432
         var center = jQuery.goMap.map.getCenter();
433 433
         if (window.gdMaps == 'google') {
434 434
             baseMarker.setPosition(center);
@@ -437,48 +437,48 @@  discard block
 block discarded – undo
437 437
         }
438 438
     }
439 439
     function updateMapZoom(zoom) {
440
-        jQuery('#<?php echo $prefix.'mapzoom';?>').val(zoom);
440
+        jQuery('#<?php echo $prefix.'mapzoom'; ?>').val(zoom);
441 441
     }
442 442
     function updateMarkerPosition(markerlatLng) {
443
-        jQuery("#<?php echo $prefix.'map';?>").goMap();
444
-        jQuery('#<?php echo $prefix.'latitude';?>').val(markerlatLng.lat());
445
-        jQuery('#<?php echo $prefix.'longitude';?>').val(markerlatLng.lng());
443
+        jQuery("#<?php echo $prefix.'map'; ?>").goMap();
444
+        jQuery('#<?php echo $prefix.'latitude'; ?>').val(markerlatLng.lat());
445
+        jQuery('#<?php echo $prefix.'longitude'; ?>').val(markerlatLng.lng());
446 446
     }
447 447
     function updateMarkerPositionOSM(markerlatLng) {
448
-        jQuery('#<?php echo $prefix.'latitude';?>').val(markerlatLng.lat);
449
-        jQuery('#<?php echo $prefix.'longitude';?>').val(markerlatLng.lng);
448
+        jQuery('#<?php echo $prefix.'latitude'; ?>').val(markerlatLng.lat);
449
+        jQuery('#<?php echo $prefix.'longitude'; ?>').val(markerlatLng.lng);
450 450
     }
451 451
     function updateMarkerAddress(getAddress, getZip, getCity, getState, getCountry) {
452
-        var set_map_val_in_fields = '<?php echo addslashes_gpc($auto_change_map_fields);?>';
453
-        <?php ob_start();?>
454
-        var old_country = jQuery("#<?php echo $prefix.'country';?>").val();
455
-        var old_region = jQuery("#<?php echo $prefix.'region';?>").val();
452
+        var set_map_val_in_fields = '<?php echo addslashes_gpc($auto_change_map_fields); ?>';
453
+        <?php ob_start(); ?>
454
+        var old_country = jQuery("#<?php echo $prefix.'country'; ?>").val();
455
+        var old_region = jQuery("#<?php echo $prefix.'region'; ?>").val();
456 456
         
457
-        if (user_address == false || jQuery('#<?php echo $prefix.'address';?>').val() == '') {
458
-            jQuery("#<?php echo $prefix.'address';?>").val(getAddress).trigger("blur");
457
+        if (user_address == false || jQuery('#<?php echo $prefix.'address'; ?>').val() == '') {
458
+            jQuery("#<?php echo $prefix.'address'; ?>").val(getAddress).trigger("blur");
459 459
         }
460 460
         if (getAddress) {
461 461
             oldstr_address = getAddress;
462 462
         }
463 463
 
464
-        jQuery("#<?php echo $prefix.'zip';?>").val(getZip);
464
+        jQuery("#<?php echo $prefix.'zip'; ?>").val(getZip);
465 465
         if (getZip) {
466 466
             oldstr_zip = getZip;
467 467
         }
468 468
         if (set_map_val_in_fields) {
469 469
             if (getCountry) {
470
-                jQuery('#<?php echo $prefix .'country'; ?> option[value=""]').attr("selected",false);
471
-                jQuery('#<?php echo $prefix.'country';?> option[data-country_code="' + getCountryISO + '"]').attr("selected", true);
472
-                jQuery("#<?php echo $prefix.'country';?>").trigger("chosen:updated");
470
+                jQuery('#<?php echo $prefix.'country'; ?> option[value=""]').attr("selected",false);
471
+                jQuery('#<?php echo $prefix.'country'; ?> option[data-country_code="' + getCountryISO + '"]').attr("selected", true);
472
+                jQuery("#<?php echo $prefix.'country'; ?>").trigger("chosen:updated");
473 473
             }
474 474
             if (getState) {
475
-                if (jQuery('input[id="<?php echo $prefix.'region';?>"]').attr('id')) {
476
-                    jQuery("#<?php echo $prefix.'region';?>").val(getState);
475
+                if (jQuery('input[id="<?php echo $prefix.'region'; ?>"]').attr('id')) {
476
+                    jQuery("#<?php echo $prefix.'region'; ?>").val(getState);
477 477
                 }
478 478
             }
479 479
             if (getCity) {
480
-                if (jQuery('input[id="<?php echo $prefix.'city';?>"]').attr('id')) {
481
-                    jQuery("#<?php echo $prefix.'city';?>").val(getCity);
480
+                if (jQuery('input[id="<?php echo $prefix.'city'; ?>"]').attr('id')) {
481
+                    jQuery("#<?php echo $prefix.'city'; ?>").val(getCity);
482 482
                 }
483 483
             }
484 484
         }
@@ -494,23 +494,23 @@  discard block
 block discarded – undo
494 494
         ?>
495 495
     }
496 496
     function geodir_codeAddress(set_on_map) {
497
-        var address = jQuery('#<?php echo $prefix.'address';?>').val();
498
-        var zip = jQuery('#<?php echo $prefix.'zip';?>').val();
499
-        var city = jQuery('#<?php echo $prefix.'city';?>').val();
500
-        var region = jQuery('#<?php echo $prefix.'region';?>').val();
501
-        var country = jQuery('#<?php echo $prefix.'country';?>').val();
502
-        var country_selected = jQuery('#<?php echo $prefix.'country';?>').find('option:selected');
497
+        var address = jQuery('#<?php echo $prefix.'address'; ?>').val();
498
+        var zip = jQuery('#<?php echo $prefix.'zip'; ?>').val();
499
+        var city = jQuery('#<?php echo $prefix.'city'; ?>').val();
500
+        var region = jQuery('#<?php echo $prefix.'region'; ?>').val();
501
+        var country = jQuery('#<?php echo $prefix.'country'; ?>').val();
502
+        var country_selected = jQuery('#<?php echo $prefix.'country'; ?>').find('option:selected');
503 503
         var ISO2 = country_selected.data('country_code');
504
-        if (!ISO2 && jQuery('#<?php echo $prefix.'country';?>').data('country_code')) {
505
-            ISO2 = jQuery('#<?php echo $prefix.'country';?>').data('country_code');
504
+        if (!ISO2 && jQuery('#<?php echo $prefix.'country'; ?>').data('country_code')) {
505
+            ISO2 = jQuery('#<?php echo $prefix.'country'; ?>').data('country_code');
506 506
         }
507 507
         if(!ISO2){
508 508
             <?php
509
-            if(!defined('GEODIRLOCATION_TEXTDOMAIN')){
509
+            if (!defined('GEODIRLOCATION_TEXTDOMAIN')) {
510 510
                 global $wpdb;
511 511
                 $location_result = geodir_get_default_location();
512
-                if(!empty($location_result)){
513
-                    $ISO2 = $wpdb->get_var($wpdb->prepare("SELECT ISO2 FROM " . GEODIR_COUNTRIES_TABLE . " WHERE Country=%s",$location_result->country));
512
+                if (!empty($location_result)) {
513
+                    $ISO2 = $wpdb->get_var($wpdb->prepare("SELECT ISO2 FROM ".GEODIR_COUNTRIES_TABLE." WHERE Country=%s", $location_result->country));
514 514
                     echo "ISO2 = '$ISO2';";
515 515
                 }
516 516
             }
@@ -526,13 +526,13 @@  discard block
 block discarded – undo
526 526
             zip = '';
527 527
         }
528 528
         if (typeof city == "undefined") {
529
-            city = '<?php echo addslashes_gpc($city);?>';
529
+            city = '<?php echo addslashes_gpc($city); ?>';
530 530
         }
531 531
         if (typeof region == "undefined") {
532
-            region = '<?php echo addslashes_gpc($region);?>';
532
+            region = '<?php echo addslashes_gpc($region); ?>';
533 533
         }
534 534
         if (typeof country == "undefined") {
535
-            country = '<?php echo addslashes_gpc($country);?>';
535
+            country = '<?php echo addslashes_gpc($country); ?>';
536 536
         }
537 537
         var is_restrict = '<?php echo $is_map_restrict; ?>';
538 538
         <?php ob_start();
@@ -550,7 +550,7 @@  discard block
 block discarded – undo
550 550
             if( address == city || address == region || address == country || address == zip )
551 551
                 address = '';
552 552
             <?php
553
-            if(is_admin() && isset($_REQUEST['tab'])){?>
553
+            if (is_admin() && isset($_REQUEST['tab'])) {?>
554 554
             if (jQuery.trim(city) == '' || jQuery.trim(region) == '') {
555 555
                 address = '';
556 556
             }
@@ -607,7 +607,7 @@  discard block
 block discarded – undo
607 607
             geocoder.geocode({'address': address, 'country': ISO2},
608 608
                 function (results, status) {
609 609
                     console.log(status);
610
-                    jQuery("#<?php echo $prefix.'map';?>").goMap();
610
+                    jQuery("#<?php echo $prefix.'map'; ?>").goMap();
611 611
                     if (status == google.maps.GeocoderStatus.OK) {
612 612
                         baseMarker.setPosition(results[0].geometry.location);
613 613
                         jQuery.goMap.map.setCenter(results[0].geometry.location);
@@ -624,21 +624,21 @@  discard block
 block discarded – undo
624 624
                         geocodePosition(baseMarker.getPosition(), {'address': address, 'country': ISO2});
625 625
                         //}
626 626
                     } else {
627
-                        alert('<?php echo addslashes_gpc(__('Geocode was not successful for the following reason:','geodirectory'));?> ' + status);
627
+                        alert('<?php echo addslashes_gpc(__('Geocode was not successful for the following reason:', 'geodirectory')); ?> ' + status);
628 628
                     }
629 629
                 });
630 630
         }
631 631
     }
632 632
     function gdMaxMap() {
633
-        jQuery("#<?php echo $prefix.'map';?>").goMap();
633
+        jQuery("#<?php echo $prefix.'map'; ?>").goMap();
634 634
 
635
-        jQuery('#<?php echo $prefix.'map';?>').toggleClass('map-fullscreen');
635
+        jQuery('#<?php echo $prefix.'map'; ?>').toggleClass('map-fullscreen');
636 636
         jQuery('.map_category').toggleClass('map_category_fullscreen');
637
-        jQuery('#<?php echo $prefix;?>trigger').toggleClass('map_category_fullscreen');
637
+        jQuery('#<?php echo $prefix; ?>trigger').toggleClass('map_category_fullscreen');
638 638
         jQuery('body').toggleClass('body_fullscreen');
639
-        jQuery('#<?php echo $prefix;?>loading_div').toggleClass('loading_div_fullscreen');
640
-        jQuery('#<?php echo $prefix;?>advmap_nofound').toggleClass('nofound_fullscreen');
641
-        jQuery('#<?php echo $prefix;?>triggermap').toggleClass('triggermap_fullscreen');
639
+        jQuery('#<?php echo $prefix; ?>loading_div').toggleClass('loading_div_fullscreen');
640
+        jQuery('#<?php echo $prefix; ?>advmap_nofound').toggleClass('nofound_fullscreen');
641
+        jQuery('#<?php echo $prefix; ?>triggermap').toggleClass('triggermap_fullscreen');
642 642
         jQuery('.TopLeft').toggleClass('TopLeft_fullscreen');
643 643
         window.setTimeout(function () {
644 644
             if (window.gdMaps == 'google') {
@@ -674,9 +674,9 @@  discard block
 block discarded – undo
674 674
             do_action('geodir_add_listing_geocode_js_vars');
675 675
             ?>
676 676
             <?php if ($is_map_restrict) { ?>
677
-            if (getCity.toLowerCase() != '<?php echo geodir_strtolower(addslashes_gpc($city));?>') {
678
-                alert('<?php echo addslashes_gpc(wp_sprintf(__('Please choose any address of the (%s) city only.','geodirectory'), $city));?>');
679
-                jQuery("#<?php echo $prefix.'map';?>").goMap();
677
+            if (getCity.toLowerCase() != '<?php echo geodir_strtolower(addslashes_gpc($city)); ?>') {
678
+                alert('<?php echo addslashes_gpc(wp_sprintf(__('Please choose any address of the (%s) city only.', 'geodirectory'), $city)); ?>');
679
+                jQuery("#<?php echo $prefix.'map'; ?>").goMap();
680 680
                 centerMap(new L.latLng('<?php echo $default_lat; ?>', '<?php echo $default_lng; ?>'));
681 681
                 baseMarker.setLatLng(new L.latLng('<?php echo $default_lat; ?>', '<?php echo $default_lng; ?>'));
682 682
                 updateMarkerPositionOSM(baseMarker.getLatLng());
@@ -685,39 +685,39 @@  discard block
 block discarded – undo
685 685
             <?php } ?>
686 686
             updateMarkerAddress(getAddress, getZip, getCity, getState, getCountry);
687 687
         } else {
688
-            alert('<?php echo addslashes_gpc(__('Cannot determine address at this location.','geodirectory'));?>');
688
+            alert('<?php echo addslashes_gpc(__('Cannot determine address at this location.', 'geodirectory')); ?>');
689 689
         }
690 690
     }
691 691
     
692 692
     jQuery(function ($) {
693
-        $("#<?php echo $prefix.'map';?>").goMap({
694
-            latitude: <?php echo $prefix;?>CITY_MAP_CENTER_LAT,
695
-            longitude: <?php echo $prefix;?>CITY_MAP_CENTER_LNG,
696
-            zoom: <?php echo $prefix;?>CITY_MAP_ZOOMING_FACT,
693
+        $("#<?php echo $prefix.'map'; ?>").goMap({
694
+            latitude: <?php echo $prefix; ?>CITY_MAP_CENTER_LAT,
695
+            longitude: <?php echo $prefix; ?>CITY_MAP_CENTER_LNG,
696
+            zoom: <?php echo $prefix; ?>CITY_MAP_ZOOMING_FACT,
697 697
             maptype: 'ROADMAP', // Map type - HYBRID, ROADMAP, SATELLITE, TERRAIN
698 698
             streetViewControl: true,
699
-            <?php if(get_option('geodir_add_listing_mouse_scroll')) { echo 'scrollwheel: false,';}?>
699
+            <?php if (get_option('geodir_add_listing_mouse_scroll')) { echo 'scrollwheel: false,'; }?>
700 700
         });
701 701
 
702 702
         if (window.gdMaps) {
703 703
             geocoder = window.gdMaps == 'google' ? new google.maps.Geocoder() : [];
704 704
 
705 705
             baseMarker = $.goMap.createMarker({
706
-                latitude: <?php echo $prefix;?>CITY_MAP_CENTER_LAT,
707
-                longitude: <?php echo $prefix;?>CITY_MAP_CENTER_LNG,
706
+                latitude: <?php echo $prefix; ?>CITY_MAP_CENTER_LAT,
707
+                longitude: <?php echo $prefix; ?>CITY_MAP_CENTER_LNG,
708 708
                 id: 'baseMarker',
709
-                icon: '<?php echo $marker_icon;?>',
709
+                icon: '<?php echo $marker_icon; ?>',
710 710
                 draggable: true,
711 711
                 addToMap: true, // For OSM
712
-                w: parseFloat('<?php echo $icon_size['w'];?>'),
713
-                h: parseFloat('<?php echo $icon_size['h'];?>'),
712
+                w: parseFloat('<?php echo $icon_size['w']; ?>'),
713
+                h: parseFloat('<?php echo $icon_size['h']; ?>'),
714 714
             });
715 715
         } else {
716
-            jQuery('#<?php echo $prefix.'advmap_nofound';?>').hide();
717
-            jQuery('#<?php echo $prefix.'advmap_notloaded';?>').show();
716
+            jQuery('#<?php echo $prefix.'advmap_nofound'; ?>').hide();
717
+            jQuery('#<?php echo $prefix.'advmap_notloaded'; ?>').show();
718 718
         }
719 719
         
720
-        $("#<?php echo $prefix;?>set_address_button").click(function () {
720
+        $("#<?php echo $prefix; ?>set_address_button").click(function () {
721 721
             var set_on_map = true;
722 722
             geodir_codeAddress(set_on_map);
723 723
         });
@@ -752,14 +752,14 @@  discard block
 block discarded – undo
752 752
                 updateMapZoom($.goMap.map.zoom);
753 753
             });
754 754
 
755
-            var maxMap = document.getElementById('<?php echo $prefix;?>triggermap');
755
+            var maxMap = document.getElementById('<?php echo $prefix; ?>triggermap');
756 756
             google.maps.event.addDomListener(maxMap, 'click', gdMaxMap);
757 757
 
758 758
             <?php if ($is_map_restrict) { ?>
759
-            var CITY_ADDRESS = '<?php echo addslashes_gpc($city).','.addslashes_gpc($region).','.addslashes_gpc($country);?>';
759
+            var CITY_ADDRESS = '<?php echo addslashes_gpc($city).','.addslashes_gpc($region).','.addslashes_gpc($country); ?>';
760 760
             geocoder.geocode({'address': CITY_ADDRESS},
761 761
                 function (results, status) {
762
-                    $("#<?php echo $prefix.'map';?>").goMap();
762
+                    $("#<?php echo $prefix.'map'; ?>").goMap();
763 763
                     if (status == google.maps.GeocoderStatus.OK) {
764 764
                         // Bounds for North America
765 765
                         var bound_lat_lng = String(results[0].geometry.bounds);
@@ -770,13 +770,13 @@  discard block
 block discarded – undo
770 770
                             new google.maps.LatLng(bound_lat_lng[2], bound_lat_lng[3])
771 771
                         );
772 772
                     } else {
773
-                        alert("<?php _e('Geocode was not successful for the following reason:','geodirectory');?> " + status);
773
+                        alert("<?php _e('Geocode was not successful for the following reason:', 'geodirectory'); ?> " + status);
774 774
                     }
775 775
                 });
776 776
             <?php } ?>
777 777
             // Limit the zoom level
778 778
             google.maps.event.addListener($.goMap.map, 'zoom_changed', function () {
779
-                $("#<?php echo $prefix.'map';?>").goMap();
779
+                $("#<?php echo $prefix.'map'; ?>").goMap();
780 780
                 if ($.goMap.map.getZoom() < minZoomLevel) $.goMap.map.setZoom(minZoomLevel);
781 781
             });
782 782
         } else if (window.gdMaps == 'osm') {
@@ -802,10 +802,10 @@  discard block
 block discarded – undo
802 802
                 updateMapZoom($.goMap.map.getZoom());
803 803
             });
804 804
 
805
-            L.DomEvent.addListener($('<?php echo $prefix;?>triggermap'), 'click', gdMaxMap);
805
+            L.DomEvent.addListener($('<?php echo $prefix; ?>triggermap'), 'click', gdMaxMap);
806 806
 
807 807
             <?php if ($is_map_restrict) { ?>
808
-            var CITY_ADDRESS = '<?php echo addslashes_gpc($city).', '.addslashes_gpc($region).', '.addslashes_gpc($country);?>';
808
+            var CITY_ADDRESS = '<?php echo addslashes_gpc($city).', '.addslashes_gpc($region).', '.addslashes_gpc($country); ?>';
809 809
             //geocodePositionOSM('', CITY_ADDRESS);
810 810
             <?php } ?>
811 811
             // Limit the zoom level
@@ -828,14 +828,14 @@  discard block
 block discarded – undo
828 828
 <div class="top_banner_section_inn geodir_map_container clearfix" style="margin-top:10px;">
829 829
     <div class="TopLeft"><span id="<?php echo $prefix; ?>triggermap" style="margin-top:-11px;margin-left:-12px;"></span></div>
830 830
     <div class="TopRight"></div>
831
-    <div id="<?php echo $prefix . 'map'; ?>" class="geodir_map" style="height:300px">
831
+    <div id="<?php echo $prefix.'map'; ?>" class="geodir_map" style="height:300px">
832 832
         <!-- new map start -->
833 833
         <div class="iprelative">
834
-            <div id="<?php echo $prefix . 'map'; ?>" style="float:right;height:300px;position:relative;" class="form_row clearfix"></div>
834
+            <div id="<?php echo $prefix.'map'; ?>" style="float:right;height:300px;position:relative;" class="form_row clearfix"></div>
835 835
             <div id="<?php echo $prefix; ?>loading_div" style="height:300px"></div>
836 836
             <div id="<?php echo $prefix; ?>advmap_counter"></div>
837 837
             <div id="<?php echo $prefix; ?>advmap_nofound"><?php echo MAP_NO_RESULTS; ?></div>
838
-            <div id="<?php echo $prefix;?>advmap_notloaded" class="advmap_notloaded"><?php _e('<h3>Map Not Loaded</h3><p>Sorry, unable to load Maps API.', 'geodirectory'); ?></div>
838
+            <div id="<?php echo $prefix; ?>advmap_notloaded" class="advmap_notloaded"><?php _e('<h3>Map Not Loaded</h3><p>Sorry, unable to load Maps API.', 'geodirectory'); ?></div>
839 839
         </div>
840 840
         <!-- new map end -->
841 841
     </div>
Please login to merge, or discard this patch.
geodirectory_shortcodes.php 3 patches
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -427,7 +427,7 @@
 block discarded – undo
427 427
         }
428 428
 
429 429
         return $output;
430
-    }else{
430
+    } else{
431 431
         ob_start();
432 432
         add_action('wp_head', 'init_listing_map_script'); // Initialize the map object and marker array
433 433
         add_action('the_post', 'create_list_jsondata'); // Add marker in json array
Please login to merge, or discard this patch.
Indentation   +909 added lines, -909 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
  */
8 8
 // If this file is called directly, abort.
9 9
 if (!defined('WPINC')) {
10
-    die;
10
+	die;
11 11
 }
12 12
 require_once('geodirectory-functions/shortcode_functions.php');
13 13
 
@@ -32,43 +32,43 @@  discard block
 block discarded – undo
32 32
  */
33 33
 function geodir_sc_add_listing($atts)
34 34
 {
35
-    ob_start();
36
-    $defaults = array(
37
-        'pid' => '',
38
-        'listing_type' => 'gd_place',
39
-        'login_msg' => __('You must login to post.', 'geodirectory'),
40
-        'show_login' => false,
41
-    );
42
-    $params = shortcode_atts($defaults, $atts);
43
-
44
-    foreach ($params as $key => $value) {
45
-        $_REQUEST[$key] = $value;
46
-    }
47
-
48
-    $user_id = get_current_user_id();
49
-    if (!$user_id) {
50
-        echo $params['login_msg'];
51
-        if ($params['show_login']) {
52
-            echo "<br />";
53
-            $defaults = array(
54
-                'before_widget' => '',
55
-                'after_widget' => '',
56
-                'before_title' => '',
57
-                'after_title' => '',
58
-            );
59
-
60
-            geodir_loginwidget_output($defaults, $defaults);
61
-        }
62
-
63
-
64
-    } else {
65
-       // Add listing page will be used if shortcode is detected in page content, no need to call it here
66
-    }
67
-    $output = ob_get_contents();
68
-
69
-    ob_end_clean();
70
-
71
-    return $output;
35
+	ob_start();
36
+	$defaults = array(
37
+		'pid' => '',
38
+		'listing_type' => 'gd_place',
39
+		'login_msg' => __('You must login to post.', 'geodirectory'),
40
+		'show_login' => false,
41
+	);
42
+	$params = shortcode_atts($defaults, $atts);
43
+
44
+	foreach ($params as $key => $value) {
45
+		$_REQUEST[$key] = $value;
46
+	}
47
+
48
+	$user_id = get_current_user_id();
49
+	if (!$user_id) {
50
+		echo $params['login_msg'];
51
+		if ($params['show_login']) {
52
+			echo "<br />";
53
+			$defaults = array(
54
+				'before_widget' => '',
55
+				'after_widget' => '',
56
+				'before_title' => '',
57
+				'after_title' => '',
58
+			);
59
+
60
+			geodir_loginwidget_output($defaults, $defaults);
61
+		}
62
+
63
+
64
+	} else {
65
+	   // Add listing page will be used if shortcode is detected in page content, no need to call it here
66
+	}
67
+	$output = ob_get_contents();
68
+
69
+	ob_end_clean();
70
+
71
+	return $output;
72 72
 }
73 73
 
74 74
 /**
@@ -96,136 +96,136 @@  discard block
 block discarded – undo
96 96
  */
97 97
 function geodir_sc_home_map($atts)
98 98
 {
99
-    ob_start();
100
-    $defaults = array(
101
-        'width' => '960',
102
-        'height' => '425',
103
-        'maptype' => 'ROADMAP',
104
-        'zoom' => '13',
105
-        'autozoom' => '',
106
-        'child_collapse' => '0',
107
-        'scrollwheel' => '0',
99
+	ob_start();
100
+	$defaults = array(
101
+		'width' => '960',
102
+		'height' => '425',
103
+		'maptype' => 'ROADMAP',
104
+		'zoom' => '13',
105
+		'autozoom' => '',
106
+		'child_collapse' => '0',
107
+		'scrollwheel' => '0',
108 108
 		'marker_cluster' => false,
109
-        'latitude' => '',
110
-        'longitude' => ''
111
-    );
112
-
113
-    $params = shortcode_atts($defaults, $atts);
114
-
115
-    $params = gdsc_validate_map_args($params);
116
-
117
-    $map_args = array(
118
-        'map_canvas_name' => 'gd_home_map',
119
-        'latitude' => $params['latitude'],
120
-        'longitude' => $params['longitude'],
121
-
122
-        /**
123
-         * Filter the widget width of the map on home/listings page.
124
-         *
125
-         * @since 1.0.0
126
-         * @param mixed(string|int|float) $params['width'] The map width.
127
-         */
128
-        'width' => apply_filters('widget_width', $params['width']),
129
-        /**
130
-         * Filter the widget height of the map on home/listings page.
131
-         *
132
-         * @since 1.0.0
133
-         * @param mixed(string|int|float) $params['height'] The map height.
134
-         */
135
-        'height' => apply_filters('widget_heigh', $params['height']),
136
-        /**
137
-         * Filter the widget maptype of the map on home/listings page.
138
-         *
139
-         * @since 1.0.0
109
+		'latitude' => '',
110
+		'longitude' => ''
111
+	);
112
+
113
+	$params = shortcode_atts($defaults, $atts);
114
+
115
+	$params = gdsc_validate_map_args($params);
116
+
117
+	$map_args = array(
118
+		'map_canvas_name' => 'gd_home_map',
119
+		'latitude' => $params['latitude'],
120
+		'longitude' => $params['longitude'],
121
+
122
+		/**
123
+		 * Filter the widget width of the map on home/listings page.
124
+		 *
125
+		 * @since 1.0.0
126
+		 * @param mixed(string|int|float) $params['width'] The map width.
127
+		 */
128
+		'width' => apply_filters('widget_width', $params['width']),
129
+		/**
130
+		 * Filter the widget height of the map on home/listings page.
131
+		 *
132
+		 * @since 1.0.0
133
+		 * @param mixed(string|int|float) $params['height'] The map height.
134
+		 */
135
+		'height' => apply_filters('widget_heigh', $params['height']),
136
+		/**
137
+		 * Filter the widget maptype of the map on home/listings page.
138
+		 *
139
+		 * @since 1.0.0
140 140
 		 * @since 1.5.2 Added TERRAIN map type.
141
-         * @param string $params['maptype'] The map type. Can be ROADMAP | SATELLITE | HYBRID | TERRAIN.
142
-         */
143
-        'maptype' => apply_filters('widget_maptype', $params['maptype']),
144
-        /**
145
-         * Filter the widget scrollwheel value of the map on home/listings page.
146
-         *
147
-         * Should the scrollwheel zoom the map or not.
148
-         *
149
-         * @since 1.0.0
150
-         * @param bool $params['scrollwheel'] True to allow scroll wheel to scroll map or false if not.
151
-         */
152
-        'scrollwheel' => apply_filters('widget_scrollwheel', $params['scrollwheel']),
153
-        /**
154
-         * Filter the widget zoom level of the map on home/listings page.
155
-         *
156
-         * @since 1.0.0
157
-         * @param int $params['zoom'] The zoom level of the map. Between 1-19.
158
-         */
159
-        'zoom' => apply_filters('widget_zoom', $params['zoom']),
160
-        /**
161
-         * Filter the widget auto zoom value of the map on home/listings page.
162
-         *
163
-         * If the map should autozoom to fit the markers shown.
164
-         *
165
-         * @since 1.0.0
166
-         * @param bool $params['autozoom'] True if the map should autozoom, false if not.
167
-         */
168
-        'autozoom' => apply_filters('widget_autozoom', $params['autozoom']),
169
-        /**
170
-         * Filter the widget child_collapse value of the map on home/listings page.
171
-         *
172
-         * If the map should auto collapse the child categories if the category bar is present.
173
-         *
174
-         * @since 1.0.0
175
-         * @param bool $params['child_collapse'] True if the map should collapse the categories, false if not.
176
-         */
177
-        'child_collapse' => apply_filters('widget_child_collapse', $params['child_collapse']),
178
-        'enable_cat_filters' => true,
179
-        'enable_text_search' => true,
180
-        'enable_post_type_filters' => true,
181
-        /**
182
-         * Filter the widget enable_location_filters value of the map on home/listings page.
183
-         *
184
-         * This is used when the location addon is used.
185
-         *
186
-         * @since 1.0.0
187
-         * @param bool $val True if location filters should be used, false if not.
188
-         */
189
-        'enable_location_filters' => apply_filters('geodir_home_map_enable_location_filters', false),
190
-        'enable_jason_on_load' => false,
191
-        'enable_marker_cluster' => false,
192
-        'enable_map_resize_button' => true,
193
-        'map_class_name' => 'geodir-map-home-page',
194
-        'is_geodir_home_map_widget' => true,
195
-    );
141
+		 * @param string $params['maptype'] The map type. Can be ROADMAP | SATELLITE | HYBRID | TERRAIN.
142
+		 */
143
+		'maptype' => apply_filters('widget_maptype', $params['maptype']),
144
+		/**
145
+		 * Filter the widget scrollwheel value of the map on home/listings page.
146
+		 *
147
+		 * Should the scrollwheel zoom the map or not.
148
+		 *
149
+		 * @since 1.0.0
150
+		 * @param bool $params['scrollwheel'] True to allow scroll wheel to scroll map or false if not.
151
+		 */
152
+		'scrollwheel' => apply_filters('widget_scrollwheel', $params['scrollwheel']),
153
+		/**
154
+		 * Filter the widget zoom level of the map on home/listings page.
155
+		 *
156
+		 * @since 1.0.0
157
+		 * @param int $params['zoom'] The zoom level of the map. Between 1-19.
158
+		 */
159
+		'zoom' => apply_filters('widget_zoom', $params['zoom']),
160
+		/**
161
+		 * Filter the widget auto zoom value of the map on home/listings page.
162
+		 *
163
+		 * If the map should autozoom to fit the markers shown.
164
+		 *
165
+		 * @since 1.0.0
166
+		 * @param bool $params['autozoom'] True if the map should autozoom, false if not.
167
+		 */
168
+		'autozoom' => apply_filters('widget_autozoom', $params['autozoom']),
169
+		/**
170
+		 * Filter the widget child_collapse value of the map on home/listings page.
171
+		 *
172
+		 * If the map should auto collapse the child categories if the category bar is present.
173
+		 *
174
+		 * @since 1.0.0
175
+		 * @param bool $params['child_collapse'] True if the map should collapse the categories, false if not.
176
+		 */
177
+		'child_collapse' => apply_filters('widget_child_collapse', $params['child_collapse']),
178
+		'enable_cat_filters' => true,
179
+		'enable_text_search' => true,
180
+		'enable_post_type_filters' => true,
181
+		/**
182
+		 * Filter the widget enable_location_filters value of the map on home/listings page.
183
+		 *
184
+		 * This is used when the location addon is used.
185
+		 *
186
+		 * @since 1.0.0
187
+		 * @param bool $val True if location filters should be used, false if not.
188
+		 */
189
+		'enable_location_filters' => apply_filters('geodir_home_map_enable_location_filters', false),
190
+		'enable_jason_on_load' => false,
191
+		'enable_marker_cluster' => false,
192
+		'enable_map_resize_button' => true,
193
+		'map_class_name' => 'geodir-map-home-page',
194
+		'is_geodir_home_map_widget' => true,
195
+	);
196 196
 
197 197
 	// Add marker cluster
198 198
 	if (isset($params['marker_cluster']) && gdsc_to_bool_val($params['marker_cluster']) && defined('GDCLUSTER_VERSION')) {
199
-        $map_args['enable_marker_cluster'] = true;
200
-        if(get_option('geodir_marker_cluster_type')) {
201
-            if ($map_args['autozoom']) {
202
-                $map_args['enable_marker_cluster_no_reposition'] = false;
203
-            } else {
204
-                $map_args['enable_marker_cluster_no_reposition'] = true;
205
-            }
199
+		$map_args['enable_marker_cluster'] = true;
200
+		if(get_option('geodir_marker_cluster_type')) {
201
+			if ($map_args['autozoom']) {
202
+				$map_args['enable_marker_cluster_no_reposition'] = false;
203
+			} else {
204
+				$map_args['enable_marker_cluster_no_reposition'] = true;
205
+			}
206 206
 
207
-            $map_args['enable_marker_cluster_server'] = true ;
207
+			$map_args['enable_marker_cluster_server'] = true ;
208 208
 
209
-        }
209
+		}
210 210
 	} else {
211 211
 		$map_args['enable_marker_cluster'] = false;
212 212
 	}
213 213
 
214
-    // if lat and long set in shortcode, hack it so the map is not repositioned
215
-    if(!empty($params['latitude']) && !empty($params['longitude']) ){
216
-        $map_args['enable_marker_cluster_no_reposition'] = true;
217
-    }
214
+	// if lat and long set in shortcode, hack it so the map is not repositioned
215
+	if(!empty($params['latitude']) && !empty($params['longitude']) ){
216
+		$map_args['enable_marker_cluster_no_reposition'] = true;
217
+	}
218 218
 
219 219
 
220
-    geodir_draw_map($map_args);
220
+	geodir_draw_map($map_args);
221 221
 
222
-    add_action('wp_footer', 'geodir_home_map_add_script', 100);
222
+	add_action('wp_footer', 'geodir_home_map_add_script', 100);
223 223
 
224
-    $output = ob_get_contents();
224
+	$output = ob_get_contents();
225 225
 
226
-    ob_end_clean();
226
+	ob_end_clean();
227 227
 
228
-    return $output;
228
+	return $output;
229 229
 }
230 230
 add_shortcode('gd_homepage_map', 'geodir_sc_home_map');
231 231
 
@@ -264,218 +264,218 @@  discard block
 block discarded – undo
264 264
  */
265 265
 function geodir_sc_listing_map($atts) {
266 266
 
267
-    // if some params are set then we need a new query, if not then we can use the main query
268
-    if( isset($atts['post_type']) || isset($atts['category']) || isset($atts['event_type']) ) {
269
-
270
-        global $add_post_in_marker_array, $gd_sc_map_params;
271
-        $backup_globals                             = array();
272
-        $backup_globals['add_post_in_marker_array'] = $add_post_in_marker_array;
273
-        $backup_globals['gd_sc_map_params']         = $gd_sc_map_params;
274
-
275
-        $defaults = array(
276
-            'width'          => '294',
277
-            'height'         => '370',
278
-            'zoom'           => '13',
279
-            'autozoom'       => '',
280
-            'sticky'         => '',
281
-            'showall'        => '0',
282
-            'scrollwheel'    => '0',
283
-            'maptype'        => 'ROADMAP',
284
-            'child_collapse' => 0,
285
-            'marker_cluster' => false,
286
-            'post_type'      => 'gd_place',
287
-            'category'       => '0',
288
-            'event_type'     => 'all'
289
-        );
290
-
291
-        $params = shortcode_atts( $defaults, $atts );
292
-
293
-        if ( ! ( gdsc_is_post_type_valid( $params['post_type'] ) ) ) {
294
-            $params['post_type'] = 'gd_place';
295
-        }
296
-
297
-        // Validate the selected category/ies - Grab the current list based on post_type
298
-        $category_taxonomy = geodir_get_taxonomies( $params['post_type'] );
299
-        $categories        = get_terms( $category_taxonomy, array(
300
-            'orderby' => 'count',
301
-            'order'   => 'DESC',
302
-            'fields'  => 'ids'
303
-        ) );
304
-
305
-        // Make sure we have an array
306
-        if ( ! ( is_array( $params['category'] ) ) ) {
307
-            $params['category'] = explode( ',', $params['category'] );
308
-        }
309
-
310
-        // Array_intersect returns only the items in $params['category'] that are also in our category list
311
-        // Otherwise it becomes empty and later on that will mean "All"
312
-        $params['category'] = array_intersect( $params['category'], $categories );
313
-
314
-        if ( $params['post_type'] == 'gd_event' ) {
315
-            $params['event_type'] = gdsc_validate_list_filter_choice( $params['event_type'] );
316
-        }
317
-
318
-        $params = gdsc_validate_map_args( $params );
319
-
320
-        $gd_sc_map_params = $params;
321
-
322
-        $query_args = array(
323
-            'posts_per_page' => 1000000, //@todo kiran why was this added? 
324
-            'is_geodir_loop' => true,
325
-            'gd_location'    => false,
326
-            'post_type'      => $params['post_type'],
327
-        );
328
-
329
-        if ( ! empty( $params['category'] ) && isset( $params['category'][0] ) && (int) $params['category'][0] != 0 ) {
330
-            $category_taxonomy = geodir_get_taxonomies( $params['post_type'] );
331
-
332
-            ######### WPML #########
333
-            if ( geodir_wpml_is_taxonomy_translated( $category_taxonomy[0] ) ) {
334
-                $category = gd_lang_object_ids( $params['category'], $category_taxonomy[0] );
335
-            }
336
-            ######### WPML #########
337
-
338
-            $tax_query = array(
339
-                'taxonomy' => $category_taxonomy[0],
340
-                'field'    => 'id',
341
-                'terms'    => $params['category']
342
-            );
343
-
344
-            $query_args['tax_query'] = array( $tax_query );
345
-        }
346
-
347
-        $add_post_in_marker_array = true;
348
-
349
-        if ( $params['post_type'] == 'gd_event' && function_exists( 'geodir_event_get_widget_events' ) ) {
350
-            global $geodir_event_widget_listview;
351
-            $geodir_event_widget_listview = true;
352
-
353
-            $query_args['geodir_event_type'] = $params['event_type'];
354
-
355
-            $listings = geodir_event_get_widget_events( $query_args );
356
-
357
-            $geodir_event_widget_listview = false;
358
-        } else {
359
-            $listings = geodir_get_widget_listings( $query_args );
360
-        }
361
-
362
-        if ( ! empty( $listings ) ) {
363
-            foreach ( $listings as $listing ) {
364
-                create_marker_jason_of_posts( $listing );
365
-            }
366
-        }
367
-
368
-        ob_start();
369
-        add_action( 'wp_head', 'init_listing_map_script' ); // Initialize the map object and marker array
370
-
371
-        add_action( 'the_post', 'create_list_jsondata' ); // Add marker in json array
372
-
373
-        add_action( 'wp_footer', 'show_listing_widget_map' ); // Show map for listings with markers
374
-
375
-        $default_location = geodir_get_default_location();
376
-
377
-        $map_args = array(
378
-            'map_canvas_name'          => 'gd_listing_map',
379
-            'width'                    => $params['width'],
380
-            'height'                   => $params['height'],
381
-            'zoom'                     => $params['zoom'],
382
-            'autozoom'                 => $params['autozoom'],
383
-            'sticky'                   => $params['sticky'],
384
-            'showall'                  => $params['showall'],
385
-            'scrollwheel'              => $params['scrollwheel'],
386
-            'maptype'                  => $params['maptype'],
387
-            'child_collapse'           => 0,
388
-            'enable_cat_filters'       => false,
389
-            'enable_text_search'       => false,
390
-            'enable_post_type_filters' => false,
391
-            'enable_location_filters'  => false,
392
-            'enable_jason_on_load'     => true,
393
-            'ajax_url'                 => geodir_get_ajax_url(),
394
-            'latitude'                 => isset( $default_location->city_latitude ) ? $default_location->city_latitude : '',
395
-            'longitude'                => isset( $default_location->city_longitude ) ? $default_location->city_longitude : '',
396
-            'streetViewControl'        => true,
397
-            'showPreview'              => '0',
398
-            'maxZoom'                  => 21,
399
-            'bubble_size'              => 'small',
400
-        );
401
-
402
-        if ( is_single() ) {
403
-            global $post;
404
-            if ( isset( $post->post_latitude ) ) {
405
-                $map_args['latitude']  = $post->post_latitude;
406
-                $map_args['longitude'] = $post->post_longitude;
407
-            }
408
-
409
-            $map_args['map_class_name'] = 'geodir-map-listing-page-single';
410
-        } else {
411
-            $map_args['map_class_name'] = 'geodir-map-listing-page';
412
-        }
413
-
414
-        // Add marker cluster
415
-        if ( isset( $params['marker_cluster'] ) && gdsc_to_bool_val( $params['marker_cluster'] ) && defined( 'GDCLUSTER_VERSION' ) ) {
416
-            $map_args['enable_marker_cluster'] = true;
417
-        } else {
418
-            $map_args['enable_marker_cluster'] = false;
419
-        }
420
-
421
-        geodir_draw_map( $map_args );
422
-
423
-        $output = ob_get_contents();
424
-
425
-        ob_end_clean();
426
-
427
-        foreach ( $backup_globals as $global => $value ) {
428
-            ${$global} = $value;
429
-        }
430
-
431
-        return $output;
432
-    }else{
433
-        ob_start();
434
-        add_action('wp_head', 'init_listing_map_script'); // Initialize the map object and marker array
435
-        add_action('the_post', 'create_list_jsondata'); // Add marker in json array
436
-        add_action('wp_footer', 'show_listing_widget_map'); // Show map for listings with markers
437
-        $defaults = array(
438
-            'width' => '294',
439
-            'height' => '370',
440
-            'zoom' => '13',
441
-            'autozoom' => '',
442
-            'sticky' => '',
443
-            'showall' => '0',
444
-            'scrollwheel' => '0',
445
-            'maptype' => 'ROADMAP',
446
-            'child_collapse' => 0,
447
-            'marker_cluster' => false
448
-        );
449
-        $params = shortcode_atts($defaults, $atts);
450
-        $params = gdsc_validate_map_args($params);
451
-        $map_args = array(
452
-            'map_canvas_name' => 'gd_listing_map',
453
-            'width' => $params['width'],
454
-            'height' => $params['height'],
455
-            'zoom' => $params['zoom'],
456
-            'autozoom' => $params['autozoom'],
457
-            'sticky' => $params['sticky'],
458
-            'showall' => $params['showall'],
459
-            'scrollwheel' => $params['scrollwheel'],
460
-            'child_collapse' => 0,
461
-            'enable_cat_filters' => false,
462
-            'enable_text_search' => false,
463
-            'enable_post_type_filters' => false,
464
-            'enable_location_filters' => false,
465
-            'enable_jason_on_load' => true,
466
-        );
467
-        if (is_single()) {
468
-            global $post;
469
-            $map_default_lat = $address_latitude = $post->post_latitude;
470
-            $map_default_lng = $address_longitude = $post->post_longitude;
471
-            $mapview = $post->post_mapview;
472
-            $map_args['zoom'] = $post->post_mapzoom;
473
-            $map_args['map_class_name'] = 'geodir-map-listing-page-single';
474
-        } else {
475
-            $default_location = geodir_get_default_location();
476
-            $map_default_lat = isset($default_location->city_latitude) ? $default_location->city_latitude : '';
477
-            $map_default_lng = isset($default_location->city_longitude) ? $default_location->city_longitude : '';
478
-            $map_args['map_class_name'] = 'geodir-map-listing-page';
267
+	// if some params are set then we need a new query, if not then we can use the main query
268
+	if( isset($atts['post_type']) || isset($atts['category']) || isset($atts['event_type']) ) {
269
+
270
+		global $add_post_in_marker_array, $gd_sc_map_params;
271
+		$backup_globals                             = array();
272
+		$backup_globals['add_post_in_marker_array'] = $add_post_in_marker_array;
273
+		$backup_globals['gd_sc_map_params']         = $gd_sc_map_params;
274
+
275
+		$defaults = array(
276
+			'width'          => '294',
277
+			'height'         => '370',
278
+			'zoom'           => '13',
279
+			'autozoom'       => '',
280
+			'sticky'         => '',
281
+			'showall'        => '0',
282
+			'scrollwheel'    => '0',
283
+			'maptype'        => 'ROADMAP',
284
+			'child_collapse' => 0,
285
+			'marker_cluster' => false,
286
+			'post_type'      => 'gd_place',
287
+			'category'       => '0',
288
+			'event_type'     => 'all'
289
+		);
290
+
291
+		$params = shortcode_atts( $defaults, $atts );
292
+
293
+		if ( ! ( gdsc_is_post_type_valid( $params['post_type'] ) ) ) {
294
+			$params['post_type'] = 'gd_place';
295
+		}
296
+
297
+		// Validate the selected category/ies - Grab the current list based on post_type
298
+		$category_taxonomy = geodir_get_taxonomies( $params['post_type'] );
299
+		$categories        = get_terms( $category_taxonomy, array(
300
+			'orderby' => 'count',
301
+			'order'   => 'DESC',
302
+			'fields'  => 'ids'
303
+		) );
304
+
305
+		// Make sure we have an array
306
+		if ( ! ( is_array( $params['category'] ) ) ) {
307
+			$params['category'] = explode( ',', $params['category'] );
308
+		}
309
+
310
+		// Array_intersect returns only the items in $params['category'] that are also in our category list
311
+		// Otherwise it becomes empty and later on that will mean "All"
312
+		$params['category'] = array_intersect( $params['category'], $categories );
313
+
314
+		if ( $params['post_type'] == 'gd_event' ) {
315
+			$params['event_type'] = gdsc_validate_list_filter_choice( $params['event_type'] );
316
+		}
317
+
318
+		$params = gdsc_validate_map_args( $params );
319
+
320
+		$gd_sc_map_params = $params;
321
+
322
+		$query_args = array(
323
+			'posts_per_page' => 1000000, //@todo kiran why was this added? 
324
+			'is_geodir_loop' => true,
325
+			'gd_location'    => false,
326
+			'post_type'      => $params['post_type'],
327
+		);
328
+
329
+		if ( ! empty( $params['category'] ) && isset( $params['category'][0] ) && (int) $params['category'][0] != 0 ) {
330
+			$category_taxonomy = geodir_get_taxonomies( $params['post_type'] );
331
+
332
+			######### WPML #########
333
+			if ( geodir_wpml_is_taxonomy_translated( $category_taxonomy[0] ) ) {
334
+				$category = gd_lang_object_ids( $params['category'], $category_taxonomy[0] );
335
+			}
336
+			######### WPML #########
337
+
338
+			$tax_query = array(
339
+				'taxonomy' => $category_taxonomy[0],
340
+				'field'    => 'id',
341
+				'terms'    => $params['category']
342
+			);
343
+
344
+			$query_args['tax_query'] = array( $tax_query );
345
+		}
346
+
347
+		$add_post_in_marker_array = true;
348
+
349
+		if ( $params['post_type'] == 'gd_event' && function_exists( 'geodir_event_get_widget_events' ) ) {
350
+			global $geodir_event_widget_listview;
351
+			$geodir_event_widget_listview = true;
352
+
353
+			$query_args['geodir_event_type'] = $params['event_type'];
354
+
355
+			$listings = geodir_event_get_widget_events( $query_args );
356
+
357
+			$geodir_event_widget_listview = false;
358
+		} else {
359
+			$listings = geodir_get_widget_listings( $query_args );
360
+		}
361
+
362
+		if ( ! empty( $listings ) ) {
363
+			foreach ( $listings as $listing ) {
364
+				create_marker_jason_of_posts( $listing );
365
+			}
366
+		}
367
+
368
+		ob_start();
369
+		add_action( 'wp_head', 'init_listing_map_script' ); // Initialize the map object and marker array
370
+
371
+		add_action( 'the_post', 'create_list_jsondata' ); // Add marker in json array
372
+
373
+		add_action( 'wp_footer', 'show_listing_widget_map' ); // Show map for listings with markers
374
+
375
+		$default_location = geodir_get_default_location();
376
+
377
+		$map_args = array(
378
+			'map_canvas_name'          => 'gd_listing_map',
379
+			'width'                    => $params['width'],
380
+			'height'                   => $params['height'],
381
+			'zoom'                     => $params['zoom'],
382
+			'autozoom'                 => $params['autozoom'],
383
+			'sticky'                   => $params['sticky'],
384
+			'showall'                  => $params['showall'],
385
+			'scrollwheel'              => $params['scrollwheel'],
386
+			'maptype'                  => $params['maptype'],
387
+			'child_collapse'           => 0,
388
+			'enable_cat_filters'       => false,
389
+			'enable_text_search'       => false,
390
+			'enable_post_type_filters' => false,
391
+			'enable_location_filters'  => false,
392
+			'enable_jason_on_load'     => true,
393
+			'ajax_url'                 => geodir_get_ajax_url(),
394
+			'latitude'                 => isset( $default_location->city_latitude ) ? $default_location->city_latitude : '',
395
+			'longitude'                => isset( $default_location->city_longitude ) ? $default_location->city_longitude : '',
396
+			'streetViewControl'        => true,
397
+			'showPreview'              => '0',
398
+			'maxZoom'                  => 21,
399
+			'bubble_size'              => 'small',
400
+		);
401
+
402
+		if ( is_single() ) {
403
+			global $post;
404
+			if ( isset( $post->post_latitude ) ) {
405
+				$map_args['latitude']  = $post->post_latitude;
406
+				$map_args['longitude'] = $post->post_longitude;
407
+			}
408
+
409
+			$map_args['map_class_name'] = 'geodir-map-listing-page-single';
410
+		} else {
411
+			$map_args['map_class_name'] = 'geodir-map-listing-page';
412
+		}
413
+
414
+		// Add marker cluster
415
+		if ( isset( $params['marker_cluster'] ) && gdsc_to_bool_val( $params['marker_cluster'] ) && defined( 'GDCLUSTER_VERSION' ) ) {
416
+			$map_args['enable_marker_cluster'] = true;
417
+		} else {
418
+			$map_args['enable_marker_cluster'] = false;
419
+		}
420
+
421
+		geodir_draw_map( $map_args );
422
+
423
+		$output = ob_get_contents();
424
+
425
+		ob_end_clean();
426
+
427
+		foreach ( $backup_globals as $global => $value ) {
428
+			${$global} = $value;
429
+		}
430
+
431
+		return $output;
432
+	}else{
433
+		ob_start();
434
+		add_action('wp_head', 'init_listing_map_script'); // Initialize the map object and marker array
435
+		add_action('the_post', 'create_list_jsondata'); // Add marker in json array
436
+		add_action('wp_footer', 'show_listing_widget_map'); // Show map for listings with markers
437
+		$defaults = array(
438
+			'width' => '294',
439
+			'height' => '370',
440
+			'zoom' => '13',
441
+			'autozoom' => '',
442
+			'sticky' => '',
443
+			'showall' => '0',
444
+			'scrollwheel' => '0',
445
+			'maptype' => 'ROADMAP',
446
+			'child_collapse' => 0,
447
+			'marker_cluster' => false
448
+		);
449
+		$params = shortcode_atts($defaults, $atts);
450
+		$params = gdsc_validate_map_args($params);
451
+		$map_args = array(
452
+			'map_canvas_name' => 'gd_listing_map',
453
+			'width' => $params['width'],
454
+			'height' => $params['height'],
455
+			'zoom' => $params['zoom'],
456
+			'autozoom' => $params['autozoom'],
457
+			'sticky' => $params['sticky'],
458
+			'showall' => $params['showall'],
459
+			'scrollwheel' => $params['scrollwheel'],
460
+			'child_collapse' => 0,
461
+			'enable_cat_filters' => false,
462
+			'enable_text_search' => false,
463
+			'enable_post_type_filters' => false,
464
+			'enable_location_filters' => false,
465
+			'enable_jason_on_load' => true,
466
+		);
467
+		if (is_single()) {
468
+			global $post;
469
+			$map_default_lat = $address_latitude = $post->post_latitude;
470
+			$map_default_lng = $address_longitude = $post->post_longitude;
471
+			$mapview = $post->post_mapview;
472
+			$map_args['zoom'] = $post->post_mapzoom;
473
+			$map_args['map_class_name'] = 'geodir-map-listing-page-single';
474
+		} else {
475
+			$default_location = geodir_get_default_location();
476
+			$map_default_lat = isset($default_location->city_latitude) ? $default_location->city_latitude : '';
477
+			$map_default_lng = isset($default_location->city_longitude) ? $default_location->city_longitude : '';
478
+			$map_args['map_class_name'] = 'geodir-map-listing-page';
479 479
 			if ( geodir_is_page( 'search' ) ) {
480 480
 				$map_default_lat = '';
481 481
 				$map_default_lng = '';
@@ -491,31 +491,31 @@  discard block
 block discarded – undo
491 491
 					}
492 492
 				}
493 493
 			}
494
-        }
495
-        if (empty($mapview)) {
496
-            $mapview = 'ROADMAP';
497
-        }
498
-        // Set default map options
499
-        $map_args['ajax_url'] = geodir_get_ajax_url();
500
-        $map_args['latitude'] = $map_default_lat;
501
-        $map_args['longitude'] = $map_default_lng;
502
-        $map_args['streetViewControl'] = true;
503
-        $map_args['maptype'] = $mapview;
504
-        $map_args['showPreview'] = '0';
505
-        $map_args['maxZoom'] = 21;
506
-        $map_args['bubble_size'] = 'small';
507
-
508
-        // Add marker cluster
509
-        if (isset($params['marker_cluster']) && gdsc_to_bool_val($params['marker_cluster']) && defined('GDCLUSTER_VERSION')) {
510
-            $map_args['enable_marker_cluster'] = true;
511
-        } else {
512
-            $map_args['enable_marker_cluster'] = false;
513
-        }
514
-        geodir_draw_map($map_args);
515
-        $output = ob_get_contents();
516
-        ob_end_clean();
517
-        return $output;
518
-    }
494
+		}
495
+		if (empty($mapview)) {
496
+			$mapview = 'ROADMAP';
497
+		}
498
+		// Set default map options
499
+		$map_args['ajax_url'] = geodir_get_ajax_url();
500
+		$map_args['latitude'] = $map_default_lat;
501
+		$map_args['longitude'] = $map_default_lng;
502
+		$map_args['streetViewControl'] = true;
503
+		$map_args['maptype'] = $mapview;
504
+		$map_args['showPreview'] = '0';
505
+		$map_args['maxZoom'] = 21;
506
+		$map_args['bubble_size'] = 'small';
507
+
508
+		// Add marker cluster
509
+		if (isset($params['marker_cluster']) && gdsc_to_bool_val($params['marker_cluster']) && defined('GDCLUSTER_VERSION')) {
510
+			$map_args['enable_marker_cluster'] = true;
511
+		} else {
512
+			$map_args['enable_marker_cluster'] = false;
513
+		}
514
+		geodir_draw_map($map_args);
515
+		$output = ob_get_contents();
516
+		ob_end_clean();
517
+		return $output;
518
+	}
519 519
 }
520 520
 
521 521
 add_shortcode('gd_listing_slider', 'geodir_sc_listing_slider');
@@ -548,120 +548,120 @@  discard block
 block discarded – undo
548 548
  */
549 549
 function geodir_sc_listing_slider($atts)
550 550
 {
551
-    ob_start();
552
-    $defaults = array(
553
-        'post_type' => 'gd_place',
554
-        'category' => '0',
555
-        'post_number' => '5',
556
-        'slideshow' => '0',
557
-        'animation_loop' => 0,
558
-        'direction_nav' => 0,
559
-        'slideshow_speed' => 5000,
560
-        'animation_speed' => 600,
561
-        'animation' => 'slide',
562
-        'order_by' => 'latest',
563
-        'show_title' => '',
564
-        'show_featured_only' => '',
565
-        'title' => '',
566
-    );
567
-
568
-    $params = shortcode_atts($defaults, $atts);
569
-
570
-
571
-    /*
551
+	ob_start();
552
+	$defaults = array(
553
+		'post_type' => 'gd_place',
554
+		'category' => '0',
555
+		'post_number' => '5',
556
+		'slideshow' => '0',
557
+		'animation_loop' => 0,
558
+		'direction_nav' => 0,
559
+		'slideshow_speed' => 5000,
560
+		'animation_speed' => 600,
561
+		'animation' => 'slide',
562
+		'order_by' => 'latest',
563
+		'show_title' => '',
564
+		'show_featured_only' => '',
565
+		'title' => '',
566
+	);
567
+
568
+	$params = shortcode_atts($defaults, $atts);
569
+
570
+
571
+	/*
572 572
      *
573 573
      * Now we begin the validation of the attributes.
574 574
      */
575
-    // Check we have a valid post_type
576
-    if (!(gdsc_is_post_type_valid($params['post_type']))) {
577
-        $params['post_type'] = 'gd_place';
578
-    }
579
-
580
-    // Check we have a valid sort_order
581
-    $params['order_by'] = gdsc_validate_sort_choice($params['order_by']);
582
-
583
-    // Match the chosen animation to our options
584
-    $animation_list = array('slide', 'fade');
585
-    if (!(in_array($params['animation'], $animation_list))) {
586
-        $params['animation'] = 'slide';
587
-    }
588
-
589
-    // Post_number needs to be a positive integer
590
-    $params['post_number'] = absint($params['post_number']);
591
-    if (0 == $params['post_number']) {
592
-        $params['post_number'] = 1;
593
-    }
594
-
595
-    // Manage the entered categories
596
-    if (0 != $params['category'] || '' != $params['category']) {
597
-        $params['category'] = gdsc_manage_category_choice($params['post_type'], $params['category']);
598
-    }
599
-    // Convert show_title to a bool
600
-    $params['show_title'] = intval(gdsc_to_bool_val($params['show_title']));
601
-
602
-    // Convert show_featured_only to a bool
603
-    $params['show_featured_only'] = intval(gdsc_to_bool_val($params['show_featured_only']));
604
-
605
-    /*
575
+	// Check we have a valid post_type
576
+	if (!(gdsc_is_post_type_valid($params['post_type']))) {
577
+		$params['post_type'] = 'gd_place';
578
+	}
579
+
580
+	// Check we have a valid sort_order
581
+	$params['order_by'] = gdsc_validate_sort_choice($params['order_by']);
582
+
583
+	// Match the chosen animation to our options
584
+	$animation_list = array('slide', 'fade');
585
+	if (!(in_array($params['animation'], $animation_list))) {
586
+		$params['animation'] = 'slide';
587
+	}
588
+
589
+	// Post_number needs to be a positive integer
590
+	$params['post_number'] = absint($params['post_number']);
591
+	if (0 == $params['post_number']) {
592
+		$params['post_number'] = 1;
593
+	}
594
+
595
+	// Manage the entered categories
596
+	if (0 != $params['category'] || '' != $params['category']) {
597
+		$params['category'] = gdsc_manage_category_choice($params['post_type'], $params['category']);
598
+	}
599
+	// Convert show_title to a bool
600
+	$params['show_title'] = intval(gdsc_to_bool_val($params['show_title']));
601
+
602
+	// Convert show_featured_only to a bool
603
+	$params['show_featured_only'] = intval(gdsc_to_bool_val($params['show_featured_only']));
604
+
605
+	/*
606 606
      * Hopefully all attributes are now valid, and safe to pass forward
607 607
      */
608 608
 
609
-    // redeclare vars after validation
610
-
611
-    if (isset($params['direction_nav'])) {
612
-        $params['directionNav'] = $params['direction_nav'];
613
-    }
614
-    if (isset($params['animation_loop'])) {
615
-        $params['animationLoop'] = $params['animation_loop'];
616
-    }
617
-    if (isset($params['slideshow_speed'])) {
618
-        $params['slideshowSpeed'] = $params['slideshow_speed'];
619
-    }
620
-    if (isset($params['animation_speed'])) {
621
-        $params['animationSpeed'] = $params['animation_speed'];
622
-    }
623
-    if (isset($params['order_by'])) {
624
-        $params['list_sort'] = $params['order_by'];
625
-    }
626
-
627
-    $query_args = array(
628
-        'post_number' => $params['post_number'],
629
-        'is_geodir_loop' => true,
630
-        'post_type' => $params['post_type'],
631
-        'order_by' => $params['order_by']
632
-    );
633
-
634
-    if (1 == $params['show_featured_only']) {
635
-        $query_args['show_featured_only'] = 1;
636
-    }
637
-
638
-    if (0 != $params['category'] && '' != $params['category']) {
639
-        $category_taxonomy = geodir_get_taxonomies($params['post_type']);
640
-        $tax_query = array(
641
-            'taxonomy' => $category_taxonomy[0],
642
-            'field' => 'id',
643
-            'terms' => $params['category'],
644
-        );
645
-
646
-        $query_args['tax_query'] = array($tax_query);
647
-    }
648
-
649
-    $defaults = array(
650
-        'before_widget' => '',
651
-        'after_widget' => '',
652
-        'before_title' => '',
653
-        'after_title' => '',
654
-    );
655
-
656
-    $query_args = array_merge($query_args, $params);
657
-
658
-    geodir_listing_slider_widget_output($defaults, $query_args);
659
-
660
-    $output = ob_get_contents();
661
-
662
-    ob_end_clean();
663
-
664
-    return $output;
609
+	// redeclare vars after validation
610
+
611
+	if (isset($params['direction_nav'])) {
612
+		$params['directionNav'] = $params['direction_nav'];
613
+	}
614
+	if (isset($params['animation_loop'])) {
615
+		$params['animationLoop'] = $params['animation_loop'];
616
+	}
617
+	if (isset($params['slideshow_speed'])) {
618
+		$params['slideshowSpeed'] = $params['slideshow_speed'];
619
+	}
620
+	if (isset($params['animation_speed'])) {
621
+		$params['animationSpeed'] = $params['animation_speed'];
622
+	}
623
+	if (isset($params['order_by'])) {
624
+		$params['list_sort'] = $params['order_by'];
625
+	}
626
+
627
+	$query_args = array(
628
+		'post_number' => $params['post_number'],
629
+		'is_geodir_loop' => true,
630
+		'post_type' => $params['post_type'],
631
+		'order_by' => $params['order_by']
632
+	);
633
+
634
+	if (1 == $params['show_featured_only']) {
635
+		$query_args['show_featured_only'] = 1;
636
+	}
637
+
638
+	if (0 != $params['category'] && '' != $params['category']) {
639
+		$category_taxonomy = geodir_get_taxonomies($params['post_type']);
640
+		$tax_query = array(
641
+			'taxonomy' => $category_taxonomy[0],
642
+			'field' => 'id',
643
+			'terms' => $params['category'],
644
+		);
645
+
646
+		$query_args['tax_query'] = array($tax_query);
647
+	}
648
+
649
+	$defaults = array(
650
+		'before_widget' => '',
651
+		'after_widget' => '',
652
+		'before_title' => '',
653
+		'after_title' => '',
654
+	);
655
+
656
+	$query_args = array_merge($query_args, $params);
657
+
658
+	geodir_listing_slider_widget_output($defaults, $query_args);
659
+
660
+	$output = ob_get_contents();
661
+
662
+	ob_end_clean();
663
+
664
+	return $output;
665 665
 }
666 666
 
667 667
 add_shortcode('gd_login_box', 'geodir_sc_login_box');
@@ -685,22 +685,22 @@  discard block
 block discarded – undo
685 685
  */
686 686
 function geodir_sc_login_box($atts)
687 687
 {
688
-    ob_start();
688
+	ob_start();
689 689
 
690
-    $defaults = array(
691
-        'before_widget' => '',
692
-        'after_widget' => '',
693
-        'before_title' => '',
694
-        'after_title' => '',
695
-    );
690
+	$defaults = array(
691
+		'before_widget' => '',
692
+		'after_widget' => '',
693
+		'before_title' => '',
694
+		'after_title' => '',
695
+	);
696 696
 
697
-    geodir_loginwidget_output($defaults, $defaults);
697
+	geodir_loginwidget_output($defaults, $defaults);
698 698
 
699
-    $output = ob_get_contents();
699
+	$output = ob_get_contents();
700 700
 
701
-    ob_end_clean();
701
+	ob_end_clean();
702 702
 
703
-    return $output;
703
+	return $output;
704 704
 }
705 705
 
706 706
 add_shortcode('gd_popular_post_category', 'geodir_sc_popular_post_category');
@@ -731,31 +731,31 @@  discard block
 block discarded – undo
731 731
  */
732 732
 function geodir_sc_popular_post_category($atts)
733 733
 {
734
-    ob_start();
735
-    global $geodir_post_category_str;
736
-    $defaults = array(
737
-        'category_limit' => 15,
738
-        'category_restrict' => false,
739
-        'before_widget' => '',
740
-        'after_widget' => '',
741
-        'before_title' => '',
742
-        'after_title' => '',
743
-        'title' => '',
744
-        'default_post_type' => '',
745
-        'parent_only' => false,
746
-    );
747
-
748
-    $params = shortcode_atts($defaults, $atts, 'popular_post_category');
749
-    $params['category_limit'] = absint($params['category_limit']);
750
-    $params['default_post_type'] = gdsc_is_post_type_valid($params['default_post_type']) ? $params['default_post_type'] : '';
751
-    $params['parent_only'] = gdsc_to_bool_val($params['parent_only']);
752
-    geodir_popular_post_category_output($params, $params);
753
-
754
-    $output = ob_get_contents();
755
-
756
-    ob_end_clean();
757
-
758
-    return $output;
734
+	ob_start();
735
+	global $geodir_post_category_str;
736
+	$defaults = array(
737
+		'category_limit' => 15,
738
+		'category_restrict' => false,
739
+		'before_widget' => '',
740
+		'after_widget' => '',
741
+		'before_title' => '',
742
+		'after_title' => '',
743
+		'title' => '',
744
+		'default_post_type' => '',
745
+		'parent_only' => false,
746
+	);
747
+
748
+	$params = shortcode_atts($defaults, $atts, 'popular_post_category');
749
+	$params['category_limit'] = absint($params['category_limit']);
750
+	$params['default_post_type'] = gdsc_is_post_type_valid($params['default_post_type']) ? $params['default_post_type'] : '';
751
+	$params['parent_only'] = gdsc_to_bool_val($params['parent_only']);
752
+	geodir_popular_post_category_output($params, $params);
753
+
754
+	$output = ob_get_contents();
755
+
756
+	ob_end_clean();
757
+
758
+	return $output;
759 759
 }
760 760
 
761 761
 add_shortcode('gd_popular_post_view', 'geodir_sc_popular_post_view');
@@ -798,98 +798,98 @@  discard block
 block discarded – undo
798 798
  */
799 799
 function geodir_sc_popular_post_view($atts)
800 800
 {
801
-    ob_start();
802
-    $defaults = array(
803
-        'post_type' => 'gd_place',
804
-        'category' => '0',
805
-        'post_number' => '5',
806
-        'layout' => 'gridview_onehalf',
807
-        'add_location_filter' => '0',
808
-        'list_sort' => 'latest',
809
-        'use_viewing_post_type' => '1',
810
-        'character_count' => '20',
811
-        'listing_width' => '',
812
-        'show_featured_only' => '0',
813
-        'show_special_only' => '0',
814
-        'with_pics_only' => '0',
815
-        'with_videos_only' => '0',
816
-        'hide_if_empty' => '0',
817
-        'before_widget' => '',
818
-        'after_widget' => '',
819
-        'before_title' => '<h3 class="widget-title">',
820
-        'after_title' => '</h3>',
821
-        'title' => '',
822
-        'category_title' => '',
823
-    );
824
-
825
-    $params = shortcode_atts($defaults, $atts);
826
-
827
-    /**
828
-     * Validate our incoming params
829
-     */
801
+	ob_start();
802
+	$defaults = array(
803
+		'post_type' => 'gd_place',
804
+		'category' => '0',
805
+		'post_number' => '5',
806
+		'layout' => 'gridview_onehalf',
807
+		'add_location_filter' => '0',
808
+		'list_sort' => 'latest',
809
+		'use_viewing_post_type' => '1',
810
+		'character_count' => '20',
811
+		'listing_width' => '',
812
+		'show_featured_only' => '0',
813
+		'show_special_only' => '0',
814
+		'with_pics_only' => '0',
815
+		'with_videos_only' => '0',
816
+		'hide_if_empty' => '0',
817
+		'before_widget' => '',
818
+		'after_widget' => '',
819
+		'before_title' => '<h3 class="widget-title">',
820
+		'after_title' => '</h3>',
821
+		'title' => '',
822
+		'category_title' => '',
823
+	);
830 824
 
831
-    // Validate the selected post type, default to gd_place on fail
832
-    if (!(gdsc_is_post_type_valid($params['post_type']))) {
833
-        $params['post_type'] = 'gd_place';
834
-    }
835
-
836
-    // Validate the selected category/ies - Grab the current list based on post_type
837
-    $category_taxonomy = geodir_get_taxonomies($params['post_type']);
838
-    $categories = get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC', 'fields' => 'ids'));
839
-
840
-    // Make sure we have an array
841
-    if (!(is_array($params['category']))) {
842
-        $params['category'] = explode(',', $params['category']);
843
-    }
844
-
845
-    // Array_intersect returns only the items in $params['category'] that are also in our category list
846
-    // Otherwise it becomes empty and later on that will mean "All"
847
-    $params['category'] = array_intersect($params['category'], $categories);
848
-
849
-    // Post_number needs to be a positive integer
850
-    $params['post_number'] = absint($params['post_number']);
851
-    if (0 == $params['post_number']) {
852
-        $params['post_number'] = 1;
853
-    }
854
-
855
-    // Validate our layout choice
856
-    // Outside of the norm, I added some more simple terms to match the existing
857
-    // So now I just run the switch to set it properly.
858
-    $params['layout'] = gdsc_validate_layout_choice($params['layout']);
859
-
860
-    // Validate our sorting choice
861
-    $params['list_sort'] = gdsc_validate_sort_choice($params['list_sort'], $params['post_type']);
862
-
863
-    // Validate character_count
864
-    if ($params['character_count'] !== '') {
865
-        $params['character_count'] = absint($params['character_count']);
866
-    }
867
-
868
-    // Validate Listing width, used in the template widget-listing-listview.php
869
-    // The context is in width=$listing_width% - So we need a positive number between 0 & 100
870
-    $params['listing_width'] = gdsc_validate_listing_width($params['listing_width']);
871
-
872
-    // Validate the checkboxes used on the widget
873
-    $params['add_location_filter'] = gdsc_to_bool_val($params['add_location_filter']);
874
-    $params['show_featured_only'] = gdsc_to_bool_val($params['show_featured_only']);
875
-    $params['show_special_only'] = gdsc_to_bool_val($params['show_special_only']);
876
-    $params['with_pics_only'] = gdsc_to_bool_val($params['with_pics_only']);
877
-    $params['with_videos_only'] = gdsc_to_bool_val($params['with_videos_only']);
878
-    $params['use_viewing_post_type'] = gdsc_to_bool_val($params['use_viewing_post_type']);
879
-    $params['hide_if_empty'] = gdsc_to_bool_val($params['hide_if_empty']);
880
-
881
-    /**
882
-     * End of validation
883
-     */
825
+	$params = shortcode_atts($defaults, $atts);
826
+
827
+	/**
828
+	 * Validate our incoming params
829
+	 */
830
+
831
+	// Validate the selected post type, default to gd_place on fail
832
+	if (!(gdsc_is_post_type_valid($params['post_type']))) {
833
+		$params['post_type'] = 'gd_place';
834
+	}
835
+
836
+	// Validate the selected category/ies - Grab the current list based on post_type
837
+	$category_taxonomy = geodir_get_taxonomies($params['post_type']);
838
+	$categories = get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC', 'fields' => 'ids'));
839
+
840
+	// Make sure we have an array
841
+	if (!(is_array($params['category']))) {
842
+		$params['category'] = explode(',', $params['category']);
843
+	}
844
+
845
+	// Array_intersect returns only the items in $params['category'] that are also in our category list
846
+	// Otherwise it becomes empty and later on that will mean "All"
847
+	$params['category'] = array_intersect($params['category'], $categories);
884 848
 
885
-    geodir_popular_postview_output($params, $params);
849
+	// Post_number needs to be a positive integer
850
+	$params['post_number'] = absint($params['post_number']);
851
+	if (0 == $params['post_number']) {
852
+		$params['post_number'] = 1;
853
+	}
854
+
855
+	// Validate our layout choice
856
+	// Outside of the norm, I added some more simple terms to match the existing
857
+	// So now I just run the switch to set it properly.
858
+	$params['layout'] = gdsc_validate_layout_choice($params['layout']);
859
+
860
+	// Validate our sorting choice
861
+	$params['list_sort'] = gdsc_validate_sort_choice($params['list_sort'], $params['post_type']);
862
+
863
+	// Validate character_count
864
+	if ($params['character_count'] !== '') {
865
+		$params['character_count'] = absint($params['character_count']);
866
+	}
867
+
868
+	// Validate Listing width, used in the template widget-listing-listview.php
869
+	// The context is in width=$listing_width% - So we need a positive number between 0 & 100
870
+	$params['listing_width'] = gdsc_validate_listing_width($params['listing_width']);
886 871
 
872
+	// Validate the checkboxes used on the widget
873
+	$params['add_location_filter'] = gdsc_to_bool_val($params['add_location_filter']);
874
+	$params['show_featured_only'] = gdsc_to_bool_val($params['show_featured_only']);
875
+	$params['show_special_only'] = gdsc_to_bool_val($params['show_special_only']);
876
+	$params['with_pics_only'] = gdsc_to_bool_val($params['with_pics_only']);
877
+	$params['with_videos_only'] = gdsc_to_bool_val($params['with_videos_only']);
878
+	$params['use_viewing_post_type'] = gdsc_to_bool_val($params['use_viewing_post_type']);
879
+	$params['hide_if_empty'] = gdsc_to_bool_val($params['hide_if_empty']);
887 880
 
888
-    $output = ob_get_contents();
881
+	/**
882
+	 * End of validation
883
+	 */
889 884
 
890
-    ob_end_clean();
885
+	geodir_popular_postview_output($params, $params);
891 886
 
892
-    return $output;
887
+
888
+	$output = ob_get_contents();
889
+
890
+	ob_end_clean();
891
+
892
+	return $output;
893 893
 }
894 894
 
895 895
 add_shortcode('gd_recent_reviews', 'geodir_sc_recent_reviews');
@@ -911,37 +911,37 @@  discard block
 block discarded – undo
911 911
  * @return string Recent reviews HTML.
912 912
  */
913 913
 function geodir_sc_recent_reviews($atts) {
914
-    ob_start();
915
-    $defaults = array(
914
+	ob_start();
915
+	$defaults = array(
916 916
 		'title' => '',
917 917
 		'count' => 5,
918
-    );
918
+	);
919 919
 
920
-    $params = shortcode_atts($defaults, $atts);
920
+	$params = shortcode_atts($defaults, $atts);
921 921
 
922
-    $count = absint($params['count']);
923
-    if (0 == $count) {
924
-        $count = 1;
925
-    }
922
+	$count = absint($params['count']);
923
+	if (0 == $count) {
924
+		$count = 1;
925
+	}
926 926
 	
927 927
 	$title = !empty($params['title']) ? __($params['title'], 'geodirectory') : '';
928 928
 
929
-    $comments_li = geodir_get_recent_reviews(30, $count, 100, false);
929
+	$comments_li = geodir_get_recent_reviews(30, $count, 100, false);
930 930
 
931
-    if ($comments_li) {
932
-        if ($title != '') { ?>
931
+	if ($comments_li) {
932
+		if ($title != '') { ?>
933 933
 		<h3 class="geodir-sc-recent-reviews-title widget-title"><?php echo $title; ?></h3>
934 934
 		<?php } ?>
935 935
         <div class="geodir_sc_recent_reviews_section">
936 936
             <ul class="geodir_sc_recent_reviews"><?php echo $comments_li; ?></ul>
937 937
         </div>
938 938
     <?php
939
-    }
940
-    $output = ob_get_contents();
939
+	}
940
+	$output = ob_get_contents();
941 941
 
942
-    ob_end_clean();
942
+	ob_end_clean();
943 943
 
944
-    return $output;
944
+	return $output;
945 945
 }
946 946
 
947 947
 add_shortcode('gd_related_listings', 'geodir_sc_related_listings');
@@ -971,63 +971,63 @@  discard block
 block discarded – undo
971 971
  */
972 972
 function geodir_sc_related_listings($atts)
973 973
 {
974
-    ob_start();
975
-    $defaults = array(
976
-        'post_number' => 5,
977
-        'relate_to' => 'category',
978
-        'layout' => 'gridview_onehalf',
979
-        'add_location_filter' => 0,
980
-        'listing_width' => '',
981
-        'list_sort' => 'latest',
982
-        'character_count' => 20,
983
-        'is_widget' => 1,
984
-        'before_title' => '<style type="text/css">.geodir_category_list_view li{margin:0px!important}</style>',
985
-    );
986
-    // The "before_title" code is an ugly & terrible hack. But it works for now. I should enqueue a new stylesheet.
987
-
988
-    $params = shortcode_atts($defaults, $atts);
989
-
990
-    /**
991
-     * Begin validating parameters
992
-     */
974
+	ob_start();
975
+	$defaults = array(
976
+		'post_number' => 5,
977
+		'relate_to' => 'category',
978
+		'layout' => 'gridview_onehalf',
979
+		'add_location_filter' => 0,
980
+		'listing_width' => '',
981
+		'list_sort' => 'latest',
982
+		'character_count' => 20,
983
+		'is_widget' => 1,
984
+		'before_title' => '<style type="text/css">.geodir_category_list_view li{margin:0px!important}</style>',
985
+	);
986
+	// The "before_title" code is an ugly & terrible hack. But it works for now. I should enqueue a new stylesheet.
987
+
988
+	$params = shortcode_atts($defaults, $atts);
989
+
990
+	/**
991
+	 * Begin validating parameters
992
+	 */
993 993
 
994
-    // Validate that post_number is a number and is 1 or higher
995
-    $params['post_number'] = absint($params['post_number']);
996
-    if (0 === $params['post_number']) {
997
-        $params['post_number'] = 1;
998
-    }
994
+	// Validate that post_number is a number and is 1 or higher
995
+	$params['post_number'] = absint($params['post_number']);
996
+	if (0 === $params['post_number']) {
997
+		$params['post_number'] = 1;
998
+	}
999 999
 
1000
-    // Validate relate_to - only category or tags
1001
-    $params['relate_to'] = geodir_strtolower($params['relate_to']);
1002
-    if ('category' != $params['relate_to'] && 'tags' != $params['relate_to']) {
1003
-        $params['relate_to'] = 'category';
1004
-    }
1000
+	// Validate relate_to - only category or tags
1001
+	$params['relate_to'] = geodir_strtolower($params['relate_to']);
1002
+	if ('category' != $params['relate_to'] && 'tags' != $params['relate_to']) {
1003
+		$params['relate_to'] = 'category';
1004
+	}
1005 1005
 
1006
-    // Validate layout selection
1007
-    $params['layout'] = gdsc_validate_layout_choice($params['layout']);
1006
+	// Validate layout selection
1007
+	$params['layout'] = gdsc_validate_layout_choice($params['layout']);
1008 1008
 
1009
-    // Validate sorting option
1010
-    $params['list_sort'] = gdsc_validate_sort_choice($params['list_sort']);
1009
+	// Validate sorting option
1010
+	$params['list_sort'] = gdsc_validate_sort_choice($params['list_sort']);
1011 1011
 
1012
-    // Validate add_location_filter
1013
-    $params['add_location_filter'] = gdsc_to_bool_val($params['add_location_filter']);
1012
+	// Validate add_location_filter
1013
+	$params['add_location_filter'] = gdsc_to_bool_val($params['add_location_filter']);
1014 1014
 
1015
-    // Validate listing_width
1016
-    $params['listing_width'] = gdsc_validate_listing_width($params['listing_width']);
1015
+	// Validate listing_width
1016
+	$params['listing_width'] = gdsc_validate_listing_width($params['listing_width']);
1017 1017
 
1018
-    // Validate character_count
1019
-    if ($params['character_count'] !== '') {
1020
-        $params['character_count'] = absint($params['character_count']);
1021
-    }
1018
+	// Validate character_count
1019
+	if ($params['character_count'] !== '') {
1020
+		$params['character_count'] = absint($params['character_count']);
1021
+	}
1022 1022
 
1023
-    if ($related_display = geodir_related_posts_display($params)) {
1024
-        echo $related_display;
1025
-    }
1026
-    $output = ob_get_contents();
1023
+	if ($related_display = geodir_related_posts_display($params)) {
1024
+		echo $related_display;
1025
+	}
1026
+	$output = ob_get_contents();
1027 1027
 
1028
-    ob_end_clean();
1028
+	ob_end_clean();
1029 1029
 
1030
-    return $output;
1030
+	return $output;
1031 1031
 }
1032 1032
 
1033 1033
 /**
@@ -1051,13 +1051,13 @@  discard block
 block discarded – undo
1051 1051
  * @return string Advanced search widget HTML.
1052 1052
  */
1053 1053
 function geodir_sc_advanced_search($atts) {
1054
-    $defaults = array(
1054
+	$defaults = array(
1055 1055
 		'title' => '',
1056 1056
 		'before_widget' => '<section id="geodir_advanced_search-1" class="widget geodir-widget geodir_advance_search_widget">',
1057
-        'after_widget' => '</section>',
1058
-        'before_title' => '<h3 class="widget-title">',
1059
-        'after_title' => '</h3>',
1060
-        'show_adv_search' => 'default',
1057
+		'after_widget' => '</section>',
1058
+		'before_title' => '<h3 class="widget-title">',
1059
+		'after_title' => '</h3>',
1060
+		'show_adv_search' => 'default',
1061 1061
 		'post_type' => ''
1062 1062
 	);
1063 1063
 	
@@ -1081,9 +1081,9 @@  discard block
 block discarded – undo
1081 1081
 	the_widget('geodir_advance_search_widget', $params, $params );
1082 1082
 	
1083 1083
 	$output = ob_get_contents();
1084
-    ob_end_clean();
1084
+	ob_end_clean();
1085 1085
 
1086
-    return $output;
1086
+	return $output;
1087 1087
 }
1088 1088
 add_shortcode('gd_advanced_search', 'geodir_sc_advanced_search');
1089 1089
 
@@ -1129,48 +1129,48 @@  discard block
 block discarded – undo
1129 1129
 		'add_location_filter' => '1',
1130 1130
 		'tab_layout' => 'bestof-tabs-on-top',
1131 1131
 		'before_widget' => '<section id="bestof_widget-1" class="widget geodir-widget geodir_bestof_widget geodir_sc_bestof_widget">',
1132
-        'after_widget' => '</section>',
1133
-        'before_title' => '<h3 class="widget-title">',
1134
-        'after_title' => '</h3>',
1132
+		'after_widget' => '</section>',
1133
+		'before_title' => '<h3 class="widget-title">',
1134
+		'after_title' => '</h3>',
1135 1135
 	);
1136 1136
 	$params = shortcode_atts($defaults, $atts);
1137 1137
 
1138
-    /**
1139
-     * Validate our incoming params
1140
-     */
1138
+	/**
1139
+	 * Validate our incoming params
1140
+	 */
1141 1141
 
1142
-    // Validate the selected post type, default to gd_place on fail
1143
-    if (!(gdsc_is_post_type_valid($params['post_type']))) {
1144
-        $params['post_type'] = 'gd_place';
1145
-    }
1142
+	// Validate the selected post type, default to gd_place on fail
1143
+	if (!(gdsc_is_post_type_valid($params['post_type']))) {
1144
+		$params['post_type'] = 'gd_place';
1145
+	}
1146 1146
 	
1147 1147
 	// Post limit needs to be a positive integer
1148
-    $params['post_limit'] = absint($params['post_limit']);
1149
-    if (0 == $params['post_limit']) {
1150
-        $params['post_limit'] = 5;
1151
-    }
1148
+	$params['post_limit'] = absint($params['post_limit']);
1149
+	if (0 == $params['post_limit']) {
1150
+		$params['post_limit'] = 5;
1151
+	}
1152 1152
 	
1153 1153
 	// Category limit needs to be a positive integer
1154
-    $params['categ_limit'] = absint($params['categ_limit']);
1155
-    if (0 == $params['categ_limit']) {
1156
-        $params['categ_limit'] = 3;
1157
-    }
1154
+	$params['categ_limit'] = absint($params['categ_limit']);
1155
+	if (0 == $params['categ_limit']) {
1156
+		$params['categ_limit'] = 3;
1157
+	}
1158 1158
 	
1159 1159
 	// Tab layout validation
1160
-    $params['tab_layout'] = $params['tab_layout'];
1161
-    if (!in_array($params['tab_layout'], array('bestof-tabs-on-top', 'bestof-tabs-on-left', 'bestof-tabs-as-dropdown'))) {
1162
-        $params['tab_layout'] = 'bestof-tabs-on-top';
1163
-    }
1160
+	$params['tab_layout'] = $params['tab_layout'];
1161
+	if (!in_array($params['tab_layout'], array('bestof-tabs-on-top', 'bestof-tabs-on-left', 'bestof-tabs-as-dropdown'))) {
1162
+		$params['tab_layout'] = 'bestof-tabs-on-top';
1163
+	}
1164 1164
 	
1165 1165
 	// Validate character_count
1166
-    $params['character_count'] = $params['character_count'];
1166
+	$params['character_count'] = $params['character_count'];
1167 1167
 
1168 1168
 	ob_start();
1169 1169
 	the_widget('geodir_bestof_widget', $params, $params);
1170
-    $output = ob_get_contents();
1171
-    ob_end_clean();
1170
+	$output = ob_get_contents();
1171
+	ob_end_clean();
1172 1172
 
1173
-    return $output;
1173
+	return $output;
1174 1174
 }
1175 1175
 add_shortcode('gd_bestof_widget', 'geodir_sc_bestof_widget');
1176 1176
 
@@ -1223,162 +1223,162 @@  discard block
 block discarded – undo
1223 1223
  * @return string HTML content to display geodirectory listings.
1224 1224
  */
1225 1225
 function geodir_sc_gd_listings($atts, $content = '') {
1226
-    global $post;
1227
-    $defaults = array(
1228
-        'title'                 => '',
1229
-        'post_type'             => 'gd_place',
1230
-        'category'              => 0,
1231
-        'list_sort'             => 'latest',
1232
-        'event_type'            => '',
1233
-        'post_number'           => 10,
1234
-        'post_author'           => '',
1235
-        'layout'                => 'gridview_onehalf',
1236
-        'listing_width'         => '',
1237
-        'character_count'       => 20,
1238
-        'add_location_filter'   => 1,
1239
-        'show_featured_only'    => '',
1240
-        'show_special_only'     => '',
1241
-        'with_pics_only'        => '',
1242
-        'with_videos_only'      => '',
1243
-        'with_pagination'       => '1',
1244
-        'top_pagination'        => '0',
1245
-        'bottom_pagination'     => '1',
1246
-        'without_no_results'    => 0,
1247
-        'tags'                  => '',
1248
-        'show_favorites_only'   => '',
1249
-        'favorites_by_user'     => '',
1250
-    );
1251
-    $params = shortcode_atts($defaults, $atts);
1252
-
1253
-    $params['title']        = wp_strip_all_tags($params['title']);
1254
-    $params['post_type']    = gdsc_is_post_type_valid($params['post_type']) ? $params['post_type'] : 'gd_place';
1255
-
1256
-    // Validate the selected category/ies - Grab the current list based on post_type
1257
-    $category_taxonomy      = geodir_get_taxonomies($params['post_type']);
1258
-    $categories             = get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC', 'fields' => 'ids', 'hide_empty' => 0));
1259
-
1260
-    // Make sure we have an array
1261
-    if (!(is_array($params['category']))) {
1262
-        $params['category'] = explode(',', $params['category']);
1263
-    }
1264
-
1265
-    // Array_intersect returns only the items in $params['category'] that are also in our category list
1266
-    // Otherwise it becomes empty and later on that will mean "All"
1267
-    $params['category']     = array_intersect($params['category'], $categories);
1268
-
1269
-    // Post_number needs to be a positive integer
1270
-    $params['post_number']  = absint($params['post_number']);
1271
-    $params['post_number']  = $params['post_number'] > 0 ? $params['post_number'] : 10;
1226
+	global $post;
1227
+	$defaults = array(
1228
+		'title'                 => '',
1229
+		'post_type'             => 'gd_place',
1230
+		'category'              => 0,
1231
+		'list_sort'             => 'latest',
1232
+		'event_type'            => '',
1233
+		'post_number'           => 10,
1234
+		'post_author'           => '',
1235
+		'layout'                => 'gridview_onehalf',
1236
+		'listing_width'         => '',
1237
+		'character_count'       => 20,
1238
+		'add_location_filter'   => 1,
1239
+		'show_featured_only'    => '',
1240
+		'show_special_only'     => '',
1241
+		'with_pics_only'        => '',
1242
+		'with_videos_only'      => '',
1243
+		'with_pagination'       => '1',
1244
+		'top_pagination'        => '0',
1245
+		'bottom_pagination'     => '1',
1246
+		'without_no_results'    => 0,
1247
+		'tags'                  => '',
1248
+		'show_favorites_only'   => '',
1249
+		'favorites_by_user'     => '',
1250
+	);
1251
+	$params = shortcode_atts($defaults, $atts);
1252
+
1253
+	$params['title']        = wp_strip_all_tags($params['title']);
1254
+	$params['post_type']    = gdsc_is_post_type_valid($params['post_type']) ? $params['post_type'] : 'gd_place';
1255
+
1256
+	// Validate the selected category/ies - Grab the current list based on post_type
1257
+	$category_taxonomy      = geodir_get_taxonomies($params['post_type']);
1258
+	$categories             = get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC', 'fields' => 'ids', 'hide_empty' => 0));
1259
+
1260
+	// Make sure we have an array
1261
+	if (!(is_array($params['category']))) {
1262
+		$params['category'] = explode(',', $params['category']);
1263
+	}
1264
+
1265
+	// Array_intersect returns only the items in $params['category'] that are also in our category list
1266
+	// Otherwise it becomes empty and later on that will mean "All"
1267
+	$params['category']     = array_intersect($params['category'], $categories);
1268
+
1269
+	// Post_number needs to be a positive integer
1270
+	$params['post_number']  = absint($params['post_number']);
1271
+	$params['post_number']  = $params['post_number'] > 0 ? $params['post_number'] : 10;
1272 1272
     
1273
-    // Post_number needs to be a positive integer
1274
-    if (!empty($params['post_author'])) {
1275
-        // 'current' left for backwards compatibility
1276
-        if ( $params['post_author'] == 'current' || $params['post_author'] == 'current_author') {
1277
-            if (!empty($post) && $post->post_type != 'page' && isset($post->post_author)) {
1278
-                $params['post_author'] = $post->post_author;
1279
-            } else {
1280
-                $params['post_author'] = -1; // Don't show any listings.
1281
-            }
1282
-        } else if ($params['post_author'] == 'current_user' ) {
1283
-            if ($current_user_id = get_current_user_id()) {
1284
-                $params['post_author'] = $current_user_id;
1285
-            } else {
1286
-                $params['post_author'] = -1; // If not logged in then don't show any listings.
1287
-            }
1288
-        } else if (absint($params['post_author']) > 0) {
1289
-            $params['post_author'] = absint($params['post_author']);
1290
-        } else {
1291
-            $params['post_author'] = -1; // Don't show any listings.
1292
-        }
1293
-    } else {
1294
-        unset($params['post_author']);
1295
-    }
1296
-
1297
-    // Validate character_count
1298
-    //todo: is this necessary?
1299
-    $params['character_count']  = $params['character_count'];
1300
-
1301
-    // Validate our layout choice
1302
-    // Outside of the norm, I added some more simple terms to match the existing
1303
-    // So now I just run the switch to set it properly.
1304
-    $params['layout']           = gdsc_validate_layout_choice($params['layout']);
1305
-
1306
-    // Validate our sorting choice
1307
-    $params['list_sort']        = gdsc_validate_sort_choice($params['list_sort'], $params['post_type']);
1308
-
1309
-    // Validate Listing width, used in the template widget-listing-listview.php
1310
-    // The context is in width=$listing_width% - So we need a positive number between 0 & 100
1311
-    $params['listing_width']    = gdsc_validate_listing_width($params['listing_width']);
1312
-
1313
-    // Validate the checkboxes used on the widget
1314
-    $params['add_location_filter']  = gdsc_to_bool_val($params['add_location_filter']);
1315
-    $params['show_featured_only']   = gdsc_to_bool_val($params['show_featured_only']);
1316
-    $params['show_special_only']    = gdsc_to_bool_val($params['show_special_only']);
1317
-    $params['with_pics_only']       = gdsc_to_bool_val($params['with_pics_only']);
1318
-    $params['with_videos_only']     = gdsc_to_bool_val($params['with_videos_only']);
1319
-    $params['with_pagination']      = gdsc_to_bool_val($params['with_pagination']);
1320
-    $params['top_pagination']       = gdsc_to_bool_val($params['top_pagination']);
1321
-    $params['bottom_pagination']    = gdsc_to_bool_val($params['bottom_pagination']);
1273
+	// Post_number needs to be a positive integer
1274
+	if (!empty($params['post_author'])) {
1275
+		// 'current' left for backwards compatibility
1276
+		if ( $params['post_author'] == 'current' || $params['post_author'] == 'current_author') {
1277
+			if (!empty($post) && $post->post_type != 'page' && isset($post->post_author)) {
1278
+				$params['post_author'] = $post->post_author;
1279
+			} else {
1280
+				$params['post_author'] = -1; // Don't show any listings.
1281
+			}
1282
+		} else if ($params['post_author'] == 'current_user' ) {
1283
+			if ($current_user_id = get_current_user_id()) {
1284
+				$params['post_author'] = $current_user_id;
1285
+			} else {
1286
+				$params['post_author'] = -1; // If not logged in then don't show any listings.
1287
+			}
1288
+		} else if (absint($params['post_author']) > 0) {
1289
+			$params['post_author'] = absint($params['post_author']);
1290
+		} else {
1291
+			$params['post_author'] = -1; // Don't show any listings.
1292
+		}
1293
+	} else {
1294
+		unset($params['post_author']);
1295
+	}
1296
+
1297
+	// Validate character_count
1298
+	//todo: is this necessary?
1299
+	$params['character_count']  = $params['character_count'];
1300
+
1301
+	// Validate our layout choice
1302
+	// Outside of the norm, I added some more simple terms to match the existing
1303
+	// So now I just run the switch to set it properly.
1304
+	$params['layout']           = gdsc_validate_layout_choice($params['layout']);
1305
+
1306
+	// Validate our sorting choice
1307
+	$params['list_sort']        = gdsc_validate_sort_choice($params['list_sort'], $params['post_type']);
1308
+
1309
+	// Validate Listing width, used in the template widget-listing-listview.php
1310
+	// The context is in width=$listing_width% - So we need a positive number between 0 & 100
1311
+	$params['listing_width']    = gdsc_validate_listing_width($params['listing_width']);
1312
+
1313
+	// Validate the checkboxes used on the widget
1314
+	$params['add_location_filter']  = gdsc_to_bool_val($params['add_location_filter']);
1315
+	$params['show_featured_only']   = gdsc_to_bool_val($params['show_featured_only']);
1316
+	$params['show_special_only']    = gdsc_to_bool_val($params['show_special_only']);
1317
+	$params['with_pics_only']       = gdsc_to_bool_val($params['with_pics_only']);
1318
+	$params['with_videos_only']     = gdsc_to_bool_val($params['with_videos_only']);
1319
+	$params['with_pagination']      = gdsc_to_bool_val($params['with_pagination']);
1320
+	$params['top_pagination']       = gdsc_to_bool_val($params['top_pagination']);
1321
+	$params['bottom_pagination']    = gdsc_to_bool_val($params['bottom_pagination']);
1322 1322
     
1323
-    // User favorites
1324
-    $params['show_favorites_only']  = gdsc_to_bool_val($params['show_favorites_only']);
1325
-    if (!empty($params['show_favorites_only'])) {
1326
-        if ( $params['favorites_by_user'] == 'current' || $params['favorites_by_user'] == 'current_author') {
1327
-            if (!empty($post) && $post->post_type != 'page' && isset($post->post_author)) {
1328
-                $params['favorites_by_user'] = $post->post_author;
1329
-            } else {
1330
-                $params['favorites_by_user'] = 0;
1331
-            }
1332
-        } else if ($params['favorites_by_user'] == 'current_user' || empty($params['favorites_by_user'])) {
1333
-            if ($current_user_id = get_current_user_id()) {
1334
-                $params['favorites_by_user'] = $current_user_id;
1335
-            } else {
1336
-                $params['favorites_by_user'] = 0;
1337
-            }
1338
-        } else if (absint($params['favorites_by_user']) > 0) {
1339
-            $params['favorites_by_user'] = absint($params['favorites_by_user']);
1340
-        } else {
1341
-            $params['favorites_by_user'] = 0;
1342
-        }
1343
-    }
1344
-
1345
-    // Clean tags
1346
-    if (!empty($params['tags'])) {
1347
-        if (!is_array($params['tags'])) {
1348
-            $comma = _x(',', 'tag delimiter');
1349
-            if ( ',' !== $comma ) {
1350
-                $params['tags'] = str_replace($comma, ',', $params['tags']);
1351
-            }
1352
-            $params['tags'] = explode(',', trim($params['tags'], " \n\t\r\0\x0B,"));
1353
-            $params['tags'] = array_map('trim', $params['tags']);
1354
-        }
1355
-    } else {
1356
-        $params['tags'] = array();
1357
-    }
1358
-
1359
-    /**
1360
-     * End of validation
1361
-     */
1362
-    if (isset($atts['geodir_ajax'])) {
1363
-        $params['geodir_ajax'] = $atts['geodir_ajax'];
1364
-        unset($atts['geodir_ajax']);
1365
-    }
1366
-    if (isset($atts['pageno'])) {
1367
-        $params['pageno'] = $atts['pageno'];
1368
-        unset($atts['pageno']);
1369
-    }
1370
-
1371
-    if ( !empty($atts['shortcode_content']) ) {
1372
-        $content = $atts['shortcode_content'];
1373
-    }
1374
-    $params['shortcode_content'] = trim($content);
1375
-    $atts['shortcode_content'] = trim($content);
1323
+	// User favorites
1324
+	$params['show_favorites_only']  = gdsc_to_bool_val($params['show_favorites_only']);
1325
+	if (!empty($params['show_favorites_only'])) {
1326
+		if ( $params['favorites_by_user'] == 'current' || $params['favorites_by_user'] == 'current_author') {
1327
+			if (!empty($post) && $post->post_type != 'page' && isset($post->post_author)) {
1328
+				$params['favorites_by_user'] = $post->post_author;
1329
+			} else {
1330
+				$params['favorites_by_user'] = 0;
1331
+			}
1332
+		} else if ($params['favorites_by_user'] == 'current_user' || empty($params['favorites_by_user'])) {
1333
+			if ($current_user_id = get_current_user_id()) {
1334
+				$params['favorites_by_user'] = $current_user_id;
1335
+			} else {
1336
+				$params['favorites_by_user'] = 0;
1337
+			}
1338
+		} else if (absint($params['favorites_by_user']) > 0) {
1339
+			$params['favorites_by_user'] = absint($params['favorites_by_user']);
1340
+		} else {
1341
+			$params['favorites_by_user'] = 0;
1342
+		}
1343
+	}
1344
+
1345
+	// Clean tags
1346
+	if (!empty($params['tags'])) {
1347
+		if (!is_array($params['tags'])) {
1348
+			$comma = _x(',', 'tag delimiter');
1349
+			if ( ',' !== $comma ) {
1350
+				$params['tags'] = str_replace($comma, ',', $params['tags']);
1351
+			}
1352
+			$params['tags'] = explode(',', trim($params['tags'], " \n\t\r\0\x0B,"));
1353
+			$params['tags'] = array_map('trim', $params['tags']);
1354
+		}
1355
+	} else {
1356
+		$params['tags'] = array();
1357
+	}
1358
+
1359
+	/**
1360
+	 * End of validation
1361
+	 */
1362
+	if (isset($atts['geodir_ajax'])) {
1363
+		$params['geodir_ajax'] = $atts['geodir_ajax'];
1364
+		unset($atts['geodir_ajax']);
1365
+	}
1366
+	if (isset($atts['pageno'])) {
1367
+		$params['pageno'] = $atts['pageno'];
1368
+		unset($atts['pageno']);
1369
+	}
1370
+
1371
+	if ( !empty($atts['shortcode_content']) ) {
1372
+		$content = $atts['shortcode_content'];
1373
+	}
1374
+	$params['shortcode_content'] = trim($content);
1375
+	$atts['shortcode_content'] = trim($content);
1376 1376
     
1377
-    $params['shortcode_atts']       = $atts;
1377
+	$params['shortcode_atts']       = $atts;
1378 1378
 
1379
-    $output = geodir_sc_gd_listings_output($params);
1379
+	$output = geodir_sc_gd_listings_output($params);
1380 1380
 
1381
-    return $output;
1381
+	return $output;
1382 1382
 }
1383 1383
 add_shortcode('gd_listings', 'geodir_sc_gd_listings');
1384 1384
 
@@ -1418,56 +1418,56 @@  discard block
 block discarded – undo
1418 1418
  * @return string HTML content to display CPT categories.
1419 1419
  */
1420 1420
 function geodir_sc_cpt_categories_widget($atts, $content = '') {
1421
-    $defaults = array(
1422
-        'title' => '',
1423
-        'post_type' => '', // NULL for all
1424
-        'hide_empty' => '',
1425
-        'show_count' => '',
1426
-        'hide_icon' => '',
1427
-        'cpt_left' => '',
1428
-        'sort_by' => 'count',
1429
-        'max_count' => 'all',
1430
-        'max_level' => '1',
1431
-        'no_cpt_filter' => '',
1432
-        'no_cat_filter' => '',
1433
-        'before_widget' => '<section id="geodir_cpt_categories_widget-1" class="widget geodir-widget geodir_cpt_categories_widget geodir_sc_cpt_categories_widget">',
1434
-        'after_widget' => '</section>',
1435
-        'before_title' => '<h3 class="widget-title">',
1436
-        'after_title' => '</h3>',
1437
-    );
1438
-    $params = shortcode_atts($defaults, $atts);
1439
-
1440
-    /**
1441
-     * Validate our incoming params
1442
-     */
1443
-    // Make sure we have an array
1444
-    $params['post_type'] = !is_array($params['post_type']) && trim($params['post_type']) != '' ? explode(',', trim($params['post_type'])) : array();
1445
-     
1446
-    // Validate the checkboxes used on the widget
1447
-    $params['hide_empty'] 	= gdsc_to_bool_val($params['hide_empty']);
1448
-    $params['show_count'] 	= gdsc_to_bool_val($params['show_count']);
1449
-    $params['hide_icon'] 	= gdsc_to_bool_val($params['hide_icon']);
1450
-    $params['cpt_left'] 	= gdsc_to_bool_val($params['cpt_left']);
1421
+	$defaults = array(
1422
+		'title' => '',
1423
+		'post_type' => '', // NULL for all
1424
+		'hide_empty' => '',
1425
+		'show_count' => '',
1426
+		'hide_icon' => '',
1427
+		'cpt_left' => '',
1428
+		'sort_by' => 'count',
1429
+		'max_count' => 'all',
1430
+		'max_level' => '1',
1431
+		'no_cpt_filter' => '',
1432
+		'no_cat_filter' => '',
1433
+		'before_widget' => '<section id="geodir_cpt_categories_widget-1" class="widget geodir-widget geodir_cpt_categories_widget geodir_sc_cpt_categories_widget">',
1434
+		'after_widget' => '</section>',
1435
+		'before_title' => '<h3 class="widget-title">',
1436
+		'after_title' => '</h3>',
1437
+	);
1438
+	$params = shortcode_atts($defaults, $atts);
1451 1439
 
1452
-    if ($params['max_count'] != 'all') {
1453
-        $params['max_count'] = absint($params['max_count']);
1454
-    }
1440
+	/**
1441
+	 * Validate our incoming params
1442
+	 */
1443
+	// Make sure we have an array
1444
+	$params['post_type'] = !is_array($params['post_type']) && trim($params['post_type']) != '' ? explode(',', trim($params['post_type'])) : array();
1445
+     
1446
+	// Validate the checkboxes used on the widget
1447
+	$params['hide_empty'] 	= gdsc_to_bool_val($params['hide_empty']);
1448
+	$params['show_count'] 	= gdsc_to_bool_val($params['show_count']);
1449
+	$params['hide_icon'] 	= gdsc_to_bool_val($params['hide_icon']);
1450
+	$params['cpt_left'] 	= gdsc_to_bool_val($params['cpt_left']);
1451
+
1452
+	if ($params['max_count'] != 'all') {
1453
+		$params['max_count'] = absint($params['max_count']);
1454
+	}
1455 1455
 
1456
-    if ($params['max_level'] != 'all') {
1457
-        $params['max_level'] = absint($params['max_level']);
1458
-    }
1456
+	if ($params['max_level'] != 'all') {
1457
+		$params['max_level'] = absint($params['max_level']);
1458
+	}
1459 1459
 
1460
-    $params['no_cpt_filter'] = gdsc_to_bool_val($params['no_cpt_filter']);
1461
-    $params['no_cat_filter'] = gdsc_to_bool_val($params['no_cat_filter']);
1460
+	$params['no_cpt_filter'] = gdsc_to_bool_val($params['no_cpt_filter']);
1461
+	$params['no_cat_filter'] = gdsc_to_bool_val($params['no_cat_filter']);
1462 1462
 
1463
-    $params['sort_by'] = $params['sort_by'] == 'az' ? 'az' : 'count';
1463
+	$params['sort_by'] = $params['sort_by'] == 'az' ? 'az' : 'count';
1464 1464
 
1465
-    ob_start();
1466
-    the_widget('geodir_cpt_categories_widget', $params, $params);
1467
-    $output = ob_get_contents();
1468
-    ob_end_clean();
1465
+	ob_start();
1466
+	the_widget('geodir_cpt_categories_widget', $params, $params);
1467
+	$output = ob_get_contents();
1468
+	ob_end_clean();
1469 1469
 
1470
-    return $output;
1470
+	return $output;
1471 1471
 }
1472 1472
 add_shortcode('gd_cpt_categories', 'geodir_sc_cpt_categories_widget');
1473 1473
 
@@ -1482,6 +1482,6 @@  discard block
 block discarded – undo
1482 1482
  * @return string HTML code.
1483 1483
  */
1484 1484
 function geodir_sc_responsive_videos($atts, $content) {
1485
-    return '<div class="geodir-video-wrapper">'.$content.'</div>';
1485
+	return '<div class="geodir-video-wrapper">'.$content.'</div>';
1486 1486
 }
1487 1487
 add_shortcode('gd_video', 'geodir_sc_responsive_videos');
1488 1488
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +59 added lines, -59 removed lines patch added patch discarded remove patch
@@ -197,14 +197,14 @@  discard block
 block discarded – undo
197 197
 	// Add marker cluster
198 198
 	if (isset($params['marker_cluster']) && gdsc_to_bool_val($params['marker_cluster']) && defined('GDCLUSTER_VERSION')) {
199 199
         $map_args['enable_marker_cluster'] = true;
200
-        if(get_option('geodir_marker_cluster_type')) {
200
+        if (get_option('geodir_marker_cluster_type')) {
201 201
             if ($map_args['autozoom']) {
202 202
                 $map_args['enable_marker_cluster_no_reposition'] = false;
203 203
             } else {
204 204
                 $map_args['enable_marker_cluster_no_reposition'] = true;
205 205
             }
206 206
 
207
-            $map_args['enable_marker_cluster_server'] = true ;
207
+            $map_args['enable_marker_cluster_server'] = true;
208 208
 
209 209
         }
210 210
 	} else {
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
 	}
213 213
 
214 214
     // if lat and long set in shortcode, hack it so the map is not repositioned
215
-    if(!empty($params['latitude']) && !empty($params['longitude']) ){
215
+    if (!empty($params['latitude']) && !empty($params['longitude'])) {
216 216
         $map_args['enable_marker_cluster_no_reposition'] = true;
217 217
     }
218 218
 
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
 function geodir_sc_listing_map($atts) {
266 266
 
267 267
     // if some params are set then we need a new query, if not then we can use the main query
268
-    if( isset($atts['post_type']) || isset($atts['category']) || isset($atts['event_type']) ) {
268
+    if (isset($atts['post_type']) || isset($atts['category']) || isset($atts['event_type'])) {
269 269
 
270 270
         global $add_post_in_marker_array, $gd_sc_map_params;
271 271
         $backup_globals                             = array();
@@ -288,34 +288,34 @@  discard block
 block discarded – undo
288 288
             'event_type'     => 'all'
289 289
         );
290 290
 
291
-        $params = shortcode_atts( $defaults, $atts );
291
+        $params = shortcode_atts($defaults, $atts);
292 292
 
293
-        if ( ! ( gdsc_is_post_type_valid( $params['post_type'] ) ) ) {
293
+        if (!(gdsc_is_post_type_valid($params['post_type']))) {
294 294
             $params['post_type'] = 'gd_place';
295 295
         }
296 296
 
297 297
         // Validate the selected category/ies - Grab the current list based on post_type
298
-        $category_taxonomy = geodir_get_taxonomies( $params['post_type'] );
299
-        $categories        = get_terms( $category_taxonomy, array(
298
+        $category_taxonomy = geodir_get_taxonomies($params['post_type']);
299
+        $categories        = get_terms($category_taxonomy, array(
300 300
             'orderby' => 'count',
301 301
             'order'   => 'DESC',
302 302
             'fields'  => 'ids'
303
-        ) );
303
+        ));
304 304
 
305 305
         // Make sure we have an array
306
-        if ( ! ( is_array( $params['category'] ) ) ) {
307
-            $params['category'] = explode( ',', $params['category'] );
306
+        if (!(is_array($params['category']))) {
307
+            $params['category'] = explode(',', $params['category']);
308 308
         }
309 309
 
310 310
         // Array_intersect returns only the items in $params['category'] that are also in our category list
311 311
         // Otherwise it becomes empty and later on that will mean "All"
312
-        $params['category'] = array_intersect( $params['category'], $categories );
312
+        $params['category'] = array_intersect($params['category'], $categories);
313 313
 
314
-        if ( $params['post_type'] == 'gd_event' ) {
315
-            $params['event_type'] = gdsc_validate_list_filter_choice( $params['event_type'] );
314
+        if ($params['post_type'] == 'gd_event') {
315
+            $params['event_type'] = gdsc_validate_list_filter_choice($params['event_type']);
316 316
         }
317 317
 
318
-        $params = gdsc_validate_map_args( $params );
318
+        $params = gdsc_validate_map_args($params);
319 319
 
320 320
         $gd_sc_map_params = $params;
321 321
 
@@ -326,12 +326,12 @@  discard block
 block discarded – undo
326 326
             'post_type'      => $params['post_type'],
327 327
         );
328 328
 
329
-        if ( ! empty( $params['category'] ) && isset( $params['category'][0] ) && (int) $params['category'][0] != 0 ) {
330
-            $category_taxonomy = geodir_get_taxonomies( $params['post_type'] );
329
+        if (!empty($params['category']) && isset($params['category'][0]) && (int) $params['category'][0] != 0) {
330
+            $category_taxonomy = geodir_get_taxonomies($params['post_type']);
331 331
 
332 332
             ######### WPML #########
333
-            if ( geodir_wpml_is_taxonomy_translated( $category_taxonomy[0] ) ) {
334
-                $category = gd_lang_object_ids( $params['category'], $category_taxonomy[0] );
333
+            if (geodir_wpml_is_taxonomy_translated($category_taxonomy[0])) {
334
+                $category = gd_lang_object_ids($params['category'], $category_taxonomy[0]);
335 335
             }
336 336
             ######### WPML #########
337 337
 
@@ -341,36 +341,36 @@  discard block
 block discarded – undo
341 341
                 'terms'    => $params['category']
342 342
             );
343 343
 
344
-            $query_args['tax_query'] = array( $tax_query );
344
+            $query_args['tax_query'] = array($tax_query);
345 345
         }
346 346
 
347 347
         $add_post_in_marker_array = true;
348 348
 
349
-        if ( $params['post_type'] == 'gd_event' && function_exists( 'geodir_event_get_widget_events' ) ) {
349
+        if ($params['post_type'] == 'gd_event' && function_exists('geodir_event_get_widget_events')) {
350 350
             global $geodir_event_widget_listview;
351 351
             $geodir_event_widget_listview = true;
352 352
 
353 353
             $query_args['geodir_event_type'] = $params['event_type'];
354 354
 
355
-            $listings = geodir_event_get_widget_events( $query_args );
355
+            $listings = geodir_event_get_widget_events($query_args);
356 356
 
357 357
             $geodir_event_widget_listview = false;
358 358
         } else {
359
-            $listings = geodir_get_widget_listings( $query_args );
359
+            $listings = geodir_get_widget_listings($query_args);
360 360
         }
361 361
 
362
-        if ( ! empty( $listings ) ) {
363
-            foreach ( $listings as $listing ) {
364
-                create_marker_jason_of_posts( $listing );
362
+        if (!empty($listings)) {
363
+            foreach ($listings as $listing) {
364
+                create_marker_jason_of_posts($listing);
365 365
             }
366 366
         }
367 367
 
368 368
         ob_start();
369
-        add_action( 'wp_head', 'init_listing_map_script' ); // Initialize the map object and marker array
369
+        add_action('wp_head', 'init_listing_map_script'); // Initialize the map object and marker array
370 370
 
371
-        add_action( 'the_post', 'create_list_jsondata' ); // Add marker in json array
371
+        add_action('the_post', 'create_list_jsondata'); // Add marker in json array
372 372
 
373
-        add_action( 'wp_footer', 'show_listing_widget_map' ); // Show map for listings with markers
373
+        add_action('wp_footer', 'show_listing_widget_map'); // Show map for listings with markers
374 374
 
375 375
         $default_location = geodir_get_default_location();
376 376
 
@@ -391,17 +391,17 @@  discard block
 block discarded – undo
391 391
             'enable_location_filters'  => false,
392 392
             'enable_jason_on_load'     => true,
393 393
             'ajax_url'                 => geodir_get_ajax_url(),
394
-            'latitude'                 => isset( $default_location->city_latitude ) ? $default_location->city_latitude : '',
395
-            'longitude'                => isset( $default_location->city_longitude ) ? $default_location->city_longitude : '',
394
+            'latitude'                 => isset($default_location->city_latitude) ? $default_location->city_latitude : '',
395
+            'longitude'                => isset($default_location->city_longitude) ? $default_location->city_longitude : '',
396 396
             'streetViewControl'        => true,
397 397
             'showPreview'              => '0',
398 398
             'maxZoom'                  => 21,
399 399
             'bubble_size'              => 'small',
400 400
         );
401 401
 
402
-        if ( is_single() ) {
402
+        if (is_single()) {
403 403
             global $post;
404
-            if ( isset( $post->post_latitude ) ) {
404
+            if (isset($post->post_latitude)) {
405 405
                 $map_args['latitude']  = $post->post_latitude;
406 406
                 $map_args['longitude'] = $post->post_longitude;
407 407
             }
@@ -412,24 +412,24 @@  discard block
 block discarded – undo
412 412
         }
413 413
 
414 414
         // Add marker cluster
415
-        if ( isset( $params['marker_cluster'] ) && gdsc_to_bool_val( $params['marker_cluster'] ) && defined( 'GDCLUSTER_VERSION' ) ) {
415
+        if (isset($params['marker_cluster']) && gdsc_to_bool_val($params['marker_cluster']) && defined('GDCLUSTER_VERSION')) {
416 416
             $map_args['enable_marker_cluster'] = true;
417 417
         } else {
418 418
             $map_args['enable_marker_cluster'] = false;
419 419
         }
420 420
 
421
-        geodir_draw_map( $map_args );
421
+        geodir_draw_map($map_args);
422 422
 
423 423
         $output = ob_get_contents();
424 424
 
425 425
         ob_end_clean();
426 426
 
427
-        foreach ( $backup_globals as $global => $value ) {
427
+        foreach ($backup_globals as $global => $value) {
428 428
             ${$global} = $value;
429 429
         }
430 430
 
431 431
         return $output;
432
-    }else{
432
+    } else {
433 433
         ob_start();
434 434
         add_action('wp_head', 'init_listing_map_script'); // Initialize the map object and marker array
435 435
         add_action('the_post', 'create_list_jsondata'); // Add marker in json array
@@ -476,16 +476,16 @@  discard block
 block discarded – undo
476 476
             $map_default_lat = isset($default_location->city_latitude) ? $default_location->city_latitude : '';
477 477
             $map_default_lng = isset($default_location->city_longitude) ? $default_location->city_longitude : '';
478 478
             $map_args['map_class_name'] = 'geodir-map-listing-page';
479
-			if ( geodir_is_page( 'search' ) ) {
479
+			if (geodir_is_page('search')) {
480 480
 				$map_default_lat = '';
481 481
 				$map_default_lng = '';
482
-				if ( isset( $_REQUEST['sgeo_lat'] ) && isset( $_REQUEST['sgeo_lon'] ) ) {
483
-					$map_default_lat = (float)sanitize_text_field( $_REQUEST['sgeo_lat'] );
484
-					$map_default_lng = (float)sanitize_text_field( $_REQUEST['sgeo_lon'] );
482
+				if (isset($_REQUEST['sgeo_lat']) && isset($_REQUEST['sgeo_lon'])) {
483
+					$map_default_lat = (float) sanitize_text_field($_REQUEST['sgeo_lat']);
484
+					$map_default_lng = (float) sanitize_text_field($_REQUEST['sgeo_lon']);
485 485
 				}
486
-				if ( empty( $map_default_lat ) && empty( $map_default_lng ) && ! empty( $_REQUEST['set_location_type'] ) && ! empty( $_REQUEST['set_location_val'] ) && function_exists( 'geodir_get_location_by_id' ) ) {
487
-					$location = geodir_get_location_by_id( '', (int)$_REQUEST['set_location_val'] );
488
-					if ( ! empty( $location ) ) {
486
+				if (empty($map_default_lat) && empty($map_default_lng) && !empty($_REQUEST['set_location_type']) && !empty($_REQUEST['set_location_val']) && function_exists('geodir_get_location_by_id')) {
487
+					$location = geodir_get_location_by_id('', (int) $_REQUEST['set_location_val']);
488
+					if (!empty($location)) {
489 489
 						$map_default_lat = $location->city_latitude;
490 490
 						$map_default_lng = $location->city_longitude;
491 491
 					}
@@ -1065,20 +1065,20 @@  discard block
 block discarded – undo
1065 1065
 	
1066 1066
 	$show_adv_search = isset($params['show_adv_search']) && in_array($params['show_adv_search'], array('default', 'always', 'searched')) ? $params['show_adv_search'] : '';
1067 1067
 	
1068
-	if ($show_adv_search != '' ) {
1069
-		$show_adv_class = 'geodir-advance-search-' . $show_adv_search . ' ';
1068
+	if ($show_adv_search != '') {
1069
+		$show_adv_class = 'geodir-advance-search-'.$show_adv_search.' ';
1070 1070
 		if ($show_adv_search == 'searched' && geodir_is_page('search')) {
1071 1071
 			$show_adv_search = 'search';
1072 1072
 		}
1073
-		$show_adv_attrs = 'data-show-adv="' . $show_adv_search . '"';
1073
+		$show_adv_attrs = 'data-show-adv="'.$show_adv_search.'"';
1074 1074
 		
1075
-		$params['before_widget'] = str_replace('class="', $show_adv_attrs . ' class="' . $show_adv_class, $params['before_widget']);
1075
+		$params['before_widget'] = str_replace('class="', $show_adv_attrs.' class="'.$show_adv_class, $params['before_widget']);
1076 1076
 	}
1077 1077
 	
1078 1078
 	ob_start();
1079 1079
 	
1080 1080
 	//geodir_get_template_part('listing', 'filter-form');
1081
-	the_widget('geodir_advance_search_widget', $params, $params );
1081
+	the_widget('geodir_advance_search_widget', $params, $params);
1082 1082
 	
1083 1083
 	$output = ob_get_contents();
1084 1084
     ob_end_clean();
@@ -1273,13 +1273,13 @@  discard block
 block discarded – undo
1273 1273
     // Post_number needs to be a positive integer
1274 1274
     if (!empty($params['post_author'])) {
1275 1275
         // 'current' left for backwards compatibility
1276
-        if ( $params['post_author'] == 'current' || $params['post_author'] == 'current_author') {
1276
+        if ($params['post_author'] == 'current' || $params['post_author'] == 'current_author') {
1277 1277
             if (!empty($post) && $post->post_type != 'page' && isset($post->post_author)) {
1278 1278
                 $params['post_author'] = $post->post_author;
1279 1279
             } else {
1280 1280
                 $params['post_author'] = -1; // Don't show any listings.
1281 1281
             }
1282
-        } else if ($params['post_author'] == 'current_user' ) {
1282
+        } else if ($params['post_author'] == 'current_user') {
1283 1283
             if ($current_user_id = get_current_user_id()) {
1284 1284
                 $params['post_author'] = $current_user_id;
1285 1285
             } else {
@@ -1296,7 +1296,7 @@  discard block
 block discarded – undo
1296 1296
 
1297 1297
     // Validate character_count
1298 1298
     //todo: is this necessary?
1299
-    $params['character_count']  = $params['character_count'];
1299
+    $params['character_count'] = $params['character_count'];
1300 1300
 
1301 1301
     // Validate our layout choice
1302 1302
     // Outside of the norm, I added some more simple terms to match the existing
@@ -1308,7 +1308,7 @@  discard block
 block discarded – undo
1308 1308
 
1309 1309
     // Validate Listing width, used in the template widget-listing-listview.php
1310 1310
     // The context is in width=$listing_width% - So we need a positive number between 0 & 100
1311
-    $params['listing_width']    = gdsc_validate_listing_width($params['listing_width']);
1311
+    $params['listing_width'] = gdsc_validate_listing_width($params['listing_width']);
1312 1312
 
1313 1313
     // Validate the checkboxes used on the widget
1314 1314
     $params['add_location_filter']  = gdsc_to_bool_val($params['add_location_filter']);
@@ -1323,7 +1323,7 @@  discard block
 block discarded – undo
1323 1323
     // User favorites
1324 1324
     $params['show_favorites_only']  = gdsc_to_bool_val($params['show_favorites_only']);
1325 1325
     if (!empty($params['show_favorites_only'])) {
1326
-        if ( $params['favorites_by_user'] == 'current' || $params['favorites_by_user'] == 'current_author') {
1326
+        if ($params['favorites_by_user'] == 'current' || $params['favorites_by_user'] == 'current_author') {
1327 1327
             if (!empty($post) && $post->post_type != 'page' && isset($post->post_author)) {
1328 1328
                 $params['favorites_by_user'] = $post->post_author;
1329 1329
             } else {
@@ -1346,7 +1346,7 @@  discard block
 block discarded – undo
1346 1346
     if (!empty($params['tags'])) {
1347 1347
         if (!is_array($params['tags'])) {
1348 1348
             $comma = _x(',', 'tag delimiter');
1349
-            if ( ',' !== $comma ) {
1349
+            if (',' !== $comma) {
1350 1350
                 $params['tags'] = str_replace($comma, ',', $params['tags']);
1351 1351
             }
1352 1352
             $params['tags'] = explode(',', trim($params['tags'], " \n\t\r\0\x0B,"));
@@ -1368,13 +1368,13 @@  discard block
 block discarded – undo
1368 1368
         unset($atts['pageno']);
1369 1369
     }
1370 1370
 
1371
-    if ( !empty($atts['shortcode_content']) ) {
1371
+    if (!empty($atts['shortcode_content'])) {
1372 1372
         $content = $atts['shortcode_content'];
1373 1373
     }
1374 1374
     $params['shortcode_content'] = trim($content);
1375 1375
     $atts['shortcode_content'] = trim($content);
1376 1376
     
1377
-    $params['shortcode_atts']       = $atts;
1377
+    $params['shortcode_atts'] = $atts;
1378 1378
 
1379 1379
     $output = geodir_sc_gd_listings_output($params);
1380 1380
 
@@ -1446,8 +1446,8 @@  discard block
 block discarded – undo
1446 1446
     // Validate the checkboxes used on the widget
1447 1447
     $params['hide_empty'] 	= gdsc_to_bool_val($params['hide_empty']);
1448 1448
     $params['show_count'] 	= gdsc_to_bool_val($params['show_count']);
1449
-    $params['hide_icon'] 	= gdsc_to_bool_val($params['hide_icon']);
1450
-    $params['cpt_left'] 	= gdsc_to_bool_val($params['cpt_left']);
1449
+    $params['hide_icon'] = gdsc_to_bool_val($params['hide_icon']);
1450
+    $params['cpt_left'] = gdsc_to_bool_val($params['cpt_left']);
1451 1451
 
1452 1452
     if ($params['max_count'] != 'all') {
1453 1453
         $params['max_count'] = absint($params['max_count']);
Please login to merge, or discard this patch.
geodirectory-admin/option-pages/general_settings_array.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -98,7 +98,7 @@
 block discarded – undo
98 98
     ),
99 99
     array('type' => 'sectionend', 'id' => 'general_options'),
100 100
 
101
-));/* General Options End*/
101
+)); /* General Options End*/
102 102
 
103 103
 /**
104 104
  * Filter GD Google Analytic Settings array.
Please login to merge, or discard this patch.
Indentation   +273 added lines, -273 removed lines patch added patch discarded remove patch
@@ -16,92 +16,92 @@  discard block
 block discarded – undo
16 16
  */
17 17
 $general_options = apply_filters('geodir_general_options', array(
18 18
 
19
-    array('name' => __('General', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'general_options'),
20
-
21
-    array('name' => __('General Options', 'geodirectory'), 'type' => 'sectionstart', 'id' => 'general_options'),
22
-
23
-    array(
24
-        'name' => __('Sender name', 'geodirectory'),
25
-        'desc' => __('(Name that will be shown as email sender when users receive emails from this site)', 'geodirectory'),
26
-        'id' => 'site_email_name',
27
-        'type' => 'text',
28
-        'css' => 'min-width:300px;',
29
-        'std' => get_bloginfo('name') // Default value for the page title - changed in settings
30
-    ),
31
-
32
-    array(
33
-        'name' => __('Email address', 'geodirectory'),
34
-        'desc' => __('(Emails to users will be sent via this mail ID)', 'geodirectory'),
35
-        'id' => 'site_email',
36
-        'type' => 'text',
37
-        'css' => 'min-width:300px;',
38
-        'std' => get_bloginfo('admin_email') // Default value for the page title - changed in settings
39
-    ),
40
-    array(
41
-        'name' => __('Allow user to see wp-admin area', 'geodirectory'),
42
-        'desc' => __('Yes', 'geodirectory'),
43
-        'id' => 'geodir_allow_wpadmin',
44
-        'std' => '1',
45
-        'type' => 'radio',
46
-        'value' => '1',
47
-        'radiogroup' => 'start'
48
-    ),
49
-    array(
50
-        'name' => __('Allow user to see wp-admin area', 'geodirectory'),
51
-        'desc' => __('No', 'geodirectory'),
52
-        'id' => 'geodir_allow_wpadmin',
53
-        'std' => '0',
54
-        'type' => 'radio',
55
-        'value' => '0',
56
-        'radiogroup' => 'end'
57
-    ),
58
-
59
-    array(
60
-        'name' => __('Allow user to choose own password', 'geodirectory'),
61
-        'desc' => __('Yes', 'geodirectory'),
62
-        'id' => 'geodir_allow_cpass',
63
-        'std' => '1',
64
-        'type' => 'radio',
65
-        'value' => '1',
66
-        'radiogroup' => 'start'
67
-    ),
68
-    array(
69
-        'name' => __('Allow user to choose own password', 'geodirectory'),
70
-        'desc' => __('No', 'geodirectory'),
71
-        'id' => 'geodir_allow_cpass',
72
-        'std' => '0',
73
-        'type' => 'radio',
74
-        'value' => '0',
75
-        'radiogroup' => 'end'
76
-    ),
77
-    array(
78
-        'name' => __('Disable review stars for CPT', 'geodirectory'),
79
-        'desc' => __('Disable review stars for certain CPT without disabling comments on listings.', 'geodirectory'),
80
-        'tip' => '',
81
-        'id' => 'geodir_disable_rating_cpt',
82
-        'css' => 'min-width:300px;',
83
-        'std' => '',
84
-        'type' => 'multiselect',
85
-        'placeholder_text' => __('Select post types', 'geodirectory'),
86
-        'class' => 'chosen_select',
87
-        'options' => array_unique(geodir_post_type_setting_fun())
88
-    ),
89
-    array(
90
-        'name' => __('User deleted posts go to trash', 'geodirectory'),
91
-        'desc' => __('If checked a user deleted post will go to trash, otherwise it will be permanently deleted', 'geodirectory'),
92
-        'id' => 'geodir_disable_perm_delete',
93
-        'type' => 'checkbox',
94
-        'std' => '1'
95
-    ),
96
-    array(
97
-        'name' => __('Max upload file size(in mb)', 'geodirectory'),
98
-        'desc' => __('(Maximum upload file size in MB, 1 MB = 1024 KB. Must be greater then 0(ZERO), for ex: 2. This setting will overwrite the max upload file size limit in image/file upload & import listings for entire GeoDirectory core + GeoDirectory plugins.)', 'geodirectory'),
99
-        'id' => 'geodir_upload_max_filesize',
100
-        'type' => 'text',
101
-        'css' => 'min-width:300px;',
102
-        'std' => '2'
103
-    ),
104
-    array('type' => 'sectionend', 'id' => 'general_options'),
19
+	array('name' => __('General', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'general_options'),
20
+
21
+	array('name' => __('General Options', 'geodirectory'), 'type' => 'sectionstart', 'id' => 'general_options'),
22
+
23
+	array(
24
+		'name' => __('Sender name', 'geodirectory'),
25
+		'desc' => __('(Name that will be shown as email sender when users receive emails from this site)', 'geodirectory'),
26
+		'id' => 'site_email_name',
27
+		'type' => 'text',
28
+		'css' => 'min-width:300px;',
29
+		'std' => get_bloginfo('name') // Default value for the page title - changed in settings
30
+	),
31
+
32
+	array(
33
+		'name' => __('Email address', 'geodirectory'),
34
+		'desc' => __('(Emails to users will be sent via this mail ID)', 'geodirectory'),
35
+		'id' => 'site_email',
36
+		'type' => 'text',
37
+		'css' => 'min-width:300px;',
38
+		'std' => get_bloginfo('admin_email') // Default value for the page title - changed in settings
39
+	),
40
+	array(
41
+		'name' => __('Allow user to see wp-admin area', 'geodirectory'),
42
+		'desc' => __('Yes', 'geodirectory'),
43
+		'id' => 'geodir_allow_wpadmin',
44
+		'std' => '1',
45
+		'type' => 'radio',
46
+		'value' => '1',
47
+		'radiogroup' => 'start'
48
+	),
49
+	array(
50
+		'name' => __('Allow user to see wp-admin area', 'geodirectory'),
51
+		'desc' => __('No', 'geodirectory'),
52
+		'id' => 'geodir_allow_wpadmin',
53
+		'std' => '0',
54
+		'type' => 'radio',
55
+		'value' => '0',
56
+		'radiogroup' => 'end'
57
+	),
58
+
59
+	array(
60
+		'name' => __('Allow user to choose own password', 'geodirectory'),
61
+		'desc' => __('Yes', 'geodirectory'),
62
+		'id' => 'geodir_allow_cpass',
63
+		'std' => '1',
64
+		'type' => 'radio',
65
+		'value' => '1',
66
+		'radiogroup' => 'start'
67
+	),
68
+	array(
69
+		'name' => __('Allow user to choose own password', 'geodirectory'),
70
+		'desc' => __('No', 'geodirectory'),
71
+		'id' => 'geodir_allow_cpass',
72
+		'std' => '0',
73
+		'type' => 'radio',
74
+		'value' => '0',
75
+		'radiogroup' => 'end'
76
+	),
77
+	array(
78
+		'name' => __('Disable review stars for CPT', 'geodirectory'),
79
+		'desc' => __('Disable review stars for certain CPT without disabling comments on listings.', 'geodirectory'),
80
+		'tip' => '',
81
+		'id' => 'geodir_disable_rating_cpt',
82
+		'css' => 'min-width:300px;',
83
+		'std' => '',
84
+		'type' => 'multiselect',
85
+		'placeholder_text' => __('Select post types', 'geodirectory'),
86
+		'class' => 'chosen_select',
87
+		'options' => array_unique(geodir_post_type_setting_fun())
88
+	),
89
+	array(
90
+		'name' => __('User deleted posts go to trash', 'geodirectory'),
91
+		'desc' => __('If checked a user deleted post will go to trash, otherwise it will be permanently deleted', 'geodirectory'),
92
+		'id' => 'geodir_disable_perm_delete',
93
+		'type' => 'checkbox',
94
+		'std' => '1'
95
+	),
96
+	array(
97
+		'name' => __('Max upload file size(in mb)', 'geodirectory'),
98
+		'desc' => __('(Maximum upload file size in MB, 1 MB = 1024 KB. Must be greater then 0(ZERO), for ex: 2. This setting will overwrite the max upload file size limit in image/file upload & import listings for entire GeoDirectory core + GeoDirectory plugins.)', 'geodirectory'),
99
+		'id' => 'geodir_upload_max_filesize',
100
+		'type' => 'text',
101
+		'css' => 'min-width:300px;',
102
+		'std' => '2'
103
+	),
104
+	array('type' => 'sectionend', 'id' => 'general_options'),
105 105
 
106 106
 ));/* General Options End*/
107 107
 
@@ -113,104 +113,104 @@  discard block
 block discarded – undo
113 113
  */
114 114
 $google_analytic_settings = apply_filters('geodir_google_analytic_settings', array(
115 115
 
116
-    array('name' => __('Google Analytics', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'google_analytic_settings'),
117
-
118
-    array('name' => __('Google Analytic Settings', 'geodirectory'), 'type' => 'sectionstart', 'id' => 'google_analytic_settings'),
119
-
120
-
121
-
122
-    array(
123
-        'name' => __('Show business owner google analytics stats?', 'geodirectory'),
124
-        'desc' => __('Yes', 'geodirectory'),
125
-        'id' => 'geodir_ga_stats',
126
-        'std' => '0',
127
-        'type' => 'radio',
128
-        'value' => '1',
129
-        'radiogroup' => 'start'
130
-    ),
131
-    array(
132
-        'name' => __('Show business owner Google Analytics stats?', 'geodirectory'),
133
-        'desc' => __('No', 'geodirectory'),
134
-        'id' => 'geodir_ga_stats',
135
-        'std' => '1',
136
-        'type' => 'radio',
137
-        'value' => '0',
138
-        'radiogroup' => 'end'
139
-    ),
140
-
141
-    array(
142
-        'name' => __('Google analytics access', 'geodirectory'),
143
-        'desc' => '',
144
-        'id' => 'geodir_ga_token',
145
-        'type' => 'google_analytics',
146
-        'css' => 'min-width:300px;',
147
-        'std' => '' // Default value for the page title - changed in settings
148
-    ),
149
-
150
-    array(
151
-        'name' => __('Google analytics Auth Code', 'geodirectory'),
152
-        'desc' => __('You must save this setting before accounts will show.', 'geodirectory'),
153
-        'id' => 'geodir_ga_auth_code',
154
-        'type' => 'text',
155
-        'css' => 'min-width:300px;',
156
-        'std' => '' // Default value for the page title - changed in settings
157
-    ),
158
-
159
-    array(
160
-        'name' => __('Analytics Account', 'geodirectory'),
161
-        'desc' => __('Select the account that you setup for this site.', 'geodirectory'),
162
-        'id' => 'geodir_ga_account_id',
163
-        'css' => 'min-width:300px;',
164
-        'std' => 'gridview_onehalf',
165
-        'type' => 'select',
166
-        'class' => 'chosen_select',
167
-        'options' => geodir_gd_accounts()
168
-    ),
169
-
170
-
171
-    array(
172
-        'name' => __('Add Google analytics tracking code to site?', 'geodirectory'),
173
-        'desc' => __('Yes <small>(this will automatically add the correct tracking code to your site)</small>', 'geodirectory'),
174
-        'id' => 'geodir_ga_add_tracking_code',
175
-        'std' => '0',
176
-        'type' => 'radio',
177
-        'value' => '1',
178
-        'radiogroup' => 'start'
179
-    ),
180
-    array(
181
-        'name' => __('Add Google analytics tracking code to site?', 'geodirectory'),
182
-        'desc' => __('No <small>(if you already have tracking code added you should not add it again)</small>', 'geodirectory'),
183
-        'id' => 'geodir_ga_add_tracking_code',
184
-        'std' => '1',
185
-        'type' => 'radio',
186
-        'value' => '0',
187
-        'radiogroup' => 'end'
188
-    ),
189
-
190
-    array(
191
-        'name' => __('Anonymize user IP?', 'geodirectory'),
192
-        'desc' => __('In most cases this is not required, this is to comply with certain country laws such as Germany.', 'geodirectory'),
193
-        'id' => 'geodir_ga_anonymize_ip',
194
-        'type' => 'checkbox',
195
-        'std' => '0'
196
-    ),
197
-
198
-    array(
199
-        'name' => __('Auto refresh active users?', 'geodirectory'),
200
-        'desc' => __('If ticked it uses the auto refresh time below, if not it never refreshes unless the refresh button is clicked.', 'geodirectory'),
201
-        'id' => 'geodir_ga_auto_refresh',
202
-        'type' => 'checkbox',
203
-        'std' => '0'
204
-    ),
205
-    array(
206
-        'name' => __('Time interval for auto refresh active users', 'geodirectory'),
207
-        'desc' => __('Time interval in seconds to auto refresh active users. The active users will be auto refreshed after this time interval. Leave blank or use 0(zero) to disable auto refresh. Default: 5', 'geodirectory'),
208
-        'id' => 'geodir_ga_refresh_time',
209
-        'type' => 'text',
210
-        'std' => '5'
211
-    ),
212
-
213
-    array('type' => 'sectionend', 'id' => 'google_analytic_settings'),
116
+	array('name' => __('Google Analytics', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'google_analytic_settings'),
117
+
118
+	array('name' => __('Google Analytic Settings', 'geodirectory'), 'type' => 'sectionstart', 'id' => 'google_analytic_settings'),
119
+
120
+
121
+
122
+	array(
123
+		'name' => __('Show business owner google analytics stats?', 'geodirectory'),
124
+		'desc' => __('Yes', 'geodirectory'),
125
+		'id' => 'geodir_ga_stats',
126
+		'std' => '0',
127
+		'type' => 'radio',
128
+		'value' => '1',
129
+		'radiogroup' => 'start'
130
+	),
131
+	array(
132
+		'name' => __('Show business owner Google Analytics stats?', 'geodirectory'),
133
+		'desc' => __('No', 'geodirectory'),
134
+		'id' => 'geodir_ga_stats',
135
+		'std' => '1',
136
+		'type' => 'radio',
137
+		'value' => '0',
138
+		'radiogroup' => 'end'
139
+	),
140
+
141
+	array(
142
+		'name' => __('Google analytics access', 'geodirectory'),
143
+		'desc' => '',
144
+		'id' => 'geodir_ga_token',
145
+		'type' => 'google_analytics',
146
+		'css' => 'min-width:300px;',
147
+		'std' => '' // Default value for the page title - changed in settings
148
+	),
149
+
150
+	array(
151
+		'name' => __('Google analytics Auth Code', 'geodirectory'),
152
+		'desc' => __('You must save this setting before accounts will show.', 'geodirectory'),
153
+		'id' => 'geodir_ga_auth_code',
154
+		'type' => 'text',
155
+		'css' => 'min-width:300px;',
156
+		'std' => '' // Default value for the page title - changed in settings
157
+	),
158
+
159
+	array(
160
+		'name' => __('Analytics Account', 'geodirectory'),
161
+		'desc' => __('Select the account that you setup for this site.', 'geodirectory'),
162
+		'id' => 'geodir_ga_account_id',
163
+		'css' => 'min-width:300px;',
164
+		'std' => 'gridview_onehalf',
165
+		'type' => 'select',
166
+		'class' => 'chosen_select',
167
+		'options' => geodir_gd_accounts()
168
+	),
169
+
170
+
171
+	array(
172
+		'name' => __('Add Google analytics tracking code to site?', 'geodirectory'),
173
+		'desc' => __('Yes <small>(this will automatically add the correct tracking code to your site)</small>', 'geodirectory'),
174
+		'id' => 'geodir_ga_add_tracking_code',
175
+		'std' => '0',
176
+		'type' => 'radio',
177
+		'value' => '1',
178
+		'radiogroup' => 'start'
179
+	),
180
+	array(
181
+		'name' => __('Add Google analytics tracking code to site?', 'geodirectory'),
182
+		'desc' => __('No <small>(if you already have tracking code added you should not add it again)</small>', 'geodirectory'),
183
+		'id' => 'geodir_ga_add_tracking_code',
184
+		'std' => '1',
185
+		'type' => 'radio',
186
+		'value' => '0',
187
+		'radiogroup' => 'end'
188
+	),
189
+
190
+	array(
191
+		'name' => __('Anonymize user IP?', 'geodirectory'),
192
+		'desc' => __('In most cases this is not required, this is to comply with certain country laws such as Germany.', 'geodirectory'),
193
+		'id' => 'geodir_ga_anonymize_ip',
194
+		'type' => 'checkbox',
195
+		'std' => '0'
196
+	),
197
+
198
+	array(
199
+		'name' => __('Auto refresh active users?', 'geodirectory'),
200
+		'desc' => __('If ticked it uses the auto refresh time below, if not it never refreshes unless the refresh button is clicked.', 'geodirectory'),
201
+		'id' => 'geodir_ga_auto_refresh',
202
+		'type' => 'checkbox',
203
+		'std' => '0'
204
+	),
205
+	array(
206
+		'name' => __('Time interval for auto refresh active users', 'geodirectory'),
207
+		'desc' => __('Time interval in seconds to auto refresh active users. The active users will be auto refreshed after this time interval. Leave blank or use 0(zero) to disable auto refresh. Default: 5', 'geodirectory'),
208
+		'id' => 'geodir_ga_refresh_time',
209
+		'type' => 'text',
210
+		'std' => '5'
211
+	),
212
+
213
+	array('type' => 'sectionend', 'id' => 'google_analytic_settings'),
214 214
 
215 215
 )); // google_analytic_settings End
216 216
 
@@ -222,84 +222,84 @@  discard block
 block discarded – undo
222 222
  */
223 223
 $search_settings = apply_filters('geodir_search_settings', array(
224 224
 
225
-    array('name' => __('Search', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'search_settings'),
226
-
227
-    array('name' => __('Search Settings', 'geodirectory'), 'type' => 'sectionstart', 'id' => 'search_settings'),
228
-
229
-    array(
230
-        'name' => __('Limit squared distance area to X miles (helps improve search speed)', 'geodirectory'),
231
-        'desc' => __('Enter whole number only ex. 40 (Tokyo is largest city in the world @40 sq miles) LEAVE BLANK FOR NO DISTANCE LIMIT', 'geodirectory'),
232
-        'id' => 'geodir_search_dist',
233
-        'type' => 'text',
234
-        'css' => 'min-width:300px;',
235
-        'std' => '40' // Default value for the page title - changed in settings
236
-    ),
237
-
238
-    array(
239
-        'name' => __('Show search distances in miles or km', 'geodirectory'),
240
-        'desc' => __('Miles', 'geodirectory'),
241
-        'id' => 'geodir_search_dist_1',
242
-        'std' => 'miles',
243
-        'type' => 'radio',
244
-        'value' => 'miles',
245
-        'radiogroup' => 'start'
246
-    ),
247
-    array(
248
-        'name' => __('Show search distances in miles or km', 'geodirectory'),
249
-        'desc' => __('Kilometers', 'geodirectory'),
250
-        'id' => 'geodir_search_dist_1',
251
-        'std' => 'miles',
252
-        'type' => 'radio',
253
-        'value' => 'km',
254
-        'radiogroup' => 'end'
255
-    ),
256
-
257
-    array(
258
-        'name' => __('If distance is less than 0.01 show distance in meters or feet', 'geodirectory'),
259
-        'desc' => __('Meters', 'geodirectory'),
260
-        'id' => 'geodir_search_dist_2',
261
-        'std' => 'meters',
262
-        'type' => 'radio',
263
-        'value' => 'meters',
264
-        'radiogroup' => 'start'
265
-    ),
266
-
267
-    array(
268
-        'name' => __('If distance is less than 0.01 show distance in meters or feet', 'geodirectory'),
269
-        'desc' => __('Feet', 'geodirectory'),
270
-        'id' => 'geodir_search_dist_2',
271
-        'std' => 'meters',
272
-        'type' => 'radio',
273
-        'value' => 'feet',
274
-        'radiogroup' => 'end'
275
-    ),
276
-
277
-    array(
278
-        'name' => __('Add location specific text to (Near) search for Google', 'geodirectory'),
279
-        'desc' => __('This is usefull if your directory is limted to one location such as: New York or Australia (this setting should be blank if using default country, regions etc with multilocation addon as it will automatically add them)', 'geodirectory'),
280
-        'id' => 'geodir_search_near_addition',
281
-        'type' => 'text',
282
-        'css' => 'min-width:300px;',
283
-        'std' => ''
284
-    ),
285
-    array(
286
-        'name' => __('Individual word search limit', 'geodirectory'),
287
-        'desc' => __('With this option you can limit individual words being searched for, for example searching for `Jo Brown` would return results with words like `Jones`, you can exclude these types of small character words if you wish.', 'geodirectory'),
288
-        'id' => 'geodir_search_word_limit',
289
-        'css' => 'min-width:300px;',
290
-        'std' => 'gridview_onehalf',
291
-        'type' => 'select',
292
-        'class' => 'chosen_select',
293
-        'options' => array_unique(array(
294
-            '0' => __('Disabled', 'geodirectory'),
295
-            '1' => __('1 Character words excluded', 'geodirectory'),
296
-            '2' => __('2 Character words and less excluded', 'geodirectory'),
297
-            '3' => __('3 Character words and less excluded', 'geodirectory'),
298
-        ))
299
-    ),
300
-
301
-
302
-    array('type' => 'sectionend', 'id' => 'search_settings'),
225
+	array('name' => __('Search', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'search_settings'),
226
+
227
+	array('name' => __('Search Settings', 'geodirectory'), 'type' => 'sectionstart', 'id' => 'search_settings'),
228
+
229
+	array(
230
+		'name' => __('Limit squared distance area to X miles (helps improve search speed)', 'geodirectory'),
231
+		'desc' => __('Enter whole number only ex. 40 (Tokyo is largest city in the world @40 sq miles) LEAVE BLANK FOR NO DISTANCE LIMIT', 'geodirectory'),
232
+		'id' => 'geodir_search_dist',
233
+		'type' => 'text',
234
+		'css' => 'min-width:300px;',
235
+		'std' => '40' // Default value for the page title - changed in settings
236
+	),
237
+
238
+	array(
239
+		'name' => __('Show search distances in miles or km', 'geodirectory'),
240
+		'desc' => __('Miles', 'geodirectory'),
241
+		'id' => 'geodir_search_dist_1',
242
+		'std' => 'miles',
243
+		'type' => 'radio',
244
+		'value' => 'miles',
245
+		'radiogroup' => 'start'
246
+	),
247
+	array(
248
+		'name' => __('Show search distances in miles or km', 'geodirectory'),
249
+		'desc' => __('Kilometers', 'geodirectory'),
250
+		'id' => 'geodir_search_dist_1',
251
+		'std' => 'miles',
252
+		'type' => 'radio',
253
+		'value' => 'km',
254
+		'radiogroup' => 'end'
255
+	),
256
+
257
+	array(
258
+		'name' => __('If distance is less than 0.01 show distance in meters or feet', 'geodirectory'),
259
+		'desc' => __('Meters', 'geodirectory'),
260
+		'id' => 'geodir_search_dist_2',
261
+		'std' => 'meters',
262
+		'type' => 'radio',
263
+		'value' => 'meters',
264
+		'radiogroup' => 'start'
265
+	),
266
+
267
+	array(
268
+		'name' => __('If distance is less than 0.01 show distance in meters or feet', 'geodirectory'),
269
+		'desc' => __('Feet', 'geodirectory'),
270
+		'id' => 'geodir_search_dist_2',
271
+		'std' => 'meters',
272
+		'type' => 'radio',
273
+		'value' => 'feet',
274
+		'radiogroup' => 'end'
275
+	),
276
+
277
+	array(
278
+		'name' => __('Add location specific text to (Near) search for Google', 'geodirectory'),
279
+		'desc' => __('This is usefull if your directory is limted to one location such as: New York or Australia (this setting should be blank if using default country, regions etc with multilocation addon as it will automatically add them)', 'geodirectory'),
280
+		'id' => 'geodir_search_near_addition',
281
+		'type' => 'text',
282
+		'css' => 'min-width:300px;',
283
+		'std' => ''
284
+	),
285
+	array(
286
+		'name' => __('Individual word search limit', 'geodirectory'),
287
+		'desc' => __('With this option you can limit individual words being searched for, for example searching for `Jo Brown` would return results with words like `Jones`, you can exclude these types of small character words if you wish.', 'geodirectory'),
288
+		'id' => 'geodir_search_word_limit',
289
+		'css' => 'min-width:300px;',
290
+		'std' => 'gridview_onehalf',
291
+		'type' => 'select',
292
+		'class' => 'chosen_select',
293
+		'options' => array_unique(array(
294
+			'0' => __('Disabled', 'geodirectory'),
295
+			'1' => __('1 Character words excluded', 'geodirectory'),
296
+			'2' => __('2 Character words and less excluded', 'geodirectory'),
297
+			'3' => __('3 Character words and less excluded', 'geodirectory'),
298
+		))
299
+	),
300
+
301
+
302
+	array('type' => 'sectionend', 'id' => 'search_settings'),
303 303
 
304 304
 )); //search_settings End
305 305
 
@@ -311,17 +311,17 @@  discard block
 block discarded – undo
311 311
  */
312 312
 $dummy_data_settings = apply_filters('geodir_dummy_data_settings', array(
313 313
 
314
-    array('name' => __('Dummy Data', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'dummy_data_settings'),
315
-
316
-    array(
317
-        'name' => '',
318
-        'desc' => '',
319
-        'id' => 'geodir_dummy_data_installer',
320
-        'type' => 'dummy_installer',
321
-        'css' => 'min-width:300px;',
322
-        'std' => '40' // Default value for the page title - changed in settings
323
-    ),
324
-    array('type' => 'sectionend', 'id' => 'geodir_dummy_data_settings'),
314
+	array('name' => __('Dummy Data', 'geodirectory'), 'type' => 'title', 'desc' => '', 'id' => 'dummy_data_settings'),
315
+
316
+	array(
317
+		'name' => '',
318
+		'desc' => '',
319
+		'id' => 'geodir_dummy_data_installer',
320
+		'type' => 'dummy_installer',
321
+		'css' => 'min-width:300px;',
322
+		'std' => '40' // Default value for the page title - changed in settings
323
+	),
324
+	array('type' => 'sectionend', 'id' => 'geodir_dummy_data_settings'),
325 325
 
326 326
 )); //dummy_data_settings End
327 327
 
Please login to merge, or discard this patch.