Test Setup Failed
Push — master ( 2261e5...599f56 )
by Stiofan
02:03
created
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-admin/class.analytics.stats.php 3 patches
Indentation   +104 added lines, -104 removed lines patch added patch discarded remove patch
@@ -30,135 +30,135 @@  discard block
 block discarded – undo
30 30
 			// Include the Google Service API
31 31
 			include_once('google-api-php-client/src/Google/autoload.php');
32 32
 
33
-            $this->client = new Google_Client();
34
-            $this->client->setApprovalPrompt("force");
35
-            $this->client->setAccessType('offline');
36
-            $this->client->setClientId(GEODIR_GA_CLIENTID);
37
-            $this->client->setClientSecret(GEODIR_GA_CLIENTSECRET);
38
-            $this->client->setRedirectUri(GEODIR_GA_REDIRECT);
33
+			$this->client = new Google_Client();
34
+			$this->client->setApprovalPrompt("force");
35
+			$this->client->setAccessType('offline');
36
+			$this->client->setClientId(GEODIR_GA_CLIENTID);
37
+			$this->client->setClientSecret(GEODIR_GA_CLIENTSECRET);
38
+			$this->client->setRedirectUri(GEODIR_GA_REDIRECT);
39 39
 			
40
-            $this->client->setScopes(array("https://www.googleapis.com/auth/analytics"));
41
-
42
-            try {
43
-                    $this->analytics = new Google_Service_Analytics($this->client);
44
-                }
45
-            catch (Google_ServiceException $e)
46
-                {
47
-                    print '(cas:48) There was an Analytics API service error ' . $e->getCode() . ':' . $e->getMessage();
40
+			$this->client->setScopes(array("https://www.googleapis.com/auth/analytics"));
41
+
42
+			try {
43
+					$this->analytics = new Google_Service_Analytics($this->client);
44
+				}
45
+			catch (Google_ServiceException $e)
46
+				{
47
+					print '(cas:48) There was an Analytics API service error ' . $e->getCode() . ':' . $e->getMessage();
48 48
 					return false;
49
-                }
49
+				}
50 50
 	}
51 51
 
52 52
 	function checkLogin()
53 53
 	{
54
-            $ga_google_authtoken = get_option('geodir_ga_auth_token');
54
+			$ga_google_authtoken = get_option('geodir_ga_auth_token');
55 55
 
56
-            if (!empty($ga_google_authtoken))
57
-            {
56
+			if (!empty($ga_google_authtoken))
57
+			{
58 58
 				try
59
-                {
60
-                    $this->client->setAccessToken($ga_google_authtoken);
59
+				{
60
+					$this->client->setAccessToken($ga_google_authtoken);
61 61
 				}
62 62
 				catch( Google_AuthException $e )
63
-                {
64
-                    print '(cas:72) GeoDirectory was unable to authenticate you with
63
+				{
64
+					print '(cas:72) GeoDirectory was unable to authenticate you with
65 65
                             Google using the Auth Token you pasted into the input box on the previous step. <br><br>
66 66
                             This could mean either you pasted the token wrong, or the time/date on your server is wrong,
67 67
                             or an SSL issue preventing Google from Authenticating. <br><br>
68 68
                             <br><br><strong>Tech Info </strong> ' . $e->getCode() . ':' . $e->getMessage();
69 69
 
70
-                    return false;
71
-                }
72
-            }
73
-            else
74
-            {
75
-                $authCode = get_option('geodir_ga_auth_code');
76
-
77
-                if (empty($authCode)) return false;
78
-
79
-                try
80
-                {
81
-                    $accessToken = $this->client->authenticate($authCode);
82
-                }
83
-                catch( Exception $e )
84
-                {
85
-                    print '(cas:72) GeoDirectory was unable to authenticate you with
70
+					return false;
71
+				}
72
+			}
73
+			else
74
+			{
75
+				$authCode = get_option('geodir_ga_auth_code');
76
+
77
+				if (empty($authCode)) return false;
78
+
79
+				try
80
+				{
81
+					$accessToken = $this->client->authenticate($authCode);
82
+				}
83
+				catch( Exception $e )
84
+				{
85
+					print '(cas:72) GeoDirectory was unable to authenticate you with
86 86
                             Google using the Auth Token you pasted into the input box on the previous step. <br><br>
87 87
                             This could mean either you pasted the token wrong, or the time/date on your server is wrong,
88 88
                             or an SSL issue preventing Google from Authenticating. <br><br>
89 89
                             <br><br><strong>Tech Info </strong> ' . $e->getCode() . ':' . $e->getMessage();
90 90
 
91
-                    return false;
92
-                }
93
-
94
-                if($accessToken)
95
-                {
96
-                    $this->client->setAccessToken($accessToken);
97
-                    update_option('geodir_ga_auth_token', $accessToken);
98
-                }
99
-                else
100
-                {
101
-                    return false;
102
-                }
103
-            }
104
-
105
-            $this->token =  $this->client->getAccessToken();
106
-            return true;
91
+					return false;
92
+				}
93
+
94
+				if($accessToken)
95
+				{
96
+					$this->client->setAccessToken($accessToken);
97
+					update_option('geodir_ga_auth_token', $accessToken);
98
+				}
99
+				else
100
+				{
101
+					return false;
102
+				}
103
+			}
104
+
105
+			$this->token =  $this->client->getAccessToken();
106
+			return true;
107 107
 	}
108 108
 
109 109
 	function deauthorize()
110 110
 	{
111
-            update_option('geodir_ga_auth_code', '');
112
-            update_option('geodir_ga_auth_token', '');
111
+			update_option('geodir_ga_auth_code', '');
112
+			update_option('geodir_ga_auth_token', '');
113 113
 	}
114 114
 
115 115
 	function getSingleProfile()
116 116
 	{
117
-            $webproperty_id = get_option('geodir_ga_account_id');
118
-            list($pre, $account_id, $post) = explode('-',$webproperty_id);
119
-
120
-            if (empty($webproperty_id)) return false;
121
-
122
-            try {
123
-                $profiles = $this->analytics->management_profiles->listManagementProfiles($account_id, $webproperty_id);
124
-            }
125
-            catch (Google_ServiceException $e)
126
-            {
127
-                print 'There was an Analytics API service error ' . $e->getCode() . ': ' . $e->getMessage();
128
-                return false;
129
-            }
130
-
131
-            $profile_id = $profiles->items[0]->id;
132
-            if (empty($profile_id)) return false;
133
-
134
-            $account_array = array();
135
-            array_push($account_array, array('id'=>$profile_id, 'ga:webPropertyId'=>$webproperty_id));
136
-            return $account_array;
117
+			$webproperty_id = get_option('geodir_ga_account_id');
118
+			list($pre, $account_id, $post) = explode('-',$webproperty_id);
119
+
120
+			if (empty($webproperty_id)) return false;
121
+
122
+			try {
123
+				$profiles = $this->analytics->management_profiles->listManagementProfiles($account_id, $webproperty_id);
124
+			}
125
+			catch (Google_ServiceException $e)
126
+			{
127
+				print 'There was an Analytics API service error ' . $e->getCode() . ': ' . $e->getMessage();
128
+				return false;
129
+			}
130
+
131
+			$profile_id = $profiles->items[0]->id;
132
+			if (empty($profile_id)) return false;
133
+
134
+			$account_array = array();
135
+			array_push($account_array, array('id'=>$profile_id, 'ga:webPropertyId'=>$webproperty_id));
136
+			return $account_array;
137 137
 	}
138 138
 
139
-        function getAllProfiles()
140
-        {
141
-            $profile_array = array();
139
+		function getAllProfiles()
140
+		{
141
+			$profile_array = array();
142 142
             
143
-            try {
144
-                    $profiles = $this->analytics->management_webproperties->listManagementWebproperties('~all');
145
-                }
146
-                catch (Google_ServiceException $e)
147
-                {
148
-                    print 'There was an Analytics API service error ' . $e->getCode() . ': ' . $e->getMessage();
149
-                }
150
-
151
-
152
-            if( !empty( $profiles->items ) )
153
-            {
154
-                foreach( $profiles->items as $profile )
155
-                {
156
-                    $profile_array[ $profile->id ] = str_replace('http://','',$profile->name );
157
-                }
158
-            }
159
-
160
-            return $profile_array;
161
-        }
143
+			try {
144
+					$profiles = $this->analytics->management_webproperties->listManagementWebproperties('~all');
145
+				}
146
+				catch (Google_ServiceException $e)
147
+				{
148
+					print 'There was an Analytics API service error ' . $e->getCode() . ': ' . $e->getMessage();
149
+				}
150
+
151
+
152
+			if( !empty( $profiles->items ) )
153
+			{
154
+				foreach( $profiles->items as $profile )
155
+				{
156
+					$profile_array[ $profile->id ] = str_replace('http://','',$profile->name );
157
+				}
158
+			}
159
+
160
+			return $profile_array;
161
+		}
162 162
 
163 163
 	function getAnalyticsAccounts()
164 164
 	{
@@ -241,13 +241,13 @@  discard block
 block discarded – undo
241 241
 			$params['max-results'] = $limit;
242 242
 		}
243 243
            
244
-           // Just incase, the ga: is still used in the account id, strip it out to prevent it breaking
245
-           $filtered_id = str_replace( 'ga:', '', $this->accountId );
244
+		   // Just incase, the ga: is still used in the account id, strip it out to prevent it breaking
245
+		   $filtered_id = str_replace( 'ga:', '', $this->accountId );
246 246
            
247
-           if(!$filtered_id){
248
-                echo 'Error - Account ID is blank';
249
-                return false;
250
-           }
247
+		   if(!$filtered_id){
248
+				echo 'Error - Account ID is blank';
249
+				return false;
250
+		   }
251 251
 
252 252
 		if($realtime){
253 253
 			return $analytics->data_realtime->get(
Please login to merge, or discard this patch.
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
                 }
45 45
             catch (Google_ServiceException $e)
46 46
                 {
47
-                    print '(cas:48) There was an Analytics API service error ' . $e->getCode() . ':' . $e->getMessage();
47
+                    print '(cas:48) There was an Analytics API service error '.$e->getCode().':'.$e->getMessage();
48 48
 					return false;
49 49
                 }
50 50
 	}
@@ -59,13 +59,13 @@  discard block
 block discarded – undo
59 59
                 {
60 60
                     $this->client->setAccessToken($ga_google_authtoken);
61 61
 				}
62
-				catch( Google_AuthException $e )
62
+				catch (Google_AuthException $e)
63 63
                 {
64 64
                     print '(cas:72) GeoDirectory was unable to authenticate you with
65 65
                             Google using the Auth Token you pasted into the input box on the previous step. <br><br>
66 66
                             This could mean either you pasted the token wrong, or the time/date on your server is wrong,
67 67
                             or an SSL issue preventing Google from Authenticating. <br><br>
68
-                            <br><br><strong>Tech Info </strong> ' . $e->getCode() . ':' . $e->getMessage();
68
+                            <br><br><strong>Tech Info </strong> ' . $e->getCode().':'.$e->getMessage();
69 69
 
70 70
                     return false;
71 71
                 }
@@ -80,18 +80,18 @@  discard block
 block discarded – undo
80 80
                 {
81 81
                     $accessToken = $this->client->authenticate($authCode);
82 82
                 }
83
-                catch( Exception $e )
83
+                catch (Exception $e)
84 84
                 {
85 85
                     print '(cas:72) GeoDirectory was unable to authenticate you with
86 86
                             Google using the Auth Token you pasted into the input box on the previous step. <br><br>
87 87
                             This could mean either you pasted the token wrong, or the time/date on your server is wrong,
88 88
                             or an SSL issue preventing Google from Authenticating. <br><br>
89
-                            <br><br><strong>Tech Info </strong> ' . $e->getCode() . ':' . $e->getMessage();
89
+                            <br><br><strong>Tech Info </strong> ' . $e->getCode().':'.$e->getMessage();
90 90
 
91 91
                     return false;
92 92
                 }
93 93
 
94
-                if($accessToken)
94
+                if ($accessToken)
95 95
                 {
96 96
                     $this->client->setAccessToken($accessToken);
97 97
                     update_option('geodir_ga_auth_token', $accessToken);
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
                 }
103 103
             }
104 104
 
105
-            $this->token =  $this->client->getAccessToken();
105
+            $this->token = $this->client->getAccessToken();
106 106
             return true;
107 107
 	}
108 108
 
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
 	function getSingleProfile()
116 116
 	{
117 117
             $webproperty_id = get_option('geodir_ga_account_id');
118
-            list($pre, $account_id, $post) = explode('-',$webproperty_id);
118
+            list($pre, $account_id, $post) = explode('-', $webproperty_id);
119 119
 
120 120
             if (empty($webproperty_id)) return false;
121 121
 
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
             }
125 125
             catch (Google_ServiceException $e)
126 126
             {
127
-                print 'There was an Analytics API service error ' . $e->getCode() . ': ' . $e->getMessage();
127
+                print 'There was an Analytics API service error '.$e->getCode().': '.$e->getMessage();
128 128
                 return false;
129 129
             }
130 130
 
@@ -145,15 +145,15 @@  discard block
 block discarded – undo
145 145
                 }
146 146
                 catch (Google_ServiceException $e)
147 147
                 {
148
-                    print 'There was an Analytics API service error ' . $e->getCode() . ': ' . $e->getMessage();
148
+                    print 'There was an Analytics API service error '.$e->getCode().': '.$e->getMessage();
149 149
                 }
150 150
 
151 151
 
152
-            if( !empty( $profiles->items ) )
152
+            if (!empty($profiles->items))
153 153
             {
154
-                foreach( $profiles->items as $profile )
154
+                foreach ($profiles->items as $profile)
155 155
                 {
156
-                    $profile_array[ $profile->id ] = str_replace('http://','',$profile->name );
156
+                    $profile_array[$profile->id] = str_replace('http://', '', $profile->name);
157 157
                 }
158 158
             }
159 159
 
@@ -242,20 +242,20 @@  discard block
 block discarded – undo
242 242
 		}
243 243
            
244 244
            // Just incase, the ga: is still used in the account id, strip it out to prevent it breaking
245
-           $filtered_id = str_replace( 'ga:', '', $this->accountId );
245
+           $filtered_id = str_replace('ga:', '', $this->accountId);
246 246
            
