Test Failed
Push — master ( a9f063...63f06b )
by Stiofan
19:08 queued 03:14
created
geodirectory-admin/google-api-php-client/src/Google/IO/Stream.php 2 patches
Indentation   +140 added lines, -140 removed lines patch added patch discarded remove patch
@@ -34,24 +34,24 @@  discard block
 block discarded – undo
34 34
   private $trappedErrorString;
35 35
 
36 36
   private static $DEFAULT_HTTP_CONTEXT = array(
37
-    "follow_location" => 0,
38
-    "ignore_errors" => 1,
37
+	"follow_location" => 0,
38
+	"ignore_errors" => 1,
39 39
   );
40 40
 
41 41
   private static $DEFAULT_SSL_CONTEXT = array(
42
-    "verify_peer" => true,
42
+	"verify_peer" => true,
43 43
   );
44 44
 
45 45
   public function __construct(Google_Client $client)
46 46
   {
47
-    if (!ini_get('allow_url_fopen')) {
48
-      $error = 'The stream IO handler requires the allow_url_fopen runtime ' .
49
-               'configuration to be enabled';
50
-      $client->getLogger()->critical($error);
51
-      throw new Google_IO_Exception($error);
52
-    }
53
-
54
-    parent::__construct($client);
47
+	if (!ini_get('allow_url_fopen')) {
48
+	  $error = 'The stream IO handler requires the allow_url_fopen runtime ' .
49
+			   'configuration to be enabled';
50
+	  $client->getLogger()->critical($error);
51
+	  throw new Google_IO_Exception($error);
52
+	}
53
+
54
+	parent::__construct($client);
55 55
   }
56 56
 
57 57
   /**
@@ -63,119 +63,119 @@  discard block
 block discarded – undo
63 63
    */
64 64
   public function executeRequest(Google_Http_Request $request)
65 65
   {
66
-    $default_options = stream_context_get_options(stream_context_get_default());
67
-
68
-    $requestHttpContext = array_key_exists('http', $default_options) ?
69
-        $default_options['http'] : array();
70
-
71
-    if ($request->getPostBody()) {
72
-      $requestHttpContext["content"] = $request->getPostBody();
73
-    }
74
-
75
-    $requestHeaders = $request->getRequestHeaders();
76
-    if ($requestHeaders && is_array($requestHeaders)) {
77
-      $headers = "";
78
-      foreach ($requestHeaders as $k => $v) {
79
-        $headers .= "$k: $v\r\n";
80
-      }
81
-      $requestHttpContext["header"] = $headers;
82
-    }
83
-
84
-    $requestHttpContext["method"] = $request->getRequestMethod();
85
-    $requestHttpContext["user_agent"] = $request->getUserAgent();
86
-
87
-    $requestSslContext = array_key_exists('ssl', $default_options) ?
88
-        $default_options['ssl'] : array();
89
-
90
-    if (!array_key_exists("cafile", $requestSslContext)) {
91
-      $requestSslContext["cafile"] = dirname(__FILE__) . '/cacerts.pem';
92
-    }
93
-
94
-    $options = array(
95
-        "http" => array_merge(
96
-            self::$DEFAULT_HTTP_CONTEXT,
97
-            $requestHttpContext
98
-        ),
99
-        "ssl" => array_merge(
100
-            self::$DEFAULT_SSL_CONTEXT,
101
-            $requestSslContext
102
-        )
103
-    );
104
-
105
-    $context = stream_context_create($options);
106
-
107
-    $url = $request->getUrl();
108
-
109
-    if ($request->canGzip()) {
110
-      $url = self::ZLIB . $url;
111
-    }
112
-
113
-    $this->client->getLogger()->debug(
114
-        'Stream request',
115
-        array(
116
-            'url' => $url,
117
-            'method' => $request->getRequestMethod(),
118
-            'headers' => $requestHeaders,
119
-            'body' => $request->getPostBody()
120
-        )
121
-    );
122
-
123
-    // We are trapping any thrown errors in this method only and
124
-    // throwing an exception.
125
-    $this->trappedErrorNumber = null;
126
-    $this->trappedErrorString = null;
127
-
128
-    // START - error trap.
129
-    set_error_handler(array($this, 'trapError'));
130
-    $fh = fopen($url, 'r', false, $context);
131
-    restore_error_handler();
132
-    // END - error trap.
133
-
134
-    if ($this->trappedErrorNumber) {
135
-      $error = sprintf(
136
-          "HTTP Error: Unable to connect: '%s'",
137
-          $this->trappedErrorString
138
-      );
139
-
140
-      $this->client->getLogger()->error('Stream ' . $error);
141
-      throw new Google_IO_Exception($error, $this->trappedErrorNumber);
142
-    }
143
-
144
-    $response_data = false;
145
-    $respHttpCode = self::UNKNOWN_CODE;
146
-    if ($fh) {
147
-      if (isset($this->options[self::TIMEOUT])) {
148
-        stream_set_timeout($fh, $this->options[self::TIMEOUT]);
149
-      }
150
-
151
-      $response_data = stream_get_contents($fh);
152
-      fclose($fh);
153
-
154
-      $respHttpCode = $this->getHttpResponseCode($http_response_header);
155
-    }
156
-
157
-    if (false === $response_data) {
158
-      $error = sprintf(
159
-          "HTTP Error: Unable to connect: '%s'",
160
-          $respHttpCode
161
-      );
162
-
163
-      $this->client->getLogger()->error('Stream ' . $error);
164
-      throw new Google_IO_Exception($error, $respHttpCode);
165
-    }
166
-
167
-    $responseHeaders = $this->getHttpResponseHeaders($http_response_header);
168
-
169
-    $this->client->getLogger()->debug(
170
-        'Stream response',
171
-        array(
172
-            'code' => $respHttpCode,
173
-            'headers' => $responseHeaders,
174
-            'body' => $response_data,
175
-        )
176
-    );
177
-
178
-    return array($response_data, $responseHeaders, $respHttpCode);
66
+	$default_options = stream_context_get_options(stream_context_get_default());
67
+
68
+	$requestHttpContext = array_key_exists('http', $default_options) ?
69
+		$default_options['http'] : array();
70
+
71
+	if ($request->getPostBody()) {
72
+	  $requestHttpContext["content"] = $request->getPostBody();
73
+	}
74
+
75
+	$requestHeaders = $request->getRequestHeaders();
76
+	if ($requestHeaders && is_array($requestHeaders)) {
77
+	  $headers = "";
78
+	  foreach ($requestHeaders as $k => $v) {
79
+		$headers .= "$k: $v\r\n";
80
+	  }
81
+	  $requestHttpContext["header"] = $headers;
82
+	}
83
+
84
+	$requestHttpContext["method"] = $request->getRequestMethod();
85
+	$requestHttpContext["user_agent"] = $request->getUserAgent();
86
+
87
+	$requestSslContext = array_key_exists('ssl', $default_options) ?
88
+		$default_options['ssl'] : array();
89
+
90
+	if (!array_key_exists("cafile", $requestSslContext)) {
91
+	  $requestSslContext["cafile"] = dirname(__FILE__) . '/cacerts.pem';
92
+	}
93
+
94
+	$options = array(
95
+		"http" => array_merge(
96
+			self::$DEFAULT_HTTP_CONTEXT,
97
+			$requestHttpContext
98
+		),
99
+		"ssl" => array_merge(
100
+			self::$DEFAULT_SSL_CONTEXT,
101
+			$requestSslContext
102
+		)
103
+	);
104
+
105
+	$context = stream_context_create($options);
106
+
107
+	$url = $request->getUrl();
108
+
109
+	if ($request->canGzip()) {
110
+	  $url = self::ZLIB . $url;
111
+	}
112
+
113
+	$this->client->getLogger()->debug(
114
+		'Stream request',
115
+		array(
116
+			'url' => $url,
117
+			'method' => $request->getRequestMethod(),
118
+			'headers' => $requestHeaders,
119
+			'body' => $request->getPostBody()
120
+		)
121
+	);
122
+
123
+	// We are trapping any thrown errors in this method only and
124
+	// throwing an exception.
125
+	$this->trappedErrorNumber = null;
126
+	$this->trappedErrorString = null;
127
+
128
+	// START - error trap.
129
+	set_error_handler(array($this, 'trapError'));
130
+	$fh = fopen($url, 'r', false, $context);
131
+	restore_error_handler();
132
+	// END - error trap.
133
+
134
+	if ($this->trappedErrorNumber) {
135
+	  $error = sprintf(
136
+		  "HTTP Error: Unable to connect: '%s'",
137
+		  $this->trappedErrorString
138
+	  );
139
+
140
+	  $this->client->getLogger()->error('Stream ' . $error);
141
+	  throw new Google_IO_Exception($error, $this->trappedErrorNumber);
142
+	}
143
+
144
+	$response_data = false;
145
+	$respHttpCode = self::UNKNOWN_CODE;
146
+	if ($fh) {
147
+	  if (isset($this->options[self::TIMEOUT])) {
148
+		stream_set_timeout($fh, $this->options[self::TIMEOUT]);
149
+	  }
150
+
151
+	  $response_data = stream_get_contents($fh);
152
+	  fclose($fh);
153
+
154
+	  $respHttpCode = $this->getHttpResponseCode($http_response_header);
155
+	}
156
+
157
+	if (false === $response_data) {
158
+	  $error = sprintf(
159
+		  "HTTP Error: Unable to connect: '%s'",
160
+		  $respHttpCode
161
+	  );
162
+
163
+	  $this->client->getLogger()->error('Stream ' . $error);
164
+	  throw new Google_IO_Exception($error, $respHttpCode);
165
+	}
166
+
167
+	$responseHeaders = $this->getHttpResponseHeaders($http_response_header);
168
+
169
+	$this->client->getLogger()->debug(
170
+		'Stream response',
171
+		array(
172
+			'code' => $respHttpCode,
173
+			'headers' => $responseHeaders,
174
+			'body' => $response_data,
175
+		)
176
+	);
177
+
178
+	return array($response_data, $responseHeaders, $respHttpCode);
179 179
   }
180 180
 
181 181
   /**
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
    */
185 185
   public function setOptions($options)
186 186
   {
187
-    $this->options = $options + $this->options;
187
+	$this->options = $options + $this->options;
188 188
   }
189 189
 
190 190
   /**
@@ -193,8 +193,8 @@  discard block
 block discarded – undo
193 193
    */
194 194
   public function trapError($errno, $errstr)
195 195
   {
196
-    $this->trappedErrorNumber = $errno;
197
-    $this->trappedErrorString = $errstr;
196
+	$this->trappedErrorNumber = $errno;
197
+	$this->trappedErrorString = $errstr;
198 198
   }
199 199
 
200 200
   /**
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
    */
204 204
   public function setTimeout($timeout)
205 205
   {
206
-    $this->options[self::TIMEOUT] = $timeout;
206
+	$this->options[self::TIMEOUT] = $timeout;
207 207
   }
208 208
 
209 209
   /**
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
    */
213 213
   public function getTimeout()
214 214
   {
215
-    return $this->options[self::TIMEOUT];
215
+	return $this->options[self::TIMEOUT];
216 216
   }
217 217
 
218 218
   /**
@@ -224,20 +224,20 @@  discard block
 block discarded – undo
224 224
    */
225 225
   protected function needsQuirk()
226 226
   {
227
-    return false;
227
+	return false;
228 228
   }
229 229
 
230 230
   protected function getHttpResponseCode($response_headers)
231 231
   {
232
-    $header_count = count($response_headers);
233
-
234
-    for ($i = 0; $i < $header_count; $i++) {
235
-      $header = $response_headers[$i];
236
-      if (strncasecmp("HTTP", $header, strlen("HTTP")) == 0) {
237
-        $response = explode(' ', $header);
238
-        return $response[1];
239
-      }
240
-    }
241
-    return self::UNKNOWN_CODE;
232
+	$header_count = count($response_headers);
233
+
234
+	for ($i = 0; $i < $header_count; $i++) {
235
+	  $header = $response_headers[$i];
236
+	  if (strncasecmp("HTTP", $header, strlen("HTTP")) == 0) {
237
+		$response = explode(' ', $header);
238
+		return $response[1];
239
+	  }
240
+	}
241
+	return self::UNKNOWN_CODE;
242 242
   }
243 243
 }
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
  */
23 23
 
24 24
 if (!class_exists('Google_Client')) {
25
-  require_once dirname(__FILE__) . '/../autoload.php';
25
+  require_once dirname(__FILE__).'/../autoload.php';
26 26
 }
27 27
 
28 28
 class Google_IO_Stream extends Google_IO_Abstract
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
   public function __construct(Google_Client $client)
46 46
   {
47 47
     if (!ini_get('allow_url_fopen')) {
48
-      $error = 'The stream IO handler requires the allow_url_fopen runtime ' .
48
+      $error = 'The stream IO handler requires the allow_url_fopen runtime '.
49 49
                'configuration to be enabled';
50 50
       $client->getLogger()->critical($error);
51 51
       throw new Google_IO_Exception($error);
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
         $default_options['ssl'] : array();
89 89
 
90 90
     if (!array_key_exists("cafile", $requestSslContext)) {
91
-      $requestSslContext["cafile"] = dirname(__FILE__) . '/cacerts.pem';
91
+      $requestSslContext["cafile"] = dirname(__FILE__).'/cacerts.pem';
92 92
     }
93 93
 
94 94
     $options = array(
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
     $url = $request->getUrl();
108 108
 
109 109
     if ($request->canGzip()) {
110
-      $url = self::ZLIB . $url;
110
+      $url = self::ZLIB.$url;
111 111
     }
112 112
 
113 113
     $this->client->getLogger()->debug(
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
           $this->trappedErrorString
138 138
       );
139 139
 
140
-      $this->client->getLogger()->error('Stream ' . $error);
140
+      $this->client->getLogger()->error('Stream '.$error);
141 141
       throw new Google_IO_Exception($error, $this->trappedErrorNumber);
142 142
     }
143 143
 
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
           $respHttpCode
161 161
       );
162 162
 
163
-      $this->client->getLogger()->error('Stream ' . $error);
163
+      $this->client->getLogger()->error('Stream '.$error);
164 164
       throw new Google_IO_Exception($error, $respHttpCode);
165 165
     }
166 166
 
Please login to merge, or discard this patch.
geodirectory-admin/google-api-php-client/src/Google/IO/Exception.php 2 patches
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -35,20 +35,20 @@  discard block
 block discarded – undo
35 35
    * @param array|null $retryMap Map of errors with retry counts.
36 36
    */
37 37
   public function __construct(
38
-      $message,
39
-      $code = 0,
40
-      Exception $previous = null,
41
-      array $retryMap = null
38
+	  $message,
39
+	  $code = 0,
40
+	  Exception $previous = null,
41
+	  array $retryMap = null
42 42
   ) {
43
-    if (version_compare(PHP_VERSION, '5.3.0') >= 0) {
44
-      parent::__construct($message, $code, $previous);
45
-    } else {
46
-      parent::__construct($message, $code);
47
-    }
43
+	if (version_compare(PHP_VERSION, '5.3.0') >= 0) {
44
+	  parent::__construct($message, $code, $previous);
45
+	} else {
46
+	  parent::__construct($message, $code);
47
+	}
48 48
 
49
-    if (is_array($retryMap)) {
50
-      $this->retryMap = $retryMap;
51
-    }
49
+	if (is_array($retryMap)) {
50
+	  $this->retryMap = $retryMap;
51
+	}
52 52
   }
53 53
 
54 54
   /**
@@ -60,10 +60,10 @@  discard block
 block discarded – undo
60 60
    */
61 61
   public function allowedRetries()
62 62
   {
63
-    if (isset($this->retryMap[$this->code])) {
64
-      return $this->retryMap[$this->code];
65
-    }
63
+	if (isset($this->retryMap[$this->code])) {
64
+	  return $this->retryMap[$this->code];
65
+	}
66 66
 
67
-    return 0;
67
+	return 0;
68 68
   }
69 69
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@
 block discarded – undo
16 16
  */
17 17
 
18 18
 if (!class_exists('Google_Client')) {
19
-  require_once dirname(__FILE__) . '/../autoload.php';
19
+  require_once dirname(__FILE__).'/../autoload.php';
20 20
 }
21 21
 
22 22
 class Google_IO_Exception extends Google_Exception implements Google_Task_Retryable
Please login to merge, or discard this patch.
geodirectory-admin/google-api-php-client/src/Google/IO/Abstract.php 2 patches
Indentation   +165 added lines, -165 removed lines patch added patch discarded remove patch
@@ -28,19 +28,19 @@  discard block
 block discarded – undo
28 28
   const UNKNOWN_CODE = 0;
29 29
   const FORM_URLENCODED = 'application/x-www-form-urlencoded';
30 30
   private static $CONNECTION_ESTABLISHED_HEADERS = array(
31
-    "HTTP/1.0 200 Connection established\r\n\r\n",
32
-    "HTTP/1.1 200 Connection established\r\n\r\n",
31
+	"HTTP/1.0 200 Connection established\r\n\r\n",
32
+	"HTTP/1.1 200 Connection established\r\n\r\n",
33 33
   );
34 34
   private static $ENTITY_HTTP_METHODS = array("POST" => null, "PUT" => null);
35 35
   private static $HOP_BY_HOP = array(
36
-    'connection' => true,
37
-    'keep-alive' => true,
38
-    'proxy-authenticate' => true,
39
-    'proxy-authorization' => true,
40
-    'te' => true,
41
-    'trailers' => true,
42
-    'transfer-encoding' => true,
43
-    'upgrade' => true
36
+	'connection' => true,
37
+	'keep-alive' => true,
38
+	'proxy-authenticate' => true,
39
+	'proxy-authorization' => true,
40
+	'te' => true,
41
+	'trailers' => true,
42
+	'transfer-encoding' => true,
43
+	'upgrade' => true
44 44
   );
45 45
 
46 46
 
@@ -49,11 +49,11 @@  discard block
 block discarded – undo
49 49
 
50 50
   public function __construct(Google_Client $client)
51 51
   {
52
-    $this->client = $client;
53
-    $timeout = $client->getClassConfig('Google_IO_Abstract', 'request_timeout_seconds');
54
-    if ($timeout > 0) {
55
-      $this->setTimeout($timeout);
56
-    }
52
+	$this->client = $client;
53
+	$timeout = $client->getClassConfig('Google_IO_Abstract', 'request_timeout_seconds');
54
+	if ($timeout > 0) {
55
+	  $this->setTimeout($timeout);
56
+	}
57 57
   }
58 58
 
59 59
   /**
@@ -102,13 +102,13 @@  discard block
 block discarded – undo
102 102
    */
103 103
   public function setCachedRequest(Google_Http_Request $request)
104 104
   {
105
-    // Determine if the request is cacheable.
106
-    if (Google_Http_CacheParser::isResponseCacheable($request)) {
107
-      $this->client->getCache()->set($request->getCacheKey(), $request);
108
-      return true;
109
-    }
105
+	// Determine if the request is cacheable.
106
+	if (Google_Http_CacheParser::isResponseCacheable($request)) {
107
+	  $this->client->getCache()->set($request->getCacheKey(), $request);
108
+	  return true;
109
+	}
110 110
 
111
-    return false;
111
+	return false;
112 112
   }
113 113
 
114 114
   /**
@@ -121,37 +121,37 @@  discard block
 block discarded – undo
121 121
    */
122 122
   public function makeRequest(Google_Http_Request $request)
123 123
   {
124
-    // First, check to see if we have a valid cached version.
125
-    $cached = $this->getCachedRequest($request);
126
-    if ($cached !== false && $cached instanceof Google_Http_Request) {
127
-      if (!$this->checkMustRevalidateCachedRequest($cached, $request)) {
128
-        return $cached;
129
-      }
130
-    }
131
-
132
-    if (array_key_exists($request->getRequestMethod(), self::$ENTITY_HTTP_METHODS)) {
133
-      $request = $this->processEntityRequest($request);
134
-    }
135
-
136
-    list($responseData, $responseHeaders, $respHttpCode) = $this->executeRequest($request);
137
-
138
-    if ($respHttpCode == 304 && $cached) {
139
-      // If the server responded NOT_MODIFIED, return the cached request.
140
-      $this->updateCachedRequest($cached, $responseHeaders);
141
-      return $cached;
142
-    }
143
-
144
-    if (!isset($responseHeaders['Date']) && !isset($responseHeaders['date'])) {
145
-      $responseHeaders['date'] = date("r");
146
-    }
147
-
148
-    $request->setResponseHttpCode($respHttpCode);
149
-    $request->setResponseHeaders($responseHeaders);
150
-    $request->setResponseBody($responseData);
151
-    // Store the request in cache (the function checks to see if the request
152
-    // can actually be cached)
153
-    $this->setCachedRequest($request);
154
-    return $request;
124
+	// First, check to see if we have a valid cached version.
125
+	$cached = $this->getCachedRequest($request);
126
+	if ($cached !== false && $cached instanceof Google_Http_Request) {
127
+	  if (!$this->checkMustRevalidateCachedRequest($cached, $request)) {
128
+		return $cached;
129
+	  }
130
+	}
131
+
132
+	if (array_key_exists($request->getRequestMethod(), self::$ENTITY_HTTP_METHODS)) {
133
+	  $request = $this->processEntityRequest($request);
134
+	}
135
+
136
+	list($responseData, $responseHeaders, $respHttpCode) = $this->executeRequest($request);
137
+
138
+	if ($respHttpCode == 304 && $cached) {
139
+	  // If the server responded NOT_MODIFIED, return the cached request.
140
+	  $this->updateCachedRequest($cached, $responseHeaders);
141
+	  return $cached;
142
+	}
143
+
144
+	if (!isset($responseHeaders['Date']) && !isset($responseHeaders['date'])) {
145
+	  $responseHeaders['date'] = date("r");
146
+	}
147
+
148
+	$request->setResponseHttpCode($respHttpCode);
149
+	$request->setResponseHeaders($responseHeaders);
150
+	$request->setResponseBody($responseData);
151
+	// Store the request in cache (the function checks to see if the request
152
+	// can actually be cached)
153
+	$this->setCachedRequest($request);
154
+	return $request;
155 155
   }
156 156
 
157 157
   /**
@@ -162,11 +162,11 @@  discard block
 block discarded – undo
162 162
    */
163 163
   public function getCachedRequest(Google_Http_Request $request)
164 164
   {
165
-    if (false === Google_Http_CacheParser::isRequestCacheable($request)) {
166
-      return false;
167
-    }
165
+	if (false === Google_Http_CacheParser::isRequestCacheable($request)) {
166
+	  return false;
167
+	}
168 168
 
169
-    return $this->client->getCache()->get($request->getCacheKey());
169
+	return $this->client->getCache()->get($request->getCacheKey());
170 170
   }
171 171
 
172 172
   /**
@@ -177,28 +177,28 @@  discard block
 block discarded – undo
177 177
    */
178 178
   public function processEntityRequest(Google_Http_Request $request)
179 179
   {
180
-    $postBody = $request->getPostBody();
181
-    $contentType = $request->getRequestHeader("content-type");
182
-
183
-    // Set the default content-type as application/x-www-form-urlencoded.
184
-    if (false == $contentType) {
185
-      $contentType = self::FORM_URLENCODED;
186
-      $request->setRequestHeaders(array('content-type' => $contentType));
187
-    }
188
-
189
-    // Force the payload to match the content-type asserted in the header.
190
-    if ($contentType == self::FORM_URLENCODED && is_array($postBody)) {
191
-      $postBody = http_build_query($postBody, '', '&');
192
-      $request->setPostBody($postBody);
193
-    }
194
-
195
-    // Make sure the content-length header is set.
196
-    if (!$postBody || is_string($postBody)) {
197
-      $postsLength = strlen($postBody);
198
-      $request->setRequestHeaders(array('content-length' => $postsLength));
199
-    }
200
-
201
-    return $request;
180
+	$postBody = $request->getPostBody();
181
+	$contentType = $request->getRequestHeader("content-type");
182
+
183
+	// Set the default content-type as application/x-www-form-urlencoded.
184
+	if (false == $contentType) {
185
+	  $contentType = self::FORM_URLENCODED;
186
+	  $request->setRequestHeaders(array('content-type' => $contentType));
187
+	}
188
+
189
+	// Force the payload to match the content-type asserted in the header.
190
+	if ($contentType == self::FORM_URLENCODED && is_array($postBody)) {
191
+	  $postBody = http_build_query($postBody, '', '&');
192
+	  $request->setPostBody($postBody);
193
+	}
194
+
195
+	// Make sure the content-length header is set.
196
+	if (!$postBody || is_string($postBody)) {
197
+	  $postsLength = strlen($postBody);
198
+	  $request->setRequestHeaders(array('content-length' => $postsLength));
199
+	}
200
+
201
+	return $request;
202 202
   }
203 203
 
204 204
   /**
@@ -211,21 +211,21 @@  discard block
 block discarded – undo
211 211
    */
212 212
   protected function checkMustRevalidateCachedRequest($cached, $request)
213 213
   {
214
-    if (Google_Http_CacheParser::mustRevalidate($cached)) {
215
-      $addHeaders = array();
216
-      if ($cached->getResponseHeader('etag')) {
217
-        // [13.3.4] If an entity tag has been provided by the origin server,
218
-        // we must use that entity tag in any cache-conditional request.
219
-        $addHeaders['If-None-Match'] = $cached->getResponseHeader('etag');
220
-      } elseif ($cached->getResponseHeader('date')) {
221
-        $addHeaders['If-Modified-Since'] = $cached->getResponseHeader('date');
222
-      }
223
-
224
-      $request->setRequestHeaders($addHeaders);
225
-      return true;
226
-    } else {
227
-      return false;
228
-    }
214
+	if (Google_Http_CacheParser::mustRevalidate($cached)) {
215
+	  $addHeaders = array();
216
+	  if ($cached->getResponseHeader('etag')) {
217
+		// [13.3.4] If an entity tag has been provided by the origin server,
218
+		// we must use that entity tag in any cache-conditional request.
219
+		$addHeaders['If-None-Match'] = $cached->getResponseHeader('etag');
220
+	  } elseif ($cached->getResponseHeader('date')) {
221
+		$addHeaders['If-Modified-Since'] = $cached->getResponseHeader('date');
222
+	  }
223
+
224
+	  $request->setRequestHeaders($addHeaders);
225
+	  return true;
226
+	} else {
227
+	  return false;
228
+	}
229 229
   }
230 230
 
231 231
   /**
@@ -235,19 +235,19 @@  discard block
 block discarded – undo
235 235
    */
236 236
   protected function updateCachedRequest($cached, $responseHeaders)
237 237
   {
238
-    $hopByHop = self::$HOP_BY_HOP;
239
-    if (!empty($responseHeaders['connection'])) {
240
-      $connectionHeaders = array_map(
241
-          'strtolower',
242
-          array_filter(
243
-              array_map('trim', explode(',', $responseHeaders['connection']))
244
-          )
245
-      );
246
-      $hopByHop += array_fill_keys($connectionHeaders, true);
247
-    }
248
-
249
-    $endToEnd = array_diff_key($responseHeaders, $hopByHop);
250
-    $cached->setResponseHeaders($endToEnd);
238
+	$hopByHop = self::$HOP_BY_HOP;
239
+	if (!empty($responseHeaders['connection'])) {
240
+	  $connectionHeaders = array_map(
241
+		  'strtolower',
242
+		  array_filter(
243
+			  array_map('trim', explode(',', $responseHeaders['connection']))
244
+		  )
245
+	  );
246
+	  $hopByHop += array_fill_keys($connectionHeaders, true);
247
+	}
248
+
249
+	$endToEnd = array_diff_key($responseHeaders, $hopByHop);
250
+	$cached->setResponseHeaders($endToEnd);
251 251
   }
252 252
 
253 253
   /**
@@ -259,33 +259,33 @@  discard block
 block discarded – undo
259 259
    */
260 260
   public function parseHttpResponse($respData, $headerSize)
261 261
   {
262
-    // check proxy header
263
-    foreach (self::$CONNECTION_ESTABLISHED_HEADERS as $established_header) {
264
-      if (stripos($respData, $established_header) !== false) {
265
-        // existed, remove it
266
-        $respData = str_ireplace($established_header, '', $respData);
267
-        // Subtract the proxy header size unless the cURL bug prior to 7.30.0
268
-        // is present which prevented the proxy header size from being taken into
269
-        // account.
270
-        if (!$this->needsQuirk()) {
271
-          $headerSize -= strlen($established_header);
272
-        }
273
-        break;
274
-      }
275
-    }
276
-
277
-    if ($headerSize) {
278
-      $responseBody = substr($respData, $headerSize);
279
-      $responseHeaders = substr($respData, 0, $headerSize);
280
-    } else {
281
-      $responseSegments = explode("\r\n\r\n", $respData, 2);
282
-      $responseHeaders = $responseSegments[0];
283
-      $responseBody = isset($responseSegments[1]) ? $responseSegments[1] :
284
-                                                    null;
285
-    }
286
-
287
-    $responseHeaders = $this->getHttpResponseHeaders($responseHeaders);
288
-    return array($responseHeaders, $responseBody);
262
+	// check proxy header
263
+	foreach (self::$CONNECTION_ESTABLISHED_HEADERS as $established_header) {
264
+	  if (stripos($respData, $established_header) !== false) {
265
+		// existed, remove it
266
+		$respData = str_ireplace($established_header, '', $respData);
267
+		// Subtract the proxy header size unless the cURL bug prior to 7.30.0
268
+		// is present which prevented the proxy header size from being taken into
269
+		// account.
270
+		if (!$this->needsQuirk()) {
271
+		  $headerSize -= strlen($established_header);
272
+		}
273
+		break;
274
+	  }
275
+	}
276
+
277
+	if ($headerSize) {
278
+	  $responseBody = substr($respData, $headerSize);
279
+	  $responseHeaders = substr($respData, 0, $headerSize);
280
+	} else {
281
+	  $responseSegments = explode("\r\n\r\n", $respData, 2);
282
+	  $responseHeaders = $responseSegments[0];
283
+	  $responseBody = isset($responseSegments[1]) ? $responseSegments[1] :
284
+													null;
285
+	}
286
+
287
+	$responseHeaders = $this->getHttpResponseHeaders($responseHeaders);
288
+	return array($responseHeaders, $responseBody);
289 289
   }
290 290
 
291 291
   /**
@@ -295,45 +295,45 @@  discard block
 block discarded – undo
295 295
    */
296 296
   public function getHttpResponseHeaders($rawHeaders)
297 297
   {
298
-    if (is_array($rawHeaders)) {
299
-      return $this->parseArrayHeaders($rawHeaders);
300
-    } else {
301
-      return $this->parseStringHeaders($rawHeaders);
302
-    }
298
+	if (is_array($rawHeaders)) {
299
+	  return $this->parseArrayHeaders($rawHeaders);
300
+	} else {
301
+	  return $this->parseStringHeaders($rawHeaders);
302
+	}
303 303
   }
304 304
 
305 305
   private function parseStringHeaders($rawHeaders)
306 306
   {
307
-    $headers = array();
308
-    $responseHeaderLines = explode("\r\n", $rawHeaders);
309
-    foreach ($responseHeaderLines as $headerLine) {
310
-      if ($headerLine && strpos($headerLine, ':') !== false) {
311
-        list($header, $value) = explode(': ', $headerLine, 2);
312
-        $header = strtolower($header);
313
-        if (isset($headers[$header])) {
314
-          $headers[$header] .= "\n" . $value;
315
-        } else {
316
-          $headers[$header] = $value;
317
-        }
318
-      }
319
-    }
320
-    return $headers;
307
+	$headers = array();
308
+	$responseHeaderLines = explode("\r\n", $rawHeaders);
309
+	foreach ($responseHeaderLines as $headerLine) {
310
+	  if ($headerLine && strpos($headerLine, ':') !== false) {
311
+		list($header, $value) = explode(': ', $headerLine, 2);
312
+		$header = strtolower($header);
313
+		if (isset($headers[$header])) {
314
+		  $headers[$header] .= "\n" . $value;
315
+		} else {
316
+		  $headers[$header] = $value;
317
+		}
318
+	  }
319
+	}
320
+	return $headers;
321 321
   }
322 322
 
323 323
   private function parseArrayHeaders($rawHeaders)
324 324
   {
325
-    $header_count = count($rawHeaders);
326
-    $headers = array();
327
-
328
-    for ($i = 0; $i < $header_count; $i++) {
329
-      $header = $rawHeaders[$i];
330
-      // Times will have colons in - so we just want the first match.
331
-      $header_parts = explode(': ', $header, 2);
332
-      if (count($header_parts) == 2) {
333
-        $headers[strtolower($header_parts[0])] = $header_parts[1];
334
-      }
335
-    }
336
-
337
-    return $headers;
325
+	$header_count = count($rawHeaders);
326
+	$headers = array();
327
+
328
+	for ($i = 0; $i < $header_count; $i++) {
329
+	  $header = $rawHeaders[$i];
330
+	  // Times will have colons in - so we just want the first match.
331
+	  $header_parts = explode(': ', $header, 2);
332
+	  if (count($header_parts) == 2) {
333
+		$headers[strtolower($header_parts[0])] = $header_parts[1];
334
+	  }
335
+	}
336
+
337
+	return $headers;
338 338
   }
339 339
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -4 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
  */
21 21
 
22 22
 if (!class_exists('Google_Client')) {
23
-  require_once dirname(__FILE__) . '/../autoload.php';
23
+  require_once dirname(__FILE__).'/../autoload.php';
24 24
 }
25 25
 
26 26
 abstract class Google_IO_Abstract
@@ -280,8 +280,7 @@  discard block
 block discarded – undo
280 280
     } else {
281 281
       $responseSegments = explode("\r\n\r\n", $respData, 2);
282 282
       $responseHeaders = $responseSegments[0];
283
-      $responseBody = isset($responseSegments[1]) ? $responseSegments[1] :
284
-                                                    null;
283
+      $responseBody = isset($responseSegments[1]) ? $responseSegments[1] : null;
285 284
     }
286 285
 
287 286
     $responseHeaders = $this->getHttpResponseHeaders($responseHeaders);
@@ -311,7 +310,7 @@  discard block
 block discarded – undo
311 310
         list($header, $value) = explode(': ', $headerLine, 2);
312 311
         $header = strtolower($header);
313 312
         if (isset($headers[$header])) {
314
-          $headers[$header] .= "\n" . $value;
313
+          $headers[$header] .= "\n".$value;
315 314
         } else {
316 315
           $headers[$header] = $value;
317 316
         }
Please login to merge, or discard this patch.
geodirectory-functions/compatibility/Twenty_Seventeen.php 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -1,12 +1,12 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 
4
-add_filter('post_thumbnail_html','geodir_2017_remove_header',10,5);
5
-function geodir_2017_remove_header($html, $post_ID, $post_thumbnail_id, $size, $attr){
6
-	if($size=='twentyseventeen-featured-image'){
4
+add_filter('post_thumbnail_html', 'geodir_2017_remove_header', 10, 5);
5
+function geodir_2017_remove_header($html, $post_ID, $post_thumbnail_id, $size, $attr) {
6
+	if ($size == 'twentyseventeen-featured-image') {
7 7
 
8
-		if(geodir_is_page('detail') || geodir_is_page('add-listing')){
9
-			$html = '';// nothing up top
8
+		if (geodir_is_page('detail') || geodir_is_page('add-listing')) {
9
+			$html = ''; // nothing up top
10 10
 		}
11 11
 
12 12
 	}
@@ -63,19 +63,19 @@  discard block
 block discarded – undo
63 63
 
64 64
 }
65 65
 
66
-function geodir_twentyseventeen_body_classes($classes){
66
+function geodir_twentyseventeen_body_classes($classes) {
67 67
 
68
-	if(geodir_is_page('add-listing')
68
+	if (geodir_is_page('add-listing')
69 69
 	   || geodir_is_page('preview')
70 70
 	   || geodir_is_page('home')
71 71
 	   || geodir_is_page('location')
72 72
 	   || geodir_is_page('listing')
73 73
 	   || geodir_is_page('search')
74 74
 	   || geodir_is_page('author')
75
-	){
75
+	) {
76 76
 		$classes[] = 'has-sidebar';
77 77
 	}
78 78
 	return $classes;
79 79
 }
80
-add_filter( 'body_class', 'geodir_twentyseventeen_body_classes' );
80
+add_filter('body_class', 'geodir_twentyseventeen_body_classes');
81 81
 
Please login to merge, or discard this patch.
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -46,17 +46,13 @@
 block discarded – undo
46 46
 
47 47
 	if (is_page_geodir_home() || geodir_is_page('location')) {
48 48
 		add_action('geodir_wrapper_open', 'geodir_action_geodir_sidebar_home_top', 8);
49
-	}
50
-	elseif (geodir_is_page('listing')) {
49
+	} elseif (geodir_is_page('listing')) {
51 50
 		add_action('geodir_wrapper_open', 'geodir_action_geodir_sidebar_listings_top', 8);
52
-	}
53
-	elseif (geodir_is_page('detail')) {
51
+	} elseif (geodir_is_page('detail')) {
54 52
 		add_action('geodir_wrapper_open', 'geodir_action_geodir_sidebar_detail_top', 8);
55
-	}
56
-	elseif (geodir_is_page('search')) {
53
+	} elseif (geodir_is_page('search')) {
57 54
 		add_action('geodir_wrapper_open', 'geodir_action_geodir_sidebar_search_top', 8);
58
-	}
59
-	elseif (geodir_is_page('author')) {
55
+	} elseif (geodir_is_page('author')) {
60 56
 		add_action('geodir_wrapper_open', 'geodir_action_geodir_sidebar_author_top', 8);
61 57
 	}
62 58
 
Please login to merge, or discard this patch.
geodirectory-admin/option-pages/create_field.php 3 patches
Indentation   +65 added lines, -65 removed lines patch added patch discarded remove patch
@@ -16,100 +16,100 @@
 block discarded – undo
16 16
 
17 17
 $field_ids = array();
18 18
 if (!empty($_REQUEST['licontainer']) && is_array($_REQUEST['licontainer'])) {
19
-    foreach ($_REQUEST['licontainer'] as $lic_id) {
20
-        $field_ids[] = sanitize_text_field($lic_id);
21
-    }
19
+	foreach ($_REQUEST['licontainer'] as $lic_id) {
20
+		$field_ids[] = sanitize_text_field($lic_id);
21
+	}
22 22
 }
23 23
 
24 24
 /* ------- check nonce field ------- */
25 25
 if (isset($_REQUEST['update']) && $_REQUEST['update'] == "update" && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'custom_fields') {
26
-    echo godir_set_field_order($field_ids);
26
+	echo godir_set_field_order($field_ids);
27 27
 }
28 28
 
29 29
 if (isset($_REQUEST['update']) && $_REQUEST['update'] == "update" && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'sorting_options') {
30
-    $response = godir_set_sort_field_order($field_ids);
31
-    if (is_array($response)) {
32
-        wp_send_json($response);
33
-    } else {
34
-        echo $response;
35
-    }
30
+	$response = godir_set_sort_field_order($field_ids);
31
+	if (is_array($response)) {
32
+		wp_send_json($response);
33
+	} else {
34
+		echo $response;
35
+	}
36 36
 }
37 37
 
38 38
 /* ---- Show field form in admin ---- */
39 39
 if ($field_type != '' && $field_id != '' && $field_action == 'new' && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'custom_fields') {
40
-    geodir_custom_field_adminhtml($field_type, $field_id, $field_action,$field_type_key);
40
+	geodir_custom_field_adminhtml($field_type, $field_id, $field_action,$field_type_key);
41 41
 }
42 42
 
43 43
 if ($field_type != '' && $field_id != '' && $field_action == 'new' && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'sorting_options') {
44
-    geodir_custom_sort_field_adminhtml($field_type, $field_id, $field_action,$field_type_key);
44
+	geodir_custom_sort_field_adminhtml($field_type, $field_id, $field_action,$field_type_key);
45 45
 }
46 46
 
47 47
 /* ---- Delete field ---- */
48 48
 if ($field_id != '' && $field_action == 'delete' && isset($_REQUEST['_wpnonce']) && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'custom_fields') {
49
-    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id))
50
-        return;
49
+	if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id))
50
+		return;
51 51
     
52
-    echo geodir_custom_field_delete($field_id);
52
+	echo geodir_custom_field_delete($field_id);
53 53
 }
54 54
 
55 55
 if ($field_id != '' && $field_action == 'delete' && isset($_REQUEST['_wpnonce']) && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'sorting_options') {
56
-    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id))
57
-        return;
56
+	if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id))
57
+		return;
58 58
     
59
-    echo geodir_custom_sort_field_delete($field_id);
59
+	echo geodir_custom_sort_field_delete($field_id);
60 60
 }
61 61
 
62 62
 /* ---- Save field  ---- */
63 63
 if ($field_id != '' && $field_action == 'submit' && isset($_REQUEST['_wpnonce']) && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'custom_fields') {
64
-    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id))
65
-        return;
66
-
67
-    foreach ($_REQUEST as $pkey => $pval) {
68
-        if (is_array($_REQUEST[$pkey]) || $pkey=='default_value') {
69
-            $tags = 'skip_field';
70
-        } else {
71
-            $tags = '';
72
-        }
73
-
74
-        if ($tags != 'skip_field') {
75
-            $_REQUEST[$pkey] = strip_tags($_REQUEST[$pkey], $tags);
76
-        }
77
-    }
78
-
79
-    $return = geodir_custom_field_save($_REQUEST);
80
-
81
-    if (is_int($return)) {
82
-        $lastid = $return;
83
-        geodir_custom_field_adminhtml($field_type, $lastid, 'submit',$field_type_key);
84
-    } else {
85
-        echo $return;
86
-    }
64
+	if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id))
65
+		return;
66
+
67
+	foreach ($_REQUEST as $pkey => $pval) {
68
+		if (is_array($_REQUEST[$pkey]) || $pkey=='default_value') {
69
+			$tags = 'skip_field';
70
+		} else {
71
+			$tags = '';
72
+		}
73
+
74
+		if ($tags != 'skip_field') {
75
+			$_REQUEST[$pkey] = strip_tags($_REQUEST[$pkey], $tags);
76
+		}
77
+	}
78
+
79
+	$return = geodir_custom_field_save($_REQUEST);
80
+
81
+	if (is_int($return)) {
82
+		$lastid = $return;
83
+		geodir_custom_field_adminhtml($field_type, $lastid, 'submit',$field_type_key);
84
+	} else {
85
+		echo $return;
86
+	}
87 87
 }
88 88
 
89 89
 /* ---- Save sort field  ---- */
90 90
 if ($field_id != '' && $field_action == 'submit' && isset($_REQUEST['_wpnonce']) && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'sorting_options') {
91
-    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id))
92
-        return;
93
-
94
-    foreach ($_REQUEST as $pkey => $pval) {
95
-        if (is_array($_REQUEST[$pkey])) {
96
-            $tags = 'skip_field';
97
-        } else {
98
-            $tags = '';
99
-        }
100
-
101
-        if ($tags != 'skip_field') {
102
-            $_REQUEST[$pkey] = strip_tags($_REQUEST[$pkey], $tags);
103
-        }
104
-    }
105
-
106
-    $return = geodir_custom_sort_field_save($_REQUEST);
107
-
108
-    if (is_int($return)) {
109
-        $lastid = $return;
110
-        $default = false;
111
-        geodir_custom_sort_field_adminhtml($field_type, $lastid, 'submit', $default);
112
-    } else {
113
-        echo $return;
114
-    }
91
+	if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id))
92
+		return;
93
+
94
+	foreach ($_REQUEST as $pkey => $pval) {
95
+		if (is_array($_REQUEST[$pkey])) {
96
+			$tags = 'skip_field';
97
+		} else {
98
+			$tags = '';
99
+		}
100
+
101
+		if ($tags != 'skip_field') {
102
+			$_REQUEST[$pkey] = strip_tags($_REQUEST[$pkey], $tags);
103
+		}
104
+	}
105
+
106
+	$return = geodir_custom_sort_field_save($_REQUEST);
107
+
108
+	if (is_int($return)) {
109
+		$lastid = $return;
110
+		$default = false;
111
+		geodir_custom_sort_field_adminhtml($field_type, $lastid, 'submit', $default);
112
+	} else {
113
+		echo $return;
114
+	}
115 115
 }
116 116
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -37,23 +37,23 @@  discard block
 block discarded – undo
37 37
 
38 38
 /* ---- Show field form in admin ---- */
39 39
 if ($field_type != '' && $field_id != '' && $field_action == 'new' && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'custom_fields') {
40
-    geodir_custom_field_adminhtml($field_type, $field_id, $field_action,$field_type_key);
40
+    geodir_custom_field_adminhtml($field_type, $field_id, $field_action, $field_type_key);
41 41
 }
42 42
 
43 43
 if ($field_type != '' && $field_id != '' && $field_action == 'new' && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'sorting_options') {
44
-    geodir_custom_sort_field_adminhtml($field_type, $field_id, $field_action,$field_type_key);
44
+    geodir_custom_sort_field_adminhtml($field_type, $field_id, $field_action, $field_type_key);
45 45
 }
46 46
 
47 47
 /* ---- Delete field ---- */
48 48
 if ($field_id != '' && $field_action == 'delete' && isset($_REQUEST['_wpnonce']) && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'custom_fields') {
49
-    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id))
49
+    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_'.$field_id))
50 50
         return;
51 51
     
52 52
     echo geodir_custom_field_delete($field_id);
53 53
 }
54 54
 
55 55
 if ($field_id != '' && $field_action == 'delete' && isset($_REQUEST['_wpnonce']) && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'sorting_options') {
56
-    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id))
56
+    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_'.$field_id))
57 57
         return;
58 58
     
59 59
     echo geodir_custom_sort_field_delete($field_id);
@@ -61,11 +61,11 @@  discard block
 block discarded – undo
61 61
 
62 62
 /* ---- Save field  ---- */
63 63
 if ($field_id != '' && $field_action == 'submit' && isset($_REQUEST['_wpnonce']) && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'custom_fields') {
64
-    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id))
64
+    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_'.$field_id))
65 65
         return;
66 66
 
67 67
     foreach ($_REQUEST as $pkey => $pval) {
68
-        if (is_array($_REQUEST[$pkey]) || $pkey=='default_value') {
68
+        if (is_array($_REQUEST[$pkey]) || $pkey == 'default_value') {
69 69
             $tags = 'skip_field';
70 70
         } else {
71 71
             $tags = '';
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 
81 81
     if (is_int($return)) {
82 82
         $lastid = $return;
83
-        geodir_custom_field_adminhtml($field_type, $lastid, 'submit',$field_type_key);
83
+        geodir_custom_field_adminhtml($field_type, $lastid, 'submit', $field_type_key);
84 84
     } else {
85 85
         echo $return;
86 86
     }
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 
89 89
 /* ---- Save sort field  ---- */
90 90
 if ($field_id != '' && $field_action == 'submit' && isset($_REQUEST['_wpnonce']) && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'sorting_options') {
91
-    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id))
91
+    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_'.$field_id))
92 92
         return;
93 93
 
94 94
     foreach ($_REQUEST as $pkey => $pval) {
Please login to merge, or discard this patch.
Braces   +12 added lines, -8 removed lines patch added patch discarded remove patch
@@ -46,23 +46,26 @@  discard block
 block discarded – undo
46 46
 
47 47
 /* ---- Delete field ---- */
48 48
 if ($field_id != '' && $field_action == 'delete' && isset($_REQUEST['_wpnonce']) && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'custom_fields') {
49
-    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id))
50
-        return;
49
+    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id)) {
50
+            return;
51
+    }
51 52
     
52 53
     echo geodir_custom_field_delete($field_id);
53 54
 }
54 55
 
55 56
 if ($field_id != '' && $field_action == 'delete' && isset($_REQUEST['_wpnonce']) && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'sorting_options') {
56
-    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id))
57
-        return;
57
+    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id)) {
58
+            return;
59
+    }
58 60
     
59 61
     echo geodir_custom_sort_field_delete($field_id);
60 62
 }
61 63
 
62 64
 /* ---- Save field  ---- */
63 65
 if ($field_id != '' && $field_action == 'submit' && isset($_REQUEST['_wpnonce']) && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'custom_fields') {
64
-    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id))
65
-        return;
66
+    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id)) {
67
+            return;
68
+    }
66 69
 
67 70
     foreach ($_REQUEST as $pkey => $pval) {
68 71
         if (is_array($_REQUEST[$pkey]) || $pkey=='default_value') {
@@ -88,8 +91,9 @@  discard block
 block discarded – undo
88 91
 
89 92
 /* ---- Save sort field  ---- */
90 93
 if ($field_id != '' && $field_action == 'submit' && isset($_REQUEST['_wpnonce']) && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'sorting_options') {
91
-    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id))
92
-        return;
94
+    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id)) {
95
+            return;
96
+    }
93 97
 
94 98
     foreach ($_REQUEST as $pkey => $pval) {
95 99
         if (is_array($_REQUEST[$pkey])) {
Please login to merge, or discard this patch.
geodirectory-functions/custom_field_html.php 3 patches
Indentation   +333 added lines, -333 removed lines patch added patch discarded remove patch
@@ -18,9 +18,9 @@  discard block
 block discarded – undo
18 18
 global $post_type;
19 19
 
20 20
 if (!isset($field_info->post_type)) {
21
-    $post_type = sanitize_text_field($_REQUEST['listing_type']);
21
+	$post_type = sanitize_text_field($_REQUEST['listing_type']);
22 22
 } else
23
-    $post_type = $field_info->post_type;
23
+	$post_type = $field_info->post_type;
24 24
 
25 25
 //if(isset($_REQUEST['custom_type']) && $_REQUEST['custom_type']=='predefined'){
26 26
 //    $cf_arr = geodir_custom_fields_predefined($post_type);
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 
49 49
 $field_admin_title = '';
50 50
 if (isset($field_info->admin_title))
51
-    $field_admin_title = $field_info->admin_title;
51
+	$field_admin_title = $field_info->admin_title;
52 52
 
53 53
 $default = isset($field_info->is_admin) ? $field_info->is_admin : '';
54 54
 
@@ -68,17 +68,17 @@  discard block
 block discarded – undo
68 68
 //print_r($field_info);
69 69
 
70 70
 if (isset($cf['icon']) && strpos($cf['icon'], 'fa fa-') !== false) {
71
-    $field_icon = '<i class="'.$cf['icon'].'" aria-hidden="true"></i>';
71
+	$field_icon = '<i class="'.$cf['icon'].'" aria-hidden="true"></i>';
72 72
 }elseif(isset($cf['icon']) && $cf['icon']){
73
-    $field_icon = '<b style="background-image: url("'.$cf['icon'].'")"></b>';
73
+	$field_icon = '<b style="background-image: url("'.$cf['icon'].'")"></b>';
74 74
 }else{
75
-    $field_icon = '<i class="fa fa-cog" aria-hidden="true"></i>';
75
+	$field_icon = '<i class="fa fa-cog" aria-hidden="true"></i>';
76 76
 }
77 77
 
78 78
 if(isset($cf['name']) && $cf['name']){
79
-    $field_type_name = $cf['name'];
79
+	$field_type_name = $cf['name'];
80 80
 }else{
81
-    $field_type_name = $field_type;
81
+	$field_type_name = $field_type;
82 82
 }
83 83
 
84 84
 ?>
@@ -88,8 +88,8 @@  discard block
 block discarded – undo
88 88
          ondblclick="show_hide('field_frm<?php echo $result_str; ?>')">
89 89
         <?php
90 90
 
91
-        $nonce = wp_create_nonce('custom_fields_' . $result_str);
92
-        ?>
91
+		$nonce = wp_create_nonce('custom_fields_' . $result_str);
92
+		?>
93 93
 
94 94
         <?php if ($default): ?>
95 95
             <div title="<?php _e('Default field, should not be removed.', 'geodirectory'); ?>" class="handlediv move gd-default-remove"><i class="fa fa-times" aria-hidden="true"></i></div>
@@ -98,37 +98,37 @@  discard block
 block discarded – undo
98 98
                  onclick="delete_field('<?php echo $result_str; ?>', '<?php echo $nonce; ?>')"
99 99
                  class="handlediv close"><i class="fa fa-times" aria-hidden="true"></i></div>
100 100
         <?php endif;
101
-        if ($field_type == 'fieldset') {
102
-            ?>
101
+		if ($field_type == 'fieldset') {
102
+			?>
103 103
             <i class="fa fa-long-arrow-left " aria-hidden="true"></i>
104 104
             <i class="fa fa-long-arrow-right " aria-hidden="true"></i>
105 105
             <b style="cursor:pointer;"
106 106
                onclick="show_hide('field_frm<?php echo $result_str;?>')"><?php echo geodir_ucwords(__('Fieldset:', 'geodirectory') . ' ' . $field_admin_title);?></b>
107 107
         <?php
108
-        } else {echo $field_icon;
109
-            ?>
108
+		} else {echo $field_icon;
109
+			?>
110 110
             <b style="cursor:pointer;"
111 111
                onclick="show_hide('field_frm<?php echo $result_str;?>')"><?php echo geodir_ucwords(' ' . $field_admin_title . ' (' . $field_type_name . ')');?></b>
112 112
         <?php
113
-        }
114
-        ?>
113
+		}
114
+		?>
115 115
     </div>
116 116
 
117 117
     <form><!-- we need to wrap in a fom so we can use radio buttons with same name -->
118 118
     <div id="field_frm<?php echo $result_str; ?>" class="field_frm"
119 119
          style="display:<?php if ($field_ins_upd == 'submit') {
120
-             echo 'block;';
121
-         } else {
122
-             echo 'none;';
123
-         } ?>">
120
+			 echo 'block;';
121
+		 } else {
122
+			 echo 'none;';
123
+		 } ?>">
124 124
         <input type="hidden" name="_wpnonce" value="<?php echo esc_attr($nonce); ?>"/>
125 125
         <input type="hidden" name="listing_type" id="listing_type" value="<?php echo $post_type; ?>"/>
126 126
         <input type="hidden" name="field_type" id="field_type" value="<?php echo $field_type; ?>"/>
127 127
         <input type="hidden" name="field_type_key" id="field_type_key" value="<?php echo $field_type_key; ?>"/>
128 128
         <input type="hidden" name="field_id" id="field_id" value="<?php echo esc_attr($result_str); ?>"/>
129 129
         <input type="hidden" name="data_type" id="data_type" value="<?php if (isset($field_info->data_type)) {
130
-            echo $field_info->data_type;
131
-        } ?>"/>
130
+			echo $field_info->data_type;
131
+		} ?>"/>
132 132
         <input type="hidden" name="is_active" id="is_active" value="1"/>
133 133
 
134 134
         <input type="hidden" name="is_default" value="<?php echo isset($field_info->is_default) ? $field_info->is_default : '';?>" /><?php // show in sidebar value?>
@@ -140,37 +140,37 @@  discard block
 block discarded – undo
140 140
 
141 141
             <?php
142 142
 
143
-            // data_type
144
-            if(has_filter("geodir_cfa_data_type_{$field_type}")){
143
+			// data_type
144
+			if(has_filter("geodir_cfa_data_type_{$field_type}")){
145 145
 
146
-                echo apply_filters("geodir_cfa_data_type_{$field_type}",'',$result_str,$cf,$field_info);
146
+				echo apply_filters("geodir_cfa_data_type_{$field_type}",'',$result_str,$cf,$field_info);
147 147
 
148
-            }else{
149
-                $value = '';
150
-                if (isset($field_info->data_type)) {
151
-                    $value = esc_attr($field_info->data_type);
152
-                }elseif(isset($cf['defaults']['data_type']) && $cf['defaults']['data_type']){
153
-                    $value = $cf['defaults']['data_type'];
154
-                }
155
-                ?>
148
+			}else{
149
+				$value = '';
150
+				if (isset($field_info->data_type)) {
151
+					$value = esc_attr($field_info->data_type);
152
+				}elseif(isset($cf['defaults']['data_type']) && $cf['defaults']['data_type']){
153
+					$value = $cf['defaults']['data_type'];
154
+				}
155
+				?>
156 156
                 <input type="hidden" name="data_type" id="data_type" value="<?php echo $value;?>"/>
157 157
             <?php
158
-            }
158
+			}
159 159
 
160 160
 
161
-            // admin_title
162
-            if(has_filter("geodir_cfa_admin_title_{$field_type}")){
161
+			// admin_title
162
+			if(has_filter("geodir_cfa_admin_title_{$field_type}")){
163 163
 
164
-                echo apply_filters("geodir_cfa_admin_title_{$field_type}",'',$result_str,$cf,$field_info);
164
+				echo apply_filters("geodir_cfa_admin_title_{$field_type}",'',$result_str,$cf,$field_info);
165 165
 
166
-            }else{
167
-                $value = '';
168
-                if (isset($field_info->admin_title)) {
169
-                    $value = esc_attr($field_info->admin_title);
170
-                }elseif(isset($cf['defaults']['admin_title']) && $cf['defaults']['admin_title']){
171
-                    $value = $cf['defaults']['admin_title'];
172
-                }
173
-                ?>
166
+			}else{
167
+				$value = '';
168
+				if (isset($field_info->admin_title)) {
169
+					$value = esc_attr($field_info->admin_title);
170
+				}elseif(isset($cf['defaults']['admin_title']) && $cf['defaults']['admin_title']){
171
+					$value = $cf['defaults']['admin_title'];
172
+				}
173
+				?>
174 174
                 <li>
175 175
                     <label for="admin_title" class="gd-cf-tooltip-wrap">
176 176
                         <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Admin title :', 'geodirectory'); ?>
@@ -184,22 +184,22 @@  discard block
 block discarded – undo
184 184
                     </div>
185 185
                 </li>
186 186
                 <?php
187
-            }
187
+			}
188 188
 
189 189
 
190
-            // site_title
191
-            if(has_filter("geodir_cfa_site_title_{$field_type}")){
190
+			// site_title
191
+			if(has_filter("geodir_cfa_site_title_{$field_type}")){
192 192
 
193
-                echo apply_filters("geodir_cfa_site_title_{$field_type}",'',$result_str,$cf,$field_info);
193
+				echo apply_filters("geodir_cfa_site_title_{$field_type}",'',$result_str,$cf,$field_info);
194 194
 
195
-            }else{
196
-                $value = '';
197
-                if (isset($field_info->site_title)) {
198
-                    $value = esc_attr($field_info->site_title);
199
-                }elseif(isset($cf['defaults']['site_title']) && $cf['defaults']['site_title']){
200
-                    $value = $cf['defaults']['site_title'];
201
-                }
202
-                ?>
195
+			}else{
196
+				$value = '';
197
+				if (isset($field_info->site_title)) {
198
+					$value = esc_attr($field_info->site_title);
199
+				}elseif(isset($cf['defaults']['site_title']) && $cf['defaults']['site_title']){
200
+					$value = $cf['defaults']['site_title'];
201
+				}
202
+				?>
203 203
                 <li>
204 204
                     <label for="site_title" class="gd-cf-tooltip-wrap"> <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Frontend title :', 'geodirectory'); ?>
205 205
                         <div class="gdcf-tooltip">
@@ -212,22 +212,22 @@  discard block
 block discarded – undo
212 212
                     </div>
213 213
                 </li>
214 214
                 <?php
215
-            }
215
+			}
216 216
 
217 217
 
218
-            // admin_desc
219
-            if(has_filter("geodir_cfa_admin_desc_{$field_type}")){
218
+			// admin_desc
219
+			if(has_filter("geodir_cfa_admin_desc_{$field_type}")){
220 220
 
221
-                echo apply_filters("geodir_cfa_admin_desc_{$field_type}",'',$result_str,$cf,$field_info);
221
+				echo apply_filters("geodir_cfa_admin_desc_{$field_type}",'',$result_str,$cf,$field_info);
222 222
 
223
-            }else{
224
-                $value = '';
225
-                if (isset($field_info->admin_desc)) {
226
-                    $value = esc_attr($field_info->admin_desc);
227
-                }elseif(isset($cf['defaults']['admin_desc']) && $cf['defaults']['admin_desc']){
228
-                    $value = $cf['defaults']['admin_desc'];
229
-                }
230
-                ?>
223
+			}else{
224
+				$value = '';
225
+				if (isset($field_info->admin_desc)) {
226
+					$value = esc_attr($field_info->admin_desc);
227
+				}elseif(isset($cf['defaults']['admin_desc']) && $cf['defaults']['admin_desc']){
228
+					$value = $cf['defaults']['admin_desc'];
229
+				}
230
+				?>
231 231
                 <li>
232 232
                     <label for="admin_desc" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Frontend description :', 'geodirectory'); ?>
233 233
                         <div class="gdcf-tooltip">
@@ -239,23 +239,23 @@  discard block
 block discarded – undo
239 239
                     </div>
240 240
                 </li>
241 241
                 <?php
242
-            }
242
+			}
243 243
 
244 244
 
245 245
 
246
-            // htmlvar_name
247
-            if(has_filter("geodir_cfa_htmlvar_name_{$field_type}")){
246
+			// htmlvar_name
247
+			if(has_filter("geodir_cfa_htmlvar_name_{$field_type}")){
248 248
 
249
-                echo apply_filters("geodir_cfa_htmlvar_name_{$field_type}",'',$result_str,$cf,$field_info);
249
+				echo apply_filters("geodir_cfa_htmlvar_name_{$field_type}",'',$result_str,$cf,$field_info);
250 250
 
251
-            }else{
252
-                $value = '';
253
-                if (isset($field_info->htmlvar_name)) {
254
-                    $value = esc_attr($field_info->htmlvar_name);
255
-                }elseif(isset($cf['defaults']['htmlvar_name']) && $cf['defaults']['htmlvar_name']){
256
-                    $value = $cf['defaults']['htmlvar_name'];
257
-                }
258
-                ?>
251
+			}else{
252
+				$value = '';
253
+				if (isset($field_info->htmlvar_name)) {
254
+					$value = esc_attr($field_info->htmlvar_name);
255
+				}elseif(isset($cf['defaults']['htmlvar_name']) && $cf['defaults']['htmlvar_name']){
256
+					$value = $cf['defaults']['htmlvar_name'];
257
+				}
258
+				?>
259 259
                 <li>
260 260
                     <label for="htmlvar_name" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('HTML variable name :', 'geodirectory');?>
261 261
                         <div class="gdcf-tooltip">
@@ -265,29 +265,29 @@  discard block
 block discarded – undo
265 265
                     <div class="gd-cf-input-wrap">
266 266
                         <input type="text" name="htmlvar_name" id="htmlvar_name" pattern="[a-zA-Z0-9]+" title="<?php _e('Must not contain spaces or special characters', 'geodirectory');?>"
267 267
                                value="<?php if ($value) {
268
-                                   echo preg_replace('/geodir_/', '', $value, 1);
269
-                               }?>" <?php if ($default) {
270
-                            echo 'readonly="readonly"';
271
-                        }?> />
268
+								   echo preg_replace('/geodir_/', '', $value, 1);
269
+							   }?>" <?php if ($default) {
270
+							echo 'readonly="readonly"';
271
+						}?> />
272 272
                     </div>
273 273
                 </li>
274 274
                 <?php
275
-            }
275
+			}
276 276
 
277 277
 
278
-            // is_active
279
-            if(has_filter("geodir_cfa_is_active_{$field_type}")){
278
+			// is_active
279
+			if(has_filter("geodir_cfa_is_active_{$field_type}")){
280 280
 
281
-                echo apply_filters("geodir_cfa_is_active_{$field_type}",'',$result_str,$cf,$field_info);
281
+				echo apply_filters("geodir_cfa_is_active_{$field_type}",'',$result_str,$cf,$field_info);
282 282
 
283
-            }else{
284
-                $value = '';
285
-                if (isset($field_info->is_active)) {
286
-                    $value = esc_attr($field_info->is_active);
287
-                }elseif(isset($cf['defaults']['is_active']) && $cf['defaults']['is_active']){
288
-                    $value = $cf['defaults']['is_active'];
289
-                }
290
-                ?>
283
+			}else{
284
+				$value = '';
285
+				if (isset($field_info->is_active)) {
286
+					$value = esc_attr($field_info->is_active);
287
+				}elseif(isset($cf['defaults']['is_active']) && $cf['defaults']['is_active']){
288
+					$value = $cf['defaults']['is_active'];
289
+				}
290
+				?>
291 291
                 <li <?php echo $field_display; ?>>
292 292
                     <label for="is_active" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Is active :', 'geodirectory'); ?>
293 293
                         <div class="gdcf-tooltip">
@@ -298,35 +298,35 @@  discard block
 block discarded – undo
298 298
 
299 299
                         <input type="radio" id="is_active_yes<?php echo $radio_id;?>" name="is_active" class="gdri-enabled"  value="1"
300 300
                             <?php if ($value == '1') {
301
-                                echo 'checked';
302
-                            } ?>/>
301
+								echo 'checked';
302
+							} ?>/>
303 303
                         <label for="is_active_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
304 304
 
305 305
                         <input type="radio" id="is_active_no<?php echo $radio_id;?>" name="is_active" class="gdri-disabled" value="0"
306 306
                             <?php if ($value == '0' || !$value) {
307
-                                echo 'checked';
308
-                            } ?>/>
307
+								echo 'checked';
308
+							} ?>/>
309 309
                         <label for="is_active_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
310 310
 
311 311
                     </div>
312 312
                 </li>
313 313
                 <?php
314
-            }
314
+			}
315 315
 
316 316
 
317
-            // for_admin_use
318
-            if(has_filter("geodir_cfa_for_admin_use_{$field_type}")){
317
+			// for_admin_use
318
+			if(has_filter("geodir_cfa_for_admin_use_{$field_type}")){
319 319
 
320
-                echo apply_filters("geodir_cfa_for_admin_use_{$field_type}",'',$result_str,$cf,$field_info);
320
+				echo apply_filters("geodir_cfa_for_admin_use_{$field_type}",'',$result_str,$cf,$field_info);
321 321
 
322
-            }else{
323
-                $value = '';
324
-                if (isset($field_info->for_admin_use)) {
325
-                    $value = esc_attr($field_info->for_admin_use);
326
-                }elseif(isset($cf['defaults']['for_admin_use']) && $cf['defaults']['for_admin_use']){
327
-                    $value = $cf['defaults']['for_admin_use'];
328
-                }
329
-                ?>
322
+			}else{
323
+				$value = '';
324
+				if (isset($field_info->for_admin_use)) {
325
+					$value = esc_attr($field_info->for_admin_use);
326
+				}elseif(isset($cf['defaults']['for_admin_use']) && $cf['defaults']['for_admin_use']){
327
+					$value = $cf['defaults']['for_admin_use'];
328
+				}
329
+				?>
330 330
                 <li>
331 331
                     <label for="for_admin_use" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('For admin use only? :', 'geodirectory'); ?>
332 332
                         <div class="gdcf-tooltip">
@@ -337,47 +337,47 @@  discard block
 block discarded – undo
337 337
 
338 338
                         <input type="radio" id="for_admin_use_yes<?php echo $radio_id;?>" name="for_admin_use" class="gdri-enabled"  value="1"
339 339
                             <?php if ($value == '1') {
340
-                                echo 'checked';
341
-                            } ?>/>
340
+								echo 'checked';
341
+							} ?>/>
342 342
                         <label for="for_admin_use_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
343 343
 
344 344
                         <input type="radio" id="for_admin_use_no<?php echo $radio_id;?>" name="for_admin_use" class="gdri-disabled" value="0"
345 345
                             <?php if ($value == '0' || !$value) {
346
-                                echo 'checked';
347
-                            } ?>/>
346
+								echo 'checked';
347
+							} ?>/>
348 348
                         <label for="for_admin_use_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
349 349
 
350 350
                     </div>
351 351
                 </li>
352 352
                 <?php
353
-            }
353
+			}
354 354
 
355 355
 
356
-            // default_value
357
-            if(has_filter("geodir_cfa_default_value_{$field_type}")){
356
+			// default_value
357
+			if(has_filter("geodir_cfa_default_value_{$field_type}")){
358 358
 
359
-                echo apply_filters("geodir_cfa_default_value_{$field_type}",'',$result_str,$cf,$field_info);
359
+				echo apply_filters("geodir_cfa_default_value_{$field_type}",'',$result_str,$cf,$field_info);
360 360
 
361
-            }else{
362
-                $value = '';
363
-                if (isset($field_info->default_value)) {
364
-                    $value = esc_attr($field_info->default_value);
365
-                }elseif(isset($cf['defaults']['default_value']) && $cf['defaults']['default_value']){
366
-                    $value = $cf['defaults']['default_value'];
367
-                }
368
-                ?>
361
+			}else{
362
+				$value = '';
363
+				if (isset($field_info->default_value)) {
364
+					$value = esc_attr($field_info->default_value);
365
+				}elseif(isset($cf['defaults']['default_value']) && $cf['defaults']['default_value']){
366
+					$value = $cf['defaults']['default_value'];
367
+				}
368
+				?>
369 369
                 <li>
370 370
                     <label for="default_value" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Default value :', 'geodirectory');?>
371 371
                         <div class="gdcf-tooltip">
372 372
                             <?php
373
-                            if ($field_type == 'checkbox') {
374
-                                _e('Should the checkbox be checked by default?', 'geodirectory');
375
-                            } else if ($field_type == 'email') {
376
-                                _e('A default value for the field, usually blank. Ex: [email protected]', 'geodirectory');
377
-                            } else {
378
-                                _e('A default value for the field, usually blank. (for "link" this will be used as the link text)', 'geodirectory');
379
-                            }
380
-                            ?>
373
+							if ($field_type == 'checkbox') {
374
+								_e('Should the checkbox be checked by default?', 'geodirectory');
375
+							} else if ($field_type == 'email') {
376
+								_e('A default value for the field, usually blank. Ex: [email protected]', 'geodirectory');
377
+							} else {
378
+								_e('A default value for the field, usually blank. (for "link" this will be used as the link text)', 'geodirectory');
379
+							}
380
+							?>
381 381
                         </div>
382 382
                     </label>
383 383
                     <div class="gd-cf-input-wrap">
@@ -394,22 +394,22 @@  discard block
 block discarded – undo
394 394
                     </div>
395 395
                 </li>
396 396
                 <?php
397
-            }
397
+			}
398 398
 
399 399
 
400
-            // show_in
401
-            if(has_filter("geodir_cfa_show_in_{$field_type}")){
400
+			// show_in
401
+			if(has_filter("geodir_cfa_show_in_{$field_type}")){
402 402
 
403
-                echo apply_filters("geodir_cfa_show_in_{$field_type}",'',$result_str,$cf,$field_info);
403
+				echo apply_filters("geodir_cfa_show_in_{$field_type}",'',$result_str,$cf,$field_info);
404 404
 
405
-            }else{
406
-                $value = '';
407
-                if (isset($field_info->show_in)) {
408
-                    $value = esc_attr($field_info->show_in);
409
-                }elseif(isset($cf['defaults']['show_in']) && $cf['defaults']['show_in']){
410
-                    $value = esc_attr($cf['defaults']['show_in']);
411
-                }
412
-                ?>
405
+			}else{
406
+				$value = '';
407
+				if (isset($field_info->show_in)) {
408
+					$value = esc_attr($field_info->show_in);
409
+				}elseif(isset($cf['defaults']['show_in']) && $cf['defaults']['show_in']){
410
+					$value = esc_attr($cf['defaults']['show_in']);
411
+				}
412
+				?>
413 413
                 <li>
414 414
                     <label for="show_in" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Show in what locations?:', 'geodirectory'); ?>
415 415
                         <div class="gdcf-tooltip">
@@ -420,41 +420,41 @@  discard block
 block discarded – undo
420 420
 
421 421
                         <?php
422 422
 
423
-                        /*
423
+						/*
424 424
 						 * We wrap the key values in [] so we can search the DB easier with a LIKE query.
425 425
 						 */
426
-                        $show_in_locations = array(
427
-                            "[detail]" => __("Details page sidebar", 'geodirectory'),
428
-                            "[moreinfo]" => __("More info tab", 'geodirectory'),
429
-                            "[listing]" => __("Listings page", 'geodirectory'),
430
-                            "[owntab]" => __("Details page own tab", 'geodirectory'),
431
-                            "[mapbubble]" => __("Map bubble", 'geodirectory'),
432
-                        );
433
-
434
-                        /**
435
-                         * Filter the locations array for where to display custom fields.
436
-                         *
437
-                         * @since 1.6.6
438
-                         * @param array $show_in_locations The array of locations and descriptions.
439
-                         * @param object $field_info The field being displayed info.
440
-                         * @param string $field_info The type of field.
441
-                         */
442
-                        $show_in_locations = apply_filters('geodir_show_in_locations',$show_in_locations,$field_info,$field_type);
443
-
444
-
445
-                        // remove some locations for some field types
446
-
447
-                        // don't show new tab option for some types
448
-                        if (in_array($field_type, array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file','address','taxonomy'))) {
449
-                        }else{
450
-                            unset($show_in_locations['[owntab]']);
451
-                        }
452
-
453
-                        if(!$display_on_listing){
454
-                            unset($show_in_locations['[listings]']);
455
-                        }
456
-
457
-                        ?>
426
+						$show_in_locations = array(
427
+							"[detail]" => __("Details page sidebar", 'geodirectory'),
428
+							"[moreinfo]" => __("More info tab", 'geodirectory'),
429
+							"[listing]" => __("Listings page", 'geodirectory'),
430
+							"[owntab]" => __("Details page own tab", 'geodirectory'),
431
+							"[mapbubble]" => __("Map bubble", 'geodirectory'),
432
+						);
433
+
434
+						/**
435
+						 * Filter the locations array for where to display custom fields.
436
+						 *
437
+						 * @since 1.6.6
438
+						 * @param array $show_in_locations The array of locations and descriptions.
439
+						 * @param object $field_info The field being displayed info.
440
+						 * @param string $field_info The type of field.
441
+						 */
442
+						$show_in_locations = apply_filters('geodir_show_in_locations',$show_in_locations,$field_info,$field_type);
443
+
444
+
445
+						// remove some locations for some field types
446
+
447
+						// don't show new tab option for some types
448
+						if (in_array($field_type, array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file','address','taxonomy'))) {
449
+						}else{
450
+							unset($show_in_locations['[owntab]']);
451
+						}
452
+
453
+						if(!$display_on_listing){
454
+							unset($show_in_locations['[listings]']);
455
+						}
456
+
457
+						?>
458 458
 
459 459
                         <select multiple="multiple" name="show_in[]"
460 460
                                 id="show_in"
@@ -464,38 +464,38 @@  discard block
 block discarded – undo
464 464
                                 option-ajaxchosen="false">
465 465
                             <?php
466 466
 
467
-                            $show_in_values = explode(',',$value);
467
+							$show_in_values = explode(',',$value);
468 468
 
469
-                            foreach( $show_in_locations as $key => $val){
470
-                                $selected = '';
469
+							foreach( $show_in_locations as $key => $val){
470
+								$selected = '';
471 471
 
472
-                                if(is_array($show_in_values) && in_array($key,$show_in_values ) ){
473
-                                    $selected = 'selected';
474
-                                }
472
+								if(is_array($show_in_values) && in_array($key,$show_in_values ) ){
473
+									$selected = 'selected';
474
+								}
475 475
 
476
-                                ?>
476
+								?>
477 477
                                 <option  value="<?php echo $key;?>" <?php echo $selected;?>><?php echo $val;?></option>
478 478
                                 <?php
479
-                            }
480
-                            ?>
479
+							}
480
+							?>
481 481
                         </select>
482 482
                     </div>
483 483
                 </li>
484 484
                 <?php
485
-            }
485
+			}
486 486
 
487 487
 
488
-            // advanced_editor
489
-            if(has_filter("geodir_cfa_advanced_editor_{$field_type}")){
488
+			// advanced_editor
489
+			if(has_filter("geodir_cfa_advanced_editor_{$field_type}")){
490 490
 
491
-                echo apply_filters("geodir_cfa_advanced_editor_{$field_type}",'',$result_str,$cf,$field_info);
491
+				echo apply_filters("geodir_cfa_advanced_editor_{$field_type}",'',$result_str,$cf,$field_info);
492 492
 
493
-            }
493
+			}
494 494
 
495 495
 
496 496
 
497 497
 
498
-            ?>
498
+			?>
499 499
 
500 500
 
501 501
             <?php // @todo this does not seem to be used for anything, it can be removed or replaced ?>
@@ -508,38 +508,38 @@  discard block
 block discarded – undo
508 508
 
509 509
             <?php
510 510
 
511
-            $pricearr = array();
512
-            if (isset($field_info->packages) && $field_info->packages != '') {
513
-                $pricearr = explode(',', trim($field_info->packages, ','));
514
-            } else {
515
-                $package_info = array();
511
+			$pricearr = array();
512
+			if (isset($field_info->packages) && $field_info->packages != '') {
513
+				$pricearr = explode(',', trim($field_info->packages, ','));
514
+			} else {
515
+				$package_info = array();
516 516
 
517
-                $package_info = geodir_post_package_info($package_info, '', $post_type);
518
-                $pricearr[] = $package_info->pid;
519
-            }
517
+				$package_info = geodir_post_package_info($package_info, '', $post_type);
518
+				$pricearr[] = $package_info->pid;
519
+			}
520 520
 
521
-            ob_start()
522
-            ?>
521
+			ob_start()
522
+			?>
523 523
 
524 524
             <select style="display:none" name="show_on_pkg[]" id="show_on_pkg" multiple="multiple">
525 525
                 <?php
526
-                if (!empty($pricearr)) {
527
-                    foreach ($pricearr as $val) {
528
-                        ?>
526
+				if (!empty($pricearr)) {
527
+					foreach ($pricearr as $val) {
528
+						?>
529 529
                         <option selected="selected" value="<?php echo esc_attr($val); ?>" ><?php echo $val; ?></option><?php
530
-                    }
531
-                }
532
-                ?>
530
+					}
531
+				}
532
+				?>
533 533
             </select>
534 534
 
535 535
             <?php
536
-            $html = ob_get_clean();
536
+			$html = ob_get_clean();
537 537
 
538 538
 			/**
539 539
 			 * Filter the price packages list.
540 540
 			 *
541 541
 			 * Filter the price packages list in custom field form in admin
542
-             * custom fields settings.
542
+			 * custom fields settings.
543 543
 			 *
544 544
 			 * @since 1.0.0
545 545
 			 *
@@ -548,25 +548,25 @@  discard block
 block discarded – undo
548 548
 			 */
549 549
 			echo $html = apply_filters('geodir_packages_list_on_custom_fields', $html, $field_info);
550 550
 
551
-            ?>
551
+			?>
552 552
 
553 553
 
554 554
 
555 555
             <?php
556 556
 
557
-            // is_required
558
-            if(has_filter("geodir_cfa_is_required_{$field_type}")){
557
+			// is_required
558
+			if(has_filter("geodir_cfa_is_required_{$field_type}")){
559 559
 
560
-                echo apply_filters("geodir_cfa_is_required_{$field_type}",'',$result_str,$cf,$field_info);
560
+				echo apply_filters("geodir_cfa_is_required_{$field_type}",'',$result_str,$cf,$field_info);
561 561
 
562
-            }else{
563
-                $value = '';
564
-                if (isset($field_info->is_required)) {
565
-                    $value = esc_attr($field_info->is_required);
566
-                }elseif(isset($cf['defaults']['is_required']) && $cf['defaults']['is_required']){
567
-                    $value = $cf['defaults']['is_required'];
568
-                }
569
-                ?>
562
+			}else{
563
+				$value = '';
564
+				if (isset($field_info->is_required)) {
565
+					$value = esc_attr($field_info->is_required);
566
+				}elseif(isset($cf['defaults']['is_required']) && $cf['defaults']['is_required']){
567
+					$value = $cf['defaults']['is_required'];
568
+				}
569
+				?>
570 570
                 <li>
571 571
                     <label for="is_required" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Is required :', 'geodirectory'); ?>
572 572
                         <div class="gdcf-tooltip">
@@ -578,14 +578,14 @@  discard block
 block discarded – undo
578 578
 
579 579
                         <input type="radio" id="is_required_yes<?php echo $radio_id;?>" name="is_required" class="gdri-enabled"  value="1"
580 580
                             <?php if ($value == '1') {
581
-                                echo 'checked';
582
-                            } ?>/>
581
+								echo 'checked';
582
+							} ?>/>
583 583
                         <label onclick="show_hide_radio(this,'show','cf-is-required-msg');" for="is_required_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
584 584
 
585 585
                         <input type="radio" id="is_required_no<?php echo $radio_id;?>" name="is_required" class="gdri-disabled" value="0"
586 586
                             <?php if ($value == '0' || !$value) {
587
-                                echo 'checked';
588
-                            } ?>/>
587
+								echo 'checked';
588
+							} ?>/>
589 589
                         <label onclick="show_hide_radio(this,'hide','cf-is-required-msg');" for="is_required_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
590 590
 
591 591
                     </div>
@@ -593,21 +593,21 @@  discard block
 block discarded – undo
593 593
                 </li>
594 594
 
595 595
                 <?php
596
-            }
596
+			}
597 597
 
598
-            // required_msg
599
-            if(has_filter("geodir_cfa_required_msg_{$field_type}")){
598
+			// required_msg
599
+			if(has_filter("geodir_cfa_required_msg_{$field_type}")){
600 600
 
601
-                echo apply_filters("geodir_cfa_required_msg_{$field_type}",'',$result_str,$cf,$field_info);
601
+				echo apply_filters("geodir_cfa_required_msg_{$field_type}",'',$result_str,$cf,$field_info);
602 602
 
603
-            }else{
604
-                $value = '';
605
-                if (isset($field_info->required_msg)) {
606
-                    $value = esc_attr($field_info->required_msg);
607
-                }elseif(isset($cf['defaults']['required_msg']) && $cf['defaults']['required_msg']){
608
-                    $value = $cf['defaults']['required_msg'];
609
-                }
610
-                ?>
603
+			}else{
604
+				$value = '';
605
+				if (isset($field_info->required_msg)) {
606
+					$value = esc_attr($field_info->required_msg);
607
+				}elseif(isset($cf['defaults']['required_msg']) && $cf['defaults']['required_msg']){
608
+					$value = $cf['defaults']['required_msg'];
609
+				}
610
+				?>
611 611
                 <li class="cf-is-required-msg" <?php if ((isset($field_info->is_required) && $field_info->is_required == '0') || !isset($field_info->is_required)) {echo "style='display:none;'";}?>>
612 612
                     <label for="required_msg" class="gd-cf-tooltip-wrap">
613 613
                         <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Required message:', 'geodirectory'); ?>
@@ -621,38 +621,38 @@  discard block
 block discarded – undo
621 621
                     </div>
622 622
                 </li>
623 623
                 <?php
624
-            }
624
+			}
625 625
 
626 626
 
627
-            // required_msg
628
-            if(has_filter("geodir_cfa_validation_pattern_{$field_type}")){
627
+			// required_msg
628
+			if(has_filter("geodir_cfa_validation_pattern_{$field_type}")){
629 629
 
630
-                echo apply_filters("geodir_cfa_validation_pattern_{$field_type}",'',$result_str,$cf,$field_info);
630
+				echo apply_filters("geodir_cfa_validation_pattern_{$field_type}",'',$result_str,$cf,$field_info);
631 631
 
632
-            }
632
+			}
633 633
 
634 634
 
635
-            // extra_fields
636
-            if(has_filter("geodir_cfa_extra_fields_{$field_type}")){
635
+			// extra_fields
636
+			if(has_filter("geodir_cfa_extra_fields_{$field_type}")){
637 637
 
638
-                echo apply_filters("geodir_cfa_extra_fields_{$field_type}",'',$result_str,$cf,$field_info);
638
+				echo apply_filters("geodir_cfa_extra_fields_{$field_type}",'',$result_str,$cf,$field_info);
639 639
 
640
-            }
640
+			}
641 641
 
642 642
 
643
-            // field_icon
644
-            if(has_filter("geodir_cfa_field_icon_{$field_type}")){
643
+			// field_icon
644
+			if(has_filter("geodir_cfa_field_icon_{$field_type}")){
645 645
 
646
-                echo apply_filters("geodir_cfa_field_icon_{$field_type}",'',$result_str,$cf,$field_info);
646
+				echo apply_filters("geodir_cfa_field_icon_{$field_type}",'',$result_str,$cf,$field_info);
647 647
 
648
-            }else{
649
-                $value = '';
650
-                if (isset($field_info->field_icon)) {
651
-                    $value = esc_attr($field_info->field_icon);
652
-                }elseif(isset($cf['defaults']['field_icon']) && $cf['defaults']['field_icon']){
653
-                    $value = $cf['defaults']['field_icon'];
654
-                }
655
-                ?>
648
+			}else{
649
+				$value = '';
650
+				if (isset($field_info->field_icon)) {
651
+					$value = esc_attr($field_info->field_icon);
652
+				}elseif(isset($cf['defaults']['field_icon']) && $cf['defaults']['field_icon']){
653
+					$value = $cf['defaults']['field_icon'];
654
+				}
655
+				?>
656 656
                 <li>
657 657
                     <h3><?php echo __('Custom css', 'geodirectory'); ?></h3>
658 658
 
@@ -670,22 +670,22 @@  discard block
 block discarded – undo
670 670
 
671 671
                 </li>
672 672
                 <?php
673
-            }
673
+			}
674 674
 
675 675
 
676
-            // css_class
677
-            if(has_filter("geodir_cfa_css_class_{$field_type}")){
676
+			// css_class
677
+			if(has_filter("geodir_cfa_css_class_{$field_type}")){
678 678
 
679
-                echo apply_filters("geodir_cfa_css_class_{$field_type}",'',$result_str,$cf,$field_info);
679
+				echo apply_filters("geodir_cfa_css_class_{$field_type}",'',$result_str,$cf,$field_info);
680 680
 
681
-            }else{
682
-                $value = '';
683
-                if (isset($field_info->css_class)) {
684
-                    $value = esc_attr($field_info->css_class);
685
-                }elseif(isset($cf['defaults']['css_class']) && $cf['defaults']['css_class']){
686
-                    $value = $cf['defaults']['css_class'];
687
-                }
688
-                ?>
681
+			}else{
682
+				$value = '';
683
+				if (isset($field_info->css_class)) {
684
+					$value = esc_attr($field_info->css_class);
685
+				}elseif(isset($cf['defaults']['css_class']) && $cf['defaults']['css_class']){
686
+					$value = $cf['defaults']['css_class'];
687
+				}
688
+				?>
689 689
                 <li>
690 690
 
691 691
                     <label for="css_class" class="gd-cf-tooltip-wrap">
@@ -698,47 +698,47 @@  discard block
 block discarded – undo
698 698
                     <div class="gd-cf-input-wrap">
699 699
                         <input type="text" name="css_class" id="css_class"
700 700
                                value="<?php if (isset($field_info->css_class)) {
701
-                                   echo esc_attr($field_info->css_class);
702
-                               }?>"/>
701
+								   echo esc_attr($field_info->css_class);
702
+							   }?>"/>
703 703
                     </div>
704 704
                 </li>
705 705
                 <?php
706
-            }
706
+			}
707 707
 
708 708
 
709
-            // cat_sort
710
-            if(has_filter("geodir_cfa_cat_sort_{$field_type}")){
709
+			// cat_sort
710
+			if(has_filter("geodir_cfa_cat_sort_{$field_type}")){
711 711
 
712
-                echo apply_filters("geodir_cfa_cat_sort_{$field_type}",'',$result_str,$cf,$field_info);
712
+				echo apply_filters("geodir_cfa_cat_sort_{$field_type}",'',$result_str,$cf,$field_info);
713 713
 
714
-            }else{
715
-                $value = '';
716
-                $hide_cat_sort  ='';
717
-                if (isset($field_info->cat_sort)) {
718
-                    $value = esc_attr($field_info->cat_sort);
719
-                }elseif(isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort']){
720
-                    $value = $cf['defaults']['cat_sort'];
721
-                    $hide_cat_sort = ($value===false) ? "style='display:none;'" : '';
722
-                }
714
+			}else{
715
+				$value = '';
716
+				$hide_cat_sort  ='';
717
+				if (isset($field_info->cat_sort)) {
718
+					$value = esc_attr($field_info->cat_sort);
719
+				}elseif(isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort']){
720
+					$value = $cf['defaults']['cat_sort'];
721
+					$hide_cat_sort = ($value===false) ? "style='display:none;'" : '';
722
+				}
723 723
 
724
-                $hide_cat_sort = (isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort']===false) ? "style='display:none;'" : '';
725
-                ?>
724
+				$hide_cat_sort = (isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort']===false) ? "style='display:none;'" : '';
725
+				?>
726 726
                 <li <?php echo $hide_cat_sort ;?>>
727 727
                     <h3><?php
728
-                        /**
729
-                         * Filter the section title.
730
-                         *
731
-                         * Filter the section title in custom field form in admin
732
-                         * custom fields settings.
733
-                         *
734
-                         * @since 1.0.0
735
-                         *
736
-                         * @param string $title Title of the section.
737
-                         * @param string $field_type Current field type.
738
-                         */
739
-                        echo apply_filters('geodir_advance_custom_fields_heading', __('Posts sort options', 'geodirectory'), $field_type);
740
-
741
-                        ?></h3>
728
+						/**
729
+						 * Filter the section title.
730
+						 *
731
+						 * Filter the section title in custom field form in admin
732
+						 * custom fields settings.
733
+						 *
734
+						 * @since 1.0.0
735
+						 *
736
+						 * @param string $title Title of the section.
737
+						 * @param string $field_type Current field type.
738
+						 */
739
+						echo apply_filters('geodir_advance_custom_fields_heading', __('Posts sort options', 'geodirectory'), $field_type);
740
+
741
+						?></h3>
742 742
                     <label for="cat_sort" class="gd-cf-tooltip-wrap">
743 743
                         <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Include this field in sorting options :', 'geodirectory'); ?>
744 744
                         <div class="gdcf-tooltip">
@@ -750,42 +750,42 @@  discard block
 block discarded – undo
750 750
 
751 751
                         <input type="radio" id="cat_sort_yes<?php echo $radio_id;?>" name="cat_sort" class="gdri-enabled"  value="1"
752 752
                             <?php if ($value == '1') {
753
-                                echo 'checked';
754
-                            } ?>/>
753
+								echo 'checked';
754
+							} ?>/>
755 755
                         <label for="cat_sort_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
756 756
 
757 757
                         <input type="radio" id="cat_sort_no<?php echo $radio_id;?>" name="cat_sort" class="gdri-disabled" value="0"
758 758
                             <?php if (!$value) {
759
-                                echo 'checked';
760
-                            } ?>/>
759
+								echo 'checked';
760
+							} ?>/>
761 761
                         <label for="cat_sort_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
762 762
 
763 763
                     </div>
764 764
                 </li>
765 765
                 <?php
766
-            }
767
-
768
-
769
-
770
-            switch ($field_type):
771
-                case 'html':
772
-                case 'file':
773
-                case 'url':
774
-                case 'fieldset':
775
-                    break;
776
-                default:
777
-
778
-                    /**
779
-                     * Called at the end of the advanced custom fields settings page loop.
780
-                     *
781
-                     * Can be used to add or deal with different settings types.
782
-                     *
783
-                     * @since 1.0.0
784
-                     * @since 1.6.6 $cf param added.
785
-                     * @param object $field_info The current fields info.
786
-                     * @param array $cf The custom field settings
787
-                     */
788
-                    do_action('geodir_advance_custom_fields', $field_info,$cf);?>
766
+			}
767
+
768
+
769
+
770
+			switch ($field_type):
771
+				case 'html':
772
+				case 'file':
773
+				case 'url':
774
+				case 'fieldset':
775
+					break;
776
+				default:
777
+
778
+					/**
779
+					 * Called at the end of the advanced custom fields settings page loop.
780
+					 *
781
+					 * Can be used to add or deal with different settings types.
782
+					 *
783
+					 * @since 1.0.0
784
+					 * @since 1.6.6 $cf param added.
785
+					 * @param object $field_info The current fields info.
786
+					 * @param array $cf The custom field settings
787
+					 */
788
+					do_action('geodir_advance_custom_fields', $field_info,$cf);?>
789 789
 
790 790
 
791 791
                 <?php endswitch; ?>
Please login to merge, or discard this patch.
Spacing   +124 added lines, -124 removed lines patch added patch discarded remove patch
@@ -39,12 +39,12 @@  discard block
 block discarded – undo
39 39
 $cf = (isset($cf_arr[$field_type_key])) ? $cf_arr[$field_type_key] : '';
40 40
 
41 41
 
42
-if(isset($field_info->extra_fields)){$extra_fields = $field_info->extra_fields;}
42
+if (isset($field_info->extra_fields)) {$extra_fields = $field_info->extra_fields; }
43 43
 $field_info = stripslashes_deep($field_info); // strip slashes from labels
44
-if(isset($field_info->extra_fields)){$field_info->extra_fields = $extra_fields;}
44
+if (isset($field_info->extra_fields)) {$field_info->extra_fields = $extra_fields; }
45 45
 
46 46
 
47
-$nonce = wp_create_nonce('custom_fields_' . $result_str);
47
+$nonce = wp_create_nonce('custom_fields_'.$result_str);
48 48
 
49 49
 $field_admin_title = '';
50 50
 if (isset($field_info->admin_title))
@@ -69,15 +69,15 @@  discard block
 block discarded – undo
69 69
 
70 70
 if (isset($cf['icon']) && strpos($cf['icon'], 'fa fa-') !== false) {
71 71
     $field_icon = '<i class="'.$cf['icon'].'" aria-hidden="true"></i>';
72
-}elseif(isset($cf['icon']) && $cf['icon']){
72
+}elseif (isset($cf['icon']) && $cf['icon']) {
73 73
     $field_icon = '<b style="background-image: url("'.$cf['icon'].'")"></b>';
74
-}else{
74
+} else {
75 75
     $field_icon = '<i class="fa fa-cog" aria-hidden="true"></i>';
76 76
 }
77 77
 
78
-if(isset($cf['name']) && $cf['name']){
78
+if (isset($cf['name']) && $cf['name']) {
79 79
     $field_type_name = $cf['name'];
80
-}else{
80
+} else {
81 81
     $field_type_name = $field_type;
82 82
 }
83 83
 
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
          ondblclick="show_hide('field_frm<?php echo $result_str; ?>')">
89 89
         <?php
90 90
 
91
-        $nonce = wp_create_nonce('custom_fields_' . $result_str);
91
+        $nonce = wp_create_nonce('custom_fields_'.$result_str);
92 92
         ?>
93 93
 
94 94
         <?php if ($default): ?>
@@ -103,12 +103,12 @@  discard block
 block discarded – undo
103 103
             <i class="fa fa-long-arrow-left " aria-hidden="true"></i>
104 104
             <i class="fa fa-long-arrow-right " aria-hidden="true"></i>
105 105
             <b style="cursor:pointer;"
106
-               onclick="show_hide('field_frm<?php echo $result_str;?>')"><?php echo geodir_ucwords(__('Fieldset:', 'geodirectory') . ' ' . $field_admin_title);?></b>
106
+               onclick="show_hide('field_frm<?php echo $result_str; ?>')"><?php echo geodir_ucwords(__('Fieldset:', 'geodirectory').' '.$field_admin_title); ?></b>
107 107
         <?php
108 108
         } else {echo $field_icon;
109 109
             ?>
110 110
             <b style="cursor:pointer;"
111
-               onclick="show_hide('field_frm<?php echo $result_str;?>')"><?php echo geodir_ucwords(' ' . $field_admin_title . ' (' . $field_type_name . ')');?></b>
111
+               onclick="show_hide('field_frm<?php echo $result_str; ?>')"><?php echo geodir_ucwords(' '.$field_admin_title.' ('.$field_type_name.')'); ?></b>
112 112
         <?php
113 113
         }
114 114
         ?>
@@ -131,43 +131,43 @@  discard block
 block discarded – undo
131 131
         } ?>"/>
132 132
         <input type="hidden" name="is_active" id="is_active" value="1"/>
133 133
 
134
-        <input type="hidden" name="is_default" value="<?php echo isset($field_info->is_default) ? $field_info->is_default : '';?>" /><?php // show in sidebar value?>
135
-        <input type="hidden" name="show_on_listing" value="<?php echo isset($field_info->show_on_listing) ? $field_info->show_on_listing : '';?>" />
136
-        <input type="hidden" name="show_on_detail" value="<?php echo isset($field_info->show_on_listing) ? $field_info->show_on_listing : '';?>" />
137
-        <input type="hidden" name="show_as_tab" value="<?php echo isset($field_info->show_as_tab) ? $field_info->show_as_tab : '';?>" />
134
+        <input type="hidden" name="is_default" value="<?php echo isset($field_info->is_default) ? $field_info->is_default : ''; ?>" /><?php // show in sidebar value?>
135
+        <input type="hidden" name="show_on_listing" value="<?php echo isset($field_info->show_on_listing) ? $field_info->show_on_listing : ''; ?>" />
136
+        <input type="hidden" name="show_on_detail" value="<?php echo isset($field_info->show_on_listing) ? $field_info->show_on_listing : ''; ?>" />
137
+        <input type="hidden" name="show_as_tab" value="<?php echo isset($field_info->show_as_tab) ? $field_info->show_as_tab : ''; ?>" />
138 138
 
139 139
         <ul class="widefat post fixed" border="0" style="width:100%;">
140 140
 
141 141
             <?php
142 142
 
143 143
             // data_type
144
-            if(has_filter("geodir_cfa_data_type_{$field_type}")){
144
+            if (has_filter("geodir_cfa_data_type_{$field_type}")) {
145 145
 
146
-                echo apply_filters("geodir_cfa_data_type_{$field_type}",'',$result_str,$cf,$field_info);
146
+                echo apply_filters("geodir_cfa_data_type_{$field_type}", '', $result_str, $cf, $field_info);
147 147
 
148
-            }else{
148
+            } else {
149 149
                 $value = '';
150 150
                 if (isset($field_info->data_type)) {
151 151
                     $value = esc_attr($field_info->data_type);
152
-                }elseif(isset($cf['defaults']['data_type']) && $cf['defaults']['data_type']){
152
+                }elseif (isset($cf['defaults']['data_type']) && $cf['defaults']['data_type']) {
153 153
                     $value = $cf['defaults']['data_type'];
154 154
                 }
155 155
                 ?>
156
-                <input type="hidden" name="data_type" id="data_type" value="<?php echo $value;?>"/>
156
+                <input type="hidden" name="data_type" id="data_type" value="<?php echo $value; ?>"/>
157 157
             <?php
158 158
             }
159 159
 
160 160
 
161 161
             // admin_title
162
-            if(has_filter("geodir_cfa_admin_title_{$field_type}")){
162
+            if (has_filter("geodir_cfa_admin_title_{$field_type}")) {
163 163
 
164
-                echo apply_filters("geodir_cfa_admin_title_{$field_type}",'',$result_str,$cf,$field_info);
164
+                echo apply_filters("geodir_cfa_admin_title_{$field_type}", '', $result_str, $cf, $field_info);
165 165
 
166
-            }else{
166
+            } else {
167 167
                 $value = '';
168 168
                 if (isset($field_info->admin_title)) {
169 169
                     $value = esc_attr($field_info->admin_title);
170
-                }elseif(isset($cf['defaults']['admin_title']) && $cf['defaults']['admin_title']){
170
+                }elseif (isset($cf['defaults']['admin_title']) && $cf['defaults']['admin_title']) {
171 171
                     $value = $cf['defaults']['admin_title'];
172 172
                 }
173 173
                 ?>
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
                     </label>
181 181
                     <div class="gd-cf-input-wrap">
182 182
                         <input type="text" name="admin_title" id="admin_title"
183
-                               value="<?php echo $value;?>"/>
183
+                               value="<?php echo $value; ?>"/>
184 184
                     </div>
185 185
                 </li>
186 186
                 <?php
@@ -188,15 +188,15 @@  discard block
 block discarded – undo
188 188
 
189 189
 
190 190
             // site_title
191
-            if(has_filter("geodir_cfa_site_title_{$field_type}")){
191
+            if (has_filter("geodir_cfa_site_title_{$field_type}")) {
192 192
 
193
-                echo apply_filters("geodir_cfa_site_title_{$field_type}",'',$result_str,$cf,$field_info);
193
+                echo apply_filters("geodir_cfa_site_title_{$field_type}", '', $result_str, $cf, $field_info);
194 194
 
195
-            }else{
195
+            } else {
196 196
                 $value = '';
197 197
                 if (isset($field_info->site_title)) {
198 198
                     $value = esc_attr($field_info->site_title);
199
-                }elseif(isset($cf['defaults']['site_title']) && $cf['defaults']['site_title']){
199
+                }elseif (isset($cf['defaults']['site_title']) && $cf['defaults']['site_title']) {
200 200
                     $value = $cf['defaults']['site_title'];
201 201
                 }
202 202
                 ?>
@@ -216,15 +216,15 @@  discard block
 block discarded – undo
216 216
 
217 217
 
218 218
             // admin_desc
219
-            if(has_filter("geodir_cfa_admin_desc_{$field_type}")){
219
+            if (has_filter("geodir_cfa_admin_desc_{$field_type}")) {
220 220
 
221
-                echo apply_filters("geodir_cfa_admin_desc_{$field_type}",'',$result_str,$cf,$field_info);
221
+                echo apply_filters("geodir_cfa_admin_desc_{$field_type}", '', $result_str, $cf, $field_info);
222 222
 
223
-            }else{
223
+            } else {
224 224
                 $value = '';
225 225
                 if (isset($field_info->admin_desc)) {
226 226
                     $value = esc_attr($field_info->admin_desc);
227
-                }elseif(isset($cf['defaults']['admin_desc']) && $cf['defaults']['admin_desc']){
227
+                }elseif (isset($cf['defaults']['admin_desc']) && $cf['defaults']['admin_desc']) {
228 228
                     $value = $cf['defaults']['admin_desc'];
229 229
                 }
230 230
                 ?>
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
                         </div>
236 236
                     </label>
237 237
                     <div class="gd-cf-input-wrap">
238
-                        <input type="text" name="admin_desc" id="admin_desc" value="<?php echo $value;?>"/>
238
+                        <input type="text" name="admin_desc" id="admin_desc" value="<?php echo $value; ?>"/>
239 239
                     </div>
240 240
                 </li>
241 241
                 <?php
@@ -244,26 +244,26 @@  discard block
 block discarded – undo
244 244
 
245 245
 
246 246
             // htmlvar_name
247
-            if(has_filter("geodir_cfa_htmlvar_name_{$field_type}")){
247
+            if (has_filter("geodir_cfa_htmlvar_name_{$field_type}")) {
248 248
 
249
-                echo apply_filters("geodir_cfa_htmlvar_name_{$field_type}",'',$result_str,$cf,$field_info);
249
+                echo apply_filters("geodir_cfa_htmlvar_name_{$field_type}", '', $result_str, $cf, $field_info);
250 250
 
251
-            }else{
251
+            } else {
252 252
                 $value = '';
253 253
                 if (isset($field_info->htmlvar_name)) {
254 254
                     $value = esc_attr($field_info->htmlvar_name);
255
-                }elseif(isset($cf['defaults']['htmlvar_name']) && $cf['defaults']['htmlvar_name']){
255
+                }elseif (isset($cf['defaults']['htmlvar_name']) && $cf['defaults']['htmlvar_name']) {
256 256
                     $value = $cf['defaults']['htmlvar_name'];
257 257
                 }
258 258
                 ?>
259 259
                 <li>
260
-                    <label for="htmlvar_name" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('HTML variable name :', 'geodirectory');?>
260
+                    <label for="htmlvar_name" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('HTML variable name :', 'geodirectory'); ?>
261 261
                         <div class="gdcf-tooltip">
262 262
                             <?php _e('This is a unique identifier used in the HTML, it MUST NOT contain spaces or special characters.', 'geodirectory'); ?>
263 263
                         </div>
264 264
                     </label>
265 265
                     <div class="gd-cf-input-wrap">
266
-                        <input type="text" name="htmlvar_name" id="htmlvar_name" pattern="[a-zA-Z0-9]+" title="<?php _e('Must not contain spaces or special characters', 'geodirectory');?>"
266
+                        <input type="text" name="htmlvar_name" id="htmlvar_name" pattern="[a-zA-Z0-9]+" title="<?php _e('Must not contain spaces or special characters', 'geodirectory'); ?>"
267 267
                                value="<?php if ($value) {
268 268
                                    echo preg_replace('/geodir_/', '', $value, 1);
269 269
                                }?>" <?php if ($default) {
@@ -276,15 +276,15 @@  discard block
 block discarded – undo
276 276
 
277 277
 
278 278
             // is_active
279
-            if(has_filter("geodir_cfa_is_active_{$field_type}")){
279
+            if (has_filter("geodir_cfa_is_active_{$field_type}")) {
280 280
 
281
-                echo apply_filters("geodir_cfa_is_active_{$field_type}",'',$result_str,$cf,$field_info);
281
+                echo apply_filters("geodir_cfa_is_active_{$field_type}", '', $result_str, $cf, $field_info);
282 282
 
283
-            }else{
283
+            } else {
284 284
                 $value = '';
285 285
                 if (isset($field_info->is_active)) {
286 286
                     $value = esc_attr($field_info->is_active);
287
-                }elseif(isset($cf['defaults']['is_active']) && $cf['defaults']['is_active']){
287
+                }elseif (isset($cf['defaults']['is_active']) && $cf['defaults']['is_active']) {
288 288
                     $value = $cf['defaults']['is_active'];
289 289
                 }
290 290
                 ?>
@@ -296,17 +296,17 @@  discard block
 block discarded – undo
296 296
                     </label>
297 297
                     <div class="gd-cf-input-wrap gd-switch">
298 298
 
299
-                        <input type="radio" id="is_active_yes<?php echo $radio_id;?>" name="is_active" class="gdri-enabled"  value="1"
299
+                        <input type="radio" id="is_active_yes<?php echo $radio_id; ?>" name="is_active" class="gdri-enabled"  value="1"
300 300
                             <?php if ($value == '1') {
301 301
                                 echo 'checked';
302 302
                             } ?>/>
303
-                        <label for="is_active_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
303
+                        <label for="is_active_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
304 304
 
305
-                        <input type="radio" id="is_active_no<?php echo $radio_id;?>" name="is_active" class="gdri-disabled" value="0"
305
+                        <input type="radio" id="is_active_no<?php echo $radio_id; ?>" name="is_active" class="gdri-disabled" value="0"
306 306
                             <?php if ($value == '0' || !$value) {
307 307
                                 echo 'checked';
308 308
                             } ?>/>
309
-                        <label for="is_active_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
309
+                        <label for="is_active_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
310 310
 
311 311
                     </div>
312 312
                 </li>
@@ -315,15 +315,15 @@  discard block
 block discarded – undo
315 315
 
316 316
 
317 317
             // for_admin_use
318
-            if(has_filter("geodir_cfa_for_admin_use_{$field_type}")){
318
+            if (has_filter("geodir_cfa_for_admin_use_{$field_type}")) {
319 319
 
320
-                echo apply_filters("geodir_cfa_for_admin_use_{$field_type}",'',$result_str,$cf,$field_info);
320
+                echo apply_filters("geodir_cfa_for_admin_use_{$field_type}", '', $result_str, $cf, $field_info);
321 321
 
322
-            }else{
322
+            } else {
323 323
                 $value = '';
324 324
                 if (isset($field_info->for_admin_use)) {
325 325
                     $value = esc_attr($field_info->for_admin_use);
326
-                }elseif(isset($cf['defaults']['for_admin_use']) && $cf['defaults']['for_admin_use']){
326
+                }elseif (isset($cf['defaults']['for_admin_use']) && $cf['defaults']['for_admin_use']) {
327 327
                     $value = $cf['defaults']['for_admin_use'];
328 328
                 }
329 329
                 ?>
@@ -335,17 +335,17 @@  discard block
 block discarded – undo
335 335
                     </label>
336 336
                     <div class="gd-cf-input-wrap gd-switch">
337 337
 
338
-                        <input type="radio" id="for_admin_use_yes<?php echo $radio_id;?>" name="for_admin_use" class="gdri-enabled"  value="1"
338
+                        <input type="radio" id="for_admin_use_yes<?php echo $radio_id; ?>" name="for_admin_use" class="gdri-enabled"  value="1"
339 339
                             <?php if ($value == '1') {
340 340
                                 echo 'checked';
341 341
                             } ?>/>
342
-                        <label for="for_admin_use_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
342
+                        <label for="for_admin_use_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
343 343
 
344
-                        <input type="radio" id="for_admin_use_no<?php echo $radio_id;?>" name="for_admin_use" class="gdri-disabled" value="0"
344
+                        <input type="radio" id="for_admin_use_no<?php echo $radio_id; ?>" name="for_admin_use" class="gdri-disabled" value="0"
345 345
                             <?php if ($value == '0' || !$value) {
346 346
                                 echo 'checked';
347 347
                             } ?>/>
348
-                        <label for="for_admin_use_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
348
+                        <label for="for_admin_use_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
349 349
 
350 350
                     </div>
351 351
                 </li>
@@ -354,20 +354,20 @@  discard block
 block discarded – undo
354 354
 
355 355
 
356 356
             // default_value
357
-            if(has_filter("geodir_cfa_default_value_{$field_type}")){
357
+            if (has_filter("geodir_cfa_default_value_{$field_type}")) {
358 358
 
359
-                echo apply_filters("geodir_cfa_default_value_{$field_type}",'',$result_str,$cf,$field_info);
359
+                echo apply_filters("geodir_cfa_default_value_{$field_type}", '', $result_str, $cf, $field_info);
360 360
 
361
-            }else{
361
+            } else {
362 362
                 $value = '';
363 363
                 if (isset($field_info->default_value)) {
364 364
                     $value = esc_attr($field_info->default_value);
365
-                }elseif(isset($cf['defaults']['default_value']) && $cf['defaults']['default_value']){
365
+                }elseif (isset($cf['defaults']['default_value']) && $cf['defaults']['default_value']) {
366 366
                     $value = $cf['defaults']['default_value'];
367 367
                 }
368 368
                 ?>
369 369
                 <li>
370
-                    <label for="default_value" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Default value :', 'geodirectory');?>
370
+                    <label for="default_value" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Default value :', 'geodirectory'); ?>
371 371
                         <div class="gdcf-tooltip">
372 372
                             <?php
373 373
                             if ($field_type == 'checkbox') {
@@ -384,12 +384,12 @@  discard block
 block discarded – undo
384 384
                         <?php if ($field_type == 'checkbox') { ?>
385 385
                             <select name="default_value" id="default_value">
386 386
                                 <option value=""><?php _e('Unchecked', 'geodirectory'); ?></option>
387
-                                <option value="1" <?php selected(true, (int)$value === 1);?>><?php _e('Checked', 'geodirectory'); ?></option>
387
+                                <option value="1" <?php selected(true, (int) $value === 1); ?>><?php _e('Checked', 'geodirectory'); ?></option>
388 388
                             </select>
389 389
                         <?php } else if ($field_type == 'email') { ?>
390
-                            <input type="email" name="default_value" placeholder="<?php _e('[email protected]', 'geodirectory') ;?>" id="default_value" value="<?php echo esc_attr($value);?>" /><br/>
390
+                            <input type="email" name="default_value" placeholder="<?php _e('[email protected]', 'geodirectory'); ?>" id="default_value" value="<?php echo esc_attr($value); ?>" /><br/>
391 391
                         <?php } else { ?>
392
-                            <input type="text" name="default_value" id="default_value" value="<?php echo esc_attr($value);?>" /><br/>
392
+                            <input type="text" name="default_value" id="default_value" value="<?php echo esc_attr($value); ?>" /><br/>
393 393
                         <?php } ?>
394 394
                     </div>
395 395
                 </li>
@@ -398,15 +398,15 @@  discard block
 block discarded – undo
398 398
 
399 399
 
400 400
             // show_in
401
-            if(has_filter("geodir_cfa_show_in_{$field_type}")){
401
+            if (has_filter("geodir_cfa_show_in_{$field_type}")) {
402 402
 
403
-                echo apply_filters("geodir_cfa_show_in_{$field_type}",'',$result_str,$cf,$field_info);
403
+                echo apply_filters("geodir_cfa_show_in_{$field_type}", '', $result_str, $cf, $field_info);
404 404
 
405
-            }else{
405
+            } else {
406 406
                 $value = '';
407 407
                 if (isset($field_info->show_in)) {
408 408
                     $value = esc_attr($field_info->show_in);
409
-                }elseif(isset($cf['defaults']['show_in']) && $cf['defaults']['show_in']){
409
+                }elseif (isset($cf['defaults']['show_in']) && $cf['defaults']['show_in']) {
410 410
                     $value = esc_attr($cf['defaults']['show_in']);
411 411
                 }
412 412
                 ?>
@@ -439,18 +439,18 @@  discard block
 block discarded – undo
439 439
                          * @param object $field_info The field being displayed info.
440 440
                          * @param string $field_info The type of field.
441 441
                          */
442
-                        $show_in_locations = apply_filters('geodir_show_in_locations',$show_in_locations,$field_info,$field_type);
442
+                        $show_in_locations = apply_filters('geodir_show_in_locations', $show_in_locations, $field_info, $field_type);
443 443
 
444 444
 
445 445
                         // remove some locations for some field types
446 446
 
447 447
                         // don't show new tab option for some types
448
-                        if (in_array($field_type, array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file','address','taxonomy'))) {
449
-                        }else{
448
+                        if (in_array($field_type, array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file', 'address', 'taxonomy'))) {
449
+                        } else {
450 450
                             unset($show_in_locations['[owntab]']);
451 451
                         }
452 452
 
453
-                        if(!$display_on_listing){
453
+                        if (!$display_on_listing) {
454 454
                             unset($show_in_locations['[listings]']);
455 455
                         }
456 456
 
@@ -464,17 +464,17 @@  discard block
 block discarded – undo
464 464
                                 option-ajaxchosen="false">
465 465
                             <?php
466 466
 
467
-                            $show_in_values = explode(',',$value);
467
+                            $show_in_values = explode(',', $value);
468 468
 
469
-                            foreach( $show_in_locations as $key => $val){
469
+                            foreach ($show_in_locations as $key => $val) {
470 470
                                 $selected = '';
471 471
 
472
-                                if(is_array($show_in_values) && in_array($key,$show_in_values ) ){
472
+                                if (is_array($show_in_values) && in_array($key, $show_in_values)) {
473 473
                                     $selected = 'selected';
474 474
                                 }
475 475
 
476 476
                                 ?>
477
-                                <option  value="<?php echo $key;?>" <?php echo $selected;?>><?php echo $val;?></option>
477
+                                <option  value="<?php echo $key; ?>" <?php echo $selected; ?>><?php echo $val; ?></option>
478 478
                                 <?php
479 479
                             }
480 480
                             ?>
@@ -486,9 +486,9 @@  discard block
 block discarded – undo
486 486
 
487 487
 
488 488
             // advanced_editor
489
-            if(has_filter("geodir_cfa_advanced_editor_{$field_type}")){
489
+            if (has_filter("geodir_cfa_advanced_editor_{$field_type}")) {
490 490
 
491
-                echo apply_filters("geodir_cfa_advanced_editor_{$field_type}",'',$result_str,$cf,$field_info);
491
+                echo apply_filters("geodir_cfa_advanced_editor_{$field_type}", '', $result_str, $cf, $field_info);
492 492
 
493 493
             }
494 494
 
@@ -499,10 +499,10 @@  discard block
 block discarded – undo
499 499
 
500 500
 
501 501
             <?php // @todo this does not seem to be used for anything, it can be removed or replaced ?>
502
-            <input type="hidden" name="clabels" id="clabels" value="<?php if (isset($field_info->clabels)) { echo esc_attr($field_info->clabels);} ?>"/>
502
+            <input type="hidden" name="clabels" id="clabels" value="<?php if (isset($field_info->clabels)) { echo esc_attr($field_info->clabels); } ?>"/>
503 503
 
504 504
             <?php // we dont need to show the sort order ?>
505
-            <input type="hidden" readonly="readonly" name="sort_order" id="sort_order" value="<?php if (isset($field_info->sort_order)) { echo esc_attr($field_info->sort_order);} ?>"/>
505
+            <input type="hidden" readonly="readonly" name="sort_order" id="sort_order" value="<?php if (isset($field_info->sort_order)) { echo esc_attr($field_info->sort_order); } ?>"/>
506 506
 
507 507
 
508 508
 
@@ -555,15 +555,15 @@  discard block
 block discarded – undo
555 555
             <?php
556 556
 
557 557
             // is_required
558
-            if(has_filter("geodir_cfa_is_required_{$field_type}")){
558
+            if (has_filter("geodir_cfa_is_required_{$field_type}")) {
559 559
 
560
-                echo apply_filters("geodir_cfa_is_required_{$field_type}",'',$result_str,$cf,$field_info);
560
+                echo apply_filters("geodir_cfa_is_required_{$field_type}", '', $result_str, $cf, $field_info);
561 561
 
562
-            }else{
562
+            } else {
563 563
                 $value = '';
564 564
                 if (isset($field_info->is_required)) {
565 565
                     $value = esc_attr($field_info->is_required);
566
-                }elseif(isset($cf['defaults']['is_required']) && $cf['defaults']['is_required']){
566
+                }elseif (isset($cf['defaults']['is_required']) && $cf['defaults']['is_required']) {
567 567
                     $value = $cf['defaults']['is_required'];
568 568
                 }
569 569
                 ?>
@@ -576,17 +576,17 @@  discard block
 block discarded – undo
576 576
 
577 577
                     <div class="gd-cf-input-wrap gd-switch">
578 578
 
579
-                        <input type="radio" id="is_required_yes<?php echo $radio_id;?>" name="is_required" class="gdri-enabled"  value="1"
579
+                        <input type="radio" id="is_required_yes<?php echo $radio_id; ?>" name="is_required" class="gdri-enabled"  value="1"
580 580
                             <?php if ($value == '1') {
581 581
                                 echo 'checked';
582 582
                             } ?>/>
583
-                        <label onclick="show_hide_radio(this,'show','cf-is-required-msg');" for="is_required_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
583
+                        <label onclick="show_hide_radio(this,'show','cf-is-required-msg');" for="is_required_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
584 584
 
585
-                        <input type="radio" id="is_required_no<?php echo $radio_id;?>" name="is_required" class="gdri-disabled" value="0"
585
+                        <input type="radio" id="is_required_no<?php echo $radio_id; ?>" name="is_required" class="gdri-disabled" value="0"
586 586
                             <?php if ($value == '0' || !$value) {
587 587
                                 echo 'checked';
588 588
                             } ?>/>
589
-                        <label onclick="show_hide_radio(this,'hide','cf-is-required-msg');" for="is_required_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
589
+                        <label onclick="show_hide_radio(this,'hide','cf-is-required-msg');" for="is_required_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
590 590
 
591 591
                     </div>
592 592
 
@@ -596,19 +596,19 @@  discard block
 block discarded – undo
596 596
             }
597 597
 
598 598
             // required_msg
599
-            if(has_filter("geodir_cfa_required_msg_{$field_type}")){
599
+            if (has_filter("geodir_cfa_required_msg_{$field_type}")) {
600 600
 
601
-                echo apply_filters("geodir_cfa_required_msg_{$field_type}",'',$result_str,$cf,$field_info);
601
+                echo apply_filters("geodir_cfa_required_msg_{$field_type}", '', $result_str, $cf, $field_info);
602 602
 
603
-            }else{
603
+            } else {
604 604
                 $value = '';
605 605
                 if (isset($field_info->required_msg)) {
606 606
                     $value = esc_attr($field_info->required_msg);
607
-                }elseif(isset($cf['defaults']['required_msg']) && $cf['defaults']['required_msg']){
607
+                }elseif (isset($cf['defaults']['required_msg']) && $cf['defaults']['required_msg']) {
608 608
                     $value = $cf['defaults']['required_msg'];
609 609
                 }
610 610
                 ?>
611
-                <li class="cf-is-required-msg" <?php if ((isset($field_info->is_required) && $field_info->is_required == '0') || !isset($field_info->is_required)) {echo "style='display:none;'";}?>>
611
+                <li class="cf-is-required-msg" <?php if ((isset($field_info->is_required) && $field_info->is_required == '0') || !isset($field_info->is_required)) {echo "style='display:none;'"; }?>>
612 612
                     <label for="required_msg" class="gd-cf-tooltip-wrap">
613 613
                         <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Required message:', 'geodirectory'); ?>
614 614
                         <div class="gdcf-tooltip">
@@ -625,31 +625,31 @@  discard block
 block discarded – undo
625 625
 
626 626
 
627 627
             // required_msg
628
-            if(has_filter("geodir_cfa_validation_pattern_{$field_type}")){
628
+            if (has_filter("geodir_cfa_validation_pattern_{$field_type}")) {
629 629
 
630
-                echo apply_filters("geodir_cfa_validation_pattern_{$field_type}",'',$result_str,$cf,$field_info);
630
+                echo apply_filters("geodir_cfa_validation_pattern_{$field_type}", '', $result_str, $cf, $field_info);
631 631
 
632 632
             }
633 633
 
634 634
 
635 635
             // extra_fields
636
-            if(has_filter("geodir_cfa_extra_fields_{$field_type}")){
636
+            if (has_filter("geodir_cfa_extra_fields_{$field_type}")) {
637 637
 
638
-                echo apply_filters("geodir_cfa_extra_fields_{$field_type}",'',$result_str,$cf,$field_info);
638
+                echo apply_filters("geodir_cfa_extra_fields_{$field_type}", '', $result_str, $cf, $field_info);
639 639
 
640 640
             }
641 641
 
642 642
 
643 643
             // field_icon
644
-            if(has_filter("geodir_cfa_field_icon_{$field_type}")){
644
+            if (has_filter("geodir_cfa_field_icon_{$field_type}")) {
645 645
 
646
-                echo apply_filters("geodir_cfa_field_icon_{$field_type}",'',$result_str,$cf,$field_info);
646
+                echo apply_filters("geodir_cfa_field_icon_{$field_type}", '', $result_str, $cf, $field_info);
647 647
 
648
-            }else{
648
+            } else {
649 649
                 $value = '';
650 650
                 if (isset($field_info->field_icon)) {
651 651
                     $value = esc_attr($field_info->field_icon);
652
-                }elseif(isset($cf['defaults']['field_icon']) && $cf['defaults']['field_icon']){
652
+                }elseif (isset($cf['defaults']['field_icon']) && $cf['defaults']['field_icon']) {
653 653
                     $value = $cf['defaults']['field_icon'];
654 654
                 }
655 655
                 ?>
@@ -660,12 +660,12 @@  discard block
 block discarded – undo
660 660
                     <label for="field_icon" class="gd-cf-tooltip-wrap">
661 661
                         <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Upload icon :', 'geodirectory'); ?>
662 662
                         <div class="gdcf-tooltip">
663
-                            <?php _e('Upload icon using media and enter its url path, or enter <a href="http://fortawesome.github.io/Font-Awesome/icons/" target="_blank" >font awesome </a>class eg:"fa fa-home"', 'geodirectory');?>
663
+                            <?php _e('Upload icon using media and enter its url path, or enter <a href="http://fortawesome.github.io/Font-Awesome/icons/" target="_blank" >font awesome </a>class eg:"fa fa-home"', 'geodirectory'); ?>
664 664
                         </div>
665 665
                     </label>
666 666
                     <div class="gd-cf-input-wrap">
667 667
                         <input type="text" name="field_icon" id="field_icon"
668
-                               value="<?php echo $value;?>"/>
668
+                               value="<?php echo $value; ?>"/>
669 669
                     </div>
670 670
 
671 671
                 </li>
@@ -674,15 +674,15 @@  discard block
 block discarded – undo
674 674
 
675 675
 
676 676
             // css_class
677
-            if(has_filter("geodir_cfa_css_class_{$field_type}")){
677
+            if (has_filter("geodir_cfa_css_class_{$field_type}")) {
678 678
 
679
-                echo apply_filters("geodir_cfa_css_class_{$field_type}",'',$result_str,$cf,$field_info);
679
+                echo apply_filters("geodir_cfa_css_class_{$field_type}", '', $result_str, $cf, $field_info);
680 680
 
681
-            }else{
681
+            } else {
682 682
                 $value = '';
683 683
                 if (isset($field_info->css_class)) {
684 684
                     $value = esc_attr($field_info->css_class);
685
-                }elseif(isset($cf['defaults']['css_class']) && $cf['defaults']['css_class']){
685
+                }elseif (isset($cf['defaults']['css_class']) && $cf['defaults']['css_class']) {
686 686
                     $value = $cf['defaults']['css_class'];
687 687
                 }
688 688
                 ?>
@@ -691,8 +691,8 @@  discard block
 block discarded – undo
691 691
                     <label for="css_class" class="gd-cf-tooltip-wrap">
692 692
                         <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Css class :', 'geodirectory'); ?>
693 693
                         <div class="gdcf-tooltip">
694
-                            <?php _e('Enter custom css class for field custom style.', 'geodirectory');?>
695
-                            <?php if($field_type=='multiselect'){_e('(Enter class `gd-comma-list` to show list as comma separated)', 'geodirectory');}?>
694
+                            <?php _e('Enter custom css class for field custom style.', 'geodirectory'); ?>
695
+                            <?php if ($field_type == 'multiselect') {_e('(Enter class `gd-comma-list` to show list as comma separated)', 'geodirectory'); }?>
696 696
                         </div>
697 697
                     </label>
698 698
                     <div class="gd-cf-input-wrap">
@@ -707,23 +707,23 @@  discard block
 block discarded – undo
707 707
 
708 708
 
709 709
             // cat_sort
710
-            if(has_filter("geodir_cfa_cat_sort_{$field_type}")){
710
+            if (has_filter("geodir_cfa_cat_sort_{$field_type}")) {
711 711
 
712
-                echo apply_filters("geodir_cfa_cat_sort_{$field_type}",'',$result_str,$cf,$field_info);
712
+                echo apply_filters("geodir_cfa_cat_sort_{$field_type}", '', $result_str, $cf, $field_info);
713 713
 
714
-            }else{
714
+            } else {
715 715
                 $value = '';
716
-                $hide_cat_sort  ='';
716
+                $hide_cat_sort = '';
717 717
                 if (isset($field_info->cat_sort)) {
718 718
                     $value = esc_attr($field_info->cat_sort);
719
-                }elseif(isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort']){
719
+                }elseif (isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort']) {
720 720
                     $value = $cf['defaults']['cat_sort'];
721
-                    $hide_cat_sort = ($value===false) ? "style='display:none;'" : '';
721
+                    $hide_cat_sort = ($value === false) ? "style='display:none;'" : '';
722 722
                 }
723 723
 
724
-                $hide_cat_sort = (isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort']===false) ? "style='display:none;'" : '';
724
+                $hide_cat_sort = (isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort'] === false) ? "style='display:none;'" : '';
725 725
                 ?>
726
-                <li <?php echo $hide_cat_sort ;?>>
726
+                <li <?php echo $hide_cat_sort; ?>>
727 727
                     <h3><?php
728 728
                         /**
729 729
                          * Filter the section title.
@@ -742,23 +742,23 @@  discard block
 block discarded – undo
742 742
                     <label for="cat_sort" class="gd-cf-tooltip-wrap">
743 743
                         <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Include this field in sorting options :', 'geodirectory'); ?>
744 744
                         <div class="gdcf-tooltip">
745
-                            <?php _e('Lets you use this filed as a sorting option, set from sorting options above.', 'geodirectory');?>
745
+                            <?php _e('Lets you use this filed as a sorting option, set from sorting options above.', 'geodirectory'); ?>
746 746
                         </div>
747 747
                     </label>
748 748
 
749 749
                     <div class="gd-cf-input-wrap gd-switch">
750 750
 
751
-                        <input type="radio" id="cat_sort_yes<?php echo $radio_id;?>" name="cat_sort" class="gdri-enabled"  value="1"
751
+                        <input type="radio" id="cat_sort_yes<?php echo $radio_id; ?>" name="cat_sort" class="gdri-enabled"  value="1"
752 752
                             <?php if ($value == '1') {
753 753
                                 echo 'checked';
754 754
                             } ?>/>
755
-                        <label for="cat_sort_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
755
+                        <label for="cat_sort_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
756 756
 
757
-                        <input type="radio" id="cat_sort_no<?php echo $radio_id;?>" name="cat_sort" class="gdri-disabled" value="0"
757
+                        <input type="radio" id="cat_sort_no<?php echo $radio_id; ?>" name="cat_sort" class="gdri-disabled" value="0"
758 758
                             <?php if (!$value) {
759 759
                                 echo 'checked';
760 760
                             } ?>/>
761
-                        <label for="cat_sort_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
761
+                        <label for="cat_sort_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
762 762
 
763 763
                     </div>
764 764
                 </li>
@@ -785,7 +785,7 @@  discard block
 block discarded – undo
785 785
                      * @param object $field_info The current fields info.
786 786
                      * @param array $cf The custom field settings
787 787
                      */
788
-                    do_action('geodir_advance_custom_fields', $field_info,$cf);?>
788
+                    do_action('geodir_advance_custom_fields', $field_info, $cf); ?>
789 789
 
790 790
 
791 791
                 <?php endswitch; ?>
@@ -797,10 +797,10 @@  discard block
 block discarded – undo
797 797
                     <h3></h3>
798 798
                 </label>
799 799
                 <div class="gd-cf-input-wrap">
800
-                    <input type="button" class="button button-primary" name="save" id="save" value="<?php echo esc_attr(__('Save','geodirectory'));?>"
800
+                    <input type="button" class="button button-primary" name="save" id="save" value="<?php echo esc_attr(__('Save', 'geodirectory')); ?>"
801 801
                            onclick="save_field('<?php echo esc_attr($result_str); ?>')"/>
802 802
                     <?php if (!$default): ?>
803
-                        <a href="javascript:void(0)"><input type="button" name="delete" value="<?php echo esc_attr(__('Delete','geodirectory'));?>"
803
+                        <a href="javascript:void(0)"><input type="button" name="delete" value="<?php echo esc_attr(__('Delete', 'geodirectory')); ?>"
804 804
                                                             onclick="delete_field('<?php echo esc_attr($result_str); ?>', '<?php echo $nonce; ?>')"
805 805
                                                             class="button"/></a>
806 806
                     <?php endif; ?>
Please login to merge, or discard this patch.
Braces   +43 added lines, -38 removed lines patch added patch discarded remove patch
@@ -19,8 +19,9 @@  discard block
 block discarded – undo
19 19
 
20 20
 if (!isset($field_info->post_type)) {
21 21
     $post_type = sanitize_text_field($_REQUEST['listing_type']);
22
-} else
23
-    $post_type = $field_info->post_type;
22
+} else {
23
+    $post_type = $field_info->post_type;
24
+}
24 25
 
25 26
 //if(isset($_REQUEST['custom_type']) && $_REQUEST['custom_type']=='predefined'){
26 27
 //    $cf_arr = geodir_custom_fields_predefined($post_type);
@@ -47,8 +48,9 @@  discard block
 block discarded – undo
47 48
 $nonce = wp_create_nonce('custom_fields_' . $result_str);
48 49
 
49 50
 $field_admin_title = '';
50
-if (isset($field_info->admin_title))
51
-    $field_admin_title = $field_info->admin_title;
51
+if (isset($field_info->admin_title)) {
52
+    $field_admin_title = $field_info->admin_title;
53
+}
52 54
 
53 55
 $default = isset($field_info->is_admin) ? $field_info->is_admin : '';
54 56
 
@@ -69,15 +71,15 @@  discard block
 block discarded – undo
69 71
 
70 72
 if (isset($cf['icon']) && strpos($cf['icon'], 'fa fa-') !== false) {
71 73
     $field_icon = '<i class="'.$cf['icon'].'" aria-hidden="true"></i>';
72
-}elseif(isset($cf['icon']) && $cf['icon']){
74
+} elseif(isset($cf['icon']) && $cf['icon']){
73 75
     $field_icon = '<b style="background-image: url("'.$cf['icon'].'")"></b>';
74
-}else{
76
+} else{
75 77
     $field_icon = '<i class="fa fa-cog" aria-hidden="true"></i>';
76 78
 }
77 79
 
78 80
 if(isset($cf['name']) && $cf['name']){
79 81
     $field_type_name = $cf['name'];
80
-}else{
82
+} else{
81 83
     $field_type_name = $field_type;
82 84
 }
83 85
 
@@ -93,8 +95,11 @@  discard block
 block discarded – undo
93 95
 
94 96
         <?php if ($default): ?>
95 97
             <div title="<?php _e('Default field, should not be removed.', 'geodirectory'); ?>" class="handlediv move gd-default-remove"><i class="fa fa-times" aria-hidden="true"></i></div>
96
-        <?php else: ?>
97
-            <div title="<?php _e('Click to remove field', 'geodirectory'); ?>"
98
+        <?php else {
99
+	: ?>
100
+            <div title="<?php _e('Click to remove field', 'geodirectory');
101
+}
102
+?>"
98 103
                  onclick="delete_field('<?php echo $result_str; ?>', '<?php echo $nonce; ?>')"
99 104
                  class="handlediv close"><i class="fa fa-times" aria-hidden="true"></i></div>
100 105
         <?php endif;
@@ -145,11 +150,11 @@  discard block
 block discarded – undo
145 150
 
146 151
                 echo apply_filters("geodir_cfa_data_type_{$field_type}",'',$result_str,$cf,$field_info);
147 152
 
148
-            }else{
153
+            } else{
149 154
                 $value = '';
150 155
                 if (isset($field_info->data_type)) {
151 156
                     $value = esc_attr($field_info->data_type);
152
-                }elseif(isset($cf['defaults']['data_type']) && $cf['defaults']['data_type']){
157
+                } elseif(isset($cf['defaults']['data_type']) && $cf['defaults']['data_type']){
153 158
                     $value = $cf['defaults']['data_type'];
154 159
                 }
155 160
                 ?>
@@ -163,11 +168,11 @@  discard block
 block discarded – undo
163 168
 
164 169
                 echo apply_filters("geodir_cfa_admin_title_{$field_type}",'',$result_str,$cf,$field_info);
165 170
 
166
-            }else{
171
+            } else{
167 172
                 $value = '';
168 173
                 if (isset($field_info->admin_title)) {
169 174
                     $value = esc_attr($field_info->admin_title);
170
-                }elseif(isset($cf['defaults']['admin_title']) && $cf['defaults']['admin_title']){
175
+                } elseif(isset($cf['defaults']['admin_title']) && $cf['defaults']['admin_title']){
171 176
                     $value = $cf['defaults']['admin_title'];
172 177
                 }
173 178
                 ?>
@@ -192,11 +197,11 @@  discard block
 block discarded – undo
192 197
 
193 198
                 echo apply_filters("geodir_cfa_site_title_{$field_type}",'',$result_str,$cf,$field_info);
194 199
 
195
-            }else{
200
+            } else{
196 201
                 $value = '';
197 202
                 if (isset($field_info->site_title)) {
198 203
                     $value = esc_attr($field_info->site_title);
199
-                }elseif(isset($cf['defaults']['site_title']) && $cf['defaults']['site_title']){
204
+                } elseif(isset($cf['defaults']['site_title']) && $cf['defaults']['site_title']){
200 205
                     $value = $cf['defaults']['site_title'];
201 206
                 }
202 207
                 ?>
@@ -220,11 +225,11 @@  discard block
 block discarded – undo
220 225
 
221 226
                 echo apply_filters("geodir_cfa_admin_desc_{$field_type}",'',$result_str,$cf,$field_info);
222 227
 
223
-            }else{
228
+            } else{
224 229
                 $value = '';
225 230
                 if (isset($field_info->admin_desc)) {
226 231
                     $value = esc_attr($field_info->admin_desc);
227
-                }elseif(isset($cf['defaults']['admin_desc']) && $cf['defaults']['admin_desc']){
232
+                } elseif(isset($cf['defaults']['admin_desc']) && $cf['defaults']['admin_desc']){
228 233
                     $value = $cf['defaults']['admin_desc'];
229 234
                 }
230 235
                 ?>
@@ -248,11 +253,11 @@  discard block
 block discarded – undo
248 253
 
249 254
                 echo apply_filters("geodir_cfa_htmlvar_name_{$field_type}",'',$result_str,$cf,$field_info);
250 255
 
251
-            }else{
256
+            } else{
252 257
                 $value = '';
253 258
                 if (isset($field_info->htmlvar_name)) {
254 259
                     $value = esc_attr($field_info->htmlvar_name);
255
-                }elseif(isset($cf['defaults']['htmlvar_name']) && $cf['defaults']['htmlvar_name']){
260
+                } elseif(isset($cf['defaults']['htmlvar_name']) && $cf['defaults']['htmlvar_name']){
256 261
                     $value = $cf['defaults']['htmlvar_name'];
257 262
                 }
258 263
                 ?>
@@ -280,11 +285,11 @@  discard block
 block discarded – undo
280 285
 
281 286
                 echo apply_filters("geodir_cfa_is_active_{$field_type}",'',$result_str,$cf,$field_info);
282 287
 
283
-            }else{
288
+            } else{
284 289
                 $value = '';
285 290
                 if (isset($field_info->is_active)) {
286 291
                     $value = esc_attr($field_info->is_active);
287
-                }elseif(isset($cf['defaults']['is_active']) && $cf['defaults']['is_active']){
292
+                } elseif(isset($cf['defaults']['is_active']) && $cf['defaults']['is_active']){
288 293
                     $value = $cf['defaults']['is_active'];
289 294
                 }
290 295
                 ?>
@@ -319,11 +324,11 @@  discard block
 block discarded – undo
319 324
 
320 325
                 echo apply_filters("geodir_cfa_for_admin_use_{$field_type}",'',$result_str,$cf,$field_info);
321 326
 
322
-            }else{
327
+            } else{
323 328
                 $value = '';
324 329
                 if (isset($field_info->for_admin_use)) {
325 330
                     $value = esc_attr($field_info->for_admin_use);
326
-                }elseif(isset($cf['defaults']['for_admin_use']) && $cf['defaults']['for_admin_use']){
331
+                } elseif(isset($cf['defaults']['for_admin_use']) && $cf['defaults']['for_admin_use']){
327 332
                     $value = $cf['defaults']['for_admin_use'];
328 333
                 }
329 334
                 ?>
@@ -358,11 +363,11 @@  discard block
 block discarded – undo
358 363
 
359 364
                 echo apply_filters("geodir_cfa_default_value_{$field_type}",'',$result_str,$cf,$field_info);
360 365
 
361
-            }else{
366
+            } else{
362 367
                 $value = '';
363 368
                 if (isset($field_info->default_value)) {
364 369
                     $value = esc_attr($field_info->default_value);
365
-                }elseif(isset($cf['defaults']['default_value']) && $cf['defaults']['default_value']){
370
+                } elseif(isset($cf['defaults']['default_value']) && $cf['defaults']['default_value']){
366 371
                     $value = $cf['defaults']['default_value'];
367 372
                 }
368 373
                 ?>
@@ -402,11 +407,11 @@  discard block
 block discarded – undo
402 407
 
403 408
                 echo apply_filters("geodir_cfa_show_in_{$field_type}",'',$result_str,$cf,$field_info);
404 409
 
405
-            }else{
410
+            } else{
406 411
                 $value = '';
407 412
                 if (isset($field_info->show_in)) {
408 413
                     $value = esc_attr($field_info->show_in);
409
-                }elseif(isset($cf['defaults']['show_in']) && $cf['defaults']['show_in']){
414
+                } elseif(isset($cf['defaults']['show_in']) && $cf['defaults']['show_in']){
410 415
                     $value = esc_attr($cf['defaults']['show_in']);
411 416
                 }
412 417
                 ?>
@@ -446,7 +451,7 @@  discard block
 block discarded – undo
446 451
 
447 452
                         // don't show new tab option for some types
448 453
                         if (in_array($field_type, array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file','address','taxonomy'))) {
449
-                        }else{
454
+                        } else{
450 455
                             unset($show_in_locations['[owntab]']);
451 456
                         }
452 457
 
@@ -559,11 +564,11 @@  discard block
 block discarded – undo
559 564
 
560 565
                 echo apply_filters("geodir_cfa_is_required_{$field_type}",'',$result_str,$cf,$field_info);
561 566
 
562
-            }else{
567
+            } else{
563 568
                 $value = '';
564 569
                 if (isset($field_info->is_required)) {
565 570
                     $value = esc_attr($field_info->is_required);
566
-                }elseif(isset($cf['defaults']['is_required']) && $cf['defaults']['is_required']){
571
+                } elseif(isset($cf['defaults']['is_required']) && $cf['defaults']['is_required']){
567 572
                     $value = $cf['defaults']['is_required'];
568 573
                 }
569 574
                 ?>
@@ -600,11 +605,11 @@  discard block
 block discarded – undo
600 605
 
601 606
                 echo apply_filters("geodir_cfa_required_msg_{$field_type}",'',$result_str,$cf,$field_info);
602 607
 
603
-            }else{
608
+            } else{
604 609
                 $value = '';
605 610
                 if (isset($field_info->required_msg)) {
606 611
                     $value = esc_attr($field_info->required_msg);
607
-                }elseif(isset($cf['defaults']['required_msg']) && $cf['defaults']['required_msg']){
612
+                } elseif(isset($cf['defaults']['required_msg']) && $cf['defaults']['required_msg']){
608 613
                     $value = $cf['defaults']['required_msg'];
609 614
                 }
610 615
                 ?>
@@ -645,11 +650,11 @@  discard block
 block discarded – undo
645 650
 
646 651
                 echo apply_filters("geodir_cfa_field_icon_{$field_type}",'',$result_str,$cf,$field_info);
647 652
 
648
-            }else{
653
+            } else{
649 654
                 $value = '';
650 655
                 if (isset($field_info->field_icon)) {
651 656
                     $value = esc_attr($field_info->field_icon);
652
-                }elseif(isset($cf['defaults']['field_icon']) && $cf['defaults']['field_icon']){
657
+                } elseif(isset($cf['defaults']['field_icon']) && $cf['defaults']['field_icon']){
653 658
                     $value = $cf['defaults']['field_icon'];
654 659
                 }
655 660
                 ?>
@@ -678,11 +683,11 @@  discard block
 block discarded – undo
678 683
 
679 684
                 echo apply_filters("geodir_cfa_css_class_{$field_type}",'',$result_str,$cf,$field_info);
680 685
 
681
-            }else{
686
+            } else{
682 687
                 $value = '';
683 688
                 if (isset($field_info->css_class)) {
684 689
                     $value = esc_attr($field_info->css_class);
685
-                }elseif(isset($cf['defaults']['css_class']) && $cf['defaults']['css_class']){
690
+                } elseif(isset($cf['defaults']['css_class']) && $cf['defaults']['css_class']){
686 691
                     $value = $cf['defaults']['css_class'];
687 692
                 }
688 693
                 ?>
@@ -711,12 +716,12 @@  discard block
 block discarded – undo
711 716
 
712 717
                 echo apply_filters("geodir_cfa_cat_sort_{$field_type}",'',$result_str,$cf,$field_info);
713 718
 
714
-            }else{
719
+            } else{
715 720
                 $value = '';
716 721
                 $hide_cat_sort  ='';
717 722
                 if (isset($field_info->cat_sort)) {
718 723
                     $value = esc_attr($field_info->cat_sort);
719
-                }elseif(isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort']){
724
+                } elseif(isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort']){
720 725
                     $value = $cf['defaults']['cat_sort'];
721 726
                     $hide_cat_sort = ($value===false) ? "style='display:none;'" : '';
722 727
                 }
Please login to merge, or discard this patch.
geodirectory-functions/listing_filters.php 3 patches
Braces   +30 added lines, -19 removed lines patch added patch discarded remove patch
@@ -16,7 +16,9 @@  discard block
 block discarded – undo
16 16
  */
17 17
 function geodir_session_start()
18 18
 {
19
-    if (!session_id()) session_start();
19
+    if (!session_id()) {
20
+    	session_start();
21
+    }
20 22
     global $geodir_add_location_url;
21 23
 
22 24
     $geodir_add_location_url = NULL;
@@ -86,7 +88,9 @@  discard block
 block discarded – undo
86 88
 
87 89
     if ((is_search() && isset($_REQUEST['geodir_search']) && $_REQUEST['geodir_search'] != '')):
88 90
 
89
-        if (isset($_REQUEST['scat']) && $_REQUEST['scat'] == 'all') $_REQUEST['scat'] = '';
91
+        if (isset($_REQUEST['scat']) && $_REQUEST['scat'] == 'all') {
92
+        	$_REQUEST['scat'] = '';
93
+        }
90 94
         //if(isset($_REQUEST['s']) && $_REQUEST['s'] == '+') $_REQUEST['s'] = '';
91 95
 
92 96
         if (isset($_REQUEST['sdist'])) {
@@ -198,8 +202,9 @@  discard block
 block discarded – undo
198 202
         add_filter('posts_fields', 'geodir_posts_fields', 1);
199 203
         add_filter('posts_join', 'geodir_posts_join', 1);
200 204
         geodir_post_where();
201
-        if (!is_admin())
202
-            add_filter('posts_orderby', 'geodir_posts_orderby', 1);
205
+        if (!is_admin()) {
206
+                    add_filter('posts_orderby', 'geodir_posts_orderby', 1);
207
+        }
203 208
 
204 209
         // advanced filter for popular post view widget
205 210
         global $wp_query;
@@ -349,8 +354,9 @@  discard block
 block discarded – undo
349 354
     $sort_by = '';
350 355
     $orderby = ' ';
351 356
 
352
-    if (get_query_var('order_by'))
353
-        $sort_by = get_query_var('order_by');
357
+    if (get_query_var('order_by')) {
358
+            $sort_by = get_query_var('order_by');
359
+    }
354 360
 
355 361
     /*if(isset($wp_query->tax_query->queries) && $wp_query->tax_query->queries){
356 362
         $current_term = $wp_query->get_queried_object();
@@ -370,14 +376,16 @@  discard block
 block discarded – undo
370 376
         $orderby .= " distance,";
371 377
     }
372 378
 
373
-    if (isset($_REQUEST['sort_by']) && $_REQUEST['sort_by'] != '' && is_main_query())
374
-        $sort_by = esc_attr($_REQUEST['sort_by']);
379
+    if (isset($_REQUEST['sort_by']) && $_REQUEST['sort_by'] != '' && is_main_query()) {
380
+            $sort_by = esc_attr($_REQUEST['sort_by']);
381
+    }
375 382
 
376 383
 
377 384
     if ($sort_by == '') {
378 385
         $default_sort = geodir_get_posts_default_sort($geodir_post_type);
379
-        if (!empty($default_sort))
380
-            $sort_by = $default_sort;
386
+        if (!empty($default_sort)) {
387
+                    $sort_by = $default_sort;
388
+        }
381 389
     }
382 390
 
383 391
     /*
@@ -572,8 +580,9 @@  discard block
 block discarded – undo
572 580
 
573 581
             add_filter('posts_where', 'searching_filter_where', 1);
574 582
 
575
-            if ($snear != '')
576
-                add_filter('posts_where', 'searching_filter_where', 1);
583
+            if ($snear != '') {
584
+                            add_filter('posts_where', 'searching_filter_where', 1);
585
+            }
577 586
 
578 587
             add_filter('posts_orderby', 'geodir_posts_orderby', 1);
579 588
 
@@ -727,10 +736,11 @@  discard block
 block discarded – undo
727 736
 
728 737
     $where = '';
729 738
     $better_search_terms = '';
730
-    if (isset($_REQUEST['stype']))
731
-        $post_types = esc_attr(wp_strip_all_tags($_REQUEST['stype']));
732
-    else
733
-        $post_types = 'gd_place';
739
+    if (isset($_REQUEST['stype'])) {
740
+            $post_types = esc_attr(wp_strip_all_tags($_REQUEST['stype']));
741
+    } else {
742
+            $post_types = 'gd_place';
743
+    }
734 744
 
735 745
     if ($s != '') {
736 746
         $keywords = explode(" ", $s);
@@ -767,7 +777,7 @@  discard block
 block discarded – undo
767 777
     if($taxonomies) {
768 778
         $taxonomies = implode("','", $taxonomies);
769 779
         $taxonomies = "'" . $taxonomies . "'";
770
-    }else{$taxonomies='';}
780
+    } else{$taxonomies='';}
771 781
 
772 782
     $content_where = $terms_where = '';
773 783
 	if ($s != '') {
@@ -887,8 +897,9 @@  discard block
 block discarded – undo
887 897
             $user_fav_posts = get_user_meta($user_id, 'gd_user_favourite_post', true);
888 898
             $user_fav_posts = !empty($user_fav_posts) && is_array($user_fav_posts) ? implode("','", $user_fav_posts) : '-1';
889 899
             $where .= " AND $wpdb->posts.ID IN ('$user_fav_posts')";
890
-        } else
891
-            $where .= " AND $wpdb->posts.post_author = $user_id";
900
+        } else {
901
+                    $where .= " AND $wpdb->posts.post_author = $user_id";
902
+        }
892 903
 
893 904
         if ($user_id == (int)get_current_user_id()) {
894 905
             $where .= " AND $wpdb->posts.post_status IN ('publish','draft','pending') ";
Please login to merge, or discard this patch.
Indentation   +546 added lines, -546 removed lines patch added patch discarded remove patch
@@ -16,10 +16,10 @@  discard block
 block discarded – undo
16 16
  */
17 17
 function geodir_session_start()
18 18
 {
19
-    if (!session_id()) session_start();
20
-    global $geodir_add_location_url;
19
+	if (!session_id()) session_start();
20
+	global $geodir_add_location_url;
21 21
 
22
-    $geodir_add_location_url = NULL;
22
+	$geodir_add_location_url = NULL;
23 23
 }
24 24
 
25 25
 /**
@@ -33,18 +33,18 @@  discard block
 block discarded – undo
33 33
  */
34 34
 function geodir_modified_query($query)
35 35
 {
36
-    if ($query->is_main_query() && (
37
-            (geodir_is_page('add-listing') && isset($_REQUEST['pid']) && $_REQUEST['pid'] != '')
38
-            || geodir_is_page('listing')
39
-            || geodir_is_page('author')
40
-            || geodir_is_page('search')
41
-            || geodir_is_page('detail'))
42
-    ) {
43
-
44
-        $query->set('is_geodir_loop', true);
45
-    }
36
+	if ($query->is_main_query() && (
37
+			(geodir_is_page('add-listing') && isset($_REQUEST['pid']) && $_REQUEST['pid'] != '')
38
+			|| geodir_is_page('listing')
39
+			|| geodir_is_page('author')
40
+			|| geodir_is_page('search')
41
+			|| geodir_is_page('detail'))
42
+	) {
43
+
44
+		$query->set('is_geodir_loop', true);
45
+	}
46 46
 
47
-    return $query;
47
+	return $query;
48 48
 }
49 49
 
50 50
 /**
@@ -67,81 +67,81 @@  discard block
 block discarded – undo
67 67
  */
68 68
 function set_listing_request($query )
69 69
 {
70
-    global $wp_query, $wpdb, $geodir_post_type, $table, $dist, $mylat, $mylon, $s, $snear, $s, $s_A, $s_SA;
70
+	global $wp_query, $wpdb, $geodir_post_type, $table, $dist, $mylat, $mylon, $s, $snear, $s, $s_A, $s_SA;
71 71
 
72 72
 
73
-    // fix woocommerce shop products filtered by language for GD + WPML + Woocommerce
74
-    if (!geodir_is_geodir_page()) {
75
-        return;
76
-    }
73
+	// fix woocommerce shop products filtered by language for GD + WPML + Woocommerce
74
+	if (!geodir_is_geodir_page()) {
75
+		return;
76
+	}
77 77
 
78
-    /* remove all pre filters */
79
-    remove_all_filters('query');
80
-    remove_all_filters('posts_search');
81
-    remove_all_filters('posts_fields');
82
-    remove_all_filters('posts_join');
83
-    remove_all_filters('posts_orderby');
84
-    remove_all_filters('posts_where');
78
+	/* remove all pre filters */
79
+	remove_all_filters('query');
80
+	remove_all_filters('posts_search');
81
+	remove_all_filters('posts_fields');
82
+	remove_all_filters('posts_join');
83
+	remove_all_filters('posts_orderby');
84
+	remove_all_filters('posts_where');
85 85
 
86 86
 
87
-    if ((is_search() && isset($_REQUEST['geodir_search']) && $_REQUEST['geodir_search'] != '')):
87
+	if ((is_search() && isset($_REQUEST['geodir_search']) && $_REQUEST['geodir_search'] != '')):
88 88
 
89
-        if (isset($_REQUEST['scat']) && $_REQUEST['scat'] == 'all') $_REQUEST['scat'] = '';
90
-        //if(isset($_REQUEST['s']) && $_REQUEST['s'] == '+') $_REQUEST['s'] = '';
89
+		if (isset($_REQUEST['scat']) && $_REQUEST['scat'] == 'all') $_REQUEST['scat'] = '';
90
+		//if(isset($_REQUEST['s']) && $_REQUEST['s'] == '+') $_REQUEST['s'] = '';
91 91
 
92
-        if (isset($_REQUEST['sdist'])) {
93
-            ($_REQUEST['sdist'] != '0' && $_REQUEST['sdist'] != '') ? $dist = esc_attr($_REQUEST['sdist']) : $dist = 25000;
94
-        } elseif (get_option('geodir_search_dist') != '') {
95
-            $dist = get_option('geodir_search_dist');
92
+		if (isset($_REQUEST['sdist'])) {
93
+			($_REQUEST['sdist'] != '0' && $_REQUEST['sdist'] != '') ? $dist = esc_attr($_REQUEST['sdist']) : $dist = 25000;
94
+		} elseif (get_option('geodir_search_dist') != '') {
95
+			$dist = get_option('geodir_search_dist');
96 96
 
97
-        } else {
98
-            $dist = 25000;
99
-        } //  Distance
97
+		} else {
98
+			$dist = 25000;
99
+		} //  Distance
100 100
 
101
-        if (isset($_REQUEST['sgeo_lat'])) {
102
-            $mylat = (float)esc_attr($_REQUEST['sgeo_lat']);
103
-        } else {
104
-            $mylat = (float)geodir_get_current_city_lat();
105
-        } //  Latitude
101
+		if (isset($_REQUEST['sgeo_lat'])) {
102
+			$mylat = (float)esc_attr($_REQUEST['sgeo_lat']);
103
+		} else {
104
+			$mylat = (float)geodir_get_current_city_lat();
105
+		} //  Latitude
106 106
 
107
-        if (isset($_REQUEST['sgeo_lon'])) {
108
-            $mylon = (float)esc_attr($_REQUEST['sgeo_lon']);
109
-        } else {
110
-            $mylon = (float)geodir_get_current_city_lng();
111
-        } //  Distance
107
+		if (isset($_REQUEST['sgeo_lon'])) {
108
+			$mylon = (float)esc_attr($_REQUEST['sgeo_lon']);
109
+		} else {
110
+			$mylon = (float)geodir_get_current_city_lng();
111
+		} //  Distance
112 112
 
113
-        if (isset($_REQUEST['snear'])) {
114
-            $snear = trim(esc_attr($_REQUEST['snear']));
115
-        }
113
+		if (isset($_REQUEST['snear'])) {
114
+			$snear = trim(esc_attr($_REQUEST['snear']));
115
+		}
116 116
 
117
-        if (isset($_REQUEST['s'])) {
118
-            $s = trim(esc_attr(wp_strip_all_tags($_REQUEST['s'])));
119
-        }
117
+		if (isset($_REQUEST['s'])) {
118
+			$s = trim(esc_attr(wp_strip_all_tags($_REQUEST['s'])));
119
+		}
120 120
 
121
-        if ($snear == 'NEAR ME') {
122
-            $ip = $_SERVER['REMOTE_ADDR'];
123
-            $addr_details = unserialize(file_get_contents('http://www.geoplugin.net/php.gp?ip=' . $ip));
124
-            $mylat = stripslashes(geodir_utf8_ucfirst($addr_details[geoplugin_latitude]));
125
-            $mylon = stripslashes(geodir_utf8_ucfirst($addr_details[geoplugin_longitude]));
126
-        }
121
+		if ($snear == 'NEAR ME') {
122
+			$ip = $_SERVER['REMOTE_ADDR'];
123
+			$addr_details = unserialize(file_get_contents('http://www.geoplugin.net/php.gp?ip=' . $ip));
124
+			$mylat = stripslashes(geodir_utf8_ucfirst($addr_details[geoplugin_latitude]));
125
+			$mylon = stripslashes(geodir_utf8_ucfirst($addr_details[geoplugin_longitude]));
126
+		}
127 127
 
128 128
 
129
-        if (strstr($s, ',')) {
130
-            $s_AA = str_replace(" ", "", $s);
131
-            $s_A = explode(",", $s_AA);
132
-            $s_A = implode('","', $s_A);
133
-            $s_A = '"' . $s_A . '"';
134
-        } else {
135
-            $s_A = '"' . $s . '"';
136
-        }
129
+		if (strstr($s, ',')) {
130
+			$s_AA = str_replace(" ", "", $s);
131
+			$s_A = explode(",", $s_AA);
132
+			$s_A = implode('","', $s_A);
133
+			$s_A = '"' . $s_A . '"';
134
+		} else {
135
+			$s_A = '"' . $s . '"';
136
+		}
137 137
 
138
-        if (strstr($s, ' ')) {
139
-            $s_SA = explode(" ", $s);
140
-        } else {
141
-            $s_SA = '';
142
-        }
138
+		if (strstr($s, ' ')) {
139
+			$s_SA = explode(" ", $s);
140
+		} else {
141
+			$s_SA = '';
142
+		}
143 143
 
144
-    endif;
144
+	endif;
145 145
 
146 146
 
147 147
 
@@ -162,56 +162,56 @@  discard block
 block discarded – undo
162 162
  */
163 163
 function geodir_listing_loop_filter($query)
164 164
 {
165
-    global $wp_query, $geodir_post_type, $table, $plugin_prefix, $table, $term;
165
+	global $wp_query, $geodir_post_type, $table, $plugin_prefix, $table, $term;
166 166
 
167
-    // fix wp_reset_query for popular post view widget
168
-    if (!geodir_is_geodir_page()) {
169
-        return;
170
-    }
167
+	// fix wp_reset_query for popular post view widget
168
+	if (!geodir_is_geodir_page()) {
169
+		return;
170
+	}
171 171
 
172
-    $geodir_post_type = geodir_get_current_posttype();
173
-
174
-    if (isset($wp_query->tax_query->queries) && $wp_query->tax_query->queries) {
175
-        $taxonomies = wp_list_pluck($wp_query->tax_query->queries, 'taxonomy');
176
-
177
-        if (isset($wp_query->query[$taxonomies[0]])) {
178
-            $request_term = explode("/", $wp_query->query[$taxonomies[0]]);
179
-            $request_term = end($request_term);
180
-            if (!term_exists($request_term)) {
181
-                $args = array('number' => '1',);
182
-                $terms_arr = get_terms($taxonomies[0], $args);
183
-                foreach ($terms_arr as $location_term) {
184
-                    $term_arr = $location_term;
185
-                    $term_arr->name = geodir_ucwords(str_replace('-', ' ', $request_term));
186
-                }
187
-                $wp_query->queried_object_id = 1;
188
-                $wp_query->queried_object = $term_arr;
189
-                //print_r($wp_query) ;
190
-            }
191
-        }
172
+	$geodir_post_type = geodir_get_current_posttype();
173
+
174
+	if (isset($wp_query->tax_query->queries) && $wp_query->tax_query->queries) {
175
+		$taxonomies = wp_list_pluck($wp_query->tax_query->queries, 'taxonomy');
176
+
177
+		if (isset($wp_query->query[$taxonomies[0]])) {
178
+			$request_term = explode("/", $wp_query->query[$taxonomies[0]]);
179
+			$request_term = end($request_term);
180
+			if (!term_exists($request_term)) {
181
+				$args = array('number' => '1',);
182
+				$terms_arr = get_terms($taxonomies[0], $args);
183
+				foreach ($terms_arr as $location_term) {
184
+					$term_arr = $location_term;
185
+					$term_arr->name = geodir_ucwords(str_replace('-', ' ', $request_term));
186
+				}
187
+				$wp_query->queried_object_id = 1;
188
+				$wp_query->queried_object = $term_arr;
189
+				//print_r($wp_query) ;
190
+			}
191
+		}
192 192
 
193
-    }
194
-    if (isset($query->query_vars['is_geodir_loop']) && $query->query_vars['is_geodir_loop']) {
195
-
196
-        $table = $plugin_prefix . $geodir_post_type . '_detail';
197
-
198
-        add_filter('posts_fields', 'geodir_posts_fields', 1);
199
-        add_filter('posts_join', 'geodir_posts_join', 1);
200
-        geodir_post_where();
201
-        if (!is_admin())
202
-            add_filter('posts_orderby', 'geodir_posts_orderby', 1);
203
-
204
-        // advanced filter for popular post view widget
205
-        global $wp_query;
206
-        if (!is_admin()) {
207
-            if (!empty($wp_query->query['with_pics_only'])) {
208
-                add_filter('posts_join', 'geodir_filter_widget_join', 1000);
209
-            }
210
-            add_filter('posts_where', 'geodir_filter_widget_where', 1000);
211
-        }
193
+	}
194
+	if (isset($query->query_vars['is_geodir_loop']) && $query->query_vars['is_geodir_loop']) {
212 195
 
213
-    }
214
-    return $query;
196
+		$table = $plugin_prefix . $geodir_post_type . '_detail';
197
+
198
+		add_filter('posts_fields', 'geodir_posts_fields', 1);
199
+		add_filter('posts_join', 'geodir_posts_join', 1);
200
+		geodir_post_where();
201
+		if (!is_admin())
202
+			add_filter('posts_orderby', 'geodir_posts_orderby', 1);
203
+
204
+		// advanced filter for popular post view widget
205
+		global $wp_query;
206
+		if (!is_admin()) {
207
+			if (!empty($wp_query->query['with_pics_only'])) {
208
+				add_filter('posts_join', 'geodir_filter_widget_join', 1000);
209
+			}
210
+			add_filter('posts_where', 'geodir_filter_widget_where', 1000);
211
+		}
212
+
213
+	}
214
+	return $query;
215 215
 }
216 216
 
217 217
 
@@ -230,67 +230,67 @@  discard block
 block discarded – undo
230 230
  * @return string Modified fields query string.
231 231
  */
232 232
 function geodir_posts_fields($fields) {
233
-    global $wp_query, $wpdb, $geodir_post_type, $table, $plugin_prefix, $dist, $mylat, $mylon, $snear, $gd_session;
233
+	global $wp_query, $wpdb, $geodir_post_type, $table, $plugin_prefix, $dist, $mylat, $mylon, $snear, $gd_session;
234 234
 
235
-    // Filter-Location-Manager to add location table.
236
-    $fields .= ", " . $table . ".* ";
235
+	// Filter-Location-Manager to add location table.
236
+	$fields .= ", " . $table . ".* ";
237 237
 
238 238
 	if ($snear != '' || $gd_session->get('all_near_me')) {
239
-        $DistanceRadius = geodir_getDistanceRadius(get_option('geodir_search_dist_1'));
239
+		$DistanceRadius = geodir_getDistanceRadius(get_option('geodir_search_dist_1'));
240 240
 
241 241
 		if ($gd_session->get('all_near_me')) {
242
-            $mylat = $gd_session->get('user_lat');
243
-            $mylon = $gd_session->get('user_lon');
244
-        }
245
-
246
-        $fields .= " , (" . $DistanceRadius . " * 2 * ASIN(SQRT( POWER(SIN((ABS($mylat) - ABS(" . $table . ".post_latitude)) * pi()/180 / 2), 2) +COS(ABS($mylat) * pi()/180) * COS( ABS(" . $table . ".post_latitude) * pi()/180) *POWER(SIN(($mylon - " . $table . ".post_longitude) * pi()/180 / 2), 2) )))as distance ";
247
-    }
248
-
249
-    global $s;
250
-    if (is_search() && isset($_REQUEST['geodir_search']) && $s && trim($s) != '') {
251
-        $keywords = explode(" ", $s);
252
-
253
-        if(is_array($keywords) && $klimit = get_option('geodir_search_word_limit')){
254
-            foreach($keywords as $kkey=>$kword){
255
-                if(geodir_utf8_strlen($kword)<=$klimit){
256
-                    unset($keywords[$kkey]);
257
-                }
258
-            }
259
-        }
242
+			$mylat = $gd_session->get('user_lat');
243
+			$mylon = $gd_session->get('user_lon');
244
+		}
260 245
 
246
+		$fields .= " , (" . $DistanceRadius . " * 2 * ASIN(SQRT( POWER(SIN((ABS($mylat) - ABS(" . $table . ".post_latitude)) * pi()/180 / 2), 2) +COS(ABS($mylat) * pi()/180) * COS( ABS(" . $table . ".post_latitude) * pi()/180) *POWER(SIN(($mylon - " . $table . ".post_longitude) * pi()/180 / 2), 2) )))as distance ";
247
+	}
261 248
 
262
-        if (count($keywords) > 1) {
263
-            $parts = array(
264
-                'AND' => 'gd_alltitlematch_part',
265
-                'OR' => 'gd_titlematch_part'
266
-            );
267
-            $gd_titlematch_part = "";
268
-            foreach ($parts as $key => $part) {
269
-                $gd_titlematch_part .= " CASE WHEN ";
270
-                $count = 0;
271
-                foreach ($keywords as $keyword) {
272
-                    $keyword = trim($keyword);
273
-                    $keyword  = wp_specialchars_decode($keyword ,ENT_QUOTES);
249
+	global $s;
250
+	if (is_search() && isset($_REQUEST['geodir_search']) && $s && trim($s) != '') {
251
+		$keywords = explode(" ", $s);
252
+
253
+		if(is_array($keywords) && $klimit = get_option('geodir_search_word_limit')){
254
+			foreach($keywords as $kkey=>$kword){
255
+				if(geodir_utf8_strlen($kword)<=$klimit){
256
+					unset($keywords[$kkey]);
257
+				}
258
+			}
259
+		}
260
+
261
+
262
+		if (count($keywords) > 1) {
263
+			$parts = array(
264
+				'AND' => 'gd_alltitlematch_part',
265
+				'OR' => 'gd_titlematch_part'
266
+			);
267
+			$gd_titlematch_part = "";
268
+			foreach ($parts as $key => $part) {
269
+				$gd_titlematch_part .= " CASE WHEN ";
270
+				$count = 0;
271
+				foreach ($keywords as $keyword) {
272
+					$keyword = trim($keyword);
273
+					$keyword  = wp_specialchars_decode($keyword ,ENT_QUOTES);
274 274
 					$count++;
275
-                    if ($count < count($keywords)) {
276
-                       // $gd_titlematch_part .= $wpdb->posts . ".post_title LIKE '%%" . $keyword . "%%' " . $key . " ";
275
+					if ($count < count($keywords)) {
276
+					   // $gd_titlematch_part .= $wpdb->posts . ".post_title LIKE '%%" . $keyword . "%%' " . $key . " ";
277 277
 						$gd_titlematch_part .= "( " . $wpdb->posts . ".post_title LIKE '" . $keyword . "' OR " . $wpdb->posts . ".post_title LIKE '" . $keyword . "%%' OR " . $wpdb->posts . ".post_title LIKE '%% " . $keyword . "%%' ) " . $key . " ";
278
-                    } else {
279
-                        //$gd_titlematch_part .= $wpdb->posts . ".post_title LIKE '%%" . $keyword . "%%' ";
278
+					} else {
279
+						//$gd_titlematch_part .= $wpdb->posts . ".post_title LIKE '%%" . $keyword . "%%' ";
280 280
 						$gd_titlematch_part .= "( " . $wpdb->posts . ".post_title LIKE '" . $keyword . "' OR " . $wpdb->posts . ".post_title LIKE '" . $keyword . "%%' OR " . $wpdb->posts . ".post_title LIKE '%% " . $keyword . "%%' ) ";
281
-                    }
282
-                }
283
-                $gd_titlematch_part .= "THEN 1 ELSE 0 END AS " . $part . ",";
284
-            }
285
-        } else {
286
-            $gd_titlematch_part = "";
287
-        }
288
-        $s = stripslashes_deep( $s );
289
-        $s = wp_specialchars_decode($s,ENT_QUOTES);
281
+					}
282
+				}
283
+				$gd_titlematch_part .= "THEN 1 ELSE 0 END AS " . $part . ",";
284
+			}
285
+		} else {
286
+			$gd_titlematch_part = "";
287
+		}
288
+		$s = stripslashes_deep( $s );
289
+		$s = wp_specialchars_decode($s,ENT_QUOTES);
290 290
 		$fields .= $wpdb->prepare(", CASE WHEN " . $table . ".is_featured='1' THEN 1 ELSE 0 END AS gd_featured, CASE WHEN " . $wpdb->posts . ".post_title LIKE %s THEN 1 ELSE 0 END AS gd_exacttitle," . $gd_titlematch_part . " CASE WHEN ( " . $wpdb->posts . ".post_title LIKE %s OR " . $wpdb->posts . ".post_title LIKE %s OR " . $wpdb->posts . ".post_title LIKE %s ) THEN 1 ELSE 0 END AS gd_titlematch, CASE WHEN ( " . $wpdb->posts . ".post_content LIKE %s OR " . $wpdb->posts . ".post_content LIKE %s OR " . $wpdb->posts . ".post_content LIKE %s OR " . $wpdb->posts . ".post_content LIKE %s ) THEN 1 ELSE 0 END AS gd_content", array($s, $s, $s . '%', '% ' . $s . '%', $s, $s . ' %', '% ' . $s . ' %', '% ' . $s));
291
-    }
291
+	}
292 292
 
293
-    return $fields;
293
+	return $fields;
294 294
 }
295 295
 
296 296
 
@@ -307,26 +307,26 @@  discard block
 block discarded – undo
307 307
  */
308 308
 function geodir_posts_join($join)
309 309
 {
310
-    global $wpdb, $geodir_post_type, $table, $table_prefix, $plugin_prefix;
310
+	global $wpdb, $geodir_post_type, $table, $table_prefix, $plugin_prefix;
311 311
 
312
-    ########### WPML ###########
312
+	########### WPML ###########
313 313
 
314
-    if (function_exists('icl_object_id')) {
315
-        global $sitepress;
316
-        $lang_code = ICL_LANGUAGE_CODE;
317
-        $default_lang_code = $sitepress->get_default_language();
318
-        if ($lang_code) {
319
-            $join .= "JOIN " . $table_prefix . "icl_translations icl_t ON icl_t.element_id = " . $table_prefix . "posts.ID";
320
-        }
314
+	if (function_exists('icl_object_id')) {
315
+		global $sitepress;
316
+		$lang_code = ICL_LANGUAGE_CODE;
317
+		$default_lang_code = $sitepress->get_default_language();
318
+		if ($lang_code) {
319
+			$join .= "JOIN " . $table_prefix . "icl_translations icl_t ON icl_t.element_id = " . $table_prefix . "posts.ID";
320
+		}
321 321
 
322
-    }
323
-    ########### WPML ###########
322
+	}
323
+	########### WPML ###########
324 324
 
325
-    $join .= " INNER JOIN " . $table . " ON (" . $table . ".post_id = $wpdb->posts.ID)  ";
326
-    //===old code start
327
-    //$join .= " INNER JOIN ".POST_LOCATION_TABLE." ON (".$table.".post_location_id = ".POST_LOCATION_TABLE.".location_id)  " ;//===old code end
325
+	$join .= " INNER JOIN " . $table . " ON (" . $table . ".post_id = $wpdb->posts.ID)  ";
326
+	//===old code start
327
+	//$join .= " INNER JOIN ".POST_LOCATION_TABLE." ON (".$table.".post_location_id = ".POST_LOCATION_TABLE.".location_id)  " ;//===old code end
328 328
 
329
-    return $join;
329
+	return $join;
330 330
 }
331 331
 
332 332
 
@@ -344,15 +344,15 @@  discard block
 block discarded – undo
344 344
  */
345 345
 function geodir_posts_orderby($orderby)
346 346
 {
347
-    global $wpdb, $wp_query, $geodir_post_type, $table, $plugin_prefix, $snear, $default_sort;
347
+	global $wpdb, $wp_query, $geodir_post_type, $table, $plugin_prefix, $snear, $default_sort;
348 348
 
349
-    $sort_by = '';
350
-    $orderby = ' ';
349
+	$sort_by = '';
350
+	$orderby = ' ';
351 351
 
352
-    if (get_query_var('order_by'))
353
-        $sort_by = get_query_var('order_by');
352
+	if (get_query_var('order_by'))
353
+		$sort_by = get_query_var('order_by');
354 354
 
355
-    /*if(isset($wp_query->tax_query->queries) && $wp_query->tax_query->queries){
355
+	/*if(isset($wp_query->tax_query->queries) && $wp_query->tax_query->queries){
356 356
         $current_term = $wp_query->get_queried_object();
357 357
     }
358 358
 
@@ -366,133 +366,133 @@  discard block
 block discarded – undo
366 366
     }*/
367 367
 
368 368
 
369
-    if ($snear != '') {
370
-        $orderby .= " distance,";
371
-    }
369
+	if ($snear != '') {
370
+		$orderby .= " distance,";
371
+	}
372 372
 
373
-    if (isset($_REQUEST['sort_by']) && $_REQUEST['sort_by'] != '' && is_main_query())
374
-        $sort_by = esc_attr($_REQUEST['sort_by']);
373
+	if (isset($_REQUEST['sort_by']) && $_REQUEST['sort_by'] != '' && is_main_query())
374
+		$sort_by = esc_attr($_REQUEST['sort_by']);
375 375
 
376 376
 
377
-    if ($sort_by == '') {
378
-        $default_sort = geodir_get_posts_default_sort($geodir_post_type);
379
-        if (!empty($default_sort))
380
-            $sort_by = $default_sort;
381
-    }
377
+	if ($sort_by == '') {
378
+		$default_sort = geodir_get_posts_default_sort($geodir_post_type);
379
+		if (!empty($default_sort))
380
+			$sort_by = $default_sort;
381
+	}
382 382
 
383
-    /*
383
+	/*
384 384
     if search by term & no location then order always "relevance"
385 385
     if search by location then order always "nearest"
386 386
     */
387
-    if (is_main_query() && geodir_is_page('search')) {
388
-        $search_term = get_query_var('s');
387
+	if (is_main_query() && geodir_is_page('search')) {
388
+		$search_term = get_query_var('s');
389 389
 
390
-        if (trim($search_term) != '' && !isset($_REQUEST['sort_by'])) {
391
-            $sort_by = 'az';
392
-        }
390
+		if (trim($search_term) != '' && !isset($_REQUEST['sort_by'])) {
391
+			$sort_by = 'az';
392
+		}
393 393
 
394
-        if ($snear != '' &&  $sort_by!='farthest') {
395
-            $sort_by = 'nearest';
396
-        }
397
-    }
398
-
399
-    switch ($sort_by):
400
-        case 'newest':
401
-            $orderby = "$wpdb->posts.post_date desc, ";
402
-            break;
403
-        case 'oldest':
404
-            $orderby = "$wpdb->posts.post_date asc, ";
405
-            break;
406
-        case 'low_review':
407
-        case 'rating_count_asc':
408
-            $orderby = $table . ".rating_count ASC, " . $table . ".overall_rating ASC, ";
409
-            break;
410
-        case 'high_review':
411
-        case 'rating_count_desc':
412
-            $orderby = $table . ".rating_count DESC, " . $table . ".overall_rating DESC, ";
413
-            break;
414
-        case 'low_rating':
415
-            $orderby = "( " . $table . ".overall_rating  ) ASC, " . $table . ".rating_count ASC,  ";
416
-            break;
417
-        case 'high_rating':
418
-            $orderby = " " . $table . ".overall_rating DESC, " . $table . ".rating_count DESC, ";
419
-            break;
420
-        case 'featured':
421
-            $orderby = $table . ".is_featured asc, ";
422
-            break;
423
-        case 'nearest':
424
-            $orderby = " distance asc, ";
425
-            break;
426
-        case 'farthest':
427
-            $orderby = " distance desc, ";
428
-            break;
429
-        case 'random':
430
-            $orderby = " rand(), ";
431
-            break;
432
-        case 'az':
433
-            $orderby = "$wpdb->posts.post_title asc, ";
434
-            break;
435
-        // sort by rating
436
-        case 'overall_rating_desc':
437
-            $orderby = " " . $table . ".overall_rating DESC, " . $table . ".rating_count DESC, ";
438
-            break;
439
-        case 'overall_rating_asc':
440
-            $orderby = " " . $table . ".overall_rating ASC, " . $table . ".rating_count ASC, ";
441
-            break;
442
-        default:
443
-
444
-            break;
445
-    endswitch;
446
-
447
-    if ($sort_by != '' && geodir_cpt_has_rating_disabled($geodir_post_type)) {
448
-        if (in_array($sort_by, array('high_review', 'rating_count_desc', 'high_rating', 'overall_rating_desc'))) {
449
-            $orderby = "$wpdb->posts.comment_count DESC, ";
450
-            $sort_by = 'comment_count_desc';
451
-        } else if (in_array($sort_by, array('low_review', 'rating_count_asc', 'low_rating', 'overall_rating_asc'))) {
452
-            $orderby = "$wpdb->posts.comment_count ASC, ";
453
-            $sort_by = 'comment_count_asc';
454
-        }
455
-    }
394
+		if ($snear != '' &&  $sort_by!='farthest') {
395
+			$sort_by = 'nearest';
396
+		}
397
+	}
456 398
 
457
-    global $s;
399
+	switch ($sort_by):
400
+		case 'newest':
401
+			$orderby = "$wpdb->posts.post_date desc, ";
402
+			break;
403
+		case 'oldest':
404
+			$orderby = "$wpdb->posts.post_date asc, ";
405
+			break;
406
+		case 'low_review':
407
+		case 'rating_count_asc':
408
+			$orderby = $table . ".rating_count ASC, " . $table . ".overall_rating ASC, ";
409
+			break;
410
+		case 'high_review':
411
+		case 'rating_count_desc':
412
+			$orderby = $table . ".rating_count DESC, " . $table . ".overall_rating DESC, ";
413
+			break;
414
+		case 'low_rating':
415
+			$orderby = "( " . $table . ".overall_rating  ) ASC, " . $table . ".rating_count ASC,  ";
416
+			break;
417
+		case 'high_rating':
418
+			$orderby = " " . $table . ".overall_rating DESC, " . $table . ".rating_count DESC, ";
419
+			break;
420
+		case 'featured':
421
+			$orderby = $table . ".is_featured asc, ";
422
+			break;
423
+		case 'nearest':
424
+			$orderby = " distance asc, ";
425
+			break;
426
+		case 'farthest':
427
+			$orderby = " distance desc, ";
428
+			break;
429
+		case 'random':
430
+			$orderby = " rand(), ";
431
+			break;
432
+		case 'az':
433
+			$orderby = "$wpdb->posts.post_title asc, ";
434
+			break;
435
+		// sort by rating
436
+		case 'overall_rating_desc':
437
+			$orderby = " " . $table . ".overall_rating DESC, " . $table . ".rating_count DESC, ";
438
+			break;
439
+		case 'overall_rating_asc':
440
+			$orderby = " " . $table . ".overall_rating ASC, " . $table . ".rating_count ASC, ";
441
+			break;
442
+		default:
443
+
444
+			break;
445
+	endswitch;
446
+
447
+	if ($sort_by != '' && geodir_cpt_has_rating_disabled($geodir_post_type)) {
448
+		if (in_array($sort_by, array('high_review', 'rating_count_desc', 'high_rating', 'overall_rating_desc'))) {
449
+			$orderby = "$wpdb->posts.comment_count DESC, ";
450
+			$sort_by = 'comment_count_desc';
451
+		} else if (in_array($sort_by, array('low_review', 'rating_count_asc', 'low_rating', 'overall_rating_asc'))) {
452
+			$orderby = "$wpdb->posts.comment_count ASC, ";
453
+			$sort_by = 'comment_count_asc';
454
+		}
455
+	}
458 456
 
459
-    if (is_search() && isset($_REQUEST['geodir_search']) && $s && trim($s) != '') {
460
-        $keywords = explode(" ", $s);
461
-        if(is_array($keywords) && $klimit = get_option('geodir_search_word_limit')){
462
-            foreach($keywords as $kkey=>$kword){
463
-                if(geodir_utf8_strlen($kword)<=$klimit){
464
-                    unset($keywords[$kkey]);
465
-                }
466
-            }
467
-        }
468
-        if ($sort_by == 'nearest' || $sort_by == 'farthest') {
469
-            if (count($keywords) > 1) {
470
-                $orderby = $orderby . " ( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_alltitlematch_part * 100 + gd_titlematch_part * 50 + gd_content * 1.5) DESC, ";
471
-            } else {
472
-                $orderby = $orderby . " ( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_content * 1.5) DESC, ";
473
-            }
474
-        } else {
475
-            if (count($keywords) > 1) {
476
-                $orderby = "( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_alltitlematch_part * 100 + gd_titlematch_part * 50 + gd_content * 1.5) DESC, " . $orderby;
477
-            } else {
478
-                $orderby = "( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_content * 1.5) DESC, " . $orderby;
479
-            }
480
-        }
481
-    }
457
+	global $s;
458
+
459
+	if (is_search() && isset($_REQUEST['geodir_search']) && $s && trim($s) != '') {
460
+		$keywords = explode(" ", $s);
461
+		if(is_array($keywords) && $klimit = get_option('geodir_search_word_limit')){
462
+			foreach($keywords as $kkey=>$kword){
463
+				if(geodir_utf8_strlen($kword)<=$klimit){
464
+					unset($keywords[$kkey]);
465
+				}
466
+			}
467
+		}
468
+		if ($sort_by == 'nearest' || $sort_by == 'farthest') {
469
+			if (count($keywords) > 1) {
470
+				$orderby = $orderby . " ( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_alltitlematch_part * 100 + gd_titlematch_part * 50 + gd_content * 1.5) DESC, ";
471
+			} else {
472
+				$orderby = $orderby . " ( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_content * 1.5) DESC, ";
473
+			}
474
+		} else {
475
+			if (count($keywords) > 1) {
476
+				$orderby = "( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_alltitlematch_part * 100 + gd_titlematch_part * 50 + gd_content * 1.5) DESC, " . $orderby;
477
+			} else {
478
+				$orderby = "( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_content * 1.5) DESC, " . $orderby;
479
+			}
480
+		}
481
+	}
482 482
 
483
-    /**
484
-     * Filter order by SQL.
485
-     *
486
-     * @since 1.0.0
487
-     * @param string $orderby The orderby query string.
488
-     * @param string $sort_by Sortby query string.
489
-     * @param string $table Listing table name.
490
-     */
491
-    $orderby = apply_filters('geodir_posts_order_by_sort', $orderby, $sort_by, $table);
483
+	/**
484
+	 * Filter order by SQL.
485
+	 *
486
+	 * @since 1.0.0
487
+	 * @param string $orderby The orderby query string.
488
+	 * @param string $sort_by Sortby query string.
489
+	 * @param string $table Listing table name.
490
+	 */
491
+	$orderby = apply_filters('geodir_posts_order_by_sort', $orderby, $sort_by, $table);
492 492
 
493
-    $orderby .= $table . ".is_featured asc, $wpdb->posts.post_date desc, $wpdb->posts.post_title ";
493
+	$orderby .= $table . ".is_featured asc, $wpdb->posts.post_date desc, $wpdb->posts.post_title ";
494 494
 
495
-    return $orderby;
495
+	return $orderby;
496 496
 }
497 497
 
498 498
 
@@ -510,53 +510,53 @@  discard block
 block discarded – undo
510 510
 function geodir_posts_order_by_custom_sort($orderby, $sort_by, $table)
511 511
 {
512 512
 
513
-    global $wpdb;
513
+	global $wpdb;
514 514
 
515
-    if ($sort_by != '' && (!is_search() || ( isset($_REQUEST['s']) && isset($_REQUEST['snear']) && $_REQUEST['snear']=='' && ( $_REQUEST['s']=='' ||  $_REQUEST['s']==' ') ) )) {
515
+	if ($sort_by != '' && (!is_search() || ( isset($_REQUEST['s']) && isset($_REQUEST['snear']) && $_REQUEST['snear']=='' && ( $_REQUEST['s']=='' ||  $_REQUEST['s']==' ') ) )) {
516 516
 
517
-        $sort_array = explode('_', $sort_by);
517
+		$sort_array = explode('_', $sort_by);
518 518
 
519
-        $sort_by_count = count($sort_array);
519
+		$sort_by_count = count($sort_array);
520 520
 
521
-        $order = $sort_array[$sort_by_count - 1];
521
+		$order = $sort_array[$sort_by_count - 1];
522 522
 
523
-        if ($sort_by_count > 1 && ($order == 'asc' || $order == 'desc')) {
523
+		if ($sort_by_count > 1 && ($order == 'asc' || $order == 'desc')) {
524 524
 
525
-            $sort_by = str_replace('_' . $order, '', $sort_by);
525
+			$sort_by = str_replace('_' . $order, '', $sort_by);
526 526
 
527
-            switch ($sort_by):
527
+			switch ($sort_by):
528 528
 
529
-                case 'post_date':
530
-                case 'comment_count':
529
+				case 'post_date':
530
+				case 'comment_count':
531 531
 
532
-                    $orderby = "$wpdb->posts." . $sort_by . " " . $order . ", ".$table . ".overall_rating " . $order . ", ";
533
-                    break;
532
+					$orderby = "$wpdb->posts." . $sort_by . " " . $order . ", ".$table . ".overall_rating " . $order . ", ";
533
+					break;
534 534
 
535
-                case 'distance':
536
-                    $orderby = $sort_by . " " . $order . ", ";
537
-                    break;
535
+				case 'distance':
536
+					$orderby = $sort_by . " " . $order . ", ";
537
+					break;
538 538
 
539 539
 
540
-                // sort by rating
541
-                case 'overall_rating':
542
-                    $orderby = " " . $table . "." . $sort_by . "  " . $order . ", " . $table . ".rating_count " . $order . ", ";
540
+				// sort by rating
541
+				case 'overall_rating':
542
+					$orderby = " " . $table . "." . $sort_by . "  " . $order . ", " . $table . ".rating_count " . $order . ", ";
543 543
 
544
-                    break;
544
+					break;
545 545
 
546 546
 
547
-                default:
548
-                    if (geodir_column_exist($table, $sort_by)) {
547
+				default:
548
+					if (geodir_column_exist($table, $sort_by)) {
549 549
 						$orderby = $table . "." . $sort_by . " " . $order . ", ";
550 550
 					}
551
-                    break;
551
+					break;
552 552
 
553
-            endswitch;
553
+			endswitch;
554 554
 
555
-        }
555
+		}
556 556
 
557
-    }
557
+	}
558 558
 
559
-    return $orderby;
559
+	return $orderby;
560 560
 }
561 561
 
562 562
 /**
@@ -571,34 +571,34 @@  discard block
 block discarded – undo
571 571
 {
572 572
 
573 573
 
574
-    global $wpdb, $geodir_post_type, $table, $s, $snear;
574
+	global $wpdb, $geodir_post_type, $table, $s, $snear;
575 575
 
576
-    if (!is_admin()) {
576
+	if (!is_admin()) {
577 577
 
578
-        if (geodir_is_page('add-listing') && isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
579
-            add_filter('posts_where', 'geodir_edit_listing_where', 1);
578
+		if (geodir_is_page('add-listing') && isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
579
+			add_filter('posts_where', 'geodir_edit_listing_where', 1);
580 580
 
581
-        } elseif ((is_search() && $_REQUEST['geodir_search'])) {
581
+		} elseif ((is_search() && $_REQUEST['geodir_search'])) {
582 582
 
583
-            add_filter('posts_where', 'searching_filter_where', 1);
583
+			add_filter('posts_where', 'searching_filter_where', 1);
584 584
 
585
-            if ($snear != '')
586
-                add_filter('posts_where', 'searching_filter_where', 1);
585
+			if ($snear != '')
586
+				add_filter('posts_where', 'searching_filter_where', 1);
587 587
 
588
-            add_filter('posts_orderby', 'geodir_posts_orderby', 1);
588
+			add_filter('posts_orderby', 'geodir_posts_orderby', 1);
589 589
 
590
-        } elseif (geodir_is_page('author')) {
590
+		} elseif (geodir_is_page('author')) {
591 591
 
592
-            add_filter('posts_where', 'author_filter_where', 1);
592
+			add_filter('posts_where', 'author_filter_where', 1);
593 593
 
594
-        }
594
+		}
595 595
 
596
-        //if (!geodir_is_page('detail'))
597
-            add_filter('posts_where', 'geodir_default_where', 1);/**/
596
+		//if (!geodir_is_page('detail'))
597
+			add_filter('posts_where', 'geodir_default_where', 1);/**/
598 598
 
599
-        //add_filter( 'user_has_cap', 'geodir_preview_post_cap', 10, 3 );// let subscribers edit their own posts
599
+		//add_filter( 'user_has_cap', 'geodir_preview_post_cap', 10, 3 );// let subscribers edit their own posts
600 600
 
601
-    }
601
+	}
602 602
 }
603 603
 
604 604
 /**
@@ -613,13 +613,13 @@  discard block
 block discarded – undo
613 613
  */
614 614
 function geodir_preview_post_cap($allcaps, $caps, $args)
615 615
 {
616
-    $user_id = get_current_user_id();
617
-    if ($user_id && isset($_REQUEST['post_type']) && $_REQUEST['post_type'] != '' && isset($_REQUEST['p']) && $_REQUEST['p'] != '' && $args[0] == 'edit_post' && $_REQUEST['p'] == $args[2]) {
616
+	$user_id = get_current_user_id();
617
+	if ($user_id && isset($_REQUEST['post_type']) && $_REQUEST['post_type'] != '' && isset($_REQUEST['p']) && $_REQUEST['p'] != '' && $args[0] == 'edit_post' && $_REQUEST['p'] == $args[2]) {
618 618
 
619
-        $allcaps['edit_posts'] = true;
620
-    }
621
-    //print_r($allcaps);
622
-    return $allcaps;
619
+		$allcaps['edit_posts'] = true;
620
+	}
621
+	//print_r($allcaps);
622
+	return $allcaps;
623 623
 }
624 624
 
625 625
 
@@ -634,9 +634,9 @@  discard block
 block discarded – undo
634 634
  */
635 635
 function geodir_edit_listing_where($where)
636 636
 {
637
-    global $wpdb;
638
-    $where = $wpdb->prepare(" AND $wpdb->posts.ID = %d ", $_REQUEST['pid']);
639
-    return $where;
637
+	global $wpdb;
638
+	$where = $wpdb->prepare(" AND $wpdb->posts.ID = %d ", $_REQUEST['pid']);
639
+	return $where;
640 640
 }
641 641
 
642 642
 
@@ -653,29 +653,29 @@  discard block
 block discarded – undo
653 653
  */
654 654
 function geodir_default_where($where)
655 655
 {
656
-    global $wp_query, $wpdb;
657
-
658
-    //print_r($wp_query);
659
-    ########### WPML ###########
660
-
661
-    if (function_exists('icl_object_id')) {
662
-        global $sitepress, $table_prefix;
663
-        $lang_code = ICL_LANGUAGE_CODE;
664
-        $default_lang_code = $sitepress->get_default_language();
665
-        $q_post_type = isset($wp_query->query['post_type']) ? $wp_query->query['post_type'] : '';
666
-        //echo '##########'.$q_post_type;
667
-        if ($lang_code && $q_post_type) {
668
-            $where .= " AND icl_t.language_code = '$lang_code' AND icl_t.element_type IN('post_" . $q_post_type . "') ";
669
-            //$where .= " AND icl_t.language_code = '$lang_code' ";
670
-        }
656
+	global $wp_query, $wpdb;
671 657
 
672
-    }
673
-    ########### WPML ###########
658
+	//print_r($wp_query);
659
+	########### WPML ###########
674 660
 
661
+	if (function_exists('icl_object_id')) {
662
+		global $sitepress, $table_prefix;
663
+		$lang_code = ICL_LANGUAGE_CODE;
664
+		$default_lang_code = $sitepress->get_default_language();
665
+		$q_post_type = isset($wp_query->query['post_type']) ? $wp_query->query['post_type'] : '';
666
+		//echo '##########'.$q_post_type;
667
+		if ($lang_code && $q_post_type) {
668
+			$where .= " AND icl_t.language_code = '$lang_code' AND icl_t.element_type IN('post_" . $q_post_type . "') ";
669
+			//$where .= " AND icl_t.language_code = '$lang_code' ";
670
+		}
675 671
 
676
-    return $where = str_replace("0 = 1", "1=1", $where);
672
+	}
673
+	########### WPML ###########
674
+
675
+
676
+	return $where = str_replace("0 = 1", "1=1", $where);
677 677
 
678
-    /* ====== old code start ===
678
+	/* ====== old code start ===
679 679
     $where = str_replace("0 = 1", "1=1", $where);
680 680
     $country = get_query_var('gd_country');
681 681
     $region = get_query_var('gd_region');
@@ -716,108 +716,108 @@  discard block
 block discarded – undo
716 716
  * @return string Modified where query string.
717 717
  */
718 718
 function searching_filter_where($where) {
719
-    global $wpdb, $geodir_post_type, $table, $plugin_prefix, $dist, $mylat, $mylon, $s, $snear, $s_A, $s_SA, $search_term, $gd_session;
719
+	global $wpdb, $geodir_post_type, $table, $plugin_prefix, $dist, $mylat, $mylon, $s, $snear, $s_A, $s_SA, $search_term, $gd_session;
720 720
 
721
-    $search_term = 'OR';
722
-    $search_term = 'AND';
723
-    $geodir_custom_search = '';
724
-    $category_search_range = '';
721
+	$search_term = 'OR';
722
+	$search_term = 'AND';
723
+	$geodir_custom_search = '';
724
+	$category_search_range = '';
725 725
 
726
-    if (is_single() && get_query_var('post_type')) {
726
+	if (is_single() && get_query_var('post_type')) {
727 727
 		return $where;
728 728
 	}
729 729
 
730
-    if (is_tax()) {
730
+	if (is_tax()) {
731 731
 		return $where;
732 732
 	}
733 733
 
734 734
 	$s = trim($s);
735
-    $s  = wp_specialchars_decode($s ,ENT_QUOTES);
736
-    $s_A = wp_specialchars_decode($s_A ,ENT_QUOTES);
737
-
738
-    $where = '';
739
-    $better_search_terms = '';
740
-    if (isset($_REQUEST['stype']))
741
-        $post_types = esc_attr(wp_strip_all_tags($_REQUEST['stype']));
742
-    else
743
-        $post_types = 'gd_place';
744
-
745
-    if ($s != '') {
746
-        $keywords = explode(" ", $s);
747
-        if(is_array($keywords) && $klimit = get_option('geodir_search_word_limit')){
748
-            foreach($keywords as $kkey=>$kword){
749
-                if(geodir_utf8_strlen($kword)<=$klimit){
750
-                    unset($keywords[$kkey]);
751
-                }
752
-            }
753
-        }
735
+	$s  = wp_specialchars_decode($s ,ENT_QUOTES);
736
+	$s_A = wp_specialchars_decode($s_A ,ENT_QUOTES);
737
+
738
+	$where = '';
739
+	$better_search_terms = '';
740
+	if (isset($_REQUEST['stype']))
741
+		$post_types = esc_attr(wp_strip_all_tags($_REQUEST['stype']));
742
+	else
743
+		$post_types = 'gd_place';
754 744
 
755
-        if (!empty($keywords)) {
756
-            foreach ($keywords as $keyword) {
757
-                $keyword = trim($keyword);
758
-                $keyword  = wp_specialchars_decode($keyword ,ENT_QUOTES);
759
-                if ($keyword != '') {
760
-                    /**
761
-                     * Filter the search query keywords SQL.
762
-                     *
763
-                     * @since 1.5.9
764
-                     * @package GeoDirectory
765
-                     * @param string $better_search_terms The query values, default: `' OR ( ' . $wpdb->posts . '.post_title LIKE "' . $keyword . '" OR ' . $wpdb->posts . '.post_title LIKE "' . $keyword . '%" OR ' . $wpdb->posts . '.post_title LIKE "% ' . $keyword . '%" )'`.
766
-                     * @param array $keywords The array of keywords for the query.
767
-                     * @param string $keyword The single keyword being searched.
768
-                     */
745
+	if ($s != '') {
746
+		$keywords = explode(" ", $s);
747
+		if(is_array($keywords) && $klimit = get_option('geodir_search_word_limit')){
748
+			foreach($keywords as $kkey=>$kword){
749
+				if(geodir_utf8_strlen($kword)<=$klimit){
750
+					unset($keywords[$kkey]);
751
+				}
752
+			}
753
+		}
754
+
755
+		if (!empty($keywords)) {
756
+			foreach ($keywords as $keyword) {
757
+				$keyword = trim($keyword);
758
+				$keyword  = wp_specialchars_decode($keyword ,ENT_QUOTES);
759
+				if ($keyword != '') {
760
+					/**
761
+					 * Filter the search query keywords SQL.
762
+					 *
763
+					 * @since 1.5.9
764
+					 * @package GeoDirectory
765
+					 * @param string $better_search_terms The query values, default: `' OR ( ' . $wpdb->posts . '.post_title LIKE "' . $keyword . '" OR ' . $wpdb->posts . '.post_title LIKE "' . $keyword . '%" OR ' . $wpdb->posts . '.post_title LIKE "% ' . $keyword . '%" )'`.
766
+					 * @param array $keywords The array of keywords for the query.
767
+					 * @param string $keyword The single keyword being searched.
768
+					 */
769 769
 					$better_search_terms .= apply_filters("geodir_search_better_search_terms",' OR ( ' . $wpdb->posts . '.post_title LIKE "' . $keyword . '" OR ' . $wpdb->posts . '.post_title LIKE "' . $keyword . '%" OR ' . $wpdb->posts . '.post_title LIKE "% ' . $keyword . '%" )',$keywords,$keyword);
770
-                }
771
-            }
772
-        }
773
-    }
770
+				}
771
+			}
772
+		}
773
+	}
774 774
 
775
-    /* get taxonomy */
776
-    $taxonomies = geodir_get_taxonomies($post_types, true);
777
-    if($taxonomies) {
778
-        $taxonomies = implode("','", $taxonomies);
779
-        $taxonomies = "'" . $taxonomies . "'";
780
-    }else{$taxonomies='';}
775
+	/* get taxonomy */
776
+	$taxonomies = geodir_get_taxonomies($post_types, true);
777
+	if($taxonomies) {
778
+		$taxonomies = implode("','", $taxonomies);
779
+		$taxonomies = "'" . $taxonomies . "'";
780
+	}else{$taxonomies='';}
781 781
 
782
-    $content_where = $terms_where = '';
782
+	$content_where = $terms_where = '';
783 783
 	if ($s != '') {
784
-        /**
785
-         * Filter the search query content where values.
786
-         *
787
-         * @since 1.5.0
788
-         * @package GeoDirectory
789
-         * @param string $content_where The query values, default: `" OR ($wpdb->posts.post_content LIKE \"$s\" OR $wpdb->posts.post_content LIKE \"$s%\" OR $wpdb->posts.post_content LIKE \"% $s%\" OR $wpdb->posts.post_content LIKE \"%>$s%\" OR $wpdb->posts.post_content LIKE \"%\n$s%\") ") "`.
790
-         */
784
+		/**
785
+		 * Filter the search query content where values.
786
+		 *
787
+		 * @since 1.5.0
788
+		 * @package GeoDirectory
789
+		 * @param string $content_where The query values, default: `" OR ($wpdb->posts.post_content LIKE \"$s\" OR $wpdb->posts.post_content LIKE \"$s%\" OR $wpdb->posts.post_content LIKE \"% $s%\" OR $wpdb->posts.post_content LIKE \"%>$s%\" OR $wpdb->posts.post_content LIKE \"%\n$s%\") ") "`.
790
+		 */
791 791
 		$content_where = apply_filters("geodir_search_content_where"," OR ($wpdb->posts.post_content LIKE \"$s\" OR $wpdb->posts.post_content LIKE \"$s%\" OR $wpdb->posts.post_content LIKE \"% $s%\" OR $wpdb->posts.post_content LIKE \"%>$s%\" OR $wpdb->posts.post_content LIKE \"%\n$s%\") ");
792
-        /**
793
-         * Filter the search query term values.
794
-         *
795
-         * @since 1.5.0
796
-         * @package GeoDirectory
797
-         * @param string $terms_where The separator, default: `" AND ($wpdb->terms.name LIKE \"$s\" OR $wpdb->terms.name LIKE \"$s%\" OR $wpdb->terms.name LIKE \"% $s%\" OR $wpdb->terms.name IN ($s_A)) "`.
798
-         */
799
-        $terms_where = apply_filters("geodir_search_terms_where"," AND ($wpdb->terms.name LIKE \"$s\" OR $wpdb->terms.name LIKE \"$s%\" OR $wpdb->terms.name LIKE \"% $s%\" OR $wpdb->terms.name IN ($s_A)) ");
792
+		/**
793
+		 * Filter the search query term values.
794
+		 *
795
+		 * @since 1.5.0
796
+		 * @package GeoDirectory
797
+		 * @param string $terms_where The separator, default: `" AND ($wpdb->terms.name LIKE \"$s\" OR $wpdb->terms.name LIKE \"$s%\" OR $wpdb->terms.name LIKE \"% $s%\" OR $wpdb->terms.name IN ($s_A)) "`.
798
+		 */
799
+		$terms_where = apply_filters("geodir_search_terms_where"," AND ($wpdb->terms.name LIKE \"$s\" OR $wpdb->terms.name LIKE \"$s%\" OR $wpdb->terms.name LIKE \"% $s%\" OR $wpdb->terms.name IN ($s_A)) ");
800 800
 	}
801 801
 
802
-    if ($snear != '') {
802
+	if ($snear != '') {
803 803
 
804 804
 
805
-        if (is_numeric($gd_session->get('near_me_range')) && !isset($_REQUEST['sdist'])) {
806
-            $dist = $gd_session->get('near_me_range');
807
-        }
808
-        $lon1 = $mylon - $dist / abs(cos(deg2rad($mylat)) * 69);
809
-        $lon2 = $mylon + $dist / abs(cos(deg2rad($mylat)) * 69);
810
-        $lat1 = $mylat - ($dist / 69);
811
-        $lat2 = $mylat + ($dist / 69);
805
+		if (is_numeric($gd_session->get('near_me_range')) && !isset($_REQUEST['sdist'])) {
806
+			$dist = $gd_session->get('near_me_range');
807
+		}
808
+		$lon1 = $mylon - $dist / abs(cos(deg2rad($mylat)) * 69);
809
+		$lon2 = $mylon + $dist / abs(cos(deg2rad($mylat)) * 69);
810
+		$lat1 = $mylat - ($dist / 69);
811
+		$lat2 = $mylat + ($dist / 69);
812 812
 
813
-        $rlon1 = is_numeric(min($lon1, $lon2)) ? min($lon1, $lon2) : '';
814
-        $rlon2 = is_numeric(max($lon1, $lon2)) ? max($lon1, $lon2) : '';
815
-        $rlat1 = is_numeric(min($lat1, $lat2)) ? min($lat1, $lat2) : '';
816
-        $rlat2 = is_numeric(max($lat1, $lat2)) ? max($lat1, $lat2) : '';
813
+		$rlon1 = is_numeric(min($lon1, $lon2)) ? min($lon1, $lon2) : '';
814
+		$rlon2 = is_numeric(max($lon1, $lon2)) ? max($lon1, $lon2) : '';
815
+		$rlat1 = is_numeric(min($lat1, $lat2)) ? min($lat1, $lat2) : '';
816
+		$rlat2 = is_numeric(max($lat1, $lat2)) ? max($lat1, $lat2) : '';
817 817
 
818 818
 
819 819
 
820
-	    $where .= " AND ( ( $wpdb->posts.post_title LIKE \"$s\" $better_search_terms)
820
+		$where .= " AND ( ( $wpdb->posts.post_title LIKE \"$s\" $better_search_terms)
821 821
 			                    $content_where 
822 822
 								OR ($wpdb->posts.ID IN( 
823 823
 										SELECT $wpdb->term_relationships.object_id as post_id 
@@ -834,13 +834,13 @@  discard block
 block discarded – undo
834 834
 						AND ( " . $table . ".post_latitude between $rlat1 and $rlat2 )
835 835
 						AND ( " . $table . ".post_longitude between $rlon1 and $rlon2 ) ";
836 836
 
837
-        if (isset($_REQUEST['sdist']) && $_REQUEST['sdist'] != 'all') {
838
-            $DistanceRadius = geodir_getDistanceRadius(get_option('geodir_search_dist_1'));
839
-            $where .= " AND CONVERT((" . $DistanceRadius . " * 2 * ASIN(SQRT( POWER(SIN((ABS($mylat) - ABS(" . $table . ".post_latitude)) * pi()/180 / 2), 2) +COS(ABS($mylat) * pi()/180) * COS( ABS(" . $table . ".post_latitude) * pi()/180) *POWER(SIN(($mylon - " . $table . ".post_longitude) * pi()/180 / 2), 2) ))),DECIMAL(64,4)) <= " . $dist;
840
-        }
837
+		if (isset($_REQUEST['sdist']) && $_REQUEST['sdist'] != 'all') {
838
+			$DistanceRadius = geodir_getDistanceRadius(get_option('geodir_search_dist_1'));
839
+			$where .= " AND CONVERT((" . $DistanceRadius . " * 2 * ASIN(SQRT( POWER(SIN((ABS($mylat) - ABS(" . $table . ".post_latitude)) * pi()/180 / 2), 2) +COS(ABS($mylat) * pi()/180) * COS( ABS(" . $table . ".post_latitude) * pi()/180) *POWER(SIN(($mylon - " . $table . ".post_longitude) * pi()/180 / 2), 2) ))),DECIMAL(64,4)) <= " . $dist;
840
+		}
841 841
 
842
-    } else {
843
-        $where .= " AND (	( $wpdb->posts.post_title LIKE \"$s\" $better_search_terms)
842
+	} else {
843
+		$where .= " AND (	( $wpdb->posts.post_title LIKE \"$s\" $better_search_terms)
844 844
                             $content_where  
845 845
 							OR ( $wpdb->posts.ID IN(	
846 846
 									SELECT $wpdb->term_relationships.object_id as post_id                     
@@ -854,19 +854,19 @@  discard block
 block discarded – undo
854 854
 					) 
855 855
 				AND $wpdb->posts.post_type in ('$post_types')
856 856
 				AND ($wpdb->posts.post_status = 'publish') ";
857
-    }
857
+	}
858 858
 
859 859
 	########### WPML ###########
860
-    if ( function_exists( 'icl_object_id' ) ) {
860
+	if ( function_exists( 'icl_object_id' ) ) {
861 861
 		$lang_code = ICL_LANGUAGE_CODE;
862 862
 
863 863
 		if ($lang_code && $post_types) {
864
-            $where .= " AND icl_t.language_code = '".$lang_code."' AND icl_t.element_type IN('post_" . $post_types . "') ";
865
-        }
866
-    }
867
-    ########### WPML ###########
864
+			$where .= " AND icl_t.language_code = '".$lang_code."' AND icl_t.element_type IN('post_" . $post_types . "') ";
865
+		}
866
+	}
867
+	########### WPML ###########
868 868
 
869
-    return $where;
869
+	return $where;
870 870
 }
871 871
 
872 872
 
@@ -881,45 +881,45 @@  discard block
 block discarded – undo
881 881
  * @return string Modified where query string.
882 882
  */
883 883
 function author_filter_where($where) {
884
-    global $wpdb, $geodir_post_type, $table, $curr;
884
+	global $wpdb, $geodir_post_type, $table, $curr;
885 885
 
886
-    $curauth = (get_query_var('author_name')) ? get_user_by('slug', get_query_var('author_name')) : get_userdata(get_query_var('author'));
887
-    $user_id = !empty($curauth->ID) ? (int)$curauth->ID : 0;
886
+	$curauth = (get_query_var('author_name')) ? get_user_by('slug', get_query_var('author_name')) : get_userdata(get_query_var('author'));
887
+	$user_id = !empty($curauth->ID) ? (int)$curauth->ID : 0;
888 888
 
889
-    if (isset($_REQUEST['stype'])) {
890
-        $where = $wpdb->prepare(" AND $wpdb->posts.post_type IN (%s) ",$_REQUEST['stype']);
891
-    } else {
892
-        $where = " AND $wpdb->posts.post_type IN ('gd_place') ";
893
-    }
889
+	if (isset($_REQUEST['stype'])) {
890
+		$where = $wpdb->prepare(" AND $wpdb->posts.post_type IN (%s) ",$_REQUEST['stype']);
891
+	} else {
892
+		$where = " AND $wpdb->posts.post_type IN ('gd_place') ";
893
+	}
894 894
 
895
-    if ($user_id > 0) {
896
-        if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite') {
897
-            $user_fav_posts = get_user_meta($user_id, 'gd_user_favourite_post', true);
898
-            $user_fav_posts = !empty($user_fav_posts) && is_array($user_fav_posts) ? implode("','", $user_fav_posts) : '-1';
899
-            $where .= " AND $wpdb->posts.ID IN ('$user_fav_posts')";
900
-        } else
901
-            $where .= " AND $wpdb->posts.post_author = $user_id";
902
-
903
-        if ($user_id == (int)get_current_user_id()) {
904
-            $where .= " AND $wpdb->posts.post_status IN ('publish','draft','pending') ";
905
-        } else {
906
-            $where .= " AND $wpdb->posts.post_status = 'publish' ";
907
-        }
908
-    } else {
909
-        $where .= " AND $wpdb->posts.post_author = '-1' AND $wpdb->posts.post_status = 'publish' ";
910
-    }
895
+	if ($user_id > 0) {
896
+		if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite') {
897
+			$user_fav_posts = get_user_meta($user_id, 'gd_user_favourite_post', true);
898
+			$user_fav_posts = !empty($user_fav_posts) && is_array($user_fav_posts) ? implode("','", $user_fav_posts) : '-1';
899
+			$where .= " AND $wpdb->posts.ID IN ('$user_fav_posts')";
900
+		} else
901
+			$where .= " AND $wpdb->posts.post_author = $user_id";
902
+
903
+		if ($user_id == (int)get_current_user_id()) {
904
+			$where .= " AND $wpdb->posts.post_status IN ('publish','draft','pending') ";
905
+		} else {
906
+			$where .= " AND $wpdb->posts.post_status = 'publish' ";
907
+		}
908
+	} else {
909
+		$where .= " AND $wpdb->posts.post_author = '-1' AND $wpdb->posts.post_status = 'publish' ";
910
+	}
911 911
 
912
-    ########### WPML ###########
913
-    if (function_exists('icl_object_id')) {
914
-        $lang_code = ICL_LANGUAGE_CODE;
915
-        if ($lang_code) {
916
-            $where .= " AND icl_t.language_code='" . $lang_code . "' ";
917
-        }
912
+	########### WPML ###########
913
+	if (function_exists('icl_object_id')) {
914
+		$lang_code = ICL_LANGUAGE_CODE;
915
+		if ($lang_code) {
916
+			$where .= " AND icl_t.language_code='" . $lang_code . "' ";
917
+		}
918 918
 
919
-    }
920
-    ########### WPML ###########
919
+	}
920
+	########### WPML ###########
921 921
 
922
-    return $where;
922
+	return $where;
923 923
 }
924 924
 
925 925
 /**
@@ -934,11 +934,11 @@  discard block
 block discarded – undo
934 934
  */
935 935
 function geodir_filter_widget_join($join)
936 936
 {
937
-    global $wp_query, $table;
938
-    if (!empty($wp_query->query['with_pics_only'])) {
939
-        $join .= " LEFT JOIN " . GEODIR_ATTACHMENT_TABLE . " ON ( " . GEODIR_ATTACHMENT_TABLE . ".post_id=" . $table . ".post_id AND " . GEODIR_ATTACHMENT_TABLE . ".mime_type LIKE '%image%' )";
940
-    }
941
-    return $join;
937
+	global $wp_query, $table;
938
+	if (!empty($wp_query->query['with_pics_only'])) {
939
+		$join .= " LEFT JOIN " . GEODIR_ATTACHMENT_TABLE . " ON ( " . GEODIR_ATTACHMENT_TABLE . ".post_id=" . $table . ".post_id AND " . GEODIR_ATTACHMENT_TABLE . ".mime_type LIKE '%image%' )";
940
+	}
941
+	return $join;
942 942
 }
943 943
 
944 944
 /**
@@ -953,43 +953,43 @@  discard block
 block discarded – undo
953 953
  */
954 954
 function geodir_filter_widget_where($where)
955 955
 {
956
-    global $wp_query, $table;
957
-    if (!empty($wp_query->query['show_featured_only'])) {
958
-        $where .= " AND " . $table . ".is_featured = '1'";
959
-    }
960
-    if (!empty($wp_query->query['show_special_only'])) {
961
-        $where .= " AND ( " . $table . ".geodir_special_offers != '' AND " . $table . ".geodir_special_offers IS NOT NULL )";
962
-    }
963
-    if (!empty($wp_query->query['with_pics_only'])) {
964
-        $where .= " AND " . GEODIR_ATTACHMENT_TABLE . ".ID IS NOT NULL GROUP BY " . $table . ".post_id";
965
-    }
966
-    if (!empty($wp_query->query['with_videos_only'])) {
967
-        $where .= " AND ( " . $table . ".geodir_video != '' AND " . $table . ".geodir_video IS NOT NULL )";
968
-    }
969
-    return $where;
956
+	global $wp_query, $table;
957
+	if (!empty($wp_query->query['show_featured_only'])) {
958
+		$where .= " AND " . $table . ".is_featured = '1'";
959
+	}
960
+	if (!empty($wp_query->query['show_special_only'])) {
961
+		$where .= " AND ( " . $table . ".geodir_special_offers != '' AND " . $table . ".geodir_special_offers IS NOT NULL )";
962
+	}
963
+	if (!empty($wp_query->query['with_pics_only'])) {
964
+		$where .= " AND " . GEODIR_ATTACHMENT_TABLE . ".ID IS NOT NULL GROUP BY " . $table . ".post_id";
965
+	}
966
+	if (!empty($wp_query->query['with_videos_only'])) {
967
+		$where .= " AND ( " . $table . ".geodir_video != '' AND " . $table . ".geodir_video IS NOT NULL )";
968
+	}
969
+	return $where;
970 970
 }
971 971
 
972 972
 
973 973
 function geodir_related_posts_fields($fields) {
974
-    global $wp_query, $wpdb, $table, $post;
974
+	global $wp_query, $wpdb, $table, $post;
975 975
 
976
-    $fields .= ", " . $table . ".* ";
976
+	$fields .= ", " . $table . ".* ";
977 977
 
978
-    $DistanceRadius = geodir_getDistanceRadius(get_option('geodir_search_dist_1'));
978
+	$DistanceRadius = geodir_getDistanceRadius(get_option('geodir_search_dist_1'));
979 979
 
980
-    $mylat = $post->post_latitude;
981
-    $mylon = $post->post_longitude;
980
+	$mylat = $post->post_latitude;
981
+	$mylon = $post->post_longitude;
982 982
 
983
-    $fields .= " , (" . $DistanceRadius . " * 2 * ASIN(SQRT( POWER(SIN((ABS($mylat) - ABS(" . $table . ".post_latitude)) * pi()/180 / 2), 2) +COS(ABS($mylat) * pi()/180) * COS( ABS(" . $table . ".post_latitude) * pi()/180) *POWER(SIN(($mylon - " . $table . ".post_longitude) * pi()/180 / 2), 2) )))as distance ";
984
-    return $fields;
983
+	$fields .= " , (" . $DistanceRadius . " * 2 * ASIN(SQRT( POWER(SIN((ABS($mylat) - ABS(" . $table . ".post_latitude)) * pi()/180 / 2), 2) +COS(ABS($mylat) * pi()/180) * COS( ABS(" . $table . ".post_latitude) * pi()/180) *POWER(SIN(($mylon - " . $table . ".post_longitude) * pi()/180 / 2), 2) )))as distance ";
984
+	return $fields;
985 985
 }
986 986
 function geodir_related_posts_fields_filter($query) {
987
-    if ( isset($query->query_vars['is_geodir_loop']) && $query->query_vars['is_geodir_loop']
988
-        && isset($query->query_vars['order_by']) && $query->query_vars['order_by'] == 'nearest'
989
-        && isset($query->query_vars['related_listings']) && $query->query_vars['related_listings']
990
-    ) {
991
-        add_filter('posts_fields', 'geodir_related_posts_fields', 1);
992
-    }
987
+	if ( isset($query->query_vars['is_geodir_loop']) && $query->query_vars['is_geodir_loop']
988
+		&& isset($query->query_vars['order_by']) && $query->query_vars['order_by'] == 'nearest'
989
+		&& isset($query->query_vars['related_listings']) && $query->query_vars['related_listings']
990
+	) {
991
+		add_filter('posts_fields', 'geodir_related_posts_fields', 1);
992
+	}
993 993
 }
994 994
 add_action('pre_get_posts', 'geodir_related_posts_fields_filter', 1);
995 995
 
@@ -1004,28 +1004,28 @@  discard block
 block discarded – undo
1004 1004
  * @return string|null If field exists in table returns order by clause else returns empty.
1005 1005
  */
1006 1006
 function geodir_prepare_custom_sorting( $sorting, $table ) {
1007
-    $orderby = '';
1007
+	$orderby = '';
1008 1008
     
1009
-    if ( empty( $sorting ) || empty( $table ) ) {
1010
-        return $orderby;
1011
-    }
1009
+	if ( empty( $sorting ) || empty( $table ) ) {
1010
+		return $orderby;
1011
+	}
1012 1012
     
1013
-    if ( strpos( strtoupper( $sorting ), '_ASC' ) !== false || strpos( strtoupper( $sorting ), '_DESC') !== false ) {
1014
-        $sorting_array = explode( '_', $sorting );
1013
+	if ( strpos( strtoupper( $sorting ), '_ASC' ) !== false || strpos( strtoupper( $sorting ), '_DESC') !== false ) {
1014
+		$sorting_array = explode( '_', $sorting );
1015 1015
         
1016
-        if ( ( $count = count( $sorting_array ) ) > 1 ) {
1017
-            $order = !empty( $sorting_array[$count - 1] ) ? strtoupper( $sorting_array[$count - 1] ) : '';
1018
-            array_pop( $sorting_array );
1016
+		if ( ( $count = count( $sorting_array ) ) > 1 ) {
1017
+			$order = !empty( $sorting_array[$count - 1] ) ? strtoupper( $sorting_array[$count - 1] ) : '';
1018
+			array_pop( $sorting_array );
1019 1019
             
1020
-            if ( !empty( $sorting_array ) && ( $order == 'ASC' || $order == 'DESC' ) ) {
1021
-                $sort_by = implode( '_', $sorting_array );
1020
+			if ( !empty( $sorting_array ) && ( $order == 'ASC' || $order == 'DESC' ) ) {
1021
+				$sort_by = implode( '_', $sorting_array );
1022 1022
                 
1023
-                if ( geodir_column_exist( $table, $sort_by ) ) {
1024
-                    $orderby = $table . "." . $sort_by . " " . $order;
1025
-                }
1026
-            }
1027
-        }
1028
-    }
1023
+				if ( geodir_column_exist( $table, $sort_by ) ) {
1024
+					$orderby = $table . "." . $sort_by . " " . $order;
1025
+				}
1026
+			}
1027
+		}
1028
+	}
1029 1029
 
1030
-    return $orderby;
1030
+	return $orderby;
1031 1031
 }
1032 1032
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +87 added lines, -87 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
  * @global string $s_A Extra parameters.
66 66
  * @global string $s_SA Extra parameters.
67 67
  */
68
-function set_listing_request($query )
68
+function set_listing_request($query)
69 69
 {
70 70
     global $wp_query, $wpdb, $geodir_post_type, $table, $dist, $mylat, $mylon, $s, $snear, $s, $s_A, $s_SA;
71 71
 
@@ -99,15 +99,15 @@  discard block
 block discarded – undo
99 99
         } //  Distance
100 100
 
101 101
         if (isset($_REQUEST['sgeo_lat'])) {
102
-            $mylat = (float)esc_attr($_REQUEST['sgeo_lat']);
102
+            $mylat = (float) esc_attr($_REQUEST['sgeo_lat']);
103 103
         } else {
104
-            $mylat = (float)geodir_get_current_city_lat();
104
+            $mylat = (float) geodir_get_current_city_lat();
105 105
         } //  Latitude
106 106
 
107 107
         if (isset($_REQUEST['sgeo_lon'])) {
108
-            $mylon = (float)esc_attr($_REQUEST['sgeo_lon']);
108
+            $mylon = (float) esc_attr($_REQUEST['sgeo_lon']);
109 109
         } else {
110
-            $mylon = (float)geodir_get_current_city_lng();
110
+            $mylon = (float) geodir_get_current_city_lng();
111 111
         } //  Distance
112 112
 
113 113
         if (isset($_REQUEST['snear'])) {
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 
121 121
         if ($snear == 'NEAR ME') {
122 122
             $ip = $_SERVER['REMOTE_ADDR'];
123
-            $addr_details = unserialize(file_get_contents('http://www.geoplugin.net/php.gp?ip=' . $ip));
123
+            $addr_details = unserialize(file_get_contents('http://www.geoplugin.net/php.gp?ip='.$ip));
124 124
             $mylat = stripslashes(geodir_utf8_ucfirst($addr_details[geoplugin_latitude]));
125 125
             $mylon = stripslashes(geodir_utf8_ucfirst($addr_details[geoplugin_longitude]));
126 126
         }
@@ -130,9 +130,9 @@  discard block
 block discarded – undo
130 130
             $s_AA = str_replace(" ", "", $s);
131 131
             $s_A = explode(",", $s_AA);
132 132
             $s_A = implode('","', $s_A);
133
-            $s_A = '"' . $s_A . '"';
133
+            $s_A = '"'.$s_A.'"';
134 134
         } else {
135
-            $s_A = '"' . $s . '"';
135
+            $s_A = '"'.$s.'"';
136 136
         }
137 137
 
138 138
         if (strstr($s, ' ')) {
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
     }
194 194
     if (isset($query->query_vars['is_geodir_loop']) && $query->query_vars['is_geodir_loop']) {
195 195
 
196
-        $table = $plugin_prefix . $geodir_post_type . '_detail';
196
+        $table = $plugin_prefix.$geodir_post_type.'_detail';
197 197
 
198 198
         add_filter('posts_fields', 'geodir_posts_fields', 1);
199 199
         add_filter('posts_join', 'geodir_posts_join', 1);
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
     global $wp_query, $wpdb, $geodir_post_type, $table, $plugin_prefix, $dist, $mylat, $mylon, $snear, $gd_session;
234 234
 
235 235
     // Filter-Location-Manager to add location table.
236
-    $fields .= ", " . $table . ".* ";
236
+    $fields .= ", ".$table.".* ";
237 237
 
238 238
 	if ($snear != '' || $gd_session->get('all_near_me')) {
239 239
         $DistanceRadius = geodir_getDistanceRadius(get_option('geodir_search_dist_1'));
@@ -243,16 +243,16 @@  discard block
 block discarded – undo
243 243
             $mylon = $gd_session->get('user_lon');
244 244
         }
245 245
 
246
-        $fields .= " , (" . $DistanceRadius . " * 2 * ASIN(SQRT( POWER(SIN((ABS($mylat) - ABS(" . $table . ".post_latitude)) * pi()/180 / 2), 2) +COS(ABS($mylat) * pi()/180) * COS( ABS(" . $table . ".post_latitude) * pi()/180) *POWER(SIN(($mylon - " . $table . ".post_longitude) * pi()/180 / 2), 2) )))as distance ";
246
+        $fields .= " , (".$DistanceRadius." * 2 * ASIN(SQRT( POWER(SIN((ABS($mylat) - ABS(".$table.".post_latitude)) * pi()/180 / 2), 2) +COS(ABS($mylat) * pi()/180) * COS( ABS(".$table.".post_latitude) * pi()/180) *POWER(SIN(($mylon - ".$table.".post_longitude) * pi()/180 / 2), 2) )))as distance ";
247 247
     }
248 248
 
249 249
     global $s;
250 250
     if (is_search() && isset($_REQUEST['geodir_search']) && $s && trim($s) != '') {
251 251
         $keywords = explode(" ", $s);
252 252
 
253
-        if(is_array($keywords) && $klimit = get_option('geodir_search_word_limit')){
254
-            foreach($keywords as $kkey=>$kword){
255
-                if(geodir_utf8_strlen($kword)<=$klimit){
253
+        if (is_array($keywords) && $klimit = get_option('geodir_search_word_limit')) {
254
+            foreach ($keywords as $kkey=>$kword) {
255
+                if (geodir_utf8_strlen($kword) <= $klimit) {
256 256
                     unset($keywords[$kkey]);
257 257
                 }
258 258
             }
@@ -270,24 +270,24 @@  discard block
 block discarded – undo
270 270
                 $count = 0;
271 271
                 foreach ($keywords as $keyword) {
272 272
                     $keyword = trim($keyword);
273
-                    $keyword  = wp_specialchars_decode($keyword ,ENT_QUOTES);
273
+                    $keyword = wp_specialchars_decode($keyword, ENT_QUOTES);
274 274
 					$count++;
275 275
                     if ($count < count($keywords)) {
276 276
                        // $gd_titlematch_part .= $wpdb->posts . ".post_title LIKE '%%" . $keyword . "%%' " . $key . " ";
277
-						$gd_titlematch_part .= "( " . $wpdb->posts . ".post_title LIKE '" . $keyword . "' OR " . $wpdb->posts . ".post_title LIKE '" . $keyword . "%%' OR " . $wpdb->posts . ".post_title LIKE '%% " . $keyword . "%%' ) " . $key . " ";
277
+						$gd_titlematch_part .= "( ".$wpdb->posts.".post_title LIKE '".$keyword."' OR ".$wpdb->posts.".post_title LIKE '".$keyword."%%' OR ".$wpdb->posts.".post_title LIKE '%% ".$keyword."%%' ) ".$key." ";
278 278
                     } else {
279 279
                         //$gd_titlematch_part .= $wpdb->posts . ".post_title LIKE '%%" . $keyword . "%%' ";
280
-						$gd_titlematch_part .= "( " . $wpdb->posts . ".post_title LIKE '" . $keyword . "' OR " . $wpdb->posts . ".post_title LIKE '" . $keyword . "%%' OR " . $wpdb->posts . ".post_title LIKE '%% " . $keyword . "%%' ) ";
280
+						$gd_titlematch_part .= "( ".$wpdb->posts.".post_title LIKE '".$keyword."' OR ".$wpdb->posts.".post_title LIKE '".$keyword."%%' OR ".$wpdb->posts.".post_title LIKE '%% ".$keyword."%%' ) ";
281 281
                     }
282 282
                 }
283
-                $gd_titlematch_part .= "THEN 1 ELSE 0 END AS " . $part . ",";
283
+                $gd_titlematch_part .= "THEN 1 ELSE 0 END AS ".$part.",";
284 284
             }
285 285
         } else {
286 286
             $gd_titlematch_part = "";
287 287
         }
288
-        $s = stripslashes_deep( $s );
289
-        $s = wp_specialchars_decode($s,ENT_QUOTES);
290
-		$fields .= $wpdb->prepare(", CASE WHEN " . $table . ".is_featured='1' THEN 1 ELSE 0 END AS gd_featured, CASE WHEN " . $wpdb->posts . ".post_title LIKE %s THEN 1 ELSE 0 END AS gd_exacttitle," . $gd_titlematch_part . " CASE WHEN ( " . $wpdb->posts . ".post_title LIKE %s OR " . $wpdb->posts . ".post_title LIKE %s OR " . $wpdb->posts . ".post_title LIKE %s ) THEN 1 ELSE 0 END AS gd_titlematch, CASE WHEN ( " . $wpdb->posts . ".post_content LIKE %s OR " . $wpdb->posts . ".post_content LIKE %s OR " . $wpdb->posts . ".post_content LIKE %s OR " . $wpdb->posts . ".post_content LIKE %s ) THEN 1 ELSE 0 END AS gd_content", array($s, $s, $s . '%', '% ' . $s . '%', $s, $s . ' %', '% ' . $s . ' %', '% ' . $s));
288
+        $s = stripslashes_deep($s);
289
+        $s = wp_specialchars_decode($s, ENT_QUOTES);
290
+		$fields .= $wpdb->prepare(", CASE WHEN ".$table.".is_featured='1' THEN 1 ELSE 0 END AS gd_featured, CASE WHEN ".$wpdb->posts.".post_title LIKE %s THEN 1 ELSE 0 END AS gd_exacttitle,".$gd_titlematch_part." CASE WHEN ( ".$wpdb->posts.".post_title LIKE %s OR ".$wpdb->posts.".post_title LIKE %s OR ".$wpdb->posts.".post_title LIKE %s ) THEN 1 ELSE 0 END AS gd_titlematch, CASE WHEN ( ".$wpdb->posts.".post_content LIKE %s OR ".$wpdb->posts.".post_content LIKE %s OR ".$wpdb->posts.".post_content LIKE %s OR ".$wpdb->posts.".post_content LIKE %s ) THEN 1 ELSE 0 END AS gd_content", array($s, $s, $s.'%', '% '.$s.'%', $s, $s.' %', '% '.$s.' %', '% '.$s));
291 291
     }
292 292
 
293 293
     return $fields;
@@ -316,13 +316,13 @@  discard block
 block discarded – undo
316 316
         $lang_code = ICL_LANGUAGE_CODE;
317 317
         $default_lang_code = $sitepress->get_default_language();
318 318
         if ($lang_code) {
319
-            $join .= "JOIN " . $table_prefix . "icl_translations icl_t ON icl_t.element_id = " . $table_prefix . "posts.ID";
319
+            $join .= "JOIN ".$table_prefix."icl_translations icl_t ON icl_t.element_id = ".$table_prefix."posts.ID";
320 320
         }
321 321
 
322 322
     }
323 323
     ########### WPML ###########
324 324
 
325
-    $join .= " INNER JOIN " . $table . " ON (" . $table . ".post_id = $wpdb->posts.ID)  ";
325
+    $join .= " INNER JOIN ".$table." ON (".$table.".post_id = $wpdb->posts.ID)  ";
326 326
     //===old code start
327 327
     //$join .= " INNER JOIN ".POST_LOCATION_TABLE." ON (".$table.".post_location_id = ".POST_LOCATION_TABLE.".location_id)  " ;//===old code end
328 328
 
@@ -391,7 +391,7 @@  discard block
 block discarded – undo
391 391
             $sort_by = 'az';
392 392
         }
393 393
 
394
-        if ($snear != '' &&  $sort_by!='farthest') {
394
+        if ($snear != '' && $sort_by != 'farthest') {
395 395
             $sort_by = 'nearest';
396 396
         }
397 397
     }
@@ -405,20 +405,20 @@  discard block
 block discarded – undo
405 405
             break;
406 406
         case 'low_review':
407 407
         case 'rating_count_asc':
408
-            $orderby = $table . ".rating_count ASC, " . $table . ".overall_rating ASC, ";
408
+            $orderby = $table.".rating_count ASC, ".$table.".overall_rating ASC, ";
409 409
             break;
410 410
         case 'high_review':
411 411
         case 'rating_count_desc':
412
-            $orderby = $table . ".rating_count DESC, " . $table . ".overall_rating DESC, ";
412
+            $orderby = $table.".rating_count DESC, ".$table.".overall_rating DESC, ";
413 413
             break;
414 414
         case 'low_rating':
415
-            $orderby = "( " . $table . ".overall_rating  ) ASC, " . $table . ".rating_count ASC,  ";
415
+            $orderby = "( ".$table.".overall_rating  ) ASC, ".$table.".rating_count ASC,  ";
416 416
             break;
417 417
         case 'high_rating':
418
-            $orderby = " " . $table . ".overall_rating DESC, " . $table . ".rating_count DESC, ";
418
+            $orderby = " ".$table.".overall_rating DESC, ".$table.".rating_count DESC, ";
419 419
             break;
420 420
         case 'featured':
421
-            $orderby = $table . ".is_featured asc, ";
421
+            $orderby = $table.".is_featured asc, ";
422 422
             break;
423 423
         case 'nearest':
424 424
             $orderby = " distance asc, ";
@@ -434,10 +434,10 @@  discard block
 block discarded – undo
434 434
             break;
435 435
         // sort by rating
436 436
         case 'overall_rating_desc':
437
-            $orderby = " " . $table . ".overall_rating DESC, " . $table . ".rating_count DESC, ";
437
+            $orderby = " ".$table.".overall_rating DESC, ".$table.".rating_count DESC, ";
438 438
             break;
439 439
         case 'overall_rating_asc':
440
-            $orderby = " " . $table . ".overall_rating ASC, " . $table . ".rating_count ASC, ";
440
+            $orderby = " ".$table.".overall_rating ASC, ".$table.".rating_count ASC, ";
441 441
             break;
442 442
         default:
443 443
 
@@ -458,24 +458,24 @@  discard block
 block discarded – undo
458 458
 
459 459
     if (is_search() && isset($_REQUEST['geodir_search']) && $s && trim($s) != '') {
460 460
         $keywords = explode(" ", $s);
461
-        if(is_array($keywords) && $klimit = get_option('geodir_search_word_limit')){
462
-            foreach($keywords as $kkey=>$kword){
463
-                if(geodir_utf8_strlen($kword)<=$klimit){
461
+        if (is_array($keywords) && $klimit = get_option('geodir_search_word_limit')) {
462
+            foreach ($keywords as $kkey=>$kword) {
463
+                if (geodir_utf8_strlen($kword) <= $klimit) {
464 464
                     unset($keywords[$kkey]);
465 465
                 }
466 466
             }
467 467
         }
468 468
         if ($sort_by == 'nearest' || $sort_by == 'farthest') {
469 469
             if (count($keywords) > 1) {
470
-                $orderby = $orderby . " ( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_alltitlematch_part * 100 + gd_titlematch_part * 50 + gd_content * 1.5) DESC, ";
470
+                $orderby = $orderby." ( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_alltitlematch_part * 100 + gd_titlematch_part * 50 + gd_content * 1.5) DESC, ";
471 471
             } else {
472
-                $orderby = $orderby . " ( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_content * 1.5) DESC, ";
472
+                $orderby = $orderby." ( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_content * 1.5) DESC, ";
473 473
             }
474 474
         } else {
475 475
             if (count($keywords) > 1) {
476
-                $orderby = "( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_alltitlematch_part * 100 + gd_titlematch_part * 50 + gd_content * 1.5) DESC, " . $orderby;
476
+                $orderby = "( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_alltitlematch_part * 100 + gd_titlematch_part * 50 + gd_content * 1.5) DESC, ".$orderby;
477 477
             } else {
478
-                $orderby = "( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_content * 1.5) DESC, " . $orderby;
478
+                $orderby = "( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_content * 1.5) DESC, ".$orderby;
479 479
             }
480 480
         }
481 481
     }
@@ -490,7 +490,7 @@  discard block
 block discarded – undo
490 490
      */
491 491
     $orderby = apply_filters('geodir_posts_order_by_sort', $orderby, $sort_by, $table);
492 492
 
493
-    $orderby .= $table . ".is_featured asc, $wpdb->posts.post_date desc, $wpdb->posts.post_title ";
493
+    $orderby .= $table.".is_featured asc, $wpdb->posts.post_date desc, $wpdb->posts.post_title ";
494 494
 
495 495
     return $orderby;
496 496
 }
@@ -512,7 +512,7 @@  discard block
 block discarded – undo
512 512
 
513 513
     global $wpdb;
514 514
 
515
-    if ($sort_by != '' && (!is_search() || ( isset($_REQUEST['s']) && isset($_REQUEST['snear']) && $_REQUEST['snear']=='' && ( $_REQUEST['s']=='' ||  $_REQUEST['s']==' ') ) )) {
515
+    if ($sort_by != '' && (!is_search() || (isset($_REQUEST['s']) && isset($_REQUEST['snear']) && $_REQUEST['snear'] == '' && ($_REQUEST['s'] == '' || $_REQUEST['s'] == ' ')))) {
516 516
 
517 517
         $sort_array = explode('_', $sort_by);
518 518
 
@@ -522,31 +522,31 @@  discard block
 block discarded – undo
522 522
 
523 523
         if ($sort_by_count > 1 && ($order == 'asc' || $order == 'desc')) {
524 524
 
525
-            $sort_by = str_replace('_' . $order, '', $sort_by);
525
+            $sort_by = str_replace('_'.$order, '', $sort_by);
526 526
 
527 527
             switch ($sort_by):
528 528
 
529 529
                 case 'post_date':
530 530
                 case 'comment_count':
531 531
 
532
-                    $orderby = "$wpdb->posts." . $sort_by . " " . $order . ", ".$table . ".overall_rating " . $order . ", ";
532
+                    $orderby = "$wpdb->posts.".$sort_by." ".$order.", ".$table.".overall_rating ".$order.", ";
533 533
                     break;
534 534
 
535 535
                 case 'distance':
536
-                    $orderby = $sort_by . " " . $order . ", ";
536
+                    $orderby = $sort_by." ".$order.", ";
537 537
                     break;
538 538
 
539 539
 
540 540
                 // sort by rating
541 541
                 case 'overall_rating':
542
-                    $orderby = " " . $table . "." . $sort_by . "  " . $order . ", " . $table . ".rating_count " . $order . ", ";
542
+                    $orderby = " ".$table.".".$sort_by."  ".$order.", ".$table.".rating_count ".$order.", ";
543 543
 
544 544
                     break;
545 545
 
546 546
 
547 547
                 default:
548 548
                     if (geodir_column_exist($table, $sort_by)) {
549
-						$orderby = $table . "." . $sort_by . " " . $order . ", ";
549
+						$orderby = $table.".".$sort_by." ".$order.", ";
550 550
 					}
551 551
                     break;
552 552
 
@@ -594,7 +594,7 @@  discard block
 block discarded – undo
594 594
         }
595 595
 
596 596
         //if (!geodir_is_page('detail'))
597
-            add_filter('posts_where', 'geodir_default_where', 1);/**/
597
+            add_filter('posts_where', 'geodir_default_where', 1); /**/
598 598
 
599 599
         //add_filter( 'user_has_cap', 'geodir_preview_post_cap', 10, 3 );// let subscribers edit their own posts
600 600
 
@@ -665,7 +665,7 @@  discard block
 block discarded – undo
665 665
         $q_post_type = isset($wp_query->query['post_type']) ? $wp_query->query['post_type'] : '';
666 666
         //echo '##########'.$q_post_type;
667 667
         if ($lang_code && $q_post_type) {
668
-            $where .= " AND icl_t.language_code = '$lang_code' AND icl_t.element_type IN('post_" . $q_post_type . "') ";
668
+            $where .= " AND icl_t.language_code = '$lang_code' AND icl_t.element_type IN('post_".$q_post_type."') ";
669 669
             //$where .= " AND icl_t.language_code = '$lang_code' ";
670 670
         }
671 671
 
@@ -732,8 +732,8 @@  discard block
 block discarded – undo
732 732
 	}
733 733
 
734 734
 	$s = trim($s);
735
-    $s  = wp_specialchars_decode($s ,ENT_QUOTES);
736
-    $s_A = wp_specialchars_decode($s_A ,ENT_QUOTES);
735
+    $s = wp_specialchars_decode($s, ENT_QUOTES);
736
+    $s_A = wp_specialchars_decode($s_A, ENT_QUOTES);
737 737
 
738 738
     $where = '';
739 739
     $better_search_terms = '';
@@ -744,9 +744,9 @@  discard block
 block discarded – undo
744 744
 
745 745
     if ($s != '') {
746 746
         $keywords = explode(" ", $s);
747
-        if(is_array($keywords) && $klimit = get_option('geodir_search_word_limit')){
748
-            foreach($keywords as $kkey=>$kword){
749
-                if(geodir_utf8_strlen($kword)<=$klimit){
747
+        if (is_array($keywords) && $klimit = get_option('geodir_search_word_limit')) {
748
+            foreach ($keywords as $kkey=>$kword) {
749
+                if (geodir_utf8_strlen($kword) <= $klimit) {
750 750
                     unset($keywords[$kkey]);
751 751
                 }
752 752
             }
@@ -755,7 +755,7 @@  discard block
 block discarded – undo
755 755
         if (!empty($keywords)) {
756 756
             foreach ($keywords as $keyword) {
757 757
                 $keyword = trim($keyword);
758
-                $keyword  = wp_specialchars_decode($keyword ,ENT_QUOTES);
758
+                $keyword = wp_specialchars_decode($keyword, ENT_QUOTES);
759 759
                 if ($keyword != '') {
760 760
                     /**
761 761
                      * Filter the search query keywords SQL.
@@ -766,7 +766,7 @@  discard block
 block discarded – undo
766 766
                      * @param array $keywords The array of keywords for the query.
767 767
                      * @param string $keyword The single keyword being searched.
768 768
                      */
769
-					$better_search_terms .= apply_filters("geodir_search_better_search_terms",' OR ( ' . $wpdb->posts . '.post_title LIKE "' . $keyword . '" OR ' . $wpdb->posts . '.post_title LIKE "' . $keyword . '%" OR ' . $wpdb->posts . '.post_title LIKE "% ' . $keyword . '%" )',$keywords,$keyword);
769
+					$better_search_terms .= apply_filters("geodir_search_better_search_terms", ' OR ( '.$wpdb->posts.'.post_title LIKE "'.$keyword.'" OR '.$wpdb->posts.'.post_title LIKE "'.$keyword.'%" OR '.$wpdb->posts.'.post_title LIKE "% '.$keyword.'%" )', $keywords, $keyword);
770 770
                 }
771 771
             }
772 772
         }
@@ -774,10 +774,10 @@  discard block
 block discarded – undo
774 774
 
775 775
     /* get taxonomy */
776 776
     $taxonomies = geodir_get_taxonomies($post_types, true);
777
-    if($taxonomies) {
777
+    if ($taxonomies) {
778 778
         $taxonomies = implode("','", $taxonomies);
779
-        $taxonomies = "'" . $taxonomies . "'";
780
-    }else{$taxonomies='';}
779
+        $taxonomies = "'".$taxonomies."'";
780
+    } else {$taxonomies = ''; }
781 781
 
782 782
     $content_where = $terms_where = '';
783 783
 	if ($s != '') {
@@ -788,7 +788,7 @@  discard block
 block discarded – undo
788 788
          * @package GeoDirectory
789 789
          * @param string $content_where The query values, default: `" OR ($wpdb->posts.post_content LIKE \"$s\" OR $wpdb->posts.post_content LIKE \"$s%\" OR $wpdb->posts.post_content LIKE \"% $s%\" OR $wpdb->posts.post_content LIKE \"%>$s%\" OR $wpdb->posts.post_content LIKE \"%\n$s%\") ") "`.
790 790
          */
791
-		$content_where = apply_filters("geodir_search_content_where"," OR ($wpdb->posts.post_content LIKE \"$s\" OR $wpdb->posts.post_content LIKE \"$s%\" OR $wpdb->posts.post_content LIKE \"% $s%\" OR $wpdb->posts.post_content LIKE \"%>$s%\" OR $wpdb->posts.post_content LIKE \"%\n$s%\") ");
791
+		$content_where = apply_filters("geodir_search_content_where", " OR ($wpdb->posts.post_content LIKE \"$s\" OR $wpdb->posts.post_content LIKE \"$s%\" OR $wpdb->posts.post_content LIKE \"% $s%\" OR $wpdb->posts.post_content LIKE \"%>$s%\" OR $wpdb->posts.post_content LIKE \"%\n$s%\") ");
792 792
         /**
793 793
          * Filter the search query term values.
794 794
          *
@@ -796,7 +796,7 @@  discard block
 block discarded – undo
796 796
          * @package GeoDirectory
797 797
          * @param string $terms_where The separator, default: `" AND ($wpdb->terms.name LIKE \"$s\" OR $wpdb->terms.name LIKE \"$s%\" OR $wpdb->terms.name LIKE \"% $s%\" OR $wpdb->terms.name IN ($s_A)) "`.
798 798
          */
799
-        $terms_where = apply_filters("geodir_search_terms_where"," AND ($wpdb->terms.name LIKE \"$s\" OR $wpdb->terms.name LIKE \"$s%\" OR $wpdb->terms.name LIKE \"% $s%\" OR $wpdb->terms.name IN ($s_A)) ");
799
+        $terms_where = apply_filters("geodir_search_terms_where", " AND ($wpdb->terms.name LIKE \"$s\" OR $wpdb->terms.name LIKE \"$s%\" OR $wpdb->terms.name LIKE \"% $s%\" OR $wpdb->terms.name IN ($s_A)) ");
800 800
 	}
801 801
 
802 802
     if ($snear != '') {
@@ -831,12 +831,12 @@  discard block
 block discarded – undo
831 831
 							)
832 832
 						AND $wpdb->posts.post_type in ('{$post_types}')
833 833
 						AND ($wpdb->posts.post_status = 'publish')
834
-						AND ( " . $table . ".post_latitude between $rlat1 and $rlat2 )
835
-						AND ( " . $table . ".post_longitude between $rlon1 and $rlon2 ) ";
834
+						AND ( ".$table.".post_latitude between $rlat1 and $rlat2 )
835
+						AND ( ".$table.".post_longitude between $rlon1 and $rlon2 ) ";
836 836
 
837 837
         if (isset($_REQUEST['sdist']) && $_REQUEST['sdist'] != 'all') {
838 838
             $DistanceRadius = geodir_getDistanceRadius(get_option('geodir_search_dist_1'));
839
-            $where .= " AND CONVERT((" . $DistanceRadius . " * 2 * ASIN(SQRT( POWER(SIN((ABS($mylat) - ABS(" . $table . ".post_latitude)) * pi()/180 / 2), 2) +COS(ABS($mylat) * pi()/180) * COS( ABS(" . $table . ".post_latitude) * pi()/180) *POWER(SIN(($mylon - " . $table . ".post_longitude) * pi()/180 / 2), 2) ))),DECIMAL(64,4)) <= " . $dist;
839
+            $where .= " AND CONVERT((".$DistanceRadius." * 2 * ASIN(SQRT( POWER(SIN((ABS($mylat) - ABS(".$table.".post_latitude)) * pi()/180 / 2), 2) +COS(ABS($mylat) * pi()/180) * COS( ABS(".$table.".post_latitude) * pi()/180) *POWER(SIN(($mylon - ".$table.".post_longitude) * pi()/180 / 2), 2) ))),DECIMAL(64,4)) <= ".$dist;
840 840
         }
841 841
 
842 842
     } else {
@@ -857,11 +857,11 @@  discard block
 block discarded – undo
857 857
     }
858 858
 
859 859
 	########### WPML ###########
860
-    if ( function_exists( 'icl_object_id' ) ) {
860
+    if (function_exists('icl_object_id')) {
861 861
 		$lang_code = ICL_LANGUAGE_CODE;
862 862
 
863 863
 		if ($lang_code && $post_types) {
864
-            $where .= " AND icl_t.language_code = '".$lang_code."' AND icl_t.element_type IN('post_" . $post_types . "') ";
864
+            $where .= " AND icl_t.language_code = '".$lang_code."' AND icl_t.element_type IN('post_".$post_types."') ";
865 865
         }
866 866
     }
867 867
     ########### WPML ###########
@@ -884,10 +884,10 @@  discard block
 block discarded – undo
884 884
     global $wpdb, $geodir_post_type, $table, $curr;
885 885
 
886 886
     $curauth = (get_query_var('author_name')) ? get_user_by('slug', get_query_var('author_name')) : get_userdata(get_query_var('author'));
887
-    $user_id = !empty($curauth->ID) ? (int)$curauth->ID : 0;
887
+    $user_id = !empty($curauth->ID) ? (int) $curauth->ID : 0;
888 888
 
889 889
     if (isset($_REQUEST['stype'])) {
890
-        $where = $wpdb->prepare(" AND $wpdb->posts.post_type IN (%s) ",$_REQUEST['stype']);
890
+        $where = $wpdb->prepare(" AND $wpdb->posts.post_type IN (%s) ", $_REQUEST['stype']);
891 891
     } else {
892 892
         $where = " AND $wpdb->posts.post_type IN ('gd_place') ";
893 893
     }
@@ -900,7 +900,7 @@  discard block
 block discarded – undo
900 900
         } else
901 901
             $where .= " AND $wpdb->posts.post_author = $user_id";
902 902
 
903
-        if ($user_id == (int)get_current_user_id()) {
903
+        if ($user_id == (int) get_current_user_id()) {
904 904
             $where .= " AND $wpdb->posts.post_status IN ('publish','draft','pending') ";
905 905
         } else {
906 906
             $where .= " AND $wpdb->posts.post_status = 'publish' ";
@@ -913,7 +913,7 @@  discard block
 block discarded – undo
913 913
     if (function_exists('icl_object_id')) {
914 914
         $lang_code = ICL_LANGUAGE_CODE;
915 915
         if ($lang_code) {
916
-            $where .= " AND icl_t.language_code='" . $lang_code . "' ";
916
+            $where .= " AND icl_t.language_code='".$lang_code."' ";
917 917
         }
918 918
 
919 919
     }
@@ -936,7 +936,7 @@  discard block
 block discarded – undo
936 936
 {
937 937
     global $wp_query, $table;
938 938
     if (!empty($wp_query->query['with_pics_only'])) {
939
-        $join .= " LEFT JOIN " . GEODIR_ATTACHMENT_TABLE . " ON ( " . GEODIR_ATTACHMENT_TABLE . ".post_id=" . $table . ".post_id AND " . GEODIR_ATTACHMENT_TABLE . ".mime_type LIKE '%image%' )";
939
+        $join .= " LEFT JOIN ".GEODIR_ATTACHMENT_TABLE." ON ( ".GEODIR_ATTACHMENT_TABLE.".post_id=".$table.".post_id AND ".GEODIR_ATTACHMENT_TABLE.".mime_type LIKE '%image%' )";
940 940
     }
941 941
     return $join;
942 942
 }
@@ -955,16 +955,16 @@  discard block
 block discarded – undo
955 955
 {
956 956
     global $wp_query, $table;
957 957
     if (!empty($wp_query->query['show_featured_only'])) {
958
-        $where .= " AND " . $table . ".is_featured = '1'";
958
+        $where .= " AND ".$table.".is_featured = '1'";
959 959
     }
960 960
     if (!empty($wp_query->query['show_special_only'])) {
961
-        $where .= " AND ( " . $table . ".geodir_special_offers != '' AND " . $table . ".geodir_special_offers IS NOT NULL )";
961
+        $where .= " AND ( ".$table.".geodir_special_offers != '' AND ".$table.".geodir_special_offers IS NOT NULL )";
962 962
     }
963 963
     if (!empty($wp_query->query['with_pics_only'])) {
964
-        $where .= " AND " . GEODIR_ATTACHMENT_TABLE . ".ID IS NOT NULL GROUP BY " . $table . ".post_id";
964
+        $where .= " AND ".GEODIR_ATTACHMENT_TABLE.".ID IS NOT NULL GROUP BY ".$table.".post_id";
965 965
     }
966 966
     if (!empty($wp_query->query['with_videos_only'])) {
967
-        $where .= " AND ( " . $table . ".geodir_video != '' AND " . $table . ".geodir_video IS NOT NULL )";
967
+        $where .= " AND ( ".$table.".geodir_video != '' AND ".$table.".geodir_video IS NOT NULL )";
968 968
     }
969 969
     return $where;
970 970
 }
@@ -973,18 +973,18 @@  discard block
 block discarded – undo
973 973
 function geodir_related_posts_fields($fields) {
974 974
     global $wp_query, $wpdb, $table, $post;
975 975
 
976
-    $fields .= ", " . $table . ".* ";
976
+    $fields .= ", ".$table.".* ";
977 977
 
978 978
     $DistanceRadius = geodir_getDistanceRadius(get_option('geodir_search_dist_1'));
979 979
 
980 980
     $mylat = $post->post_latitude;
981 981
     $mylon = $post->post_longitude;
982 982
 
983
-    $fields .= " , (" . $DistanceRadius . " * 2 * ASIN(SQRT( POWER(SIN((ABS($mylat) - ABS(" . $table . ".post_latitude)) * pi()/180 / 2), 2) +COS(ABS($mylat) * pi()/180) * COS( ABS(" . $table . ".post_latitude) * pi()/180) *POWER(SIN(($mylon - " . $table . ".post_longitude) * pi()/180 / 2), 2) )))as distance ";
983
+    $fields .= " , (".$DistanceRadius." * 2 * ASIN(SQRT( POWER(SIN((ABS($mylat) - ABS(".$table.".post_latitude)) * pi()/180 / 2), 2) +COS(ABS($mylat) * pi()/180) * COS( ABS(".$table.".post_latitude) * pi()/180) *POWER(SIN(($mylon - ".$table.".post_longitude) * pi()/180 / 2), 2) )))as distance ";
984 984
     return $fields;
985 985
 }
986 986
 function geodir_related_posts_fields_filter($query) {
987
-    if ( isset($query->query_vars['is_geodir_loop']) && $query->query_vars['is_geodir_loop']
987
+    if (isset($query->query_vars['is_geodir_loop']) && $query->query_vars['is_geodir_loop']
988 988
         && isset($query->query_vars['order_by']) && $query->query_vars['order_by'] == 'nearest'
989 989
         && isset($query->query_vars['related_listings']) && $query->query_vars['related_listings']
990 990
     ) {
@@ -1003,25 +1003,25 @@  discard block
 block discarded – undo
1003 1003
  * @param string $table Listing table name.
1004 1004
  * @return string|null If field exists in table returns order by clause else returns empty.
1005 1005
  */
1006
-function geodir_prepare_custom_sorting( $sorting, $table ) {
1006
+function geodir_prepare_custom_sorting($sorting, $table) {
1007 1007
     $orderby = '';
1008 1008
     
1009
-    if ( empty( $sorting ) || empty( $table ) ) {
1009
+    if (empty($sorting) || empty($table)) {
1010 1010
         return $orderby;
1011 1011
     }
1012 1012
     
1013
-    if ( strpos( strtoupper( $sorting ), '_ASC' ) !== false || strpos( strtoupper( $sorting ), '_DESC') !== false ) {
1014
-        $sorting_array = explode( '_', $sorting );
1013
+    if (strpos(strtoupper($sorting), '_ASC') !== false || strpos(strtoupper($sorting), '_DESC') !== false) {
1014
+        $sorting_array = explode('_', $sorting);
1015 1015
         
1016
-        if ( ( $count = count( $sorting_array ) ) > 1 ) {
1017
-            $order = !empty( $sorting_array[$count - 1] ) ? strtoupper( $sorting_array[$count - 1] ) : '';
1018
-            array_pop( $sorting_array );
1016
+        if (($count = count($sorting_array)) > 1) {
1017
+            $order = !empty($sorting_array[$count - 1]) ? strtoupper($sorting_array[$count - 1]) : '';
1018
+            array_pop($sorting_array);
1019 1019
             
1020
-            if ( !empty( $sorting_array ) && ( $order == 'ASC' || $order == 'DESC' ) ) {
1021
-                $sort_by = implode( '_', $sorting_array );
1020
+            if (!empty($sorting_array) && ($order == 'ASC' || $order == 'DESC')) {
1021
+                $sort_by = implode('_', $sorting_array);
1022 1022
                 
1023
-                if ( geodir_column_exist( $table, $sort_by ) ) {
1024
-                    $orderby = $table . "." . $sort_by . " " . $order;
1023
+                if (geodir_column_exist($table, $sort_by)) {
1024
+                    $orderby = $table.".".$sort_by." ".$order;
1025 1025
                 }
1026 1026
             }
1027 1027
         }
Please login to merge, or discard this patch.
geodirectory-functions/custom_functions.php 4 patches
Braces   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -2256,7 +2256,7 @@  discard block
 block discarded – undo
2256 2256
 
2257 2257
 	if ( $new_style ) {
2258 2258
 		$default_search_button_label = '<i class="fa fa-search" aria-hidden="true"></i>';
2259
-	}else{
2259
+	} else{
2260 2260
 		$default_search_button_label = 'Search';
2261 2261
 	}
2262 2262
 	if ( get_option( 'geodir_search_button_label' ) && get_option( 'geodir_search_button_label' ) != 'Search' ) {
@@ -2283,7 +2283,7 @@  discard block
 block discarded – undo
2283 2283
 	if ( $new_style ) {
2284 2284
 	?>
2285 2285
 		<button class="geodir_submit_search <?php echo $fa_class; ?>"><?php _e( $default_search_button_label ,'geodirectory'); ?></button>
2286
-<?php }else{?>
2286
+<?php } else{?>
2287 2287
 		<input type="button" value="<?php esc_attr_e( $default_search_button_label ); ?>"
2288 2288
 	       class="geodir_submit_search <?php echo $fa_class; ?>"/>
2289 2289
 	<?php }
@@ -2333,17 +2333,17 @@  discard block
 block discarded – undo
2333 2333
 			if ( $new_style ) {
2334 2334
 				echo "</div>";
2335 2335
 			}
2336
-		}else{
2336
+		} else{
2337 2337
 			if(! empty( $post_types )){
2338 2338
 				$pt_arr = (array)$post_types;
2339 2339
 				echo '<input type="hidden" name="stype" value="' . key( $pt_arr  ) . '"  />';
2340
-			}else{
2340
+			} else{
2341 2341
 				echo '<input type="hidden" name="stype" value="gd_place"  />';
2342 2342
 			}
2343 2343
 
2344 2344
 		}
2345 2345
 
2346
-	}elseif ( ! empty( $post_types ) ) {
2346
+	} elseif ( ! empty( $post_types ) ) {
2347 2347
 		echo '<input type="hidden" name="stype" value="gd_place"  />';
2348 2348
 	}
2349 2349
 }
Please login to merge, or discard this patch.
Doc Comments   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
  * @param object|string $post The post object.
162 162
  * @param string $post_type   The post type.
163 163
  *
164
- * @return object Returns filtered package info as an object.
164
+ * @return string Returns filtered package info as an object.
165 165
  */
166 166
 function geodir_post_package_info( $package_info, $post = '', $post_type = '' ) {
167 167
 	$package_info['pid']              = 0;
@@ -2489,7 +2489,7 @@  discard block
 block discarded – undo
2489 2489
  *
2490 2490
  * @since 1.5.0
2491 2491
  *
2492
- * @return True if WPML is active else False.
2492
+ * @return boolean if WPML is active else False.
2493 2493
  */
2494 2494
 function geodir_is_wpml() {
2495 2495
     if (function_exists('icl_object_id')) {
@@ -2561,7 +2561,6 @@  discard block
 block discarded – undo
2561 2561
  * @since 1.6.16 Sync reviews if sync comments allowed.
2562 2562
  *
2563 2563
  * @param int $post_id The Post ID.
2564
- * @param string $lang Language code for translating post.
2565 2564
  * @param array $request_info The post details in an array.
2566 2565
  */
2567 2566
 function geodir_wpml_duplicate_listing($post_id, $request_info) {
@@ -2645,7 +2644,7 @@  discard block
 block discarded – undo
2645 2644
  * @param int $master_post_id Original Post ID.
2646 2645
  * @param int $tr_post_id Translation Post ID.
2647 2646
  * @param string $lang Language code for translating post.
2648
- * @return bool True for success, False for fail.
2647
+ * @return boolean|null True for success, False for fail.
2649 2648
  */
2650 2649
 function geodir_icl_duplicate_taxonomies($master_post_id, $tr_post_id, $lang) {
2651 2650
     global $sitepress, $wpdb;
@@ -2888,8 +2887,6 @@  discard block
 block discarded – undo
2888 2887
  *
2889 2888
  * @since 1.6.16
2890 2889
  *
2891
- * @param string $post_type WP post type or WP texonomy. Ex: gd_place.
2892
- * @param bool $taxonomy Whether $post_type is taxonomy or not.
2893 2890
  * @return bool True if review star disabled, otherwise false.
2894 2891
  */ 
2895 2892
 function geodir_rating_disabled_post_types() {
Please login to merge, or discard this patch.
Indentation   +298 added lines, -298 removed lines patch added patch discarded remove patch
@@ -2363,10 +2363,10 @@  discard block
 block discarded – undo
2363 2363
 	?>
2364 2364
 	<input class="search_text" name="s"
2365 2365
 	       value="<?php if ( isset( $_REQUEST['s'] ) && trim( $_REQUEST['s'] ) != '' ) {
2366
-		       echo esc_attr( stripslashes_deep( $_REQUEST['s'] ) );
2367
-	       } else {
2368
-		       echo $default_search_for_text;
2369
-	       } ?>" type="text"
2366
+			   echo esc_attr( stripslashes_deep( $_REQUEST['s'] ) );
2367
+		   } else {
2368
+			   echo $default_search_for_text;
2369
+		   } ?>" type="text"
2370 2370
 	       onblur="if (this.value.trim() == '') {this.value = '<?php echo esc_sql( $default_search_for_text ); ?>';}"
2371 2371
 	       onfocus="if (this.value == '<?php echo esc_sql( $default_search_for_text ); ?>') {this.value = '';}"
2372 2372
 	       onkeydown="javascript: if(event.keyCode == 13) geodir_click_search(this);">
@@ -2493,11 +2493,11 @@  discard block
 block discarded – undo
2493 2493
  * @return True if WPML is active else False.
2494 2494
  */
2495 2495
 function geodir_is_wpml() {
2496
-    if (function_exists('icl_object_id')) {
2497
-        return true;
2498
-    }
2496
+	if (function_exists('icl_object_id')) {
2497
+		return true;
2498
+	}
2499 2499
 
2500
-    return false;
2500
+	return false;
2501 2501
 }
2502 2502
 
2503 2503
 /**
@@ -2512,9 +2512,9 @@  discard block
 block discarded – undo
2512 2512
  * @return Language code.
2513 2513
  */
2514 2514
 function geodir_get_language_for_element($element_id, $element_type) {
2515
-    global $sitepress;
2515
+	global $sitepress;
2516 2516
 
2517
-    return $sitepress->get_language_for_element($element_id, $element_type);
2517
+	return $sitepress->get_language_for_element($element_id, $element_type);
2518 2518
 }
2519 2519
 
2520 2520
 /**
@@ -2531,31 +2531,31 @@  discard block
 block discarded – undo
2531 2531
  *                         Added to fix duplicate translation for front end.
2532 2532
  */
2533 2533
 function geodir_icl_make_duplicate($master_post_id, $lang, $postarr, $tr_post_id, $after_save = false) {
2534
-    global $sitepress;
2534
+	global $sitepress;
2535 2535
     
2536
-    $post_type = get_post_type($master_post_id);
2537
-    $icl_ajx_action = !empty($_REQUEST['icl_ajx_action']) && $_REQUEST['icl_ajx_action'] == 'make_duplicates' ? true : false;
2538
-    if (!empty($_REQUEST['action']) && $_REQUEST['action'] == 'wpml_duplicate_dashboard' && !empty($_REQUEST['duplicate_post_ids'])) {
2539
-        $icl_ajx_action = true;
2540
-    }
2536
+	$post_type = get_post_type($master_post_id);
2537
+	$icl_ajx_action = !empty($_REQUEST['icl_ajx_action']) && $_REQUEST['icl_ajx_action'] == 'make_duplicates' ? true : false;
2538
+	if (!empty($_REQUEST['action']) && $_REQUEST['action'] == 'wpml_duplicate_dashboard' && !empty($_REQUEST['duplicate_post_ids'])) {
2539
+		$icl_ajx_action = true;
2540
+	}
2541 2541
     
2542
-    if (in_array($post_type, geodir_get_posttypes())) {
2543
-        if ($icl_ajx_action || $after_save) {
2544
-            // Duplicate post details
2545
-            geodir_icl_duplicate_post_details($master_post_id, $tr_post_id, $lang);
2542
+	if (in_array($post_type, geodir_get_posttypes())) {
2543
+		if ($icl_ajx_action || $after_save) {
2544
+			// Duplicate post details
2545
+			geodir_icl_duplicate_post_details($master_post_id, $tr_post_id, $lang);
2546 2546
             
2547
-            // Duplicate taxonomies
2548
-            geodir_icl_duplicate_taxonomies($master_post_id, $tr_post_id, $lang);
2547
+			// Duplicate taxonomies
2548
+			geodir_icl_duplicate_taxonomies($master_post_id, $tr_post_id, $lang);
2549 2549
             
2550
-            // Duplicate post images
2551
-            geodir_icl_duplicate_post_images($master_post_id, $tr_post_id, $lang);
2552
-        }
2550
+			// Duplicate post images
2551
+			geodir_icl_duplicate_post_images($master_post_id, $tr_post_id, $lang);
2552
+		}
2553 2553
         
2554
-        // Sync post reviews
2555
-        if ($sitepress->get_setting('sync_comments_on_duplicates')) {
2556
-            geodir_wpml_duplicate_post_reviews($master_post_id, $tr_post_id, $lang);
2557
-        }
2558
-    }
2554
+		// Sync post reviews
2555
+		if ($sitepress->get_setting('sync_comments_on_duplicates')) {
2556
+			geodir_wpml_duplicate_post_reviews($master_post_id, $tr_post_id, $lang);
2557
+		}
2558
+	}
2559 2559
 }
2560 2560
 add_filter( 'icl_make_duplicate', 'geodir_icl_make_duplicate', 11, 4 );
2561 2561
 
@@ -2569,18 +2569,18 @@  discard block
 block discarded – undo
2569 2569
  * @param array $request_info The post details in an array.
2570 2570
  */
2571 2571
 function geodir_wpml_duplicate_listing($post_id, $request_info) {
2572
-    global $sitepress;
2572
+	global $sitepress;
2573 2573
     
2574
-    $icl_ajx_action = !empty($_REQUEST['icl_ajx_action']) && $_REQUEST['icl_ajx_action'] == 'make_duplicates' ? true : false;
2575
-    if (!empty($_REQUEST['action']) && $_REQUEST['action'] == 'wpml_duplicate_dashboard' && !empty($_REQUEST['duplicate_post_ids'])) {
2576
-        $icl_ajx_action = true;
2577
-    }
2574
+	$icl_ajx_action = !empty($_REQUEST['icl_ajx_action']) && $_REQUEST['icl_ajx_action'] == 'make_duplicates' ? true : false;
2575
+	if (!empty($_REQUEST['action']) && $_REQUEST['action'] == 'wpml_duplicate_dashboard' && !empty($_REQUEST['duplicate_post_ids'])) {
2576
+		$icl_ajx_action = true;
2577
+	}
2578 2578
     
2579
-    if (!$icl_ajx_action && in_array(get_post_type($post_id), geodir_get_posttypes()) && $post_duplicates = $sitepress->get_duplicates($post_id)) {
2580
-        foreach ($post_duplicates as $lang => $dup_post_id) {
2581
-            geodir_icl_make_duplicate($post_id, $lang, $request_info, $dup_post_id, true);
2582
-        }
2583
-    }
2579
+	if (!$icl_ajx_action && in_array(get_post_type($post_id), geodir_get_posttypes()) && $post_duplicates = $sitepress->get_duplicates($post_id)) {
2580
+		foreach ($post_duplicates as $lang => $dup_post_id) {
2581
+			geodir_icl_make_duplicate($post_id, $lang, $request_info, $dup_post_id, true);
2582
+		}
2583
+	}
2584 2584
 }
2585 2585
 
2586 2586
 /**
@@ -2596,17 +2596,17 @@  discard block
 block discarded – undo
2596 2596
  * @return bool True for success, False for fail.
2597 2597
  */
2598 2598
 function geodir_wpml_duplicate_post_reviews($master_post_id, $tr_post_id, $lang) {
2599
-    global $wpdb;
2599
+	global $wpdb;
2600 2600
 
2601
-    $reviews = $wpdb->get_results($wpdb->prepare("SELECT comment_id FROM " . GEODIR_REVIEW_TABLE . " WHERE post_id=%d ORDER BY id ASC", $master_post_id), ARRAY_A);
2601
+	$reviews = $wpdb->get_results($wpdb->prepare("SELECT comment_id FROM " . GEODIR_REVIEW_TABLE . " WHERE post_id=%d ORDER BY id ASC", $master_post_id), ARRAY_A);
2602 2602
 
2603
-    if (!empty($reviews)) {
2604
-        foreach ($reviews as $review) {
2605
-            geodir_wpml_duplicate_post_review($review['comment_id'], $master_post_id, $tr_post_id, $lang);
2606
-        }
2607
-    }
2603
+	if (!empty($reviews)) {
2604
+		foreach ($reviews as $review) {
2605
+			geodir_wpml_duplicate_post_review($review['comment_id'], $master_post_id, $tr_post_id, $lang);
2606
+		}
2607
+	}
2608 2608
 
2609
-    return false;
2609
+	return false;
2610 2610
 }
2611 2611
 
2612 2612
 /**
@@ -2623,22 +2623,22 @@  discard block
 block discarded – undo
2623 2623
  * @return bool True for success, False for fail.
2624 2624
  */
2625 2625
 function geodir_icl_duplicate_post_details($master_post_id, $tr_post_id, $lang) {
2626
-    global $wpdb, $plugin_prefix;
2626
+	global $wpdb, $plugin_prefix;
2627 2627
 
2628
-    $post_type = get_post_type($master_post_id);
2629
-    $post_table = $plugin_prefix . $post_type . '_detail';
2628
+	$post_type = get_post_type($master_post_id);
2629
+	$post_table = $plugin_prefix . $post_type . '_detail';
2630 2630
 
2631
-    $query = $wpdb->prepare("SELECT * FROM " . $post_table . " WHERE post_id = %d", array($master_post_id));
2632
-    $data = (array)$wpdb->get_row($query);
2631
+	$query = $wpdb->prepare("SELECT * FROM " . $post_table . " WHERE post_id = %d", array($master_post_id));
2632
+	$data = (array)$wpdb->get_row($query);
2633 2633
 
2634
-    if ( !empty( $data ) ) {
2635
-        $data['post_id'] = $tr_post_id;
2636
-        unset($data['default_category'], $data['marker_json'], $data['featured_image'], $data[$post_type . 'category']);
2637
-        $wpdb->update($post_table, $data, array('post_id' => $tr_post_id));
2638
-        return true;
2639
-    }
2634
+	if ( !empty( $data ) ) {
2635
+		$data['post_id'] = $tr_post_id;
2636
+		unset($data['default_category'], $data['marker_json'], $data['featured_image'], $data[$post_type . 'category']);
2637
+		$wpdb->update($post_table, $data, array('post_id' => $tr_post_id));
2638
+		return true;
2639
+	}
2640 2640
 
2641
-    return false;
2641
+	return false;
2642 2642
 }
2643 2643
 
2644 2644
 /**
@@ -2655,40 +2655,40 @@  discard block
 block discarded – undo
2655 2655
  * @return bool True for success, False for fail.
2656 2656
  */
2657 2657
 function geodir_icl_duplicate_taxonomies($master_post_id, $tr_post_id, $lang) {
2658
-    global $sitepress, $wpdb;
2659
-    $post_type = get_post_type($master_post_id);
2658
+	global $sitepress, $wpdb;
2659
+	$post_type = get_post_type($master_post_id);
2660 2660
 
2661
-    remove_filter('get_term', array($sitepress,'get_term_adjust_id')); // AVOID filtering to current language
2661
+	remove_filter('get_term', array($sitepress,'get_term_adjust_id')); // AVOID filtering to current language
2662 2662
 
2663
-    $taxonomies = get_object_taxonomies($post_type);
2664
-    foreach ($taxonomies as $taxonomy) {
2665
-        $terms = get_the_terms($master_post_id, $taxonomy);
2666
-        $terms_array = array();
2663
+	$taxonomies = get_object_taxonomies($post_type);
2664
+	foreach ($taxonomies as $taxonomy) {
2665
+		$terms = get_the_terms($master_post_id, $taxonomy);
2666
+		$terms_array = array();
2667 2667
         
2668
-        if ($terms) {
2669
-            foreach ($terms as $term) {
2670
-                $tr_id = apply_filters( 'translate_object_id',$term->term_id, $taxonomy, false, $lang);
2668
+		if ($terms) {
2669
+			foreach ($terms as $term) {
2670
+				$tr_id = apply_filters( 'translate_object_id',$term->term_id, $taxonomy, false, $lang);
2671 2671
                 
2672
-                if (!is_null($tr_id)){
2673
-                    // not using get_term - unfiltered get_term
2674
-                    $translated_term = $wpdb->get_row($wpdb->prepare("
2672
+				if (!is_null($tr_id)){
2673
+					// not using get_term - unfiltered get_term
2674
+					$translated_term = $wpdb->get_row($wpdb->prepare("
2675 2675
                         SELECT * FROM {$wpdb->terms} t JOIN {$wpdb->term_taxonomy} x ON x.term_id = t.term_id WHERE t.term_id = %d AND x.taxonomy = %s", $tr_id, $taxonomy));
2676 2676
 
2677
-                    $terms_array[] = $translated_term->term_id;
2678
-                }
2679
-            }
2677
+					$terms_array[] = $translated_term->term_id;
2678
+				}
2679
+			}
2680 2680
 
2681
-            if (!is_taxonomy_hierarchical($taxonomy)){
2682
-                $terms_array = array_unique( array_map( 'intval', $terms_array ) );
2683
-            }
2681
+			if (!is_taxonomy_hierarchical($taxonomy)){
2682
+				$terms_array = array_unique( array_map( 'intval', $terms_array ) );
2683
+			}
2684 2684
 
2685
-            wp_set_post_terms($tr_post_id, $terms_array, $taxonomy);
2685
+			wp_set_post_terms($tr_post_id, $terms_array, $taxonomy);
2686 2686
             
2687
-            if ($taxonomy == $post_type . 'category') {
2688
-                geodir_set_postcat_structure($tr_post_id, $post_type . 'category');
2689
-            }
2690
-        }
2691
-    }
2687
+			if ($taxonomy == $post_type . 'category') {
2688
+				geodir_set_postcat_structure($tr_post_id, $post_type . 'category');
2689
+			}
2690
+		}
2691
+	}
2692 2692
 }
2693 2693
 
2694 2694
 /**
@@ -2704,29 +2704,29 @@  discard block
 block discarded – undo
2704 2704
  * @return bool True for success, False for fail.
2705 2705
  */
2706 2706
 function geodir_icl_duplicate_post_images($master_post_id, $tr_post_id, $lang) {
2707
-    global $wpdb;
2707
+	global $wpdb;
2708 2708
 
2709
-    $query = $wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE mime_type like %s AND post_id = %d", array('%image%', $tr_post_id));
2710
-    $wpdb->query($query);
2709
+	$query = $wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE mime_type like %s AND post_id = %d", array('%image%', $tr_post_id));
2710
+	$wpdb->query($query);
2711 2711
 
2712
-    $query = $wpdb->prepare("SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE mime_type like %s AND post_id = %d ORDER BY menu_order ASC", array('%image%', $master_post_id));
2713
-    $post_images = $wpdb->get_results($query);
2712
+	$query = $wpdb->prepare("SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE mime_type like %s AND post_id = %d ORDER BY menu_order ASC", array('%image%', $master_post_id));
2713
+	$post_images = $wpdb->get_results($query);
2714 2714
 
2715
-    if ( !empty( $post_images ) ) {
2716
-        foreach ( $post_images as $post_image) {
2717
-            $image_data = (array)$post_image;
2718
-            unset($image_data['ID']);
2719
-            $image_data['post_id'] = $tr_post_id;
2715
+	if ( !empty( $post_images ) ) {
2716
+		foreach ( $post_images as $post_image) {
2717
+			$image_data = (array)$post_image;
2718
+			unset($image_data['ID']);
2719
+			$image_data['post_id'] = $tr_post_id;
2720 2720
             
2721
-            $wpdb->insert(GEODIR_ATTACHMENT_TABLE, $image_data);
2721
+			$wpdb->insert(GEODIR_ATTACHMENT_TABLE, $image_data);
2722 2722
             
2723
-            geodir_set_wp_featured_image($tr_post_id);
2724
-        }
2723
+			geodir_set_wp_featured_image($tr_post_id);
2724
+		}
2725 2725
         
2726
-        return true;
2727
-    }
2726
+		return true;
2727
+	}
2728 2728
 
2729
-    return false;
2729
+	return false;
2730 2730
 }
2731 2731
 
2732 2732
 
@@ -2745,73 +2745,73 @@  discard block
 block discarded – undo
2745 2745
  * @return bool True for success, False for fail.
2746 2746
  */
2747 2747
 function geodir_wpml_duplicate_post_review($master_comment_id, $master_post_id, $tr_post_id, $lang) {
2748
-    global $wpdb, $plugin_prefix, $sitepress;
2749
-
2750
-    $review = $wpdb->get_row($wpdb->prepare("SELECT * FROM " . GEODIR_REVIEW_TABLE . " WHERE comment_id=%d ORDER BY id ASC", $master_comment_id), ARRAY_A);
2751
-
2752
-    if (empty($review)) {
2753
-        return false;
2754
-    }
2755
-    if ($review['post_id'] != $master_post_id) {
2756
-        $wpdb->query($wpdb->prepare("UPDATE " . GEODIR_REVIEW_TABLE . " SET post_id=%d WHERE comment_id=%d", $master_post_id, $master_comment_id));
2757
-        geodir_update_postrating($master_post_id, $post_type);
2758
-    }
2759
-
2760
-    $tr_comment_id = geodir_wpml_duplicate_comment_exists($tr_post_id, $master_comment_id);
2761
-
2762
-    if (empty($tr_comment_id)) {
2763
-        return false;
2764
-    }
2765
-
2766
-    $post_type = get_post_type($master_post_id);
2767
-    $post_table = $plugin_prefix . $post_type . '_detail';
2768
-
2769
-    $translated_post = $wpdb->get_row($wpdb->prepare("SELECT post_title, post_latitude, post_longitude, post_city, post_region, post_country FROM " . $post_table . " WHERE post_id = %d", $tr_post_id), ARRAY_A);
2770
-    if (empty($translated_post)) {
2771
-        return false;
2772
-    }
2773
-
2774
-    $review['comment_id'] = $tr_comment_id;
2775
-    $review['post_id'] = $tr_post_id;
2776
-    $review['post_title'] = $translated_post['post_title'];
2777
-    $review['post_city'] = $translated_post['post_city'];
2778
-    $review['post_region'] = $translated_post['post_region'];
2779
-    $review['post_country'] = $translated_post['post_country'];
2780
-    $review['post_latitude'] = $translated_post['post_latitude'];
2781
-    $review['post_longitude'] = $translated_post['post_longitude'];
2782
-
2783
-    if (isset($review['id'])) {
2784
-        unset($review['id']);
2785
-    }
2786
-
2787
-    $tr_review_id = $wpdb->get_var($wpdb->prepare("SELECT id FROM " . GEODIR_REVIEW_TABLE . " WHERE comment_id=%d AND post_id=%d ORDER BY id ASC", $tr_comment_id, $tr_post_id));
2788
-
2789
-    if ($tr_review_id) { // update review
2790
-        $wpdb->update(GEODIR_REVIEW_TABLE, $review, array('id' => $tr_review_id));
2791
-    } else { // insert review
2792
-        $wpdb->insert(GEODIR_REVIEW_TABLE, $review);
2793
-        $tr_review_id = $wpdb->insert_id;
2794
-    }
2795
-
2796
-    if ($tr_post_id) {
2797
-        geodir_update_postrating($tr_post_id, $post_type);
2748
+	global $wpdb, $plugin_prefix, $sitepress;
2749
+
2750
+	$review = $wpdb->get_row($wpdb->prepare("SELECT * FROM " . GEODIR_REVIEW_TABLE . " WHERE comment_id=%d ORDER BY id ASC", $master_comment_id), ARRAY_A);
2751
+
2752
+	if (empty($review)) {
2753
+		return false;
2754
+	}
2755
+	if ($review['post_id'] != $master_post_id) {
2756
+		$wpdb->query($wpdb->prepare("UPDATE " . GEODIR_REVIEW_TABLE . " SET post_id=%d WHERE comment_id=%d", $master_post_id, $master_comment_id));
2757
+		geodir_update_postrating($master_post_id, $post_type);
2758
+	}
2759
+
2760
+	$tr_comment_id = geodir_wpml_duplicate_comment_exists($tr_post_id, $master_comment_id);
2761
+
2762
+	if (empty($tr_comment_id)) {
2763
+		return false;
2764
+	}
2765
+
2766
+	$post_type = get_post_type($master_post_id);
2767
+	$post_table = $plugin_prefix . $post_type . '_detail';
2768
+
2769
+	$translated_post = $wpdb->get_row($wpdb->prepare("SELECT post_title, post_latitude, post_longitude, post_city, post_region, post_country FROM " . $post_table . " WHERE post_id = %d", $tr_post_id), ARRAY_A);
2770
+	if (empty($translated_post)) {
2771
+		return false;
2772
+	}
2773
+
2774
+	$review['comment_id'] = $tr_comment_id;
2775
+	$review['post_id'] = $tr_post_id;
2776
+	$review['post_title'] = $translated_post['post_title'];
2777
+	$review['post_city'] = $translated_post['post_city'];
2778
+	$review['post_region'] = $translated_post['post_region'];
2779
+	$review['post_country'] = $translated_post['post_country'];
2780
+	$review['post_latitude'] = $translated_post['post_latitude'];
2781
+	$review['post_longitude'] = $translated_post['post_longitude'];
2782
+
2783
+	if (isset($review['id'])) {
2784
+		unset($review['id']);
2785
+	}
2786
+
2787
+	$tr_review_id = $wpdb->get_var($wpdb->prepare("SELECT id FROM " . GEODIR_REVIEW_TABLE . " WHERE comment_id=%d AND post_id=%d ORDER BY id ASC", $tr_comment_id, $tr_post_id));
2788
+
2789
+	if ($tr_review_id) { // update review
2790
+		$wpdb->update(GEODIR_REVIEW_TABLE, $review, array('id' => $tr_review_id));
2791
+	} else { // insert review
2792
+		$wpdb->insert(GEODIR_REVIEW_TABLE, $review);
2793
+		$tr_review_id = $wpdb->insert_id;
2794
+	}
2795
+
2796
+	if ($tr_post_id) {
2797
+		geodir_update_postrating($tr_post_id, $post_type);
2798 2798
         
2799
-        if (defined('GEODIRREVIEWRATING_VERSION') && get_option('geodir_reviewrating_enable_review') && $sitepress->get_setting('sync_comments_on_duplicates')) {
2800
-            $wpdb->query($wpdb->prepare("DELETE FROM " . GEODIR_COMMENTS_REVIEWS_TABLE . " WHERE comment_id = %d", array($tr_comment_id)));
2801
-            $likes = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . GEODIR_COMMENTS_REVIEWS_TABLE . " WHERE comment_id=%d ORDER BY like_date ASC", $master_comment_id, $tr_post_id), ARRAY_A);
2802
-
2803
-            if (!empty($likes)) {
2804
-                foreach ($likes as $like) {
2805
-                    unset($like['like_id']);
2806
-                    $like['comment_id'] = $tr_comment_id;
2799
+		if (defined('GEODIRREVIEWRATING_VERSION') && get_option('geodir_reviewrating_enable_review') && $sitepress->get_setting('sync_comments_on_duplicates')) {
2800
+			$wpdb->query($wpdb->prepare("DELETE FROM " . GEODIR_COMMENTS_REVIEWS_TABLE . " WHERE comment_id = %d", array($tr_comment_id)));
2801
+			$likes = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . GEODIR_COMMENTS_REVIEWS_TABLE . " WHERE comment_id=%d ORDER BY like_date ASC", $master_comment_id, $tr_post_id), ARRAY_A);
2802
+
2803
+			if (!empty($likes)) {
2804
+				foreach ($likes as $like) {
2805
+					unset($like['like_id']);
2806
+					$like['comment_id'] = $tr_comment_id;
2807 2807
                     
2808
-                    $wpdb->insert(GEODIR_COMMENTS_REVIEWS_TABLE, $like);
2809
-                }
2810
-            }
2811
-        }
2812
-    }
2808
+					$wpdb->insert(GEODIR_COMMENTS_REVIEWS_TABLE, $like);
2809
+				}
2810
+			}
2811
+		}
2812
+	}
2813 2813
 
2814
-    return $tr_review_id;
2814
+	return $tr_review_id;
2815 2815
 }
2816 2816
 
2817 2817
 /**
@@ -2826,36 +2826,36 @@  discard block
 block discarded – undo
2826 2826
  * @param int $comment_id The Comment ID.
2827 2827
  */
2828 2828
 function gepdir_wpml_sync_comment($comment_id) {
2829
-    global $wpdb, $sitepress, $gd_wpml_posttypes;
2830
-
2831
-    if (empty($gd_post_types)) {
2832
-        $gd_wpml_posttypes = geodir_get_posttypes();
2833
-    }
2834
-
2835
-    $comment = $wpdb->get_row($wpdb->prepare("SELECT * FROM {$wpdb->comments} WHERE comment_ID=%d", $comment_id), ARRAY_A);
2836
-    if (empty($comment)) {
2837
-        return;
2838
-    }
2839
-
2840
-    $post_id = $comment['comment_post_ID'];
2841
-    $post_type = $post_id ? get_post_type($post_id) : NULL;
2842
-
2843
-    if (!($post_type && in_array($post_type, $gd_wpml_posttypes))) {
2844
-        return;
2845
-    }
2846
-
2847
-    $post_duplicates = $sitepress->get_duplicates($post_id);
2848
-    if (empty($post_duplicates)) {
2849
-        return;
2850
-    }
2851
-
2852
-    foreach ($post_duplicates as $lang => $dup_post_id) {
2853
-        if (empty($comment['comment_parent'])) {
2854
-            geodir_wpml_duplicate_post_review($comment_id, $post_id, $dup_post_id, $lang);
2855
-        }
2856
-    }
2829
+	global $wpdb, $sitepress, $gd_wpml_posttypes;
2830
+
2831
+	if (empty($gd_post_types)) {
2832
+		$gd_wpml_posttypes = geodir_get_posttypes();
2833
+	}
2834
+
2835
+	$comment = $wpdb->get_row($wpdb->prepare("SELECT * FROM {$wpdb->comments} WHERE comment_ID=%d", $comment_id), ARRAY_A);
2836
+	if (empty($comment)) {
2837
+		return;
2838
+	}
2839
+
2840
+	$post_id = $comment['comment_post_ID'];
2841
+	$post_type = $post_id ? get_post_type($post_id) : NULL;
2842
+
2843
+	if (!($post_type && in_array($post_type, $gd_wpml_posttypes))) {
2844
+		return;
2845
+	}
2846
+
2847
+	$post_duplicates = $sitepress->get_duplicates($post_id);
2848
+	if (empty($post_duplicates)) {
2849
+		return;
2850
+	}
2851
+
2852
+	foreach ($post_duplicates as $lang => $dup_post_id) {
2853
+		if (empty($comment['comment_parent'])) {
2854
+			geodir_wpml_duplicate_post_review($comment_id, $post_id, $dup_post_id, $lang);
2855
+		}
2856
+	}
2857 2857
     
2858
-    return true;
2858
+	return true;
2859 2859
 }
2860 2860
 
2861 2861
 /**
@@ -2870,11 +2870,11 @@  discard block
 block discarded – undo
2870 2870
  * @return int The duplicate comment ID.
2871 2871
  */
2872 2872
 function geodir_wpml_duplicate_comment_exists($dup_post_id, $original_cid) {
2873
-    global $wpdb;
2873
+	global $wpdb;
2874 2874
 
2875
-    $duplicate = $wpdb->get_var(
2876
-        $wpdb->prepare(
2877
-            "   SELECT comm.comment_ID
2875
+	$duplicate = $wpdb->get_var(
2876
+		$wpdb->prepare(
2877
+			"   SELECT comm.comment_ID
2878 2878
                 FROM {$wpdb->comments} comm
2879 2879
                 JOIN {$wpdb->commentmeta} cm
2880 2880
                     ON comm.comment_ID = cm.comment_id
@@ -2882,12 +2882,12 @@  discard block
 block discarded – undo
2882 2882
                     AND cm.meta_key = '_icl_duplicate_of'
2883 2883
                     AND cm.meta_value = %d
2884 2884
                 LIMIT 1",
2885
-            $dup_post_id,
2886
-            $original_cid
2887
-        )
2888
-    );
2885
+			$dup_post_id,
2886
+			$original_cid
2887
+		)
2888
+	);
2889 2889
 
2890
-    return $duplicate;
2890
+	return $duplicate;
2891 2891
 }
2892 2892
 
2893 2893
 /**
@@ -2959,7 +2959,7 @@  discard block
 block discarded – undo
2959 2959
  * @return bool True if Yoast SEO disabled on GD pages.
2960 2960
  */
2961 2961
 function geodir_disable_yoast_seo_metas() {
2962
-    return (bool)get_option( 'geodir_disable_yoast_meta' );
2962
+	return (bool)get_option( 'geodir_disable_yoast_meta' );
2963 2963
 }
2964 2964
 
2965 2965
 /**
@@ -2971,39 +2971,39 @@  discard block
 block discarded – undo
2971 2971
  * @return bool True if allowed.
2972 2972
  */
2973 2973
 function geodir_wpml_allowed_to_duplicate( $post_id ) {
2974
-    $allowed = false;
2974
+	$allowed = false;
2975 2975
     
2976
-    if ( !geodir_is_wpml() || empty( $post_id ) ) {
2977
-        return $allowed;
2978
-    }
2976
+	if ( !geodir_is_wpml() || empty( $post_id ) ) {
2977
+		return $allowed;
2978
+	}
2979 2979
     
2980
-    $user_id = (int)get_current_user_id();
2980
+	$user_id = (int)get_current_user_id();
2981 2981
     
2982
-    if ( empty( $user_id ) ) {
2983
-        return $allowed;
2984
-    }
2982
+	if ( empty( $user_id ) ) {
2983
+		return $allowed;
2984
+	}
2985 2985
     
2986
-    $post_type = get_post_type( $post_id );
2987
-    if ( !is_post_type_translated( $post_type ) || get_post_meta( $post_id, '_icl_lang_duplicate_of', true ) ) {
2988
-        return $allowed;
2989
-    }
2986
+	$post_type = get_post_type( $post_id );
2987
+	if ( !is_post_type_translated( $post_type ) || get_post_meta( $post_id, '_icl_lang_duplicate_of', true ) ) {
2988
+		return $allowed;
2989
+	}
2990 2990
     
2991
-    if ( geodir_listing_belong_to_current_user( $post_id ) ) {
2992
-        $allowed = true;
2993
-    }
2991
+	if ( geodir_listing_belong_to_current_user( $post_id ) ) {
2992
+		$allowed = true;
2993
+	}
2994 2994
     
2995
-    $disable_cpts = get_option( 'geodir_wpml_disable_duplicate' );
2996
-    if ( $allowed && !empty( $disable_cpts ) && in_array( $post_type, $disable_cpts ) ) {
2997
-        $allowed = false;
2998
-    }
2995
+	$disable_cpts = get_option( 'geodir_wpml_disable_duplicate' );
2996
+	if ( $allowed && !empty( $disable_cpts ) && in_array( $post_type, $disable_cpts ) ) {
2997
+		$allowed = false;
2998
+	}
2999 2999
     
3000
-    /**
3001
-     * Filter the user allowed to duplicate listing or not for WPML.
3002
-     *
3003
-     * @param bool $allowed True if allowed.
3004
-     * @param int $post_id The post ID.
3005
-     */
3006
-    return apply_filters( 'geodir_wpml_allowed_to_duplicate', $allowed, $post_id );
3000
+	/**
3001
+	 * Filter the user allowed to duplicate listing or not for WPML.
3002
+	 *
3003
+	 * @param bool $allowed True if allowed.
3004
+	 * @param int $post_id The post ID.
3005
+	 */
3006
+	return apply_filters( 'geodir_wpml_allowed_to_duplicate', $allowed, $post_id );
3007 3007
 }
3008 3008
 
3009 3009
 /**
@@ -3019,71 +3019,71 @@  discard block
 block discarded – undo
3019 3019
  * @return string Filtered html of the geodir_edit_post_link() function.
3020 3020
  */
3021 3021
 function geodir_wpml_frontend_duplicate_listing( $content_html ) {
3022
-    global $post, $preview, $sitepress;
3022
+	global $post, $preview, $sitepress;
3023 3023
     
3024
-    if ( !empty( $post->ID ) && !$preview && geodir_is_page( 'detail' ) && geodir_wpml_allowed_to_duplicate( $post->ID ) ) {
3025
-        $post_id = $post->ID;
3026
-        $element_type = 'post_' . get_post_type( $post_id );
3027
-        $original_post_id = $sitepress->get_original_element_id( $post_id, $element_type );
3024
+	if ( !empty( $post->ID ) && !$preview && geodir_is_page( 'detail' ) && geodir_wpml_allowed_to_duplicate( $post->ID ) ) {
3025
+		$post_id = $post->ID;
3026
+		$element_type = 'post_' . get_post_type( $post_id );
3027
+		$original_post_id = $sitepress->get_original_element_id( $post_id, $element_type );
3028 3028
         
3029
-        if ( $original_post_id == $post_id ) {
3030
-            $wpml_languages = $sitepress->get_active_languages();
3031
-            $post_language = $sitepress->get_language_for_element( $post_id, $element_type );
3029
+		if ( $original_post_id == $post_id ) {
3030
+			$wpml_languages = $sitepress->get_active_languages();
3031
+			$post_language = $sitepress->get_language_for_element( $post_id, $element_type );
3032 3032
             
3033
-            if ( !empty( $wpml_languages ) && isset( $wpml_languages[ $post_language ] ) ) {
3034
-                unset( $wpml_languages[ $post_language ] );
3035
-            }
3033
+			if ( !empty( $wpml_languages ) && isset( $wpml_languages[ $post_language ] ) ) {
3034
+				unset( $wpml_languages[ $post_language ] );
3035
+			}
3036 3036
             
3037
-            if ( !empty( $wpml_languages ) ) {
3038
-                $trid  = $sitepress->get_element_trid( $post_id, $element_type );
3039
-                $element_translations = $sitepress->get_element_translations( $trid, $element_type );
3040
-                $duplicates = $sitepress->get_duplicates( $post_id );
3037
+			if ( !empty( $wpml_languages ) ) {
3038
+				$trid  = $sitepress->get_element_trid( $post_id, $element_type );
3039
+				$element_translations = $sitepress->get_element_translations( $trid, $element_type );
3040
+				$duplicates = $sitepress->get_duplicates( $post_id );
3041 3041
                 
3042
-                $wpml_content = '<div class="geodir-company_info gd-detail-duplicate"><h3 class="widget-title">' . __( 'Translate Listing', 'geodirectory' ) . '</h3>';
3043
-                $wpml_content .= '<table class="gd-duplicate-table" style="width:100%;margin:0"><tbody>';
3044
-                $wpml_content .= '<tr style="border-bottom:solid 1px #efefef"><th style="padding:0 2px 2px 2px">' . __( 'Language', 'geodirectory' ) . '</th><th style="width:25px;"></th><th style="width:5em;text-align:center">' . __( 'Translate', 'geodirectory' ) . '</th></tr>';
3042
+				$wpml_content = '<div class="geodir-company_info gd-detail-duplicate"><h3 class="widget-title">' . __( 'Translate Listing', 'geodirectory' ) . '</h3>';
3043
+				$wpml_content .= '<table class="gd-duplicate-table" style="width:100%;margin:0"><tbody>';
3044
+				$wpml_content .= '<tr style="border-bottom:solid 1px #efefef"><th style="padding:0 2px 2px 2px">' . __( 'Language', 'geodirectory' ) . '</th><th style="width:25px;"></th><th style="width:5em;text-align:center">' . __( 'Translate', 'geodirectory' ) . '</th></tr>';
3045 3045
                 
3046
-                $needs_translation = false;
3046
+				$needs_translation = false;
3047 3047
                 
3048
-                foreach ( $wpml_languages as $lang_code => $lang ) {
3049
-                    $duplicates_text = '';
3050
-                    $translated = false;
3048
+				foreach ( $wpml_languages as $lang_code => $lang ) {
3049
+					$duplicates_text = '';
3050
+					$translated = false;
3051 3051
                     
3052
-                    if ( !empty( $element_translations ) && isset( $element_translations[$lang_code] ) ) {
3053
-                        $translated = true;
3052
+					if ( !empty( $element_translations ) && isset( $element_translations[$lang_code] ) ) {
3053
+						$translated = true;
3054 3054
                         
3055
-                        if ( !empty( $duplicates ) && isset( $duplicates[$lang_code] ) ) {
3056
-                            $duplicates_text = ' ' . __( '(duplicate)', 'geodirectory' );
3057
-                        }
3058
-                    } else {
3059
-                        $needs_translation = true;
3060
-                    }
3055
+						if ( !empty( $duplicates ) && isset( $duplicates[$lang_code] ) ) {
3056
+							$duplicates_text = ' ' . __( '(duplicate)', 'geodirectory' );
3057
+						}
3058
+					} else {
3059
+						$needs_translation = true;
3060
+					}
3061 3061
                     
3062
-                    $wpml_content .= '<tr><td style="padding:4px">' . $lang['english_name'] . $duplicates_text . '</td><td>&nbsp;</td><td style="text-align:center;">';
3062
+					$wpml_content .= '<tr><td style="padding:4px">' . $lang['english_name'] . $duplicates_text . '</td><td>&nbsp;</td><td style="text-align:center;">';
3063 3063
                     
3064
-                    if ( $translated ) {
3065
-                        $wpml_content .= '<i class="fa fa-check" style="color:orange"></i>';
3066
-                    } else {
3067
-                        $wpml_content .= '<input name="gd_icl_dup[]" value="' . $lang_code . '" title="' . esc_attr__( 'Create duplicate', 'geodirectory' ) . '" type="checkbox">';
3068
-                    }
3064
+					if ( $translated ) {
3065
+						$wpml_content .= '<i class="fa fa-check" style="color:orange"></i>';
3066
+					} else {
3067
+						$wpml_content .= '<input name="gd_icl_dup[]" value="' . $lang_code . '" title="' . esc_attr__( 'Create duplicate', 'geodirectory' ) . '" type="checkbox">';
3068
+					}
3069 3069
                     
3070
-                    $wpml_content .= '</td></tr>';
3071
-                }
3070
+					$wpml_content .= '</td></tr>';
3071
+				}
3072 3072
                 
3073
-                if ( $needs_translation ) {
3074
-                    $nonce = wp_create_nonce( 'geodir_duplicate_nonce' );
3075
-                    $wpml_content .= '<tr><td>&nbsp;</td><td style="vertical-align:middle;padding-top:13px"><i style="display:none" class="fa fa-spin fa-refresh"></i></td><td style="padding:15px 3px 3px 3px;text-align:right"><button data-nonce="' . esc_attr( $nonce ) . '" data-post-id="' . $post_id . '" id="gd_make_duplicates" class="button-secondary">' . __( 'Duplicate', 'geodirectory' ) . '</button></td></tr>';
3076
-                }
3073
+				if ( $needs_translation ) {
3074
+					$nonce = wp_create_nonce( 'geodir_duplicate_nonce' );
3075
+					$wpml_content .= '<tr><td>&nbsp;</td><td style="vertical-align:middle;padding-top:13px"><i style="display:none" class="fa fa-spin fa-refresh"></i></td><td style="padding:15px 3px 3px 3px;text-align:right"><button data-nonce="' . esc_attr( $nonce ) . '" data-post-id="' . $post_id . '" id="gd_make_duplicates" class="button-secondary">' . __( 'Duplicate', 'geodirectory' ) . '</button></td></tr>';
3076
+				}
3077 3077
                 
3078
-                $wpml_content .= '</tbody></table>';
3079
-                $wpml_content .= '</div>';
3078
+				$wpml_content .= '</tbody></table>';
3079
+				$wpml_content .= '</div>';
3080 3080
                 
3081
-                $content_html .= $wpml_content;
3082
-            }
3083
-        }
3084
-    }
3081
+				$content_html .= $wpml_content;
3082
+			}
3083
+		}
3084
+	}
3085 3085
     
3086
-    return $content_html;
3086
+	return $content_html;
3087 3087
 }
3088 3088
 
3089 3089
 /**
@@ -3095,26 +3095,26 @@  discard block
 block discarded – undo
3095 3095
  * @return array Filtered GD design settings array..
3096 3096
  */
3097 3097
 function geodir_wpml_duplicate_settings( $settings = array() ) {
3098
-    $new_settings = array();
3098
+	$new_settings = array();
3099 3099
     
3100
-    foreach ( $settings as $key => $setting ) {
3100
+	foreach ( $settings as $key => $setting ) {
3101 3101
         
3102
-        if ( isset( $setting['type'] ) && $setting['type'] == 'sectionend' && $setting['id'] == 'detail_page_settings' ) {
3103
-            $new_settings[] = array(
3104
-                'name' => __('Disable WPML duplicate translation', 'geodirectory'),
3105
-                'desc' => __('Select post types to disable front end WPML duplicate translation. For selected post types the WPML duplicate option will be disabled from listing detail page sidebar.', 'geodirectory'),
3106
-                'tip' => '',
3107
-                'id' => 'geodir_wpml_disable_duplicate',
3108
-                'css' => 'min-width:300px;',
3109
-                'std' => '',
3110
-                'type' => 'multiselect',
3111
-                'placeholder_text' => __('Select post types', 'geodirectory'),
3112
-                'class' => 'chosen_select',
3113
-                'options' => array_unique(geodir_post_type_setting_fun())
3114
-            );
3115
-        }
3116
-        $new_settings[] = $setting;
3117
-    }
3102
+		if ( isset( $setting['type'] ) && $setting['type'] == 'sectionend' && $setting['id'] == 'detail_page_settings' ) {
3103
+			$new_settings[] = array(
3104
+				'name' => __('Disable WPML duplicate translation', 'geodirectory'),
3105
+				'desc' => __('Select post types to disable front end WPML duplicate translation. For selected post types the WPML duplicate option will be disabled from listing detail page sidebar.', 'geodirectory'),
3106
+				'tip' => '',
3107
+				'id' => 'geodir_wpml_disable_duplicate',
3108
+				'css' => 'min-width:300px;',
3109
+				'std' => '',
3110
+				'type' => 'multiselect',
3111
+				'placeholder_text' => __('Select post types', 'geodirectory'),
3112
+				'class' => 'chosen_select',
3113
+				'options' => array_unique(geodir_post_type_setting_fun())
3114
+			);
3115
+		}
3116
+		$new_settings[] = $setting;
3117
+	}
3118 3118
     
3119
-    return $new_settings;
3119
+	return $new_settings;
3120 3120
 }
3121 3121
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +706 added lines, -706 removed lines patch added patch discarded remove patch
@@ -52,31 +52,31 @@  discard block
 block discarded – undo
52 52
 				jQuery(listSel).children('li').switchClass('gridview_onehalf gridview_onethird gridview_onefourth', 'gridview_onefifth', 600);
53 53
 			}
54 54
 
55
-			jQuery.post("<?php echo geodir_get_ajax_url();?>&gd_listing_view=" + val, function (data) {
55
+			jQuery.post("<?php echo geodir_get_ajax_url(); ?>&gd_listing_view=" + val, function (data) {
56 56
 				//alert(data );
57 57
 			});
58 58
 		}
59 59
 	</script>
60 60
 	<div class="geodir-list-view-select">
61 61
 		<select name="gd_list_view" id="gd_list_view" onchange="geodir_list_view_select(this);">
62
-			<?php $listing_view = (int) $gd_session->get( 'gd_listing_view' ); ?>
63
-			<option value=""><?php _e( 'View:', 'geodirectory' ); ?></option>
62
+			<?php $listing_view = (int) $gd_session->get('gd_listing_view'); ?>
63
+			<option value=""><?php _e('View:', 'geodirectory'); ?></option>
64 64
 			<option
65
-				value="1" <?php selected( 1, $listing_view ); ?>><?php _e( 'View: List', 'geodirectory' ); ?></option>
65
+				value="1" <?php selected(1, $listing_view); ?>><?php _e('View: List', 'geodirectory'); ?></option>
66 66
 			<option
67
-				value="2" <?php selected( 2, $listing_view ); ?>><?php _e( 'View: Grid 2', 'geodirectory' ); ?></option>
67
+				value="2" <?php selected(2, $listing_view); ?>><?php _e('View: Grid 2', 'geodirectory'); ?></option>
68 68
 			<option
69
-				value="3" <?php selected( 3, $listing_view ); ?>><?php _e( 'View: Grid 3', 'geodirectory' ); ?></option>
69
+				value="3" <?php selected(3, $listing_view); ?>><?php _e('View: Grid 3', 'geodirectory'); ?></option>
70 70
 			<option
71
-				value="4" <?php selected( 4, $listing_view ); ?>><?php _e( 'View: Grid 4', 'geodirectory' ); ?></option>
71
+				value="4" <?php selected(4, $listing_view); ?>><?php _e('View: Grid 4', 'geodirectory'); ?></option>
72 72
 			<option
73
-				value="5" <?php selected( 5, $listing_view ); ?>><?php _e( 'View: Grid 5', 'geodirectory' ); ?></option>
73
+				value="5" <?php selected(5, $listing_view); ?>><?php _e('View: Grid 5', 'geodirectory'); ?></option>
74 74
 		</select>
75 75
 	</div>
76 76
 	<?php
77 77
 }
78 78
 
79
-add_action( 'geodir_before_listing', 'geodir_list_view_select', 100 );
79
+add_action('geodir_before_listing', 'geodir_list_view_select', 100);
80 80
 
81 81
 /**
82 82
  * Limit the listing excerpt.
@@ -91,9 +91,9 @@  discard block
 block discarded – undo
91 91
  * @global object $post          The current post object.
92 92
  * @return string The modified excerpt.
93 93
  */
94
-function geodir_max_excerpt( $charlength ) {
94
+function geodir_max_excerpt($charlength) {
95 95
 	global $post;
96
-	if ( $charlength == '0' ) {
96
+	if ($charlength == '0') {
97 97
 		return;
98 98
 	}
99 99
 	$out = '';
@@ -101,46 +101,46 @@  discard block
 block discarded – undo
101 101
 	$temp_post = $post;
102 102
 	$excerpt   = get_the_excerpt();
103 103
 
104
-	$charlength ++;
105
-	$excerpt_more = function_exists( 'geodirf_excerpt_more' ) ? geodirf_excerpt_more( '' ) : geodir_excerpt_more( '' );
106
-	if ( geodir_utf8_strlen( $excerpt ) > $charlength ) {
107
-		if ( geodir_utf8_strlen( $excerpt_more ) > 0 && geodir_utf8_strpos( $excerpt, $excerpt_more ) !== false ) {
108
-			$excut = - ( geodir_utf8_strlen( $excerpt_more ) );
109
-			$subex = geodir_utf8_substr( $excerpt, 0, $excut );
110
-			if ( $charlength > 0 && geodir_utf8_strlen( $subex ) > $charlength ) {
111
-				$subex = geodir_utf8_substr( $subex, 0, $charlength );
104
+	$charlength++;
105
+	$excerpt_more = function_exists('geodirf_excerpt_more') ? geodirf_excerpt_more('') : geodir_excerpt_more('');
106
+	if (geodir_utf8_strlen($excerpt) > $charlength) {
107
+		if (geodir_utf8_strlen($excerpt_more) > 0 && geodir_utf8_strpos($excerpt, $excerpt_more) !== false) {
108
+			$excut = - (geodir_utf8_strlen($excerpt_more));
109
+			$subex = geodir_utf8_substr($excerpt, 0, $excut);
110
+			if ($charlength > 0 && geodir_utf8_strlen($subex) > $charlength) {
111
+				$subex = geodir_utf8_substr($subex, 0, $charlength);
112 112
 			}
113 113
 			$out .= $subex;
114 114
 		} else {
115
-			$subex   = geodir_utf8_substr( $excerpt, 0, $charlength - 5 );
116
-			$exwords = explode( ' ', $subex );
117
-			$excut   = - ( geodir_utf8_strlen( $exwords[ count( $exwords ) - 1 ] ) );
118
-			if ( $excut < 0 ) {
119
-				$out .= geodir_utf8_substr( $subex, 0, $excut );
115
+			$subex   = geodir_utf8_substr($excerpt, 0, $charlength - 5);
116
+			$exwords = explode(' ', $subex);
117
+			$excut   = - (geodir_utf8_strlen($exwords[count($exwords) - 1]));
118
+			if ($excut < 0) {
119
+				$out .= geodir_utf8_substr($subex, 0, $excut);
120 120
 			} else {
121 121
 				$out .= $subex;
122 122
 			}
123 123
 		}
124
-		$out .= ' <a class="excerpt-read-more" href="' . get_permalink() . '" title="' . get_the_title() . '">';
124
+		$out .= ' <a class="excerpt-read-more" href="'.get_permalink().'" title="'.get_the_title().'">';
125 125
 		/**
126 126
 		 * Filter excerpt read more text.
127 127
 		 *
128 128
 		 * @since 1.0.0
129 129
 		 */
130
-		$out .= apply_filters( 'geodir_max_excerpt_end', __( 'Read more [...]', 'geodirectory' ) );
130
+		$out .= apply_filters('geodir_max_excerpt_end', __('Read more [...]', 'geodirectory'));
131 131
 		$out .= '</a>';
132 132
 
133 133
 	} else {
134
-		if ( geodir_utf8_strlen( $excerpt_more ) > 0 && geodir_utf8_strpos( $excerpt, $excerpt_more ) !== false ) {
135
-			$excut = - ( geodir_utf8_strlen( $excerpt_more ) );
136
-			$out .= geodir_utf8_substr( $excerpt, 0, $excut );
137
-			$out .= ' <a class="excerpt-read-more" href="' . get_permalink() . '" title="' . get_the_title() . '">';
134
+		if (geodir_utf8_strlen($excerpt_more) > 0 && geodir_utf8_strpos($excerpt, $excerpt_more) !== false) {
135
+			$excut = - (geodir_utf8_strlen($excerpt_more));
136
+			$out .= geodir_utf8_substr($excerpt, 0, $excut);
137
+			$out .= ' <a class="excerpt-read-more" href="'.get_permalink().'" title="'.get_the_title().'">';
138 138
 			/**
139 139
 			 * Filter excerpt read more text.
140 140
 			 *
141 141
 			 * @since 1.0.0
142 142
 			 */
143
-			$out .= apply_filters( 'geodir_max_excerpt_end', __( 'Read more [...]', 'geodirectory' ) );
143
+			$out .= apply_filters('geodir_max_excerpt_end', __('Read more [...]', 'geodirectory'));
144 144
 			$out .= '</a>';
145 145
 		} else {
146 146
 			$out .= $excerpt;
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
  *
164 164
  * @return object Returns filtered package info as an object.
165 165
  */
166
-function geodir_post_package_info( $package_info, $post = '', $post_type = '' ) {
166
+function geodir_post_package_info($package_info, $post = '', $post_type = '') {
167 167
 	$package_info['pid']              = 0;
168 168
 	$package_info['days']             = 0;
169 169
 	$package_info['amount']           = 0;
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
 	 * @param object|string $post  The post object.
193 193
 	 * @param string $post_type    The post type.
194 194
 	 */
195
-	return (object) apply_filters( 'geodir_post_package_info', $package_info, $post, $post_type );
195
+	return (object) apply_filters('geodir_post_package_info', $package_info, $post, $post_type);
196 196
 
197 197
 }
198 198
 
@@ -220,11 +220,11 @@  discard block
 block discarded – undo
220 220
  *
221 221
  * }
222 222
  */
223
-function geodir_send_inquiry( $request ) {
223
+function geodir_send_inquiry($request) {
224 224
 	global $wpdb;
225 225
 
226 226
 	// strip slashes from text
227
-	$request = ! empty( $request ) ? stripslashes_deep( $request ) : $request;
227
+	$request = !empty($request) ? stripslashes_deep($request) : $request;
228 228
 
229 229
 	$yourname      = $request['inq_name'];
230 230
 	$youremail     = $request['inq_email'];
@@ -235,26 +235,26 @@  discard block
 block discarded – undo
235 235
 	$author_id  = '';
236 236
 	$post_title = '';
237 237
 
238
-	if ( $request['pid'] ) {
238
+	if ($request['pid']) {
239 239
 
240 240
 		$productinfosql = $wpdb->prepare(
241 241
 			"select ID,post_author,post_title from $wpdb->posts where ID =%d",
242
-			array( $request['pid'] )
242
+			array($request['pid'])
243 243
 		);
244
-		$productinfo    = $wpdb->get_row( $productinfosql );
244
+		$productinfo = $wpdb->get_row($productinfosql);
245 245
 
246 246
 		$author_id  = $productinfo->post_author;
247 247
 		$post_title = $productinfo->post_title;
248 248
 	}
249 249
 
250
-	$post_title = '<a href="' . get_permalink( $pid ) . '">' . $post_title . '</a>';
250
+	$post_title = '<a href="'.get_permalink($pid).'">'.$post_title.'</a>';
251 251
 
252
-	$user_info = get_userdata( $author_id );
253
-	$to_email  = geodir_get_post_meta( $pid, 'geodir_email', true );
254
-	$to_name   = geodir_get_client_name( $author_id );
252
+	$user_info = get_userdata($author_id);
253
+	$to_email  = geodir_get_post_meta($pid, 'geodir_email', true);
254
+	$to_name   = geodir_get_client_name($author_id);
255 255
 
256
-	if ( $to_email == '' ) {
257
-		$to_email = get_option( 'admin_email' );
256
+	if ($to_email == '') {
257
+		$to_email = get_option('admin_email');
258 258
 	}
259 259
 
260 260
 	/**
@@ -275,10 +275,10 @@  discard block
 block discarded – undo
275 275
 	 * }
276 276
 	 * @param string $type     The form type, default: `Enquiry`.
277 277
 	 */
278
-	do_action( 'geodir_after_send_enquiry', $request, 'Enquiry' );
278
+	do_action('geodir_after_send_enquiry', $request, 'Enquiry');
279 279
 
280 280
 	$client_message = $frnd_comments;
281
-	$client_message .= '<br>' . __( 'From :', 'geodirectory' ) . ' ' . $yourname . '<br>' . __( 'Phone :', 'geodirectory' ) . ' ' . $inq_phone . '<br>' . __( 'Email :', 'geodirectory' ) . ' ' . $youremail . '<br><br>' . __( 'Sent from', 'geodirectory' ) . ' - <b><a href="' . trailingslashit( home_url() ) . '">' . get_option( 'blogname' ) . '</a></b>.';
281
+	$client_message .= '<br>'.__('From :', 'geodirectory').' '.$yourname.'<br>'.__('Phone :', 'geodirectory').' '.$inq_phone.'<br>'.__('Email :', 'geodirectory').' '.$youremail.'<br><br>'.__('Sent from', 'geodirectory').' - <b><a href="'.trailingslashit(home_url()).'">'.get_option('blogname').'</a></b>.';
282 282
 	/**
283 283
 	 * Filter client message text.
284 284
 	 *
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
 	 *
287 287
 	 * @param string $client_message Client message text.
288 288
 	 */
289
-	$client_message = apply_filters( 'geodir_inquiry_email_msg', $client_message );
289
+	$client_message = apply_filters('geodir_inquiry_email_msg', $client_message);
290 290
 
291 291
 	/**
292 292
 	 * Called before the send enquiry email is sent.
@@ -305,12 +305,12 @@  discard block
 block discarded – undo
305 305
 	 *
306 306
 	 * }
307 307
 	 */
308
-	do_action( 'geodir_before_send_enquiry_email', $request );
309
-	if ( $to_email ) {
308
+	do_action('geodir_before_send_enquiry_email', $request);
309
+	if ($to_email) {
310 310
 		// strip slashes message
311
-		$client_message = stripslashes_deep( $client_message );
311
+		$client_message = stripslashes_deep($client_message);
312 312
 
313
-		geodir_sendEmail( $youremail, $yourname, $to_email, $to_name, '', $client_message, $extra = '', 'send_enquiry', $request['pid'] );//To client email
313
+		geodir_sendEmail($youremail, $yourname, $to_email, $to_name, '', $client_message, $extra = '', 'send_enquiry', $request['pid']); //To client email
314 314
 	}
315 315
 
316 316
 	/**
@@ -330,12 +330,12 @@  discard block
 block discarded – undo
330 330
 	 *
331 331
 	 * }
332 332
 	 */
333
-	do_action( 'geodir_after_send_enquiry_email', $request );
334
-	$url = get_permalink( $pid );
335
-	if ( strstr( $url, '?' ) ) {
336
-		$url = $url . "&send_inquiry=success";
333
+	do_action('geodir_after_send_enquiry_email', $request);
334
+	$url = get_permalink($pid);
335
+	if (strstr($url, '?')) {
336
+		$url = $url."&send_inquiry=success";
337 337
 	} else {
338
-		$url = $url . "?send_inquiry=success";
338
+		$url = $url."?send_inquiry=success";
339 339
 	}
340 340
 	/**
341 341
 	 * Filter redirect url after the send enquiry email is sent.
@@ -344,8 +344,8 @@  discard block
 block discarded – undo
344 344
 	 *
345 345
 	 * @param string $url Redirect url.
346 346
 	 */
347
-	$url = apply_filters( 'geodir_send_enquiry_after_submit_redirect', $url );
348
-	wp_redirect( $url );
347
+	$url = apply_filters('geodir_send_enquiry_after_submit_redirect', $url);
348
+	wp_redirect($url);
349 349
 	gd_die();
350 350
 
351 351
 }
@@ -374,11 +374,11 @@  discard block
 block discarded – undo
374 374
  * }
375 375
  * @global object $wpdb        WordPress Database object.
376 376
  */
377
-function geodir_send_friend( $request ) {
377
+function geodir_send_friend($request) {
378 378
 	global $wpdb;
379 379
 
380 380
 	// strip slashes from text
381
-	$request = ! empty( $request ) ? stripslashes_deep( $request ) : $request;
381
+	$request = !empty($request) ? stripslashes_deep($request) : $request;
382 382
 
383 383
 	$yourname      = $request['yourname'];
384 384
 	$youremail     = $request['youremail'];
@@ -387,13 +387,13 @@  discard block
 block discarded – undo
387 387
 	$pid           = $request['pid'];
388 388
 	$to_email      = $request['to_email'];
389 389
 	$to_name       = $request['to_name'];
390
-	if ( $request['pid'] ) {
390
+	if ($request['pid']) {
391 391
 		$productinfosql = $wpdb->prepare(
392 392
 			"select ID,post_title from $wpdb->posts where ID =%d",
393
-			array( $request['pid'] )
393
+			array($request['pid'])
394 394
 		);
395
-		$productinfo    = $wpdb->get_results( $productinfosql );
396
-		foreach ( $productinfo as $productinfoObj ) {
395
+		$productinfo = $wpdb->get_results($productinfosql);
396
+		foreach ($productinfo as $productinfoObj) {
397 397
 			$post_title = $productinfoObj->post_title;
398 398
 		}
399 399
 	}
@@ -417,8 +417,8 @@  discard block
 block discarded – undo
417 417
 	 *
418 418
 	 * }
419 419
 	 */
420
-	do_action( 'geodir_before_send_to_friend_email', $request );
421
-	geodir_sendEmail( $youremail, $yourname, $to_email, $to_name, $frnd_subject, $frnd_comments, $extra = '', 'send_friend', $request['pid'] );//To client email
420
+	do_action('geodir_before_send_to_friend_email', $request);
421
+	geodir_sendEmail($youremail, $yourname, $to_email, $to_name, $frnd_subject, $frnd_comments, $extra = '', 'send_friend', $request['pid']); //To client email
422 422
 
423 423
 	/**
424 424
 	 * Called after the send to friend email is sent.
@@ -439,13 +439,13 @@  discard block
 block discarded – undo
439 439
 	 *
440 440
 	 * }
441 441
 	 */
442
-	do_action( 'geodir_after_send_to_friend_email', $request );
442
+	do_action('geodir_after_send_to_friend_email', $request);
443 443
 
444
-	$url = get_permalink( $pid );
445
-	if ( strstr( $url, '?' ) ) {
446
-		$url = $url . "&sendtofrnd=success";
444
+	$url = get_permalink($pid);
445
+	if (strstr($url, '?')) {
446
+		$url = $url."&sendtofrnd=success";
447 447
 	} else {
448
-		$url = $url . "?sendtofrnd=success";
448
+		$url = $url."?sendtofrnd=success";
449 449
 	}
450 450
 	/**
451 451
 	 * Filter redirect url after the send to friend email is sent.
@@ -454,8 +454,8 @@  discard block
 block discarded – undo
454 454
 	 *
455 455
 	 * @param string $url Redirect url.
456 456
 	 */
457
-	$url = apply_filters( 'geodir_send_to_friend_after_submit_redirect', $url );
458
-	wp_redirect( $url );
457
+	$url = apply_filters('geodir_send_to_friend_after_submit_redirect', $url);
458
+	wp_redirect($url);
459 459
 	gd_die();
460 460
 }
461 461
 
@@ -469,8 +469,8 @@  discard block
 block discarded – undo
469 469
  *
470 470
  * @param string $hash_key
471 471
  */
472
-function geodir_before_tab_content( $hash_key ) {
473
-	switch ( $hash_key ) {
472
+function geodir_before_tab_content($hash_key) {
473
+	switch ($hash_key) {
474 474
 		case 'post_info' :
475 475
 			echo '<div class="geodir-company_info field-group">';
476 476
 			break;
@@ -480,7 +480,7 @@  discard block
 block discarded – undo
480 480
 			 *
481 481
 			 * @since 1.0.0
482 482
 			 */
483
-			echo ' <div id="' . apply_filters( 'geodir_post_gallery_id', 'geodir-post-gallery' ) . '" class="clearfix" >';
483
+			echo ' <div id="'.apply_filters('geodir_post_gallery_id', 'geodir-post-gallery').'" class="clearfix" >';
484 484
 			break;
485 485
 		case 'reviews' :
486 486
 			echo '<div id="reviews-wrap" class="clearfix"> ';
@@ -504,8 +504,8 @@  discard block
 block discarded – undo
504 504
  *
505 505
  * @param string $hash_key
506 506
  */
507
-function geodir_after_tab_content( $hash_key ) {
508
-	switch ( $hash_key ) {
507
+function geodir_after_tab_content($hash_key) {
508
+	switch ($hash_key) {
509 509
 		case 'post_info' :
510 510
 			echo '</div>';
511 511
 			break;
@@ -536,25 +536,25 @@  discard block
 block discarded – undo
536 536
  * @global object $wpdb     WordPress Database object.
537 537
  * @return bool|null|string Returns default sort results, when the post type is valid. Otherwise returns false.
538 538
  */
539
-function geodir_get_posts_default_sort( $post_type ) {
539
+function geodir_get_posts_default_sort($post_type) {
540 540
 
541 541
 	global $wpdb;
542 542
 
543
-	if ( $post_type != '' ) {
543
+	if ($post_type != '') {
544 544
 
545 545
 		$all_postypes = geodir_get_posttypes();
546 546
 
547
-		if ( ! in_array( $post_type, $all_postypes ) ) {
547
+		if (!in_array($post_type, $all_postypes)) {
548 548
 			return false;
549 549
 		}
550 550
 
551
-		$sort_field_info = $wpdb->get_var( $wpdb->prepare( "select default_order from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where	post_type= %s and is_active=%d and is_default=%d", array(
551
+		$sort_field_info = $wpdb->get_var($wpdb->prepare("select default_order from ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." where	post_type= %s and is_active=%d and is_default=%d", array(
552 552
 			$post_type,
553 553
 			1,
554 554
 			1
555
-		) ) );
555
+		)));
556 556
 
557
-		if ( ! empty( $sort_field_info ) ) {
557
+		if (!empty($sort_field_info)) {
558 558
 			return $sort_field_info;
559 559
 		}
560 560
 
@@ -574,20 +574,20 @@  discard block
 block discarded – undo
574 574
  * @global object $wpdb     WordPress Database object.
575 575
  * @return bool|mixed|void Returns sort results, when the post type is valid. Otherwise returns false.
576 576
  */
577
-function geodir_get_sort_options( $post_type ) {
577
+function geodir_get_sort_options($post_type) {
578 578
 	global $wpdb;
579 579
 
580
-	if ( $post_type != '' ) {
580
+	if ($post_type != '') {
581 581
 		$all_postypes = geodir_get_posttypes();
582 582
 
583
-		if ( ! in_array( $post_type, $all_postypes ) ) {
583
+		if (!in_array($post_type, $all_postypes)) {
584 584
 			return false;
585 585
 		}
586 586
 
587
-		$sort_field_info = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE post_type=%s AND is_active=%d AND (sort_asc=1 || sort_desc=1 || field_type='random') AND field_type != 'address' ORDER BY sort_order ASC", array(
587
+		$sort_field_info = $wpdb->get_results($wpdb->prepare("SELECT * FROM ".GEODIR_CUSTOM_SORT_FIELDS_TABLE." WHERE post_type=%s AND is_active=%d AND (sort_asc=1 || sort_desc=1 || field_type='random') AND field_type != 'address' ORDER BY sort_order ASC", array(
588 588
 			$post_type,
589 589
 			1
590
-		) ) );
590
+		)));
591 591
 
592 592
 		/**
593 593
 		 * Filter post sort options.
@@ -597,7 +597,7 @@  discard block
 block discarded – undo
597 597
 		 * @param array $sort_field_info Unfiltered sort field array.
598 598
 		 * @param string $post_type      Post type.
599 599
 		 */
600
-		return apply_filters( 'geodir_get_sort_options', $sort_field_info, $post_type );
600
+		return apply_filters('geodir_get_sort_options', $sort_field_info, $post_type);
601 601
 	}
602 602
 
603 603
 }
@@ -618,63 +618,63 @@  discard block
 block discarded – undo
618 618
 	 *
619 619
 	 * @since 1.4.4
620 620
 	 */
621
-	if ( is_search() ) {
621
+	if (is_search()) {
622 622
 		return;
623 623
 	}
624 624
 
625 625
 	$sort_by = '';
626 626
 
627
-	if ( isset( $_REQUEST['sort_by'] ) ) {
627
+	if (isset($_REQUEST['sort_by'])) {
628 628
 		$sort_by = $_REQUEST['sort_by'];
629 629
 	}
630 630
 
631 631
 	$gd_post_type = geodir_get_current_posttype();
632 632
 
633
-	$sort_options = geodir_get_sort_options( $gd_post_type );
633
+	$sort_options = geodir_get_sort_options($gd_post_type);
634 634
 
635 635
 
636 636
 	$sort_field_options = '';
637 637
 
638
-	if ( ! empty( $sort_options ) ) {
639
-		foreach ( $sort_options as $sort ) {
640
-			$sort = stripslashes_deep( $sort ); // strip slashes
638
+	if (!empty($sort_options)) {
639
+		foreach ($sort_options as $sort) {
640
+			$sort = stripslashes_deep($sort); // strip slashes
641 641
 
642
-			$label = __( $sort->site_title, 'geodirectory' );
642
+			$label = __($sort->site_title, 'geodirectory');
643 643
 
644
-			if ( $sort->field_type == 'random' ) {
644
+			if ($sort->field_type == 'random') {
645 645
 				$key = $sort->field_type;
646
-				( $sort_by == $key || ( $sort->is_default == '1' && ! isset( $_REQUEST['sort_by'] ) ) ) ? $selected = 'selected="selected"' : $selected = '';
647
-				$sort_field_options .= '<option ' . $selected . ' value="' . esc_url( add_query_arg( 'sort_by', $key ) ) . '">' . __( $label, 'geodirectory' ) . '</option>';
646
+				($sort_by == $key || ($sort->is_default == '1' && !isset($_REQUEST['sort_by']))) ? $selected = 'selected="selected"' : $selected = '';
647
+				$sort_field_options .= '<option '.$selected.' value="'.esc_url(add_query_arg('sort_by', $key)).'">'.__($label, 'geodirectory').'</option>';
648 648
 			}
649 649
 
650
-			if ( $sort->htmlvar_name == 'comment_count' ) {
650
+			if ($sort->htmlvar_name == 'comment_count') {
651 651
 				$sort->htmlvar_name = 'rating_count';
652 652
 			}
653 653
 
654
-			if ( $sort->sort_asc ) {
655
-				$key   = $sort->htmlvar_name . '_asc';
654
+			if ($sort->sort_asc) {
655
+				$key   = $sort->htmlvar_name.'_asc';
656 656
 				$label = $sort->site_title;
657
-				if ( $sort->asc_title ) {
657
+				if ($sort->asc_title) {
658 658
 					$label = $sort->asc_title;
659 659
 				}
660
-				( $sort_by == $key || ( $sort->is_default == '1' && $sort->default_order == $key && ! isset( $_REQUEST['sort_by'] ) ) ) ? $selected = 'selected="selected"' : $selected = '';
661
-				$sort_field_options .= '<option ' . $selected . ' value="' . esc_url( add_query_arg( 'sort_by', $key ) ) . '">' . __( $label, 'geodirectory' ) . '</option>';
660
+				($sort_by == $key || ($sort->is_default == '1' && $sort->default_order == $key && !isset($_REQUEST['sort_by']))) ? $selected = 'selected="selected"' : $selected = '';
661
+				$sort_field_options .= '<option '.$selected.' value="'.esc_url(add_query_arg('sort_by', $key)).'">'.__($label, 'geodirectory').'</option>';
662 662
 			}
663 663
 
664
-			if ( $sort->sort_desc ) {
665
-				$key   = $sort->htmlvar_name . '_desc';
664
+			if ($sort->sort_desc) {
665
+				$key   = $sort->htmlvar_name.'_desc';
666 666
 				$label = $sort->site_title;
667
-				if ( $sort->desc_title ) {
667
+				if ($sort->desc_title) {
668 668
 					$label = $sort->desc_title;
669 669
 				}
670
-				( $sort_by == $key || ( $sort->is_default == '1' && $sort->default_order == $key && ! isset( $_REQUEST['sort_by'] ) ) ) ? $selected = 'selected="selected"' : $selected = '';
671
-				$sort_field_options .= '<option ' . $selected . ' value="' . esc_url( add_query_arg( 'sort_by', $key ) ) . '">' . __( $label, 'geodirectory' ) . '</option>';
670
+				($sort_by == $key || ($sort->is_default == '1' && $sort->default_order == $key && !isset($_REQUEST['sort_by']))) ? $selected = 'selected="selected"' : $selected = '';
671
+				$sort_field_options .= '<option '.$selected.' value="'.esc_url(add_query_arg('sort_by', $key)).'">'.__($label, 'geodirectory').'</option>';
672 672
 			}
673 673
 
674 674
 		}
675 675
 	}
676 676
 
677
-	if ( $sort_field_options != '' ) {
677
+	if ($sort_field_options != '') {
678 678
 
679 679
 		?>
680 680
 
@@ -683,9 +683,9 @@  discard block
 block discarded – undo
683 683
 			<select name="sort_by" id="sort_by" onchange="javascript:window.location=this.value;">
684 684
 
685 685
 				<option
686
-					value="<?php echo esc_url( add_query_arg( 'sort_by', '' ) ); ?>" <?php if ( $sort_by == '' ) {
686
+					value="<?php echo esc_url(add_query_arg('sort_by', '')); ?>" <?php if ($sort_by == '') {
687 687
 					echo 'selected="selected"';
688
-				} ?>><?php _e( 'Sort By', 'geodirectory' ); ?></option><?php
688
+				} ?>><?php _e('Sort By', 'geodirectory'); ?></option><?php
689 689
 
690 690
 				echo $sort_field_options; ?>
691 691
 
@@ -713,9 +713,9 @@  discard block
 block discarded – undo
713 713
  *
714 714
  * @return string Returns the section title.
715 715
  */
716
-function geodir_advance_customfields_heading( $title, $field_type ) {
716
+function geodir_advance_customfields_heading($title, $field_type) {
717 717
 
718
-	if ( in_array( $field_type, array( 'multiselect', 'textarea', 'taxonomy' ) ) ) {
718
+	if (in_array($field_type, array('multiselect', 'textarea', 'taxonomy'))) {
719 719
 		$title = '';
720 720
 	}
721 721
 
@@ -737,19 +737,19 @@  discard block
 block discarded – undo
737 737
  * @global object $gd_session       GeoDirectory Session object.
738 738
  * @return string Returns related posts html.
739 739
  */
740
-function geodir_related_posts_display( $request ) {
741
-	if ( ! empty( $request ) ) {
742
-		$before_title = ( isset( $request['before_title'] ) && ! empty( $request['before_title'] ) ) ? $request['before_title'] : '';
743
-		$after_title  = ( isset( $request['after_title'] ) && ! empty( $request['after_title'] ) ) ? $request['after_title'] : '';
744
-
745
-		$title               = ( isset( $request['title'] ) && ! empty( $request['title'] ) ) ? $request['title'] : __( 'Related Listings', 'geodirectory' );
746
-		$post_number         = ( isset( $request['post_number'] ) && ! empty( $request['post_number'] ) ) ? $request['post_number'] : '5';
747
-		$relate_to           = ( isset( $request['relate_to'] ) && ! empty( $request['relate_to'] ) ) ? $request['relate_to'] : 'category';
748
-		$layout              = ( isset( $request['layout'] ) && ! empty( $request['layout'] ) ) ? $request['layout'] : 'gridview_onehalf';
749
-		$add_location_filter = ( isset( $request['add_location_filter'] ) && ! empty( $request['add_location_filter'] ) ) ? $request['add_location_filter'] : '0';
750
-		$listing_width       = ( isset( $request['listing_width'] ) && ! empty( $request['listing_width'] ) ) ? $request['listing_width'] : '';
751
-		$list_sort           = ( isset( $request['list_sort'] ) && ! empty( $request['list_sort'] ) ) ? $request['list_sort'] : 'latest';
752
-		$character_count     = ( isset( $request['character_count'] ) && ! empty( $request['character_count'] ) ) ? $request['character_count'] : '';
740
+function geodir_related_posts_display($request) {
741
+	if (!empty($request)) {
742
+		$before_title = (isset($request['before_title']) && !empty($request['before_title'])) ? $request['before_title'] : '';
743
+		$after_title  = (isset($request['after_title']) && !empty($request['after_title'])) ? $request['after_title'] : '';
744
+
745
+		$title               = (isset($request['title']) && !empty($request['title'])) ? $request['title'] : __('Related Listings', 'geodirectory');
746
+		$post_number         = (isset($request['post_number']) && !empty($request['post_number'])) ? $request['post_number'] : '5';
747
+		$relate_to           = (isset($request['relate_to']) && !empty($request['relate_to'])) ? $request['relate_to'] : 'category';
748
+		$layout              = (isset($request['layout']) && !empty($request['layout'])) ? $request['layout'] : 'gridview_onehalf';
749
+		$add_location_filter = (isset($request['add_location_filter']) && !empty($request['add_location_filter'])) ? $request['add_location_filter'] : '0';
750
+		$listing_width       = (isset($request['listing_width']) && !empty($request['listing_width'])) ? $request['listing_width'] : '';
751
+		$list_sort           = (isset($request['list_sort']) && !empty($request['list_sort'])) ? $request['list_sort'] : 'latest';
752
+		$character_count     = (isset($request['character_count']) && !empty($request['character_count'])) ? $request['character_count'] : '';
753 753
 
754 754
 		global $wpdb, $post, $gd_session, $related_nearest, $related_parent_lat, $related_parent_lon;
755 755
 		$related_parent_lat   = !empty($post->post_latitude) ? $post->post_latitude : '';
@@ -757,10 +757,10 @@  discard block
 block discarded – undo
757 757
 		$arr_detail_page_tabs = geodir_detail_page_tabs_list();
758 758
 
759 759
 		$related_listing_array = array();
760
-		if ( get_option( 'geodir_add_related_listing_posttypes' ) ) {
761
-			$related_listing_array = get_option( 'geodir_add_related_listing_posttypes' );
760
+		if (get_option('geodir_add_related_listing_posttypes')) {
761
+			$related_listing_array = get_option('geodir_add_related_listing_posttypes');
762 762
 		}
763
-		if ( isset($post->post_type) && in_array( $post->post_type, $related_listing_array ) ) {
763
+		if (isset($post->post_type) && in_array($post->post_type, $related_listing_array)) {
764 764
 			$arr_detail_page_tabs['related_listing']['is_display'] = true;
765 765
 		}
766 766
 
@@ -772,90 +772,90 @@  discard block
 block discarded – undo
772 772
 		$tax_field         = 'id';
773 773
 		$category          = array();
774 774
 
775
-		if ( isset( $_REQUEST['backandedit'] ) ) {
776
-			$post      = (object) $gd_session->get( 'listing' );
775
+		if (isset($_REQUEST['backandedit'])) {
776
+			$post      = (object) $gd_session->get('listing');
777 777
 			$post_type = $post->listing_type;
778
-			if ( isset( $_REQUEST['pid'] ) && $_REQUEST['pid'] != '' ) {
778
+			if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
779 779
 				$post_id = $_REQUEST['pid'];
780 780
 			}
781
-		} elseif ( isset( $_REQUEST['pid'] ) && $_REQUEST['pid'] != '' ) {
782
-			$post      = geodir_get_post_info( $_REQUEST['pid'] );
781
+		} elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
782
+			$post      = geodir_get_post_info($_REQUEST['pid']);
783 783
 			$post_type = $post->post_type;
784 784
 			$post_id   = $_REQUEST['pid'];
785
-		} elseif ( isset( $post->post_type ) && $post->post_type != '' ) {
785
+		} elseif (isset($post->post_type) && $post->post_type != '') {
786 786
 			$post_type = $post->post_type;
787 787
 			$post_id   = $post->ID;
788 788
 		}
789 789
 
790
-		if ( $relate_to == 'category' ) {
790
+		if ($relate_to == 'category') {
791 791
 
792
-			$category_taxonomy = $post_type . $relate_to;
793
-			if ( isset( $post->{$category_taxonomy} ) && $post->{$category_taxonomy} != '' ) {
794
-				$category = explode( ',', trim( $post->{$category_taxonomy}, ',' ) );
792
+			$category_taxonomy = $post_type.$relate_to;
793
+			if (isset($post->{$category_taxonomy} ) && $post->{$category_taxonomy} != '') {
794
+				$category = explode(',', trim($post->{$category_taxonomy}, ','));
795 795
 			}
796 796
 
797
-		} elseif ( $relate_to == 'tags' ) {
797
+		} elseif ($relate_to == 'tags') {
798 798
 
799
-			$category_taxonomy = $post_type . '_' . $relate_to;
800
-			if ( $post->post_tags != '' ) {
801
-				$category = explode( ',', trim( $post->post_tags, ',' ) );
799
+			$category_taxonomy = $post_type.'_'.$relate_to;
800
+			if ($post->post_tags != '') {
801
+				$category = explode(',', trim($post->post_tags, ','));
802 802
 			}
803 803
 			$tax_field = 'name';
804 804
 		}
805 805
 
806 806
 		/* --- return false in invalid request --- */
807
-		if ( empty( $category ) ) {
807
+		if (empty($category)) {
808 808
 			return false;
809 809
 		}
810 810
 
811 811
 		$all_postypes = geodir_get_posttypes();
812 812
 
813
-		if ( ! in_array( $post_type, $all_postypes ) ) {
813
+		if (!in_array($post_type, $all_postypes)) {
814 814
 			return false;
815 815
 		}
816 816
 
817 817
 		/* --- return false in invalid request --- */
818 818
 
819 819
 		$location_url = '';
820
-		if ( $add_location_filter != '0' ) {
820
+		if ($add_location_filter != '0') {
821 821
 			$location_url             = array();
822
-			$geodir_show_location_url = get_option( 'geodir_show_location_url' );
822
+			$geodir_show_location_url = get_option('geodir_show_location_url');
823 823
 
824
-			$gd_city = get_query_var( 'gd_city' );
824
+			$gd_city = get_query_var('gd_city');
825 825
 
826
-			if ( $gd_city ) {
827
-				$gd_country = get_query_var( 'gd_country' );
828
-				$gd_region  = get_query_var( 'gd_region' );
826
+			if ($gd_city) {
827
+				$gd_country = get_query_var('gd_country');
828
+				$gd_region  = get_query_var('gd_region');
829 829
 			} else {
830 830
 				$location = geodir_get_default_location();
831 831
 
832
-				$gd_country = isset( $location->country_slug ) ? $location->country_slug : '';
833
-				$gd_region  = isset( $location->region_slug ) ? $location->region_slug : '';
834
-				$gd_city    = isset( $location->city_slug ) ? $location->city_slug : '';
832
+				$gd_country = isset($location->country_slug) ? $location->country_slug : '';
833
+				$gd_region  = isset($location->region_slug) ? $location->region_slug : '';
834
+				$gd_city    = isset($location->city_slug) ? $location->city_slug : '';
835 835
 			}
836 836
 
837
-			if ( $geodir_show_location_url == 'all' ) {
837
+			if ($geodir_show_location_url == 'all') {
838 838
 				$location_url[] = $gd_country;
839 839
 				$location_url[] = $gd_region;
840
-			} else if ( $geodir_show_location_url == 'country_city' ) {
840
+			} else if ($geodir_show_location_url == 'country_city') {
841 841
 				$location_url[] = $gd_country;
842
-			} else if ( $geodir_show_location_url == 'region_city' ) {
842
+			} else if ($geodir_show_location_url == 'region_city') {
843 843
 				$location_url[] = $gd_region;
844 844
 			}
845 845
 
846 846
 			$location_url[] = $gd_city;
847 847
 
848
-			$location_url = implode( '/', $location_url );
848
+			$location_url = implode('/', $location_url);
849 849
 		}
850 850
 
851 851
 
852
-		if ( ! empty( $category ) ) {
852
+		if (!empty($category)) {
853 853
 			global $geodir_add_location_url;
854 854
 			$geodir_add_location_url = '0';
855
-			if ( $add_location_filter != '0' ) {
855
+			if ($add_location_filter != '0') {
856 856
 				$geodir_add_location_url = '1';
857 857
 			}
858
-			$viewall_url             = get_term_link( (int) $category[0], $post_type . $category_taxonomy );
858
+			$viewall_url             = get_term_link((int) $category[0], $post_type.$category_taxonomy);
859 859
 			$geodir_add_location_url = null;
860 860
 		}
861 861
 		ob_start();
@@ -865,24 +865,24 @@  discard block
 block discarded – undo
865 865
 		<div class="geodir_locations geodir_location_listing">
866 866
 
867 867
 			<?php
868
-			if ( isset( $request['is_widget'] ) && $request['is_widget'] == '1' ) {
868
+			if (isset($request['is_widget']) && $request['is_widget'] == '1') {
869 869
 				/** geodir_before_title filter Documented in geodirectory_widgets.php */
870
-				$before_title = isset( $before_title ) ? $before_title : apply_filters( 'geodir_before_title', '<h3 class="widget-title">' );
870
+				$before_title = isset($before_title) ? $before_title : apply_filters('geodir_before_title', '<h3 class="widget-title">');
871 871
 				/** geodir_after_title filter Documented in geodirectory_widgets.php */
872
-				$after_title = isset( $after_title ) ? $after_title : apply_filters( 'geodir_after_title', '</h3>' );
872
+				$after_title = isset($after_title) ? $after_title : apply_filters('geodir_after_title', '</h3>');
873 873
 				?>
874 874
 				<div class="location_list_heading clearfix">
875
-					<?php echo $before_title . $title . $after_title; ?>
875
+					<?php echo $before_title.$title.$after_title; ?>
876 876
 				</div>
877 877
 				<?php
878 878
 			}
879 879
 			$query_args = array(
880 880
 				'posts_per_page'   => $post_number,
881 881
 				'is_geodir_loop'   => true,
882
-				'gd_location'      => ( $add_location_filter ) ? true : false,
882
+				'gd_location'      => ($add_location_filter) ? true : false,
883 883
 				'post_type'        => $post_type,
884 884
 				'order_by'         => $list_sort,
885
-				'post__not_in'     => array( $post_id ),
885
+				'post__not_in'     => array($post_id),
886 886
 				'excerpt_length'   => $character_count,
887 887
 				'related_listings' => $is_display
888 888
 			);
@@ -893,7 +893,7 @@  discard block
 block discarded – undo
893 893
 				'terms'    => $category
894 894
 			);
895 895
 
896
-			$query_args['tax_query'] = array( $tax_query );
896
+			$query_args['tax_query'] = array($tax_query);
897 897
 
898 898
 			global $gridview_columns, $post;
899 899
 
@@ -905,21 +905,21 @@  discard block
 block discarded – undo
905 905
 			 * @param array $query_args The query array.
906 906
 			 * @param array $request Related posts request array.
907 907
 			 */
908
-			$query_args = apply_filters( 'geodir_related_posts_widget_query_args', $query_args, $request );
908
+			$query_args = apply_filters('geodir_related_posts_widget_query_args', $query_args, $request);
909 909
 
910
-			query_posts( $query_args );
910
+			query_posts($query_args);
911 911
 
912
-			if ( strstr( $layout, 'gridview' ) ) {
913
-				$listing_view_exp = explode( '_', $layout );
912
+			if (strstr($layout, 'gridview')) {
913
+				$listing_view_exp = explode('_', $layout);
914 914
 				$gridview_columns = $layout;
915 915
 				$layout           = $listing_view_exp[0];
916
-			} else if ( $layout == 'list' ) {
916
+			} else if ($layout == 'list') {
917 917
 				$gridview_columns = '';
918 918
 			}
919 919
 			$related_posts = true;
920 920
 
921 921
 			$related_nearest = false;
922
-			if ( $list_sort == 'nearest' ) {
922
+			if ($list_sort == 'nearest') {
923 923
 				$related_nearest = true;
924 924
 			}
925 925
 
@@ -929,14 +929,14 @@  discard block
 block discarded – undo
929 929
 			 *
930 930
 			 * @since 1.0.0
931 931
 			 */
932
-			$template = apply_filters( "geodir_template_part-related-listing-listview", geodir_locate_template( 'listing-listview' ) );
932
+			$template = apply_filters("geodir_template_part-related-listing-listview", geodir_locate_template('listing-listview'));
933 933
 
934 934
 			/**
935 935
 			 * Includes related listing listview template.
936 936
 			 *
937 937
 			 * @since 1.0.0
938 938
 			 */
939
-			include( $template );
939
+			include($template);
940 940
 
941 941
 			wp_reset_query();
942 942
 			$post            = $origi_post;
@@ -964,12 +964,12 @@  discard block
 block discarded – undo
964 964
 function geodir_category_count_script() {
965 965
 	global $geodir_post_category_str;
966 966
 
967
-	if ( ! empty( $geodir_post_category_str ) ) {
968
-		$geodir_post_category_str = serialize( $geodir_post_category_str );
967
+	if (!empty($geodir_post_category_str)) {
968
+		$geodir_post_category_str = serialize($geodir_post_category_str);
969 969
 	}
970 970
 
971
-	$all_var['post_category_array'] = html_entity_decode( (string) $geodir_post_category_str, ENT_QUOTES, 'UTF-8' );
972
-	$script                         = "var post_category_array = " . json_encode( $all_var ) . ';';
971
+	$all_var['post_category_array'] = html_entity_decode((string) $geodir_post_category_str, ENT_QUOTES, 'UTF-8');
972
+	$script                         = "var post_category_array = ".json_encode($all_var).';';
973 973
 	echo '<script>';
974 974
 	echo $script;
975 975
 	echo '</script>';
@@ -984,8 +984,8 @@  discard block
 block discarded – undo
984 984
  * @return string Returns the default language.
985 985
  */
986 986
 function geodir_get_map_default_language() {
987
-	$geodir_default_map_language = get_option( 'geodir_default_map_language' );
988
-	if ( empty( $geodir_default_map_language ) ) {
987
+	$geodir_default_map_language = get_option('geodir_default_map_language');
988
+	if (empty($geodir_default_map_language)) {
989 989
 		$geodir_default_map_language = 'en';
990 990
 	}
991 991
 
@@ -996,7 +996,7 @@  discard block
 block discarded – undo
996 996
 	 *
997 997
 	 * @param string $geodir_default_map_language Default map language.
998 998
 	 */
999
-	return apply_filters( 'geodir_default_map_language', $geodir_default_map_language );
999
+	return apply_filters('geodir_default_map_language', $geodir_default_map_language);
1000 1000
 }
1001 1001
 
1002 1002
 /**
@@ -1007,7 +1007,7 @@  discard block
 block discarded – undo
1007 1007
  * @return string Returns the api key.
1008 1008
  */
1009 1009
 function geodir_get_map_api_key() {
1010
-	$key = get_option( 'geodir_google_api_key' );
1010
+	$key = get_option('geodir_google_api_key');
1011 1011
 
1012 1012
 	/**
1013 1013
 	 * Filter Google maps api key.
@@ -1016,7 +1016,7 @@  discard block
 block discarded – undo
1016 1016
 	 *
1017 1017
 	 * @param string $key Google maps api key.
1018 1018
 	 */
1019
-	return apply_filters( 'geodir_google_api_key', $key );
1019
+	return apply_filters('geodir_google_api_key', $key);
1020 1020
 }
1021 1021
 
1022 1022
 
@@ -1036,20 +1036,20 @@  discard block
 block discarded – undo
1036 1036
 	global $wp, $post, $wp_query, $wpdb, $geodir_addon_list;
1037 1037
 
1038 1038
 	$is_geodir_page = geodir_is_geodir_page();
1039
-	if ( ! $is_geodir_page ) {
1039
+	if (!$is_geodir_page) {
1040 1040
 		return;
1041 1041
 	}// if non GD page, bail
1042 1042
 
1043 1043
 	$use_gd_meta = true;
1044
-	if ( ( class_exists( 'WPSEO_Frontend' ) || class_exists( 'All_in_One_SEO_Pack' ) ) && !geodir_disable_yoast_seo_metas() ) {
1044
+	if ((class_exists('WPSEO_Frontend') || class_exists('All_in_One_SEO_Pack')) && !geodir_disable_yoast_seo_metas()) {
1045 1045
 		$use_gd_meta = false;
1046 1046
 
1047
-		if ( geodir_is_page( 'search' ) ) {
1047
+		if (geodir_is_page('search')) {
1048 1048
 			$use_gd_meta = true;
1049 1049
 		}
1050 1050
 	}
1051 1051
 
1052
-	if ( ! $use_gd_meta ) {
1052
+	if (!$use_gd_meta) {
1053 1053
 		return;
1054 1054
 	}// bail if Yoast Wordpress SEO or All_in_One_SEO_Pack active.
1055 1055
 
@@ -1057,170 +1057,170 @@  discard block
 block discarded – undo
1057 1057
 
1058 1058
 	$all_postypes = geodir_get_posttypes();
1059 1059
 
1060
-	$geodir_taxonomies = geodir_get_taxonomies( '', true );
1060
+	$geodir_taxonomies = geodir_get_taxonomies('', true);
1061 1061
 
1062 1062
 	$meta_desc = '';
1063 1063
 	$meta_key  = '';
1064
-	if ( isset( $current_term->ID ) && $current_term->ID == geodir_location_page_id() ) {
1064
+	if (isset($current_term->ID) && $current_term->ID == geodir_location_page_id()) {
1065 1065
 		/**
1066 1066
 		 * Filter SEO meta location description.
1067 1067
 		 *
1068 1068
 		 * @since 1.0.0
1069 1069
 		 */
1070
-		$meta_desc = apply_filters( 'geodir_seo_meta_location_description', '' );
1070
+		$meta_desc = apply_filters('geodir_seo_meta_location_description', '');
1071 1071
 		$meta_desc .= '';
1072 1072
 	}
1073
-	if ( have_posts() && is_single() OR is_page() ) {
1074
-		while ( have_posts() ) {
1073
+	if (have_posts() && is_single() OR is_page()) {
1074
+		while (have_posts()) {
1075 1075
 			the_post();
1076 1076
 
1077
-			if ( has_excerpt() ) {
1078
-				$out_excerpt = strip_tags( strip_shortcodes( get_the_excerpt() ) );
1079
-				if ( empty( $out_excerpt ) ) {
1080
-					$out_excerpt = strip_tags( do_shortcode( get_the_excerpt() ) );
1077
+			if (has_excerpt()) {
1078
+				$out_excerpt = strip_tags(strip_shortcodes(get_the_excerpt()));
1079
+				if (empty($out_excerpt)) {
1080
+					$out_excerpt = strip_tags(do_shortcode(get_the_excerpt()));
1081 1081
 				}
1082
-				$out_excerpt = str_replace( array( "\r\n", "\r", "\n" ), "", $out_excerpt );
1082
+				$out_excerpt = str_replace(array("\r\n", "\r", "\n"), "", $out_excerpt);
1083 1083
 			} else {
1084
-				$out_excerpt = str_replace( array( "\r\n", "\r", "\n" ), "", $post->post_content );
1085
-				$out_excerpt = strip_tags( strip_shortcodes( $out_excerpt ) );
1086
-				if ( empty( $out_excerpt ) ) {
1087
-					$out_excerpt = strip_tags( do_shortcode( $out_excerpt ) ); // parse short code from content
1084
+				$out_excerpt = str_replace(array("\r\n", "\r", "\n"), "", $post->post_content);
1085
+				$out_excerpt = strip_tags(strip_shortcodes($out_excerpt));
1086
+				if (empty($out_excerpt)) {
1087
+					$out_excerpt = strip_tags(do_shortcode($out_excerpt)); // parse short code from content
1088 1088
 				}
1089
-				$out_excerpt = trim( wp_trim_words( $out_excerpt, 35, '' ), '.!?,;:-' );
1089
+				$out_excerpt = trim(wp_trim_words($out_excerpt, 35, ''), '.!?,;:-');
1090 1090
 			}
1091 1091
 
1092 1092
 			$meta_desc .= $out_excerpt;
1093 1093
 		}
1094
-	} elseif ( ( is_category() || is_tag() ) && isset( $current_term->taxonomy ) && in_array( $current_term->taxonomy, $geodir_taxonomies ) ) {
1095
-		if ( is_category() ) {
1096
-			$meta_desc .= __( "Posts related to Category:", 'geodirectory' ) . " " . geodir_utf8_ucfirst( single_cat_title( "", false ) );
1097
-		} elseif ( is_tag() ) {
1098
-			$meta_desc .= __( "Posts related to Tag:", 'geodirectory' ) . " " . geodir_utf8_ucfirst( single_tag_title( "", false ) );
1094
+	} elseif ((is_category() || is_tag()) && isset($current_term->taxonomy) && in_array($current_term->taxonomy, $geodir_taxonomies)) {
1095
+		if (is_category()) {
1096
+			$meta_desc .= __("Posts related to Category:", 'geodirectory')." ".geodir_utf8_ucfirst(single_cat_title("", false));
1097
+		} elseif (is_tag()) {
1098
+			$meta_desc .= __("Posts related to Tag:", 'geodirectory')." ".geodir_utf8_ucfirst(single_tag_title("", false));
1099 1099
 		}
1100
-	} elseif ( isset( $current_term->taxonomy ) && in_array( $current_term->taxonomy, $geodir_taxonomies ) ) {
1101
-		$meta_desc .= isset( $current_term->description ) ? $current_term->description : '';
1100
+	} elseif (isset($current_term->taxonomy) && in_array($current_term->taxonomy, $geodir_taxonomies)) {
1101
+		$meta_desc .= isset($current_term->description) ? $current_term->description : '';
1102 1102
 	}
1103 1103
 
1104 1104
 
1105 1105
 	$geodir_post_type       = geodir_get_current_posttype();
1106
-	$geodir_post_type_info  = get_post_type_object( $geodir_post_type );
1107
-	$geodir_is_page_listing = geodir_is_page( 'listing' ) ? true : false;
1108
-
1109
-	$category_taxonomy = geodir_get_taxonomies( $geodir_post_type );
1110
-	$tag_taxonomy      = geodir_get_taxonomies( $geodir_post_type, true );
1111
-
1112
-	$geodir_is_category = isset( $category_taxonomy[0] ) && get_query_var( $category_taxonomy[0] ) ? get_query_var( $category_taxonomy[0] ) : false;
1113
-	$geodir_is_tag      = isset( $tag_taxonomy[0] ) && get_query_var( $tag_taxonomy[0] ) ? true : false;
1114
-
1115
-	$geodir_is_search        = geodir_is_page( 'search' ) ? true : false;
1116
-	$geodir_is_location      = geodir_is_page( 'location' ) ? true : false;
1117
-	$geodir_location_manager = isset( $geodir_addon_list['geodir_location_manager'] ) && $geodir_addon_list['geodir_location_manager'] = 'yes' ? true : false;
1118
-	$godir_location_terms    = geodir_get_current_location_terms( 'query_vars' );
1119
-	$gd_city                 = $geodir_location_manager && isset( $godir_location_terms['gd_city'] ) ? $godir_location_terms['gd_city'] : null;
1120
-	$gd_region               = $geodir_location_manager && isset( $godir_location_terms['gd_region'] ) ? $godir_location_terms['gd_region'] : null;
1121
-	$gd_country              = $geodir_location_manager && isset( $godir_location_terms['gd_country'] ) ? $godir_location_terms['gd_country'] : null;
1122
-	$replace_location        = __( 'Everywhere', 'geodirectory' );
1106
+	$geodir_post_type_info  = get_post_type_object($geodir_post_type);
1107
+	$geodir_is_page_listing = geodir_is_page('listing') ? true : false;
1108
+
1109
+	$category_taxonomy = geodir_get_taxonomies($geodir_post_type);
1110
+	$tag_taxonomy      = geodir_get_taxonomies($geodir_post_type, true);
1111
+
1112
+	$geodir_is_category = isset($category_taxonomy[0]) && get_query_var($category_taxonomy[0]) ? get_query_var($category_taxonomy[0]) : false;
1113
+	$geodir_is_tag      = isset($tag_taxonomy[0]) && get_query_var($tag_taxonomy[0]) ? true : false;
1114
+
1115
+	$geodir_is_search        = geodir_is_page('search') ? true : false;
1116
+	$geodir_is_location      = geodir_is_page('location') ? true : false;
1117
+	$geodir_location_manager = isset($geodir_addon_list['geodir_location_manager']) && $geodir_addon_list['geodir_location_manager'] = 'yes' ? true : false;
1118
+	$godir_location_terms    = geodir_get_current_location_terms('query_vars');
1119
+	$gd_city                 = $geodir_location_manager && isset($godir_location_terms['gd_city']) ? $godir_location_terms['gd_city'] : null;
1120
+	$gd_region               = $geodir_location_manager && isset($godir_location_terms['gd_region']) ? $godir_location_terms['gd_region'] : null;
1121
+	$gd_country              = $geodir_location_manager && isset($godir_location_terms['gd_country']) ? $godir_location_terms['gd_country'] : null;
1122
+	$replace_location        = __('Everywhere', 'geodirectory');
1123 1123
 	$location_id             = null;
1124
-	if ( $geodir_location_manager ) {
1125
-		$sql           = $wpdb->prepare( "SELECT location_id FROM " . POST_LOCATION_TABLE . " WHERE city_slug=%s ORDER BY location_id ASC LIMIT 1", array( $gd_city ) );
1126
-		$location_id   = (int) $wpdb->get_var( $sql );
1124
+	if ($geodir_location_manager) {
1125
+		$sql           = $wpdb->prepare("SELECT location_id FROM ".POST_LOCATION_TABLE." WHERE city_slug=%s ORDER BY location_id ASC LIMIT 1", array($gd_city));
1126
+		$location_id   = (int) $wpdb->get_var($sql);
1127 1127
 		$location_type = geodir_what_is_current_location();
1128
-		if ( $location_type == 'city' ) {
1129
-			$replace_location = geodir_get_current_location( array( 'what' => 'city', 'echo' => false ) );
1130
-		} elseif ( $location_type == 'region' ) {
1131
-			$replace_location = geodir_get_current_location( array( 'what' => 'region', 'echo' => false ) );
1132
-		} elseif ( $location_type == 'country' ) {
1133
-			$replace_location = geodir_get_current_location( array( 'what' => 'country', 'echo' => false ) );
1134
-			$replace_location = __( $replace_location, 'geodirectory' );
1128
+		if ($location_type == 'city') {
1129
+			$replace_location = geodir_get_current_location(array('what' => 'city', 'echo' => false));
1130
+		} elseif ($location_type == 'region') {
1131
+			$replace_location = geodir_get_current_location(array('what' => 'region', 'echo' => false));
1132
+		} elseif ($location_type == 'country') {
1133
+			$replace_location = geodir_get_current_location(array('what' => 'country', 'echo' => false));
1134
+			$replace_location = __($replace_location, 'geodirectory');
1135 1135
 		}
1136
-		$country          = get_query_var( 'gd_country' );
1137
-		$region           = get_query_var( 'gd_region' );
1138
-		$city             = get_query_var( 'gd_city' );
1136
+		$country          = get_query_var('gd_country');
1137
+		$region           = get_query_var('gd_region');
1138
+		$city             = get_query_var('gd_city');
1139 1139
 		$current_location = '';
1140
-		if ( $country != '' ) {
1141
-			$current_location = get_actual_location_name( 'country', $country, true );
1140
+		if ($country != '') {
1141
+			$current_location = get_actual_location_name('country', $country, true);
1142 1142
 		}
1143
-		if ( $region != '' ) {
1144
-			$current_location = get_actual_location_name( 'region', $region );
1143
+		if ($region != '') {
1144
+			$current_location = get_actual_location_name('region', $region);
1145 1145
 		}
1146
-		if ( $city != '' ) {
1147
-			$current_location = get_actual_location_name( 'city', $city );
1146
+		if ($city != '') {
1147
+			$current_location = get_actual_location_name('city', $city);
1148 1148
 		}
1149 1149
 		$replace_location = $current_location != '' ? $current_location : $replace_location;
1150 1150
 	}
1151 1151
 
1152 1152
 	$geodir_meta_keys = '';
1153 1153
 	$geodir_meta_desc = '';
1154
-	if ( $is_geodir_page && ! empty( $geodir_post_type_info ) ) {
1155
-		if ( $geodir_is_page_listing || $geodir_is_search || geodir_is_page( 'add-listing' ) ) {
1156
-			$geodir_meta_keys = isset( $geodir_post_type_info->seo['meta_keyword'] ) && $geodir_post_type_info->seo['meta_keyword'] != '' ? $geodir_post_type_info->seo['meta_keyword'] : $geodir_meta_keys;
1154
+	if ($is_geodir_page && !empty($geodir_post_type_info)) {
1155
+		if ($geodir_is_page_listing || $geodir_is_search || geodir_is_page('add-listing')) {
1156
+			$geodir_meta_keys = isset($geodir_post_type_info->seo['meta_keyword']) && $geodir_post_type_info->seo['meta_keyword'] != '' ? $geodir_post_type_info->seo['meta_keyword'] : $geodir_meta_keys;
1157 1157
 
1158
-			$geodir_meta_desc = isset( $geodir_post_type_info->description ) ? $geodir_post_type_info->description : $geodir_meta_desc;
1159
-			$geodir_meta_desc = isset( $geodir_post_type_info->seo['meta_description'] ) && $geodir_post_type_info->seo['meta_description'] != '' ? $geodir_post_type_info->seo['meta_description'] : $geodir_meta_desc;
1158
+			$geodir_meta_desc = isset($geodir_post_type_info->description) ? $geodir_post_type_info->description : $geodir_meta_desc;
1159
+			$geodir_meta_desc = isset($geodir_post_type_info->seo['meta_description']) && $geodir_post_type_info->seo['meta_description'] != '' ? $geodir_post_type_info->seo['meta_description'] : $geodir_meta_desc;
1160 1160
 
1161
-			if ( $geodir_is_category ) {
1162
-				$category = $geodir_is_category ? get_term_by( 'slug', $geodir_is_category, $category_taxonomy[0] ) : null;
1163
-				if ( isset( $category->term_id ) && ! empty( $category->term_id ) ) {
1161
+			if ($geodir_is_category) {
1162
+				$category = $geodir_is_category ? get_term_by('slug', $geodir_is_category, $category_taxonomy[0]) : null;
1163
+				if (isset($category->term_id) && !empty($category->term_id)) {
1164 1164
 					$category_id   = $category->term_id;
1165
-					$category_desc = trim( $category->description ) != '' ? trim( $category->description ) : geodir_get_tax_meta( $category_id, 'ct_cat_top_desc', false, $geodir_post_type );
1166
-					if ( $location_id ) {
1167
-						$option_name    = 'geodir_cat_loc_' . $geodir_post_type . '_' . $category_id;
1168
-						$cat_loc_option = get_option( $option_name );
1169
-
1170
-						$gd_cat_loc_default = ! empty( $cat_loc_option ) && isset( $cat_loc_option['gd_cat_loc_default'] ) && $cat_loc_option['gd_cat_loc_default'] > 0 ? true : false;
1171
-						if ( ! $gd_cat_loc_default ) {
1172
-							$option_name   = 'geodir_cat_loc_' . $geodir_post_type . '_' . $category_id . '_' . $location_id;
1173
-							$option        = get_option( $option_name );
1174
-							$category_desc = isset( $option['gd_cat_loc_desc'] ) && trim( $option['gd_cat_loc_desc'] ) != '' ? trim( $option['gd_cat_loc_desc'] ) : $category_desc;
1165
+					$category_desc = trim($category->description) != '' ? trim($category->description) : geodir_get_tax_meta($category_id, 'ct_cat_top_desc', false, $geodir_post_type);
1166
+					if ($location_id) {
1167
+						$option_name    = 'geodir_cat_loc_'.$geodir_post_type.'_'.$category_id;
1168
+						$cat_loc_option = get_option($option_name);
1169
+
1170
+						$gd_cat_loc_default = !empty($cat_loc_option) && isset($cat_loc_option['gd_cat_loc_default']) && $cat_loc_option['gd_cat_loc_default'] > 0 ? true : false;
1171
+						if (!$gd_cat_loc_default) {
1172
+							$option_name   = 'geodir_cat_loc_'.$geodir_post_type.'_'.$category_id.'_'.$location_id;
1173
+							$option        = get_option($option_name);
1174
+							$category_desc = isset($option['gd_cat_loc_desc']) && trim($option['gd_cat_loc_desc']) != '' ? trim($option['gd_cat_loc_desc']) : $category_desc;
1175 1175
 						}
1176 1176
 					}
1177
-					$geodir_meta_desc = __( "Posts related to Category:", 'geodirectory' ) . " " . geodir_utf8_ucfirst( single_cat_title( "", false ) ) . '. ' . $category_desc;
1177
+					$geodir_meta_desc = __("Posts related to Category:", 'geodirectory')." ".geodir_utf8_ucfirst(single_cat_title("", false)).'. '.$category_desc;
1178 1178
 				}
1179
-			} else if ( $geodir_is_tag ) {
1180
-				$geodir_meta_desc = __( "Posts related to Tag:", 'geodirectory' ) . " " . geodir_utf8_ucfirst( single_tag_title( "", false ) ) . '. ' . $geodir_meta_desc;
1179
+			} else if ($geodir_is_tag) {
1180
+				$geodir_meta_desc = __("Posts related to Tag:", 'geodirectory')." ".geodir_utf8_ucfirst(single_tag_title("", false)).'. '.$geodir_meta_desc;
1181 1181
 			}
1182 1182
 		}
1183 1183
 	}
1184 1184
 
1185 1185
 
1186 1186
 	$gd_page = '';
1187
-	if ( geodir_is_page( 'home' ) ) {
1187
+	if (geodir_is_page('home')) {
1188 1188
 		$gd_page   = 'home';
1189
-		$meta_desc = ( get_option( 'geodir_meta_desc_homepage' ) ) ? get_option( 'geodir_meta_desc_homepage' ) : $meta_desc;
1190
-	} elseif ( geodir_is_page( 'detail' ) ) {
1189
+		$meta_desc = (get_option('geodir_meta_desc_homepage')) ? get_option('geodir_meta_desc_homepage') : $meta_desc;
1190
+	} elseif (geodir_is_page('detail')) {
1191 1191
 		$gd_page   = 'detail';
1192
-		$meta_desc = ( get_option( 'geodir_meta_desc_detail' ) ) ? get_option( 'geodir_meta_desc_detail' ) : $meta_desc;
1193
-	} elseif ( geodir_is_page( 'pt' ) ) {
1192
+		$meta_desc = (get_option('geodir_meta_desc_detail')) ? get_option('geodir_meta_desc_detail') : $meta_desc;
1193
+	} elseif (geodir_is_page('pt')) {
1194 1194
 		$gd_page   = 'pt';
1195
-		$meta_desc = ( get_option( 'geodir_meta_desc_pt' ) ) ? get_option( 'geodir_meta_desc_pt' ) : $meta_desc;
1196
-	} elseif ( geodir_is_page( 'listing' ) ) {
1195
+		$meta_desc = (get_option('geodir_meta_desc_pt')) ? get_option('geodir_meta_desc_pt') : $meta_desc;
1196
+	} elseif (geodir_is_page('listing')) {
1197 1197
 		$gd_page   = 'listing';
1198
-		$meta_desc = ( get_option( 'geodir_meta_desc_listing' ) ) ? get_option( 'geodir_meta_desc_listing' ) : $meta_desc;
1199
-	} elseif ( geodir_is_page( 'location' ) ) {
1198
+		$meta_desc = (get_option('geodir_meta_desc_listing')) ? get_option('geodir_meta_desc_listing') : $meta_desc;
1199
+	} elseif (geodir_is_page('location')) {
1200 1200
 		$gd_page   = 'location';
1201
-		$meta_desc = ( get_option( 'geodir_meta_desc_location' ) ) ? get_option( 'geodir_meta_desc_location' ) : $meta_desc;
1202
-		$meta_desc = apply_filters( 'geodir_seo_meta_location_description', $meta_desc );
1201
+		$meta_desc = (get_option('geodir_meta_desc_location')) ? get_option('geodir_meta_desc_location') : $meta_desc;
1202
+		$meta_desc = apply_filters('geodir_seo_meta_location_description', $meta_desc);
1203 1203
 
1204
-	} elseif ( geodir_is_page( 'search' ) ) {
1204
+	} elseif (geodir_is_page('search')) {
1205 1205
 		$gd_page   = 'search';
1206
-		$meta_desc = ( get_option( 'geodir_meta_desc_search' ) ) ? get_option( 'geodir_meta_desc_search' ) : $meta_desc;
1207
-	} elseif ( geodir_is_page( 'add-listing' ) ) {
1206
+		$meta_desc = (get_option('geodir_meta_desc_search')) ? get_option('geodir_meta_desc_search') : $meta_desc;
1207
+	} elseif (geodir_is_page('add-listing')) {
1208 1208
 		$gd_page   = 'add-listing';
1209
-		$meta_desc = ( get_option( 'geodir_meta_desc_add-listing' ) ) ? get_option( 'geodir_meta_desc_add-listing' ) : $meta_desc;
1210
-	} elseif ( geodir_is_page( 'author' ) ) {
1209
+		$meta_desc = (get_option('geodir_meta_desc_add-listing')) ? get_option('geodir_meta_desc_add-listing') : $meta_desc;
1210
+	} elseif (geodir_is_page('author')) {
1211 1211
 		$gd_page   = 'author';
1212
-		$meta_desc = ( get_option( 'geodir_meta_desc_author' ) ) ? get_option( 'geodir_meta_desc_author' ) : $meta_desc;
1213
-	} elseif ( geodir_is_page( 'login' ) ) {
1212
+		$meta_desc = (get_option('geodir_meta_desc_author')) ? get_option('geodir_meta_desc_author') : $meta_desc;
1213
+	} elseif (geodir_is_page('login')) {
1214 1214
 		$gd_page   = 'login';
1215
-		$meta_desc = ( get_option( 'geodir_meta_desc_login' ) ) ? get_option( 'geodir_meta_desc_login' ) : $meta_desc;
1216
-	} elseif ( geodir_is_page( 'listing-success' ) ) {
1215
+		$meta_desc = (get_option('geodir_meta_desc_login')) ? get_option('geodir_meta_desc_login') : $meta_desc;
1216
+	} elseif (geodir_is_page('listing-success')) {
1217 1217
 		$gd_page   = 'listing-success';
1218
-		$meta_desc = ( get_option( 'geodir_meta_desc_listing-success' ) ) ? get_option( 'geodir_meta_desc_listing-success' ) : $meta_desc;
1218
+		$meta_desc = (get_option('geodir_meta_desc_listing-success')) ? get_option('geodir_meta_desc_listing-success') : $meta_desc;
1219 1219
 	}
1220 1220
 
1221 1221
 
1222
-	if ( $meta_desc ) {
1223
-		$meta_desc = stripslashes_deep( $meta_desc );
1222
+	if ($meta_desc) {
1223
+		$meta_desc = stripslashes_deep($meta_desc);
1224 1224
 		/**
1225 1225
 		 * Filter page description to replace variables.
1226 1226
 		 *
@@ -1229,7 +1229,7 @@  discard block
 block discarded – undo
1229 1229
 		 * @param string $title   The page description including variables.
1230 1230
 		 * @param string $gd_page The GeoDirectory page type if any.
1231 1231
 		 */
1232
-		$meta_desc = apply_filters( 'geodir_seo_meta_description_pre', __( $meta_desc, 'geodirectory' ), $gd_page, '' );
1232
+		$meta_desc = apply_filters('geodir_seo_meta_description_pre', __($meta_desc, 'geodirectory'), $gd_page, '');
1233 1233
 
1234 1234
 		/**
1235 1235
 		 * Filter SEO meta description.
@@ -1238,49 +1238,49 @@  discard block
 block discarded – undo
1238 1238
 		 *
1239 1239
 		 * @param string $meta_desc Meta description content.
1240 1240
 		 */
1241
-		echo apply_filters( 'geodir_seo_meta_description', '<meta name="description" content="' . $meta_desc . '" />', $meta_desc );
1241
+		echo apply_filters('geodir_seo_meta_description', '<meta name="description" content="'.$meta_desc.'" />', $meta_desc);
1242 1242
 	}
1243 1243
 
1244 1244
 	// meta keywords
1245
-	if ( isset( $post->post_type ) && in_array( $post->post_type, $all_postypes ) ) {
1246
-		$place_tags = wp_get_post_terms( $post->ID, $post->post_type . '_tags', array( "fields" => "names" ) );
1247
-		$place_cats = wp_get_post_terms( $post->ID, $post->post_type . 'category', array( "fields" => "names" ) );
1245
+	if (isset($post->post_type) && in_array($post->post_type, $all_postypes)) {
1246
+		$place_tags = wp_get_post_terms($post->ID, $post->post_type.'_tags', array("fields" => "names"));
1247
+		$place_cats = wp_get_post_terms($post->ID, $post->post_type.'category', array("fields" => "names"));
1248 1248
 
1249
-		$meta_key .= implode( ", ", array_merge( (array) $place_cats, (array) $place_tags ) );
1249
+		$meta_key .= implode(", ", array_merge((array) $place_cats, (array) $place_tags));
1250 1250
 	} else {
1251 1251
 		$posttags = get_the_tags();
1252
-		if ( $posttags ) {
1253
-			foreach ( $posttags as $tag ) {
1254
-				$meta_key .= $tag->name . ' ';
1252
+		if ($posttags) {
1253
+			foreach ($posttags as $tag) {
1254
+				$meta_key .= $tag->name.' ';
1255 1255
 			}
1256 1256
 		} else {
1257
-			$tags = get_tags( array( 'orderby' => 'count', 'order' => 'DESC' ) );
1257
+			$tags = get_tags(array('orderby' => 'count', 'order' => 'DESC'));
1258 1258
 			$xt   = 1;
1259 1259
 
1260
-			foreach ( $tags as $tag ) {
1261
-				if ( $xt <= 20 ) {
1262
-					$meta_key .= $tag->name . ", ";
1260
+			foreach ($tags as $tag) {
1261
+				if ($xt <= 20) {
1262
+					$meta_key .= $tag->name.", ";
1263 1263
 				}
1264 1264
 
1265
-				$xt ++;
1265
+				$xt++;
1266 1266
 			}
1267 1267
 		}
1268 1268
 	}
1269 1269
 
1270
-	$meta_key         = $meta_key != '' ? rtrim( trim( $meta_key ), "," ) : $meta_key;
1271
-	$geodir_meta_keys = $geodir_meta_keys != '' ? ( $meta_key != '' ? $meta_key . ', ' . $geodir_meta_keys : $geodir_meta_keys ) : $meta_key;
1272
-	if ( $geodir_meta_keys != '' ) {
1273
-		$geodir_meta_keys = strip_tags( $geodir_meta_keys );
1274
-		$geodir_meta_keys = esc_html( $geodir_meta_keys );
1275
-		$geodir_meta_keys = geodir_strtolower( $geodir_meta_keys );
1276
-		$geodir_meta_keys = wp_html_excerpt( $geodir_meta_keys, 1000, '' );
1277
-		$geodir_meta_keys = str_replace( '%location%', $replace_location, $geodir_meta_keys );
1270
+	$meta_key         = $meta_key != '' ? rtrim(trim($meta_key), ",") : $meta_key;
1271
+	$geodir_meta_keys = $geodir_meta_keys != '' ? ($meta_key != '' ? $meta_key.', '.$geodir_meta_keys : $geodir_meta_keys) : $meta_key;
1272
+	if ($geodir_meta_keys != '') {
1273
+		$geodir_meta_keys = strip_tags($geodir_meta_keys);
1274
+		$geodir_meta_keys = esc_html($geodir_meta_keys);
1275
+		$geodir_meta_keys = geodir_strtolower($geodir_meta_keys);
1276
+		$geodir_meta_keys = wp_html_excerpt($geodir_meta_keys, 1000, '');
1277
+		$geodir_meta_keys = str_replace('%location%', $replace_location, $geodir_meta_keys);
1278 1278
 
1279
-		$meta_key = rtrim( trim( $geodir_meta_keys ), "," );
1279
+		$meta_key = rtrim(trim($geodir_meta_keys), ",");
1280 1280
 	}
1281 1281
 
1282
-	if ( $meta_key ) {
1283
-		$meta_key = stripslashes_deep( $meta_key );
1282
+	if ($meta_key) {
1283
+		$meta_key = stripslashes_deep($meta_key);
1284 1284
 		/**
1285 1285
 		 * Filter SEO meta keywords.
1286 1286
 		 *
@@ -1288,7 +1288,7 @@  discard block
 block discarded – undo
1288 1288
 		 *
1289 1289
 		 * @param string $meta_desc Meta keywords.
1290 1290
 		 */
1291
-		echo apply_filters( 'geodir_seo_meta_keywords', '<meta name="keywords" content="' . $meta_key . '" />', $meta_key );
1291
+		echo apply_filters('geodir_seo_meta_keywords', '<meta name="keywords" content="'.$meta_key.'" />', $meta_key);
1292 1292
 	}
1293 1293
 
1294 1294
 }
@@ -1308,8 +1308,8 @@  discard block
 block discarded – undo
1308 1308
 
1309 1309
 	$geodir_detail_page_tabs_array = geodir_detail_page_tabs_array();
1310 1310
 
1311
-	foreach ( $geodir_detail_page_tabs_array as $key => $tabs_obj ) {
1312
-		$geodir_detail_page_tabs_key_value_array[ $key ] = $tabs_obj['heading_text'];
1311
+	foreach ($geodir_detail_page_tabs_array as $key => $tabs_obj) {
1312
+		$geodir_detail_page_tabs_key_value_array[$key] = $tabs_obj['heading_text'];
1313 1313
 	}
1314 1314
 
1315 1315
 	return $geodir_detail_page_tabs_key_value_array;
@@ -1331,57 +1331,57 @@  discard block
 block discarded – undo
1331 1331
 	 * @since 1.0.0
1332 1332
 	 */
1333 1333
 	$arr_tabs['post_profile'] = array(
1334
-		'heading_text'  => __( 'Profile', 'geodirectory' ),
1334
+		'heading_text'  => __('Profile', 'geodirectory'),
1335 1335
 		'is_active_tab' => true,
1336
-		'is_display'    => apply_filters( 'geodir_detail_page_tab_is_display', true, 'post_profile' ),
1336
+		'is_display'    => apply_filters('geodir_detail_page_tab_is_display', true, 'post_profile'),
1337 1337
 		'tab_content'   => ''
1338 1338
 	);
1339
-	$arr_tabs['post_info']    = array(
1340
-		'heading_text'  => __( 'More Info', 'geodirectory' ),
1339
+	$arr_tabs['post_info'] = array(
1340
+		'heading_text'  => __('More Info', 'geodirectory'),
1341 1341
 		'is_active_tab' => false,
1342
-		'is_display'    => apply_filters( 'geodir_detail_page_tab_is_display', true, 'post_info' ),
1342
+		'is_display'    => apply_filters('geodir_detail_page_tab_is_display', true, 'post_info'),
1343 1343
 		'tab_content'   => ''
1344 1344
 	);
1345 1345
 
1346 1346
 	$arr_tabs['post_images'] = array(
1347
-		'heading_text'  => __( 'Photos', 'geodirectory' ),
1347
+		'heading_text'  => __('Photos', 'geodirectory'),
1348 1348
 		'is_active_tab' => false,
1349
-		'is_display'    => apply_filters( 'geodir_detail_page_tab_is_display', true, 'post_images' ),
1349
+		'is_display'    => apply_filters('geodir_detail_page_tab_is_display', true, 'post_images'),
1350 1350
 		'tab_content'   => ''
1351 1351
 	);
1352 1352
 
1353 1353
 	$arr_tabs['post_video'] = array(
1354
-		'heading_text'  => __( 'Video', 'geodirectory' ),
1354
+		'heading_text'  => __('Video', 'geodirectory'),
1355 1355
 		'is_active_tab' => false,
1356
-		'is_display'    => apply_filters( 'geodir_detail_page_tab_is_display', true, 'post_video' ),
1356
+		'is_display'    => apply_filters('geodir_detail_page_tab_is_display', true, 'post_video'),
1357 1357
 		'tab_content'   => ''
1358 1358
 	);
1359 1359
 
1360 1360
 	$arr_tabs['special_offers'] = array(
1361
-		'heading_text'  => __( 'Special Offers', 'geodirectory' ),
1361
+		'heading_text'  => __('Special Offers', 'geodirectory'),
1362 1362
 		'is_active_tab' => false,
1363
-		'is_display'    => apply_filters( 'geodir_detail_page_tab_is_display', true, 'special_offers' ),
1363
+		'is_display'    => apply_filters('geodir_detail_page_tab_is_display', true, 'special_offers'),
1364 1364
 		'tab_content'   => ''
1365 1365
 	);
1366 1366
 
1367 1367
 	$arr_tabs['post_map'] = array(
1368
-		'heading_text'  => __( 'Map', 'geodirectory' ),
1368
+		'heading_text'  => __('Map', 'geodirectory'),
1369 1369
 		'is_active_tab' => false,
1370
-		'is_display'    => apply_filters( 'geodir_detail_page_tab_is_display', true, 'post_map' ),
1370
+		'is_display'    => apply_filters('geodir_detail_page_tab_is_display', true, 'post_map'),
1371 1371
 		'tab_content'   => ''
1372 1372
 	);
1373 1373
 
1374 1374
 	$arr_tabs['reviews'] = array(
1375
-		'heading_text'  => __( 'Reviews', 'geodirectory' ),
1375
+		'heading_text'  => __('Reviews', 'geodirectory'),
1376 1376
 		'is_active_tab' => false,
1377
-		'is_display'    => apply_filters( 'geodir_detail_page_tab_is_display', true, 'reviews' ),
1377
+		'is_display'    => apply_filters('geodir_detail_page_tab_is_display', true, 'reviews'),
1378 1378
 		'tab_content'   => 'review display'
1379 1379
 	);
1380 1380
 
1381 1381
 	$arr_tabs['related_listing'] = array(
1382
-		'heading_text'  => __( 'Related Listing', 'geodirectory' ),
1382
+		'heading_text'  => __('Related Listing', 'geodirectory'),
1383 1383
 		'is_active_tab' => false,
1384
-		'is_display'    => apply_filters( 'geodir_detail_page_tab_is_display', true, 'related_listing' ),
1384
+		'is_display'    => apply_filters('geodir_detail_page_tab_is_display', true, 'related_listing'),
1385 1385
 		'tab_content'   => ''
1386 1386
 	);
1387 1387
 
@@ -1390,7 +1390,7 @@  discard block
 block discarded – undo
1390 1390
 	 *
1391 1391
 	 * @since 1.0.0
1392 1392
 	 */
1393
-	return apply_filters( 'geodir_detail_page_tab_list_extend', $arr_tabs );
1393
+	return apply_filters('geodir_detail_page_tab_list_extend', $arr_tabs);
1394 1394
 
1395 1395
 
1396 1396
 }
@@ -1404,13 +1404,13 @@  discard block
 block discarded – undo
1404 1404
  * @return mixed|array Tabs array.
1405 1405
  */
1406 1406
 function geodir_detail_page_tabs_list() {
1407
-	$tabs_excluded = get_option( 'geodir_detail_page_tabs_excluded' );
1407
+	$tabs_excluded = get_option('geodir_detail_page_tabs_excluded');
1408 1408
 	$tabs_array    = geodir_detail_page_tabs_array();
1409 1409
 
1410
-	if ( ! empty( $tabs_excluded ) ) {
1411
-		foreach ( $tabs_excluded as $tab ) {
1412
-			if ( array_key_exists( $tab, $tabs_array ) ) {
1413
-				unset( $tabs_array[ $tab ] );
1410
+	if (!empty($tabs_excluded)) {
1411
+		foreach ($tabs_excluded as $tab) {
1412
+			if (array_key_exists($tab, $tabs_array)) {
1413
+				unset($tabs_array[$tab]);
1414 1414
 			}
1415 1415
 		}
1416 1416
 	}
@@ -1434,58 +1434,58 @@  discard block
 block discarded – undo
1434 1434
 function geodir_show_detail_page_tabs() {
1435 1435
 	global $post, $post_images, $video, $special_offers, $related_listing, $geodir_post_detail_fields, $preview;
1436 1436
 
1437
-	$post_id            = ! empty( $post ) && isset( $post->ID ) ? (int) $post->ID : 0;
1438
-	$request_post_id    = ! empty( $_REQUEST['p'] ) ? (int) $_REQUEST['p'] : 0;
1439
-	$is_backend_preview = ( is_single() && ! empty( $_REQUEST['post_type'] ) && ! empty( $_REQUEST['preview'] ) && ! empty( $_REQUEST['p'] ) ) && is_super_admin() ? true : false; // skip if preview from backend
1437
+	$post_id            = !empty($post) && isset($post->ID) ? (int) $post->ID : 0;
1438
+	$request_post_id    = !empty($_REQUEST['p']) ? (int) $_REQUEST['p'] : 0;
1439
+	$is_backend_preview = (is_single() && !empty($_REQUEST['post_type']) && !empty($_REQUEST['preview']) && !empty($_REQUEST['p'])) && is_super_admin() ? true : false; // skip if preview from backend
1440 1440
 
1441
-	if ( $is_backend_preview && ! $post_id > 0 && $request_post_id > 0 ) {
1442
-		$post = geodir_get_post_info( $request_post_id );
1443
-		setup_postdata( $post );
1441
+	if ($is_backend_preview && !$post_id > 0 && $request_post_id > 0) {
1442
+		$post = geodir_get_post_info($request_post_id);
1443
+		setup_postdata($post);
1444 1444
 	}
1445 1445
 
1446
-	$geodir_post_detail_fields = geodir_show_listing_info( 'moreinfo' );
1446
+	$geodir_post_detail_fields = geodir_show_listing_info('moreinfo');
1447 1447
 
1448 1448
 
1449
-	if ( geodir_is_page( 'detail' ) ) {
1450
-		$video                 = geodir_get_video( $post->ID );
1451
-		$special_offers        = geodir_get_special_offers( $post->ID );
1449
+	if (geodir_is_page('detail')) {
1450
+		$video                 = geodir_get_video($post->ID);
1451
+		$special_offers        = geodir_get_special_offers($post->ID);
1452 1452
 		$related_listing_array = array();
1453
-		if ( get_option( 'geodir_add_related_listing_posttypes' ) ) {
1454
-			$related_listing_array = get_option( 'geodir_add_related_listing_posttypes' );
1453
+		if (get_option('geodir_add_related_listing_posttypes')) {
1454
+			$related_listing_array = get_option('geodir_add_related_listing_posttypes');
1455 1455
 		}
1456 1456
 
1457 1457
 
1458
-		$excluded_tabs = get_option( 'geodir_detail_page_tabs_excluded' );
1459
-		if ( ! $excluded_tabs ) {
1458
+		$excluded_tabs = get_option('geodir_detail_page_tabs_excluded');
1459
+		if (!$excluded_tabs) {
1460 1460
 			$excluded_tabs = array();
1461 1461
 		}
1462 1462
 
1463 1463
 		$related_listing = '';
1464
-		if ( in_array( $post->post_type, $related_listing_array ) && ! in_array( 'related_listing', $excluded_tabs ) ) {
1464
+		if (in_array($post->post_type, $related_listing_array) && !in_array('related_listing', $excluded_tabs)) {
1465 1465
 			$request = array(
1466
-				'post_number'         => get_option( 'geodir_related_post_count' ),
1467
-				'relate_to'           => get_option( 'geodir_related_post_relate_to' ),
1468
-				'layout'              => get_option( 'geodir_related_post_listing_view' ),
1469
-				'add_location_filter' => get_option( 'geodir_related_post_location_filter' ),
1470
-				'list_sort'           => get_option( 'geodir_related_post_sortby' ),
1471
-				'character_count'     => get_option( 'geodir_related_post_excerpt' )
1466
+				'post_number'         => get_option('geodir_related_post_count'),
1467
+				'relate_to'           => get_option('geodir_related_post_relate_to'),
1468
+				'layout'              => get_option('geodir_related_post_listing_view'),
1469
+				'add_location_filter' => get_option('geodir_related_post_location_filter'),
1470
+				'list_sort'           => get_option('geodir_related_post_sortby'),
1471
+				'character_count'     => get_option('geodir_related_post_excerpt')
1472 1472
 			);
1473 1473
 
1474
-			if ( $post->post_type == 'gd_event' && defined( 'GDEVENTS_VERSION' ) ) {
1475
-				$related_listing = geodir_get_detail_page_related_events( $request );
1474
+			if ($post->post_type == 'gd_event' && defined('GDEVENTS_VERSION')) {
1475
+				$related_listing = geodir_get_detail_page_related_events($request);
1476 1476
 			} else {
1477
-				$related_listing = geodir_related_posts_display( $request );
1477
+				$related_listing = geodir_related_posts_display($request);
1478 1478
 			}
1479 1479
 
1480 1480
 		}
1481 1481
 
1482
-		$post_images = geodir_get_images( $post->ID, 'thumbnail' );
1482
+		$post_images = geodir_get_images($post->ID, 'thumbnail');
1483 1483
 		$thumb_image = '';
1484
-		if ( ! empty( $post_images ) ) {
1485
-			foreach ( $post_images as $image ) {
1486
-				$caption = ( ! empty( $image->caption ) ) ? $image->caption : '';
1487
-				$thumb_image .= '<a href="' . $image->src . '" title="' . $caption . '">';
1488
-				$thumb_image .= geodir_show_image( $image, 'thumbnail', true, false );
1484
+		if (!empty($post_images)) {
1485
+			foreach ($post_images as $image) {
1486
+				$caption = (!empty($image->caption)) ? $image->caption : '';
1487
+				$thumb_image .= '<a href="'.$image->src.'" title="'.$caption.'">';
1488
+				$thumb_image .= geodir_show_image($image, 'thumbnail', true, false);
1489 1489
 				$thumb_image .= '</a>';
1490 1490
 			}
1491 1491
 		}
@@ -1494,11 +1494,11 @@  discard block
 block discarded – undo
1494 1494
 		$map_args['map_canvas_name'] = 'detail_page_map_canvas';
1495 1495
 		$map_args['width']           = '600';
1496 1496
 		$map_args['height']          = '300';
1497
-		if ( $post->post_mapzoom ) {
1498
-			$map_args['zoom'] = '' . $post->post_mapzoom . '';
1497
+		if ($post->post_mapzoom) {
1498
+			$map_args['zoom'] = ''.$post->post_mapzoom.'';
1499 1499
 		}
1500 1500
 		$map_args['autozoom']                 = false;
1501
-		$map_args['scrollwheel']              = ( get_option( 'geodir_add_listing_mouse_scroll' ) ) ? 0 : 1;
1501
+		$map_args['scrollwheel']              = (get_option('geodir_add_listing_mouse_scroll')) ? 0 : 1;
1502 1502
 		$map_args['child_collapse']           = '0';
1503 1503
 		$map_args['enable_cat_filters']       = false;
1504 1504
 		$map_args['enable_text_search']       = false;
@@ -1507,43 +1507,43 @@  discard block
 block discarded – undo
1507 1507
 		$map_args['enable_jason_on_load']     = true;
1508 1508
 		$map_args['enable_map_direction']     = true;
1509 1509
 		$map_args['map_class_name']           = 'geodir-map-detail-page';
1510
-		$map_args['maptype']                  = ( ! empty( $post->post_mapview ) ) ? $post->post_mapview : 'ROADMAP';
1511
-	} else if ( geodir_is_page( 'preview' ) ) {
1512
-		$video          = isset( $post->geodir_video ) ? $post->geodir_video : '';
1513
-		$special_offers = isset( $post->geodir_special_offers ) ? $post->geodir_special_offers : '';
1510
+		$map_args['maptype']                  = (!empty($post->post_mapview)) ? $post->post_mapview : 'ROADMAP';
1511
+	} else if (geodir_is_page('preview')) {
1512
+		$video          = isset($post->geodir_video) ? $post->geodir_video : '';
1513
+		$special_offers = isset($post->geodir_special_offers) ? $post->geodir_special_offers : '';
1514 1514
 
1515
-		if ( isset( $post->post_images ) ) {
1516
-			$post->post_images = trim( $post->post_images, "," );
1515
+		if (isset($post->post_images)) {
1516
+			$post->post_images = trim($post->post_images, ",");
1517 1517
 		}
1518 1518
 
1519
-		if ( isset( $post->post_images ) && ! empty( $post->post_images ) ) {
1520
-			$post_images = explode( ",", $post->post_images );
1519
+		if (isset($post->post_images) && !empty($post->post_images)) {
1520
+			$post_images = explode(",", $post->post_images);
1521 1521
 		}
1522 1522
 
1523 1523
 		$thumb_image = '';
1524
-		if ( ! empty( $post_images ) ) {
1525
-			foreach ( $post_images as $image ) {
1526
-				if ( $image != '' ) {
1527
-					$thumb_image .= '<a href="' . $image . '">';
1528
-					$thumb_image .= geodir_show_image( array( 'src' => $image ), 'thumbnail', true, false );
1524
+		if (!empty($post_images)) {
1525
+			foreach ($post_images as $image) {
1526
+				if ($image != '') {
1527
+					$thumb_image .= '<a href="'.$image.'">';
1528
+					$thumb_image .= geodir_show_image(array('src' => $image), 'thumbnail', true, false);
1529 1529
 					$thumb_image .= '</a>';
1530 1530
 				}
1531 1531
 			}
1532 1532
 		}
1533 1533
 
1534 1534
 		global $map_jason;
1535
-		$marker_json      = $post->marker_json != '' ? json_decode( $post->marker_json, true ) : array();
1536
-		$marker_icon      = ( ! empty( $marker_json ) && ! empty( $marker_json['i'] ) ) ? $marker_json['i'] : '';
1537
-		$icon_size        = geodir_get_marker_size( $marker_icon );
1535
+		$marker_json      = $post->marker_json != '' ? json_decode($post->marker_json, true) : array();
1536
+		$marker_icon      = (!empty($marker_json) && !empty($marker_json['i'])) ? $marker_json['i'] : '';
1537
+		$icon_size        = geodir_get_marker_size($marker_icon);
1538 1538
 		$marker_json['w'] = $icon_size['w'];
1539 1539
 		$marker_json['h'] = $icon_size['h'];
1540
-		$map_jason[]      = json_encode( $marker_json );
1540
+		$map_jason[]      = json_encode($marker_json);
1541 1541
 
1542
-		$address_latitude  = isset( $post->post_latitude ) ? $post->post_latitude : '';
1543
-		$address_longitude = isset( $post->post_longitude ) ? $post->post_longitude : '';
1544
-		$mapview           = isset( $post->post_mapview ) ? $post->post_mapview : '';
1545
-		$mapzoom           = isset( $post->post_mapzoom ) ? $post->post_mapzoom : '';
1546
-		if ( ! $mapzoom ) {
1542
+		$address_latitude  = isset($post->post_latitude) ? $post->post_latitude : '';
1543
+		$address_longitude = isset($post->post_longitude) ? $post->post_longitude : '';
1544
+		$mapview           = isset($post->post_mapview) ? $post->post_mapview : '';
1545
+		$mapzoom           = isset($post->post_mapzoom) ? $post->post_mapzoom : '';
1546
+		if (!$mapzoom) {
1547 1547
 			$mapzoom = 12;
1548 1548
 		}
1549 1549
 
@@ -1566,37 +1566,37 @@  discard block
 block discarded – undo
1566 1566
 		$map_args['map_class_name']           = 'geodir-map-preview-page';
1567 1567
 	}
1568 1568
 
1569
-	$arr_detail_page_tabs = geodir_detail_page_tabs_list();// get this sooner so we can get the active tab for the user
1569
+	$arr_detail_page_tabs = geodir_detail_page_tabs_list(); // get this sooner so we can get the active tab for the user
1570 1570
 
1571 1571
 	$active_tab       = '';
1572 1572
 	$active_tab_name  = '';
1573 1573
 	$default_tab      = '';
1574 1574
 	$default_tab_name = '';
1575
-	foreach ( $arr_detail_page_tabs as $tab_index => $tabs ) {
1576
-		if ( isset( $tabs['is_active_tab'] ) && $tabs['is_active_tab'] && ! empty( $tabs['is_display'] ) && isset( $tabs['heading_text'] ) && $tabs['heading_text'] ) {
1575
+	foreach ($arr_detail_page_tabs as $tab_index => $tabs) {
1576
+		if (isset($tabs['is_active_tab']) && $tabs['is_active_tab'] && !empty($tabs['is_display']) && isset($tabs['heading_text']) && $tabs['heading_text']) {
1577 1577
 			$active_tab      = $tab_index;
1578
-			$active_tab_name = __( $tabs['heading_text'], 'geodirectory' );
1578
+			$active_tab_name = __($tabs['heading_text'], 'geodirectory');
1579 1579
 		}
1580 1580
 
1581
-		if ( $default_tab === '' && ! empty( $tabs['is_display'] ) && ! empty( $tabs['heading_text'] ) ) {
1581
+		if ($default_tab === '' && !empty($tabs['is_display']) && !empty($tabs['heading_text'])) {
1582 1582
 			$default_tab      = $tab_index;
1583
-			$default_tab_name = __( $tabs['heading_text'], 'geodirectory' );
1583
+			$default_tab_name = __($tabs['heading_text'], 'geodirectory');
1584 1584
 		}
1585 1585
 	}
1586 1586
 
1587
-	if ( $active_tab === '' && $default_tab !== '' ) { // Make first tab as a active tab if not any tab is active.
1588
-		if ( isset( $arr_detail_page_tabs[ $active_tab ] ) && isset( $arr_detail_page_tabs[ $active_tab ]['is_active_tab'] ) ) {
1589
-			$arr_detail_page_tabs[ $active_tab ]['is_active_tab'] = false;
1587
+	if ($active_tab === '' && $default_tab !== '') { // Make first tab as a active tab if not any tab is active.
1588
+		if (isset($arr_detail_page_tabs[$active_tab]) && isset($arr_detail_page_tabs[$active_tab]['is_active_tab'])) {
1589
+			$arr_detail_page_tabs[$active_tab]['is_active_tab'] = false;
1590 1590
 		}
1591 1591
 
1592
-		$arr_detail_page_tabs[ $default_tab ]['is_active_tab'] = true;
1592
+		$arr_detail_page_tabs[$default_tab]['is_active_tab'] = true;
1593 1593
 		$active_tab                                            = $default_tab;
1594 1594
 		$active_tab_name                                       = $default_tab_name;
1595 1595
 	}
1596
-	$tab_list = ( get_option( 'geodir_disable_tabs', false ) ) ? true : false;
1596
+	$tab_list = (get_option('geodir_disable_tabs', false)) ? true : false;
1597 1597
 	?>
1598 1598
 	<div class="geodir-tabs" id="gd-tabs" style="position:relative;">
1599
-		<?php if ( ! $tab_list ){ ?>
1599
+		<?php if (!$tab_list) { ?>
1600 1600
 		<div id="geodir-tab-mobile-menu">
1601 1601
 			<i class="fa fa-bars"></i>
1602 1602
 			<span class="geodir-mobile-active-tab"><?php echo $active_tab_name; ?></span>
@@ -1611,26 +1611,26 @@  discard block
 block discarded – undo
1611 1611
 			 * @since 1.0.0
1612 1612
 			 * @see   'geodir_after_tab_list'
1613 1613
 			 */
1614
-			do_action( 'geodir_before_tab_list' ); ?>
1614
+			do_action('geodir_before_tab_list'); ?>
1615 1615
 			<?php
1616 1616
 
1617
-			foreach ( $arr_detail_page_tabs as $tab_index => $detail_page_tab ) {
1618
-				if ( $detail_page_tab['is_display'] ) {
1617
+			foreach ($arr_detail_page_tabs as $tab_index => $detail_page_tab) {
1618
+				if ($detail_page_tab['is_display']) {
1619 1619
 
1620
-					if ( ! $tab_list ) {
1620
+					if (!$tab_list) {
1621 1621
 						?>
1622 1622
 						<dt></dt> <!-- added to comply with validation -->
1623
-						<dd <?php if ( $detail_page_tab['is_active_tab'] ){ ?>class="geodir-tab-active"<?php } ?> ><a
1623
+						<dd <?php if ($detail_page_tab['is_active_tab']) { ?>class="geodir-tab-active"<?php } ?> ><a
1624 1624
 								data-tab="#<?php echo $tab_index; ?>"
1625
-								data-status="enable"><?php _e( $detail_page_tab['heading_text'], 'geodirectory' ); ?></a>
1625
+								data-status="enable"><?php _e($detail_page_tab['heading_text'], 'geodirectory'); ?></a>
1626 1626
 						</dd>
1627 1627
 						<?php
1628 1628
 					}
1629 1629
 					ob_start() // start tab content buffering
1630 1630
 					?>
1631 1631
 					<li id="<?php echo $tab_index; ?>Tab">
1632
-						<?php if ( $tab_list ) {
1633
-							$tab_title = '<span class="gd-tab-list-title" ><a href="#' . $tab_index . '">' . __( $detail_page_tab['heading_text'], 'geodirectory' ) . '</a></span><hr />';
1632
+						<?php if ($tab_list) {
1633
+							$tab_title = '<span class="gd-tab-list-title" ><a href="#'.$tab_index.'">'.__($detail_page_tab['heading_text'], 'geodirectory').'</a></span><hr />';
1634 1634
 							/**
1635 1635
 							 * Filter the tab list title html.
1636 1636
 							 *
@@ -1640,7 +1640,7 @@  discard block
 block discarded – undo
1640 1640
 							 * @param string $tab_index      The tab index type.
1641 1641
 							 * @param array $detail_page_tab The array of values including title text.
1642 1642
 							 */
1643
-							echo apply_filters( 'geodir_tab_list_title', $tab_title, $tab_index, $detail_page_tab );
1643
+							echo apply_filters('geodir_tab_list_title', $tab_title, $tab_index, $detail_page_tab);
1644 1644
 						} ?>
1645 1645
 						<div id="<?php echo $tab_index; ?>" class="hash-offset"></div>
1646 1646
 						<?php
@@ -1651,7 +1651,7 @@  discard block
 block discarded – undo
1651 1651
 						 *
1652 1652
 						 * @param string $tab_index The tab name ID.
1653 1653
 						 */
1654
-						do_action( 'geodir_before_tab_content', $tab_index );
1654
+						do_action('geodir_before_tab_content', $tab_index);
1655 1655
 
1656 1656
 						/**
1657 1657
 						 * Called before the details tab content is output per tab.
@@ -1661,21 +1661,21 @@  discard block
 block discarded – undo
1661 1661
 						 * @since 1.0.0
1662 1662
 						 * @todo  do we need this if we have the hook above? 'geodir_before_tab_content'
1663 1663
 						 */
1664
-						do_action( 'geodir_before_' . $tab_index . '_tab_content' );
1664
+						do_action('geodir_before_'.$tab_index.'_tab_content');
1665 1665
 						/// write a code to generate content of each tab
1666
-						switch ( $tab_index ) {
1666
+						switch ($tab_index) {
1667 1667
 							case 'post_profile':
1668 1668
 								/**
1669 1669
 								 * Called before the listing description content on the details page tab.
1670 1670
 								 *
1671 1671
 								 * @since 1.0.0
1672 1672
 								 */
1673
-								do_action( 'geodir_before_description_on_listing_detail' );
1674
-								if ( geodir_is_page( 'detail' ) ) {
1673
+								do_action('geodir_before_description_on_listing_detail');
1674
+								if (geodir_is_page('detail')) {
1675 1675
 									the_content();
1676 1676
 								} else {
1677 1677
 									/** This action is documented in geodirectory_template_actions.php */
1678
-									echo apply_filters( 'the_content', stripslashes( $post->post_desc ) );
1678
+									echo apply_filters('the_content', stripslashes($post->post_desc));
1679 1679
 								}
1680 1680
 
1681 1681
 								/**
@@ -1683,7 +1683,7 @@  discard block
 block discarded – undo
1683 1683
 								 *
1684 1684
 								 * @since 1.0.0
1685 1685
 								 */
1686
-								do_action( 'geodir_after_description_on_listing_detail' );
1686
+								do_action('geodir_after_description_on_listing_detail');
1687 1687
 								break;
1688 1688
 							case 'post_info':
1689 1689
 								echo $geodir_post_detail_fields;
@@ -1693,32 +1693,32 @@  discard block
 block discarded – undo
1693 1693
 								break;
1694 1694
 							case 'post_video':
1695 1695
 								// some browsers hide $_POST data if used for embeds so we replace with a placeholder
1696
-								if ( $preview ) {
1697
-									if ( $video ) {
1698
-										echo "<span class='gd-video-embed-preview' ><p class='gd-video-preview-text'><i class=\"fa fa-video-camera\" aria-hidden=\"true\"></i><br />" . __( 'Video Preview Placeholder', 'geodirectory' ) . "</p></span>";
1696
+								if ($preview) {
1697
+									if ($video) {
1698
+										echo "<span class='gd-video-embed-preview' ><p class='gd-video-preview-text'><i class=\"fa fa-video-camera\" aria-hidden=\"true\"></i><br />".__('Video Preview Placeholder', 'geodirectory')."</p></span>";
1699 1699
 									}
1700 1700
 								} else {
1701 1701
 
1702 1702
 									// stop payment manager filtering content length
1703
-									$filter_priority = has_filter( 'the_content', 'geodir_payments_the_content' );
1704
-									if ( false !== $filter_priority ) {
1705
-										remove_filter( 'the_content', 'geodir_payments_the_content', $filter_priority );
1703
+									$filter_priority = has_filter('the_content', 'geodir_payments_the_content');
1704
+									if (false !== $filter_priority) {
1705
+										remove_filter('the_content', 'geodir_payments_the_content', $filter_priority);
1706 1706
 									}
1707 1707
 
1708 1708
 									/** This action is documented in geodirectory_template_actions.php */
1709
-									echo apply_filters( 'the_content', stripslashes( $video ) );// we apply the_content filter so oembed works also;
1709
+									echo apply_filters('the_content', stripslashes($video)); // we apply the_content filter so oembed works also;
1710 1710
 
1711
-									if ( false !== $filter_priority ) {
1712
-										add_filter( 'the_content', 'geodir_payments_the_content', $filter_priority );
1711
+									if (false !== $filter_priority) {
1712
+										add_filter('the_content', 'geodir_payments_the_content', $filter_priority);
1713 1713
 									}
1714 1714
 								}
1715 1715
 								break;
1716 1716
 							case 'special_offers':
1717
-								echo apply_filters( 'gd_special_offers_content', wpautop( stripslashes( $special_offers ) ) );
1717
+								echo apply_filters('gd_special_offers_content', wpautop(stripslashes($special_offers)));
1718 1718
 
1719 1719
 								break;
1720 1720
 							case 'post_map':
1721
-								geodir_draw_map( $map_args );
1721
+								geodir_draw_map($map_args);
1722 1722
 								break;
1723 1723
 							case 'reviews':
1724 1724
 								comments_template();
@@ -1727,7 +1727,7 @@  discard block
 block discarded – undo
1727 1727
 								echo $related_listing;
1728 1728
 								break;
1729 1729
 							default: {
1730
-								if ( ( isset( $post->{$tab_index} ) || ( ! isset( $post->{$tab_index} ) && ( strpos( $tab_index, 'gd_tab_' ) !== false || $tab_index == 'link_business' ) ) ) && ! empty( $detail_page_tab['tab_content'] ) ) {
1730
+								if ((isset($post->{$tab_index} ) || (!isset($post->{$tab_index} ) && (strpos($tab_index, 'gd_tab_') !== false || $tab_index == 'link_business'))) && !empty($detail_page_tab['tab_content'])) {
1731 1731
 									echo $detail_page_tab['tab_content'];
1732 1732
 								}
1733 1733
 							}
@@ -1739,7 +1739,7 @@  discard block
 block discarded – undo
1739 1739
 						 *
1740 1740
 						 * @since 1.0.0
1741 1741
 						 */
1742
-						do_action( 'geodir_after_tab_content', $tab_index );
1742
+						do_action('geodir_after_tab_content', $tab_index);
1743 1743
 
1744 1744
 						/**
1745 1745
 						 * Called after the details tab content is output per tab.
@@ -1749,7 +1749,7 @@  discard block
 block discarded – undo
1749 1749
 						 * @since 1.0.0
1750 1750
 						 * @todo  do we need this if we have the hook above? 'geodir_after_tab_content'
1751 1751
 						 */
1752
-						do_action( 'geodir_after_' . $tab_index . '_tab_content' );
1752
+						do_action('geodir_after_'.$tab_index.'_tab_content');
1753 1753
 						?> </li>
1754 1754
 					<?php
1755 1755
 					/**
@@ -1757,7 +1757,7 @@  discard block
 block discarded – undo
1757 1757
 					 *
1758 1758
 					 * @since 1.0.0
1759 1759
 					 */
1760
-					$arr_detail_page_tabs[ $tab_index ]['tab_content'] = apply_filters( "geodir_modify_" . $detail_page_tab['tab_content'] . "_tab_content", ob_get_clean() );
1760
+					$arr_detail_page_tabs[$tab_index]['tab_content'] = apply_filters("geodir_modify_".$detail_page_tab['tab_content']."_tab_content", ob_get_clean());
1761 1761
 				} // end of if for is_display
1762 1762
 			}// end of foreach
1763 1763
 
@@ -1767,14 +1767,14 @@  discard block
 block discarded – undo
1767 1767
 			 * @since 1.0.0
1768 1768
 			 * @see   'geodir_before_tab_list'
1769 1769
 			 */
1770
-			do_action( 'geodir_after_tab_list' );
1770
+			do_action('geodir_after_tab_list');
1771 1771
 			?>
1772
-			<?php if ( ! $tab_list ){ ?></dl><?php } ?>
1773
-		<ul class="geodir-tabs-content entry-content <?php if ( $tab_list ) { ?>geodir-tabs-list<?php } ?>"
1772
+			<?php if (!$tab_list) { ?></dl><?php } ?>
1773
+		<ul class="geodir-tabs-content entry-content <?php if ($tab_list) { ?>geodir-tabs-list<?php } ?>"
1774 1774
 		    style="position:relative;">
1775 1775
 			<?php
1776
-			foreach ( $arr_detail_page_tabs as $detail_page_tab ) {
1777
-				if ( $detail_page_tab['is_display'] && ! empty( $detail_page_tab['tab_content'] ) ) {
1776
+			foreach ($arr_detail_page_tabs as $detail_page_tab) {
1777
+				if ($detail_page_tab['is_display'] && !empty($detail_page_tab['tab_content'])) {
1778 1778
 					echo $detail_page_tab['tab_content'];
1779 1779
 				}// end of if
1780 1780
 			}// end of foreach
@@ -1784,11 +1784,11 @@  discard block
 block discarded – undo
1784 1784
 			 *
1785 1785
 			 * @since 1.0.0
1786 1786
 			 */
1787
-			do_action( 'geodir_add_tab_content' ); ?>
1787
+			do_action('geodir_add_tab_content'); ?>
1788 1788
 		</ul>
1789 1789
 		<!--gd-tabs-content ul end-->
1790 1790
 	</div>
1791
-	<?php if ( ! $tab_list ) { ?>
1791
+	<?php if (!$tab_list) { ?>
1792 1792
 		<script>
1793 1793
 			if (window.location.hash && window.location.hash.indexOf('&') === -1 && jQuery(window.location.hash + 'Tab').length) {
1794 1794
 				hashVal = window.location.hash;
@@ -1820,31 +1820,31 @@  discard block
 block discarded – undo
1820 1820
  *
1821 1821
  * @return mixed Image file.
1822 1822
  */
1823
-function geodir_exif( $file ) {
1824
-	if ( empty( $file ) || ! is_array( $file ) ) {
1823
+function geodir_exif($file) {
1824
+	if (empty($file) || !is_array($file)) {
1825 1825
 		return $file;
1826 1826
 	}
1827 1827
 
1828
-	$file_path = ! empty( $file['tmp_name'] ) ? sanitize_text_field( $file['tmp_name'] ) : '';
1829
-	if ( ! ( $file_path && file_exists( $file_path ) ) ) {
1828
+	$file_path = !empty($file['tmp_name']) ? sanitize_text_field($file['tmp_name']) : '';
1829
+	if (!($file_path && file_exists($file_path))) {
1830 1830
 		return $file;
1831 1831
 	}
1832 1832
 	$file['file'] = $file_path;
1833 1833
 
1834
-	if ( ! file_is_valid_image( $file_path ) ) {
1834
+	if (!file_is_valid_image($file_path)) {
1835 1835
 		return $file; // Bail if file is not an image.
1836 1836
 	}
1837 1837
 
1838
-	if ( ! function_exists( 'wp_get_image_editor' ) ) {
1838
+	if (!function_exists('wp_get_image_editor')) {
1839 1839
 		return $file;
1840 1840
 	}
1841 1841
 
1842 1842
 	$mime_type = $file['type'];
1843 1843
 	$exif      = array();
1844
-	if ( $mime_type == 'image/jpeg' && function_exists( 'exif_read_data' ) ) {
1844
+	if ($mime_type == 'image/jpeg' && function_exists('exif_read_data')) {
1845 1845
 		try {
1846
-			$exif = exif_read_data( $file_path );
1847
-		} catch ( Exception $e ) {
1846
+			$exif = exif_read_data($file_path);
1847
+		} catch (Exception $e) {
1848 1848
 			$exif = array();
1849 1849
 		}
1850 1850
 	}
@@ -1853,13 +1853,13 @@  discard block
 block discarded – undo
1853 1853
 	$flip        = false;
1854 1854
 	$modify      = false;
1855 1855
 	$orientation = 0;
1856
-	if ( ! empty( $exif ) && isset( $exif['Orientation'] ) ) {
1857
-		switch ( (int) $exif['Orientation'] ) {
1856
+	if (!empty($exif) && isset($exif['Orientation'])) {
1857
+		switch ((int) $exif['Orientation']) {
1858 1858
 			case 1:
1859 1859
 				// do nothing
1860 1860
 				break;
1861 1861
 			case 2:
1862
-				$flip   = array( false, true );
1862
+				$flip   = array(false, true);
1863 1863
 				$modify = true;
1864 1864
 				break;
1865 1865
 			case 3:
@@ -1868,13 +1868,13 @@  discard block
 block discarded – undo
1868 1868
 				$modify      = true;
1869 1869
 				break;
1870 1870
 			case 4:
1871
-				$flip   = array( true, false );
1871
+				$flip   = array(true, false);
1872 1872
 				$modify = true;
1873 1873
 				break;
1874 1874
 			case 5:
1875 1875
 				$orientation = - 90;
1876 1876
 				$rotate      = true;
1877
-				$flip        = array( false, true );
1877
+				$flip        = array(false, true);
1878 1878
 				$modify      = true;
1879 1879
 				break;
1880 1880
 			case 6:
@@ -1885,7 +1885,7 @@  discard block
 block discarded – undo
1885 1885
 			case 7:
1886 1886
 				$orientation = - 270;
1887 1887
 				$rotate      = true;
1888
-				$flip        = array( false, true );
1888
+				$flip        = array(false, true);
1889 1889
 				$modify      = true;
1890 1890
 				break;
1891 1891
 			case 8:
@@ -1911,31 +1911,31 @@  discard block
 block discarded – undo
1911 1911
 	 * @param int|null $quality Image Compression quality between 1-100% scale. Default null.
1912 1912
 	 * @param string $quality   Image mime type.
1913 1913
 	 */
1914
-	$quality = apply_filters( 'geodir_image_upload_set_quality', $quality, $mime_type );
1915
-	if ( $quality !== null ) {
1914
+	$quality = apply_filters('geodir_image_upload_set_quality', $quality, $mime_type);
1915
+	if ($quality !== null) {
1916 1916
 		$modify = true;
1917 1917
 	}
1918 1918
 
1919
-	if ( ! $modify ) {
1919
+	if (!$modify) {
1920 1920
 		return $file; // no change
1921 1921
 	}
1922 1922
 
1923
-	$image = wp_get_image_editor( $file_path );
1924
-	if ( ! is_wp_error( $image ) ) {
1925
-		if ( $rotate ) {
1926
-			$image->rotate( $orientation );
1923
+	$image = wp_get_image_editor($file_path);
1924
+	if (!is_wp_error($image)) {
1925
+		if ($rotate) {
1926
+			$image->rotate($orientation);
1927 1927
 		}
1928 1928
 
1929
-		if ( ! empty( $flip ) ) {
1930
-			$image->flip( $flip[0], $flip[1] );
1929
+		if (!empty($flip)) {
1930
+			$image->flip($flip[0], $flip[1]);
1931 1931
 		}
1932 1932
 
1933
-		if ( $quality !== null ) {
1934
-			$image->set_quality( (int) $quality );
1933
+		if ($quality !== null) {
1934
+			$image->set_quality((int) $quality);
1935 1935
 		}
1936 1936
 
1937
-		$result = $image->save( $file_path );
1938
-		if ( ! is_wp_error( $result ) ) {
1937
+		$result = $image->save($file_path);
1938
+		if (!is_wp_error($result)) {
1939 1939
 			$file['file']     = $result['path'];
1940 1940
 			$file['tmp_name'] = $result['path'];
1941 1941
 		}
@@ -1963,7 +1963,7 @@  discard block
 block discarded – undo
1963 1963
  *
1964 1964
  * @return string Returns the recent reviews html.
1965 1965
  */
1966
-function geodir_get_recent_reviews( $g_size = 60, $no_comments = 10, $comment_lenth = 60, $show_pass_post = false ) {
1966
+function geodir_get_recent_reviews($g_size = 60, $no_comments = 10, $comment_lenth = 60, $show_pass_post = false) {
1967 1967
 	global $wpdb, $tablecomments, $tableposts, $rating_table_name, $gd_session, $table_prefix;
1968 1968
 	$tablecomments = $wpdb->comments;
1969 1969
 	$tableposts    = $wpdb->posts;
@@ -1973,17 +1973,17 @@  discard block
 block discarded – undo
1973 1973
 	$region_filter  = '';
1974 1974
 	$country_filter = '';
1975 1975
 
1976
-	if ( $gd_session->get( 'gd_multi_location' ) ) {
1977
-		if ( $gd_ses_country = $gd_session->get( 'gd_country' ) ) {
1978
-			$country_filter = $wpdb->prepare( " AND r.post_country=%s ", str_replace( "-", " ", $gd_ses_country ) );
1976
+	if ($gd_session->get('gd_multi_location')) {
1977
+		if ($gd_ses_country = $gd_session->get('gd_country')) {
1978
+			$country_filter = $wpdb->prepare(" AND r.post_country=%s ", str_replace("-", " ", $gd_ses_country));
1979 1979
 		}
1980 1980
 
1981
-		if ( $gd_ses_region = $gd_session->get( 'gd_region' ) ) {
1982
-			$region_filter = $wpdb->prepare( " AND r.post_region=%s ", str_replace( "-", " ", $gd_ses_region ) );
1981
+		if ($gd_ses_region = $gd_session->get('gd_region')) {
1982
+			$region_filter = $wpdb->prepare(" AND r.post_region=%s ", str_replace("-", " ", $gd_ses_region));
1983 1983
 		}
1984 1984
 
1985
-		if ( $gd_ses_city = $gd_session->get( 'gd_city' ) ) {
1986
-			$city_filter = $wpdb->prepare( " AND r.post_city=%s ", str_replace( "-", " ", $gd_ses_city ) );
1985
+		if ($gd_ses_city = $gd_session->get('gd_city')) {
1986
+			$city_filter = $wpdb->prepare(" AND r.post_city=%s ", str_replace("-", " ", $gd_ses_city));
1987 1987
 		}
1988 1988
 	}
1989 1989
 	
@@ -1994,84 +1994,84 @@  discard block
 block discarded – undo
1994 1994
 		$lang_code = ICL_LANGUAGE_CODE;
1995 1995
 		
1996 1996
 		if ($lang_code) {
1997
-			$join .= " JOIN " . $table_prefix . "icl_translations AS icltr2 ON icltr2.element_id = c.comment_post_ID AND p.ID = icltr2.element_id AND CONCAT('post_', p.post_type) = icltr2.element_type LEFT JOIN " . $table_prefix . "icl_translations AS icltr_comment ON icltr_comment.element_id = c.comment_ID AND icltr_comment.element_type = 'comment'";
1998
-			$where .= " AND icltr2.language_code = '" . $lang_code . "' AND (icltr_comment.language_code IS NULL OR icltr_comment.language_code = icltr2.language_code)";
1997
+			$join .= " JOIN ".$table_prefix."icl_translations AS icltr2 ON icltr2.element_id = c.comment_post_ID AND p.ID = icltr2.element_id AND CONCAT('post_', p.post_type) = icltr2.element_type LEFT JOIN ".$table_prefix."icl_translations AS icltr_comment ON icltr_comment.element_id = c.comment_ID AND icltr_comment.element_type = 'comment'";
1998
+			$where .= " AND icltr2.language_code = '".$lang_code."' AND (icltr_comment.language_code IS NULL OR icltr_comment.language_code = icltr2.language_code)";
1999 1999
 		}
2000 2000
 	}
2001 2001
 	
2002
-	$request = "SELECT r.id AS ID, r.post_type, r.comment_id AS comment_ID, r.post_date AS comment_date, r.overall_rating, r.user_id, r.post_id FROM " . GEODIR_REVIEW_TABLE . " AS r JOIN " . $wpdb->comments . " AS c ON c.comment_ID = r.comment_id JOIN " . $wpdb->posts . " AS p ON p.ID = c.comment_post_ID " . $join . " WHERE c.comment_parent = 0 AND c.comment_approved = 1 AND r.status = 1 AND r.overall_rating >= 1 AND p.post_status = 'publish' " . $where . " ORDER BY r.post_date DESC, r.id DESC LIMIT 5";
2002
+	$request = "SELECT r.id AS ID, r.post_type, r.comment_id AS comment_ID, r.post_date AS comment_date, r.overall_rating, r.user_id, r.post_id FROM ".GEODIR_REVIEW_TABLE." AS r JOIN ".$wpdb->comments." AS c ON c.comment_ID = r.comment_id JOIN ".$wpdb->posts." AS p ON p.ID = c.comment_post_ID ".$join." WHERE c.comment_parent = 0 AND c.comment_approved = 1 AND r.status = 1 AND r.overall_rating >= 1 AND p.post_status = 'publish' ".$where." ORDER BY r.post_date DESC, r.id DESC LIMIT 5";
2003 2003
 	
2004
-	$comments = $wpdb->get_results( $request );
2004
+	$comments = $wpdb->get_results($request);
2005 2005
 	
2006
-	foreach ( $comments as $comment ) {
2006
+	foreach ($comments as $comment) {
2007 2007
 		// Set the extra comment info needed.
2008
-		$comment_extra = $wpdb->get_row( "SELECT * FROM $wpdb->comments WHERE comment_ID =$comment->comment_ID" );
2008
+		$comment_extra = $wpdb->get_row("SELECT * FROM $wpdb->comments WHERE comment_ID =$comment->comment_ID");
2009 2009
 		$comment->comment_content      = $comment_extra->comment_content;
2010 2010
 		$comment->comment_author       = $comment_extra->comment_author;
2011 2011
 		$comment->comment_author_email = $comment_extra->comment_author_email;
2012 2012
 
2013 2013
 		$comment_id      = '';
2014 2014
 		$comment_id      = $comment->comment_ID;
2015
-		$comment_content = strip_tags( $comment->comment_content );
2015
+		$comment_content = strip_tags($comment->comment_content);
2016 2016
 
2017
-		$comment_content = preg_replace( '#(\\[img\\]).+(\\[\\/img\\])#', '', $comment_content );
2017
+		$comment_content = preg_replace('#(\\[img\\]).+(\\[\\/img\\])#', '', $comment_content);
2018 2018
 
2019
-		$permalink            = get_permalink( $comment->ID ) . "#comment-" . $comment->comment_ID;
2019
+		$permalink            = get_permalink($comment->ID)."#comment-".$comment->comment_ID;
2020 2020
 		$comment_author_email = $comment->comment_author_email;
2021 2021
 		$comment_post_ID      = $comment->post_id;
2022 2022
 
2023
-		$post_title        = get_the_title( $comment_post_ID );
2024
-		$permalink         = get_permalink( $comment_post_ID );
2025
-		$comment_permalink = $permalink . "#comment-" . $comment->comment_ID;
2026
-		$read_more         = '<a class="comment_excerpt" href="' . $comment_permalink . '">' . __( 'Read more', 'geodirectory' ) . '</a>';
2023
+		$post_title        = get_the_title($comment_post_ID);
2024
+		$permalink         = get_permalink($comment_post_ID);
2025
+		$comment_permalink = $permalink."#comment-".$comment->comment_ID;
2026
+		$read_more         = '<a class="comment_excerpt" href="'.$comment_permalink.'">'.__('Read more', 'geodirectory').'</a>';
2027 2027
 
2028
-		$comment_content_length = strlen( $comment_content );
2029
-		if ( $comment_content_length > $comment_lenth ) {
2030
-			$comment_excerpt = geodir_utf8_substr( $comment_content, 0, $comment_lenth ) . '... ' . $read_more;
2028
+		$comment_content_length = strlen($comment_content);
2029
+		if ($comment_content_length > $comment_lenth) {
2030
+			$comment_excerpt = geodir_utf8_substr($comment_content, 0, $comment_lenth).'... '.$read_more;
2031 2031
 		} else {
2032 2032
 			$comment_excerpt = $comment_content;
2033 2033
 		}
2034 2034
 
2035
-		if ( $comment->user_id ) {
2036
-			$user_profile_url = get_author_posts_url( $comment->user_id );
2035
+		if ($comment->user_id) {
2036
+			$user_profile_url = get_author_posts_url($comment->user_id);
2037 2037
 		} else {
2038 2038
 			$user_profile_url = '';
2039 2039
 		}
2040 2040
 
2041
-		if ( $comment_id ) {
2041
+		if ($comment_id) {
2042 2042
 			$comments_echo .= '<li class="clearfix">';
2043
-			$comments_echo .= "<span class=\"li" . $comment_id . " geodir_reviewer_image\">";
2044
-			if ( function_exists( 'get_avatar' ) ) {
2045
-				if ( ! isset( $comment->comment_type ) ) {
2046
-					if ( $user_profile_url ) {
2047
-						$comments_echo .= '<a href="' . $user_profile_url . '">';
2043
+			$comments_echo .= "<span class=\"li".$comment_id." geodir_reviewer_image\">";
2044
+			if (function_exists('get_avatar')) {
2045
+				if (!isset($comment->comment_type)) {
2046
+					if ($user_profile_url) {
2047
+						$comments_echo .= '<a href="'.$user_profile_url.'">';
2048 2048
 					}
2049
-					$comments_echo .= get_avatar( $comment->comment_author_email, $g_size, geodir_plugin_url() . '/geodirectory-assets/images/gravatar2.png' );
2050
-					if ( $user_profile_url ) {
2049
+					$comments_echo .= get_avatar($comment->comment_author_email, $g_size, geodir_plugin_url().'/geodirectory-assets/images/gravatar2.png');
2050
+					if ($user_profile_url) {
2051 2051
 						$comments_echo .= '</a>';
2052 2052
 					}
2053
-				} elseif ( ( isset( $comment->comment_type ) && $comment->comment_type == 'trackback' ) || ( isset( $comment->comment_type ) && $comment->comment_type == 'pingback' ) ) {
2054
-					if ( $user_profile_url ) {
2055
-						$comments_echo .= '<a href="' . $user_profile_url . '">';
2053
+				} elseif ((isset($comment->comment_type) && $comment->comment_type == 'trackback') || (isset($comment->comment_type) && $comment->comment_type == 'pingback')) {
2054
+					if ($user_profile_url) {
2055
+						$comments_echo .= '<a href="'.$user_profile_url.'">';
2056 2056
 					}
2057
-					$comments_echo .= get_avatar( $comment->comment_author_url, $g_size, geodir_plugin_url() . '/geodirectory-assets/images/gravatar2.png' );
2057
+					$comments_echo .= get_avatar($comment->comment_author_url, $g_size, geodir_plugin_url().'/geodirectory-assets/images/gravatar2.png');
2058 2058
 				}
2059
-			} elseif ( function_exists( 'gravatar' ) ) {
2060
-				if ( $user_profile_url ) {
2061
-					$comments_echo .= '<a href="' . $user_profile_url . '">';
2059
+			} elseif (function_exists('gravatar')) {
2060
+				if ($user_profile_url) {
2061
+					$comments_echo .= '<a href="'.$user_profile_url.'">';
2062 2062
 				}
2063 2063
 				$comments_echo .= "<img src=\"";
2064
-				if ( '' == $comment->comment_type ) {
2065
-					$comments_echo .= gravatar( $comment->comment_author_email, $g_size, geodir_plugin_url() . '/geodirectory-assets/images/gravatar2.png' );
2066
-					if ( $user_profile_url ) {
2064
+				if ('' == $comment->comment_type) {
2065
+					$comments_echo .= gravatar($comment->comment_author_email, $g_size, geodir_plugin_url().'/geodirectory-assets/images/gravatar2.png');
2066
+					if ($user_profile_url) {
2067 2067
 						$comments_echo .= '</a>';
2068 2068
 					}
2069
-				} elseif ( ( 'trackback' == $comment->comment_type ) || ( 'pingback' == $comment->comment_type ) ) {
2070
-					if ( $user_profile_url ) {
2071
-						$comments_echo .= '<a href="' . $user_profile_url . '">';
2069
+				} elseif (('trackback' == $comment->comment_type) || ('pingback' == $comment->comment_type)) {
2070
+					if ($user_profile_url) {
2071
+						$comments_echo .= '<a href="'.$user_profile_url.'">';
2072 2072
 					}
2073
-					$comments_echo .= gravatar( $comment->comment_author_url, $g_size, geodir_plugin_url() . '/geodirectory-assets/images/gravatar2.png' );
2074
-					if ( $user_profile_url ) {
2073
+					$comments_echo .= gravatar($comment->comment_author_url, $g_size, geodir_plugin_url().'/geodirectory-assets/images/gravatar2.png');
2074
+					if ($user_profile_url) {
2075 2075
 						$comments_echo .= '</a>';
2076 2076
 					}
2077 2077
 				}
@@ -2081,17 +2081,17 @@  discard block
 block discarded – undo
2081 2081
 			$comments_echo .= "</span>\n";
2082 2082
 
2083 2083
 			$comments_echo .= '<span class="geodir_reviewer_content">';
2084
-			if ( $comment->user_id ) {
2085
-				$comments_echo .= '<a href="' . get_author_posts_url( $comment->user_id ) . '">';
2084
+			if ($comment->user_id) {
2085
+				$comments_echo .= '<a href="'.get_author_posts_url($comment->user_id).'">';
2086 2086
 			}
2087
-			$comments_echo .= '<span class="geodir_reviewer_author">' . $comment->comment_author . '</span> ';
2088
-			if ( $comment->user_id ) {
2087
+			$comments_echo .= '<span class="geodir_reviewer_author">'.$comment->comment_author.'</span> ';
2088
+			if ($comment->user_id) {
2089 2089
 				$comments_echo .= '</a>';
2090 2090
 			}
2091
-			$comments_echo .= '<span class="geodir_reviewer_reviewed">' . __( 'reviewed', 'geodirectory' ) . '</span> ';
2092
-			$comments_echo .= '<a href="' . $permalink . '" class="geodir_reviewer_title">' . $post_title . '</a>';
2093
-			$comments_echo .= geodir_get_rating_stars( $comment->overall_rating, $comment_post_ID );
2094
-			$comments_echo .= '<p class="geodir_reviewer_text">' . $comment_excerpt . '';
2091
+			$comments_echo .= '<span class="geodir_reviewer_reviewed">'.__('reviewed', 'geodirectory').'</span> ';
2092
+			$comments_echo .= '<a href="'.$permalink.'" class="geodir_reviewer_title">'.$post_title.'</a>';
2093
+			$comments_echo .= geodir_get_rating_stars($comment->overall_rating, $comment_post_ID);
2094
+			$comments_echo .= '<p class="geodir_reviewer_text">'.$comment_excerpt.'';
2095 2095
 			//echo preg_replace('#(\\[img\\]).+(\\[\\/img\\])#', '', $comment_excerpt);
2096 2096
 			$comments_echo .= '</p>';
2097 2097
 
@@ -2111,25 +2111,25 @@  discard block
 block discarded – undo
2111 2111
  * @return array Returns post categories as an array.
2112 2112
  */
2113 2113
 function geodir_home_map_cats_key_value_array() {
2114
-	$post_types = geodir_get_posttypes( 'object' );
2114
+	$post_types = geodir_get_posttypes('object');
2115 2115
 
2116 2116
 	$return = array();
2117
-	if ( ! empty( $post_types ) ) {
2118
-		foreach ( $post_types as $key => $post_type ) {
2119
-			$cpt_name       = __( $post_type->labels->singular_name, 'geodirectory' );
2120
-			$post_type_name = sprintf( __( '%s Categories', 'geodirectory' ), $cpt_name );
2121
-			$taxonomies     = geodir_get_taxonomies( $key );
2122
-			$cat_taxonomy   = ! empty( $taxonomies[0] ) ? $taxonomies[0] : null;
2123
-			$cat_terms      = $cat_taxonomy ? get_terms( $cat_taxonomy ) : null;
2124
-
2125
-			if ( ! empty( $cat_terms ) ) {
2126
-				$return[ 'optgroup_start-' . $key ] = $post_type_name;
2127
-
2128
-				foreach ( $cat_terms as $cat_term ) {
2129
-					$return[ $key . '_' . $cat_term->term_id ] = $cat_term->name;
2117
+	if (!empty($post_types)) {
2118
+		foreach ($post_types as $key => $post_type) {
2119
+			$cpt_name       = __($post_type->labels->singular_name, 'geodirectory');
2120
+			$post_type_name = sprintf(__('%s Categories', 'geodirectory'), $cpt_name);
2121
+			$taxonomies     = geodir_get_taxonomies($key);
2122
+			$cat_taxonomy   = !empty($taxonomies[0]) ? $taxonomies[0] : null;
2123
+			$cat_terms      = $cat_taxonomy ? get_terms($cat_taxonomy) : null;
2124
+
2125
+			if (!empty($cat_terms)) {
2126
+				$return['optgroup_start-'.$key] = $post_type_name;
2127
+
2128
+				foreach ($cat_terms as $cat_term) {
2129
+					$return[$key.'_'.$cat_term->term_id] = $cat_term->name;
2130 2130
 				}
2131 2131
 
2132
-				$return[ 'optgroup_end-' . $key ] = $post_type_name;
2132
+				$return['optgroup_end-'.$key] = $post_type_name;
2133 2133
 			}
2134 2134
 		}
2135 2135
 	}
@@ -2145,14 +2145,14 @@  discard block
 block discarded – undo
2145 2145
  * @package GeoDirectory
2146 2146
  */
2147 2147
 function geodir_twitter_tweet_button() {
2148
-	if ( isset( $_GET['gde'] ) ) {
2149
-		$link = '?url=' . urlencode( geodir_curPageURL() );
2148
+	if (isset($_GET['gde'])) {
2149
+		$link = '?url='.urlencode(geodir_curPageURL());
2150 2150
 	} else {
2151 2151
 		$link = '';
2152 2152
 	}
2153 2153
 	?>
2154 2154
 	<a href="http://twitter.com/share<?php echo $link; ?>"
2155
-	   class="twitter-share-button"><?php _e( 'Tweet', 'geodirectory' ); ?></a>
2155
+	   class="twitter-share-button"><?php _e('Tweet', 'geodirectory'); ?></a>
2156 2156
 	<script type="text/javascript" src="//platform.twitter.com/widgets.js"></script>
2157 2157
 	<?php
2158 2158
 }
@@ -2169,10 +2169,10 @@  discard block
 block discarded – undo
2169 2169
 function geodir_fb_like_button() {
2170 2170
 	global $post;
2171 2171
 	?>
2172
-	<iframe <?php if ( isset( $_SERVER['HTTP_USER_AGENT'] ) && ( strpos( $_SERVER['HTTP_USER_AGENT'], 'MSIE' ) !== false ) ) {
2172
+	<iframe <?php if (isset($_SERVER['HTTP_USER_AGENT']) && (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false)) {
2173 2173
 		echo 'allowtransparency="true"';
2174 2174
 	} ?> class="facebook"
2175
-	     src="//www.facebook.com/plugins/like.php?href=<?php echo urlencode( get_permalink( $post->ID ) ); ?>&amp;layout=button_count&amp;show_faces=false&amp;width=100&amp;action=like&amp;colorscheme=light"
2175
+	     src="//www.facebook.com/plugins/like.php?href=<?php echo urlencode(get_permalink($post->ID)); ?>&amp;layout=button_count&amp;show_faces=false&amp;width=100&amp;action=like&amp;colorscheme=light"
2176 2176
 	     style="border:none; overflow:hidden; width:100px; height:20px"></iframe>
2177 2177
 	<?php
2178 2178
 }
@@ -2203,7 +2203,7 @@  discard block
 block discarded – undo
2203 2203
 
2204 2204
 
2205 2205
 function geodir_listing_bounce_map_pin_on_hover() {
2206
-	if ( get_option( 'geodir_listing_hover_bounce_map_pin', true ) ) {
2206
+	if (get_option('geodir_listing_hover_bounce_map_pin', true)) {
2207 2207
 		?>
2208 2208
 		<script>
2209 2209
 			jQuery(function ($) {
@@ -2226,44 +2226,44 @@  discard block
 block discarded – undo
2226 2226
 	}
2227 2227
 }
2228 2228
 
2229
-add_action( 'geodir_after_listing_listview', 'geodir_listing_bounce_map_pin_on_hover', 10 );
2229
+add_action('geodir_after_listing_listview', 'geodir_listing_bounce_map_pin_on_hover', 10);
2230 2230
 
2231
-add_action( 'geodir_after_favorite_html', 'geodir_output_favourite_html_listings', 1, 1 );
2232
-function geodir_output_favourite_html_listings( $post_id ) {
2233
-	geodir_favourite_html( '', $post_id );
2231
+add_action('geodir_after_favorite_html', 'geodir_output_favourite_html_listings', 1, 1);
2232
+function geodir_output_favourite_html_listings($post_id) {
2233
+	geodir_favourite_html('', $post_id);
2234 2234
 }
2235 2235
 
2236
-add_action( 'geodir_listing_after_pinpoint', 'geodir_output_pinpoint_html_listings', 1, 2 );
2237
-function geodir_output_pinpoint_html_listings( $post_id, $post = array() ) {
2236
+add_action('geodir_listing_after_pinpoint', 'geodir_output_pinpoint_html_listings', 1, 2);
2237
+function geodir_output_pinpoint_html_listings($post_id, $post = array()) {
2238 2238
 	global $wp_query;
2239 2239
 
2240 2240
 	$show_pin_point = $wp_query->is_main_query();
2241 2241
 
2242
-	if ( ! empty( $post ) && ! empty( $show_pin_point ) && is_active_widget( false, "", "geodir_map_v3_listing_map" ) ) {
2243
-		$term_icon_url = geodir_get_tax_meta( $post->default_category, 'ct_cat_icon', false, $post->post_type );
2244
-		$marker_icon   = isset( $term_icon_url['src'] ) ? $term_icon_url['src'] : get_option( 'geodir_default_marker_icon' );
2242
+	if (!empty($post) && !empty($show_pin_point) && is_active_widget(false, "", "geodir_map_v3_listing_map")) {
2243
+		$term_icon_url = geodir_get_tax_meta($post->default_category, 'ct_cat_icon', false, $post->post_type);
2244
+		$marker_icon   = isset($term_icon_url['src']) ? $term_icon_url['src'] : get_option('geodir_default_marker_icon');
2245 2245
 		?>
2246 2246
 		<span class="geodir-pinpoint"
2247
-		      style="background:url('<?php echo $marker_icon; ?>') no-repeat scroll left top transparent;background-size:auto 100%; -webkit-background-size:auto 100%;-moz-background-size:auto 100%;height:9px;width:14px;"><?php echo apply_filters( 'geodir_listing_listview_pinpoint_inner_content', '', 'listing' ); ?></span>
2247
+		      style="background:url('<?php echo $marker_icon; ?>') no-repeat scroll left top transparent;background-size:auto 100%; -webkit-background-size:auto 100%;-moz-background-size:auto 100%;height:9px;width:14px;"><?php echo apply_filters('geodir_listing_listview_pinpoint_inner_content', '', 'listing'); ?></span>
2248 2248
 		<a class="geodir-pinpoint-link" href="javascript:void(0)"
2249 2249
 		   onclick="if(typeof openMarker=='function'){openMarker('listing_map_canvas' ,'<?php echo $post->ID; ?>')}"
2250 2250
 		   onmouseover="if(typeof animate_marker=='function'){animate_marker('listing_map_canvas' ,'<?php echo $post->ID; ?>')}"
2251
-		   onmouseout="if(typeof stop_marker_animation=='function'){stop_marker_animation('listing_map_canvas' ,'<?php echo $post->ID; ?>')}"><?php _e( 'Pinpoint', 'geodirectory' ); ?></a>
2251
+		   onmouseout="if(typeof stop_marker_animation=='function'){stop_marker_animation('listing_map_canvas' ,'<?php echo $post->ID; ?>')}"><?php _e('Pinpoint', 'geodirectory'); ?></a>
2252 2252
 		<?php
2253 2253
 	}
2254 2254
 }
2255 2255
 
2256 2256
 function geodir_search_form_submit_button() {
2257 2257
 
2258
-	$new_style = get_option( 'geodir_show_search_old_search_from' ) ? false : true;
2258
+	$new_style = get_option('geodir_show_search_old_search_from') ? false : true;
2259 2259
 
2260
-	if ( $new_style ) {
2260
+	if ($new_style) {
2261 2261
 		$default_search_button_label = '<i class="fa fa-search" aria-hidden="true"></i>';
2262
-	}else{
2262
+	} else {
2263 2263
 		$default_search_button_label = 'Search';
2264 2264
 	}
2265
-	if ( get_option( 'geodir_search_button_label' ) && get_option( 'geodir_search_button_label' ) != 'Search' ) {
2266
-		$default_search_button_label = __( get_option( 'geodir_search_button_label' ), 'geodirectory' );
2265
+	if (get_option('geodir_search_button_label') && get_option('geodir_search_button_label') != 'Search') {
2266
+		$default_search_button_label = __(get_option('geodir_search_button_label'), 'geodirectory');
2267 2267
 	}
2268 2268
 
2269 2269
 	/**
@@ -2275,78 +2275,78 @@  discard block
 block discarded – undo
2275 2275
 	 *
2276 2276
 	 * @param string $default_search_button_label The current search button text.
2277 2277
 	 */
2278
-	$default_search_button_label = apply_filters( 'geodir_search_default_search_button_text', $default_search_button_label );
2278
+	$default_search_button_label = apply_filters('geodir_search_default_search_button_text', $default_search_button_label);
2279 2279
 
2280 2280
 	$fa_class = '';
2281
-	if ( strpos( $default_search_button_label, '&#' ) !== false ) {
2281
+	if (strpos($default_search_button_label, '&#') !== false) {
2282 2282
 		$fa_class = 'fa';
2283 2283
 	}
2284 2284
 
2285 2285
 
2286
-	if ( $new_style ) {
2286
+	if ($new_style) {
2287 2287
 	?>
2288
-		<button class="geodir_submit_search <?php echo $fa_class; ?>"><?php _e( $default_search_button_label ,'geodirectory'); ?></button>
2289
-<?php }else{?>
2290
-		<input type="button" value="<?php esc_attr_e( $default_search_button_label ); ?>"
2288
+		<button class="geodir_submit_search <?php echo $fa_class; ?>"><?php _e($default_search_button_label, 'geodirectory'); ?></button>
2289
+<?php } else {?>
2290
+		<input type="button" value="<?php esc_attr_e($default_search_button_label); ?>"
2291 2291
 	       class="geodir_submit_search <?php echo $fa_class; ?>"/>
2292 2292
 	<?php }
2293 2293
 }
2294 2294
 
2295
-add_action( 'geodir_before_search_button', 'geodir_search_form_submit_button', 5000 );
2295
+add_action('geodir_before_search_button', 'geodir_search_form_submit_button', 5000);
2296 2296
 
2297 2297
 function geodir_search_form_post_type_input() {
2298 2298
 	global $geodir_search_post_type;
2299
-	$post_types     = apply_filters( 'geodir_search_form_post_types', geodir_get_posttypes( 'object' ) );
2299
+	$post_types     = apply_filters('geodir_search_form_post_types', geodir_get_posttypes('object'));
2300 2300
 	$curr_post_type = $geodir_search_post_type;
2301 2301
 
2302
-	if ( ! empty( $post_types ) && count( (array) $post_types ) > 1 ) {
2302
+	if (!empty($post_types) && count((array) $post_types) > 1) {
2303 2303
 
2304
-		foreach ( $post_types as $post_type => $info ){
2304
+		foreach ($post_types as $post_type => $info) {
2305 2305
 			global $wpdb;
2306
-			$has_posts = $wpdb->get_row( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_type = %s AND post_status='publish' LIMIT 1", $post_type ) );
2307
-			if ( ! $has_posts ) {
2306
+			$has_posts = $wpdb->get_row($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_type = %s AND post_status='publish' LIMIT 1", $post_type));
2307
+			if (!$has_posts) {
2308 2308
 				unset($post_types->{$post_type});
2309 2309
 			}
2310 2310
 		}
2311 2311
 
2312
-		if ( ! empty( $post_types ) && count( (array) $post_types ) > 1 ) {
2312
+		if (!empty($post_types) && count((array) $post_types) > 1) {
2313 2313
 
2314
-			$new_style = get_option( 'geodir_show_search_old_search_from' ) ? false : true;
2315
-			if ( $new_style ) {
2314
+			$new_style = get_option('geodir_show_search_old_search_from') ? false : true;
2315
+			if ($new_style) {
2316 2316
 				echo "<div class='gd-search-input-wrapper gd-search-field-cpt'>";
2317 2317
 			}
2318 2318
 			?>
2319 2319
 			<select name="stype" class="search_by_post">
2320
-				<?php foreach ( $post_types as $post_type => $info ):
2320
+				<?php foreach ($post_types as $post_type => $info):
2321 2321
 					global $wpdb;
2322 2322
 					?>
2323 2323
 
2324
-					<option data-label="<?php echo get_post_type_archive_link( $post_type ); ?>"
2325
-					        value="<?php echo $post_type; ?>" <?php if ( isset( $_REQUEST['stype'] ) ) {
2326
-						if ( $post_type == $_REQUEST['stype'] ) {
2324
+					<option data-label="<?php echo get_post_type_archive_link($post_type); ?>"
2325
+					        value="<?php echo $post_type; ?>" <?php if (isset($_REQUEST['stype'])) {
2326
+						if ($post_type == $_REQUEST['stype']) {
2327 2327
 							echo 'selected="selected"';
2328 2328
 						}
2329
-					} elseif ( $curr_post_type == $post_type ) {
2329
+					} elseif ($curr_post_type == $post_type) {
2330 2330
 						echo 'selected="selected"';
2331
-					} ?>><?php _e( geodir_utf8_ucfirst( $info->labels->name ), 'geodirectory' ); ?></option>
2331
+					} ?>><?php _e(geodir_utf8_ucfirst($info->labels->name), 'geodirectory'); ?></option>
2332 2332
 
2333 2333
 				<?php endforeach; ?>
2334 2334
 			</select>
2335 2335
 			<?php
2336
-			if ( $new_style ) {
2336
+			if ($new_style) {
2337 2337
 				echo "</div>";
2338 2338
 			}
2339
-		}else{
2340
-			if(! empty( $post_types )){
2341
-				$pt_arr = (array)$post_types;
2342
-				echo '<input type="hidden" name="stype" value="' . key( $pt_arr  ) . '"  />';
2343
-			}else{
2339
+		} else {
2340
+			if (!empty($post_types)) {
2341
+				$pt_arr = (array) $post_types;
2342
+				echo '<input type="hidden" name="stype" value="'.key($pt_arr).'"  />';
2343
+			} else {
2344 2344
 				echo '<input type="hidden" name="stype" value="gd_place"  />';
2345 2345
 			}
2346 2346
 
2347 2347
 		}
2348 2348
 
2349
-	}elseif ( ! empty( $post_types ) ) {
2349
+	}elseif (!empty($post_types)) {
2350 2350
 		echo '<input type="hidden" name="stype" value="gd_place"  />';
2351 2351
 	}
2352 2352
 }
@@ -2354,26 +2354,26 @@  discard block
 block discarded – undo
2354 2354
 function geodir_search_form_search_input() {
2355 2355
 
2356 2356
 	$default_search_for_text = SEARCH_FOR_TEXT;
2357
-	if ( get_option( 'geodir_search_field_default_text' ) ) {
2358
-		$default_search_for_text = __( get_option( 'geodir_search_field_default_text' ), 'geodirectory' );
2357
+	if (get_option('geodir_search_field_default_text')) {
2358
+		$default_search_for_text = __(get_option('geodir_search_field_default_text'), 'geodirectory');
2359 2359
 	}
2360 2360
 
2361 2361
 	$new_style = get_option('geodir_show_search_old_search_from') ? false : true;
2362
-	if($new_style){
2362
+	if ($new_style) {
2363 2363
 		echo "<div class='gd-search-input-wrapper gd-search-field-search'>";
2364 2364
 	}
2365 2365
 	?>
2366 2366
 	<input class="search_text" name="s"
2367
-	       value="<?php if ( isset( $_REQUEST['s'] ) && trim( $_REQUEST['s'] ) != '' ) {
2368
-		       echo esc_attr( stripslashes_deep( $_REQUEST['s'] ) );
2367
+	       value="<?php if (isset($_REQUEST['s']) && trim($_REQUEST['s']) != '') {
2368
+		       echo esc_attr(stripslashes_deep($_REQUEST['s']));
2369 2369
 	       } else {
2370 2370
 		       echo $default_search_for_text;
2371 2371
 	       } ?>" type="text"
2372
-	       onblur="if (this.value.trim() == '') {this.value = '<?php echo esc_sql( $default_search_for_text ); ?>';}"
2373
-	       onfocus="if (this.value == '<?php echo esc_sql( $default_search_for_text ); ?>') {this.value = '';}"
2372
+	       onblur="if (this.value.trim() == '') {this.value = '<?php echo esc_sql($default_search_for_text); ?>';}"
2373
+	       onfocus="if (this.value == '<?php echo esc_sql($default_search_for_text); ?>') {this.value = '';}"
2374 2374
 	       onkeydown="javascript: if(event.keyCode == 13) geodir_click_search(this);">
2375 2375
 	<?php
2376
-	if($new_style){
2376
+	if ($new_style) {
2377 2377
 		echo "</div>";
2378 2378
 	}
2379 2379
 }
@@ -2381,12 +2381,12 @@  discard block
 block discarded – undo
2381 2381
 function geodir_search_form_near_input() {
2382 2382
 
2383 2383
 	$default_near_text = NEAR_TEXT;
2384
-	if ( get_option( 'geodir_near_field_default_text' ) ) {
2385
-		$default_near_text = __( get_option( 'geodir_near_field_default_text' ), 'geodirectory' );
2384
+	if (get_option('geodir_near_field_default_text')) {
2385
+		$default_near_text = __(get_option('geodir_near_field_default_text'), 'geodirectory');
2386 2386
 	}
2387 2387
 
2388
-	if ( isset( $_REQUEST['snear'] ) && $_REQUEST['snear'] != '' ) {
2389
-		$near = esc_attr( stripslashes_deep( $_REQUEST['snear'] ) );
2388
+	if (isset($_REQUEST['snear']) && $_REQUEST['snear'] != '') {
2389
+		$near = esc_attr(stripslashes_deep($_REQUEST['snear']));
2390 2390
 	} else {
2391 2391
 		$near = $default_near_text;
2392 2392
 	}
@@ -2400,7 +2400,7 @@  discard block
 block discarded – undo
2400 2400
 	 * @since 1.6.9
2401 2401
 	 * @param string $curr_post_type The current post type.
2402 2402
 	 */
2403
-	$near_input_extra = apply_filters('geodir_near_input_extra','',$curr_post_type);
2403
+	$near_input_extra = apply_filters('geodir_near_input_extra', '', $curr_post_type);
2404 2404
 
2405 2405
 
2406 2406
 	/**
@@ -2413,7 +2413,7 @@  discard block
 block discarded – undo
2413 2413
 	 * @param string $near              The current near value.
2414 2414
 	 * @param string $default_near_text The default near value.
2415 2415
 	 */
2416
-	$near = apply_filters( 'geodir_search_near_text', $near, $default_near_text );
2416
+	$near = apply_filters('geodir_search_near_text', $near, $default_near_text);
2417 2417
 	/**
2418 2418
 	 * Filter the default "Near" text value for the search form.
2419 2419
 	 *
@@ -2424,7 +2424,7 @@  discard block
 block discarded – undo
2424 2424
 	 * @param string $near              The current near value.
2425 2425
 	 * @param string $default_near_text The default near value.
2426 2426
 	 */
2427
-	$default_near_text = apply_filters( 'geodir_search_default_near_text', $default_near_text, $near );
2427
+	$default_near_text = apply_filters('geodir_search_default_near_text', $default_near_text, $near);
2428 2428
 	/**
2429 2429
 	 * Filter the class for the near search input.
2430 2430
 	 *
@@ -2432,10 +2432,10 @@  discard block
 block discarded – undo
2432 2432
 	 *
2433 2433
 	 * @param string $class The class for the HTML near input, default is blank.
2434 2434
 	 */
2435
-	$near_class = apply_filters( 'geodir_search_near_class', '' );
2435
+	$near_class = apply_filters('geodir_search_near_class', '');
2436 2436
 
2437 2437
 	$new_style = get_option('geodir_show_search_old_search_from') ? false : true;
2438
-	if($new_style){
2438
+	if ($new_style) {
2439 2439
 		echo "<div class='gd-search-input-wrapper gd-search-field-near' $near_input_extra>";
2440 2440
 		
2441 2441
 		do_action('geodir_before_near_input');
@@ -2443,30 +2443,30 @@  discard block
 block discarded – undo
2443 2443
 
2444 2444
 	?>
2445 2445
 	<input name="snear" class="snear <?php echo $near_class; ?>" type="text" value="<?php echo $near; ?>"
2446
-	       onblur="if (this.value.trim() == '') {this.value = ('<?php echo esc_sql( $near ); ?>' != '' ? '<?php echo esc_sql( $near ); ?>' : '<?php echo $default_near_text; ?>');}"
2447
-	       onfocus="if (this.value == '<?php echo $default_near_text; ?>' || this.value =='<?php echo esc_sql( $near ); ?>') {this.value = '';}"
2448
-	       onkeydown="javascript: if(event.keyCode == 13) geodir_click_search(this);" <?php echo $near_input_extra;?>/>
2446
+	       onblur="if (this.value.trim() == '') {this.value = ('<?php echo esc_sql($near); ?>' != '' ? '<?php echo esc_sql($near); ?>' : '<?php echo $default_near_text; ?>');}"
2447
+	       onfocus="if (this.value == '<?php echo $default_near_text; ?>' || this.value =='<?php echo esc_sql($near); ?>') {this.value = '';}"
2448
+	       onkeydown="javascript: if(event.keyCode == 13) geodir_click_search(this);" <?php echo $near_input_extra; ?>/>
2449 2449
 	<?php
2450
-	if($new_style){
2450
+	if ($new_style) {
2451 2451
 		do_action('geodir_after_near_input');
2452 2452
 
2453 2453
 		echo "</div>";
2454 2454
 	}
2455 2455
 }
2456 2456
 
2457
-add_action( 'geodir_search_form_inputs', 'geodir_search_form_post_type_input', 10 );
2458
-add_action( 'geodir_search_form_inputs', 'geodir_search_form_search_input', 20 );
2459
-add_action( 'geodir_search_form_inputs', 'geodir_search_form_near_input', 30 );
2457
+add_action('geodir_search_form_inputs', 'geodir_search_form_post_type_input', 10);
2458
+add_action('geodir_search_form_inputs', 'geodir_search_form_search_input', 20);
2459
+add_action('geodir_search_form_inputs', 'geodir_search_form_near_input', 30);
2460 2460
 
2461
-function geodir_get_search_post_type($pt=''){
2461
+function geodir_get_search_post_type($pt = '') {
2462 2462
 	global $geodir_search_post_type;
2463 2463
 
2464
-	if($pt!=''){return $geodir_search_post_type = $pt;}
2465
-	if(!empty($geodir_search_post_type)){ return $geodir_search_post_type;}
2464
+	if ($pt != '') {return $geodir_search_post_type = $pt; }
2465
+	if (!empty($geodir_search_post_type)) { return $geodir_search_post_type; }
2466 2466
 
2467 2467
 	$geodir_search_post_type = geodir_get_current_posttype();
2468 2468
 
2469
-	if(!$geodir_search_post_type) {
2469
+	if (!$geodir_search_post_type) {
2470 2470
 		$geodir_search_post_type = geodir_get_default_posttype();
2471 2471
 	}
2472 2472
 
@@ -2474,7 +2474,7 @@  discard block
 block discarded – undo
2474 2474
 	return $geodir_search_post_type;
2475 2475
 }
2476 2476
 
2477
-function geodir_search_form(){
2477
+function geodir_search_form() {
2478 2478
 
2479 2479
 	geodir_get_search_post_type();
2480 2480
 
@@ -2484,8 +2484,8 @@  discard block
 block discarded – undo
2484 2484
 	die();
2485 2485
 }
2486 2486
 
2487
-add_action( 'wp_ajax_geodir_search_form', 'geodir_search_form' );
2488
-add_action( 'wp_ajax_nopriv_geodir_search_form', 'geodir_search_form' );
2487
+add_action('wp_ajax_geodir_search_form', 'geodir_search_form');
2488
+add_action('wp_ajax_nopriv_geodir_search_form', 'geodir_search_form');
2489 2489
 
2490 2490
 /**
2491 2491
  * Check wpml active or not.
@@ -2559,7 +2559,7 @@  discard block
 block discarded – undo
2559 2559
         }
2560 2560
     }
2561 2561
 }
2562
-add_filter( 'icl_make_duplicate', 'geodir_icl_make_duplicate', 11, 4 );
2562
+add_filter('icl_make_duplicate', 'geodir_icl_make_duplicate', 11, 4);
2563 2563
 
2564 2564
 /**
2565 2565
  * Duplicate post listing manually after listing saved.
@@ -2600,7 +2600,7 @@  discard block
 block discarded – undo
2600 2600
 function geodir_wpml_duplicate_post_reviews($master_post_id, $tr_post_id, $lang) {
2601 2601
     global $wpdb;
2602 2602
 
2603
-    $reviews = $wpdb->get_results($wpdb->prepare("SELECT comment_id FROM " . GEODIR_REVIEW_TABLE . " WHERE post_id=%d ORDER BY id ASC", $master_post_id), ARRAY_A);
2603
+    $reviews = $wpdb->get_results($wpdb->prepare("SELECT comment_id FROM ".GEODIR_REVIEW_TABLE." WHERE post_id=%d ORDER BY id ASC", $master_post_id), ARRAY_A);
2604 2604
 
2605 2605
     if (!empty($reviews)) {
2606 2606
         foreach ($reviews as $review) {
@@ -2628,14 +2628,14 @@  discard block
 block discarded – undo
2628 2628
     global $wpdb, $plugin_prefix;
2629 2629
 
2630 2630
     $post_type = get_post_type($master_post_id);
2631
-    $post_table = $plugin_prefix . $post_type . '_detail';
2631
+    $post_table = $plugin_prefix.$post_type.'_detail';
2632 2632
 
2633
-    $query = $wpdb->prepare("SELECT * FROM " . $post_table . " WHERE post_id = %d", array($master_post_id));
2634
-    $data = (array)$wpdb->get_row($query);
2633
+    $query = $wpdb->prepare("SELECT * FROM ".$post_table." WHERE post_id = %d", array($master_post_id));
2634
+    $data = (array) $wpdb->get_row($query);
2635 2635
 
2636
-    if ( !empty( $data ) ) {
2636
+    if (!empty($data)) {
2637 2637
         $data['post_id'] = $tr_post_id;
2638
-        unset($data['default_category'], $data['marker_json'], $data['featured_image'], $data[$post_type . 'category']);
2638
+        unset($data['default_category'], $data['marker_json'], $data['featured_image'], $data[$post_type.'category']);
2639 2639
         $wpdb->update($post_table, $data, array('post_id' => $tr_post_id));
2640 2640
         return true;
2641 2641
     }
@@ -2660,7 +2660,7 @@  discard block
 block discarded – undo
2660 2660
     global $sitepress, $wpdb;
2661 2661
     $post_type = get_post_type($master_post_id);
2662 2662
 
2663
-    remove_filter('get_term', array($sitepress,'get_term_adjust_id')); // AVOID filtering to current language
2663
+    remove_filter('get_term', array($sitepress, 'get_term_adjust_id')); // AVOID filtering to current language
2664 2664
 
2665 2665
     $taxonomies = get_object_taxonomies($post_type);
2666 2666
     foreach ($taxonomies as $taxonomy) {
@@ -2669,9 +2669,9 @@  discard block
 block discarded – undo
2669 2669
         
2670 2670
         if ($terms) {
2671 2671
             foreach ($terms as $term) {
2672
-                $tr_id = apply_filters( 'translate_object_id',$term->term_id, $taxonomy, false, $lang);
2672
+                $tr_id = apply_filters('translate_object_id', $term->term_id, $taxonomy, false, $lang);
2673 2673
                 
2674
-                if (!is_null($tr_id)){
2674
+                if (!is_null($tr_id)) {
2675 2675
                     // not using get_term - unfiltered get_term
2676 2676
                     $translated_term = $wpdb->get_row($wpdb->prepare("
2677 2677
                         SELECT * FROM {$wpdb->terms} t JOIN {$wpdb->term_taxonomy} x ON x.term_id = t.term_id WHERE t.term_id = %d AND x.taxonomy = %s", $tr_id, $taxonomy));
@@ -2680,14 +2680,14 @@  discard block
 block discarded – undo
2680 2680
                 }
2681 2681
             }
2682 2682
 
2683
-            if (!is_taxonomy_hierarchical($taxonomy)){
2684
-                $terms_array = array_unique( array_map( 'intval', $terms_array ) );
2683
+            if (!is_taxonomy_hierarchical($taxonomy)) {
2684
+                $terms_array = array_unique(array_map('intval', $terms_array));
2685 2685
             }
2686 2686
 
2687 2687
             wp_set_post_terms($tr_post_id, $terms_array, $taxonomy);
2688 2688
             
2689
-            if ($taxonomy == $post_type . 'category') {
2690
-                geodir_set_postcat_structure($tr_post_id, $post_type . 'category');
2689
+            if ($taxonomy == $post_type.'category') {
2690
+                geodir_set_postcat_structure($tr_post_id, $post_type.'category');
2691 2691
             }
2692 2692
         }
2693 2693
     }
@@ -2708,15 +2708,15 @@  discard block
 block discarded – undo
2708 2708
 function geodir_icl_duplicate_post_images($master_post_id, $tr_post_id, $lang) {
2709 2709
     global $wpdb;
2710 2710
 
2711
-    $query = $wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE mime_type like %s AND post_id = %d", array('%image%', $tr_post_id));
2711
+    $query = $wpdb->prepare("DELETE FROM ".GEODIR_ATTACHMENT_TABLE." WHERE mime_type like %s AND post_id = %d", array('%image%', $tr_post_id));
2712 2712
     $wpdb->query($query);
2713 2713
 
2714
-    $query = $wpdb->prepare("SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE mime_type like %s AND post_id = %d ORDER BY menu_order ASC", array('%image%', $master_post_id));
2714
+    $query = $wpdb->prepare("SELECT * FROM ".GEODIR_ATTACHMENT_TABLE." WHERE mime_type like %s AND post_id = %d ORDER BY menu_order ASC", array('%image%', $master_post_id));
2715 2715
     $post_images = $wpdb->get_results($query);
2716 2716
 
2717
-    if ( !empty( $post_images ) ) {
2718
-        foreach ( $post_images as $post_image) {
2719
-            $image_data = (array)$post_image;
2717
+    if (!empty($post_images)) {
2718
+        foreach ($post_images as $post_image) {
2719
+            $image_data = (array) $post_image;
2720 2720
             unset($image_data['ID']);
2721 2721
             $image_data['post_id'] = $tr_post_id;
2722 2722
             
@@ -2749,13 +2749,13 @@  discard block
 block discarded – undo
2749 2749
 function geodir_wpml_duplicate_post_review($master_comment_id, $master_post_id, $tr_post_id, $lang) {
2750 2750
     global $wpdb, $plugin_prefix, $sitepress;
2751 2751
 
2752
-    $review = $wpdb->get_row($wpdb->prepare("SELECT * FROM " . GEODIR_REVIEW_TABLE . " WHERE comment_id=%d ORDER BY id ASC", $master_comment_id), ARRAY_A);
2752
+    $review = $wpdb->get_row($wpdb->prepare("SELECT * FROM ".GEODIR_REVIEW_TABLE." WHERE comment_id=%d ORDER BY id ASC", $master_comment_id), ARRAY_A);
2753 2753
 
2754 2754
     if (empty($review)) {
2755 2755
         return false;
2756 2756
     }
2757 2757
     if ($review['post_id'] != $master_post_id) {
2758
-        $wpdb->query($wpdb->prepare("UPDATE " . GEODIR_REVIEW_TABLE . " SET post_id=%d WHERE comment_id=%d", $master_post_id, $master_comment_id));
2758
+        $wpdb->query($wpdb->prepare("UPDATE ".GEODIR_REVIEW_TABLE." SET post_id=%d WHERE comment_id=%d", $master_post_id, $master_comment_id));
2759 2759
         geodir_update_postrating($master_post_id, $post_type);
2760 2760
     }
2761 2761
 
@@ -2766,9 +2766,9 @@  discard block
 block discarded – undo
2766 2766
     }
2767 2767
 
2768 2768
     $post_type = get_post_type($master_post_id);
2769
-    $post_table = $plugin_prefix . $post_type . '_detail';
2769
+    $post_table = $plugin_prefix.$post_type.'_detail';
2770 2770
 
2771
-    $translated_post = $wpdb->get_row($wpdb->prepare("SELECT post_title, post_latitude, post_longitude, post_city, post_region, post_country FROM " . $post_table . " WHERE post_id = %d", $tr_post_id), ARRAY_A);
2771
+    $translated_post = $wpdb->get_row($wpdb->prepare("SELECT post_title, post_latitude, post_longitude, post_city, post_region, post_country FROM ".$post_table." WHERE post_id = %d", $tr_post_id), ARRAY_A);
2772 2772
     if (empty($translated_post)) {
2773 2773
         return false;
2774 2774
     }
@@ -2786,7 +2786,7 @@  discard block
 block discarded – undo
2786 2786
         unset($review['id']);
2787 2787
     }
2788 2788
 
2789
-    $tr_review_id = $wpdb->get_var($wpdb->prepare("SELECT id FROM " . GEODIR_REVIEW_TABLE . " WHERE comment_id=%d AND post_id=%d ORDER BY id ASC", $tr_comment_id, $tr_post_id));
2789
+    $tr_review_id = $wpdb->get_var($wpdb->prepare("SELECT id FROM ".GEODIR_REVIEW_TABLE." WHERE comment_id=%d AND post_id=%d ORDER BY id ASC", $tr_comment_id, $tr_post_id));
2790 2790
 
2791 2791
     if ($tr_review_id) { // update review
2792 2792
         $wpdb->update(GEODIR_REVIEW_TABLE, $review, array('id' => $tr_review_id));
@@ -2799,8 +2799,8 @@  discard block
 block discarded – undo
2799 2799
         geodir_update_postrating($tr_post_id, $post_type);
2800 2800
         
2801 2801
         if (defined('GEODIRREVIEWRATING_VERSION') && get_option('geodir_reviewrating_enable_review') && $sitepress->get_setting('sync_comments_on_duplicates')) {
2802
-            $wpdb->query($wpdb->prepare("DELETE FROM " . GEODIR_COMMENTS_REVIEWS_TABLE . " WHERE comment_id = %d", array($tr_comment_id)));
2803
-            $likes = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . GEODIR_COMMENTS_REVIEWS_TABLE . " WHERE comment_id=%d ORDER BY like_date ASC", $master_comment_id, $tr_post_id), ARRAY_A);
2802
+            $wpdb->query($wpdb->prepare("DELETE FROM ".GEODIR_COMMENTS_REVIEWS_TABLE." WHERE comment_id = %d", array($tr_comment_id)));
2803
+            $likes = $wpdb->get_results($wpdb->prepare("SELECT * FROM ".GEODIR_COMMENTS_REVIEWS_TABLE." WHERE comment_id=%d ORDER BY like_date ASC", $master_comment_id, $tr_post_id), ARRAY_A);
2804 2804
 
2805 2805
             if (!empty($likes)) {
2806 2806
                 foreach ($likes as $like) {
@@ -2902,7 +2902,7 @@  discard block
 block discarded – undo
2902 2902
  * @return bool True if review star disabled, otherwise false.
2903 2903
  */ 
2904 2904
 function geodir_rating_disabled_post_types() {
2905
-	$post_types = get_option( 'geodir_disable_rating_cpt' );
2905
+	$post_types = get_option('geodir_disable_rating_cpt');
2906 2906
 	
2907 2907
 	/**
2908 2908
 	 * Filter the post types array which have rating disabled.
@@ -2911,7 +2911,7 @@  discard block
 block discarded – undo
2911 2911
 	 *
2912 2912
 	 * @param array $post_types Array of post types which have rating starts disabled.
2913 2913
 	 */
2914
-	return apply_filters( 'geodir_rating_disabled_post_types', $post_types );
2914
+	return apply_filters('geodir_rating_disabled_post_types', $post_types);
2915 2915
 }
2916 2916
 
2917 2917
 /**
@@ -2923,30 +2923,30 @@  discard block
 block discarded – undo
2923 2923
  * @param bool $taxonomy Whether $post_type is taxonomy or not.
2924 2924
  * @return bool True if review star disabled, otherwise false.
2925 2925
  */ 
2926
-function geodir_cpt_has_rating_disabled( $post_type = '', $taxonomy = false ) {
2926
+function geodir_cpt_has_rating_disabled($post_type = '', $taxonomy = false) {
2927 2927
 	$post_types = geodir_rating_disabled_post_types();
2928 2928
 	
2929
-	if ( empty( $post_types ) ) {
2929
+	if (empty($post_types)) {
2930 2930
 		return false;
2931 2931
 	}
2932 2932
 	
2933
-	if ( is_int( $post_type ) ) {
2934
-		$post_type = get_post_type( $post_type );
2933
+	if (is_int($post_type)) {
2934
+		$post_type = get_post_type($post_type);
2935 2935
 	}
2936 2936
 	
2937
-	if ( $taxonomy && !empty( $post_types ) ) {
2937
+	if ($taxonomy && !empty($post_types)) {
2938 2938
 		$posttypes = array();
2939 2939
 		
2940
-		foreach ( $post_types as $posttype ) {
2941
-			$posttypes[] = $posttype . 'category';
2942
-			$posttypes[] = $posttype . '_tags';
2940
+		foreach ($post_types as $posttype) {
2941
+			$posttypes[] = $posttype.'category';
2942
+			$posttypes[] = $posttype.'_tags';
2943 2943
 		}
2944 2944
 		
2945 2945
 		$post_types = $posttypes;
2946 2946
 	}
2947 2947
 
2948 2948
 	$return = false;
2949
-	if ( $post_type != '' && !empty( $post_types ) && in_array( $post_type, $post_types ) ) {
2949
+	if ($post_type != '' && !empty($post_types) && in_array($post_type, $post_types)) {
2950 2950
 		$return = true;
2951 2951
 	}
2952 2952
 
@@ -2961,7 +2961,7 @@  discard block
 block discarded – undo
2961 2961
  * @return bool True if Yoast SEO disabled on GD pages.
2962 2962
  */
2963 2963
 function geodir_disable_yoast_seo_metas() {
2964
-    return (bool)get_option( 'geodir_disable_yoast_meta' );
2964
+    return (bool) get_option('geodir_disable_yoast_meta');
2965 2965
 }
2966 2966
 
2967 2967
 /**
@@ -2972,30 +2972,30 @@  discard block
 block discarded – undo
2972 2972
  * @param int $post_id The post ID.
2973 2973
  * @return bool True if allowed.
2974 2974
  */
2975
-function geodir_wpml_allowed_to_duplicate( $post_id ) {
2975
+function geodir_wpml_allowed_to_duplicate($post_id) {
2976 2976
     $allowed = false;
2977 2977
     
2978
-    if ( !geodir_is_wpml() || empty( $post_id ) ) {
2978
+    if (!geodir_is_wpml() || empty($post_id)) {
2979 2979
         return $allowed;
2980 2980
     }
2981 2981
     
2982
-    $user_id = (int)get_current_user_id();
2982
+    $user_id = (int) get_current_user_id();
2983 2983
     
2984
-    if ( empty( $user_id ) ) {
2984
+    if (empty($user_id)) {
2985 2985
         return $allowed;
2986 2986
     }
2987 2987
     
2988
-    $post_type = get_post_type( $post_id );
2989
-    if ( !is_post_type_translated( $post_type ) || get_post_meta( $post_id, '_icl_lang_duplicate_of', true ) ) {
2988
+    $post_type = get_post_type($post_id);
2989
+    if (!is_post_type_translated($post_type) || get_post_meta($post_id, '_icl_lang_duplicate_of', true)) {
2990 2990
         return $allowed;
2991 2991
     }
2992 2992
     
2993
-    if ( geodir_listing_belong_to_current_user( $post_id ) ) {
2993
+    if (geodir_listing_belong_to_current_user($post_id)) {
2994 2994
         $allowed = true;
2995 2995
     }
2996 2996
     
2997
-    $disable_cpts = get_option( 'geodir_wpml_disable_duplicate' );
2998
-    if ( $allowed && !empty( $disable_cpts ) && in_array( $post_type, $disable_cpts ) ) {
2997
+    $disable_cpts = get_option('geodir_wpml_disable_duplicate');
2998
+    if ($allowed && !empty($disable_cpts) && in_array($post_type, $disable_cpts)) {
2999 2999
         $allowed = false;
3000 3000
     }
3001 3001
     
@@ -3005,7 +3005,7 @@  discard block
 block discarded – undo
3005 3005
      * @param bool $allowed True if allowed.
3006 3006
      * @param int $post_id The post ID.
3007 3007
      */
3008
-    return apply_filters( 'geodir_wpml_allowed_to_duplicate', $allowed, $post_id );
3008
+    return apply_filters('geodir_wpml_allowed_to_duplicate', $allowed, $post_id);
3009 3009
 }
3010 3010
 
3011 3011
 /**
@@ -3020,61 +3020,61 @@  discard block
 block discarded – undo
3020 3020
  * @param string $content_html The output html of the geodir_edit_post_link() function.
3021 3021
  * @return string Filtered html of the geodir_edit_post_link() function.
3022 3022
  */
3023
-function geodir_wpml_frontend_duplicate_listing( $content_html ) {
3023
+function geodir_wpml_frontend_duplicate_listing($content_html) {
3024 3024
     global $post, $preview, $sitepress;
3025 3025
     
3026
-    if ( !empty( $post->ID ) && !$preview && geodir_is_page( 'detail' ) && geodir_wpml_allowed_to_duplicate( $post->ID ) ) {
3026
+    if (!empty($post->ID) && !$preview && geodir_is_page('detail') && geodir_wpml_allowed_to_duplicate($post->ID)) {
3027 3027
         $post_id = $post->ID;
3028
-        $element_type = 'post_' . get_post_type( $post_id );
3029
-        $original_post_id = $sitepress->get_original_element_id( $post_id, $element_type );
3028
+        $element_type = 'post_'.get_post_type($post_id);
3029
+        $original_post_id = $sitepress->get_original_element_id($post_id, $element_type);
3030 3030
         
3031
-        if ( $original_post_id == $post_id ) {
3031
+        if ($original_post_id == $post_id) {
3032 3032
             $wpml_languages = $sitepress->get_active_languages();
3033
-            $post_language = $sitepress->get_language_for_element( $post_id, $element_type );
3033
+            $post_language = $sitepress->get_language_for_element($post_id, $element_type);
3034 3034
             
3035
-            if ( !empty( $wpml_languages ) && isset( $wpml_languages[ $post_language ] ) ) {
3036
-                unset( $wpml_languages[ $post_language ] );
3035
+            if (!empty($wpml_languages) && isset($wpml_languages[$post_language])) {
3036
+                unset($wpml_languages[$post_language]);
3037 3037
             }
3038 3038
             
3039
-            if ( !empty( $wpml_languages ) ) {
3040
-                $trid  = $sitepress->get_element_trid( $post_id, $element_type );
3041
-                $element_translations = $sitepress->get_element_translations( $trid, $element_type );
3042
-                $duplicates = $sitepress->get_duplicates( $post_id );
3039
+            if (!empty($wpml_languages)) {
3040
+                $trid = $sitepress->get_element_trid($post_id, $element_type);
3041
+                $element_translations = $sitepress->get_element_translations($trid, $element_type);
3042
+                $duplicates = $sitepress->get_duplicates($post_id);
3043 3043
                 
3044
-                $wpml_content = '<div class="geodir-company_info gd-detail-duplicate"><h3 class="widget-title">' . __( 'Translate Listing', 'geodirectory' ) . '</h3>';
3044
+                $wpml_content = '<div class="geodir-company_info gd-detail-duplicate"><h3 class="widget-title">'.__('Translate Listing', 'geodirectory').'</h3>';
3045 3045
                 $wpml_content .= '<table class="gd-duplicate-table" style="width:100%;margin:0"><tbody>';
3046
-                $wpml_content .= '<tr style="border-bottom:solid 1px #efefef"><th style="padding:0 2px 2px 2px">' . __( 'Language', 'geodirectory' ) . '</th><th style="width:25px;"></th><th style="width:5em;text-align:center">' . __( 'Translate', 'geodirectory' ) . '</th></tr>';
3046
+                $wpml_content .= '<tr style="border-bottom:solid 1px #efefef"><th style="padding:0 2px 2px 2px">'.__('Language', 'geodirectory').'</th><th style="width:25px;"></th><th style="width:5em;text-align:center">'.__('Translate', 'geodirectory').'</th></tr>';
3047 3047
                 
3048 3048
                 $needs_translation = false;
3049 3049
                 
3050
-                foreach ( $wpml_languages as $lang_code => $lang ) {
3050
+                foreach ($wpml_languages as $lang_code => $lang) {
3051 3051
                     $duplicates_text = '';
3052 3052
                     $translated = false;
3053 3053
                     
3054
-                    if ( !empty( $element_translations ) && isset( $element_translations[$lang_code] ) ) {
3054
+                    if (!empty($element_translations) && isset($element_translations[$lang_code])) {
3055 3055
                         $translated = true;
3056 3056
                         
3057
-                        if ( !empty( $duplicates ) && isset( $duplicates[$lang_code] ) ) {
3058
-                            $duplicates_text = ' ' . __( '(duplicate)', 'geodirectory' );
3057
+                        if (!empty($duplicates) && isset($duplicates[$lang_code])) {
3058
+                            $duplicates_text = ' '.__('(duplicate)', 'geodirectory');
3059 3059
                         }
3060 3060
                     } else {
3061 3061
                         $needs_translation = true;
3062 3062
                     }
3063 3063
                     
3064
-                    $wpml_content .= '<tr><td style="padding:4px">' . $lang['english_name'] . $duplicates_text . '</td><td>&nbsp;</td><td style="text-align:center;">';
3064
+                    $wpml_content .= '<tr><td style="padding:4px">'.$lang['english_name'].$duplicates_text.'</td><td>&nbsp;</td><td style="text-align:center;">';
3065 3065
                     
3066
-                    if ( $translated ) {
3066
+                    if ($translated) {
3067 3067
                         $wpml_content .= '<i class="fa fa-check" style="color:orange"></i>';
3068 3068
                     } else {
3069
-                        $wpml_content .= '<input name="gd_icl_dup[]" value="' . $lang_code . '" title="' . esc_attr__( 'Create duplicate', 'geodirectory' ) . '" type="checkbox">';
3069
+                        $wpml_content .= '<input name="gd_icl_dup[]" value="'.$lang_code.'" title="'.esc_attr__('Create duplicate', 'geodirectory').'" type="checkbox">';
3070 3070
                     }
3071 3071
                     
3072 3072
                     $wpml_content .= '</td></tr>';
3073 3073
                 }
3074 3074
                 
3075
-                if ( $needs_translation ) {
3076
-                    $nonce = wp_create_nonce( 'geodir_duplicate_nonce' );
3077
-                    $wpml_content .= '<tr><td>&nbsp;</td><td style="vertical-align:middle;padding-top:13px"><i style="display:none" class="fa fa-spin fa-refresh"></i></td><td style="padding:15px 3px 3px 3px;text-align:right"><button data-nonce="' . esc_attr( $nonce ) . '" data-post-id="' . $post_id . '" id="gd_make_duplicates" class="button-secondary">' . __( 'Duplicate', 'geodirectory' ) . '</button></td></tr>';
3075
+                if ($needs_translation) {
3076
+                    $nonce = wp_create_nonce('geodir_duplicate_nonce');
3077
+                    $wpml_content .= '<tr><td>&nbsp;</td><td style="vertical-align:middle;padding-top:13px"><i style="display:none" class="fa fa-spin fa-refresh"></i></td><td style="padding:15px 3px 3px 3px;text-align:right"><button data-nonce="'.esc_attr($nonce).'" data-post-id="'.$post_id.'" id="gd_make_duplicates" class="button-secondary">'.__('Duplicate', 'geodirectory').'</button></td></tr>';
3078 3078
                 }
3079 3079
                 
3080 3080
                 $wpml_content .= '</tbody></table>';
@@ -3096,12 +3096,12 @@  discard block
 block discarded – undo
3096 3096
  * @param array $settings GD design settings array.
3097 3097
  * @return array Filtered GD design settings array..
3098 3098
  */
3099
-function geodir_wpml_duplicate_settings( $settings = array() ) {
3099
+function geodir_wpml_duplicate_settings($settings = array()) {
3100 3100
     $new_settings = array();
3101 3101
     
3102
-    foreach ( $settings as $key => $setting ) {
3102
+    foreach ($settings as $key => $setting) {
3103 3103
         
3104
-        if ( isset( $setting['type'] ) && $setting['type'] == 'sectionend' && $setting['id'] == 'detail_page_settings' ) {
3104
+        if (isset($setting['type']) && $setting['type'] == 'sectionend' && $setting['id'] == 'detail_page_settings') {
3105 3105
             $new_settings[] = array(
3106 3106
                 'name' => __('Disable WPML duplicate translation', 'geodirectory'),
3107 3107
                 'desc' => __('Select post types to disable front end WPML duplicate translation. For selected post types the WPML duplicate option will be disabled from listing detail page sidebar.', 'geodirectory'),
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.
Spacing   +62 added lines, -62 removed lines patch added patch discarded remove patch
@@ -129,12 +129,12 @@  discard block
 block discarded – undo
129 129
 
130 130
     if (strpos($geodir_map_options['height'], '%') !== false || strpos($geodir_map_options['height'], 'px') !== false || strpos($geodir_map_options['height'], 'vh') !== false) {
131 131
     } else {
132
-        $geodir_map_options['height'] = $geodir_map_options['height'] . 'px';
132
+        $geodir_map_options['height'] = $geodir_map_options['height'].'px';
133 133
     }
134 134
 
135 135
     if (strpos($geodir_map_options['width'], '%') !== false || strpos($geodir_map_options['width'], 'px') !== false) {
136 136
     } else {
137
-        $geodir_map_options['width'] = $geodir_map_options['width'] . 'px';
137
+        $geodir_map_options['width'] = $geodir_map_options['width'].'px';
138 138
     }
139 139
 
140 140
     /**
@@ -166,10 +166,10 @@  discard block
 block discarded – undo
166 166
 	 */
167 167
 	$exclude_post_types = apply_filters("geodir_exclude_post_type_on_map_{$map_canvas_name}", get_option('geodir_exclude_post_type_on_map'));
168 168
 
169
-    if (count((array)$post_types) != count($exclude_post_types) || ($enable_jason_on_load)):
169
+    if (count((array) $post_types) != count($exclude_post_types) || ($enable_jason_on_load)):
170 170
         // Set default map options
171 171
 
172
-        wp_enqueue_script('geodir-map-widget', geodir_plugin_url() . '/geodirectory-functions/map-functions/js/map.min.js',array(),false,true);
172
+        wp_enqueue_script('geodir-map-widget', geodir_plugin_url().'/geodirectory-functions/map-functions/js/map.min.js', array(), false, true);
173 173
 
174 174
         wp_localize_script('geodir-map-widget', $map_canvas_name, $geodir_map_options);
175 175
 
@@ -188,41 +188,41 @@  discard block
 block discarded – undo
188 188
 		 */
189 189
 		$map_width = apply_filters('geodir_change_map_width', $map_width);
190 190
         ?>
191
-        <div id="catcher_<?php echo $map_canvas_name;?>"></div>
191
+        <div id="catcher_<?php echo $map_canvas_name; ?>"></div>
192 192
         <div class="stick_trigger_container">
193 193
             <div class="trigger_sticky triggeroff_sticky"></div>
194
-            <div class="top_banner_section geodir_map_container <?php echo $map_class_name;?>"
195
-                 id="sticky_map_<?php echo $map_canvas_name;?>"
196
-                 style="min-height:<?php echo $geodir_map_options['height'];?>;width:<?php echo $map_width;?>;">
194
+            <div class="top_banner_section geodir_map_container <?php echo $map_class_name; ?>"
195
+                 id="sticky_map_<?php echo $map_canvas_name; ?>"
196
+                 style="min-height:<?php echo $geodir_map_options['height']; ?>;width:<?php echo $map_width; ?>;">
197 197
 
198 198
                 <div class="map_background">
199 199
                     <div class="top_banner_section_in clearfix">
200
-                        <div class="<?php echo $map_canvas_name;?>_TopLeft TopLeft"><span class="triggermap" id="<?php echo $map_canvas_name;?>_triggermap" <?php if (!$geodir_map_options['enable_map_resize_button']) { ?> <?php }?>><i class="fa fa-arrows-alt"></i></span></div>
201
-                        <div class="<?php echo $map_canvas_name;?>_TopRight TopRight"></div>
202
-                        <div id="<?php echo $map_canvas_name;?>_wrapper" class="main_map_wrapper"
203
-                             style="height:<?php echo $geodir_map_options['height'];?>;width:<?php echo $map_width;?>;">
200
+                        <div class="<?php echo $map_canvas_name; ?>_TopLeft TopLeft"><span class="triggermap" id="<?php echo $map_canvas_name; ?>_triggermap" <?php if (!$geodir_map_options['enable_map_resize_button']) { ?> <?php }?>><i class="fa fa-arrows-alt"></i></span></div>
201
+                        <div class="<?php echo $map_canvas_name; ?>_TopRight TopRight"></div>
202
+                        <div id="<?php echo $map_canvas_name; ?>_wrapper" class="main_map_wrapper"
203
+                             style="height:<?php echo $geodir_map_options['height']; ?>;width:<?php echo $map_width; ?>;">
204 204
                             <!-- new map start -->
205 205
                             <div class="iprelative">
206
-                                <div class="geodir_marker_cluster" id="<?php echo $map_canvas_name;?>"
207
-                                     style="height:<?php echo $geodir_map_options['height'];?>;width:<?php echo $map_width;?>;"></div>
208
-                                <div id="<?php echo $map_canvas_name;?>_loading_div" class="loading_div"
209
-                                     style=" height:<?php echo $geodir_map_options['height'];?>;width:<?php echo $map_width;?>;"></div>
206
+                                <div class="geodir_marker_cluster" id="<?php echo $map_canvas_name; ?>"
207
+                                     style="height:<?php echo $geodir_map_options['height']; ?>;width:<?php echo $map_width; ?>;"></div>
208
+                                <div id="<?php echo $map_canvas_name; ?>_loading_div" class="loading_div"
209
+                                     style=" height:<?php echo $geodir_map_options['height']; ?>;width:<?php echo $map_width; ?>;"></div>
210 210
                                 <!--<div id="home_map_counter"></div>        -->
211
-                                <div id="<?php echo $map_canvas_name;?>_map_nofound"
211
+                                <div id="<?php echo $map_canvas_name; ?>_map_nofound"
212 212
                                      class="advmap_nofound"><?php echo MAP_NO_RESULTS; ?></div>
213
-                                <div id="<?php echo $map_canvas_name;?>_map_notloaded"
213
+                                <div id="<?php echo $map_canvas_name; ?>_map_notloaded"
214 214
                                      class="advmap_notloaded"><?php _e('<h3>Google Map Not Loaded</h3><p>Sorry, unable to load Google Maps API.', 'geodirectory'); ?></div>
215 215
                             </div>
216 216
                             <!-- new map end -->
217 217
                         </div>
218
-                        <div class="<?php echo $map_canvas_name;?>_BottomLeft BottomLeft"></div>
218
+                        <div class="<?php echo $map_canvas_name; ?>_BottomLeft BottomLeft"></div>
219 219
                     </div>
220 220
                 </div>
221 221
                 <?php if ($geodir_map_options['enable_jason_on_load']) { ?>
222
-                    <input type="hidden" id="<?php echo $map_canvas_name;?>_jason_enabled" value="1"/>
222
+                    <input type="hidden" id="<?php echo $map_canvas_name; ?>_jason_enabled" value="1"/>
223 223
                 <?php } else {
224 224
                     ?>
225
-                    <input type="hidden" id="<?php echo $map_canvas_name;?>_jason_enabled" value="0"/>
225
+                    <input type="hidden" id="<?php echo $map_canvas_name; ?>_jason_enabled" value="0"/>
226 226
                 <?php }
227 227
 
228 228
                 if (!$geodir_map_options['enable_text_search'] && !$geodir_map_options['enable_cat_filters'])
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
                       <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>
243 243
                     </div>
244 244
                     <script>
245
-                        <?php if(geodir_is_page('detail')){?>
245
+                        <?php if (geodir_is_page('detail')) {?>
246 246
                         jQuery(function () {
247 247
                             gd_initialize_ac();
248 248
                         });
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
                                 // Create the autocomplete object, restricting the search
254 254
                                 // to geographical location types.
255 255
                                 autocomplete = new google.maps.places.Autocomplete(
256
-                                    /** @type {HTMLInputElement} */(document.getElementById('<?php echo $map_canvas_name;?>_fromAddress')),
256
+                                    /** @type {HTMLInputElement} */(document.getElementById('<?php echo $map_canvas_name; ?>_fromAddress')),
257 257
                                     {types: ['geocode']});
258 258
                                 // When the user selects an address from the dropdown,
259 259
                                 // populate the address fields in the form.
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
                                 
268 268
                                 if (window.gdMaps == 'osm') {
269 269
                                     window.setTimeout(function() {
270
-                                        calcRoute('<?php echo $map_canvas_name;?>');
270
+                                        calcRoute('<?php echo $map_canvas_name; ?>');
271 271
                                     }, 1000);
272 272
                                 }
273 273
                             }
@@ -321,7 +321,7 @@  discard block
 block discarded – undo
321 321
 				 */
322 322
 				$map_search_pt = apply_filters('geodir_default_map_search_pt', $geodir_default_map_search_pt);
323 323
 				?>
324
-                <div class="map-category-listing-main" style="display:<?php echo $show_entire_cat_panel;?>">
324
+                <div class="map-category-listing-main" style="display:<?php echo $show_entire_cat_panel; ?>">
325 325
                     <?php
326 326
                     $exclude_post_types = get_option('geodir_exclude_post_type_on_map');
327 327
                     $geodir_available_pt_on_map = count(geodir_get_posttypes('array')) - count($exclude_post_types);
@@ -331,12 +331,12 @@  discard block
 block discarded – undo
331 331
 					}
332 332
                     ?>
333 333
                     <div
334
-                        class="map-category-listing<?php echo $map_cat_class;?>">
334
+                        class="map-category-listing<?php echo $map_cat_class; ?>">
335 335
                         <div class="gd-trigger gd-triggeroff"><i class="fa fa-compress"></i><i class="fa fa-expand"></i></div>
336
-                        <div id="<?php echo $map_canvas_name;?>_cat"
337
-                             class="<?php echo $map_canvas_name;?>_map_category  map_category"
338
-                             <?php if ($child_collapse){ ?>checked="checked" <?php }?>
339
-                             style="max-height:<?php echo $geodir_map_options['height'];?>;">
336
+                        <div id="<?php echo $map_canvas_name; ?>_cat"
337
+                             class="<?php echo $map_canvas_name; ?>_map_category  map_category"
338
+                             <?php if ($child_collapse) { ?>checked="checked" <?php }?>
339
+                             style="max-height:<?php echo $geodir_map_options['height']; ?>;">
340 340
                             <input
341 341
                                 onkeydown="if(event.keyCode == 13){build_map_ajax_search_param('<?php echo $map_canvas_name; ?>', false)}"
342 342
                                 type="text"
@@ -348,11 +348,11 @@  discard block
 block discarded – undo
348 348
                                     <input type="hidden" id="<?php echo $map_canvas_name; ?>_child_collapse" value="1"/>
349 349
                                 <?php } else {$child_collapse = "0";
350 350
                                     ?>
351
-                                    <input type="hidden" id="<?php echo $map_canvas_name;?>_child_collapse" value="0"/>
351
+                                    <input type="hidden" id="<?php echo $map_canvas_name; ?>_child_collapse" value="0"/>
352 352
                                 <?php } ?>
353 353
                                 <input type="hidden" id="<?php echo $map_canvas_name; ?>_cat_enabled" value="1"/>
354 354
                                 <div class="geodir_toggle">
355
-                                    <?php echo home_map_taxonomy_walker(array($map_search_pt.'category'),0,true,0,$map_canvas_name,$child_collapse,true); ?>
355
+                                    <?php echo home_map_taxonomy_walker(array($map_search_pt.'category'), 0, true, 0, $map_canvas_name, $child_collapse, true); ?>
356 356
                                     <script>jQuery( document ).ready(function() {
357 357
                                             geodir_show_sub_cat_collapse_button();
358 358
                                         });</script>
@@ -381,21 +381,21 @@  discard block
 block discarded – undo
381 381
 					$city = $country != 'me' ? $city : '';
382 382
                     $gd_neighbourhood = $country != 'me' ? $gd_neighbourhood : '';
383 383
                     ?>
384
-                    <input type="hidden" id="<?php echo $map_canvas_name;?>_location_enabled" value="1"/>
385
-                    <input type="hidden" id="<?php echo $map_canvas_name;?>_country" name="gd_country"
386
-                           value="<?php echo $country;?>"/>
387
-                    <input type="hidden" id="<?php echo $map_canvas_name;?>_region" name="gd_region"
388
-                           value="<?php echo $region;?>"/>
389
-                    <input type="hidden" id="<?php echo $map_canvas_name;?>_city" name="gd_city"
390
-                           value="<?php echo $city;?>"/>
391
-                    <input type="hidden" id="<?php echo $map_canvas_name;?>_neighbourhood" name="gd_neighbourhood"
392
-                           value="<?php echo $gd_neighbourhood;?>"/>
384
+                    <input type="hidden" id="<?php echo $map_canvas_name; ?>_location_enabled" value="1"/>
385
+                    <input type="hidden" id="<?php echo $map_canvas_name; ?>_country" name="gd_country"
386
+                           value="<?php echo $country; ?>"/>
387
+                    <input type="hidden" id="<?php echo $map_canvas_name; ?>_region" name="gd_region"
388
+                           value="<?php echo $region; ?>"/>
389
+                    <input type="hidden" id="<?php echo $map_canvas_name; ?>_city" name="gd_city"
390
+                           value="<?php echo $city; ?>"/>
391
+                    <input type="hidden" id="<?php echo $map_canvas_name; ?>_neighbourhood" name="gd_neighbourhood"
392
+                           value="<?php echo $gd_neighbourhood; ?>"/>
393 393
                 <?php } else { //end of location filter
394 394
                     ?>
395
-                    <input type="hidden" id="<?php echo $map_canvas_name;?>_location_enabled" value="0"/>
395
+                    <input type="hidden" id="<?php echo $map_canvas_name; ?>_location_enabled" value="0"/>
396 396
                 <?php }?>
397 397
 
398
-                <input type="hidden" id="<?php echo $map_canvas_name;?>_posttype" name="gd_posttype" value="<?php echo $map_search_pt;?>"/>
398
+                <input type="hidden" id="<?php echo $map_canvas_name; ?>_posttype" name="gd_posttype" value="<?php echo $map_search_pt; ?>"/>
399 399
 
400 400
                 <input type="hidden" name="limitstart" value=""/>
401 401
 
@@ -412,8 +412,8 @@  discard block
 block discarded – undo
412 412
                     }
413 413
                     if (count($map_post_types) > 1) {
414 414
                         ?>
415
-                        <div class="map-places-listing" id="<?php echo $map_canvas_name;?>_posttype_menu"
416
-                             style="max-width:<?php echo $map_width;?>!important;">
415
+                        <div class="map-places-listing" id="<?php echo $map_canvas_name; ?>_posttype_menu"
416
+                             style="max-width:<?php echo $map_width; ?>!important;">
417 417
 
418 418
                             <?php if (isset($geodir_map_options['is_geodir_home_map_widget']) && $map_args['is_geodir_home_map_widget']) { ?>
419 419
                             <div class="geodir-map-posttype-list"><?php } ?>
@@ -424,7 +424,7 @@  discard block
 block discarded – undo
424 424
                                     foreach ($post_types as $post_type => $args) {
425 425
                                         if (!in_array($post_type, $exclude_post_types)) {
426 426
                                             $class = $map_search_pt == $post_type ? 'class="gd-map-search-pt"' : '';
427
-											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>';
427
+											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>';
428 428
                                         }
429 429
                                     }
430 430
                                     ?>
@@ -449,9 +449,9 @@  discard block
 block discarded – undo
449 449
         <script type="text/javascript">
450 450
 
451 451
             jQuery(document).ready(function () {
452
-                //initMap('<?php echo $map_canvas_name;?>'); // depreciated, no need to load this twice
453
-                build_map_ajax_search_param('<?php echo $map_canvas_name;?>', false);
454
-                map_sticky('<?php echo $map_canvas_name;?>');
452
+                //initMap('<?php echo $map_canvas_name; ?>'); // depreciated, no need to load this twice
453
+                build_map_ajax_search_param('<?php echo $map_canvas_name; ?>', false);
454
+                map_sticky('<?php echo $map_canvas_name; ?>');
455 455
             });
456 456
 
457 457
         </script>
@@ -462,18 +462,18 @@  discard block
 block discarded – undo
462 462
             <script>
463 463
                 (function () {
464 464
                     var screenH = jQuery(window).height();
465
-                    var heightVH = "<?php echo str_replace("vh", "", $geodir_map_options['height']);?>";
465
+                    var heightVH = "<?php echo str_replace("vh", "", $geodir_map_options['height']); ?>";
466 466
 
467 467
                     var ptypeH = '';
468
-                    if (jQuery("#<?php echo $map_canvas_name;?>_posttype_menu").length) {
469
-                        ptypeH = jQuery("#<?php echo $map_canvas_name;?>_posttype_menu").outerHeight();
468
+                    if (jQuery("#<?php echo $map_canvas_name; ?>_posttype_menu").length) {
469
+                        ptypeH = jQuery("#<?php echo $map_canvas_name; ?>_posttype_menu").outerHeight();
470 470
                     }
471 471
 
472
-                    jQuery("#sticky_map_<?php echo $map_canvas_name;?>").css("min-height", screenH * (heightVH / 100) + 'px');
473
-                    jQuery("#<?php echo $map_canvas_name;?>_wrapper").height(screenH * (heightVH / 100) + 'px');
474
-                    jQuery("#<?php echo $map_canvas_name;?>").height(screenH * (heightVH / 100) + 'px');
475
-                    jQuery("#<?php echo $map_canvas_name;?>_loading_div").height(screenH * (heightVH / 100) + 'px');
476
-                    jQuery("#<?php echo $map_canvas_name;?>_cat").css("max-height", (screenH * (heightVH / 100)) - ptypeH + 'px');
472
+                    jQuery("#sticky_map_<?php echo $map_canvas_name; ?>").css("min-height", screenH * (heightVH / 100) + 'px');
473
+                    jQuery("#<?php echo $map_canvas_name; ?>_wrapper").height(screenH * (heightVH / 100) + 'px');
474
+                    jQuery("#<?php echo $map_canvas_name; ?>").height(screenH * (heightVH / 100) + 'px');
475
+                    jQuery("#<?php echo $map_canvas_name; ?>_loading_div").height(screenH * (heightVH / 100) + 'px');
476
+                    jQuery("#<?php echo $map_canvas_name; ?>_cat").css("max-height", (screenH * (heightVH / 100)) - ptypeH + 'px');
477 477
 
478 478
                 }());
479 479
             </script>
@@ -485,13 +485,13 @@  discard block
 block discarded – undo
485 485
             <script>
486 486
                 (function () {
487 487
                     var screenH = jQuery(window).height();
488
-                    var heightVH = "<?php echo str_replace("px", "", $geodir_map_options['height']);?>";
488
+                    var heightVH = "<?php echo str_replace("px", "", $geodir_map_options['height']); ?>";
489 489
                     var ptypeH = '';
490
-                    if (jQuery("#<?php echo $map_canvas_name;?>_posttype_menu").length) {
491
-                        ptypeH = jQuery("#<?php echo $map_canvas_name;?>_posttype_menu").outerHeight();
490
+                    if (jQuery("#<?php echo $map_canvas_name; ?>_posttype_menu").length) {
491
+                        ptypeH = jQuery("#<?php echo $map_canvas_name; ?>_posttype_menu").outerHeight();
492 492
                     }
493 493
 
494
-                    jQuery("#<?php echo $map_canvas_name;?>_cat").css("max-height", heightVH - ptypeH + 'px');
494
+                    jQuery("#<?php echo $map_canvas_name; ?>_cat").css("max-height", heightVH - ptypeH + 'px');
495 495
 
496 496
                 }());
497 497
             </script>
@@ -506,7 +506,7 @@  discard block
 block discarded – undo
506 506
          * @param array $geodir_map_options Array of map settings.
507 507
          * @param string $map_canvas_name The canvas name and ID for the map.
508 508
          */
509
-        do_action('geodir_map_after_render',$geodir_map_options,$map_canvas_name);
509
+        do_action('geodir_map_after_render', $geodir_map_options, $map_canvas_name);
510 510
 
511 511
 
512 512
     endif; // Exclude posttypes if end
Please login to merge, or discard this patch.
Indentation   +143 added lines, -143 removed lines patch added patch discarded remove patch
@@ -67,78 +67,78 @@  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
-    if (!empty($map_args)) {
126
-        foreach ($map_args as $map_option_key => $map_option_value) {
127
-            $geodir_map_options[$map_option_key] = $map_option_value;
128
-        }
129
-    }
130
-
131
-    if (strpos($geodir_map_options['height'], '%') !== false || strpos($geodir_map_options['height'], 'px') !== false || strpos($geodir_map_options['height'], 'vh') !== false) {
132
-    } else {
133
-        $geodir_map_options['height'] = $geodir_map_options['height'] . 'px';
134
-    }
135
-
136
-    if (strpos($geodir_map_options['width'], '%') !== false || strpos($geodir_map_options['width'], 'px') !== false) {
137
-    } else {
138
-        $geodir_map_options['width'] = $geodir_map_options['width'] . 'px';
139
-    }
140
-
141
-    /**
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
+	if (!empty($map_args)) {
126
+		foreach ($map_args as $map_option_key => $map_option_value) {
127
+			$geodir_map_options[$map_option_key] = $map_option_value;
128
+		}
129
+	}
130
+
131
+	if (strpos($geodir_map_options['height'], '%') !== false || strpos($geodir_map_options['height'], 'px') !== false || strpos($geodir_map_options['height'], 'vh') !== false) {
132
+	} else {
133
+		$geodir_map_options['height'] = $geodir_map_options['height'] . 'px';
134
+	}
135
+
136
+	if (strpos($geodir_map_options['width'], '%') !== false || strpos($geodir_map_options['width'], 'px') !== false) {
137
+	} else {
138
+		$geodir_map_options['width'] = $geodir_map_options['width'] . 'px';
139
+	}
140
+
141
+	/**
142 142
 	 * Filter the options to use in google map.
143 143
 	 *
144 144
 	 * @since 1.0.0
@@ -147,9 +147,9 @@  discard block
 block discarded – undo
147 147
 	 */
148 148
 	$geodir_map_options = apply_filters("geodir_map_options_{$map_canvas_name}", $geodir_map_options);
149 149
 
150
-    $map_canvas_arr[$map_canvas_name] = array();
150
+	$map_canvas_arr[$map_canvas_name] = array();
151 151
 
152
-    /**
152
+	/**
153 153
 	 * Filter the post types to display data on map.
154 154
 	 *
155 155
 	 * @since 1.0.0
@@ -167,20 +167,20 @@  discard block
 block discarded – undo
167 167
 	 */
168 168
 	$exclude_post_types = apply_filters("geodir_exclude_post_type_on_map_{$map_canvas_name}", get_option('geodir_exclude_post_type_on_map'));
169 169
 
170
-    if (count((array)$post_types) != count($exclude_post_types) || ($enable_jason_on_load)):
171
-        // Set default map options
170
+	if (count((array)$post_types) != count($exclude_post_types) || ($enable_jason_on_load)):
171
+		// Set default map options
172 172
 
173
-        wp_enqueue_script('geodir-map-widget', geodir_plugin_url() . '/geodirectory-functions/map-functions/js/map.min.js',array(),false,true);
173
+		wp_enqueue_script('geodir-map-widget', geodir_plugin_url() . '/geodirectory-functions/map-functions/js/map.min.js',array(),false,true);
174 174
 
175
-        wp_localize_script('geodir-map-widget', $map_canvas_name, $geodir_map_options);
175
+		wp_localize_script('geodir-map-widget', $map_canvas_name, $geodir_map_options);
176 176
 
177
-        if ($map_canvas_name == 'detail_page_map_canvas' || $map_canvas_name == 'preview_map_canvas') {
178
-            $map_width = '100%';
179
-        } else {
180
-            $map_width = $geodir_map_options['width'];
181
-        }
177
+		if ($map_canvas_name == 'detail_page_map_canvas' || $map_canvas_name == 'preview_map_canvas') {
178
+			$map_width = '100%';
179
+		} else {
180
+			$map_width = $geodir_map_options['width'];
181
+		}
182 182
 
183
-        /**
183
+		/**
184 184
 		 * Filter the width of map.
185 185
 		 *
186 186
 		 * @since 1.0.0
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
 		 * @param int $map_width Width of map box, eg: gd_place.
189 189
 		 */
190 190
 		$map_width = apply_filters('geodir_change_map_width', $map_width);
191
-        ?>
191
+		?>
192 192
         <div id="catcher_<?php echo $map_canvas_name;?>"></div>
193 193
         <div class="stick_trigger_container">
194 194
             <div class="trigger_sticky triggeroff_sticky"></div>
@@ -222,15 +222,15 @@  discard block
 block discarded – undo
222 222
                 <?php if ($geodir_map_options['enable_jason_on_load']) { ?>
223 223
                     <input type="hidden" id="<?php echo $map_canvas_name;?>_jason_enabled" value="1"/>
224 224
                 <?php } else {
225
-                    ?>
225
+					?>
226 226
                     <input type="hidden" id="<?php echo $map_canvas_name;?>_jason_enabled" value="0"/>
227 227
                 <?php }
228 228
 
229
-                if (!$geodir_map_options['enable_text_search'] && !$geodir_map_options['enable_cat_filters'])
230
-                    $show_entire_cat_panel = "none";
231
-                else
232
-                    $show_entire_cat_panel = "''";
233
-                ?>
229
+				if (!$geodir_map_options['enable_text_search'] && !$geodir_map_options['enable_cat_filters'])
230
+					$show_entire_cat_panel = "none";
231
+				else
232
+					$show_entire_cat_panel = "''";
233
+				?>
234 234
 
235 235
                 <?php if ($geodir_map_options['enable_map_direction']) { ?>
236 236
                     <div class="gd-input-group gd-get-directions">
@@ -293,8 +293,8 @@  discard block
 block discarded – undo
293 293
                         <select id="travel-units" onchange="calcRoute('<?php echo $map_canvas_name; ?>')">
294 294
                             <option value="miles"><?php _e('Miles', 'geodirectory'); ?></option>
295 295
                             <option <?php if (get_option('geodir_search_dist_1') == 'km') {
296
-                                echo 'selected="selected"';
297
-                            } ?> value="kilometers"><?php _e('Kilometers', 'geodirectory'); ?></option>
296
+								echo 'selected="selected"';
297
+							} ?> value="kilometers"><?php _e('Kilometers', 'geodirectory'); ?></option>
298 298
                         </select>
299 299
                     </div>
300 300
 
@@ -306,12 +306,12 @@  discard block
 block discarded – undo
306 306
 				if (empty($geodir_default_map_search_pt))
307 307
 					$geodir_default_map_search_pt = 'gd_place';
308 308
 
309
-                global $gd_session;
310
-                $homemap_catlist_ptype = $gd_session->get('homemap_catlist_ptype');
309
+				global $gd_session;
310
+				$homemap_catlist_ptype = $gd_session->get('homemap_catlist_ptype');
311 311
 
312
-                if ($homemap_catlist_ptype) {
313
-                    $geodir_default_map_search_pt = $homemap_catlist_ptype;
314
-                }
312
+				if ($homemap_catlist_ptype) {
313
+					$geodir_default_map_search_pt = $homemap_catlist_ptype;
314
+				}
315 315
 
316 316
 				/**
317 317
 				 * Filter the post type to retrieve data for map
@@ -324,13 +324,13 @@  discard block
 block discarded – undo
324 324
 				?>
325 325
                 <div class="map-category-listing-main" style="display:<?php echo $show_entire_cat_panel;?>">
326 326
                     <?php
327
-                    $exclude_post_types = get_option('geodir_exclude_post_type_on_map');
328
-                    $geodir_available_pt_on_map = count(geodir_get_posttypes('array')) - count($exclude_post_types);
327
+					$exclude_post_types = get_option('geodir_exclude_post_type_on_map');
328
+					$geodir_available_pt_on_map = count(geodir_get_posttypes('array')) - count($exclude_post_types);
329 329
 					$map_cat_class = '';
330 330
 					if ($geodir_map_options['enable_post_type_filters']) {
331 331
 						$map_cat_class = $geodir_available_pt_on_map > 1 ? ' map-cat-ptypes' : ' map-cat-floor';
332 332
 					}
333
-                    ?>
333
+					?>
334 334
                     <div
335 335
                         class="map-category-listing<?php echo $map_cat_class;?>">
336 336
                         <div class="gd-trigger gd-triggeroff"><i class="fa fa-compress"></i><i class="fa fa-expand"></i></div>
@@ -348,7 +348,7 @@  discard block
 block discarded – undo
348 348
                                 <?php if ($geodir_map_options['child_collapse']) { $child_collapse = "1"; ?>
349 349
                                     <input type="hidden" id="<?php echo $map_canvas_name; ?>_child_collapse" value="1"/>
350 350
                                 <?php } else {$child_collapse = "0";
351
-                                    ?>
351
+									?>
352 352
                                     <input type="hidden" id="<?php echo $map_canvas_name;?>_child_collapse" value="0"/>
353 353
                                 <?php } ?>
354 354
                                 <input type="hidden" id="<?php echo $map_canvas_name; ?>_cat_enabled" value="1"/>
@@ -370,18 +370,18 @@  discard block
 block discarded – undo
370 370
                 <!-- map-category-listings-->
371 371
 
372 372
                 <?php
373
-                if ($geodir_map_options['enable_location_filters']) {
374
-                    $country = get_query_var('gd_country');
373
+				if ($geodir_map_options['enable_location_filters']) {
374
+					$country = get_query_var('gd_country');
375 375
 					$region = get_query_var('gd_region');
376 376
 					$city = get_query_var('gd_city');
377
-                    $gd_neighbourhood = get_query_var('gd_neighbourhood');
377
+					$gd_neighbourhood = get_query_var('gd_neighbourhood');
378 378
                     
379
-                    //fix for location/me page
380
-                    $country = $country != 'me' ? $country : '';
379
+					//fix for location/me page
380
+					$country = $country != 'me' ? $country : '';
381 381
 					$region = $region != 'me' ? $region : '';
382 382
 					$city = $country != 'me' ? $city : '';
383
-                    $gd_neighbourhood = $country != 'me' ? $gd_neighbourhood : '';
384
-                    ?>
383
+					$gd_neighbourhood = $country != 'me' ? $gd_neighbourhood : '';
384
+					?>
385 385
                     <input type="hidden" id="<?php echo $map_canvas_name;?>_location_enabled" value="1"/>
386 386
                     <input type="hidden" id="<?php echo $map_canvas_name;?>_country" name="gd_country"
387 387
                            value="<?php echo $country;?>"/>
@@ -392,7 +392,7 @@  discard block
 block discarded – undo
392 392
                     <input type="hidden" id="<?php echo $map_canvas_name;?>_neighbourhood" name="gd_neighbourhood"
393 393
                            value="<?php echo $gd_neighbourhood;?>"/>
394 394
                 <?php } else { //end of location filter
395
-                    ?>
395
+					?>
396 396
                     <input type="hidden" id="<?php echo $map_canvas_name;?>_location_enabled" value="0"/>
397 397
                 <?php }?>
398 398
 
@@ -403,16 +403,16 @@  discard block
 block discarded – undo
403 403
 
404 404
 
405 405
                 <?php if ($geodir_map_options['enable_post_type_filters']) {
406
-                    $post_types = geodir_get_posttypes('object');
407
-                    $all_post_types = geodir_get_posttypes('names');
408
-                    $exclude_post_types = get_option('geodir_exclude_post_type_on_map');
409
-                    if (is_array($exclude_post_types)) {
410
-                        $map_post_types = array_diff($all_post_types, $exclude_post_types);
411
-                    } else {
412
-                        $map_post_types = $all_post_types;
413
-                    }
414
-                    if (count($map_post_types) > 1) {
415
-                        ?>
406
+					$post_types = geodir_get_posttypes('object');
407
+					$all_post_types = geodir_get_posttypes('names');
408
+					$exclude_post_types = get_option('geodir_exclude_post_type_on_map');
409
+					if (is_array($exclude_post_types)) {
410
+						$map_post_types = array_diff($all_post_types, $exclude_post_types);
411
+					} else {
412
+						$map_post_types = $all_post_types;
413
+					}
414
+					if (count($map_post_types) > 1) {
415
+						?>
416 416
                         <div class="map-places-listing" id="<?php echo $map_canvas_name;?>_posttype_menu"
417 417
                              style="max-width:<?php echo $map_width;?>!important;">
418 418
 
@@ -422,13 +422,13 @@  discard block
 block discarded – undo
422 422
                                     <?php
423 423
 
424 424
 
425
-                                    foreach ($post_types as $post_type => $args) {
426
-                                        if (!in_array($post_type, $exclude_post_types)) {
427
-                                            $class = $map_search_pt == $post_type ? 'class="gd-map-search-pt"' : '';
425
+									foreach ($post_types as $post_type => $args) {
426
+										if (!in_array($post_type, $exclude_post_types)) {
427
+											$class = $map_search_pt == $post_type ? 'class="gd-map-search-pt"' : '';
428 428
 											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>';
429
-                                        }
430
-                                    }
431
-                                    ?>
429
+										}
430
+									}
431
+									?>
432 432
                                 </ul>
433 433
                                 <?php if (isset($geodir_map_options['is_geodir_home_map_widget']) && $map_args['is_geodir_home_map_widget']) { ?>
434 434
                             </div><?php } ?>
@@ -442,8 +442,8 @@  discard block
 block discarded – undo
442 442
 
443 443
                         </div> <!-- map-places-listings-->
444 444
                     <?php }
445
-                } // end of post type filter if
446
-                ?>
445
+				} // end of post type filter if
446
+				?>
447 447
 
448 448
             </div>
449 449
         </div> <!--end of stick trigger container-->
@@ -458,8 +458,8 @@  discard block
 block discarded – undo
458 458
         </script>
459 459
         <?php
460 460
 
461
-        if (strpos($geodir_map_options['height'], 'vh')) {
462
-            ?>
461
+		if (strpos($geodir_map_options['height'], 'vh')) {
462
+			?>
463 463
             <script>
464 464
                 (function () {
465 465
                     var screenH = jQuery(window).height();
@@ -481,8 +481,8 @@  discard block
 block discarded – undo
481 481
 
482 482
         <?php
483 483
 
484
-        } elseif (strpos($geodir_map_options['height'], 'px')) {
485
-            ?>
484
+		} elseif (strpos($geodir_map_options['height'], 'px')) {
485
+			?>
486 486
             <script>
487 487
                 (function () {
488 488
                     var screenH = jQuery(window).height();
@@ -497,20 +497,20 @@  discard block
 block discarded – undo
497 497
                 }());
498 498
             </script>
499 499
         <?php
500
-        }
500
+		}
501 501
 
502
-        /**
503
-         * Action that runs after all the map code has been output;
504
-         *
505
-         * @since 1.5.3
506
-         *
507
-         * @param array $geodir_map_options Array of map settings.
508
-         * @param string $map_canvas_name The canvas name and ID for the map.
509
-         */
510
-        do_action('geodir_map_after_render',$geodir_map_options,$map_canvas_name);
502
+		/**
503
+		 * Action that runs after all the map code has been output;
504
+		 *
505
+		 * @since 1.5.3
506
+		 *
507
+		 * @param array $geodir_map_options Array of map settings.
508
+		 * @param string $map_canvas_name The canvas name and ID for the map.
509
+		 */
510
+		do_action('geodir_map_after_render',$geodir_map_options,$map_canvas_name);
511 511
 
512 512
 
513
-    endif; // Exclude posttypes if end
513
+	endif; // Exclude posttypes if end
514 514
 }
515 515
 
516 516
 /**
Please login to merge, or discard this patch.