Test Failed
Push — master ( f5f5fe...9630d5 )
by Stiofan
04:13
created
geodirectory-admin/google-api-php-client/src/Google/IO/Abstract.php 2 patches
Indentation   +165 added lines, -165 removed lines patch added patch discarded remove patch
@@ -28,19 +28,19 @@  discard block
 block discarded – undo
28 28
   const UNKNOWN_CODE = 0;
29 29
   const FORM_URLENCODED = 'application/x-www-form-urlencoded';
30 30
   private static $CONNECTION_ESTABLISHED_HEADERS = array(
31
-    "HTTP/1.0 200 Connection established\r\n\r\n",
32
-    "HTTP/1.1 200 Connection established\r\n\r\n",
31
+	"HTTP/1.0 200 Connection established\r\n\r\n",
32
+	"HTTP/1.1 200 Connection established\r\n\r\n",
33 33
   );
34 34
   private static $ENTITY_HTTP_METHODS = array("POST" => null, "PUT" => null);
35 35
   private static $HOP_BY_HOP = array(
36
-    'connection' => true,
37
-    'keep-alive' => true,
38
-    'proxy-authenticate' => true,
39
-    'proxy-authorization' => true,
40
-    'te' => true,
41
-    'trailers' => true,
42
-    'transfer-encoding' => true,
43
-    'upgrade' => true
36
+	'connection' => true,
37
+	'keep-alive' => true,
38
+	'proxy-authenticate' => true,
39
+	'proxy-authorization' => true,
40
+	'te' => true,
41
+	'trailers' => true,
42
+	'transfer-encoding' => true,
43
+	'upgrade' => true
44 44
   );
45 45
 
46 46
 
@@ -49,11 +49,11 @@  discard block
 block discarded – undo
49 49
 
50 50
   public function __construct(Google_Client $client)
51 51
   {
52
-    $this->client = $client;
53
-    $timeout = $client->getClassConfig('Google_IO_Abstract', 'request_timeout_seconds');
54
-    if ($timeout > 0) {
55
-      $this->setTimeout($timeout);
56
-    }
52
+	$this->client = $client;
53
+	$timeout = $client->getClassConfig('Google_IO_Abstract', 'request_timeout_seconds');
54
+	if ($timeout > 0) {
55
+	  $this->setTimeout($timeout);
56
+	}
57 57
   }
58 58
 
59 59
   /**
@@ -102,13 +102,13 @@  discard block
 block discarded – undo
102 102
    */
103 103
   public function setCachedRequest(Google_Http_Request $request)
104 104
   {
105
-    // Determine if the request is cacheable.
106
-    if (Google_Http_CacheParser::isResponseCacheable($request)) {
107
-      $this->client->getCache()->set($request->getCacheKey(), $request);
108
-      return true;
109
-    }
105
+	// Determine if the request is cacheable.
106
+	if (Google_Http_CacheParser::isResponseCacheable($request)) {
107
+	  $this->client->getCache()->set($request->getCacheKey(), $request);
108
+	  return true;
109
+	}
110 110
 
111
-    return false;
111
+	return false;
112 112
   }
113 113
 
114 114
   /**
@@ -121,37 +121,37 @@  discard block
 block discarded – undo
121 121
    */
122 122
   public function makeRequest(Google_Http_Request $request)
123 123
   {
124
-    // First, check to see if we have a valid cached version.
125
-    $cached = $this->getCachedRequest($request);
126
-    if ($cached !== false && $cached instanceof Google_Http_Request) {
127
-      if (!$this->checkMustRevalidateCachedRequest($cached, $request)) {
128
-        return $cached;
129
-      }
130
-    }
131
-
132
-    if (array_key_exists($request->getRequestMethod(), self::$ENTITY_HTTP_METHODS)) {
133
-      $request = $this->processEntityRequest($request);
134
-    }
135
-
136
-    list($responseData, $responseHeaders, $respHttpCode) = $this->executeRequest($request);
137
-
138
-    if ($respHttpCode == 304 && $cached) {
139
-      // If the server responded NOT_MODIFIED, return the cached request.
140
-      $this->updateCachedRequest($cached, $responseHeaders);
141
-      return $cached;
142
-    }
143
-
144
-    if (!isset($responseHeaders['Date']) && !isset($responseHeaders['date'])) {
145
-      $responseHeaders['date'] = date("r");
146
-    }
147
-
148
-    $request->setResponseHttpCode($respHttpCode);
149
-    $request->setResponseHeaders($responseHeaders);
150
-    $request->setResponseBody($responseData);
151
-    // Store the request in cache (the function checks to see if the request
152
-    // can actually be cached)
153
-    $this->setCachedRequest($request);
154
-    return $request;
124
+	// First, check to see if we have a valid cached version.
125
+	$cached = $this->getCachedRequest($request);
126
+	if ($cached !== false && $cached instanceof Google_Http_Request) {
127
+	  if (!$this->checkMustRevalidateCachedRequest($cached, $request)) {
128
+		return $cached;
129
+	  }
130
+	}
131
+
132
+	if (array_key_exists($request->getRequestMethod(), self::$ENTITY_HTTP_METHODS)) {
133
+	  $request = $this->processEntityRequest($request);
134
+	}
135
+
136
+	list($responseData, $responseHeaders, $respHttpCode) = $this->executeRequest($request);
137
+
138
+	if ($respHttpCode == 304 && $cached) {
139
+	  // If the server responded NOT_MODIFIED, return the cached request.
140
+	  $this->updateCachedRequest($cached, $responseHeaders);
141
+	  return $cached;
142
+	}
143
+
144
+	if (!isset($responseHeaders['Date']) && !isset($responseHeaders['date'])) {
145
+	  $responseHeaders['date'] = date("r");
146
+	}
147
+
148
+	$request->setResponseHttpCode($respHttpCode);
149
+	$request->setResponseHeaders($responseHeaders);
150
+	$request->setResponseBody($responseData);
151
+	// Store the request in cache (the function checks to see if the request
152
+	// can actually be cached)
153
+	$this->setCachedRequest($request);
154
+	return $request;
155 155
   }
156 156
 
157 157
   /**
@@ -162,11 +162,11 @@  discard block
 block discarded – undo
162 162
    */
163 163
   public function getCachedRequest(Google_Http_Request $request)
164 164
   {
165
-    if (false === Google_Http_CacheParser::isRequestCacheable($request)) {
166
-      return false;
167
-    }
165
+	if (false === Google_Http_CacheParser::isRequestCacheable($request)) {
166
+	  return false;
167
+	}
168 168
 
169
-    return $this->client->getCache()->get($request->getCacheKey());
169
+	return $this->client->getCache()->get($request->getCacheKey());
170 170
   }
171 171
 
172 172
   /**
@@ -177,28 +177,28 @@  discard block
 block discarded – undo
177 177
    */
178 178
   public function processEntityRequest(Google_Http_Request $request)
179 179
   {
180
-    $postBody = $request->getPostBody();
181
-    $contentType = $request->getRequestHeader("content-type");
182
-
183
-    // Set the default content-type as application/x-www-form-urlencoded.
184
-    if (false == $contentType) {
185
-      $contentType = self::FORM_URLENCODED;
186
-      $request->setRequestHeaders(array('content-type' => $contentType));
187
-    }
188
-
189
-    // Force the payload to match the content-type asserted in the header.
190
-    if ($contentType == self::FORM_URLENCODED && is_array($postBody)) {
191
-      $postBody = http_build_query($postBody, '', '&');
192
-      $request->setPostBody($postBody);
193
-    }
194
-
195
-    // Make sure the content-length header is set.
196
-    if (!$postBody || is_string($postBody)) {
197
-      $postsLength = strlen($postBody);
198
-      $request->setRequestHeaders(array('content-length' => $postsLength));
199
-    }
200
-
201
-    return $request;
180
+	$postBody = $request->getPostBody();
181
+	$contentType = $request->getRequestHeader("content-type");
182
+
183
+	// Set the default content-type as application/x-www-form-urlencoded.
184
+	if (false == $contentType) {
185
+	  $contentType = self::FORM_URLENCODED;
186
+	  $request->setRequestHeaders(array('content-type' => $contentType));
187
+	}
188
+
189
+	// Force the payload to match the content-type asserted in the header.
190
+	if ($contentType == self::FORM_URLENCODED && is_array($postBody)) {
191
+	  $postBody = http_build_query($postBody, '', '&');
192
+	  $request->setPostBody($postBody);
193
+	}
194
+
195
+	// Make sure the content-length header is set.
196
+	if (!$postBody || is_string($postBody)) {
197
+	  $postsLength = strlen($postBody);
198
+	  $request->setRequestHeaders(array('content-length' => $postsLength));
199
+	}
200
+
201
+	return $request;
202 202
   }
203 203
 
204 204
   /**
@@ -211,21 +211,21 @@  discard block
 block discarded – undo
211 211
    */
212 212
   protected function checkMustRevalidateCachedRequest($cached, $request)
213 213
   {
214
-    if (Google_Http_CacheParser::mustRevalidate($cached)) {
215
-      $addHeaders = array();
216
-      if ($cached->getResponseHeader('etag')) {
217
-        // [13.3.4] If an entity tag has been provided by the origin server,
218
-        // we must use that entity tag in any cache-conditional request.
219
-        $addHeaders['If-None-Match'] = $cached->getResponseHeader('etag');
220
-      } elseif ($cached->getResponseHeader('date')) {
221
-        $addHeaders['If-Modified-Since'] = $cached->getResponseHeader('date');
222
-      }
223
-
224
-      $request->setRequestHeaders($addHeaders);
225
-      return true;
226
-    } else {
227
-      return false;
228
-    }
214
+	if (Google_Http_CacheParser::mustRevalidate($cached)) {
215
+	  $addHeaders = array();
216
+	  if ($cached->getResponseHeader('etag')) {
217
+		// [13.3.4] If an entity tag has been provided by the origin server,
218
+		// we must use that entity tag in any cache-conditional request.
219
+		$addHeaders['If-None-Match'] = $cached->getResponseHeader('etag');
220
+	  } elseif ($cached->getResponseHeader('date')) {
221
+		$addHeaders['If-Modified-Since'] = $cached->getResponseHeader('date');
222
+	  }
223
+
224
+	  $request->setRequestHeaders($addHeaders);
225
+	  return true;
226
+	} else {
227
+	  return false;
228
+	}
229 229
   }
230 230
 
231 231
   /**
@@ -235,19 +235,19 @@  discard block
 block discarded – undo
235 235
    */
236 236
   protected function updateCachedRequest($cached, $responseHeaders)
237 237
   {
238
-    $hopByHop = self::$HOP_BY_HOP;
239
-    if (!empty($responseHeaders['connection'])) {
240
-      $connectionHeaders = array_map(
241
-          'strtolower',
242
-          array_filter(
243
-              array_map('trim', explode(',', $responseHeaders['connection']))
244
-          )
245
-      );
246
-      $hopByHop += array_fill_keys($connectionHeaders, true);
247
-    }
248
-
249
-    $endToEnd = array_diff_key($responseHeaders, $hopByHop);
250
-    $cached->setResponseHeaders($endToEnd);
238
+	$hopByHop = self::$HOP_BY_HOP;
239
+	if (!empty($responseHeaders['connection'])) {
240
+	  $connectionHeaders = array_map(
241
+		  'strtolower',
242
+		  array_filter(
243
+			  array_map('trim', explode(',', $responseHeaders['connection']))
244
+		  )
245
+	  );
246
+	  $hopByHop += array_fill_keys($connectionHeaders, true);
247
+	}
248
+
249
+	$endToEnd = array_diff_key($responseHeaders, $hopByHop);
250
+	$cached->setResponseHeaders($endToEnd);
251 251
   }
252 252
 
253 253
   /**
@@ -259,33 +259,33 @@  discard block
 block discarded – undo
259 259
    */
260 260
   public function parseHttpResponse($respData, $headerSize)
261 261
   {
262
-    // check proxy header
263
-    foreach (self::$CONNECTION_ESTABLISHED_HEADERS as $established_header) {
264
-      if (stripos($respData, $established_header) !== false) {
265
-        // existed, remove it
266
-        $respData = str_ireplace($established_header, '', $respData);
267
-        // Subtract the proxy header size unless the cURL bug prior to 7.30.0
268
-        // is present which prevented the proxy header size from being taken into
269
-        // account.
270
-        if (!$this->needsQuirk()) {
271
-          $headerSize -= strlen($established_header);
272
-        }
273
-        break;
274
-      }
275
-    }
276
-
277
-    if ($headerSize) {
278
-      $responseBody = substr($respData, $headerSize);
279
-      $responseHeaders = substr($respData, 0, $headerSize);
280
-    } else {
281
-      $responseSegments = explode("\r\n\r\n", $respData, 2);
282
-      $responseHeaders = $responseSegments[0];
283
-      $responseBody = isset($responseSegments[1]) ? $responseSegments[1] :
284
-                                                    null;
285
-    }
286
-
287
-    $responseHeaders = $this->getHttpResponseHeaders($responseHeaders);
288
-    return array($responseHeaders, $responseBody);
262
+	// check proxy header
263
+	foreach (self::$CONNECTION_ESTABLISHED_HEADERS as $established_header) {
264
+	  if (stripos($respData, $established_header) !== false) {
265
+		// existed, remove it
266
+		$respData = str_ireplace($established_header, '', $respData);
267
+		// Subtract the proxy header size unless the cURL bug prior to 7.30.0
268
+		// is present which prevented the proxy header size from being taken into
269
+		// account.
270
+		if (!$this->needsQuirk()) {
271
+		  $headerSize -= strlen($established_header);
272
+		}
273
+		break;
274
+	  }
275
+	}
276
+
277
+	if ($headerSize) {
278
+	  $responseBody = substr($respData, $headerSize);
279
+	  $responseHeaders = substr($respData, 0, $headerSize);
280
+	} else {
281
+	  $responseSegments = explode("\r\n\r\n", $respData, 2);
282
+	  $responseHeaders = $responseSegments[0];
283
+	  $responseBody = isset($responseSegments[1]) ? $responseSegments[1] :
284
+													null;
285
+	}
286
+
287
+	$responseHeaders = $this->getHttpResponseHeaders($responseHeaders);
288
+	return array($responseHeaders, $responseBody);
289 289
   }
290 290
 
291 291
   /**
@@ -295,45 +295,45 @@  discard block
 block discarded – undo
295 295
    */
296 296
   public function getHttpResponseHeaders($rawHeaders)
297 297
   {
298
-    if (is_array($rawHeaders)) {
299
-      return $this->parseArrayHeaders($rawHeaders);
300
-    } else {
301
-      return $this->parseStringHeaders($rawHeaders);
302
-    }
298
+	if (is_array($rawHeaders)) {
299
+	  return $this->parseArrayHeaders($rawHeaders);
300
+	} else {
301
+	  return $this->parseStringHeaders($rawHeaders);
302
+	}
303 303
   }
304 304
 
305 305
   private function parseStringHeaders($rawHeaders)
306 306
   {
307
-    $headers = array();
308
-    $responseHeaderLines = explode("\r\n", $rawHeaders);
309
-    foreach ($responseHeaderLines as $headerLine) {
310
-      if ($headerLine && strpos($headerLine, ':') !== false) {
311
-        list($header, $value) = explode(': ', $headerLine, 2);
312
-        $header = strtolower($header);
313
-        if (isset($headers[$header])) {
314
-          $headers[$header] .= "\n" . $value;
315
-        } else {
316
-          $headers[$header] = $value;
317
-        }
318
-      }
319
-    }
320
-    return $headers;
307
+	$headers = array();
308
+	$responseHeaderLines = explode("\r\n", $rawHeaders);
309
+	foreach ($responseHeaderLines as $headerLine) {
310
+	  if ($headerLine && strpos($headerLine, ':') !== false) {
311
+		list($header, $value) = explode(': ', $headerLine, 2);
312
+		$header = strtolower($header);
313
+		if (isset($headers[$header])) {
314
+		  $headers[$header] .= "\n" . $value;
315
+		} else {
316
+		  $headers[$header] = $value;
317
+		}
318
+	  }
319
+	}
320
+	return $headers;
321 321
   }
322 322
 
323 323
   private function parseArrayHeaders($rawHeaders)
324 324
   {
325
-    $header_count = count($rawHeaders);
326
-    $headers = array();
327
-
328
-    for ($i = 0; $i < $header_count; $i++) {
329
-      $header = $rawHeaders[$i];
330
-      // Times will have colons in - so we just want the first match.
331
-      $header_parts = explode(': ', $header, 2);
332
-      if (count($header_parts) == 2) {
333
-        $headers[strtolower($header_parts[0])] = $header_parts[1];
334
-      }
335
-    }
336
-
337
-    return $headers;
325
+	$header_count = count($rawHeaders);
326
+	$headers = array();
327
+
328
+	for ($i = 0; $i < $header_count; $i++) {
329
+	  $header = $rawHeaders[$i];
330
+	  // Times will have colons in - so we just want the first match.
331
+	  $header_parts = explode(': ', $header, 2);
332
+	  if (count($header_parts) == 2) {
333
+		$headers[strtolower($header_parts[0])] = $header_parts[1];
334
+	  }
335
+	}
336
+
337
+	return $headers;
338 338
   }
339 339
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -4 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
  */
21 21
 
22 22
 if (!class_exists('Google_Client')) {
23
-  require_once dirname(__FILE__) . '/../autoload.php';
23
+  require_once dirname(__FILE__).'/../autoload.php';
24 24
 }
25 25
 
26 26
 abstract class Google_IO_Abstract
@@ -280,8 +280,7 @@  discard block
 block discarded – undo
280 280
     } else {
281 281
       $responseSegments = explode("\r\n\r\n", $respData, 2);
282 282
       $responseHeaders = $responseSegments[0];
283
-      $responseBody = isset($responseSegments[1]) ? $responseSegments[1] :
284
-                                                    null;
283
+      $responseBody = isset($responseSegments[1]) ? $responseSegments[1] : null;
285 284
     }
286 285
 
287 286
     $responseHeaders = $this->getHttpResponseHeaders($responseHeaders);
@@ -311,7 +310,7 @@  discard block
 block discarded – undo
311 310
         list($header, $value) = explode(': ', $headerLine, 2);
312 311
         $header = strtolower($header);
313 312
         if (isset($headers[$header])) {
314
-          $headers[$header] .= "\n" . $value;
313
+          $headers[$header] .= "\n".$value;
315 314
         } else {
316 315
           $headers[$header] = $value;
317 316
         }
Please login to merge, or discard this patch.
geodirectory-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-functions/map-functions/get_markers.php 3 patches
Indentation   +230 added lines, -230 removed lines patch added patch discarded remove patch
@@ -7,61 +7,61 @@  discard block
 block discarded – undo
7 7
  */
8 8
  
9 9
 if (isset($_REQUEST['ajax_action']) && $_REQUEST['ajax_action'] == 'homemap_catlist') {
10
-    global $gd_session;
11
-    $gd_post_type = sanitize_text_field($_REQUEST['post_type']);
12
-    $gd_session->set('homemap_catlist_ptype', $gd_post_type);
13
-    $post_taxonomy = geodir_get_taxonomies($gd_post_type);
14
-    $map_canvas_name = sanitize_text_field($_REQUEST['map_canvas']);
15
-    $child_collapse = (bool)$_REQUEST['child_collapse'];
16
-    echo home_map_taxonomy_walker($post_taxonomy, 0, true, 0, $map_canvas_name, $child_collapse, true);
17
-    die;
10
+	global $gd_session;
11
+	$gd_post_type = sanitize_text_field($_REQUEST['post_type']);
12
+	$gd_session->set('homemap_catlist_ptype', $gd_post_type);
13
+	$post_taxonomy = geodir_get_taxonomies($gd_post_type);
14
+	$map_canvas_name = sanitize_text_field($_REQUEST['map_canvas']);
15
+	$child_collapse = (bool)$_REQUEST['child_collapse'];
16
+	echo home_map_taxonomy_walker($post_taxonomy, 0, true, 0, $map_canvas_name, $child_collapse, true);
17
+	die;
18 18
 }
19 19
 
20 20
 // Send the content-type header with correct encoding
21 21
 header("Content-type: text/javascript; charset=utf-8");
22 22
 
23 23
 if (isset($_REQUEST['ajax_action']) && $_REQUEST['ajax_action'] == 'cat') { // Retrives markers data for categories
24
-    echo get_markers();
25
-    exit;
24
+	echo get_markers();
25
+	exit;
26 26
 } else if (isset($_REQUEST['ajax_action']) && $_REQUEST['ajax_action'] == 'info') { // Retrives marker info window html
27
-    /**
28
-     * @global object $wpdb WordPress Database object.
29
-     * @global string $plugin_prefix Geodirectory plugin table prefix.
30
-     * @global object $gd_session GeoDirectory Session object.
31
-     */
32
-    global $wpdb, $plugin_prefix, $gd_session;
33
-
34
-    if ($_REQUEST['m_id'] != '') {
35
-        $pid = (int)$_REQUEST['m_id'];
36
-    } else {
37
-        echo __('No marker data found', 'geodirectory');
38
-        exit;
39
-    }
40
-
41
-    if (isset($_REQUEST['post_preview']) && $_REQUEST['post_preview'] != '' && $gd_ses_listing = $gd_session->get('listing')) {
42
-        $post = (object)$gd_ses_listing;
43
-        echo geodir_get_infowindow_html($post, $_REQUEST['post_preview']);
44
-    } else {
45
-        $geodir_post_type = get_post_type($pid);
46
-
47
-        $table = $plugin_prefix . $geodir_post_type . '_detail';
48
-
49
-        $sql = $wpdb->prepare("SELECT * FROM " . $table . " WHERE post_id = %d", array($pid));
50
-
51
-        $postinfo = $wpdb->get_results($sql);
52
-
53
-        $data_arr = array();
54
-
55
-        if ($postinfo) {
56
-            $srcharr = array("'", "/", "-", '"', '\\');
57
-            $replarr = array("&prime;", "&frasl;", "&ndash;", "&ldquo;", '');
58
-
59
-            foreach ($postinfo as $postinfo_obj) {
60
-                echo geodir_get_infowindow_html($postinfo_obj);
61
-            }
62
-        }
63
-    }
64
-    exit;
27
+	/**
28
+	 * @global object $wpdb WordPress Database object.
29
+	 * @global string $plugin_prefix Geodirectory plugin table prefix.
30
+	 * @global object $gd_session GeoDirectory Session object.
31
+	 */
32
+	global $wpdb, $plugin_prefix, $gd_session;
33
+
34
+	if ($_REQUEST['m_id'] != '') {
35
+		$pid = (int)$_REQUEST['m_id'];
36
+	} else {
37
+		echo __('No marker data found', 'geodirectory');
38
+		exit;
39
+	}
40
+
41
+	if (isset($_REQUEST['post_preview']) && $_REQUEST['post_preview'] != '' && $gd_ses_listing = $gd_session->get('listing')) {
42
+		$post = (object)$gd_ses_listing;
43
+		echo geodir_get_infowindow_html($post, $_REQUEST['post_preview']);
44
+	} else {
45
+		$geodir_post_type = get_post_type($pid);
46
+
47
+		$table = $plugin_prefix . $geodir_post_type . '_detail';
48
+
49
+		$sql = $wpdb->prepare("SELECT * FROM " . $table . " WHERE post_id = %d", array($pid));
50
+
51
+		$postinfo = $wpdb->get_results($sql);
52
+
53
+		$data_arr = array();
54
+
55
+		if ($postinfo) {
56
+			$srcharr = array("'", "/", "-", '"', '\\');
57
+			$replarr = array("&prime;", "&frasl;", "&ndash;", "&ldquo;", '');
58
+
59
+			foreach ($postinfo as $postinfo_obj) {
60
+				echo geodir_get_infowindow_html($postinfo_obj);
61
+			}
62
+		}
63
+	}
64
+	exit;
65 65
 }
66 66
 
67 67
 /**
@@ -79,80 +79,80 @@  discard block
 block discarded – undo
79 79
  * @return string
80 80
  */
81 81
 function get_markers() {
82
-    global $wpdb, $plugin_prefix, $geodir_cat_icons, $gd_marker_sizes;
82
+	global $wpdb, $plugin_prefix, $geodir_cat_icons, $gd_marker_sizes;
83 83
 
84
-    $search = '';
85
-    $main_query_array;
84
+	$search = '';
85
+	$main_query_array;
86 86
 
87
-    $srcharr = array("'", "/", "-", '"', '\\', '&#39;');
88
-    $replarr = array("&prime;", "&frasl;", "&ndash;", "&ldquo;", '', "&prime;");
87
+	$srcharr = array("'", "/", "-", '"', '\\', '&#39;');
88
+	$replarr = array("&prime;", "&frasl;", "&ndash;", "&ldquo;", '', "&prime;");
89 89
 
90
-    $post_type = isset($_REQUEST['gd_posttype']) ? $_REQUEST['gd_posttype'] : 'gd_place';
90
+	$post_type = isset($_REQUEST['gd_posttype']) ? $_REQUEST['gd_posttype'] : 'gd_place';
91 91
 
92
-    $map_cat_ids_array = array('0');
93
-    $cat_find_array = array(" FIND_IN_SET(%d, pd." . $post_type . "category)");
92
+	$map_cat_ids_array = array('0');
93
+	$cat_find_array = array(" FIND_IN_SET(%d, pd." . $post_type . "category)");
94 94
 
95 95
 
96
-    $field_default_cat = '';
97
-    if (isset($_REQUEST['cat_id']) && $_REQUEST['cat_id'] != '') {
98
-        $map_cat_arr = trim($_REQUEST['cat_id'], ',');
96
+	$field_default_cat = '';
97
+	if (isset($_REQUEST['cat_id']) && $_REQUEST['cat_id'] != '') {
98
+		$map_cat_arr = trim($_REQUEST['cat_id'], ',');
99 99
 
100
-        if (!empty($map_cat_arr)) {
101
-            $field_default_cat .= "WHEN (default_category IN (" . $map_cat_arr . ")) THEN default_category ";
100
+		if (!empty($map_cat_arr)) {
101
+			$field_default_cat .= "WHEN (default_category IN (" . $map_cat_arr . ")) THEN default_category ";
102 102
 
103
-            $map_cat_ids_array = explode(',', $map_cat_arr);
104
-            $cat_find_array = array();
105
-            foreach ($map_cat_ids_array as $cat_id) {
106
-                $field_default_cat .= "WHEN (FIND_IN_SET($cat_id, `" . $post_type . "category`) > 0) THEN $cat_id ";
107
-                $cat_find_array[] = " FIND_IN_SET(%d, pd." . $post_type . "category)";
108
-                $main_query_array[] = $cat_id;
109
-            }
103
+			$map_cat_ids_array = explode(',', $map_cat_arr);
104
+			$cat_find_array = array();
105
+			foreach ($map_cat_ids_array as $cat_id) {
106
+				$field_default_cat .= "WHEN (FIND_IN_SET($cat_id, `" . $post_type . "category`) > 0) THEN $cat_id ";
107
+				$cat_find_array[] = " FIND_IN_SET(%d, pd." . $post_type . "category)";
108
+				$main_query_array[] = $cat_id;
109
+			}
110 110
 
111
-        }
112
-    }
111
+		}
112
+	}
113 113
 
114
-    if (!empty($field_default_cat))
115
-        $field_default_cat = '';
114
+	if (!empty($field_default_cat))
115
+		$field_default_cat = '';
116 116
 
117
-    if (!empty($cat_find_array))
118
-        $search .= "AND (" . implode(' OR ', $cat_find_array) . ")";
117
+	if (!empty($cat_find_array))
118
+		$search .= "AND (" . implode(' OR ', $cat_find_array) . ")";
119 119
 
120
-    $main_query_array = $map_cat_ids_array;
120
+	$main_query_array = $map_cat_ids_array;
121 121
   
122
-    if (isset($_REQUEST['search']) && !empty($_REQUEST['search']) && $_REQUEST['search'] != __('Title', 'geodirectory')) {
123
-        $search .= " AND p.post_title LIKE %s";
124
-        $main_query_array[] = "%" . $_REQUEST['search'] . "%";
125
-    }
126
-
127
-    /**
128
-     * Filter the marker query search SQL, values are replaces with %s or %d.
129
-     *
130
-     * @since 1.5.3
131
-     *
132
-     * @param string $search The SQL query for search/where.
133
-     */
134
-    $search = apply_filters('geodir_marker_search', $search);
135
-    /**
136
-     * Filter the marker query search SQL values %s and %d, this is an array of values.
137
-     *
138
-     * @since 1.5.3
139
-     *
140
-     * @param array $main_query_array The SQL query values for search/where.
141
-     */
142
-    $main_query_array = apply_filters('geodir_marker_main_query_array', $main_query_array);
143
-
144
-    $gd_posttype = '';
145
-    if (isset($_REQUEST['gd_posttype']) && $_REQUEST['gd_posttype'] != '') {
146
-        $table = $plugin_prefix . $_REQUEST['gd_posttype'] . '_detail';
147
-        $gd_posttype = " AND p.post_type = %s";
148
-        $main_query_array[] = $_REQUEST['gd_posttype'];
149
-
150
-    } else
151
-        $table = $plugin_prefix . 'gd_place_detail';
152
-
153
-    $join = ", " . $table . " AS pd ";
154
-
155
-    /**
122
+	if (isset($_REQUEST['search']) && !empty($_REQUEST['search']) && $_REQUEST['search'] != __('Title', 'geodirectory')) {
123
+		$search .= " AND p.post_title LIKE %s";
124
+		$main_query_array[] = "%" . $_REQUEST['search'] . "%";
125
+	}
126
+
127
+	/**
128
+	 * Filter the marker query search SQL, values are replaces with %s or %d.
129
+	 *
130
+	 * @since 1.5.3
131
+	 *
132
+	 * @param string $search The SQL query for search/where.
133
+	 */
134
+	$search = apply_filters('geodir_marker_search', $search);
135
+	/**
136
+	 * Filter the marker query search SQL values %s and %d, this is an array of values.
137
+	 *
138
+	 * @since 1.5.3
139
+	 *
140
+	 * @param array $main_query_array The SQL query values for search/where.
141
+	 */
142
+	$main_query_array = apply_filters('geodir_marker_main_query_array', $main_query_array);
143
+
144
+	$gd_posttype = '';
145
+	if (isset($_REQUEST['gd_posttype']) && $_REQUEST['gd_posttype'] != '') {
146
+		$table = $plugin_prefix . $_REQUEST['gd_posttype'] . '_detail';
147
+		$gd_posttype = " AND p.post_type = %s";
148
+		$main_query_array[] = $_REQUEST['gd_posttype'];
149
+
150
+	} else
151
+		$table = $plugin_prefix . 'gd_place_detail';
152
+
153
+	$join = ", " . $table . " AS pd ";
154
+
155
+	/**
156 156
 	 * Filter the SQL JOIN clause for the markers data
157 157
 	 *
158 158
 	 * @since 1.0.0
@@ -169,16 +169,16 @@  discard block
 block discarded – undo
169 169
 	 * @param string $search Row of searched fields to use in WHERE clause.
170 170
 	 */
171 171
 	$search = apply_filters('geodir_home_map_listing_where', $search);
172
-    $search = str_replace(array("'%", "%'"), array("'%%", "%%'"), $search);
173
-    $cat_type = $post_type . 'category';
174
-    if ($post_type == 'gd_event') {
175
-        $event_select = ", pd.recurring_dates, pd.is_recurring";
176
-    } else {
177
-        $event_select = "";
178
-    }
179
-
180
-    $sql_select = 'SELECT pd.default_category, pd.' . $cat_type . ', pd.post_title, pd.post_id, pd.post_latitude, pd.post_longitude' . $event_select;
181
-    /**
172
+	$search = str_replace(array("'%", "%'"), array("'%%", "%%'"), $search);
173
+	$cat_type = $post_type . 'category';
174
+	if ($post_type == 'gd_event') {
175
+		$event_select = ", pd.recurring_dates, pd.is_recurring";
176
+	} else {
177
+		$event_select = "";
178
+	}
179
+
180
+	$sql_select = 'SELECT pd.default_category, pd.' . $cat_type . ', pd.post_title, pd.post_id, pd.post_latitude, pd.post_longitude' . $event_select;
181
+	/**
182 182
 	 * Filter the SQL SELECT clause to retrive fields data
183 183
 	 *
184 184
 	 * @since 1.0.0
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
 	 */
198 198
 	$groupby = apply_filters('geodir_home_map_listing_groupby', $groupby);
199 199
 
200
-    $catsql = $wpdb->prepare("$select $field_default_cat FROM " . $wpdb->posts . " as p" . $join . " WHERE p.ID = pd.post_id AND p.post_status = 'publish' " . $search . $gd_posttype . $groupby , $main_query_array);
200
+	$catsql = $wpdb->prepare("$select $field_default_cat FROM " . $wpdb->posts . " as p" . $join . " WHERE p.ID = pd.post_id AND p.post_status = 'publish' " . $search . $gd_posttype . $groupby , $main_query_array);
201 201
     
202 202
 	/**
203 203
 	 * Filter the SQL query to retrive markers data
@@ -209,125 +209,125 @@  discard block
 block discarded – undo
209 209
 	 */
210 210
 	$catsql = apply_filters('geodir_home_map_listing_query', $catsql, $search);
211 211
 
212
-    $catinfo = $wpdb->get_results($catsql);
212
+	$catinfo = $wpdb->get_results($catsql);
213 213
 	
214
-    $cat_content_info = array();
215
-    $content_data = array();
216
-    $post_ids = array();
217
-
218
-    /**
219
-     * Called before marker data is processed into JSON.
220
-     *
221
-     * Called before marker data is processed into JSON, this action can be used to change the format or add/remove markers.
222
-     *
223
-     * @since 1.5.3
224
-     * @param object $catinfo The posts object containing all marker data.
225
-     * @see 'geodir_after_marker_post_process'
226
-     */
227
-    $catinfo = apply_filters('geodir_before_marker_post_process', $catinfo);
228
-
229
-    /**
230
-     * Called before marker data is processed into JSON.
231
-     *
232
-     * Called before marker data is processed into JSON, this action can be used to change the format or add/remove markers.
233
-     *
234
-     * @since 1.4.9
235
-     * @param object $catinfo The posts object containing all marker data.
236
-     * @see 'geodir_after_marker_post_process'
237
-     */
238
-    do_action('geodir_before_marker_post_process_action', $catinfo);
239
-
240
-    // Sort any posts into a ajax array
241
-    if (!empty($catinfo)) {
242
-        $geodir_cat_icons = geodir_get_term_icon();
243
-        global $geodir_date_format;
244
-
245
-        $today = strtotime(date_i18n('Y-m-d'));
214
+	$cat_content_info = array();
215
+	$content_data = array();
216
+	$post_ids = array();
217
+
218
+	/**
219
+	 * Called before marker data is processed into JSON.
220
+	 *
221
+	 * Called before marker data is processed into JSON, this action can be used to change the format or add/remove markers.
222
+	 *
223
+	 * @since 1.5.3
224
+	 * @param object $catinfo The posts object containing all marker data.
225
+	 * @see 'geodir_after_marker_post_process'
226
+	 */
227
+	$catinfo = apply_filters('geodir_before_marker_post_process', $catinfo);
228
+
229
+	/**
230
+	 * Called before marker data is processed into JSON.
231
+	 *
232
+	 * Called before marker data is processed into JSON, this action can be used to change the format or add/remove markers.
233
+	 *
234
+	 * @since 1.4.9
235
+	 * @param object $catinfo The posts object containing all marker data.
236
+	 * @see 'geodir_after_marker_post_process'
237
+	 */
238
+	do_action('geodir_before_marker_post_process_action', $catinfo);
239
+
240
+	// Sort any posts into a ajax array
241
+	if (!empty($catinfo)) {
242
+		$geodir_cat_icons = geodir_get_term_icon();
243
+		global $geodir_date_format;
244
+
245
+		$today = strtotime(date_i18n('Y-m-d'));
246 246
         
247
-        foreach ($catinfo as $catinfo_obj) {
248
-            $post_title = $catinfo_obj->post_title;
247
+		foreach ($catinfo as $catinfo_obj) {
248
+			$post_title = $catinfo_obj->post_title;
249 249
             
250
-            if ($post_type == 'gd_event' && !empty($catinfo_obj->recurring_dates)) {
251
-                $event_dates = '';
252
-                $recurring_data = isset($catinfo_obj->recurring_dates) ? maybe_unserialize($catinfo_obj->recurring_dates) : array();
250
+			if ($post_type == 'gd_event' && !empty($catinfo_obj->recurring_dates)) {
251
+				$event_dates = '';
252
+				$recurring_data = isset($catinfo_obj->recurring_dates) ? maybe_unserialize($catinfo_obj->recurring_dates) : array();
253 253
                 
254
-                $post_info = geodir_get_post_info($catinfo_obj->post_id);
255
-                if (!empty($catinfo_obj->is_recurring) && !empty($recurring_data) && !empty($recurring_data['is_recurring']) && geodir_event_recurring_pkg($post_info)) {
256
-                    $recurring_dates = explode(',', $recurring_data['event_recurring_dates']);
254
+				$post_info = geodir_get_post_info($catinfo_obj->post_id);
255
+				if (!empty($catinfo_obj->is_recurring) && !empty($recurring_data) && !empty($recurring_data['is_recurring']) && geodir_event_recurring_pkg($post_info)) {
256
+					$recurring_dates = explode(',', $recurring_data['event_recurring_dates']);
257 257
                     
258
-                    if (!empty($recurring_dates)) {					
259
-                        $e = 0;
260
-                        foreach ($recurring_dates as $date) {
261
-                            if (strtotime($date) >= $today) {
262
-                                $event_dates .= ' :: ' . date_i18n($geodir_date_format, strtotime($date));
258
+					if (!empty($recurring_dates)) {					
259
+						$e = 0;
260
+						foreach ($recurring_dates as $date) {
261
+							if (strtotime($date) >= $today) {
262
+								$event_dates .= ' :: ' . date_i18n($geodir_date_format, strtotime($date));
263 263
                                 
264
-                                $e++;
265
-                                if ($e == 3) { // only show 3 event dates
266
-                                    break;
267
-                                }
268
-                            }
269
-                        }
270
-                    }
271
-                } else {
272
-                    $start_date = !empty($recurring_data['event_start']) && $recurring_data['event_start'] != '0000-00-00 00:00:00' ? $recurring_data['event_start'] : '';
273
-                    $end_date = !empty($recurring_data['event_end']) && $recurring_data['event_end'] != '0000-00-00 00:00:00' ? $recurring_data['event_end'] : $start_date;
264
+								$e++;
265
+								if ($e == 3) { // only show 3 event dates
266
+									break;
267
+								}
268
+							}
269
+						}
270
+					}
271
+				} else {
272
+					$start_date = !empty($recurring_data['event_start']) && $recurring_data['event_start'] != '0000-00-00 00:00:00' ? $recurring_data['event_start'] : '';
273
+					$end_date = !empty($recurring_data['event_end']) && $recurring_data['event_end'] != '0000-00-00 00:00:00' ? $recurring_data['event_end'] : $start_date;
274 274
                 
275
-                    if ($end_date != '' && strtotime($end_date) >= $today) {
276
-                        $event_dates .= ' :: ' . date_i18n($geodir_date_format, strtotime($start_date)) .' -> ' . date_i18n($geodir_date_format, strtotime($end_date));
277
-                    }
278
-                }
279
-
280
-                if (empty($event_dates)) {
281
-                    continue;
282
-                }
275
+					if ($end_date != '' && strtotime($end_date) >= $today) {
276
+						$event_dates .= ' :: ' . date_i18n($geodir_date_format, strtotime($start_date)) .' -> ' . date_i18n($geodir_date_format, strtotime($end_date));
277
+					}
278
+				}
279
+
280
+				if (empty($event_dates)) {
281
+					continue;
282
+				}
283 283
                 
284
-                $post_title .= $event_dates;
285
-            }
284
+				$post_title .= $event_dates;
285
+			}
286 286
 
287
-            $icon = !empty($geodir_cat_icons) && isset($geodir_cat_icons[$catinfo_obj->default_category]) ? $geodir_cat_icons[$catinfo_obj->default_category] : '';
288
-            $mark_extra = (isset($catinfo_obj->marker_extra)) ? $catinfo_obj->marker_extra : '';
289
-            $title = str_replace($srcharr, $replarr, $post_title);
287
+			$icon = !empty($geodir_cat_icons) && isset($geodir_cat_icons[$catinfo_obj->default_category]) ? $geodir_cat_icons[$catinfo_obj->default_category] : '';
288
+			$mark_extra = (isset($catinfo_obj->marker_extra)) ? $catinfo_obj->marker_extra : '';
289
+			$title = str_replace($srcharr, $replarr, $post_title);
290 290
             
291
-            if ($icon != '') {
292
-                $gd_marker_sizes = empty($gd_marker_sizes) ? array() : $gd_marker_sizes;
291
+			if ($icon != '') {
292
+				$gd_marker_sizes = empty($gd_marker_sizes) ? array() : $gd_marker_sizes;
293 293
                 
294
-                if (isset($gd_marker_sizes[$icon])) {
295
-                    $icon_size = $gd_marker_sizes[$icon];
296
-                } else {
297
-                    $icon_size = geodir_get_marker_size($icon);
298
-                    $gd_marker_sizes[$icon] = $icon_size;
299
-                }               
300
-            } else {
301
-                $icon_size = array('w' => 36, 'h' => 45);
302
-            }
303
-
304
-            $content_data[] = '{"id":"' . $catinfo_obj->post_id . '","t": "' . $title . '","lt": "' . $catinfo_obj->post_latitude . '","ln": "' . $catinfo_obj->post_longitude . '","mk_id":"' . $catinfo_obj->post_id . '_' . $catinfo_obj->default_category . '","i":"' . $icon . '","w":"' . $icon_size['w'] . '","h":"' . $icon_size['h'] . '"'.$mark_extra.'}';
305
-            $post_ids[] = $catinfo_obj->post_id;
306
-        }
307
-    }
308
-
309
-    /**
310
-     * Called after marker data is processed into JSON.
311
-     *
312
-     * Called after marker data is processed into JSON, this action can be used to change the format or add/remove markers.
313
-     *
314
-     * @since 1.4.9
315
-     * @param array $content_data The array containing all markers in JSON format.
316
-     * @param object $catinfo The posts object containing all marker data.
317
-     * @see 'geodir_before_marker_post_process'
318
-     */
319
-    do_action('geodir_after_marker_post_process', $content_data, $catinfo);
320
-
321
-    if (!empty($content_data)) {
322
-        $cat_content_info[] = implode(',', $content_data);
323
-    }
324
-
325
-    $totalcount = count(array_unique($post_ids));
326
-
327
-    if (!empty($cat_content_info)) {
328
-        return '[{"totalcount":"' . $totalcount . '",' . substr(implode(',', $cat_content_info), 1) . ']';
329
-    }
330
-    else {
331
-        return '[{"totalcount":"0"}]';
332
-    }
294
+				if (isset($gd_marker_sizes[$icon])) {
295
+					$icon_size = $gd_marker_sizes[$icon];
296
+				} else {
297
+					$icon_size = geodir_get_marker_size($icon);
298
+					$gd_marker_sizes[$icon] = $icon_size;
299
+				}               
300
+			} else {
301
+				$icon_size = array('w' => 36, 'h' => 45);
302
+			}
303
+
304
+			$content_data[] = '{"id":"' . $catinfo_obj->post_id . '","t": "' . $title . '","lt": "' . $catinfo_obj->post_latitude . '","ln": "' . $catinfo_obj->post_longitude . '","mk_id":"' . $catinfo_obj->post_id . '_' . $catinfo_obj->default_category . '","i":"' . $icon . '","w":"' . $icon_size['w'] . '","h":"' . $icon_size['h'] . '"'.$mark_extra.'}';
305
+			$post_ids[] = $catinfo_obj->post_id;
306
+		}
307
+	}
308
+
309
+	/**
310
+	 * Called after marker data is processed into JSON.
311
+	 *
312
+	 * Called after marker data is processed into JSON, this action can be used to change the format or add/remove markers.
313
+	 *
314
+	 * @since 1.4.9
315
+	 * @param array $content_data The array containing all markers in JSON format.
316
+	 * @param object $catinfo The posts object containing all marker data.
317
+	 * @see 'geodir_before_marker_post_process'
318
+	 */
319
+	do_action('geodir_after_marker_post_process', $content_data, $catinfo);
320
+
321
+	if (!empty($content_data)) {
322
+		$cat_content_info[] = implode(',', $content_data);
323
+	}
324
+
325
+	$totalcount = count(array_unique($post_ids));
326
+
327
+	if (!empty($cat_content_info)) {
328
+		return '[{"totalcount":"' . $totalcount . '",' . substr(implode(',', $cat_content_info), 1) . ']';
329
+	}
330
+	else {
331
+		return '[{"totalcount":"0"}]';
332
+	}
333 333
 }
334 334
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
     $gd_session->set('homemap_catlist_ptype', $gd_post_type);
13 13
     $post_taxonomy = geodir_get_taxonomies($gd_post_type);
14 14
     $map_canvas_name = sanitize_text_field($_REQUEST['map_canvas']);
15
-    $child_collapse = (bool)$_REQUEST['child_collapse'];
15
+    $child_collapse = (bool) $_REQUEST['child_collapse'];
16 16
     echo home_map_taxonomy_walker($post_taxonomy, 0, true, 0, $map_canvas_name, $child_collapse, true);
17 17
     die;
18 18
 }
@@ -32,21 +32,21 @@  discard block
 block discarded – undo
32 32
     global $wpdb, $plugin_prefix, $gd_session;
33 33
 
34 34
     if ($_REQUEST['m_id'] != '') {
35
-        $pid = (int)$_REQUEST['m_id'];
35
+        $pid = (int) $_REQUEST['m_id'];
36 36
     } else {
37 37
         echo __('No marker data found', 'geodirectory');
38 38
         exit;
39 39
     }
40 40
 
41 41
     if (isset($_REQUEST['post_preview']) && $_REQUEST['post_preview'] != '' && $gd_ses_listing = $gd_session->get('listing')) {
42
-        $post = (object)$gd_ses_listing;
42
+        $post = (object) $gd_ses_listing;
43 43
         echo geodir_get_infowindow_html($post, $_REQUEST['post_preview']);
44 44
     } else {
45 45
         $geodir_post_type = get_post_type($pid);
46 46
 
47
-        $table = $plugin_prefix . $geodir_post_type . '_detail';
47
+        $table = $plugin_prefix.$geodir_post_type.'_detail';
48 48
 
49
-        $sql = $wpdb->prepare("SELECT * FROM " . $table . " WHERE post_id = %d", array($pid));
49
+        $sql = $wpdb->prepare("SELECT * FROM ".$table." WHERE post_id = %d", array($pid));
50 50
 
51 51
         $postinfo = $wpdb->get_results($sql);
52 52
 
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
     $post_type = isset($_REQUEST['gd_posttype']) ? $_REQUEST['gd_posttype'] : 'gd_place';
91 91
 
92 92
     $map_cat_ids_array = array('0');
93
-    $cat_find_array = array(" FIND_IN_SET(%d, pd." . $post_type . "category)");
93
+    $cat_find_array = array(" FIND_IN_SET(%d, pd.".$post_type."category)");
94 94
 
95 95
 
96 96
     $field_default_cat = '';
@@ -98,13 +98,13 @@  discard block
 block discarded – undo
98 98
         $map_cat_arr = trim($_REQUEST['cat_id'], ',');
99 99
 
100 100
         if (!empty($map_cat_arr)) {
101
-            $field_default_cat .= "WHEN (default_category IN (" . $map_cat_arr . ")) THEN default_category ";
101
+            $field_default_cat .= "WHEN (default_category IN (".$map_cat_arr.")) THEN default_category ";
102 102
 
103 103
             $map_cat_ids_array = explode(',', $map_cat_arr);
104 104
             $cat_find_array = array();
105 105
             foreach ($map_cat_ids_array as $cat_id) {
106
-                $field_default_cat .= "WHEN (FIND_IN_SET($cat_id, `" . $post_type . "category`) > 0) THEN $cat_id ";
107
-                $cat_find_array[] = " FIND_IN_SET(%d, pd." . $post_type . "category)";
106
+                $field_default_cat .= "WHEN (FIND_IN_SET($cat_id, `".$post_type."category`) > 0) THEN $cat_id ";
107
+                $cat_find_array[] = " FIND_IN_SET(%d, pd.".$post_type."category)";
108 108
                 $main_query_array[] = $cat_id;
109 109
             }
110 110
 
@@ -115,13 +115,13 @@  discard block
 block discarded – undo
115 115
         $field_default_cat = '';
116 116
 
117 117
     if (!empty($cat_find_array))
118
-        $search .= "AND (" . implode(' OR ', $cat_find_array) . ")";
118
+        $search .= "AND (".implode(' OR ', $cat_find_array).")";
119 119
 
120 120
     $main_query_array = $map_cat_ids_array;
121 121
   
122 122
     if (isset($_REQUEST['search']) && !empty($_REQUEST['search']) && $_REQUEST['search'] != __('Title', 'geodirectory')) {
123 123
         $search .= " AND p.post_title LIKE %s";
124
-        $main_query_array[] = "%" . $_REQUEST['search'] . "%";
124
+        $main_query_array[] = "%".$_REQUEST['search']."%";
125 125
     }
126 126
 
127 127
     /**
@@ -143,14 +143,14 @@  discard block
 block discarded – undo
143 143
 
144 144
     $gd_posttype = '';
145 145
     if (isset($_REQUEST['gd_posttype']) && $_REQUEST['gd_posttype'] != '') {
146
-        $table = $plugin_prefix . $_REQUEST['gd_posttype'] . '_detail';
146
+        $table = $plugin_prefix.$_REQUEST['gd_posttype'].'_detail';
147 147
         $gd_posttype = " AND p.post_type = %s";
148 148
         $main_query_array[] = $_REQUEST['gd_posttype'];
149 149
 
150 150
     } else
151
-        $table = $plugin_prefix . 'gd_place_detail';
151
+        $table = $plugin_prefix.'gd_place_detail';
152 152
 
153
-    $join = ", " . $table . " AS pd ";
153
+    $join = ", ".$table." AS pd ";
154 154
 
155 155
     /**
156 156
 	 * Filter the SQL JOIN clause for the markers data
@@ -170,14 +170,14 @@  discard block
 block discarded – undo
170 170
 	 */
171 171
 	$search = apply_filters('geodir_home_map_listing_where', $search);
172 172
     $search = str_replace(array("'%", "%'"), array("'%%", "%%'"), $search);
173
-    $cat_type = $post_type . 'category';
173
+    $cat_type = $post_type.'category';
174 174
     if ($post_type == 'gd_event') {
175 175
         $event_select = ", pd.recurring_dates, pd.is_recurring";
176 176
     } else {
177 177
         $event_select = "";
178 178
     }
179 179
 
180
-    $sql_select = 'SELECT pd.default_category, pd.' . $cat_type . ', pd.post_title, pd.post_id, pd.post_latitude, pd.post_longitude' . $event_select;
180
+    $sql_select = 'SELECT pd.default_category, pd.'.$cat_type.', pd.post_title, pd.post_id, pd.post_latitude, pd.post_longitude'.$event_select;
181 181
     /**
182 182
 	 * Filter the SQL SELECT clause to retrive fields data
183 183
 	 *
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
 	 */
198 198
 	$groupby = apply_filters('geodir_home_map_listing_groupby', $groupby);
199 199
 
200
-    $catsql = $wpdb->prepare("$select $field_default_cat FROM " . $wpdb->posts . " as p" . $join . " WHERE p.ID = pd.post_id AND p.post_status = 'publish' " . $search . $gd_posttype . $groupby , $main_query_array);
200
+    $catsql = $wpdb->prepare("$select $field_default_cat FROM ".$wpdb->posts." as p".$join." WHERE p.ID = pd.post_id AND p.post_status = 'publish' ".$search.$gd_posttype.$groupby, $main_query_array);
201 201
     
202 202
 	/**
203 203
 	 * Filter the SQL query to retrive markers data
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
                         $e = 0;
260 260
                         foreach ($recurring_dates as $date) {
261 261
                             if (strtotime($date) >= $today) {
262
-                                $event_dates .= ' :: ' . date_i18n($geodir_date_format, strtotime($date));
262
+                                $event_dates .= ' :: '.date_i18n($geodir_date_format, strtotime($date));
263 263
                                 
264 264
                                 $e++;
265 265
                                 if ($e == 3) { // only show 3 event dates
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
                     $end_date = !empty($recurring_data['event_end']) && $recurring_data['event_end'] != '0000-00-00 00:00:00' ? $recurring_data['event_end'] : $start_date;
274 274
                 
275 275
                     if ($end_date != '' && strtotime($end_date) >= $today) {
276
-                        $event_dates .= ' :: ' . date_i18n($geodir_date_format, strtotime($start_date)) .' -> ' . date_i18n($geodir_date_format, strtotime($end_date));
276
+                        $event_dates .= ' :: '.date_i18n($geodir_date_format, strtotime($start_date)).' -> '.date_i18n($geodir_date_format, strtotime($end_date));
277 277
                     }
278 278
                 }
279 279
 
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
                 $icon_size = array('w' => 36, 'h' => 45);
302 302
             }
303 303
 
304
-            $content_data[] = '{"id":"' . $catinfo_obj->post_id . '","t": "' . $title . '","lt": "' . $catinfo_obj->post_latitude . '","ln": "' . $catinfo_obj->post_longitude . '","mk_id":"' . $catinfo_obj->post_id . '_' . $catinfo_obj->default_category . '","i":"' . $icon . '","w":"' . $icon_size['w'] . '","h":"' . $icon_size['h'] . '"'.$mark_extra.'}';
304
+            $content_data[] = '{"id":"'.$catinfo_obj->post_id.'","t": "'.$title.'","lt": "'.$catinfo_obj->post_latitude.'","ln": "'.$catinfo_obj->post_longitude.'","mk_id":"'.$catinfo_obj->post_id.'_'.$catinfo_obj->default_category.'","i":"'.$icon.'","w":"'.$icon_size['w'].'","h":"'.$icon_size['h'].'"'.$mark_extra.'}';
305 305
             $post_ids[] = $catinfo_obj->post_id;
306 306
         }
307 307
     }
@@ -325,7 +325,7 @@  discard block
 block discarded – undo
325 325
     $totalcount = count(array_unique($post_ids));
326 326
 
327 327
     if (!empty($cat_content_info)) {
328
-        return '[{"totalcount":"' . $totalcount . '",' . substr(implode(',', $cat_content_info), 1) . ']';
328
+        return '[{"totalcount":"'.$totalcount.'",'.substr(implode(',', $cat_content_info), 1).']';
329 329
     }
330 330
     else {
331 331
         return '[{"totalcount":"0"}]';
Please login to merge, or discard this patch.
Braces   +10 added lines, -8 removed lines patch added patch discarded remove patch
@@ -111,11 +111,13 @@  discard block
 block discarded – undo
111 111
         }
112 112
     }
113 113
 
114
-    if (!empty($field_default_cat))
115
-        $field_default_cat = '';
114
+    if (!empty($field_default_cat)) {
115
+            $field_default_cat = '';
116
+    }
116 117
 
117
-    if (!empty($cat_find_array))
118
-        $search .= "AND (" . implode(' OR ', $cat_find_array) . ")";
118
+    if (!empty($cat_find_array)) {
119
+            $search .= "AND (" . implode(' OR ', $cat_find_array) . ")";
120
+    }
119 121
 
120 122
     $main_query_array = $map_cat_ids_array;
121 123
   
@@ -147,8 +149,9 @@  discard block
 block discarded – undo
147 149
         $gd_posttype = " AND p.post_type = %s";
148 150
         $main_query_array[] = $_REQUEST['gd_posttype'];
149 151
 
150
-    } else
151
-        $table = $plugin_prefix . 'gd_place_detail';
152
+    } else {
153
+            $table = $plugin_prefix . 'gd_place_detail';
154
+    }
152 155
 
153 156
     $join = ", " . $table . " AS pd ";
154 157
 
@@ -326,8 +329,7 @@  discard block
 block discarded – undo
326 329
 
327 330
     if (!empty($cat_content_info)) {
328 331
         return '[{"totalcount":"' . $totalcount . '",' . substr(implode(',', $cat_content_info), 1) . ']';
329
-    }
330
-    else {
332
+    } else {
331 333
         return '[{"totalcount":"0"}]';
332 334
     }
333 335
 }
334 336
\ No newline at end of file
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_template_actions.php 3 patches
Braces   +31 added lines, -24 removed lines patch added patch discarded remove patch
@@ -715,8 +715,9 @@  discard block
 block discarded – undo
715 715
 
716 716
                         if (isset($post->post_default_category) && $post->post_default_category == $cat_id) {
717 717
                             if ($term_icon_url = get_tax_meta($cat_id, 'ct_cat_icon', false, $post_type)) {
718
-                                if (isset($term_icon_url['src']) && $term_icon_url['src'] != '')
719
-                                    $term_icon = $term_icon_url['src'];
718
+                                if (isset($term_icon_url['src']) && $term_icon_url['src'] != '') {
719
+                                                                    $term_icon = $term_icon_url['src'];
720
+                                }
720 721
                                 break;
721 722
                             }
722 723
                         }
@@ -1265,8 +1266,9 @@  discard block
 block discarded – undo
1265 1266
         echo '<span class="geodir-category">' . $taxonomies[$post_taxonomy] . '</span>';
1266 1267
     }
1267 1268
 
1268
-    if (isset($taxonomies[$post_type . '_tags']))
1269
-        echo '<span class="geodir-tags">' . $taxonomies[$post_type . '_tags'] . '</span>';
1269
+    if (isset($taxonomies[$post_type . '_tags'])) {
1270
+            echo '<span class="geodir-tags">' . $taxonomies[$post_type . '_tags'] . '</span>';
1271
+    }
1270 1272
 
1271 1273
     ?>
1272 1274
     </p><?php
@@ -1634,23 +1636,21 @@  discard block
 block discarded – undo
1634 1636
     if(geodir_is_page('pt')){
1635 1637
         $gd_page = 'pt';
1636 1638
         $title  = (get_option('geodir_page_title_pt')) ? get_option('geodir_page_title_pt') : $title;
1637
-    }
1638
-    elseif(geodir_is_page('listing')){
1639
+    } elseif(geodir_is_page('listing')){
1639 1640
         $gd_page = 'listing';
1640 1641
         global $wp_query;
1641 1642
         $current_term = $wp_query->get_queried_object();
1642 1643
         if (strpos($current_term->taxonomy,'_tags') !== false) {
1643 1644
             $title = (get_option('geodir_page_title_tag-listing')) ? get_option('geodir_page_title_tag-listing') : $title;
1644
-        }else{
1645
+        } else{
1645 1646
             $title = (get_option('geodir_page_title_cat-listing')) ? get_option('geodir_page_title_cat-listing') : $title;
1646 1647
         }
1647 1648
 
1648
-    }
1649
-    elseif(geodir_is_page('author')){
1649
+    } elseif(geodir_is_page('author')){
1650 1650
         $gd_page = 'author';
1651 1651
         if(isset($_REQUEST['list']) && $_REQUEST['list']=='favourite'){
1652 1652
             $title = (get_option('geodir_page_title_favorite')) ? get_option('geodir_page_title_favorite') : $title;
1653
-        }else{
1653
+        } else{
1654 1654
             $title = (get_option('geodir_page_title_author')) ? get_option('geodir_page_title_author') : $title;
1655 1655
         }
1656 1656
 
@@ -2074,8 +2074,9 @@  discard block
 block discarded – undo
2074 2074
  */
2075 2075
 function geodir_action_add_listing_page_title()
2076 2076
 {
2077
-    if (isset($_REQUEST['listing_type']) && $_REQUEST['listing_type'] != '')
2078
-        $listing_type = sanitize_text_field($_REQUEST['listing_type']);
2077
+    if (isset($_REQUEST['listing_type']) && $_REQUEST['listing_type'] != '') {
2078
+            $listing_type = sanitize_text_field($_REQUEST['listing_type']);
2079
+    }
2079 2080
     /** This action is documented in geodirectory_template_actions.php */
2080 2081
     $class = apply_filters('geodir_page_title_class', 'entry-title fn');
2081 2082
     /** This action is documented in geodirectory_template_actions.php */
@@ -2087,7 +2088,7 @@  discard block
 block discarded – undo
2087 2088
         $gd_page = 'add-listing';
2088 2089
         if(isset($_REQUEST['pid']) && $_REQUEST['pid'] != ''){
2089 2090
             $title = (get_option('geodir_page_title_edit-listing')) ? get_option('geodir_page_title_edit-listing') : $title;
2090
-        }elseif(isset($listing_type)){
2091
+        } elseif(isset($listing_type)){
2091 2092
             $title = (get_option('geodir_page_title_add-listing')) ? get_option('geodir_page_title_add-listing') : $title;
2092 2093
         }
2093 2094
 
@@ -2406,8 +2407,9 @@  discard block
 block discarded – undo
2406 2407
         $totImg = 0;
2407 2408
         if (isset($_REQUEST['backandedit']) && empty($_REQUEST['pid'])) {
2408 2409
             $post = (object)$gd_session->get('listing');
2409
-            if (isset($post->post_images))
2410
-                $curImages = trim($post->post_images, ",");
2410
+            if (isset($post->post_images)) {
2411
+                            $curImages = trim($post->post_images, ",");
2412
+            }
2411 2413
 
2412 2414
 
2413 2415
             if ($curImages != '') {
@@ -2435,10 +2437,13 @@  discard block
 block discarded – undo
2435 2437
             $totImg = count((array)$thumb_img_arr);
2436 2438
         }
2437 2439
 
2438
-        if ($curImages != '')
2439
-            $svalue = $curImages; // this will be initial value of the above form field. Image urls.
2440
-        else
2441
-            $svalue = '';
2440
+        if ($curImages != '') {
2441
+                    $svalue = $curImages;
2442
+        }
2443
+        // this will be initial value of the above form field. Image urls.
2444
+        else {
2445
+                    $svalue = '';
2446
+        }
2442 2447
 
2443 2448
         $image_limit = isset($package_info->image_limit) ? $package_info->image_limit : '0';
2444 2449
         $show_image_input_box = ($image_limit != '0');
@@ -2648,8 +2653,9 @@  discard block
 block discarded – undo
2648 2653
     </script><?php
2649 2654
 
2650 2655
     global $errors;
2651
-    if (isset($_REQUEST['msg']) && $_REQUEST['msg'] == 'claim')
2652
-        $errors->add('claim_login', LOGIN_CLAIM);
2656
+    if (isset($_REQUEST['msg']) && $_REQUEST['msg'] == 'claim') {
2657
+            $errors->add('claim_login', LOGIN_CLAIM);
2658
+    }
2653 2659
 
2654 2660
     if (!empty($errors)) {
2655 2661
         foreach ($errors as $errorsObj) {
@@ -2753,8 +2759,9 @@  discard block
 block discarded – undo
2753 2759
 
2754 2760
     if (!empty($term)) {
2755 2761
         $current_term = get_term_by('slug', $term, $taxonomy[0]);
2756
-        if (!empty($current_term))
2757
-            $list_title .= __(' in', 'geodirectory') . " '" . geodir_ucwords($current_term->name) . "'";
2762
+        if (!empty($current_term)) {
2763
+                    $list_title .= __(' in', 'geodirectory') . " '" . geodir_ucwords($current_term->name) . "'";
2764
+        }
2758 2765
     }
2759 2766
 
2760 2767
 
@@ -2772,7 +2779,7 @@  discard block
 block discarded – undo
2772 2779
         $gd_page = 'author';
2773 2780
         if(isset($_REQUEST['list']) && $_REQUEST['list']=='favourite'){
2774 2781
             $title = (get_option('geodir_page_title_favorite')) ? get_option('geodir_page_title_favorite') : $title;
2775
-        }else{
2782
+        } else{
2776 2783
             $title = (get_option('geodir_page_title_author')) ? get_option('geodir_page_title_author') : $title;
2777 2784
         }
2778 2785
 
Please login to merge, or discard this patch.
Indentation   +1838 added lines, -1838 removed lines patch added patch discarded remove patch
@@ -17,10 +17,10 @@  discard block
 block discarded – undo
17 17
  */
18 18
 function gd_compat_styles()
19 19
 {
20
-    $tc = get_option('theme_compatibility_setting');
21
-    echo "<style id='gd-compat-styles' type='text/css'>";
22
-    echo $tc['geodir_theme_compat_css'];
23
-    echo "</style>";
20
+	$tc = get_option('theme_compatibility_setting');
21
+	echo "<style id='gd-compat-styles' type='text/css'>";
22
+	echo $tc['geodir_theme_compat_css'];
23
+	echo "</style>";
24 24
 }
25 25
 
26 26
 /**
@@ -31,10 +31,10 @@  discard block
 block discarded – undo
31 31
  */
32 32
 function gd_compat_script()
33 33
 {
34
-    $tc = get_option('theme_compatibility_setting');
35
-    echo "<script>";
36
-    echo $tc['geodir_theme_compat_js'];
37
-    echo " </script>";
34
+	$tc = get_option('theme_compatibility_setting');
35
+	echo "<script>";
36
+	echo $tc['geodir_theme_compat_js'];
37
+	echo " </script>";
38 38
 }
39 39
 
40 40
 /**
@@ -47,8 +47,8 @@  discard block
 block discarded – undo
47 47
  */
48 48
 function geodir_top_content_add_dynamic()
49 49
 {
50
-    $tc = get_option('theme_compatibility_setting');
51
-    echo $tc['geodir_top_content_add'];
50
+	$tc = get_option('theme_compatibility_setting');
51
+	echo $tc['geodir_top_content_add'];
52 52
 }
53 53
 
54 54
 /**
@@ -61,8 +61,8 @@  discard block
 block discarded – undo
61 61
  */
62 62
 function geodir_before_main_content_add_dynamic()
63 63
 {
64
-    $tc = get_option('theme_compatibility_setting');
65
-    echo $tc['geodir_before_main_content_add'];
64
+	$tc = get_option('theme_compatibility_setting');
65
+	echo $tc['geodir_before_main_content_add'];
66 66
 }
67 67
 
68 68
 /**
@@ -75,8 +75,8 @@  discard block
 block discarded – undo
75 75
  */
76 76
 function geodir_full_page_class_dynamic()
77 77
 {
78
-    $tc = get_option('theme_compatibility_setting');
79
-    return $tc['geodir_full_page_class_filter'];
78
+	$tc = get_option('theme_compatibility_setting');
79
+	return $tc['geodir_full_page_class_filter'];
80 80
 }
81 81
 
82 82
 /**
@@ -89,8 +89,8 @@  discard block
 block discarded – undo
89 89
  */
90 90
 function geodir_before_widget_dynamic()
91 91
 {
92
-    $tc = get_option('theme_compatibility_setting');
93
-    return $tc['geodir_before_widget_filter'];
92
+	$tc = get_option('theme_compatibility_setting');
93
+	return $tc['geodir_before_widget_filter'];
94 94
 }
95 95
 
96 96
 /**
@@ -103,8 +103,8 @@  discard block
 block discarded – undo
103 103
  */
104 104
 function geodir_after_widget_dynamic()
105 105
 {
106
-    $tc = get_option('theme_compatibility_setting');
107
-    return $tc['geodir_after_widget_filter'];
106
+	$tc = get_option('theme_compatibility_setting');
107
+	return $tc['geodir_after_widget_filter'];
108 108
 }
109 109
 
110 110
 /**
@@ -117,8 +117,8 @@  discard block
 block discarded – undo
117 117
  */
118 118
 function geodir_before_title_dynamic()
119 119
 {
120
-    $tc = get_option('theme_compatibility_setting');
121
-    return $tc['geodir_before_title_filter'];
120
+	$tc = get_option('theme_compatibility_setting');
121
+	return $tc['geodir_before_title_filter'];
122 122
 }
123 123
 
124 124
 /**
@@ -131,8 +131,8 @@  discard block
 block discarded – undo
131 131
  */
132 132
 function geodir_after_title_dynamic()
133 133
 {
134
-    $tc = get_option('theme_compatibility_setting');
135
-    return $tc['geodir_after_title_filter'];
134
+	$tc = get_option('theme_compatibility_setting');
135
+	return $tc['geodir_after_title_filter'];
136 136
 }
137 137
 
138 138
 /**
@@ -145,8 +145,8 @@  discard block
 block discarded – undo
145 145
  */
146 146
 function geodir_menu_li_class_dynamic()
147 147
 {
148
-    $tc = get_option('theme_compatibility_setting');
149
-    return $tc['geodir_menu_li_class_filter'];
148
+	$tc = get_option('theme_compatibility_setting');
149
+	return $tc['geodir_menu_li_class_filter'];
150 150
 }
151 151
 
152 152
 /**
@@ -159,8 +159,8 @@  discard block
 block discarded – undo
159 159
  */
160 160
 function geodir_sub_menu_ul_class_dynamic()
161 161
 {
162
-    $tc = get_option('theme_compatibility_setting');
163
-    return $tc['geodir_sub_menu_ul_class_filter'];
162
+	$tc = get_option('theme_compatibility_setting');
163
+	return $tc['geodir_sub_menu_ul_class_filter'];
164 164
 }
165 165
 
166 166
 /**
@@ -173,8 +173,8 @@  discard block
 block discarded – undo
173 173
  */
174 174
 function geodir_sub_menu_li_class_dynamic()
175 175
 {
176
-    $tc = get_option('theme_compatibility_setting');
177
-    return $tc['geodir_sub_menu_li_class_filter'];
176
+	$tc = get_option('theme_compatibility_setting');
177
+	return $tc['geodir_sub_menu_li_class_filter'];
178 178
 }
179 179
 
180 180
 /**
@@ -187,8 +187,8 @@  discard block
 block discarded – undo
187 187
  */
188 188
 function geodir_menu_a_class_dynamic()
189 189
 {
190
-    $tc = get_option('theme_compatibility_setting');
191
-    return $tc['geodir_menu_a_class_filter'];
190
+	$tc = get_option('theme_compatibility_setting');
191
+	return $tc['geodir_menu_a_class_filter'];
192 192
 }
193 193
 
194 194
 /**
@@ -201,8 +201,8 @@  discard block
 block discarded – undo
201 201
  */
202 202
 function geodir_sub_menu_a_class_dynamic()
203 203
 {
204
-    $tc = get_option('theme_compatibility_setting');
205
-    return $tc['geodir_sub_menu_a_class_filter'];
204
+	$tc = get_option('theme_compatibility_setting');
205
+	return $tc['geodir_sub_menu_a_class_filter'];
206 206
 }
207 207
 
208 208
 /**
@@ -215,8 +215,8 @@  discard block
 block discarded – undo
215 215
  */
216 216
 function geodir_location_switcher_menu_li_class_dynamic()
217 217
 {
218
-    $tc = get_option('theme_compatibility_setting');
219
-    return $tc['geodir_location_switcher_menu_li_class_filter'];
218
+	$tc = get_option('theme_compatibility_setting');
219
+	return $tc['geodir_location_switcher_menu_li_class_filter'];
220 220
 }
221 221
 
222 222
 /**
@@ -229,8 +229,8 @@  discard block
 block discarded – undo
229 229
  */
230 230
 function geodir_location_switcher_menu_a_class_dynamic()
231 231
 {
232
-    $tc = get_option('theme_compatibility_setting');
233
-    return $tc['geodir_location_switcher_menu_a_class_filter'];
232
+	$tc = get_option('theme_compatibility_setting');
233
+	return $tc['geodir_location_switcher_menu_a_class_filter'];
234 234
 }
235 235
 
236 236
 /**
@@ -243,8 +243,8 @@  discard block
 block discarded – undo
243 243
  */
244 244
 function geodir_location_switcher_menu_sub_ul_class_dynamic()
245 245
 {
246
-    $tc = get_option('theme_compatibility_setting');
247
-    return $tc['geodir_location_switcher_menu_sub_ul_class_filter'];
246
+	$tc = get_option('theme_compatibility_setting');
247
+	return $tc['geodir_location_switcher_menu_sub_ul_class_filter'];
248 248
 }
249 249
 
250 250
 /**
@@ -257,8 +257,8 @@  discard block
 block discarded – undo
257 257
  */
258 258
 function geodir_location_switcher_menu_sub_li_class_dynamic()
259 259
 {
260
-    $tc = get_option('theme_compatibility_setting');
261
-    return $tc['geodir_location_switcher_menu_sub_li_class_filter'];
260
+	$tc = get_option('theme_compatibility_setting');
261
+	return $tc['geodir_location_switcher_menu_sub_li_class_filter'];
262 262
 }
263 263
 
264 264
 
@@ -275,107 +275,107 @@  discard block
 block discarded – undo
275 275
 function geodir_content_actions_dynamic()
276 276
 {
277 277
 
278
-    $tc = get_option('theme_compatibility_setting');
278
+	$tc = get_option('theme_compatibility_setting');
279 279
 //print_r($tc);
280
-    if (empty($tc)) {
281
-        return;
282
-    }
283
-
284
-    //php
285
-    if (!empty($tc['geodir_theme_compat_code'])) {
286
-        include_once('geodirectory-functions/compatibility/' . $tc['geodir_theme_compat_code'] . '.php');
287
-    }
288
-
289
-    //geodir_full_page_class
290
-    if (!empty($tc['geodir_full_page_class_filter'])) {
291
-        add_filter('geodir_full_page_class', 'geodir_full_page_class_dynamic', 10);
292
-    }
293
-
294
-    //widget before filter
295
-    if (!empty($tc['geodir_before_widget_filter'])) {
296
-        add_filter('geodir_before_widget', 'geodir_before_widget_dynamic', 10);
297
-    }
298
-
299
-    //widget after filter
300
-    if (!empty($tc['geodir_after_widget_filter'])) {
301
-        add_filter('geodir_after_widget', 'geodir_after_widget_dynamic', 10);
302
-    }
303
-
304
-    //widget before title filter
305
-    if (!empty($tc['geodir_before_title_filter'])) {
306
-        add_filter('geodir_before_title', 'geodir_before_title_dynamic', 10);
307
-    }
308
-
309
-    //widget before title filter
310
-    if (!empty($tc['geodir_after_title_filter'])) {
311
-        add_filter('geodir_after_title', 'geodir_after_title_dynamic', 10);
312
-    }
313
-
314
-    //menu li class
315
-    if (!empty($tc['geodir_menu_li_class_filter'])) {
316
-        add_filter('geodir_menu_li_class', 'geodir_menu_li_class_dynamic', 10);
317
-    }
318
-
319
-    //menu ul class
320
-    if (!empty($tc['geodir_sub_menu_ul_class_filter'])) {
321
-        add_filter('geodir_sub_menu_ul_class', 'geodir_sub_menu_ul_class_dynamic', 10);
322
-    }
323
-
324
-    //menu sub li class
325
-    if (!empty($tc['geodir_sub_menu_li_class_filter'])) {
326
-        add_filter('geodir_sub_menu_li_class', 'geodir_sub_menu_li_class_dynamic', 10);
327
-    }
328
-
329
-    //menu a class
330
-    if (!empty($tc['geodir_menu_a_class_filter'])) {
331
-        add_filter('geodir_menu_a_class', 'geodir_menu_a_class_dynamic', 10);
332
-    }
333
-
334
-    //menu sub a class
335
-    if (!empty($tc['geodir_sub_menu_a_class_filter'])) {
336
-        add_filter('geodir_sub_menu_a_class', 'geodir_sub_menu_a_class_dynamic', 10);
337
-    }
338
-
339
-    //location menu li class
340
-    if (!empty($tc['geodir_location_switcher_menu_li_class_filter'])) {
341
-        add_filter('geodir_location_switcher_menu_li_class', 'geodir_location_switcher_menu_li_class_dynamic', 10);
342
-    }
343
-
344
-    //location menu sub ul class
345
-    if (!empty($tc['geodir_location_switcher_menu_sub_ul_class_filter'])) {
346
-        add_filter('geodir_location_switcher_menu_sub_ul_class', 'geodir_location_switcher_menu_sub_ul_class_dynamic', 10);
347
-    }
348
-
349
-    //location menu sub li class
350
-    if (!empty($tc['geodir_location_switcher_menu_sub_li_class_filter'])) {
351
-        add_filter('geodir_location_switcher_menu_sub_li_class', 'geodir_location_switcher_menu_sub_li_class_dynamic', 10);
352
-    }
353
-
354
-    //location menu a class
355
-    if (!empty($tc['geodir_location_switcher_menu_a_class_filter'])) {
356
-        add_filter('geodir_location_switcher_menu_a_class', 'geodir_location_switcher_menu_a_class_dynamic', 10);
357
-    }
358
-
359
-    // compat styles
360
-    if (!empty($tc['geodir_theme_compat_css'])) {
361
-        add_action('wp_head', 'gd_compat_styles');
362
-    }
363
-
364
-    // compat js
365
-    if (!empty($tc['geodir_theme_compat_js'])) {
366
-        add_action('wp_footer', 'gd_compat_script');
367
-    }
368
-
369
-
370
-    // geodir_top_content_add
371
-    if (!empty($tc['geodir_top_content_add'])) {
372
-        add_action('geodir_top_content', 'geodir_top_content_add_dynamic', 10, 1);
373
-    }
374
-
375
-    // geodir_before_main_content_add
376
-    if (!empty($tc['geodir_before_main_content_add'])) {
377
-        add_action('geodir_before_main_content', 'geodir_before_main_content_add_dynamic', 10, 1);
378
-    }
280
+	if (empty($tc)) {
281
+		return;
282
+	}
283
+
284
+	//php
285
+	if (!empty($tc['geodir_theme_compat_code'])) {
286
+		include_once('geodirectory-functions/compatibility/' . $tc['geodir_theme_compat_code'] . '.php');
287
+	}
288
+
289
+	//geodir_full_page_class
290
+	if (!empty($tc['geodir_full_page_class_filter'])) {
291
+		add_filter('geodir_full_page_class', 'geodir_full_page_class_dynamic', 10);
292
+	}
293
+
294
+	//widget before filter
295
+	if (!empty($tc['geodir_before_widget_filter'])) {
296
+		add_filter('geodir_before_widget', 'geodir_before_widget_dynamic', 10);
297
+	}
298
+
299
+	//widget after filter
300
+	if (!empty($tc['geodir_after_widget_filter'])) {
301
+		add_filter('geodir_after_widget', 'geodir_after_widget_dynamic', 10);
302
+	}
303
+
304
+	//widget before title filter
305
+	if (!empty($tc['geodir_before_title_filter'])) {
306
+		add_filter('geodir_before_title', 'geodir_before_title_dynamic', 10);
307
+	}
308
+
309
+	//widget before title filter
310
+	if (!empty($tc['geodir_after_title_filter'])) {
311
+		add_filter('geodir_after_title', 'geodir_after_title_dynamic', 10);
312
+	}
313
+
314
+	//menu li class
315
+	if (!empty($tc['geodir_menu_li_class_filter'])) {
316
+		add_filter('geodir_menu_li_class', 'geodir_menu_li_class_dynamic', 10);
317
+	}
318
+
319
+	//menu ul class
320
+	if (!empty($tc['geodir_sub_menu_ul_class_filter'])) {
321
+		add_filter('geodir_sub_menu_ul_class', 'geodir_sub_menu_ul_class_dynamic', 10);
322
+	}
323
+
324
+	//menu sub li class
325
+	if (!empty($tc['geodir_sub_menu_li_class_filter'])) {
326
+		add_filter('geodir_sub_menu_li_class', 'geodir_sub_menu_li_class_dynamic', 10);
327
+	}
328
+
329
+	//menu a class
330
+	if (!empty($tc['geodir_menu_a_class_filter'])) {
331
+		add_filter('geodir_menu_a_class', 'geodir_menu_a_class_dynamic', 10);
332
+	}
333
+
334
+	//menu sub a class
335
+	if (!empty($tc['geodir_sub_menu_a_class_filter'])) {
336
+		add_filter('geodir_sub_menu_a_class', 'geodir_sub_menu_a_class_dynamic', 10);
337
+	}
338
+
339
+	//location menu li class
340
+	if (!empty($tc['geodir_location_switcher_menu_li_class_filter'])) {
341
+		add_filter('geodir_location_switcher_menu_li_class', 'geodir_location_switcher_menu_li_class_dynamic', 10);
342
+	}
343
+
344
+	//location menu sub ul class
345
+	if (!empty($tc['geodir_location_switcher_menu_sub_ul_class_filter'])) {
346
+		add_filter('geodir_location_switcher_menu_sub_ul_class', 'geodir_location_switcher_menu_sub_ul_class_dynamic', 10);
347
+	}
348
+
349
+	//location menu sub li class
350
+	if (!empty($tc['geodir_location_switcher_menu_sub_li_class_filter'])) {
351
+		add_filter('geodir_location_switcher_menu_sub_li_class', 'geodir_location_switcher_menu_sub_li_class_dynamic', 10);
352
+	}
353
+
354
+	//location menu a class
355
+	if (!empty($tc['geodir_location_switcher_menu_a_class_filter'])) {
356
+		add_filter('geodir_location_switcher_menu_a_class', 'geodir_location_switcher_menu_a_class_dynamic', 10);
357
+	}
358
+
359
+	// compat styles
360
+	if (!empty($tc['geodir_theme_compat_css'])) {
361
+		add_action('wp_head', 'gd_compat_styles');
362
+	}
363
+
364
+	// compat js
365
+	if (!empty($tc['geodir_theme_compat_js'])) {
366
+		add_action('wp_footer', 'gd_compat_script');
367
+	}
368
+
369
+
370
+	// geodir_top_content_add
371
+	if (!empty($tc['geodir_top_content_add'])) {
372
+		add_action('geodir_top_content', 'geodir_top_content_add_dynamic', 10, 1);
373
+	}
374
+
375
+	// geodir_before_main_content_add
376
+	if (!empty($tc['geodir_before_main_content_add'])) {
377
+		add_action('geodir_before_main_content', 'geodir_before_main_content_add_dynamic', 10, 1);
378
+	}
379 379
 
380 380
 
381 381
 }
@@ -398,23 +398,23 @@  discard block
 block discarded – undo
398 398
  */
399 399
 function geodir_action_wrapper_open($type = '', $id = '', $class = '')
400 400
 {
401
-    $tc = get_option('theme_compatibility_setting');
402
-    if (!empty($tc['geodir_wrapper_open_replace'])) {
403
-        $text = $tc['geodir_wrapper_open_replace'];
404
-    } else {
405
-        $text = '<div id="[id]" class="[class]">';
406
-    }
401
+	$tc = get_option('theme_compatibility_setting');
402
+	if (!empty($tc['geodir_wrapper_open_replace'])) {
403
+		$text = $tc['geodir_wrapper_open_replace'];
404
+	} else {
405
+		$text = '<div id="[id]" class="[class]">';
406
+	}
407 407
 
408
-    if (!empty($tc['geodir_wrapper_open_id'])) {
409
-        $id = $tc['geodir_wrapper_open_id'];
410
-    }
411
-    if (!empty($tc['geodir_wrapper_open_class'])) {
412
-        $class = $tc['geodir_wrapper_open_class'];
413
-    }
408
+	if (!empty($tc['geodir_wrapper_open_id'])) {
409
+		$id = $tc['geodir_wrapper_open_id'];
410
+	}
411
+	if (!empty($tc['geodir_wrapper_open_class'])) {
412
+		$class = $tc['geodir_wrapper_open_class'];
413
+	}
414 414
 
415
-    $text = str_replace(array("[id]", "[class]"), array($id, $class), $text);
415
+	$text = str_replace(array("[id]", "[class]"), array($id, $class), $text);
416 416
 
417
-    echo $text;
417
+	echo $text;
418 418
 }
419 419
 
420 420
 // action for adding the wrapperdiv closing tag
@@ -429,14 +429,14 @@  discard block
 block discarded – undo
429 429
  */
430 430
 function geodir_action_wrapper_close($type = '')
431 431
 {
432
-    $tc = get_option('theme_compatibility_setting');
433
-    if (!empty($tc['geodir_wrapper_close_replace'])) {
434
-        $text = $tc['geodir_wrapper_close_replace'];
435
-    } else {
436
-        $text = '</div><!-- wrapper ends here-->';
437
-    }
432
+	$tc = get_option('theme_compatibility_setting');
433
+	if (!empty($tc['geodir_wrapper_close_replace'])) {
434
+		$text = $tc['geodir_wrapper_close_replace'];
435
+	} else {
436
+		$text = '</div><!-- wrapper ends here-->';
437
+	}
438 438
 
439
-    echo $text;
439
+	echo $text;
440 440
 }
441 441
 
442 442
 // action for adding the content div opening tag
@@ -452,35 +452,35 @@  discard block
 block discarded – undo
452 452
  */
453 453
 function geodir_action_wrapper_content_open($type = '', $id = '', $class = '')
454 454
 {
455
-    if ($type == 'home-page' && $width = get_option('geodir_width_home_contant_section')) {
456
-        $width_css = 'style="width:' . $width . '%;"';
457
-    } elseif ($type == 'listings-page' && $width = get_option('geodir_width_listing_contant_section')) {
458
-        $width_css = 'style="width:' . $width . '%;"';
459
-    } elseif ($type == 'search-page' && $width = get_option('geodir_width_search_contant_section')) {
460
-        $width_css = 'style="width:' . $width . '%;"';
461
-    } elseif ($type == 'author-page' && $width = get_option('geodir_width_author_contant_section')) {
462
-        $width_css = 'style="width:' . $width . '%;"';
463
-    } else {
464
-        $width_css = '';
465
-    }
466
-
467
-    $tc = get_option('theme_compatibility_setting');
468
-    if (!empty($tc['geodir_wrapper_content_open_replace'])) {
469
-        $text = $tc['geodir_wrapper_content_open_replace'];
470
-    } else {
471
-        $text = '<div id="[id]" class="[class]" role="main" [width_css]>';
472
-    }
473
-
474
-    if (!empty($tc['geodir_wrapper_content_open_id'])) {
475
-        $id = $tc['geodir_wrapper_content_open_id'];
476
-    }
477
-    if (!empty($tc['geodir_wrapper_content_open_class'])) {
478
-        $class = $tc['geodir_wrapper_content_open_class'];
479
-    }
480
-
481
-    $text = str_replace(array("[id]", "[class]", "[width_css]"), array($id, $class, $width_css), $text);
482
-
483
-    echo $text;
455
+	if ($type == 'home-page' && $width = get_option('geodir_width_home_contant_section')) {
456
+		$width_css = 'style="width:' . $width . '%;"';
457
+	} elseif ($type == 'listings-page' && $width = get_option('geodir_width_listing_contant_section')) {
458
+		$width_css = 'style="width:' . $width . '%;"';
459
+	} elseif ($type == 'search-page' && $width = get_option('geodir_width_search_contant_section')) {
460
+		$width_css = 'style="width:' . $width . '%;"';
461
+	} elseif ($type == 'author-page' && $width = get_option('geodir_width_author_contant_section')) {
462
+		$width_css = 'style="width:' . $width . '%;"';
463
+	} else {
464
+		$width_css = '';
465
+	}
466
+
467
+	$tc = get_option('theme_compatibility_setting');
468
+	if (!empty($tc['geodir_wrapper_content_open_replace'])) {
469
+		$text = $tc['geodir_wrapper_content_open_replace'];
470
+	} else {
471
+		$text = '<div id="[id]" class="[class]" role="main" [width_css]>';
472
+	}
473
+
474
+	if (!empty($tc['geodir_wrapper_content_open_id'])) {
475
+		$id = $tc['geodir_wrapper_content_open_id'];
476
+	}
477
+	if (!empty($tc['geodir_wrapper_content_open_class'])) {
478
+		$class = $tc['geodir_wrapper_content_open_class'];
479
+	}
480
+
481
+	$text = str_replace(array("[id]", "[class]", "[width_css]"), array($id, $class, $width_css), $text);
482
+
483
+	echo $text;
484 484
 }
485 485
 
486 486
 // action for adding the primary div closing tag
@@ -494,13 +494,13 @@  discard block
 block discarded – undo
494 494
  */
495 495
 function geodir_action_wrapper_content_close($type = '')
496 496
 {
497
-    $tc = get_option('theme_compatibility_setting');
498
-    if (!empty($tc['geodir_wrapper_content_close_replace'])) {
499
-        $text = $tc['geodir_wrapper_content_close_replace'];
500
-    } else {
501
-        $text = '</div><!-- content ends here-->';
502
-    }
503
-    echo $text;
497
+	$tc = get_option('theme_compatibility_setting');
498
+	if (!empty($tc['geodir_wrapper_content_close_replace'])) {
499
+		$text = $tc['geodir_wrapper_content_close_replace'];
500
+	} else {
501
+		$text = '</div><!-- content ends here-->';
502
+	}
503
+	echo $text;
504 504
 }
505 505
 
506 506
 // action for adding the <article> opening tag
@@ -518,24 +518,24 @@  discard block
 block discarded – undo
518 518
  */
519 519
 function geodir_action_article_open($type = '', $id = '', $class = '', $itemtype = '')
520 520
 {
521
-    $class = implode(" ", $class);
522
-    $tc = get_option('theme_compatibility_setting');
523
-    if (!empty($tc['geodir_article_open_replace'])) {
524
-        $text = $tc['geodir_article_open_replace'];
525
-    } else {
526
-        $text = '<article  id="[id]" class="[class]" >';
527
-    }
521
+	$class = implode(" ", $class);
522
+	$tc = get_option('theme_compatibility_setting');
523
+	if (!empty($tc['geodir_article_open_replace'])) {
524
+		$text = $tc['geodir_article_open_replace'];
525
+	} else {
526
+		$text = '<article  id="[id]" class="[class]" >';
527
+	}
528 528
 
529
-    if (!empty($tc['geodir_article_open_id'])) {
530
-        $id = $tc['geodir_article_open_id'];
531
-    }
532
-    if (!empty($tc['geodir_article_open_class'])) {
533
-        $class = $tc['geodir_article_open_class'];
534
-    }
529
+	if (!empty($tc['geodir_article_open_id'])) {
530
+		$id = $tc['geodir_article_open_id'];
531
+	}
532
+	if (!empty($tc['geodir_article_open_class'])) {
533
+		$class = $tc['geodir_article_open_class'];
534
+	}
535 535
 
536
-    $text = str_replace(array("[id]", "[class]", "[itemtype]"), array($id, $class, $itemtype), $text);
536
+	$text = str_replace(array("[id]", "[class]", "[itemtype]"), array($id, $class, $itemtype), $text);
537 537
 
538
-    echo $text;
538
+	echo $text;
539 539
 }
540 540
 
541 541
 // action for adding the primary div closing tag
@@ -549,13 +549,13 @@  discard block
 block discarded – undo
549 549
  */
550 550
 function geodir_action_article_close($type = '')
551 551
 {
552
-    $tc = get_option('theme_compatibility_setting');
553
-    if (!empty($tc['geodir_article_close_replace'])) {
554
-        $text = $tc['geodir_article_close_replace'];
555
-    } else {
556
-        $text = '</article><!-- article ends here-->';
557
-    }
558
-    echo $text;
552
+	$tc = get_option('theme_compatibility_setting');
553
+	if (!empty($tc['geodir_article_close_replace'])) {
554
+		$text = $tc['geodir_article_close_replace'];
555
+	} else {
556
+		$text = '</article><!-- article ends here-->';
557
+	}
558
+	echo $text;
559 559
 }
560 560
 
561 561
 // action for adding the sidebar opening tag
@@ -572,35 +572,35 @@  discard block
 block discarded – undo
572 572
  */
573 573
 function geodir_action_sidebar_right_open($type = '', $id = '', $class = '', $itemtype = '')
574 574
 {
575
-    if ($type == 'home-page' && $width = get_option('geodir_width_home_right_section')) {
576
-        $width_css = 'style="width:' . $width . '%;"';
577
-    } elseif ($type == 'listings-page' && $width = get_option('geodir_width_listing_right_section')) {
578
-        $width_css = 'style="width:' . $width . '%;"';
579
-    } elseif ($type == 'search-page' && $width = get_option('geodir_width_search_right_section')) {
580
-        $width_css = 'style="width:' . $width . '%;"';
581
-    } elseif ($type == 'author-page' && $width = get_option('geodir_width_author_right_section')) {
582
-        $width_css = 'style="width:' . $width . '%;"';
583
-    } else {
584
-        $width_css = '';
585
-    }
586
-
587
-    $tc = get_option('theme_compatibility_setting');
588
-    if (!empty($tc['geodir_sidebar_right_open_replace'])) {
589
-        $text = $tc['geodir_sidebar_right_open_replace'];
590
-    } else {
591
-        $text = '<aside  id="[id]" class="[class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>';
592
-    }
593
-
594
-    if (!empty($tc['geodir_sidebar_right_open_id'])) {
595
-        $id = $tc['geodir_sidebar_right_open_id'];
596
-    }
597
-    if (!empty($tc['geodir_sidebar_right_open_class'])) {
598
-        $class = $tc['geodir_sidebar_right_open_class'];
599
-    }
600
-
601
-    $text = str_replace(array("[id]", "[class]", "[itemtype]", "[width_css]"), array($id, $class, $itemtype, $width_css), $text);
602
-
603
-    echo $text;
575
+	if ($type == 'home-page' && $width = get_option('geodir_width_home_right_section')) {
576
+		$width_css = 'style="width:' . $width . '%;"';
577
+	} elseif ($type == 'listings-page' && $width = get_option('geodir_width_listing_right_section')) {
578
+		$width_css = 'style="width:' . $width . '%;"';
579
+	} elseif ($type == 'search-page' && $width = get_option('geodir_width_search_right_section')) {
580
+		$width_css = 'style="width:' . $width . '%;"';
581
+	} elseif ($type == 'author-page' && $width = get_option('geodir_width_author_right_section')) {
582
+		$width_css = 'style="width:' . $width . '%;"';
583
+	} else {
584
+		$width_css = '';
585
+	}
586
+
587
+	$tc = get_option('theme_compatibility_setting');
588
+	if (!empty($tc['geodir_sidebar_right_open_replace'])) {
589
+		$text = $tc['geodir_sidebar_right_open_replace'];
590
+	} else {
591
+		$text = '<aside  id="[id]" class="[class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>';
592
+	}
593
+
594
+	if (!empty($tc['geodir_sidebar_right_open_id'])) {
595
+		$id = $tc['geodir_sidebar_right_open_id'];
596
+	}
597
+	if (!empty($tc['geodir_sidebar_right_open_class'])) {
598
+		$class = $tc['geodir_sidebar_right_open_class'];
599
+	}
600
+
601
+	$text = str_replace(array("[id]", "[class]", "[itemtype]", "[width_css]"), array($id, $class, $itemtype, $width_css), $text);
602
+
603
+	echo $text;
604 604
 }
605 605
 
606 606
 // action for adding the primary div closing tag
@@ -614,13 +614,13 @@  discard block
 block discarded – undo
614 614
  */
615 615
 function geodir_action_sidebar_right_close($type = '')
616 616
 {
617
-    $tc = get_option('theme_compatibility_setting');
618
-    if (!empty($tc['geodir_sidebar_right_close_replace'])) {
619
-        $text = $tc['geodir_sidebar_right_close_replace'];
620
-    } else {
621
-        $text = '</aside><!-- sidebar ends here-->';
622
-    }
623
-    echo $text;
617
+	$tc = get_option('theme_compatibility_setting');
618
+	if (!empty($tc['geodir_sidebar_right_close_replace'])) {
619
+		$text = $tc['geodir_sidebar_right_close_replace'];
620
+	} else {
621
+		$text = '</aside><!-- sidebar ends here-->';
622
+	}
623
+	echo $text;
624 624
 }
625 625
 
626 626
 
@@ -641,121 +641,121 @@  discard block
 block discarded – undo
641 641
  */
642 642
 function geodir_action_geodir_set_preview_post()
643 643
 {
644
-    global $post, $preview, $gd_session;
645
-    $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
646
-    if (!$preview || $is_backend_preview) {
647
-        return;
648
-    }// bail if not previewing
649
-
650
-    $listing_type = isset($_REQUEST['listing_type']) ? sanitize_text_field($_REQUEST['listing_type']) : '';
651
-
652
-    $fields_info = geodir_get_custom_fields_type($listing_type);
653
-
654
-    foreach ($_REQUEST as $pkey => $pval) {
655
-        if ($pkey == 'geodir_video') {
656
-            $tags = '<iframe>';
657
-        } else if ($pkey == 'post_desc') {
658
-            $tags = '<p><a><b><i><em><h1><h2><h3><h4><h5><ul><ol><li><img><div><del><ins><span><cite><code><strike><strong><blockquote>';
659
-        } else if (is_array($fields_info) && isset($fields_info[$pkey]) && ($fields_info[$pkey] == 'textarea' || $fields_info[$pkey] == 'html')) {
660
-            $tags = '<p><a><b><i><em><h1><h2><h3><h4><h5><ul><ol><li><img><div><del><ins><span><cite><code><strike><strong><blockquote>';
661
-        } else if (is_array($_REQUEST[$pkey])) {
662
-            $tags = 'skip_field';
663
-        } else {
664
-            $tags = '';
665
-        }
666
-        /**
667
-         * Allows the filtering of the allowed HTML tags per field when submitting from frontend add listing page.
668
-         *
669
-         * @since 1.0.0
670
-         * @param string $tags The allowed HTML tags for the field. Can be many things, for example the description allows these tags '<p><a><b><i><em><h1><h2><h3><h4><h5><ul><ol><li><img><div><del><ins><span><cite><code><strike><strong><blockquote>'.
671
-         * @param string|array $pkey The field id/name. If array then value is set as "skip_field".
672
-         */
673
-        $tags = apply_filters('geodir_save_post_key', $tags, $pkey);
674
-
675
-        if ($tags != 'skip_field') {
676
-            $_REQUEST[$pkey] = strip_tags($_REQUEST[$pkey], $tags);
677
-        }
678
-    }
679
-
680
-    $post = (object)$_REQUEST;
681
-
682
-
683
-    if (isset($post->video)) {
684
-        $post->video = stripslashes($post->video);
685
-    }
686
-
687
-    if (isset($post->Video2)) {
688
-        $post->Video2 = stripslashes($post->Video2);
689
-    }
690
-
691
-    $post_type = $post->listing_type;
692
-    $post_type_info = get_post_type_object($post_type);
693
-
694
-    $listing_label = $post_type_info->labels->singular_name;
695
-
696
-    $term_icon = '';
697
-
698
-    if (!empty($post->post_category)) {
699
-        foreach ($post->post_category as $post_taxonomy => $post_term) {
700
-
701
-            if ($post_term != '' && !is_array($post_term)) {
702
-                $post_term = explode(',', trim($post_term, ','));
703
-            }
644
+	global $post, $preview, $gd_session;
645
+	$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
646
+	if (!$preview || $is_backend_preview) {
647
+		return;
648
+	}// bail if not previewing
649
+
650
+	$listing_type = isset($_REQUEST['listing_type']) ? sanitize_text_field($_REQUEST['listing_type']) : '';
651
+
652
+	$fields_info = geodir_get_custom_fields_type($listing_type);
653
+
654
+	foreach ($_REQUEST as $pkey => $pval) {
655
+		if ($pkey == 'geodir_video') {
656
+			$tags = '<iframe>';
657
+		} else if ($pkey == 'post_desc') {
658
+			$tags = '<p><a><b><i><em><h1><h2><h3><h4><h5><ul><ol><li><img><div><del><ins><span><cite><code><strike><strong><blockquote>';
659
+		} else if (is_array($fields_info) && isset($fields_info[$pkey]) && ($fields_info[$pkey] == 'textarea' || $fields_info[$pkey] == 'html')) {
660
+			$tags = '<p><a><b><i><em><h1><h2><h3><h4><h5><ul><ol><li><img><div><del><ins><span><cite><code><strike><strong><blockquote>';
661
+		} else if (is_array($_REQUEST[$pkey])) {
662
+			$tags = 'skip_field';
663
+		} else {
664
+			$tags = '';
665
+		}
666
+		/**
667
+		 * Allows the filtering of the allowed HTML tags per field when submitting from frontend add listing page.
668
+		 *
669
+		 * @since 1.0.0
670
+		 * @param string $tags The allowed HTML tags for the field. Can be many things, for example the description allows these tags '<p><a><b><i><em><h1><h2><h3><h4><h5><ul><ol><li><img><div><del><ins><span><cite><code><strike><strong><blockquote>'.
671
+		 * @param string|array $pkey The field id/name. If array then value is set as "skip_field".
672
+		 */
673
+		$tags = apply_filters('geodir_save_post_key', $tags, $pkey);
674
+
675
+		if ($tags != 'skip_field') {
676
+			$_REQUEST[$pkey] = strip_tags($_REQUEST[$pkey], $tags);
677
+		}
678
+	}
679
+
680
+	$post = (object)$_REQUEST;
681
+
682
+
683
+	if (isset($post->video)) {
684
+		$post->video = stripslashes($post->video);
685
+	}
686
+
687
+	if (isset($post->Video2)) {
688
+		$post->Video2 = stripslashes($post->Video2);
689
+	}
690
+
691
+	$post_type = $post->listing_type;
692
+	$post_type_info = get_post_type_object($post_type);
693
+
694
+	$listing_label = $post_type_info->labels->singular_name;
695
+
696
+	$term_icon = '';
697
+
698
+	if (!empty($post->post_category)) {
699
+		foreach ($post->post_category as $post_taxonomy => $post_term) {
700
+
701
+			if ($post_term != '' && !is_array($post_term)) {
702
+				$post_term = explode(',', trim($post_term, ','));
703
+			}
704 704
 
705
-            if (is_array($post_term)) {
706
-                $post_term = array_unique($post_term);
707
-            }
705
+			if (is_array($post_term)) {
706
+				$post_term = array_unique($post_term);
707
+			}
708 708
 
709
-            if (!empty($post_term)) {
710
-                foreach ($post_term as $cat_id) {
711
-                    $cat_id = trim($cat_id);
712
-
713
-                    if ($cat_id != '') {
714
-                        $term_icon = get_option('geodir_default_marker_icon');
715
-
716
-                        if (isset($post->post_default_category) && $post->post_default_category == $cat_id) {
717
-                            if ($term_icon_url = get_tax_meta($cat_id, 'ct_cat_icon', false, $post_type)) {
718
-                                if (isset($term_icon_url['src']) && $term_icon_url['src'] != '')
719
-                                    $term_icon = $term_icon_url['src'];
720
-                                break;
721
-                            }
722
-                        }
723
-                    }
724
-                }
725
-            }
726
-        }
727
-    }
709
+			if (!empty($post_term)) {
710
+				foreach ($post_term as $cat_id) {
711
+					$cat_id = trim($cat_id);
712
+
713
+					if ($cat_id != '') {
714
+						$term_icon = get_option('geodir_default_marker_icon');
715
+
716
+						if (isset($post->post_default_category) && $post->post_default_category == $cat_id) {
717
+							if ($term_icon_url = get_tax_meta($cat_id, 'ct_cat_icon', false, $post_type)) {
718
+								if (isset($term_icon_url['src']) && $term_icon_url['src'] != '')
719
+									$term_icon = $term_icon_url['src'];
720
+								break;
721
+							}
722
+						}
723
+					}
724
+				}
725
+			}
726
+		}
727
+	}
728 728
 
729
-    $post_latitude = isset($post->post_latitude) ? $post->post_latitude : '';
730
-    $post_longitude = isset($post->post_longitude) ? $post->post_longitude : '';
729
+	$post_latitude = isset($post->post_latitude) ? $post->post_latitude : '';
730
+	$post_longitude = isset($post->post_longitude) ? $post->post_longitude : '';
731 731
 
732
-    $srcharr = array("'", "/", "-", '"', '\\');
733
-    $replarr = array("&prime;", "&frasl;", "&ndash;", "&ldquo;", '');
732
+	$srcharr = array("'", "/", "-", '"', '\\');
733
+	$replarr = array("&prime;", "&frasl;", "&ndash;", "&ldquo;", '');
734 734
 
735
-    $json_title = str_replace($srcharr, $replarr, $post->post_title);
735
+	$json_title = str_replace($srcharr, $replarr, $post->post_title);
736 736
 
737
-    $json = '{';
738
-    $json .= '"post_preview": "1",';
739
-    $json .= '"t": "' . $json_title . '",';
740
-    $json .= '"lt": "' . $post_latitude . '",';
741
-    $json .= '"ln": "' . $post_longitude . '",';
742
-    $json .= '"i":"' . $term_icon . '"';
743
-    $json .= '}';
737
+	$json = '{';
738
+	$json .= '"post_preview": "1",';
739
+	$json .= '"t": "' . $json_title . '",';
740
+	$json .= '"lt": "' . $post_latitude . '",';
741
+	$json .= '"ln": "' . $post_longitude . '",';
742
+	$json .= '"i":"' . $term_icon . '"';
743
+	$json .= '}';
744 744
 
745
-    $post->marker_json = $json;
745
+	$post->marker_json = $json;
746 746
 
747
-    $gd_session->set('listing', $_REQUEST);
747
+	$gd_session->set('listing', $_REQUEST);
748 748
 
749
-    // we need to define a few things to trick the setup_postdata
750
-    if (!isset($post->ID)) {
751
-        $post->ID = '';
752
-        $post->post_author = '';
753
-        $post->post_date = '';
754
-        $post->post_content = '';
755
-        $post->default_category = '';
756
-        $post->post_type = '';
757
-    }
758
-    setup_postdata($post);
749
+	// we need to define a few things to trick the setup_postdata
750
+	if (!isset($post->ID)) {
751
+		$post->ID = '';
752
+		$post->post_author = '';
753
+		$post->post_date = '';
754
+		$post->post_content = '';
755
+		$post->default_category = '';
756
+		$post->post_type = '';
757
+	}
758
+	setup_postdata($post);
759 759
 }
760 760
 
761 761
 /**
@@ -767,15 +767,15 @@  discard block
 block discarded – undo
767 767
  */
768 768
 function geodir_action_geodir_preview_code()
769 769
 {
770
-    global $preview;
770
+	global $preview;
771 771
 
772
-    $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
772
+	$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
773 773
 
774
-    if (!$preview || $is_backend_preview) {
775
-        return;
776
-    }// bail if not previewing
774
+	if (!$preview || $is_backend_preview) {
775
+		return;
776
+	}// bail if not previewing
777 777
 
778
-    geodir_get_template_part('preview', 'buttons');
778
+	geodir_get_template_part('preview', 'buttons');
779 779
 }
780 780
 
781 781
 // action for adding the details page top widget area
@@ -791,20 +791,20 @@  discard block
 block discarded – undo
791 791
  */
792 792
 function geodir_action_geodir_sidebar_detail_top($class = '')
793 793
 {
794
-    if (get_option('geodir_show_detail_top_section')) { ?>
794
+	if (get_option('geodir_show_detail_top_section')) { ?>
795 795
         <div
796 796
             class="<?php
797
-            /**
798
-             * Filter the div class for the wrapper of the full width widget areas.
799
-             *
800
-             * Allows you to filter the class of the div for the HTML Container wrapper for the full width widget areas referred to as "Top Section" or "Bottom Section" in the widget areas.
801
-             *
802
-             * @since 1.0.0
803
-             * @param string $class The class of the div.
804
-             * @param string $type The page type the widget area is being used on. Values can be 'geodir_detail_top', 'geodir_detail_bottom', 'geodir_listing_top', 'geodir_listing_bottom', 'Reg/Login Top Section',
805
-             *               'geodir_author_top','geodir_author_bottom', 'geodir_search_top', 'geodir_search_bottom', 'geodir_home_top' or 'geodir_home_bottom'.
806
-             */
807
-            echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_detail_top'); ?> <?php echo $class; ?>">
797
+			/**
798
+			 * Filter the div class for the wrapper of the full width widget areas.
799
+			 *
800
+			 * Allows you to filter the class of the div for the HTML Container wrapper for the full width widget areas referred to as "Top Section" or "Bottom Section" in the widget areas.
801
+			 *
802
+			 * @since 1.0.0
803
+			 * @param string $class The class of the div.
804
+			 * @param string $type The page type the widget area is being used on. Values can be 'geodir_detail_top', 'geodir_detail_bottom', 'geodir_listing_top', 'geodir_listing_bottom', 'Reg/Login Top Section',
805
+			 *               'geodir_author_top','geodir_author_bottom', 'geodir_search_top', 'geodir_search_bottom', 'geodir_home_top' or 'geodir_home_bottom'.
806
+			 */
807
+			echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_detail_top'); ?> <?php echo $class; ?>">
808 808
             <?php dynamic_sidebar('geodir_detail_top'); ?>
809 809
         </div>
810 810
     <?php }
@@ -828,11 +828,11 @@  discard block
 block discarded – undo
828 828
  */
829 829
 function geodir_action_geodir_sidebar_detail_bottom_section($class = '')
830 830
 {
831
-    if (get_option('geodir_show_detail_bottom_section')) { ?>
831
+	if (get_option('geodir_show_detail_bottom_section')) { ?>
832 832
         <div
833 833
             class="<?php
834
-            /** This action is documented in geodirectory_template_actions.php */
835
-            echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_detail_bottom'); ?> <?php echo $class; ?>">
834
+			/** This action is documented in geodirectory_template_actions.php */
835
+			echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_detail_bottom'); ?> <?php echo $class; ?>">
836 836
             <?php dynamic_sidebar('geodir_detail_bottom'); ?>
837 837
         </div><!-- clearfix ends here-->
838 838
     <?php }
@@ -846,7 +846,7 @@  discard block
 block discarded – undo
846 846
  */
847 847
 function geodir_details_sidebar_widget_area()
848 848
 {
849
-    dynamic_sidebar('geodir_detail_sidebar');
849
+	dynamic_sidebar('geodir_detail_sidebar');
850 850
 }
851 851
 
852 852
 /**
@@ -857,12 +857,12 @@  discard block
 block discarded – undo
857 857
  */
858 858
 function geodir_details_sidebar_place_details()
859 859
 {
860
-    /**
861
-     * Used to add items to the details page sidebar.
862
-     *
863
-     * @since 1.0.0
864
-     */
865
-    do_action('geodir_detail_page_sidebar');
860
+	/**
861
+	 * Used to add items to the details page sidebar.
862
+	 *
863
+	 * @since 1.0.0
864
+	 */
865
+	do_action('geodir_detail_page_sidebar');
866 866
 }
867 867
 
868 868
 add_action('geodir_detail_sidebar_inside', 'geodir_details_sidebar_place_details', 10);
@@ -877,68 +877,68 @@  discard block
 block discarded – undo
877 877
  */
878 878
 function geodir_action_details_sidebar()
879 879
 {
880
-    // this adds the opening html tags to the primary div, this required the closing tag below :: ($type='',$id='',$class='',$itemtype='')
881
-    if (get_option('geodir_detail_sidebar_left_section')) {
882
-        /**
883
-         * Called before the details page left sidebar is opened.
884
-         *
885
-         * This is used to add opening wrapper HTML to the details page left sidebar.
886
-         *
887
-         * @since 1.0.0
888
-         * @param string $type The current page type. Values can be 'details-page', 'listings-page', 'author-page', 'search-page' or 'home-page'.
889
-         * @param string $id Usually the ID of the sidebar wrapper. Values can be 'geodir-sidebar' or 'geodir-sidebar-left'.
890
-         * @param string $class The class of the sidebar wrapper. 'geodir-sidebar-left geodir-details-sidebar-left'.
891
-         * @param string $itemtype HTML itemtype 'http://schema.org/WPSideBar'.
892
-         */
893
-        do_action('geodir_sidebar_left_open', 'details-page', 'geodir-sidebar', 'geodir-sidebar-left geodir-details-sidebar-left', 'https://schema.org/WPSideBar');
894
-        ?>
880
+	// this adds the opening html tags to the primary div, this required the closing tag below :: ($type='',$id='',$class='',$itemtype='')
881
+	if (get_option('geodir_detail_sidebar_left_section')) {
882
+		/**
883
+		 * Called before the details page left sidebar is opened.
884
+		 *
885
+		 * This is used to add opening wrapper HTML to the details page left sidebar.
886
+		 *
887
+		 * @since 1.0.0
888
+		 * @param string $type The current page type. Values can be 'details-page', 'listings-page', 'author-page', 'search-page' or 'home-page'.
889
+		 * @param string $id Usually the ID of the sidebar wrapper. Values can be 'geodir-sidebar' or 'geodir-sidebar-left'.
890
+		 * @param string $class The class of the sidebar wrapper. 'geodir-sidebar-left geodir-details-sidebar-left'.
891
+		 * @param string $itemtype HTML itemtype 'http://schema.org/WPSideBar'.
892
+		 */
893
+		do_action('geodir_sidebar_left_open', 'details-page', 'geodir-sidebar', 'geodir-sidebar-left geodir-details-sidebar-left', 'https://schema.org/WPSideBar');
894
+		?>
895 895
         <div class="geodir-content-left geodir-sidebar-wrap"><?php
896
-        /**
897
-         * Called inside the HTML wrapper of the details sidebar for either the left and right sidebar.
898
-         *
899
-         * This is used to add all info to the details page sidebars.
900
-         *
901
-         * @since 1.0.0
902
-         */
903
-        do_action('geodir_detail_sidebar_inside');
904
-        ?></div><!-- end geodir-content-left --><?php
905
-        /**
906
-         * Called after the details page left sidebar.
907
-         *
908
-         * This is used to add closing wrapper HTML to the details page left sidebar.
909
-         *
910
-         * @since 1.0.0
911
-         * @param string $type The current page type. Values can be 'details-page', 'listings-page', 'author-page', 'search-page' or 'home-page'.
912
-         */
913
-        do_action('geodir_sidebar_left_close', 'details-page');
914
-    } else {
915
-        /**
916
-         * Called before the details page right sidebar is opened.
917
-         *
918
-         * This is used to add opening wrapper HTML to the details page right sidebar.
919
-         *
920
-         * @since 1.0.0
921
-         * @param string $type The current page type. Values can be 'details-page', 'listings-page', 'add-listing-page', 'author-page', 'search-page' or 'home-page'.
922
-         * @param string $id Usually the ID of the sidebar wrapper. Values can be 'geodir-sidebar' or 'geodir-sidebar-right'.
923
-         * @param string $class The class of the sidebar wrapper. 'geodir-sidebar-right geodir-details-sidebar-right'.
924
-         * @param string $itemtype HTML itemtype 'http://schema.org/WPSideBar'.
925
-         */
926
-        do_action('geodir_sidebar_right_open', 'details-page', 'geodir-sidebar', 'geodir-sidebar-right geodir-details-sidebar-right', 'http://schema.org/WPSideBar');
927
-        ?>
896
+		/**
897
+		 * Called inside the HTML wrapper of the details sidebar for either the left and right sidebar.
898
+		 *
899
+		 * This is used to add all info to the details page sidebars.
900
+		 *
901
+		 * @since 1.0.0
902
+		 */
903
+		do_action('geodir_detail_sidebar_inside');
904
+		?></div><!-- end geodir-content-left --><?php
905
+		/**
906
+		 * Called after the details page left sidebar.
907
+		 *
908
+		 * This is used to add closing wrapper HTML to the details page left sidebar.
909
+		 *
910
+		 * @since 1.0.0
911
+		 * @param string $type The current page type. Values can be 'details-page', 'listings-page', 'author-page', 'search-page' or 'home-page'.
912
+		 */
913
+		do_action('geodir_sidebar_left_close', 'details-page');
914
+	} else {
915
+		/**
916
+		 * Called before the details page right sidebar is opened.
917
+		 *
918
+		 * This is used to add opening wrapper HTML to the details page right sidebar.
919
+		 *
920
+		 * @since 1.0.0
921
+		 * @param string $type The current page type. Values can be 'details-page', 'listings-page', 'add-listing-page', 'author-page', 'search-page' or 'home-page'.
922
+		 * @param string $id Usually the ID of the sidebar wrapper. Values can be 'geodir-sidebar' or 'geodir-sidebar-right'.
923
+		 * @param string $class The class of the sidebar wrapper. 'geodir-sidebar-right geodir-details-sidebar-right'.
924
+		 * @param string $itemtype HTML itemtype 'http://schema.org/WPSideBar'.
925
+		 */
926
+		do_action('geodir_sidebar_right_open', 'details-page', 'geodir-sidebar', 'geodir-sidebar-right geodir-details-sidebar-right', 'http://schema.org/WPSideBar');
927
+		?>
928 928
         <div class="geodir-content-right geodir-sidebar-wrap"><?php
929
-        /** This action is documented in geodirectory_template_actions.php */
930
-        do_action('geodir_detail_sidebar_inside');
931
-        ?></div><!-- end geodir-content-right --><?php
932
-        /**
933
-         * Called after the details page right sidebar.
934
-         *
935
-         * This is used to add closing wrapper HTML to the details page right sidebar.
936
-         *
937
-         * @since 1.0.0
938
-         * @param string $type The current page type. Values can be 'details-page', 'listings-page', 'author-page', 'search-page' or 'home-page'.
939
-         */
940
-        do_action('geodir_sidebar_right_close', 'details-page');
941
-    }
929
+		/** This action is documented in geodirectory_template_actions.php */
930
+		do_action('geodir_detail_sidebar_inside');
931
+		?></div><!-- end geodir-content-right --><?php
932
+		/**
933
+		 * Called after the details page right sidebar.
934
+		 *
935
+		 * This is used to add closing wrapper HTML to the details page right sidebar.
936
+		 *
937
+		 * @since 1.0.0
938
+		 * @param string $type The current page type. Values can be 'details-page', 'listings-page', 'author-page', 'search-page' or 'home-page'.
939
+		 */
940
+		do_action('geodir_sidebar_right_close', 'details-page');
941
+	}
942 942
 }
943 943
 
944 944
 add_action('geodir_page_title', 'geodir_action_page_title', 10);
@@ -952,21 +952,21 @@  discard block
 block discarded – undo
952 952
  */
953 953
 function geodir_action_page_title()
954 954
 {
955
-    /**
956
-     * Filter the page title HTML h1 class.
957
-     *
958
-     * @since 1.0.0
959
-     * @param string $class The class to use. Default is 'entry-title fn'.
960
-     */
961
-    $class = apply_filters('geodir_page_title_class', 'entry-title fn');
962
-    /**
963
-     * Filter the page title HTML header wrapper class.
964
-     *
965
-     * @since 1.0.0
966
-     * @param string $class The class to use. Default is 'entry-header'.
967
-     */
968
-    $class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
969
-    echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' . stripslashes(get_the_title()) . '</h1></header>';
955
+	/**
956
+	 * Filter the page title HTML h1 class.
957
+	 *
958
+	 * @since 1.0.0
959
+	 * @param string $class The class to use. Default is 'entry-title fn'.
960
+	 */
961
+	$class = apply_filters('geodir_page_title_class', 'entry-title fn');
962
+	/**
963
+	 * Filter the page title HTML header wrapper class.
964
+	 *
965
+	 * @since 1.0.0
966
+	 * @param string $class The class to use. Default is 'entry-header'.
967
+	 */
968
+	$class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
969
+	echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' . stripslashes(get_the_title()) . '</h1></header>';
970 970
 }
971 971
 
972 972
 
@@ -983,94 +983,94 @@  discard block
 block discarded – undo
983 983
  */
984 984
 function geodir_action_details_slider()
985 985
 {
986
-    global $preview, $post;
986
+	global $preview, $post;
987 987
 
988
-    $is_backend_preview = (is_single() && !empty($_REQUEST['post_type']) && !empty($_REQUEST['preview']) && !empty($_REQUEST['p'])) && is_super_admin() ? true : false; // preview from backend
988
+	$is_backend_preview = (is_single() && !empty($_REQUEST['post_type']) && !empty($_REQUEST['preview']) && !empty($_REQUEST['p'])) && is_super_admin() ? true : false; // preview from backend
989 989
 
990
-    if ($is_backend_preview && !empty($post) && !empty($post->ID) && !isset($post->post_images)) {
991
-        $preview_get_images = geodir_get_images($post->ID, 'thumbnail', get_option('geodir_listing_no_img'));
990
+	if ($is_backend_preview && !empty($post) && !empty($post->ID) && !isset($post->post_images)) {
991
+		$preview_get_images = geodir_get_images($post->ID, 'thumbnail', get_option('geodir_listing_no_img'));
992 992
 
993
-        $preview_post_images = array();
994
-        if ($preview_get_images) {
995
-            foreach ($preview_get_images as $row) {
996
-                $preview_post_images[] = $row->src;
997
-            }
998
-        }
999
-        if (!empty($preview_post_images)) {
1000
-            $post->post_images = implode(',', $preview_post_images);
1001
-        }
1002
-    }
1003
-
1004
-    if ($preview) {
1005
-        $post_images = array();
1006
-        if (isset($post->post_images) && !empty($post->post_images)) {
1007
-            $post->post_images = trim($post->post_images, ",");
1008
-            $post_images = explode(",", $post->post_images);
1009
-        }
1010
-
1011
-        $main_slides = '';
1012
-        $nav_slides = '';
1013
-        $slides = 0;
1014
-
1015
-        if (!empty($post_images)) {
1016
-            foreach ($post_images as $image) {
1017
-                if (!empty($image)) {
1018
-                    $sizes = getimagesize(trim($image));
1019
-                    $width = !empty($sizes) && isset($sizes[0]) ? $sizes[0] : 0;
1020
-                    $height = !empty($sizes) && isset($sizes[1]) ? $sizes[1] : 0;
1021
-
1022
-                    if ($image && $width && $height) {
1023
-                        $image = (object)array('src' => $image, 'width' => $width, 'height' => $height);
1024
-                    }
1025
-
1026
-                    if (isset($image->src)) {
1027
-                        if ($image->height >= 400) {
1028
-                            $spacer_height = 0;
1029
-                        } else {
1030
-                            $spacer_height = ((400 - $image->height) / 2);
1031
-                        }
1032
-
1033
-                        $image_title = isset($image->title) ? $image->title : '';
1034
-
1035
-                        $main_slides .= '<li><img src="' . geodir_plugin_url() . "/geodirectory-assets/images/spacer.gif" . '" alt="' . $image_title . '" title="' . $image_title . '" style="max-height:' . $spacer_height . 'px;margin:0 auto;" />';
1036
-                        $main_slides .= '<img src="' . $image->src . '" alt="' . $image_title . '" title="' . $image_title . '" style="max-height:400px;margin:0 auto;" /></li>';
1037
-                        $nav_slides .= '<li><img src="' . $image->src . '" alt="' . $image_title . '" title="' . $image_title . '" style="max-height:48px;margin:0 auto;" /></li>';
1038
-                        $slides++;
1039
-                    }
1040
-                }
1041
-            }// endfore
1042
-        } //end if
1043
-    } else {
1044
-        $main_slides = '';
1045
-        $nav_slides = '';
1046
-        /**
1047
-         * Filter if default images should show on the details page.
1048
-         *
1049
-         * @param bool $use_default_image Default false.
1050
-         * @since 1.6.16
1051
-         */
1052
-        $use_default_image = apply_filters('geodir_details_default_image_show', false);
1053
-        $post_images = geodir_get_images($post->ID, 'thumbnail', $use_default_image); // Hide default image on listing preview/detail page.
1054
-        $slides = 0;
1055
-
1056
-        if (!empty($post_images)) {
1057
-            foreach ($post_images as $image) {
1058
-                if ($image->height >= 400) {
1059
-                    $spacer_height = 0;
1060
-                } else {
1061
-                    $spacer_height = ((400 - $image->height) / 2);
1062
-                }
1063
-                $caption = '';//(!empty($image->caption)) ? '<p class="flex-caption">'.$image->caption.'</p>' : '';
1064
-                $main_slides .= '<li><img src="' . geodir_plugin_url() . "/geodirectory-assets/images/spacer.gif" . '" alt="' . $image->title . '" title="' . $image->title . '" style="max-height:' . $spacer_height . 'px;margin:0 auto;" />';
1065
-                $main_slides .= '<img src="' . $image->src . '" alt="' . $image->title . '" title="' . $image->title . '" style="max-height:400px;margin:0 auto;" />'.$caption.'</li>';
1066
-                $nav_slides .= '<li><img src="' . $image->src . '" alt="' . $image->title . '" title="' . $image->title . '" style="max-height:48px;margin:0 auto;" /></li>';
1067
-                $slides++;
1068
-            }
1069
-        }// endfore
1070
-    }
993
+		$preview_post_images = array();
994
+		if ($preview_get_images) {
995
+			foreach ($preview_get_images as $row) {
996
+				$preview_post_images[] = $row->src;
997
+			}
998
+		}
999
+		if (!empty($preview_post_images)) {
1000
+			$post->post_images = implode(',', $preview_post_images);
1001
+		}
1002
+	}
1003
+
1004
+	if ($preview) {
1005
+		$post_images = array();
1006
+		if (isset($post->post_images) && !empty($post->post_images)) {
1007
+			$post->post_images = trim($post->post_images, ",");
1008
+			$post_images = explode(",", $post->post_images);
1009
+		}
1010
+
1011
+		$main_slides = '';
1012
+		$nav_slides = '';
1013
+		$slides = 0;
1014
+
1015
+		if (!empty($post_images)) {
1016
+			foreach ($post_images as $image) {
1017
+				if (!empty($image)) {
1018
+					$sizes = getimagesize(trim($image));
1019
+					$width = !empty($sizes) && isset($sizes[0]) ? $sizes[0] : 0;
1020
+					$height = !empty($sizes) && isset($sizes[1]) ? $sizes[1] : 0;
1021
+
1022
+					if ($image && $width && $height) {
1023
+						$image = (object)array('src' => $image, 'width' => $width, 'height' => $height);
1024
+					}
1025
+
1026
+					if (isset($image->src)) {
1027
+						if ($image->height >= 400) {
1028
+							$spacer_height = 0;
1029
+						} else {
1030
+							$spacer_height = ((400 - $image->height) / 2);
1031
+						}
1032
+
1033
+						$image_title = isset($image->title) ? $image->title : '';
1034
+
1035
+						$main_slides .= '<li><img src="' . geodir_plugin_url() . "/geodirectory-assets/images/spacer.gif" . '" alt="' . $image_title . '" title="' . $image_title . '" style="max-height:' . $spacer_height . 'px;margin:0 auto;" />';
1036
+						$main_slides .= '<img src="' . $image->src . '" alt="' . $image_title . '" title="' . $image_title . '" style="max-height:400px;margin:0 auto;" /></li>';
1037
+						$nav_slides .= '<li><img src="' . $image->src . '" alt="' . $image_title . '" title="' . $image_title . '" style="max-height:48px;margin:0 auto;" /></li>';
1038
+						$slides++;
1039
+					}
1040
+				}
1041
+			}// endfore
1042
+		} //end if
1043
+	} else {
1044
+		$main_slides = '';
1045
+		$nav_slides = '';
1046
+		/**
1047
+		 * Filter if default images should show on the details page.
1048
+		 *
1049
+		 * @param bool $use_default_image Default false.
1050
+		 * @since 1.6.16
1051
+		 */
1052
+		$use_default_image = apply_filters('geodir_details_default_image_show', false);
1053
+		$post_images = geodir_get_images($post->ID, 'thumbnail', $use_default_image); // Hide default image on listing preview/detail page.
1054
+		$slides = 0;
1055
+
1056
+		if (!empty($post_images)) {
1057
+			foreach ($post_images as $image) {
1058
+				if ($image->height >= 400) {
1059
+					$spacer_height = 0;
1060
+				} else {
1061
+					$spacer_height = ((400 - $image->height) / 2);
1062
+				}
1063
+				$caption = '';//(!empty($image->caption)) ? '<p class="flex-caption">'.$image->caption.'</p>' : '';
1064
+				$main_slides .= '<li><img src="' . geodir_plugin_url() . "/geodirectory-assets/images/spacer.gif" . '" alt="' . $image->title . '" title="' . $image->title . '" style="max-height:' . $spacer_height . 'px;margin:0 auto;" />';
1065
+				$main_slides .= '<img src="' . $image->src . '" alt="' . $image->title . '" title="' . $image->title . '" style="max-height:400px;margin:0 auto;" />'.$caption.'</li>';
1066
+				$nav_slides .= '<li><img src="' . $image->src . '" alt="' . $image->title . '" title="' . $image->title . '" style="max-height:48px;margin:0 auto;" /></li>';
1067
+				$slides++;
1068
+			}
1069
+		}// endfore
1070
+	}
1071 1071
 
1072
-    if (!empty($post_images)) {
1073
-        ?>
1072
+	if (!empty($post_images)) {
1073
+		?>
1074 1074
         <div class="geodir_flex-container">
1075 1075
             <div class="geodir_flex-loader"><i class="fa fa-refresh fa-spin"></i></div>
1076 1076
             <div id="geodir_slider" class="geodir_flexslider ">
@@ -1083,7 +1083,7 @@  discard block
 block discarded – undo
1083 1083
             <?php } ?>
1084 1084
         </div>
1085 1085
     <?php
1086
-    }
1086
+	}
1087 1087
 }
1088 1088
 
1089 1089
 add_action('geodir_details_taxonomies', 'geodir_action_details_taxonomies', 10);
@@ -1098,177 +1098,177 @@  discard block
 block discarded – undo
1098 1098
  */
1099 1099
 function geodir_action_details_taxonomies()
1100 1100
 {
1101
-    global $preview, $post;?>
1101
+	global $preview, $post;?>
1102 1102
     <p class="geodir_post_taxomomies clearfix">
1103 1103
     <?php
1104
-    $taxonomies = array();
1105
-
1106
-    $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
1107
-
1108
-    if ($preview && !$is_backend_preview) {
1109
-        $post_type = $post->listing_type;
1110
-        $post_taxonomy = $post_type . 'category';
1111
-        $post->{$post_taxonomy} = $post->post_category[$post_taxonomy];
1112
-    } else {
1113
-        $post_type = $post->post_type;
1114
-        $post_taxonomy = $post_type . 'category';
1115
-    }
1104
+	$taxonomies = array();
1105
+
1106
+	$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
1107
+
1108
+	if ($preview && !$is_backend_preview) {
1109
+		$post_type = $post->listing_type;
1110
+		$post_taxonomy = $post_type . 'category';
1111
+		$post->{$post_taxonomy} = $post->post_category[$post_taxonomy];
1112
+	} else {
1113
+		$post_type = $post->post_type;
1114
+		$post_taxonomy = $post_type . 'category';
1115
+	}
1116 1116
 //{	
1117
-    $post_type_info = get_post_type_object($post_type);
1118
-    $listing_label = __($post_type_info->labels->singular_name, 'geodirectory');
1119
-
1120
-    if (!empty($post->post_tags)) {
1121
-
1122
-        if (taxonomy_exists($post_type . '_tags')):
1123
-            $links = array();
1124
-            $terms = array();
1125
-            // to limit post tags
1126
-            $post_tags = trim($post->post_tags, ",");
1127
-            $post_id = isset($post->ID) ? $post->ID : '';
1128
-            /**
1129
-             * Filter the post tags.
1130
-             *
1131
-             * Allows you to filter the post tags output on the details page of a post.
1132
-             *
1133
-             * @since 1.0.0
1134
-             * @param string $post_tags A comma seperated list of tags.
1135
-             * @param int $post_id The current post id.
1136
-             */
1137
-            $post_tags = apply_filters('geodir_action_details_post_tags', $post_tags, $post_id);
1138
-
1139
-            $post->post_tags = $post_tags;
1140
-            $post_tags = explode(",", trim($post->post_tags, ","));
1141
-
1142
-
1143
-            foreach ($post_tags as $post_term) {
1144
-
1145
-                // fix slug creation order for tags & location
1146
-                $post_term = trim($post_term);
1147
-
1148
-                $priority_location = false;
1149
-                if ($insert_term = term_exists($post_term, $post_type . '_tags')) {
1150
-                    $term = get_term_by('id', $insert_term['term_id'], $post_type . '_tags');
1151
-                } else {
1152
-                    $post_country = isset($_REQUEST['post_country']) && $_REQUEST['post_country'] != '' ? sanitize_text_field($_REQUEST['post_country']) : NULL;
1153
-                    $post_region = isset($_REQUEST['post_region']) && $_REQUEST['post_region'] != '' ? sanitize_text_field($_REQUEST['post_region']) : NULL;
1154
-                    $post_city = isset($_REQUEST['post_city']) && $_REQUEST['post_city'] != '' ? sanitize_text_field($_REQUEST['post_city']) : NULL;
1155
-                    $match_country = $post_country && sanitize_title($post_term) == sanitize_title($post_country) ? true : false;
1156
-                    $match_region = $post_region && sanitize_title($post_term) == sanitize_title($post_region) ? true : false;
1157
-                    $match_city = $post_city && sanitize_title($post_term) == sanitize_title($post_city) ? true : false;
1158
-                    if ($match_country || $match_region || $match_city) {
1159
-                        $priority_location = true;
1160
-                        $term = get_term_by('name', $post_term, $post_type . '_tags');
1161
-                    } else {
1162
-                        $insert_term = wp_insert_term($post_term, $post_type . '_tags');
1163
-                        $term = get_term_by('name', $post_term, $post_type . '_tags');
1164
-                    }
1165
-                }
1166
-
1167
-                if (!is_wp_error($term) && is_object($term)) {
1168
-
1169
-                    // fix tag link on detail page
1170
-                    if ($priority_location) {
1171
-
1172
-                        $tag_link = "<a href=''>$post_term</a>";
1173
-                        /**
1174
-                         * Filter the tag name on the details page.
1175
-                         *
1176
-                         * @since 1.5.6
1177
-                         * @param string $tag_link The tag link html.
1178
-                         * @param object $term The tag term object.
1179
-                         */
1180
-                        $tag_link = apply_filters('geodir_details_taxonomies_tag_link',$tag_link,$term);
1181
-                        $links[] = $tag_link;
1182
-                    } else {
1183
-                        $tag_link = "<a href='" . esc_attr(get_term_link($term->term_id, $term->taxonomy)) . "'>$term->name</a>";
1184
-                        /** This action is documented in geodirectory-template_actions.php */
1185
-                        $tag_link = apply_filters('geodir_details_taxonomies_tag_link',$tag_link,$term);
1186
-                        $links[] = $tag_link;
1187
-                    }
1188
-                    $terms[] = $term;
1189
-                }
1190
-                //
1191
-            }
1192
-            if (!isset($listing_label)) {
1193
-                $listing_label = '';
1194
-            }
1195
-            $taxonomies[$post_type . '_tags'] = wp_sprintf(__('%s Tags: %l', 'geodirectory'), geodir_ucwords($listing_label), $links, (object)$terms);
1196
-        endif;
1197
-
1198
-    }
1199
-
1200
-    if (!empty($post->{$post_taxonomy})) {
1201
-        $links = array();
1202
-        $terms = array();
1203
-        $termsOrdered = array();
1204
-        if (!is_array($post->{$post_taxonomy})) {
1205
-            $post_term = explode(",", trim($post->{$post_taxonomy}, ","));
1206
-        } else {
1207
-            $post_term = $post->{$post_taxonomy};
1117
+	$post_type_info = get_post_type_object($post_type);
1118
+	$listing_label = __($post_type_info->labels->singular_name, 'geodirectory');
1119
+
1120
+	if (!empty($post->post_tags)) {
1121
+
1122
+		if (taxonomy_exists($post_type . '_tags')):
1123
+			$links = array();
1124
+			$terms = array();
1125
+			// to limit post tags
1126
+			$post_tags = trim($post->post_tags, ",");
1127
+			$post_id = isset($post->ID) ? $post->ID : '';
1128
+			/**
1129
+			 * Filter the post tags.
1130
+			 *
1131
+			 * Allows you to filter the post tags output on the details page of a post.
1132
+			 *
1133
+			 * @since 1.0.0
1134
+			 * @param string $post_tags A comma seperated list of tags.
1135
+			 * @param int $post_id The current post id.
1136
+			 */
1137
+			$post_tags = apply_filters('geodir_action_details_post_tags', $post_tags, $post_id);
1138
+
1139
+			$post->post_tags = $post_tags;
1140
+			$post_tags = explode(",", trim($post->post_tags, ","));
1141
+
1142
+
1143
+			foreach ($post_tags as $post_term) {
1144
+
1145
+				// fix slug creation order for tags & location
1146
+				$post_term = trim($post_term);
1147
+
1148
+				$priority_location = false;
1149
+				if ($insert_term = term_exists($post_term, $post_type . '_tags')) {
1150
+					$term = get_term_by('id', $insert_term['term_id'], $post_type . '_tags');
1151
+				} else {
1152
+					$post_country = isset($_REQUEST['post_country']) && $_REQUEST['post_country'] != '' ? sanitize_text_field($_REQUEST['post_country']) : NULL;
1153
+					$post_region = isset($_REQUEST['post_region']) && $_REQUEST['post_region'] != '' ? sanitize_text_field($_REQUEST['post_region']) : NULL;
1154
+					$post_city = isset($_REQUEST['post_city']) && $_REQUEST['post_city'] != '' ? sanitize_text_field($_REQUEST['post_city']) : NULL;
1155
+					$match_country = $post_country && sanitize_title($post_term) == sanitize_title($post_country) ? true : false;
1156
+					$match_region = $post_region && sanitize_title($post_term) == sanitize_title($post_region) ? true : false;
1157
+					$match_city = $post_city && sanitize_title($post_term) == sanitize_title($post_city) ? true : false;
1158
+					if ($match_country || $match_region || $match_city) {
1159
+						$priority_location = true;
1160
+						$term = get_term_by('name', $post_term, $post_type . '_tags');
1161
+					} else {
1162
+						$insert_term = wp_insert_term($post_term, $post_type . '_tags');
1163
+						$term = get_term_by('name', $post_term, $post_type . '_tags');
1164
+					}
1165
+				}
1166
+
1167
+				if (!is_wp_error($term) && is_object($term)) {
1168
+
1169
+					// fix tag link on detail page
1170
+					if ($priority_location) {
1171
+
1172
+						$tag_link = "<a href=''>$post_term</a>";
1173
+						/**
1174
+						 * Filter the tag name on the details page.
1175
+						 *
1176
+						 * @since 1.5.6
1177
+						 * @param string $tag_link The tag link html.
1178
+						 * @param object $term The tag term object.
1179
+						 */
1180
+						$tag_link = apply_filters('geodir_details_taxonomies_tag_link',$tag_link,$term);
1181
+						$links[] = $tag_link;
1182
+					} else {
1183
+						$tag_link = "<a href='" . esc_attr(get_term_link($term->term_id, $term->taxonomy)) . "'>$term->name</a>";
1184
+						/** This action is documented in geodirectory-template_actions.php */
1185
+						$tag_link = apply_filters('geodir_details_taxonomies_tag_link',$tag_link,$term);
1186
+						$links[] = $tag_link;
1187
+					}
1188
+					$terms[] = $term;
1189
+				}
1190
+				//
1191
+			}
1192
+			if (!isset($listing_label)) {
1193
+				$listing_label = '';
1194
+			}
1195
+			$taxonomies[$post_type . '_tags'] = wp_sprintf(__('%s Tags: %l', 'geodirectory'), geodir_ucwords($listing_label), $links, (object)$terms);
1196
+		endif;
1197
+
1198
+	}
1199
+
1200
+	if (!empty($post->{$post_taxonomy})) {
1201
+		$links = array();
1202
+		$terms = array();
1203
+		$termsOrdered = array();
1204
+		if (!is_array($post->{$post_taxonomy})) {
1205
+			$post_term = explode(",", trim($post->{$post_taxonomy}, ","));
1206
+		} else {
1207
+			$post_term = $post->{$post_taxonomy};
1208 1208
 			
1209 1209
 			if ($preview && !$is_backend_preview) {
1210 1210
 				$post_term = geodir_add_parent_terms($post_term, $post_taxonomy);
1211 1211
 			}
1212
-        }
1213
-
1214
-        $post_term = array_unique($post_term);
1215
-        if (!empty($post_term)) {
1216
-            foreach ($post_term as $post_term) {
1217
-                $post_term = trim($post_term);
1218
-
1219
-                if ($post_term != ''):
1220
-                    $term = get_term_by('id', $post_term, $post_taxonomy);
1221
-
1222
-                    if (is_object($term)) {
1223
-                        $term_link = "<a href='" . esc_attr(get_term_link($term, $post_taxonomy)) . "'>$term->name</a>";
1224
-                        /**
1225
-                         * Filter the category name on the details page.
1226
-                         *
1227
-                         * @since 1.5.6
1228
-                         * @param string $term_link The link html to the category.
1229
-                         * @param object $term The category term object.
1230
-                         */
1231
-                        $term_link = apply_filters('geodir_details_taxonomies_cat_link',$term_link,$term);
1232
-                        $links[] = $term_link;
1233
-                        $terms[] = $term;
1234
-                    }
1235
-                endif;
1236
-            }
1237
-            // order alphabetically
1238
-            asort($links);
1239
-            foreach (array_keys($links) as $key) {
1240
-                $termsOrdered[$key] = $terms[$key];
1241
-            }
1242
-            $terms = $termsOrdered;
1212
+		}
1213
+
1214
+		$post_term = array_unique($post_term);
1215
+		if (!empty($post_term)) {
1216
+			foreach ($post_term as $post_term) {
1217
+				$post_term = trim($post_term);
1218
+
1219
+				if ($post_term != ''):
1220
+					$term = get_term_by('id', $post_term, $post_taxonomy);
1221
+
1222
+					if (is_object($term)) {
1223
+						$term_link = "<a href='" . esc_attr(get_term_link($term, $post_taxonomy)) . "'>$term->name</a>";
1224
+						/**
1225
+						 * Filter the category name on the details page.
1226
+						 *
1227
+						 * @since 1.5.6
1228
+						 * @param string $term_link The link html to the category.
1229
+						 * @param object $term The category term object.
1230
+						 */
1231
+						$term_link = apply_filters('geodir_details_taxonomies_cat_link',$term_link,$term);
1232
+						$links[] = $term_link;
1233
+						$terms[] = $term;
1234
+					}
1235
+				endif;
1236
+			}
1237
+			// order alphabetically
1238
+			asort($links);
1239
+			foreach (array_keys($links) as $key) {
1240
+				$termsOrdered[$key] = $terms[$key];
1241
+			}
1242
+			$terms = $termsOrdered;
1243 1243
 
1244
-        }
1244
+		}
1245 1245
 
1246
-        if (!isset($listing_label)) {
1247
-            $listing_label = '';
1248
-        }
1249
-        $taxonomies[$post_taxonomy] = wp_sprintf(__('%s Category: %l', 'geodirectory'), geodir_ucwords($listing_label), $links, (object)$terms);
1246
+		if (!isset($listing_label)) {
1247
+			$listing_label = '';
1248
+		}
1249
+		$taxonomies[$post_taxonomy] = wp_sprintf(__('%s Category: %l', 'geodirectory'), geodir_ucwords($listing_label), $links, (object)$terms);
1250 1250
 
1251
-    }
1251
+	}
1252 1252
 
1253
-    /**
1254
-     * Filter the taxonomies array before output.
1255
-     *
1256
-     * @since 1.5.9
1257
-     * @param array $taxonomies The array of cats and tags.
1258
-     * @param string $post_type The post type being output.
1259
-     * @param string $listing_label The post type label.
1260
-     * @param string $listing_label The post type label with ucwords function.
1261
-     */
1262
-    $taxonomies = apply_filters('geodir_details_taxonomies_output',$taxonomies,$post_type,$listing_label,geodir_ucwords($listing_label));
1253
+	/**
1254
+	 * Filter the taxonomies array before output.
1255
+	 *
1256
+	 * @since 1.5.9
1257
+	 * @param array $taxonomies The array of cats and tags.
1258
+	 * @param string $post_type The post type being output.
1259
+	 * @param string $listing_label The post type label.
1260
+	 * @param string $listing_label The post type label with ucwords function.
1261
+	 */
1262
+	$taxonomies = apply_filters('geodir_details_taxonomies_output',$taxonomies,$post_type,$listing_label,geodir_ucwords($listing_label));
1263 1263
 
1264
-    if (isset($taxonomies[$post_taxonomy])) {
1265
-        echo '<span class="geodir-category">' . $taxonomies[$post_taxonomy] . '</span>';
1266
-    }
1264
+	if (isset($taxonomies[$post_taxonomy])) {
1265
+		echo '<span class="geodir-category">' . $taxonomies[$post_taxonomy] . '</span>';
1266
+	}
1267 1267
 
1268
-    if (isset($taxonomies[$post_type . '_tags']))
1269
-        echo '<span class="geodir-tags">' . $taxonomies[$post_type . '_tags'] . '</span>';
1268
+	if (isset($taxonomies[$post_type . '_tags']))
1269
+		echo '<span class="geodir-tags">' . $taxonomies[$post_type . '_tags'] . '</span>';
1270 1270
 
1271
-    ?>
1271
+	?>
1272 1272
     </p><?php
1273 1273
 }
1274 1274
 
@@ -1290,140 +1290,140 @@  discard block
 block discarded – undo
1290 1290
 function geodir_action_details_micordata($post='')
1291 1291
 {
1292 1292
 
1293
-    global $preview;
1294
-    if(empty($post)){global $post;}
1295
-    if ($preview || !geodir_is_page('detail')) {
1296
-        return;
1297
-    }
1298
-
1299
-    // url
1300
-    $c_url = geodir_curPageURL();
1301
-
1302
-    // post reviews
1303
-    $post_reviews = get_comments(array('post_id' => $post->ID, 'status' => 'approve'));
1304
-    if (empty($post_reviews)) {
1305
-        $reviews = '';
1306
-    } else {
1307
-        foreach ($post_reviews as $review) {
1308
-            $reviews[] = array(
1309
-                "@type" => "Review",
1310
-                "author" => $review->comment_author,
1311
-                "datePublished" => $review->comment_date,
1312
-                "description" => $review->comment_content,
1313
-                "reviewRating" => array(
1314
-                    "@type" => "Rating",
1315
-                    "bestRating" => "5",// @todo this will need to be filtered for review manager if user changes the score.
1316
-                    "ratingValue" => geodir_get_commentoverall($review->comment_ID),
1317
-                    "worstRating" => "1"
1318
-                )
1319
-            );
1320
-        }
1321
-
1322
-    }
1323
-
1324
-    // post images
1325
-    $post_images = geodir_get_images($post->ID, 'thumbnail', get_option('geodir_listing_no_img'));
1326
-    if (empty($post_images)) {
1327
-        $images = '';
1328
-    } else {
1329
-        $i_arr = array();
1330
-        foreach ($post_images as $img) {
1331
-            $i_arr[] = $img->src;
1332
-        }
1333
-
1334
-        if (count($i_arr) == 1) {
1335
-            $images = $i_arr[0];
1336
-        } else {
1337
-            $images = $i_arr;
1338
-        }
1339
-
1340
-    }
1341
-    //print_r($post);
1342
-    // external links
1343
-    $external_links =  array();
1344
-    $external_links[] = $post->geodir_website;
1345
-    $external_links[] = $post->geodir_twitter;
1346
-    $external_links[] = $post->geodir_facebook;
1347
-    $external_links = array_filter($external_links);
1348
-
1349
-    if(!empty($external_links)){
1350
-        $external_links = array_values($external_links);
1351
-    }
1352
-
1353
-    // reviews
1354
-    $comment_count = geodir_get_review_count_total($post->ID);
1355
-    $post_avgratings = geodir_get_post_rating($post->ID);
1356
-
1357
-    // schema type
1358
-    $schema_type = 'LocalBusiness';
1359
-    if(isset($post->default_category) && $post->default_category){
1360
-        $cat_schema = get_tax_meta($post->default_category, 'ct_cat_schema', false, $post->post_type);
1361
-        if($cat_schema){$schema_type = $cat_schema;}
1362
-        if(!$schema_type && $post->post_type=='gd_event'){$schema_type = 'Event';}
1363
-    }
1364
-
1365
-    $schema = array();
1366
-    $schema['@context'] = "https://schema.org";
1367
-    $schema['@type'] = $schema_type;
1368
-    $schema['name'] = $post->post_title;
1369
-    $schema['description'] = wp_strip_all_tags( $post->post_content, true );
1370
-    $schema['telephone'] = $post->geodir_contact;
1371
-    $schema['url'] = $c_url;
1372
-    $schema['sameAs'] = $external_links;
1373
-    $schema['image'] = $images;
1374
-    $schema['address'] = array(
1375
-        "@type" => "PostalAddress",
1376
-        "streetAddress" => $post->post_address,
1377
-        "addressLocality" => $post->post_city,
1378
-        "addressRegion" => $post->post_region,
1379
-        "addressCountry" => $post->post_country,
1380
-        "postalCode" => $post->post_zip
1381
-    );
1382
-
1383
-    if($post->post_latitude && $post->post_longitude) {
1384
-        $schema['geo'] = array(
1385
-            "@type" => "GeoCoordinates",
1386
-            "latitude" => $post->post_latitude,
1387
-            "longitude" => $post->post_longitude
1388
-        );
1389
-    }
1390
-
1391
-    if($post_avgratings) {
1392
-        $schema['aggregateRating'] = array(
1393
-            "@type" => "AggregateRating",
1394
-            "ratingValue" => $post_avgratings,
1395
-            "bestRating" => "5", // @todo this will need to be filtered for review manager if user changes the score.
1396
-            "worstRating" => "1",
1397
-            "ratingCount" => $comment_count
1398
-        );
1399
-    }
1400
-    $schema['review'] = $reviews;
1401
-
1402
-    /**
1403
-     * Allow the schema JSON-LD info to be filtered.
1404
-     *
1405
-     * @since 1.5.4
1406
-     * @since 1.5.7 Added $post variable.
1407
-     * @param array $schema The array of schema data to be filtered.
1408
-     * @param object $post The post object.
1409
-     */
1410
-    $schema = apply_filters('geodir_details_schema', $schema,$post);
1411
-
1412
-
1413
-    echo '<script type="application/ld+json">' . json_encode($schema) . '</script>';
1414
-
1415
-
1416
-    $uploads = wp_upload_dir();
1417
-    $facebook_og = (isset($post->featured_image) && $post->featured_image) ? '<meta property="og:image" content="'.$uploads['baseurl'].$post->featured_image.'"/>' : '';
1418
-
1419
-    /**
1420
-     * Show facebook open graph meta info
1421
-     *
1422
-     * @since 1.6.6
1423
-     * @param string $facebook_og The open graph html to be filtered.
1424
-     * @param object $post The post object.
1425
-     */
1426
-    echo apply_filters('geodir_details_facebook_og', $facebook_og,$post);
1293
+	global $preview;
1294
+	if(empty($post)){global $post;}
1295
+	if ($preview || !geodir_is_page('detail')) {
1296
+		return;
1297
+	}
1298
+
1299
+	// url
1300
+	$c_url = geodir_curPageURL();
1301
+
1302
+	// post reviews
1303
+	$post_reviews = get_comments(array('post_id' => $post->ID, 'status' => 'approve'));
1304
+	if (empty($post_reviews)) {
1305
+		$reviews = '';
1306
+	} else {
1307
+		foreach ($post_reviews as $review) {
1308
+			$reviews[] = array(
1309
+				"@type" => "Review",
1310
+				"author" => $review->comment_author,
1311
+				"datePublished" => $review->comment_date,
1312
+				"description" => $review->comment_content,
1313
+				"reviewRating" => array(
1314
+					"@type" => "Rating",
1315
+					"bestRating" => "5",// @todo this will need to be filtered for review manager if user changes the score.
1316
+					"ratingValue" => geodir_get_commentoverall($review->comment_ID),
1317
+					"worstRating" => "1"
1318
+				)
1319
+			);
1320
+		}
1321
+
1322
+	}
1323
+
1324
+	// post images
1325
+	$post_images = geodir_get_images($post->ID, 'thumbnail', get_option('geodir_listing_no_img'));
1326
+	if (empty($post_images)) {
1327
+		$images = '';
1328
+	} else {
1329
+		$i_arr = array();
1330
+		foreach ($post_images as $img) {
1331
+			$i_arr[] = $img->src;
1332
+		}
1333
+
1334
+		if (count($i_arr) == 1) {
1335
+			$images = $i_arr[0];
1336
+		} else {
1337
+			$images = $i_arr;
1338
+		}
1339
+
1340
+	}
1341
+	//print_r($post);
1342
+	// external links
1343
+	$external_links =  array();
1344
+	$external_links[] = $post->geodir_website;
1345
+	$external_links[] = $post->geodir_twitter;
1346
+	$external_links[] = $post->geodir_facebook;
1347
+	$external_links = array_filter($external_links);
1348
+
1349
+	if(!empty($external_links)){
1350
+		$external_links = array_values($external_links);
1351
+	}
1352
+
1353
+	// reviews
1354
+	$comment_count = geodir_get_review_count_total($post->ID);
1355
+	$post_avgratings = geodir_get_post_rating($post->ID);
1356
+
1357
+	// schema type
1358
+	$schema_type = 'LocalBusiness';
1359
+	if(isset($post->default_category) && $post->default_category){
1360
+		$cat_schema = get_tax_meta($post->default_category, 'ct_cat_schema', false, $post->post_type);
1361
+		if($cat_schema){$schema_type = $cat_schema;}
1362
+		if(!$schema_type && $post->post_type=='gd_event'){$schema_type = 'Event';}
1363
+	}
1364
+
1365
+	$schema = array();
1366
+	$schema['@context'] = "https://schema.org";
1367
+	$schema['@type'] = $schema_type;
1368
+	$schema['name'] = $post->post_title;
1369
+	$schema['description'] = wp_strip_all_tags( $post->post_content, true );
1370
+	$schema['telephone'] = $post->geodir_contact;
1371
+	$schema['url'] = $c_url;
1372
+	$schema['sameAs'] = $external_links;
1373
+	$schema['image'] = $images;
1374
+	$schema['address'] = array(
1375
+		"@type" => "PostalAddress",
1376
+		"streetAddress" => $post->post_address,
1377
+		"addressLocality" => $post->post_city,
1378
+		"addressRegion" => $post->post_region,
1379
+		"addressCountry" => $post->post_country,
1380
+		"postalCode" => $post->post_zip
1381
+	);
1382
+
1383
+	if($post->post_latitude && $post->post_longitude) {
1384
+		$schema['geo'] = array(
1385
+			"@type" => "GeoCoordinates",
1386
+			"latitude" => $post->post_latitude,
1387
+			"longitude" => $post->post_longitude
1388
+		);
1389
+	}
1390
+
1391
+	if($post_avgratings) {
1392
+		$schema['aggregateRating'] = array(
1393
+			"@type" => "AggregateRating",
1394
+			"ratingValue" => $post_avgratings,
1395
+			"bestRating" => "5", // @todo this will need to be filtered for review manager if user changes the score.
1396
+			"worstRating" => "1",
1397
+			"ratingCount" => $comment_count
1398
+		);
1399
+	}
1400
+	$schema['review'] = $reviews;
1401
+
1402
+	/**
1403
+	 * Allow the schema JSON-LD info to be filtered.
1404
+	 *
1405
+	 * @since 1.5.4
1406
+	 * @since 1.5.7 Added $post variable.
1407
+	 * @param array $schema The array of schema data to be filtered.
1408
+	 * @param object $post The post object.
1409
+	 */
1410
+	$schema = apply_filters('geodir_details_schema', $schema,$post);
1411
+
1412
+
1413
+	echo '<script type="application/ld+json">' . json_encode($schema) . '</script>';
1414
+
1415
+
1416
+	$uploads = wp_upload_dir();
1417
+	$facebook_og = (isset($post->featured_image) && $post->featured_image) ? '<meta property="og:image" content="'.$uploads['baseurl'].$post->featured_image.'"/>' : '';
1418
+
1419
+	/**
1420
+	 * Show facebook open graph meta info
1421
+	 *
1422
+	 * @since 1.6.6
1423
+	 * @param string $facebook_og The open graph html to be filtered.
1424
+	 * @param object $post The post object.
1425
+	 */
1426
+	echo apply_filters('geodir_details_facebook_og', $facebook_og,$post);
1427 1427
 
1428 1428
 
1429 1429
 
@@ -1443,7 +1443,7 @@  discard block
 block discarded – undo
1443 1443
  */
1444 1444
 function geodir_action_details_next_prev()
1445 1445
 {
1446
-    ?>
1446
+	?>
1447 1447
     <div class="geodir-pos_navigation clearfix">
1448 1448
     <div
1449 1449
         class="geodir-post_left"><?php previous_post_link('%link', '' . __('Previous', 'geodirectory'), false) ?></div>
@@ -1461,15 +1461,15 @@  discard block
 block discarded – undo
1461 1461
  */
1462 1462
 function geodir_action_before_single_post()
1463 1463
 {
1464
-    global $post;
1465
-    /**
1466
-     * Called at the very start of the details page output, before the title section.
1467
-     *
1468
-     * @since 1.0.0
1469
-     * @param object $post The current post object.
1470
-     * @global WP_Post|null $post The current post, if available.
1471
-     */
1472
-    do_action('geodir_before_single_post', $post); // extra action	
1464
+	global $post;
1465
+	/**
1466
+	 * Called at the very start of the details page output, before the title section.
1467
+	 *
1468
+	 * @since 1.0.0
1469
+	 * @param object $post The current post object.
1470
+	 * @global WP_Post|null $post The current post, if available.
1471
+	 */
1472
+	do_action('geodir_before_single_post', $post); // extra action	
1473 1473
 }
1474 1474
 
1475 1475
 /**
@@ -1480,13 +1480,13 @@  discard block
 block discarded – undo
1480 1480
  */
1481 1481
 function geodir_action_after_single_post($post)
1482 1482
 {
1483
-    /**
1484
-     * Called on the details page after the details page tabs section and before the next/prev buttons.
1485
-     *
1486
-     * @since 1.0.0
1487
-     * @param object $post The current post object.
1488
-     */
1489
-    do_action('geodir_after_single_post', $post); // extra action	
1483
+	/**
1484
+	 * Called on the details page after the details page tabs section and before the next/prev buttons.
1485
+	 *
1486
+	 * @since 1.0.0
1487
+	 * @param object $post The current post object.
1488
+	 */
1489
+	do_action('geodir_after_single_post', $post); // extra action	
1490 1490
 }
1491 1491
 
1492 1492
 add_action('geodir_details_main_content', 'geodir_action_before_single_post', 10);
@@ -1512,168 +1512,168 @@  discard block
 block discarded – undo
1512 1512
  */
1513 1513
 function geodir_action_listings_title()
1514 1514
 {
1515
-    global $wp, $term;
1516
-
1517
-    $gd_post_type = geodir_get_current_posttype();
1518
-    $post_type_info = get_post_type_object($gd_post_type);
1519
-
1520
-    $add_string_in_title = __('All', 'geodirectory') . ' ';
1521
-    if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite') {
1522
-        $add_string_in_title = __('My Favorite', 'geodirectory') . ' ';
1523
-    }
1524
-
1525
-    $list_title = $add_string_in_title . __($post_type_info->labels->name, 'geodirectory');
1526
-    $single_name = $post_type_info->labels->singular_name;
1527
-
1528
-    $taxonomy = geodir_get_taxonomies($gd_post_type, true);
1529
-
1530
-    $gd_country = get_query_var('gd_country');
1531
-    $gd_region = get_query_var('gd_region');
1532
-    $gd_city = get_query_var('gd_city');
1533
-
1534
-    if (!empty($term)) {
1535
-        $location_name = '';
1536
-        if ($gd_country != '' || $gd_region != '' || $gd_city != '') {
1537
-            if ($gd_country != '') {
1538
-                $location_name = geodir_sanitize_location_name('gd_country', $gd_country);
1539
-            }
1540
-
1541
-            if ($gd_region != '') {
1542
-                $location_name = geodir_sanitize_location_name('gd_region', $gd_region);
1543
-            }
1544
-
1545
-            if ($gd_city != '') {
1546
-                $location_name = geodir_sanitize_location_name('gd_city', $gd_city);
1547
-            }
1548
-        }
1549
-
1550
-        $current_term = get_term_by('slug', $term, $taxonomy[0]);
1551
-        if (!empty($current_term)) {
1552
-            $current_term_name = __(geodir_utf8_ucfirst($current_term->name), 'geodirectory');
1553
-            if ($current_term_name != '' && $location_name != '' && isset($current_term->taxonomy) && $current_term->taxonomy == $gd_post_type . 'category') {
1554
-                $location_last_char = substr($location_name, -1);
1555
-                $location_name_attach = geodir_strtolower($location_last_char) == 's' ? __("'", 'geodirectory') : __("'s", 'geodirectory');
1556
-                $list_title .= __(' in', 'geodirectory') . ' ' . $location_name . $location_name_attach . ' ' . $current_term_name;
1557
-            } else {
1558
-                $list_title .= __(' in', 'geodirectory') . " '" . $current_term_name . "'";
1559
-            }
1560
-        } else {
1561
-            if (count($taxonomy) > 1) {
1562
-                $current_term = get_term_by('slug', $term, $taxonomy[1]);
1563
-
1564
-                if (!empty($current_term)) {
1565
-                    $current_term_name = __(geodir_utf8_ucfirst($current_term->name), 'geodirectory');
1566
-                    if ($current_term_name != '' && $location_name != '' && isset($current_term->taxonomy) && $current_term->taxonomy == $gd_post_type . 'category') {
1567
-                        $location_last_char = substr($location_name, -1);
1568
-                        $location_name_attach = geodir_strtolower($location_last_char) == 's' ? __("'", 'geodirectory') : __("'s", 'geodirectory');
1569
-                        $list_title .= __(' in', 'geodirectory') . ' ' . $location_name . $location_name_attach . ' ' . $current_term_name;
1570
-                    } else {
1571
-                        $list_title .= __(' in', 'geodirectory') . " '" . $current_term_name . "'";
1572
-                    }
1573
-                }
1574
-            }
1575
-        }
1515
+	global $wp, $term;
1576 1516
 
1577
-    } else {
1578
-        $gd_country = (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '') ? $wp->query_vars['gd_country'] : '';
1579
-        $gd_region = (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] != '') ? $wp->query_vars['gd_region'] : '';
1580
-        $gd_city = (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] != '') ? $wp->query_vars['gd_city'] : '';
1517
+	$gd_post_type = geodir_get_current_posttype();
1518
+	$post_type_info = get_post_type_object($gd_post_type);
1581 1519
 
1582
-        $gd_country_actual = $gd_region_actual = $gd_city_actual = '';
1520
+	$add_string_in_title = __('All', 'geodirectory') . ' ';
1521
+	if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite') {
1522
+		$add_string_in_title = __('My Favorite', 'geodirectory') . ' ';
1523
+	}
1583 1524
 
1584
-        if (function_exists('get_actual_location_name')) {
1585
-            $gd_country_actual = $gd_country != '' ? get_actual_location_name('country', $gd_country, true) : $gd_country;
1586
-            $gd_region_actual = $gd_region != '' ? get_actual_location_name('region', $gd_region) : $gd_region;
1587
-            $gd_city_actual = $gd_city != '' ? get_actual_location_name('city', $gd_city) : $gd_city;
1588
-        }
1525
+	$list_title = $add_string_in_title . __($post_type_info->labels->name, 'geodirectory');
1526
+	$single_name = $post_type_info->labels->singular_name;
1589 1527
 
1590
-        if ($gd_city != '') {
1591
-            if ($gd_city_actual != '') {
1592
-                $gd_city = $gd_city_actual;
1593
-            } else {
1594
-                $gd_city = preg_replace('/-(\d+)$/', '', $gd_city);
1595
-                $gd_city = preg_replace('/[_-]/', ' ', $gd_city);
1596
-                $gd_city = __(geodir_ucwords($gd_city), 'geodirectory');
1597
-            }
1528
+	$taxonomy = geodir_get_taxonomies($gd_post_type, true);
1598 1529
 
1599
-            $list_title .= __(' in', 'geodirectory') . " '" . $gd_city . "'";
1600
-        } else if ($gd_region != '') {
1601
-            if ($gd_region_actual != '') {
1602
-                $gd_region = $gd_region_actual;
1603
-            } else {
1604
-                $gd_region = preg_replace('/-(\d+)$/', '', $gd_region);
1605
-                $gd_region = preg_replace('/[_-]/', ' ', $gd_region);
1606
-                $gd_region = __(geodir_ucwords($gd_region), 'geodirectory');
1607
-            }
1530
+	$gd_country = get_query_var('gd_country');
1531
+	$gd_region = get_query_var('gd_region');
1532
+	$gd_city = get_query_var('gd_city');
1608 1533
 
1609
-            $list_title .= __(' in', 'geodirectory') . " '" . $gd_region . "'";
1610
-        } else if ($gd_country != '') {
1611
-            if ($gd_country_actual != '') {
1612
-                $gd_country = $gd_country_actual;
1613
-            } else {
1614
-                $gd_country = preg_replace('/-(\d+)$/', '', $gd_country);
1615
-                $gd_country = preg_replace('/[_-]/', ' ', $gd_country);
1616
-                $gd_country = __(geodir_ucwords($gd_country), 'geodirectory');
1617
-            }
1618
-
1619
-            $list_title .= __(' in', 'geodirectory') . " '" . $gd_country . "'";
1620
-        }
1621
-    }
1622
-
1623
-    if (is_search()) {
1624
-        $list_title = __('Search', 'geodirectory') . ' ' . __(geodir_utf8_ucfirst($post_type_info->labels->name), 'geodirectory') . __(' For :', 'geodirectory') . " '" . get_search_query() . "'";
1625
-    }
1626
-    /** This action is documented in geodirectory_template_actions.php */
1627
-    $class = apply_filters('geodir_page_title_class', 'entry-title fn');
1628
-    /** This action is documented in geodirectory_template_actions.php */
1629
-    $class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
1630
-
1631
-
1632
-    $title = $list_title;
1633
-    $gd_page = '';
1634
-    if(geodir_is_page('pt')){
1635
-        $gd_page = 'pt';
1636
-        $title  = (get_option('geodir_page_title_pt')) ? get_option('geodir_page_title_pt') : $title;
1637
-    }
1638
-    elseif(geodir_is_page('listing')){
1639
-        $gd_page = 'listing';
1640
-        global $wp_query;
1641
-        $current_term = $wp_query->get_queried_object();
1642
-        if (strpos($current_term->taxonomy,'_tags') !== false) {
1643
-            $title = (get_option('geodir_page_title_tag-listing')) ? get_option('geodir_page_title_tag-listing') : $title;
1644
-        }else{
1645
-            $title = (get_option('geodir_page_title_cat-listing')) ? get_option('geodir_page_title_cat-listing') : $title;
1646
-        }
1534
+	if (!empty($term)) {
1535
+		$location_name = '';
1536
+		if ($gd_country != '' || $gd_region != '' || $gd_city != '') {
1537
+			if ($gd_country != '') {
1538
+				$location_name = geodir_sanitize_location_name('gd_country', $gd_country);
1539
+			}
1647 1540
 
1648
-    }
1649
-    elseif(geodir_is_page('author')){
1650
-        $gd_page = 'author';
1651
-        if(isset($_REQUEST['list']) && $_REQUEST['list']=='favourite'){
1652
-            $title = (get_option('geodir_page_title_favorite')) ? get_option('geodir_page_title_favorite') : $title;
1653
-        }else{
1654
-            $title = (get_option('geodir_page_title_author')) ? get_option('geodir_page_title_author') : $title;
1655
-        }
1541
+			if ($gd_region != '') {
1542
+				$location_name = geodir_sanitize_location_name('gd_region', $gd_region);
1543
+			}
1656 1544
 
1657
-    }
1545
+			if ($gd_city != '') {
1546
+				$location_name = geodir_sanitize_location_name('gd_city', $gd_city);
1547
+			}
1548
+		}
1549
+
1550
+		$current_term = get_term_by('slug', $term, $taxonomy[0]);
1551
+		if (!empty($current_term)) {
1552
+			$current_term_name = __(geodir_utf8_ucfirst($current_term->name), 'geodirectory');
1553
+			if ($current_term_name != '' && $location_name != '' && isset($current_term->taxonomy) && $current_term->taxonomy == $gd_post_type . 'category') {
1554
+				$location_last_char = substr($location_name, -1);
1555
+				$location_name_attach = geodir_strtolower($location_last_char) == 's' ? __("'", 'geodirectory') : __("'s", 'geodirectory');
1556
+				$list_title .= __(' in', 'geodirectory') . ' ' . $location_name . $location_name_attach . ' ' . $current_term_name;
1557
+			} else {
1558
+				$list_title .= __(' in', 'geodirectory') . " '" . $current_term_name . "'";
1559
+			}
1560
+		} else {
1561
+			if (count($taxonomy) > 1) {
1562
+				$current_term = get_term_by('slug', $term, $taxonomy[1]);
1563
+
1564
+				if (!empty($current_term)) {
1565
+					$current_term_name = __(geodir_utf8_ucfirst($current_term->name), 'geodirectory');
1566
+					if ($current_term_name != '' && $location_name != '' && isset($current_term->taxonomy) && $current_term->taxonomy == $gd_post_type . 'category') {
1567
+						$location_last_char = substr($location_name, -1);
1568
+						$location_name_attach = geodir_strtolower($location_last_char) == 's' ? __("'", 'geodirectory') : __("'s", 'geodirectory');
1569
+						$list_title .= __(' in', 'geodirectory') . ' ' . $location_name . $location_name_attach . ' ' . $current_term_name;
1570
+					} else {
1571
+						$list_title .= __(' in', 'geodirectory') . " '" . $current_term_name . "'";
1572
+					}
1573
+				}
1574
+			}
1575
+		}
1576
+
1577
+	} else {
1578
+		$gd_country = (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '') ? $wp->query_vars['gd_country'] : '';
1579
+		$gd_region = (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] != '') ? $wp->query_vars['gd_region'] : '';
1580
+		$gd_city = (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] != '') ? $wp->query_vars['gd_city'] : '';
1581
+
1582
+		$gd_country_actual = $gd_region_actual = $gd_city_actual = '';
1583
+
1584
+		if (function_exists('get_actual_location_name')) {
1585
+			$gd_country_actual = $gd_country != '' ? get_actual_location_name('country', $gd_country, true) : $gd_country;
1586
+			$gd_region_actual = $gd_region != '' ? get_actual_location_name('region', $gd_region) : $gd_region;
1587
+			$gd_city_actual = $gd_city != '' ? get_actual_location_name('city', $gd_city) : $gd_city;
1588
+		}
1589
+
1590
+		if ($gd_city != '') {
1591
+			if ($gd_city_actual != '') {
1592
+				$gd_city = $gd_city_actual;
1593
+			} else {
1594
+				$gd_city = preg_replace('/-(\d+)$/', '', $gd_city);
1595
+				$gd_city = preg_replace('/[_-]/', ' ', $gd_city);
1596
+				$gd_city = __(geodir_ucwords($gd_city), 'geodirectory');
1597
+			}
1658 1598
 
1599
+			$list_title .= __(' in', 'geodirectory') . " '" . $gd_city . "'";
1600
+		} else if ($gd_region != '') {
1601
+			if ($gd_region_actual != '') {
1602
+				$gd_region = $gd_region_actual;
1603
+			} else {
1604
+				$gd_region = preg_replace('/-(\d+)$/', '', $gd_region);
1605
+				$gd_region = preg_replace('/[_-]/', ' ', $gd_region);
1606
+				$gd_region = __(geodir_ucwords($gd_region), 'geodirectory');
1607
+			}
1659 1608
 
1660
-    /**
1661
-     * Filter page title to replace variables.
1662
-     *
1663
-     * @since 1.5.4
1664
-     * @param string $title The page title including variables.
1665
-     * @param string $gd_page The GeoDirectory page type if any.
1666
-     */
1667
-    $title =  apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
1609
+			$list_title .= __(' in', 'geodirectory') . " '" . $gd_region . "'";
1610
+		} else if ($gd_country != '') {
1611
+			if ($gd_country_actual != '') {
1612
+				$gd_country = $gd_country_actual;
1613
+			} else {
1614
+				$gd_country = preg_replace('/-(\d+)$/', '', $gd_country);
1615
+				$gd_country = preg_replace('/[_-]/', ' ', $gd_country);
1616
+				$gd_country = __(geodir_ucwords($gd_country), 'geodirectory');
1617
+			}
1668 1618
 
1669
-    echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' .
1670
-        /**
1671
-         * Filter the listing page title.
1672
-         *
1673
-         * @since 1.0.0
1674
-         * @param string $list_title The title for the category page.
1675
-         */
1676
-        apply_filters('geodir_listing_page_title', $title) . '</h1></header>';
1619
+			$list_title .= __(' in', 'geodirectory') . " '" . $gd_country . "'";
1620
+		}
1621
+	}
1622
+
1623
+	if (is_search()) {
1624
+		$list_title = __('Search', 'geodirectory') . ' ' . __(geodir_utf8_ucfirst($post_type_info->labels->name), 'geodirectory') . __(' For :', 'geodirectory') . " '" . get_search_query() . "'";
1625
+	}
1626
+	/** This action is documented in geodirectory_template_actions.php */
1627
+	$class = apply_filters('geodir_page_title_class', 'entry-title fn');
1628
+	/** This action is documented in geodirectory_template_actions.php */
1629
+	$class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
1630
+
1631
+
1632
+	$title = $list_title;
1633
+	$gd_page = '';
1634
+	if(geodir_is_page('pt')){
1635
+		$gd_page = 'pt';
1636
+		$title  = (get_option('geodir_page_title_pt')) ? get_option('geodir_page_title_pt') : $title;
1637
+	}
1638
+	elseif(geodir_is_page('listing')){
1639
+		$gd_page = 'listing';
1640
+		global $wp_query;
1641
+		$current_term = $wp_query->get_queried_object();
1642
+		if (strpos($current_term->taxonomy,'_tags') !== false) {
1643
+			$title = (get_option('geodir_page_title_tag-listing')) ? get_option('geodir_page_title_tag-listing') : $title;
1644
+		}else{
1645
+			$title = (get_option('geodir_page_title_cat-listing')) ? get_option('geodir_page_title_cat-listing') : $title;
1646
+		}
1647
+
1648
+	}
1649
+	elseif(geodir_is_page('author')){
1650
+		$gd_page = 'author';
1651
+		if(isset($_REQUEST['list']) && $_REQUEST['list']=='favourite'){
1652
+			$title = (get_option('geodir_page_title_favorite')) ? get_option('geodir_page_title_favorite') : $title;
1653
+		}else{
1654
+			$title = (get_option('geodir_page_title_author')) ? get_option('geodir_page_title_author') : $title;
1655
+		}
1656
+
1657
+	}
1658
+
1659
+
1660
+	/**
1661
+	 * Filter page title to replace variables.
1662
+	 *
1663
+	 * @since 1.5.4
1664
+	 * @param string $title The page title including variables.
1665
+	 * @param string $gd_page The GeoDirectory page type if any.
1666
+	 */
1667
+	$title =  apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
1668
+
1669
+	echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' .
1670
+		/**
1671
+		 * Filter the listing page title.
1672
+		 *
1673
+		 * @since 1.0.0
1674
+		 * @param string $list_title The title for the category page.
1675
+		 */
1676
+		apply_filters('geodir_listing_page_title', $title) . '</h1></header>';
1677 1677
 }
1678 1678
 
1679 1679
 add_action('geodir_listings_page_description', 'geodir_action_listings_description', 10);
@@ -1686,46 +1686,46 @@  discard block
 block discarded – undo
1686 1686
  */
1687 1687
 function geodir_action_listings_description()
1688 1688
 {
1689
-    global $wp_query;
1690
-    $current_term = $wp_query->get_queried_object();
1689
+	global $wp_query;
1690
+	$current_term = $wp_query->get_queried_object();
1691 1691
 
1692
-    $gd_post_type = geodir_get_current_posttype();
1693
-    if (isset($current_term->term_id) && $current_term->term_id != '') {
1692
+	$gd_post_type = geodir_get_current_posttype();
1693
+	if (isset($current_term->term_id) && $current_term->term_id != '') {
1694 1694
 
1695
-        $term_desc = term_description($current_term->term_id, $gd_post_type . '_tags');
1696
-        $saved_data = stripslashes(get_tax_meta($current_term->term_id, 'ct_cat_top_desc', false, $gd_post_type));
1697
-        if ($term_desc && !$saved_data) {
1698
-            $saved_data = $term_desc;
1699
-        }
1695
+		$term_desc = term_description($current_term->term_id, $gd_post_type . '_tags');
1696
+		$saved_data = stripslashes(get_tax_meta($current_term->term_id, 'ct_cat_top_desc', false, $gd_post_type));
1697
+		if ($term_desc && !$saved_data) {
1698
+			$saved_data = $term_desc;
1699
+		}
1700 1700
 
1701
-        // stop payment manager filtering content length
1702
-        $filter_priority = has_filter( 'the_content', 'geodir_payments_the_content' );
1703
-        if ( false !== $filter_priority ) {
1704
-            remove_filter( 'the_content', 'geodir_payments_the_content', $filter_priority );
1705
-        }
1701
+		// stop payment manager filtering content length
1702
+		$filter_priority = has_filter( 'the_content', 'geodir_payments_the_content' );
1703
+		if ( false !== $filter_priority ) {
1704
+			remove_filter( 'the_content', 'geodir_payments_the_content', $filter_priority );
1705
+		}
1706 1706
 
1707
-        /**
1708
-         * Apply the core filter `the_content` filter to the variable string.
1709
-         *
1710
-         * This is a WordPress core filter that does many things.
1711
-         *
1712
-         * @since 1.0.0
1713
-         * @param string $var The string to apply the filter to.
1714
-         */
1715
-        $cat_description = apply_filters('the_content', $saved_data);
1707
+		/**
1708
+		 * Apply the core filter `the_content` filter to the variable string.
1709
+		 *
1710
+		 * This is a WordPress core filter that does many things.
1711
+		 *
1712
+		 * @since 1.0.0
1713
+		 * @param string $var The string to apply the filter to.
1714
+		 */
1715
+		$cat_description = apply_filters('the_content', $saved_data);
1716 1716
 
1717 1717
 
1718
-        if ( false !== $filter_priority ) {
1719
-            add_filter( 'the_content', 'geodir_payments_the_content', $filter_priority );
1720
-        }
1718
+		if ( false !== $filter_priority ) {
1719
+			add_filter( 'the_content', 'geodir_payments_the_content', $filter_priority );
1720
+		}
1721 1721
 
1722
-        if ($cat_description) {
1723
-            ?>
1722
+		if ($cat_description) {
1723
+			?>
1724 1724
 
1725 1725
             <div class="term_description"><?php echo $cat_description;?></div> <?php
1726
-        }
1726
+		}
1727 1727
 
1728
-    }
1728
+	}
1729 1729
 }
1730 1730
 
1731 1731
 // action for adding the listings page top widget area
@@ -1744,11 +1744,11 @@  discard block
 block discarded – undo
1744 1744
  */
1745 1745
 function geodir_action_geodir_sidebar_listings_top()
1746 1746
 {
1747
-    if (get_option('geodir_show_listing_top_section')) { ?>
1747
+	if (get_option('geodir_show_listing_top_section')) { ?>
1748 1748
         <div
1749 1749
             class="<?php
1750
-            /** This action is documented in geodirectory_template_actions.php */
1751
-            echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_listing_top'); ?>">
1750
+			/** This action is documented in geodirectory_template_actions.php */
1751
+			echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_listing_top'); ?>">
1752 1752
             <?php dynamic_sidebar('geodir_listing_top'); ?>
1753 1753
         </div><!-- clearfix ends here-->
1754 1754
     <?php }
@@ -1771,35 +1771,35 @@  discard block
 block discarded – undo
1771 1771
  */
1772 1772
 function geodir_action_sidebar_left_open($type = '', $id = '', $class = '', $itemtype = '')
1773 1773
 {
1774
-    if ($type == 'home-page' && $width = get_option('geodir_width_home_left_section')) {
1775
-        $width_css = 'style="width:' . $width . '%;"';
1776
-    } elseif ($type == 'listings-page' && $width = get_option('geodir_width_listing_left_section')) {
1777
-        $width_css = 'style="width:' . $width . '%;"';
1778
-    } elseif ($type == 'search-page' && $width = get_option('geodir_width_search_left_section')) {
1779
-        $width_css = 'style="width:' . $width . '%;"';
1780
-    } elseif ($type == 'author-page' && $width = get_option('geodir_width_author_left_section')) {
1781
-        $width_css = 'style="width:' . $width . '%;"';
1782
-    } else {
1783
-        $width_css = '';
1784
-    }
1785
-
1786
-    $tc = get_option('theme_compatibility_setting');
1787
-    if (!empty($tc['geodir_sidebar_left_open_replace'])) {
1788
-        $text = $tc['geodir_sidebar_left_open_replace'];
1789
-    } else {
1790
-        $text = '<aside  id="[id]" class="[class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>';
1791
-    }
1792
-
1793
-    if (!empty($tc['geodir_sidebar_left_open_id'])) {
1794
-        $id = $tc['geodir_sidebar_left_open_id'];
1795
-    }
1796
-    if (!empty($tc['geodir_sidebar_left_open_class'])) {
1797
-        $class = $tc['geodir_sidebar_left_open_class'];
1798
-    }
1799
-
1800
-    $text = str_replace(array("[id]", "[class]", "[itemtype]", "[width_css]"), array($id, $class, $itemtype, $width_css), $text);
1801
-
1802
-    echo $text;
1774
+	if ($type == 'home-page' && $width = get_option('geodir_width_home_left_section')) {
1775
+		$width_css = 'style="width:' . $width . '%;"';
1776
+	} elseif ($type == 'listings-page' && $width = get_option('geodir_width_listing_left_section')) {
1777
+		$width_css = 'style="width:' . $width . '%;"';
1778
+	} elseif ($type == 'search-page' && $width = get_option('geodir_width_search_left_section')) {
1779
+		$width_css = 'style="width:' . $width . '%;"';
1780
+	} elseif ($type == 'author-page' && $width = get_option('geodir_width_author_left_section')) {
1781
+		$width_css = 'style="width:' . $width . '%;"';
1782
+	} else {
1783
+		$width_css = '';
1784
+	}
1785
+
1786
+	$tc = get_option('theme_compatibility_setting');
1787
+	if (!empty($tc['geodir_sidebar_left_open_replace'])) {
1788
+		$text = $tc['geodir_sidebar_left_open_replace'];
1789
+	} else {
1790
+		$text = '<aside  id="[id]" class="[class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>';
1791
+	}
1792
+
1793
+	if (!empty($tc['geodir_sidebar_left_open_id'])) {
1794
+		$id = $tc['geodir_sidebar_left_open_id'];
1795
+	}
1796
+	if (!empty($tc['geodir_sidebar_left_open_class'])) {
1797
+		$class = $tc['geodir_sidebar_left_open_class'];
1798
+	}
1799
+
1800
+	$text = str_replace(array("[id]", "[class]", "[itemtype]", "[width_css]"), array($id, $class, $itemtype, $width_css), $text);
1801
+
1802
+	echo $text;
1803 1803
 }
1804 1804
 
1805 1805
 // action for adding the primary div closing tag
@@ -1815,13 +1815,13 @@  discard block
 block discarded – undo
1815 1815
  */
1816 1816
 function geodir_action_sidebar_left_close($type = '')
1817 1817
 {
1818
-    $tc = get_option('theme_compatibility_setting');
1819
-    if (!empty($tc['geodir_sidebar_left_close_replace'])) {
1820
-        $text = $tc['geodir_sidebar_left_close_replace'];
1821
-    } else {
1822
-        $text = '</aside><!-- sidebar ends here-->';
1823
-    }
1824
-    echo $text;
1818
+	$tc = get_option('theme_compatibility_setting');
1819
+	if (!empty($tc['geodir_sidebar_left_close_replace'])) {
1820
+		$text = $tc['geodir_sidebar_left_close_replace'];
1821
+	} else {
1822
+		$text = '</aside><!-- sidebar ends here-->';
1823
+	}
1824
+	echo $text;
1825 1825
 }
1826 1826
 
1827 1827
 /**
@@ -1834,7 +1834,7 @@  discard block
 block discarded – undo
1834 1834
  */
1835 1835
 function geodir_listing_left_section()
1836 1836
 {
1837
-    if (get_option('geodir_show_listing_left_section')) { ?>
1837
+	if (get_option('geodir_show_listing_left_section')) { ?>
1838 1838
         <div class="geodir-content-left geodir-sidebar-wrap">
1839 1839
             <?php dynamic_sidebar('geodir_listing_left_sidebar'); ?>
1840 1840
         </div><!-- end geodir-content-left -->
@@ -1852,20 +1852,20 @@  discard block
 block discarded – undo
1852 1852
  */
1853 1853
 function geodir_action_listings_sidebar_left()
1854 1854
 {
1855
-    if (get_option('geodir_show_listing_left_section')) {
1856
-        /** This action is documented in geodirectory_template_actions.php */
1857
-        do_action('geodir_sidebar_left_open', 'listings-page', 'geodir-sidebar-left', 'geodir-sidebar-left geodir-listings-sidebar-left', 'https://schema.org/WPSideBar');
1858
-        /**
1859
-         * Calls the listings page (category) left sidebar content.
1860
-         *
1861
-         * All the content for the listings page left sidebar is added via this hook.
1862
-         *
1863
-         * @since 1.0.0
1864
-         */
1865
-        do_action('geodir_listings_sidebar_left_inside');
1866
-        /** This action is documented in geodirectory_template_actions.php */
1867
-        do_action('geodir_sidebar_left_close', 'listings-page');
1868
-    }
1855
+	if (get_option('geodir_show_listing_left_section')) {
1856
+		/** This action is documented in geodirectory_template_actions.php */
1857
+		do_action('geodir_sidebar_left_open', 'listings-page', 'geodir-sidebar-left', 'geodir-sidebar-left geodir-listings-sidebar-left', 'https://schema.org/WPSideBar');
1858
+		/**
1859
+		 * Calls the listings page (category) left sidebar content.
1860
+		 *
1861
+		 * All the content for the listings page left sidebar is added via this hook.
1862
+		 *
1863
+		 * @since 1.0.0
1864
+		 */
1865
+		do_action('geodir_listings_sidebar_left_inside');
1866
+		/** This action is documented in geodirectory_template_actions.php */
1867
+		do_action('geodir_sidebar_left_close', 'listings-page');
1868
+	}
1869 1869
 }
1870 1870
 
1871 1871
 /**
@@ -1878,7 +1878,7 @@  discard block
 block discarded – undo
1878 1878
  */
1879 1879
 function geodir_listing_right_section()
1880 1880
 {
1881
-    if (get_option('geodir_show_listing_right_section')) { ?>
1881
+	if (get_option('geodir_show_listing_right_section')) { ?>
1882 1882
         <div class="geodir-content-right geodir-sidebar-wrap">
1883 1883
             <?php dynamic_sidebar('geodir_listing_right_sidebar'); ?>
1884 1884
         </div><!-- end geodir-content-right -->
@@ -1896,20 +1896,20 @@  discard block
 block discarded – undo
1896 1896
  */
1897 1897
 function geodir_action_listings_sidebar_right()
1898 1898
 {
1899
-    if (get_option('geodir_show_listing_right_section')) {
1900
-        /** This action is documented in geodirectory_template_actions.php */
1901
-        do_action('geodir_sidebar_right_open', 'listings-page', 'geodir-sidebar-right', 'geodir-sidebar-right geodir-listings-sidebar-right', 'http://schema.org/WPSideBar');
1902
-        /**
1903
-         * Calls the listings page (category) right sidebar content.
1904
-         *
1905
-         * All the content for the listings page right sidebar is added via this hook.
1906
-         *
1907
-         * @since 1.0.0
1908
-         */
1909
-        do_action('geodir_listings_sidebar_right_inside');
1910
-        /** This action is documented in geodirectory_template_actions.php */
1911
-        do_action('geodir_sidebar_right_close', 'listings-page');
1912
-    }
1899
+	if (get_option('geodir_show_listing_right_section')) {
1900
+		/** This action is documented in geodirectory_template_actions.php */
1901
+		do_action('geodir_sidebar_right_open', 'listings-page', 'geodir-sidebar-right', 'geodir-sidebar-right geodir-listings-sidebar-right', 'http://schema.org/WPSideBar');
1902
+		/**
1903
+		 * Calls the listings page (category) right sidebar content.
1904
+		 *
1905
+		 * All the content for the listings page right sidebar is added via this hook.
1906
+		 *
1907
+		 * @since 1.0.0
1908
+		 */
1909
+		do_action('geodir_listings_sidebar_right_inside');
1910
+		/** This action is documented in geodirectory_template_actions.php */
1911
+		do_action('geodir_sidebar_right_close', 'listings-page');
1912
+	}
1913 1913
 }
1914 1914
 
1915 1915
 
@@ -1926,23 +1926,23 @@  discard block
 block discarded – undo
1926 1926
  */
1927 1927
 function geodir_action_main_content_open($type = '', $id = '', $class = '')
1928 1928
 {
1929
-    $tc = get_option('theme_compatibility_setting');
1930
-    if (!empty($tc['geodir_main_content_open_replace'])) {
1931
-        $text = $tc['geodir_main_content_open_replace'];
1932
-    } else {
1933
-        $text = '<main id="[id]" class="[class]" role="main">';
1934
-    }
1929
+	$tc = get_option('theme_compatibility_setting');
1930
+	if (!empty($tc['geodir_main_content_open_replace'])) {
1931
+		$text = $tc['geodir_main_content_open_replace'];
1932
+	} else {
1933
+		$text = '<main id="[id]" class="[class]" role="main">';
1934
+	}
1935 1935
 
1936
-    if (!empty($tc['geodir_main_content_open_id'])) {
1937
-        $id = $tc['geodir_main_content_open_id'];
1938
-    }
1939
-    if (!empty($tc['geodir_main_content_open_class'])) {
1940
-        $class = $tc['geodir_main_content_open_class'];
1941
-    }
1936
+	if (!empty($tc['geodir_main_content_open_id'])) {
1937
+		$id = $tc['geodir_main_content_open_id'];
1938
+	}
1939
+	if (!empty($tc['geodir_main_content_open_class'])) {
1940
+		$class = $tc['geodir_main_content_open_class'];
1941
+	}
1942 1942
 
1943
-    $text = str_replace(array("[id]", "[class]"), array($id, $class), $text);
1943
+	$text = str_replace(array("[id]", "[class]"), array($id, $class), $text);
1944 1944
 
1945
-    echo $text;
1945
+	echo $text;
1946 1946
 }
1947 1947
 
1948 1948
 // action for adding the primary div closing tag
@@ -1955,13 +1955,13 @@  discard block
 block discarded – undo
1955 1955
  */
1956 1956
 function geodir_action_main_content_close()
1957 1957
 {
1958
-    $tc = get_option('theme_compatibility_setting');
1959
-    if (!empty($tc['geodir_main_content_close_replace'])) {
1960
-        $text = $tc['geodir_main_content_close_replace'];
1961
-    } else {
1962
-        $text = '</main><!-- main ends here-->';
1963
-    }
1964
-    echo $text;
1958
+	$tc = get_option('theme_compatibility_setting');
1959
+	if (!empty($tc['geodir_main_content_close_replace'])) {
1960
+		$text = $tc['geodir_main_content_close_replace'];
1961
+	} else {
1962
+		$text = '</main><!-- main ends here-->';
1963
+	}
1964
+	echo $text;
1965 1965
 }
1966 1966
 
1967 1967
 /**
@@ -1973,14 +1973,14 @@  discard block
 block discarded – undo
1973 1973
  */
1974 1974
 function geodir_action_listings_content_inside()
1975 1975
 {
1976
-    global $gridview_columns;
1977
-    $listing_view = get_option('geodir_listing_view');
1978
-    if (strstr($listing_view, 'gridview')) {
1979
-        $gridview_columns = $listing_view;
1980
-        $listing_view_exp = explode('_', $listing_view);
1981
-        $listing_view = $listing_view_exp[0];
1982
-    }
1983
-    geodir_get_template_part('listing', 'listview');
1976
+	global $gridview_columns;
1977
+	$listing_view = get_option('geodir_listing_view');
1978
+	if (strstr($listing_view, 'gridview')) {
1979
+		$gridview_columns = $listing_view;
1980
+		$listing_view_exp = explode('_', $listing_view);
1981
+		$listing_view = $listing_view_exp[0];
1982
+	}
1983
+	geodir_get_template_part('listing', 'listview');
1984 1984
 }
1985 1985
 
1986 1986
 add_action('geodir_listings_content_inside', 'geodir_action_listings_content_inside', 10);
@@ -1996,47 +1996,47 @@  discard block
 block discarded – undo
1996 1996
  */
1997 1997
 function geodir_action_listings_content()
1998 1998
 {
1999
-    /**
2000
-     * This is used to add HTML opening wrappers to the main content of most pages including listings, author, search, home etc.
2001
-     *
2002
-     * @since 1.0.0
2003
-     * @param string $type The page type. Values can be 'listings-page', 'author-page', 'search-page' or 'home-page'.
2004
-     * @param string $id The id for the div. Usually 'geodir-main-content'.
2005
-     * @param string $class The class for the div. Values can be 'listings-page', 'author-page', 'search-page' or 'home-page'.
2006
-     * @see 'geodir_main_content_close' Where the oposing closing tag is added.
2007
-     */
2008
-    do_action('geodir_main_content_open', 'listings-page', 'geodir-main-content', 'listings-page');
2009
-    $extra_class = apply_filters('geodir_before_listing_wrapper_extra_class', '', 'listings-page');
2010
-    echo '<div class="clearfix '.$extra_class.'">';
2011
-    /**
2012
-     * Called before the listings page content, inside the outer wrapper. Used on listings pages and search and author pages.
2013
-     *
2014
-     * @since 1.0.0
2015
-     */
2016
-    do_action('geodir_before_listing');
2017
-    echo '</div>';
2018
-
2019
-    /**
2020
-     * This actions calls the listings list content. Used on listings pages and search and author pages.
2021
-     *
2022
-     * @since 1.0.0
2023
-     */
2024
-    do_action('geodir_listings_content_inside');
2025
-
2026
-    /**
2027
-     * Called after the listings content, inside the outer wrapper HTML. Used on listings pages and search and author pages.
2028
-     *
2029
-     * @since 1.0.0
2030
-     */
2031
-    do_action('geodir_after_listing');
2032
-
2033
-    /**
2034
-     * This is used to add HTML closing wrappers to the main content of most pages including listings, author, search, home etc.
2035
-     *
2036
-     * @since 1.0.0
2037
-     * @see 'geodir_main_content_open' Where the oposing opening tag is added.
2038
-     */
2039
-    do_action('geodir_main_content_close', 'listings-page');
1999
+	/**
2000
+	 * This is used to add HTML opening wrappers to the main content of most pages including listings, author, search, home etc.
2001
+	 *
2002
+	 * @since 1.0.0
2003
+	 * @param string $type The page type. Values can be 'listings-page', 'author-page', 'search-page' or 'home-page'.
2004
+	 * @param string $id The id for the div. Usually 'geodir-main-content'.
2005
+	 * @param string $class The class for the div. Values can be 'listings-page', 'author-page', 'search-page' or 'home-page'.
2006
+	 * @see 'geodir_main_content_close' Where the oposing closing tag is added.
2007
+	 */
2008
+	do_action('geodir_main_content_open', 'listings-page', 'geodir-main-content', 'listings-page');
2009
+	$extra_class = apply_filters('geodir_before_listing_wrapper_extra_class', '', 'listings-page');
2010
+	echo '<div class="clearfix '.$extra_class.'">';
2011
+	/**
2012
+	 * Called before the listings page content, inside the outer wrapper. Used on listings pages and search and author pages.
2013
+	 *
2014
+	 * @since 1.0.0
2015
+	 */
2016
+	do_action('geodir_before_listing');
2017
+	echo '</div>';
2018
+
2019
+	/**
2020
+	 * This actions calls the listings list content. Used on listings pages and search and author pages.
2021
+	 *
2022
+	 * @since 1.0.0
2023
+	 */
2024
+	do_action('geodir_listings_content_inside');
2025
+
2026
+	/**
2027
+	 * Called after the listings content, inside the outer wrapper HTML. Used on listings pages and search and author pages.
2028
+	 *
2029
+	 * @since 1.0.0
2030
+	 */
2031
+	do_action('geodir_after_listing');
2032
+
2033
+	/**
2034
+	 * This is used to add HTML closing wrappers to the main content of most pages including listings, author, search, home etc.
2035
+	 *
2036
+	 * @since 1.0.0
2037
+	 * @see 'geodir_main_content_open' Where the oposing opening tag is added.
2038
+	 */
2039
+	do_action('geodir_main_content_close', 'listings-page');
2040 2040
 }
2041 2041
 
2042 2042
 
@@ -2051,10 +2051,10 @@  discard block
 block discarded – undo
2051 2051
  */
2052 2052
 function geodir_action_sidebar_listings_bottom_section()
2053 2053
 {
2054
-    if (get_option('geodir_show_listing_bottom_section')) { ?>
2054
+	if (get_option('geodir_show_listing_bottom_section')) { ?>
2055 2055
         <div class="<?php
2056
-            /** This action is documented in geodirectory_template_actions.php */
2057
-            echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_listing_bottom'); ?>">
2056
+			/** This action is documented in geodirectory_template_actions.php */
2057
+			echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_listing_bottom'); ?>">
2058 2058
             <?php dynamic_sidebar('geodir_listing_bottom'); ?>
2059 2059
         </div><!-- clearfix ends here-->
2060 2060
     <?php }
@@ -2074,38 +2074,38 @@  discard block
 block discarded – undo
2074 2074
  */
2075 2075
 function geodir_action_add_listing_page_title()
2076 2076
 {
2077
-    if (isset($_REQUEST['listing_type']) && $_REQUEST['listing_type'] != '')
2078
-        $listing_type = sanitize_text_field($_REQUEST['listing_type']);
2079
-    /** This action is documented in geodirectory_template_actions.php */
2080
-    $class = apply_filters('geodir_page_title_class', 'entry-title fn');
2081
-    /** This action is documented in geodirectory_template_actions.php */
2082
-    $class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
2083
-
2084
-    $title = apply_filters('geodir_add_listing_page_title_text', get_the_title());
2085
-
2086
-    if(geodir_is_page('add-listing')){
2087
-        $gd_page = 'add-listing';
2088
-        if(isset($_REQUEST['pid']) && $_REQUEST['pid'] != ''){
2089
-            $title = (get_option('geodir_page_title_edit-listing')) ? get_option('geodir_page_title_edit-listing') : $title;
2090
-        }elseif(isset($listing_type)){
2091
-            $title = (get_option('geodir_page_title_add-listing')) ? get_option('geodir_page_title_add-listing') : $title;
2092
-        }
2077
+	if (isset($_REQUEST['listing_type']) && $_REQUEST['listing_type'] != '')
2078
+		$listing_type = sanitize_text_field($_REQUEST['listing_type']);
2079
+	/** This action is documented in geodirectory_template_actions.php */
2080
+	$class = apply_filters('geodir_page_title_class', 'entry-title fn');
2081
+	/** This action is documented in geodirectory_template_actions.php */
2082
+	$class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
2083
+
2084
+	$title = apply_filters('geodir_add_listing_page_title_text', get_the_title());
2085
+
2086
+	if(geodir_is_page('add-listing')){
2087
+		$gd_page = 'add-listing';
2088
+		if(isset($_REQUEST['pid']) && $_REQUEST['pid'] != ''){
2089
+			$title = (get_option('geodir_page_title_edit-listing')) ? get_option('geodir_page_title_edit-listing') : $title;
2090
+		}elseif(isset($listing_type)){
2091
+			$title = (get_option('geodir_page_title_add-listing')) ? get_option('geodir_page_title_add-listing') : $title;
2092
+		}
2093 2093
 
2094
-    }
2094
+	}
2095 2095
 
2096 2096
 
2097
-    /**
2098
-     * Filter page title to replace variables.
2099
-     *
2100
-     * @since 1.5.4
2101
-     * @param string $title The page title including variables.
2102
-     * @param string $gd_page The GeoDirectory page type if any.
2103
-     */
2104
-    $title =  apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
2097
+	/**
2098
+	 * Filter page title to replace variables.
2099
+	 *
2100
+	 * @since 1.5.4
2101
+	 * @param string $title The page title including variables.
2102
+	 * @param string $gd_page The GeoDirectory page type if any.
2103
+	 */
2104
+	$title =  apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
2105 2105
 
2106
-    echo '<header class="' . $class_header . '"><h1 class="' . $class . '">';
2107
-    echo $title;
2108
-    echo '</h1></header>';
2106
+	echo '<header class="' . $class_header . '"><h1 class="' . $class . '">';
2107
+	echo $title;
2108
+	echo '</h1></header>';
2109 2109
 }
2110 2110
 
2111 2111
 add_action('geodir_add_listing_page_mandatory', 'geodir_action_add_listing_page_mandatory', 10);
@@ -2136,61 +2136,61 @@  discard block
 block discarded – undo
2136 2136
  */
2137 2137
 function geodir_action_add_listing_form()
2138 2138
 {
2139
-    global $cat_display, $post_cat, $current_user, $gd_session;
2140
-    $page_id = get_the_ID();
2141
-    $post = '';
2142
-    $title = '';
2143
-    $desc = '';
2144
-    $kw_tags = '';
2145
-    $required_msg = '';
2146
-    $submit_button = '';
2147
-
2148
-    $ajax_action = isset($_REQUEST['ajax_action']) ? $_REQUEST['ajax_action'] : 'add';
2149
-
2150
-    $thumb_img_arr = array();
2151
-    $curImages = '';
2152
-
2153
-    if (isset($_REQUEST['backandedit'])) {
2154
-        global $post;
2155
-        $post = (object)$gd_session->get('listing');
2156
-        $listing_type = $post->listing_type;
2157
-        $title = $post->post_title;
2158
-        $desc = $post->post_desc;
2159
-        $post_cat = $post->post_category;
2160
-
2161
-        $kw_tags = $post->post_tags;
2162
-        $curImages = isset($post->post_images) ? $post->post_images : '';
2163
-    } elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
2164
-        global $post, $post_images;
2165
-
2166
-        $post = geodir_get_post_info($_REQUEST['pid']);
2167
-        $thumb_img_arr = geodir_get_images($post->ID);
2168
-        if ($thumb_img_arr) {
2169
-            foreach ($thumb_img_arr as $post_img) {
2170
-                $curImages .= $post_img->src . ',';
2171
-            }
2172
-        }
2139
+	global $cat_display, $post_cat, $current_user, $gd_session;
2140
+	$page_id = get_the_ID();
2141
+	$post = '';
2142
+	$title = '';
2143
+	$desc = '';
2144
+	$kw_tags = '';
2145
+	$required_msg = '';
2146
+	$submit_button = '';
2147
+
2148
+	$ajax_action = isset($_REQUEST['ajax_action']) ? $_REQUEST['ajax_action'] : 'add';
2149
+
2150
+	$thumb_img_arr = array();
2151
+	$curImages = '';
2152
+
2153
+	if (isset($_REQUEST['backandedit'])) {
2154
+		global $post;
2155
+		$post = (object)$gd_session->get('listing');
2156
+		$listing_type = $post->listing_type;
2157
+		$title = $post->post_title;
2158
+		$desc = $post->post_desc;
2159
+		$post_cat = $post->post_category;
2160
+
2161
+		$kw_tags = $post->post_tags;
2162
+		$curImages = isset($post->post_images) ? $post->post_images : '';
2163
+	} elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
2164
+		global $post, $post_images;
2165
+
2166
+		$post = geodir_get_post_info($_REQUEST['pid']);
2167
+		$thumb_img_arr = geodir_get_images($post->ID);
2168
+		if ($thumb_img_arr) {
2169
+			foreach ($thumb_img_arr as $post_img) {
2170
+				$curImages .= $post_img->src . ',';
2171
+			}
2172
+		}
2173 2173
 
2174
-        $listing_type = $post->post_type;
2175
-        $title = $post->post_title;
2176
-        $desc = $post->post_content;
2177
-        $kw_tags = $post->post_tags;
2178
-        $kw_tags = implode(",", wp_get_object_terms($post->ID, $listing_type . '_tags', array('fields' => 'names')));
2179
-    } else {
2180
-        $listing_type = sanitize_text_field($_REQUEST['listing_type']);
2181
-    }
2174
+		$listing_type = $post->post_type;
2175
+		$title = $post->post_title;
2176
+		$desc = $post->post_content;
2177
+		$kw_tags = $post->post_tags;
2178
+		$kw_tags = implode(",", wp_get_object_terms($post->ID, $listing_type . '_tags', array('fields' => 'names')));
2179
+	} else {
2180
+		$listing_type = sanitize_text_field($_REQUEST['listing_type']);
2181
+	}
2182 2182
 
2183
-    if ($current_user->ID != '0') {
2184
-        $user_login = true;
2185
-    }
2183
+	if ($current_user->ID != '0') {
2184
+		$user_login = true;
2185
+	}
2186 2186
 
2187
-    $post_type_info = geodir_get_posttype_info($listing_type);
2187
+	$post_type_info = geodir_get_posttype_info($listing_type);
2188 2188
 
2189
-    $cpt_singular_name = (isset($post_type_info['labels']['singular_name']) && $post_type_info['labels']['singular_name']) ? __($post_type_info['labels']['singular_name'], 'geodirectory') : __('Listing','geodirectory');
2189
+	$cpt_singular_name = (isset($post_type_info['labels']['singular_name']) && $post_type_info['labels']['singular_name']) ? __($post_type_info['labels']['singular_name'], 'geodirectory') : __('Listing','geodirectory');
2190 2190
     
2191
-    $package_info = array();
2192
-    $package_info = geodir_post_package_info($package_info, $post);
2193
-    ?>
2191
+	$package_info = array();
2192
+	$package_info = geodir_post_package_info($package_info, $post);
2193
+	?>
2194 2194
     <form name="propertyform" id="propertyform" action="<?php echo get_page_link(geodir_preview_page_id());?>" method="post" enctype="multipart/form-data">
2195 2195
         <input type="hidden" name="preview" value="<?php echo sanitize_text_field($listing_type);?>"/>
2196 2196
         <input type="hidden" name="listing_type" value="<?php echo sanitize_text_field($listing_type);?>"/>
@@ -2201,114 +2201,114 @@  discard block
 block discarded – undo
2201 2201
         <?php } if (isset($_REQUEST['backandedit'])) { ?>
2202 2202
             <input type="hidden" name="backandedit" value="<?php echo sanitize_text_field($_REQUEST['backandedit']);?>"/>
2203 2203
         <?php
2204
-        } 
2205
-        /**
2206
-         * Called at the very top of the add listing page form for frontend.
2207
-         *
2208
-         * This is called just before the "Enter Listing Details" text.
2209
-         *
2210
-         * @since 1.0.0
2211
-         */
2212
-        do_action('geodir_before_detail_fields');
2213
-        ?>
2204
+		} 
2205
+		/**
2206
+		 * Called at the very top of the add listing page form for frontend.
2207
+		 *
2208
+		 * This is called just before the "Enter Listing Details" text.
2209
+		 *
2210
+		 * @since 1.0.0
2211
+		 */
2212
+		do_action('geodir_before_detail_fields');
2213
+		?>
2214 2214
         <h5 id="geodir_fieldset_details" class="geodir-fieldset-row" gd-fieldset="details"><?php echo LISTING_DETAILS_TEXT;?></h5>
2215 2215
         <?php
2216
-        /**
2217
-         * Called at the top of the add listing page form for frontend.
2218
-         *
2219
-         * This is called after the "Enter Listing Details" text.
2220
-         *
2221
-         * @since 1.0.0
2222
-         */
2223
-        do_action('geodir_before_main_form_fields');
2224
-        ?>
2216
+		/**
2217
+		 * Called at the top of the add listing page form for frontend.
2218
+		 *
2219
+		 * This is called after the "Enter Listing Details" text.
2220
+		 *
2221
+		 * @since 1.0.0
2222
+		 */
2223
+		do_action('geodir_before_main_form_fields');
2224
+		?>
2225 2225
         <div id="geodir_post_title_row" class="required_field geodir_form_row clearfix gd-fieldset-details">
2226 2226
             <label><?php
2227
-                /**
2228
-                 * Filter the add listing page title input label.
2229
-                 *
2230
-                 * @since 1.6.11
2231
-                 * @param string $title The title to be output.
2232
-                 * @param string $cpt_singular_name The singular title of the curent CPT.
2233
-                 * @param string $listing_type The CPT being requested. ie: gd_place.
2234
-                 */
2235
-                echo apply_filters('geodir_add_listing_title_label', sprintf( __('%s Title', 'geodirectory'), $cpt_singular_name ),$cpt_singular_name,$listing_type); ?><span>*</span> </label>
2227
+				/**
2228
+				 * Filter the add listing page title input label.
2229
+				 *
2230
+				 * @since 1.6.11
2231
+				 * @param string $title The title to be output.
2232
+				 * @param string $cpt_singular_name The singular title of the curent CPT.
2233
+				 * @param string $listing_type The CPT being requested. ie: gd_place.
2234
+				 */
2235
+				echo apply_filters('geodir_add_listing_title_label', sprintf( __('%s Title', 'geodirectory'), $cpt_singular_name ),$cpt_singular_name,$listing_type); ?><span>*</span> </label>
2236 2236
             <input type="text" field_type="text" name="post_title" id="post_title" class="geodir_textfield"
2237 2237
                    value="<?php echo esc_attr(stripslashes($title)); ?>"/>
2238 2238
             <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory');?></span>
2239 2239
         </div>
2240 2240
         <?php
2241
-        $show_editor = get_option('geodir_tiny_editor_on_add_listing');
2242
-        $show_editor = !empty($show_editor) && in_array($listing_type, $show_editor) ? true : false;
2243
-        /**
2244
-         * Filter whether to show or don't show the editor.
2245
-         *
2246
-         * @since 1.6.16
2247
-         * @param bool $show_editor If true the editor will be available for description field.
2248
-         * @param object $package_info The listing package.
2249
-         * @param string $listing_type The current post type.
2250
-         * @param object $post The current post object.
2251
-         */
2252
-        $show_editor = apply_filters('geodir_description_field_show_editor', $show_editor, $package_info, $listing_type, $post);
2253
-
2254
-        $desc = $show_editor ? stripslashes($desc) : esc_attr(stripslashes($desc));
2255
-        $desc_limit = '';
2256
-        /**
2257
-         * Filter the add listing description field character limit number.
2258
-         *
2259
-         * @since 1.0.0
2260
-         * @param int $desc_limit The amount of characters to limit the description to.
2261
-         */
2262
-        $desc_limit = apply_filters('geodir_description_field_desc_limit', $desc_limit);
2263
-        /**
2264
-         * Filter the add listing description field text.
2265
-         *
2266
-         * @since 1.0.0
2267
-         * @param string $desc The text for the description field.
2268
-         * @param int $desc_limit The character limit number if any.
2269
-         */
2270
-        $desc = apply_filters('geodir_description_field_desc', $desc, $desc_limit);
2271
-        $desc_limit_msg = '';
2272
-        /**
2273
-         * Filter the add listing description limit message.
2274
-         *
2275
-         * This is the message shown if there is a limit applied to the amount of characters the description can use.
2276
-         *
2277
-         * @since 1.0.0
2278
-         * @param string $desc_limit_msg The limit message string if any.
2279
-         * @param int $desc_limit The character limit numer if any.
2280
-         */
2281
-        $desc_limit_msg = apply_filters('geodir_description_field_desc_limit_msg', $desc_limit_msg, $desc_limit);
2241
+		$show_editor = get_option('geodir_tiny_editor_on_add_listing');
2242
+		$show_editor = !empty($show_editor) && in_array($listing_type, $show_editor) ? true : false;
2243
+		/**
2244
+		 * Filter whether to show or don't show the editor.
2245
+		 *
2246
+		 * @since 1.6.16
2247
+		 * @param bool $show_editor If true the editor will be available for description field.
2248
+		 * @param object $package_info The listing package.
2249
+		 * @param string $listing_type The current post type.
2250
+		 * @param object $post The current post object.
2251
+		 */
2252
+		$show_editor = apply_filters('geodir_description_field_show_editor', $show_editor, $package_info, $listing_type, $post);
2253
+
2254
+		$desc = $show_editor ? stripslashes($desc) : esc_attr(stripslashes($desc));
2255
+		$desc_limit = '';
2256
+		/**
2257
+		 * Filter the add listing description field character limit number.
2258
+		 *
2259
+		 * @since 1.0.0
2260
+		 * @param int $desc_limit The amount of characters to limit the description to.
2261
+		 */
2262
+		$desc_limit = apply_filters('geodir_description_field_desc_limit', $desc_limit);
2263
+		/**
2264
+		 * Filter the add listing description field text.
2265
+		 *
2266
+		 * @since 1.0.0
2267
+		 * @param string $desc The text for the description field.
2268
+		 * @param int $desc_limit The character limit number if any.
2269
+		 */
2270
+		$desc = apply_filters('geodir_description_field_desc', $desc, $desc_limit);
2271
+		$desc_limit_msg = '';
2272
+		/**
2273
+		 * Filter the add listing description limit message.
2274
+		 *
2275
+		 * This is the message shown if there is a limit applied to the amount of characters the description can use.
2276
+		 *
2277
+		 * @since 1.0.0
2278
+		 * @param string $desc_limit_msg The limit message string if any.
2279
+		 * @param int $desc_limit The character limit numer if any.
2280
+		 */
2281
+		$desc_limit_msg = apply_filters('geodir_description_field_desc_limit_msg', $desc_limit_msg, $desc_limit);
2282 2282
         
2283
-        $desc_class = '';
2284
-        if ($desc_limit === '' || (int)$desc_limit > 0) {
2285
-            /**
2286
-             * Called on the add listing page form for frontend just before the description field.
2287
-             *
2288
-             * @since 1.0.0
2289
-             */
2290
-            do_action('geodir_before_description_field');
2283
+		$desc_class = '';
2284
+		if ($desc_limit === '' || (int)$desc_limit > 0) {
2285
+			/**
2286
+			 * Called on the add listing page form for frontend just before the description field.
2287
+			 *
2288
+			 * @since 1.0.0
2289
+			 */
2290
+			do_action('geodir_before_description_field');
2291 2291
             
2292
-            $desc_class = ' required_field';
2293
-        } else {
2294
-            $desc_class = ' hidden';
2295
-        }
2296
-        ?>
2292
+			$desc_class = ' required_field';
2293
+		} else {
2294
+			$desc_class = ' hidden';
2295
+		}
2296
+		?>
2297 2297
         <div id="geodir_post_desc_row" class="geodir_form_row clearfix gd-fieldset-details<?php echo $desc_class;?>">
2298 2298
             <label><?php
2299
-                /**
2300
-                 * Filter the add listing page description input label.
2301
-                 *
2302
-                 * @since 1.6.11
2303
-                 * @param string $title The title to be output.
2304
-                 * @param string $cpt_singular_name The singular title of the curent CPT.
2305
-                 * @param string $listing_type The CPT being requested. ie: gd_place.
2306
-                 */
2307
-                echo apply_filters('geodir_add_listing_description_label',sprintf( __('%s Description', 'geodirectory'), $cpt_singular_name ),$cpt_singular_name,$listing_type); ?><span><?php if ($desc_limit != '0') { echo '*'; } ?></span> </label>
2299
+				/**
2300
+				 * Filter the add listing page description input label.
2301
+				 *
2302
+				 * @since 1.6.11
2303
+				 * @param string $title The title to be output.
2304
+				 * @param string $cpt_singular_name The singular title of the curent CPT.
2305
+				 * @param string $listing_type The CPT being requested. ie: gd_place.
2306
+				 */
2307
+				echo apply_filters('geodir_add_listing_description_label',sprintf( __('%s Description', 'geodirectory'), $cpt_singular_name ),$cpt_singular_name,$listing_type); ?><span><?php if ($desc_limit != '0') { echo '*'; } ?></span> </label>
2308 2308
             <?php
2309
-            if ($show_editor) {
2310
-                $editor_settings = array('media_buttons' => false, 'textarea_rows' => 10);
2311
-            ?>
2309
+			if ($show_editor) {
2310
+				$editor_settings = array('media_buttons' => false, 'textarea_rows' => 10);
2311
+			?>
2312 2312
                 <div class="editor" field_id="post_desc" field_type="editor">
2313 2313
                     <?php wp_editor($desc, "post_desc", $editor_settings); ?>
2314 2314
                 </div>
@@ -2322,56 +2322,56 @@  discard block
 block discarded – undo
2322 2322
             <span class="geodir_message_error"><?php echo _e($required_msg, 'geodirectory');?></span>
2323 2323
         </div>
2324 2324
         <?php
2325
-        if ($desc_limit === '' || (int)$desc_limit > 0) {
2326
-            /**
2327
-             * Called on the add listing page form for frontend just after the description field.
2328
-             *
2329
-             * @since 1.0.0
2330
-             */
2331
-            do_action('geodir_after_description_field');
2332
-        }
2325
+		if ($desc_limit === '' || (int)$desc_limit > 0) {
2326
+			/**
2327
+			 * Called on the add listing page form for frontend just after the description field.
2328
+			 *
2329
+			 * @since 1.0.0
2330
+			 */
2331
+			do_action('geodir_after_description_field');
2332
+		}
2333 2333
         
2334
-        $kw_tags = esc_attr(stripslashes($kw_tags));
2335
-        $kw_tags_count = TAGKW_TEXT_COUNT;
2336
-        $kw_tags_msg = TAGKW_MSG;
2337
-        /**
2338
-         * Filter the add listing tags character limit.
2339
-         *
2340
-         * @since 1.0.0
2341
-         * @param int $kw_tags_count The character count limit if any.
2342
-         */
2343
-        $kw_tags_count = apply_filters('geodir_listing_tags_field_tags_count', $kw_tags_count);
2344
-        /**
2345
-         * Filter the add listing tags field value.
2346
-         *
2347
-         * You can use the $_REQUEST values to check if this is a go back and edit value etc.
2348
-         *
2349
-         * @since 1.0.0
2350
-         * @param string $kw_tags The tag field value, usually a comma separated list of tags.
2351
-         * @param int $kw_tags_count The character count limit if any.
2352
-         */
2353
-        $kw_tags = apply_filters('geodir_listing_tags_field_tags', $kw_tags, $kw_tags_count);
2354
-        /**
2355
-         * Filter the add listing tags field message text.
2356
-         *
2357
-         * @since 1.0.0
2358
-         * @param string $kw_tags_msg The message shown under the field.
2359
-         * @param int $kw_tags_count The character count limit if any.
2360
-         */
2361
-        $kw_tags_msg = apply_filters('geodir_listing_tags_field_tags_msg', $kw_tags_msg, $kw_tags_count);
2334
+		$kw_tags = esc_attr(stripslashes($kw_tags));
2335
+		$kw_tags_count = TAGKW_TEXT_COUNT;
2336
+		$kw_tags_msg = TAGKW_MSG;
2337
+		/**
2338
+		 * Filter the add listing tags character limit.
2339
+		 *
2340
+		 * @since 1.0.0
2341
+		 * @param int $kw_tags_count The character count limit if any.
2342
+		 */
2343
+		$kw_tags_count = apply_filters('geodir_listing_tags_field_tags_count', $kw_tags_count);
2344
+		/**
2345
+		 * Filter the add listing tags field value.
2346
+		 *
2347
+		 * You can use the $_REQUEST values to check if this is a go back and edit value etc.
2348
+		 *
2349
+		 * @since 1.0.0
2350
+		 * @param string $kw_tags The tag field value, usually a comma separated list of tags.
2351
+		 * @param int $kw_tags_count The character count limit if any.
2352
+		 */
2353
+		$kw_tags = apply_filters('geodir_listing_tags_field_tags', $kw_tags, $kw_tags_count);
2354
+		/**
2355
+		 * Filter the add listing tags field message text.
2356
+		 *
2357
+		 * @since 1.0.0
2358
+		 * @param string $kw_tags_msg The message shown under the field.
2359
+		 * @param int $kw_tags_count The character count limit if any.
2360
+		 */
2361
+		$kw_tags_msg = apply_filters('geodir_listing_tags_field_tags_msg', $kw_tags_msg, $kw_tags_count);
2362 2362
         
2363
-        $tags_class = '';
2364
-        if ($kw_tags_count === '' || (int)$kw_tags_count > 0) {
2365
-            /**
2366
-             * Called on the add listing page form for frontend just before the tags field.
2367
-             *
2368
-             * @since 1.0.0
2369
-             */
2370
-            do_action('geodir_before_listing_tags_field');
2371
-        } else {
2372
-            $tags_class = ' hidden';
2373
-        }
2374
-        ?>
2363
+		$tags_class = '';
2364
+		if ($kw_tags_count === '' || (int)$kw_tags_count > 0) {
2365
+			/**
2366
+			 * Called on the add listing page form for frontend just before the tags field.
2367
+			 *
2368
+			 * @since 1.0.0
2369
+			 */
2370
+			do_action('geodir_before_listing_tags_field');
2371
+		} else {
2372
+			$tags_class = ' hidden';
2373
+		}
2374
+		?>
2375 2375
         <div id="geodir_post_tags_row" class="geodir_form_row clearfix gd-fieldset-details<?php echo $tags_class;?>">
2376 2376
             <label><?php echo TAGKW_TEXT; ?></label>
2377 2377
             <input name="post_tags" id="post_tags" value="<?php echo $kw_tags; ?>" type="text" class="geodir_textfield"
@@ -2379,90 +2379,90 @@  discard block
 block discarded – undo
2379 2379
             <span class="geodir_message_note"><?php echo $kw_tags_msg;?></span>
2380 2380
         </div>
2381 2381
         <?php
2382
-        if ($kw_tags_count === '' || (int)$kw_tags_count > 0) {
2383
-            /**
2384
-             * Called on the add listing page form for frontend just after the tags field.
2385
-             *
2386
-             * @since 1.0.0
2387
-             */
2388
-            do_action('geodir_after_listing_tags_field');
2389
-        }
2382
+		if ($kw_tags_count === '' || (int)$kw_tags_count > 0) {
2383
+			/**
2384
+			 * Called on the add listing page form for frontend just after the tags field.
2385
+			 *
2386
+			 * @since 1.0.0
2387
+			 */
2388
+			do_action('geodir_after_listing_tags_field');
2389
+		}
2390 2390
         
2391
-        $package_info = array();
2392
-        $package_info = geodir_post_package_info($package_info, $post);
2391
+		$package_info = array();
2392
+		$package_info = geodir_post_package_info($package_info, $post);
2393 2393
         
2394
-        geodir_get_custom_fields_html($package_info->pid, 'all', $listing_type);
2394
+		geodir_get_custom_fields_html($package_info->pid, 'all', $listing_type);
2395 2395
         
2396
-        // adjust values here
2397
-        $id = "post_images"; // this will be the name of form field. Image url(s) will be submitted in $_POST using this key. So if $id == �img1� then $_POST[�img1�] will have all the image urls
2396
+		// adjust values here
2397
+		$id = "post_images"; // this will be the name of form field. Image url(s) will be submitted in $_POST using this key. So if $id == �img1� then $_POST[�img1�] will have all the image urls
2398 2398
 
2399
-        $multiple = true; // allow multiple files upload
2399
+		$multiple = true; // allow multiple files upload
2400 2400
 
2401
-        $width = geodir_media_image_large_width(); // If you want to automatically resize all uploaded images then provide width here (in pixels)
2401
+		$width = geodir_media_image_large_width(); // If you want to automatically resize all uploaded images then provide width here (in pixels)
2402 2402
 
2403
-        $height = geodir_media_image_large_height(); // If you want to automatically resize all uploaded images then provide height here (in pixels)
2403
+		$height = geodir_media_image_large_height(); // If you want to automatically resize all uploaded images then provide height here (in pixels)
2404 2404
 
2405
-        $thumb_img_arr = array();
2406
-        $totImg = 0;
2407
-        if (isset($_REQUEST['backandedit']) && empty($_REQUEST['pid'])) {
2408
-            $post = (object)$gd_session->get('listing');
2409
-            if (isset($post->post_images))
2410
-                $curImages = trim($post->post_images, ",");
2405
+		$thumb_img_arr = array();
2406
+		$totImg = 0;
2407
+		if (isset($_REQUEST['backandedit']) && empty($_REQUEST['pid'])) {
2408
+			$post = (object)$gd_session->get('listing');
2409
+			if (isset($post->post_images))
2410
+				$curImages = trim($post->post_images, ",");
2411 2411
 
2412 2412
 
2413
-            if ($curImages != '') {
2414
-                $curImages_array = explode(',', $curImages);
2415
-                $totImg = count($curImages_array);
2416
-            }
2413
+			if ($curImages != '') {
2414
+				$curImages_array = explode(',', $curImages);
2415
+				$totImg = count($curImages_array);
2416
+			}
2417 2417
 
2418
-            $listing_type = $post->listing_type;
2418
+			$listing_type = $post->listing_type;
2419 2419
 
2420
-        } elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
2421
-            $post = geodir_get_post_info((int)$_REQUEST['pid']);
2422
-            $listing_type = $post->post_type;
2423
-            $thumb_img_arr = geodir_get_images($_REQUEST['pid']);
2420
+		} elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
2421
+			$post = geodir_get_post_info((int)$_REQUEST['pid']);
2422
+			$listing_type = $post->post_type;
2423
+			$thumb_img_arr = geodir_get_images($_REQUEST['pid']);
2424 2424
 
2425
-        } else {
2426
-            $listing_type = sanitize_text_field($_REQUEST['listing_type']);
2427
-        }
2425
+		} else {
2426
+			$listing_type = sanitize_text_field($_REQUEST['listing_type']);
2427
+		}
2428 2428
 
2429 2429
 
2430
-        if (!empty($thumb_img_arr)) {
2431
-            foreach ($thumb_img_arr as $img) {
2432
-                //$curImages = $img->src.",";
2433
-            }
2434
-
2435
-            $totImg = count((array)$thumb_img_arr);
2436
-        }
2430
+		if (!empty($thumb_img_arr)) {
2431
+			foreach ($thumb_img_arr as $img) {
2432
+				//$curImages = $img->src.",";
2433
+			}
2437 2434
 
2438
-        if ($curImages != '')
2439
-            $svalue = $curImages; // this will be initial value of the above form field. Image urls.
2440
-        else
2441
-            $svalue = '';
2442
-
2443
-        $image_limit = isset($package_info->image_limit) ? $package_info->image_limit : '0';
2444
-        $show_image_input_box = ($image_limit != '0');
2445
-        /**
2446
-         * Filter to be able to show/hide the image upload section of the add listing form.
2447
-         *
2448
-         * @since 1.0.0
2449
-         * @param bool $show_image_input_box Set true to show. Set false to not show.
2450
-         * @param string $listing_type The custom post type slug.
2451
-         */
2452
-        $show_image_input_box = apply_filters('geodir_image_uploader_on_add_listing', $show_image_input_box, $listing_type);
2453
-        if ($show_image_input_box) {
2454
-            ?>
2435
+			$totImg = count((array)$thumb_img_arr);
2436
+		}
2437
+
2438
+		if ($curImages != '')
2439
+			$svalue = $curImages; // this will be initial value of the above form field. Image urls.
2440
+		else
2441
+			$svalue = '';
2442
+
2443
+		$image_limit = isset($package_info->image_limit) ? $package_info->image_limit : '0';
2444
+		$show_image_input_box = ($image_limit != '0');
2445
+		/**
2446
+		 * Filter to be able to show/hide the image upload section of the add listing form.
2447
+		 *
2448
+		 * @since 1.0.0
2449
+		 * @param bool $show_image_input_box Set true to show. Set false to not show.
2450
+		 * @param string $listing_type The custom post type slug.
2451
+		 */
2452
+		$show_image_input_box = apply_filters('geodir_image_uploader_on_add_listing', $show_image_input_box, $listing_type);
2453
+		if ($show_image_input_box) {
2454
+			?>
2455 2455
 
2456 2456
             <h5 id="geodir_form_title_row" class="geodir-form_title"> <?php echo PRO_PHOTO_TEXT;?>
2457 2457
                 <?php if ($image_limit == 1) {
2458
-                    echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('image with this package', 'geodirectory') . ')</small>';
2459
-                } ?>
2458
+					echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('image with this package', 'geodirectory') . ')</small>';
2459
+				} ?>
2460 2460
                 <?php if ($image_limit > 1) {
2461
-                    echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('images with this package', 'geodirectory') . ')</small>';
2462
-                } ?>
2461
+					echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('images with this package', 'geodirectory') . ')</small>';
2462
+				} ?>
2463 2463
                 <?php if ($image_limit == '') {
2464
-                    echo '<br /><small>(' . __('You can upload unlimited images with this package', 'geodirectory') . ')</small>';
2465
-                } ?>
2464
+					echo '<br /><small>(' . __('You can upload unlimited images with this package', 'geodirectory') . ')</small>';
2465
+				} ?>
2466 2466
             </h5>
2467 2467
 
2468 2468
             <div class="geodir_form_row clearfix" id="<?php echo $id; ?>dropbox"
@@ -2500,12 +2500,12 @@  discard block
 block discarded – undo
2500 2500
         <?php } ?>
2501 2501
 
2502 2502
         <?php
2503
-        /**
2504
-         * Called on the add listing page form for frontend just after the image upload field.
2505
-         *
2506
-         * @since 1.0.0
2507
-         */
2508
-        do_action('geodir_after_main_form_fields');?>
2503
+		/**
2504
+		 * Called on the add listing page form for frontend just after the image upload field.
2505
+		 *
2506
+		 * @since 1.0.0
2507
+		 */
2508
+		do_action('geodir_after_main_form_fields');?>
2509 2509
 
2510 2510
 
2511 2511
         <!-- add captcha code -->
@@ -2534,7 +2534,7 @@  discard block
 block discarded – undo
2534 2534
 
2535 2535
     </form>
2536 2536
     <?php
2537
-    wp_reset_query();
2537
+	wp_reset_query();
2538 2538
 }
2539 2539
 
2540 2540
 /**
@@ -2545,7 +2545,7 @@  discard block
 block discarded – undo
2545 2545
  */
2546 2546
 function geodir_add_listing_sidebar_widget_area()
2547 2547
 {
2548
-    dynamic_sidebar('geodir_add_listing_sidebar');
2548
+	dynamic_sidebar('geodir_add_listing_sidebar');
2549 2549
 }
2550 2550
 
2551 2551
 add_action('geodir_add_listing_sidebar_inside', 'geodir_add_listing_sidebar_widget_area', 10);
@@ -2560,16 +2560,16 @@  discard block
 block discarded – undo
2560 2560
  */
2561 2561
 function geodir_action_add_listing_sidebar()
2562 2562
 {
2563
-    /** This action is documented in geodirectory_template_actions.php */
2564
-    do_action('geodir_sidebar_right_open', 'add-listing-page', 'geodir-sidebar', 'geodir-sidebar-right', 'http://schema.org/WPSideBar');
2565
-    /**
2566
-     * This is used to add the content to the add listing page sidebar.
2567
-     *
2568
-     * @since 1.0.0
2569
-     */
2570
-    do_action('geodir_add_listing_sidebar_inside');
2571
-    /** This action is documented in geodirectory_template_actions.php */
2572
-    do_action('geodir_sidebar_right_close', 'details-page');
2563
+	/** This action is documented in geodirectory_template_actions.php */
2564
+	do_action('geodir_sidebar_right_open', 'add-listing-page', 'geodir-sidebar', 'geodir-sidebar-right', 'http://schema.org/WPSideBar');
2565
+	/**
2566
+	 * This is used to add the content to the add listing page sidebar.
2567
+	 *
2568
+	 * @since 1.0.0
2569
+	 */
2570
+	do_action('geodir_add_listing_sidebar_inside');
2571
+	/** This action is documented in geodirectory_template_actions.php */
2572
+	do_action('geodir_sidebar_right_close', 'details-page');
2573 2573
 }
2574 2574
 
2575 2575
 ###############################################
@@ -2586,11 +2586,11 @@  discard block
 block discarded – undo
2586 2586
  */
2587 2587
 function geodir_action_geodir_sidebar_signup_top()
2588 2588
 {
2589
-    ?>
2589
+	?>
2590 2590
     <div
2591 2591
         class="<?php
2592
-        /** This action is documented in geodirectory_template_actions.php */
2593
-        echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'Reg/Login Top Section'); ?>">
2592
+		/** This action is documented in geodirectory_template_actions.php */
2593
+		echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'Reg/Login Top Section'); ?>">
2594 2594
         <?php dynamic_sidebar('Reg/Login Top Section');?>
2595 2595
     </div><!-- clearfix ends here-->
2596 2596
 <?php
@@ -2609,11 +2609,11 @@  discard block
 block discarded – undo
2609 2609
 function geodir_action_signup_forms()
2610 2610
 {
2611 2611
 
2612
-    global $user_login;
2612
+	global $user_login;
2613 2613
     
2614
-    $is_enable_signup = get_option( 'users_can_register' );
2614
+	$is_enable_signup = get_option( 'users_can_register' );
2615 2615
     
2616
-    ?>
2616
+	?>
2617 2617
     <script type="text/javascript">
2618 2618
         <?php if ( $user_login ) { ?>
2619 2619
         setTimeout(function () {
@@ -2649,67 +2649,67 @@  discard block
 block discarded – undo
2649 2649
         <?php } ?>
2650 2650
     </script><?php
2651 2651
 
2652
-    global $errors;
2653
-    if (isset($_REQUEST['msg']) && $_REQUEST['msg'] == 'claim')
2654
-        $errors->add('claim_login', LOGIN_CLAIM);
2655
-
2656
-    if (!empty($errors)) {
2657
-        foreach ($errors as $errorsObj) {
2658
-            foreach ($errorsObj as $key => $val) {
2659
-                for ($i = 0; $i < count($val); $i++) {
2660
-                    echo "<div class=error_msg_fix>" . $val[$i] . '</div>';
2661
-                    $registration_error_msg = 1;
2662
-                }
2663
-            }
2664
-        }
2665
-    }
2652
+	global $errors;
2653
+	if (isset($_REQUEST['msg']) && $_REQUEST['msg'] == 'claim')
2654
+		$errors->add('claim_login', LOGIN_CLAIM);
2655
+
2656
+	if (!empty($errors)) {
2657
+		foreach ($errors as $errorsObj) {
2658
+			foreach ($errorsObj as $key => $val) {
2659
+				for ($i = 0; $i < count($val); $i++) {
2660
+					echo "<div class=error_msg_fix>" . $val[$i] . '</div>';
2661
+					$registration_error_msg = 1;
2662
+				}
2663
+			}
2664
+		}
2665
+	}
2666 2666
 
2667
-    if (isset($_REQUEST['page']) && $_REQUEST['page'] == 'login' && isset($_REQUEST['page1']) && $_REQUEST['page1'] == 'sign_in') {
2668
-        ?>
2667
+	if (isset($_REQUEST['page']) && $_REQUEST['page'] == 'login' && isset($_REQUEST['page1']) && $_REQUEST['page1'] == 'sign_in') {
2668
+		?>
2669 2669
 
2670 2670
         <div class="login_form">
2671 2671
             <?php
2672
-            /**
2673
-             * Contains login form template.
2674
-             *
2675
-             * @since 1.0.0
2676
-             */
2677
-            include(geodir_plugin_path() . "/geodirectory-templates/login_frm.php"); ?>
2672
+			/**
2673
+			 * Contains login form template.
2674
+			 *
2675
+			 * @since 1.0.0
2676
+			 */
2677
+			include(geodir_plugin_path() . "/geodirectory-templates/login_frm.php"); ?>
2678 2678
         </div>
2679 2679
 
2680 2680
     <?php } elseif (isset($_REQUEST['page']) && $_REQUEST['page'] == 'login' && isset($_REQUEST['page1']) && $_REQUEST['page1'] == 'sign_up' && $is_enable_signup ) { ?>
2681 2681
 
2682 2682
         <div class="registration_form">
2683 2683
             <?php
2684
-            /**
2685
-             * Contains registration form template.
2686
-             *
2687
-             * @since 1.0.0
2688
-             */
2689
-            include(geodir_plugin_path() . "/geodirectory-templates/reg_frm.php"); ?>
2684
+			/**
2685
+			 * Contains registration form template.
2686
+			 *
2687
+			 * @since 1.0.0
2688
+			 */
2689
+			include(geodir_plugin_path() . "/geodirectory-templates/reg_frm.php"); ?>
2690 2690
         </div>
2691 2691
 
2692 2692
     <?php } else { ?>
2693 2693
 
2694 2694
         <div class="login_form_l">
2695 2695
             <?php
2696
-            /**
2697
-             * Contains login form template.
2698
-             *
2699
-             * @since 1.0.0
2700
-             */
2701
-            include(geodir_plugin_path() . "/geodirectory-templates/login_frm.php"); ?>
2696
+			/**
2697
+			 * Contains login form template.
2698
+			 *
2699
+			 * @since 1.0.0
2700
+			 */
2701
+			include(geodir_plugin_path() . "/geodirectory-templates/login_frm.php"); ?>
2702 2702
         </div>
2703 2703
         
2704 2704
         <?php if ( $is_enable_signup ) { ?>
2705 2705
             <div class="registration_form_r">
2706 2706
                 <?php
2707
-                /**
2708
-                 * Contains registration form template.
2709
-                 *
2710
-                 * @since 1.0.0
2711
-                 */
2712
-                include(geodir_plugin_path() . "/geodirectory-templates/reg_frm.php"); ?>
2707
+				/**
2708
+				 * Contains registration form template.
2709
+				 *
2710
+				 * @since 1.0.0
2711
+				 */
2712
+				include(geodir_plugin_path() . "/geodirectory-templates/reg_frm.php"); ?>
2713 2713
             </div>
2714 2714
         <?php } ?>
2715 2715
 
@@ -2741,66 +2741,66 @@  discard block
 block discarded – undo
2741 2741
  */
2742 2742
 function geodir_action_author_page_title()
2743 2743
 {
2744
-    global $term;
2744
+	global $term;
2745 2745
 
2746
-    $gd_post_type = geodir_get_current_posttype();
2747
-    $post_type_info = get_post_type_object($gd_post_type);
2746
+	$gd_post_type = geodir_get_current_posttype();
2747
+	$post_type_info = get_post_type_object($gd_post_type);
2748 2748
 
2749
-    $add_string_in_title = __('All', 'geodirectory') . ' ';
2750
-    if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite') {
2751
-        $add_string_in_title = __('My Favorite', 'geodirectory') . ' ';
2752
-    }
2749
+	$add_string_in_title = __('All', 'geodirectory') . ' ';
2750
+	if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite') {
2751
+		$add_string_in_title = __('My Favorite', 'geodirectory') . ' ';
2752
+	}
2753 2753
 
2754
-    $list_title = $add_string_in_title . $post_type_info->labels->name;
2755
-    $single_name = $post_type_info->labels->singular_name;
2754
+	$list_title = $add_string_in_title . $post_type_info->labels->name;
2755
+	$single_name = $post_type_info->labels->singular_name;
2756 2756
 
2757
-    $taxonomy = geodir_get_taxonomies($gd_post_type);
2757
+	$taxonomy = geodir_get_taxonomies($gd_post_type);
2758 2758
 
2759
-    if (!empty($term)) {
2760
-        $current_term = get_term_by('slug', $term, $taxonomy[0]);
2761
-        if (!empty($current_term))
2762
-            $list_title .= __(' in', 'geodirectory') . " '" . geodir_ucwords($current_term->name) . "'";
2763
-    }
2759
+	if (!empty($term)) {
2760
+		$current_term = get_term_by('slug', $term, $taxonomy[0]);
2761
+		if (!empty($current_term))
2762
+			$list_title .= __(' in', 'geodirectory') . " '" . geodir_ucwords($current_term->name) . "'";
2763
+	}
2764 2764
 
2765 2765
 
2766
-    if (is_search()) {
2767
-        $list_title = __('Search', 'geodirectory') . ' ' . __($post_type_info->labels->name, 'geodirectory') . __(' For :', 'geodirectory') . " '" . get_search_query() . "'";
2766
+	if (is_search()) {
2767
+		$list_title = __('Search', 'geodirectory') . ' ' . __($post_type_info->labels->name, 'geodirectory') . __(' For :', 'geodirectory') . " '" . get_search_query() . "'";
2768 2768
 
2769
-    }
2770
-    /** This action is documented in geodirectory_template_actions.php */
2771
-    $class = apply_filters('geodir_page_title_class', 'entry-title fn');
2772
-    /** This action is documented in geodirectory_template_actions.php */
2773
-    $class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
2769
+	}
2770
+	/** This action is documented in geodirectory_template_actions.php */
2771
+	$class = apply_filters('geodir_page_title_class', 'entry-title fn');
2772
+	/** This action is documented in geodirectory_template_actions.php */
2773
+	$class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
2774 2774
 
2775
-    $title = $list_title;
2776
-    if(geodir_is_page('author')){
2777
-        $gd_page = 'author';
2778
-        if(isset($_REQUEST['list']) && $_REQUEST['list']=='favourite'){
2779
-            $title = (get_option('geodir_page_title_favorite')) ? get_option('geodir_page_title_favorite') : $title;
2780
-        }else{
2781
-            $title = (get_option('geodir_page_title_author')) ? get_option('geodir_page_title_author') : $title;
2782
-        }
2775
+	$title = $list_title;
2776
+	if(geodir_is_page('author')){
2777
+		$gd_page = 'author';
2778
+		if(isset($_REQUEST['list']) && $_REQUEST['list']=='favourite'){
2779
+			$title = (get_option('geodir_page_title_favorite')) ? get_option('geodir_page_title_favorite') : $title;
2780
+		}else{
2781
+			$title = (get_option('geodir_page_title_author')) ? get_option('geodir_page_title_author') : $title;
2782
+		}
2783 2783
 
2784
-    }
2784
+	}
2785 2785
 
2786 2786
 
2787
-    /**
2788
-     * Filter page title to replace variables.
2789
-     *
2790
-     * @since 1.5.4
2791
-     * @param string $title The page title including variables.
2792
-     * @param string $gd_page The GeoDirectory page type if any.
2793
-     */
2794
-    $title =  apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
2787
+	/**
2788
+	 * Filter page title to replace variables.
2789
+	 *
2790
+	 * @since 1.5.4
2791
+	 * @param string $title The page title including variables.
2792
+	 * @param string $gd_page The GeoDirectory page type if any.
2793
+	 */
2794
+	$title =  apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
2795 2795
 
2796
-    echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' .
2797
-        /**
2798
-         * Filter the author page title text.
2799
-         *
2800
-         * @since 1.0.0
2801
-         * @param string $list_title The title for the page.
2802
-         */
2803
-        apply_filters('geodir_author_page_title_text', $title) . '</h1></header>';
2796
+	echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' .
2797
+		/**
2798
+		 * Filter the author page title text.
2799
+		 *
2800
+		 * @since 1.0.0
2801
+		 * @param string $list_title The title for the page.
2802
+		 */
2803
+		apply_filters('geodir_author_page_title_text', $title) . '</h1></header>';
2804 2804
 }
2805 2805
 
2806 2806
 
@@ -2818,11 +2818,11 @@  discard block
 block discarded – undo
2818 2818
  */
2819 2819
 function geodir_action_geodir_sidebar_author_top()
2820 2820
 {
2821
-    if (get_option('geodir_show_author_top_section')) { ?>
2821
+	if (get_option('geodir_show_author_top_section')) { ?>
2822 2822
         <div
2823 2823
             class="<?php
2824
-            /** This action is documented in geodirectory_template_actions.php */
2825
-            echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_author_top'); ?>">
2824
+			/** This action is documented in geodirectory_template_actions.php */
2825
+			echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_author_top'); ?>">
2826 2826
             <?php dynamic_sidebar('geodir_author_top'); ?>
2827 2827
         </div><!-- clearfix ends here-->
2828 2828
     <?php }
@@ -2838,7 +2838,7 @@  discard block
 block discarded – undo
2838 2838
  */
2839 2839
 function geodir_author_left_section()
2840 2840
 {
2841
-    if (get_option('geodir_show_author_left_section')) { ?>
2841
+	if (get_option('geodir_show_author_left_section')) { ?>
2842 2842
         <div class="geodir-content-left geodir-sidebar-wrap">
2843 2843
             <?php dynamic_sidebar('geodir_author_left_sidebar'); ?>
2844 2844
         </div><!-- end geodir-content-left -->
@@ -2859,19 +2859,19 @@  discard block
 block discarded – undo
2859 2859
  */
2860 2860
 function geodir_action_author_sidebar_left()
2861 2861
 {
2862
-    if (get_option('geodir_show_author_left_section')) {
2862
+	if (get_option('geodir_show_author_left_section')) {
2863 2863
 // this adds the opening html tags to the primary div, this required the closing tag below :: ($type='',$id='',$class='',$itemtype='')
2864
-        /** This action is documented in geodirectory_template_actions.php */
2865
-        do_action('geodir_sidebar_left_open', 'author-page', 'geodir-sidebar-left', 'geodir-sidebar-left geodir-listings-sidebar-left', 'http://schema.org/WPSideBar');
2866
-        /**
2867
-         * This is used to add the content to the author page left sidebar (if active).
2868
-         *
2869
-         * @since 1.0.0
2870
-         */
2871
-        do_action('geodir_author_sidebar_left_inside');
2872
-        /** This action is documented in geodirectory_template_actions.php */
2873
-        do_action('geodir_sidebar_left_close', 'author-page');
2874
-    }
2864
+		/** This action is documented in geodirectory_template_actions.php */
2865
+		do_action('geodir_sidebar_left_open', 'author-page', 'geodir-sidebar-left', 'geodir-sidebar-left geodir-listings-sidebar-left', 'http://schema.org/WPSideBar');
2866
+		/**
2867
+		 * This is used to add the content to the author page left sidebar (if active).
2868
+		 *
2869
+		 * @since 1.0.0
2870
+		 */
2871
+		do_action('geodir_author_sidebar_left_inside');
2872
+		/** This action is documented in geodirectory_template_actions.php */
2873
+		do_action('geodir_sidebar_left_close', 'author-page');
2874
+	}
2875 2875
 }
2876 2876
 
2877 2877
 /**
@@ -2884,7 +2884,7 @@  discard block
 block discarded – undo
2884 2884
  */
2885 2885
 function geodir_author_right_section()
2886 2886
 {
2887
-    if (get_option('geodir_show_author_right_section')) { ?>
2887
+	if (get_option('geodir_show_author_right_section')) { ?>
2888 2888
         <div class="geodir-content-right geodir-sidebar-wrap">
2889 2889
             <?php dynamic_sidebar('geodir_author_right_sidebar'); ?>
2890 2890
         </div><!-- end geodir-content-right -->
@@ -2904,18 +2904,18 @@  discard block
 block discarded – undo
2904 2904
  */
2905 2905
 function geodir_action_author_sidebar_right()
2906 2906
 {
2907
-    if (get_option('geodir_show_author_right_section')) {
2908
-        /** This action is documented in geodirectory_template_actions.php */
2909
-        do_action('geodir_sidebar_right_open', 'author-page', 'geodir-sidebar-right', 'geodir-sidebar-right geodir-listings-sidebar-right', 'http://schema.org/WPSideBar');
2910
-        /**
2911
-         * This is used to add the content to the author page right sidebar (if active).
2912
-         *
2913
-         * @since 1.0.0
2914
-         */
2915
-        do_action('geodir_author_sidebar_right_inside');
2916
-        /** This action is documented in geodirectory_template_actions.php */
2917
-        do_action('geodir_sidebar_right_close', 'author-page');
2918
-    }
2907
+	if (get_option('geodir_show_author_right_section')) {
2908
+		/** This action is documented in geodirectory_template_actions.php */
2909
+		do_action('geodir_sidebar_right_open', 'author-page', 'geodir-sidebar-right', 'geodir-sidebar-right geodir-listings-sidebar-right', 'http://schema.org/WPSideBar');
2910
+		/**
2911
+		 * This is used to add the content to the author page right sidebar (if active).
2912
+		 *
2913
+		 * @since 1.0.0
2914
+		 */
2915
+		do_action('geodir_author_sidebar_right_inside');
2916
+		/** This action is documented in geodirectory_template_actions.php */
2917
+		do_action('geodir_sidebar_right_close', 'author-page');
2918
+	}
2919 2919
 }
2920 2920
 
2921 2921
 /**
@@ -2927,14 +2927,14 @@  discard block
 block discarded – undo
2927 2927
  */
2928 2928
 function geodir_action_author_content_inside()
2929 2929
 {
2930
-    global $gridview_columns;
2931
-    $listing_view = get_option('geodir_author_view');
2932
-    if (strstr($listing_view, 'gridview')) {
2933
-        $gridview_columns = $listing_view;
2934
-        $listing_view_exp = explode('_', $listing_view);
2935
-        $listing_view = $listing_view_exp[0];
2936
-    }
2937
-    geodir_get_template_part('listing', 'listview');
2930
+	global $gridview_columns;
2931
+	$listing_view = get_option('geodir_author_view');
2932
+	if (strstr($listing_view, 'gridview')) {
2933
+		$gridview_columns = $listing_view;
2934
+		$listing_view_exp = explode('_', $listing_view);
2935
+		$listing_view = $listing_view_exp[0];
2936
+	}
2937
+	geodir_get_template_part('listing', 'listview');
2938 2938
 }
2939 2939
 
2940 2940
 add_action('geodir_author_content_inside', 'geodir_action_author_content_inside', 10);
@@ -2949,22 +2949,22 @@  discard block
 block discarded – undo
2949 2949
  */
2950 2950
 function geodir_action_author_content()
2951 2951
 {
2952
-    /** This action is documented in geodirectory_template_actions.php */
2953
-    do_action('geodir_main_content_open', 'author-page', 'geodir-main-content', 'author-page');
2954
-    echo '<div class="clearfix">';
2955
-    /** This action is documented in geodirectory_template_actions.php */
2956
-    do_action('geodir_before_listing');
2957
-    echo '</div>';
2958
-    /**
2959
-     * This is used to add the content to the author page main content.
2960
-     *
2961
-     * @since 1.0.0
2962
-     */
2963
-    do_action('geodir_author_content_inside');
2964
-    /** This action is documented in geodirectory_template_actions.php */
2965
-    do_action('geodir_after_listing');
2966
-    /** This action is documented in geodirectory_template_actions.php */
2967
-    do_action('geodir_main_content_close', 'author-page');
2952
+	/** This action is documented in geodirectory_template_actions.php */
2953
+	do_action('geodir_main_content_open', 'author-page', 'geodir-main-content', 'author-page');
2954
+	echo '<div class="clearfix">';
2955
+	/** This action is documented in geodirectory_template_actions.php */
2956
+	do_action('geodir_before_listing');
2957
+	echo '</div>';
2958
+	/**
2959
+	 * This is used to add the content to the author page main content.
2960
+	 *
2961
+	 * @since 1.0.0
2962
+	 */
2963
+	do_action('geodir_author_content_inside');
2964
+	/** This action is documented in geodirectory_template_actions.php */
2965
+	do_action('geodir_after_listing');
2966
+	/** This action is documented in geodirectory_template_actions.php */
2967
+	do_action('geodir_main_content_close', 'author-page');
2968 2968
 }
2969 2969
 
2970 2970
 add_action('geodir_sidebar_author_bottom_section', 'geodir_action_sidebar_author_bottom_section', 10);
@@ -2978,11 +2978,11 @@  discard block
 block discarded – undo
2978 2978
  */
2979 2979
 function geodir_action_sidebar_author_bottom_section()
2980 2980
 {
2981
-    if (get_option('geodir_show_author_bottom_section')) { ?>
2981
+	if (get_option('geodir_show_author_bottom_section')) { ?>
2982 2982
         <div
2983 2983
             class="<?php
2984
-            /** This action is documented in geodirectory_template_actions.php */
2985
-            echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_author_bottom'); ?>">
2984
+			/** This action is documented in geodirectory_template_actions.php */
2985
+			echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_author_bottom'); ?>">
2986 2986
             <?php dynamic_sidebar('geodir_author_bottom'); ?>
2987 2987
         </div><!-- clearfix ends here-->
2988 2988
     <?php }
@@ -3001,23 +3001,23 @@  discard block
 block discarded – undo
3001 3001
  */
3002 3002
 function geodir_action_search_page_title()
3003 3003
 {
3004
-    $gd_post_type = geodir_get_current_posttype();
3005
-    $post_type_info = get_post_type_object($gd_post_type);
3004
+	$gd_post_type = geodir_get_current_posttype();
3005
+	$post_type_info = get_post_type_object($gd_post_type);
3006 3006
 
3007
-    $pt_name = '';
3008
-    if(isset($post_type_info->labels->name)){$pt_name=$post_type_info->labels->name;}
3007
+	$pt_name = '';
3008
+	if(isset($post_type_info->labels->name)){$pt_name=$post_type_info->labels->name;}
3009 3009
 
3010
-    if (is_search()) {
3011
-        $list_title = __('Search', 'geodirectory') . ' ' . __($pt_name, 'geodirectory') . __(' For :', 'geodirectory') . " '" . get_search_query() . "'";
3010
+	if (is_search()) {
3011
+		$list_title = __('Search', 'geodirectory') . ' ' . __($pt_name, 'geodirectory') . __(' For :', 'geodirectory') . " '" . get_search_query() . "'";
3012 3012
 
3013
-    }
3014
-    /** This action is documented in geodirectory_template_actions.php */
3015
-    $class = apply_filters('geodir_page_title_class', 'entry-title fn');
3016
-    /** This action is documented in geodirectory_template_actions.php */
3017
-    $class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
3018
-    echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' .
3019
-        /** This action is documented in geodirectory_template_actions.php */
3020
-        apply_filters('geodir_listing_page_title', wptexturize($list_title)) . '</h1></header>';
3013
+	}
3014
+	/** This action is documented in geodirectory_template_actions.php */
3015
+	$class = apply_filters('geodir_page_title_class', 'entry-title fn');
3016
+	/** This action is documented in geodirectory_template_actions.php */
3017
+	$class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
3018
+	echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' .
3019
+		/** This action is documented in geodirectory_template_actions.php */
3020
+		apply_filters('geodir_listing_page_title', wptexturize($list_title)) . '</h1></header>';
3021 3021
 }
3022 3022
 
3023 3023
 // action for adding the listings page top widget area
@@ -3033,11 +3033,11 @@  discard block
 block discarded – undo
3033 3033
  */
3034 3034
 function geodir_action_geodir_sidebar_search_top()
3035 3035
 {
3036
-    if (get_option('geodir_show_search_top_section')) { ?>
3036
+	if (get_option('geodir_show_search_top_section')) { ?>
3037 3037
         <div
3038 3038
             class="<?php
3039
-            /** This action is documented in geodirectory_template_actions.php */
3040
-            echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_search_top'); ?>">
3039
+			/** This action is documented in geodirectory_template_actions.php */
3040
+			echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_search_top'); ?>">
3041 3041
             <?php dynamic_sidebar('geodir_search_top'); ?>
3042 3042
         </div><!-- clearfix ends here-->
3043 3043
     <?php }
@@ -3053,7 +3053,7 @@  discard block
 block discarded – undo
3053 3053
  */
3054 3054
 function geodir_search_left_section()
3055 3055
 {
3056
-    if (get_option('geodir_show_search_left_section')) { ?>
3056
+	if (get_option('geodir_show_search_left_section')) { ?>
3057 3057
         <div class="geodir-content-left geodir-sidebar-wrap">
3058 3058
             <?php dynamic_sidebar('geodir_search_left_sidebar'); ?>
3059 3059
         </div><!-- end geodir-content-left -->
@@ -3073,19 +3073,19 @@  discard block
 block discarded – undo
3073 3073
  */
3074 3074
 function geodir_action_search_sidebar_left()
3075 3075
 {
3076
-    if (get_option('geodir_show_search_left_section')) {
3076
+	if (get_option('geodir_show_search_left_section')) {
3077 3077
 // this adds the opening html tags to the primary div, this required the closing tag below :: ($type='',$id='',$class='',$itemtype='')
3078
-        /** This action is documented in geodirectory_template_actions.php */
3079
-        do_action('geodir_sidebar_left_open', 'search-page', 'geodir-sidebar-left', 'geodir-sidebar-left geodir-listings-sidebar-left', 'http://schema.org/WPSideBar');
3080
-        /**
3081
-         * This is used to add the content to the search page left sidebar (if active).
3082
-         *
3083
-         * @since 1.0.0
3084
-         */
3085
-        do_action('geodir_search_sidebar_left_inside');
3086
-        /** This action is documented in geodirectory_template_actions.php */
3087
-        do_action('geodir_sidebar_left_close', 'search-page');
3088
-    }
3078
+		/** This action is documented in geodirectory_template_actions.php */
3079
+		do_action('geodir_sidebar_left_open', 'search-page', 'geodir-sidebar-left', 'geodir-sidebar-left geodir-listings-sidebar-left', 'http://schema.org/WPSideBar');
3080
+		/**
3081
+		 * This is used to add the content to the search page left sidebar (if active).
3082
+		 *
3083
+		 * @since 1.0.0
3084
+		 */
3085
+		do_action('geodir_search_sidebar_left_inside');
3086
+		/** This action is documented in geodirectory_template_actions.php */
3087
+		do_action('geodir_sidebar_left_close', 'search-page');
3088
+	}
3089 3089
 }
3090 3090
 
3091 3091
 /**
@@ -3098,7 +3098,7 @@  discard block
 block discarded – undo
3098 3098
  */
3099 3099
 function geodir_search_right_section()
3100 3100
 {
3101
-    if (get_option('geodir_show_search_right_section')) { ?>
3101
+	if (get_option('geodir_show_search_right_section')) { ?>
3102 3102
         <div class="geodir-content-right geodir-sidebar-wrap">
3103 3103
             <?php dynamic_sidebar('geodir_search_right_sidebar'); ?>
3104 3104
         </div><!-- end geodir-content-right -->
@@ -3118,18 +3118,18 @@  discard block
 block discarded – undo
3118 3118
  */
3119 3119
 function geodir_action_search_sidebar_right()
3120 3120
 {
3121
-    if (get_option('geodir_show_search_right_section')) {
3122
-        /** This action is documented in geodirectory_template_actions.php */
3123
-        do_action('geodir_sidebar_right_open', 'search-page', 'geodir-sidebar-right', 'geodir-sidebar-right geodir-listings-sidebar-right', 'http://schema.org/WPSideBar');
3124
-        /**
3125
-         * This is used to add the content to the search page right sidebar (if active).
3126
-         *
3127
-         * @since 1.0.0
3128
-         */
3129
-        do_action('geodir_search_sidebar_right_inside');
3130
-        /** This action is documented in geodirectory_template_actions.php */
3131
-        do_action('geodir_sidebar_right_close', 'search-page');
3132
-    }
3121
+	if (get_option('geodir_show_search_right_section')) {
3122
+		/** This action is documented in geodirectory_template_actions.php */
3123
+		do_action('geodir_sidebar_right_open', 'search-page', 'geodir-sidebar-right', 'geodir-sidebar-right geodir-listings-sidebar-right', 'http://schema.org/WPSideBar');
3124
+		/**
3125
+		 * This is used to add the content to the search page right sidebar (if active).
3126
+		 *
3127
+		 * @since 1.0.0
3128
+		 */
3129
+		do_action('geodir_search_sidebar_right_inside');
3130
+		/** This action is documented in geodirectory_template_actions.php */
3131
+		do_action('geodir_sidebar_right_close', 'search-page');
3132
+	}
3133 3133
 }
3134 3134
 
3135 3135
 
@@ -3144,11 +3144,11 @@  discard block
 block discarded – undo
3144 3144
  */
3145 3145
 function geodir_action_sidebar_search_bottom_section()
3146 3146
 {
3147
-    if (get_option('geodir_show_search_bottom_section')) { ?>
3147
+	if (get_option('geodir_show_search_bottom_section')) { ?>
3148 3148
         <div
3149 3149
             class="<?php
3150
-            /** This action is documented in geodirectory_template_actions.php */
3151
-            echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_search_bottom'); ?>">
3150
+			/** This action is documented in geodirectory_template_actions.php */
3151
+			echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_search_bottom'); ?>">
3152 3152
             <?php dynamic_sidebar('geodir_search_bottom'); ?>
3153 3153
         </div><!-- clearfix ends here-->
3154 3154
     <?php }
@@ -3163,14 +3163,14 @@  discard block
 block discarded – undo
3163 3163
  */
3164 3164
 function geodir_action_search_content_inside()
3165 3165
 {
3166
-    global $gridview_columns;
3167
-    $listing_view = get_option('geodir_search_view');
3168
-    if (strstr($listing_view, 'gridview')) {
3169
-        $gridview_columns = $listing_view;
3170
-        $listing_view_exp = explode('_', $listing_view);
3171
-        $listing_view = $listing_view_exp[0];
3172
-    }
3173
-    geodir_get_template_part('listing', 'listview');
3166
+	global $gridview_columns;
3167
+	$listing_view = get_option('geodir_search_view');
3168
+	if (strstr($listing_view, 'gridview')) {
3169
+		$gridview_columns = $listing_view;
3170
+		$listing_view_exp = explode('_', $listing_view);
3171
+		$listing_view = $listing_view_exp[0];
3172
+	}
3173
+	geodir_get_template_part('listing', 'listview');
3174 3174
 }
3175 3175
 
3176 3176
 add_action('geodir_search_content_inside', 'geodir_action_search_content_inside', 10);
@@ -3186,22 +3186,22 @@  discard block
 block discarded – undo
3186 3186
  */
3187 3187
 function geodir_action_search_content()
3188 3188
 {
3189
-    /** This action is documented in geodirectory_template_actions.php */
3190
-    do_action('geodir_main_content_open', 'search-page', 'geodir-main-content', 'search-page');
3191
-    echo '<div class="clearfix">';
3192
-    /** This action is documented in geodirectory_template_actions.php */
3193
-    do_action('geodir_before_listing');
3194
-    echo '</div>';
3195
-    /**
3196
-     * This is used to add the content to the search page main content.
3197
-     *
3198
-     * @since 1.0.0
3199
-     */
3200
-    do_action('geodir_search_content_inside');
3201
-    /** This action is documented in geodirectory_template_actions.php */
3202
-    do_action('geodir_after_listing');
3203
-    /** This action is documented in geodirectory_template_actions.php */
3204
-    do_action('geodir_main_content_close', 'search-page');
3189
+	/** This action is documented in geodirectory_template_actions.php */
3190
+	do_action('geodir_main_content_open', 'search-page', 'geodir-main-content', 'search-page');
3191
+	echo '<div class="clearfix">';
3192
+	/** This action is documented in geodirectory_template_actions.php */
3193
+	do_action('geodir_before_listing');
3194
+	echo '</div>';
3195
+	/**
3196
+	 * This is used to add the content to the search page main content.
3197
+	 *
3198
+	 * @since 1.0.0
3199
+	 */
3200
+	do_action('geodir_search_content_inside');
3201
+	/** This action is documented in geodirectory_template_actions.php */
3202
+	do_action('geodir_after_listing');
3203
+	/** This action is documented in geodirectory_template_actions.php */
3204
+	do_action('geodir_main_content_close', 'search-page');
3205 3205
 }
3206 3206
 
3207 3207
 ###############################################
@@ -3224,11 +3224,11 @@  discard block
 block discarded – undo
3224 3224
  */
3225 3225
 function geodir_action_geodir_sidebar_home_top()
3226 3226
 {
3227
-    if (get_option('geodir_show_home_top_section')) { ?>
3227
+	if (get_option('geodir_show_home_top_section')) { ?>
3228 3228
         <div
3229 3229
             class="<?php
3230
-            /** This action is documented in geodirectory_template_actions.php */
3231
-            echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_home_top'); ?>">
3230
+			/** This action is documented in geodirectory_template_actions.php */
3231
+			echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_home_top'); ?>">
3232 3232
             <?php dynamic_sidebar('geodir_home_top'); ?>
3233 3233
         </div><!-- clearfix ends here-->
3234 3234
     <?php }
@@ -3244,7 +3244,7 @@  discard block
 block discarded – undo
3244 3244
  */
3245 3245
 function geodir_home_left_section()
3246 3246
 {
3247
-    if (get_option('geodir_show_home_left_section')) { ?>
3247
+	if (get_option('geodir_show_home_left_section')) { ?>
3248 3248
         <div class="geodir-content-left geodir-sidebar-wrap">
3249 3249
             <?php dynamic_sidebar('geodir_home_left'); ?>
3250 3250
         </div><!-- end geodir-content-left -->
@@ -3266,19 +3266,19 @@  discard block
 block discarded – undo
3266 3266
  */
3267 3267
 function geodir_action_home_sidebar_left()
3268 3268
 {
3269
-    if (get_option('geodir_show_home_left_section')) {
3269
+	if (get_option('geodir_show_home_left_section')) {
3270 3270
 // this adds the opening html tags to the primary div, this required the closing tag below :: ($type='',$id='',$class='',$itemtype='')
3271
-        /** This action is documented in geodirectory_template_actions.php */
3272
-        do_action('geodir_sidebar_left_open', 'home-page', 'geodir-sidebar-left', 'geodir-sidebar geodir-sidebar-left geodir-listings-sidebar-left', 'http://schema.org/WPSideBar');
3273
-        /**
3274
-         * This is used to add the content to the home page left sidebar (if active).
3275
-         *
3276
-         * @since 1.0.0
3277
-         */
3278
-        do_action('geodir_home_sidebar_left_inside');
3279
-        /** This action is documented in geodirectory_template_actions.php */
3280
-        do_action('geodir_sidebar_left_close', 'home-page');
3281
-    }
3271
+		/** This action is documented in geodirectory_template_actions.php */
3272
+		do_action('geodir_sidebar_left_open', 'home-page', 'geodir-sidebar-left', 'geodir-sidebar geodir-sidebar-left geodir-listings-sidebar-left', 'http://schema.org/WPSideBar');
3273
+		/**
3274
+		 * This is used to add the content to the home page left sidebar (if active).
3275
+		 *
3276
+		 * @since 1.0.0
3277
+		 */
3278
+		do_action('geodir_home_sidebar_left_inside');
3279
+		/** This action is documented in geodirectory_template_actions.php */
3280
+		do_action('geodir_sidebar_left_close', 'home-page');
3281
+	}
3282 3282
 }
3283 3283
 
3284 3284
 /**
@@ -3291,7 +3291,7 @@  discard block
 block discarded – undo
3291 3291
  */
3292 3292
 function geodir_home_right_section()
3293 3293
 {
3294
-    if (get_option('geodir_show_home_right_section')) { ?>
3294
+	if (get_option('geodir_show_home_right_section')) { ?>
3295 3295
         <div class="geodir-content-right geodir-sidebar-wrap">
3296 3296
             <?php dynamic_sidebar('geodir_home_right'); ?>
3297 3297
         </div><!-- end geodir-content-right -->
@@ -3312,18 +3312,18 @@  discard block
 block discarded – undo
3312 3312
  */
3313 3313
 function geodir_action_home_sidebar_right()
3314 3314
 {
3315
-    if (get_option('geodir_show_home_right_section')) {
3316
-        /** This action is documented in geodirectory_template_actions.php */
3317
-        do_action('geodir_sidebar_right_open', 'home-page', 'geodir-sidebar-right', 'geodir-sidebar-right geodir-listings-sidebar-right', 'http://schema.org/WPSideBar');
3318
-        /**
3319
-         * This is used to add the content to the home page right sidebar (if active).
3320
-         *
3321
-         * @since 1.0.0
3322
-         */
3323
-        do_action('geodir_home_sidebar_right_inside');
3324
-        /** This action is documented in geodirectory_template_actions.php */
3325
-        do_action('geodir_sidebar_right_close', 'home-page');
3326
-    }
3315
+	if (get_option('geodir_show_home_right_section')) {
3316
+		/** This action is documented in geodirectory_template_actions.php */
3317
+		do_action('geodir_sidebar_right_open', 'home-page', 'geodir-sidebar-right', 'geodir-sidebar-right geodir-listings-sidebar-right', 'http://schema.org/WPSideBar');
3318
+		/**
3319
+		 * This is used to add the content to the home page right sidebar (if active).
3320
+		 *
3321
+		 * @since 1.0.0
3322
+		 */
3323
+		do_action('geodir_home_sidebar_right_inside');
3324
+		/** This action is documented in geodirectory_template_actions.php */
3325
+		do_action('geodir_sidebar_right_close', 'home-page');
3326
+	}
3327 3327
 }
3328 3328
 
3329 3329
 /**
@@ -3334,7 +3334,7 @@  discard block
 block discarded – undo
3334 3334
  */
3335 3335
 function geodir_action_home_content_inside()
3336 3336
 {
3337
-    dynamic_sidebar('geodir_home_content');
3337
+	dynamic_sidebar('geodir_home_content');
3338 3338
 }
3339 3339
 
3340 3340
 add_action('geodir_home_content_inside', 'geodir_action_home_content_inside', 10);
@@ -3349,28 +3349,28 @@  discard block
 block discarded – undo
3349 3349
  */
3350 3350
 function geodir_action_home_content()
3351 3351
 {
3352
-    /** This action is documented in geodirectory_template_actions.php */
3353
-    do_action('geodir_main_content_open', 'home-page', 'geodir-main-content', 'home-page');
3354
-    /**
3355
-     * This called before the home page main content.
3356
-     *
3357
-     * @since 1.0.0
3358
-     */
3359
-    do_action('geodir_before_home_content');
3360
-    /**
3361
-     * This is used to add the content to the home page main content.
3362
-     *
3363
-     * @since 1.0.0
3364
-     */
3365
-    do_action('geodir_home_content_inside');
3366
-    /**
3367
-     * This is called after the homepage main content.
3368
-     *
3369
-     * @since 1.0.0
3370
-     */
3371
-    do_action('geodir_after_home_content');
3372
-    /** This action is documented in geodirectory_template_actions.php */
3373
-    do_action('geodir_main_content_close', 'home-page');
3352
+	/** This action is documented in geodirectory_template_actions.php */
3353
+	do_action('geodir_main_content_open', 'home-page', 'geodir-main-content', 'home-page');
3354
+	/**
3355
+	 * This called before the home page main content.
3356
+	 *
3357
+	 * @since 1.0.0
3358
+	 */
3359
+	do_action('geodir_before_home_content');
3360
+	/**
3361
+	 * This is used to add the content to the home page main content.
3362
+	 *
3363
+	 * @since 1.0.0
3364
+	 */
3365
+	do_action('geodir_home_content_inside');
3366
+	/**
3367
+	 * This is called after the homepage main content.
3368
+	 *
3369
+	 * @since 1.0.0
3370
+	 */
3371
+	do_action('geodir_after_home_content');
3372
+	/** This action is documented in geodirectory_template_actions.php */
3373
+	do_action('geodir_main_content_close', 'home-page');
3374 3374
 }
3375 3375
 
3376 3376
 add_action('geodir_sidebar_location_bottom_section', 'geodir_action_sidebar_home_bottom_section', 10);
@@ -3385,11 +3385,11 @@  discard block
 block discarded – undo
3385 3385
  */
3386 3386
 function geodir_action_sidebar_home_bottom_section()
3387 3387
 {
3388
-    if (get_option('geodir_show_home_bottom_section')) { ?>
3388
+	if (get_option('geodir_show_home_bottom_section')) { ?>
3389 3389
         <div
3390 3390
             class="<?php
3391
-            /** This action is documented in geodirectory_template_actions.php */
3392
-            echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_home_bottom'); ?>">
3391
+			/** This action is documented in geodirectory_template_actions.php */
3392
+			echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_home_bottom'); ?>">
3393 3393
             <?php dynamic_sidebar('geodir_home_bottom'); ?>
3394 3394
         </div><!-- clearfix ends here-->
3395 3395
     <?php }
@@ -3417,13 +3417,13 @@  discard block
 block discarded – undo
3417 3417
  */
3418 3418
 function geodir_filter_listing_page_title($list_title)
3419 3419
 {
3420
-    if (is_search() && trim(get_search_query()) == '') {
3421
-        $gd_post_type = geodir_get_current_posttype();
3422
-        $post_type_info = get_post_type_object($gd_post_type);
3420
+	if (is_search() && trim(get_search_query()) == '') {
3421
+		$gd_post_type = geodir_get_current_posttype();
3422
+		$post_type_info = get_post_type_object($gd_post_type);
3423 3423
 
3424
-        $list_title = __('Search', 'geodirectory') . ' ' . __(geodir_utf8_ucfirst($post_type_info->labels->name), 'geodirectory') . __(' :', 'geodirectory');
3425
-    }
3426
-    return $list_title;
3424
+		$list_title = __('Search', 'geodirectory') . ' ' . __(geodir_utf8_ucfirst($post_type_info->labels->name), 'geodirectory') . __(' :', 'geodirectory');
3425
+	}
3426
+	return $list_title;
3427 3427
 }
3428 3428
 
3429 3429
 add_action('geodir_message_not_found_on_listing', 'geodir_display_message_not_found_on_listing');
@@ -3438,62 +3438,62 @@  discard block
 block discarded – undo
3438 3438
  * @param string $gd_page The geodirectory page type. Default null.
3439 3439
  */
3440 3440
 function geodir_add_page_content( $position = 'before', $gd_page = '' ) {
3441
-    global $post;
3442
-
3443
-    $gd_page_id = NULL;
3444
-    if ($gd_page == 'home-page' && geodir_is_page('home')) {
3445
-        $gd_page_id = geodir_home_page_id();
3446
-    } else if ($gd_page == 'details-page' && geodir_is_page('preview')) {
3447
-        $gd_page_id = geodir_preview_page_id();
3448
-    } else if ($gd_page == 'add-listing-page' && geodir_is_page('add-listing')) {
3449
-        $gd_page_id = geodir_add_listing_page_id();
3450
-    } else if ($gd_page == 'success-page' && geodir_is_page('listing-success')) {
3451
-        $gd_page_id = geodir_success_page_id();
3452
-    } else if ($gd_page == 'location-page' && geodir_is_page('location')) {
3453
-        $gd_page_id = geodir_location_page_id();
3454
-    } else if ($gd_page == 'info-page' && geodir_is_page('info')) {
3455
-        $gd_page_id = geodir_info_page_id();
3456
-    } else if ($gd_page == 'signup-page' && geodir_is_page('login')) {
3457
-        $gd_page_id = geodir_login_page_id();
3458
-    } else if ($gd_page == 'checkout-page' && geodir_is_page('checkout')) {
3459
-        $gd_page_id = geodir_payment_checkout_page_id();
3460
-    } else if ($gd_page == 'invoices-page' && geodir_is_page('invoices')) {
3461
-        $gd_page_id = geodir_payment_invoices_page_id();
3462
-    }
3463
-
3464
-    if (!$gd_page_id > 0) {
3465
-        return;
3466
-    }
3441
+	global $post;
3442
+
3443
+	$gd_page_id = NULL;
3444
+	if ($gd_page == 'home-page' && geodir_is_page('home')) {
3445
+		$gd_page_id = geodir_home_page_id();
3446
+	} else if ($gd_page == 'details-page' && geodir_is_page('preview')) {
3447
+		$gd_page_id = geodir_preview_page_id();
3448
+	} else if ($gd_page == 'add-listing-page' && geodir_is_page('add-listing')) {
3449
+		$gd_page_id = geodir_add_listing_page_id();
3450
+	} else if ($gd_page == 'success-page' && geodir_is_page('listing-success')) {
3451
+		$gd_page_id = geodir_success_page_id();
3452
+	} else if ($gd_page == 'location-page' && geodir_is_page('location')) {
3453
+		$gd_page_id = geodir_location_page_id();
3454
+	} else if ($gd_page == 'info-page' && geodir_is_page('info')) {
3455
+		$gd_page_id = geodir_info_page_id();
3456
+	} else if ($gd_page == 'signup-page' && geodir_is_page('login')) {
3457
+		$gd_page_id = geodir_login_page_id();
3458
+	} else if ($gd_page == 'checkout-page' && geodir_is_page('checkout')) {
3459
+		$gd_page_id = geodir_payment_checkout_page_id();
3460
+	} else if ($gd_page == 'invoices-page' && geodir_is_page('invoices')) {
3461
+		$gd_page_id = geodir_payment_invoices_page_id();
3462
+	}
3463
+
3464
+	if (!$gd_page_id > 0) {
3465
+		return;
3466
+	}
3467 3467
     
3468
-    $display = 'before';
3469
-    /**
3470
-     * Filter the position to display the page content.
3471
-     *
3472
-     * @since 1.6.3
3473
-     *
3474
-     * @param string $display Position to add the post content.
3475
-     * @param string $gd_page The geodirectory page type.
3476
-     */
3477
-    $display = apply_filters('geodir_add_page_content_position', $display, $gd_page);
3478
-
3479
-    if ($position !== $display) {
3480
-        return;
3481
-    }
3482
-
3483
-    $gd_post = $post;
3468
+	$display = 'before';
3469
+	/**
3470
+	 * Filter the position to display the page content.
3471
+	 *
3472
+	 * @since 1.6.3
3473
+	 *
3474
+	 * @param string $display Position to add the post content.
3475
+	 * @param string $gd_page The geodirectory page type.
3476
+	 */
3477
+	$display = apply_filters('geodir_add_page_content_position', $display, $gd_page);
3478
+
3479
+	if ($position !== $display) {
3480
+		return;
3481
+	}
3482
+
3483
+	$gd_post = $post;
3484 3484
     
3485
-    setup_postdata(get_post($gd_page_id));
3485
+	setup_postdata(get_post($gd_page_id));
3486 3486
 
3487
-    if (get_the_content()) {
3488
-        ?>
3487
+	if (get_the_content()) {
3488
+		?>
3489 3489
         <section class="entry-content clearfix" itemprop="articleBody"><?php the_content(); ?></section>
3490 3490
         <?php
3491
-    }
3491
+	}
3492 3492
 
3493
-    $post = $gd_post;
3494
-    if (!empty($gd_post) && is_object($gd_post)) {
3495
-        setup_postdata($gd_post);
3496
-    }
3493
+	$post = $gd_post;
3494
+	if (!empty($gd_post) && is_object($gd_post)) {
3495
+		setup_postdata($gd_post);
3496
+	}
3497 3497
 
3498 3498
 }
3499 3499
 add_action('geodir_add_page_content', 'geodir_add_page_content', 10, 2);
@@ -3514,13 +3514,13 @@  discard block
 block discarded – undo
3514 3514
  * @return string Filtered SQL JOIN clause.
3515 3515
  */
3516 3516
 function geodir_previous_next_post_join( $join, $in_same_term, $excluded_terms, $taxonomy, $post ) {
3517
-    global $plugin_prefix;
3517
+	global $plugin_prefix;
3518 3518
 
3519
-    if ( !empty($post->post_type) && in_array( $post->post_type, geodir_get_posttypes() ) ) {
3520
-        $join .= " INNER JOIN " . $plugin_prefix . $post->post_type . "_detail AS gd ON gd.post_id = p.ID";
3521
-    }
3519
+	if ( !empty($post->post_type) && in_array( $post->post_type, geodir_get_posttypes() ) ) {
3520
+		$join .= " INNER JOIN " . $plugin_prefix . $post->post_type . "_detail AS gd ON gd.post_id = p.ID";
3521
+	}
3522 3522
     
3523
-    return $join;
3523
+	return $join;
3524 3524
 }
3525 3525
 add_filter( 'get_previous_post_join', 'geodir_previous_next_post_join', 10, 5 );
3526 3526
 add_filter( 'get_next_post_join', 'geodir_previous_next_post_join', 10, 5 );
@@ -3542,31 +3542,31 @@  discard block
 block discarded – undo
3542 3542
  * @return string Filtered SQL WHERE clause.
3543 3543
  */
3544 3544
 function geodir_previous_next_post_where( $where, $in_same_term, $excluded_terms, $taxonomy, $post ) {
3545
-    global $wpdb, $plugin_prefix;
3545
+	global $wpdb, $plugin_prefix;
3546 3546
 
3547
-    if ( !empty($post->post_type) && ( !empty( $post->country_slug ) || !empty( $post->region_slug ) || !empty( $post->city_slug ) ) && in_array( $post->post_type, geodir_get_posttypes() ) ) {
3548
-        $post_locations = '';
3549
-        $post_locations_var = array();
3547
+	if ( !empty($post->post_type) && ( !empty( $post->country_slug ) || !empty( $post->region_slug ) || !empty( $post->city_slug ) ) && in_array( $post->post_type, geodir_get_posttypes() ) ) {
3548
+		$post_locations = '';
3549
+		$post_locations_var = array();
3550 3550
         
3551
-        if ( !empty( $post->country_slug ) ) {
3552
-            $post_locations .= " AND post_locations LIKE %s";
3553
-            $post_locations_var[] = "%,[" . $post->country_slug . "]";
3554
-        }
3555
-
3556
-        if ( !empty( $post->region_slug ) ) {
3557
-            $post_locations .= " AND post_locations LIKE %s";
3558
-            $post_locations_var[] = "%,[" . $post->region_slug . "],%";
3559
-        }
3560
-
3561
-        if ( !empty( $post->city_slug ) ) {
3562
-            $post_locations .= " AND post_locations LIKE %s";
3563
-            $post_locations_var[] = "[" . $post->city_slug . "],%";
3564
-        }
3551
+		if ( !empty( $post->country_slug ) ) {
3552
+			$post_locations .= " AND post_locations LIKE %s";
3553
+			$post_locations_var[] = "%,[" . $post->country_slug . "]";
3554
+		}
3555
+
3556
+		if ( !empty( $post->region_slug ) ) {
3557
+			$post_locations .= " AND post_locations LIKE %s";
3558
+			$post_locations_var[] = "%,[" . $post->region_slug . "],%";
3559
+		}
3560
+
3561
+		if ( !empty( $post->city_slug ) ) {
3562
+			$post_locations .= " AND post_locations LIKE %s";
3563
+			$post_locations_var[] = "[" . $post->city_slug . "],%";
3564
+		}
3565 3565
         
3566
-        $where .= $wpdb->prepare( $post_locations, $post_locations_var );
3567
-    }
3566
+		$where .= $wpdb->prepare( $post_locations, $post_locations_var );
3567
+	}
3568 3568
     
3569
-    return $where;
3569
+	return $where;
3570 3570
 }
3571 3571
 add_filter( 'get_previous_post_where', 'geodir_previous_next_post_where', 10, 5 );
3572 3572
 add_filter( 'get_next_post_where', 'geodir_previous_next_post_where', 10, 5 );
3573 3573
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +183 added lines, -183 removed lines patch added patch discarded remove patch
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
 
284 284
     //php
285 285
     if (!empty($tc['geodir_theme_compat_code'])) {
286
-        include_once('geodirectory-functions/compatibility/' . $tc['geodir_theme_compat_code'] . '.php');
286
+        include_once('geodirectory-functions/compatibility/'.$tc['geodir_theme_compat_code'].'.php');
287 287
     }
288 288
 
289 289
     //geodir_full_page_class
@@ -453,13 +453,13 @@  discard block
 block discarded – undo
453 453
 function geodir_action_wrapper_content_open($type = '', $id = '', $class = '')
454 454
 {
455 455
     if ($type == 'home-page' && $width = get_option('geodir_width_home_contant_section')) {
456
-        $width_css = 'style="width:' . $width . '%;"';
456
+        $width_css = 'style="width:'.$width.'%;"';
457 457
     } elseif ($type == 'listings-page' && $width = get_option('geodir_width_listing_contant_section')) {
458
-        $width_css = 'style="width:' . $width . '%;"';
458
+        $width_css = 'style="width:'.$width.'%;"';
459 459
     } elseif ($type == 'search-page' && $width = get_option('geodir_width_search_contant_section')) {
460
-        $width_css = 'style="width:' . $width . '%;"';
460
+        $width_css = 'style="width:'.$width.'%;"';
461 461
     } elseif ($type == 'author-page' && $width = get_option('geodir_width_author_contant_section')) {
462
-        $width_css = 'style="width:' . $width . '%;"';
462
+        $width_css = 'style="width:'.$width.'%;"';
463 463
     } else {
464 464
         $width_css = '';
465 465
     }
@@ -573,13 +573,13 @@  discard block
 block discarded – undo
573 573
 function geodir_action_sidebar_right_open($type = '', $id = '', $class = '', $itemtype = '')
574 574
 {
575 575
     if ($type == 'home-page' && $width = get_option('geodir_width_home_right_section')) {
576
-        $width_css = 'style="width:' . $width . '%;"';
576
+        $width_css = 'style="width:'.$width.'%;"';
577 577
     } elseif ($type == 'listings-page' && $width = get_option('geodir_width_listing_right_section')) {
578
-        $width_css = 'style="width:' . $width . '%;"';
578
+        $width_css = 'style="width:'.$width.'%;"';
579 579
     } elseif ($type == 'search-page' && $width = get_option('geodir_width_search_right_section')) {
580
-        $width_css = 'style="width:' . $width . '%;"';
580
+        $width_css = 'style="width:'.$width.'%;"';
581 581
     } elseif ($type == 'author-page' && $width = get_option('geodir_width_author_right_section')) {
582
-        $width_css = 'style="width:' . $width . '%;"';
582
+        $width_css = 'style="width:'.$width.'%;"';
583 583
     } else {
584 584
         $width_css = '';
585 585
     }
@@ -677,7 +677,7 @@  discard block
 block discarded – undo
677 677
         }
678 678
     }
679 679
 
680
-    $post = (object)$_REQUEST;
680
+    $post = (object) $_REQUEST;
681 681
 
682 682
 
683 683
     if (isset($post->video)) {
@@ -736,10 +736,10 @@  discard block
 block discarded – undo
736 736
 
737 737
     $json = '{';
738 738
     $json .= '"post_preview": "1",';
739
-    $json .= '"t": "' . $json_title . '",';
740
-    $json .= '"lt": "' . $post_latitude . '",';
741
-    $json .= '"ln": "' . $post_longitude . '",';
742
-    $json .= '"i":"' . $term_icon . '"';
739
+    $json .= '"t": "'.$json_title.'",';
740
+    $json .= '"lt": "'.$post_latitude.'",';
741
+    $json .= '"ln": "'.$post_longitude.'",';
742
+    $json .= '"i":"'.$term_icon.'"';
743 743
     $json .= '}';
744 744
 
745 745
     $post->marker_json = $json;
@@ -966,7 +966,7 @@  discard block
 block discarded – undo
966 966
      * @param string $class The class to use. Default is 'entry-header'.
967 967
      */
968 968
     $class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
969
-    echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' . stripslashes(get_the_title()) . '</h1></header>';
969
+    echo '<header class="'.$class_header.'"><h1 class="'.$class.'">'.stripslashes(get_the_title()).'</h1></header>';
970 970
 }
971 971
 
972 972
 
@@ -1020,7 +1020,7 @@  discard block
 block discarded – undo
1020 1020
                     $height = !empty($sizes) && isset($sizes[1]) ? $sizes[1] : 0;
1021 1021
 
1022 1022
                     if ($image && $width && $height) {
1023
-                        $image = (object)array('src' => $image, 'width' => $width, 'height' => $height);
1023
+                        $image = (object) array('src' => $image, 'width' => $width, 'height' => $height);
1024 1024
                     }
1025 1025
 
1026 1026
                     if (isset($image->src)) {
@@ -1032,9 +1032,9 @@  discard block
 block discarded – undo
1032 1032
 
1033 1033
                         $image_title = isset($image->title) ? $image->title : '';
1034 1034
 
1035
-                        $main_slides .= '<li><img src="' . geodir_plugin_url() . "/geodirectory-assets/images/spacer.gif" . '" alt="' . $image_title . '" title="' . $image_title . '" style="max-height:' . $spacer_height . 'px;margin:0 auto;" />';
1036
-                        $main_slides .= '<img src="' . $image->src . '" alt="' . $image_title . '" title="' . $image_title . '" style="max-height:400px;margin:0 auto;" /></li>';
1037
-                        $nav_slides .= '<li><img src="' . $image->src . '" alt="' . $image_title . '" title="' . $image_title . '" style="max-height:48px;margin:0 auto;" /></li>';
1035
+                        $main_slides .= '<li><img src="'.geodir_plugin_url()."/geodirectory-assets/images/spacer.gif".'" alt="'.$image_title.'" title="'.$image_title.'" style="max-height:'.$spacer_height.'px;margin:0 auto;" />';
1036
+                        $main_slides .= '<img src="'.$image->src.'" alt="'.$image_title.'" title="'.$image_title.'" style="max-height:400px;margin:0 auto;" /></li>';
1037
+                        $nav_slides .= '<li><img src="'.$image->src.'" alt="'.$image_title.'" title="'.$image_title.'" style="max-height:48px;margin:0 auto;" /></li>';
1038 1038
                         $slides++;
1039 1039
                     }
1040 1040
                 }
@@ -1060,10 +1060,10 @@  discard block
 block discarded – undo
1060 1060
                 } else {
1061 1061
                     $spacer_height = ((400 - $image->height) / 2);
1062 1062
                 }
1063
-                $caption = '';//(!empty($image->caption)) ? '<p class="flex-caption">'.$image->caption.'</p>' : '';
1064
-                $main_slides .= '<li><img src="' . geodir_plugin_url() . "/geodirectory-assets/images/spacer.gif" . '" alt="' . $image->title . '" title="' . $image->title . '" style="max-height:' . $spacer_height . 'px;margin:0 auto;" />';
1065
-                $main_slides .= '<img src="' . $image->src . '" alt="' . $image->title . '" title="' . $image->title . '" style="max-height:400px;margin:0 auto;" />'.$caption.'</li>';
1066
-                $nav_slides .= '<li><img src="' . $image->src . '" alt="' . $image->title . '" title="' . $image->title . '" style="max-height:48px;margin:0 auto;" /></li>';
1063
+                $caption = ''; //(!empty($image->caption)) ? '<p class="flex-caption">'.$image->caption.'</p>' : '';
1064
+                $main_slides .= '<li><img src="'.geodir_plugin_url()."/geodirectory-assets/images/spacer.gif".'" alt="'.$image->title.'" title="'.$image->title.'" style="max-height:'.$spacer_height.'px;margin:0 auto;" />';
1065
+                $main_slides .= '<img src="'.$image->src.'" alt="'.$image->title.'" title="'.$image->title.'" style="max-height:400px;margin:0 auto;" />'.$caption.'</li>';
1066
+                $nav_slides .= '<li><img src="'.$image->src.'" alt="'.$image->title.'" title="'.$image->title.'" style="max-height:48px;margin:0 auto;" /></li>';
1067 1067
                 $slides++;
1068 1068
             }
1069 1069
         }// endfore
@@ -1098,7 +1098,7 @@  discard block
 block discarded – undo
1098 1098
  */
1099 1099
 function geodir_action_details_taxonomies()
1100 1100
 {
1101
-    global $preview, $post;?>
1101
+    global $preview, $post; ?>
1102 1102
     <p class="geodir_post_taxomomies clearfix">
1103 1103
     <?php
1104 1104
     $taxonomies = array();
@@ -1107,11 +1107,11 @@  discard block
 block discarded – undo
1107 1107
 
1108 1108
     if ($preview && !$is_backend_preview) {
1109 1109
         $post_type = $post->listing_type;
1110
-        $post_taxonomy = $post_type . 'category';
1110
+        $post_taxonomy = $post_type.'category';
1111 1111
         $post->{$post_taxonomy} = $post->post_category[$post_taxonomy];
1112 1112
     } else {
1113 1113
         $post_type = $post->post_type;
1114
-        $post_taxonomy = $post_type . 'category';
1114
+        $post_taxonomy = $post_type.'category';
1115 1115
     }
1116 1116
 //{	
1117 1117
     $post_type_info = get_post_type_object($post_type);
@@ -1119,7 +1119,7 @@  discard block
 block discarded – undo
1119 1119
 
1120 1120
     if (!empty($post->post_tags)) {
1121 1121
 
1122
-        if (taxonomy_exists($post_type . '_tags')):
1122
+        if (taxonomy_exists($post_type.'_tags')):
1123 1123
             $links = array();
1124 1124
             $terms = array();
1125 1125
             // to limit post tags
@@ -1146,8 +1146,8 @@  discard block
 block discarded – undo
1146 1146
                 $post_term = trim($post_term);
1147 1147
 
1148 1148
                 $priority_location = false;
1149
-                if ($insert_term = term_exists($post_term, $post_type . '_tags')) {
1150
-                    $term = get_term_by('id', $insert_term['term_id'], $post_type . '_tags');
1149
+                if ($insert_term = term_exists($post_term, $post_type.'_tags')) {
1150
+                    $term = get_term_by('id', $insert_term['term_id'], $post_type.'_tags');
1151 1151
                 } else {
1152 1152
                     $post_country = isset($_REQUEST['post_country']) && $_REQUEST['post_country'] != '' ? sanitize_text_field($_REQUEST['post_country']) : NULL;
1153 1153
                     $post_region = isset($_REQUEST['post_region']) && $_REQUEST['post_region'] != '' ? sanitize_text_field($_REQUEST['post_region']) : NULL;
@@ -1157,10 +1157,10 @@  discard block
 block discarded – undo
1157 1157
                     $match_city = $post_city && sanitize_title($post_term) == sanitize_title($post_city) ? true : false;
1158 1158
                     if ($match_country || $match_region || $match_city) {
1159 1159
                         $priority_location = true;
1160
-                        $term = get_term_by('name', $post_term, $post_type . '_tags');
1160
+                        $term = get_term_by('name', $post_term, $post_type.'_tags');
1161 1161
                     } else {
1162
-                        $insert_term = wp_insert_term($post_term, $post_type . '_tags');
1163
-                        $term = get_term_by('name', $post_term, $post_type . '_tags');
1162
+                        $insert_term = wp_insert_term($post_term, $post_type.'_tags');
1163
+                        $term = get_term_by('name', $post_term, $post_type.'_tags');
1164 1164
                     }
1165 1165
                 }
1166 1166
 
@@ -1177,12 +1177,12 @@  discard block
 block discarded – undo
1177 1177
                          * @param string $tag_link The tag link html.
1178 1178
                          * @param object $term The tag term object.
1179 1179
                          */
1180
-                        $tag_link = apply_filters('geodir_details_taxonomies_tag_link',$tag_link,$term);
1180
+                        $tag_link = apply_filters('geodir_details_taxonomies_tag_link', $tag_link, $term);
1181 1181
                         $links[] = $tag_link;
1182 1182
                     } else {
1183
-                        $tag_link = "<a href='" . esc_attr(get_term_link($term->term_id, $term->taxonomy)) . "'>$term->name</a>";
1183
+                        $tag_link = "<a href='".esc_attr(get_term_link($term->term_id, $term->taxonomy))."'>$term->name</a>";
1184 1184
                         /** This action is documented in geodirectory-template_actions.php */
1185
-                        $tag_link = apply_filters('geodir_details_taxonomies_tag_link',$tag_link,$term);
1185
+                        $tag_link = apply_filters('geodir_details_taxonomies_tag_link', $tag_link, $term);
1186 1186
                         $links[] = $tag_link;
1187 1187
                     }
1188 1188
                     $terms[] = $term;
@@ -1192,7 +1192,7 @@  discard block
 block discarded – undo
1192 1192
             if (!isset($listing_label)) {
1193 1193
                 $listing_label = '';
1194 1194
             }
1195
-            $taxonomies[$post_type . '_tags'] = wp_sprintf(__('%s Tags: %l', 'geodirectory'), geodir_ucwords($listing_label), $links, (object)$terms);
1195
+            $taxonomies[$post_type.'_tags'] = wp_sprintf(__('%s Tags: %l', 'geodirectory'), geodir_ucwords($listing_label), $links, (object) $terms);
1196 1196
         endif;
1197 1197
 
1198 1198
     }
@@ -1220,7 +1220,7 @@  discard block
 block discarded – undo
1220 1220
                     $term = get_term_by('id', $post_term, $post_taxonomy);
1221 1221
 
1222 1222
                     if (is_object($term)) {
1223
-                        $term_link = "<a href='" . esc_attr(get_term_link($term, $post_taxonomy)) . "'>$term->name</a>";
1223
+                        $term_link = "<a href='".esc_attr(get_term_link($term, $post_taxonomy))."'>$term->name</a>";
1224 1224
                         /**
1225 1225
                          * Filter the category name on the details page.
1226 1226
                          *
@@ -1228,7 +1228,7 @@  discard block
 block discarded – undo
1228 1228
                          * @param string $term_link The link html to the category.
1229 1229
                          * @param object $term The category term object.
1230 1230
                          */
1231
-                        $term_link = apply_filters('geodir_details_taxonomies_cat_link',$term_link,$term);
1231
+                        $term_link = apply_filters('geodir_details_taxonomies_cat_link', $term_link, $term);
1232 1232
                         $links[] = $term_link;
1233 1233
                         $terms[] = $term;
1234 1234
                     }
@@ -1246,7 +1246,7 @@  discard block
 block discarded – undo
1246 1246
         if (!isset($listing_label)) {
1247 1247
             $listing_label = '';
1248 1248
         }
1249
-        $taxonomies[$post_taxonomy] = wp_sprintf(__('%s Category: %l', 'geodirectory'), geodir_ucwords($listing_label), $links, (object)$terms);
1249
+        $taxonomies[$post_taxonomy] = wp_sprintf(__('%s Category: %l', 'geodirectory'), geodir_ucwords($listing_label), $links, (object) $terms);
1250 1250
 
1251 1251
     }
1252 1252
 
@@ -1259,14 +1259,14 @@  discard block
 block discarded – undo
1259 1259
      * @param string $listing_label The post type label.
1260 1260
      * @param string $listing_label The post type label with ucwords function.
1261 1261
      */
1262
-    $taxonomies = apply_filters('geodir_details_taxonomies_output',$taxonomies,$post_type,$listing_label,geodir_ucwords($listing_label));
1262
+    $taxonomies = apply_filters('geodir_details_taxonomies_output', $taxonomies, $post_type, $listing_label, geodir_ucwords($listing_label));
1263 1263
 
1264 1264
     if (isset($taxonomies[$post_taxonomy])) {
1265
-        echo '<span class="geodir-category">' . $taxonomies[$post_taxonomy] . '</span>';
1265
+        echo '<span class="geodir-category">'.$taxonomies[$post_taxonomy].'</span>';
1266 1266
     }
1267 1267
 
1268
-    if (isset($taxonomies[$post_type . '_tags']))
1269
-        echo '<span class="geodir-tags">' . $taxonomies[$post_type . '_tags'] . '</span>';
1268
+    if (isset($taxonomies[$post_type.'_tags']))
1269
+        echo '<span class="geodir-tags">'.$taxonomies[$post_type.'_tags'].'</span>';
1270 1270
 
1271 1271
     ?>
1272 1272
     </p><?php
@@ -1287,11 +1287,11 @@  discard block
 block discarded – undo
1287 1287
  * @param object $post Optional. The post object or blank.
1288 1288
  * @package GeoDirectory
1289 1289
  */
1290
-function geodir_action_details_micordata($post='')
1290
+function geodir_action_details_micordata($post = '')
1291 1291
 {
1292 1292
 
1293 1293
     global $preview;
1294
-    if(empty($post)){global $post;}
1294
+    if (empty($post)) {global $post; }
1295 1295
     if ($preview || !geodir_is_page('detail')) {
1296 1296
         return;
1297 1297
     }
@@ -1312,7 +1312,7 @@  discard block
 block discarded – undo
1312 1312
                 "description" => $review->comment_content,
1313 1313
                 "reviewRating" => array(
1314 1314
                     "@type" => "Rating",
1315
-                    "bestRating" => "5",// @todo this will need to be filtered for review manager if user changes the score.
1315
+                    "bestRating" => "5", // @todo this will need to be filtered for review manager if user changes the score.
1316 1316
                     "ratingValue" => geodir_get_commentoverall($review->comment_ID),
1317 1317
                     "worstRating" => "1"
1318 1318
                 )
@@ -1340,13 +1340,13 @@  discard block
 block discarded – undo
1340 1340
     }
1341 1341
     //print_r($post);
1342 1342
     // external links
1343
-    $external_links =  array();
1343
+    $external_links = array();
1344 1344
     $external_links[] = $post->geodir_website;
1345 1345
     $external_links[] = $post->geodir_twitter;
1346 1346
     $external_links[] = $post->geodir_facebook;
1347 1347
     $external_links = array_filter($external_links);
1348 1348
 
1349
-    if(!empty($external_links)){
1349
+    if (!empty($external_links)) {
1350 1350
         $external_links = array_values($external_links);
1351 1351
     }
1352 1352
 
@@ -1356,17 +1356,17 @@  discard block
 block discarded – undo
1356 1356
 
1357 1357
     // schema type
1358 1358
     $schema_type = 'LocalBusiness';
1359
-    if(isset($post->default_category) && $post->default_category){
1359
+    if (isset($post->default_category) && $post->default_category) {
1360 1360
         $cat_schema = get_tax_meta($post->default_category, 'ct_cat_schema', false, $post->post_type);
1361
-        if($cat_schema){$schema_type = $cat_schema;}
1362
-        if(!$schema_type && $post->post_type=='gd_event'){$schema_type = 'Event';}
1361
+        if ($cat_schema) {$schema_type = $cat_schema; }
1362
+        if (!$schema_type && $post->post_type == 'gd_event') {$schema_type = 'Event'; }
1363 1363
     }
1364 1364
 
1365 1365
     $schema = array();
1366 1366
     $schema['@context'] = "https://schema.org";
1367 1367
     $schema['@type'] = $schema_type;
1368 1368
     $schema['name'] = $post->post_title;
1369
-    $schema['description'] = wp_strip_all_tags( $post->post_content, true );
1369
+    $schema['description'] = wp_strip_all_tags($post->post_content, true);
1370 1370
     $schema['telephone'] = $post->geodir_contact;
1371 1371
     $schema['url'] = $c_url;
1372 1372
     $schema['sameAs'] = $external_links;
@@ -1380,7 +1380,7 @@  discard block
 block discarded – undo
1380 1380
         "postalCode" => $post->post_zip
1381 1381
     );
1382 1382
 
1383
-    if($post->post_latitude && $post->post_longitude) {
1383
+    if ($post->post_latitude && $post->post_longitude) {
1384 1384
         $schema['geo'] = array(
1385 1385
             "@type" => "GeoCoordinates",
1386 1386
             "latitude" => $post->post_latitude,
@@ -1388,7 +1388,7 @@  discard block
 block discarded – undo
1388 1388
         );
1389 1389
     }
1390 1390
 
1391
-    if($post_avgratings) {
1391
+    if ($post_avgratings) {
1392 1392
         $schema['aggregateRating'] = array(
1393 1393
             "@type" => "AggregateRating",
1394 1394
             "ratingValue" => $post_avgratings,
@@ -1407,10 +1407,10 @@  discard block
 block discarded – undo
1407 1407
      * @param array $schema The array of schema data to be filtered.
1408 1408
      * @param object $post The post object.
1409 1409
      */
1410
-    $schema = apply_filters('geodir_details_schema', $schema,$post);
1410
+    $schema = apply_filters('geodir_details_schema', $schema, $post);
1411 1411
 
1412 1412
 
1413
-    echo '<script type="application/ld+json">' . json_encode($schema) . '</script>';
1413
+    echo '<script type="application/ld+json">'.json_encode($schema).'</script>';
1414 1414
 
1415 1415
 
1416 1416
     $uploads = wp_upload_dir();
@@ -1423,7 +1423,7 @@  discard block
 block discarded – undo
1423 1423
      * @param string $facebook_og The open graph html to be filtered.
1424 1424
      * @param object $post The post object.
1425 1425
      */
1426
-    echo apply_filters('geodir_details_facebook_og', $facebook_og,$post);
1426
+    echo apply_filters('geodir_details_facebook_og', $facebook_og, $post);
1427 1427
 
1428 1428
 
1429 1429
 
@@ -1446,9 +1446,9 @@  discard block
 block discarded – undo
1446 1446
     ?>
1447 1447
     <div class="geodir-pos_navigation clearfix">
1448 1448
     <div
1449
-        class="geodir-post_left"><?php previous_post_link('%link', '' . __('Previous', 'geodirectory'), false) ?></div>
1449
+        class="geodir-post_left"><?php previous_post_link('%link', ''.__('Previous', 'geodirectory'), false) ?></div>
1450 1450
     <div
1451
-        class="geodir-post_right"><?php next_post_link('%link', __('Next', 'geodirectory') . '', false) ?></div>
1451
+        class="geodir-post_right"><?php next_post_link('%link', __('Next', 'geodirectory').'', false) ?></div>
1452 1452
     </div><?php
1453 1453
 }
1454 1454
 
@@ -1517,12 +1517,12 @@  discard block
 block discarded – undo
1517 1517
     $gd_post_type = geodir_get_current_posttype();
1518 1518
     $post_type_info = get_post_type_object($gd_post_type);
1519 1519
 
1520
-    $add_string_in_title = __('All', 'geodirectory') . ' ';
1520
+    $add_string_in_title = __('All', 'geodirectory').' ';
1521 1521
     if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite') {
1522
-        $add_string_in_title = __('My Favorite', 'geodirectory') . ' ';
1522
+        $add_string_in_title = __('My Favorite', 'geodirectory').' ';
1523 1523
     }
1524 1524
 
1525
-    $list_title = $add_string_in_title . __($post_type_info->labels->name, 'geodirectory');
1525
+    $list_title = $add_string_in_title.__($post_type_info->labels->name, 'geodirectory');
1526 1526
     $single_name = $post_type_info->labels->singular_name;
1527 1527
 
1528 1528
     $taxonomy = geodir_get_taxonomies($gd_post_type, true);
@@ -1550,12 +1550,12 @@  discard block
 block discarded – undo
1550 1550
         $current_term = get_term_by('slug', $term, $taxonomy[0]);
1551 1551
         if (!empty($current_term)) {
1552 1552
             $current_term_name = __(geodir_utf8_ucfirst($current_term->name), 'geodirectory');
1553
-            if ($current_term_name != '' && $location_name != '' && isset($current_term->taxonomy) && $current_term->taxonomy == $gd_post_type . 'category') {
1553
+            if ($current_term_name != '' && $location_name != '' && isset($current_term->taxonomy) && $current_term->taxonomy == $gd_post_type.'category') {
1554 1554
                 $location_last_char = substr($location_name, -1);
1555 1555
                 $location_name_attach = geodir_strtolower($location_last_char) == 's' ? __("'", 'geodirectory') : __("'s", 'geodirectory');
1556
-                $list_title .= __(' in', 'geodirectory') . ' ' . $location_name . $location_name_attach . ' ' . $current_term_name;
1556
+                $list_title .= __(' in', 'geodirectory').' '.$location_name.$location_name_attach.' '.$current_term_name;
1557 1557
             } else {
1558
-                $list_title .= __(' in', 'geodirectory') . " '" . $current_term_name . "'";
1558
+                $list_title .= __(' in', 'geodirectory')." '".$current_term_name."'";
1559 1559
             }
1560 1560
         } else {
1561 1561
             if (count($taxonomy) > 1) {
@@ -1563,12 +1563,12 @@  discard block
 block discarded – undo
1563 1563
 
1564 1564
                 if (!empty($current_term)) {
1565 1565
                     $current_term_name = __(geodir_utf8_ucfirst($current_term->name), 'geodirectory');
1566
-                    if ($current_term_name != '' && $location_name != '' && isset($current_term->taxonomy) && $current_term->taxonomy == $gd_post_type . 'category') {
1566
+                    if ($current_term_name != '' && $location_name != '' && isset($current_term->taxonomy) && $current_term->taxonomy == $gd_post_type.'category') {
1567 1567
                         $location_last_char = substr($location_name, -1);
1568 1568
                         $location_name_attach = geodir_strtolower($location_last_char) == 's' ? __("'", 'geodirectory') : __("'s", 'geodirectory');
1569
-                        $list_title .= __(' in', 'geodirectory') . ' ' . $location_name . $location_name_attach . ' ' . $current_term_name;
1569
+                        $list_title .= __(' in', 'geodirectory').' '.$location_name.$location_name_attach.' '.$current_term_name;
1570 1570
                     } else {
1571
-                        $list_title .= __(' in', 'geodirectory') . " '" . $current_term_name . "'";
1571
+                        $list_title .= __(' in', 'geodirectory')." '".$current_term_name."'";
1572 1572
                     }
1573 1573
                 }
1574 1574
             }
@@ -1596,7 +1596,7 @@  discard block
 block discarded – undo
1596 1596
                 $gd_city = __(geodir_ucwords($gd_city), 'geodirectory');
1597 1597
             }
1598 1598
 
1599
-            $list_title .= __(' in', 'geodirectory') . " '" . $gd_city . "'";
1599
+            $list_title .= __(' in', 'geodirectory')." '".$gd_city."'";
1600 1600
         } else if ($gd_region != '') {
1601 1601
             if ($gd_region_actual != '') {
1602 1602
                 $gd_region = $gd_region_actual;
@@ -1606,7 +1606,7 @@  discard block
 block discarded – undo
1606 1606
                 $gd_region = __(geodir_ucwords($gd_region), 'geodirectory');
1607 1607
             }
1608 1608
 
1609
-            $list_title .= __(' in', 'geodirectory') . " '" . $gd_region . "'";
1609
+            $list_title .= __(' in', 'geodirectory')." '".$gd_region."'";
1610 1610
         } else if ($gd_country != '') {
1611 1611
             if ($gd_country_actual != '') {
1612 1612
                 $gd_country = $gd_country_actual;
@@ -1616,12 +1616,12 @@  discard block
 block discarded – undo
1616 1616
                 $gd_country = __(geodir_ucwords($gd_country), 'geodirectory');
1617 1617
             }
1618 1618
 
1619
-            $list_title .= __(' in', 'geodirectory') . " '" . $gd_country . "'";
1619
+            $list_title .= __(' in', 'geodirectory')." '".$gd_country."'";
1620 1620
         }
1621 1621
     }
1622 1622
 
1623 1623
     if (is_search()) {
1624
-        $list_title = __('Search', 'geodirectory') . ' ' . __(geodir_utf8_ucfirst($post_type_info->labels->name), 'geodirectory') . __(' For :', 'geodirectory') . " '" . get_search_query() . "'";
1624
+        $list_title = __('Search', 'geodirectory').' '.__(geodir_utf8_ucfirst($post_type_info->labels->name), 'geodirectory').__(' For :', 'geodirectory')." '".get_search_query()."'";
1625 1625
     }
1626 1626
     /** This action is documented in geodirectory_template_actions.php */
1627 1627
     $class = apply_filters('geodir_page_title_class', 'entry-title fn');
@@ -1631,26 +1631,26 @@  discard block
 block discarded – undo
1631 1631
 
1632 1632
     $title = $list_title;
1633 1633
     $gd_page = '';
1634
-    if(geodir_is_page('pt')){
1634
+    if (geodir_is_page('pt')) {
1635 1635
         $gd_page = 'pt';
1636
-        $title  = (get_option('geodir_page_title_pt')) ? get_option('geodir_page_title_pt') : $title;
1636
+        $title = (get_option('geodir_page_title_pt')) ? get_option('geodir_page_title_pt') : $title;
1637 1637
     }
1638
-    elseif(geodir_is_page('listing')){
1638
+    elseif (geodir_is_page('listing')) {
1639 1639
         $gd_page = 'listing';
1640 1640
         global $wp_query;
1641 1641
         $current_term = $wp_query->get_queried_object();
1642
-        if (strpos($current_term->taxonomy,'_tags') !== false) {
1642
+        if (strpos($current_term->taxonomy, '_tags') !== false) {
1643 1643
             $title = (get_option('geodir_page_title_tag-listing')) ? get_option('geodir_page_title_tag-listing') : $title;
1644
-        }else{
1644
+        } else {
1645 1645
             $title = (get_option('geodir_page_title_cat-listing')) ? get_option('geodir_page_title_cat-listing') : $title;
1646 1646
         }
1647 1647
 
1648 1648
     }
1649
-    elseif(geodir_is_page('author')){
1649
+    elseif (geodir_is_page('author')) {
1650 1650
         $gd_page = 'author';
1651
-        if(isset($_REQUEST['list']) && $_REQUEST['list']=='favourite'){
1651
+        if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite') {
1652 1652
             $title = (get_option('geodir_page_title_favorite')) ? get_option('geodir_page_title_favorite') : $title;
1653
-        }else{
1653
+        } else {
1654 1654
             $title = (get_option('geodir_page_title_author')) ? get_option('geodir_page_title_author') : $title;
1655 1655
         }
1656 1656
 
@@ -1664,16 +1664,16 @@  discard block
 block discarded – undo
1664 1664
      * @param string $title The page title including variables.
1665 1665
      * @param string $gd_page The GeoDirectory page type if any.
1666 1666
      */
1667
-    $title =  apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
1667
+    $title = apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
1668 1668
 
1669
-    echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' .
1669
+    echo '<header class="'.$class_header.'"><h1 class="'.$class.'">'.
1670 1670
         /**
1671 1671
          * Filter the listing page title.
1672 1672
          *
1673 1673
          * @since 1.0.0
1674 1674
          * @param string $list_title The title for the category page.
1675 1675
          */
1676
-        apply_filters('geodir_listing_page_title', $title) . '</h1></header>';
1676
+        apply_filters('geodir_listing_page_title', $title).'</h1></header>';
1677 1677
 }
1678 1678
 
1679 1679
 add_action('geodir_listings_page_description', 'geodir_action_listings_description', 10);
@@ -1692,16 +1692,16 @@  discard block
 block discarded – undo
1692 1692
     $gd_post_type = geodir_get_current_posttype();
1693 1693
     if (isset($current_term->term_id) && $current_term->term_id != '') {
1694 1694
 
1695
-        $term_desc = term_description($current_term->term_id, $gd_post_type . '_tags');
1695
+        $term_desc = term_description($current_term->term_id, $gd_post_type.'_tags');
1696 1696
         $saved_data = stripslashes(get_tax_meta($current_term->term_id, 'ct_cat_top_desc', false, $gd_post_type));
1697 1697
         if ($term_desc && !$saved_data) {
1698 1698
             $saved_data = $term_desc;
1699 1699
         }
1700 1700
 
1701 1701
         // stop payment manager filtering content length
1702
-        $filter_priority = has_filter( 'the_content', 'geodir_payments_the_content' );
1703
-        if ( false !== $filter_priority ) {
1704
-            remove_filter( 'the_content', 'geodir_payments_the_content', $filter_priority );
1702
+        $filter_priority = has_filter('the_content', 'geodir_payments_the_content');
1703
+        if (false !== $filter_priority) {
1704
+            remove_filter('the_content', 'geodir_payments_the_content', $filter_priority);
1705 1705
         }
1706 1706
 
1707 1707
         /**
@@ -1715,14 +1715,14 @@  discard block
 block discarded – undo
1715 1715
         $cat_description = apply_filters('the_content', $saved_data);
1716 1716
 
1717 1717
 
1718
-        if ( false !== $filter_priority ) {
1719
-            add_filter( 'the_content', 'geodir_payments_the_content', $filter_priority );
1718
+        if (false !== $filter_priority) {
1719
+            add_filter('the_content', 'geodir_payments_the_content', $filter_priority);
1720 1720
         }
1721 1721
 
1722 1722
         if ($cat_description) {
1723 1723
             ?>
1724 1724
 
1725
-            <div class="term_description"><?php echo $cat_description;?></div> <?php
1725
+            <div class="term_description"><?php echo $cat_description; ?></div> <?php
1726 1726
         }
1727 1727
 
1728 1728
     }
@@ -1772,13 +1772,13 @@  discard block
 block discarded – undo
1772 1772
 function geodir_action_sidebar_left_open($type = '', $id = '', $class = '', $itemtype = '')
1773 1773
 {
1774 1774
     if ($type == 'home-page' && $width = get_option('geodir_width_home_left_section')) {
1775
-        $width_css = 'style="width:' . $width . '%;"';
1775
+        $width_css = 'style="width:'.$width.'%;"';
1776 1776
     } elseif ($type == 'listings-page' && $width = get_option('geodir_width_listing_left_section')) {
1777
-        $width_css = 'style="width:' . $width . '%;"';
1777
+        $width_css = 'style="width:'.$width.'%;"';
1778 1778
     } elseif ($type == 'search-page' && $width = get_option('geodir_width_search_left_section')) {
1779
-        $width_css = 'style="width:' . $width . '%;"';
1779
+        $width_css = 'style="width:'.$width.'%;"';
1780 1780
     } elseif ($type == 'author-page' && $width = get_option('geodir_width_author_left_section')) {
1781
-        $width_css = 'style="width:' . $width . '%;"';
1781
+        $width_css = 'style="width:'.$width.'%;"';
1782 1782
     } else {
1783 1783
         $width_css = '';
1784 1784
     }
@@ -2083,11 +2083,11 @@  discard block
 block discarded – undo
2083 2083
 
2084 2084
     $title = apply_filters('geodir_add_listing_page_title_text', get_the_title());
2085 2085
 
2086
-    if(geodir_is_page('add-listing')){
2086
+    if (geodir_is_page('add-listing')) {
2087 2087
         $gd_page = 'add-listing';
2088
-        if(isset($_REQUEST['pid']) && $_REQUEST['pid'] != ''){
2088
+        if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
2089 2089
             $title = (get_option('geodir_page_title_edit-listing')) ? get_option('geodir_page_title_edit-listing') : $title;
2090
-        }elseif(isset($listing_type)){
2090
+        }elseif (isset($listing_type)) {
2091 2091
             $title = (get_option('geodir_page_title_add-listing')) ? get_option('geodir_page_title_add-listing') : $title;
2092 2092
         }
2093 2093
 
@@ -2101,9 +2101,9 @@  discard block
 block discarded – undo
2101 2101
      * @param string $title The page title including variables.
2102 2102
      * @param string $gd_page The GeoDirectory page type if any.
2103 2103
      */
2104
-    $title =  apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
2104
+    $title = apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
2105 2105
 
2106
-    echo '<header class="' . $class_header . '"><h1 class="' . $class . '">';
2106
+    echo '<header class="'.$class_header.'"><h1 class="'.$class.'">';
2107 2107
     echo $title;
2108 2108
     echo '</h1></header>';
2109 2109
 }
@@ -2117,7 +2117,7 @@  discard block
 block discarded – undo
2117 2117
  */
2118 2118
 function geodir_action_add_listing_page_mandatory()
2119 2119
 {?>
2120
-    <p class="geodir-note "><span class="geodir-required">*</span>&nbsp;<?php echo INDICATES_MANDATORY_FIELDS_TEXT;?></p>
2120
+    <p class="geodir-note "><span class="geodir-required">*</span>&nbsp;<?php echo INDICATES_MANDATORY_FIELDS_TEXT; ?></p>
2121 2121
 <?php
2122 2122
 }
2123 2123
 
@@ -2152,7 +2152,7 @@  discard block
 block discarded – undo
2152 2152
 
2153 2153
     if (isset($_REQUEST['backandedit'])) {
2154 2154
         global $post;
2155
-        $post = (object)$gd_session->get('listing');
2155
+        $post = (object) $gd_session->get('listing');
2156 2156
         $listing_type = $post->listing_type;
2157 2157
         $title = $post->post_title;
2158 2158
         $desc = $post->post_desc;
@@ -2167,7 +2167,7 @@  discard block
 block discarded – undo
2167 2167
         $thumb_img_arr = geodir_get_images($post->ID);
2168 2168
         if ($thumb_img_arr) {
2169 2169
             foreach ($thumb_img_arr as $post_img) {
2170
-                $curImages .= $post_img->src . ',';
2170
+                $curImages .= $post_img->src.',';
2171 2171
             }
2172 2172
         }
2173 2173
 
@@ -2175,7 +2175,7 @@  discard block
 block discarded – undo
2175 2175
         $title = $post->post_title;
2176 2176
         $desc = $post->post_content;
2177 2177
         $kw_tags = $post->post_tags;
2178
-        $kw_tags = implode(",", wp_get_object_terms($post->ID, $listing_type . '_tags', array('fields' => 'names')));
2178
+        $kw_tags = implode(",", wp_get_object_terms($post->ID, $listing_type.'_tags', array('fields' => 'names')));
2179 2179
     } else {
2180 2180
         $listing_type = sanitize_text_field($_REQUEST['listing_type']);
2181 2181
     }
@@ -2186,20 +2186,20 @@  discard block
 block discarded – undo
2186 2186
 
2187 2187
     $post_type_info = geodir_get_posttype_info($listing_type);
2188 2188
 
2189
-    $cpt_singular_name = (isset($post_type_info['labels']['singular_name']) && $post_type_info['labels']['singular_name']) ? __($post_type_info['labels']['singular_name'], 'geodirectory') : __('Listing','geodirectory');
2189
+    $cpt_singular_name = (isset($post_type_info['labels']['singular_name']) && $post_type_info['labels']['singular_name']) ? __($post_type_info['labels']['singular_name'], 'geodirectory') : __('Listing', 'geodirectory');
2190 2190
     
2191 2191
     $package_info = array();
2192 2192
     $package_info = geodir_post_package_info($package_info, $post);
2193 2193
     ?>
2194
-    <form name="propertyform" id="propertyform" action="<?php echo get_page_link(geodir_preview_page_id());?>" method="post" enctype="multipart/form-data">
2195
-        <input type="hidden" name="preview" value="<?php echo sanitize_text_field($listing_type);?>"/>
2196
-        <input type="hidden" name="listing_type" value="<?php echo sanitize_text_field($listing_type);?>"/>
2194
+    <form name="propertyform" id="propertyform" action="<?php echo get_page_link(geodir_preview_page_id()); ?>" method="post" enctype="multipart/form-data">
2195
+        <input type="hidden" name="preview" value="<?php echo sanitize_text_field($listing_type); ?>"/>
2196
+        <input type="hidden" name="listing_type" value="<?php echo sanitize_text_field($listing_type); ?>"/>
2197 2197
         <?php if ($page_id) { ?>
2198
-        <input type="hidden" name="add_listing_page_id" value="<?php echo $page_id;?>"/>
2198
+        <input type="hidden" name="add_listing_page_id" value="<?php echo $page_id; ?>"/>
2199 2199
         <?php } if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') { ?>
2200
-            <input type="hidden" name="pid" value="<?php echo sanitize_text_field($_REQUEST['pid']);?>"/>
2200
+            <input type="hidden" name="pid" value="<?php echo sanitize_text_field($_REQUEST['pid']); ?>"/>
2201 2201
         <?php } if (isset($_REQUEST['backandedit'])) { ?>
2202
-            <input type="hidden" name="backandedit" value="<?php echo sanitize_text_field($_REQUEST['backandedit']);?>"/>
2202
+            <input type="hidden" name="backandedit" value="<?php echo sanitize_text_field($_REQUEST['backandedit']); ?>"/>
2203 2203
         <?php
2204 2204
         } 
2205 2205
         /**
@@ -2211,7 +2211,7 @@  discard block
 block discarded – undo
2211 2211
          */
2212 2212
         do_action('geodir_before_detail_fields');
2213 2213
         ?>
2214
-        <h5 id="geodir_fieldset_details" class="geodir-fieldset-row" gd-fieldset="details"><?php echo LISTING_DETAILS_TEXT;?></h5>
2214
+        <h5 id="geodir_fieldset_details" class="geodir-fieldset-row" gd-fieldset="details"><?php echo LISTING_DETAILS_TEXT; ?></h5>
2215 2215
         <?php
2216 2216
         /**
2217 2217
          * Called at the top of the add listing page form for frontend.
@@ -2232,10 +2232,10 @@  discard block
 block discarded – undo
2232 2232
                  * @param string $cpt_singular_name The singular title of the curent CPT.
2233 2233
                  * @param string $listing_type The CPT being requested. ie: gd_place.
2234 2234
                  */
2235
-                echo apply_filters('geodir_add_listing_title_label', sprintf( __('%s Title', 'geodirectory'), $cpt_singular_name ),$cpt_singular_name,$listing_type); ?><span>*</span> </label>
2235
+                echo apply_filters('geodir_add_listing_title_label', sprintf(__('%s Title', 'geodirectory'), $cpt_singular_name), $cpt_singular_name, $listing_type); ?><span>*</span> </label>
2236 2236
             <input type="text" field_type="text" name="post_title" id="post_title" class="geodir_textfield"
2237 2237
                    value="<?php echo esc_attr(stripslashes($title)); ?>"/>
2238
-            <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory');?></span>
2238
+            <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?></span>
2239 2239
         </div>
2240 2240
         <?php
2241 2241
         $show_editor = get_option('geodir_tiny_editor_on_add_listing');
@@ -2281,7 +2281,7 @@  discard block
 block discarded – undo
2281 2281
         $desc_limit_msg = apply_filters('geodir_description_field_desc_limit_msg', $desc_limit_msg, $desc_limit);
2282 2282
         
2283 2283
         $desc_class = '';
2284
-        if ($desc_limit === '' || (int)$desc_limit > 0) {
2284
+        if ($desc_limit === '' || (int) $desc_limit > 0) {
2285 2285
             /**
2286 2286
              * Called on the add listing page form for frontend just before the description field.
2287 2287
              *
@@ -2294,7 +2294,7 @@  discard block
 block discarded – undo
2294 2294
             $desc_class = ' hidden';
2295 2295
         }
2296 2296
         ?>
2297
-        <div id="geodir_post_desc_row" class="geodir_form_row clearfix gd-fieldset-details<?php echo $desc_class;?>">
2297
+        <div id="geodir_post_desc_row" class="geodir_form_row clearfix gd-fieldset-details<?php echo $desc_class; ?>">
2298 2298
             <label><?php
2299 2299
                 /**
2300 2300
                  * Filter the add listing page description input label.
@@ -2304,7 +2304,7 @@  discard block
 block discarded – undo
2304 2304
                  * @param string $cpt_singular_name The singular title of the curent CPT.
2305 2305
                  * @param string $listing_type The CPT being requested. ie: gd_place.
2306 2306
                  */
2307
-                echo apply_filters('geodir_add_listing_description_label',sprintf( __('%s Description', 'geodirectory'), $cpt_singular_name ),$cpt_singular_name,$listing_type); ?><span><?php if ($desc_limit != '0') { echo '*'; } ?></span> </label>
2307
+                echo apply_filters('geodir_add_listing_description_label', sprintf(__('%s Description', 'geodirectory'), $cpt_singular_name), $cpt_singular_name, $listing_type); ?><span><?php if ($desc_limit != '0') { echo '*'; } ?></span> </label>
2308 2308
             <?php
2309 2309
             if ($show_editor) {
2310 2310
                 $editor_settings = array('media_buttons' => false, 'textarea_rows' => 10);
@@ -2313,16 +2313,16 @@  discard block
 block discarded – undo
2313 2313
                     <?php wp_editor($desc, "post_desc", $editor_settings); ?>
2314 2314
                 </div>
2315 2315
             <?php if ($desc_limit != '') { ?>
2316
-                <script type="text/javascript">jQuery('textarea#post_desc').attr('maxlength', "<?php echo $desc_limit;?>");</script>
2316
+                <script type="text/javascript">jQuery('textarea#post_desc').attr('maxlength', "<?php echo $desc_limit; ?>");</script>
2317 2317
             <?php } } else { ?>
2318 2318
                 <textarea field_type="textarea" name="post_desc" id="post_desc" class="geodir_textarea" maxlength="<?php echo $desc_limit; ?>"><?php echo $desc; ?></textarea>
2319 2319
             <?php } if ($desc_limit_msg != '') { ?>
2320 2320
                 <span class="geodir_message_note"><?php echo $desc_limit_msg; ?></span>
2321 2321
             <?php } ?>
2322
-            <span class="geodir_message_error"><?php echo _e($required_msg, 'geodirectory');?></span>
2322
+            <span class="geodir_message_error"><?php echo _e($required_msg, 'geodirectory'); ?></span>
2323 2323
         </div>
2324 2324
         <?php
2325
-        if ($desc_limit === '' || (int)$desc_limit > 0) {
2325
+        if ($desc_limit === '' || (int) $desc_limit > 0) {
2326 2326
             /**
2327 2327
              * Called on the add listing page form for frontend just after the description field.
2328 2328
              *
@@ -2361,7 +2361,7 @@  discard block
 block discarded – undo
2361 2361
         $kw_tags_msg = apply_filters('geodir_listing_tags_field_tags_msg', $kw_tags_msg, $kw_tags_count);
2362 2362
         
2363 2363
         $tags_class = '';
2364
-        if ($kw_tags_count === '' || (int)$kw_tags_count > 0) {
2364
+        if ($kw_tags_count === '' || (int) $kw_tags_count > 0) {
2365 2365
             /**
2366 2366
              * Called on the add listing page form for frontend just before the tags field.
2367 2367
              *
@@ -2372,14 +2372,14 @@  discard block
 block discarded – undo
2372 2372
             $tags_class = ' hidden';
2373 2373
         }
2374 2374
         ?>
2375
-        <div id="geodir_post_tags_row" class="geodir_form_row clearfix gd-fieldset-details<?php echo $tags_class;?>">
2375
+        <div id="geodir_post_tags_row" class="geodir_form_row clearfix gd-fieldset-details<?php echo $tags_class; ?>">
2376 2376
             <label><?php echo TAGKW_TEXT; ?></label>
2377 2377
             <input name="post_tags" id="post_tags" value="<?php echo $kw_tags; ?>" type="text" class="geodir_textfield"
2378
-                   maxlength="<?php echo $kw_tags_count;?>"/>
2379
-            <span class="geodir_message_note"><?php echo $kw_tags_msg;?></span>
2378
+                   maxlength="<?php echo $kw_tags_count; ?>"/>
2379
+            <span class="geodir_message_note"><?php echo $kw_tags_msg; ?></span>
2380 2380
         </div>
2381 2381
         <?php
2382
-        if ($kw_tags_count === '' || (int)$kw_tags_count > 0) {
2382
+        if ($kw_tags_count === '' || (int) $kw_tags_count > 0) {
2383 2383
             /**
2384 2384
              * Called on the add listing page form for frontend just after the tags field.
2385 2385
              *
@@ -2405,7 +2405,7 @@  discard block
 block discarded – undo
2405 2405
         $thumb_img_arr = array();
2406 2406
         $totImg = 0;
2407 2407
         if (isset($_REQUEST['backandedit']) && empty($_REQUEST['pid'])) {
2408
-            $post = (object)$gd_session->get('listing');
2408
+            $post = (object) $gd_session->get('listing');
2409 2409
             if (isset($post->post_images))
2410 2410
                 $curImages = trim($post->post_images, ",");
2411 2411
 
@@ -2418,7 +2418,7 @@  discard block
 block discarded – undo
2418 2418
             $listing_type = $post->listing_type;
2419 2419
 
2420 2420
         } elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
2421
-            $post = geodir_get_post_info((int)$_REQUEST['pid']);
2421
+            $post = geodir_get_post_info((int) $_REQUEST['pid']);
2422 2422
             $listing_type = $post->post_type;
2423 2423
             $thumb_img_arr = geodir_get_images($_REQUEST['pid']);
2424 2424
 
@@ -2432,7 +2432,7 @@  discard block
 block discarded – undo
2432 2432
                 //$curImages = $img->src.",";
2433 2433
             }
2434 2434
 
2435
-            $totImg = count((array)$thumb_img_arr);
2435
+            $totImg = count((array) $thumb_img_arr);
2436 2436
         }
2437 2437
 
2438 2438
         if ($curImages != '')
@@ -2453,15 +2453,15 @@  discard block
 block discarded – undo
2453 2453
         if ($show_image_input_box) {
2454 2454
             ?>
2455 2455
 
2456
-            <h5 id="geodir_form_title_row" class="geodir-form_title"> <?php echo PRO_PHOTO_TEXT;?>
2456
+            <h5 id="geodir_form_title_row" class="geodir-form_title"> <?php echo PRO_PHOTO_TEXT; ?>
2457 2457
                 <?php if ($image_limit == 1) {
2458
-                    echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('image with this package', 'geodirectory') . ')</small>';
2458
+                    echo '<br /><small>('.__('You can upload', 'geodirectory').' '.$image_limit.' '.__('image with this package', 'geodirectory').')</small>';
2459 2459
                 } ?>
2460 2460
                 <?php if ($image_limit > 1) {
2461
-                    echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('images with this package', 'geodirectory') . ')</small>';
2461
+                    echo '<br /><small>('.__('You can upload', 'geodirectory').' '.$image_limit.' '.__('images with this package', 'geodirectory').')</small>';
2462 2462
                 } ?>
2463 2463
                 <?php if ($image_limit == '') {
2464
-                    echo '<br /><small>(' . __('You can upload unlimited images with this package', 'geodirectory') . ')</small>';
2464
+                    echo '<br /><small>('.__('You can upload unlimited images with this package', 'geodirectory').')</small>';
2465 2465
                 } ?>
2466 2466
             </h5>
2467 2467
 
@@ -2476,11 +2476,11 @@  discard block
 block discarded – undo
2476 2476
                 <div
2477 2477
                     class="plupload-upload-uic hide-if-no-js <?php if ($multiple): ?>plupload-upload-uic-multiple<?php endif; ?>"
2478 2478
                     id="<?php echo $id; ?>plupload-upload-ui">
2479
-                    <h4><?php _e('Drop files to upload', 'geodirectory');?></h4><br/>
2479
+                    <h4><?php _e('Drop files to upload', 'geodirectory'); ?></h4><br/>
2480 2480
                     <input id="<?php echo $id; ?>plupload-browse-button" type="button"
2481 2481
                            value="<?php esc_attr_e('Select Files', 'geodirectory'); ?>" class="geodir_button"/>
2482 2482
                     <span class="ajaxnonceplu"
2483
-                          id="ajaxnonceplu<?php echo wp_create_nonce($id . 'pluploadan'); ?>"></span>
2483
+                          id="ajaxnonceplu<?php echo wp_create_nonce($id.'pluploadan'); ?>"></span>
2484 2484
                     <?php if ($width && $height): ?>
2485 2485
                         <span class="plupload-resize"></span>
2486 2486
                         <span class="plupload-width" id="plupload-width<?php echo $width; ?>"></span>
@@ -2493,7 +2493,7 @@  discard block
 block discarded – undo
2493 2493
                      id="<?php echo $id; ?>plupload-thumbs" style="border-top:1px solid #ccc; padding-top:10px;">
2494 2494
                 </div>
2495 2495
                 <span
2496
-                    id="upload-msg"><?php _e('Please drag &amp; drop the images to rearrange the order', 'geodirectory');?></span>
2496
+                    id="upload-msg"><?php _e('Please drag &amp; drop the images to rearrange the order', 'geodirectory'); ?></span>
2497 2497
                 <span id="<?php echo $id; ?>upload-error" style="display:none"></span>
2498 2498
             </div>
2499 2499
 
@@ -2505,7 +2505,7 @@  discard block
 block discarded – undo
2505 2505
          *
2506 2506
          * @since 1.0.0
2507 2507
          */
2508
-        do_action('geodir_after_main_form_fields');?>
2508
+        do_action('geodir_after_main_form_fields'); ?>
2509 2509
 
2510 2510
 
2511 2511
         <!-- add captcha code -->
@@ -2516,7 +2516,7 @@  discard block
 block discarded – undo
2516 2516
         </script>
2517 2517
         <noscript>
2518 2518
             <div>
2519
-                <label><?php _e('Type 64 into this box', 'geodirectory');?></label>
2519
+                <label><?php _e('Type 64 into this box', 'geodirectory'); ?></label>
2520 2520
                 <input type="text" id="geodir_spamblocker_top_form" name="geodir_spamblocker" value="" maxlength="10"/>
2521 2521
             </div>
2522 2522
         </noscript>
@@ -2526,10 +2526,10 @@  discard block
 block discarded – undo
2526 2526
         <!-- end captcha code -->
2527 2527
 
2528 2528
         <div id="geodir-add-listing-submit" class="geodir_form_row clear_both" style="padding:2px;text-align:center;">
2529
-            <input type="submit" value="<?php echo PRO_PREVIEW_BUTTON;?>"
2530
-                   class="geodir_button" <?php echo $submit_button;?>/>
2529
+            <input type="submit" value="<?php echo PRO_PREVIEW_BUTTON; ?>"
2530
+                   class="geodir_button" <?php echo $submit_button; ?>/>
2531 2531
             <span class="geodir_message_note"
2532
-                  style="padding-left:0px;"> <?php _e('Note: You will be able to see a preview in the next page', 'geodirectory');?></span>
2532
+                  style="padding-left:0px;"> <?php _e('Note: You will be able to see a preview in the next page', 'geodirectory'); ?></span>
2533 2533
         </div>
2534 2534
 
2535 2535
     </form>
@@ -2591,7 +2591,7 @@  discard block
 block discarded – undo
2591 2591
         class="<?php
2592 2592
         /** This action is documented in geodirectory_template_actions.php */
2593 2593
         echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'Reg/Login Top Section'); ?>">
2594
-        <?php dynamic_sidebar('Reg/Login Top Section');?>
2594
+        <?php dynamic_sidebar('Reg/Login Top Section'); ?>
2595 2595
     </div><!-- clearfix ends here-->
2596 2596
 <?php
2597 2597
 }
@@ -2611,11 +2611,11 @@  discard block
 block discarded – undo
2611 2611
 
2612 2612
     global $user_login;
2613 2613
     
2614
-    $is_enable_signup = get_option( 'users_can_register' );
2614
+    $is_enable_signup = get_option('users_can_register');
2615 2615
     
2616 2616
     ?>
2617 2617
     <script type="text/javascript">
2618
-        <?php if ( $user_login ) { ?>
2618
+        <?php if ($user_login) { ?>
2619 2619
         setTimeout(function () {
2620 2620
             try {
2621 2621
                 d = document.getElementById('user_pass');
@@ -2632,7 +2632,7 @@  discard block
 block discarded – undo
2632 2632
         <?php } ?>
2633 2633
     </script>
2634 2634
     <script type="text/javascript">
2635
-        <?php if ( $user_login ) { ?>
2635
+        <?php if ($user_login) { ?>
2636 2636
         setTimeout(function () {
2637 2637
             try {
2638 2638
                 d = document.getElementById('user_pass');
@@ -2657,7 +2657,7 @@  discard block
 block discarded – undo
2657 2657
         foreach ($errors as $errorsObj) {
2658 2658
             foreach ($errorsObj as $key => $val) {
2659 2659
                 for ($i = 0; $i < count($val); $i++) {
2660
-                    echo "<div class=error_msg_fix>" . $val[$i] . '</div>';
2660
+                    echo "<div class=error_msg_fix>".$val[$i].'</div>';
2661 2661
                     $registration_error_msg = 1;
2662 2662
                 }
2663 2663
             }
@@ -2674,10 +2674,10 @@  discard block
 block discarded – undo
2674 2674
              *
2675 2675
              * @since 1.0.0
2676 2676
              */
2677
-            include(geodir_plugin_path() . "/geodirectory-templates/login_frm.php"); ?>
2677
+            include(geodir_plugin_path()."/geodirectory-templates/login_frm.php"); ?>
2678 2678
         </div>
2679 2679
 
2680
-    <?php } elseif (isset($_REQUEST['page']) && $_REQUEST['page'] == 'login' && isset($_REQUEST['page1']) && $_REQUEST['page1'] == 'sign_up' && $is_enable_signup ) { ?>
2680
+    <?php } elseif (isset($_REQUEST['page']) && $_REQUEST['page'] == 'login' && isset($_REQUEST['page1']) && $_REQUEST['page1'] == 'sign_up' && $is_enable_signup) { ?>
2681 2681
 
2682 2682
         <div class="registration_form">
2683 2683
             <?php
@@ -2686,7 +2686,7 @@  discard block
 block discarded – undo
2686 2686
              *
2687 2687
              * @since 1.0.0
2688 2688
              */
2689
-            include(geodir_plugin_path() . "/geodirectory-templates/reg_frm.php"); ?>
2689
+            include(geodir_plugin_path()."/geodirectory-templates/reg_frm.php"); ?>
2690 2690
         </div>
2691 2691
 
2692 2692
     <?php } else { ?>
@@ -2698,10 +2698,10 @@  discard block
 block discarded – undo
2698 2698
              *
2699 2699
              * @since 1.0.0
2700 2700
              */
2701
-            include(geodir_plugin_path() . "/geodirectory-templates/login_frm.php"); ?>
2701
+            include(geodir_plugin_path()."/geodirectory-templates/login_frm.php"); ?>
2702 2702
         </div>
2703 2703
         
2704
-        <?php if ( $is_enable_signup ) { ?>
2704
+        <?php if ($is_enable_signup) { ?>
2705 2705
             <div class="registration_form_r">
2706 2706
                 <?php
2707 2707
                 /**
@@ -2709,7 +2709,7 @@  discard block
 block discarded – undo
2709 2709
                  *
2710 2710
                  * @since 1.0.0
2711 2711
                  */
2712
-                include(geodir_plugin_path() . "/geodirectory-templates/reg_frm.php"); ?>
2712
+                include(geodir_plugin_path()."/geodirectory-templates/reg_frm.php"); ?>
2713 2713
             </div>
2714 2714
         <?php } ?>
2715 2715
 
@@ -2746,12 +2746,12 @@  discard block
 block discarded – undo
2746 2746
     $gd_post_type = geodir_get_current_posttype();
2747 2747
     $post_type_info = get_post_type_object($gd_post_type);
2748 2748
 
2749
-    $add_string_in_title = __('All', 'geodirectory') . ' ';
2749
+    $add_string_in_title = __('All', 'geodirectory').' ';
2750 2750
     if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite') {
2751
-        $add_string_in_title = __('My Favorite', 'geodirectory') . ' ';
2751
+        $add_string_in_title = __('My Favorite', 'geodirectory').' ';
2752 2752
     }
2753 2753
 
2754
-    $list_title = $add_string_in_title . $post_type_info->labels->name;
2754
+    $list_title = $add_string_in_title.$post_type_info->labels->name;
2755 2755
     $single_name = $post_type_info->labels->singular_name;
2756 2756
 
2757 2757
     $taxonomy = geodir_get_taxonomies($gd_post_type);
@@ -2759,12 +2759,12 @@  discard block
 block discarded – undo
2759 2759
     if (!empty($term)) {
2760 2760
         $current_term = get_term_by('slug', $term, $taxonomy[0]);
2761 2761
         if (!empty($current_term))
2762
-            $list_title .= __(' in', 'geodirectory') . " '" . geodir_ucwords($current_term->name) . "'";
2762
+            $list_title .= __(' in', 'geodirectory')." '".geodir_ucwords($current_term->name)."'";
2763 2763
     }
2764 2764
 
2765 2765
 
2766 2766
     if (is_search()) {
2767
-        $list_title = __('Search', 'geodirectory') . ' ' . __($post_type_info->labels->name, 'geodirectory') . __(' For :', 'geodirectory') . " '" . get_search_query() . "'";
2767
+        $list_title = __('Search', 'geodirectory').' '.__($post_type_info->labels->name, 'geodirectory').__(' For :', 'geodirectory')." '".get_search_query()."'";
2768 2768
 
2769 2769
     }
2770 2770
     /** This action is documented in geodirectory_template_actions.php */
@@ -2773,11 +2773,11 @@  discard block
 block discarded – undo
2773 2773
     $class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
2774 2774
 
2775 2775
     $title = $list_title;
2776
-    if(geodir_is_page('author')){
2776
+    if (geodir_is_page('author')) {
2777 2777
         $gd_page = 'author';
2778
-        if(isset($_REQUEST['list']) && $_REQUEST['list']=='favourite'){
2778
+        if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite') {
2779 2779
             $title = (get_option('geodir_page_title_favorite')) ? get_option('geodir_page_title_favorite') : $title;
2780
-        }else{
2780
+        } else {
2781 2781
             $title = (get_option('geodir_page_title_author')) ? get_option('geodir_page_title_author') : $title;
2782 2782
         }
2783 2783
 
@@ -2791,16 +2791,16 @@  discard block
 block discarded – undo
2791 2791
      * @param string $title The page title including variables.
2792 2792
      * @param string $gd_page The GeoDirectory page type if any.
2793 2793
      */
2794
-    $title =  apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
2794
+    $title = apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
2795 2795
 
2796
-    echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' .
2796
+    echo '<header class="'.$class_header.'"><h1 class="'.$class.'">'.
2797 2797
         /**
2798 2798
          * Filter the author page title text.
2799 2799
          *
2800 2800
          * @since 1.0.0
2801 2801
          * @param string $list_title The title for the page.
2802 2802
          */
2803
-        apply_filters('geodir_author_page_title_text', $title) . '</h1></header>';
2803
+        apply_filters('geodir_author_page_title_text', $title).'</h1></header>';
2804 2804
 }
2805 2805
 
2806 2806
 
@@ -3005,19 +3005,19 @@  discard block
 block discarded – undo
3005 3005
     $post_type_info = get_post_type_object($gd_post_type);
3006 3006
 
3007 3007
     $pt_name = '';
3008
-    if(isset($post_type_info->labels->name)){$pt_name=$post_type_info->labels->name;}
3008
+    if (isset($post_type_info->labels->name)) {$pt_name = $post_type_info->labels->name; }
3009 3009
 
3010 3010
     if (is_search()) {
3011
-        $list_title = __('Search', 'geodirectory') . ' ' . __($pt_name, 'geodirectory') . __(' For :', 'geodirectory') . " '" . get_search_query() . "'";
3011
+        $list_title = __('Search', 'geodirectory').' '.__($pt_name, 'geodirectory').__(' For :', 'geodirectory')." '".get_search_query()."'";
3012 3012
 
3013 3013
     }
3014 3014
     /** This action is documented in geodirectory_template_actions.php */
3015 3015
     $class = apply_filters('geodir_page_title_class', 'entry-title fn');
3016 3016
     /** This action is documented in geodirectory_template_actions.php */
3017 3017
     $class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
3018
-    echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' .
3018
+    echo '<header class="'.$class_header.'"><h1 class="'.$class.'">'.
3019 3019
         /** This action is documented in geodirectory_template_actions.php */
3020
-        apply_filters('geodir_listing_page_title', wptexturize($list_title)) . '</h1></header>';
3020
+        apply_filters('geodir_listing_page_title', wptexturize($list_title)).'</h1></header>';
3021 3021
 }
3022 3022
 
3023 3023
 // action for adding the listings page top widget area
@@ -3421,7 +3421,7 @@  discard block
 block discarded – undo
3421 3421
         $gd_post_type = geodir_get_current_posttype();
3422 3422
         $post_type_info = get_post_type_object($gd_post_type);
3423 3423
 
3424
-        $list_title = __('Search', 'geodirectory') . ' ' . __(geodir_utf8_ucfirst($post_type_info->labels->name), 'geodirectory') . __(' :', 'geodirectory');
3424
+        $list_title = __('Search', 'geodirectory').' '.__(geodir_utf8_ucfirst($post_type_info->labels->name), 'geodirectory').__(' :', 'geodirectory');
3425 3425
     }
3426 3426
     return $list_title;
3427 3427
 }
@@ -3437,7 +3437,7 @@  discard block
 block discarded – undo
3437 3437
  * @param string $position Position to add the post content. 'before' or 'after'. Default 'before'.
3438 3438
  * @param string $gd_page The geodirectory page type. Default null.
3439 3439
  */
3440
-function geodir_add_page_content( $position = 'before', $gd_page = '' ) {
3440
+function geodir_add_page_content($position = 'before', $gd_page = '') {
3441 3441
     global $post;
3442 3442
 
3443 3443
     $gd_page_id = NULL;
@@ -3513,17 +3513,17 @@  discard block
 block discarded – undo
3513 3513
  * @param WP_Post $post           WP_Post object.
3514 3514
  * @return string Filtered SQL JOIN clause.
3515 3515
  */
3516
-function geodir_previous_next_post_join( $join, $in_same_term, $excluded_terms, $taxonomy, $post ) {
3516
+function geodir_previous_next_post_join($join, $in_same_term, $excluded_terms, $taxonomy, $post) {
3517 3517
     global $plugin_prefix;
3518 3518
 
3519
-    if ( !empty($post->post_type) && in_array( $post->post_type, geodir_get_posttypes() ) ) {
3520
-        $join .= " INNER JOIN " . $plugin_prefix . $post->post_type . "_detail AS gd ON gd.post_id = p.ID";
3519
+    if (!empty($post->post_type) && in_array($post->post_type, geodir_get_posttypes())) {
3520
+        $join .= " INNER JOIN ".$plugin_prefix.$post->post_type."_detail AS gd ON gd.post_id = p.ID";
3521 3521
     }
3522 3522
     
3523 3523
     return $join;
3524 3524
 }
3525
-add_filter( 'get_previous_post_join', 'geodir_previous_next_post_join', 10, 5 );
3526
-add_filter( 'get_next_post_join', 'geodir_previous_next_post_join', 10, 5 );
3525
+add_filter('get_previous_post_join', 'geodir_previous_next_post_join', 10, 5);
3526
+add_filter('get_next_post_join', 'geodir_previous_next_post_join', 10, 5);
3527 3527
 
3528 3528
 /**
3529 3529
  * Filters the WHERE clause in the SQL for an adjacent post query.
@@ -3541,32 +3541,32 @@  discard block
 block discarded – undo
3541 3541
  * @param WP_Post $post          WP_Post object.
3542 3542
  * @return string Filtered SQL WHERE clause.
3543 3543
  */
3544
-function geodir_previous_next_post_where( $where, $in_same_term, $excluded_terms, $taxonomy, $post ) {
3544
+function geodir_previous_next_post_where($where, $in_same_term, $excluded_terms, $taxonomy, $post) {
3545 3545
     global $wpdb, $plugin_prefix;
3546 3546
 
3547
-    if ( !empty($post->post_type) && ( !empty( $post->country_slug ) || !empty( $post->region_slug ) || !empty( $post->city_slug ) ) && in_array( $post->post_type, geodir_get_posttypes() ) ) {
3547
+    if (!empty($post->post_type) && (!empty($post->country_slug) || !empty($post->region_slug) || !empty($post->city_slug)) && in_array($post->post_type, geodir_get_posttypes())) {
3548 3548
         $post_locations = '';
3549 3549
         $post_locations_var = array();
3550 3550
         
3551
-        if ( !empty( $post->country_slug ) ) {
3551
+        if (!empty($post->country_slug)) {
3552 3552
             $post_locations .= " AND post_locations LIKE %s";
3553
-            $post_locations_var[] = "%,[" . $post->country_slug . "]";
3553
+            $post_locations_var[] = "%,[".$post->country_slug."]";
3554 3554
         }
3555 3555
 
3556
-        if ( !empty( $post->region_slug ) ) {
3556
+        if (!empty($post->region_slug)) {
3557 3557
             $post_locations .= " AND post_locations LIKE %s";
3558
-            $post_locations_var[] = "%,[" . $post->region_slug . "],%";
3558
+            $post_locations_var[] = "%,[".$post->region_slug."],%";
3559 3559
         }
3560 3560
 
3561
-        if ( !empty( $post->city_slug ) ) {
3561
+        if (!empty($post->city_slug)) {
3562 3562
             $post_locations .= " AND post_locations LIKE %s";
3563
-            $post_locations_var[] = "[" . $post->city_slug . "],%";
3563
+            $post_locations_var[] = "[".$post->city_slug."],%";
3564 3564
         }
3565 3565
         
3566
-        $where .= $wpdb->prepare( $post_locations, $post_locations_var );
3566
+        $where .= $wpdb->prepare($post_locations, $post_locations_var);
3567 3567
     }
3568 3568
     
3569 3569
     return $where;
3570 3570
 }
3571
-add_filter( 'get_previous_post_where', 'geodir_previous_next_post_where', 10, 5 );
3572
-add_filter( 'get_next_post_where', 'geodir_previous_next_post_where', 10, 5 );
3573 3571
\ No newline at end of file
3572
+add_filter('get_previous_post_where', 'geodir_previous_next_post_where', 10, 5);
3573
+add_filter('get_next_post_where', 'geodir_previous_next_post_where', 10, 5);
3574 3574
\ No newline at end of file
Please login to merge, or discard this patch.
geodirectory-functions/custom_fields_output_functions.php 3 patches
Braces   +25 added lines, -38 removed lines patch added patch discarded remove patch
@@ -22,8 +22,7 @@  discard block
 block discarded – undo
22 22
 function geodir_cf_checkbox($html,$location,$cf,$p=''){
23 23
 
24 24
     // check we have the post value
25
-    if(is_int($p)){$post = geodir_get_post_info($p);}
26
-    else{ global $post;}
25
+    if(is_int($p)){$post = geodir_get_post_info($p);} else{ global $post;}
27 26
 
28 27
     if(!is_array($cf) && $cf!=''){
29 28
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
@@ -77,8 +76,10 @@  discard block
 block discarded – undo
77 76
 
78 77
             if ( $post->{$html_var} == '1' ):
79 78
                 $html_val = __( 'Yes', 'geodirectory' );
80
-            else:
79
+            else {
80
+            	:
81 81
                 $html_val = __( 'No', 'geodirectory' );
82
+            }
82 83
             endif;
83 84
 
84 85
             $field_icon = geodir_field_icon_proccess($cf);
@@ -116,8 +117,7 @@  discard block
 block discarded – undo
116 117
 function geodir_cf_fieldset($html,$location,$cf,$p=''){
117 118
 
118 119
     // check we have the post value
119
-    if(is_int($p)){$post = geodir_get_post_info($p);}
120
-    else{ global $post;}
120
+    if(is_int($p)){$post = geodir_get_post_info($p);} else{ global $post;}
121 121
 
122 122
     if(!is_array($cf) && $cf!=''){
123 123
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
@@ -197,8 +197,7 @@  discard block
 block discarded – undo
197 197
 function geodir_cf_url($html,$location,$cf,$p=''){
198 198
 
199 199
     // check we have the post value
200
-    if(is_int($p)){$post = geodir_get_post_info($p);}
201
-    else{ global $post;}
200
+    if(is_int($p)){$post = geodir_get_post_info($p);} else{ global $post;}
202 201
 
203 202
     if(!is_array($cf) && $cf!=''){
204 203
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
@@ -313,8 +312,7 @@  discard block
 block discarded – undo
313 312
 function geodir_cf_phone($html,$location,$cf,$p=''){
314 313
 
315 314
     // check we have the post value
316
-    if(is_int($p)){$post = geodir_get_post_info($p);}
317
-    else{ global $post;}
315
+    if(is_int($p)){$post = geodir_get_post_info($p);} else{ global $post;}
318 316
 
319 317
     if(!is_array($cf) && $cf!=''){
320 318
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
@@ -403,8 +401,7 @@  discard block
 block discarded – undo
403 401
 function geodir_cf_time($html,$location,$cf,$p=''){
404 402
 
405 403
     // check we have the post value
406
-    if(is_int($p)){$post = geodir_get_post_info($p);}
407
-    else{ global $post;}
404
+    if(is_int($p)){$post = geodir_get_post_info($p);} else{ global $post;}
408 405
 
409 406
     if(!is_array($cf) && $cf!=''){
410 407
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
@@ -457,9 +454,10 @@  discard block
 block discarded – undo
457 454
         if ($post->{$cf['htmlvar_name']}):
458 455
 
459 456
             $value = '';
460
-            if ($post->{$cf['htmlvar_name']} != '')
461
-                //$value = date('h:i',strtotime($post->{$cf['htmlvar_name']}));
457
+            if ($post->{$cf['htmlvar_name']} != '') {
458
+                            //$value = date('h:i',strtotime($post->{$cf['htmlvar_name']}));
462 459
                 $value = date(get_option('time_format'), strtotime($post->{$cf['htmlvar_name']}));
460
+            }
463 461
 
464 462
             $field_icon = geodir_field_icon_proccess($cf);
465 463
             if (strpos($field_icon, 'http') !== false) {
@@ -498,8 +496,7 @@  discard block
 block discarded – undo
498 496
 function geodir_cf_datepicker($html,$location,$cf,$p=''){
499 497
     global $preview;
500 498
     // check we have the post value
501
-    if(is_int($p)){$post = geodir_get_post_info($p);}
502
-    else{ global $post;}
499
+    if(is_int($p)){$post = geodir_get_post_info($p);} else{ global $post;}
503 500
 
504 501
     if(!is_array($cf) && $cf!=''){
505 502
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
@@ -566,7 +563,7 @@  discard block
 block discarded – undo
566 563
                 $date_format = str_replace($search, $replace, $date_format);
567 564
 
568 565
                 $post_htmlvar_value = ($date_format == 'd/m/Y' || $date_format == 'j/n/Y' ) ? str_replace('/', '-', $post->{$cf['htmlvar_name']}) : $post->{$cf['htmlvar_name']}; // PHP doesn't work well with dd/mm/yyyy format
569
-            }else{
566
+            } else{
570 567
                 $post_htmlvar_value = $post->{$cf['htmlvar_name']};
571 568
             }
572 569
 
@@ -575,7 +572,7 @@  discard block
 block discarded – undo
575 572
                 $value = geodir_date($post_htmlvar_value, $date_format, $date_format_from); // save as sql format Y-m-d
576 573
                 //$post_htmlvar_value = strpos($post_htmlvar_value, '/') !== false ? str_replace('/', '-', $post_htmlvar_value) : $post_htmlvar_value;
577 574
                 //$value = date_i18n($date_format, strtotime($post_htmlvar_value));
578
-            }else{
575
+            } else{
579 576
                 return '';
580 577
             }
581 578
 
@@ -618,8 +615,7 @@  discard block
 block discarded – undo
618 615
 function geodir_cf_text($html,$location,$cf,$p=''){
619 616
 
620 617
     // check we have the post value
621
-    if(is_int($p)){$post = geodir_get_post_info($p);}
622
-    else{ global $post;}
618
+    if(is_int($p)){$post = geodir_get_post_info($p);} else{ global $post;}
623 619
 
624 620
     if(!is_array($cf) && $cf!=''){
625 621
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
@@ -725,8 +721,7 @@  discard block
 block discarded – undo
725 721
 function geodir_cf_radio($html,$location,$cf,$p=''){
726 722
 
727 723
     // check we have the post value
728
-    if(is_int($p)){$post = geodir_get_post_info($p);}
729
-    else{ global $post;}
724
+    if(is_int($p)){$post = geodir_get_post_info($p);} else{ global $post;}
730 725
 
731 726
     if(!is_array($cf) && $cf!=''){
732 727
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
@@ -833,8 +828,7 @@  discard block
 block discarded – undo
833 828
 function geodir_cf_select($html,$location,$cf,$p=''){
834 829
 
835 830
     // check we have the post value
836
-    if(is_int($p)){$post = geodir_get_post_info($p);}
837
-    else{ global $post;}
831
+    if(is_int($p)){$post = geodir_get_post_info($p);} else{ global $post;}
838 832
 
839 833
     if(!is_array($cf) && $cf!=''){
840 834
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
@@ -935,8 +929,7 @@  discard block
 block discarded – undo
935 929
 function geodir_cf_multiselect($html,$location,$cf,$p=''){
936 930
 
937 931
     // check we have the post value
938
-    if(is_int($p)){$post = geodir_get_post_info($p);}
939
-    else{ global $post;}
932
+    if(is_int($p)){$post = geodir_get_post_info($p);} else{ global $post;}
940 933
 
941 934
     if(!is_array($cf) && $cf!=''){
942 935
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
@@ -1062,8 +1055,7 @@  discard block
 block discarded – undo
1062 1055
 function geodir_cf_email($html,$location,$cf,$p=''){
1063 1056
 
1064 1057
     // check we have the post value
1065
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1066
-    else{ global $post;}
1058
+    if(is_int($p)){$post = geodir_get_post_info($p);} else{ global $post;}
1067 1059
 
1068 1060
     if(!is_array($cf) && $cf!=''){
1069 1061
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
@@ -1197,7 +1189,7 @@  discard block
 block discarded – undo
1197 1189
                      */
1198 1190
                     $email_name = apply_filters('geodir_email_field_name_output',$email,$cf);
1199 1191
                     $html .=  "<script>document.write('<a href=\"mailto:'+'$e_split[0]' + '@' + '$e_split[1]'+'\">$email_name</a>')</script>";
1200
-                }else{
1192
+                } else{
1201 1193
                     $html .=  $email;
1202 1194
                 }
1203 1195
                 $html .= '</span></div>';
@@ -1225,8 +1217,7 @@  discard block
 block discarded – undo
1225 1217
 function geodir_cf_file($html,$location,$cf,$p=''){
1226 1218
 
1227 1219
     // check we have the post value
1228
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1229
-    else{ global $post;}
1220
+    if(is_int($p)){$post = geodir_get_post_info($p);} else{ global $post;}
1230 1221
 
1231 1222
     if(!is_array($cf) && $cf!=''){
1232 1223
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
@@ -1366,8 +1357,7 @@  discard block
 block discarded – undo
1366 1357
 function geodir_cf_textarea($html,$location,$cf,$p=''){
1367 1358
 
1368 1359
     // check we have the post value
1369
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1370
-    else{ global $post;}
1360
+    if(is_int($p)){$post = geodir_get_post_info($p);} else{ global $post;}
1371 1361
 
1372 1362
     if(!is_array($cf) && $cf!=''){
1373 1363
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
@@ -1457,8 +1447,7 @@  discard block
 block discarded – undo
1457 1447
 function geodir_cf_html($html,$location,$cf,$p=''){
1458 1448
 
1459 1449
     // check we have the post value
1460
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1461
-    else{ global $post;}
1450
+    if(is_int($p)){$post = geodir_get_post_info($p);} else{ global $post;}
1462 1451
 
1463 1452
     if(!is_array($cf) && $cf!=''){
1464 1453
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
@@ -1547,8 +1536,7 @@  discard block
 block discarded – undo
1547 1536
 function geodir_cf_taxonomy($html,$location,$cf,$p=''){
1548 1537
 
1549 1538
     // check we have the post value
1550
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1551
-    else{ global $post;}
1539
+    if(is_int($p)){$post = geodir_get_post_info($p);} else{ global $post;}
1552 1540
 
1553 1541
     if(!is_array($cf) && $cf!=''){
1554 1542
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
@@ -1670,8 +1658,7 @@  discard block
 block discarded – undo
1670 1658
 function geodir_cf_address($html,$location,$cf,$p=''){
1671 1659
 
1672 1660
     // check we have the post value
1673
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1674
-    else{ global $post;}
1661
+    if(is_int($p)){$post = geodir_get_post_info($p);} else{ global $post;}
1675 1662
 
1676 1663
     if(!is_array($cf) && $cf!=''){
1677 1664
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
Please login to merge, or discard this patch.
Indentation   +1542 added lines, -1542 removed lines patch added patch discarded remove patch
@@ -21,84 +21,84 @@  discard block
 block discarded – undo
21 21
  */
22 22
 function geodir_cf_checkbox($html,$location,$cf,$p=''){
23 23
 
24
-    // check we have the post value
25
-    if(is_int($p)){$post = geodir_get_post_info($p);}
26
-    else{ global $post;}
27
-
28
-    if(!is_array($cf) && $cf!=''){
29
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
30
-        if(!$cf){return NULL;}
31
-    }
32
-
33
-    $html_var = $cf['htmlvar_name'];
34
-
35
-    // Check if there is a location specific filter.
36
-    if(has_filter("geodir_custom_field_output_checkbox_loc_{$location}")){
37
-        /**
38
-         * Filter the checkbox html by location.
39
-         *
40
-         * @param string $html The html to filter.
41
-         * @param array $cf The custom field array.
42
-         * @since 1.6.6
43
-         */
44
-        $html = apply_filters("geodir_custom_field_output_checkbox_loc_{$location}",$html,$cf);
45
-    }
46
-
47
-    // Check if there is a custom field specific filter.
48
-    if(has_filter("geodir_custom_field_output_checkbox_var_{$html_var}")){
49
-        /**
50
-         * Filter the checkbox html by individual custom field.
51
-         *
52
-         * @param string $html The html to filter.
53
-         * @param string $location The location to output the html.
54
-         * @param array $cf The custom field array.
55
-         * @since 1.6.6
56
-         */
57
-        $html = apply_filters("geodir_custom_field_output_checkbox_var_{$html_var}",$html,$location,$cf);
58
-    }
59
-
60
-    // Check if there is a custom field key specific filter.
61
-    if(has_filter("geodir_custom_field_output_checkbox_key_{$cf['field_type_key']}")){
62
-        /**
63
-         * Filter the checkbox html by field type key.
64
-         *
65
-         * @param string $html The html to filter.
66
-         * @param string $location The location to output the html.
67
-         * @param array $cf The custom field array.
68
-         * @since 1.6.6
69
-         */
70
-        $html = apply_filters("geodir_custom_field_output_checkbox_key_{$cf['field_type_key']}",$html,$location,$cf);
71
-    }
72
-
73
-    // If not html then we run the standard output.
74
-    if(empty($html)){
75
-
76
-        if ( (int) $post->{$html_var} == 1 ):
77
-
78
-            if ( $post->{$html_var} == '1' ):
79
-                $html_val = __( 'Yes', 'geodirectory' );
80
-            else:
81
-                $html_val = __( 'No', 'geodirectory' );
82
-            endif;
83
-
84
-            $field_icon = geodir_field_icon_proccess($cf);
85
-            if (strpos($field_icon, 'http') !== false) {
86
-                $field_icon_af = '';
87
-            } elseif ($field_icon == '') {
88
-                $field_icon_af = '';
89
-            } else {
90
-                $field_icon_af = $field_icon;
91
-                $field_icon = '';
92
-            }
93
-
94
-            $html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-checkbox" style="' . $field_icon . '">' . $field_icon_af;
95
-            $html .= ( trim( $cf['site_title'] ) ) ? __( $cf['site_title'], 'geodirectory' ) . ': ' : '';
96
-            $html .= '</span>' . $html_val . '</div>';
97
-        endif;
98
-
99
-    }
100
-
101
-    return $html;
24
+	// check we have the post value
25
+	if(is_int($p)){$post = geodir_get_post_info($p);}
26
+	else{ global $post;}
27
+
28
+	if(!is_array($cf) && $cf!=''){
29
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
30
+		if(!$cf){return NULL;}
31
+	}
32
+
33
+	$html_var = $cf['htmlvar_name'];
34
+
35
+	// Check if there is a location specific filter.
36
+	if(has_filter("geodir_custom_field_output_checkbox_loc_{$location}")){
37
+		/**
38
+		 * Filter the checkbox html by location.
39
+		 *
40
+		 * @param string $html The html to filter.
41
+		 * @param array $cf The custom field array.
42
+		 * @since 1.6.6
43
+		 */
44
+		$html = apply_filters("geodir_custom_field_output_checkbox_loc_{$location}",$html,$cf);
45
+	}
46
+
47
+	// Check if there is a custom field specific filter.
48
+	if(has_filter("geodir_custom_field_output_checkbox_var_{$html_var}")){
49
+		/**
50
+		 * Filter the checkbox html by individual custom field.
51
+		 *
52
+		 * @param string $html The html to filter.
53
+		 * @param string $location The location to output the html.
54
+		 * @param array $cf The custom field array.
55
+		 * @since 1.6.6
56
+		 */
57
+		$html = apply_filters("geodir_custom_field_output_checkbox_var_{$html_var}",$html,$location,$cf);
58
+	}
59
+
60
+	// Check if there is a custom field key specific filter.
61
+	if(has_filter("geodir_custom_field_output_checkbox_key_{$cf['field_type_key']}")){
62
+		/**
63
+		 * Filter the checkbox html by field type key.
64
+		 *
65
+		 * @param string $html The html to filter.
66
+		 * @param string $location The location to output the html.
67
+		 * @param array $cf The custom field array.
68
+		 * @since 1.6.6
69
+		 */
70
+		$html = apply_filters("geodir_custom_field_output_checkbox_key_{$cf['field_type_key']}",$html,$location,$cf);
71
+	}
72
+
73
+	// If not html then we run the standard output.
74
+	if(empty($html)){
75
+
76
+		if ( (int) $post->{$html_var} == 1 ):
77
+
78
+			if ( $post->{$html_var} == '1' ):
79
+				$html_val = __( 'Yes', 'geodirectory' );
80
+			else:
81
+				$html_val = __( 'No', 'geodirectory' );
82
+			endif;
83
+
84
+			$field_icon = geodir_field_icon_proccess($cf);
85
+			if (strpos($field_icon, 'http') !== false) {
86
+				$field_icon_af = '';
87
+			} elseif ($field_icon == '') {
88
+				$field_icon_af = '';
89
+			} else {
90
+				$field_icon_af = $field_icon;
91
+				$field_icon = '';
92
+			}
93
+
94
+			$html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-checkbox" style="' . $field_icon . '">' . $field_icon_af;
95
+			$html .= ( trim( $cf['site_title'] ) ) ? __( $cf['site_title'], 'geodirectory' ) . ': ' : '';
96
+			$html .= '</span>' . $html_val . '</div>';
97
+		endif;
98
+
99
+	}
100
+
101
+	return $html;
102 102
 }
103 103
 add_filter('geodir_custom_field_output_checkbox','geodir_cf_checkbox',10,3);
104 104
 
@@ -115,71 +115,71 @@  discard block
 block discarded – undo
115 115
  */
116 116
 function geodir_cf_fieldset($html,$location,$cf,$p=''){
117 117
 
118
-    // check we have the post value
119
-    if(is_int($p)){$post = geodir_get_post_info($p);}
120
-    else{ global $post;}
121
-
122
-    if(!is_array($cf) && $cf!=''){
123
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
124
-        if(!$cf){return NULL;}
125
-    }
126
-
127
-    $html_var = $cf['htmlvar_name'];
128
-
129
-    // Check if there is a location specific filter.
130
-    if(has_filter("geodir_custom_field_output_fieldset_loc_{$location}")){
131
-        /**
132
-         * Filter the fieldset html by location.
133
-         *
134
-         * @param string $html The html to filter.
135
-         * @param array $cf The custom field array.
136
-         * @since 1.6.6
137
-         */
138
-        $html = apply_filters("geodir_custom_field_output_fieldset_loc_{$location}",$html,$cf);
139
-    }
140
-
141
-    // Check if there is a custom field specific filter.
142
-    if(has_filter("geodir_custom_field_output_fieldset_var_{$html_var}")){
143
-        /**
144
-         * Filter the fieldset html by individual custom field.
145
-         *
146
-         * @param string $html The html to filter.
147
-         * @param string $location The location to output the html.
148
-         * @param array $cf The custom field array.
149
-         * @since 1.6.6
150
-         */
151
-        $html = apply_filters("geodir_custom_field_output_fieldset_var_{$html_var}",$html,$location,$cf);
152
-    }
153
-
154
-    // Check if there is a custom field key specific filter.
155
-    if(has_filter("geodir_custom_field_output_fieldset_key_{$cf['field_type_key']}")){
156
-        /**
157
-         * Filter the fieldset html by field type key.
158
-         *
159
-         * @param string $html The html to filter.
160
-         * @param string $location The location to output the html.
161
-         * @param array $cf The custom field array.
162
-         * @since 1.6.6
163
-         */
164
-        $html = apply_filters("geodir_custom_field_output_fieldset_key_{$cf['field_type_key']}",$html,$location,$cf);
165
-    }
166
-
167
-    // If not html then we run the standard output.
168
-    if(empty($html)){
169
-
170
-        global $field_set_start;
171
-        $fieldset_class = 'fieldset-'.sanitize_title_with_dashes($cf['site_title']);
172
-
173
-        if ($field_set_start == 1) {
174
-            $html = '';
175
-        } else {
176
-            $html = '<h2 class="'.$fieldset_class.'">'. __($cf['site_title'], 'geodirectory') . '</h2>';
177
-            //$field_set_start = 1;
178
-        }
179
-
180
-    }
181
-
182
-    return $html;
118
+	// check we have the post value
119
+	if(is_int($p)){$post = geodir_get_post_info($p);}
120
+	else{ global $post;}
121
+
122
+	if(!is_array($cf) && $cf!=''){
123
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
124
+		if(!$cf){return NULL;}
125
+	}
126
+
127
+	$html_var = $cf['htmlvar_name'];
128
+
129
+	// Check if there is a location specific filter.
130
+	if(has_filter("geodir_custom_field_output_fieldset_loc_{$location}")){
131
+		/**
132
+		 * Filter the fieldset html by location.
133
+		 *
134
+		 * @param string $html The html to filter.
135
+		 * @param array $cf The custom field array.
136
+		 * @since 1.6.6
137
+		 */
138
+		$html = apply_filters("geodir_custom_field_output_fieldset_loc_{$location}",$html,$cf);
139
+	}
140
+
141
+	// Check if there is a custom field specific filter.
142
+	if(has_filter("geodir_custom_field_output_fieldset_var_{$html_var}")){
143
+		/**
144
+		 * Filter the fieldset html by individual custom field.
145
+		 *
146
+		 * @param string $html The html to filter.
147
+		 * @param string $location The location to output the html.
148
+		 * @param array $cf The custom field array.
149
+		 * @since 1.6.6
150
+		 */
151
+		$html = apply_filters("geodir_custom_field_output_fieldset_var_{$html_var}",$html,$location,$cf);
152
+	}
153
+
154
+	// Check if there is a custom field key specific filter.
155
+	if(has_filter("geodir_custom_field_output_fieldset_key_{$cf['field_type_key']}")){
156
+		/**
157
+		 * Filter the fieldset html by field type key.
158
+		 *
159
+		 * @param string $html The html to filter.
160
+		 * @param string $location The location to output the html.
161
+		 * @param array $cf The custom field array.
162
+		 * @since 1.6.6
163
+		 */
164
+		$html = apply_filters("geodir_custom_field_output_fieldset_key_{$cf['field_type_key']}",$html,$location,$cf);
165
+	}
166
+
167
+	// If not html then we run the standard output.
168
+	if(empty($html)){
169
+
170
+		global $field_set_start;
171
+		$fieldset_class = 'fieldset-'.sanitize_title_with_dashes($cf['site_title']);
172
+
173
+		if ($field_set_start == 1) {
174
+			$html = '';
175
+		} else {
176
+			$html = '<h2 class="'.$fieldset_class.'">'. __($cf['site_title'], 'geodirectory') . '</h2>';
177
+			//$field_set_start = 1;
178
+		}
179
+
180
+	}
181
+
182
+	return $html;
183 183
 }
184 184
 add_filter('geodir_custom_field_output_fieldset','geodir_cf_fieldset',10,3);
185 185
 
@@ -196,106 +196,106 @@  discard block
 block discarded – undo
196 196
  */
197 197
 function geodir_cf_url($html,$location,$cf,$p=''){
198 198
 
199
-    // check we have the post value
200
-    if(is_int($p)){$post = geodir_get_post_info($p);}
201
-    else{ global $post;}
202
-
203
-    if(!is_array($cf) && $cf!=''){
204
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
205
-        if(!$cf){return NULL;}
206
-    }
207
-
208
-    $html_var = $cf['htmlvar_name'];
209
-
210
-    // Check if there is a location specific filter.
211
-    if(has_filter("geodir_custom_field_output_url_loc_{$location}")){
212
-        /**
213
-         * Filter the url html by location.
214
-         *
215
-         * @param string $html The html to filter.
216
-         * @param array $cf The custom field array.
217
-         * @since 1.6.6
218
-         */
219
-        $html = apply_filters("geodir_custom_field_output_url_loc_{$location}",$html,$cf);
220
-    }
221
-
222
-    // Check if there is a custom field specific filter.
223
-    if(has_filter("geodir_custom_field_output_url_var_{$html_var}")){
224
-        /**
225
-         * Filter the url html by individual custom field.
226
-         *
227
-         * @param string $html The html to filter.
228
-         * @param string $location The location to output the html.
229
-         * @param array $cf The custom field array.
230
-         * @since 1.6.6
231
-         */
232
-        $html = apply_filters("geodir_custom_field_output_url_var_{$html_var}",$html,$location,$cf);
233
-    }
234
-
235
-    // Check if there is a custom field key specific filter.
236
-    if(has_filter("geodir_custom_field_output_url_key_{$cf['field_type_key']}")){
237
-        /**
238
-         * Filter the url html by field type key.
239
-         *
240
-         * @param string $html The html to filter.
241
-         * @param string $location The location to output the html.
242
-         * @param array $cf The custom field array.
243
-         * @since 1.6.6
244
-         */
245
-        $html = apply_filters("geodir_custom_field_output_url_key_{$cf['field_type_key']}",$html,$location,$cf);
246
-    }
247
-
248
-    // If not html then we run the standard output.
249
-    if(empty($html)){
250
-
251
-        if ($post->{$cf['htmlvar_name']}):
252
-
253
-            $field_icon = geodir_field_icon_proccess($cf);
254
-            if (strpos($field_icon, 'http') !== false) {
255
-                $field_icon_af = '';
256
-            } elseif ($field_icon == '') {
257
-
258
-                if ($cf['name'] == 'geodir_facebook') {
259
-                    $field_icon_af = '<i class="fa fa-facebook-square"></i>';
260
-                } elseif ($cf['name'] == 'geodir_twitter') {
261
-                    $field_icon_af = '<i class="fa fa-twitter-square"></i>';
262
-                } else {
263
-                    $field_icon_af = '<i class="fa fa-link"></i>';
264
-                }
265
-
266
-            } else {
267
-                $field_icon_af = $field_icon;
268
-                $field_icon = '';
269
-            }
270
-
271
-            $a_url = geodir_parse_custom_field_url($post->{$cf['htmlvar_name']});
272
-
273
-
274
-            $website = !empty($a_url['url']) ? $a_url['url'] : '';
275
-            $title = !empty($a_url['label']) ? $a_url['label'] : $cf['site_title'];
276
-            if(!empty($cf['default_value'])){$title = $cf['default_value'];}
277
-            $title = $title != '' ? __(stripslashes($title), 'geodirectory') : '';
278
-
279
-
280
-
281
-            // all search engines that use the nofollow value exclude links that use it from their ranking calculation
282
-            $rel = strpos($website, get_site_url()) !== false ? '' : 'rel="nofollow"';
283
-            /**
284
-             * Filter custom field website name.
285
-             *
286
-             * @since 1.0.0
287
-             *
288
-             * @param string $title Website Title.
289
-             * @param string $website Website URL.
290
-             * @param int $post->ID Post ID.
291
-             */
292
-            $html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '"><span class="geodir-i-website" style="' . $field_icon . '">' . $field_icon_af . '<a href="' . $website . '" target="_blank" ' . $rel . ' ><strong>' . apply_filters('geodir_custom_field_website_name', $title, $website, $post->ID) . '</strong></a></span></div>';
293
-
294
-        endif;
295
-
296
-    }
297
-
298
-    return $html;
199
+	// check we have the post value
200
+	if(is_int($p)){$post = geodir_get_post_info($p);}
201
+	else{ global $post;}
202
+
203
+	if(!is_array($cf) && $cf!=''){
204
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
205
+		if(!$cf){return NULL;}
206
+	}
207
+
208
+	$html_var = $cf['htmlvar_name'];
209
+
210
+	// Check if there is a location specific filter.
211
+	if(has_filter("geodir_custom_field_output_url_loc_{$location}")){
212
+		/**
213
+		 * Filter the url html by location.
214
+		 *
215
+		 * @param string $html The html to filter.
216
+		 * @param array $cf The custom field array.
217
+		 * @since 1.6.6
218
+		 */
219
+		$html = apply_filters("geodir_custom_field_output_url_loc_{$location}",$html,$cf);
220
+	}
221
+
222
+	// Check if there is a custom field specific filter.
223
+	if(has_filter("geodir_custom_field_output_url_var_{$html_var}")){
224
+		/**
225
+		 * Filter the url html by individual custom field.
226
+		 *
227
+		 * @param string $html The html to filter.
228
+		 * @param string $location The location to output the html.
229
+		 * @param array $cf The custom field array.
230
+		 * @since 1.6.6
231
+		 */
232
+		$html = apply_filters("geodir_custom_field_output_url_var_{$html_var}",$html,$location,$cf);
233
+	}
234
+
235
+	// Check if there is a custom field key specific filter.
236
+	if(has_filter("geodir_custom_field_output_url_key_{$cf['field_type_key']}")){
237
+		/**
238
+		 * Filter the url html by field type key.
239
+		 *
240
+		 * @param string $html The html to filter.
241
+		 * @param string $location The location to output the html.
242
+		 * @param array $cf The custom field array.
243
+		 * @since 1.6.6
244
+		 */
245
+		$html = apply_filters("geodir_custom_field_output_url_key_{$cf['field_type_key']}",$html,$location,$cf);
246
+	}
247
+
248
+	// If not html then we run the standard output.
249
+	if(empty($html)){
250
+
251
+		if ($post->{$cf['htmlvar_name']}):
252
+
253
+			$field_icon = geodir_field_icon_proccess($cf);
254
+			if (strpos($field_icon, 'http') !== false) {
255
+				$field_icon_af = '';
256
+			} elseif ($field_icon == '') {
257
+
258
+				if ($cf['name'] == 'geodir_facebook') {
259
+					$field_icon_af = '<i class="fa fa-facebook-square"></i>';
260
+				} elseif ($cf['name'] == 'geodir_twitter') {
261
+					$field_icon_af = '<i class="fa fa-twitter-square"></i>';
262
+				} else {
263
+					$field_icon_af = '<i class="fa fa-link"></i>';
264
+				}
265
+
266
+			} else {
267
+				$field_icon_af = $field_icon;
268
+				$field_icon = '';
269
+			}
270
+
271
+			$a_url = geodir_parse_custom_field_url($post->{$cf['htmlvar_name']});
272
+
273
+
274
+			$website = !empty($a_url['url']) ? $a_url['url'] : '';
275
+			$title = !empty($a_url['label']) ? $a_url['label'] : $cf['site_title'];
276
+			if(!empty($cf['default_value'])){$title = $cf['default_value'];}
277
+			$title = $title != '' ? __(stripslashes($title), 'geodirectory') : '';
278
+
279
+
280
+
281
+			// all search engines that use the nofollow value exclude links that use it from their ranking calculation
282
+			$rel = strpos($website, get_site_url()) !== false ? '' : 'rel="nofollow"';
283
+			/**
284
+			 * Filter custom field website name.
285
+			 *
286
+			 * @since 1.0.0
287
+			 *
288
+			 * @param string $title Website Title.
289
+			 * @param string $website Website URL.
290
+			 * @param int $post->ID Post ID.
291
+			 */
292
+			$html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '"><span class="geodir-i-website" style="' . $field_icon . '">' . $field_icon_af . '<a href="' . $website . '" target="_blank" ' . $rel . ' ><strong>' . apply_filters('geodir_custom_field_website_name', $title, $website, $post->ID) . '</strong></a></span></div>';
293
+
294
+		endif;
295
+
296
+	}
297
+
298
+	return $html;
299 299
 }
300 300
 add_filter('geodir_custom_field_output_url','geodir_cf_url',10,3);
301 301
 
@@ -312,80 +312,80 @@  discard block
 block discarded – undo
312 312
  */
313 313
 function geodir_cf_phone($html,$location,$cf,$p=''){
314 314
 
315
-    // check we have the post value
316
-    if(is_int($p)){$post = geodir_get_post_info($p);}
317
-    else{ global $post;}
318
-
319
-    if(!is_array($cf) && $cf!=''){
320
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
321
-        if(!$cf){return NULL;}
322
-    }
323
-
324
-    $html_var = $cf['htmlvar_name'];
325
-
326
-    // Check if there is a location specific filter.
327
-    if(has_filter("geodir_custom_field_output_phone_loc_{$location}")){
328
-        /**
329
-         * Filter the phone html by location.
330
-         *
331
-         * @param string $html The html to filter.
332
-         * @param array $cf The custom field array.
333
-         * @since 1.6.6
334
-         */
335
-        $html = apply_filters("geodir_custom_field_output_phone_loc_{$location}",$html,$cf);
336
-    }
337
-
338
-    // Check if there is a custom field specific filter.
339
-    if(has_filter("geodir_custom_field_output_phone_var_{$html_var}")){
340
-        /**
341
-         * Filter the phone html by individual custom field.
342
-         *
343
-         * @param string $html The html to filter.
344
-         * @param string $location The location to output the html.
345
-         * @param array $cf The custom field array.
346
-         * @since 1.6.6
347
-         */
348
-        $html = apply_filters("geodir_custom_field_output_phone_var_{$html_var}",$html,$location,$cf);
349
-    }
350
-
351
-    // Check if there is a custom field key specific filter.
352
-    if(has_filter("geodir_custom_field_output_phone_key_{$cf['field_type_key']}")){
353
-        /**
354
-         * Filter the phone html by field type key.
355
-         *
356
-         * @param string $html The html to filter.
357
-         * @param string $location The location to output the html.
358
-         * @param array $cf The custom field array.
359
-         * @since 1.6.6
360
-         */
361
-        $html = apply_filters("geodir_custom_field_output_phone_key_{$cf['field_type_key']}",$html,$location,$cf);
362
-    }
363
-
364
-    // If not html then we run the standard output.
365
-    if(empty($html)){
366
-
367
-        if ($post->{$cf['htmlvar_name']}):
368
-
369
-            $field_icon = geodir_field_icon_proccess($cf);
370
-            if (strpos($field_icon, 'http') !== false) {
371
-                $field_icon_af = '';
372
-            } elseif ($field_icon == '') {
373
-                $field_icon_af = '<i class="fa fa-phone"></i>';
374
-            } else {
375
-                $field_icon_af = $field_icon;
376
-                $field_icon = '';
377
-            }
378
-
379
-
380
-            $html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-contact" style="' . $field_icon . '">' . $field_icon_af .
381
-                    $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '&nbsp;';
382
-            $html .= '</span><a href="tel:' . preg_replace('/[^0-9+]/', '', $post->{$cf['htmlvar_name']}) . '">' . $post->{$cf['htmlvar_name']} . '</a></div>';
383
-
384
-        endif;
385
-
386
-    }
387
-
388
-    return $html;
315
+	// check we have the post value
316
+	if(is_int($p)){$post = geodir_get_post_info($p);}
317
+	else{ global $post;}
318
+
319
+	if(!is_array($cf) && $cf!=''){
320
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
321
+		if(!$cf){return NULL;}
322
+	}
323
+
324
+	$html_var = $cf['htmlvar_name'];
325
+
326
+	// Check if there is a location specific filter.
327
+	if(has_filter("geodir_custom_field_output_phone_loc_{$location}")){
328
+		/**
329
+		 * Filter the phone html by location.
330
+		 *
331
+		 * @param string $html The html to filter.
332
+		 * @param array $cf The custom field array.
333
+		 * @since 1.6.6
334
+		 */
335
+		$html = apply_filters("geodir_custom_field_output_phone_loc_{$location}",$html,$cf);
336
+	}
337
+
338
+	// Check if there is a custom field specific filter.
339
+	if(has_filter("geodir_custom_field_output_phone_var_{$html_var}")){
340
+		/**
341
+		 * Filter the phone html by individual custom field.
342
+		 *
343
+		 * @param string $html The html to filter.
344
+		 * @param string $location The location to output the html.
345
+		 * @param array $cf The custom field array.
346
+		 * @since 1.6.6
347
+		 */
348
+		$html = apply_filters("geodir_custom_field_output_phone_var_{$html_var}",$html,$location,$cf);
349
+	}
350
+
351
+	// Check if there is a custom field key specific filter.
352
+	if(has_filter("geodir_custom_field_output_phone_key_{$cf['field_type_key']}")){
353
+		/**
354
+		 * Filter the phone html by field type key.
355
+		 *
356
+		 * @param string $html The html to filter.
357
+		 * @param string $location The location to output the html.
358
+		 * @param array $cf The custom field array.
359
+		 * @since 1.6.6
360
+		 */
361
+		$html = apply_filters("geodir_custom_field_output_phone_key_{$cf['field_type_key']}",$html,$location,$cf);
362
+	}
363
+
364
+	// If not html then we run the standard output.
365
+	if(empty($html)){
366
+
367
+		if ($post->{$cf['htmlvar_name']}):
368
+
369
+			$field_icon = geodir_field_icon_proccess($cf);
370
+			if (strpos($field_icon, 'http') !== false) {
371
+				$field_icon_af = '';
372
+			} elseif ($field_icon == '') {
373
+				$field_icon_af = '<i class="fa fa-phone"></i>';
374
+			} else {
375
+				$field_icon_af = $field_icon;
376
+				$field_icon = '';
377
+			}
378
+
379
+
380
+			$html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-contact" style="' . $field_icon . '">' . $field_icon_af .
381
+					$html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '&nbsp;';
382
+			$html .= '</span><a href="tel:' . preg_replace('/[^0-9+]/', '', $post->{$cf['htmlvar_name']}) . '">' . $post->{$cf['htmlvar_name']} . '</a></div>';
383
+
384
+		endif;
385
+
386
+	}
387
+
388
+	return $html;
389 389
 }
390 390
 add_filter('geodir_custom_field_output_phone','geodir_cf_phone',10,3);
391 391
 
@@ -402,85 +402,85 @@  discard block
 block discarded – undo
402 402
  */
403 403
 function geodir_cf_time($html,$location,$cf,$p=''){
404 404
 
405
-    // check we have the post value
406
-    if(is_int($p)){$post = geodir_get_post_info($p);}
407
-    else{ global $post;}
408
-
409
-    if(!is_array($cf) && $cf!=''){
410
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
411
-        if(!$cf){return NULL;}
412
-    }
413
-
414
-    $html_var = $cf['htmlvar_name'];
415
-
416
-    // Check if there is a location specific filter.
417
-    if(has_filter("geodir_custom_field_output_time_loc_{$location}")){
418
-        /**
419
-         * Filter the time html by location.
420
-         *
421
-         * @param string $html The html to filter.
422
-         * @param array $cf The custom field array.
423
-         * @since 1.6.6
424
-         */
425
-        $html = apply_filters("geodir_custom_field_output_time_loc_{$location}",$html,$cf);
426
-    }
427
-
428
-    // Check if there is a custom field specific filter.
429
-    if(has_filter("geodir_custom_field_output_time_var_{$html_var}")){
430
-        /**
431
-         * Filter the time html by individual custom field.
432
-         *
433
-         * @param string $html The html to filter.
434
-         * @param string $location The location to output the html.
435
-         * @param array $cf The custom field array.
436
-         * @since 1.6.6
437
-         */
438
-        $html = apply_filters("geodir_custom_field_output_time_var_{$html_var}",$html,$location,$cf);
439
-    }
440
-
441
-    // Check if there is a custom field key specific filter.
442
-    if(has_filter("geodir_custom_field_output_time_key_{$cf['field_type_key']}")){
443
-        /**
444
-         * Filter the time html by field type key.
445
-         *
446
-         * @param string $html The html to filter.
447
-         * @param string $location The location to output the html.
448
-         * @param array $cf The custom field array.
449
-         * @since 1.6.6
450
-         */
451
-        $html = apply_filters("geodir_custom_field_output_time_key_{$cf['field_type_key']}",$html,$location,$cf);
452
-    }
453
-
454
-    // If not html then we run the standard output.
455
-    if(empty($html)){
456
-
457
-        if ($post->{$cf['htmlvar_name']}):
458
-
459
-            $value = '';
460
-            if ($post->{$cf['htmlvar_name']} != '')
461
-                //$value = date('h:i',strtotime($post->{$cf['htmlvar_name']}));
462
-                $value = date(get_option('time_format'), strtotime($post->{$cf['htmlvar_name']}));
463
-
464
-            $field_icon = geodir_field_icon_proccess($cf);
465
-            if (strpos($field_icon, 'http') !== false) {
466
-                $field_icon_af = '';
467
-            } elseif ($field_icon == '') {
468
-                $field_icon_af = '<i class="fa fa-clock-o"></i>';
469
-            } else {
470
-                $field_icon_af = $field_icon;
471
-                $field_icon = '';
472
-            }
473
-
474
-
475
-            $html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-time" style="' . $field_icon . '">' . $field_icon_af;
476
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '&nbsp;';
477
-            $html .= '</span>' . $value . '</div>';
478
-
479
-        endif;
480
-
481
-    }
482
-
483
-    return $html;
405
+	// check we have the post value
406
+	if(is_int($p)){$post = geodir_get_post_info($p);}
407
+	else{ global $post;}
408
+
409
+	if(!is_array($cf) && $cf!=''){
410
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
411
+		if(!$cf){return NULL;}
412
+	}
413
+
414
+	$html_var = $cf['htmlvar_name'];
415
+
416
+	// Check if there is a location specific filter.
417
+	if(has_filter("geodir_custom_field_output_time_loc_{$location}")){
418
+		/**
419
+		 * Filter the time html by location.
420
+		 *
421
+		 * @param string $html The html to filter.
422
+		 * @param array $cf The custom field array.
423
+		 * @since 1.6.6
424
+		 */
425
+		$html = apply_filters("geodir_custom_field_output_time_loc_{$location}",$html,$cf);
426
+	}
427
+
428
+	// Check if there is a custom field specific filter.
429
+	if(has_filter("geodir_custom_field_output_time_var_{$html_var}")){
430
+		/**
431
+		 * Filter the time html by individual custom field.
432
+		 *
433
+		 * @param string $html The html to filter.
434
+		 * @param string $location The location to output the html.
435
+		 * @param array $cf The custom field array.
436
+		 * @since 1.6.6
437
+		 */
438
+		$html = apply_filters("geodir_custom_field_output_time_var_{$html_var}",$html,$location,$cf);
439
+	}
440
+
441
+	// Check if there is a custom field key specific filter.
442
+	if(has_filter("geodir_custom_field_output_time_key_{$cf['field_type_key']}")){
443
+		/**
444
+		 * Filter the time html by field type key.
445
+		 *
446
+		 * @param string $html The html to filter.
447
+		 * @param string $location The location to output the html.
448
+		 * @param array $cf The custom field array.
449
+		 * @since 1.6.6
450
+		 */
451
+		$html = apply_filters("geodir_custom_field_output_time_key_{$cf['field_type_key']}",$html,$location,$cf);
452
+	}
453
+
454
+	// If not html then we run the standard output.
455
+	if(empty($html)){
456
+
457
+		if ($post->{$cf['htmlvar_name']}):
458
+
459
+			$value = '';
460
+			if ($post->{$cf['htmlvar_name']} != '')
461
+				//$value = date('h:i',strtotime($post->{$cf['htmlvar_name']}));
462
+				$value = date(get_option('time_format'), strtotime($post->{$cf['htmlvar_name']}));
463
+
464
+			$field_icon = geodir_field_icon_proccess($cf);
465
+			if (strpos($field_icon, 'http') !== false) {
466
+				$field_icon_af = '';
467
+			} elseif ($field_icon == '') {
468
+				$field_icon_af = '<i class="fa fa-clock-o"></i>';
469
+			} else {
470
+				$field_icon_af = $field_icon;
471
+				$field_icon = '';
472
+			}
473
+
474
+
475
+			$html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-time" style="' . $field_icon . '">' . $field_icon_af;
476
+			$html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '&nbsp;';
477
+			$html .= '</span>' . $value . '</div>';
478
+
479
+		endif;
480
+
481
+	}
482
+
483
+	return $html;
484 484
 }
485 485
 add_filter('geodir_custom_field_output_time','geodir_cf_time',10,3);
486 486
 
@@ -496,111 +496,111 @@  discard block
 block discarded – undo
496 496
  * @return string The html to output for the custom field.
497 497
  */
498 498
 function geodir_cf_datepicker($html,$location,$cf,$p=''){
499
-    global $preview;
500
-    // check we have the post value
501
-    if(is_int($p)){$post = geodir_get_post_info($p);}
502
-    else{ global $post;}
503
-
504
-    if(!is_array($cf) && $cf!=''){
505
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
506
-        if(!$cf){return NULL;}
507
-    }
508
-
509
-    $html_var = $cf['htmlvar_name'];
510
-
511
-    // Check if there is a location specific filter.
512
-    if(has_filter("geodir_custom_field_output_datepicker_loc_{$location}")){
513
-        /**
514
-         * Filter the datepicker html by location.
515
-         *
516
-         * @param string $html The html to filter.
517
-         * @param array $cf The custom field array.
518
-         * @since 1.6.6
519
-         */
520
-        $html = apply_filters("geodir_custom_field_output_datepicker_loc_{$location}",$html,$cf);
521
-    }
522
-
523
-    // Check if there is a custom field specific filter.
524
-    if(has_filter("geodir_custom_field_output_datepicker_var_{$html_var}")){
525
-        /**
526
-         * Filter the datepicker html by individual custom field.
527
-         *
528
-         * @param string $html The html to filter.
529
-         * @param string $location The location to output the html.
530
-         * @param array $cf The custom field array.
531
-         * @since 1.6.6
532
-         */
533
-        $html = apply_filters("geodir_custom_field_output_datepicker_var_{$html_var}",$html,$location,$cf);
534
-    }
535
-
536
-    // Check if there is a custom field key specific filter.
537
-    if(has_filter("geodir_custom_field_output_datepicker_key_{$cf['field_type_key']}")){
538
-        /**
539
-         * Filter the datepicker html by field type key.
540
-         *
541
-         * @param string $html The html to filter.
542
-         * @param string $location The location to output the html.
543
-         * @param array $cf The custom field array.
544
-         * @since 1.6.6
545
-         */
546
-        $html = apply_filters("geodir_custom_field_output_datepicker_key_{$cf['field_type_key']}",$html,$location,$cf);
547
-    }
548
-
549
-    // If not html then we run the standard output.
550
-    if(empty($html)){
551
-
552
-        if ($post->{$cf['htmlvar_name']}):
553
-
554
-            $date_format = geodir_default_date_format();
555
-            if ($cf['extra_fields'] != '') {
556
-                $date_format = stripslashes_deep(unserialize($cf['extra_fields']));
557
-                $date_format = $date_format['date_format'];
558
-            }
559
-            // check if we need to change the format or not
560
-            $date_format_len = strlen(str_replace(' ', '', $date_format));
561
-            if($date_format_len>5){// if greater then 4 then it's the old style format.
562
-
563
-                $search = array('dd','d','DD','mm','m','MM','yy'); //jQuery UI datepicker format
564
-                $replace = array('d','j','l','m','n','F','Y');//PHP date format
565
-
566
-                $date_format = str_replace($search, $replace, $date_format);
567
-
568
-                $post_htmlvar_value = ($date_format == 'd/m/Y' || $date_format == 'j/n/Y' ) ? str_replace('/', '-', $post->{$cf['htmlvar_name']}) : $post->{$cf['htmlvar_name']}; // PHP doesn't work well with dd/mm/yyyy format
569
-            }else{
570
-                $post_htmlvar_value = $post->{$cf['htmlvar_name']};
571
-            }
572
-
573
-            if ($post->{$cf['htmlvar_name']} != '' && $post->{$cf['htmlvar_name']}!="0000-00-00") {
574
-                $date_format_from = $preview ? $date_format : 'Y-m-d';
575
-                $value = geodir_date($post_htmlvar_value, $date_format, $date_format_from); // save as sql format Y-m-d
576
-                //$post_htmlvar_value = strpos($post_htmlvar_value, '/') !== false ? str_replace('/', '-', $post_htmlvar_value) : $post_htmlvar_value;
577
-                //$value = date_i18n($date_format, strtotime($post_htmlvar_value));
578
-            }else{
579
-                return '';
580
-            }
581
-
582
-            $field_icon = geodir_field_icon_proccess($cf);
583
-
584
-            if (strpos($field_icon, 'http') !== false) {
585
-                $field_icon_af = '';
586
-            } elseif ($field_icon == '') {
587
-                $field_icon_af = '<i class="fa fa-calendar"></i>';
588
-            } else {
589
-                $field_icon_af = $field_icon;
590
-                $field_icon = '';
591
-            }
592
-
593
-
594
-
595
-            $html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-datepicker" style="' . $field_icon . '">' . $field_icon_af;
596
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
597
-            $html .= '</span>' . $value . '</div>';
598
-
599
-        endif;
600
-
601
-    }
602
-
603
-    return $html;
499
+	global $preview;
500
+	// check we have the post value
501
+	if(is_int($p)){$post = geodir_get_post_info($p);}
502
+	else{ global $post;}
503
+
504
+	if(!is_array($cf) && $cf!=''){
505
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
506
+		if(!$cf){return NULL;}
507
+	}
508
+
509
+	$html_var = $cf['htmlvar_name'];
510
+
511
+	// Check if there is a location specific filter.
512
+	if(has_filter("geodir_custom_field_output_datepicker_loc_{$location}")){
513
+		/**
514
+		 * Filter the datepicker html by location.
515
+		 *
516
+		 * @param string $html The html to filter.
517
+		 * @param array $cf The custom field array.
518
+		 * @since 1.6.6
519
+		 */
520
+		$html = apply_filters("geodir_custom_field_output_datepicker_loc_{$location}",$html,$cf);
521
+	}
522
+
523
+	// Check if there is a custom field specific filter.
524
+	if(has_filter("geodir_custom_field_output_datepicker_var_{$html_var}")){
525
+		/**
526
+		 * Filter the datepicker html by individual custom field.
527
+		 *
528
+		 * @param string $html The html to filter.
529
+		 * @param string $location The location to output the html.
530
+		 * @param array $cf The custom field array.
531
+		 * @since 1.6.6
532
+		 */
533
+		$html = apply_filters("geodir_custom_field_output_datepicker_var_{$html_var}",$html,$location,$cf);
534
+	}
535
+
536
+	// Check if there is a custom field key specific filter.
537
+	if(has_filter("geodir_custom_field_output_datepicker_key_{$cf['field_type_key']}")){
538
+		/**
539
+		 * Filter the datepicker html by field type key.
540
+		 *
541
+		 * @param string $html The html to filter.
542
+		 * @param string $location The location to output the html.
543
+		 * @param array $cf The custom field array.
544
+		 * @since 1.6.6
545
+		 */
546
+		$html = apply_filters("geodir_custom_field_output_datepicker_key_{$cf['field_type_key']}",$html,$location,$cf);
547
+	}
548
+
549
+	// If not html then we run the standard output.
550
+	if(empty($html)){
551
+
552
+		if ($post->{$cf['htmlvar_name']}):
553
+
554
+			$date_format = geodir_default_date_format();
555
+			if ($cf['extra_fields'] != '') {
556
+				$date_format = stripslashes_deep(unserialize($cf['extra_fields']));
557
+				$date_format = $date_format['date_format'];
558
+			}
559
+			// check if we need to change the format or not
560
+			$date_format_len = strlen(str_replace(' ', '', $date_format));
561
+			if($date_format_len>5){// if greater then 4 then it's the old style format.
562
+
563
+				$search = array('dd','d','DD','mm','m','MM','yy'); //jQuery UI datepicker format
564
+				$replace = array('d','j','l','m','n','F','Y');//PHP date format
565
+
566
+				$date_format = str_replace($search, $replace, $date_format);
567
+
568
+				$post_htmlvar_value = ($date_format == 'd/m/Y' || $date_format == 'j/n/Y' ) ? str_replace('/', '-', $post->{$cf['htmlvar_name']}) : $post->{$cf['htmlvar_name']}; // PHP doesn't work well with dd/mm/yyyy format
569
+			}else{
570
+				$post_htmlvar_value = $post->{$cf['htmlvar_name']};
571
+			}
572
+
573
+			if ($post->{$cf['htmlvar_name']} != '' && $post->{$cf['htmlvar_name']}!="0000-00-00") {
574
+				$date_format_from = $preview ? $date_format : 'Y-m-d';
575
+				$value = geodir_date($post_htmlvar_value, $date_format, $date_format_from); // save as sql format Y-m-d
576
+				//$post_htmlvar_value = strpos($post_htmlvar_value, '/') !== false ? str_replace('/', '-', $post_htmlvar_value) : $post_htmlvar_value;
577
+				//$value = date_i18n($date_format, strtotime($post_htmlvar_value));
578
+			}else{
579
+				return '';
580
+			}
581
+
582
+			$field_icon = geodir_field_icon_proccess($cf);
583
+
584
+			if (strpos($field_icon, 'http') !== false) {
585
+				$field_icon_af = '';
586
+			} elseif ($field_icon == '') {
587
+				$field_icon_af = '<i class="fa fa-calendar"></i>';
588
+			} else {
589
+				$field_icon_af = $field_icon;
590
+				$field_icon = '';
591
+			}
592
+
593
+
594
+
595
+			$html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-datepicker" style="' . $field_icon . '">' . $field_icon_af;
596
+			$html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
597
+			$html .= '</span>' . $value . '</div>';
598
+
599
+		endif;
600
+
601
+	}
602
+
603
+	return $html;
604 604
 }
605 605
 add_filter('geodir_custom_field_output_datepicker','geodir_cf_datepicker',10,3);
606 606
 
@@ -617,97 +617,97 @@  discard block
 block discarded – undo
617 617
  */
618 618
 function geodir_cf_text($html,$location,$cf,$p=''){
619 619
 
620
-    // check we have the post value
621
-    if(is_int($p)){$post = geodir_get_post_info($p);}
622
-    else{ global $post;}
623
-
624
-    if(!is_array($cf) && $cf!=''){
625
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
626
-        if(!$cf){return NULL;}
627
-    }
628
-
629
-    $html_var = $cf['htmlvar_name'];
630
-
631
-    // Check if there is a location specific filter.
632
-    if(has_filter("geodir_custom_field_output_text_loc_{$location}")){
633
-        /**
634
-         * Filter the text html by location.
635
-         *
636
-         * @param string $html The html to filter.
637
-         * @param array $cf The custom field array.
638
-         * @since 1.6.6
639
-         */
640
-        $html = apply_filters("geodir_custom_field_output_text_loc_{$location}",$html,$cf);
641
-    }
642
-
643
-    // Check if there is a custom field specific filter.
644
-    if(has_filter("geodir_custom_field_output_text_var_{$html_var}")){
645
-        /**
646
-         * Filter the text html by individual custom field.
647
-         *
648
-         * @param string $html The html to filter.
649
-         * @param string $location The location to output the html.
650
-         * @param array $cf The custom field array.
651
-         * @since 1.6.6
652
-         */
653
-        $html = apply_filters("geodir_custom_field_output_text_var_{$html_var}",$html,$location,$cf);
654
-    }
655
-
656
-    // Check if there is a custom field key specific filter.
657
-    if(has_filter("geodir_custom_field_output_text_key_{$cf['field_type_key']}")){
658
-        /**
659
-         * Filter the text html by field type key.
660
-         *
661
-         * @param string $html The html to filter.
662
-         * @param string $location The location to output the html.
663
-         * @param array $cf The custom field array.
664
-         * @since 1.6.6
665
-         */
666
-        $html = apply_filters("geodir_custom_field_output_text_key_{$cf['field_type_key']}",$html,$location,$cf);
667
-    }
620
+	// check we have the post value
621
+	if(is_int($p)){$post = geodir_get_post_info($p);}
622
+	else{ global $post;}
623
+
624
+	if(!is_array($cf) && $cf!=''){
625
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
626
+		if(!$cf){return NULL;}
627
+	}
628
+
629
+	$html_var = $cf['htmlvar_name'];
630
+
631
+	// Check if there is a location specific filter.
632
+	if(has_filter("geodir_custom_field_output_text_loc_{$location}")){
633
+		/**
634
+		 * Filter the text html by location.
635
+		 *
636
+		 * @param string $html The html to filter.
637
+		 * @param array $cf The custom field array.
638
+		 * @since 1.6.6
639
+		 */
640
+		$html = apply_filters("geodir_custom_field_output_text_loc_{$location}",$html,$cf);
641
+	}
642
+
643
+	// Check if there is a custom field specific filter.
644
+	if(has_filter("geodir_custom_field_output_text_var_{$html_var}")){
645
+		/**
646
+		 * Filter the text html by individual custom field.
647
+		 *
648
+		 * @param string $html The html to filter.
649
+		 * @param string $location The location to output the html.
650
+		 * @param array $cf The custom field array.
651
+		 * @since 1.6.6
652
+		 */
653
+		$html = apply_filters("geodir_custom_field_output_text_var_{$html_var}",$html,$location,$cf);
654
+	}
655
+
656
+	// Check if there is a custom field key specific filter.
657
+	if(has_filter("geodir_custom_field_output_text_key_{$cf['field_type_key']}")){
658
+		/**
659
+		 * Filter the text html by field type key.
660
+		 *
661
+		 * @param string $html The html to filter.
662
+		 * @param string $location The location to output the html.
663
+		 * @param array $cf The custom field array.
664
+		 * @since 1.6.6
665
+		 */
666
+		$html = apply_filters("geodir_custom_field_output_text_key_{$cf['field_type_key']}",$html,$location,$cf);
667
+	}
668 668
 
669 669
     
670 670
 
671
-    // If not html then we run the standard output.
672
-    if(empty($html)){
671
+	// If not html then we run the standard output.
672
+	if(empty($html)){
673 673
 
674
-        if (isset($post->{$cf['htmlvar_name']}) && $post->{$cf['htmlvar_name']} != '' ):
674
+		if (isset($post->{$cf['htmlvar_name']}) && $post->{$cf['htmlvar_name']} != '' ):
675 675
 
676
-            $class = ($cf['htmlvar_name'] == 'geodir_timing') ? "geodir-i-time" : "geodir-i-text";
676
+			$class = ($cf['htmlvar_name'] == 'geodir_timing') ? "geodir-i-time" : "geodir-i-text";
677 677
 
678
-            $field_icon = geodir_field_icon_proccess($cf);
679
-            if (strpos($field_icon, 'http') !== false) {
680
-                $field_icon_af = '';
681
-            } elseif ($field_icon == '') {
682
-                $field_icon_af = ($cf['htmlvar_name'] == 'geodir_timing') ? '<i class="fa fa-clock-o"></i>' : "";
683
-            } else {
684
-                $field_icon_af = $field_icon;
685
-                $field_icon = '';
686
-            }
678
+			$field_icon = geodir_field_icon_proccess($cf);
679
+			if (strpos($field_icon, 'http') !== false) {
680
+				$field_icon_af = '';
681
+			} elseif ($field_icon == '') {
682
+				$field_icon_af = ($cf['htmlvar_name'] == 'geodir_timing') ? '<i class="fa fa-clock-o"></i>' : "";
683
+			} else {
684
+				$field_icon_af = $field_icon;
685
+				$field_icon = '';
686
+			}
687 687
 
688 688
 
689
-            $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="'.$class.'" style="' . $field_icon . '">' . $field_icon_af;
690
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
691
-            $html .= '</span>';
689
+			$html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="'.$class.'" style="' . $field_icon . '">' . $field_icon_af;
690
+			$html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
691
+			$html .= '</span>';
692 692
 
693
-            $value = $post->{$cf['htmlvar_name']};
694
-            if(isset($cf['data_type']) && ($cf['data_type']=='INT' || $cf['data_type']=='FLOAT') && isset($cf['extra_fields']) && $cf['extra_fields']){
695
-                $extra_fields = stripslashes_deep(maybe_unserialize($cf['extra_fields']));
696
-                if(isset($extra_fields['is_price']) && $extra_fields['is_price']){
697
-                    if(!ceil($value) > 0){return '';}// dont output blank prices
698
-                    $value = geodir_currency_format_number($value,$cf);
699
-                }
700
-            }
693
+			$value = $post->{$cf['htmlvar_name']};
694
+			if(isset($cf['data_type']) && ($cf['data_type']=='INT' || $cf['data_type']=='FLOAT') && isset($cf['extra_fields']) && $cf['extra_fields']){
695
+				$extra_fields = stripslashes_deep(maybe_unserialize($cf['extra_fields']));
696
+				if(isset($extra_fields['is_price']) && $extra_fields['is_price']){
697
+					if(!ceil($value) > 0){return '';}// dont output blank prices
698
+					$value = geodir_currency_format_number($value,$cf);
699
+				}
700
+			}
701 701
 
702 702
 
703
-            $html .= $value;
704
-            $html .= '</div>';
703
+			$html .= $value;
704
+			$html .= '</div>';
705 705
 
706
-        endif;
706
+		endif;
707 707
 
708
-    }
708
+	}
709 709
 
710
-    return $html;
710
+	return $html;
711 711
 }
712 712
 add_filter('geodir_custom_field_output_text','geodir_cf_text',10,3);
713 713
 
@@ -724,98 +724,98 @@  discard block
 block discarded – undo
724 724
  */
725 725
 function geodir_cf_radio($html,$location,$cf,$p=''){
726 726
 
727
-    // check we have the post value
728
-    if(is_int($p)){$post = geodir_get_post_info($p);}
729
-    else{ global $post;}
730
-
731
-    if(!is_array($cf) && $cf!=''){
732
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
733
-        if(!$cf){return NULL;}
734
-    }
735
-
736
-    $html_var = $cf['htmlvar_name'];
737
-
738
-    // Check if there is a location specific filter.
739
-    if(has_filter("geodir_custom_field_output_radio_loc_{$location}")){
740
-        /**
741
-         * Filter the radio html by location.
742
-         *
743
-         * @param string $html The html to filter.
744
-         * @param array $cf The custom field array.
745
-         * @since 1.6.6
746
-         */
747
-        $html = apply_filters("geodir_custom_field_output_radio_loc_{$location}",$html,$cf);
748
-    }
749
-
750
-    // Check if there is a custom field specific filter.
751
-    if(has_filter("geodir_custom_field_output_radio_var_{$html_var}")){
752
-        /**
753
-         * Filter the radio html by individual custom field.
754
-         *
755
-         * @param string $html The html to filter.
756
-         * @param string $location The location to output the html.
757
-         * @param array $cf The custom field array.
758
-         * @since 1.6.6
759
-         */
760
-        $html = apply_filters("geodir_custom_field_output_radio_var_{$html_var}",$html,$location,$cf);
761
-    }
762
-
763
-    // Check if there is a custom field key specific filter.
764
-    if(has_filter("geodir_custom_field_output_radio_key_{$cf['field_type_key']}")){
765
-        /**
766
-         * Filter the radio html by field type key.
767
-         *
768
-         * @param string $html The html to filter.
769
-         * @param string $location The location to output the html.
770
-         * @param array $cf The custom field array.
771
-         * @since 1.6.6
772
-         */
773
-        $html = apply_filters("geodir_custom_field_output_radio_key_{$cf['field_type_key']}",$html,$location,$cf);
774
-    }
775
-
776
-    // If not html then we run the standard output.
777
-    if(empty($html)){
778
-
779
-        $html_val = isset($post->{$cf['htmlvar_name']}) ? __($post->{$cf['htmlvar_name']}, 'geodirectory') : '';
780
-        if (isset($post->{$cf['htmlvar_name']}) && $post->{$cf['htmlvar_name']} != ''):
781
-
782
-            if ($post->{$cf['htmlvar_name']} == 'f' || $post->{$cf['htmlvar_name']} == '0') {
783
-                $html_val = __('No', 'geodirectory');
784
-            } else if ($post->{$cf['htmlvar_name']} == 't' || $post->{$cf['htmlvar_name']} == '1') {
785
-                $html_val = __('Yes', 'geodirectory');
786
-            } else {
787
-                if (!empty($cf['option_values'])) {
788
-                    $cf_option_values = geodir_string_values_to_options(stripslashes_deep($cf['option_values']), true);
789
-
790
-                    if (!empty($cf_option_values)) {
791
-                        foreach ($cf_option_values as $cf_option_value) {
792
-                            if (isset($cf_option_value['value']) && $cf_option_value['value'] == $post->{$cf['htmlvar_name']}) {
793
-                                $html_val = $cf_option_value['label'];
794
-                            }
795
-                        }
796
-                    }
797
-                }
798
-            }
799
-
800
-            $field_icon = geodir_field_icon_proccess($cf);
801
-            if (strpos($field_icon, 'http') !== false) {
802
-                $field_icon_af = '';
803
-            } elseif ($field_icon == '') {
804
-                $field_icon_af = '';
805
-            } else {
806
-                $field_icon_af = $field_icon;
807
-                $field_icon = '';
808
-            }
809
-
810
-
811
-            $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-radio" style="' . $field_icon . '">' . $field_icon_af;
812
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
813
-            $html .= '</span>' . $html_val . '</div>';
814
-        endif;
815
-
816
-    }
817
-
818
-    return $html;
727
+	// check we have the post value
728
+	if(is_int($p)){$post = geodir_get_post_info($p);}
729
+	else{ global $post;}
730
+
731
+	if(!is_array($cf) && $cf!=''){
732
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
733
+		if(!$cf){return NULL;}
734
+	}
735
+
736
+	$html_var = $cf['htmlvar_name'];
737
+
738
+	// Check if there is a location specific filter.
739
+	if(has_filter("geodir_custom_field_output_radio_loc_{$location}")){
740
+		/**
741
+		 * Filter the radio html by location.
742
+		 *
743
+		 * @param string $html The html to filter.
744
+		 * @param array $cf The custom field array.
745
+		 * @since 1.6.6
746
+		 */
747
+		$html = apply_filters("geodir_custom_field_output_radio_loc_{$location}",$html,$cf);
748
+	}
749
+
750
+	// Check if there is a custom field specific filter.
751
+	if(has_filter("geodir_custom_field_output_radio_var_{$html_var}")){
752
+		/**
753
+		 * Filter the radio html by individual custom field.
754
+		 *
755
+		 * @param string $html The html to filter.
756
+		 * @param string $location The location to output the html.
757
+		 * @param array $cf The custom field array.
758
+		 * @since 1.6.6
759
+		 */
760
+		$html = apply_filters("geodir_custom_field_output_radio_var_{$html_var}",$html,$location,$cf);
761
+	}
762
+
763
+	// Check if there is a custom field key specific filter.
764
+	if(has_filter("geodir_custom_field_output_radio_key_{$cf['field_type_key']}")){
765
+		/**
766
+		 * Filter the radio html by field type key.
767
+		 *
768
+		 * @param string $html The html to filter.
769
+		 * @param string $location The location to output the html.
770
+		 * @param array $cf The custom field array.
771
+		 * @since 1.6.6
772
+		 */
773
+		$html = apply_filters("geodir_custom_field_output_radio_key_{$cf['field_type_key']}",$html,$location,$cf);
774
+	}
775
+
776
+	// If not html then we run the standard output.
777
+	if(empty($html)){
778
+
779
+		$html_val = isset($post->{$cf['htmlvar_name']}) ? __($post->{$cf['htmlvar_name']}, 'geodirectory') : '';
780
+		if (isset($post->{$cf['htmlvar_name']}) && $post->{$cf['htmlvar_name']} != ''):
781
+
782
+			if ($post->{$cf['htmlvar_name']} == 'f' || $post->{$cf['htmlvar_name']} == '0') {
783
+				$html_val = __('No', 'geodirectory');
784
+			} else if ($post->{$cf['htmlvar_name']} == 't' || $post->{$cf['htmlvar_name']} == '1') {
785
+				$html_val = __('Yes', 'geodirectory');
786
+			} else {
787
+				if (!empty($cf['option_values'])) {
788
+					$cf_option_values = geodir_string_values_to_options(stripslashes_deep($cf['option_values']), true);
789
+
790
+					if (!empty($cf_option_values)) {
791
+						foreach ($cf_option_values as $cf_option_value) {
792
+							if (isset($cf_option_value['value']) && $cf_option_value['value'] == $post->{$cf['htmlvar_name']}) {
793
+								$html_val = $cf_option_value['label'];
794
+							}
795
+						}
796
+					}
797
+				}
798
+			}
799
+
800
+			$field_icon = geodir_field_icon_proccess($cf);
801
+			if (strpos($field_icon, 'http') !== false) {
802
+				$field_icon_af = '';
803
+			} elseif ($field_icon == '') {
804
+				$field_icon_af = '';
805
+			} else {
806
+				$field_icon_af = $field_icon;
807
+				$field_icon = '';
808
+			}
809
+
810
+
811
+			$html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-radio" style="' . $field_icon . '">' . $field_icon_af;
812
+			$html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
813
+			$html .= '</span>' . $html_val . '</div>';
814
+		endif;
815
+
816
+	}
817
+
818
+	return $html;
819 819
 }
820 820
 add_filter('geodir_custom_field_output_radio','geodir_cf_radio',10,3);
821 821
 
@@ -833,92 +833,92 @@  discard block
 block discarded – undo
833 833
  */
834 834
 function geodir_cf_select($html,$location,$cf,$p=''){
835 835
 
836
-    // check we have the post value
837
-    if(is_int($p)){$post = geodir_get_post_info($p);}
838
-    else{ global $post;}
839
-
840
-    if(!is_array($cf) && $cf!=''){
841
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
842
-        if(!$cf){return NULL;}
843
-    }
844
-
845
-    $html_var = $cf['htmlvar_name'];
846
-
847
-    // Check if there is a location specific filter.
848
-    if(has_filter("geodir_custom_field_output_select_loc_{$location}")){
849
-        /**
850
-         * Filter the select html by location.
851
-         *
852
-         * @param string $html The html to filter.
853
-         * @param array $cf The custom field array.
854
-         * @since 1.6.6
855
-         */
856
-        $html = apply_filters("geodir_custom_field_output_select_loc_{$location}",$html,$cf);
857
-    }
858
-
859
-    // Check if there is a custom field specific filter.
860
-    if(has_filter("geodir_custom_field_output_select_var_{$html_var}")){
861
-        /**
862
-         * Filter the select html by individual custom field.
863
-         *
864
-         * @param string $html The html to filter.
865
-         * @param string $location The location to output the html.
866
-         * @param array $cf The custom field array.
867
-         * @since 1.6.6
868
-         */
869
-        $html = apply_filters("geodir_custom_field_output_select_var_{$html_var}",$html,$location,$cf);
870
-    }
871
-
872
-    // Check if there is a custom field key specific filter.
873
-    if(has_filter("geodir_custom_field_output_select_key_{$cf['field_type_key']}")){
874
-        /**
875
-         * Filter the select html by field type key.
876
-         *
877
-         * @param string $html The html to filter.
878
-         * @param string $location The location to output the html.
879
-         * @param array $cf The custom field array.
880
-         * @since 1.6.6
881
-         */
882
-        $html = apply_filters("geodir_custom_field_output_select_key_{$cf['field_type_key']}",$html,$location,$cf);
883
-    }
884
-
885
-    // If not html then we run the standard output.
886
-    if(empty($html)){
887
-
888
-        if ($post->{$cf['htmlvar_name']}):
889
-            $field_value = __($post->{$cf['htmlvar_name']}, 'geodirectory');
890
-
891
-            if (!empty($cf['option_values'])) {
892
-                $cf_option_values = geodir_string_values_to_options(stripslashes_deep($cf['option_values']), true);
893
-
894
-                if (!empty($cf_option_values)) {
895
-                    foreach ($cf_option_values as $cf_option_value) {
896
-                        if (isset($cf_option_value['value']) && $cf_option_value['value'] == $post->{$cf['htmlvar_name']}) {
897
-                            $field_value = $cf_option_value['label']; // no longer needed here. Removed comment because it displays number instead of label if option vales set like "Good/1,Fair/2".
898
-                        }
899
-                    }
900
-                }
901
-            }
902
-
903
-            $field_icon = geodir_field_icon_proccess($cf);
904
-            if (strpos($field_icon, 'http') !== false) {
905
-                $field_icon_af = '';
906
-            } elseif ($field_icon == '') {
907
-                $field_icon_af = '';
908
-            } else {
909
-                $field_icon_af = $field_icon;
910
-                $field_icon = '';
911
-            }
912
-
913
-
914
-            $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af;
915
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
916
-            $html .= '</span>' . $field_value . '</div>';
917
-        endif;
918
-
919
-    }
920
-
921
-    return $html;
836
+	// check we have the post value
837
+	if(is_int($p)){$post = geodir_get_post_info($p);}
838
+	else{ global $post;}
839
+
840
+	if(!is_array($cf) && $cf!=''){
841
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
842
+		if(!$cf){return NULL;}
843
+	}
844
+
845
+	$html_var = $cf['htmlvar_name'];
846
+
847
+	// Check if there is a location specific filter.
848
+	if(has_filter("geodir_custom_field_output_select_loc_{$location}")){
849
+		/**
850
+		 * Filter the select html by location.
851
+		 *
852
+		 * @param string $html The html to filter.
853
+		 * @param array $cf The custom field array.
854
+		 * @since 1.6.6
855
+		 */
856
+		$html = apply_filters("geodir_custom_field_output_select_loc_{$location}",$html,$cf);
857
+	}
858
+
859
+	// Check if there is a custom field specific filter.
860
+	if(has_filter("geodir_custom_field_output_select_var_{$html_var}")){
861
+		/**
862
+		 * Filter the select html by individual custom field.
863
+		 *
864
+		 * @param string $html The html to filter.
865
+		 * @param string $location The location to output the html.
866
+		 * @param array $cf The custom field array.
867
+		 * @since 1.6.6
868
+		 */
869
+		$html = apply_filters("geodir_custom_field_output_select_var_{$html_var}",$html,$location,$cf);
870
+	}
871
+
872
+	// Check if there is a custom field key specific filter.
873
+	if(has_filter("geodir_custom_field_output_select_key_{$cf['field_type_key']}")){
874
+		/**
875
+		 * Filter the select html by field type key.
876
+		 *
877
+		 * @param string $html The html to filter.
878
+		 * @param string $location The location to output the html.
879
+		 * @param array $cf The custom field array.
880
+		 * @since 1.6.6
881
+		 */
882
+		$html = apply_filters("geodir_custom_field_output_select_key_{$cf['field_type_key']}",$html,$location,$cf);
883
+	}
884
+
885
+	// If not html then we run the standard output.
886
+	if(empty($html)){
887
+
888
+		if ($post->{$cf['htmlvar_name']}):
889
+			$field_value = __($post->{$cf['htmlvar_name']}, 'geodirectory');
890
+
891
+			if (!empty($cf['option_values'])) {
892
+				$cf_option_values = geodir_string_values_to_options(stripslashes_deep($cf['option_values']), true);
893
+
894
+				if (!empty($cf_option_values)) {
895
+					foreach ($cf_option_values as $cf_option_value) {
896
+						if (isset($cf_option_value['value']) && $cf_option_value['value'] == $post->{$cf['htmlvar_name']}) {
897
+							$field_value = $cf_option_value['label']; // no longer needed here. Removed comment because it displays number instead of label if option vales set like "Good/1,Fair/2".
898
+						}
899
+					}
900
+				}
901
+			}
902
+
903
+			$field_icon = geodir_field_icon_proccess($cf);
904
+			if (strpos($field_icon, 'http') !== false) {
905
+				$field_icon_af = '';
906
+			} elseif ($field_icon == '') {
907
+				$field_icon_af = '';
908
+			} else {
909
+				$field_icon_af = $field_icon;
910
+				$field_icon = '';
911
+			}
912
+
913
+
914
+			$html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af;
915
+			$html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
916
+			$html .= '</span>' . $field_value . '</div>';
917
+		endif;
918
+
919
+	}
920
+
921
+	return $html;
922 922
 }
923 923
 add_filter('geodir_custom_field_output_select','geodir_cf_select',10,3);
924 924
 
@@ -935,117 +935,117 @@  discard block
 block discarded – undo
935 935
  */
936 936
 function geodir_cf_multiselect($html,$location,$cf,$p=''){
937 937
 
938
-    // check we have the post value
939
-    if(is_int($p)){$post = geodir_get_post_info($p);}
940
-    else{ global $post;}
941
-
942
-    if(!is_array($cf) && $cf!=''){
943
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
944
-        if(!$cf){return NULL;}
945
-    }
946
-
947
-    $html_var = $cf['htmlvar_name'];
948
-
949
-    // Check if there is a location specific filter.
950
-    if(has_filter("geodir_custom_field_output_multiselect_loc_{$location}")){
951
-        /**
952
-         * Filter the multiselect html by location.
953
-         *
954
-         * @param string $html The html to filter.
955
-         * @param array $cf The custom field array.
956
-         * @since 1.6.6
957
-         */
958
-        $html = apply_filters("geodir_custom_field_output_multiselect_loc_{$location}",$html,$cf);
959
-    }
960
-
961
-    // Check if there is a custom field specific filter.
962
-    if(has_filter("geodir_custom_field_output_multiselect_var_{$html_var}")){
963
-        /**
964
-         * Filter the multiselect html by individual custom field.
965
-         *
966
-         * @param string $html The html to filter.
967
-         * @param string $location The location to output the html.
968
-         * @param array $cf The custom field array.
969
-         * @since 1.6.6
970
-         */
971
-        $html = apply_filters("geodir_custom_field_output_multiselect_var_{$html_var}",$html,$location,$cf);
972
-    }
973
-
974
-    // Check if there is a custom field key specific filter.
975
-    if(has_filter("geodir_custom_field_output_multiselect_key_{$cf['field_type_key']}")){
976
-        /**
977
-         * Filter the multiselect html by field type key.
978
-         *
979
-         * @param string $html The html to filter.
980
-         * @param string $location The location to output the html.
981
-         * @param array $cf The custom field array.
982
-         * @since 1.6.6
983
-         */
984
-        $html = apply_filters("geodir_custom_field_output_multiselect_key_{$cf['field_type_key']}",$html,$location,$cf);
985
-    }
986
-
987
-    // If not html then we run the standard output.
988
-    if(empty($html)){
989
-
990
-
991
-        if (!empty($post->{$cf['htmlvar_name']})):
992
-
993
-            if (is_array($post->{$cf['htmlvar_name']})) {
994
-                $post->{$cf['htmlvar_name']} = implode(', ', $post->{$cf['htmlvar_name']});
995
-            }
996
-
997
-            $field_icon = geodir_field_icon_proccess($cf);
998
-            if (strpos($field_icon, 'http') !== false) {
999
-                $field_icon_af = '';
1000
-            } elseif ($field_icon == '') {
1001
-                $field_icon_af = '';
1002
-            } else {
1003
-                $field_icon_af = $field_icon;
1004
-                $field_icon = '';
1005
-            }
1006
-
1007
-            $field_values = explode(',', trim($post->{$cf['htmlvar_name']}, ","));
1008
-
1009
-            if(is_array($field_values)){
1010
-                $field_values = array_map('trim', $field_values);
1011
-            }
1012
-
1013
-            $option_values = array();
1014
-            if (!empty($cf['option_values'])) {
1015
-                $cf_option_values = geodir_string_values_to_options(stripslashes_deep($cf['option_values']), true);
1016
-
1017
-                if (!empty($cf_option_values)) {
1018
-                    foreach ($cf_option_values as $cf_option_value) {
1019
-                        if (isset($cf_option_value['value']) && in_array($cf_option_value['value'], $field_values)) {
1020
-                            $option_values[] = $cf_option_value['label'];
1021
-                        }
1022
-                    }
1023
-                }
1024
-            }
1025
-
1026
-
1027
-            $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af;
1028
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1029
-            $html .= '</span>';
1030
-
1031
-            if (count($option_values) > 1) {
1032
-                $html .= '<ul>';
1033
-
1034
-                foreach ($option_values as $val) {
1035
-                    $html .= '<li>' . $val . '</li>';
1036
-                }
1037
-
1038
-                $html .= '</ul>';
1039
-            } else {
1040
-                $html .= __($post->{$cf['htmlvar_name']}, 'geodirectory');
1041
-            }
1042
-
1043
-            $html .= '</div>';
1044
-        endif;
1045
-
1046
-    }
1047
-
1048
-    return $html;
938
+	// check we have the post value
939
+	if(is_int($p)){$post = geodir_get_post_info($p);}
940
+	else{ global $post;}
941
+
942
+	if(!is_array($cf) && $cf!=''){
943
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
944
+		if(!$cf){return NULL;}
945
+	}
946
+
947
+	$html_var = $cf['htmlvar_name'];
948
+
949
+	// Check if there is a location specific filter.
950
+	if(has_filter("geodir_custom_field_output_multiselect_loc_{$location}")){
951
+		/**
952
+		 * Filter the multiselect html by location.
953
+		 *
954
+		 * @param string $html The html to filter.
955
+		 * @param array $cf The custom field array.
956
+		 * @since 1.6.6
957
+		 */
958
+		$html = apply_filters("geodir_custom_field_output_multiselect_loc_{$location}",$html,$cf);
959
+	}
960
+
961
+	// Check if there is a custom field specific filter.
962
+	if(has_filter("geodir_custom_field_output_multiselect_var_{$html_var}")){
963
+		/**
964
+		 * Filter the multiselect html by individual custom field.
965
+		 *
966
+		 * @param string $html The html to filter.
967
+		 * @param string $location The location to output the html.
968
+		 * @param array $cf The custom field array.
969
+		 * @since 1.6.6
970
+		 */
971
+		$html = apply_filters("geodir_custom_field_output_multiselect_var_{$html_var}",$html,$location,$cf);
972
+	}
973
+
974
+	// Check if there is a custom field key specific filter.
975
+	if(has_filter("geodir_custom_field_output_multiselect_key_{$cf['field_type_key']}")){
976
+		/**
977
+		 * Filter the multiselect html by field type key.
978
+		 *
979
+		 * @param string $html The html to filter.
980
+		 * @param string $location The location to output the html.
981
+		 * @param array $cf The custom field array.
982
+		 * @since 1.6.6
983
+		 */
984
+		$html = apply_filters("geodir_custom_field_output_multiselect_key_{$cf['field_type_key']}",$html,$location,$cf);
985
+	}
986
+
987
+	// If not html then we run the standard output.
988
+	if(empty($html)){
989
+
990
+
991
+		if (!empty($post->{$cf['htmlvar_name']})):
992
+
993
+			if (is_array($post->{$cf['htmlvar_name']})) {
994
+				$post->{$cf['htmlvar_name']} = implode(', ', $post->{$cf['htmlvar_name']});
995
+			}
996
+
997
+			$field_icon = geodir_field_icon_proccess($cf);
998
+			if (strpos($field_icon, 'http') !== false) {
999
+				$field_icon_af = '';
1000
+			} elseif ($field_icon == '') {
1001
+				$field_icon_af = '';
1002
+			} else {
1003
+				$field_icon_af = $field_icon;
1004
+				$field_icon = '';
1005
+			}
1006
+
1007
+			$field_values = explode(',', trim($post->{$cf['htmlvar_name']}, ","));
1008
+
1009
+			if(is_array($field_values)){
1010
+				$field_values = array_map('trim', $field_values);
1011
+			}
1012
+
1013
+			$option_values = array();
1014
+			if (!empty($cf['option_values'])) {
1015
+				$cf_option_values = geodir_string_values_to_options(stripslashes_deep($cf['option_values']), true);
1016
+
1017
+				if (!empty($cf_option_values)) {
1018
+					foreach ($cf_option_values as $cf_option_value) {
1019
+						if (isset($cf_option_value['value']) && in_array($cf_option_value['value'], $field_values)) {
1020
+							$option_values[] = $cf_option_value['label'];
1021
+						}
1022
+					}
1023
+				}
1024
+			}
1025
+
1026
+
1027
+			$html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af;
1028
+			$html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1029
+			$html .= '</span>';
1030
+
1031
+			if (count($option_values) > 1) {
1032
+				$html .= '<ul>';
1033
+
1034
+				foreach ($option_values as $val) {
1035
+					$html .= '<li>' . $val . '</li>';
1036
+				}
1037
+
1038
+				$html .= '</ul>';
1039
+			} else {
1040
+				$html .= __($post->{$cf['htmlvar_name']}, 'geodirectory');
1041
+			}
1042
+
1043
+			$html .= '</div>';
1044
+		endif;
1045
+
1046
+	}
1047
+
1048
+	return $html;
1049 1049
 }
1050 1050
 add_filter('geodir_custom_field_output_multiselect','geodir_cf_multiselect',10,3);
1051 1051
 
@@ -1062,155 +1062,155 @@  discard block
 block discarded – undo
1062 1062
  */
1063 1063
 function geodir_cf_email($html,$location,$cf,$p=''){
1064 1064
 
1065
-    // check we have the post value
1066
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1067
-    else{ global $post;}
1068
-
1069
-    if(!is_array($cf) && $cf!=''){
1070
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1071
-        if(!$cf){return NULL;}
1072
-    }
1073
-
1074
-    $html_var = $cf['htmlvar_name'];
1075
-
1076
-    // Check if there is a location specific filter.
1077
-    if(has_filter("geodir_custom_field_output_email_loc_{$location}")){
1078
-        /**
1079
-         * Filter the email html by location.
1080
-         *
1081
-         * @param string $html The html to filter.
1082
-         * @param array $cf The custom field array.
1083
-         * @since 1.6.6
1084
-         */
1085
-        $html = apply_filters("geodir_custom_field_output_email_loc_{$location}",$html,$cf);
1086
-    }
1087
-
1088
-    // Check if there is a custom field specific filter.
1089
-    if(has_filter("geodir_custom_field_output_email_var_{$html_var}")){
1090
-        /**
1091
-         * Filter the email html by individual custom field.
1092
-         *
1093
-         * @param string $html The html to filter.
1094
-         * @param string $location The location to output the html.
1095
-         * @param array $cf The custom field array.
1096
-         * @since 1.6.6
1097
-         */
1098
-        $html = apply_filters("geodir_custom_field_output_email_var_{$html_var}",$html,$location,$cf);
1099
-    }
1100
-
1101
-    // Check if there is a custom field key specific filter.
1102
-    if(has_filter("geodir_custom_field_output_email_key_{$cf['field_type_key']}")){
1103
-        /**
1104
-         * Filter the email html by field type key.
1105
-         *
1106
-         * @param string $html The html to filter.
1107
-         * @param string $location The location to output the html.
1108
-         * @param array $cf The custom field array.
1109
-         * @since 1.6.6
1110
-         */
1111
-        $html = apply_filters("geodir_custom_field_output_email_key_{$cf['field_type_key']}",$html,$location,$cf);
1112
-    }
1113
-
1114
-    // If not html then we run the standard output.
1115
-    if(empty($html)){
1116
-
1117
-        global $preview;
1118
-        if ($cf['htmlvar_name'] == 'geodir_email' && !(geodir_is_page('detail') || geodir_is_page('preview'))) {
1119
-            return ''; // Remove Send Enquiry | Send To Friend from listings page
1120
-        }
1121
-
1122
-        $package_info = (array)geodir_post_package_info(array(), $post, $post->post_type);
1123
-
1124
-        if ($cf['htmlvar_name'] == 'geodir_email' && ((isset($package_info['sendtofriend']) && $package_info['sendtofriend']) || $post->{$cf['htmlvar_name']})) {
1125
-            global $send_to_friend;
1126
-            $send_to_friend = true;
1127
-            $b_send_inquiry = '';
1128
-            $b_sendtofriend = '';
1129
-
1130
-            $html = '';
1131
-            if (!$preview) {
1132
-                $b_send_inquiry = 'b_send_inquiry';
1133
-                $b_sendtofriend = 'b_sendtofriend';
1134
-                $html = '<input type="hidden" name="geodir_popup_post_id" value="' . $post->ID . '" /><div class="geodir_display_popup_forms"></div>';
1135
-            }
1136
-
1137
-            $field_icon = geodir_field_icon_proccess($cf);
1138
-            if (strpos($field_icon, 'http') !== false) {
1139
-                $field_icon_af = '';
1140
-            } elseif ($field_icon == '') {
1141
-                $field_icon_af = '<i class="fa fa-envelope"></i>';
1142
-            } else {
1143
-                $field_icon_af = $field_icon;
1144
-                $field_icon = '';
1145
-            }
1146
-
1147
-            $html .= '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '"><span class="geodir-i-email" style="' . $field_icon . '">' . $field_icon_af;
1148
-            $seperator = '';
1149
-            if ($post->{$cf['htmlvar_name']}) {
1150
-                $b_send_inquiry_url = apply_filters('b_send_inquiry_url', 'javascript:void(0);');
1151
-                $html .= '<a href="'.$b_send_inquiry_url.'" class="' . $b_send_inquiry . '" >' . SEND_INQUIRY . '</a>';
1152
-                $seperator = ' | ';
1153
-            }
1154
-
1155
-            if (isset($package_info['sendtofriend']) && $package_info['sendtofriend']) {
1156
-                $b_sendtofriend_url = apply_filters('b_sendtofriend_url', 'javascript:void(0);');
1157
-                $html .= $seperator . '<a href="'.$b_sendtofriend_url.'" class="' . $b_sendtofriend . '">' . SEND_TO_FRIEND . '</a>';
1158
-            }
1159
-
1160
-            $html .= '</span></div>';
1161
-
1162
-
1163
-            if (isset($_REQUEST['send_inquiry']) && $_REQUEST['send_inquiry'] == 'success') {
1164
-                $html .= '<p class="sucess_msg">' . SEND_INQUIRY_SUCCESS . '</p>';
1165
-            } elseif (isset($_REQUEST['sendtofrnd']) && $_REQUEST['sendtofrnd'] == 'success') {
1166
-                $html .= '<p class="sucess_msg">' . SEND_FRIEND_SUCCESS . '</p>';
1167
-            } elseif (isset($_REQUEST['emsg']) && $_REQUEST['emsg'] == 'captch') {
1168
-                $html .= '<p class="error_msg_fix">' . WRONG_CAPTCH_MSG . '</p>';
1169
-            }
1170
-
1171
-            /*if(!$preview){require_once (geodir_plugin_path().'/geodirectory-templates/popup-forms.php');}*/
1172
-
1173
-        } else {
1174
-
1175
-            if ($post->{$cf['htmlvar_name']}) {
1176
-
1177
-                $field_icon = geodir_field_icon_proccess($cf);
1178
-                if (strpos($field_icon, 'http') !== false) {
1179
-                    $field_icon_af = '';
1180
-                } elseif ($field_icon == '') {
1181
-                    $field_icon_af = '<i class="fa fa-envelope"></i>';
1182
-                } else {
1183
-                    $field_icon_af = $field_icon;
1184
-                    $field_icon = '';
1185
-                }
1186
-
1187
-
1188
-                $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-email" style="' . $field_icon . '">' . $field_icon_af;
1189
-                $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1190
-                $html .= '</span><span class="geodir-email-address-output">';
1191
-                $email = $post->{$cf['htmlvar_name']} ;
1192
-                if($e_split = explode('@',$email)){
1193
-                    /**
1194
-                     * Filter email custom field name output.
1195
-                     *
1196
-                     * @since 1.5.3
1197
-                     *
1198
-                     * @param string $email The email string being output.
1199
-                     * @param array $cf Custom field variables array.
1200
-                     */
1201
-                    $email_name = apply_filters('geodir_email_field_name_output',$email,$cf);
1202
-                    $html .=  "<script>document.write('<a href=\"mailto:'+'$e_split[0]' + '@' + '$e_split[1]'+'\">$email_name</a>')</script>";
1203
-                }else{
1204
-                    $html .=  $email;
1205
-                }
1206
-                $html .= '</span></div>';
1207
-            }
1208
-
1209
-        }
1210
-
1211
-    }
1212
-
1213
-    return $html;
1065
+	// check we have the post value
1066
+	if(is_int($p)){$post = geodir_get_post_info($p);}
1067
+	else{ global $post;}
1068
+
1069
+	if(!is_array($cf) && $cf!=''){
1070
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1071
+		if(!$cf){return NULL;}
1072
+	}
1073
+
1074
+	$html_var = $cf['htmlvar_name'];
1075
+
1076
+	// Check if there is a location specific filter.
1077
+	if(has_filter("geodir_custom_field_output_email_loc_{$location}")){
1078
+		/**
1079
+		 * Filter the email html by location.
1080
+		 *
1081
+		 * @param string $html The html to filter.
1082
+		 * @param array $cf The custom field array.
1083
+		 * @since 1.6.6
1084
+		 */
1085
+		$html = apply_filters("geodir_custom_field_output_email_loc_{$location}",$html,$cf);
1086
+	}
1087
+
1088
+	// Check if there is a custom field specific filter.
1089
+	if(has_filter("geodir_custom_field_output_email_var_{$html_var}")){
1090
+		/**
1091
+		 * Filter the email html by individual custom field.
1092
+		 *
1093
+		 * @param string $html The html to filter.
1094
+		 * @param string $location The location to output the html.
1095
+		 * @param array $cf The custom field array.
1096
+		 * @since 1.6.6
1097
+		 */
1098
+		$html = apply_filters("geodir_custom_field_output_email_var_{$html_var}",$html,$location,$cf);
1099
+	}
1100
+
1101
+	// Check if there is a custom field key specific filter.
1102
+	if(has_filter("geodir_custom_field_output_email_key_{$cf['field_type_key']}")){
1103
+		/**
1104
+		 * Filter the email html by field type key.
1105
+		 *
1106
+		 * @param string $html The html to filter.
1107
+		 * @param string $location The location to output the html.
1108
+		 * @param array $cf The custom field array.
1109
+		 * @since 1.6.6
1110
+		 */
1111
+		$html = apply_filters("geodir_custom_field_output_email_key_{$cf['field_type_key']}",$html,$location,$cf);
1112
+	}
1113
+
1114
+	// If not html then we run the standard output.
1115
+	if(empty($html)){
1116
+
1117
+		global $preview;
1118
+		if ($cf['htmlvar_name'] == 'geodir_email' && !(geodir_is_page('detail') || geodir_is_page('preview'))) {
1119
+			return ''; // Remove Send Enquiry | Send To Friend from listings page
1120
+		}
1121
+
1122
+		$package_info = (array)geodir_post_package_info(array(), $post, $post->post_type);
1123
+
1124
+		if ($cf['htmlvar_name'] == 'geodir_email' && ((isset($package_info['sendtofriend']) && $package_info['sendtofriend']) || $post->{$cf['htmlvar_name']})) {
1125
+			global $send_to_friend;
1126
+			$send_to_friend = true;
1127
+			$b_send_inquiry = '';
1128
+			$b_sendtofriend = '';
1129
+
1130
+			$html = '';
1131
+			if (!$preview) {
1132
+				$b_send_inquiry = 'b_send_inquiry';
1133
+				$b_sendtofriend = 'b_sendtofriend';
1134
+				$html = '<input type="hidden" name="geodir_popup_post_id" value="' . $post->ID . '" /><div class="geodir_display_popup_forms"></div>';
1135
+			}
1136
+
1137
+			$field_icon = geodir_field_icon_proccess($cf);
1138
+			if (strpos($field_icon, 'http') !== false) {
1139
+				$field_icon_af = '';
1140
+			} elseif ($field_icon == '') {
1141
+				$field_icon_af = '<i class="fa fa-envelope"></i>';
1142
+			} else {
1143
+				$field_icon_af = $field_icon;
1144
+				$field_icon = '';
1145
+			}
1146
+
1147
+			$html .= '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '"><span class="geodir-i-email" style="' . $field_icon . '">' . $field_icon_af;
1148
+			$seperator = '';
1149
+			if ($post->{$cf['htmlvar_name']}) {
1150
+				$b_send_inquiry_url = apply_filters('b_send_inquiry_url', 'javascript:void(0);');
1151
+				$html .= '<a href="'.$b_send_inquiry_url.'" class="' . $b_send_inquiry . '" >' . SEND_INQUIRY . '</a>';
1152
+				$seperator = ' | ';
1153
+			}
1154
+
1155
+			if (isset($package_info['sendtofriend']) && $package_info['sendtofriend']) {
1156
+				$b_sendtofriend_url = apply_filters('b_sendtofriend_url', 'javascript:void(0);');
1157
+				$html .= $seperator . '<a href="'.$b_sendtofriend_url.'" class="' . $b_sendtofriend . '">' . SEND_TO_FRIEND . '</a>';
1158
+			}
1159
+
1160
+			$html .= '</span></div>';
1161
+
1162
+
1163
+			if (isset($_REQUEST['send_inquiry']) && $_REQUEST['send_inquiry'] == 'success') {
1164
+				$html .= '<p class="sucess_msg">' . SEND_INQUIRY_SUCCESS . '</p>';
1165
+			} elseif (isset($_REQUEST['sendtofrnd']) && $_REQUEST['sendtofrnd'] == 'success') {
1166
+				$html .= '<p class="sucess_msg">' . SEND_FRIEND_SUCCESS . '</p>';
1167
+			} elseif (isset($_REQUEST['emsg']) && $_REQUEST['emsg'] == 'captch') {
1168
+				$html .= '<p class="error_msg_fix">' . WRONG_CAPTCH_MSG . '</p>';
1169
+			}
1170
+
1171
+			/*if(!$preview){require_once (geodir_plugin_path().'/geodirectory-templates/popup-forms.php');}*/
1172
+
1173
+		} else {
1174
+
1175
+			if ($post->{$cf['htmlvar_name']}) {
1176
+
1177
+				$field_icon = geodir_field_icon_proccess($cf);
1178
+				if (strpos($field_icon, 'http') !== false) {
1179
+					$field_icon_af = '';
1180
+				} elseif ($field_icon == '') {
1181
+					$field_icon_af = '<i class="fa fa-envelope"></i>';
1182
+				} else {
1183
+					$field_icon_af = $field_icon;
1184
+					$field_icon = '';
1185
+				}
1186
+
1187
+
1188
+				$html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-email" style="' . $field_icon . '">' . $field_icon_af;
1189
+				$html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1190
+				$html .= '</span><span class="geodir-email-address-output">';
1191
+				$email = $post->{$cf['htmlvar_name']} ;
1192
+				if($e_split = explode('@',$email)){
1193
+					/**
1194
+					 * Filter email custom field name output.
1195
+					 *
1196
+					 * @since 1.5.3
1197
+					 *
1198
+					 * @param string $email The email string being output.
1199
+					 * @param array $cf Custom field variables array.
1200
+					 */
1201
+					$email_name = apply_filters('geodir_email_field_name_output',$email,$cf);
1202
+					$html .=  "<script>document.write('<a href=\"mailto:'+'$e_split[0]' + '@' + '$e_split[1]'+'\">$email_name</a>')</script>";
1203
+				}else{
1204
+					$html .=  $email;
1205
+				}
1206
+				$html .= '</span></div>';
1207
+			}
1208
+
1209
+		}
1210
+
1211
+	}
1212
+
1213
+	return $html;
1214 1214
 }
1215 1215
 add_filter('geodir_custom_field_output_email','geodir_cf_email',10,3);
1216 1216
 
@@ -1227,130 +1227,130 @@  discard block
 block discarded – undo
1227 1227
  */
1228 1228
 function geodir_cf_file($html,$location,$cf,$p=''){
1229 1229
 
1230
-    // check we have the post value
1231
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1232
-    else{ global $post;}
1233
-
1234
-    if(!is_array($cf) && $cf!=''){
1235
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1236
-        if(!$cf){return NULL;}
1237
-    }
1238
-
1239
-    $html_var = $cf['htmlvar_name'];
1240
-
1241
-    // Check if there is a location specific filter.
1242
-    if(has_filter("geodir_custom_field_output_file_loc_{$location}")){
1243
-        /**
1244
-         * Filter the file html by location.
1245
-         *
1246
-         * @param string $html The html to filter.
1247
-         * @param array $cf The custom field array.
1248
-         * @since 1.6.6
1249
-         */
1250
-        $html = apply_filters("geodir_custom_field_output_file_loc_{$location}",$html,$cf);
1251
-    }
1252
-
1253
-    // Check if there is a custom field specific filter.
1254
-    if(has_filter("geodir_custom_field_output_file_var_{$html_var}")){
1255
-        /**
1256
-         * Filter the file html by individual custom field.
1257
-         *
1258
-         * @param string $html The html to filter.
1259
-         * @param string $location The location to output the html.
1260
-         * @param array $cf The custom field array.
1261
-         * @since 1.6.6
1262
-         */
1263
-        $html = apply_filters("geodir_custom_field_output_file_var_{$html_var}",$html,$location,$cf);
1264
-    }
1265
-
1266
-    // Check if there is a custom field key specific filter.
1267
-    if(has_filter("geodir_custom_field_output_file_key_{$cf['field_type_key']}")){
1268
-        /**
1269
-         * Filter the file html by field type key.
1270
-         *
1271
-         * @param string $html The html to filter.
1272
-         * @param string $location The location to output the html.
1273
-         * @param array $cf The custom field array.
1274
-         * @since 1.6.6
1275
-         */
1276
-        $html = apply_filters("geodir_custom_field_output_file_key_{$cf['field_type_key']}",$html,$location,$cf);
1277
-    }
1278
-
1279
-    // If not html then we run the standard output.
1280
-    if(empty($html)){
1281
-
1282
-        if (!empty($post->{$cf['htmlvar_name']})):
1283
-
1284
-            $files = explode(",", $post->{$cf['htmlvar_name']});
1285
-            if (!empty($files)):
1286
-
1287
-                $extra_fields = !empty($cf['extra_fields']) ? stripslashes_deep(maybe_unserialize($cf['extra_fields'])) : NULL;
1288
-                $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? $extra_fields['gd_file_types'] : '';
1289
-
1290
-                $file_paths = '';
1291
-                foreach ($files as $file) {
1292
-                    if (!empty($file)) {
1293
-
1294
-                        // $filetype = wp_check_filetype($file);
1295
-
1296
-                        $image_name_arr = explode('/', $file);
1297
-                        $curr_img_dir = $image_name_arr[count($image_name_arr) - 2];
1298
-                        $filename = end($image_name_arr);
1299
-                        $img_name_arr = explode('.', $filename);
1300
-
1301
-                        $arr_file_type = wp_check_filetype($filename);
1302
-                        if (empty($arr_file_type['ext']) || empty($arr_file_type['type'])) {
1303
-                            continue;
1304
-                        }
1305
-
1306
-                        $uploaded_file_type = $arr_file_type['type'];
1307
-                        $uploaded_file_ext = $arr_file_type['ext'];
1308
-
1309
-                        if (!empty($allowed_file_types) && !in_array($uploaded_file_ext, $allowed_file_types)) {
1310
-                            continue; // Invalid file type.
1311
-                        }
1312
-
1313
-                        //$allowed_file_types = array('application/pdf', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'text/csv', 'text/plain');
1314
-                        $image_file_types = array('image/jpg', 'image/jpeg', 'image/gif', 'image/png', 'image/bmp', 'image/x-icon');
1315
-
1316
-                        // If the uploaded file is image
1317
-                        if (in_array($uploaded_file_type, $image_file_types)) {
1318
-                            $file_paths .= '<div class="geodir-custom-post-gallery" class="clearfix">';
1319
-                            $file_paths .= '<a href="'.$file.'">';
1320
-                            $file_paths .= geodir_show_image(array('src' => $file), 'thumbnail', false, false);
1321
-                            $file_paths .= '</a>';
1322
-                            //$file_paths .= '<img src="'.$file.'"  />';	
1323
-                            $file_paths .= '</div>';
1324
-                        } else {
1325
-                            $ext_path = '_' . $html_var . '_';
1326
-                            $filename = explode($ext_path, $filename);
1327
-                            $file_paths .= '<a href="' . $file . '" target="_blank">' . $filename[count($filename) - 1] . '</a>';
1328
-                        }
1329
-                    }
1330
-                }
1331
-
1332
-                $field_icon = geodir_field_icon_proccess($cf);
1333
-                if (strpos($field_icon, 'http') !== false) {
1334
-                    $field_icon_af = '';
1335
-                } elseif ($field_icon == '') {
1336
-                    $field_icon_af = '';
1337
-                } else {
1338
-                    $field_icon_af = $field_icon;
1339
-                    $field_icon = '';
1340
-                }
1341
-
1342
-                $html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' geodir-custom-file-box ' . $cf['htmlvar_name'] . '"><div class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af;
1343
-                $html .= '<span style="display: inline-block; vertical-align: top; padding-right: 14px;">';
1344
-                $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1345
-                $html .= '</span>';
1346
-                $html .= $file_paths . '</div></div>';
1347
-
1348
-            endif;
1349
-        endif;
1350
-
1351
-    }
1352
-
1353
-    return $html;
1230
+	// check we have the post value
1231
+	if(is_int($p)){$post = geodir_get_post_info($p);}
1232
+	else{ global $post;}
1233
+
1234
+	if(!is_array($cf) && $cf!=''){
1235
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1236
+		if(!$cf){return NULL;}
1237
+	}
1238
+
1239
+	$html_var = $cf['htmlvar_name'];
1240
+
1241
+	// Check if there is a location specific filter.
1242
+	if(has_filter("geodir_custom_field_output_file_loc_{$location}")){
1243
+		/**
1244
+		 * Filter the file html by location.
1245
+		 *
1246
+		 * @param string $html The html to filter.
1247
+		 * @param array $cf The custom field array.
1248
+		 * @since 1.6.6
1249
+		 */
1250
+		$html = apply_filters("geodir_custom_field_output_file_loc_{$location}",$html,$cf);
1251
+	}
1252
+
1253
+	// Check if there is a custom field specific filter.
1254
+	if(has_filter("geodir_custom_field_output_file_var_{$html_var}")){
1255
+		/**
1256
+		 * Filter the file html by individual custom field.
1257
+		 *
1258
+		 * @param string $html The html to filter.
1259
+		 * @param string $location The location to output the html.
1260
+		 * @param array $cf The custom field array.
1261
+		 * @since 1.6.6
1262
+		 */
1263
+		$html = apply_filters("geodir_custom_field_output_file_var_{$html_var}",$html,$location,$cf);
1264
+	}
1265
+
1266
+	// Check if there is a custom field key specific filter.
1267
+	if(has_filter("geodir_custom_field_output_file_key_{$cf['field_type_key']}")){
1268
+		/**
1269
+		 * Filter the file html by field type key.
1270
+		 *
1271
+		 * @param string $html The html to filter.
1272
+		 * @param string $location The location to output the html.
1273
+		 * @param array $cf The custom field array.
1274
+		 * @since 1.6.6
1275
+		 */
1276
+		$html = apply_filters("geodir_custom_field_output_file_key_{$cf['field_type_key']}",$html,$location,$cf);
1277
+	}
1278
+
1279
+	// If not html then we run the standard output.
1280
+	if(empty($html)){
1281
+
1282
+		if (!empty($post->{$cf['htmlvar_name']})):
1283
+
1284
+			$files = explode(",", $post->{$cf['htmlvar_name']});
1285
+			if (!empty($files)):
1286
+
1287
+				$extra_fields = !empty($cf['extra_fields']) ? stripslashes_deep(maybe_unserialize($cf['extra_fields'])) : NULL;
1288
+				$allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? $extra_fields['gd_file_types'] : '';
1289
+
1290
+				$file_paths = '';
1291
+				foreach ($files as $file) {
1292
+					if (!empty($file)) {
1293
+
1294
+						// $filetype = wp_check_filetype($file);
1295
+
1296
+						$image_name_arr = explode('/', $file);
1297
+						$curr_img_dir = $image_name_arr[count($image_name_arr) - 2];
1298
+						$filename = end($image_name_arr);
1299
+						$img_name_arr = explode('.', $filename);
1300
+
1301
+						$arr_file_type = wp_check_filetype($filename);
1302
+						if (empty($arr_file_type['ext']) || empty($arr_file_type['type'])) {
1303
+							continue;
1304
+						}
1305
+
1306
+						$uploaded_file_type = $arr_file_type['type'];
1307
+						$uploaded_file_ext = $arr_file_type['ext'];
1308
+
1309
+						if (!empty($allowed_file_types) && !in_array($uploaded_file_ext, $allowed_file_types)) {
1310
+							continue; // Invalid file type.
1311
+						}
1312
+
1313
+						//$allowed_file_types = array('application/pdf', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'text/csv', 'text/plain');
1314
+						$image_file_types = array('image/jpg', 'image/jpeg', 'image/gif', 'image/png', 'image/bmp', 'image/x-icon');
1315
+
1316
+						// If the uploaded file is image
1317
+						if (in_array($uploaded_file_type, $image_file_types)) {
1318
+							$file_paths .= '<div class="geodir-custom-post-gallery" class="clearfix">';
1319
+							$file_paths .= '<a href="'.$file.'">';
1320
+							$file_paths .= geodir_show_image(array('src' => $file), 'thumbnail', false, false);
1321
+							$file_paths .= '</a>';
1322
+							//$file_paths .= '<img src="'.$file.'"  />';	
1323
+							$file_paths .= '</div>';
1324
+						} else {
1325
+							$ext_path = '_' . $html_var . '_';
1326
+							$filename = explode($ext_path, $filename);
1327
+							$file_paths .= '<a href="' . $file . '" target="_blank">' . $filename[count($filename) - 1] . '</a>';
1328
+						}
1329
+					}
1330
+				}
1331
+
1332
+				$field_icon = geodir_field_icon_proccess($cf);
1333
+				if (strpos($field_icon, 'http') !== false) {
1334
+					$field_icon_af = '';
1335
+				} elseif ($field_icon == '') {
1336
+					$field_icon_af = '';
1337
+				} else {
1338
+					$field_icon_af = $field_icon;
1339
+					$field_icon = '';
1340
+				}
1341
+
1342
+				$html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' geodir-custom-file-box ' . $cf['htmlvar_name'] . '"><div class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af;
1343
+				$html .= '<span style="display: inline-block; vertical-align: top; padding-right: 14px;">';
1344
+				$html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1345
+				$html .= '</span>';
1346
+				$html .= $file_paths . '</div></div>';
1347
+
1348
+			endif;
1349
+		endif;
1350
+
1351
+	}
1352
+
1353
+	return $html;
1354 1354
 }
1355 1355
 add_filter('geodir_custom_field_output_file','geodir_cf_file',10,3);
1356 1356
 
@@ -1368,80 +1368,80 @@  discard block
 block discarded – undo
1368 1368
  */
1369 1369
 function geodir_cf_textarea($html,$location,$cf,$p=''){
1370 1370
 
1371
-    // check we have the post value
1372
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1373
-    else{ global $post;}
1374
-
1375
-    if(!is_array($cf) && $cf!=''){
1376
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1377
-        if(!$cf){return NULL;}
1378
-    }
1379
-
1380
-    $html_var = $cf['htmlvar_name'];
1381
-
1382
-    // Check if there is a location specific filter.
1383
-    if(has_filter("geodir_custom_field_output_textarea_loc_{$location}")){
1384
-        /**
1385
-         * Filter the textarea html by location.
1386
-         *
1387
-         * @param string $html The html to filter.
1388
-         * @param array $cf The custom field array.
1389
-         * @since 1.6.6
1390
-         */
1391
-        $html = apply_filters("geodir_custom_field_output_textarea_loc_{$location}",$html,$cf);
1392
-    }
1393
-
1394
-    // Check if there is a custom field specific filter.
1395
-    if(has_filter("geodir_custom_field_output_textarea_var_{$html_var}")){
1396
-        /**
1397
-         * Filter the textarea html by individual custom field.
1398
-         *
1399
-         * @param string $html The html to filter.
1400
-         * @param string $location The location to output the html.
1401
-         * @param array $cf The custom field array.
1402
-         * @since 1.6.6
1403
-         */
1404
-        $html = apply_filters("geodir_custom_field_output_textarea_var_{$html_var}",$html,$location,$cf);
1405
-    }
1406
-
1407
-    // Check if there is a custom field key specific filter.
1408
-    if(has_filter("geodir_custom_field_output_textarea_key_{$cf['field_type_key']}")){
1409
-        /**
1410
-         * Filter the textarea html by field type key.
1411
-         *
1412
-         * @param string $html The html to filter.
1413
-         * @param string $location The location to output the html.
1414
-         * @param array $cf The custom field array.
1415
-         * @since 1.6.6
1416
-         */
1417
-        $html = apply_filters("geodir_custom_field_output_textarea_key_{$cf['field_type_key']}",$html,$location,$cf);
1418
-    }
1419
-
1420
-    // If not html then we run the standard output.
1421
-    if(empty($html)){
1422
-
1423
-        if (!empty($post->{$cf['htmlvar_name']})) {
1424
-
1425
-            $field_icon = geodir_field_icon_proccess($cf);
1426
-            if (strpos($field_icon, 'http') !== false) {
1427
-                $field_icon_af = '';
1428
-            } elseif ($field_icon == '') {
1429
-                $field_icon_af = '';
1430
-            } else {
1431
-                $field_icon_af = $field_icon;
1432
-                $field_icon = '';
1433
-            }
1434
-
1435
-
1436
-            $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af;
1437
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1438
-            $html .= '</span>' . wpautop($post->{$cf['htmlvar_name']}) . '</div>';
1439
-
1440
-        }
1441
-
1442
-    }
1443
-
1444
-    return $html;
1371
+	// check we have the post value
1372
+	if(is_int($p)){$post = geodir_get_post_info($p);}
1373
+	else{ global $post;}
1374
+
1375
+	if(!is_array($cf) && $cf!=''){
1376
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1377
+		if(!$cf){return NULL;}
1378
+	}
1379
+
1380
+	$html_var = $cf['htmlvar_name'];
1381
+
1382
+	// Check if there is a location specific filter.
1383
+	if(has_filter("geodir_custom_field_output_textarea_loc_{$location}")){
1384
+		/**
1385
+		 * Filter the textarea html by location.
1386
+		 *
1387
+		 * @param string $html The html to filter.
1388
+		 * @param array $cf The custom field array.
1389
+		 * @since 1.6.6
1390
+		 */
1391
+		$html = apply_filters("geodir_custom_field_output_textarea_loc_{$location}",$html,$cf);
1392
+	}
1393
+
1394
+	// Check if there is a custom field specific filter.
1395
+	if(has_filter("geodir_custom_field_output_textarea_var_{$html_var}")){
1396
+		/**
1397
+		 * Filter the textarea html by individual custom field.
1398
+		 *
1399
+		 * @param string $html The html to filter.
1400
+		 * @param string $location The location to output the html.
1401
+		 * @param array $cf The custom field array.
1402
+		 * @since 1.6.6
1403
+		 */
1404
+		$html = apply_filters("geodir_custom_field_output_textarea_var_{$html_var}",$html,$location,$cf);
1405
+	}
1406
+
1407
+	// Check if there is a custom field key specific filter.
1408
+	if(has_filter("geodir_custom_field_output_textarea_key_{$cf['field_type_key']}")){
1409
+		/**
1410
+		 * Filter the textarea html by field type key.
1411
+		 *
1412
+		 * @param string $html The html to filter.
1413
+		 * @param string $location The location to output the html.
1414
+		 * @param array $cf The custom field array.
1415
+		 * @since 1.6.6
1416
+		 */
1417
+		$html = apply_filters("geodir_custom_field_output_textarea_key_{$cf['field_type_key']}",$html,$location,$cf);
1418
+	}
1419
+
1420
+	// If not html then we run the standard output.
1421
+	if(empty($html)){
1422
+
1423
+		if (!empty($post->{$cf['htmlvar_name']})) {
1424
+
1425
+			$field_icon = geodir_field_icon_proccess($cf);
1426
+			if (strpos($field_icon, 'http') !== false) {
1427
+				$field_icon_af = '';
1428
+			} elseif ($field_icon == '') {
1429
+				$field_icon_af = '';
1430
+			} else {
1431
+				$field_icon_af = $field_icon;
1432
+				$field_icon = '';
1433
+			}
1434
+
1435
+
1436
+			$html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af;
1437
+			$html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1438
+			$html .= '</span>' . wpautop($post->{$cf['htmlvar_name']}) . '</div>';
1439
+
1440
+		}
1441
+
1442
+	}
1443
+
1444
+	return $html;
1445 1445
 }
1446 1446
 add_filter('geodir_custom_field_output_textarea','geodir_cf_textarea',10,3);
1447 1447
 
@@ -1459,79 +1459,79 @@  discard block
 block discarded – undo
1459 1459
  */
1460 1460
 function geodir_cf_html($html,$location,$cf,$p=''){
1461 1461
 
1462
-    // check we have the post value
1463
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1464
-    else{ global $post;}
1465
-
1466
-    if(!is_array($cf) && $cf!=''){
1467
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1468
-        if(!$cf){return NULL;}
1469
-    }
1470
-
1471
-    $html_var = $cf['htmlvar_name'];
1472
-
1473
-    // Check if there is a location specific filter.
1474
-    if(has_filter("geodir_custom_field_output_html_loc_{$location}")){
1475
-        /**
1476
-         * Filter the html html by location.
1477
-         *
1478
-         * @param string $html The html to filter.
1479
-         * @param array $cf The custom field array.
1480
-         * @since 1.6.6
1481
-         */
1482
-        $html = apply_filters("geodir_custom_field_output_html_loc_{$location}",$html,$cf);
1483
-    }
1484
-
1485
-    // Check if there is a custom field specific filter.
1486
-    if(has_filter("geodir_custom_field_output_html_var_{$html_var}")){
1487
-        /**
1488
-         * Filter the html html by individual custom field.
1489
-         *
1490
-         * @param string $html The html to filter.
1491
-         * @param string $location The location to output the html.
1492
-         * @param array $cf The custom field array.
1493
-         * @since 1.6.6
1494
-         */
1495
-        $html = apply_filters("geodir_custom_field_output_html_var_{$html_var}",$html,$location,$cf);
1496
-    }
1497
-
1498
-    // Check if there is a custom field key specific filter.
1499
-    if(has_filter("geodir_custom_field_output_html_key_{$cf['field_type_key']}")){
1500
-        /**
1501
-         * Filter the html html by field type key.
1502
-         *
1503
-         * @param string $html The html to filter.
1504
-         * @param string $location The location to output the html.
1505
-         * @param array $cf The custom field array.
1506
-         * @since 1.6.6
1507
-         */
1508
-        $html = apply_filters("geodir_custom_field_output_html_key_{$cf['field_type_key']}",$html,$location,$cf);
1509
-    }
1510
-
1511
-    // If not html then we run the standard output.
1512
-    if(empty($html)){
1513
-
1514
-        if (!empty($post->{$cf['htmlvar_name']})) {
1515
-
1516
-            $field_icon = geodir_field_icon_proccess($cf);
1517
-            if (strpos($field_icon, 'http') !== false) {
1518
-                $field_icon_af = '';
1519
-            } elseif ($field_icon == '') {
1520
-                $field_icon_af = '';
1521
-            } else {
1522
-                $field_icon_af = $field_icon;
1523
-                $field_icon = '';
1524
-            }
1525
-
1526
-            $html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af;
1527
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1528
-            $html .= '</span>' . wpautop($post->{$cf['htmlvar_name']}) . '</div>';
1529
-
1530
-        }
1531
-
1532
-    }
1533
-
1534
-    return $html;
1462
+	// check we have the post value
1463
+	if(is_int($p)){$post = geodir_get_post_info($p);}
1464
+	else{ global $post;}
1465
+
1466
+	if(!is_array($cf) && $cf!=''){
1467
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1468
+		if(!$cf){return NULL;}
1469
+	}
1470
+
1471
+	$html_var = $cf['htmlvar_name'];
1472
+
1473
+	// Check if there is a location specific filter.
1474
+	if(has_filter("geodir_custom_field_output_html_loc_{$location}")){
1475
+		/**
1476
+		 * Filter the html html by location.
1477
+		 *
1478
+		 * @param string $html The html to filter.
1479
+		 * @param array $cf The custom field array.
1480
+		 * @since 1.6.6
1481
+		 */
1482
+		$html = apply_filters("geodir_custom_field_output_html_loc_{$location}",$html,$cf);
1483
+	}
1484
+
1485
+	// Check if there is a custom field specific filter.
1486
+	if(has_filter("geodir_custom_field_output_html_var_{$html_var}")){
1487
+		/**
1488
+		 * Filter the html html by individual custom field.
1489
+		 *
1490
+		 * @param string $html The html to filter.
1491
+		 * @param string $location The location to output the html.
1492
+		 * @param array $cf The custom field array.
1493
+		 * @since 1.6.6
1494
+		 */
1495
+		$html = apply_filters("geodir_custom_field_output_html_var_{$html_var}",$html,$location,$cf);
1496
+	}
1497
+
1498
+	// Check if there is a custom field key specific filter.
1499
+	if(has_filter("geodir_custom_field_output_html_key_{$cf['field_type_key']}")){
1500
+		/**
1501
+		 * Filter the html html by field type key.
1502
+		 *
1503
+		 * @param string $html The html to filter.
1504
+		 * @param string $location The location to output the html.
1505
+		 * @param array $cf The custom field array.
1506
+		 * @since 1.6.6
1507
+		 */
1508
+		$html = apply_filters("geodir_custom_field_output_html_key_{$cf['field_type_key']}",$html,$location,$cf);
1509
+	}
1510
+
1511
+	// If not html then we run the standard output.
1512
+	if(empty($html)){
1513
+
1514
+		if (!empty($post->{$cf['htmlvar_name']})) {
1515
+
1516
+			$field_icon = geodir_field_icon_proccess($cf);
1517
+			if (strpos($field_icon, 'http') !== false) {
1518
+				$field_icon_af = '';
1519
+			} elseif ($field_icon == '') {
1520
+				$field_icon_af = '';
1521
+			} else {
1522
+				$field_icon_af = $field_icon;
1523
+				$field_icon = '';
1524
+			}
1525
+
1526
+			$html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af;
1527
+			$html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1528
+			$html .= '</span>' . wpautop($post->{$cf['htmlvar_name']}) . '</div>';
1529
+
1530
+		}
1531
+
1532
+	}
1533
+
1534
+	return $html;
1535 1535
 }
1536 1536
 add_filter('geodir_custom_field_output_html','geodir_cf_html',10,3);
1537 1537
 
@@ -1549,113 +1549,113 @@  discard block
 block discarded – undo
1549 1549
  */
1550 1550
 function geodir_cf_taxonomy($html,$location,$cf,$p=''){
1551 1551
 
1552
-    // check we have the post value
1553
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1554
-    else{ global $post;}
1555
-
1556
-    if(!is_array($cf) && $cf!=''){
1557
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1558
-        if(!$cf){return NULL;}
1559
-    }
1560
-
1561
-    $html_var = $cf['htmlvar_name'];
1562
-
1563
-    // Check if there is a location specific filter.
1564
-    if(has_filter("geodir_custom_field_output_taxonomy_loc_{$location}")){
1565
-        /**
1566
-         * Filter the taxonomy html by location.
1567
-         *
1568
-         * @param string $html The html to filter.
1569
-         * @param array $cf The custom field array.
1570
-         * @since 1.6.6
1571
-         */
1572
-        $html = apply_filters("geodir_custom_field_output_taxonomy_loc_{$location}",$html,$cf);
1573
-    }
1574
-
1575
-    // Check if there is a custom field specific filter.
1576
-    if(has_filter("geodir_custom_field_output_taxonomy_var_{$html_var}")){
1577
-        /**
1578
-         * Filter the taxonomy html by individual custom field.
1579
-         *
1580
-         * @param string $html The html to filter.
1581
-         * @param string $location The location to output the html.
1582
-         * @param array $cf The custom field array.
1583
-         * @since 1.6.6
1584
-         */
1585
-        $html = apply_filters("geodir_custom_field_output_taxonomy_var_{$html_var}",$html,$location,$cf);
1586
-    }
1587
-
1588
-    // Check if there is a custom field key specific filter.
1589
-    if(has_filter("geodir_custom_field_output_taxonomy_key_{$cf['field_type_key']}")){
1590
-        /**
1591
-         * Filter the taxonomy html by field type key.
1592
-         *
1593
-         * @param string $html The html to filter.
1594
-         * @param string $location The location to output the html.
1595
-         * @param array $cf The custom field array.
1596
-         * @since 1.6.6
1597
-         */
1598
-        $html = apply_filters("geodir_custom_field_output_taxonomy_key_{$cf['field_type_key']}",$html,$location,$cf);
1599
-    }
1600
-
1601
-    // If not html then we run the standard output.
1602
-    if(empty($html)){
1603
-
1604
-        if ($html_var == $post->post_type . 'category' && !empty($post->{$html_var})) {
1605
-            $post_taxonomy = $post->post_type . 'category';
1606
-            $field_value = $post->{$html_var};
1607
-            $links = array();
1608
-            $terms = array();
1609
-            $termsOrdered = array();
1610
-            if (!is_array($field_value)) {
1611
-                $field_value = explode(",", trim($field_value, ","));
1612
-            }
1613
-
1614
-            $field_value = array_unique($field_value);
1615
-
1616
-            if (!empty($field_value)) {
1617
-                foreach ($field_value as $term) {
1618
-                    $term = trim($term);
1619
-
1620
-                    if ($term != '') {
1621
-                        $term = get_term_by('id', $term, $html_var);
1622
-                        if (is_object($term)) {
1623
-                            $links[] = "<a href='" . esc_attr(get_term_link($term, $post_taxonomy)) . "'>" . $term->name . "</a>";
1624
-                            $terms[] = $term;
1625
-                        }
1626
-                    }
1627
-                }
1628
-                if (!empty($links)) {
1629
-                    // order alphabetically
1630
-                    asort($links);
1631
-                    foreach (array_keys($links) as $key) {
1632
-                        $termsOrdered[$key] = $terms[$key];
1633
-                    }
1634
-                    $terms = $termsOrdered;
1635
-                }
1636
-            }
1637
-            $html_value = !empty($links) && !empty($terms) ? wp_sprintf('%l', $links, (object)$terms) : '';
1638
-
1639
-            if ($html_value != '') {
1640
-                $field_icon = geodir_field_icon_proccess($cf);
1641
-                if (strpos($field_icon, 'http') !== false) {
1642
-                    $field_icon_af = '';
1643
-                } else if ($field_icon == '') {
1644
-                    $field_icon_af = '';
1645
-                } else {
1646
-                    $field_icon_af = $field_icon;
1647
-                    $field_icon = '';
1648
-                }
1649
-
1650
-                $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $html_var . '" style="clear:both;"><span class="geodir-i-taxonomy geodir-i-category" style="' . $field_icon . '">' . $field_icon_af;
1651
-                $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1652
-                $html .= '</span> ' . $html_value . '</div>';
1653
-            }
1654
-        }
1655
-
1656
-    }
1657
-
1658
-    return $html;
1552
+	// check we have the post value
1553
+	if(is_int($p)){$post = geodir_get_post_info($p);}
1554
+	else{ global $post;}
1555
+
1556
+	if(!is_array($cf) && $cf!=''){
1557
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1558
+		if(!$cf){return NULL;}
1559
+	}
1560
+
1561
+	$html_var = $cf['htmlvar_name'];
1562
+
1563
+	// Check if there is a location specific filter.
1564
+	if(has_filter("geodir_custom_field_output_taxonomy_loc_{$location}")){
1565
+		/**
1566
+		 * Filter the taxonomy html by location.
1567
+		 *
1568
+		 * @param string $html The html to filter.
1569
+		 * @param array $cf The custom field array.
1570
+		 * @since 1.6.6
1571
+		 */
1572
+		$html = apply_filters("geodir_custom_field_output_taxonomy_loc_{$location}",$html,$cf);
1573
+	}
1574
+
1575
+	// Check if there is a custom field specific filter.
1576
+	if(has_filter("geodir_custom_field_output_taxonomy_var_{$html_var}")){
1577
+		/**
1578
+		 * Filter the taxonomy html by individual custom field.
1579
+		 *
1580
+		 * @param string $html The html to filter.
1581
+		 * @param string $location The location to output the html.
1582
+		 * @param array $cf The custom field array.
1583
+		 * @since 1.6.6
1584
+		 */
1585
+		$html = apply_filters("geodir_custom_field_output_taxonomy_var_{$html_var}",$html,$location,$cf);
1586
+	}
1587
+
1588
+	// Check if there is a custom field key specific filter.
1589
+	if(has_filter("geodir_custom_field_output_taxonomy_key_{$cf['field_type_key']}")){
1590
+		/**
1591
+		 * Filter the taxonomy html by field type key.
1592
+		 *
1593
+		 * @param string $html The html to filter.
1594
+		 * @param string $location The location to output the html.
1595
+		 * @param array $cf The custom field array.
1596
+		 * @since 1.6.6
1597
+		 */
1598
+		$html = apply_filters("geodir_custom_field_output_taxonomy_key_{$cf['field_type_key']}",$html,$location,$cf);
1599
+	}
1600
+
1601
+	// If not html then we run the standard output.
1602
+	if(empty($html)){
1603
+
1604
+		if ($html_var == $post->post_type . 'category' && !empty($post->{$html_var})) {
1605
+			$post_taxonomy = $post->post_type . 'category';
1606
+			$field_value = $post->{$html_var};
1607
+			$links = array();
1608
+			$terms = array();
1609
+			$termsOrdered = array();
1610
+			if (!is_array($field_value)) {
1611
+				$field_value = explode(",", trim($field_value, ","));
1612
+			}
1613
+
1614
+			$field_value = array_unique($field_value);
1615
+
1616
+			if (!empty($field_value)) {
1617
+				foreach ($field_value as $term) {
1618
+					$term = trim($term);
1619
+
1620
+					if ($term != '') {
1621
+						$term = get_term_by('id', $term, $html_var);
1622
+						if (is_object($term)) {
1623
+							$links[] = "<a href='" . esc_attr(get_term_link($term, $post_taxonomy)) . "'>" . $term->name . "</a>";
1624
+							$terms[] = $term;
1625
+						}
1626
+					}
1627
+				}
1628
+				if (!empty($links)) {
1629
+					// order alphabetically
1630
+					asort($links);
1631
+					foreach (array_keys($links) as $key) {
1632
+						$termsOrdered[$key] = $terms[$key];
1633
+					}
1634
+					$terms = $termsOrdered;
1635
+				}
1636
+			}
1637
+			$html_value = !empty($links) && !empty($terms) ? wp_sprintf('%l', $links, (object)$terms) : '';
1638
+
1639
+			if ($html_value != '') {
1640
+				$field_icon = geodir_field_icon_proccess($cf);
1641
+				if (strpos($field_icon, 'http') !== false) {
1642
+					$field_icon_af = '';
1643
+				} else if ($field_icon == '') {
1644
+					$field_icon_af = '';
1645
+				} else {
1646
+					$field_icon_af = $field_icon;
1647
+					$field_icon = '';
1648
+				}
1649
+
1650
+				$html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $html_var . '" style="clear:both;"><span class="geodir-i-taxonomy geodir-i-category" style="' . $field_icon . '">' . $field_icon_af;
1651
+				$html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1652
+				$html .= '</span> ' . $html_value . '</div>';
1653
+			}
1654
+		}
1655
+
1656
+	}
1657
+
1658
+	return $html;
1659 1659
 }
1660 1660
 add_filter('geodir_custom_field_output_taxonomy','geodir_cf_taxonomy',10,3);
1661 1661
 
@@ -1672,161 +1672,161 @@  discard block
 block discarded – undo
1672 1672
  */
1673 1673
 function geodir_cf_address($html,$location,$cf,$p=''){
1674 1674
 
1675
-    // check we have the post value
1676
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1677
-    else{ global $post;}
1678
-
1679
-    if(!is_array($cf) && $cf!=''){
1680
-        $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1681
-        if(!$cf){return NULL;}
1682
-    }
1683
-
1684
-    $html_var = $cf['htmlvar_name'];
1685
-
1686
-    // Check if there is a location specific filter.
1687
-    if(has_filter("geodir_custom_field_output_address_loc_{$location}")){
1688
-        /**
1689
-         * Filter the address html by location.
1690
-         *
1691
-         * @param string $html The html to filter.
1692
-         * @param array $cf The custom field array.
1693
-         * @since 1.6.6
1694
-         */
1695
-        $html = apply_filters("geodir_custom_field_output_address_loc_{$location}",$html,$cf);
1696
-    }
1697
-
1698
-    // Check if there is a custom field specific filter.
1699
-    if(has_filter("geodir_custom_field_output_address_var_{$html_var}")){
1700
-        /**
1701
-         * Filter the address html by individual custom field.
1702
-         *
1703
-         * @param string $html The html to filter.
1704
-         * @param string $location The location to output the html.
1705
-         * @param array $cf The custom field array.
1706
-         * @since 1.6.6
1707
-         */
1708
-        $html = apply_filters("geodir_custom_field_output_address_var_{$html_var}",$html,$location,$cf);
1709
-    }
1710
-
1711
-    // Check if there is a custom field key specific filter.
1712
-    if(has_filter("geodir_custom_field_output_address_key_{$cf['field_type_key']}")){
1713
-        /**
1714
-         * Filter the address html by field type key.
1715
-         *
1716
-         * @param string $html The html to filter.
1717
-         * @param string $location The location to output the html.
1718
-         * @param array $cf The custom field array.
1719
-         * @since 1.6.6
1720
-         */
1721
-        $html = apply_filters("geodir_custom_field_output_address_key_{$cf['field_type_key']}",$html,$location,$cf);
1722
-    }
1723
-
1724
-    // If not html then we run the standard output.
1725
-    if(empty($html)){
1726
-
1727
-        global $preview;
1728
-        $html_var = $cf['htmlvar_name'] . '_address';
1729
-
1730
-        if ($cf['extra_fields']) {
1731
-
1732
-            $extra_fields = stripslashes_deep(unserialize($cf['extra_fields']));
1733
-
1734
-            $addition_fields = '';
1735
-
1736
-            if (!empty($extra_fields)) {
1737
-
1738
-                $show_city_in_address = false;
1739
-                if (isset($extra_fields['show_city']) && $extra_fields['show_city']) {
1740
-                    $show_city_in_address = true;
1741
-                }
1742
-                /**
1743
-                 * Filter "show city in address" value.
1744
-                 *
1745
-                 * @since 1.0.0
1746
-                 */
1747
-                $show_city_in_address = apply_filters('geodir_show_city_in_address', $show_city_in_address);
1748
-
1749
-
1750
-                $show_region_in_address = false;
1751
-                if (isset($extra_fields['show_region']) && $extra_fields['show_region']) {
1752
-                    $show_region_in_address = true;
1753
-                }
1754
-                /**
1755
-                 * Filter "show region in address" value.
1756
-                 *
1757
-                 * @since 1.6.6
1758
-                 */
1759
-                $show_region_in_address = apply_filters('geodir_show_region_in_address', $show_region_in_address);
1760
-
1761
-                $show_country_in_address = false;
1762
-                if (isset($extra_fields['show_country']) && $extra_fields['show_country']) {
1763
-                    $show_country_in_address = true;
1764
-                }
1765
-                /**
1766
-                 * Filter "show country in address" value.
1767
-                 *
1768
-                 * @since 1.6.6
1769
-                 */
1770
-                $show_country_in_address = apply_filters('geodir_show_country_in_address', $show_country_in_address);
1771
-
1772
-                $show_zip_in_address = false;
1773
-                if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) {
1774
-                    $show_zip_in_address = true;
1775
-                }
1776
-                /**
1777
-                 * Filter "show zip in address" value.
1778
-                 *
1779
-                 * @since 1.6.6
1780
-                 */
1781
-                $show_zip_in_address = apply_filters('geodir_show_zip_in_address', $show_zip_in_address);
1782
-
1783
-
1784
-            }
1785
-
1786
-        }
1787
-
1788
-
1789
-        if ($post->{$html_var}) {
1790
-
1791
-            $field_icon = geodir_field_icon_proccess( $cf );
1792
-            if ( strpos( $field_icon, 'http' ) !== false ) {
1793
-                $field_icon_af = '';
1794
-            } elseif ( $field_icon == '' ) {
1795
-                $field_icon_af = '<i class="fa fa-home"></i>';
1796
-            } else {
1797
-                $field_icon_af = $field_icon;
1798
-                $field_icon    = '';
1799
-            }
1675
+	// check we have the post value
1676
+	if(is_int($p)){$post = geodir_get_post_info($p);}
1677
+	else{ global $post;}
1678
+
1679
+	if(!is_array($cf) && $cf!=''){
1680
+		$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1681
+		if(!$cf){return NULL;}
1682
+	}
1683
+
1684
+	$html_var = $cf['htmlvar_name'];
1685
+
1686
+	// Check if there is a location specific filter.
1687
+	if(has_filter("geodir_custom_field_output_address_loc_{$location}")){
1688
+		/**
1689
+		 * Filter the address html by location.
1690
+		 *
1691
+		 * @param string $html The html to filter.
1692
+		 * @param array $cf The custom field array.
1693
+		 * @since 1.6.6
1694
+		 */
1695
+		$html = apply_filters("geodir_custom_field_output_address_loc_{$location}",$html,$cf);
1696
+	}
1697
+
1698
+	// Check if there is a custom field specific filter.
1699
+	if(has_filter("geodir_custom_field_output_address_var_{$html_var}")){
1700
+		/**
1701
+		 * Filter the address html by individual custom field.
1702
+		 *
1703
+		 * @param string $html The html to filter.
1704
+		 * @param string $location The location to output the html.
1705
+		 * @param array $cf The custom field array.
1706
+		 * @since 1.6.6
1707
+		 */
1708
+		$html = apply_filters("geodir_custom_field_output_address_var_{$html_var}",$html,$location,$cf);
1709
+	}
1710
+
1711
+	// Check if there is a custom field key specific filter.
1712
+	if(has_filter("geodir_custom_field_output_address_key_{$cf['field_type_key']}")){
1713
+		/**
1714
+		 * Filter the address html by field type key.
1715
+		 *
1716
+		 * @param string $html The html to filter.
1717
+		 * @param string $location The location to output the html.
1718
+		 * @param array $cf The custom field array.
1719
+		 * @since 1.6.6
1720
+		 */
1721
+		$html = apply_filters("geodir_custom_field_output_address_key_{$cf['field_type_key']}",$html,$location,$cf);
1722
+	}
1723
+
1724
+	// If not html then we run the standard output.
1725
+	if(empty($html)){
1726
+
1727
+		global $preview;
1728
+		$html_var = $cf['htmlvar_name'] . '_address';
1729
+
1730
+		if ($cf['extra_fields']) {
1731
+
1732
+			$extra_fields = stripslashes_deep(unserialize($cf['extra_fields']));
1733
+
1734
+			$addition_fields = '';
1735
+
1736
+			if (!empty($extra_fields)) {
1737
+
1738
+				$show_city_in_address = false;
1739
+				if (isset($extra_fields['show_city']) && $extra_fields['show_city']) {
1740
+					$show_city_in_address = true;
1741
+				}
1742
+				/**
1743
+				 * Filter "show city in address" value.
1744
+				 *
1745
+				 * @since 1.0.0
1746
+				 */
1747
+				$show_city_in_address = apply_filters('geodir_show_city_in_address', $show_city_in_address);
1748
+
1749
+
1750
+				$show_region_in_address = false;
1751
+				if (isset($extra_fields['show_region']) && $extra_fields['show_region']) {
1752
+					$show_region_in_address = true;
1753
+				}
1754
+				/**
1755
+				 * Filter "show region in address" value.
1756
+				 *
1757
+				 * @since 1.6.6
1758
+				 */
1759
+				$show_region_in_address = apply_filters('geodir_show_region_in_address', $show_region_in_address);
1760
+
1761
+				$show_country_in_address = false;
1762
+				if (isset($extra_fields['show_country']) && $extra_fields['show_country']) {
1763
+					$show_country_in_address = true;
1764
+				}
1765
+				/**
1766
+				 * Filter "show country in address" value.
1767
+				 *
1768
+				 * @since 1.6.6
1769
+				 */
1770
+				$show_country_in_address = apply_filters('geodir_show_country_in_address', $show_country_in_address);
1771
+
1772
+				$show_zip_in_address = false;
1773
+				if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) {
1774
+					$show_zip_in_address = true;
1775
+				}
1776
+				/**
1777
+				 * Filter "show zip in address" value.
1778
+				 *
1779
+				 * @since 1.6.6
1780
+				 */
1781
+				$show_zip_in_address = apply_filters('geodir_show_zip_in_address', $show_zip_in_address);
1782
+
1783
+
1784
+			}
1785
+
1786
+		}
1787
+
1788
+
1789
+		if ($post->{$html_var}) {
1790
+
1791
+			$field_icon = geodir_field_icon_proccess( $cf );
1792
+			if ( strpos( $field_icon, 'http' ) !== false ) {
1793
+				$field_icon_af = '';
1794
+			} elseif ( $field_icon == '' ) {
1795
+				$field_icon_af = '<i class="fa fa-home"></i>';
1796
+			} else {
1797
+				$field_icon_af = $field_icon;
1798
+				$field_icon    = '';
1799
+			}
1800 1800
             
1801 1801
 
1802 1802
 
1803
-            $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $html_var . '" style="clear:both;"  itemscope itemtype="https://schema.org/PostalAddress">';
1804
-            $html .= '<span class="geodir-i-location" style="' . $field_icon . '">' . $field_icon_af;
1805
-            $html .= ( trim( $cf['site_title'] ) ) ? __( $cf['site_title'], 'geodirectory' ) . ': ' : '&nbsp;';
1806
-            $html .= '</span>';
1803
+			$html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $html_var . '" style="clear:both;"  itemscope itemtype="https://schema.org/PostalAddress">';
1804
+			$html .= '<span class="geodir-i-location" style="' . $field_icon . '">' . $field_icon_af;
1805
+			$html .= ( trim( $cf['site_title'] ) ) ? __( $cf['site_title'], 'geodirectory' ) . ': ' : '&nbsp;';
1806
+			$html .= '</span>';
1807 1807
 
1808
-            if ( isset($post->post_address) ) {
1809
-                $html .= '<span itemprop="streetAddress">' . $post->post_address . '</span><br>';
1810
-            }
1811
-            if ($show_city_in_address && isset( $post->post_city ) && $post->post_city ) {
1812
-                $html .= '<span itemprop="addressLocality">' . $post->post_city . '</span><br>';
1813
-            }
1814
-            if ($show_region_in_address && isset( $post->post_region ) && $post->post_region ) {
1815
-                $html .= '<span itemprop="addressRegion">' . $post->post_region . '</span><br>';
1816
-            }
1817
-            if ($show_zip_in_address && isset( $post->post_zip ) && $post->post_zip ) {
1818
-                $html .= '<span itemprop="postalCode">' . $post->post_zip . '</span><br>';
1819
-            }
1820
-            if ($show_country_in_address && isset( $post->post_country ) && $post->post_country ) {
1821
-                $html .= '<span itemprop="addressCountry">' . __( $post->post_country, 'geodirectory' ) . '</span><br>';
1822
-            }
1823
-            $html .= '</div>';
1808
+			if ( isset($post->post_address) ) {
1809
+				$html .= '<span itemprop="streetAddress">' . $post->post_address . '</span><br>';
1810
+			}
1811
+			if ($show_city_in_address && isset( $post->post_city ) && $post->post_city ) {
1812
+				$html .= '<span itemprop="addressLocality">' . $post->post_city . '</span><br>';
1813
+			}
1814
+			if ($show_region_in_address && isset( $post->post_region ) && $post->post_region ) {
1815
+				$html .= '<span itemprop="addressRegion">' . $post->post_region . '</span><br>';
1816
+			}
1817
+			if ($show_zip_in_address && isset( $post->post_zip ) && $post->post_zip ) {
1818
+				$html .= '<span itemprop="postalCode">' . $post->post_zip . '</span><br>';
1819
+			}
1820
+			if ($show_country_in_address && isset( $post->post_country ) && $post->post_country ) {
1821
+				$html .= '<span itemprop="addressCountry">' . __( $post->post_country, 'geodirectory' ) . '</span><br>';
1822
+			}
1823
+			$html .= '</div>';
1824 1824
 
1825
-        }
1825
+		}
1826 1826
 
1827
-    }
1827
+	}
1828 1828
 
1829 1829
 
1830
-    return $html;
1830
+	return $html;
1831 1831
 }
1832 1832
 add_filter('geodir_custom_field_output_address','geodir_cf_address',10,3);
1833 1833
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +302 added lines, -302 removed lines patch added patch discarded remove patch
@@ -19,21 +19,21 @@  discard block
 block discarded – undo
19 19
  *
20 20
  * @return string The html to output for the custom field.
21 21
  */
22
-function geodir_cf_checkbox($html,$location,$cf,$p=''){
22
+function geodir_cf_checkbox($html, $location, $cf, $p = '') {
23 23
 
24 24
     // check we have the post value
25
-    if(is_int($p)){$post = geodir_get_post_info($p);}
26
-    else{ global $post;}
25
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
26
+    else { global $post; }
27 27
 
28
-    if(!is_array($cf) && $cf!=''){
28
+    if (!is_array($cf) && $cf != '') {
29 29
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
30
-        if(!$cf){return NULL;}
30
+        if (!$cf) {return NULL; }
31 31
     }
32 32
 
33 33
     $html_var = $cf['htmlvar_name'];
34 34
 
35 35
     // Check if there is a location specific filter.
36
-    if(has_filter("geodir_custom_field_output_checkbox_loc_{$location}")){
36
+    if (has_filter("geodir_custom_field_output_checkbox_loc_{$location}")) {
37 37
         /**
38 38
          * Filter the checkbox html by location.
39 39
          *
@@ -41,11 +41,11 @@  discard block
 block discarded – undo
41 41
          * @param array $cf The custom field array.
42 42
          * @since 1.6.6
43 43
          */
44
-        $html = apply_filters("geodir_custom_field_output_checkbox_loc_{$location}",$html,$cf);
44
+        $html = apply_filters("geodir_custom_field_output_checkbox_loc_{$location}", $html, $cf);
45 45
     }
46 46
 
47 47
     // Check if there is a custom field specific filter.
48
-    if(has_filter("geodir_custom_field_output_checkbox_var_{$html_var}")){
48
+    if (has_filter("geodir_custom_field_output_checkbox_var_{$html_var}")) {
49 49
         /**
50 50
          * Filter the checkbox html by individual custom field.
51 51
          *
@@ -54,11 +54,11 @@  discard block
 block discarded – undo
54 54
          * @param array $cf The custom field array.
55 55
          * @since 1.6.6
56 56
          */
57
-        $html = apply_filters("geodir_custom_field_output_checkbox_var_{$html_var}",$html,$location,$cf);
57
+        $html = apply_filters("geodir_custom_field_output_checkbox_var_{$html_var}", $html, $location, $cf);
58 58
     }
59 59
 
60 60
     // Check if there is a custom field key specific filter.
61
-    if(has_filter("geodir_custom_field_output_checkbox_key_{$cf['field_type_key']}")){
61
+    if (has_filter("geodir_custom_field_output_checkbox_key_{$cf['field_type_key']}")) {
62 62
         /**
63 63
          * Filter the checkbox html by field type key.
64 64
          *
@@ -67,18 +67,18 @@  discard block
 block discarded – undo
67 67
          * @param array $cf The custom field array.
68 68
          * @since 1.6.6
69 69
          */
70
-        $html = apply_filters("geodir_custom_field_output_checkbox_key_{$cf['field_type_key']}",$html,$location,$cf);
70
+        $html = apply_filters("geodir_custom_field_output_checkbox_key_{$cf['field_type_key']}", $html, $location, $cf);
71 71
     }
72 72
 
73 73
     // If not html then we run the standard output.
74
-    if(empty($html)){
74
+    if (empty($html)) {
75 75
 
76
-        if ( (int) $post->{$html_var} == 1 ):
76
+        if ((int) $post->{$html_var} == 1):
77 77
 
78
-            if ( $post->{$html_var} == '1' ):
79
-                $html_val = __( 'Yes', 'geodirectory' );
78
+            if ($post->{$html_var} == '1'):
79
+                $html_val = __('Yes', 'geodirectory');
80 80
             else:
81
-                $html_val = __( 'No', 'geodirectory' );
81
+                $html_val = __('No', 'geodirectory');
82 82
             endif;
83 83
 
84 84
             $field_icon = geodir_field_icon_proccess($cf);
@@ -91,16 +91,16 @@  discard block
 block discarded – undo
91 91
                 $field_icon = '';
92 92
             }
93 93
 
94
-            $html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-checkbox" style="' . $field_icon . '">' . $field_icon_af;
95
-            $html .= ( trim( $cf['site_title'] ) ) ? __( $cf['site_title'], 'geodirectory' ) . ': ' : '';
96
-            $html .= '</span>' . $html_val . '</div>';
94
+            $html = '<div class="geodir_more_info  '.$cf['css_class'].' '.$cf['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-checkbox" style="'.$field_icon.'">'.$field_icon_af;
95
+            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : '';
96
+            $html .= '</span>'.$html_val.'</div>';
97 97
         endif;
98 98
 
99 99
     }
100 100
 
101 101
     return $html;
102 102
 }
103
-add_filter('geodir_custom_field_output_checkbox','geodir_cf_checkbox',10,3);
103
+add_filter('geodir_custom_field_output_checkbox', 'geodir_cf_checkbox', 10, 3);
104 104
 
105 105
 
106 106
 /**
@@ -113,21 +113,21 @@  discard block
 block discarded – undo
113 113
  *
114 114
  * @return string The html to output for the custom field.
115 115
  */
116
-function geodir_cf_fieldset($html,$location,$cf,$p=''){
116
+function geodir_cf_fieldset($html, $location, $cf, $p = '') {
117 117
 
118 118
     // check we have the post value
119
-    if(is_int($p)){$post = geodir_get_post_info($p);}
120
-    else{ global $post;}
119
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
120
+    else { global $post; }
121 121
 
122
-    if(!is_array($cf) && $cf!=''){
122
+    if (!is_array($cf) && $cf != '') {
123 123
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
124
-        if(!$cf){return NULL;}
124
+        if (!$cf) {return NULL; }
125 125
     }
126 126
 
127 127
     $html_var = $cf['htmlvar_name'];
128 128
 
129 129
     // Check if there is a location specific filter.
130
-    if(has_filter("geodir_custom_field_output_fieldset_loc_{$location}")){
130
+    if (has_filter("geodir_custom_field_output_fieldset_loc_{$location}")) {
131 131
         /**
132 132
          * Filter the fieldset html by location.
133 133
          *
@@ -135,11 +135,11 @@  discard block
 block discarded – undo
135 135
          * @param array $cf The custom field array.
136 136
          * @since 1.6.6
137 137
          */
138
-        $html = apply_filters("geodir_custom_field_output_fieldset_loc_{$location}",$html,$cf);
138
+        $html = apply_filters("geodir_custom_field_output_fieldset_loc_{$location}", $html, $cf);
139 139
     }
140 140
 
141 141
     // Check if there is a custom field specific filter.
142
-    if(has_filter("geodir_custom_field_output_fieldset_var_{$html_var}")){
142
+    if (has_filter("geodir_custom_field_output_fieldset_var_{$html_var}")) {
143 143
         /**
144 144
          * Filter the fieldset html by individual custom field.
145 145
          *
@@ -148,11 +148,11 @@  discard block
 block discarded – undo
148 148
          * @param array $cf The custom field array.
149 149
          * @since 1.6.6
150 150
          */
151
-        $html = apply_filters("geodir_custom_field_output_fieldset_var_{$html_var}",$html,$location,$cf);
151
+        $html = apply_filters("geodir_custom_field_output_fieldset_var_{$html_var}", $html, $location, $cf);
152 152
     }
153 153
 
154 154
     // Check if there is a custom field key specific filter.
155
-    if(has_filter("geodir_custom_field_output_fieldset_key_{$cf['field_type_key']}")){
155
+    if (has_filter("geodir_custom_field_output_fieldset_key_{$cf['field_type_key']}")) {
156 156
         /**
157 157
          * Filter the fieldset html by field type key.
158 158
          *
@@ -161,11 +161,11 @@  discard block
 block discarded – undo
161 161
          * @param array $cf The custom field array.
162 162
          * @since 1.6.6
163 163
          */
164
-        $html = apply_filters("geodir_custom_field_output_fieldset_key_{$cf['field_type_key']}",$html,$location,$cf);
164
+        $html = apply_filters("geodir_custom_field_output_fieldset_key_{$cf['field_type_key']}", $html, $location, $cf);
165 165
     }
166 166
 
167 167
     // If not html then we run the standard output.
168
-    if(empty($html)){
168
+    if (empty($html)) {
169 169
 
170 170
         global $field_set_start;
171 171
         $fieldset_class = 'fieldset-'.sanitize_title_with_dashes($cf['site_title']);
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
         if ($field_set_start == 1) {
174 174
             $html = '';
175 175
         } else {
176
-            $html = '<h2 class="'.$fieldset_class.'">'. __($cf['site_title'], 'geodirectory') . '</h2>';
176
+            $html = '<h2 class="'.$fieldset_class.'">'.__($cf['site_title'], 'geodirectory').'</h2>';
177 177
             //$field_set_start = 1;
178 178
         }
179 179
 
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 
182 182
     return $html;
183 183
 }
184
-add_filter('geodir_custom_field_output_fieldset','geodir_cf_fieldset',10,3);
184
+add_filter('geodir_custom_field_output_fieldset', 'geodir_cf_fieldset', 10, 3);
185 185
 
186 186
 
187 187
 /**
@@ -194,21 +194,21 @@  discard block
 block discarded – undo
194 194
  *
195 195
  * @return string The html to output for the custom field.
196 196
  */
197
-function geodir_cf_url($html,$location,$cf,$p=''){
197
+function geodir_cf_url($html, $location, $cf, $p = '') {
198 198
 
199 199
     // check we have the post value
200
-    if(is_int($p)){$post = geodir_get_post_info($p);}
201
-    else{ global $post;}
200
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
201
+    else { global $post; }
202 202
 
203
-    if(!is_array($cf) && $cf!=''){
203
+    if (!is_array($cf) && $cf != '') {
204 204
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
205
-        if(!$cf){return NULL;}
205
+        if (!$cf) {return NULL; }
206 206
     }
207 207
 
208 208
     $html_var = $cf['htmlvar_name'];
209 209
 
210 210
     // Check if there is a location specific filter.
211
-    if(has_filter("geodir_custom_field_output_url_loc_{$location}")){
211
+    if (has_filter("geodir_custom_field_output_url_loc_{$location}")) {
212 212
         /**
213 213
          * Filter the url html by location.
214 214
          *
@@ -216,11 +216,11 @@  discard block
 block discarded – undo
216 216
          * @param array $cf The custom field array.
217 217
          * @since 1.6.6
218 218
          */
219
-        $html = apply_filters("geodir_custom_field_output_url_loc_{$location}",$html,$cf);
219
+        $html = apply_filters("geodir_custom_field_output_url_loc_{$location}", $html, $cf);
220 220
     }
221 221
 
222 222
     // Check if there is a custom field specific filter.
223
-    if(has_filter("geodir_custom_field_output_url_var_{$html_var}")){
223
+    if (has_filter("geodir_custom_field_output_url_var_{$html_var}")) {
224 224
         /**
225 225
          * Filter the url html by individual custom field.
226 226
          *
@@ -229,11 +229,11 @@  discard block
 block discarded – undo
229 229
          * @param array $cf The custom field array.
230 230
          * @since 1.6.6
231 231
          */
232
-        $html = apply_filters("geodir_custom_field_output_url_var_{$html_var}",$html,$location,$cf);
232
+        $html = apply_filters("geodir_custom_field_output_url_var_{$html_var}", $html, $location, $cf);
233 233
     }
234 234
 
235 235
     // Check if there is a custom field key specific filter.
236
-    if(has_filter("geodir_custom_field_output_url_key_{$cf['field_type_key']}")){
236
+    if (has_filter("geodir_custom_field_output_url_key_{$cf['field_type_key']}")) {
237 237
         /**
238 238
          * Filter the url html by field type key.
239 239
          *
@@ -242,11 +242,11 @@  discard block
 block discarded – undo
242 242
          * @param array $cf The custom field array.
243 243
          * @since 1.6.6
244 244
          */
245
-        $html = apply_filters("geodir_custom_field_output_url_key_{$cf['field_type_key']}",$html,$location,$cf);
245
+        $html = apply_filters("geodir_custom_field_output_url_key_{$cf['field_type_key']}", $html, $location, $cf);
246 246
     }
247 247
 
248 248
     // If not html then we run the standard output.
249
-    if(empty($html)){
249
+    if (empty($html)) {
250 250
 
251 251
         if ($post->{$cf['htmlvar_name']}):
252 252
 
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
 
274 274
             $website = !empty($a_url['url']) ? $a_url['url'] : '';
275 275
             $title = !empty($a_url['label']) ? $a_url['label'] : $cf['site_title'];
276
-            if(!empty($cf['default_value'])){$title = $cf['default_value'];}
276
+            if (!empty($cf['default_value'])) {$title = $cf['default_value']; }
277 277
             $title = $title != '' ? __(stripslashes($title), 'geodirectory') : '';
278 278
 
279 279
 
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
              * @param string $website Website URL.
290 290
              * @param int $post->ID Post ID.
291 291
              */
292
-            $html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '"><span class="geodir-i-website" style="' . $field_icon . '">' . $field_icon_af . '<a href="' . $website . '" target="_blank" ' . $rel . ' ><strong>' . apply_filters('geodir_custom_field_website_name', $title, $website, $post->ID) . '</strong></a></span></div>';
292
+            $html = '<div class="geodir_more_info  '.$cf['css_class'].' '.$cf['htmlvar_name'].'"><span class="geodir-i-website" style="'.$field_icon.'">'.$field_icon_af.'<a href="'.$website.'" target="_blank" '.$rel.' ><strong>'.apply_filters('geodir_custom_field_website_name', $title, $website, $post->ID).'</strong></a></span></div>';
293 293
 
294 294
         endif;
295 295
 
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
 
298 298
     return $html;
299 299
 }
300
-add_filter('geodir_custom_field_output_url','geodir_cf_url',10,3);
300
+add_filter('geodir_custom_field_output_url', 'geodir_cf_url', 10, 3);
301 301
 
302 302
 
303 303
 /**
@@ -310,21 +310,21 @@  discard block
 block discarded – undo
310 310
  *
311 311
  * @return string The html to output for the custom field.
312 312
  */
313
-function geodir_cf_phone($html,$location,$cf,$p=''){
313
+function geodir_cf_phone($html, $location, $cf, $p = '') {
314 314
 
315 315
     // check we have the post value
316
-    if(is_int($p)){$post = geodir_get_post_info($p);}
317
-    else{ global $post;}
316
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
317
+    else { global $post; }
318 318
 
319
-    if(!is_array($cf) && $cf!=''){
319
+    if (!is_array($cf) && $cf != '') {
320 320
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
321
-        if(!$cf){return NULL;}
321
+        if (!$cf) {return NULL; }
322 322
     }
323 323
 
324 324
     $html_var = $cf['htmlvar_name'];
325 325
 
326 326
     // Check if there is a location specific filter.
327
-    if(has_filter("geodir_custom_field_output_phone_loc_{$location}")){
327
+    if (has_filter("geodir_custom_field_output_phone_loc_{$location}")) {
328 328
         /**
329 329
          * Filter the phone html by location.
330 330
          *
@@ -332,11 +332,11 @@  discard block
 block discarded – undo
332 332
          * @param array $cf The custom field array.
333 333
          * @since 1.6.6
334 334
          */
335
-        $html = apply_filters("geodir_custom_field_output_phone_loc_{$location}",$html,$cf);
335
+        $html = apply_filters("geodir_custom_field_output_phone_loc_{$location}", $html, $cf);
336 336
     }
337 337
 
338 338
     // Check if there is a custom field specific filter.
339
-    if(has_filter("geodir_custom_field_output_phone_var_{$html_var}")){
339
+    if (has_filter("geodir_custom_field_output_phone_var_{$html_var}")) {
340 340
         /**
341 341
          * Filter the phone html by individual custom field.
342 342
          *
@@ -345,11 +345,11 @@  discard block
 block discarded – undo
345 345
          * @param array $cf The custom field array.
346 346
          * @since 1.6.6
347 347
          */
348
-        $html = apply_filters("geodir_custom_field_output_phone_var_{$html_var}",$html,$location,$cf);
348
+        $html = apply_filters("geodir_custom_field_output_phone_var_{$html_var}", $html, $location, $cf);
349 349
     }
350 350
 
351 351
     // Check if there is a custom field key specific filter.
352
-    if(has_filter("geodir_custom_field_output_phone_key_{$cf['field_type_key']}")){
352
+    if (has_filter("geodir_custom_field_output_phone_key_{$cf['field_type_key']}")) {
353 353
         /**
354 354
          * Filter the phone html by field type key.
355 355
          *
@@ -358,11 +358,11 @@  discard block
 block discarded – undo
358 358
          * @param array $cf The custom field array.
359 359
          * @since 1.6.6
360 360
          */
361
-        $html = apply_filters("geodir_custom_field_output_phone_key_{$cf['field_type_key']}",$html,$location,$cf);
361
+        $html = apply_filters("geodir_custom_field_output_phone_key_{$cf['field_type_key']}", $html, $location, $cf);
362 362
     }
363 363
 
364 364
     // If not html then we run the standard output.
365
-    if(empty($html)){
365
+    if (empty($html)) {
366 366
 
367 367
         if ($post->{$cf['htmlvar_name']}):
368 368
 
@@ -377,9 +377,9 @@  discard block
 block discarded – undo
377 377
             }
378 378
 
379 379
 
380
-            $html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-contact" style="' . $field_icon . '">' . $field_icon_af .
381
-                    $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '&nbsp;';
382
-            $html .= '</span><a href="tel:' . preg_replace('/[^0-9+]/', '', $post->{$cf['htmlvar_name']}) . '">' . $post->{$cf['htmlvar_name']} . '</a></div>';
380
+            $html = '<div class="geodir_more_info  '.$cf['css_class'].' '.$cf['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-contact" style="'.$field_icon.'">'.$field_icon_af.
381
+                    $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : '&nbsp;';
382
+            $html .= '</span><a href="tel:'.preg_replace('/[^0-9+]/', '', $post->{$cf['htmlvar_name']}).'">'.$post->{$cf['htmlvar_name']}.'</a></div>';
383 383
 
384 384
         endif;
385 385
 
@@ -387,7 +387,7 @@  discard block
 block discarded – undo
387 387
 
388 388
     return $html;
389 389
 }
390
-add_filter('geodir_custom_field_output_phone','geodir_cf_phone',10,3);
390
+add_filter('geodir_custom_field_output_phone', 'geodir_cf_phone', 10, 3);
391 391
 
392 392
 
393 393
 /**
@@ -400,21 +400,21 @@  discard block
 block discarded – undo
400 400
  *
401 401
  * @return string The html to output for the custom field.
402 402
  */
403
-function geodir_cf_time($html,$location,$cf,$p=''){
403
+function geodir_cf_time($html, $location, $cf, $p = '') {
404 404
 
405 405
     // check we have the post value
406
-    if(is_int($p)){$post = geodir_get_post_info($p);}
407
-    else{ global $post;}
406
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
407
+    else { global $post; }
408 408
 
409
-    if(!is_array($cf) && $cf!=''){
409
+    if (!is_array($cf) && $cf != '') {
410 410
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
411
-        if(!$cf){return NULL;}
411
+        if (!$cf) {return NULL; }
412 412
     }
413 413
 
414 414
     $html_var = $cf['htmlvar_name'];
415 415
 
416 416
     // Check if there is a location specific filter.
417
-    if(has_filter("geodir_custom_field_output_time_loc_{$location}")){
417
+    if (has_filter("geodir_custom_field_output_time_loc_{$location}")) {
418 418
         /**
419 419
          * Filter the time html by location.
420 420
          *
@@ -422,11 +422,11 @@  discard block
 block discarded – undo
422 422
          * @param array $cf The custom field array.
423 423
          * @since 1.6.6
424 424
          */
425
-        $html = apply_filters("geodir_custom_field_output_time_loc_{$location}",$html,$cf);
425
+        $html = apply_filters("geodir_custom_field_output_time_loc_{$location}", $html, $cf);
426 426
     }
427 427
 
428 428
     // Check if there is a custom field specific filter.
429
-    if(has_filter("geodir_custom_field_output_time_var_{$html_var}")){
429
+    if (has_filter("geodir_custom_field_output_time_var_{$html_var}")) {
430 430
         /**
431 431
          * Filter the time html by individual custom field.
432 432
          *
@@ -435,11 +435,11 @@  discard block
 block discarded – undo
435 435
          * @param array $cf The custom field array.
436 436
          * @since 1.6.6
437 437
          */
438
-        $html = apply_filters("geodir_custom_field_output_time_var_{$html_var}",$html,$location,$cf);
438
+        $html = apply_filters("geodir_custom_field_output_time_var_{$html_var}", $html, $location, $cf);
439 439
     }
440 440
 
441 441
     // Check if there is a custom field key specific filter.
442
-    if(has_filter("geodir_custom_field_output_time_key_{$cf['field_type_key']}")){
442
+    if (has_filter("geodir_custom_field_output_time_key_{$cf['field_type_key']}")) {
443 443
         /**
444 444
          * Filter the time html by field type key.
445 445
          *
@@ -448,11 +448,11 @@  discard block
 block discarded – undo
448 448
          * @param array $cf The custom field array.
449 449
          * @since 1.6.6
450 450
          */
451
-        $html = apply_filters("geodir_custom_field_output_time_key_{$cf['field_type_key']}",$html,$location,$cf);
451
+        $html = apply_filters("geodir_custom_field_output_time_key_{$cf['field_type_key']}", $html, $location, $cf);
452 452
     }
453 453
 
454 454
     // If not html then we run the standard output.
455
-    if(empty($html)){
455
+    if (empty($html)) {
456 456
 
457 457
         if ($post->{$cf['htmlvar_name']}):
458 458
 
@@ -472,9 +472,9 @@  discard block
 block discarded – undo
472 472
             }
473 473
 
474 474
 
475
-            $html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-time" style="' . $field_icon . '">' . $field_icon_af;
476
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '&nbsp;';
477
-            $html .= '</span>' . $value . '</div>';
475
+            $html = '<div class="geodir_more_info  '.$cf['css_class'].' '.$cf['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-time" style="'.$field_icon.'">'.$field_icon_af;
476
+            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : '&nbsp;';
477
+            $html .= '</span>'.$value.'</div>';
478 478
 
479 479
         endif;
480 480
 
@@ -482,7 +482,7 @@  discard block
 block discarded – undo
482 482
 
483 483
     return $html;
484 484
 }
485
-add_filter('geodir_custom_field_output_time','geodir_cf_time',10,3);
485
+add_filter('geodir_custom_field_output_time', 'geodir_cf_time', 10, 3);
486 486
 
487 487
 
488 488
 /**
@@ -495,21 +495,21 @@  discard block
 block discarded – undo
495 495
  *
496 496
  * @return string The html to output for the custom field.
497 497
  */
498
-function geodir_cf_datepicker($html,$location,$cf,$p=''){
498
+function geodir_cf_datepicker($html, $location, $cf, $p = '') {
499 499
     global $preview;
500 500
     // check we have the post value
501
-    if(is_int($p)){$post = geodir_get_post_info($p);}
502
-    else{ global $post;}
501
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
502
+    else { global $post; }
503 503
 
504
-    if(!is_array($cf) && $cf!=''){
504
+    if (!is_array($cf) && $cf != '') {
505 505
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
506
-        if(!$cf){return NULL;}
506
+        if (!$cf) {return NULL; }
507 507
     }
508 508
 
509 509
     $html_var = $cf['htmlvar_name'];
510 510
 
511 511
     // Check if there is a location specific filter.
512
-    if(has_filter("geodir_custom_field_output_datepicker_loc_{$location}")){
512
+    if (has_filter("geodir_custom_field_output_datepicker_loc_{$location}")) {
513 513
         /**
514 514
          * Filter the datepicker html by location.
515 515
          *
@@ -517,11 +517,11 @@  discard block
 block discarded – undo
517 517
          * @param array $cf The custom field array.
518 518
          * @since 1.6.6
519 519
          */
520
-        $html = apply_filters("geodir_custom_field_output_datepicker_loc_{$location}",$html,$cf);
520
+        $html = apply_filters("geodir_custom_field_output_datepicker_loc_{$location}", $html, $cf);
521 521
     }
522 522
 
523 523
     // Check if there is a custom field specific filter.
524
-    if(has_filter("geodir_custom_field_output_datepicker_var_{$html_var}")){
524
+    if (has_filter("geodir_custom_field_output_datepicker_var_{$html_var}")) {
525 525
         /**
526 526
          * Filter the datepicker html by individual custom field.
527 527
          *
@@ -530,11 +530,11 @@  discard block
 block discarded – undo
530 530
          * @param array $cf The custom field array.
531 531
          * @since 1.6.6
532 532
          */
533
-        $html = apply_filters("geodir_custom_field_output_datepicker_var_{$html_var}",$html,$location,$cf);
533
+        $html = apply_filters("geodir_custom_field_output_datepicker_var_{$html_var}", $html, $location, $cf);
534 534
     }
535 535
 
536 536
     // Check if there is a custom field key specific filter.
537
-    if(has_filter("geodir_custom_field_output_datepicker_key_{$cf['field_type_key']}")){
537
+    if (has_filter("geodir_custom_field_output_datepicker_key_{$cf['field_type_key']}")) {
538 538
         /**
539 539
          * Filter the datepicker html by field type key.
540 540
          *
@@ -543,11 +543,11 @@  discard block
 block discarded – undo
543 543
          * @param array $cf The custom field array.
544 544
          * @since 1.6.6
545 545
          */
546
-        $html = apply_filters("geodir_custom_field_output_datepicker_key_{$cf['field_type_key']}",$html,$location,$cf);
546
+        $html = apply_filters("geodir_custom_field_output_datepicker_key_{$cf['field_type_key']}", $html, $location, $cf);
547 547
     }
548 548
 
549 549
     // If not html then we run the standard output.
550
-    if(empty($html)){
550
+    if (empty($html)) {
551 551
 
552 552
         if ($post->{$cf['htmlvar_name']}):
553 553
 
@@ -558,24 +558,24 @@  discard block
 block discarded – undo
558 558
             }
559 559
             // check if we need to change the format or not
560 560
             $date_format_len = strlen(str_replace(' ', '', $date_format));
561
-            if($date_format_len>5){// if greater then 4 then it's the old style format.
561
+            if ($date_format_len > 5) {// if greater then 4 then it's the old style format.
562 562
 
563
-                $search = array('dd','d','DD','mm','m','MM','yy'); //jQuery UI datepicker format
564
-                $replace = array('d','j','l','m','n','F','Y');//PHP date format
563
+                $search = array('dd', 'd', 'DD', 'mm', 'm', 'MM', 'yy'); //jQuery UI datepicker format
564
+                $replace = array('d', 'j', 'l', 'm', 'n', 'F', 'Y'); //PHP date format
565 565
 
566 566
                 $date_format = str_replace($search, $replace, $date_format);
567 567
 
568
-                $post_htmlvar_value = ($date_format == 'd/m/Y' || $date_format == 'j/n/Y' ) ? str_replace('/', '-', $post->{$cf['htmlvar_name']}) : $post->{$cf['htmlvar_name']}; // PHP doesn't work well with dd/mm/yyyy format
569
-            }else{
568
+                $post_htmlvar_value = ($date_format == 'd/m/Y' || $date_format == 'j/n/Y') ? str_replace('/', '-', $post->{$cf['htmlvar_name']}) : $post->{$cf['htmlvar_name']}; // PHP doesn't work well with dd/mm/yyyy format
569
+            } else {
570 570
                 $post_htmlvar_value = $post->{$cf['htmlvar_name']};
571 571
             }
572 572
 
573
-            if ($post->{$cf['htmlvar_name']} != '' && $post->{$cf['htmlvar_name']}!="0000-00-00") {
573
+            if ($post->{$cf['htmlvar_name']} != '' && $post->{$cf['htmlvar_name']} != "0000-00-00") {
574 574
                 $date_format_from = $preview ? $date_format : 'Y-m-d';
575 575
                 $value = geodir_date($post_htmlvar_value, $date_format, $date_format_from); // save as sql format Y-m-d
576 576
                 //$post_htmlvar_value = strpos($post_htmlvar_value, '/') !== false ? str_replace('/', '-', $post_htmlvar_value) : $post_htmlvar_value;
577 577
                 //$value = date_i18n($date_format, strtotime($post_htmlvar_value));
578
-            }else{
578
+            } else {
579 579
                 return '';
580 580
             }
581 581
 
@@ -592,9 +592,9 @@  discard block
 block discarded – undo
592 592
 
593 593
 
594 594
 
595
-            $html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-datepicker" style="' . $field_icon . '">' . $field_icon_af;
596
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
597
-            $html .= '</span>' . $value . '</div>';
595
+            $html = '<div class="geodir_more_info  '.$cf['css_class'].' '.$cf['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-datepicker" style="'.$field_icon.'">'.$field_icon_af;
596
+            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : '';
597
+            $html .= '</span>'.$value.'</div>';
598 598
 
599 599
         endif;
600 600
 
@@ -602,7 +602,7 @@  discard block
 block discarded – undo
602 602
 
603 603
     return $html;
604 604
 }
605
-add_filter('geodir_custom_field_output_datepicker','geodir_cf_datepicker',10,3);
605
+add_filter('geodir_custom_field_output_datepicker', 'geodir_cf_datepicker', 10, 3);
606 606
 
607 607
 
608 608
 /**
@@ -615,21 +615,21 @@  discard block
 block discarded – undo
615 615
  *
616 616
  * @return string The html to output for the custom field.
617 617
  */
618
-function geodir_cf_text($html,$location,$cf,$p=''){
618
+function geodir_cf_text($html, $location, $cf, $p = '') {
619 619
 
620 620
     // check we have the post value
621
-    if(is_int($p)){$post = geodir_get_post_info($p);}
622
-    else{ global $post;}
621
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
622
+    else { global $post; }
623 623
 
624
-    if(!is_array($cf) && $cf!=''){
624
+    if (!is_array($cf) && $cf != '') {
625 625
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
626
-        if(!$cf){return NULL;}
626
+        if (!$cf) {return NULL; }
627 627
     }
628 628
 
629 629
     $html_var = $cf['htmlvar_name'];
630 630
 
631 631
     // Check if there is a location specific filter.
632
-    if(has_filter("geodir_custom_field_output_text_loc_{$location}")){
632
+    if (has_filter("geodir_custom_field_output_text_loc_{$location}")) {
633 633
         /**
634 634
          * Filter the text html by location.
635 635
          *
@@ -637,11 +637,11 @@  discard block
 block discarded – undo
637 637
          * @param array $cf The custom field array.
638 638
          * @since 1.6.6
639 639
          */
640
-        $html = apply_filters("geodir_custom_field_output_text_loc_{$location}",$html,$cf);
640
+        $html = apply_filters("geodir_custom_field_output_text_loc_{$location}", $html, $cf);
641 641
     }
642 642
 
643 643
     // Check if there is a custom field specific filter.
644
-    if(has_filter("geodir_custom_field_output_text_var_{$html_var}")){
644
+    if (has_filter("geodir_custom_field_output_text_var_{$html_var}")) {
645 645
         /**
646 646
          * Filter the text html by individual custom field.
647 647
          *
@@ -650,11 +650,11 @@  discard block
 block discarded – undo
650 650
          * @param array $cf The custom field array.
651 651
          * @since 1.6.6
652 652
          */
653
-        $html = apply_filters("geodir_custom_field_output_text_var_{$html_var}",$html,$location,$cf);
653
+        $html = apply_filters("geodir_custom_field_output_text_var_{$html_var}", $html, $location, $cf);
654 654
     }
655 655
 
656 656
     // Check if there is a custom field key specific filter.
657
-    if(has_filter("geodir_custom_field_output_text_key_{$cf['field_type_key']}")){
657
+    if (has_filter("geodir_custom_field_output_text_key_{$cf['field_type_key']}")) {
658 658
         /**
659 659
          * Filter the text html by field type key.
660 660
          *
@@ -663,15 +663,15 @@  discard block
 block discarded – undo
663 663
          * @param array $cf The custom field array.
664 664
          * @since 1.6.6
665 665
          */
666
-        $html = apply_filters("geodir_custom_field_output_text_key_{$cf['field_type_key']}",$html,$location,$cf);
666
+        $html = apply_filters("geodir_custom_field_output_text_key_{$cf['field_type_key']}", $html, $location, $cf);
667 667
     }
668 668
 
669 669
     
670 670
 
671 671
     // If not html then we run the standard output.
672
-    if(empty($html)){
672
+    if (empty($html)) {
673 673
 
674
-        if (isset($post->{$cf['htmlvar_name']}) && $post->{$cf['htmlvar_name']} != '' ):
674
+        if (isset($post->{$cf['htmlvar_name']}) && $post->{$cf['htmlvar_name']} != ''):
675 675
 
676 676
             $class = ($cf['htmlvar_name'] == 'geodir_timing') ? "geodir-i-time" : "geodir-i-text";
677 677
 
@@ -686,16 +686,16 @@  discard block
 block discarded – undo
686 686
             }
687 687
 
688 688
 
689
-            $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="'.$class.'" style="' . $field_icon . '">' . $field_icon_af;
690
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
689
+            $html = '<div class="geodir_more_info '.$cf['css_class'].' '.$cf['htmlvar_name'].'" style="clear:both;"><span class="'.$class.'" style="'.$field_icon.'">'.$field_icon_af;
690
+            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : '';
691 691
             $html .= '</span>';
692 692
 
693 693
             $value = $post->{$cf['htmlvar_name']};
694
-            if(isset($cf['data_type']) && ($cf['data_type']=='INT' || $cf['data_type']=='FLOAT') && isset($cf['extra_fields']) && $cf['extra_fields']){
694
+            if (isset($cf['data_type']) && ($cf['data_type'] == 'INT' || $cf['data_type'] == 'FLOAT') && isset($cf['extra_fields']) && $cf['extra_fields']) {
695 695
                 $extra_fields = stripslashes_deep(maybe_unserialize($cf['extra_fields']));
696
-                if(isset($extra_fields['is_price']) && $extra_fields['is_price']){
697
-                    if(!ceil($value) > 0){return '';}// dont output blank prices
698
-                    $value = geodir_currency_format_number($value,$cf);
696
+                if (isset($extra_fields['is_price']) && $extra_fields['is_price']) {
697
+                    if (!ceil($value) > 0) {return ''; }// dont output blank prices
698
+                    $value = geodir_currency_format_number($value, $cf);
699 699
                 }
700 700
             }
701 701
 
@@ -709,7 +709,7 @@  discard block
 block discarded – undo
709 709
 
710 710
     return $html;
711 711
 }
712
-add_filter('geodir_custom_field_output_text','geodir_cf_text',10,3);
712
+add_filter('geodir_custom_field_output_text', 'geodir_cf_text', 10, 3);
713 713
 
714 714
 
715 715
 /**
@@ -722,21 +722,21 @@  discard block
 block discarded – undo
722 722
  *
723 723
  * @return string The html to output for the custom field.
724 724
  */
725
-function geodir_cf_radio($html,$location,$cf,$p=''){
725
+function geodir_cf_radio($html, $location, $cf, $p = '') {
726 726
 
727 727
     // check we have the post value
728
-    if(is_int($p)){$post = geodir_get_post_info($p);}
729
-    else{ global $post;}
728
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
729
+    else { global $post; }
730 730
 
731
-    if(!is_array($cf) && $cf!=''){
731
+    if (!is_array($cf) && $cf != '') {
732 732
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
733
-        if(!$cf){return NULL;}
733
+        if (!$cf) {return NULL; }
734 734
     }
735 735
 
736 736
     $html_var = $cf['htmlvar_name'];
737 737
 
738 738
     // Check if there is a location specific filter.
739
-    if(has_filter("geodir_custom_field_output_radio_loc_{$location}")){
739
+    if (has_filter("geodir_custom_field_output_radio_loc_{$location}")) {
740 740
         /**
741 741
          * Filter the radio html by location.
742 742
          *
@@ -744,11 +744,11 @@  discard block
 block discarded – undo
744 744
          * @param array $cf The custom field array.
745 745
          * @since 1.6.6
746 746
          */
747
-        $html = apply_filters("geodir_custom_field_output_radio_loc_{$location}",$html,$cf);
747
+        $html = apply_filters("geodir_custom_field_output_radio_loc_{$location}", $html, $cf);
748 748
     }
749 749
 
750 750
     // Check if there is a custom field specific filter.
751
-    if(has_filter("geodir_custom_field_output_radio_var_{$html_var}")){
751
+    if (has_filter("geodir_custom_field_output_radio_var_{$html_var}")) {
752 752
         /**
753 753
          * Filter the radio html by individual custom field.
754 754
          *
@@ -757,11 +757,11 @@  discard block
 block discarded – undo
757 757
          * @param array $cf The custom field array.
758 758
          * @since 1.6.6
759 759
          */
760
-        $html = apply_filters("geodir_custom_field_output_radio_var_{$html_var}",$html,$location,$cf);
760
+        $html = apply_filters("geodir_custom_field_output_radio_var_{$html_var}", $html, $location, $cf);
761 761
     }
762 762
 
763 763
     // Check if there is a custom field key specific filter.
764
-    if(has_filter("geodir_custom_field_output_radio_key_{$cf['field_type_key']}")){
764
+    if (has_filter("geodir_custom_field_output_radio_key_{$cf['field_type_key']}")) {
765 765
         /**
766 766
          * Filter the radio html by field type key.
767 767
          *
@@ -770,11 +770,11 @@  discard block
 block discarded – undo
770 770
          * @param array $cf The custom field array.
771 771
          * @since 1.6.6
772 772
          */
773
-        $html = apply_filters("geodir_custom_field_output_radio_key_{$cf['field_type_key']}",$html,$location,$cf);
773
+        $html = apply_filters("geodir_custom_field_output_radio_key_{$cf['field_type_key']}", $html, $location, $cf);
774 774
     }
775 775
 
776 776
     // If not html then we run the standard output.
777
-    if(empty($html)){
777
+    if (empty($html)) {
778 778
 
779 779
         $html_val = isset($post->{$cf['htmlvar_name']}) ? __($post->{$cf['htmlvar_name']}, 'geodirectory') : '';
780 780
         if (isset($post->{$cf['htmlvar_name']}) && $post->{$cf['htmlvar_name']} != ''):
@@ -808,16 +808,16 @@  discard block
 block discarded – undo
808 808
             }
809 809
 
810 810
 
811
-            $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-radio" style="' . $field_icon . '">' . $field_icon_af;
812
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
813
-            $html .= '</span>' . $html_val . '</div>';
811
+            $html = '<div class="geodir_more_info '.$cf['css_class'].' '.$cf['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-radio" style="'.$field_icon.'">'.$field_icon_af;
812
+            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : '';
813
+            $html .= '</span>'.$html_val.'</div>';
814 814
         endif;
815 815
 
816 816
     }
817 817
 
818 818
     return $html;
819 819
 }
820
-add_filter('geodir_custom_field_output_radio','geodir_cf_radio',10,3);
820
+add_filter('geodir_custom_field_output_radio', 'geodir_cf_radio', 10, 3);
821 821
 
822 822
 
823 823
 /**
@@ -831,21 +831,21 @@  discard block
 block discarded – undo
831 831
  *
832 832
  * @return string The html to output for the custom field.
833 833
  */
834
-function geodir_cf_select($html,$location,$cf,$p=''){
834
+function geodir_cf_select($html, $location, $cf, $p = '') {
835 835
 
836 836
     // check we have the post value
837
-    if(is_int($p)){$post = geodir_get_post_info($p);}
838
-    else{ global $post;}
837
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
838
+    else { global $post; }
839 839
 
840
-    if(!is_array($cf) && $cf!=''){
840
+    if (!is_array($cf) && $cf != '') {
841 841
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
842
-        if(!$cf){return NULL;}
842
+        if (!$cf) {return NULL; }
843 843
     }
844 844
 
845 845
     $html_var = $cf['htmlvar_name'];
846 846
 
847 847
     // Check if there is a location specific filter.
848
-    if(has_filter("geodir_custom_field_output_select_loc_{$location}")){
848
+    if (has_filter("geodir_custom_field_output_select_loc_{$location}")) {
849 849
         /**
850 850
          * Filter the select html by location.
851 851
          *
@@ -853,11 +853,11 @@  discard block
 block discarded – undo
853 853
          * @param array $cf The custom field array.
854 854
          * @since 1.6.6
855 855
          */
856
-        $html = apply_filters("geodir_custom_field_output_select_loc_{$location}",$html,$cf);
856
+        $html = apply_filters("geodir_custom_field_output_select_loc_{$location}", $html, $cf);
857 857
     }
858 858
 
859 859
     // Check if there is a custom field specific filter.
860
-    if(has_filter("geodir_custom_field_output_select_var_{$html_var}")){
860
+    if (has_filter("geodir_custom_field_output_select_var_{$html_var}")) {
861 861
         /**
862 862
          * Filter the select html by individual custom field.
863 863
          *
@@ -866,11 +866,11 @@  discard block
 block discarded – undo
866 866
          * @param array $cf The custom field array.
867 867
          * @since 1.6.6
868 868
          */
869
-        $html = apply_filters("geodir_custom_field_output_select_var_{$html_var}",$html,$location,$cf);
869
+        $html = apply_filters("geodir_custom_field_output_select_var_{$html_var}", $html, $location, $cf);
870 870
     }
871 871
 
872 872
     // Check if there is a custom field key specific filter.
873
-    if(has_filter("geodir_custom_field_output_select_key_{$cf['field_type_key']}")){
873
+    if (has_filter("geodir_custom_field_output_select_key_{$cf['field_type_key']}")) {
874 874
         /**
875 875
          * Filter the select html by field type key.
876 876
          *
@@ -879,11 +879,11 @@  discard block
 block discarded – undo
879 879
          * @param array $cf The custom field array.
880 880
          * @since 1.6.6
881 881
          */
882
-        $html = apply_filters("geodir_custom_field_output_select_key_{$cf['field_type_key']}",$html,$location,$cf);
882
+        $html = apply_filters("geodir_custom_field_output_select_key_{$cf['field_type_key']}", $html, $location, $cf);
883 883
     }
884 884
 
885 885
     // If not html then we run the standard output.
886
-    if(empty($html)){
886
+    if (empty($html)) {
887 887
 
888 888
         if ($post->{$cf['htmlvar_name']}):
889 889
             $field_value = __($post->{$cf['htmlvar_name']}, 'geodirectory');
@@ -911,16 +911,16 @@  discard block
 block discarded – undo
911 911
             }
912 912
 
913 913
 
914
-            $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af;
915
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
916
-            $html .= '</span>' . $field_value . '</div>';
914
+            $html = '<div class="geodir_more_info '.$cf['css_class'].' '.$cf['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-select" style="'.$field_icon.'">'.$field_icon_af;
915
+            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : '';
916
+            $html .= '</span>'.$field_value.'</div>';
917 917
         endif;
918 918
 
919 919
     }
920 920
 
921 921
     return $html;
922 922
 }
923
-add_filter('geodir_custom_field_output_select','geodir_cf_select',10,3);
923
+add_filter('geodir_custom_field_output_select', 'geodir_cf_select', 10, 3);
924 924
 
925 925
 
926 926
 /**
@@ -933,21 +933,21 @@  discard block
 block discarded – undo
933 933
  *
934 934
  * @return string The html to output for the custom field.
935 935
  */
936
-function geodir_cf_multiselect($html,$location,$cf,$p=''){
936
+function geodir_cf_multiselect($html, $location, $cf, $p = '') {
937 937
 
938 938
     // check we have the post value
939
-    if(is_int($p)){$post = geodir_get_post_info($p);}
940
-    else{ global $post;}
939
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
940
+    else { global $post; }
941 941
 
942
-    if(!is_array($cf) && $cf!=''){
942
+    if (!is_array($cf) && $cf != '') {
943 943
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
944
-        if(!$cf){return NULL;}
944
+        if (!$cf) {return NULL; }
945 945
     }
946 946
 
947 947
     $html_var = $cf['htmlvar_name'];
948 948
 
949 949
     // Check if there is a location specific filter.
950
-    if(has_filter("geodir_custom_field_output_multiselect_loc_{$location}")){
950
+    if (has_filter("geodir_custom_field_output_multiselect_loc_{$location}")) {
951 951
         /**
952 952
          * Filter the multiselect html by location.
953 953
          *
@@ -955,11 +955,11 @@  discard block
 block discarded – undo
955 955
          * @param array $cf The custom field array.
956 956
          * @since 1.6.6
957 957
          */
958
-        $html = apply_filters("geodir_custom_field_output_multiselect_loc_{$location}",$html,$cf);
958
+        $html = apply_filters("geodir_custom_field_output_multiselect_loc_{$location}", $html, $cf);
959 959
     }
960 960
 
961 961
     // Check if there is a custom field specific filter.
962
-    if(has_filter("geodir_custom_field_output_multiselect_var_{$html_var}")){
962
+    if (has_filter("geodir_custom_field_output_multiselect_var_{$html_var}")) {
963 963
         /**
964 964
          * Filter the multiselect html by individual custom field.
965 965
          *
@@ -968,11 +968,11 @@  discard block
 block discarded – undo
968 968
          * @param array $cf The custom field array.
969 969
          * @since 1.6.6
970 970
          */
971
-        $html = apply_filters("geodir_custom_field_output_multiselect_var_{$html_var}",$html,$location,$cf);
971
+        $html = apply_filters("geodir_custom_field_output_multiselect_var_{$html_var}", $html, $location, $cf);
972 972
     }
973 973
 
974 974
     // Check if there is a custom field key specific filter.
975
-    if(has_filter("geodir_custom_field_output_multiselect_key_{$cf['field_type_key']}")){
975
+    if (has_filter("geodir_custom_field_output_multiselect_key_{$cf['field_type_key']}")) {
976 976
         /**
977 977
          * Filter the multiselect html by field type key.
978 978
          *
@@ -981,11 +981,11 @@  discard block
 block discarded – undo
981 981
          * @param array $cf The custom field array.
982 982
          * @since 1.6.6
983 983
          */
984
-        $html = apply_filters("geodir_custom_field_output_multiselect_key_{$cf['field_type_key']}",$html,$location,$cf);
984
+        $html = apply_filters("geodir_custom_field_output_multiselect_key_{$cf['field_type_key']}", $html, $location, $cf);
985 985
     }
986 986
 
987 987
     // If not html then we run the standard output.
988
-    if(empty($html)){
988
+    if (empty($html)) {
989 989
 
990 990
 
991 991
         if (!empty($post->{$cf['htmlvar_name']})):
@@ -1006,7 +1006,7 @@  discard block
 block discarded – undo
1006 1006
 
1007 1007
             $field_values = explode(',', trim($post->{$cf['htmlvar_name']}, ","));
1008 1008
 
1009
-            if(is_array($field_values)){
1009
+            if (is_array($field_values)) {
1010 1010
                 $field_values = array_map('trim', $field_values);
1011 1011
             }
1012 1012
 
@@ -1024,15 +1024,15 @@  discard block
 block discarded – undo
1024 1024
             }
1025 1025
 
1026 1026
 
1027
-            $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af;
1028
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1027
+            $html = '<div class="geodir_more_info '.$cf['css_class'].' '.$cf['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-select" style="'.$field_icon.'">'.$field_icon_af;
1028
+            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : '';
1029 1029
             $html .= '</span>';
1030 1030
 
1031 1031
             if (count($option_values) > 1) {
1032 1032
                 $html .= '<ul>';
1033 1033
 
1034 1034
                 foreach ($option_values as $val) {
1035
-                    $html .= '<li>' . $val . '</li>';
1035
+                    $html .= '<li>'.$val.'</li>';
1036 1036
                 }
1037 1037
 
1038 1038
                 $html .= '</ul>';
@@ -1047,7 +1047,7 @@  discard block
 block discarded – undo
1047 1047
 
1048 1048
     return $html;
1049 1049
 }
1050
-add_filter('geodir_custom_field_output_multiselect','geodir_cf_multiselect',10,3);
1050
+add_filter('geodir_custom_field_output_multiselect', 'geodir_cf_multiselect', 10, 3);
1051 1051
 
1052 1052
 
1053 1053
 /**
@@ -1060,21 +1060,21 @@  discard block
 block discarded – undo
1060 1060
  *
1061 1061
  * @return string The html to output for the custom field.
1062 1062
  */
1063
-function geodir_cf_email($html,$location,$cf,$p=''){
1063
+function geodir_cf_email($html, $location, $cf, $p = '') {
1064 1064
 
1065 1065
     // check we have the post value
1066
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1067
-    else{ global $post;}
1066
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
1067
+    else { global $post; }
1068 1068
 
1069
-    if(!is_array($cf) && $cf!=''){
1069
+    if (!is_array($cf) && $cf != '') {
1070 1070
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1071
-        if(!$cf){return NULL;}
1071
+        if (!$cf) {return NULL; }
1072 1072
     }
1073 1073
 
1074 1074
     $html_var = $cf['htmlvar_name'];
1075 1075
 
1076 1076
     // Check if there is a location specific filter.
1077
-    if(has_filter("geodir_custom_field_output_email_loc_{$location}")){
1077
+    if (has_filter("geodir_custom_field_output_email_loc_{$location}")) {
1078 1078
         /**
1079 1079
          * Filter the email html by location.
1080 1080
          *
@@ -1082,11 +1082,11 @@  discard block
 block discarded – undo
1082 1082
          * @param array $cf The custom field array.
1083 1083
          * @since 1.6.6
1084 1084
          */
1085
-        $html = apply_filters("geodir_custom_field_output_email_loc_{$location}",$html,$cf);
1085
+        $html = apply_filters("geodir_custom_field_output_email_loc_{$location}", $html, $cf);
1086 1086
     }
1087 1087
 
1088 1088
     // Check if there is a custom field specific filter.
1089
-    if(has_filter("geodir_custom_field_output_email_var_{$html_var}")){
1089
+    if (has_filter("geodir_custom_field_output_email_var_{$html_var}")) {
1090 1090
         /**
1091 1091
          * Filter the email html by individual custom field.
1092 1092
          *
@@ -1095,11 +1095,11 @@  discard block
 block discarded – undo
1095 1095
          * @param array $cf The custom field array.
1096 1096
          * @since 1.6.6
1097 1097
          */
1098
-        $html = apply_filters("geodir_custom_field_output_email_var_{$html_var}",$html,$location,$cf);
1098
+        $html = apply_filters("geodir_custom_field_output_email_var_{$html_var}", $html, $location, $cf);
1099 1099
     }
1100 1100
 
1101 1101
     // Check if there is a custom field key specific filter.
1102
-    if(has_filter("geodir_custom_field_output_email_key_{$cf['field_type_key']}")){
1102
+    if (has_filter("geodir_custom_field_output_email_key_{$cf['field_type_key']}")) {
1103 1103
         /**
1104 1104
          * Filter the email html by field type key.
1105 1105
          *
@@ -1108,18 +1108,18 @@  discard block
 block discarded – undo
1108 1108
          * @param array $cf The custom field array.
1109 1109
          * @since 1.6.6
1110 1110
          */
1111
-        $html = apply_filters("geodir_custom_field_output_email_key_{$cf['field_type_key']}",$html,$location,$cf);
1111
+        $html = apply_filters("geodir_custom_field_output_email_key_{$cf['field_type_key']}", $html, $location, $cf);
1112 1112
     }
1113 1113
 
1114 1114
     // If not html then we run the standard output.
1115
-    if(empty($html)){
1115
+    if (empty($html)) {
1116 1116
 
1117 1117
         global $preview;
1118 1118
         if ($cf['htmlvar_name'] == 'geodir_email' && !(geodir_is_page('detail') || geodir_is_page('preview'))) {
1119 1119
             return ''; // Remove Send Enquiry | Send To Friend from listings page
1120 1120
         }
1121 1121
 
1122
-        $package_info = (array)geodir_post_package_info(array(), $post, $post->post_type);
1122
+        $package_info = (array) geodir_post_package_info(array(), $post, $post->post_type);
1123 1123
 
1124 1124
         if ($cf['htmlvar_name'] == 'geodir_email' && ((isset($package_info['sendtofriend']) && $package_info['sendtofriend']) || $post->{$cf['htmlvar_name']})) {
1125 1125
             global $send_to_friend;
@@ -1131,7 +1131,7 @@  discard block
 block discarded – undo
1131 1131
             if (!$preview) {
1132 1132
                 $b_send_inquiry = 'b_send_inquiry';
1133 1133
                 $b_sendtofriend = 'b_sendtofriend';
1134
-                $html = '<input type="hidden" name="geodir_popup_post_id" value="' . $post->ID . '" /><div class="geodir_display_popup_forms"></div>';
1134
+                $html = '<input type="hidden" name="geodir_popup_post_id" value="'.$post->ID.'" /><div class="geodir_display_popup_forms"></div>';
1135 1135
             }
1136 1136
 
1137 1137
             $field_icon = geodir_field_icon_proccess($cf);
@@ -1144,28 +1144,28 @@  discard block
 block discarded – undo
1144 1144
                 $field_icon = '';
1145 1145
             }
1146 1146
 
1147
-            $html .= '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '"><span class="geodir-i-email" style="' . $field_icon . '">' . $field_icon_af;
1147
+            $html .= '<div class="geodir_more_info  '.$cf['css_class'].' '.$cf['htmlvar_name'].'"><span class="geodir-i-email" style="'.$field_icon.'">'.$field_icon_af;
1148 1148
             $seperator = '';
1149 1149
             if ($post->{$cf['htmlvar_name']}) {
1150 1150
                 $b_send_inquiry_url = apply_filters('b_send_inquiry_url', 'javascript:void(0);');
1151
-                $html .= '<a href="'.$b_send_inquiry_url.'" class="' . $b_send_inquiry . '" >' . SEND_INQUIRY . '</a>';
1151
+                $html .= '<a href="'.$b_send_inquiry_url.'" class="'.$b_send_inquiry.'" >'.SEND_INQUIRY.'</a>';
1152 1152
                 $seperator = ' | ';
1153 1153
             }
1154 1154
 
1155 1155
             if (isset($package_info['sendtofriend']) && $package_info['sendtofriend']) {
1156 1156
                 $b_sendtofriend_url = apply_filters('b_sendtofriend_url', 'javascript:void(0);');
1157
-                $html .= $seperator . '<a href="'.$b_sendtofriend_url.'" class="' . $b_sendtofriend . '">' . SEND_TO_FRIEND . '</a>';
1157
+                $html .= $seperator.'<a href="'.$b_sendtofriend_url.'" class="'.$b_sendtofriend.'">'.SEND_TO_FRIEND.'</a>';
1158 1158
             }
1159 1159
 
1160 1160
             $html .= '</span></div>';
1161 1161
 
1162 1162
 
1163 1163
             if (isset($_REQUEST['send_inquiry']) && $_REQUEST['send_inquiry'] == 'success') {
1164
-                $html .= '<p class="sucess_msg">' . SEND_INQUIRY_SUCCESS . '</p>';
1164
+                $html .= '<p class="sucess_msg">'.SEND_INQUIRY_SUCCESS.'</p>';
1165 1165
             } elseif (isset($_REQUEST['sendtofrnd']) && $_REQUEST['sendtofrnd'] == 'success') {
1166
-                $html .= '<p class="sucess_msg">' . SEND_FRIEND_SUCCESS . '</p>';
1166
+                $html .= '<p class="sucess_msg">'.SEND_FRIEND_SUCCESS.'</p>';
1167 1167
             } elseif (isset($_REQUEST['emsg']) && $_REQUEST['emsg'] == 'captch') {
1168
-                $html .= '<p class="error_msg_fix">' . WRONG_CAPTCH_MSG . '</p>';
1168
+                $html .= '<p class="error_msg_fix">'.WRONG_CAPTCH_MSG.'</p>';
1169 1169
             }
1170 1170
 
1171 1171
             /*if(!$preview){require_once (geodir_plugin_path().'/geodirectory-templates/popup-forms.php');}*/
@@ -1185,11 +1185,11 @@  discard block
 block discarded – undo
1185 1185
                 }
1186 1186
 
1187 1187
 
1188
-                $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-email" style="' . $field_icon . '">' . $field_icon_af;
1189
-                $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1188
+                $html = '<div class="geodir_more_info '.$cf['css_class'].' '.$cf['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-email" style="'.$field_icon.'">'.$field_icon_af;
1189
+                $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : '';
1190 1190
                 $html .= '</span><span class="geodir-email-address-output">';
1191 1191
                 $email = $post->{$cf['htmlvar_name']} ;
1192
-                if($e_split = explode('@',$email)){
1192
+                if ($e_split = explode('@', $email)) {
1193 1193
                     /**
1194 1194
                      * Filter email custom field name output.
1195 1195
                      *
@@ -1198,10 +1198,10 @@  discard block
 block discarded – undo
1198 1198
                      * @param string $email The email string being output.
1199 1199
                      * @param array $cf Custom field variables array.
1200 1200
                      */
1201
-                    $email_name = apply_filters('geodir_email_field_name_output',$email,$cf);
1202
-                    $html .=  "<script>document.write('<a href=\"mailto:'+'$e_split[0]' + '@' + '$e_split[1]'+'\">$email_name</a>')</script>";
1203
-                }else{
1204
-                    $html .=  $email;
1201
+                    $email_name = apply_filters('geodir_email_field_name_output', $email, $cf);
1202
+                    $html .= "<script>document.write('<a href=\"mailto:'+'$e_split[0]' + '@' + '$e_split[1]'+'\">$email_name</a>')</script>";
1203
+                } else {
1204
+                    $html .= $email;
1205 1205
                 }
1206 1206
                 $html .= '</span></div>';
1207 1207
             }
@@ -1212,7 +1212,7 @@  discard block
 block discarded – undo
1212 1212
 
1213 1213
     return $html;
1214 1214
 }
1215
-add_filter('geodir_custom_field_output_email','geodir_cf_email',10,3);
1215
+add_filter('geodir_custom_field_output_email', 'geodir_cf_email', 10, 3);
1216 1216
 
1217 1217
 
1218 1218
 /**
@@ -1225,21 +1225,21 @@  discard block
 block discarded – undo
1225 1225
  *
1226 1226
  * @return string The html to output for the custom field.
1227 1227
  */
1228
-function geodir_cf_file($html,$location,$cf,$p=''){
1228
+function geodir_cf_file($html, $location, $cf, $p = '') {
1229 1229
 
1230 1230
     // check we have the post value
1231
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1232
-    else{ global $post;}
1231
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
1232
+    else { global $post; }
1233 1233
 
1234
-    if(!is_array($cf) && $cf!=''){
1234
+    if (!is_array($cf) && $cf != '') {
1235 1235
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1236
-        if(!$cf){return NULL;}
1236
+        if (!$cf) {return NULL; }
1237 1237
     }
1238 1238
 
1239 1239
     $html_var = $cf['htmlvar_name'];
1240 1240
 
1241 1241
     // Check if there is a location specific filter.
1242
-    if(has_filter("geodir_custom_field_output_file_loc_{$location}")){
1242
+    if (has_filter("geodir_custom_field_output_file_loc_{$location}")) {
1243 1243
         /**
1244 1244
          * Filter the file html by location.
1245 1245
          *
@@ -1247,11 +1247,11 @@  discard block
 block discarded – undo
1247 1247
          * @param array $cf The custom field array.
1248 1248
          * @since 1.6.6
1249 1249
          */
1250
-        $html = apply_filters("geodir_custom_field_output_file_loc_{$location}",$html,$cf);
1250
+        $html = apply_filters("geodir_custom_field_output_file_loc_{$location}", $html, $cf);
1251 1251
     }
1252 1252
 
1253 1253
     // Check if there is a custom field specific filter.
1254
-    if(has_filter("geodir_custom_field_output_file_var_{$html_var}")){
1254
+    if (has_filter("geodir_custom_field_output_file_var_{$html_var}")) {
1255 1255
         /**
1256 1256
          * Filter the file html by individual custom field.
1257 1257
          *
@@ -1260,11 +1260,11 @@  discard block
 block discarded – undo
1260 1260
          * @param array $cf The custom field array.
1261 1261
          * @since 1.6.6
1262 1262
          */
1263
-        $html = apply_filters("geodir_custom_field_output_file_var_{$html_var}",$html,$location,$cf);
1263
+        $html = apply_filters("geodir_custom_field_output_file_var_{$html_var}", $html, $location, $cf);
1264 1264
     }
1265 1265
 
1266 1266
     // Check if there is a custom field key specific filter.
1267
-    if(has_filter("geodir_custom_field_output_file_key_{$cf['field_type_key']}")){
1267
+    if (has_filter("geodir_custom_field_output_file_key_{$cf['field_type_key']}")) {
1268 1268
         /**
1269 1269
          * Filter the file html by field type key.
1270 1270
          *
@@ -1273,11 +1273,11 @@  discard block
 block discarded – undo
1273 1273
          * @param array $cf The custom field array.
1274 1274
          * @since 1.6.6
1275 1275
          */
1276
-        $html = apply_filters("geodir_custom_field_output_file_key_{$cf['field_type_key']}",$html,$location,$cf);
1276
+        $html = apply_filters("geodir_custom_field_output_file_key_{$cf['field_type_key']}", $html, $location, $cf);
1277 1277
     }
1278 1278
 
1279 1279
     // If not html then we run the standard output.
1280
-    if(empty($html)){
1280
+    if (empty($html)) {
1281 1281
 
1282 1282
         if (!empty($post->{$cf['htmlvar_name']})):
1283 1283
 
@@ -1285,7 +1285,7 @@  discard block
 block discarded – undo
1285 1285
             if (!empty($files)):
1286 1286
 
1287 1287
                 $extra_fields = !empty($cf['extra_fields']) ? stripslashes_deep(maybe_unserialize($cf['extra_fields'])) : NULL;
1288
-                $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? $extra_fields['gd_file_types'] : '';
1288
+                $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types']) ? $extra_fields['gd_file_types'] : '';
1289 1289
 
1290 1290
                 $file_paths = '';
1291 1291
                 foreach ($files as $file) {
@@ -1322,9 +1322,9 @@  discard block
 block discarded – undo
1322 1322
                             //$file_paths .= '<img src="'.$file.'"  />';	
1323 1323
                             $file_paths .= '</div>';
1324 1324
                         } else {
1325
-                            $ext_path = '_' . $html_var . '_';
1325
+                            $ext_path = '_'.$html_var.'_';
1326 1326
                             $filename = explode($ext_path, $filename);
1327
-                            $file_paths .= '<a href="' . $file . '" target="_blank">' . $filename[count($filename) - 1] . '</a>';
1327
+                            $file_paths .= '<a href="'.$file.'" target="_blank">'.$filename[count($filename) - 1].'</a>';
1328 1328
                         }
1329 1329
                     }
1330 1330
                 }
@@ -1339,11 +1339,11 @@  discard block
 block discarded – undo
1339 1339
                     $field_icon = '';
1340 1340
                 }
1341 1341
 
1342
-                $html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' geodir-custom-file-box ' . $cf['htmlvar_name'] . '"><div class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af;
1342
+                $html = '<div class="geodir_more_info  '.$cf['css_class'].' geodir-custom-file-box '.$cf['htmlvar_name'].'"><div class="geodir-i-select" style="'.$field_icon.'">'.$field_icon_af;
1343 1343
                 $html .= '<span style="display: inline-block; vertical-align: top; padding-right: 14px;">';
1344
-                $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1344
+                $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : '';
1345 1345
                 $html .= '</span>';
1346
-                $html .= $file_paths . '</div></div>';
1346
+                $html .= $file_paths.'</div></div>';
1347 1347
 
1348 1348
             endif;
1349 1349
         endif;
@@ -1352,7 +1352,7 @@  discard block
 block discarded – undo
1352 1352
 
1353 1353
     return $html;
1354 1354
 }
1355
-add_filter('geodir_custom_field_output_file','geodir_cf_file',10,3);
1355
+add_filter('geodir_custom_field_output_file', 'geodir_cf_file', 10, 3);
1356 1356
 
1357 1357
 
1358 1358
 
@@ -1366,21 +1366,21 @@  discard block
 block discarded – undo
1366 1366
  *
1367 1367
  * @return string The html to output for the custom field.
1368 1368
  */
1369
-function geodir_cf_textarea($html,$location,$cf,$p=''){
1369
+function geodir_cf_textarea($html, $location, $cf, $p = '') {
1370 1370
 
1371 1371
     // check we have the post value
1372
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1373
-    else{ global $post;}
1372
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
1373
+    else { global $post; }
1374 1374
 
1375
-    if(!is_array($cf) && $cf!=''){
1375
+    if (!is_array($cf) && $cf != '') {
1376 1376
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1377
-        if(!$cf){return NULL;}
1377
+        if (!$cf) {return NULL; }
1378 1378
     }
1379 1379
 
1380 1380
     $html_var = $cf['htmlvar_name'];
1381 1381
 
1382 1382
     // Check if there is a location specific filter.
1383
-    if(has_filter("geodir_custom_field_output_textarea_loc_{$location}")){
1383
+    if (has_filter("geodir_custom_field_output_textarea_loc_{$location}")) {
1384 1384
         /**
1385 1385
          * Filter the textarea html by location.
1386 1386
          *
@@ -1388,11 +1388,11 @@  discard block
 block discarded – undo
1388 1388
          * @param array $cf The custom field array.
1389 1389
          * @since 1.6.6
1390 1390
          */
1391
-        $html = apply_filters("geodir_custom_field_output_textarea_loc_{$location}",$html,$cf);
1391
+        $html = apply_filters("geodir_custom_field_output_textarea_loc_{$location}", $html, $cf);
1392 1392
     }
1393 1393
 
1394 1394
     // Check if there is a custom field specific filter.
1395
-    if(has_filter("geodir_custom_field_output_textarea_var_{$html_var}")){
1395
+    if (has_filter("geodir_custom_field_output_textarea_var_{$html_var}")) {
1396 1396
         /**
1397 1397
          * Filter the textarea html by individual custom field.
1398 1398
          *
@@ -1401,11 +1401,11 @@  discard block
 block discarded – undo
1401 1401
          * @param array $cf The custom field array.
1402 1402
          * @since 1.6.6
1403 1403
          */
1404
-        $html = apply_filters("geodir_custom_field_output_textarea_var_{$html_var}",$html,$location,$cf);
1404
+        $html = apply_filters("geodir_custom_field_output_textarea_var_{$html_var}", $html, $location, $cf);
1405 1405
     }
1406 1406
 
1407 1407
     // Check if there is a custom field key specific filter.
1408
-    if(has_filter("geodir_custom_field_output_textarea_key_{$cf['field_type_key']}")){
1408
+    if (has_filter("geodir_custom_field_output_textarea_key_{$cf['field_type_key']}")) {
1409 1409
         /**
1410 1410
          * Filter the textarea html by field type key.
1411 1411
          *
@@ -1414,11 +1414,11 @@  discard block
 block discarded – undo
1414 1414
          * @param array $cf The custom field array.
1415 1415
          * @since 1.6.6
1416 1416
          */
1417
-        $html = apply_filters("geodir_custom_field_output_textarea_key_{$cf['field_type_key']}",$html,$location,$cf);
1417
+        $html = apply_filters("geodir_custom_field_output_textarea_key_{$cf['field_type_key']}", $html, $location, $cf);
1418 1418
     }
1419 1419
 
1420 1420
     // If not html then we run the standard output.
1421
-    if(empty($html)){
1421
+    if (empty($html)) {
1422 1422
 
1423 1423
         if (!empty($post->{$cf['htmlvar_name']})) {
1424 1424
 
@@ -1433,9 +1433,9 @@  discard block
 block discarded – undo
1433 1433
             }
1434 1434
 
1435 1435
 
1436
-            $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af;
1437
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1438
-            $html .= '</span>' . wpautop($post->{$cf['htmlvar_name']}) . '</div>';
1436
+            $html = '<div class="geodir_more_info '.$cf['css_class'].' '.$cf['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-text" style="'.$field_icon.'">'.$field_icon_af;
1437
+            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : '';
1438
+            $html .= '</span>'.wpautop($post->{$cf['htmlvar_name']}).'</div>';
1439 1439
 
1440 1440
         }
1441 1441
 
@@ -1443,7 +1443,7 @@  discard block
 block discarded – undo
1443 1443
 
1444 1444
     return $html;
1445 1445
 }
1446
-add_filter('geodir_custom_field_output_textarea','geodir_cf_textarea',10,3);
1446
+add_filter('geodir_custom_field_output_textarea', 'geodir_cf_textarea', 10, 3);
1447 1447
 
1448 1448
 
1449 1449
 
@@ -1457,21 +1457,21 @@  discard block
 block discarded – undo
1457 1457
  *
1458 1458
  * @return string The html to output for the custom field.
1459 1459
  */
1460
-function geodir_cf_html($html,$location,$cf,$p=''){
1460
+function geodir_cf_html($html, $location, $cf, $p = '') {
1461 1461
 
1462 1462
     // check we have the post value
1463
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1464
-    else{ global $post;}
1463
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
1464
+    else { global $post; }
1465 1465
 
1466
-    if(!is_array($cf) && $cf!=''){
1466
+    if (!is_array($cf) && $cf != '') {
1467 1467
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1468
-        if(!$cf){return NULL;}
1468
+        if (!$cf) {return NULL; }
1469 1469
     }
1470 1470
 
1471 1471
     $html_var = $cf['htmlvar_name'];
1472 1472
 
1473 1473
     // Check if there is a location specific filter.
1474
-    if(has_filter("geodir_custom_field_output_html_loc_{$location}")){
1474
+    if (has_filter("geodir_custom_field_output_html_loc_{$location}")) {
1475 1475
         /**
1476 1476
          * Filter the html html by location.
1477 1477
          *
@@ -1479,11 +1479,11 @@  discard block
 block discarded – undo
1479 1479
          * @param array $cf The custom field array.
1480 1480
          * @since 1.6.6
1481 1481
          */
1482
-        $html = apply_filters("geodir_custom_field_output_html_loc_{$location}",$html,$cf);
1482
+        $html = apply_filters("geodir_custom_field_output_html_loc_{$location}", $html, $cf);
1483 1483
     }
1484 1484
 
1485 1485
     // Check if there is a custom field specific filter.
1486
-    if(has_filter("geodir_custom_field_output_html_var_{$html_var}")){
1486
+    if (has_filter("geodir_custom_field_output_html_var_{$html_var}")) {
1487 1487
         /**
1488 1488
          * Filter the html html by individual custom field.
1489 1489
          *
@@ -1492,11 +1492,11 @@  discard block
 block discarded – undo
1492 1492
          * @param array $cf The custom field array.
1493 1493
          * @since 1.6.6
1494 1494
          */
1495
-        $html = apply_filters("geodir_custom_field_output_html_var_{$html_var}",$html,$location,$cf);
1495
+        $html = apply_filters("geodir_custom_field_output_html_var_{$html_var}", $html, $location, $cf);
1496 1496
     }
1497 1497
 
1498 1498
     // Check if there is a custom field key specific filter.
1499
-    if(has_filter("geodir_custom_field_output_html_key_{$cf['field_type_key']}")){
1499
+    if (has_filter("geodir_custom_field_output_html_key_{$cf['field_type_key']}")) {
1500 1500
         /**
1501 1501
          * Filter the html html by field type key.
1502 1502
          *
@@ -1505,11 +1505,11 @@  discard block
 block discarded – undo
1505 1505
          * @param array $cf The custom field array.
1506 1506
          * @since 1.6.6
1507 1507
          */
1508
-        $html = apply_filters("geodir_custom_field_output_html_key_{$cf['field_type_key']}",$html,$location,$cf);
1508
+        $html = apply_filters("geodir_custom_field_output_html_key_{$cf['field_type_key']}", $html, $location, $cf);
1509 1509
     }
1510 1510
 
1511 1511
     // If not html then we run the standard output.
1512
-    if(empty($html)){
1512
+    if (empty($html)) {
1513 1513
 
1514 1514
         if (!empty($post->{$cf['htmlvar_name']})) {
1515 1515
 
@@ -1523,9 +1523,9 @@  discard block
 block discarded – undo
1523 1523
                 $field_icon = '';
1524 1524
             }
1525 1525
 
1526
-            $html = '<div class="geodir_more_info  ' . $cf['css_class'] . ' ' . $cf['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af;
1527
-            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1528
-            $html .= '</span>' . wpautop($post->{$cf['htmlvar_name']}) . '</div>';
1526
+            $html = '<div class="geodir_more_info  '.$cf['css_class'].' '.$cf['htmlvar_name'].'" style="clear:both;"><span class="geodir-i-text" style="'.$field_icon.'">'.$field_icon_af;
1527
+            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : '';
1528
+            $html .= '</span>'.wpautop($post->{$cf['htmlvar_name']}).'</div>';
1529 1529
 
1530 1530
         }
1531 1531
 
@@ -1533,7 +1533,7 @@  discard block
 block discarded – undo
1533 1533
 
1534 1534
     return $html;
1535 1535
 }
1536
-add_filter('geodir_custom_field_output_html','geodir_cf_html',10,3);
1536
+add_filter('geodir_custom_field_output_html', 'geodir_cf_html', 10, 3);
1537 1537
 
1538 1538
 
1539 1539
 
@@ -1547,21 +1547,21 @@  discard block
 block discarded – undo
1547 1547
  *
1548 1548
  * @return string The html to output for the custom field.
1549 1549
  */
1550
-function geodir_cf_taxonomy($html,$location,$cf,$p=''){
1550
+function geodir_cf_taxonomy($html, $location, $cf, $p = '') {
1551 1551
 
1552 1552
     // check we have the post value
1553
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1554
-    else{ global $post;}
1553
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
1554
+    else { global $post; }
1555 1555
 
1556
-    if(!is_array($cf) && $cf!=''){
1556
+    if (!is_array($cf) && $cf != '') {
1557 1557
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1558
-        if(!$cf){return NULL;}
1558
+        if (!$cf) {return NULL; }
1559 1559
     }
1560 1560
 
1561 1561
     $html_var = $cf['htmlvar_name'];
1562 1562
 
1563 1563
     // Check if there is a location specific filter.
1564
-    if(has_filter("geodir_custom_field_output_taxonomy_loc_{$location}")){
1564
+    if (has_filter("geodir_custom_field_output_taxonomy_loc_{$location}")) {
1565 1565
         /**
1566 1566
          * Filter the taxonomy html by location.
1567 1567
          *
@@ -1569,11 +1569,11 @@  discard block
 block discarded – undo
1569 1569
          * @param array $cf The custom field array.
1570 1570
          * @since 1.6.6
1571 1571
          */
1572
-        $html = apply_filters("geodir_custom_field_output_taxonomy_loc_{$location}",$html,$cf);
1572
+        $html = apply_filters("geodir_custom_field_output_taxonomy_loc_{$location}", $html, $cf);
1573 1573
     }
1574 1574
 
1575 1575
     // Check if there is a custom field specific filter.
1576
-    if(has_filter("geodir_custom_field_output_taxonomy_var_{$html_var}")){
1576
+    if (has_filter("geodir_custom_field_output_taxonomy_var_{$html_var}")) {
1577 1577
         /**
1578 1578
          * Filter the taxonomy html by individual custom field.
1579 1579
          *
@@ -1582,11 +1582,11 @@  discard block
 block discarded – undo
1582 1582
          * @param array $cf The custom field array.
1583 1583
          * @since 1.6.6
1584 1584
          */
1585
-        $html = apply_filters("geodir_custom_field_output_taxonomy_var_{$html_var}",$html,$location,$cf);
1585
+        $html = apply_filters("geodir_custom_field_output_taxonomy_var_{$html_var}", $html, $location, $cf);
1586 1586
     }
1587 1587
 
1588 1588
     // Check if there is a custom field key specific filter.
1589
-    if(has_filter("geodir_custom_field_output_taxonomy_key_{$cf['field_type_key']}")){
1589
+    if (has_filter("geodir_custom_field_output_taxonomy_key_{$cf['field_type_key']}")) {
1590 1590
         /**
1591 1591
          * Filter the taxonomy html by field type key.
1592 1592
          *
@@ -1595,14 +1595,14 @@  discard block
 block discarded – undo
1595 1595
          * @param array $cf The custom field array.
1596 1596
          * @since 1.6.6
1597 1597
          */
1598
-        $html = apply_filters("geodir_custom_field_output_taxonomy_key_{$cf['field_type_key']}",$html,$location,$cf);
1598
+        $html = apply_filters("geodir_custom_field_output_taxonomy_key_{$cf['field_type_key']}", $html, $location, $cf);
1599 1599
     }
1600 1600
 
1601 1601
     // If not html then we run the standard output.
1602
-    if(empty($html)){
1602
+    if (empty($html)) {
1603 1603
 
1604
-        if ($html_var == $post->post_type . 'category' && !empty($post->{$html_var})) {
1605
-            $post_taxonomy = $post->post_type . 'category';
1604
+        if ($html_var == $post->post_type.'category' && !empty($post->{$html_var})) {
1605
+            $post_taxonomy = $post->post_type.'category';
1606 1606
             $field_value = $post->{$html_var};
1607 1607
             $links = array();
1608 1608
             $terms = array();
@@ -1620,7 +1620,7 @@  discard block
 block discarded – undo
1620 1620
                     if ($term != '') {
1621 1621
                         $term = get_term_by('id', $term, $html_var);
1622 1622
                         if (is_object($term)) {
1623
-                            $links[] = "<a href='" . esc_attr(get_term_link($term, $post_taxonomy)) . "'>" . $term->name . "</a>";
1623
+                            $links[] = "<a href='".esc_attr(get_term_link($term, $post_taxonomy))."'>".$term->name."</a>";
1624 1624
                             $terms[] = $term;
1625 1625
                         }
1626 1626
                     }
@@ -1634,7 +1634,7 @@  discard block
 block discarded – undo
1634 1634
                     $terms = $termsOrdered;
1635 1635
                 }
1636 1636
             }
1637
-            $html_value = !empty($links) && !empty($terms) ? wp_sprintf('%l', $links, (object)$terms) : '';
1637
+            $html_value = !empty($links) && !empty($terms) ? wp_sprintf('%l', $links, (object) $terms) : '';
1638 1638
 
1639 1639
             if ($html_value != '') {
1640 1640
                 $field_icon = geodir_field_icon_proccess($cf);
@@ -1647,9 +1647,9 @@  discard block
 block discarded – undo
1647 1647
                     $field_icon = '';
1648 1648
                 }
1649 1649
 
1650
-                $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $html_var . '" style="clear:both;"><span class="geodir-i-taxonomy geodir-i-category" style="' . $field_icon . '">' . $field_icon_af;
1651
-                $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory') . ': ' : '';
1652
-                $html .= '</span> ' . $html_value . '</div>';
1650
+                $html = '<div class="geodir_more_info '.$cf['css_class'].' '.$html_var.'" style="clear:both;"><span class="geodir-i-taxonomy geodir-i-category" style="'.$field_icon.'">'.$field_icon_af;
1651
+                $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : '';
1652
+                $html .= '</span> '.$html_value.'</div>';
1653 1653
             }
1654 1654
         }
1655 1655
 
@@ -1657,7 +1657,7 @@  discard block
 block discarded – undo
1657 1657
 
1658 1658
     return $html;
1659 1659
 }
1660
-add_filter('geodir_custom_field_output_taxonomy','geodir_cf_taxonomy',10,3);
1660
+add_filter('geodir_custom_field_output_taxonomy', 'geodir_cf_taxonomy', 10, 3);
1661 1661
 
1662 1662
 
1663 1663
 /**
@@ -1670,21 +1670,21 @@  discard block
 block discarded – undo
1670 1670
  *
1671 1671
  * @return string The html to output for the custom field.
1672 1672
  */
1673
-function geodir_cf_address($html,$location,$cf,$p=''){
1673
+function geodir_cf_address($html, $location, $cf, $p = '') {
1674 1674
 
1675 1675
     // check we have the post value
1676
-    if(is_int($p)){$post = geodir_get_post_info($p);}
1677
-    else{ global $post;}
1676
+    if (is_int($p)) {$post = geodir_get_post_info($p); }
1677
+    else { global $post; }
1678 1678
 
1679
-    if(!is_array($cf) && $cf!=''){
1679
+    if (!is_array($cf) && $cf != '') {
1680 1680
         $cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
1681
-        if(!$cf){return NULL;}
1681
+        if (!$cf) {return NULL; }
1682 1682
     }
1683 1683
 
1684 1684
     $html_var = $cf['htmlvar_name'];
1685 1685
 
1686 1686
     // Check if there is a location specific filter.
1687
-    if(has_filter("geodir_custom_field_output_address_loc_{$location}")){
1687
+    if (has_filter("geodir_custom_field_output_address_loc_{$location}")) {
1688 1688
         /**
1689 1689
          * Filter the address html by location.
1690 1690
          *
@@ -1692,11 +1692,11 @@  discard block
 block discarded – undo
1692 1692
          * @param array $cf The custom field array.
1693 1693
          * @since 1.6.6
1694 1694
          */
1695
-        $html = apply_filters("geodir_custom_field_output_address_loc_{$location}",$html,$cf);
1695
+        $html = apply_filters("geodir_custom_field_output_address_loc_{$location}", $html, $cf);
1696 1696
     }
1697 1697
 
1698 1698
     // Check if there is a custom field specific filter.
1699
-    if(has_filter("geodir_custom_field_output_address_var_{$html_var}")){
1699
+    if (has_filter("geodir_custom_field_output_address_var_{$html_var}")) {
1700 1700
         /**
1701 1701
          * Filter the address html by individual custom field.
1702 1702
          *
@@ -1705,11 +1705,11 @@  discard block
 block discarded – undo
1705 1705
          * @param array $cf The custom field array.
1706 1706
          * @since 1.6.6
1707 1707
          */
1708
-        $html = apply_filters("geodir_custom_field_output_address_var_{$html_var}",$html,$location,$cf);
1708
+        $html = apply_filters("geodir_custom_field_output_address_var_{$html_var}", $html, $location, $cf);
1709 1709
     }
1710 1710
 
1711 1711
     // Check if there is a custom field key specific filter.
1712
-    if(has_filter("geodir_custom_field_output_address_key_{$cf['field_type_key']}")){
1712
+    if (has_filter("geodir_custom_field_output_address_key_{$cf['field_type_key']}")) {
1713 1713
         /**
1714 1714
          * Filter the address html by field type key.
1715 1715
          *
@@ -1718,14 +1718,14 @@  discard block
 block discarded – undo
1718 1718
          * @param array $cf The custom field array.
1719 1719
          * @since 1.6.6
1720 1720
          */
1721
-        $html = apply_filters("geodir_custom_field_output_address_key_{$cf['field_type_key']}",$html,$location,$cf);
1721
+        $html = apply_filters("geodir_custom_field_output_address_key_{$cf['field_type_key']}", $html, $location, $cf);
1722 1722
     }
1723 1723
 
1724 1724
     // If not html then we run the standard output.
1725
-    if(empty($html)){
1725
+    if (empty($html)) {
1726 1726
 
1727 1727
         global $preview;
1728
-        $html_var = $cf['htmlvar_name'] . '_address';
1728
+        $html_var = $cf['htmlvar_name'].'_address';
1729 1729
 
1730 1730
         if ($cf['extra_fields']) {
1731 1731
 
@@ -1788,10 +1788,10 @@  discard block
 block discarded – undo
1788 1788
 
1789 1789
         if ($post->{$html_var}) {
1790 1790
 
1791
-            $field_icon = geodir_field_icon_proccess( $cf );
1792
-            if ( strpos( $field_icon, 'http' ) !== false ) {
1791
+            $field_icon = geodir_field_icon_proccess($cf);
1792
+            if (strpos($field_icon, 'http') !== false) {
1793 1793
                 $field_icon_af = '';
1794
-            } elseif ( $field_icon == '' ) {
1794
+            } elseif ($field_icon == '') {
1795 1795
                 $field_icon_af = '<i class="fa fa-home"></i>';
1796 1796
             } else {
1797 1797
                 $field_icon_af = $field_icon;
@@ -1800,25 +1800,25 @@  discard block
 block discarded – undo
1800 1800
             
1801 1801
 
1802 1802
 
1803
-            $html = '<div class="geodir_more_info ' . $cf['css_class'] . ' ' . $html_var . '" style="clear:both;"  itemscope itemtype="https://schema.org/PostalAddress">';
1804
-            $html .= '<span class="geodir-i-location" style="' . $field_icon . '">' . $field_icon_af;
1805
-            $html .= ( trim( $cf['site_title'] ) ) ? __( $cf['site_title'], 'geodirectory' ) . ': ' : '&nbsp;';
1803
+            $html = '<div class="geodir_more_info '.$cf['css_class'].' '.$html_var.'" style="clear:both;"  itemscope itemtype="https://schema.org/PostalAddress">';
1804
+            $html .= '<span class="geodir-i-location" style="'.$field_icon.'">'.$field_icon_af;
1805
+            $html .= (trim($cf['site_title'])) ? __($cf['site_title'], 'geodirectory').': ' : '&nbsp;';
1806 1806
             $html .= '</span>';
1807 1807
 
1808
-            if ( isset($post->post_address) ) {
1809
-                $html .= '<span itemprop="streetAddress">' . $post->post_address . '</span><br>';
1808
+            if (isset($post->post_address)) {
1809
+                $html .= '<span itemprop="streetAddress">'.$post->post_address.'</span><br>';
1810 1810
             }
1811
-            if ($show_city_in_address && isset( $post->post_city ) && $post->post_city ) {
1812
-                $html .= '<span itemprop="addressLocality">' . $post->post_city . '</span><br>';
1811
+            if ($show_city_in_address && isset($post->post_city) && $post->post_city) {
1812
+                $html .= '<span itemprop="addressLocality">'.$post->post_city.'</span><br>';
1813 1813
             }
1814
-            if ($show_region_in_address && isset( $post->post_region ) && $post->post_region ) {
1815
-                $html .= '<span itemprop="addressRegion">' . $post->post_region . '</span><br>';
1814
+            if ($show_region_in_address && isset($post->post_region) && $post->post_region) {
1815
+                $html .= '<span itemprop="addressRegion">'.$post->post_region.'</span><br>';
1816 1816
             }
1817
-            if ($show_zip_in_address && isset( $post->post_zip ) && $post->post_zip ) {
1818
-                $html .= '<span itemprop="postalCode">' . $post->post_zip . '</span><br>';
1817
+            if ($show_zip_in_address && isset($post->post_zip) && $post->post_zip) {
1818
+                $html .= '<span itemprop="postalCode">'.$post->post_zip.'</span><br>';
1819 1819
             }
1820
-            if ($show_country_in_address && isset( $post->post_country ) && $post->post_country ) {
1821
-                $html .= '<span itemprop="addressCountry">' . __( $post->post_country, 'geodirectory' ) . '</span><br>';
1820
+            if ($show_country_in_address && isset($post->post_country) && $post->post_country) {
1821
+                $html .= '<span itemprop="addressCountry">'.__($post->post_country, 'geodirectory').'</span><br>';
1822 1822
             }
1823 1823
             $html .= '</div>';
1824 1824
 
@@ -1829,4 +1829,4 @@  discard block
 block discarded – undo
1829 1829
 
1830 1830
     return $html;
1831 1831
 }
1832
-add_filter('geodir_custom_field_output_address','geodir_cf_address',10,3);
1833 1832
\ No newline at end of file
1833
+add_filter('geodir_custom_field_output_address', 'geodir_cf_address', 10, 3);
1834 1834
\ No newline at end of file
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/location_functions.php 4 patches
Braces   +31 added lines, -22 removed lines patch added patch discarded remove patch
@@ -61,11 +61,12 @@  discard block
 block discarded – undo
61 61
 function geodir_is_default_location_set()
62 62
 {
63 63
     $default_location = geodir_get_default_location();
64
-    if (!empty($default_location))
65
-        return true;
66
-    else
67
-        return false;
68
-}
64
+    if (!empty($default_location)) {
65
+            return true;
66
+    } else {
67
+            return false;
68
+    }
69
+    }
69 70
 
70 71
 /**
71 72
  * Returns location slug using location string.
@@ -259,8 +260,9 @@  discard block
 block discarded – undo
259 260
         }
260 261
         */
261 262
 
262
-        if ($geodir_location->is_default)
263
-            update_option('geodir_default_location', $geodir_location);
263
+        if ($geodir_location->is_default) {
264
+                    update_option('geodir_default_location', $geodir_location);
265
+        }
264 266
 
265 267
         return $geodir_location->location_id;
266 268
 
@@ -308,9 +310,10 @@  discard block
 block discarded – undo
308 310
     $status = $data->status;
309 311
     if ($status == "OK") {
310 312
         return $data->results[0]->address_components;
311
-    } else
312
-        return false;
313
-}
313
+    } else {
314
+            return false;
315
+    }
316
+    }
314 317
 
315 318
 /**
316 319
  * Returns current location terms.
@@ -334,16 +337,19 @@  discard block
 block discarded – undo
334 337
         }
335 338
 
336 339
         $country = $gd_session->get('gd_country');
337
-        if ($country != '' && $country)
338
-            $location_array['gd_country'] = urldecode($country);
340
+        if ($country != '' && $country) {
341
+                    $location_array['gd_country'] = urldecode($country);
342
+        }
339 343
 
340 344
         $region = $gd_session->get('gd_region');
341
-        if ($region != '' && $region)
342
-            $location_array['gd_region'] = urldecode($region);
345
+        if ($region != '' && $region) {
346
+                    $location_array['gd_region'] = urldecode($region);
347
+        }
343 348
 
344 349
         $city = $gd_session->get('gd_city');
345
-        if ($city != '' && $city)
346
-            $location_array['gd_city'] = urldecode($city);
350
+        if ($city != '' && $city) {
351
+                    $location_array['gd_city'] = urldecode($city);
352
+        }
347 353
     } else {
348 354
         if ((isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] == 'me') || (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] == 'me') || (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] == 'me')) {
349 355
             return $location_array;
@@ -355,14 +361,17 @@  discard block
 block discarded – undo
355 361
 
356 362
         $city = (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] != '') ? $wp->query_vars['gd_city'] : '';
357 363
 
358
-        if ($country != '')
359
-            $location_array['gd_country'] = urldecode($country);
364
+        if ($country != '') {
365
+                    $location_array['gd_country'] = urldecode($country);
366
+        }
360 367
 
361
-        if ($region != '')
362
-            $location_array['gd_region'] = urldecode($region);
368
+        if ($region != '') {
369
+                    $location_array['gd_region'] = urldecode($region);
370
+        }
363 371
 
364
-        if ($city != '')
365
-            $location_array['gd_city'] = urldecode($city);
372
+        if ($city != '') {
373
+                    $location_array['gd_city'] = urldecode($city);
374
+        }
366 375
 			
367 376
 		// Fix category link in ajax popular category widget on change post type
368 377
 		if (empty($location_array) && defined('DOING_AJAX') && DOING_AJAX) {
Please login to merge, or discard this patch.
Doc Comments   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
  *
37 37
  * @since 1.0.0
38 38
  * @package GeoDirectory
39
- * @return object
39
+ * @return string
40 40
  */
41 41
 function geodir_get_default_location()
42 42
 {
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
  * @package GeoDirectory
277 277
  * @param int $min The minimum number. Default: 0.
278 278
  * @param int $max The maximum number. Default: 1.
279
- * @return float
279
+ * @return integer
280 280
  */
281 281
 function geodir_random_float($min = 0, $max = 1)
282 282
 {
@@ -594,6 +594,9 @@  discard block
 block discarded – undo
594 594
 add_filter('geodir_replace_location_variables', 'geodir_replace_location_variables');
595 595
 
596 596
 
597
+/**
598
+ * @param string $sep
599
+ */
597 600
 function geodir_location_replace_vars($location_array = array(), $sep = NULL, $gd_page = ''){
598 601
 
599 602
     global $wp;
Please login to merge, or discard this patch.
Indentation   +378 added lines, -378 removed lines patch added patch discarded remove patch
@@ -9,10 +9,10 @@  discard block
 block discarded – undo
9 9
  */
10 10
 function geodir_get_current_city_lat()
11 11
 {
12
-    $location = geodir_get_default_location();
13
-    $lat = isset($location_result->city_latitude) ? $location_result->city_latitude : '39.952484';
12
+	$location = geodir_get_default_location();
13
+	$lat = isset($location_result->city_latitude) ? $location_result->city_latitude : '39.952484';
14 14
 
15
-    return $lat;
15
+	return $lat;
16 16
 }
17 17
 
18 18
 /**
@@ -25,9 +25,9 @@  discard block
 block discarded – undo
25 25
  */
26 26
 function geodir_get_current_city_lng()
27 27
 {
28
-    $location = geodir_get_default_location();
29
-    $lng = isset($location_result->city_longitude) ? $location_result->city_longitude : '-75.163786';
30
-    return $lng;
28
+	$location = geodir_get_default_location();
29
+	$lng = isset($location_result->city_longitude) ? $location_result->city_longitude : '-75.163786';
30
+	return $lng;
31 31
 }
32 32
 
33 33
 
@@ -40,15 +40,15 @@  discard block
 block discarded – undo
40 40
  */
41 41
 function geodir_get_default_location()
42 42
 {
43
-    /**
44
-     * Filter the default location.
45
-     *
46
-     * @since 1.0.0
47
-     * @package GeoDirectory
48
-     *
49
-     * @param string $location_result The default location object.
50
-     */
51
-    return $location_result = apply_filters('geodir_get_default_location', get_option('geodir_default_location'));
43
+	/**
44
+	 * Filter the default location.
45
+	 *
46
+	 * @since 1.0.0
47
+	 * @package GeoDirectory
48
+	 *
49
+	 * @param string $location_result The default location object.
50
+	 */
51
+	return $location_result = apply_filters('geodir_get_default_location', get_option('geodir_default_location'));
52 52
 }
53 53
 
54 54
 /**
@@ -60,11 +60,11 @@  discard block
 block discarded – undo
60 60
  */
61 61
 function geodir_is_default_location_set()
62 62
 {
63
-    $default_location = geodir_get_default_location();
64
-    if (!empty($default_location))
65
-        return true;
66
-    else
67
-        return false;
63
+	$default_location = geodir_get_default_location();
64
+	if (!empty($default_location))
65
+		return true;
66
+	else
67
+		return false;
68 68
 }
69 69
 
70 70
 /**
@@ -78,15 +78,15 @@  discard block
 block discarded – undo
78 78
 function create_location_slug($location_string)
79 79
 {
80 80
 
81
-    /**
82
-     * Filter the location slug.
83
-     *
84
-     * @since 1.0.0
85
-     * @package GeoDirectory
86
-     *
87
-     * @param string $location_string Sanitized location string.
88
-     */
89
-    return urldecode(apply_filters('geodir_location_slug_check', sanitize_title($location_string)));
81
+	/**
82
+	 * Filter the location slug.
83
+	 *
84
+	 * @since 1.0.0
85
+	 * @package GeoDirectory
86
+	 *
87
+	 * @param string $location_string Sanitized location string.
88
+	 */
89
+	return urldecode(apply_filters('geodir_location_slug_check', sanitize_title($location_string)));
90 90
 
91 91
 }
92 92
 
@@ -100,15 +100,15 @@  discard block
 block discarded – undo
100 100
  */
101 101
 function geodir_get_location($id = '')
102 102
 {
103
-    /**
104
-     * Filter the location information.
105
-     *
106
-     * @since 1.0.0
107
-     * @package GeoDirectory
108
-     *
109
-     * @param string $id The location ID.
110
-     */
111
-    return $location_result = apply_filters('geodir_get_location_by_id', get_option('geodir_default_location'), $id);
103
+	/**
104
+	 * Filter the location information.
105
+	 *
106
+	 * @since 1.0.0
107
+	 * @package GeoDirectory
108
+	 *
109
+	 * @param string $id The location ID.
110
+	 */
111
+	return $location_result = apply_filters('geodir_get_location_by_id', get_option('geodir_default_location'), $id);
112 112
 }
113 113
 
114 114
 /**
@@ -122,28 +122,28 @@  discard block
 block discarded – undo
122 122
  */
123 123
 function geodir_get_country_dl($post_country = '', $prefix = '')
124 124
 {
125
-    global $wpdb;
125
+	global $wpdb;
126 126
 
127
-    $rows = $wpdb->get_results("SELECT Country,ISO2 FROM " . GEODIR_COUNTRIES_TABLE . " ORDER BY Country ASC");
127
+	$rows = $wpdb->get_results("SELECT Country,ISO2 FROM " . GEODIR_COUNTRIES_TABLE . " ORDER BY Country ASC");
128 128
     
129
-    $ISO2 = array();
130
-    $countries = array();
129
+	$ISO2 = array();
130
+	$countries = array();
131 131
     
132
-    foreach ($rows as $row) {
133
-        $ISO2[$row->Country] = $row->ISO2;
134
-        $countries[$row->Country] = __($row->Country, 'geodirectory');
135
-    }
132
+	foreach ($rows as $row) {
133
+		$ISO2[$row->Country] = $row->ISO2;
134
+		$countries[$row->Country] = __($row->Country, 'geodirectory');
135
+	}
136 136
     
137
-    asort($countries);
137
+	asort($countries);
138 138
     
139
-    $out_put = '<option ' . selected('', $post_country, false) . ' value="">' . __('Select Country', 'geodirectory') . '</option>';
140
-    foreach ($countries as $country => $name) {
141
-        $ccode = $ISO2[$country];
139
+	$out_put = '<option ' . selected('', $post_country, false) . ' value="">' . __('Select Country', 'geodirectory') . '</option>';
140
+	foreach ($countries as $country => $name) {
141
+		$ccode = $ISO2[$country];
142 142
 
143
-        $out_put .= '<option ' . selected($post_country, $country, false) . ' value="' . esc_attr($country) . '" data-country_code="' . $ccode . '">' . $name . '</option>';
144
-    }
143
+		$out_put .= '<option ' . selected($post_country, $country, false) . ' value="' . esc_attr($country) . '" data-country_code="' . $ccode . '">' . $name . '</option>';
144
+	}
145 145
 
146
-    echo $out_put;
146
+	echo $out_put;
147 147
 }
148 148
 
149 149
 
@@ -158,40 +158,40 @@  discard block
 block discarded – undo
158 158
 function geodir_location_form_submit()
159 159
 {
160 160
 
161
-    global $wpdb, $plugin_prefix;
162
-    if (isset($_REQUEST['add_location'])) {
161
+	global $wpdb, $plugin_prefix;
162
+	if (isset($_REQUEST['add_location'])) {
163 163
 
164
-        $location_info = array(
165
-            'city' => $_REQUEST['city'],
166
-            'region' => $_REQUEST['region'],
167
-            'country' => $_REQUEST['country'],
168
-            'geo_lat' => $_REQUEST['latitude'],
169
-            'geo_lng' => $_REQUEST['longitude'],
170
-            'is_default' => $_REQUEST['is_default'],
171
-            'update_city' => $_REQUEST['update_city']
172
-        );
164
+		$location_info = array(
165
+			'city' => $_REQUEST['city'],
166
+			'region' => $_REQUEST['region'],
167
+			'country' => $_REQUEST['country'],
168
+			'geo_lat' => $_REQUEST['latitude'],
169
+			'geo_lng' => $_REQUEST['longitude'],
170
+			'is_default' => $_REQUEST['is_default'],
171
+			'update_city' => $_REQUEST['update_city']
172
+		);
173 173
 
174
-        $old_location = geodir_get_default_location();
174
+		$old_location = geodir_get_default_location();
175 175
 
176
-        $locationid = geodir_add_new_location($location_info);
176
+		$locationid = geodir_add_new_location($location_info);
177 177
 
178
-        $default_location = geodir_get_location($locationid);
178
+		$default_location = geodir_get_location($locationid);
179 179
 
180
-        //UPDATE AND DELETE LISTING
181
-        $posttype = geodir_get_posttypes();
182
-        if (isset($_REQUEST['listing_action']) && $_REQUEST['listing_action'] == 'delete') {
180
+		//UPDATE AND DELETE LISTING
181
+		$posttype = geodir_get_posttypes();
182
+		if (isset($_REQUEST['listing_action']) && $_REQUEST['listing_action'] == 'delete') {
183 183
 
184
-            foreach ($posttype as $posttypeobj) {
185
-                $post_locations = '[' . $default_location->city_slug . '],[' . $default_location->region_slug . '],[' . $default_location->country_slug . ']'; // set all overall post location
184
+			foreach ($posttype as $posttypeobj) {
185
+				$post_locations = '[' . $default_location->city_slug . '],[' . $default_location->region_slug . '],[' . $default_location->country_slug . ']'; // set all overall post location
186 186
 
187
-                $sql = $wpdb->prepare(
188
-                    "UPDATE " . $plugin_prefix . $posttypeobj . "_detail SET post_city=%s, post_region=%s, post_country=%s, post_locations=%s WHERE post_location_id=%d AND ( post_city!=%s OR post_region!=%s OR post_country!=%s OR post_locations!=%s OR post_locations IS NULL)",
189
-                    array($_REQUEST['city'], $_REQUEST['region'], $_REQUEST['country'], $post_locations, $locationid, $_REQUEST['city'], $_REQUEST['region'], $_REQUEST['country'], $post_locations)
190
-                );
191
-                $wpdb->query($sql);
192
-            }
193
-        }
194
-    }
187
+				$sql = $wpdb->prepare(
188
+					"UPDATE " . $plugin_prefix . $posttypeobj . "_detail SET post_city=%s, post_region=%s, post_country=%s, post_locations=%s WHERE post_location_id=%d AND ( post_city!=%s OR post_region!=%s OR post_country!=%s OR post_locations!=%s OR post_locations IS NULL)",
189
+					array($_REQUEST['city'], $_REQUEST['region'], $_REQUEST['country'], $post_locations, $locationid, $_REQUEST['city'], $_REQUEST['region'], $_REQUEST['country'], $post_locations)
190
+				);
191
+				$wpdb->query($sql);
192
+			}
193
+		}
194
+	}
195 195
 }
196 196
 
197 197
 /**
@@ -215,37 +215,37 @@  discard block
 block discarded – undo
215 215
  */
216 216
 function geodir_add_new_location($location_info = array())
217 217
 {
218
-    global $wpdb;
219
-
220
-    if (!empty($location_info)) {
221
-        $location_city = ($location_info['city'] != '') ? $location_info['city'] : 'all';
222
-        $location_region = ($location_info['region'] != '') ? $location_info['region'] : 'all';
223
-        $location_country = ($location_info['country'] != '') ? geodir_get_normal_country($location_info['country']) : 'all';
224
-        $location_lat = ($location_info['geo_lat'] != '') ? $location_info['geo_lat'] : '';
225
-        $location_lng = ($location_info['geo_lng'] != '') ? $location_info['geo_lng'] : '';
226
-        $is_default = isset($location_info['is_default']) ? $location_info['is_default'] : '';
227
-        $country_slug = create_location_slug(__($location_country, 'geodirectory'));
228
-        $region_slug = create_location_slug($location_region);
229
-        $city_slug = create_location_slug($location_city);
218
+	global $wpdb;
219
+
220
+	if (!empty($location_info)) {
221
+		$location_city = ($location_info['city'] != '') ? $location_info['city'] : 'all';
222
+		$location_region = ($location_info['region'] != '') ? $location_info['region'] : 'all';
223
+		$location_country = ($location_info['country'] != '') ? geodir_get_normal_country($location_info['country']) : 'all';
224
+		$location_lat = ($location_info['geo_lat'] != '') ? $location_info['geo_lat'] : '';
225
+		$location_lng = ($location_info['geo_lng'] != '') ? $location_info['geo_lng'] : '';
226
+		$is_default = isset($location_info['is_default']) ? $location_info['is_default'] : '';
227
+		$country_slug = create_location_slug(__($location_country, 'geodirectory'));
228
+		$region_slug = create_location_slug($location_region);
229
+		$city_slug = create_location_slug($location_city);
230 230
         
231
-        /**
232
-         * Filter add new location data.
233
-         *
234
-         * @since 1.0.0
235
-         */
236
-        $geodir_location = (object)apply_filters('geodir_add_new_location', array('location_id' => 0,
237
-            'country' => $location_country,
238
-            'region' => $location_region,
239
-            'city' => $location_city,
240
-            'country_slug' => $country_slug,
241
-            'region_slug' => $region_slug,
242
-            'city_slug' => $city_slug,
243
-            'city_latitude' => $location_lat,
244
-            'city_longitude' => $location_lng,
245
-            'is_default' => $is_default
246
-        ));
247
-
248
-        /* // Not allowed to create country in DB : 2016-12-09
231
+		/**
232
+		 * Filter add new location data.
233
+		 *
234
+		 * @since 1.0.0
235
+		 */
236
+		$geodir_location = (object)apply_filters('geodir_add_new_location', array('location_id' => 0,
237
+			'country' => $location_country,
238
+			'region' => $location_region,
239
+			'city' => $location_city,
240
+			'country_slug' => $country_slug,
241
+			'region_slug' => $region_slug,
242
+			'city_slug' => $city_slug,
243
+			'city_latitude' => $location_lat,
244
+			'city_longitude' => $location_lng,
245
+			'is_default' => $is_default
246
+		));
247
+
248
+		/* // Not allowed to create country in DB : 2016-12-09
249 249
         if ($geodir_location->country) {
250 250
 
251 251
             $get_country = $wpdb->get_var($wpdb->prepare("SELECT Country FROM " . GEODIR_COUNTRIES_TABLE . " WHERE Country=%s", array($geodir_location->country)));
@@ -259,14 +259,14 @@  discard block
 block discarded – undo
259 259
         }
260 260
         */
261 261
 
262
-        if ($geodir_location->is_default)
263
-            update_option('geodir_default_location', $geodir_location);
262
+		if ($geodir_location->is_default)
263
+			update_option('geodir_default_location', $geodir_location);
264 264
 
265
-        return $geodir_location->location_id;
265
+		return $geodir_location->location_id;
266 266
 
267
-    } else {
268
-        return false;
269
-    }
267
+	} else {
268
+		return false;
269
+	}
270 270
 }
271 271
 
272 272
 /**
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
  */
281 281
 function geodir_random_float($min = 0, $max = 1)
282 282
 {
283
-    return $min + mt_rand() / mt_getrandmax() * ($max - $min);
283
+	return $min + mt_rand() / mt_getrandmax() * ($max - $min);
284 284
 }
285 285
 
286 286
 /**
@@ -294,22 +294,22 @@  discard block
 block discarded – undo
294 294
  */
295 295
 function geodir_get_address_by_lat_lan($lat, $lng)
296 296
 {
297
-    $url = 'https://maps.googleapis.com/maps/api/geocode/json?latlng=' . trim($lat) . ',' . trim($lng) ;
298
-
299
-    $ch = curl_init();
300
-    curl_setopt($ch, CURLOPT_URL, $url);
301
-    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
302
-    curl_setopt($ch, CURLOPT_PROXYPORT, 3128);
303
-    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
304
-    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
305
-    $response = curl_exec($ch);
306
-    curl_close($ch);
307
-    $data = json_decode($response);
308
-    $status = $data->status;
309
-    if ($status == "OK") {
310
-        return $data->results[0]->address_components;
311
-    } else
312
-        return false;
297
+	$url = 'https://maps.googleapis.com/maps/api/geocode/json?latlng=' . trim($lat) . ',' . trim($lng) ;
298
+
299
+	$ch = curl_init();
300
+	curl_setopt($ch, CURLOPT_URL, $url);
301
+	curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
302
+	curl_setopt($ch, CURLOPT_PROXYPORT, 3128);
303
+	curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
304
+	curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
305
+	$response = curl_exec($ch);
306
+	curl_close($ch);
307
+	$data = json_decode($response);
308
+	$status = $data->status;
309
+	if ($status == "OK") {
310
+		return $data->results[0]->address_components;
311
+	} else
312
+		return false;
313 313
 }
314 314
 
315 315
 /**
@@ -326,70 +326,70 @@  discard block
 block discarded – undo
326 326
  */
327 327
 function geodir_get_current_location_terms($location_array_from = 'session', $gd_post_type = '')
328 328
 {
329
-    global $wp, $gd_session;
330
-    $location_array = array();
331
-    if ($location_array_from == 'session') {
332
-        if ($gd_session->get('gd_country') == 'me' || $gd_session->get('gd_region') == 'me' || $gd_session->get('gd_city') == 'me') {
333
-            return $location_array;
334
-        }
329
+	global $wp, $gd_session;
330
+	$location_array = array();
331
+	if ($location_array_from == 'session') {
332
+		if ($gd_session->get('gd_country') == 'me' || $gd_session->get('gd_region') == 'me' || $gd_session->get('gd_city') == 'me') {
333
+			return $location_array;
334
+		}
335 335
 
336
-        $country = $gd_session->get('gd_country');
337
-        if ($country != '' && $country)
338
-            $location_array['gd_country'] = urldecode($country);
336
+		$country = $gd_session->get('gd_country');
337
+		if ($country != '' && $country)
338
+			$location_array['gd_country'] = urldecode($country);
339 339
 
340
-        $region = $gd_session->get('gd_region');
341
-        if ($region != '' && $region)
342
-            $location_array['gd_region'] = urldecode($region);
340
+		$region = $gd_session->get('gd_region');
341
+		if ($region != '' && $region)
342
+			$location_array['gd_region'] = urldecode($region);
343 343
 
344
-        $city = $gd_session->get('gd_city');
345
-        if ($city != '' && $city)
346
-            $location_array['gd_city'] = urldecode($city);
347
-    } else {
348
-        if ((isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] == 'me') || (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] == 'me') || (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] == 'me')) {
349
-            return $location_array;
350
-        }
344
+		$city = $gd_session->get('gd_city');
345
+		if ($city != '' && $city)
346
+			$location_array['gd_city'] = urldecode($city);
347
+	} else {
348
+		if ((isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] == 'me') || (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] == 'me') || (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] == 'me')) {
349
+			return $location_array;
350
+		}
351 351
 
352
-        $country = (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '') ? $wp->query_vars['gd_country'] : '';
352
+		$country = (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '') ? $wp->query_vars['gd_country'] : '';
353 353
 
354
-        $region = (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] != '') ? $wp->query_vars['gd_region'] : '';
354
+		$region = (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] != '') ? $wp->query_vars['gd_region'] : '';
355 355
 
356
-        $city = (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] != '') ? $wp->query_vars['gd_city'] : '';
356
+		$city = (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] != '') ? $wp->query_vars['gd_city'] : '';
357 357
 
358
-        if ($country != '')
359
-            $location_array['gd_country'] = urldecode($country);
358
+		if ($country != '')
359
+			$location_array['gd_country'] = urldecode($country);
360 360
 
361
-        if ($region != '')
362
-            $location_array['gd_region'] = urldecode($region);
361
+		if ($region != '')
362
+			$location_array['gd_region'] = urldecode($region);
363 363
 
364
-        if ($city != '')
365
-            $location_array['gd_city'] = urldecode($city);
364
+		if ($city != '')
365
+			$location_array['gd_city'] = urldecode($city);
366 366
 			
367 367
 		// Fix category link in ajax popular category widget on change post type
368 368
 		if (empty($location_array) && defined('DOING_AJAX') && DOING_AJAX) {
369 369
 			$location_array = geodir_get_current_location_terms('session');
370 370
 		}
371
-    }
371
+	}
372 372
 
373 373
 	/**
374 374
 	 * Filter the location terms.
375 375
 	 *
376 376
 	 * @since 1.4.6
377
-     * @package GeoDirectory
377
+	 * @package GeoDirectory
378
+	 *
379
+	 * @param array $location_array {
380
+	 *    Attributes of the location_array.
381
+	 *
382
+	 *    @type string $gd_country The country slug.
383
+	 *    @type string $gd_region The region slug.
384
+	 *    @type string $gd_city The city slug.
378 385
 	 *
379
-     * @param array $location_array {
380
-     *    Attributes of the location_array.
381
-     *
382
-     *    @type string $gd_country The country slug.
383
-     *    @type string $gd_region The region slug.
384
-     *    @type string $gd_city The city slug.
385
-     *
386
-     * }
386
+	 * }
387 387
 	 * @param string $location_array_from Source type of location terms. Default session.
388 388
 	 * @param string $gd_post_type WP post type.
389 389
 	 */
390 390
 	$location_array = apply_filters( 'geodir_current_location_terms', $location_array, $location_array_from, $gd_post_type );
391 391
 
392
-    return $location_array;
392
+	return $location_array;
393 393
 
394 394
 }
395 395
 
@@ -402,24 +402,24 @@  discard block
 block discarded – undo
402 402
  * @return bool|string
403 403
  */
404 404
 function geodir_get_location_link($which_location = 'current') {
405
-    $location_link = get_permalink(geodir_location_page_id());
406
-
407
-    if ($which_location == 'base') {
408
-        return $location_link;
409
-    } else {
410
-        $location_terms = geodir_get_current_location_terms();
411
-
412
-        if (!empty($location_terms)) {
413
-            if (get_option('permalink_structure') != '') {
414
-                $location_terms = implode("/", $location_terms);
415
-                $location_terms = rtrim($location_terms, '/');
416
-                $location_link .= $location_terms;
417
-            } else {
418
-                $location_link = geodir_getlink($location_link, $location_terms);
419
-            }
420
-        }
421
-    }
422
-    return $location_link;
405
+	$location_link = get_permalink(geodir_location_page_id());
406
+
407
+	if ($which_location == 'base') {
408
+		return $location_link;
409
+	} else {
410
+		$location_terms = geodir_get_current_location_terms();
411
+
412
+		if (!empty($location_terms)) {
413
+			if (get_option('permalink_structure') != '') {
414
+				$location_terms = implode("/", $location_terms);
415
+				$location_terms = rtrim($location_terms, '/');
416
+				$location_link .= $location_terms;
417
+			} else {
418
+				$location_link = geodir_getlink($location_link, $location_terms);
419
+			}
420
+		}
421
+	}
422
+	return $location_link;
423 423
 }
424 424
 
425 425
 /**
@@ -432,34 +432,34 @@  discard block
 block discarded – undo
432 432
  * @return array|bool Returns address on success.
433 433
  */
434 434
 function geodir_get_osm_address_by_lat_lan($lat, $lng) {
435
-    $url = is_ssl() ? 'https:' : 'http:';
436
-    $url .= '//nominatim.openstreetmap.org/reverse?format=json&lat=' . trim($lat) . '&lon=' . trim($lng) . '&zoom=16&addressdetails=1&email=' . get_option('admin_email');
437
-
438
-    $ch = curl_init();
439
-    curl_setopt($ch, CURLOPT_URL, $url);
440
-    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
441
-    curl_setopt($ch, CURLOPT_PROXYPORT, 3128);
442
-    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
443
-    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
444
-    $response = curl_exec($ch);
445
-    curl_close($ch);
446
-    $data = json_decode($response);
435
+	$url = is_ssl() ? 'https:' : 'http:';
436
+	$url .= '//nominatim.openstreetmap.org/reverse?format=json&lat=' . trim($lat) . '&lon=' . trim($lng) . '&zoom=16&addressdetails=1&email=' . get_option('admin_email');
437
+
438
+	$ch = curl_init();
439
+	curl_setopt($ch, CURLOPT_URL, $url);
440
+	curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
441
+	curl_setopt($ch, CURLOPT_PROXYPORT, 3128);
442
+	curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
443
+	curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
444
+	$response = curl_exec($ch);
445
+	curl_close($ch);
446
+	$data = json_decode($response);
447 447
     
448
-    if (!empty($data) && !empty($data->address)) {
449
-        $address_fields = array('public_building', 'house', 'house_number', 'bakery', 'footway', 'street', 'road', 'village', 'attraction', 'pedestrian', 'neighbourhood', 'suburb');
450
-        $formatted_address = (array)$data->address;
448
+	if (!empty($data) && !empty($data->address)) {
449
+		$address_fields = array('public_building', 'house', 'house_number', 'bakery', 'footway', 'street', 'road', 'village', 'attraction', 'pedestrian', 'neighbourhood', 'suburb');
450
+		$formatted_address = (array)$data->address;
451 451
         
452
-        foreach ( $data->address as $key => $value ) {
453
-            if (!in_array($key, $address_fields)) {
454
-                unset($formatted_address[$key]);
455
-            }
456
-        }
457
-        $data->formatted_address = !empty($formatted_address) ? implode(', ', $formatted_address) : '';
452
+		foreach ( $data->address as $key => $value ) {
453
+			if (!in_array($key, $address_fields)) {
454
+				unset($formatted_address[$key]);
455
+			}
456
+		}
457
+		$data->formatted_address = !empty($formatted_address) ? implode(', ', $formatted_address) : '';
458 458
         
459
-        return $data;
460
-    } else {
461
-        return false;
462
-    }
459
+		return $data;
460
+	} else {
461
+		return false;
462
+	}
463 463
 }
464 464
 
465 465
 /**
@@ -471,47 +471,47 @@  discard block
 block discarded – undo
471 471
  * @return string Returns the country.
472 472
  */
473 473
 function geodir_get_normal_country($country) {
474
-    global $wpdb;
475
-    if ($result = geodir_get_country_by_name($country)) {
476
-        return $result;
477
-    }
474
+	global $wpdb;
475
+	if ($result = geodir_get_country_by_name($country)) {
476
+		return $result;
477
+	}
478 478
     
479
-    if (defined('POST_LOCATION_TABLE')) {
480
-        $rows = $wpdb->get_results($wpdb->prepare("SELECT DISTINCT country FROM " . POST_LOCATION_TABLE . " WHERE country NOT LIKE %s ORDER BY location_id ASC", $country));
481
-        if (!empty($rows)) {
482
-            foreach ($rows as $row) {
483
-                $translated = __($row->country, 'geodirectory');
484
-                if (geodir_strtolower($translated) == geodir_strtolower($country) && $result = geodir_get_country_by_name($row->country)) {
485
-                    return $result;
486
-                }
487
-            }
488
-        }
479
+	if (defined('POST_LOCATION_TABLE')) {
480
+		$rows = $wpdb->get_results($wpdb->prepare("SELECT DISTINCT country FROM " . POST_LOCATION_TABLE . " WHERE country NOT LIKE %s ORDER BY location_id ASC", $country));
481
+		if (!empty($rows)) {
482
+			foreach ($rows as $row) {
483
+				$translated = __($row->country, 'geodirectory');
484
+				if (geodir_strtolower($translated) == geodir_strtolower($country) && $result = geodir_get_country_by_name($row->country)) {
485
+					return $result;
486
+				}
487
+			}
488
+		}
489 489
         
490
-        $rows = $wpdb->get_results( $wpdb->prepare( "SELECT DISTINCT country FROM " . POST_LOCATION_TABLE . " WHERE country_slug LIKE %s AND country NOT LIKE %s ORDER BY location_id", $country, $country ) );
491
-        if (!empty($rows)) {
492
-            foreach ($rows as $row) {
493
-                $translated = __($row->country, 'geodirectory');
494
-                if (geodir_strtolower($translated) == geodir_strtolower($country) && $result = geodir_get_country_by_name($row->country)) {
495
-                    return $result;
496
-                }
497
-            }
498
-        }
499
-    }
490
+		$rows = $wpdb->get_results( $wpdb->prepare( "SELECT DISTINCT country FROM " . POST_LOCATION_TABLE . " WHERE country_slug LIKE %s AND country NOT LIKE %s ORDER BY location_id", $country, $country ) );
491
+		if (!empty($rows)) {
492
+			foreach ($rows as $row) {
493
+				$translated = __($row->country, 'geodirectory');
494
+				if (geodir_strtolower($translated) == geodir_strtolower($country) && $result = geodir_get_country_by_name($row->country)) {
495
+					return $result;
496
+				}
497
+			}
498
+		}
499
+	}
500 500
     
501
-    $default_location = geodir_get_default_location();
502
-    if (!empty($default_location->country) && $result = geodir_get_country_by_name($default_location->country)) {
503
-        return $result;
504
-    }
501
+	$default_location = geodir_get_default_location();
502
+	if (!empty($default_location->country) && $result = geodir_get_country_by_name($default_location->country)) {
503
+		return $result;
504
+	}
505 505
     
506
-    if (!empty($default_location->country_slug) && $result = geodir_get_country_by_name($default_location->country_slug)) {
507
-        return $result;
508
-    }
506
+	if (!empty($default_location->country_slug) && $result = geodir_get_country_by_name($default_location->country_slug)) {
507
+		return $result;
508
+	}
509 509
     
510
-    if (!empty($default_location->country_ISO2) && $result = geodir_get_country_by_name($default_location->country_ISO2, true)) {
511
-        return $result;
512
-    }
510
+	if (!empty($default_location->country_ISO2) && $result = geodir_get_country_by_name($default_location->country_ISO2, true)) {
511
+		return $result;
512
+	}
513 513
     
514
-    return $country;
514
+	return $country;
515 515
 }
516 516
 
517 517
 /**
@@ -523,16 +523,16 @@  discard block
 block discarded – undo
523 523
  * @return string Country ISO2 code.
524 524
  */
525 525
 function geodir_get_country_iso2($country) {
526
-    global $wpdb;
526
+	global $wpdb;
527 527
     
528
-    if ($result = $wpdb->get_var($wpdb->prepare("SELECT ISO2 FROM " . GEODIR_COUNTRIES_TABLE . " WHERE Country LIKE %s", $country))) {
529
-        return $result;
530
-    }
531
-    if ($result = $wpdb->get_var($wpdb->prepare("SELECT ISO2 FROM " . GEODIR_COUNTRIES_TABLE . " WHERE Country LIKE %s", geodir_get_normal_country($country)))) {
532
-        return $result;
533
-    }
528
+	if ($result = $wpdb->get_var($wpdb->prepare("SELECT ISO2 FROM " . GEODIR_COUNTRIES_TABLE . " WHERE Country LIKE %s", $country))) {
529
+		return $result;
530
+	}
531
+	if ($result = $wpdb->get_var($wpdb->prepare("SELECT ISO2 FROM " . GEODIR_COUNTRIES_TABLE . " WHERE Country LIKE %s", geodir_get_normal_country($country)))) {
532
+		return $result;
533
+	}
534 534
     
535
-    return $country;
535
+	return $country;
536 536
 }
537 537
 
538 538
 /**
@@ -545,16 +545,16 @@  discard block
 block discarded – undo
545 545
  * @return string|null Country ISO2 code.
546 546
  */
547 547
 function geodir_get_country_by_name($country, $iso2 = false) {
548
-    global $wpdb;
548
+	global $wpdb;
549 549
     
550
-    if ($result = $wpdb->get_var($wpdb->prepare("SELECT Country FROM " . GEODIR_COUNTRIES_TABLE . " WHERE Country LIKE %s", $country))) {
551
-        return $result;
552
-    }
553
-    if ($iso2 && $result = $wpdb->get_var($wpdb->prepare("SELECT Country FROM " . GEODIR_COUNTRIES_TABLE . " WHERE ISO2 LIKE %s", $country))) {
554
-        return $result;
555
-    }
550
+	if ($result = $wpdb->get_var($wpdb->prepare("SELECT Country FROM " . GEODIR_COUNTRIES_TABLE . " WHERE Country LIKE %s", $country))) {
551
+		return $result;
552
+	}
553
+	if ($iso2 && $result = $wpdb->get_var($wpdb->prepare("SELECT Country FROM " . GEODIR_COUNTRIES_TABLE . " WHERE ISO2 LIKE %s", $country))) {
554
+		return $result;
555
+	}
556 556
     
557
-    return NULL;
557
+	return NULL;
558 558
 }
559 559
 
560 560
 
@@ -574,130 +574,130 @@  discard block
 block discarded – undo
574 574
  */
575 575
 function geodir_replace_location_variables($content, $location_array = array(), $sep = NULL, $gd_page = '') {
576 576
 
577
-    if (empty($content)) {
578
-        return $content;
579
-    }
577
+	if (empty($content)) {
578
+		return $content;
579
+	}
580 580
 
581 581
 
582
-    $location_replace_vars = geodir_location_replace_vars($location_array, $sep, $gd_page);
582
+	$location_replace_vars = geodir_location_replace_vars($location_array, $sep, $gd_page);
583 583
 
584
-    if (!empty($location_replace_vars)) {
585
-        foreach ($location_replace_vars as $search => $replace) {
586
-            if (!empty($search) && strpos($content, $search) !== false) {
587
-                $content = str_replace($search, $replace, $content);
588
-            }
589
-        }
590
-    }
584
+	if (!empty($location_replace_vars)) {
585
+		foreach ($location_replace_vars as $search => $replace) {
586
+			if (!empty($search) && strpos($content, $search) !== false) {
587
+				$content = str_replace($search, $replace, $content);
588
+			}
589
+		}
590
+	}
591 591
 
592
-    return $content;
592
+	return $content;
593 593
 }
594 594
 add_filter('geodir_replace_location_variables', 'geodir_replace_location_variables');
595 595
 
596 596
 
597 597
 function geodir_location_replace_vars($location_array = array(), $sep = NULL, $gd_page = ''){
598 598
 
599
-    global $wp;
599
+	global $wp;
600 600
     
601
-    $location_manager = defined('GEODIRLOCATION_VERSION') ? true : false;
602
-
603
-    if (empty($location_array)) {
604
-        $location_array = geodir_get_current_location_terms('query_vars');
605
-    }
606
-
607
-    $location_terms = array();
608
-    $location_terms['gd_neighbourhood'] = !empty($wp->query_vars['gd_neighbourhood']) ? $wp->query_vars['gd_neighbourhood'] : '';
609
-    $location_terms['gd_city'] = !empty($wp->query_vars['gd_city']) ? $wp->query_vars['gd_city'] : '';
610
-    $location_terms['gd_region'] = !empty($wp->query_vars['gd_region']) ? $wp->query_vars['gd_region'] : '';
611
-    $location_terms['gd_country'] = !empty($wp->query_vars['gd_country']) ? $wp->query_vars['gd_country'] : '';
612
-
613
-    $location_names = array();
614
-    foreach ($location_terms as $type => $location) {
615
-        $location_name = $location;
616
-
617
-        if (!empty($location_name)) {
618
-            if ($location_manager) {
619
-                $location_type = strpos($type, 'gd_') === 0 ? substr($type, 3) : $type;
620
-                $location_name = get_actual_location_name($location_type, $location, true);
621
-            } else {
622
-                $location_name = preg_replace( '/-(\d+)$/', '', $location_name);
623
-                $location_name = preg_replace( '/[_-]/', ' ', $location_name );
624
-                $location_name = __(geodir_ucwords($location_name), 'geodirectory');
625
-            }
626
-        }
601
+	$location_manager = defined('GEODIRLOCATION_VERSION') ? true : false;
602
+
603
+	if (empty($location_array)) {
604
+		$location_array = geodir_get_current_location_terms('query_vars');
605
+	}
606
+
607
+	$location_terms = array();
608
+	$location_terms['gd_neighbourhood'] = !empty($wp->query_vars['gd_neighbourhood']) ? $wp->query_vars['gd_neighbourhood'] : '';
609
+	$location_terms['gd_city'] = !empty($wp->query_vars['gd_city']) ? $wp->query_vars['gd_city'] : '';
610
+	$location_terms['gd_region'] = !empty($wp->query_vars['gd_region']) ? $wp->query_vars['gd_region'] : '';
611
+	$location_terms['gd_country'] = !empty($wp->query_vars['gd_country']) ? $wp->query_vars['gd_country'] : '';
612
+
613
+	$location_names = array();
614
+	foreach ($location_terms as $type => $location) {
615
+		$location_name = $location;
616
+
617
+		if (!empty($location_name)) {
618
+			if ($location_manager) {
619
+				$location_type = strpos($type, 'gd_') === 0 ? substr($type, 3) : $type;
620
+				$location_name = get_actual_location_name($location_type, $location, true);
621
+			} else {
622
+				$location_name = preg_replace( '/-(\d+)$/', '', $location_name);
623
+				$location_name = preg_replace( '/[_-]/', ' ', $location_name );
624
+				$location_name = __(geodir_ucwords($location_name), 'geodirectory');
625
+			}
626
+		}
627 627
 
628
-        $location_names[$type] = $location_name;
629
-    }
630
-
631
-    $location_single = '';
632
-    foreach ($location_terms as $type => $location) {
633
-        if (!empty($location)) {
634
-            if (!empty($location_names[$type])) {
635
-                $location_single = $location_names[$type];
636
-            } else {
637
-                if ($location_manager) {
638
-                    $location_type = strpos($type, 'gd_') === 0 ? substr($type, 3) : $type;
639
-                    $location_single = get_actual_location_name($location_type, $location, true);
640
-                } else {
641
-                    $location_name = preg_replace( '/-(\d+)$/', '', $location);
642
-                    $location_name = preg_replace( '/[_-]/', ' ', $location_name );
643
-                    $location_single = __(geodir_ucwords($location_name), 'geodirectory');
644
-                }
645
-            }
646
-            break;
647
-        }
648
-    }
649
-
650
-    $full_location = array();
651
-    if (!empty($location_array)) {
652
-        $location_array = array_reverse($location_array);
653
-
654
-        foreach ($location_array as $type => $location) {
655
-            if (!empty($location_names[$type])) {
656
-                $location_name = $location_names[$type];
657
-            } else {
658
-                if ($location_manager) {
659
-                    $location_type = strpos($type, 'gd_') === 0 ? substr($type, 3) : $type;
660
-                    $location_name = get_actual_location_name($location_type, $location, true);
661
-                } else {
662
-                    $location_name = preg_replace( '/-(\d+)$/', '', $location);
663
-                    $location_name = preg_replace( '/[_-]/', ' ', $location_name );
664
-                    $location_name = __(geodir_ucwords($location_name), 'geodirectory');
665
-                }
666
-            }
628
+		$location_names[$type] = $location_name;
629
+	}
630
+
631
+	$location_single = '';
632
+	foreach ($location_terms as $type => $location) {
633
+		if (!empty($location)) {
634
+			if (!empty($location_names[$type])) {
635
+				$location_single = $location_names[$type];
636
+			} else {
637
+				if ($location_manager) {
638
+					$location_type = strpos($type, 'gd_') === 0 ? substr($type, 3) : $type;
639
+					$location_single = get_actual_location_name($location_type, $location, true);
640
+				} else {
641
+					$location_name = preg_replace( '/-(\d+)$/', '', $location);
642
+					$location_name = preg_replace( '/[_-]/', ' ', $location_name );
643
+					$location_single = __(geodir_ucwords($location_name), 'geodirectory');
644
+				}
645
+			}
646
+			break;
647
+		}
648
+	}
649
+
650
+	$full_location = array();
651
+	if (!empty($location_array)) {
652
+		$location_array = array_reverse($location_array);
653
+
654
+		foreach ($location_array as $type => $location) {
655
+			if (!empty($location_names[$type])) {
656
+				$location_name = $location_names[$type];
657
+			} else {
658
+				if ($location_manager) {
659
+					$location_type = strpos($type, 'gd_') === 0 ? substr($type, 3) : $type;
660
+					$location_name = get_actual_location_name($location_type, $location, true);
661
+				} else {
662
+					$location_name = preg_replace( '/-(\d+)$/', '', $location);
663
+					$location_name = preg_replace( '/[_-]/', ' ', $location_name );
664
+					$location_name = __(geodir_ucwords($location_name), 'geodirectory');
665
+				}
666
+			}
667
+
668
+			$full_location[] = $location_name;
669
+		}
667 670
 
668
-            $full_location[] = $location_name;
669
-        }
671
+		if (!empty($full_location)) {
672
+			$full_location = array_unique($full_location);
673
+		}
674
+	}
675
+	$full_location = !empty($full_location) ? implode(', ', $full_location): '';
670 676
 
671
-        if (!empty($full_location)) {
672
-            $full_location = array_unique($full_location);
673
-        }
674
-    }
675
-    $full_location = !empty($full_location) ? implode(', ', $full_location): '';
676
-
677
-    $location_replace_vars = array();
678
-    $location_replace_vars['%%location_sep%%'] = $sep !== NULL ? $sep : '|';
679
-    $location_replace_vars['%%location%%'] = $full_location;
680
-    $location_replace_vars['%%in_location%%'] = $full_location != '' ? __( 'in', 'geodirectory' ) . ' ' . $full_location : '';
681
-    $location_replace_vars['%%location_single%%'] = $location_single;
682
-    $location_replace_vars['%%in_location_single%%'] = $location_single != '' ? __( 'in', 'geodirectory' ) . ' ' . $location_single : '';
683
-
684
-    foreach ($location_names as $type => $name) {
685
-        $location_type = strpos($type, 'gd_') === 0 ? substr($type, 3) : $type;
686
-
687
-        $location_replace_vars['%%location_' . $location_type . '%%'] = $name;
688
-        $location_replace_vars['%%in_location_' . $location_type . '%%'] = !empty($name) ? __( 'in', 'geodirectory' ) . ' ' . $name : '';
689
-    }
690
-
691
-    /**
692
-     * Filter the location terms variables to search & replace.
693
-     *
694
-     * @since   1.6.16
695
-     * @package GeoDirectory
696
-     *
697
-     * @param array $location_replace_vars The array of search & replace variables.
698
-     * @param array $location_array The array of location variables.
699
-     * @param string $gd_page       The page being filtered.
700
-     * @param string $sep           The separator.
701
-     */
702
-    return apply_filters( 'geodir_filter_location_replace_variables', $location_replace_vars, $location_array, $gd_page, $sep );
677
+	$location_replace_vars = array();
678
+	$location_replace_vars['%%location_sep%%'] = $sep !== NULL ? $sep : '|';
679
+	$location_replace_vars['%%location%%'] = $full_location;
680
+	$location_replace_vars['%%in_location%%'] = $full_location != '' ? __( 'in', 'geodirectory' ) . ' ' . $full_location : '';
681
+	$location_replace_vars['%%location_single%%'] = $location_single;
682
+	$location_replace_vars['%%in_location_single%%'] = $location_single != '' ? __( 'in', 'geodirectory' ) . ' ' . $location_single : '';
683
+
684
+	foreach ($location_names as $type => $name) {
685
+		$location_type = strpos($type, 'gd_') === 0 ? substr($type, 3) : $type;
686
+
687
+		$location_replace_vars['%%location_' . $location_type . '%%'] = $name;
688
+		$location_replace_vars['%%in_location_' . $location_type . '%%'] = !empty($name) ? __( 'in', 'geodirectory' ) . ' ' . $name : '';
689
+	}
690
+
691
+	/**
692
+	 * Filter the location terms variables to search & replace.
693
+	 *
694
+	 * @since   1.6.16
695
+	 * @package GeoDirectory
696
+	 *
697
+	 * @param array $location_replace_vars The array of search & replace variables.
698
+	 * @param array $location_array The array of location variables.
699
+	 * @param string $gd_page       The page being filtered.
700
+	 * @param string $sep           The separator.
701
+	 */
702
+	return apply_filters( 'geodir_filter_location_replace_variables', $location_replace_vars, $location_array, $gd_page, $sep );
703 703
 }
704 704
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 {
125 125
     global $wpdb;
126 126
 
127
-    $rows = $wpdb->get_results("SELECT Country,ISO2 FROM " . GEODIR_COUNTRIES_TABLE . " ORDER BY Country ASC");
127
+    $rows = $wpdb->get_results("SELECT Country,ISO2 FROM ".GEODIR_COUNTRIES_TABLE." ORDER BY Country ASC");
128 128
     
129 129
     $ISO2 = array();
130 130
     $countries = array();
@@ -136,11 +136,11 @@  discard block
 block discarded – undo
136 136
     
137 137
     asort($countries);
138 138
     
139
-    $out_put = '<option ' . selected('', $post_country, false) . ' value="">' . __('Select Country', 'geodirectory') . '</option>';
139
+    $out_put = '<option '.selected('', $post_country, false).' value="">'.__('Select Country', 'geodirectory').'</option>';
140 140
     foreach ($countries as $country => $name) {
141 141
         $ccode = $ISO2[$country];
142 142
 
143
-        $out_put .= '<option ' . selected($post_country, $country, false) . ' value="' . esc_attr($country) . '" data-country_code="' . $ccode . '">' . $name . '</option>';
143
+        $out_put .= '<option '.selected($post_country, $country, false).' value="'.esc_attr($country).'" data-country_code="'.$ccode.'">'.$name.'</option>';
144 144
     }
145 145
 
146 146
     echo $out_put;
@@ -182,10 +182,10 @@  discard block
 block discarded – undo
182 182
         if (isset($_REQUEST['listing_action']) && $_REQUEST['listing_action'] == 'delete') {
183 183
 
184 184
             foreach ($posttype as $posttypeobj) {
185
-                $post_locations = '[' . $default_location->city_slug . '],[' . $default_location->region_slug . '],[' . $default_location->country_slug . ']'; // set all overall post location
185
+                $post_locations = '['.$default_location->city_slug.'],['.$default_location->region_slug.'],['.$default_location->country_slug.']'; // set all overall post location
186 186
 
187 187
                 $sql = $wpdb->prepare(
188
-                    "UPDATE " . $plugin_prefix . $posttypeobj . "_detail SET post_city=%s, post_region=%s, post_country=%s, post_locations=%s WHERE post_location_id=%d AND ( post_city!=%s OR post_region!=%s OR post_country!=%s OR post_locations!=%s OR post_locations IS NULL)",
188
+                    "UPDATE ".$plugin_prefix.$posttypeobj."_detail SET post_city=%s, post_region=%s, post_country=%s, post_locations=%s WHERE post_location_id=%d AND ( post_city!=%s OR post_region!=%s OR post_country!=%s OR post_locations!=%s OR post_locations IS NULL)",
189 189
                     array($_REQUEST['city'], $_REQUEST['region'], $_REQUEST['country'], $post_locations, $locationid, $_REQUEST['city'], $_REQUEST['region'], $_REQUEST['country'], $post_locations)
190 190
                 );
191 191
                 $wpdb->query($sql);
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
          *
234 234
          * @since 1.0.0
235 235
          */
236
-        $geodir_location = (object)apply_filters('geodir_add_new_location', array('location_id' => 0,
236
+        $geodir_location = (object) apply_filters('geodir_add_new_location', array('location_id' => 0,
237 237
             'country' => $location_country,
238 238
             'region' => $location_region,
239 239
             'city' => $location_city,
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
  */
295 295
 function geodir_get_address_by_lat_lan($lat, $lng)
296 296
 {
297
-    $url = 'https://maps.googleapis.com/maps/api/geocode/json?latlng=' . trim($lat) . ',' . trim($lng) ;
297
+    $url = 'https://maps.googleapis.com/maps/api/geocode/json?latlng='.trim($lat).','.trim($lng);
298 298
 
299 299
     $ch = curl_init();
300 300
     curl_setopt($ch, CURLOPT_URL, $url);
@@ -387,7 +387,7 @@  discard block
 block discarded – undo
387 387
 	 * @param string $location_array_from Source type of location terms. Default session.
388 388
 	 * @param string $gd_post_type WP post type.
389 389
 	 */
390
-	$location_array = apply_filters( 'geodir_current_location_terms', $location_array, $location_array_from, $gd_post_type );
390
+	$location_array = apply_filters('geodir_current_location_terms', $location_array, $location_array_from, $gd_post_type);
391 391
 
392 392
     return $location_array;
393 393
 
@@ -433,7 +433,7 @@  discard block
 block discarded – undo
433 433
  */
434 434
 function geodir_get_osm_address_by_lat_lan($lat, $lng) {
435 435
     $url = is_ssl() ? 'https:' : 'http:';
436
-    $url .= '//nominatim.openstreetmap.org/reverse?format=json&lat=' . trim($lat) . '&lon=' . trim($lng) . '&zoom=16&addressdetails=1&email=' . get_option('admin_email');
436
+    $url .= '//nominatim.openstreetmap.org/reverse?format=json&lat='.trim($lat).'&lon='.trim($lng).'&zoom=16&addressdetails=1&email='.get_option('admin_email');
437 437
 
438 438
     $ch = curl_init();
439 439
     curl_setopt($ch, CURLOPT_URL, $url);
@@ -447,9 +447,9 @@  discard block
 block discarded – undo
447 447
     
448 448
     if (!empty($data) && !empty($data->address)) {
449 449
         $address_fields = array('public_building', 'house', 'house_number', 'bakery', 'footway', 'street', 'road', 'village', 'attraction', 'pedestrian', 'neighbourhood', 'suburb');
450
-        $formatted_address = (array)$data->address;
450
+        $formatted_address = (array) $data->address;
451 451
         
452
-        foreach ( $data->address as $key => $value ) {
452
+        foreach ($data->address as $key => $value) {
453 453
             if (!in_array($key, $address_fields)) {
454 454
                 unset($formatted_address[$key]);
455 455
             }
@@ -477,7 +477,7 @@  discard block
 block discarded – undo
477 477
     }
478 478
     
479 479
     if (defined('POST_LOCATION_TABLE')) {
480
-        $rows = $wpdb->get_results($wpdb->prepare("SELECT DISTINCT country FROM " . POST_LOCATION_TABLE . " WHERE country NOT LIKE %s ORDER BY location_id ASC", $country));
480
+        $rows = $wpdb->get_results($wpdb->prepare("SELECT DISTINCT country FROM ".POST_LOCATION_TABLE." WHERE country NOT LIKE %s ORDER BY location_id ASC", $country));
481 481
         if (!empty($rows)) {
482 482
             foreach ($rows as $row) {
483 483
                 $translated = __($row->country, 'geodirectory');
@@ -487,7 +487,7 @@  discard block
 block discarded – undo
487 487
             }
488 488
         }
489 489
         
490
-        $rows = $wpdb->get_results( $wpdb->prepare( "SELECT DISTINCT country FROM " . POST_LOCATION_TABLE . " WHERE country_slug LIKE %s AND country NOT LIKE %s ORDER BY location_id", $country, $country ) );
490
+        $rows = $wpdb->get_results($wpdb->prepare("SELECT DISTINCT country FROM ".POST_LOCATION_TABLE." WHERE country_slug LIKE %s AND country NOT LIKE %s ORDER BY location_id", $country, $country));
491 491
         if (!empty($rows)) {
492 492
             foreach ($rows as $row) {
493 493
                 $translated = __($row->country, 'geodirectory');
@@ -525,10 +525,10 @@  discard block
 block discarded – undo
525 525
 function geodir_get_country_iso2($country) {
526 526
     global $wpdb;
527 527
     
528
-    if ($result = $wpdb->get_var($wpdb->prepare("SELECT ISO2 FROM " . GEODIR_COUNTRIES_TABLE . " WHERE Country LIKE %s", $country))) {
528
+    if ($result = $wpdb->get_var($wpdb->prepare("SELECT ISO2 FROM ".GEODIR_COUNTRIES_TABLE." WHERE Country LIKE %s", $country))) {
529 529
         return $result;
530 530
     }
531
-    if ($result = $wpdb->get_var($wpdb->prepare("SELECT ISO2 FROM " . GEODIR_COUNTRIES_TABLE . " WHERE Country LIKE %s", geodir_get_normal_country($country)))) {
531
+    if ($result = $wpdb->get_var($wpdb->prepare("SELECT ISO2 FROM ".GEODIR_COUNTRIES_TABLE." WHERE Country LIKE %s", geodir_get_normal_country($country)))) {
532 532
         return $result;
533 533
     }
534 534
     
@@ -547,10 +547,10 @@  discard block
 block discarded – undo
547 547
 function geodir_get_country_by_name($country, $iso2 = false) {
548 548
     global $wpdb;
549 549
     
550
-    if ($result = $wpdb->get_var($wpdb->prepare("SELECT Country FROM " . GEODIR_COUNTRIES_TABLE . " WHERE Country LIKE %s", $country))) {
550
+    if ($result = $wpdb->get_var($wpdb->prepare("SELECT Country FROM ".GEODIR_COUNTRIES_TABLE." WHERE Country LIKE %s", $country))) {
551 551
         return $result;
552 552
     }
553
-    if ($iso2 && $result = $wpdb->get_var($wpdb->prepare("SELECT Country FROM " . GEODIR_COUNTRIES_TABLE . " WHERE ISO2 LIKE %s", $country))) {
553
+    if ($iso2 && $result = $wpdb->get_var($wpdb->prepare("SELECT Country FROM ".GEODIR_COUNTRIES_TABLE." WHERE ISO2 LIKE %s", $country))) {
554 554
         return $result;
555 555
     }
556 556
     
@@ -594,7 +594,7 @@  discard block
 block discarded – undo
594 594
 add_filter('geodir_replace_location_variables', 'geodir_replace_location_variables');
595 595
 
596 596
 
597
-function geodir_location_replace_vars($location_array = array(), $sep = NULL, $gd_page = ''){
597
+function geodir_location_replace_vars($location_array = array(), $sep = NULL, $gd_page = '') {
598 598
 
599 599
     global $wp;
600 600
     
@@ -619,8 +619,8 @@  discard block
 block discarded – undo
619 619
                 $location_type = strpos($type, 'gd_') === 0 ? substr($type, 3) : $type;
620 620
                 $location_name = get_actual_location_name($location_type, $location, true);
621 621
             } else {
622
-                $location_name = preg_replace( '/-(\d+)$/', '', $location_name);
623
-                $location_name = preg_replace( '/[_-]/', ' ', $location_name );
622
+                $location_name = preg_replace('/-(\d+)$/', '', $location_name);
623
+                $location_name = preg_replace('/[_-]/', ' ', $location_name);
624 624
                 $location_name = __(geodir_ucwords($location_name), 'geodirectory');
625 625
             }
626 626
         }
@@ -638,8 +638,8 @@  discard block
 block discarded – undo
638 638
                     $location_type = strpos($type, 'gd_') === 0 ? substr($type, 3) : $type;
639 639
                     $location_single = get_actual_location_name($location_type, $location, true);
640 640
                 } else {
641
-                    $location_name = preg_replace( '/-(\d+)$/', '', $location);
642
-                    $location_name = preg_replace( '/[_-]/', ' ', $location_name );
641
+                    $location_name = preg_replace('/-(\d+)$/', '', $location);
642
+                    $location_name = preg_replace('/[_-]/', ' ', $location_name);
643 643
                     $location_single = __(geodir_ucwords($location_name), 'geodirectory');
644 644
                 }
645 645
             }
@@ -659,8 +659,8 @@  discard block
 block discarded – undo
659 659
                     $location_type = strpos($type, 'gd_') === 0 ? substr($type, 3) : $type;
660 660
                     $location_name = get_actual_location_name($location_type, $location, true);
661 661
                 } else {
662
-                    $location_name = preg_replace( '/-(\d+)$/', '', $location);
663
-                    $location_name = preg_replace( '/[_-]/', ' ', $location_name );
662
+                    $location_name = preg_replace('/-(\d+)$/', '', $location);
663
+                    $location_name = preg_replace('/[_-]/', ' ', $location_name);
664 664
                     $location_name = __(geodir_ucwords($location_name), 'geodirectory');
665 665
                 }
666 666
             }
@@ -672,20 +672,20 @@  discard block
 block discarded – undo
672 672
             $full_location = array_unique($full_location);
673 673
         }
674 674
     }
675
-    $full_location = !empty($full_location) ? implode(', ', $full_location): '';
675
+    $full_location = !empty($full_location) ? implode(', ', $full_location) : '';
676 676
 
677 677
     $location_replace_vars = array();
678 678
     $location_replace_vars['%%location_sep%%'] = $sep !== NULL ? $sep : '|';
679 679
     $location_replace_vars['%%location%%'] = $full_location;
680
-    $location_replace_vars['%%in_location%%'] = $full_location != '' ? __( 'in', 'geodirectory' ) . ' ' . $full_location : '';
680
+    $location_replace_vars['%%in_location%%'] = $full_location != '' ? __('in', 'geodirectory').' '.$full_location : '';
681 681
     $location_replace_vars['%%location_single%%'] = $location_single;
682
-    $location_replace_vars['%%in_location_single%%'] = $location_single != '' ? __( 'in', 'geodirectory' ) . ' ' . $location_single : '';
682
+    $location_replace_vars['%%in_location_single%%'] = $location_single != '' ? __('in', 'geodirectory').' '.$location_single : '';
683 683
 
684 684
     foreach ($location_names as $type => $name) {
685 685
         $location_type = strpos($type, 'gd_') === 0 ? substr($type, 3) : $type;
686 686
 
687
-        $location_replace_vars['%%location_' . $location_type . '%%'] = $name;
688
-        $location_replace_vars['%%in_location_' . $location_type . '%%'] = !empty($name) ? __( 'in', 'geodirectory' ) . ' ' . $name : '';
687
+        $location_replace_vars['%%location_'.$location_type.'%%'] = $name;
688
+        $location_replace_vars['%%in_location_'.$location_type.'%%'] = !empty($name) ? __('in', 'geodirectory').' '.$name : '';
689 689
     }
690 690
 
691 691
     /**
@@ -699,5 +699,5 @@  discard block
 block discarded – undo
699 699
      * @param string $gd_page       The page being filtered.
700 700
      * @param string $sep           The separator.
701 701
      */
702
-    return apply_filters( 'geodir_filter_location_replace_variables', $location_replace_vars, $location_array, $gd_page, $sep );
702
+    return apply_filters('geodir_filter_location_replace_variables', $location_replace_vars, $location_array, $gd_page, $sep);
703 703
 }
704 704
\ No newline at end of file
Please login to merge, or discard this patch.