247
-           if(!$filtered_id){
247
+           if (!$filtered_id) {
248 248
                 echo 'Error - Account ID is blank';
249 249
                 return false;
250 250
            }
251 251
 
252
-		if($realtime){
252
+		if ($realtime) {
253 253
 			return $analytics->data_realtime->get(
254 254
 				'ga:'.$filtered_id,
255 255
 				$metric,
256 256
 				$params
257 257
 			);
258
-		}else{
258
+		} else {
259 259
 			return $analytics->data_ga->get(
260 260
 				'ga:'.$filtered_id,
261 261
 				$startDate,
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
 	 **/
280 280
 	function verifyStartDate($date)
281 281
 	{
282
-		if ( strtotime($date) > strtotime('2005-01-01') )
282
+		if (strtotime($date) > strtotime('2005-01-01'))
283 283
 			return $date;
284 284
 		else
285 285
 			return '2005-01-01';
Please login to merge, or discard this patch.
Braces   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -41,8 +41,7 @@  discard block
 block discarded – undo
41 41
 
42 42
             try {
43 43
                     $this->analytics = new Google_Service_Analytics($this->client);
44
-                }
45
-            catch (Google_ServiceException $e)
44
+                } catch (Google_ServiceException $e)
46 45
                 {
47 46
                     print '(cas:48) There was an Analytics API service error ' . $e->getCode() . ':' . $e->getMessage();
48 47
 					return false;
@@ -58,8 +57,7 @@  discard block
 block discarded – undo
58 57
 				try
59 58
                 {
60 59
                     $this->client->setAccessToken($ga_google_authtoken);
61
-				}
62
-				catch( Google_AuthException $e )
60
+				} catch( Google_AuthException $e )
63 61
                 {
64 62
                     print '(cas:72) GeoDirectory was unable to authenticate you with
65 63
                             Google using the Auth Token you pasted into the input box on the previous step. <br><br>
@@ -69,18 +67,18 @@  discard block
 block discarded – undo
69 67
 
70 68
                     return false;
71 69
                 }
72
-            }
73
-            else
70
+            } else
74 71
             {
75 72
                 $authCode = get_option('geodir_ga_auth_code');
76 73
 
77
-                if (empty($authCode)) return false;
74
+                if (empty($authCode)) {
75
+                	return false;
76
+                }
78 77
 
79 78
                 try
80 79
                 {
81 80
                     $accessToken = $this->client->authenticate($authCode);
82
-                }
83
-                catch( Exception $e )
81
+                } catch( Exception $e )
84 82
                 {
85 83
                     print '(cas:72) GeoDirectory was unable to authenticate you with
86 84
                             Google using the Auth Token you pasted into the input box on the previous step. <br><br>
@@ -95,8 +93,7 @@  discard block
 block discarded – undo
95 93
                 {
96 94
                     $this->client->setAccessToken($accessToken);
97 95
                     update_option('geodir_ga_auth_token', $accessToken);
98
-                }
99
-                else
96
+                } else
100 97
                 {
101 98
                     return false;
102 99
                 }
@@ -117,19 +114,22 @@  discard block
 block discarded – undo
117 114
             $webproperty_id = get_option('geodir_ga_account_id');
118 115
             list($pre, $account_id, $post) = explode('-',$webproperty_id);
119 116
 
120
-            if (empty($webproperty_id)) return false;
117
+            if (empty($webproperty_id)) {
118
+            	return false;
119
+            }
121 120
 
122 121
             try {
123 122
                 $profiles = $this->analytics->management_profiles->listManagementProfiles($account_id, $webproperty_id);
124
-            }
125
-            catch (Google_ServiceException $e)
123
+            } catch (Google_ServiceException $e)
126 124
             {
127 125
                 print 'There was an Analytics API service error ' . $e->getCode() . ': ' . $e->getMessage();
128 126
                 return false;
129 127
             }
130 128
 
131 129
             $profile_id = $profiles->items[0]->id;
132
-            if (empty($profile_id)) return false;
130
+            if (empty($profile_id)) {
131
+            	return false;
132
+            }
133 133
 
134 134
             $account_array = array();
135 135
             array_push($account_array, array('id'=>$profile_id, 'ga:webPropertyId'=>$webproperty_id));
@@ -142,8 +142,7 @@  discard block
 block discarded – undo
142 142
             
143 143
             try {
144 144
                     $profiles = $this->analytics->management_webproperties->listManagementWebproperties('~all');
145
-                }
146
-                catch (Google_ServiceException $e)
145
+                } catch (Google_ServiceException $e)
147 146
                 {
148 147
                     print 'There was an Analytics API service error ' . $e->getCode() . ': ' . $e->getMessage();
149 148
                 }
@@ -255,7 +254,7 @@  discard block
 block discarded – undo
255 254
 				$metric,
256 255
 				$params
257 256
 			);
258
-		}else{
257
+		} else{
259 258
 			return $analytics->data_ga->get(
260 259
 				'ga:'.$filtered_id,
261 260
 				$startDate,
@@ -279,10 +278,11 @@  discard block
 block discarded – undo
279 278
 	 **/
280 279
 	function verifyStartDate($date)
281 280
 	{
282
-		if ( strtotime($date) > strtotime('2005-01-01') )
283
-			return $date;
284
-		else
285
-			return '2005-01-01';
281
+		if ( strtotime($date) > strtotime('2005-01-01') ) {
282
+					return $date;
283
+		} else {
284
+					return '2005-01-01';
285
+		}
286 286
 	}
287 287
 
288 288
 } // END class	
289 289
\ No newline at end of file
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') || geodir_is_page('home')) {
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/signup_function.php 3 patches
Braces   +74 added lines, -48 removed lines patch added patch discarded remove patch
@@ -25,11 +25,13 @@  discard block
 block discarded – undo
25 25
                 window.location.href = '<?php echo geodir_login_url();?>';
26 26
             </script>
27 27
         <?php
28
-        } else
29
-            return false;
30
-    } else
31
-        return true;
32
-}
28
+        } else {
29
+                    return false;
30
+        }
31
+    } else {
32
+            return true;
33
+    }
34
+    }
33 35
 
34 36
 /**
35 37
  * Redirect to SSL url, if SSL is being used.
@@ -60,7 +62,9 @@  discard block
 block discarded – undo
60 62
      * @param string $message Login message.
61 63
      */
62 64
     $message = apply_filters('login_message', $message);
63
-    if (!empty($message)) echo $message . "\n";
65
+    if (!empty($message)) {
66
+    	echo $message . "\n";
67
+    }
64 68
 
65 69
 }
66 70
 
@@ -141,14 +145,16 @@  discard block
 block discarded – undo
141 145
     global $wpdb;
142 146
 
143 147
     $errors = new WP_Error();
144
-    if (empty($_POST['user_login']) && empty($_POST['user_email']))
145
-        $errors->add('empty_username', __('<strong>ERROR</strong>: Enter a username or e-mail address.', 'geodirectory'));
148
+    if (empty($_POST['user_login']) && empty($_POST['user_email'])) {
149
+            $errors->add('empty_username', __('<strong>ERROR</strong>: Enter a username or e-mail address.', 'geodirectory'));
150
+    }
146 151
 
147 152
     if (strpos($_POST['user_login'], '@')) {
148 153
         //$user_data = get_user_by_email(trim($_POST['user_login']));
149 154
         $user_data = get_user_by('email', trim($_POST['user_login']));
150
-        if (empty($user_data))
151
-            $errors->add('invalid_email', __('<strong>ERROR</strong>: There is no user registered with that email address.', 'geodirectory'));
155
+        if (empty($user_data)) {
156
+                    $errors->add('invalid_email', __('<strong>ERROR</strong>: There is no user registered with that email address.', 'geodirectory'));
157
+        }
152 158
     } else {
153 159
         $login = trim($_POST['user_login']);
154 160
         $user_data = get_user_by('email', $login);
@@ -161,8 +167,9 @@  discard block
 block discarded – undo
161 167
      */
162 168
     do_action('lostpassword_post');
163 169
 
164
-    if ($errors->get_error_code())
165
-        return $errors;
170
+    if ($errors->get_error_code()) {
171
+            return $errors;
172
+    }
166 173
 
167 174
     if (!$user_data) {
168 175
         $errors->add('invalidcombo', __('<strong>ERROR</strong>: Invalid username or e-mail.', 'geodirectory'));
@@ -192,8 +199,9 @@  discard block
 block discarded – undo
192 199
         )
193 200
     );
194 201
 
195
-    if (empty($user))
196
-        return new WP_Error('invalid_key', __('Invalid key', 'geodirectory'));
202
+    if (empty($user)) {
203
+            return new WP_Error('invalid_key', __('Invalid key', 'geodirectory'));
204
+    }
197 205
 
198 206
     $new_pass = wp_generate_password(12, false);
199 207
 
@@ -282,13 +290,14 @@  discard block
 block discarded – undo
282 290
     }
283 291
 
284 292
     // Check the username
285
-    if ($user_login == '')
286
-        $errors->add('empty_username', __('ERROR: Please enter a username.', 'geodirectory'));
287
-    elseif (!validate_username($user_login)) {
293
+    if ($user_login == '') {
294
+            $errors->add('empty_username', __('ERROR: Please enter a username.', 'geodirectory'));
295
+    } elseif (!validate_username($user_login)) {
288 296
         $errors->add('invalid_username', __('<strong>ERROR</strong>: This username is invalid.  Please enter a valid username.', 'geodirectory'));
289 297
         $user_login = '';
290
-    } elseif (username_exists($user_login))
291
-        $errors->add('username_exists', __('<strong>ERROR</strong>: This username is already registered, please choose another one.', 'geodirectory'));
298
+    } elseif (username_exists($user_login)) {
299
+            $errors->add('username_exists', __('<strong>ERROR</strong>: This username is already registered, please choose another one.', 'geodirectory'));
300
+    }
292 301
 
293 302
     // Check the e-mail address
294 303
     if ($user_email == '') {
@@ -296,8 +305,9 @@  discard block
 block discarded – undo
296 305
     } elseif (!is_email($user_email)) {
297 306
         $errors->add('invalid_email', __('<strong>ERROR</strong>: The email address isn&#8217;t correct.', 'geodirectory'));
298 307
         $user_email = '';
299
-    } elseif (email_exists($user_email))
300
-        $errors->add('email_exists', __('<strong>ERROR</strong>: This email is already registered, please choose another one.', 'geodirectory'));
308
+    } elseif (email_exists($user_email)) {
309
+            $errors->add('email_exists', __('<strong>ERROR</strong>: This email is already registered, please choose another one.', 'geodirectory'));
310
+    }
301 311
 
302 312
     /**
303 313
      * Called when registering a new user.
@@ -317,8 +327,9 @@  discard block
 block discarded – undo
317 327
      */
318 328
     $errors = apply_filters('registration_errors', $errors,$user_login,$user_email);
319 329
 
320
-    if ($errors->get_error_code())
321
-        return $errors;
330
+    if ($errors->get_error_code()) {
331
+            return $errors;
332
+    }
322 333
 
323 334
 
324 335
     if (!isset($user_pass) || $user_pass == '') {
@@ -423,28 +434,33 @@  discard block
 block discarded – undo
423 434
 
424 435
     $errors = new WP_Error();
425 436
 
426
-    if (isset($_GET['key']))
427
-        $action = 'resetpass';
437
+    if (isset($_GET['key'])) {
438
+            $action = 'resetpass';
439
+    }
428 440
 
429 441
     // validate action so as to default to the login screen
430
-    if (!in_array($action, array('logout', 'lostpassword', 'retrievepassword', 'resetpass', 'rp', 'register', 'login')) && false === has_filter('login_form_' . $action))
431
-        $action = 'login';
442
+    if (!in_array($action, array('logout', 'lostpassword', 'retrievepassword', 'resetpass', 'rp', 'register', 'login')) && false === has_filter('login_form_' . $action)) {
443
+            $action = 'login';
444
+    }
432 445
 
433 446
     nocache_headers();
434 447
 
435 448
     if (defined('RELOCATE')) { // Move flag is set
436
-        if (isset($_SERVER['PATH_INFO']) && ($_SERVER['PATH_INFO'] != $_SERVER['PHP_SELF']))
437
-            $_SERVER['PHP_SELF'] = str_replace($_SERVER['PATH_INFO'], '', $_SERVER['PHP_SELF']);
449
+        if (isset($_SERVER['PATH_INFO']) && ($_SERVER['PATH_INFO'] != $_SERVER['PHP_SELF'])) {
450
+                    $_SERVER['PHP_SELF'] = str_replace($_SERVER['PATH_INFO'], '', $_SERVER['PHP_SELF']);
451
+        }
438 452
 
439 453
         $schema = (isset($_SERVER['HTTPS']) && geodir_strtolower($_SERVER['HTTPS']) == 'on') ? 'https://' : 'http://';
440
-        if (dirname($schema . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']) != home_url())
441
-            update_option('siteurl', dirname($schema . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']));
454
+        if (dirname($schema . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']) != home_url()) {
455
+                    update_option('siteurl', dirname($schema . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']));
456
+        }
442 457
     }
443 458
 
444 459
     //Set a cookie now to see if they are supported by the browser.
445 460
     //setcookie(TEST_COOKIE, 'WP Cookie check', 0, COOKIEPATH, COOKIE_DOMAIN);
446
-    if (SITECOOKIEPATH != COOKIEPATH)
447
-        setcookie(TEST_COOKIE, 'WP Cookie check', 0, SITECOOKIEPATH, COOKIE_DOMAIN);
461
+    if (SITECOOKIEPATH != COOKIEPATH) {
462
+            setcookie(TEST_COOKIE, 'WP Cookie check', 0, SITECOOKIEPATH, COOKIE_DOMAIN);
463
+    }
448 464
 
449 465
     /**
450 466
      * Allow plugins to override the default actions, and to add extra actions if they want on the register/signin page.
@@ -465,8 +481,9 @@  discard block
 block discarded – undo
465 481
 
466 482
             $redirect_to = $_SERVER['HTTP_REFERER'];
467 483
             //$redirect_to = home_url().'/?ptype=login&loggedout=true';
468
-            if (isset($_REQUEST['redirect_to']))
469
-                $redirect_to = $_REQUEST['redirect_to'];
484
+            if (isset($_REQUEST['redirect_to'])) {
485
+                            $redirect_to = $_REQUEST['redirect_to'];
486
+            }
470 487
             $redirect_to = home_url();
471 488
             wp_safe_redirect($redirect_to);
472 489
             exit();
@@ -486,7 +503,9 @@  discard block
 block discarded – undo
486 503
                     gd_die();
487 504
                 }
488 505
             }
489
-            if (isset($_GET['error']) && 'invalidkey' == $_GET['error']) $errors->add('invalidkey', __('Sorry, that key does not appear to be valid.', 'geodirectory'));
506
+            if (isset($_GET['error']) && 'invalidkey' == $_GET['error']) {
507
+            	$errors->add('invalidkey', __('Sorry, that key does not appear to be valid.', 'geodirectory'));
508
+            }
490 509
         /**
491 510
          * Called in the geodir_user_signup() function during the lostpassword case.
492 511
          *
@@ -582,8 +601,9 @@  discard block
 block discarded – undo
582 601
                     }
583 602
 
584 603
 
585
-                    if (!$secure_cookie && is_ssl() && force_ssl_admin() && !force_ssl_admin() && (0 !== strpos($redirect_to, 'https')) && (0 === strpos($redirect_to, 'http')))
586
-                        $secure_cookie = false;
604
+                    if (!$secure_cookie && is_ssl() && force_ssl_admin() && !force_ssl_admin() && (0 !== strpos($redirect_to, 'https')) && (0 === strpos($redirect_to, 'http'))) {
605
+                                            $secure_cookie = false;
606
+                    }
587 607
 
588 608
                     $user = wp_signon('', $secure_cookie);
589 609
 
@@ -652,22 +672,26 @@  discard block
 block discarded – undo
652 672
                     $default_author_link = apply_filters('geodir_dashboard_author_link', $default_author_link, $user_ID);
653 673
 
654 674
                     $_REQUEST['redirect_to'] = $default_author_link;
655
-                else:
656
-                    $_REQUEST['redirect_to'] = home_url();
675
+                else {
676
+                	:
677
+                    $_REQUEST['redirect_to'] = home_url();
678
+                }
657 679
                 endif;
658 680
 
659 681
             }
660 682
             if (isset($_REQUEST['redirect_to'])) {
661 683
                 $redirect_to = $_REQUEST['redirect_to'];
662 684
                 // Redirect to https if user wants ssl
663
-                if ($secure_cookie && false !== strpos($redirect_to, 'wp-admin'))
664
-                    $redirect_to = preg_replace('|^http://|', 'https://', $redirect_to);
685
+                if ($secure_cookie && false !== strpos($redirect_to, 'wp-admin')) {
686
+                                    $redirect_to = preg_replace('|^http://|', 'https://', $redirect_to);
687
+                }
665 688
             } else {
666 689
                 $redirect_to = admin_url();
667 690
             }
668 691
 
669
-            if (!$secure_cookie && is_ssl() && force_ssl_admin() && !force_ssl_admin() && (0 !== strpos($redirect_to, 'https')) && (0 === strpos($redirect_to, 'http')))
670
-                $secure_cookie = false;
692
+            if (!$secure_cookie && is_ssl() && force_ssl_admin() && !force_ssl_admin() && (0 !== strpos($redirect_to, 'https')) && (0 === strpos($redirect_to, 'http'))) {
693
+                            $secure_cookie = false;
694
+            }
671 695
             $user = wp_signon('', $secure_cookie);
672 696
 
673 697
 
@@ -702,11 +726,13 @@  discard block
 block discarded – undo
702 726
             $errors = $user;
703 727
 
704 728
             // Clear errors if loggedout is set.
705
-            if (!empty($_GET['loggedout']))
706
-                $errors = new WP_Error();
729
+            if (!empty($_GET['loggedout'])) {
730
+                            $errors = new WP_Error();
731
+            }
707 732
             // If cookies are disabled we can't log in even with a valid user+pass
708
-            if (isset($_POST['testcookie']) && empty($_COOKIE[TEST_COOKIE]))
709
-                $errors->add('test_cookie', __("<strong>ERROR</strong>: Cookies are blocked or not supported by your browser. You must <a href='http://www.google.com/cookies.html'>enable cookies</a> to use WordPress.", 'geodirectory'));
733
+            if (isset($_POST['testcookie']) && empty($_COOKIE[TEST_COOKIE])) {
734
+                            $errors->add('test_cookie', __("<strong>ERROR</strong>: Cookies are blocked or not supported by your browser. You must <a href='http://www.google.com/cookies.html'>enable cookies</a> to use WordPress.", 'geodirectory'));
735
+            }
710 736
 
711 737
             // Some parts of this script use the main login form to display a message
712 738
             if (isset($_GET['loggedout']) && TRUE == $_GET['loggedout']) {
Please login to merge, or discard this patch.
Indentation   +621 added lines, -621 removed lines patch added patch discarded remove patch
@@ -17,18 +17,18 @@  discard block
 block discarded – undo
17 17
  */
18 18
 function geodir_is_login($redirect = false)
19 19
 {
20
-    global $current_user;
21
-    if (!$current_user->ID) {
22
-        if ($redirect) {
23
-            ?>
20
+	global $current_user;
21
+	if (!$current_user->ID) {
22
+		if ($redirect) {
23
+			?>
24 24
             <script type="text/javascript">
25 25
                 window.location.href = '<?php echo geodir_login_url();?>';
26 26
             </script>
27 27
         <?php
28
-        } else
29
-            return false;
30
-    } else
31
-        return true;
28
+		} else
29
+			return false;
30
+	} else
31
+		return true;
32 32
 }
33 33
 
34 34
 /**
@@ -42,25 +42,25 @@  discard block
 block discarded – undo
42 42
 {
43 43
 
44 44
 // Redirect to https login if forced to use SSL
45
-    if (force_ssl_admin() && !is_ssl()) {
46
-        if (0 === strpos($_SERVER['REQUEST_URI'], 'http')) {
47
-            wp_redirect(preg_replace('|^http://|', 'https://', $_SERVER['REQUEST_URI']));
48
-            exit();
49
-        } else {
50
-            wp_redirect('https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
51
-            exit();
52
-        }
53
-    }
54
-
55
-    /**
56
-     * Filter the login message.
57
-     *
58
-     * @since 1.0.0
59
-     *
60
-     * @param string $message Login message.
61
-     */
62
-    $message = apply_filters('login_message', $message);
63
-    if (!empty($message)) echo $message . "\n";
45
+	if (force_ssl_admin() && !is_ssl()) {
46
+		if (0 === strpos($_SERVER['REQUEST_URI'], 'http')) {
47
+			wp_redirect(preg_replace('|^http://|', 'https://', $_SERVER['REQUEST_URI']));
48
+			exit();
49
+		} else {
50
+			wp_redirect('https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
51
+			exit();
52
+		}
53
+	}
54
+
55
+	/**
56
+	 * Filter the login message.
57
+	 *
58
+	 * @since 1.0.0
59
+	 *
60
+	 * @param string $message Login message.
61
+	 */
62
+	$message = apply_filters('login_message', $message);
63
+	if (!empty($message)) echo $message . "\n";
64 64
 
65 65
 }
66 66
 
@@ -73,59 +73,59 @@  discard block
 block discarded – undo
73 73
  */
74 74
 function geodir_get_site_email_id()
75 75
 {
76
-    if (get_option('site_email')) {
76
+	if (get_option('site_email')) {
77 77
 
78
-        return get_option('site_email');
78
+		return get_option('site_email');
79 79
 
80
-    } else {
80
+	} else {
81 81
 
82
-        return get_option('admin_email');
82
+		return get_option('admin_email');
83 83
 
84
-    }
84
+	}
85 85
 
86 86
 }
87 87
 
88 88
 
89 89
 if (!function_exists('get_site_emailName')) {
90
-    /**
91
-     * Get site name for sending emails.
92
-     *
93
-     * @since 1.0.0
94
-     * @package GeoDirectory
95
-     * @return string Site name.
96
-     */
97
-    function get_site_emailName()
90
+	/**
91
+	 * Get site name for sending emails.
92
+	 *
93
+	 * @since 1.0.0
94
+	 * @package GeoDirectory
95
+	 * @return string Site name.
96
+	 */
97
+	function get_site_emailName()
98 98
 
99
-    {
99
+	{
100 100
 
101
-        if (get_option('site_email_name')) {
101
+		if (get_option('site_email_name')) {
102 102
 
103
-            return stripslashes(get_option('site_email_name'));
103
+			return stripslashes(get_option('site_email_name'));
104 104
 
105
-        } else {
105
+		} else {
106 106
 
107
-            return stripslashes(get_option('blogname'));
107
+			return stripslashes(get_option('blogname'));
108 108
 
109
-        }
109
+		}
110 110
 
111
-    }
111
+	}
112 112
 }
113 113
 
114 114
 if (!function_exists('is_allow_user_register')) {
115
-    /**
116
-     * Checks whether the site allowing user registration or not.
117
-     *
118
-     * @since 1.0.0
119
-     * @package GeoDirectory
120
-     * @return bool|string
121
-     */
122
-    function is_allow_user_register()
115
+	/**
116
+	 * Checks whether the site allowing user registration or not.
117
+	 *
118
+	 * @since 1.0.0
119
+	 * @package GeoDirectory
120
+	 * @return bool|string
121
+	 */
122
+	function is_allow_user_register()
123 123
 
124
-    {
124
+	{
125 125
 
126
-        return get_option('users_can_register');
126
+		return get_option('users_can_register');
127 127
 
128
-    }
128
+	}
129 129
 }
130 130
 
131 131
 /**
@@ -138,107 +138,107 @@  discard block
 block discarded – undo
138 138
  */
139 139
 function geodir_retrieve_password()
140 140
 {
141
-    global $wpdb;
142
-
143
-    $errors = new WP_Error();
144
-    if (empty($_POST['user_login']) && empty($_POST['user_email']))
145
-        $errors->add('empty_username', __('<strong>ERROR</strong>: Enter a username or e-mail address.', 'geodirectory'));
146
-
147
-    if (strpos($_POST['user_login'], '@')) {
148
-        //$user_data = get_user_by_email(trim($_POST['user_login']));
149
-        $user_data = get_user_by('email', trim($_POST['user_login']));
150
-        if (empty($user_data))
151
-            $errors->add('invalid_email', __('<strong>ERROR</strong>: There is no user registered with that email address.', 'geodirectory'));
152
-    } else {
153
-        $login = trim($_POST['user_login']);
154
-        $user_data = get_user_by('email', $login);
155
-    }
156
-
157
-    /**
158
-     * Called in the geodir_retrieve_password() function before any errors are set or any emails are sent.
159
-     *
160
-     * @since 1.0.0
161
-     */
162
-    do_action('lostpassword_post');
163
-
164
-    if ($errors->get_error_code())
165
-        return $errors;
166
-
167
-    if (!$user_data) {
168
-        $errors->add('invalidcombo', __('<strong>ERROR</strong>: Invalid username or e-mail.', 'geodirectory'));
169
-        return $errors;
170
-    }
171
-
172
-    // redefining user_login ensures we return the right case in the email
173
-    $user_login = $user_data->user_login;
174
-    $user_email = $user_data->user_email;
175
-
176
-    /**
177
-     * Called in the geodir_retrieve_password() function before any emails are sent.
178
-     *
179
-     * @since 1.0.0
180
-     * @param string $user_login The users username.
181
-     */
182
-    do_action('retrieve_password', $user_login);
183
-
184
-    ////////////////////////////////////
185
-    $user_email = isset($_POST['user_email']) ? $_POST['user_email'] : '';
186
-    $user_login = $_POST['user_login'];
187
-
188
-    $user = $wpdb->get_row(
189
-        $wpdb->prepare(
190
-            "SELECT * FROM $wpdb->users WHERE user_login like %s or user_email like %s",
191
-            array($user_login, $user_login)
192
-        )
193
-    );
194
-
195
-    if (empty($user))
196
-        return new WP_Error('invalid_key', __('Invalid key', 'geodirectory'));
197
-
198
-    $new_pass = wp_generate_password(12, false);
199
-
200
-    /**
201
-     * Called in the geodir_retrieve_password() function before any emails are sent.
202
-     *
203
-     * @since 1.0.0
204
-     * @param object $user The user object.
205
-     * @param string $new_pass The new pass being sent to the user.
206
-     */
207
-    do_action('password_reset', $user, $new_pass);
208
-
209
-    wp_set_password($new_pass, $user->ID);
210
-    update_user_meta($user->ID, 'default_password_nag', true); //Set up the Password change nag.
211
-    $message = '<p><b>' . __('Your login Information :', 'geodirectory') . '</b></p>';
212
-    $message .= '<p>' . sprintf(__('Username: %s', 'geodirectory'), $user->user_login) . "</p>";
213
-    $message .= '<p>' . sprintf(__('Password: %s', 'geodirectory'), $new_pass) . "</p>";
214
-    //$message .= '<p>You can login to : <a href="'.home_url().'/?ptype=login' . "\">Login</a> or the URL is :  ".home_url()."/?ptype=login</p>";
215
-    //$message .= '<p>Thank You,<br> '.get_option('blogname').'</p>';
216
-    $user_email = $user_data->user_email;
217
-    $user_name = geodir_get_client_name($user->ID);
218
-    $fromEmail = geodir_get_site_email_id();
219
-    $fromEmailName = get_site_emailName();
220
-    $title = sprintf(__('[%s] Your new password', 'geodirectory'), get_option('blogname'));
221
-    /**
222
-     * Filter the password reset email subject part.
223
-     *
224
-     * @since 1.0.0
225
-     *
226
-     * @param string $title Password reset email subject.
227
-     */
228
-    $title = apply_filters('password_reset_title', $title);
229
-    /**
230
-     * Filter the password reset email message part.
231
-     *
232
-     * @since 1.0.0
233
-     *
234
-     * @param string $message Password reset email message.
235
-     * @param string $new_pass The new password string.
236
-     */
237
-    $message = apply_filters('password_reset_message', $message, $new_pass);
238
-    //geodir_sendEmail($fromEmail,$fromEmailName,$user_email,$user_name,$title,$message,$extra='');///forgot password email
239
-    geodir_sendEmail($fromEmail, $fromEmailName, $user_email, $user_name, $title, $message, $extra = '', 'forgot_password', $post_id = '', $user->ID);///forgot password email
240
-
241
-    return true;
141
+	global $wpdb;
142
+
143
+	$errors = new WP_Error();
144
+	if (empty($_POST['user_login']) && empty($_POST['user_email']))
145
+		$errors->add('empty_username', __('<strong>ERROR</strong>: Enter a username or e-mail address.', 'geodirectory'));
146
+
147
+	if (strpos($_POST['user_login'], '@')) {
148
+		//$user_data = get_user_by_email(trim($_POST['user_login']));
149
+		$user_data = get_user_by('email', trim($_POST['user_login']));
150
+		if (empty($user_data))
151
+			$errors->add('invalid_email', __('<strong>ERROR</strong>: There is no user registered with that email address.', 'geodirectory'));
152
+	} else {
153
+		$login = trim($_POST['user_login']);
154
+		$user_data = get_user_by('email', $login);
155
+	}
156
+
157
+	/**
158
+	 * Called in the geodir_retrieve_password() function before any errors are set or any emails are sent.
159
+	 *
160
+	 * @since 1.0.0
161
+	 */
162
+	do_action('lostpassword_post');
163
+
164
+	if ($errors->get_error_code())
165
+		return $errors;
166
+
167
+	if (!$user_data) {
168
+		$errors->add('invalidcombo', __('<strong>ERROR</strong>: Invalid username or e-mail.', 'geodirectory'));
169
+		return $errors;
170
+	}
171
+
172
+	// redefining user_login ensures we return the right case in the email
173
+	$user_login = $user_data->user_login;
174
+	$user_email = $user_data->user_email;
175
+
176
+	/**
177
+	 * Called in the geodir_retrieve_password() function before any emails are sent.
178
+	 *
179
+	 * @since 1.0.0
180
+	 * @param string $user_login The users username.
181
+	 */
182
+	do_action('retrieve_password', $user_login);
183
+
184
+	////////////////////////////////////
185
+	$user_email = isset($_POST['user_email']) ? $_POST['user_email'] : '';
186
+	$user_login = $_POST['user_login'];
187
+
188
+	$user = $wpdb->get_row(
189
+		$wpdb->prepare(
190
+			"SELECT * FROM $wpdb->users WHERE user_login like %s or user_email like %s",
191
+			array($user_login, $user_login)
192
+		)
193
+	);
194
+
195
+	if (empty($user))
196
+		return new WP_Error('invalid_key', __('Invalid key', 'geodirectory'));
197
+
198
+	$new_pass = wp_generate_password(12, false);
199
+
200
+	/**
201
+	 * Called in the geodir_retrieve_password() function before any emails are sent.
202
+	 *
203
+	 * @since 1.0.0
204
+	 * @param object $user The user object.
205
+	 * @param string $new_pass The new pass being sent to the user.
206
+	 */
207
+	do_action('password_reset', $user, $new_pass);
208
+
209
+	wp_set_password($new_pass, $user->ID);
210
+	update_user_meta($user->ID, 'default_password_nag', true); //Set up the Password change nag.
211
+	$message = '<p><b>' . __('Your login Information :', 'geodirectory') . '</b></p>';
212
+	$message .= '<p>' . sprintf(__('Username: %s', 'geodirectory'), $user->user_login) . "</p>";
213
+	$message .= '<p>' . sprintf(__('Password: %s', 'geodirectory'), $new_pass) . "</p>";
214
+	//$message .= '<p>You can login to : <a href="'.home_url().'/?ptype=login' . "\">Login</a> or the URL is :  ".home_url()."/?ptype=login</p>";
215
+	//$message .= '<p>Thank You,<br> '.get_option('blogname').'</p>';
216
+	$user_email = $user_data->user_email;
217
+	$user_name = geodir_get_client_name($user->ID);
218
+	$fromEmail = geodir_get_site_email_id();
219
+	$fromEmailName = get_site_emailName();
220
+	$title = sprintf(__('[%s] Your new password', 'geodirectory'), get_option('blogname'));
221
+	/**
222
+	 * Filter the password reset email subject part.
223
+	 *
224
+	 * @since 1.0.0
225
+	 *
226
+	 * @param string $title Password reset email subject.
227
+	 */
228
+	$title = apply_filters('password_reset_title', $title);
229
+	/**
230
+	 * Filter the password reset email message part.
231
+	 *
232
+	 * @since 1.0.0
233
+	 *
234
+	 * @param string $message Password reset email message.
235
+	 * @param string $new_pass The new password string.
236
+	 */
237
+	$message = apply_filters('password_reset_message', $message, $new_pass);
238
+	//geodir_sendEmail($fromEmail,$fromEmailName,$user_email,$user_name,$title,$message,$extra='');///forgot password email
239
+	geodir_sendEmail($fromEmail, $fromEmailName, $user_email, $user_name, $title, $message, $extra = '', 'forgot_password', $post_id = '', $user->ID);///forgot password email
240
+
241
+	return true;
242 242
 }
243 243
 
244 244
 /**
@@ -253,80 +253,80 @@  discard block
 block discarded – undo
253 253
  */
254 254
 function geodir_register_new_user($user_login, $user_email)
255 255
 {
256
-    global $wpdb;
257
-    $errors = new WP_Error();
258
-
259
-
260
-    $user_login = sanitize_user($user_login);
261
-    $user_login = str_replace(",", "", $user_login);
262
-    $user_email = str_replace(",", "", $user_email);
263
-    /**
264
-     * Filter the user registration email.
265
-     *
266
-     * @since 1.0.0
267
-     *
268
-     * @param string $user_email User registration email.
269
-     */
270
-    $user_email = apply_filters('user_registration_email', $user_email);
271
-
272
-
273
-    if (get_option('geodir_allow_cpass')) {
274
-        $user_pass = $_REQUEST['user_pass'];
275
-        $user_pass2 = $_REQUEST['user_pass2'];
276
-        // Check the password
277
-        if ($user_pass != $user_pass2) {
278
-            $errors->add('pass_match', __('ERROR: Passwords do not match.', 'geodirectory'));
279
-        } elseif (strlen($user_pass) < 7) {
280
-            $errors->add('pass_match', __('ERROR: Password must be 7 characters or more.', 'geodirectory'));
281
-        }
282
-    }
283
-
284
-    // Check the username
285
-    if ($user_login == '')
286
-        $errors->add('empty_username', __('ERROR: Please enter a username.', 'geodirectory'));
287
-    elseif (!validate_username($user_login)) {
288
-        $errors->add('invalid_username', __('<strong>ERROR</strong>: This username is invalid.  Please enter a valid username.', 'geodirectory'));
289
-        $user_login = '';
290
-    } elseif (username_exists($user_login))
291
-        $errors->add('username_exists', __('<strong>ERROR</strong>: This username is already registered, please choose another one.', 'geodirectory'));
292
-
293
-    // Check the e-mail address
294
-    if ($user_email == '') {
295
-        $errors->add('empty_email', __('<strong>ERROR</strong>: Please type your e-mail address.', 'geodirectory'));
296
-    } elseif (!is_email($user_email)) {
297
-        $errors->add('invalid_email', __('<strong>ERROR</strong>: The email address isn&#8217;t correct.', 'geodirectory'));
298
-        $user_email = '';
299
-    } elseif (email_exists($user_email))
300
-        $errors->add('email_exists', __('<strong>ERROR</strong>: This email is already registered, please choose another one.', 'geodirectory'));
301
-
302
-    /**
303
-     * Called when registering a new user.
304
-     *
305
-     * This is a WordPress core hook.
306
-     *
307
-     * @link https://codex.wordpress.org/Plugin_API/Action_Reference/register_post
308
-     * @since 1.0.0
309
-     */
310
-    do_action('register_post', $user_login, $user_email, $errors);
311
-    /**
312
-     * Filter the registration error messages.
313
-     *
314
-     * @since 1.0.0
315
-     *
316
-     * @param object $errors Registration error messages.
317
-     */
318
-    $errors = apply_filters('registration_errors', $errors,$user_login,$user_email);
319
-
320
-    if ($errors->get_error_code())
321
-        return $errors;
322
-
323
-
324
-    if (!isset($user_pass) || $user_pass == '') {
325
-        $user_pass = wp_generate_password(12, false);
326
-    }
327
-    $user_id = wp_create_user($user_login, $user_pass, $user_email);
328
-    $user_web = '';
329
-    /*$user_add1 = $_POST['user_add1'];
256
+	global $wpdb;
257
+	$errors = new WP_Error();
258
+
259
+
260
+	$user_login = sanitize_user($user_login);
261
+	$user_login = str_replace(",", "", $user_login);
262
+	$user_email = str_replace(",", "", $user_email);
263
+	/**
264
+	 * Filter the user registration email.
265
+	 *
266
+	 * @since 1.0.0
267
+	 *
268
+	 * @param string $user_email User registration email.
269
+	 */
270
+	$user_email = apply_filters('user_registration_email', $user_email);
271
+
272
+
273
+	if (get_option('geodir_allow_cpass')) {
274
+		$user_pass = $_REQUEST['user_pass'];
275
+		$user_pass2 = $_REQUEST['user_pass2'];
276
+		// Check the password
277
+		if ($user_pass != $user_pass2) {
278
+			$errors->add('pass_match', __('ERROR: Passwords do not match.', 'geodirectory'));
279
+		} elseif (strlen($user_pass) < 7) {
280
+			$errors->add('pass_match', __('ERROR: Password must be 7 characters or more.', 'geodirectory'));
281
+		}
282
+	}
283
+
284
+	// Check the username
285
+	if ($user_login == '')
286
+		$errors->add('empty_username', __('ERROR: Please enter a username.', 'geodirectory'));
287
+	elseif (!validate_username($user_login)) {
288
+		$errors->add('invalid_username', __('<strong>ERROR</strong>: This username is invalid.  Please enter a valid username.', 'geodirectory'));
289
+		$user_login = '';
290
+	} elseif (username_exists($user_login))
291
+		$errors->add('username_exists', __('<strong>ERROR</strong>: This username is already registered, please choose another one.', 'geodirectory'));
292
+
293
+	// Check the e-mail address
294
+	if ($user_email == '') {
295
+		$errors->add('empty_email', __('<strong>ERROR</strong>: Please type your e-mail address.', 'geodirectory'));
296
+	} elseif (!is_email($user_email)) {
297
+		$errors->add('invalid_email', __('<strong>ERROR</strong>: The email address isn&#8217;t correct.', 'geodirectory'));
298
+		$user_email = '';
299
+	} elseif (email_exists($user_email))
300
+		$errors->add('email_exists', __('<strong>ERROR</strong>: This email is already registered, please choose another one.', 'geodirectory'));
301
+
302
+	/**
303
+	 * Called when registering a new user.
304
+	 *
305
+	 * This is a WordPress core hook.
306
+	 *
307
+	 * @link https://codex.wordpress.org/Plugin_API/Action_Reference/register_post
308
+	 * @since 1.0.0
309
+	 */
310
+	do_action('register_post', $user_login, $user_email, $errors);
311
+	/**
312
+	 * Filter the registration error messages.
313
+	 *
314
+	 * @since 1.0.0
315
+	 *
316
+	 * @param object $errors Registration error messages.
317
+	 */
318
+	$errors = apply_filters('registration_errors', $errors,$user_login,$user_email);
319
+
320
+	if ($errors->get_error_code())
321
+		return $errors;
322
+
323
+
324
+	if (!isset($user_pass) || $user_pass == '') {
325
+		$user_pass = wp_generate_password(12, false);
326
+	}
327
+	$user_id = wp_create_user($user_login, $user_pass, $user_email);
328
+	$user_web = '';
329
+	/*$user_add1 = $_POST['user_add1'];
330 330
     $user_add2 = $_POST['user_add2'];
331 331
     $user_city = $_POST['user_city'];
332 332
     $user_state = $_POST['user_state'];
@@ -335,79 +335,79 @@  discard block
 block discarded – undo
335 335
     $user_web = $_POST['user_web'];
336 336
     $user_phone = $_POST['user_phone'];
337 337
     $user_twitter = $_POST['user_twitter'];	*/
338
-    $user_fname = sanitize_user($_POST['user_fname']);
339
-    $user_fname = str_replace(",", "", $user_fname);
338
+	$user_fname = sanitize_user($_POST['user_fname']);
339
+	$user_fname = str_replace(",", "", $user_fname);
340 340
 	if ( empty( $user_fname ) ) {
341 341
 		$user_fname = strstr( $user_login, '@', true );
342 342
 	}
343 343
 
344
-    /**
345
-     * Filter the submitted user meta.
346
-     *
347
-     * @since 1.0.0
348
-     *
349
-     * @param int $user_id User ID.
350
-     */
351
-    $user_address_info = apply_filters('geodir_manage_user_meta', array(
352
-        "user_add1" => '',
353
-        "user_add2" => '',
354
-        "user_city" => '',
355
-        "user_state" => '',
356
-        "user_country" => '',
357
-        "user_postalcode" => '',
358
-        "user_phone" => '',
359
-        "user_twitter" => '',
360
-        "first_name" => $user_fname,
361
-        "last_name" => '',
362
-    ), $user_id);
363
-    foreach ($user_address_info as $key => $val) {
364
-        update_user_meta($user_id, $key, $val); // User Address Information Here
365
-    }
366
-    //update_user_meta($user_id, 'user_address_info', ($user_address_info)); // User Address Information Here
367
-    $userName = $user_fname;
368
-    update_user_meta($user_id, 'first_name', $userName); // User Address Information Here
369
-    //update_user_meta($user_id, 'last_name', $_POST['user_lname']); // User Address Information Here
370
-
371
-    $user_nicename = geodir_generate_user_nicename( $userName, $user_login );
372
-
373
-    $updateUsersql = $wpdb->prepare("update $wpdb->users set user_url=%s, user_nicename=%s, display_name=%s  where ID=%d", array($user_web, $user_nicename, $userName, $user_id));
374
-
375
-    $wpdb->query($updateUsersql);
376
-
377
-    if (!$user_id) {
378
-        $errors->add('registerfail', sprintf(__('<strong>ERROR</strong>: Couldn&#8217;t register you... please contact the <a href="mailto:%s">webmaster</a> !', 'geodirectory'), get_option('admin_email')));
379
-        return $errors;
380
-    }
381
-    global $upload_folder_path;
382
-
383
-    if ($user_id) {
344
+	/**
345
+	 * Filter the submitted user meta.
346
+	 *
347
+	 * @since 1.0.0
348
+	 *
349
+	 * @param int $user_id User ID.
350
+	 */
351
+	$user_address_info = apply_filters('geodir_manage_user_meta', array(
352
+		"user_add1" => '',
353
+		"user_add2" => '',
354
+		"user_city" => '',
355
+		"user_state" => '',
356
+		"user_country" => '',
357
+		"user_postalcode" => '',
358
+		"user_phone" => '',
359
+		"user_twitter" => '',
360
+		"first_name" => $user_fname,
361
+		"last_name" => '',
362
+	), $user_id);
363
+	foreach ($user_address_info as $key => $val) {
364
+		update_user_meta($user_id, $key, $val); // User Address Information Here
365
+	}
366
+	//update_user_meta($user_id, 'user_address_info', ($user_address_info)); // User Address Information Here
367
+	$userName = $user_fname;
368
+	update_user_meta($user_id, 'first_name', $userName); // User Address Information Here
369
+	//update_user_meta($user_id, 'last_name', $_POST['user_lname']); // User Address Information Here
370
+
371
+	$user_nicename = geodir_generate_user_nicename( $userName, $user_login );
372
+
373
+	$updateUsersql = $wpdb->prepare("update $wpdb->users set user_url=%s, user_nicename=%s, display_name=%s  where ID=%d", array($user_web, $user_nicename, $userName, $user_id));
374
+
375
+	$wpdb->query($updateUsersql);
376
+
377
+	if (!$user_id) {
378
+		$errors->add('registerfail', sprintf(__('<strong>ERROR</strong>: Couldn&#8217;t register you... please contact the <a href="mailto:%s">webmaster</a> !', 'geodirectory'), get_option('admin_email')));
379
+		return $errors;
380
+	}
381
+	global $upload_folder_path;
382
+
383
+	if ($user_id) {
384 384
 		clean_user_cache($user_id);
385
-        /**
386
-         * Called after registering a user and before the registration email is sent.
387
-         *
388
-         * @since 1.0.0
389
-         * @param int $user_id The user ID of the registered user.
390
-         */
391
-        do_action('geodir_user_register', $user_id);
392
-        ///////REGISTRATION EMAIL START//////
393
-        $fromEmail = geodir_get_site_email_id();
394
-        $fromEmailName = get_site_emailName();
395
-        $message = __('<p><b>' . __('Your login Information :', 'geodirectory') . '</b></p>
385
+		/**
386
+		 * Called after registering a user and before the registration email is sent.
387
+		 *
388
+		 * @since 1.0.0
389
+		 * @param int $user_id The user ID of the registered user.
390
+		 */
391
+		do_action('geodir_user_register', $user_id);
392
+		///////REGISTRATION EMAIL START//////
393
+		$fromEmail = geodir_get_site_email_id();
394
+		$fromEmailName = get_site_emailName();
395
+		$message = __('<p><b>' . __('Your login Information :', 'geodirectory') . '</b></p>
396 396
 <p>' . __('Username:', 'geodirectory') . ' ' . $user_login . '</p>
397 397
 <p>' . __('Password:', 'geodirectory') . ' ' . $user_pass . '</p>');
398 398
 
399
-        /////////////customer email//////////////
400
-        //geodir_sendEmail($fromEmail,$fromEmailName,$user_email,$userName,$subject,$client_message,$extra='');///To client email
401
-        geodir_sendEmail($fromEmail, $fromEmailName, $user_email, $userName, '', $message, '', 'registration', '', $user_id);/// registration email
402
-        //////REGISTRATION EMAIL END////////
403
-    }
399
+		/////////////customer email//////////////
400
+		//geodir_sendEmail($fromEmail,$fromEmailName,$user_email,$userName,$subject,$client_message,$extra='');///To client email
401
+		geodir_sendEmail($fromEmail, $fromEmailName, $user_email, $userName, '', $message, '', 'registration', '', $user_id);/// registration email
402
+		//////REGISTRATION EMAIL END////////
403
+	}
404 404
 
405
-    if (get_option('ptthemes_auto_login')) {
406
-        $errors->add('auto_login', __('<strong>SUCCESS</strong>: Thank you for registering, please check your email for your login details.', 'geodirectory'));
407
-        return $errors;
408
-    }
405
+	if (get_option('ptthemes_auto_login')) {
406
+		$errors->add('auto_login', __('<strong>SUCCESS</strong>: Thank you for registering, please check your email for your login details.', 'geodirectory'));
407
+		return $errors;
408
+	}
409 409
 
410
-    return array($user_id, $user_pass);
410
+	return array($user_id, $user_pass);
411 411
 }
412 412
 
413 413
 /**
@@ -420,333 +420,333 @@  discard block
 block discarded – undo
420 420
  */
421 421
 function geodir_user_signup()
422 422
 {
423
-    global $errors;
424
-    $action = isset($_REQUEST['action']) ? $_REQUEST['action'] : 'login';
425
-
426
-    $errors = new WP_Error();
427
-
428
-    if (isset($_GET['key']))
429
-        $action = 'resetpass';
430
-
431
-    // validate action so as to default to the login screen
432
-    if (!in_array($action, array('logout', 'lostpassword', 'retrievepassword', 'resetpass', 'rp', 'register', 'login')) && false === has_filter('login_form_' . $action))
433
-        $action = 'login';
434
-
435
-    nocache_headers();
436
-
437
-    if (defined('RELOCATE')) { // Move flag is set
438
-        if (isset($_SERVER['PATH_INFO']) && ($_SERVER['PATH_INFO'] != $_SERVER['PHP_SELF']))
439
-            $_SERVER['PHP_SELF'] = str_replace($_SERVER['PATH_INFO'], '', $_SERVER['PHP_SELF']);
440
-
441
-        $schema = (isset($_SERVER['HTTPS']) && geodir_strtolower($_SERVER['HTTPS']) == 'on') ? 'https://' : 'http://';
442
-        if (dirname($schema . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']) != home_url())
443
-            update_option('siteurl', dirname($schema . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']));
444
-    }
445
-
446
-    //Set a cookie now to see if they are supported by the browser.
447
-    //setcookie(TEST_COOKIE, 'WP Cookie check', 0, COOKIEPATH, COOKIE_DOMAIN);
448
-    if (SITECOOKIEPATH != COOKIEPATH)
449
-        setcookie(TEST_COOKIE, 'WP Cookie check', 0, SITECOOKIEPATH, COOKIE_DOMAIN);
450
-
451
-    /**
452
-     * Allow plugins to override the default actions, and to add extra actions if they want on the register/signin page.
453
-     *
454
-     * Used dynamic hook login_form_$action
455
-     *
456
-     * @since 1.0.0
457
-     */
458
-    do_action('login_form_' . $action);
459
-
460
-    $http_post = ('POST' == $_SERVER['REQUEST_METHOD']);
461
-
462
-    switch ($action):
463
-
464
-        case 'logout' :
465
-            //check_admin_referer('log-out');
466
-            wp_logout();
467
-
468
-            $redirect_to = $_SERVER['HTTP_REFERER'];
469
-            //$redirect_to = home_url().'/?ptype=login&loggedout=true';
470
-            if (isset($_REQUEST['redirect_to']))
471
-                $redirect_to = $_REQUEST['redirect_to'];
472
-            $redirect_to = home_url();
473
-            wp_safe_redirect($redirect_to);
474
-            exit();
475
-
476
-            break;
477
-
478
-        case 'lostpassword' :
479
-        case 'retrievepassword' :
480
-            if ($http_post) {
481
-                $errors = geodir_retrieve_password();
482
-                $error_message = isset($errors->errors['invalid_email'][0]) ? $errors->errors['invalid_email'][0] : '';
483
-                if (!is_wp_error($errors)) {
484
-                    wp_redirect(geodir_login_url(array('checkemail'=>'confirm')));
485
-                    gd_die();
486
-                } else {
487
-                    wp_redirect(geodir_login_url(array('forgot' => 1, 'emsg'=>'fw')));
488
-                    gd_die();
489
-                }
490
-            }
491
-            if (isset($_GET['error']) && 'invalidkey' == $_GET['error']) $errors->add('invalidkey', __('Sorry, that key does not appear to be valid.', 'geodirectory'));
492
-        /**
493
-         * Called in the geodir_user_signup() function during the lostpassword case.
494
-         *
495
-         * @since 1.0.0
496
-         */
497
-        do_action('lost_password');
498
-            $message = '<div class="sucess_msg">' . ENTER_USER_EMAIL_NEW_PW_MSG . '</div>';
499
-            $user_login = isset($_POST['user_login']) ? stripslashes($_POST['user_login']) : '';
500
-
501
-            break;
502
-
503
-        case 'resetpass' :
504
-        case 'rp' :
505
-            $errors = reset_password($_GET['key'], $_GET['login']);
506
-
507
-            if (!is_wp_error($errors)) {
508
-                wp_redirect(geodir_login_url(array('checkemail'=>'newpass')));
509
-                exit();
510
-            }
511
-
512
-            wp_redirect(geodir_login_url(array('error'=>'invalidkey','action'=>'lostpassword')));
513
-            exit();
514
-
515
-            break;
516
-
517
-        case 'register' :
518
-            ############################### fix by Stiofan -  HebTech.co.uk ### SECURITY FIX ##############################
519
-            if (!get_option('users_can_register')) {
520
-                wp_redirect(geodir_login_url(array('emsg'=>'regnewusr')));
521
-                exit();
522
-            }
523
-            ############################### fix by Stiofan -  HebTech.co.uk ### SECURITY FIX ##############################
524
-            global $user_email, $user_fname;
525
-            $user_login = '';
526
-            $user_email = '';
527
-            if ($http_post) {
528
-                $user_login = $_POST['user_email'];
529
-                $user_email = $_POST['user_email'];
530
-                $user_fname = $_POST['user_fname'];
531
-
532
-                $errors = geodir_register_new_user($user_login, $user_email);
533
-
534
-                /* display error in registration form */
535
-                if (is_wp_error($errors)) {
536
-                    $error_code = $errors->get_error_code();
537
-                    $error_message = $errors->get_error_message($error_code);
538
-                    if (!isset($_POST['user_login']) && ($error_code == 'empty_username' || $error_code == 'invalid_username' || $error_code == 'username_exists')) {
539
-                        if ($error_code == 'empty_username') {
540
-                            $error_code = 'empty_email';
541
-                        } else if ($error_code == 'invalid_username') {
542
-                            $error_code = 'invalid_email';
543
-                        } else if ($error_code == 'username_exists') {
544
-                            $error_code = 'email_exists';
545
-                        }
546
-
547
-                        $error_message = $errors->get_error_message($error_code);
548
-                    }
549
-                    global $geodir_signup_error;
550
-                    $geodir_signup_error = $error_message;
551
-                }
552
-
553
-                if (!is_wp_error($errors)) {
554
-                    $_POST['log'] = $user_login;
555
-                    $_POST['pwd'] = $errors[1];
556
-                    $_POST['testcookie'] = 1;
557
-
558
-                    $secure_cookie = '';
559
-                    // If the user wants ssl but the session is not ssl, force a secure cookie.
560
-                    if (!empty($_POST['log'])) {
561
-                        $user_name = sanitize_user($_POST['log']);
562
-                        if ($user = get_user_by('email', $user_name)) {
563
-                            if (get_user_option('use_ssl', $user->ID)) {
564
-                                $secure_cookie = true;
565
-                                force_ssl_admin(true);
566
-                            }
567
-                        }
568
-                    }
569
-
570
-                    $redirect_to = $_REQUEST['redirect_to'];
571
-
572
-                    if (!isset($_REQUEST['redirect_to']) || $_REQUEST['redirect_to'] == '') {
573
-                        if (isset($_SERVER['HTTP_REFERER']) && strstr($_SERVER['HTTP_REFERER'], home_url())) {
574
-                            $redirect_to = $_SERVER['HTTP_REFERER'];
575
-                        } else {
576
-                            $redirect_to = home_url();
577
-                        }
578
-
579
-                    }
580
-
581
-                    if (isset($_REQUEST['redirect_add_listing']) && $_REQUEST['redirect_add_listing'] != '') {
582
-
583
-                        $redirect_to = $_REQUEST['redirect_add_listing'];
584
-                    }
585
-
586
-
587
-                    if (!$secure_cookie && is_ssl() && force_ssl_admin() && !force_ssl_admin() && (0 !== strpos($redirect_to, 'https')) && (0 === strpos($redirect_to, 'http')))
588
-                        $secure_cookie = false;
589
-
590
-                    $user = wp_signon('', $secure_cookie);
591
-
592
-                    $requested_redirect_to = isset($_REQUEST['redirect_add_listing']) && $_REQUEST['redirect_add_listing'] != '' ? $_REQUEST['redirect_add_listing'] : (isset($_REQUEST['redirect_to']) ? $_REQUEST['redirect_to'] : '');
593
-                    /**
594
-                     * Filter the login redirect URL.
595
-                     *
596
-                     * @since 1.4.9
597
-                     * @param string $redirect_to The redirect destination URL.
598
-                     * @param string $requested_redirect_to The requested redirect destination URL passed as a parameter.
599
-                     * @param WP_User|WP_Error $user WP_User object if login was successful, WP_Error object otherwise.
600
-                     */
601
-                    $redirect_to = apply_filters('login_redirect', $redirect_to, $requested_redirect_to, $user);
602
-
603
-
604
-                    if (!is_wp_error($user)) {
605
-                        wp_safe_redirect($redirect_to);
606
-                        exit();
607
-                    }
608
-                    exit();
609
-                }
610
-            }
611
-
612
-            break;
613
-
614
-        case 'login' :
615
-        default:
616
-            $secure_cookie = '';
617
-
618
-            if (!empty($_POST['log'])) {
619
-                $user_name = sanitize_user($_POST['log']);
620
-                if ($user = get_user_by('login', $user_name)) {
621
-
622
-                    if (get_user_option('use_ssl', $user->ID)) {
623
-                        $secure_cookie = true;
624
-                        force_ssl_admin(true);
625
-                    }
626
-                } elseif ($user = get_user_by('email', $user_name)) {
627
-                    $_POST['log'] = $user->user_login; // If signing in by email, set the username for normal WP login
628
-                    if (get_user_option('use_ssl', $user->ID)) {
629
-                        $secure_cookie = true;
630
-                        force_ssl_admin(true);
631
-                    }
632
-                }
633
-            }
634
-            ///////////////////////////
635
-            if (isset($_REQUEST['redirect_add_listing'])) {
636
-                $_REQUEST['redirect_to'] = $_REQUEST['redirect_add_listing'];
637
-            }
638
-
639
-
640
-            if (!isset($_REQUEST['redirect_to']) || $_REQUEST['redirect_to'] == '') {
641
-                if (is_user_logged_in()) :
642
-                    $user_ID = !empty($user->ID) ? $user->ID : get_current_user_id();
643
-                    $post_types = geodir_get_posttypes();
423
+	global $errors;
424
+	$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : 'login';
425
+
426
+	$errors = new WP_Error();
427
+
428
+	if (isset($_GET['key']))
429
+		$action = 'resetpass';
430
+
431
+	// validate action so as to default to the login screen
432
+	if (!in_array($action, array('logout', 'lostpassword', 'retrievepassword', 'resetpass', 'rp', 'register', 'login')) && false === has_filter('login_form_' . $action))
433
+		$action = 'login';
434
+
435
+	nocache_headers();
436
+
437
+	if (defined('RELOCATE')) { // Move flag is set
438
+		if (isset($_SERVER['PATH_INFO']) && ($_SERVER['PATH_INFO'] != $_SERVER['PHP_SELF']))
439
+			$_SERVER['PHP_SELF'] = str_replace($_SERVER['PATH_INFO'], '', $_SERVER['PHP_SELF']);
440
+
441
+		$schema = (isset($_SERVER['HTTPS']) && geodir_strtolower($_SERVER['HTTPS']) == 'on') ? 'https://' : 'http://';
442
+		if (dirname($schema . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']) != home_url())
443
+			update_option('siteurl', dirname($schema . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']));
444
+	}
445
+
446
+	//Set a cookie now to see if they are supported by the browser.
447
+	//setcookie(TEST_COOKIE, 'WP Cookie check', 0, COOKIEPATH, COOKIE_DOMAIN);
448
+	if (SITECOOKIEPATH != COOKIEPATH)
449
+		setcookie(TEST_COOKIE, 'WP Cookie check', 0, SITECOOKIEPATH, COOKIE_DOMAIN);
450
+
451
+	/**
452
+	 * Allow plugins to override the default actions, and to add extra actions if they want on the register/signin page.
453
+	 *
454
+	 * Used dynamic hook login_form_$action
455
+	 *
456
+	 * @since 1.0.0
457
+	 */
458
+	do_action('login_form_' . $action);
459
+
460
+	$http_post = ('POST' == $_SERVER['REQUEST_METHOD']);
461
+
462
+	switch ($action):
463
+
464
+		case 'logout' :
465
+			//check_admin_referer('log-out');
466
+			wp_logout();
467
+
468
+			$redirect_to = $_SERVER['HTTP_REFERER'];
469
+			//$redirect_to = home_url().'/?ptype=login&loggedout=true';
470
+			if (isset($_REQUEST['redirect_to']))
471
+				$redirect_to = $_REQUEST['redirect_to'];
472
+			$redirect_to = home_url();
473
+			wp_safe_redirect($redirect_to);
474
+			exit();
475
+
476
+			break;
477
+
478
+		case 'lostpassword' :
479
+		case 'retrievepassword' :
480
+			if ($http_post) {
481
+				$errors = geodir_retrieve_password();
482
+				$error_message = isset($errors->errors['invalid_email'][0]) ? $errors->errors['invalid_email'][0] : '';
483
+				if (!is_wp_error($errors)) {
484
+					wp_redirect(geodir_login_url(array('checkemail'=>'confirm')));
485
+					gd_die();
486
+				} else {
487
+					wp_redirect(geodir_login_url(array('forgot' => 1, 'emsg'=>'fw')));
488
+					gd_die();
489
+				}
490
+			}
491
+			if (isset($_GET['error']) && 'invalidkey' == $_GET['error']) $errors->add('invalidkey', __('Sorry, that key does not appear to be valid.', 'geodirectory'));
492
+		/**
493
+		 * Called in the geodir_user_signup() function during the lostpassword case.
494
+		 *
495
+		 * @since 1.0.0
496
+		 */
497
+		do_action('lost_password');
498
+			$message = '<div class="sucess_msg">' . ENTER_USER_EMAIL_NEW_PW_MSG . '</div>';
499
+			$user_login = isset($_POST['user_login']) ? stripslashes($_POST['user_login']) : '';
500
+
501
+			break;
502
+
503
+		case 'resetpass' :
504
+		case 'rp' :
505
+			$errors = reset_password($_GET['key'], $_GET['login']);
506
+
507
+			if (!is_wp_error($errors)) {
508
+				wp_redirect(geodir_login_url(array('checkemail'=>'newpass')));
509
+				exit();
510
+			}
511
+
512
+			wp_redirect(geodir_login_url(array('error'=>'invalidkey','action'=>'lostpassword')));
513
+			exit();
514
+
515
+			break;
516
+
517
+		case 'register' :
518
+			############################### fix by Stiofan -  HebTech.co.uk ### SECURITY FIX ##############################
519
+			if (!get_option('users_can_register')) {
520
+				wp_redirect(geodir_login_url(array('emsg'=>'regnewusr')));
521
+				exit();
522
+			}
523
+			############################### fix by Stiofan -  HebTech.co.uk ### SECURITY FIX ##############################
524
+			global $user_email, $user_fname;
525
+			$user_login = '';
526
+			$user_email = '';
527
+			if ($http_post) {
528
+				$user_login = $_POST['user_email'];
529
+				$user_email = $_POST['user_email'];
530
+				$user_fname = $_POST['user_fname'];
531
+
532
+				$errors = geodir_register_new_user($user_login, $user_email);
533
+
534
+				/* display error in registration form */
535
+				if (is_wp_error($errors)) {
536
+					$error_code = $errors->get_error_code();
537
+					$error_message = $errors->get_error_message($error_code);
538
+					if (!isset($_POST['user_login']) && ($error_code == 'empty_username' || $error_code == 'invalid_username' || $error_code == 'username_exists')) {
539
+						if ($error_code == 'empty_username') {
540
+							$error_code = 'empty_email';
541
+						} else if ($error_code == 'invalid_username') {
542
+							$error_code = 'invalid_email';
543
+						} else if ($error_code == 'username_exists') {
544
+							$error_code = 'email_exists';
545
+						}
546
+
547
+						$error_message = $errors->get_error_message($error_code);
548
+					}
549
+					global $geodir_signup_error;
550
+					$geodir_signup_error = $error_message;
551
+				}
552
+
553
+				if (!is_wp_error($errors)) {
554
+					$_POST['log'] = $user_login;
555
+					$_POST['pwd'] = $errors[1];
556
+					$_POST['testcookie'] = 1;
557
+
558
+					$secure_cookie = '';
559
+					// If the user wants ssl but the session is not ssl, force a secure cookie.
560
+					if (!empty($_POST['log'])) {
561
+						$user_name = sanitize_user($_POST['log']);
562
+						if ($user = get_user_by('email', $user_name)) {
563
+							if (get_user_option('use_ssl', $user->ID)) {
564
+								$secure_cookie = true;
565
+								force_ssl_admin(true);
566
+							}
567
+						}
568
+					}
569
+
570
+					$redirect_to = $_REQUEST['redirect_to'];
571
+
572
+					if (!isset($_REQUEST['redirect_to']) || $_REQUEST['redirect_to'] == '') {
573
+						if (isset($_SERVER['HTTP_REFERER']) && strstr($_SERVER['HTTP_REFERER'], home_url())) {
574
+							$redirect_to = $_SERVER['HTTP_REFERER'];
575
+						} else {
576
+							$redirect_to = home_url();
577
+						}
578
+
579
+					}
580
+
581
+					if (isset($_REQUEST['redirect_add_listing']) && $_REQUEST['redirect_add_listing'] != '') {
582
+
583
+						$redirect_to = $_REQUEST['redirect_add_listing'];
584
+					}
585
+
586
+
587
+					if (!$secure_cookie && is_ssl() && force_ssl_admin() && !force_ssl_admin() && (0 !== strpos($redirect_to, 'https')) && (0 === strpos($redirect_to, 'http')))
588
+						$secure_cookie = false;
589
+
590
+					$user = wp_signon('', $secure_cookie);
591
+
592
+					$requested_redirect_to = isset($_REQUEST['redirect_add_listing']) && $_REQUEST['redirect_add_listing'] != '' ? $_REQUEST['redirect_add_listing'] : (isset($_REQUEST['redirect_to']) ? $_REQUEST['redirect_to'] : '');
593
+					/**
594
+					 * Filter the login redirect URL.
595
+					 *
596
+					 * @since 1.4.9
597
+					 * @param string $redirect_to The redirect destination URL.
598
+					 * @param string $requested_redirect_to The requested redirect destination URL passed as a parameter.
599
+					 * @param WP_User|WP_Error $user WP_User object if login was successful, WP_Error object otherwise.
600
+					 */
601
+					$redirect_to = apply_filters('login_redirect', $redirect_to, $requested_redirect_to, $user);
602
+
603
+
604
+					if (!is_wp_error($user)) {
605
+						wp_safe_redirect($redirect_to);
606
+						exit();
607
+					}
608
+					exit();
609
+				}
610
+			}
611
+
612
+			break;
613
+
614
+		case 'login' :
615
+		default:
616
+			$secure_cookie = '';
617
+
618
+			if (!empty($_POST['log'])) {
619
+				$user_name = sanitize_user($_POST['log']);
620
+				if ($user = get_user_by('login', $user_name)) {
621
+
622
+					if (get_user_option('use_ssl', $user->ID)) {
623
+						$secure_cookie = true;
624
+						force_ssl_admin(true);
625
+					}
626
+				} elseif ($user = get_user_by('email', $user_name)) {
627
+					$_POST['log'] = $user->user_login; // If signing in by email, set the username for normal WP login
628
+					if (get_user_option('use_ssl', $user->ID)) {
629
+						$secure_cookie = true;
630
+						force_ssl_admin(true);
631
+					}
632
+				}
633
+			}
634
+			///////////////////////////
635
+			if (isset($_REQUEST['redirect_add_listing'])) {
636
+				$_REQUEST['redirect_to'] = $_REQUEST['redirect_add_listing'];
637
+			}
638
+
639
+
640
+			if (!isset($_REQUEST['redirect_to']) || $_REQUEST['redirect_to'] == '') {
641
+				if (is_user_logged_in()) :
642
+					$user_ID = !empty($user->ID) ? $user->ID : get_current_user_id();
643
+					$post_types = geodir_get_posttypes();
644 644
                     
645
-                    if ( !empty( $_REQUEST['stype'] ) ) {
646
-                        $dashboard_post_type = sanitize_text_field($_REQUEST['stype']);
647
-                    } else {
648
-                        $user_listings = geodir_user_post_listing_count( $user_ID );
649
-                        if ( !empty( $user_listings ) && $dashboard_post_types = array_keys( $user_listings ) ) {
650
-                            $dashboard_post_type = $dashboard_post_types[0];
651
-                        }
652
-                    }
653
-                    if ( !( !empty( $dashboard_post_type ) && in_array( $dashboard_post_type, $post_types ) ) ) {
654
-                        $dashboard_post_type = $post_types[0];
655
-                    }
645
+					if ( !empty( $_REQUEST['stype'] ) ) {
646
+						$dashboard_post_type = sanitize_text_field($_REQUEST['stype']);
647
+					} else {
648
+						$user_listings = geodir_user_post_listing_count( $user_ID );
649
+						if ( !empty( $user_listings ) && $dashboard_post_types = array_keys( $user_listings ) ) {
650
+							$dashboard_post_type = $dashboard_post_types[0];
651
+						}
652
+					}
653
+					if ( !( !empty( $dashboard_post_type ) && in_array( $dashboard_post_type, $post_types ) ) ) {
654
+						$dashboard_post_type = $post_types[0];
655
+					}
656 656
                     
657
-                    $author_link = get_author_posts_url($user_ID);
658
-                    $default_author_link = geodir_getlink($author_link, array('geodir_dashbord' => 'true', 'stype' => $dashboard_post_type), false);
659
-
660
-                    /**
661
-                     * Filter the author link.
662
-                     *
663
-                     * @since 1.0.0
664
-                     *
665
-                     * @param string $default_author_link Default author link.
666
-                     * @param int $user_ID The user ID.
667
-                     */
668
-                    $default_author_link = apply_filters('geodir_dashboard_author_link', $default_author_link, $user_ID);
669
-
670
-                    $_REQUEST['redirect_to'] = $default_author_link;
671
-                else:
672
-                    $_REQUEST['redirect_to'] = home_url();
673
-                endif;
674
-
675
-            }
676
-            if (isset($_REQUEST['redirect_to'])) {
677
-                $redirect_to = $_REQUEST['redirect_to'];
678
-                // Redirect to https if user wants ssl
679
-                if ($secure_cookie && false !== strpos($redirect_to, 'wp-admin'))
680
-                    $redirect_to = preg_replace('|^http://|', 'https://', $redirect_to);
681
-            } else {
682
-                $redirect_to = admin_url();
683
-            }
684
-
685
-            if (!$secure_cookie && is_ssl() && force_ssl_admin() && !force_ssl_admin() && (0 !== strpos($redirect_to, 'https')) && (0 === strpos($redirect_to, 'http')))
686
-                $secure_cookie = false;
687
-            $user = wp_signon('', $secure_cookie);
688
-
689
-
690
-            /**
691
-             * Filter the login redirect URL.
692
-             *
693
-             * @since 1.4.9
694
-             * @param string $redirect_to The redirect destination URL.
695
-             * @param WP_User|WP_Error $user WP_User object if login was successful, WP_Error object otherwise.
696
-             */
697
-            $redirect_to = apply_filters('login_redirect', $redirect_to, isset($_REQUEST['redirect_to']) ? $_REQUEST['redirect_to'] : '', $user);
698
-
699
-            if (is_wp_error($user)) {
700
-                if (isset($_SERVER['HTTP_REFERER']) && strstr($_SERVER['HTTP_REFERER'], 'ptype=property_submit') && $_POST['log'] != '' && $_POST['pwd'] != '') {
701
-                    wp_redirect($_SERVER['HTTP_REFERER'] . '&emsg=1');
702
-                }
703
-            }
704
-            if (!is_wp_error($user)) {
705
-
706
-                // Some servers are not logging the user in properly after wp_signon, se we set the user here.
707
-                //wp_set_current_user($user->ID);
708
-                //echo '###';exit;
709
-
710
-                if ($redirect_to) {
711
-                    wp_redirect($redirect_to);
712
-                } else {
713
-                    wp_redirect(home_url());
714
-                }
715
-                gd_die();
716
-            }
717
-
718
-            $errors = $user;
719
-
720
-            // Clear errors if loggedout is set.
721
-            if (!empty($_GET['loggedout']))
722
-                $errors = new WP_Error();
723
-            // If cookies are disabled we can't log in even with a valid user+pass
724
-            if (isset($_POST['testcookie']) && empty($_COOKIE[TEST_COOKIE]))
725
-                $errors->add('test_cookie', __("<strong>ERROR</strong>: Cookies are blocked or not supported by your browser. You must <a href='http://www.google.com/cookies.html'>enable cookies</a> to use WordPress.", 'geodirectory'));
726
-
727
-            // Some parts of this script use the main login form to display a message
728
-            if (isset($_GET['loggedout']) && TRUE == $_GET['loggedout']) {
729
-                $successmsg = '<div class="sucess_msg">' . YOU_ARE_LOGED_OUT_MSG . '</div>';
730
-            } elseif (isset($_GET['registration']) && 'disabled' == $_GET['registration']) {
731
-                $successmsg = USER_REG_NOT_ALLOW_MSG;
732
-            } elseif (isset($_GET['checkemail']) && 'confirm' == $_GET['checkemail']) {
733
-                $successmsg = EMAIL_CONFIRM_LINK_MSG;
734
-            } elseif (isset($_GET['checkemail']) && 'newpass' == $_GET['checkemail']) {
735
-                $successmsg = NEW_PW_EMAIL_MSG;
736
-            } elseif (isset($_GET['checkemail']) && 'registered' == $_GET['checkemail']) {
737
-                $successmsg = REG_COMPLETE_MSG;
738
-            }
739
-
740
-            if ((isset($_POST['log']) && $_POST['log'] != '' && $errors) || ((!isset($_POST['log']) || $_POST['log'] == '') && isset($_REQUEST['testcookie']) && $_REQUEST['testcookie'])) {
741
-                if (isset($_REQUEST['pagetype']) && $_REQUEST['pagetype'] != '') {
742
-                    wp_redirect($_REQUEST['pagetype'] . '&emsg=1');
743
-                } else {
744
-                    wp_redirect(geodir_login_url(array('logemsg'=>'1','redirect_to'=>urlencode($_REQUEST['redirect_to']))));
745
-                }
746
-                gd_die();
747
-            }
748
-            break;
749
-    endswitch; // end action switch
657
+					$author_link = get_author_posts_url($user_ID);
658
+					$default_author_link = geodir_getlink($author_link, array('geodir_dashbord' => 'true', 'stype' => $dashboard_post_type), false);
659
+
660
+					/**
661
+					 * Filter the author link.
662
+					 *
663
+					 * @since 1.0.0
664
+					 *
665
+					 * @param string $default_author_link Default author link.
666
+					 * @param int $user_ID The user ID.
667
+					 */
668
+					$default_author_link = apply_filters('geodir_dashboard_author_link', $default_author_link, $user_ID);
669
+
670
+					$_REQUEST['redirect_to'] = $default_author_link;
671
+				else:
672
+					$_REQUEST['redirect_to'] = home_url();
673
+				endif;
674
+
675
+			}
676
+			if (isset($_REQUEST['redirect_to'])) {
677
+				$redirect_to = $_REQUEST['redirect_to'];
678
+				// Redirect to https if user wants ssl
679
+				if ($secure_cookie && false !== strpos($redirect_to, 'wp-admin'))
680
+					$redirect_to = preg_replace('|^http://|', 'https://', $redirect_to);
681
+			} else {
682
+				$redirect_to = admin_url();
683
+			}
684
+
685
+			if (!$secure_cookie && is_ssl() && force_ssl_admin() && !force_ssl_admin() && (0 !== strpos($redirect_to, 'https')) && (0 === strpos($redirect_to, 'http')))
686
+				$secure_cookie = false;
687
+			$user = wp_signon('', $secure_cookie);
688
+
689
+
690
+			/**
691
+			 * Filter the login redirect URL.
692
+			 *
693
+			 * @since 1.4.9
694
+			 * @param string $redirect_to The redirect destination URL.
695
+			 * @param WP_User|WP_Error $user WP_User object if login was successful, WP_Error object otherwise.
696
+			 */
697
+			$redirect_to = apply_filters('login_redirect', $redirect_to, isset($_REQUEST['redirect_to']) ? $_REQUEST['redirect_to'] : '', $user);
698
+
699
+			if (is_wp_error($user)) {
700
+				if (isset($_SERVER['HTTP_REFERER']) && strstr($_SERVER['HTTP_REFERER'], 'ptype=property_submit') && $_POST['log'] != '' && $_POST['pwd'] != '') {
701
+					wp_redirect($_SERVER['HTTP_REFERER'] . '&emsg=1');
702
+				}
703
+			}
704
+			if (!is_wp_error($user)) {
705
+
706
+				// Some servers are not logging the user in properly after wp_signon, se we set the user here.
707
+				//wp_set_current_user($user->ID);
708
+				//echo '###';exit;
709
+
710
+				if ($redirect_to) {
711
+					wp_redirect($redirect_to);
712
+				} else {
713
+					wp_redirect(home_url());
714
+				}
715
+				gd_die();
716
+			}
717
+
718
+			$errors = $user;
719
+
720
+			// Clear errors if loggedout is set.
721
+			if (!empty($_GET['loggedout']))
722
+				$errors = new WP_Error();
723
+			// If cookies are disabled we can't log in even with a valid user+pass
724
+			if (isset($_POST['testcookie']) && empty($_COOKIE[TEST_COOKIE]))
725
+				$errors->add('test_cookie', __("<strong>ERROR</strong>: Cookies are blocked or not supported by your browser. You must <a href='http://www.google.com/cookies.html'>enable cookies</a> to use WordPress.", 'geodirectory'));
726
+
727
+			// Some parts of this script use the main login form to display a message
728
+			if (isset($_GET['loggedout']) && TRUE == $_GET['loggedout']) {
729
+				$successmsg = '<div class="sucess_msg">' . YOU_ARE_LOGED_OUT_MSG . '</div>';
730
+			} elseif (isset($_GET['registration']) && 'disabled' == $_GET['registration']) {
731
+				$successmsg = USER_REG_NOT_ALLOW_MSG;
732
+			} elseif (isset($_GET['checkemail']) && 'confirm' == $_GET['checkemail']) {
733
+				$successmsg = EMAIL_CONFIRM_LINK_MSG;
734
+			} elseif (isset($_GET['checkemail']) && 'newpass' == $_GET['checkemail']) {
735
+				$successmsg = NEW_PW_EMAIL_MSG;
736
+			} elseif (isset($_GET['checkemail']) && 'registered' == $_GET['checkemail']) {
737
+				$successmsg = REG_COMPLETE_MSG;
738
+			}
739
+
740
+			if ((isset($_POST['log']) && $_POST['log'] != '' && $errors) || ((!isset($_POST['log']) || $_POST['log'] == '') && isset($_REQUEST['testcookie']) && $_REQUEST['testcookie'])) {
741
+				if (isset($_REQUEST['pagetype']) && $_REQUEST['pagetype'] != '') {
742
+					wp_redirect($_REQUEST['pagetype'] . '&emsg=1');
743
+				} else {
744
+					wp_redirect(geodir_login_url(array('logemsg'=>'1','redirect_to'=>urlencode($_REQUEST['redirect_to']))));
745
+				}
746
+				gd_die();
747
+			}
748
+			break;
749
+	endswitch; // end action switch
750 750
 }
751 751
 
752 752
 function geodir_generate_user_nicename( $display_name, $user_login ) {
Please login to merge, or discard this patch.
Spacing   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
         if ($redirect) {
23 23
             ?>
24 24
             <script type="text/javascript">
25
-                window.location.href = '<?php echo geodir_login_url();?>';
25
+                window.location.href = '<?php echo geodir_login_url(); ?>';
26 26
             </script>
27 27
         <?php
28 28
         } else
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
             wp_redirect(preg_replace('|^http://|', 'https://', $_SERVER['REQUEST_URI']));
48 48
             exit();
49 49
         } else {
50
-            wp_redirect('https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
50
+            wp_redirect('https://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']);
51 51
             exit();
52 52
         }
53 53
     }
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
      * @param string $message Login message.
61 61
      */
62 62
     $message = apply_filters('login_message', $message);
63
-    if (!empty($message)) echo $message . "\n";
63
+    if (!empty($message)) echo $message."\n";
64 64
 
65 65
 }
66 66
 
@@ -208,9 +208,9 @@  discard block
 block discarded – undo
208 208
 
209 209
     wp_set_password($new_pass, $user->ID);
210 210
     update_user_meta($user->ID, 'default_password_nag', true); //Set up the Password change nag.
211
-    $message = '<p><b>' . __('Your login Information :', 'geodirectory') . '</b></p>';
212
-    $message .= '<p>' . sprintf(__('Username: %s', 'geodirectory'), $user->user_login) . "</p>";
213
-    $message .= '<p>' . sprintf(__('Password: %s', 'geodirectory'), $new_pass) . "</p>";
211
+    $message = '<p><b>'.__('Your login Information :', 'geodirectory').'</b></p>';
212
+    $message .= '<p>'.sprintf(__('Username: %s', 'geodirectory'), $user->user_login)."</p>";
213
+    $message .= '<p>'.sprintf(__('Password: %s', 'geodirectory'), $new_pass)."</p>";
214 214
     //$message .= '<p>You can login to : <a href="'.home_url().'/?ptype=login' . "\">Login</a> or the URL is :  ".home_url()."/?ptype=login</p>";
215 215
     //$message .= '<p>Thank You,<br> '.get_option('blogname').'</p>';
216 216
     $user_email = $user_data->user_email;
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
      */
237 237
     $message = apply_filters('password_reset_message', $message, $new_pass);
238 238
     //geodir_sendEmail($fromEmail,$fromEmailName,$user_email,$user_name,$title,$message,$extra='');///forgot password email
239
-    geodir_sendEmail($fromEmail, $fromEmailName, $user_email, $user_name, $title, $message, $extra = '', 'forgot_password', $post_id = '', $user->ID);///forgot password email
239
+    geodir_sendEmail($fromEmail, $fromEmailName, $user_email, $user_name, $title, $message, $extra = '', 'forgot_password', $post_id = '', $user->ID); ///forgot password email
240 240
 
241 241
     return true;
242 242
 }
@@ -315,7 +315,7 @@  discard block
 block discarded – undo
315 315
      *
316 316
      * @param object $errors Registration error messages.
317 317
      */
318
-    $errors = apply_filters('registration_errors', $errors,$user_login,$user_email);
318
+    $errors = apply_filters('registration_errors', $errors, $user_login, $user_email);
319 319
 
320 320
     if ($errors->get_error_code())
321 321
         return $errors;
@@ -337,8 +337,8 @@  discard block
 block discarded – undo
337 337
     $user_twitter = $_POST['user_twitter'];	*/
338 338
     $user_fname = sanitize_user($_POST['user_fname']);
339 339
     $user_fname = str_replace(",", "", $user_fname);
340
-	if ( empty( $user_fname ) ) {
341
-		$user_fname = strstr( $user_login, '@', true );
340
+	if (empty($user_fname)) {
341
+		$user_fname = strstr($user_login, '@', true);
342 342
 	}
343 343
 
344 344
     /**
@@ -368,7 +368,7 @@  discard block
 block discarded – undo
368 368
     update_user_meta($user_id, 'first_name', $userName); // User Address Information Here
369 369
     //update_user_meta($user_id, 'last_name', $_POST['user_lname']); // User Address Information Here
370 370
 
371
-    $user_nicename = geodir_generate_user_nicename( $userName, $user_login );
371
+    $user_nicename = geodir_generate_user_nicename($userName, $user_login);
372 372
 
373 373
     $updateUsersql = $wpdb->prepare("update $wpdb->users set user_url=%s, user_nicename=%s, display_name=%s  where ID=%d", array($user_web, $user_nicename, $userName, $user_id));
374 374
 
@@ -392,13 +392,13 @@  discard block
 block discarded – undo
392 392
         ///////REGISTRATION EMAIL START//////
393 393
         $fromEmail = geodir_get_site_email_id();
394 394
         $fromEmailName = get_site_emailName();
395
-        $message = __('<p><b>' . __('Your login Information :', 'geodirectory') . '</b></p>
396
-<p>' . __('Username:', 'geodirectory') . ' ' . $user_login . '</p>
397
-<p>' . __('Password:', 'geodirectory') . ' ' . $user_pass . '</p>');
395
+        $message = __('<p><b>'.__('Your login Information :', 'geodirectory').'</b></p>
396
+<p>' . __('Username:', 'geodirectory').' '.$user_login.'</p>
397
+<p>' . __('Password:', 'geodirectory').' '.$user_pass.'</p>');
398 398
 
399 399
         /////////////customer email//////////////
400 400
         //geodir_sendEmail($fromEmail,$fromEmailName,$user_email,$userName,$subject,$client_message,$extra='');///To client email
401
-        geodir_sendEmail($fromEmail, $fromEmailName, $user_email, $userName, '', $message, '', 'registration', '', $user_id);/// registration email
401
+        geodir_sendEmail($fromEmail, $fromEmailName, $user_email, $userName, '', $message, '', 'registration', '', $user_id); /// registration email
402 402
         //////REGISTRATION EMAIL END////////
403 403
     }
404 404
 
@@ -429,7 +429,7 @@  discard block
 block discarded – undo
429 429
         $action = 'resetpass';
430 430
 
431 431
     // validate action so as to default to the login screen
432
-    if (!in_array($action, array('logout', 'lostpassword', 'retrievepassword', 'resetpass', 'rp', 'register', 'login')) && false === has_filter('login_form_' . $action))
432
+    if (!in_array($action, array('logout', 'lostpassword', 'retrievepassword', 'resetpass', 'rp', 'register', 'login')) && false === has_filter('login_form_'.$action))
433 433
         $action = 'login';
434 434
 
435 435
     nocache_headers();
@@ -439,8 +439,8 @@  discard block
 block discarded – undo
439 439
             $_SERVER['PHP_SELF'] = str_replace($_SERVER['PATH_INFO'], '', $_SERVER['PHP_SELF']);
440 440
 
441 441
         $schema = (isset($_SERVER['HTTPS']) && geodir_strtolower($_SERVER['HTTPS']) == 'on') ? 'https://' : 'http://';
442
-        if (dirname($schema . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']) != home_url())
443
-            update_option('siteurl', dirname($schema . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']));
442
+        if (dirname($schema.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']) != home_url())
443
+            update_option('siteurl', dirname($schema.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']));
444 444
     }
445 445
 
446 446
     //Set a cookie now to see if they are supported by the browser.
@@ -455,7 +455,7 @@  discard block
 block discarded – undo
455 455
      *
456 456
      * @since 1.0.0
457 457
      */
458
-    do_action('login_form_' . $action);
458
+    do_action('login_form_'.$action);
459 459
 
460 460
     $http_post = ('POST' == $_SERVER['REQUEST_METHOD']);
461 461
 
@@ -495,7 +495,7 @@  discard block
 block discarded – undo
495 495
          * @since 1.0.0
496 496
          */
497 497
         do_action('lost_password');
498
-            $message = '<div class="sucess_msg">' . ENTER_USER_EMAIL_NEW_PW_MSG . '</div>';
498
+            $message = '<div class="sucess_msg">'.ENTER_USER_EMAIL_NEW_PW_MSG.'</div>';
499 499
             $user_login = isset($_POST['user_login']) ? stripslashes($_POST['user_login']) : '';
500 500
 
501 501
             break;
@@ -509,7 +509,7 @@  discard block
 block discarded – undo
509 509
                 exit();
510 510
             }
511 511
 
512
-            wp_redirect(geodir_login_url(array('error'=>'invalidkey','action'=>'lostpassword')));
512
+            wp_redirect(geodir_login_url(array('error'=>'invalidkey', 'action'=>'lostpassword')));
513 513
             exit();
514 514
 
515 515
             break;
@@ -642,15 +642,15 @@  discard block
 block discarded – undo
642 642
                     $user_ID = !empty($user->ID) ? $user->ID : get_current_user_id();
643 643
                     $post_types = geodir_get_posttypes();
644 644
                     
645
-                    if ( !empty( $_REQUEST['stype'] ) ) {
645
+                    if (!empty($_REQUEST['stype'])) {
646 646
                         $dashboard_post_type = sanitize_text_field($_REQUEST['stype']);
647 647
                     } else {
648
-                        $user_listings = geodir_user_post_listing_count( $user_ID );
649
-                        if ( !empty( $user_listings ) && $dashboard_post_types = array_keys( $user_listings ) ) {
648
+                        $user_listings = geodir_user_post_listing_count($user_ID);
649
+                        if (!empty($user_listings) && $dashboard_post_types = array_keys($user_listings)) {
650 650
                             $dashboard_post_type = $dashboard_post_types[0];
651 651
                         }
652 652
                     }
653
-                    if ( !( !empty( $dashboard_post_type ) && in_array( $dashboard_post_type, $post_types ) ) ) {
653
+                    if (!(!empty($dashboard_post_type) && in_array($dashboard_post_type, $post_types))) {
654 654
                         $dashboard_post_type = $post_types[0];
655 655
                     }
656 656
                     
@@ -698,7 +698,7 @@  discard block
 block discarded – undo
698 698
 
699 699
             if (is_wp_error($user)) {
700 700
                 if (isset($_SERVER['HTTP_REFERER']) && strstr($_SERVER['HTTP_REFERER'], 'ptype=property_submit') && $_POST['log'] != '' && $_POST['pwd'] != '') {
701
-                    wp_redirect($_SERVER['HTTP_REFERER'] . '&emsg=1');
701
+                    wp_redirect($_SERVER['HTTP_REFERER'].'&emsg=1');
702 702
                 }
703 703
             }
704 704
             if (!is_wp_error($user)) {
@@ -726,7 +726,7 @@  discard block
 block discarded – undo
726 726
 
727 727
             // Some parts of this script use the main login form to display a message
728 728
             if (isset($_GET['loggedout']) && TRUE == $_GET['loggedout']) {
729
-                $successmsg = '<div class="sucess_msg">' . YOU_ARE_LOGED_OUT_MSG . '</div>';
729
+                $successmsg = '<div class="sucess_msg">'.YOU_ARE_LOGED_OUT_MSG.'</div>';
730 730
             } elseif (isset($_GET['registration']) && 'disabled' == $_GET['registration']) {
731 731
                 $successmsg = USER_REG_NOT_ALLOW_MSG;
732 732
             } elseif (isset($_GET['checkemail']) && 'confirm' == $_GET['checkemail']) {
@@ -739,9 +739,9 @@  discard block
 block discarded – undo
739 739
 
740 740
             if ((isset($_POST['log']) && $_POST['log'] != '' && $errors) || ((!isset($_POST['log']) || $_POST['log'] == '') && isset($_REQUEST['testcookie']) && $_REQUEST['testcookie'])) {
741 741
                 if (isset($_REQUEST['pagetype']) && $_REQUEST['pagetype'] != '') {
742
-                    wp_redirect($_REQUEST['pagetype'] . '&emsg=1');
742
+                    wp_redirect($_REQUEST['pagetype'].'&emsg=1');
743 743
                 } else {
744
-                    wp_redirect(geodir_login_url(array('logemsg'=>'1','redirect_to'=>urlencode($_REQUEST['redirect_to']))));
744
+                    wp_redirect(geodir_login_url(array('logemsg'=>'1', 'redirect_to'=>urlencode($_REQUEST['redirect_to']))));
745 745
                 }
746 746
                 gd_die();
747 747
             }
@@ -749,28 +749,28 @@  discard block
 block discarded – undo
749 749
     endswitch; // end action switch
750 750
 }
751 751
 
752
-function geodir_generate_user_nicename( $display_name, $user_login ) {
752
+function geodir_generate_user_nicename($display_name, $user_login) {
753 753
 	global $wpdb;
754 754
 	$user_nicename = '';
755
-	if ( ! empty( $display_name ) ) {
756
-		$user_nicename = sanitize_user( $display_name, true );
755
+	if (!empty($display_name)) {
756
+		$user_nicename = sanitize_user($display_name, true);
757 757
 	}
758
-	if ( empty( $user_nicename ) ) {
758
+	if (empty($user_nicename)) {
759 759
 		$user_nicename = $user_login;
760 760
 	}
761
-	$user_nicename = mb_substr( $user_nicename, 0, 50 );
762
-	$user_nicename = sanitize_title( $user_nicename );
763
-	$user_nicename = apply_filters( 'pre_user_nicename', $user_nicename );
761
+	$user_nicename = mb_substr($user_nicename, 0, 50);
762
+	$user_nicename = sanitize_title($user_nicename);
763
+	$user_nicename = apply_filters('pre_user_nicename', $user_nicename);
764 764
 				
765
-	$user_nicename_check = $wpdb->get_var( $wpdb->prepare("SELECT ID FROM $wpdb->users WHERE user_nicename = %s AND user_login != %s LIMIT 1" , $user_nicename, $user_login));
765
+	$user_nicename_check = $wpdb->get_var($wpdb->prepare("SELECT ID FROM $wpdb->users WHERE user_nicename = %s AND user_login != %s LIMIT 1", $user_nicename, $user_login));
766 766
 		
767
-	if ( $user_nicename_check ) {
767
+	if ($user_nicename_check) {
768 768
 		$suffix = 2;
769 769
 		while ($user_nicename_check) {
770 770
 			// user_nicename allows 50 chars. Subtract one for a hyphen, plus the length of the suffix.
771
-			$base_length = 49 - mb_strlen( $suffix );
772
-			$alt_user_nicename = mb_substr( $user_nicename, 0, $base_length ) . "-$suffix";
773
-			$user_nicename_check = $wpdb->get_var( $wpdb->prepare("SELECT ID FROM $wpdb->users WHERE user_nicename = %s AND user_login != %s LIMIT 1" , $alt_user_nicename, $user_login));
771
+			$base_length = 49 - mb_strlen($suffix);
772
+			$alt_user_nicename = mb_substr($user_nicename, 0, $base_length)."-$suffix";
773
+			$user_nicename_check = $wpdb->get_var($wpdb->prepare("SELECT ID FROM $wpdb->users WHERE user_nicename = %s AND user_login != %s LIMIT 1", $alt_user_nicename, $user_login));
774 774
 			$suffix++;
775 775
 		}
776 776
 		$user_nicename = $alt_user_nicename;
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="fas fa-compress"></i><i class="fas 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-->
@@ -459,8 +459,8 @@  discard block
 block discarded – undo
459 459
         </script>
460 460
         <?php
461 461
 
462
-        if (strpos($geodir_map_options['height'], 'vh')) {
463
-            ?>
462
+		if (strpos($geodir_map_options['height'], 'vh')) {
463
+			?>
464 464
             <script>
465 465
                 (function () {
466 466
                     var screenH = jQuery(window).height();
@@ -482,8 +482,8 @@  discard block
 block discarded – undo
482 482
 
483 483
         <?php
484 484
 
485
-        } elseif (strpos($geodir_map_options['height'], 'px')) {
486
-            ?>
485
+		} elseif (strpos($geodir_map_options['height'], 'px')) {
486
+			?>
487 487
             <script>
488 488
                 (function () {
489 489
                     var screenH = jQuery(window).height();
@@ -498,20 +498,20 @@  discard block
 block discarded – undo
498 498
                 }());
499 499
             </script>
500 500
         <?php
501
-        }
501
+		}
502 502
 
503
-        /**
504
-         * Action that runs after all the map code has been output;
505
-         *
506
-         * @since 1.5.3
507
-         *
508
-         * @param array $geodir_map_options Array of map settings.
509
-         * @param string $map_canvas_name The canvas name and ID for the map.
510
-         */
511
-        do_action('geodir_map_after_render',$geodir_map_options,$map_canvas_name);
503
+		/**
504
+		 * Action that runs after all the map code has been output;
505
+		 *
506
+		 * @since 1.5.3
507
+		 *
508
+		 * @param array $geodir_map_options Array of map settings.
509
+		 * @param string $map_canvas_name The canvas name and ID for the map.
510
+		 */
511
+		do_action('geodir_map_after_render',$geodir_map_options,$map_canvas_name);
512 512
 
513 513
 
514
-    endif; // Exclude posttypes if end
514
+	endif; // Exclude posttypes if end
515 515
 }
516 516
 
517 517
 /**
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="fas fa-expand-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="fas fa-expand-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="fas fa-compress"></i><i class="fas 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>
360 360
                                         jQuery(window).load(function() {
361 361
                                             geodir_show_sub_cat_collapse_button();
@@ -385,21 +385,21 @@  discard block
 block discarded – undo
385 385
 					$city = $country != 'me' ? $city : '';
386 386
                     $gd_neighbourhood = $country != 'me' ? $gd_neighbourhood : '';
387 387
                     ?>
388
-                    <input type="hidden" id="<?php echo $map_canvas_name;?>_location_enabled" value="1"/>
389
-                    <input type="hidden" id="<?php echo $map_canvas_name;?>_country" name="gd_country"
390
-                           value="<?php echo $country;?>"/>
391
-                    <input type="hidden" id="<?php echo $map_canvas_name;?>_region" name="gd_region"
392
-                           value="<?php echo $region;?>"/>
393
-                    <input type="hidden" id="<?php echo $map_canvas_name;?>_city" name="gd_city"
394
-                           value="<?php echo $city;?>"/>
395
-                    <input type="hidden" id="<?php echo $map_canvas_name;?>_neighbourhood" name="gd_neighbourhood"
396
-                           value="<?php echo $gd_neighbourhood;?>"/>
388
+                    <input type="hidden" id="<?php echo $map_canvas_name; ?>_location_enabled" value="1"/>
389
+                    <input type="hidden" id="<?php echo $map_canvas_name; ?>_country" name="gd_country"
390
+                           value="<?php echo $country; ?>"/>
391
+                    <input type="hidden" id="<?php echo $map_canvas_name; ?>_region" name="gd_region"
392
+                           value="<?php echo $region; ?>"/>
393
+                    <input type="hidden" id="<?php echo $map_canvas_name; ?>_city" name="gd_city"
394
+                           value="<?php echo $city; ?>"/>
395
+                    <input type="hidden" id="<?php echo $map_canvas_name; ?>_neighbourhood" name="gd_neighbourhood"
396
+                           value="<?php echo $gd_neighbourhood; ?>"/>
397 397
                 <?php } else { //end of location filter
398 398
                     ?>
399
-                    <input type="hidden" id="<?php echo $map_canvas_name;?>_location_enabled" value="0"/>
399
+                    <input type="hidden" id="<?php echo $map_canvas_name; ?>_location_enabled" value="0"/>
400 400
                 <?php }?>
401 401
 
402
-                <input type="hidden" id="<?php echo $map_canvas_name;?>_posttype" name="gd_posttype" value="<?php echo $map_search_pt;?>"/>
402
+                <input type="hidden" id="<?php echo $map_canvas_name; ?>_posttype" name="gd_posttype" value="<?php echo $map_search_pt; ?>"/>
403 403
 
404 404
                 <input type="hidden" name="limitstart" value=""/>
405 405
 
@@ -416,8 +416,8 @@  discard block
 block discarded – undo
416 416
                     }
417 417
                     if (count($map_post_types) > 1) {
418 418
                         ?>
419
-                        <div class="map-places-listing" id="<?php echo $map_canvas_name;?>_posttype_menu"
420
-                             style="max-width:<?php echo $map_width;?>!important;">
419
+                        <div class="map-places-listing" id="<?php echo $map_canvas_name; ?>_posttype_menu"
420
+                             style="max-width:<?php echo $map_width; ?>!important;">
421 421
 
422 422
                             <?php if (isset($geodir_map_options['is_geodir_home_map_widget']) && $map_args['is_geodir_home_map_widget']) { ?>
423 423
                             <div class="geodir-map-posttype-list"><?php } ?>
@@ -428,7 +428,7 @@  discard block
 block discarded – undo
428 428
                                     foreach ($post_types as $post_type => $args) {
429 429
                                         if (!in_array($post_type, $exclude_post_types)) {
430 430
                                             $class = $map_search_pt == $post_type ? 'class="gd-map-search-pt"' : '';
431
-											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
+											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>';
432 432
                                         }
433 433
                                     }
434 434
                                     ?>
@@ -453,8 +453,8 @@  discard block
 block discarded – undo
453 453
         <script type="text/javascript">
454 454
 
455 455
             jQuery(document).ready(function () {
456
-                build_map_ajax_search_param('<?php echo $map_canvas_name;?>', false);
457
-                map_sticky('<?php echo $map_canvas_name;?>');
456
+                build_map_ajax_search_param('<?php echo $map_canvas_name; ?>', false);
457
+                map_sticky('<?php echo $map_canvas_name; ?>');
458 458
             });
459 459
 
460 460
         </script>
@@ -465,18 +465,18 @@  discard block
 block discarded – undo
465 465
             <script>
466 466
                 (function () {
467 467
                     var screenH = jQuery(window).height();
468
-                    var heightVH = "<?php echo str_replace("vh", "", $geodir_map_options['height']);?>";
468
+                    var heightVH = "<?php echo str_replace("vh", "", $geodir_map_options['height']); ?>";
469 469
 
470 470
                     var ptypeH = '';
471
-                    if (jQuery("#<?php echo $map_canvas_name;?>_posttype_menu").length) {
472
-                        ptypeH = jQuery("#<?php echo $map_canvas_name;?>_posttype_menu").outerHeight();
471
+                    if (jQuery("#<?php echo $map_canvas_name; ?>_posttype_menu").length) {
472
+                        ptypeH = jQuery("#<?php echo $map_canvas_name; ?>_posttype_menu").outerHeight();
473 473
                     }
474 474
 
475
-                    jQuery("#sticky_map_<?php echo $map_canvas_name;?>").css("min-height", screenH * (heightVH / 100) + 'px');
476
-                    jQuery("#<?php echo $map_canvas_name;?>_wrapper").height(screenH * (heightVH / 100) + 'px');
477
-                    jQuery("#<?php echo $map_canvas_name;?>").height(screenH * (heightVH / 100) + 'px');
478
-                    jQuery("#<?php echo $map_canvas_name;?>_loading_div").height(screenH * (heightVH / 100) + 'px');
479
-                    jQuery("#<?php echo $map_canvas_name;?>_cat").css("max-height", (screenH * (heightVH / 100)) - ptypeH + 'px');
475
+                    jQuery("#sticky_map_<?php echo $map_canvas_name; ?>").css("min-height", screenH * (heightVH / 100) + 'px');
476
+                    jQuery("#<?php echo $map_canvas_name; ?>_wrapper").height(screenH * (heightVH / 100) + 'px');
477
+                    jQuery("#<?php echo $map_canvas_name; ?>").height(screenH * (heightVH / 100) + 'px');
478
+                    jQuery("#<?php echo $map_canvas_name; ?>_loading_div").height(screenH * (heightVH / 100) + 'px');
479
+                    jQuery("#<?php echo $map_canvas_name; ?>_cat").css("max-height", (screenH * (heightVH / 100)) - ptypeH + 'px');
480 480
 
481 481
                 }());
482 482
             </script>
@@ -488,13 +488,13 @@  discard block
 block discarded – undo
488 488
             <script>
489 489
                 (function () {
490 490
                     var screenH = jQuery(window).height();
491
-                    var heightVH = "<?php echo str_replace("px", "", $geodir_map_options['height']);?>";
491
+                    var heightVH = "<?php echo str_replace("px", "", $geodir_map_options['height']); ?>";
492 492
                     var ptypeH = '';
493
-                    if (jQuery("#<?php echo $map_canvas_name;?>_posttype_menu").length) {
494
-                        ptypeH = jQuery("#<?php echo $map_canvas_name;?>_posttype_menu").outerHeight();
493
+                    if (jQuery("#<?php echo $map_canvas_name; ?>_posttype_menu").length) {
494
+                        ptypeH = jQuery("#<?php echo $map_canvas_name; ?>_posttype_menu").outerHeight();
495 495
                     }
496 496
 
497
-                    jQuery("#<?php echo $map_canvas_name;?>_cat").css("max-height", heightVH - ptypeH + 'px');
497
+                    jQuery("#<?php echo $map_canvas_name; ?>_cat").css("max-height", heightVH - ptypeH + 'px');
498 498
 
499 499
                 }());
500 500
             </script>
@@ -509,7 +509,7 @@  discard block
 block discarded – undo
509 509
          * @param array $geodir_map_options Array of map settings.
510 510
          * @param string $map_canvas_name The canvas name and ID for the map.
511 511
          */
512
-        do_action('geodir_map_after_render',$geodir_map_options,$map_canvas_name);
512
+        do_action('geodir_map_after_render', $geodir_map_options, $map_canvas_name);
513 513
 
514 514
 
515 515
     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.