Test Failed
Pull Request — master (#360)
by
unknown
17:17
created
geodirectory-admin/google-api-php-client/src/Google/IO/Stream.php 2 patches
Indentation   +140 added lines, -140 removed lines patch added patch discarded remove patch
@@ -34,24 +34,24 @@  discard block
 block discarded – undo
34 34
   private $trappedErrorString;
35 35
 
36 36
   private static $DEFAULT_HTTP_CONTEXT = array(
37
-    "follow_location" => 0,
38
-    "ignore_errors" => 1,
37
+	"follow_location" => 0,
38
+	"ignore_errors" => 1,
39 39
   );
40 40
 
41 41
   private static $DEFAULT_SSL_CONTEXT = array(
42
-    "verify_peer" => true,
42
+	"verify_peer" => true,
43 43
   );
44 44
 
45 45
   public function __construct(Google_Client $client)
46 46
   {
47
-    if (!ini_get('allow_url_fopen')) {
48
-      $error = 'The stream IO handler requires the allow_url_fopen runtime ' .
49
-               'configuration to be enabled';
50
-      $client->getLogger()->critical($error);
51
-      throw new Google_IO_Exception($error);
52
-    }
53
-
54
-    parent::__construct($client);
47
+	if (!ini_get('allow_url_fopen')) {
48
+	  $error = 'The stream IO handler requires the allow_url_fopen runtime ' .
49
+			   'configuration to be enabled';
50
+	  $client->getLogger()->critical($error);
51
+	  throw new Google_IO_Exception($error);
52
+	}
53
+
54
+	parent::__construct($client);
55 55
   }
56 56
 
57 57
   /**
@@ -63,119 +63,119 @@  discard block
 block discarded – undo
63 63
    */
64 64
   public function executeRequest(Google_Http_Request $request)
65 65
   {
66
-    $default_options = stream_context_get_options(stream_context_get_default());
67
-
68
-    $requestHttpContext = array_key_exists('http', $default_options) ?
69
-        $default_options['http'] : array();
70
-
71
-    if ($request->getPostBody()) {
72
-      $requestHttpContext["content"] = $request->getPostBody();
73
-    }
74
-
75
-    $requestHeaders = $request->getRequestHeaders();
76
-    if ($requestHeaders && is_array($requestHeaders)) {
77
-      $headers = "";
78
-      foreach ($requestHeaders as $k => $v) {
79
-        $headers .= "$k: $v\r\n";
80
-      }
81
-      $requestHttpContext["header"] = $headers;
82
-    }
83
-
84
-    $requestHttpContext["method"] = $request->getRequestMethod();
85
-    $requestHttpContext["user_agent"] = $request->getUserAgent();
86
-
87
-    $requestSslContext = array_key_exists('ssl', $default_options) ?
88
-        $default_options['ssl'] : array();
89
-
90
-    if (!array_key_exists("cafile", $requestSslContext)) {
91
-      $requestSslContext["cafile"] = dirname(__FILE__) . '/cacerts.pem';
92
-    }
93
-
94
-    $options = array(
95
-        "http" => array_merge(
96
-            self::$DEFAULT_HTTP_CONTEXT,
97
-            $requestHttpContext
98
-        ),
99
-        "ssl" => array_merge(
100
-            self::$DEFAULT_SSL_CONTEXT,
101
-            $requestSslContext
102
-        )
103
-    );
104
-
105
-    $context = stream_context_create($options);
106
-
107
-    $url = $request->getUrl();
108
-
109
-    if ($request->canGzip()) {
110
-      $url = self::ZLIB . $url;
111
-    }
112
-
113
-    $this->client->getLogger()->debug(
114
-        'Stream request',
115
-        array(
116
-            'url' => $url,
117
-            'method' => $request->getRequestMethod(),
118
-            'headers' => $requestHeaders,
119
-            'body' => $request->getPostBody()
120
-        )
121
-    );
122
-
123
-    // We are trapping any thrown errors in this method only and
124
-    // throwing an exception.
125
-    $this->trappedErrorNumber = null;
126
-    $this->trappedErrorString = null;
127
-
128
-    // START - error trap.
129
-    set_error_handler(array($this, 'trapError'));
130
-    $fh = fopen($url, 'r', false, $context);
131
-    restore_error_handler();
132
-    // END - error trap.
133
-
134
-    if ($this->trappedErrorNumber) {
135
-      $error = sprintf(
136
-          "HTTP Error: Unable to connect: '%s'",
137
-          $this->trappedErrorString
138
-      );
139
-
140
-      $this->client->getLogger()->error('Stream ' . $error);
141
-      throw new Google_IO_Exception($error, $this->trappedErrorNumber);
142
-    }
143
-
144
-    $response_data = false;
145
-    $respHttpCode = self::UNKNOWN_CODE;
146
-    if ($fh) {
147
-      if (isset($this->options[self::TIMEOUT])) {
148
-        stream_set_timeout($fh, $this->options[self::TIMEOUT]);
149
-      }
150
-
151
-      $response_data = stream_get_contents($fh);
152
-      fclose($fh);
153
-
154
-      $respHttpCode = $this->getHttpResponseCode($http_response_header);
155
-    }
156
-
157
-    if (false === $response_data) {
158
-      $error = sprintf(
159
-          "HTTP Error: Unable to connect: '%s'",
160
-          $respHttpCode
161
-      );
162
-
163
-      $this->client->getLogger()->error('Stream ' . $error);
164
-      throw new Google_IO_Exception($error, $respHttpCode);
165
-    }
166
-
167
-    $responseHeaders = $this->getHttpResponseHeaders($http_response_header);
168
-
169
-    $this->client->getLogger()->debug(
170
-        'Stream response',
171
-        array(
172
-            'code' => $respHttpCode,
173
-            'headers' => $responseHeaders,
174
-            'body' => $response_data,
175
-        )
176
-    );
177
-
178
-    return array($response_data, $responseHeaders, $respHttpCode);
66
+	$default_options = stream_context_get_options(stream_context_get_default());
67
+
68
+	$requestHttpContext = array_key_exists('http', $default_options) ?
69
+		$default_options['http'] : array();
70
+
71
+	if ($request->getPostBody()) {
72
+	  $requestHttpContext["content"] = $request->getPostBody();
73
+	}
74
+
75
+	$requestHeaders = $request->getRequestHeaders();
76
+	if ($requestHeaders && is_array($requestHeaders)) {
77
+	  $headers = "";
78
+	  foreach ($requestHeaders as $k => $v) {
79
+		$headers .= "$k: $v\r\n";
80
+	  }
81
+	  $requestHttpContext["header"] = $headers;
82
+	}
83
+
84
+	$requestHttpContext["method"] = $request->getRequestMethod();
85
+	$requestHttpContext["user_agent"] = $request->getUserAgent();
86
+
87
+	$requestSslContext = array_key_exists('ssl', $default_options) ?
88
+		$default_options['ssl'] : array();
89
+
90
+	if (!array_key_exists("cafile", $requestSslContext)) {
91
+	  $requestSslContext["cafile"] = dirname(__FILE__) . '/cacerts.pem';
92
+	}
93
+
94
+	$options = array(
95
+		"http" => array_merge(
96
+			self::$DEFAULT_HTTP_CONTEXT,
97
+			$requestHttpContext
98
+		),
99
+		"ssl" => array_merge(
100
+			self::$DEFAULT_SSL_CONTEXT,
101
+			$requestSslContext
102
+		)
103
+	);
104
+
105
+	$context = stream_context_create($options);
106
+
107
+	$url = $request->getUrl();
108
+
109
+	if ($request->canGzip()) {
110
+	  $url = self::ZLIB . $url;
111
+	}
112
+
113
+	$this->client->getLogger()->debug(
114
+		'Stream request',
115
+		array(
116
+			'url' => $url,
117
+			'method' => $request->getRequestMethod(),
118
+			'headers' => $requestHeaders,
119
+			'body' => $request->getPostBody()
120
+		)
121
+	);
122
+
123
+	// We are trapping any thrown errors in this method only and
124
+	// throwing an exception.
125
+	$this->trappedErrorNumber = null;
126
+	$this->trappedErrorString = null;
127
+
128
+	// START - error trap.
129
+	set_error_handler(array($this, 'trapError'));
130
+	$fh = fopen($url, 'r', false, $context);
131
+	restore_error_handler();
132
+	// END - error trap.
133
+
134
+	if ($this->trappedErrorNumber) {
135
+	  $error = sprintf(
136
+		  "HTTP Error: Unable to connect: '%s'",
137
+		  $this->trappedErrorString
138
+	  );
139
+
140
+	  $this->client->getLogger()->error('Stream ' . $error);
141
+	  throw new Google_IO_Exception($error, $this->trappedErrorNumber);
142
+	}
143
+
144
+	$response_data = false;
145
+	$respHttpCode = self::UNKNOWN_CODE;
146
+	if ($fh) {
147
+	  if (isset($this->options[self::TIMEOUT])) {
148
+		stream_set_timeout($fh, $this->options[self::TIMEOUT]);
149
+	  }
150
+
151
+	  $response_data = stream_get_contents($fh);
152
+	  fclose($fh);
153
+
154
+	  $respHttpCode = $this->getHttpResponseCode($http_response_header);
155
+	}
156
+
157
+	if (false === $response_data) {
158
+	  $error = sprintf(
159
+		  "HTTP Error: Unable to connect: '%s'",
160
+		  $respHttpCode
161
+	  );
162
+
163
+	  $this->client->getLogger()->error('Stream ' . $error);
164
+	  throw new Google_IO_Exception($error, $respHttpCode);
165
+	}
166
+
167
+	$responseHeaders = $this->getHttpResponseHeaders($http_response_header);
168
+
169
+	$this->client->getLogger()->debug(
170
+		'Stream response',
171
+		array(
172
+			'code' => $respHttpCode,
173
+			'headers' => $responseHeaders,
174
+			'body' => $response_data,
175
+		)
176
+	);
177
+
178
+	return array($response_data, $responseHeaders, $respHttpCode);
179 179
   }
180 180
 
181 181
   /**
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
    */
185 185
   public function setOptions($options)
186 186
   {
187
-    $this->options = $options + $this->options;
187
+	$this->options = $options + $this->options;
188 188
   }
189 189
 
190 190
   /**
@@ -193,8 +193,8 @@  discard block
 block discarded – undo
193 193
    */
194 194
   public function trapError($errno, $errstr)
195 195
   {
196
-    $this->trappedErrorNumber = $errno;
197
-    $this->trappedErrorString = $errstr;
196
+	$this->trappedErrorNumber = $errno;
197
+	$this->trappedErrorString = $errstr;
198 198
   }
199 199
 
200 200
   /**
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
    */
204 204
   public function setTimeout($timeout)
205 205
   {
206
-    $this->options[self::TIMEOUT] = $timeout;
206
+	$this->options[self::TIMEOUT] = $timeout;
207 207
   }
208 208
 
209 209
   /**
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
    */
213 213
   public function getTimeout()
214 214
   {
215
-    return $this->options[self::TIMEOUT];
215
+	return $this->options[self::TIMEOUT];
216 216
   }
217 217
 
218 218
   /**
@@ -224,20 +224,20 @@  discard block
 block discarded – undo
224 224
    */
225 225
   protected function needsQuirk()
226 226
   {
227
-    return false;
227
+	return false;
228 228
   }
229 229
 
230 230
   protected function getHttpResponseCode($response_headers)
231 231
   {
232
-    $header_count = count($response_headers);
233
-
234
-    for ($i = 0; $i < $header_count; $i++) {
235
-      $header = $response_headers[$i];
236
-      if (strncasecmp("HTTP", $header, strlen("HTTP")) == 0) {
237
-        $response = explode(' ', $header);
238
-        return $response[1];
239
-      }
240
-    }
241
-    return self::UNKNOWN_CODE;
232
+	$header_count = count($response_headers);
233
+
234
+	for ($i = 0; $i < $header_count; $i++) {
235
+	  $header = $response_headers[$i];
236
+	  if (strncasecmp("HTTP", $header, strlen("HTTP")) == 0) {
237
+		$response = explode(' ', $header);
238
+		return $response[1];
239
+	  }
240
+	}
241
+	return self::UNKNOWN_CODE;
242 242
   }
243 243
 }
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
  */
23 23
 
24 24
 if (!class_exists('Google_Client')) {
25
-  require_once dirname(__FILE__) . '/../autoload.php';
25
+  require_once dirname(__FILE__).'/../autoload.php';
26 26
 }
27 27
 
28 28
 class Google_IO_Stream extends Google_IO_Abstract
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
   public function __construct(Google_Client $client)
46 46
   {
47 47
     if (!ini_get('allow_url_fopen')) {
48
-      $error = 'The stream IO handler requires the allow_url_fopen runtime ' .
48
+      $error = 'The stream IO handler requires the allow_url_fopen runtime '.
49 49
                'configuration to be enabled';
50 50
       $client->getLogger()->critical($error);
51 51
       throw new Google_IO_Exception($error);
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
         $default_options['ssl'] : array();
89 89
 
90 90
     if (!array_key_exists("cafile", $requestSslContext)) {
91
-      $requestSslContext["cafile"] = dirname(__FILE__) . '/cacerts.pem';
91
+      $requestSslContext["cafile"] = dirname(__FILE__).'/cacerts.pem';
92 92
     }
93 93
 
94 94
     $options = array(
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
     $url = $request->getUrl();
108 108
 
109 109
     if ($request->canGzip()) {
110
-      $url = self::ZLIB . $url;
110
+      $url = self::ZLIB.$url;
111 111
     }
112 112
 
113 113
     $this->client->getLogger()->debug(
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
           $this->trappedErrorString
138 138
       );
139 139
 
140
-      $this->client->getLogger()->error('Stream ' . $error);
140
+      $this->client->getLogger()->error('Stream '.$error);
141 141
       throw new Google_IO_Exception($error, $this->trappedErrorNumber);
142 142
     }
143 143
 
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
           $respHttpCode
161 161
       );
162 162
 
163
-      $this->client->getLogger()->error('Stream ' . $error);
163
+      $this->client->getLogger()->error('Stream '.$error);
164 164
       throw new Google_IO_Exception($error, $respHttpCode);
165 165
     }
166 166
 
Please login to merge, or discard this patch.
geodirectory-admin/google-api-php-client/src/Google/IO/Exception.php 2 patches
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -35,20 +35,20 @@  discard block
 block discarded – undo
35 35
    * @param array|null $retryMap Map of errors with retry counts.
36 36
    */
37 37
   public function __construct(
38
-      $message,
39
-      $code = 0,
40
-      Exception $previous = null,
41
-      array $retryMap = null
38
+	  $message,
39
+	  $code = 0,
40
+	  Exception $previous = null,
41
+	  array $retryMap = null
42 42
   ) {
43
-    if (version_compare(PHP_VERSION, '5.3.0') >= 0) {
44
-      parent::__construct($message, $code, $previous);
45
-    } else {
46
-      parent::__construct($message, $code);
47
-    }
43
+	if (version_compare(PHP_VERSION, '5.3.0') >= 0) {
44
+	  parent::__construct($message, $code, $previous);
45
+	} else {
46
+	  parent::__construct($message, $code);
47
+	}
48 48
 
49
-    if (is_array($retryMap)) {
50
-      $this->retryMap = $retryMap;
51
-    }
49
+	if (is_array($retryMap)) {
50
+	  $this->retryMap = $retryMap;
51
+	}
52 52
   }
53 53
 
54 54
   /**
@@ -60,10 +60,10 @@  discard block
 block discarded – undo
60 60
    */
61 61
   public function allowedRetries()
62 62
   {
63
-    if (isset($this->retryMap[$this->code])) {
64
-      return $this->retryMap[$this->code];
65
-    }
63
+	if (isset($this->retryMap[$this->code])) {
64
+	  return $this->retryMap[$this->code];
65
+	}
66 66
 
67
-    return 0;
67
+	return 0;
68 68
   }
69 69
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@
 block discarded – undo
16 16
  */
17 17
 
18 18
 if (!class_exists('Google_Client')) {
19
-  require_once dirname(__FILE__) . '/../autoload.php';
19
+  require_once dirname(__FILE__).'/../autoload.php';
20 20
 }
21 21
 
22 22
 class Google_IO_Exception extends Google_Exception implements Google_Task_Retryable
Please login to merge, or discard this patch.
geodirectory-admin/google-api-php-client/src/Google/IO/Abstract.php 2 patches
Indentation   +165 added lines, -165 removed lines patch added patch discarded remove patch
@@ -28,19 +28,19 @@  discard block
 block discarded – undo
28 28
   const UNKNOWN_CODE = 0;
29 29
   const FORM_URLENCODED = 'application/x-www-form-urlencoded';
30 30
   private static $CONNECTION_ESTABLISHED_HEADERS = array(
31
-    "HTTP/1.0 200 Connection established\r\n\r\n",
32
-    "HTTP/1.1 200 Connection established\r\n\r\n",
31
+	"HTTP/1.0 200 Connection established\r\n\r\n",
32
+	"HTTP/1.1 200 Connection established\r\n\r\n",
33 33
   );
34 34
   private static $ENTITY_HTTP_METHODS = array("POST" => null, "PUT" => null);
35 35
   private static $HOP_BY_HOP = array(
36
-    'connection' => true,
37
-    'keep-alive' => true,
38
-    'proxy-authenticate' => true,
39
-    'proxy-authorization' => true,
40
-    'te' => true,
41
-    'trailers' => true,
42
-    'transfer-encoding' => true,
43
-    'upgrade' => true
36
+	'connection' => true,
37
+	'keep-alive' => true,
38
+	'proxy-authenticate' => true,
39
+	'proxy-authorization' => true,
40
+	'te' => true,
41
+	'trailers' => true,
42
+	'transfer-encoding' => true,
43
+	'upgrade' => true
44 44
   );
45 45
 
46 46
 
@@ -49,11 +49,11 @@  discard block
 block discarded – undo
49 49
 
50 50
   public function __construct(Google_Client $client)
51 51
   {
52
-    $this->client = $client;
53
-    $timeout = $client->getClassConfig('Google_IO_Abstract', 'request_timeout_seconds');
54
-    if ($timeout > 0) {
55
-      $this->setTimeout($timeout);
56
-    }
52
+	$this->client = $client;
53
+	$timeout = $client->getClassConfig('Google_IO_Abstract', 'request_timeout_seconds');
54
+	if ($timeout > 0) {
55
+	  $this->setTimeout($timeout);
56
+	}
57 57
   }
58 58
 
59 59
   /**
@@ -102,13 +102,13 @@  discard block
 block discarded – undo
102 102
    */
103 103
   public function setCachedRequest(Google_Http_Request $request)
104 104
   {
105
-    // Determine if the request is cacheable.
106
-    if (Google_Http_CacheParser::isResponseCacheable($request)) {
107
-      $this->client->getCache()->set($request->getCacheKey(), $request);
108
-      return true;
109
-    }
105
+	// Determine if the request is cacheable.
106
+	if (Google_Http_CacheParser::isResponseCacheable($request)) {
107
+	  $this->client->getCache()->set($request->getCacheKey(), $request);
108
+	  return true;
109
+	}
110 110
 
111
-    return false;
111
+	return false;
112 112
   }
113 113
 
114 114
   /**
@@ -121,37 +121,37 @@  discard block
 block discarded – undo
121 121
    */
122 122
   public function makeRequest(Google_Http_Request $request)
123 123
   {
124
-    // First, check to see if we have a valid cached version.
125
-    $cached = $this->getCachedRequest($request);
126
-    if ($cached !== false && $cached instanceof Google_Http_Request) {
127
-      if (!$this->checkMustRevalidateCachedRequest($cached, $request)) {
128
-        return $cached;
129
-      }
130
-    }
131
-
132
-    if (array_key_exists($request->getRequestMethod(), self::$ENTITY_HTTP_METHODS)) {
133
-      $request = $this->processEntityRequest($request);
134
-    }
135
-
136
-    list($responseData, $responseHeaders, $respHttpCode) = $this->executeRequest($request);
137
-
138
-    if ($respHttpCode == 304 && $cached) {
139
-      // If the server responded NOT_MODIFIED, return the cached request.
140
-      $this->updateCachedRequest($cached, $responseHeaders);
141
-      return $cached;
142
-    }
143
-
144
-    if (!isset($responseHeaders['Date']) && !isset($responseHeaders['date'])) {
145
-      $responseHeaders['date'] = date("r");
146
-    }
147
-
148
-    $request->setResponseHttpCode($respHttpCode);
149
-    $request->setResponseHeaders($responseHeaders);
150
-    $request->setResponseBody($responseData);
151
-    // Store the request in cache (the function checks to see if the request
152
-    // can actually be cached)
153
-    $this->setCachedRequest($request);
154
-    return $request;
124
+	// First, check to see if we have a valid cached version.
125
+	$cached = $this->getCachedRequest($request);
126
+	if ($cached !== false && $cached instanceof Google_Http_Request) {
127
+	  if (!$this->checkMustRevalidateCachedRequest($cached, $request)) {
128
+		return $cached;
129
+	  }
130
+	}
131
+
132
+	if (array_key_exists($request->getRequestMethod(), self::$ENTITY_HTTP_METHODS)) {
133
+	  $request = $this->processEntityRequest($request);
134
+	}
135
+
136
+	list($responseData, $responseHeaders, $respHttpCode) = $this->executeRequest($request);
137
+
138
+	if ($respHttpCode == 304 && $cached) {
139
+	  // If the server responded NOT_MODIFIED, return the cached request.
140
+	  $this->updateCachedRequest($cached, $responseHeaders);
141
+	  return $cached;
142
+	}
143
+
144
+	if (!isset($responseHeaders['Date']) && !isset($responseHeaders['date'])) {
145
+	  $responseHeaders['date'] = date("r");
146
+	}
147
+
148
+	$request->setResponseHttpCode($respHttpCode);
149
+	$request->setResponseHeaders($responseHeaders);
150
+	$request->setResponseBody($responseData);
151
+	// Store the request in cache (the function checks to see if the request
152
+	// can actually be cached)
153
+	$this->setCachedRequest($request);
154
+	return $request;
155 155
   }
156 156
 
157 157
   /**
@@ -162,11 +162,11 @@  discard block
 block discarded – undo
162 162
    */
163 163
   public function getCachedRequest(Google_Http_Request $request)
164 164
   {
165
-    if (false === Google_Http_CacheParser::isRequestCacheable($request)) {
166
-      return false;
167
-    }
165
+	if (false === Google_Http_CacheParser::isRequestCacheable($request)) {
166
+	  return false;
167
+	}
168 168
 
169
-    return $this->client->getCache()->get($request->getCacheKey());
169
+	return $this->client->getCache()->get($request->getCacheKey());
170 170
   }
171 171
 
172 172
   /**
@@ -177,28 +177,28 @@  discard block
 block discarded – undo
177 177
    */
178 178
   public function processEntityRequest(Google_Http_Request $request)
179 179
   {
180
-    $postBody = $request->getPostBody();
181
-    $contentType = $request->getRequestHeader("content-type");
182
-
183
-    // Set the default content-type as application/x-www-form-urlencoded.
184
-    if (false == $contentType) {
185
-      $contentType = self::FORM_URLENCODED;
186
-      $request->setRequestHeaders(array('content-type' => $contentType));
187
-    }
188
-
189
-    // Force the payload to match the content-type asserted in the header.
190
-    if ($contentType == self::FORM_URLENCODED && is_array($postBody)) {
191
-      $postBody = http_build_query($postBody, '', '&');
192
-      $request->setPostBody($postBody);
193
-    }
194
-
195
-    // Make sure the content-length header is set.
196
-    if (!$postBody || is_string($postBody)) {
197
-      $postsLength = strlen($postBody);
198
-      $request->setRequestHeaders(array('content-length' => $postsLength));
199
-    }
200
-
201
-    return $request;
180
+	$postBody = $request->getPostBody();
181
+	$contentType = $request->getRequestHeader("content-type");
182
+
183
+	// Set the default content-type as application/x-www-form-urlencoded.
184
+	if (false == $contentType) {
185
+	  $contentType = self::FORM_URLENCODED;
186
+	  $request->setRequestHeaders(array('content-type' => $contentType));
187
+	}
188
+
189
+	// Force the payload to match the content-type asserted in the header.
190
+	if ($contentType == self::FORM_URLENCODED && is_array($postBody)) {
191
+	  $postBody = http_build_query($postBody, '', '&');
192
+	  $request->setPostBody($postBody);
193
+	}
194
+
195
+	// Make sure the content-length header is set.
196
+	if (!$postBody || is_string($postBody)) {
197
+	  $postsLength = strlen($postBody);
198
+	  $request->setRequestHeaders(array('content-length' => $postsLength));
199
+	}
200
+
201
+	return $request;
202 202
   }
203 203
 
204 204
   /**
@@ -211,21 +211,21 @@  discard block
 block discarded – undo
211 211
    */
212 212
   protected function checkMustRevalidateCachedRequest($cached, $request)
213 213
   {
214
-    if (Google_Http_CacheParser::mustRevalidate($cached)) {
215
-      $addHeaders = array();
216
-      if ($cached->getResponseHeader('etag')) {
217
-        // [13.3.4] If an entity tag has been provided by the origin server,
218
-        // we must use that entity tag in any cache-conditional request.
219
-        $addHeaders['If-None-Match'] = $cached->getResponseHeader('etag');
220
-      } elseif ($cached->getResponseHeader('date')) {
221
-        $addHeaders['If-Modified-Since'] = $cached->getResponseHeader('date');
222
-      }
223
-
224
-      $request->setRequestHeaders($addHeaders);
225
-      return true;
226
-    } else {
227
-      return false;
228
-    }
214
+	if (Google_Http_CacheParser::mustRevalidate($cached)) {
215
+	  $addHeaders = array();
216
+	  if ($cached->getResponseHeader('etag')) {
217
+		// [13.3.4] If an entity tag has been provided by the origin server,
218
+		// we must use that entity tag in any cache-conditional request.
219
+		$addHeaders['If-None-Match'] = $cached->getResponseHeader('etag');
220
+	  } elseif ($cached->getResponseHeader('date')) {
221
+		$addHeaders['If-Modified-Since'] = $cached->getResponseHeader('date');
222
+	  }
223
+
224
+	  $request->setRequestHeaders($addHeaders);
225
+	  return true;
226
+	} else {
227
+	  return false;
228
+	}
229 229
   }
230 230
 
231 231
   /**
@@ -235,19 +235,19 @@  discard block
 block discarded – undo
235 235
    */
236 236
   protected function updateCachedRequest($cached, $responseHeaders)
237 237
   {
238
-    $hopByHop = self::$HOP_BY_HOP;
239
-    if (!empty($responseHeaders['connection'])) {
240
-      $connectionHeaders = array_map(
241
-          'strtolower',
242
-          array_filter(
243
-              array_map('trim', explode(',', $responseHeaders['connection']))
244
-          )
245
-      );
246
-      $hopByHop += array_fill_keys($connectionHeaders, true);
247
-    }
248
-
249
-    $endToEnd = array_diff_key($responseHeaders, $hopByHop);
250
-    $cached->setResponseHeaders($endToEnd);
238
+	$hopByHop = self::$HOP_BY_HOP;
239
+	if (!empty($responseHeaders['connection'])) {
240
+	  $connectionHeaders = array_map(
241
+		  'strtolower',
242
+		  array_filter(
243
+			  array_map('trim', explode(',', $responseHeaders['connection']))
244
+		  )
245
+	  );
246
+	  $hopByHop += array_fill_keys($connectionHeaders, true);
247
+	}
248
+
249
+	$endToEnd = array_diff_key($responseHeaders, $hopByHop);
250
+	$cached->setResponseHeaders($endToEnd);
251 251
   }
252 252
 
253 253
   /**
@@ -259,33 +259,33 @@  discard block
 block discarded – undo
259 259
    */
260 260
   public function parseHttpResponse($respData, $headerSize)
261 261
   {
262
-    // check proxy header
263
-    foreach (self::$CONNECTION_ESTABLISHED_HEADERS as $established_header) {
264
-      if (stripos($respData, $established_header) !== false) {
265
-        // existed, remove it
266
-        $respData = str_ireplace($established_header, '', $respData);
267
-        // Subtract the proxy header size unless the cURL bug prior to 7.30.0
268
-        // is present which prevented the proxy header size from being taken into
269
-        // account.
270
-        if (!$this->needsQuirk()) {
271
-          $headerSize -= strlen($established_header);
272
-        }
273
-        break;
274
-      }
275
-    }
276
-
277
-    if ($headerSize) {
278
-      $responseBody = substr($respData, $headerSize);
279
-      $responseHeaders = substr($respData, 0, $headerSize);
280
-    } else {
281
-      $responseSegments = explode("\r\n\r\n", $respData, 2);
282
-      $responseHeaders = $responseSegments[0];
283
-      $responseBody = isset($responseSegments[1]) ? $responseSegments[1] :
284
-                                                    null;
285
-    }
286
-
287
-    $responseHeaders = $this->getHttpResponseHeaders($responseHeaders);
288
-    return array($responseHeaders, $responseBody);
262
+	// check proxy header
263
+	foreach (self::$CONNECTION_ESTABLISHED_HEADERS as $established_header) {
264
+	  if (stripos($respData, $established_header) !== false) {
265
+		// existed, remove it
266
+		$respData = str_ireplace($established_header, '', $respData);
267
+		// Subtract the proxy header size unless the cURL bug prior to 7.30.0
268
+		// is present which prevented the proxy header size from being taken into
269
+		// account.
270
+		if (!$this->needsQuirk()) {
271
+		  $headerSize -= strlen($established_header);
272
+		}
273
+		break;
274
+	  }
275
+	}
276
+
277
+	if ($headerSize) {
278
+	  $responseBody = substr($respData, $headerSize);
279
+	  $responseHeaders = substr($respData, 0, $headerSize);
280
+	} else {
281
+	  $responseSegments = explode("\r\n\r\n", $respData, 2);
282
+	  $responseHeaders = $responseSegments[0];
283
+	  $responseBody = isset($responseSegments[1]) ? $responseSegments[1] :
284
+													null;
285
+	}
286
+
287
+	$responseHeaders = $this->getHttpResponseHeaders($responseHeaders);
288
+	return array($responseHeaders, $responseBody);
289 289
   }
290 290
 
291 291
   /**
@@ -295,45 +295,45 @@  discard block
 block discarded – undo
295 295
    */
296 296
   public function getHttpResponseHeaders($rawHeaders)
297 297
   {
298
-    if (is_array($rawHeaders)) {
299
-      return $this->parseArrayHeaders($rawHeaders);
300
-    } else {
301
-      return $this->parseStringHeaders($rawHeaders);
302
-    }
298
+	if (is_array($rawHeaders)) {
299
+	  return $this->parseArrayHeaders($rawHeaders);
300
+	} else {
301
+	  return $this->parseStringHeaders($rawHeaders);
302
+	}
303 303
   }
304 304
 
305 305
   private function parseStringHeaders($rawHeaders)
306 306
   {
307
-    $headers = array();
308
-    $responseHeaderLines = explode("\r\n", $rawHeaders);
309
-    foreach ($responseHeaderLines as $headerLine) {
310
-      if ($headerLine && strpos($headerLine, ':') !== false) {
311
-        list($header, $value) = explode(': ', $headerLine, 2);
312
-        $header = strtolower($header);
313
-        if (isset($headers[$header])) {
314
-          $headers[$header] .= "\n" . $value;
315
-        } else {
316
-          $headers[$header] = $value;
317
-        }
318
-      }
319
-    }
320
-    return $headers;
307
+	$headers = array();
308
+	$responseHeaderLines = explode("\r\n", $rawHeaders);
309
+	foreach ($responseHeaderLines as $headerLine) {
310
+	  if ($headerLine && strpos($headerLine, ':') !== false) {
311
+		list($header, $value) = explode(': ', $headerLine, 2);
312
+		$header = strtolower($header);
313
+		if (isset($headers[$header])) {
314
+		  $headers[$header] .= "\n" . $value;
315
+		} else {
316
+		  $headers[$header] = $value;
317
+		}
318
+	  }
319
+	}
320
+	return $headers;
321 321
   }
322 322
 
323 323
   private function parseArrayHeaders($rawHeaders)
324 324
   {
325
-    $header_count = count($rawHeaders);
326
-    $headers = array();
327
-
328
-    for ($i = 0; $i < $header_count; $i++) {
329
-      $header = $rawHeaders[$i];
330
-      // Times will have colons in - so we just want the first match.
331
-      $header_parts = explode(': ', $header, 2);
332
-      if (count($header_parts) == 2) {
333
-        $headers[strtolower($header_parts[0])] = $header_parts[1];
334
-      }
335
-    }
336
-
337
-    return $headers;
325
+	$header_count = count($rawHeaders);
326
+	$headers = array();
327
+
328
+	for ($i = 0; $i < $header_count; $i++) {
329
+	  $header = $rawHeaders[$i];
330
+	  // Times will have colons in - so we just want the first match.
331
+	  $header_parts = explode(': ', $header, 2);
332
+	  if (count($header_parts) == 2) {
333
+		$headers[strtolower($header_parts[0])] = $header_parts[1];
334
+	  }
335
+	}
336
+
337
+	return $headers;
338 338
   }
339 339
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -4 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
  */
21 21
 
22 22
 if (!class_exists('Google_Client')) {
23
-  require_once dirname(__FILE__) . '/../autoload.php';
23
+  require_once dirname(__FILE__).'/../autoload.php';
24 24
 }
25 25
 
26 26
 abstract class Google_IO_Abstract
@@ -280,8 +280,7 @@  discard block
 block discarded – undo
280 280
     } else {
281 281
       $responseSegments = explode("\r\n\r\n", $respData, 2);
282 282
       $responseHeaders = $responseSegments[0];
283
-      $responseBody = isset($responseSegments[1]) ? $responseSegments[1] :
284
-                                                    null;
283
+      $responseBody = isset($responseSegments[1]) ? $responseSegments[1] : null;
285 284
     }
286 285
 
287 286
     $responseHeaders = $this->getHttpResponseHeaders($responseHeaders);
@@ -311,7 +310,7 @@  discard block
 block discarded – undo
311 310
         list($header, $value) = explode(': ', $headerLine, 2);
312 311
         $header = strtolower($header);
313 312
         if (isset($headers[$header])) {
314
-          $headers[$header] .= "\n" . $value;
313
+          $headers[$header] .= "\n".$value;
315 314
         } else {
316 315
           $headers[$header] = $value;
317 316
         }
Please login to merge, or discard this patch.
geodirectory-functions/compatibility/Twenty_Seventeen.php 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -1,12 +1,12 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 
4
-add_filter('post_thumbnail_html','geodir_2017_remove_header',10,5);
5
-function geodir_2017_remove_header($html, $post_ID, $post_thumbnail_id, $size, $attr){
6
-	if($size=='twentyseventeen-featured-image'){
4
+add_filter('post_thumbnail_html', 'geodir_2017_remove_header', 10, 5);
5
+function geodir_2017_remove_header($html, $post_ID, $post_thumbnail_id, $size, $attr) {
6
+	if ($size == 'twentyseventeen-featured-image') {
7 7
 
8
-		if(geodir_is_page('detail') || geodir_is_page('add-listing')){
9
-			$html = '';// nothing up top
8
+		if (geodir_is_page('detail') || geodir_is_page('add-listing')) {
9
+			$html = ''; // nothing up top
10 10
 		}
11 11
 
12 12
 	}
@@ -63,19 +63,19 @@  discard block
 block discarded – undo
63 63
 
64 64
 }
65 65
 
66
-function geodir_twentyseventeen_body_classes($classes){
66
+function geodir_twentyseventeen_body_classes($classes) {
67 67
 
68
-	if(geodir_is_page('add-listing')
68
+	if (geodir_is_page('add-listing')
69 69
 	   || geodir_is_page('preview')
70 70
 	   || geodir_is_page('home')
71 71
 	   || geodir_is_page('location')
72 72
 	   || geodir_is_page('listing')
73 73
 	   || geodir_is_page('search')
74 74
 	   || geodir_is_page('author')
75
-	){
75
+	) {
76 76
 		$classes[] = 'has-sidebar';
77 77
 	}
78 78
 	return $classes;
79 79
 }
80
-add_filter( 'body_class', 'geodir_twentyseventeen_body_classes' );
80
+add_filter('body_class', 'geodir_twentyseventeen_body_classes');
81 81
 
Please login to merge, or discard this patch.
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -46,17 +46,13 @@
 block discarded – undo
46 46
 
47 47
 	if (is_page_geodir_home() || geodir_is_page('location')) {
48 48
 		add_action('geodir_wrapper_open', 'geodir_action_geodir_sidebar_home_top', 8);
49
-	}
50
-	elseif (geodir_is_page('listing')) {
49
+	} elseif (geodir_is_page('listing')) {
51 50
 		add_action('geodir_wrapper_open', 'geodir_action_geodir_sidebar_listings_top', 8);
52
-	}
53
-	elseif (geodir_is_page('detail')) {
51
+	} elseif (geodir_is_page('detail')) {
54 52
 		add_action('geodir_wrapper_open', 'geodir_action_geodir_sidebar_detail_top', 8);
55
-	}
56
-	elseif (geodir_is_page('search')) {
53
+	} elseif (geodir_is_page('search')) {
57 54
 		add_action('geodir_wrapper_open', 'geodir_action_geodir_sidebar_search_top', 8);
58
-	}
59
-	elseif (geodir_is_page('author')) {
55
+	} elseif (geodir_is_page('author')) {
60 56
 		add_action('geodir_wrapper_open', 'geodir_action_geodir_sidebar_author_top', 8);
61 57
 	}
62 58
 
Please login to merge, or discard this patch.
geodirectory-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/compatibility/Kleo.php 3 patches
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -10,13 +10,13 @@
 block discarded – undo
10 10
 
11 11
 // Page titles translatable CPT names
12 12
 function geodir_kelo_title_translation( $args) {
13
-    if(function_exists('geodir_is_geodir_page') && geodir_is_page('preview') ){
14
-        $args['title'] = __(stripslashes_deep(esc_html($_POST['post_title'])),'geodirectory');
15
-    }elseif(function_exists('geodir_is_geodir_page')){
16
-        $args['title'] = __($args['title'],'geodirectory');
17
-    }
13
+	if(function_exists('geodir_is_geodir_page') && geodir_is_page('preview') ){
14
+		$args['title'] = __(stripslashes_deep(esc_html($_POST['post_title'])),'geodirectory');
15
+	}elseif(function_exists('geodir_is_geodir_page')){
16
+		$args['title'] = __($args['title'],'geodirectory');
17
+	}
18 18
 
19
-    return $args;
19
+	return $args;
20 20
 }
21 21
 add_filter( 'kleo_title_args', 'geodir_kelo_title_translation', 10, 1 );
22 22
 
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -9,15 +9,15 @@
 block discarded – undo
9 9
  */
10 10
 
11 11
 // Page titles translatable CPT names
12
-function geodir_kelo_title_translation( $args) {
13
-    if(function_exists('geodir_is_geodir_page') && geodir_is_page('preview') ){
14
-        $args['title'] = __(stripslashes_deep(esc_html($_POST['post_title'])),'geodirectory');
15
-    }elseif(function_exists('geodir_is_geodir_page')){
16
-        $args['title'] = __($args['title'],'geodirectory');
12
+function geodir_kelo_title_translation($args) {
13
+    if (function_exists('geodir_is_geodir_page') && geodir_is_page('preview')) {
14
+        $args['title'] = __(stripslashes_deep(esc_html($_POST['post_title'])), 'geodirectory');
15
+    }elseif (function_exists('geodir_is_geodir_page')) {
16
+        $args['title'] = __($args['title'], 'geodirectory');
17 17
     }
18 18
 
19 19
     return $args;
20 20
 }
21
-add_filter( 'kleo_title_args', 'geodir_kelo_title_translation', 10, 1 );
21
+add_filter('kleo_title_args', 'geodir_kelo_title_translation', 10, 1);
22 22
 
23 23
 
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@
 block discarded – undo
12 12
 function geodir_kelo_title_translation( $args) {
13 13
     if(function_exists('geodir_is_geodir_page') && geodir_is_page('preview') ){
14 14
         $args['title'] = __(stripslashes_deep(esc_html($_POST['post_title'])),'geodirectory');
15
-    }elseif(function_exists('geodir_is_geodir_page')){
15
+    } elseif(function_exists('geodir_is_geodir_page')){
16 16
         $args['title'] = __($args['title'],'geodirectory');
17 17
     }
18 18
 
Please login to merge, or discard this patch.
geodirectory-functions/custom_field_html.php 3 patches
Indentation   +333 added lines, -333 removed lines patch added patch discarded remove patch
@@ -18,9 +18,9 @@  discard block
 block discarded – undo
18 18
 global $post_type;
19 19
 
20 20
 if (!isset($field_info->post_type)) {
21
-    $post_type = sanitize_text_field($_REQUEST['listing_type']);
21
+	$post_type = sanitize_text_field($_REQUEST['listing_type']);
22 22
 } else
23
-    $post_type = $field_info->post_type;
23
+	$post_type = $field_info->post_type;
24 24
 
25 25
 //if(isset($_REQUEST['custom_type']) && $_REQUEST['custom_type']=='predefined'){
26 26
 //    $cf_arr = geodir_custom_fields_predefined($post_type);
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 
49 49
 $field_admin_title = '';
50 50
 if (isset($field_info->admin_title))
51
-    $field_admin_title = $field_info->admin_title;
51
+	$field_admin_title = $field_info->admin_title;
52 52
 
53 53
 $default = isset($field_info->is_admin) ? $field_info->is_admin : '';
54 54
 
@@ -68,17 +68,17 @@  discard block
 block discarded – undo
68 68
 //print_r($field_info);
69 69
 
70 70
 if (isset($cf['icon']) && strpos($cf['icon'], 'fa fa-') !== false) {
71
-    $field_icon = '<i class="'.$cf['icon'].'" aria-hidden="true"></i>';
71
+	$field_icon = '<i class="'.$cf['icon'].'" aria-hidden="true"></i>';
72 72
 }elseif(isset($cf['icon']) && $cf['icon']){
73
-    $field_icon = '<b style="background-image: url("'.$cf['icon'].'")"></b>';
73
+	$field_icon = '<b style="background-image: url("'.$cf['icon'].'")"></b>';
74 74
 }else{
75
-    $field_icon = '<i class="fa fa-cog" aria-hidden="true"></i>';
75
+	$field_icon = '<i class="fa fa-cog" aria-hidden="true"></i>';
76 76
 }
77 77
 
78 78
 if(isset($cf['name']) && $cf['name']){
79
-    $field_type_name = $cf['name'];
79
+	$field_type_name = $cf['name'];
80 80
 }else{
81
-    $field_type_name = $field_type;
81
+	$field_type_name = $field_type;
82 82
 }
83 83
 
84 84
 ?>
@@ -88,8 +88,8 @@  discard block
 block discarded – undo
88 88
          ondblclick="show_hide('field_frm<?php echo $result_str; ?>')">
89 89
         <?php
90 90
 
91
-        $nonce = wp_create_nonce('custom_fields_' . $result_str);
92
-        ?>
91
+		$nonce = wp_create_nonce('custom_fields_' . $result_str);
92
+		?>
93 93
 
94 94
         <?php if ($default): ?>
95 95
             <div title="<?php _e('Default field, should not be removed.', 'geodirectory'); ?>" class="handlediv move gd-default-remove"><i class="fa fa-times" aria-hidden="true"></i></div>
@@ -98,37 +98,37 @@  discard block
 block discarded – undo
98 98
                  onclick="delete_field('<?php echo $result_str; ?>', '<?php echo $nonce; ?>')"
99 99
                  class="handlediv close"><i class="fa fa-times" aria-hidden="true"></i></div>
100 100
         <?php endif;
101
-        if ($field_type == 'fieldset') {
102
-            ?>
101
+		if ($field_type == 'fieldset') {
102
+			?>
103 103
             <i class="fa fa-long-arrow-left " aria-hidden="true"></i>
104 104
             <i class="fa fa-long-arrow-right " aria-hidden="true"></i>
105 105
             <b style="cursor:pointer;"
106 106
                onclick="show_hide('field_frm<?php echo $result_str;?>')"><?php echo geodir_ucwords(__('Fieldset:', 'geodirectory') . ' ' . $field_admin_title);?></b>
107 107
         <?php
108
-        } else {echo $field_icon;
109
-            ?>
108
+		} else {echo $field_icon;
109
+			?>
110 110
             <b style="cursor:pointer;"
111 111
                onclick="show_hide('field_frm<?php echo $result_str;?>')"><?php echo geodir_ucwords(' ' . $field_admin_title . ' (' . $field_type_name . ')');?></b>
112 112
         <?php
113
-        }
114
-        ?>
113
+		}
114
+		?>
115 115
     </div>
116 116
 
117 117
     <form><!-- we need to wrap in a fom so we can use radio buttons with same name -->
118 118
     <div id="field_frm<?php echo $result_str; ?>" class="field_frm"
119 119
          style="display:<?php if ($field_ins_upd == 'submit') {
120
-             echo 'block;';
121
-         } else {
122
-             echo 'none;';
123
-         } ?>">
120
+			 echo 'block;';
121
+		 } else {
122
+			 echo 'none;';
123
+		 } ?>">
124 124
         <input type="hidden" name="_wpnonce" value="<?php echo esc_attr($nonce); ?>"/>
125 125
         <input type="hidden" name="listing_type" id="listing_type" value="<?php echo $post_type; ?>"/>
126 126
         <input type="hidden" name="field_type" id="field_type" value="<?php echo $field_type; ?>"/>
127 127
         <input type="hidden" name="field_type_key" id="field_type_key" value="<?php echo $field_type_key; ?>"/>
128 128
         <input type="hidden" name="field_id" id="field_id" value="<?php echo esc_attr($result_str); ?>"/>
129 129
         <input type="hidden" name="data_type" id="data_type" value="<?php if (isset($field_info->data_type)) {
130
-            echo $field_info->data_type;
131
-        } ?>"/>
130
+			echo $field_info->data_type;
131
+		} ?>"/>
132 132
         <input type="hidden" name="is_active" id="is_active" value="1"/>
133 133
 
134 134
         <input type="hidden" name="is_default" value="<?php echo isset($field_info->is_default) ? $field_info->is_default : '';?>" /><?php // show in sidebar value?>
@@ -140,37 +140,37 @@  discard block
 block discarded – undo
140 140
 
141 141
             <?php
142 142
 
143
-            // data_type
144
-            if(has_filter("geodir_cfa_data_type_{$field_type}")){
143
+			// data_type
144
+			if(has_filter("geodir_cfa_data_type_{$field_type}")){
145 145
 
146
-                echo apply_filters("geodir_cfa_data_type_{$field_type}",'',$result_str,$cf,$field_info);
146
+				echo apply_filters("geodir_cfa_data_type_{$field_type}",'',$result_str,$cf,$field_info);
147 147
 
148
-            }else{
149
-                $value = '';
150
-                if (isset($field_info->data_type)) {
151
-                    $value = esc_attr($field_info->data_type);
152
-                }elseif(isset($cf['defaults']['data_type']) && $cf['defaults']['data_type']){
153
-                    $value = $cf['defaults']['data_type'];
154
-                }
155
-                ?>
148
+			}else{
149
+				$value = '';
150
+				if (isset($field_info->data_type)) {
151
+					$value = esc_attr($field_info->data_type);
152
+				}elseif(isset($cf['defaults']['data_type']) && $cf['defaults']['data_type']){
153
+					$value = $cf['defaults']['data_type'];
154
+				}
155
+				?>
156 156
                 <input type="hidden" name="data_type" id="data_type" value="<?php echo $value;?>"/>
157 157
             <?php
158
-            }
158
+			}
159 159
 
160 160
 
161
-            // admin_title
162
-            if(has_filter("geodir_cfa_admin_title_{$field_type}")){
161
+			// admin_title
162
+			if(has_filter("geodir_cfa_admin_title_{$field_type}")){
163 163
 
164
-                echo apply_filters("geodir_cfa_admin_title_{$field_type}",'',$result_str,$cf,$field_info);
164
+				echo apply_filters("geodir_cfa_admin_title_{$field_type}",'',$result_str,$cf,$field_info);
165 165
 
166
-            }else{
167
-                $value = '';
168
-                if (isset($field_info->admin_title)) {
169
-                    $value = esc_attr($field_info->admin_title);
170
-                }elseif(isset($cf['defaults']['admin_title']) && $cf['defaults']['admin_title']){
171
-                    $value = $cf['defaults']['admin_title'];
172
-                }
173
-                ?>
166
+			}else{
167
+				$value = '';
168
+				if (isset($field_info->admin_title)) {
169
+					$value = esc_attr($field_info->admin_title);
170
+				}elseif(isset($cf['defaults']['admin_title']) && $cf['defaults']['admin_title']){
171
+					$value = $cf['defaults']['admin_title'];
172
+				}
173
+				?>
174 174
                 <li>
175 175
                     <label for="admin_title" class="gd-cf-tooltip-wrap">
176 176
                         <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Admin title :', 'geodirectory'); ?>
@@ -184,22 +184,22 @@  discard block
 block discarded – undo
184 184
                     </div>
185 185
                 </li>
186 186
                 <?php
187
-            }
187
+			}
188 188
 
189 189
 
190
-            // site_title
191
-            if(has_filter("geodir_cfa_site_title_{$field_type}")){
190
+			// site_title
191
+			if(has_filter("geodir_cfa_site_title_{$field_type}")){
192 192
 
193
-                echo apply_filters("geodir_cfa_site_title_{$field_type}",'',$result_str,$cf,$field_info);
193
+				echo apply_filters("geodir_cfa_site_title_{$field_type}",'',$result_str,$cf,$field_info);
194 194
 
195
-            }else{
196
-                $value = '';
197
-                if (isset($field_info->site_title)) {
198
-                    $value = esc_attr($field_info->site_title);
199
-                }elseif(isset($cf['defaults']['site_title']) && $cf['defaults']['site_title']){
200
-                    $value = $cf['defaults']['site_title'];
201
-                }
202
-                ?>
195
+			}else{
196
+				$value = '';
197
+				if (isset($field_info->site_title)) {
198
+					$value = esc_attr($field_info->site_title);
199
+				}elseif(isset($cf['defaults']['site_title']) && $cf['defaults']['site_title']){
200
+					$value = $cf['defaults']['site_title'];
201
+				}
202
+				?>
203 203
                 <li>
204 204
                     <label for="site_title" class="gd-cf-tooltip-wrap"> <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Frontend title :', 'geodirectory'); ?>
205 205
                         <div class="gdcf-tooltip">
@@ -212,22 +212,22 @@  discard block
 block discarded – undo
212 212
                     </div>
213 213
                 </li>
214 214
                 <?php
215
-            }
215
+			}
216 216
 
217 217
 
218
-            // admin_desc
219
-            if(has_filter("geodir_cfa_admin_desc_{$field_type}")){
218
+			// admin_desc
219
+			if(has_filter("geodir_cfa_admin_desc_{$field_type}")){
220 220
 
221
-                echo apply_filters("geodir_cfa_admin_desc_{$field_type}",'',$result_str,$cf,$field_info);
221
+				echo apply_filters("geodir_cfa_admin_desc_{$field_type}",'',$result_str,$cf,$field_info);
222 222
 
223
-            }else{
224
-                $value = '';
225
-                if (isset($field_info->admin_desc)) {
226
-                    $value = esc_attr($field_info->admin_desc);
227
-                }elseif(isset($cf['defaults']['admin_desc']) && $cf['defaults']['admin_desc']){
228
-                    $value = $cf['defaults']['admin_desc'];
229
-                }
230
-                ?>
223
+			}else{
224
+				$value = '';
225
+				if (isset($field_info->admin_desc)) {
226
+					$value = esc_attr($field_info->admin_desc);
227
+				}elseif(isset($cf['defaults']['admin_desc']) && $cf['defaults']['admin_desc']){
228
+					$value = $cf['defaults']['admin_desc'];
229
+				}
230
+				?>
231 231
                 <li>
232 232
                     <label for="admin_desc" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Frontend description :', 'geodirectory'); ?>
233 233
                         <div class="gdcf-tooltip">
@@ -239,23 +239,23 @@  discard block
 block discarded – undo
239 239
                     </div>
240 240
                 </li>
241 241
                 <?php
242
-            }
242
+			}
243 243
 
244 244
 
245 245
 
246
-            // htmlvar_name
247
-            if(has_filter("geodir_cfa_htmlvar_name_{$field_type}")){
246
+			// htmlvar_name
247
+			if(has_filter("geodir_cfa_htmlvar_name_{$field_type}")){
248 248
 
249
-                echo apply_filters("geodir_cfa_htmlvar_name_{$field_type}",'',$result_str,$cf,$field_info);
249
+				echo apply_filters("geodir_cfa_htmlvar_name_{$field_type}",'',$result_str,$cf,$field_info);
250 250
 
251
-            }else{
252
-                $value = '';
253
-                if (isset($field_info->htmlvar_name)) {
254
-                    $value = esc_attr($field_info->htmlvar_name);
255
-                }elseif(isset($cf['defaults']['htmlvar_name']) && $cf['defaults']['htmlvar_name']){
256
-                    $value = $cf['defaults']['htmlvar_name'];
257
-                }
258
-                ?>
251
+			}else{
252
+				$value = '';
253
+				if (isset($field_info->htmlvar_name)) {
254
+					$value = esc_attr($field_info->htmlvar_name);
255
+				}elseif(isset($cf['defaults']['htmlvar_name']) && $cf['defaults']['htmlvar_name']){
256
+					$value = $cf['defaults']['htmlvar_name'];
257
+				}
258
+				?>
259 259
                 <li>
260 260
                     <label for="htmlvar_name" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('HTML variable name :', 'geodirectory');?>
261 261
                         <div class="gdcf-tooltip">
@@ -265,29 +265,29 @@  discard block
 block discarded – undo
265 265
                     <div class="gd-cf-input-wrap">
266 266
                         <input type="text" name="htmlvar_name" id="htmlvar_name" pattern="[a-zA-Z0-9]+" title="<?php _e('Must not contain spaces or special characters', 'geodirectory');?>"
267 267
                                value="<?php if ($value) {
268
-                                   echo preg_replace('/geodir_/', '', $value, 1);
269
-                               }?>" <?php if ($default) {
270
-                            echo 'readonly="readonly"';
271
-                        }?> />
268
+								   echo preg_replace('/geodir_/', '', $value, 1);
269
+							   }?>" <?php if ($default) {
270
+							echo 'readonly="readonly"';
271
+						}?> />
272 272
                     </div>
273 273
                 </li>
274 274
                 <?php
275
-            }
275
+			}
276 276
 
277 277
 
278
-            // is_active
279
-            if(has_filter("geodir_cfa_is_active_{$field_type}")){
278
+			// is_active
279
+			if(has_filter("geodir_cfa_is_active_{$field_type}")){
280 280
 
281
-                echo apply_filters("geodir_cfa_is_active_{$field_type}",'',$result_str,$cf,$field_info);
281
+				echo apply_filters("geodir_cfa_is_active_{$field_type}",'',$result_str,$cf,$field_info);
282 282
 
283
-            }else{
284
-                $value = '';
285
-                if (isset($field_info->is_active)) {
286
-                    $value = esc_attr($field_info->is_active);
287
-                }elseif(isset($cf['defaults']['is_active']) && $cf['defaults']['is_active']){
288
-                    $value = $cf['defaults']['is_active'];
289
-                }
290
-                ?>
283
+			}else{
284
+				$value = '';
285
+				if (isset($field_info->is_active)) {
286
+					$value = esc_attr($field_info->is_active);
287
+				}elseif(isset($cf['defaults']['is_active']) && $cf['defaults']['is_active']){
288
+					$value = $cf['defaults']['is_active'];
289
+				}
290
+				?>
291 291
                 <li <?php echo $field_display; ?>>
292 292
                     <label for="is_active" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Is active :', 'geodirectory'); ?>
293 293
                         <div class="gdcf-tooltip">
@@ -298,35 +298,35 @@  discard block
 block discarded – undo
298 298
 
299 299
                         <input type="radio" id="is_active_yes<?php echo $radio_id;?>" name="is_active" class="gdri-enabled"  value="1"
300 300
                             <?php if ($value == '1') {
301
-                                echo 'checked';
302
-                            } ?>/>
301
+								echo 'checked';
302
+							} ?>/>
303 303
                         <label for="is_active_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
304 304
 
305 305
                         <input type="radio" id="is_active_no<?php echo $radio_id;?>" name="is_active" class="gdri-disabled" value="0"
306 306
                             <?php if ($value == '0' || !$value) {
307
-                                echo 'checked';
308
-                            } ?>/>
307
+								echo 'checked';
308
+							} ?>/>
309 309
                         <label for="is_active_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
310 310
 
311 311
                     </div>
312 312
                 </li>
313 313
                 <?php
314
-            }
314
+			}
315 315
 
316 316
 
317
-            // for_admin_use
318
-            if(has_filter("geodir_cfa_for_admin_use_{$field_type}")){
317
+			// for_admin_use
318
+			if(has_filter("geodir_cfa_for_admin_use_{$field_type}")){
319 319
 
320
-                echo apply_filters("geodir_cfa_for_admin_use_{$field_type}",'',$result_str,$cf,$field_info);
320
+				echo apply_filters("geodir_cfa_for_admin_use_{$field_type}",'',$result_str,$cf,$field_info);
321 321
 
322
-            }else{
323
-                $value = '';
324
-                if (isset($field_info->for_admin_use)) {
325
-                    $value = esc_attr($field_info->for_admin_use);
326
-                }elseif(isset($cf['defaults']['for_admin_use']) && $cf['defaults']['for_admin_use']){
327
-                    $value = $cf['defaults']['for_admin_use'];
328
-                }
329
-                ?>
322
+			}else{
323
+				$value = '';
324
+				if (isset($field_info->for_admin_use)) {
325
+					$value = esc_attr($field_info->for_admin_use);
326
+				}elseif(isset($cf['defaults']['for_admin_use']) && $cf['defaults']['for_admin_use']){
327
+					$value = $cf['defaults']['for_admin_use'];
328
+				}
329
+				?>
330 330
                 <li>
331 331
                     <label for="for_admin_use" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('For admin use only? :', 'geodirectory'); ?>
332 332
                         <div class="gdcf-tooltip">
@@ -337,47 +337,47 @@  discard block
 block discarded – undo
337 337
 
338 338
                         <input type="radio" id="for_admin_use_yes<?php echo $radio_id;?>" name="for_admin_use" class="gdri-enabled"  value="1"
339 339
                             <?php if ($value == '1') {
340
-                                echo 'checked';
341
-                            } ?>/>
340
+								echo 'checked';
341
+							} ?>/>
342 342
                         <label for="for_admin_use_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
343 343
 
344 344
                         <input type="radio" id="for_admin_use_no<?php echo $radio_id;?>" name="for_admin_use" class="gdri-disabled" value="0"
345 345
                             <?php if ($value == '0' || !$value) {
346
-                                echo 'checked';
347
-                            } ?>/>
346
+								echo 'checked';
347
+							} ?>/>
348 348
                         <label for="for_admin_use_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
349 349
 
350 350
                     </div>
351 351
                 </li>
352 352
                 <?php
353
-            }
353
+			}
354 354
 
355 355
 
356
-            // default_value
357
-            if(has_filter("geodir_cfa_default_value_{$field_type}")){
356
+			// default_value
357
+			if(has_filter("geodir_cfa_default_value_{$field_type}")){
358 358
 
359
-                echo apply_filters("geodir_cfa_default_value_{$field_type}",'',$result_str,$cf,$field_info);
359
+				echo apply_filters("geodir_cfa_default_value_{$field_type}",'',$result_str,$cf,$field_info);
360 360
 
361
-            }else{
362
-                $value = '';
363
-                if (isset($field_info->default_value)) {
364
-                    $value = esc_attr($field_info->default_value);
365
-                }elseif(isset($cf['defaults']['default_value']) && $cf['defaults']['default_value']){
366
-                    $value = $cf['defaults']['default_value'];
367
-                }
368
-                ?>
361
+			}else{
362
+				$value = '';
363
+				if (isset($field_info->default_value)) {
364
+					$value = esc_attr($field_info->default_value);
365
+				}elseif(isset($cf['defaults']['default_value']) && $cf['defaults']['default_value']){
366
+					$value = $cf['defaults']['default_value'];
367
+				}
368
+				?>
369 369
                 <li>
370 370
                     <label for="default_value" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Default value :', 'geodirectory');?>
371 371
                         <div class="gdcf-tooltip">
372 372
                             <?php
373
-                            if ($field_type == 'checkbox') {
374
-                                _e('Should the checkbox be checked by default?', 'geodirectory');
375
-                            } else if ($field_type == 'email') {
376
-                                _e('A default value for the field, usually blank. Ex: [email protected]', 'geodirectory');
377
-                            } else {
378
-                                _e('A default value for the field, usually blank. (for "link" this will be used as the link text)', 'geodirectory');
379
-                            }
380
-                            ?>
373
+							if ($field_type == 'checkbox') {
374
+								_e('Should the checkbox be checked by default?', 'geodirectory');
375
+							} else if ($field_type == 'email') {
376
+								_e('A default value for the field, usually blank. Ex: [email protected]', 'geodirectory');
377
+							} else {
378
+								_e('A default value for the field, usually blank. (for "link" this will be used as the link text)', 'geodirectory');
379
+							}
380
+							?>
381 381
                         </div>
382 382
                     </label>
383 383
                     <div class="gd-cf-input-wrap">
@@ -394,22 +394,22 @@  discard block
 block discarded – undo
394 394
                     </div>
395 395
                 </li>
396 396
                 <?php
397
-            }
397
+			}
398 398
 
399 399
 
400
-            // show_in
401
-            if(has_filter("geodir_cfa_show_in_{$field_type}")){
400
+			// show_in
401
+			if(has_filter("geodir_cfa_show_in_{$field_type}")){
402 402
 
403
-                echo apply_filters("geodir_cfa_show_in_{$field_type}",'',$result_str,$cf,$field_info);
403
+				echo apply_filters("geodir_cfa_show_in_{$field_type}",'',$result_str,$cf,$field_info);
404 404
 
405
-            }else{
406
-                $value = '';
407
-                if (isset($field_info->show_in)) {
408
-                    $value = esc_attr($field_info->show_in);
409
-                }elseif(isset($cf['defaults']['show_in']) && $cf['defaults']['show_in']){
410
-                    $value = esc_attr($cf['defaults']['show_in']);
411
-                }
412
-                ?>
405
+			}else{
406
+				$value = '';
407
+				if (isset($field_info->show_in)) {
408
+					$value = esc_attr($field_info->show_in);
409
+				}elseif(isset($cf['defaults']['show_in']) && $cf['defaults']['show_in']){
410
+					$value = esc_attr($cf['defaults']['show_in']);
411
+				}
412
+				?>
413 413
                 <li>
414 414
                     <label for="show_in" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Show in what locations?:', 'geodirectory'); ?>
415 415
                         <div class="gdcf-tooltip">
@@ -420,41 +420,41 @@  discard block
 block discarded – undo
420 420
 
421 421
                         <?php
422 422
 
423
-                        /*
423
+						/*
424 424
 						 * We wrap the key values in [] so we can search the DB easier with a LIKE query.
425 425
 						 */
426
-                        $show_in_locations = array(
427
-                            "[detail]" => __("Details page sidebar", 'geodirectory'),
428
-                            "[moreinfo]" => __("More info tab", 'geodirectory'),
429
-                            "[listing]" => __("Listings page", 'geodirectory'),
430
-                            "[owntab]" => __("Details page own tab", 'geodirectory'),
431
-                            "[mapbubble]" => __("Map bubble", 'geodirectory'),
432
-                        );
433
-
434
-                        /**
435
-                         * Filter the locations array for where to display custom fields.
436
-                         *
437
-                         * @since 1.6.6
438
-                         * @param array $show_in_locations The array of locations and descriptions.
439
-                         * @param object $field_info The field being displayed info.
440
-                         * @param string $field_info The type of field.
441
-                         */
442
-                        $show_in_locations = apply_filters('geodir_show_in_locations',$show_in_locations,$field_info,$field_type);
443
-
444
-
445
-                        // remove some locations for some field types
446
-
447
-                        // don't show new tab option for some types
448
-                        if (in_array($field_type, array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file','address','taxonomy'))) {
449
-                        }else{
450
-                            unset($show_in_locations['[owntab]']);
451
-                        }
452
-
453
-                        if(!$display_on_listing){
454
-                            unset($show_in_locations['[listings]']);
455
-                        }
456
-
457
-                        ?>
426
+						$show_in_locations = array(
427
+							"[detail]" => __("Details page sidebar", 'geodirectory'),
428
+							"[moreinfo]" => __("More info tab", 'geodirectory'),
429
+							"[listing]" => __("Listings page", 'geodirectory'),
430
+							"[owntab]" => __("Details page own tab", 'geodirectory'),
431
+							"[mapbubble]" => __("Map bubble", 'geodirectory'),
432
+						);
433
+
434
+						/**
435
+						 * Filter the locations array for where to display custom fields.
436
+						 *
437
+						 * @since 1.6.6
438
+						 * @param array $show_in_locations The array of locations and descriptions.
439
+						 * @param object $field_info The field being displayed info.
440
+						 * @param string $field_info The type of field.
441
+						 */
442
+						$show_in_locations = apply_filters('geodir_show_in_locations',$show_in_locations,$field_info,$field_type);
443
+
444
+
445
+						// remove some locations for some field types
446
+
447
+						// don't show new tab option for some types
448
+						if (in_array($field_type, array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file','address','taxonomy'))) {
449
+						}else{
450
+							unset($show_in_locations['[owntab]']);
451
+						}
452
+
453
+						if(!$display_on_listing){
454
+							unset($show_in_locations['[listings]']);
455
+						}
456
+
457
+						?>
458 458
 
459 459
                         <select multiple="multiple" name="show_in[]"
460 460
                                 id="show_in"
@@ -464,38 +464,38 @@  discard block
 block discarded – undo
464 464
                                 option-ajaxchosen="false">
465 465
                             <?php
466 466
 
467
-                            $show_in_values = explode(',',$value);
467
+							$show_in_values = explode(',',$value);
468 468
 
469
-                            foreach( $show_in_locations as $key => $val){
470
-                                $selected = '';
469
+							foreach( $show_in_locations as $key => $val){
470
+								$selected = '';
471 471
 
472
-                                if(is_array($show_in_values) && in_array($key,$show_in_values ) ){
473
-                                    $selected = 'selected';
474
-                                }
472
+								if(is_array($show_in_values) && in_array($key,$show_in_values ) ){
473
+									$selected = 'selected';
474
+								}
475 475
 
476
-                                ?>
476
+								?>
477 477
                                 <option  value="<?php echo $key;?>" <?php echo $selected;?>><?php echo $val;?></option>
478 478
                                 <?php
479
-                            }
480
-                            ?>
479
+							}
480
+							?>
481 481
                         </select>
482 482
                     </div>
483 483
                 </li>
484 484
                 <?php
485
-            }
485
+			}
486 486
 
487 487
 
488
-            // advanced_editor
489
-            if(has_filter("geodir_cfa_advanced_editor_{$field_type}")){
488
+			// advanced_editor
489
+			if(has_filter("geodir_cfa_advanced_editor_{$field_type}")){
490 490
 
491
-                echo apply_filters("geodir_cfa_advanced_editor_{$field_type}",'',$result_str,$cf,$field_info);
491
+				echo apply_filters("geodir_cfa_advanced_editor_{$field_type}",'',$result_str,$cf,$field_info);
492 492
 
493
-            }
493
+			}
494 494
 
495 495
 
496 496
 
497 497
 
498
-            ?>
498
+			?>
499 499
 
500 500
 
501 501
             <?php // @todo this does not seem to be used for anything, it can be removed or replaced ?>
@@ -508,38 +508,38 @@  discard block
 block discarded – undo
508 508
 
509 509
             <?php
510 510
 
511
-            $pricearr = array();
512
-            if (isset($field_info->packages) && $field_info->packages != '') {
513
-                $pricearr = explode(',', trim($field_info->packages, ','));
514
-            } else {
515
-                $package_info = array();
511
+			$pricearr = array();
512
+			if (isset($field_info->packages) && $field_info->packages != '') {
513
+				$pricearr = explode(',', trim($field_info->packages, ','));
514
+			} else {
515
+				$package_info = array();
516 516
 
517
-                $package_info = geodir_post_package_info($package_info, '', $post_type);
518
-                $pricearr[] = $package_info->pid;
519
-            }
517
+				$package_info = geodir_post_package_info($package_info, '', $post_type);
518
+				$pricearr[] = $package_info->pid;
519
+			}
520 520
 
521
-            ob_start()
522
-            ?>
521
+			ob_start()
522
+			?>
523 523
 
524 524
             <select style="display:none" name="show_on_pkg[]" id="show_on_pkg" multiple="multiple">
525 525
                 <?php
526
-                if (!empty($pricearr)) {
527
-                    foreach ($pricearr as $val) {
528
-                        ?>
526
+				if (!empty($pricearr)) {
527
+					foreach ($pricearr as $val) {
528
+						?>
529 529
                         <option selected="selected" value="<?php echo esc_attr($val); ?>" ><?php echo $val; ?></option><?php
530
-                    }
531
-                }
532
-                ?>
530
+					}
531
+				}
532
+				?>
533 533
             </select>
534 534
 
535 535
             <?php
536
-            $html = ob_get_clean();
536
+			$html = ob_get_clean();
537 537
 
538 538
 			/**
539 539
 			 * Filter the price packages list.
540 540
 			 *
541 541
 			 * Filter the price packages list in custom field form in admin
542
-             * custom fields settings.
542
+			 * custom fields settings.
543 543
 			 *
544 544
 			 * @since 1.0.0
545 545
 			 *
@@ -548,25 +548,25 @@  discard block
 block discarded – undo
548 548
 			 */
549 549
 			echo $html = apply_filters('geodir_packages_list_on_custom_fields', $html, $field_info);
550 550
 
551
-            ?>
551
+			?>
552 552
 
553 553
 
554 554
 
555 555
             <?php
556 556
 
557
-            // is_required
558
-            if(has_filter("geodir_cfa_is_required_{$field_type}")){
557
+			// is_required
558
+			if(has_filter("geodir_cfa_is_required_{$field_type}")){
559 559
 
560
-                echo apply_filters("geodir_cfa_is_required_{$field_type}",'',$result_str,$cf,$field_info);
560
+				echo apply_filters("geodir_cfa_is_required_{$field_type}",'',$result_str,$cf,$field_info);
561 561
 
562
-            }else{
563
-                $value = '';
564
-                if (isset($field_info->is_required)) {
565
-                    $value = esc_attr($field_info->is_required);
566
-                }elseif(isset($cf['defaults']['is_required']) && $cf['defaults']['is_required']){
567
-                    $value = $cf['defaults']['is_required'];
568
-                }
569
-                ?>
562
+			}else{
563
+				$value = '';
564
+				if (isset($field_info->is_required)) {
565
+					$value = esc_attr($field_info->is_required);
566
+				}elseif(isset($cf['defaults']['is_required']) && $cf['defaults']['is_required']){
567
+					$value = $cf['defaults']['is_required'];
568
+				}
569
+				?>
570 570
                 <li>
571 571
                     <label for="is_required" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Is required :', 'geodirectory'); ?>
572 572
                         <div class="gdcf-tooltip">
@@ -578,14 +578,14 @@  discard block
 block discarded – undo
578 578
 
579 579
                         <input type="radio" id="is_required_yes<?php echo $radio_id;?>" name="is_required" class="gdri-enabled"  value="1"
580 580
                             <?php if ($value == '1') {
581
-                                echo 'checked';
582
-                            } ?>/>
581
+								echo 'checked';
582
+							} ?>/>
583 583
                         <label onclick="show_hide_radio(this,'show','cf-is-required-msg');" for="is_required_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
584 584
 
585 585
                         <input type="radio" id="is_required_no<?php echo $radio_id;?>" name="is_required" class="gdri-disabled" value="0"
586 586
                             <?php if ($value == '0' || !$value) {
587
-                                echo 'checked';
588
-                            } ?>/>
587
+								echo 'checked';
588
+							} ?>/>
589 589
                         <label onclick="show_hide_radio(this,'hide','cf-is-required-msg');" for="is_required_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
590 590
 
591 591
                     </div>
@@ -593,21 +593,21 @@  discard block
 block discarded – undo
593 593
                 </li>
594 594
 
595 595
                 <?php
596
-            }
596
+			}
597 597
 
598
-            // required_msg
599
-            if(has_filter("geodir_cfa_required_msg_{$field_type}")){
598
+			// required_msg
599
+			if(has_filter("geodir_cfa_required_msg_{$field_type}")){
600 600
 
601
-                echo apply_filters("geodir_cfa_required_msg_{$field_type}",'',$result_str,$cf,$field_info);
601
+				echo apply_filters("geodir_cfa_required_msg_{$field_type}",'',$result_str,$cf,$field_info);
602 602
 
603
-            }else{
604
-                $value = '';
605
-                if (isset($field_info->required_msg)) {
606
-                    $value = esc_attr($field_info->required_msg);
607
-                }elseif(isset($cf['defaults']['required_msg']) && $cf['defaults']['required_msg']){
608
-                    $value = $cf['defaults']['required_msg'];
609
-                }
610
-                ?>
603
+			}else{
604
+				$value = '';
605
+				if (isset($field_info->required_msg)) {
606
+					$value = esc_attr($field_info->required_msg);
607
+				}elseif(isset($cf['defaults']['required_msg']) && $cf['defaults']['required_msg']){
608
+					$value = $cf['defaults']['required_msg'];
609
+				}
610
+				?>
611 611
                 <li class="cf-is-required-msg" <?php if ((isset($field_info->is_required) && $field_info->is_required == '0') || !isset($field_info->is_required)) {echo "style='display:none;'";}?>>
612 612
                     <label for="required_msg" class="gd-cf-tooltip-wrap">
613 613
                         <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Required message:', 'geodirectory'); ?>
@@ -621,38 +621,38 @@  discard block
 block discarded – undo
621 621
                     </div>
622 622
                 </li>
623 623
                 <?php
624
-            }
624
+			}
625 625
 
626 626
 
627
-            // required_msg
628
-            if(has_filter("geodir_cfa_validation_pattern_{$field_type}")){
627
+			// required_msg
628
+			if(has_filter("geodir_cfa_validation_pattern_{$field_type}")){
629 629
 
630
-                echo apply_filters("geodir_cfa_validation_pattern_{$field_type}",'',$result_str,$cf,$field_info);
630
+				echo apply_filters("geodir_cfa_validation_pattern_{$field_type}",'',$result_str,$cf,$field_info);
631 631
 
632
-            }
632
+			}
633 633
 
634 634
 
635
-            // extra_fields
636
-            if(has_filter("geodir_cfa_extra_fields_{$field_type}")){
635
+			// extra_fields
636
+			if(has_filter("geodir_cfa_extra_fields_{$field_type}")){
637 637
 
638
-                echo apply_filters("geodir_cfa_extra_fields_{$field_type}",'',$result_str,$cf,$field_info);
638
+				echo apply_filters("geodir_cfa_extra_fields_{$field_type}",'',$result_str,$cf,$field_info);
639 639
 
640
-            }
640
+			}
641 641
 
642 642
 
643
-            // field_icon
644
-            if(has_filter("geodir_cfa_field_icon_{$field_type}")){
643
+			// field_icon
644
+			if(has_filter("geodir_cfa_field_icon_{$field_type}")){
645 645
 
646
-                echo apply_filters("geodir_cfa_field_icon_{$field_type}",'',$result_str,$cf,$field_info);
646
+				echo apply_filters("geodir_cfa_field_icon_{$field_type}",'',$result_str,$cf,$field_info);
647 647
 
648
-            }else{
649
-                $value = '';
650
-                if (isset($field_info->field_icon)) {
651
-                    $value = esc_attr($field_info->field_icon);
652
-                }elseif(isset($cf['defaults']['field_icon']) && $cf['defaults']['field_icon']){
653
-                    $value = $cf['defaults']['field_icon'];
654
-                }
655
-                ?>
648
+			}else{
649
+				$value = '';
650
+				if (isset($field_info->field_icon)) {
651
+					$value = esc_attr($field_info->field_icon);
652
+				}elseif(isset($cf['defaults']['field_icon']) && $cf['defaults']['field_icon']){
653
+					$value = $cf['defaults']['field_icon'];
654
+				}
655
+				?>
656 656
                 <li>
657 657
                     <h3><?php echo __('Custom css', 'geodirectory'); ?></h3>
658 658
 
@@ -670,22 +670,22 @@  discard block
 block discarded – undo
670 670
 
671 671
                 </li>
672 672
                 <?php
673
-            }
673
+			}
674 674
 
675 675
 
676
-            // css_class
677
-            if(has_filter("geodir_cfa_css_class_{$field_type}")){
676
+			// css_class
677
+			if(has_filter("geodir_cfa_css_class_{$field_type}")){
678 678
 
679
-                echo apply_filters("geodir_cfa_css_class_{$field_type}",'',$result_str,$cf,$field_info);
679
+				echo apply_filters("geodir_cfa_css_class_{$field_type}",'',$result_str,$cf,$field_info);
680 680
 
681
-            }else{
682
-                $value = '';
683
-                if (isset($field_info->css_class)) {
684
-                    $value = esc_attr($field_info->css_class);
685
-                }elseif(isset($cf['defaults']['css_class']) && $cf['defaults']['css_class']){
686
-                    $value = $cf['defaults']['css_class'];
687
-                }
688
-                ?>
681
+			}else{
682
+				$value = '';
683
+				if (isset($field_info->css_class)) {
684
+					$value = esc_attr($field_info->css_class);
685
+				}elseif(isset($cf['defaults']['css_class']) && $cf['defaults']['css_class']){
686
+					$value = $cf['defaults']['css_class'];
687
+				}
688
+				?>
689 689
                 <li>
690 690
 
691 691
                     <label for="css_class" class="gd-cf-tooltip-wrap">
@@ -698,47 +698,47 @@  discard block
 block discarded – undo
698 698
                     <div class="gd-cf-input-wrap">
699 699
                         <input type="text" name="css_class" id="css_class"
700 700
                                value="<?php if (isset($field_info->css_class)) {
701
-                                   echo esc_attr($field_info->css_class);
702
-                               }?>"/>
701
+								   echo esc_attr($field_info->css_class);
702
+							   }?>"/>
703 703
                     </div>
704 704
                 </li>
705 705
                 <?php
706
-            }
706
+			}
707 707
 
708 708
 
709
-            // cat_sort
710
-            if(has_filter("geodir_cfa_cat_sort_{$field_type}")){
709
+			// cat_sort
710
+			if(has_filter("geodir_cfa_cat_sort_{$field_type}")){
711 711
 
712
-                echo apply_filters("geodir_cfa_cat_sort_{$field_type}",'',$result_str,$cf,$field_info);
712
+				echo apply_filters("geodir_cfa_cat_sort_{$field_type}",'',$result_str,$cf,$field_info);
713 713
 
714
-            }else{
715
-                $value = '';
716
-                $hide_cat_sort  ='';
717
-                if (isset($field_info->cat_sort)) {
718
-                    $value = esc_attr($field_info->cat_sort);
719
-                }elseif(isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort']){
720
-                    $value = $cf['defaults']['cat_sort'];
721
-                    $hide_cat_sort = ($value===false) ? "style='display:none;'" : '';
722
-                }
714
+			}else{
715
+				$value = '';
716
+				$hide_cat_sort  ='';
717
+				if (isset($field_info->cat_sort)) {
718
+					$value = esc_attr($field_info->cat_sort);
719
+				}elseif(isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort']){
720
+					$value = $cf['defaults']['cat_sort'];
721
+					$hide_cat_sort = ($value===false) ? "style='display:none;'" : '';
722
+				}
723 723
 
724
-                $hide_cat_sort = (isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort']===false) ? "style='display:none;'" : '';
725
-                ?>
724
+				$hide_cat_sort = (isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort']===false) ? "style='display:none;'" : '';
725
+				?>
726 726
                 <li <?php echo $hide_cat_sort ;?>>
727 727
                     <h3><?php
728
-                        /**
729
-                         * Filter the section title.
730
-                         *
731
-                         * Filter the section title in custom field form in admin
732
-                         * custom fields settings.
733
-                         *
734
-                         * @since 1.0.0
735
-                         *
736
-                         * @param string $title Title of the section.
737
-                         * @param string $field_type Current field type.
738
-                         */
739
-                        echo apply_filters('geodir_advance_custom_fields_heading', __('Posts sort options', 'geodirectory'), $field_type);
740
-
741
-                        ?></h3>
728
+						/**
729
+						 * Filter the section title.
730
+						 *
731
+						 * Filter the section title in custom field form in admin
732
+						 * custom fields settings.
733
+						 *
734
+						 * @since 1.0.0
735
+						 *
736
+						 * @param string $title Title of the section.
737
+						 * @param string $field_type Current field type.
738
+						 */
739
+						echo apply_filters('geodir_advance_custom_fields_heading', __('Posts sort options', 'geodirectory'), $field_type);
740
+
741
+						?></h3>
742 742
                     <label for="cat_sort" class="gd-cf-tooltip-wrap">
743 743
                         <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Include this field in sorting options :', 'geodirectory'); ?>
744 744
                         <div class="gdcf-tooltip">
@@ -750,42 +750,42 @@  discard block
 block discarded – undo
750 750
 
751 751
                         <input type="radio" id="cat_sort_yes<?php echo $radio_id;?>" name="cat_sort" class="gdri-enabled"  value="1"
752 752
                             <?php if ($value == '1') {
753
-                                echo 'checked';
754
-                            } ?>/>
753
+								echo 'checked';
754
+							} ?>/>
755 755
                         <label for="cat_sort_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
756 756
 
757 757
                         <input type="radio" id="cat_sort_no<?php echo $radio_id;?>" name="cat_sort" class="gdri-disabled" value="0"
758 758
                             <?php if (!$value) {
759
-                                echo 'checked';
760
-                            } ?>/>
759
+								echo 'checked';
760
+							} ?>/>
761 761
                         <label for="cat_sort_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
762 762
 
763 763
                     </div>
764 764
                 </li>
765 765
                 <?php
766
-            }
767
-
768
-
769
-
770
-            switch ($field_type):
771
-                case 'html':
772
-                case 'file':
773
-                case 'url':
774
-                case 'fieldset':
775
-                    break;
776
-                default:
777
-
778
-                    /**
779
-                     * Called at the end of the advanced custom fields settings page loop.
780
-                     *
781
-                     * Can be used to add or deal with different settings types.
782
-                     *
783
-                     * @since 1.0.0
784
-                     * @since 1.6.6 $cf param added.
785
-                     * @param object $field_info The current fields info.
786
-                     * @param array $cf The custom field settings
787
-                     */
788
-                    do_action('geodir_advance_custom_fields', $field_info,$cf);?>
766
+			}
767
+
768
+
769
+
770
+			switch ($field_type):
771
+				case 'html':
772
+				case 'file':
773
+				case 'url':
774
+				case 'fieldset':
775
+					break;
776
+				default:
777
+
778
+					/**
779
+					 * Called at the end of the advanced custom fields settings page loop.
780
+					 *
781
+					 * Can be used to add or deal with different settings types.
782
+					 *
783
+					 * @since 1.0.0
784
+					 * @since 1.6.6 $cf param added.
785
+					 * @param object $field_info The current fields info.
786
+					 * @param array $cf The custom field settings
787
+					 */
788
+					do_action('geodir_advance_custom_fields', $field_info,$cf);?>
789 789
 
790 790
 
791 791
                 <?php endswitch; ?>
Please login to merge, or discard this patch.
Spacing   +124 added lines, -124 removed lines patch added patch discarded remove patch
@@ -39,12 +39,12 @@  discard block
 block discarded – undo
39 39
 $cf = (isset($cf_arr[$field_type_key])) ? $cf_arr[$field_type_key] : '';
40 40
 
41 41
 
42
-if(isset($field_info->extra_fields)){$extra_fields = $field_info->extra_fields;}
42
+if (isset($field_info->extra_fields)) {$extra_fields = $field_info->extra_fields; }
43 43
 $field_info = stripslashes_deep($field_info); // strip slashes from labels
44
-if(isset($field_info->extra_fields)){$field_info->extra_fields = $extra_fields;}
44
+if (isset($field_info->extra_fields)) {$field_info->extra_fields = $extra_fields; }
45 45
 
46 46
 
47
-$nonce = wp_create_nonce('custom_fields_' . $result_str);
47
+$nonce = wp_create_nonce('custom_fields_'.$result_str);
48 48
 
49 49
 $field_admin_title = '';
50 50
 if (isset($field_info->admin_title))
@@ -69,15 +69,15 @@  discard block
 block discarded – undo
69 69
 
70 70
 if (isset($cf['icon']) && strpos($cf['icon'], 'fa fa-') !== false) {
71 71
     $field_icon = '<i class="'.$cf['icon'].'" aria-hidden="true"></i>';
72
-}elseif(isset($cf['icon']) && $cf['icon']){
72
+}elseif (isset($cf['icon']) && $cf['icon']) {
73 73
     $field_icon = '<b style="background-image: url("'.$cf['icon'].'")"></b>';
74
-}else{
74
+} else {
75 75
     $field_icon = '<i class="fa fa-cog" aria-hidden="true"></i>';
76 76
 }
77 77
 
78
-if(isset($cf['name']) && $cf['name']){
78
+if (isset($cf['name']) && $cf['name']) {
79 79
     $field_type_name = $cf['name'];
80
-}else{
80
+} else {
81 81
     $field_type_name = $field_type;
82 82
 }
83 83
 
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
          ondblclick="show_hide('field_frm<?php echo $result_str; ?>')">
89 89
         <?php
90 90
 
91
-        $nonce = wp_create_nonce('custom_fields_' . $result_str);
91
+        $nonce = wp_create_nonce('custom_fields_'.$result_str);
92 92
         ?>
93 93
 
94 94
         <?php if ($default): ?>
@@ -103,12 +103,12 @@  discard block
 block discarded – undo
103 103
             <i class="fa fa-long-arrow-left " aria-hidden="true"></i>
104 104
             <i class="fa fa-long-arrow-right " aria-hidden="true"></i>
105 105
             <b style="cursor:pointer;"
106
-               onclick="show_hide('field_frm<?php echo $result_str;?>')"><?php echo geodir_ucwords(__('Fieldset:', 'geodirectory') . ' ' . $field_admin_title);?></b>
106
+               onclick="show_hide('field_frm<?php echo $result_str; ?>')"><?php echo geodir_ucwords(__('Fieldset:', 'geodirectory').' '.$field_admin_title); ?></b>
107 107
         <?php
108 108
         } else {echo $field_icon;
109 109
             ?>
110 110
             <b style="cursor:pointer;"
111
-               onclick="show_hide('field_frm<?php echo $result_str;?>')"><?php echo geodir_ucwords(' ' . $field_admin_title . ' (' . $field_type_name . ')');?></b>
111
+               onclick="show_hide('field_frm<?php echo $result_str; ?>')"><?php echo geodir_ucwords(' '.$field_admin_title.' ('.$field_type_name.')'); ?></b>
112 112
         <?php
113 113
         }
114 114
         ?>
@@ -131,43 +131,43 @@  discard block
 block discarded – undo
131 131
         } ?>"/>
132 132
         <input type="hidden" name="is_active" id="is_active" value="1"/>
133 133
 
134
-        <input type="hidden" name="is_default" value="<?php echo isset($field_info->is_default) ? $field_info->is_default : '';?>" /><?php // show in sidebar value?>
135
-        <input type="hidden" name="show_on_listing" value="<?php echo isset($field_info->show_on_listing) ? $field_info->show_on_listing : '';?>" />
136
-        <input type="hidden" name="show_on_detail" value="<?php echo isset($field_info->show_on_listing) ? $field_info->show_on_listing : '';?>" />
137
-        <input type="hidden" name="show_as_tab" value="<?php echo isset($field_info->show_as_tab) ? $field_info->show_as_tab : '';?>" />
134
+        <input type="hidden" name="is_default" value="<?php echo isset($field_info->is_default) ? $field_info->is_default : ''; ?>" /><?php // show in sidebar value?>
135
+        <input type="hidden" name="show_on_listing" value="<?php echo isset($field_info->show_on_listing) ? $field_info->show_on_listing : ''; ?>" />
136
+        <input type="hidden" name="show_on_detail" value="<?php echo isset($field_info->show_on_listing) ? $field_info->show_on_listing : ''; ?>" />
137
+        <input type="hidden" name="show_as_tab" value="<?php echo isset($field_info->show_as_tab) ? $field_info->show_as_tab : ''; ?>" />
138 138
 
139 139
         <ul class="widefat post fixed" border="0" style="width:100%;">
140 140
 
141 141
             <?php
142 142
 
143 143
             // data_type
144
-            if(has_filter("geodir_cfa_data_type_{$field_type}")){
144
+            if (has_filter("geodir_cfa_data_type_{$field_type}")) {
145 145
 
146
-                echo apply_filters("geodir_cfa_data_type_{$field_type}",'',$result_str,$cf,$field_info);
146
+                echo apply_filters("geodir_cfa_data_type_{$field_type}", '', $result_str, $cf, $field_info);
147 147
 
148
-            }else{
148
+            } else {
149 149
                 $value = '';
150 150
                 if (isset($field_info->data_type)) {
151 151
                     $value = esc_attr($field_info->data_type);
152
-                }elseif(isset($cf['defaults']['data_type']) && $cf['defaults']['data_type']){
152
+                }elseif (isset($cf['defaults']['data_type']) && $cf['defaults']['data_type']) {
153 153
                     $value = $cf['defaults']['data_type'];
154 154
                 }
155 155
                 ?>
156
-                <input type="hidden" name="data_type" id="data_type" value="<?php echo $value;?>"/>
156
+                <input type="hidden" name="data_type" id="data_type" value="<?php echo $value; ?>"/>
157 157
             <?php
158 158
             }
159 159
 
160 160
 
161 161
             // admin_title
162
-            if(has_filter("geodir_cfa_admin_title_{$field_type}")){
162
+            if (has_filter("geodir_cfa_admin_title_{$field_type}")) {
163 163
 
164
-                echo apply_filters("geodir_cfa_admin_title_{$field_type}",'',$result_str,$cf,$field_info);
164
+                echo apply_filters("geodir_cfa_admin_title_{$field_type}", '', $result_str, $cf, $field_info);
165 165
 
166
-            }else{
166
+            } else {
167 167
                 $value = '';
168 168
                 if (isset($field_info->admin_title)) {
169 169
                     $value = esc_attr($field_info->admin_title);
170
-                }elseif(isset($cf['defaults']['admin_title']) && $cf['defaults']['admin_title']){
170
+                }elseif (isset($cf['defaults']['admin_title']) && $cf['defaults']['admin_title']) {
171 171
                     $value = $cf['defaults']['admin_title'];
172 172
                 }
173 173
                 ?>
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
                     </label>
181 181
                     <div class="gd-cf-input-wrap">
182 182
                         <input type="text" name="admin_title" id="admin_title"
183
-                               value="<?php echo $value;?>"/>
183
+                               value="<?php echo $value; ?>"/>
184 184
                     </div>
185 185
                 </li>
186 186
                 <?php
@@ -188,15 +188,15 @@  discard block
 block discarded – undo
188 188
 
189 189
 
190 190
             // site_title
191
-            if(has_filter("geodir_cfa_site_title_{$field_type}")){
191
+            if (has_filter("geodir_cfa_site_title_{$field_type}")) {
192 192
 
193
-                echo apply_filters("geodir_cfa_site_title_{$field_type}",'',$result_str,$cf,$field_info);
193
+                echo apply_filters("geodir_cfa_site_title_{$field_type}", '', $result_str, $cf, $field_info);
194 194
 
195
-            }else{
195
+            } else {
196 196
                 $value = '';
197 197
                 if (isset($field_info->site_title)) {
198 198
                     $value = esc_attr($field_info->site_title);
199
-                }elseif(isset($cf['defaults']['site_title']) && $cf['defaults']['site_title']){
199
+                }elseif (isset($cf['defaults']['site_title']) && $cf['defaults']['site_title']) {
200 200
                     $value = $cf['defaults']['site_title'];
201 201
                 }
202 202
                 ?>
@@ -216,15 +216,15 @@  discard block
 block discarded – undo
216 216
 
217 217
 
218 218
             // admin_desc
219
-            if(has_filter("geodir_cfa_admin_desc_{$field_type}")){
219
+            if (has_filter("geodir_cfa_admin_desc_{$field_type}")) {
220 220
 
221
-                echo apply_filters("geodir_cfa_admin_desc_{$field_type}",'',$result_str,$cf,$field_info);
221
+                echo apply_filters("geodir_cfa_admin_desc_{$field_type}", '', $result_str, $cf, $field_info);
222 222
 
223
-            }else{
223
+            } else {
224 224
                 $value = '';
225 225
                 if (isset($field_info->admin_desc)) {
226 226
                     $value = esc_attr($field_info->admin_desc);
227
-                }elseif(isset($cf['defaults']['admin_desc']) && $cf['defaults']['admin_desc']){
227
+                }elseif (isset($cf['defaults']['admin_desc']) && $cf['defaults']['admin_desc']) {
228 228
                     $value = $cf['defaults']['admin_desc'];
229 229
                 }
230 230
                 ?>
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
                         </div>
236 236
                     </label>
237 237
                     <div class="gd-cf-input-wrap">
238
-                        <input type="text" name="admin_desc" id="admin_desc" value="<?php echo $value;?>"/>
238
+                        <input type="text" name="admin_desc" id="admin_desc" value="<?php echo $value; ?>"/>
239 239
                     </div>
240 240
                 </li>
241 241
                 <?php
@@ -244,26 +244,26 @@  discard block
 block discarded – undo
244 244
 
245 245
 
246 246
             // htmlvar_name
247
-            if(has_filter("geodir_cfa_htmlvar_name_{$field_type}")){
247
+            if (has_filter("geodir_cfa_htmlvar_name_{$field_type}")) {
248 248
 
249
-                echo apply_filters("geodir_cfa_htmlvar_name_{$field_type}",'',$result_str,$cf,$field_info);
249
+                echo apply_filters("geodir_cfa_htmlvar_name_{$field_type}", '', $result_str, $cf, $field_info);
250 250
 
251
-            }else{
251
+            } else {
252 252
                 $value = '';
253 253
                 if (isset($field_info->htmlvar_name)) {
254 254
                     $value = esc_attr($field_info->htmlvar_name);
255
-                }elseif(isset($cf['defaults']['htmlvar_name']) && $cf['defaults']['htmlvar_name']){
255
+                }elseif (isset($cf['defaults']['htmlvar_name']) && $cf['defaults']['htmlvar_name']) {
256 256
                     $value = $cf['defaults']['htmlvar_name'];
257 257
                 }
258 258
                 ?>
259 259
                 <li>
260
-                    <label for="htmlvar_name" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('HTML variable name :', 'geodirectory');?>
260
+                    <label for="htmlvar_name" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('HTML variable name :', 'geodirectory'); ?>
261 261
                         <div class="gdcf-tooltip">
262 262
                             <?php _e('This is a unique identifier used in the HTML, it MUST NOT contain spaces or special characters.', 'geodirectory'); ?>
263 263
                         </div>
264 264
                     </label>
265 265
                     <div class="gd-cf-input-wrap">
266
-                        <input type="text" name="htmlvar_name" id="htmlvar_name" pattern="[a-zA-Z0-9]+" title="<?php _e('Must not contain spaces or special characters', 'geodirectory');?>"
266
+                        <input type="text" name="htmlvar_name" id="htmlvar_name" pattern="[a-zA-Z0-9]+" title="<?php _e('Must not contain spaces or special characters', 'geodirectory'); ?>"
267 267
                                value="<?php if ($value) {
268 268
                                    echo preg_replace('/geodir_/', '', $value, 1);
269 269
                                }?>" <?php if ($default) {
@@ -276,15 +276,15 @@  discard block
 block discarded – undo
276 276
 
277 277
 
278 278
             // is_active
279
-            if(has_filter("geodir_cfa_is_active_{$field_type}")){
279
+            if (has_filter("geodir_cfa_is_active_{$field_type}")) {
280 280
 
281
-                echo apply_filters("geodir_cfa_is_active_{$field_type}",'',$result_str,$cf,$field_info);
281
+                echo apply_filters("geodir_cfa_is_active_{$field_type}", '', $result_str, $cf, $field_info);
282 282
 
283
-            }else{
283
+            } else {
284 284
                 $value = '';
285 285
                 if (isset($field_info->is_active)) {
286 286
                     $value = esc_attr($field_info->is_active);
287
-                }elseif(isset($cf['defaults']['is_active']) && $cf['defaults']['is_active']){
287
+                }elseif (isset($cf['defaults']['is_active']) && $cf['defaults']['is_active']) {
288 288
                     $value = $cf['defaults']['is_active'];
289 289
                 }
290 290
                 ?>
@@ -296,17 +296,17 @@  discard block
 block discarded – undo
296 296
                     </label>
297 297
                     <div class="gd-cf-input-wrap gd-switch">
298 298
 
299
-                        <input type="radio" id="is_active_yes<?php echo $radio_id;?>" name="is_active" class="gdri-enabled"  value="1"
299
+                        <input type="radio" id="is_active_yes<?php echo $radio_id; ?>" name="is_active" class="gdri-enabled"  value="1"
300 300
                             <?php if ($value == '1') {
301 301
                                 echo 'checked';
302 302
                             } ?>/>
303
-                        <label for="is_active_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
303
+                        <label for="is_active_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
304 304
 
305
-                        <input type="radio" id="is_active_no<?php echo $radio_id;?>" name="is_active" class="gdri-disabled" value="0"
305
+                        <input type="radio" id="is_active_no<?php echo $radio_id; ?>" name="is_active" class="gdri-disabled" value="0"
306 306
                             <?php if ($value == '0' || !$value) {
307 307
                                 echo 'checked';
308 308
                             } ?>/>
309
-                        <label for="is_active_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
309
+                        <label for="is_active_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
310 310
 
311 311
                     </div>
312 312
                 </li>
@@ -315,15 +315,15 @@  discard block
 block discarded – undo
315 315
 
316 316
 
317 317
             // for_admin_use
318
-            if(has_filter("geodir_cfa_for_admin_use_{$field_type}")){
318
+            if (has_filter("geodir_cfa_for_admin_use_{$field_type}")) {
319 319
 
320
-                echo apply_filters("geodir_cfa_for_admin_use_{$field_type}",'',$result_str,$cf,$field_info);
320
+                echo apply_filters("geodir_cfa_for_admin_use_{$field_type}", '', $result_str, $cf, $field_info);
321 321
 
322
-            }else{
322
+            } else {
323 323
                 $value = '';
324 324
                 if (isset($field_info->for_admin_use)) {
325 325
                     $value = esc_attr($field_info->for_admin_use);
326
-                }elseif(isset($cf['defaults']['for_admin_use']) && $cf['defaults']['for_admin_use']){
326
+                }elseif (isset($cf['defaults']['for_admin_use']) && $cf['defaults']['for_admin_use']) {
327 327
                     $value = $cf['defaults']['for_admin_use'];
328 328
                 }
329 329
                 ?>
@@ -335,17 +335,17 @@  discard block
 block discarded – undo
335 335
                     </label>
336 336
                     <div class="gd-cf-input-wrap gd-switch">
337 337
 
338
-                        <input type="radio" id="for_admin_use_yes<?php echo $radio_id;?>" name="for_admin_use" class="gdri-enabled"  value="1"
338
+                        <input type="radio" id="for_admin_use_yes<?php echo $radio_id; ?>" name="for_admin_use" class="gdri-enabled"  value="1"
339 339
                             <?php if ($value == '1') {
340 340
                                 echo 'checked';
341 341
                             } ?>/>
342
-                        <label for="for_admin_use_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
342
+                        <label for="for_admin_use_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
343 343
 
344
-                        <input type="radio" id="for_admin_use_no<?php echo $radio_id;?>" name="for_admin_use" class="gdri-disabled" value="0"
344
+                        <input type="radio" id="for_admin_use_no<?php echo $radio_id; ?>" name="for_admin_use" class="gdri-disabled" value="0"
345 345
                             <?php if ($value == '0' || !$value) {
346 346
                                 echo 'checked';
347 347
                             } ?>/>
348
-                        <label for="for_admin_use_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
348
+                        <label for="for_admin_use_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
349 349
 
350 350
                     </div>
351 351
                 </li>
@@ -354,20 +354,20 @@  discard block
 block discarded – undo
354 354
 
355 355
 
356 356
             // default_value
357
-            if(has_filter("geodir_cfa_default_value_{$field_type}")){
357
+            if (has_filter("geodir_cfa_default_value_{$field_type}")) {
358 358
 
359
-                echo apply_filters("geodir_cfa_default_value_{$field_type}",'',$result_str,$cf,$field_info);
359
+                echo apply_filters("geodir_cfa_default_value_{$field_type}", '', $result_str, $cf, $field_info);
360 360
 
361
-            }else{
361
+            } else {
362 362
                 $value = '';
363 363
                 if (isset($field_info->default_value)) {
364 364
                     $value = esc_attr($field_info->default_value);
365
-                }elseif(isset($cf['defaults']['default_value']) && $cf['defaults']['default_value']){
365
+                }elseif (isset($cf['defaults']['default_value']) && $cf['defaults']['default_value']) {
366 366
                     $value = $cf['defaults']['default_value'];
367 367
                 }
368 368
                 ?>
369 369
                 <li>
370
-                    <label for="default_value" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Default value :', 'geodirectory');?>
370
+                    <label for="default_value" class="gd-cf-tooltip-wrap"><i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Default value :', 'geodirectory'); ?>
371 371
                         <div class="gdcf-tooltip">
372 372
                             <?php
373 373
                             if ($field_type == 'checkbox') {
@@ -384,12 +384,12 @@  discard block
 block discarded – undo
384 384
                         <?php if ($field_type == 'checkbox') { ?>
385 385
                             <select name="default_value" id="default_value">
386 386
                                 <option value=""><?php _e('Unchecked', 'geodirectory'); ?></option>
387
-                                <option value="1" <?php selected(true, (int)$value === 1);?>><?php _e('Checked', 'geodirectory'); ?></option>
387
+                                <option value="1" <?php selected(true, (int) $value === 1); ?>><?php _e('Checked', 'geodirectory'); ?></option>
388 388
                             </select>
389 389
                         <?php } else if ($field_type == 'email') { ?>
390
-                            <input type="email" name="default_value" placeholder="<?php _e('[email protected]', 'geodirectory') ;?>" id="default_value" value="<?php echo esc_attr($value);?>" /><br/>
390
+                            <input type="email" name="default_value" placeholder="<?php _e('[email protected]', 'geodirectory'); ?>" id="default_value" value="<?php echo esc_attr($value); ?>" /><br/>
391 391
                         <?php } else { ?>
392
-                            <input type="text" name="default_value" id="default_value" value="<?php echo esc_attr($value);?>" /><br/>
392
+                            <input type="text" name="default_value" id="default_value" value="<?php echo esc_attr($value); ?>" /><br/>
393 393
                         <?php } ?>
394 394
                     </div>
395 395
                 </li>
@@ -398,15 +398,15 @@  discard block
 block discarded – undo
398 398
 
399 399
 
400 400
             // show_in
401
-            if(has_filter("geodir_cfa_show_in_{$field_type}")){
401
+            if (has_filter("geodir_cfa_show_in_{$field_type}")) {
402 402
 
403
-                echo apply_filters("geodir_cfa_show_in_{$field_type}",'',$result_str,$cf,$field_info);
403
+                echo apply_filters("geodir_cfa_show_in_{$field_type}", '', $result_str, $cf, $field_info);
404 404
 
405
-            }else{
405
+            } else {
406 406
                 $value = '';
407 407
                 if (isset($field_info->show_in)) {
408 408
                     $value = esc_attr($field_info->show_in);
409
-                }elseif(isset($cf['defaults']['show_in']) && $cf['defaults']['show_in']){
409
+                }elseif (isset($cf['defaults']['show_in']) && $cf['defaults']['show_in']) {
410 410
                     $value = esc_attr($cf['defaults']['show_in']);
411 411
                 }
412 412
                 ?>
@@ -439,18 +439,18 @@  discard block
 block discarded – undo
439 439
                          * @param object $field_info The field being displayed info.
440 440
                          * @param string $field_info The type of field.
441 441
                          */
442
-                        $show_in_locations = apply_filters('geodir_show_in_locations',$show_in_locations,$field_info,$field_type);
442
+                        $show_in_locations = apply_filters('geodir_show_in_locations', $show_in_locations, $field_info, $field_type);
443 443
 
444 444
 
445 445
                         // remove some locations for some field types
446 446
 
447 447
                         // don't show new tab option for some types
448
-                        if (in_array($field_type, array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file','address','taxonomy'))) {
449
-                        }else{
448
+                        if (in_array($field_type, array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file', 'address', 'taxonomy'))) {
449
+                        } else {
450 450
                             unset($show_in_locations['[owntab]']);
451 451
                         }
452 452
 
453
-                        if(!$display_on_listing){
453
+                        if (!$display_on_listing) {
454 454
                             unset($show_in_locations['[listings]']);
455 455
                         }
456 456
 
@@ -464,17 +464,17 @@  discard block
 block discarded – undo
464 464
                                 option-ajaxchosen="false">
465 465
                             <?php
466 466
 
467
-                            $show_in_values = explode(',',$value);
467
+                            $show_in_values = explode(',', $value);
468 468
 
469
-                            foreach( $show_in_locations as $key => $val){
469
+                            foreach ($show_in_locations as $key => $val) {
470 470
                                 $selected = '';
471 471
 
472
-                                if(is_array($show_in_values) && in_array($key,$show_in_values ) ){
472
+                                if (is_array($show_in_values) && in_array($key, $show_in_values)) {
473 473
                                     $selected = 'selected';
474 474
                                 }
475 475
 
476 476
                                 ?>
477
-                                <option  value="<?php echo $key;?>" <?php echo $selected;?>><?php echo $val;?></option>
477
+                                <option  value="<?php echo $key; ?>" <?php echo $selected; ?>><?php echo $val; ?></option>
478 478
                                 <?php
479 479
                             }
480 480
                             ?>
@@ -486,9 +486,9 @@  discard block
 block discarded – undo
486 486
 
487 487
 
488 488
             // advanced_editor
489
-            if(has_filter("geodir_cfa_advanced_editor_{$field_type}")){
489
+            if (has_filter("geodir_cfa_advanced_editor_{$field_type}")) {
490 490
 
491
-                echo apply_filters("geodir_cfa_advanced_editor_{$field_type}",'',$result_str,$cf,$field_info);
491
+                echo apply_filters("geodir_cfa_advanced_editor_{$field_type}", '', $result_str, $cf, $field_info);
492 492
 
493 493
             }
494 494
 
@@ -499,10 +499,10 @@  discard block
 block discarded – undo
499 499
 
500 500
 
501 501
             <?php // @todo this does not seem to be used for anything, it can be removed or replaced ?>
502
-            <input type="hidden" name="clabels" id="clabels" value="<?php if (isset($field_info->clabels)) { echo esc_attr($field_info->clabels);} ?>"/>
502
+            <input type="hidden" name="clabels" id="clabels" value="<?php if (isset($field_info->clabels)) { echo esc_attr($field_info->clabels); } ?>"/>
503 503
 
504 504
             <?php // we dont need to show the sort order ?>
505
-            <input type="hidden" readonly="readonly" name="sort_order" id="sort_order" value="<?php if (isset($field_info->sort_order)) { echo esc_attr($field_info->sort_order);} ?>"/>
505
+            <input type="hidden" readonly="readonly" name="sort_order" id="sort_order" value="<?php if (isset($field_info->sort_order)) { echo esc_attr($field_info->sort_order); } ?>"/>
506 506
 
507 507
 
508 508
 
@@ -555,15 +555,15 @@  discard block
 block discarded – undo
555 555
             <?php
556 556
 
557 557
             // is_required
558
-            if(has_filter("geodir_cfa_is_required_{$field_type}")){
558
+            if (has_filter("geodir_cfa_is_required_{$field_type}")) {
559 559
 
560
-                echo apply_filters("geodir_cfa_is_required_{$field_type}",'',$result_str,$cf,$field_info);
560
+                echo apply_filters("geodir_cfa_is_required_{$field_type}", '', $result_str, $cf, $field_info);
561 561
 
562
-            }else{
562
+            } else {
563 563
                 $value = '';
564 564
                 if (isset($field_info->is_required)) {
565 565
                     $value = esc_attr($field_info->is_required);
566
-                }elseif(isset($cf['defaults']['is_required']) && $cf['defaults']['is_required']){
566
+                }elseif (isset($cf['defaults']['is_required']) && $cf['defaults']['is_required']) {
567 567
                     $value = $cf['defaults']['is_required'];
568 568
                 }
569 569
                 ?>
@@ -576,17 +576,17 @@  discard block
 block discarded – undo
576 576
 
577 577
                     <div class="gd-cf-input-wrap gd-switch">
578 578
 
579
-                        <input type="radio" id="is_required_yes<?php echo $radio_id;?>" name="is_required" class="gdri-enabled"  value="1"
579
+                        <input type="radio" id="is_required_yes<?php echo $radio_id; ?>" name="is_required" class="gdri-enabled"  value="1"
580 580
                             <?php if ($value == '1') {
581 581
                                 echo 'checked';
582 582
                             } ?>/>
583
-                        <label onclick="show_hide_radio(this,'show','cf-is-required-msg');" for="is_required_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
583
+                        <label onclick="show_hide_radio(this,'show','cf-is-required-msg');" for="is_required_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
584 584
 
585
-                        <input type="radio" id="is_required_no<?php echo $radio_id;?>" name="is_required" class="gdri-disabled" value="0"
585
+                        <input type="radio" id="is_required_no<?php echo $radio_id; ?>" name="is_required" class="gdri-disabled" value="0"
586 586
                             <?php if ($value == '0' || !$value) {
587 587
                                 echo 'checked';
588 588
                             } ?>/>
589
-                        <label onclick="show_hide_radio(this,'hide','cf-is-required-msg');" for="is_required_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
589
+                        <label onclick="show_hide_radio(this,'hide','cf-is-required-msg');" for="is_required_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
590 590
 
591 591
                     </div>
592 592
 
@@ -596,19 +596,19 @@  discard block
 block discarded – undo
596 596
             }
597 597
 
598 598
             // required_msg
599
-            if(has_filter("geodir_cfa_required_msg_{$field_type}")){
599
+            if (has_filter("geodir_cfa_required_msg_{$field_type}")) {
600 600
 
601
-                echo apply_filters("geodir_cfa_required_msg_{$field_type}",'',$result_str,$cf,$field_info);
601
+                echo apply_filters("geodir_cfa_required_msg_{$field_type}", '', $result_str, $cf, $field_info);
602 602
 
603
-            }else{
603
+            } else {
604 604
                 $value = '';
605 605
                 if (isset($field_info->required_msg)) {
606 606
                     $value = esc_attr($field_info->required_msg);
607
-                }elseif(isset($cf['defaults']['required_msg']) && $cf['defaults']['required_msg']){
607
+                }elseif (isset($cf['defaults']['required_msg']) && $cf['defaults']['required_msg']) {
608 608
                     $value = $cf['defaults']['required_msg'];
609 609
                 }
610 610
                 ?>
611
-                <li class="cf-is-required-msg" <?php if ((isset($field_info->is_required) && $field_info->is_required == '0') || !isset($field_info->is_required)) {echo "style='display:none;'";}?>>
611
+                <li class="cf-is-required-msg" <?php if ((isset($field_info->is_required) && $field_info->is_required == '0') || !isset($field_info->is_required)) {echo "style='display:none;'"; }?>>
612 612
                     <label for="required_msg" class="gd-cf-tooltip-wrap">
613 613
                         <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Required message:', 'geodirectory'); ?>
614 614
                         <div class="gdcf-tooltip">
@@ -625,31 +625,31 @@  discard block
 block discarded – undo
625 625
 
626 626
 
627 627
             // required_msg
628
-            if(has_filter("geodir_cfa_validation_pattern_{$field_type}")){
628
+            if (has_filter("geodir_cfa_validation_pattern_{$field_type}")) {
629 629
 
630
-                echo apply_filters("geodir_cfa_validation_pattern_{$field_type}",'',$result_str,$cf,$field_info);
630
+                echo apply_filters("geodir_cfa_validation_pattern_{$field_type}", '', $result_str, $cf, $field_info);
631 631
 
632 632
             }
633 633
 
634 634
 
635 635
             // extra_fields
636
-            if(has_filter("geodir_cfa_extra_fields_{$field_type}")){
636
+            if (has_filter("geodir_cfa_extra_fields_{$field_type}")) {
637 637
 
638
-                echo apply_filters("geodir_cfa_extra_fields_{$field_type}",'',$result_str,$cf,$field_info);
638
+                echo apply_filters("geodir_cfa_extra_fields_{$field_type}", '', $result_str, $cf, $field_info);
639 639
 
640 640
             }
641 641
 
642 642
 
643 643
             // field_icon
644
-            if(has_filter("geodir_cfa_field_icon_{$field_type}")){
644
+            if (has_filter("geodir_cfa_field_icon_{$field_type}")) {
645 645
 
646
-                echo apply_filters("geodir_cfa_field_icon_{$field_type}",'',$result_str,$cf,$field_info);
646
+                echo apply_filters("geodir_cfa_field_icon_{$field_type}", '', $result_str, $cf, $field_info);
647 647
 
648
-            }else{
648
+            } else {
649 649
                 $value = '';
650 650
                 if (isset($field_info->field_icon)) {
651 651
                     $value = esc_attr($field_info->field_icon);
652
-                }elseif(isset($cf['defaults']['field_icon']) && $cf['defaults']['field_icon']){
652
+                }elseif (isset($cf['defaults']['field_icon']) && $cf['defaults']['field_icon']) {
653 653
                     $value = $cf['defaults']['field_icon'];
654 654
                 }
655 655
                 ?>
@@ -660,12 +660,12 @@  discard block
 block discarded – undo
660 660
                     <label for="field_icon" class="gd-cf-tooltip-wrap">
661 661
                         <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Upload icon :', 'geodirectory'); ?>
662 662
                         <div class="gdcf-tooltip">
663
-                            <?php _e('Upload icon using media and enter its url path, or enter <a href="http://fortawesome.github.io/Font-Awesome/icons/" target="_blank" >font awesome </a>class eg:"fa fa-home"', 'geodirectory');?>
663
+                            <?php _e('Upload icon using media and enter its url path, or enter <a href="http://fortawesome.github.io/Font-Awesome/icons/" target="_blank" >font awesome </a>class eg:"fa fa-home"', 'geodirectory'); ?>
664 664
                         </div>
665 665
                     </label>
666 666
                     <div class="gd-cf-input-wrap">
667 667
                         <input type="text" name="field_icon" id="field_icon"
668
-                               value="<?php echo $value;?>"/>
668
+                               value="<?php echo $value; ?>"/>
669 669
                     </div>
670 670
 
671 671
                 </li>
@@ -674,15 +674,15 @@  discard block
 block discarded – undo
674 674
 
675 675
 
676 676
             // css_class
677
-            if(has_filter("geodir_cfa_css_class_{$field_type}")){
677
+            if (has_filter("geodir_cfa_css_class_{$field_type}")) {
678 678
 
679
-                echo apply_filters("geodir_cfa_css_class_{$field_type}",'',$result_str,$cf,$field_info);
679
+                echo apply_filters("geodir_cfa_css_class_{$field_type}", '', $result_str, $cf, $field_info);
680 680
 
681
-            }else{
681
+            } else {
682 682
                 $value = '';
683 683
                 if (isset($field_info->css_class)) {
684 684
                     $value = esc_attr($field_info->css_class);
685
-                }elseif(isset($cf['defaults']['css_class']) && $cf['defaults']['css_class']){
685
+                }elseif (isset($cf['defaults']['css_class']) && $cf['defaults']['css_class']) {
686 686
                     $value = $cf['defaults']['css_class'];
687 687
                 }
688 688
                 ?>
@@ -691,8 +691,8 @@  discard block
 block discarded – undo
691 691
                     <label for="css_class" class="gd-cf-tooltip-wrap">
692 692
                         <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Css class :', 'geodirectory'); ?>
693 693
                         <div class="gdcf-tooltip">
694
-                            <?php _e('Enter custom css class for field custom style.', 'geodirectory');?>
695
-                            <?php if($field_type=='multiselect'){_e('(Enter class `gd-comma-list` to show list as comma separated)', 'geodirectory');}?>
694
+                            <?php _e('Enter custom css class for field custom style.', 'geodirectory'); ?>
695
+                            <?php if ($field_type == 'multiselect') {_e('(Enter class `gd-comma-list` to show list as comma separated)', 'geodirectory'); }?>
696 696
                         </div>
697 697
                     </label>
698 698
                     <div class="gd-cf-input-wrap">
@@ -707,23 +707,23 @@  discard block
 block discarded – undo
707 707
 
708 708
 
709 709
             // cat_sort
710
-            if(has_filter("geodir_cfa_cat_sort_{$field_type}")){
710
+            if (has_filter("geodir_cfa_cat_sort_{$field_type}")) {
711 711
 
712
-                echo apply_filters("geodir_cfa_cat_sort_{$field_type}",'',$result_str,$cf,$field_info);
712
+                echo apply_filters("geodir_cfa_cat_sort_{$field_type}", '', $result_str, $cf, $field_info);
713 713
 
714
-            }else{
714
+            } else {
715 715
                 $value = '';
716
-                $hide_cat_sort  ='';
716
+                $hide_cat_sort = '';
717 717
                 if (isset($field_info->cat_sort)) {
718 718
                     $value = esc_attr($field_info->cat_sort);
719
-                }elseif(isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort']){
719
+                }elseif (isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort']) {
720 720
                     $value = $cf['defaults']['cat_sort'];
721
-                    $hide_cat_sort = ($value===false) ? "style='display:none;'" : '';
721
+                    $hide_cat_sort = ($value === false) ? "style='display:none;'" : '';
722 722
                 }
723 723
 
724
-                $hide_cat_sort = (isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort']===false) ? "style='display:none;'" : '';
724
+                $hide_cat_sort = (isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort'] === false) ? "style='display:none;'" : '';
725 725
                 ?>
726
-                <li <?php echo $hide_cat_sort ;?>>
726
+                <li <?php echo $hide_cat_sort; ?>>
727 727
                     <h3><?php
728 728
                         /**
729 729
                          * Filter the section title.
@@ -742,23 +742,23 @@  discard block
 block discarded – undo
742 742
                     <label for="cat_sort" class="gd-cf-tooltip-wrap">
743 743
                         <i class="fa fa-info-circle" aria-hidden="true"></i> <?php _e('Include this field in sorting options :', 'geodirectory'); ?>
744 744
                         <div class="gdcf-tooltip">
745
-                            <?php _e('Lets you use this filed as a sorting option, set from sorting options above.', 'geodirectory');?>
745
+                            <?php _e('Lets you use this filed as a sorting option, set from sorting options above.', 'geodirectory'); ?>
746 746
                         </div>
747 747
                     </label>
748 748
 
749 749
                     <div class="gd-cf-input-wrap gd-switch">
750 750
 
751
-                        <input type="radio" id="cat_sort_yes<?php echo $radio_id;?>" name="cat_sort" class="gdri-enabled"  value="1"
751
+                        <input type="radio" id="cat_sort_yes<?php echo $radio_id; ?>" name="cat_sort" class="gdri-enabled"  value="1"
752 752
                             <?php if ($value == '1') {
753 753
                                 echo 'checked';
754 754
                             } ?>/>
755
-                        <label for="cat_sort_yes<?php echo $radio_id;?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
755
+                        <label for="cat_sort_yes<?php echo $radio_id; ?>" class="gdcb-enable"><span><?php _e('Yes', 'geodirectory'); ?></span></label>
756 756
 
757
-                        <input type="radio" id="cat_sort_no<?php echo $radio_id;?>" name="cat_sort" class="gdri-disabled" value="0"
757
+                        <input type="radio" id="cat_sort_no<?php echo $radio_id; ?>" name="cat_sort" class="gdri-disabled" value="0"
758 758
                             <?php if (!$value) {
759 759
                                 echo 'checked';
760 760
                             } ?>/>
761
-                        <label for="cat_sort_no<?php echo $radio_id;?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
761
+                        <label for="cat_sort_no<?php echo $radio_id; ?>" class="gdcb-disable"><span><?php _e('No', 'geodirectory'); ?></span></label>
762 762
 
763 763
                     </div>
764 764
                 </li>
@@ -785,7 +785,7 @@  discard block
 block discarded – undo
785 785
                      * @param object $field_info The current fields info.
786 786
                      * @param array $cf The custom field settings
787 787
                      */
788
-                    do_action('geodir_advance_custom_fields', $field_info,$cf);?>
788
+                    do_action('geodir_advance_custom_fields', $field_info, $cf); ?>
789 789
 
790 790
 
791 791
                 <?php endswitch; ?>
@@ -797,10 +797,10 @@  discard block
 block discarded – undo
797 797
                     <h3></h3>
798 798
                 </label>
799 799
                 <div class="gd-cf-input-wrap">
800
-                    <input type="button" class="button button-primary" name="save" id="save" value="<?php echo esc_attr(__('Save','geodirectory'));?>"
800
+                    <input type="button" class="button button-primary" name="save" id="save" value="<?php echo esc_attr(__('Save', 'geodirectory')); ?>"
801 801
                            onclick="save_field('<?php echo esc_attr($result_str); ?>')"/>
802 802
                     <?php if (!$default): ?>
803
-                        <a href="javascript:void(0)"><input type="button" name="delete" value="<?php echo esc_attr(__('Delete','geodirectory'));?>"
803
+                        <a href="javascript:void(0)"><input type="button" name="delete" value="<?php echo esc_attr(__('Delete', 'geodirectory')); ?>"
804 804
                                                             onclick="delete_field('<?php echo esc_attr($result_str); ?>', '<?php echo $nonce; ?>')"
805 805
                                                             class="button"/></a>
806 806
                     <?php endif; ?>
Please login to merge, or discard this patch.
Braces   +43 added lines, -38 removed lines patch added patch discarded remove patch
@@ -19,8 +19,9 @@  discard block
 block discarded – undo
19 19
 
20 20
 if (!isset($field_info->post_type)) {
21 21
     $post_type = sanitize_text_field($_REQUEST['listing_type']);
22
-} else
23
-    $post_type = $field_info->post_type;
22
+} else {
23
+    $post_type = $field_info->post_type;
24
+}
24 25
 
25 26
 //if(isset($_REQUEST['custom_type']) && $_REQUEST['custom_type']=='predefined'){
26 27
 //    $cf_arr = geodir_custom_fields_predefined($post_type);
@@ -47,8 +48,9 @@  discard block
 block discarded – undo
47 48
 $nonce = wp_create_nonce('custom_fields_' . $result_str);
48 49
 
49 50
 $field_admin_title = '';
50
-if (isset($field_info->admin_title))
51
-    $field_admin_title = $field_info->admin_title;
51
+if (isset($field_info->admin_title)) {
52
+    $field_admin_title = $field_info->admin_title;
53
+}
52 54
 
53 55
 $default = isset($field_info->is_admin) ? $field_info->is_admin : '';
54 56
 
@@ -69,15 +71,15 @@  discard block
 block discarded – undo
69 71
 
70 72
 if (isset($cf['icon']) && strpos($cf['icon'], 'fa fa-') !== false) {
71 73
     $field_icon = '<i class="'.$cf['icon'].'" aria-hidden="true"></i>';
72
-}elseif(isset($cf['icon']) && $cf['icon']){
74
+} elseif(isset($cf['icon']) && $cf['icon']){
73 75
     $field_icon = '<b style="background-image: url("'.$cf['icon'].'")"></b>';
74
-}else{
76
+} else{
75 77
     $field_icon = '<i class="fa fa-cog" aria-hidden="true"></i>';
76 78
 }
77 79
 
78 80
 if(isset($cf['name']) && $cf['name']){
79 81
     $field_type_name = $cf['name'];
80
-}else{
82
+} else{
81 83
     $field_type_name = $field_type;
82 84
 }
83 85
 
@@ -93,8 +95,11 @@  discard block
 block discarded – undo
93 95
 
94 96
         <?php if ($default): ?>
95 97
             <div title="<?php _e('Default field, should not be removed.', 'geodirectory'); ?>" class="handlediv move gd-default-remove"><i class="fa fa-times" aria-hidden="true"></i></div>
96
-        <?php else: ?>
97
-            <div title="<?php _e('Click to remove field', 'geodirectory'); ?>"
98
+        <?php else {
99
+	: ?>
100
+            <div title="<?php _e('Click to remove field', 'geodirectory');
101
+}
102
+?>"
98 103
                  onclick="delete_field('<?php echo $result_str; ?>', '<?php echo $nonce; ?>')"
99 104
                  class="handlediv close"><i class="fa fa-times" aria-hidden="true"></i></div>
100 105
         <?php endif;
@@ -145,11 +150,11 @@  discard block
 block discarded – undo
145 150
 
146 151
                 echo apply_filters("geodir_cfa_data_type_{$field_type}",'',$result_str,$cf,$field_info);
147 152
 
148
-            }else{
153
+            } else{
149 154
                 $value = '';
150 155
                 if (isset($field_info->data_type)) {
151 156
                     $value = esc_attr($field_info->data_type);
152
-                }elseif(isset($cf['defaults']['data_type']) && $cf['defaults']['data_type']){
157
+                } elseif(isset($cf['defaults']['data_type']) && $cf['defaults']['data_type']){
153 158
                     $value = $cf['defaults']['data_type'];
154 159
                 }
155 160
                 ?>
@@ -163,11 +168,11 @@  discard block
 block discarded – undo
163 168
 
164 169
                 echo apply_filters("geodir_cfa_admin_title_{$field_type}",'',$result_str,$cf,$field_info);
165 170
 
166
-            }else{
171
+            } else{
167 172
                 $value = '';
168 173
                 if (isset($field_info->admin_title)) {
169 174
                     $value = esc_attr($field_info->admin_title);
170
-                }elseif(isset($cf['defaults']['admin_title']) && $cf['defaults']['admin_title']){
175
+                } elseif(isset($cf['defaults']['admin_title']) && $cf['defaults']['admin_title']){
171 176
                     $value = $cf['defaults']['admin_title'];
172 177
                 }
173 178
                 ?>
@@ -192,11 +197,11 @@  discard block
 block discarded – undo
192 197
 
193 198
                 echo apply_filters("geodir_cfa_site_title_{$field_type}",'',$result_str,$cf,$field_info);
194 199
 
195
-            }else{
200
+            } else{
196 201
                 $value = '';
197 202
                 if (isset($field_info->site_title)) {
198 203
                     $value = esc_attr($field_info->site_title);
199
-                }elseif(isset($cf['defaults']['site_title']) && $cf['defaults']['site_title']){
204
+                } elseif(isset($cf['defaults']['site_title']) && $cf['defaults']['site_title']){
200 205
                     $value = $cf['defaults']['site_title'];
201 206
                 }
202 207
                 ?>
@@ -220,11 +225,11 @@  discard block
 block discarded – undo
220 225
 
221 226
                 echo apply_filters("geodir_cfa_admin_desc_{$field_type}",'',$result_str,$cf,$field_info);
222 227
 
223
-            }else{
228
+            } else{
224 229
                 $value = '';
225 230
                 if (isset($field_info->admin_desc)) {
226 231
                     $value = esc_attr($field_info->admin_desc);
227
-                }elseif(isset($cf['defaults']['admin_desc']) && $cf['defaults']['admin_desc']){
232
+                } elseif(isset($cf['defaults']['admin_desc']) && $cf['defaults']['admin_desc']){
228 233
                     $value = $cf['defaults']['admin_desc'];
229 234
                 }
230 235
                 ?>
@@ -248,11 +253,11 @@  discard block
 block discarded – undo
248 253
 
249 254
                 echo apply_filters("geodir_cfa_htmlvar_name_{$field_type}",'',$result_str,$cf,$field_info);
250 255
 
251
-            }else{
256
+            } else{
252 257
                 $value = '';
253 258
                 if (isset($field_info->htmlvar_name)) {
254 259
                     $value = esc_attr($field_info->htmlvar_name);
255
-                }elseif(isset($cf['defaults']['htmlvar_name']) && $cf['defaults']['htmlvar_name']){
260
+                } elseif(isset($cf['defaults']['htmlvar_name']) && $cf['defaults']['htmlvar_name']){
256 261
                     $value = $cf['defaults']['htmlvar_name'];
257 262
                 }
258 263
                 ?>
@@ -280,11 +285,11 @@  discard block
 block discarded – undo
280 285
 
281 286
                 echo apply_filters("geodir_cfa_is_active_{$field_type}",'',$result_str,$cf,$field_info);
282 287
 
283
-            }else{
288
+            } else{
284 289
                 $value = '';
285 290
                 if (isset($field_info->is_active)) {
286 291
                     $value = esc_attr($field_info->is_active);
287
-                }elseif(isset($cf['defaults']['is_active']) && $cf['defaults']['is_active']){
292
+                } elseif(isset($cf['defaults']['is_active']) && $cf['defaults']['is_active']){
288 293
                     $value = $cf['defaults']['is_active'];
289 294
                 }
290 295
                 ?>
@@ -319,11 +324,11 @@  discard block
 block discarded – undo
319 324
 
320 325
                 echo apply_filters("geodir_cfa_for_admin_use_{$field_type}",'',$result_str,$cf,$field_info);
321 326
 
322
-            }else{
327
+            } else{
323 328
                 $value = '';
324 329
                 if (isset($field_info->for_admin_use)) {
325 330
                     $value = esc_attr($field_info->for_admin_use);
326
-                }elseif(isset($cf['defaults']['for_admin_use']) && $cf['defaults']['for_admin_use']){
331
+                } elseif(isset($cf['defaults']['for_admin_use']) && $cf['defaults']['for_admin_use']){
327 332
                     $value = $cf['defaults']['for_admin_use'];
328 333
                 }
329 334
                 ?>
@@ -358,11 +363,11 @@  discard block
 block discarded – undo
358 363
 
359 364
                 echo apply_filters("geodir_cfa_default_value_{$field_type}",'',$result_str,$cf,$field_info);
360 365
 
361
-            }else{
366
+            } else{
362 367
                 $value = '';
363 368
                 if (isset($field_info->default_value)) {
364 369
                     $value = esc_attr($field_info->default_value);
365
-                }elseif(isset($cf['defaults']['default_value']) && $cf['defaults']['default_value']){
370
+                } elseif(isset($cf['defaults']['default_value']) && $cf['defaults']['default_value']){
366 371
                     $value = $cf['defaults']['default_value'];
367 372
                 }
368 373
                 ?>
@@ -402,11 +407,11 @@  discard block
 block discarded – undo
402 407
 
403 408
                 echo apply_filters("geodir_cfa_show_in_{$field_type}",'',$result_str,$cf,$field_info);
404 409
 
405
-            }else{
410
+            } else{
406 411
                 $value = '';
407 412
                 if (isset($field_info->show_in)) {
408 413
                     $value = esc_attr($field_info->show_in);
409
-                }elseif(isset($cf['defaults']['show_in']) && $cf['defaults']['show_in']){
414
+                } elseif(isset($cf['defaults']['show_in']) && $cf['defaults']['show_in']){
410 415
                     $value = esc_attr($cf['defaults']['show_in']);
411 416
                 }
412 417
                 ?>
@@ -446,7 +451,7 @@  discard block
 block discarded – undo
446 451
 
447 452
                         // don't show new tab option for some types
448 453
                         if (in_array($field_type, array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file','address','taxonomy'))) {
449
-                        }else{
454
+                        } else{
450 455
                             unset($show_in_locations['[owntab]']);
451 456
                         }
452 457
 
@@ -559,11 +564,11 @@  discard block
 block discarded – undo
559 564
 
560 565
                 echo apply_filters("geodir_cfa_is_required_{$field_type}",'',$result_str,$cf,$field_info);
561 566
 
562
-            }else{
567
+            } else{
563 568
                 $value = '';
564 569
                 if (isset($field_info->is_required)) {
565 570
                     $value = esc_attr($field_info->is_required);
566
-                }elseif(isset($cf['defaults']['is_required']) && $cf['defaults']['is_required']){
571
+                } elseif(isset($cf['defaults']['is_required']) && $cf['defaults']['is_required']){
567 572
                     $value = $cf['defaults']['is_required'];
568 573
                 }
569 574
                 ?>
@@ -600,11 +605,11 @@  discard block
 block discarded – undo
600 605
 
601 606
                 echo apply_filters("geodir_cfa_required_msg_{$field_type}",'',$result_str,$cf,$field_info);
602 607
 
603
-            }else{
608
+            } else{
604 609
                 $value = '';
605 610
                 if (isset($field_info->required_msg)) {
606 611
                     $value = esc_attr($field_info->required_msg);
607
-                }elseif(isset($cf['defaults']['required_msg']) && $cf['defaults']['required_msg']){
612
+                } elseif(isset($cf['defaults']['required_msg']) && $cf['defaults']['required_msg']){
608 613
                     $value = $cf['defaults']['required_msg'];
609 614
                 }
610 615
                 ?>
@@ -645,11 +650,11 @@  discard block
 block discarded – undo
645 650
 
646 651
                 echo apply_filters("geodir_cfa_field_icon_{$field_type}",'',$result_str,$cf,$field_info);
647 652
 
648
-            }else{
653
+            } else{
649 654
                 $value = '';
650 655
                 if (isset($field_info->field_icon)) {
651 656
                     $value = esc_attr($field_info->field_icon);
652
-                }elseif(isset($cf['defaults']['field_icon']) && $cf['defaults']['field_icon']){
657
+                } elseif(isset($cf['defaults']['field_icon']) && $cf['defaults']['field_icon']){
653 658
                     $value = $cf['defaults']['field_icon'];
654 659
                 }
655 660
                 ?>
@@ -678,11 +683,11 @@  discard block
 block discarded – undo
678 683
 
679 684
                 echo apply_filters("geodir_cfa_css_class_{$field_type}",'',$result_str,$cf,$field_info);
680 685
 
681
-            }else{
686
+            } else{
682 687
                 $value = '';
683 688
                 if (isset($field_info->css_class)) {
684 689
                     $value = esc_attr($field_info->css_class);
685
-                }elseif(isset($cf['defaults']['css_class']) && $cf['defaults']['css_class']){
690
+                } elseif(isset($cf['defaults']['css_class']) && $cf['defaults']['css_class']){
686 691
                     $value = $cf['defaults']['css_class'];
687 692
                 }
688 693
                 ?>
@@ -711,12 +716,12 @@  discard block
 block discarded – undo
711 716
 
712 717
                 echo apply_filters("geodir_cfa_cat_sort_{$field_type}",'',$result_str,$cf,$field_info);
713 718
 
714
-            }else{
719
+            } else{
715 720
                 $value = '';
716 721
                 $hide_cat_sort  ='';
717 722
                 if (isset($field_info->cat_sort)) {
718 723
                     $value = esc_attr($field_info->cat_sort);
719
-                }elseif(isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort']){
724
+                } elseif(isset($cf['defaults']['cat_sort']) && $cf['defaults']['cat_sort']){
720 725
                     $value = $cf['defaults']['cat_sort'];
721 726
                     $hide_cat_sort = ($value===false) ? "style='display:none;'" : '';
722 727
                 }
Please login to merge, or discard this patch.
geodirectory-functions/map-functions/map_on_add_listing_page.php 3 patches
Indentation   +61 added lines, -61 removed lines patch added patch discarded remove patch
@@ -35,19 +35,19 @@  discard block
 block discarded – undo
35 35
 $defaultcity = isset($default_location->city) ? $default_location->city : '';
36 36
 $lat_lng_blank = false;
37 37
 if ($lat == '' && $lng == '') {
38
-    $lat_lng_blank = true;
39
-    $city = $defaultcity;
40
-    $region = isset($default_location->region) ? $default_location->region : '';
41
-    $country = isset($default_location->country) ? $default_location->country : '';
42
-    $lng = isset($default_location->city_longitude) ? $default_location->city_longitude : '';
43
-    $lat = isset($default_location->city_latitude) ? $default_location->city_latitude : '';
38
+	$lat_lng_blank = true;
39
+	$city = $defaultcity;
40
+	$region = isset($default_location->region) ? $default_location->region : '';
41
+	$country = isset($default_location->country) ? $default_location->country : '';
42
+	$lng = isset($default_location->city_longitude) ? $default_location->city_longitude : '';
43
+	$lat = isset($default_location->city_latitude) ? $default_location->city_latitude : '';
44 44
 }
45 45
 $default_lng = isset($default_location->city_longitude) ? $default_location->city_longitude : '';
46 46
 $default_lat = isset($default_location->city_latitude) ? $default_location->city_latitude : '';
47 47
 if (is_admin() && isset($_REQUEST['tab']) && $mapzoom == '') {
48
-    $mapzoom = 4;
49
-    if (isset($_REQUEST['add_hood']))
50
-        $mapzoom = 10;
48
+	$mapzoom = 4;
49
+	if (isset($_REQUEST['add_hood']))
50
+		$mapzoom = 10;
51 51
 }
52 52
 
53 53
 /**
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 	 * Fires at the start of the add javascript on the add lsitings map.
69 69
 	 *
70 70
 	 * @since 1.0.0
71
-     * @param string $prefix The prefix for all elements.
71
+	 * @param string $prefix The prefix for all elements.
72 72
 	 */
73 73
 	do_action('geodir_add_listing_js_start', $prefix);
74 74
 	?>
@@ -260,12 +260,12 @@  discard block
 block discarded – undo
260 260
             // fix for regions in GB
261 261
 
262 262
             $country_arr = <?php
263
-            /**
264
-             * Filter the regions array that uses administrative_area_level_2 instead of administrative_area_level_1.
265
-             *
266
-             * @since 1.6.16
267
-             */
268
-            echo apply_filters("geodir_geocode_region_level",'["GB","ES"]');?>;
263
+			/**
264
+			 * Filter the regions array that uses administrative_area_level_2 instead of administrative_area_level_1.
265
+			 *
266
+			 * @since 1.6.16
267
+			 */
268
+			echo apply_filters("geodir_geocode_region_level",'["GB","ES"]');?>;
269 269
             if (jQuery.inArray(rr, $country_arr) !== -1) {
270 270
                 if (administrative_area_level_2.long_name) {
271 271
                     getState = administrative_area_level_2.long_name;
@@ -339,13 +339,13 @@  discard block
 block discarded – undo
339 339
                 getZip = postal_code.long_name;
340 340
             }
341 341
             <?php 
342
-            /**
343
-             * Fires to add javascript variable to use in google map.
344
-             *
345
-             * @since 1.0.0
346
-             */
347
-            do_action('geodir_add_listing_geocode_js_vars');
348
-            ?>
342
+			/**
343
+			 * Fires to add javascript variable to use in google map.
344
+			 *
345
+			 * @since 1.0.0
346
+			 */
347
+			do_action('geodir_add_listing_geocode_js_vars');
348
+			?>
349 349
             <?php if ($is_map_restrict) { ?>
350 350
             if (getCity.toLowerCase() != '<?php echo geodir_strtolower(addslashes_gpc($city));?>') {
351 351
                 alert('<?php echo addslashes_gpc(wp_sprintf(__('Please choose any address of the (%s) city only.','geodirectory'), $city));?>');
@@ -426,15 +426,15 @@  discard block
 block discarded – undo
426 426
             }
427 427
         }
428 428
         <?php
429
-        /**
430
-         * Fires when marker address updated on map.
431
-         *
432
-         * @since 1.0.0
433
-         * @param string $prefix Identifier used as a prefix for field name
434
-         */
435
-        do_action('geodir_update_marker_address', $prefix);
436
-        echo $updateMarkerAddress = ob_get_clean();
437
-        ?>
429
+		/**
430
+		 * Fires when marker address updated on map.
431
+		 *
432
+		 * @since 1.0.0
433
+		 * @param string $prefix Identifier used as a prefix for field name
434
+		 */
435
+		do_action('geodir_update_marker_address', $prefix);
436
+		echo $updateMarkerAddress = ob_get_clean();
437
+		?>
438 438
     }
439 439
     function geodir_codeAddress(set_on_map) {
440 440
         var address = jQuery('#<?php echo $prefix.'address';?>').val();
@@ -464,9 +464,9 @@  discard block
 block discarded – undo
464 464
         }
465 465
         var is_restrict = '<?php echo $is_map_restrict; ?>';
466 466
         <?php ob_start();
467
-        $defaultregion = isset($default_location->region) ? $default_location->region : '';
468
-        $defaultcountry = isset($default_location->country) ? $default_location->country : '';
469
-        ?>
467
+		$defaultregion = isset($default_location->region) ? $default_location->region : '';
468
+		$defaultcountry = isset($default_location->country) ? $default_location->country : '';
469
+		?>
470 470
         if (set_on_map && is_restrict) {
471 471
             if (zip != '' && address != '') {
472 472
                 address = address + ',' + zip;
@@ -478,12 +478,12 @@  discard block
 block discarded – undo
478 478
             if( address == city || address == region || address == country || address == zip )
479 479
                 address = '';
480 480
             <?php
481
-            if(is_admin() && isset($_REQUEST['tab'])){?>
481
+			if(is_admin() && isset($_REQUEST['tab'])){?>
482 482
             if (jQuery.trim(city) == '' || jQuery.trim(region) == '') {
483 483
                 address = '';
484 484
             }
485 485
             <?php
486
-               }?>
486
+			   }?>
487 487
 
488 488
             if (ISO2 == 'GB') {
489 489
                 address = address + ',' + city + ',' + country; // UK is funny with regions
@@ -499,15 +499,15 @@  discard block
 block discarded – undo
499 499
             address =  address.replace(",null,", ",");
500 500
         }
501 501
         <?php $codeAddress = ob_get_clean();
502
-        /**
503
-         * Filter the address variable
504
-         *
505
-         * @since 1.0.0
506
-         *
507
-         * @param string $codeAddress Row of address to use in google map.
508
-         */
509
-        echo apply_filters('geodir_codeaddress', $codeAddress);
510
-        ?>
502
+		/**
503
+		 * Filter the address variable
504
+		 *
505
+		 * @since 1.0.0
506
+		 *
507
+		 * @param string $codeAddress Row of address to use in google map.
508
+		 */
509
+		echo apply_filters('geodir_codeaddress', $codeAddress);
510
+		?>
511 511
         if (!window.gdMaps) { // No Google Map Loaded
512 512
             return;
513 513
         }
@@ -532,13 +532,13 @@  discard block
 block discarded – undo
532 532
                         updateMarkerPosition(baseMarker.getPosition());
533 533
                         //if(set_on_map && is_restrict) {
534 534
                         <?php 
535
-                        /**
536
-                         * Fires before set geocode position.
537
-                         *
538
-                         * @since 1.0.0
539
-                         */
540
-                        do_action('geodir_add_listing_codeaddress_before_geocode');
541
-                        ?>
535
+						/**
536
+						 * Fires before set geocode position.
537
+						 *
538
+						 * @since 1.0.0
539
+						 */
540
+						do_action('geodir_add_listing_codeaddress_before_geocode');
541
+						?>
542 542
                         geocodePosition(baseMarker.getPosition(), {'address': address, 'country': ISO2});
543 543
                         //}
544 544
                     } else {
@@ -584,13 +584,13 @@  discard block
 block discarded – undo
584 584
                 updateMarkerPositionOSM(baseMarker.getLatLng());
585 585
             }
586 586
             <?php 
587
-            /**
588
-             * Fires to add javascript variable to use in google map.
589
-             *
590
-             * @since 1.0.0
591
-             */
592
-            do_action('geodir_add_listing_geocode_js_vars');
593
-            ?>
587
+			/**
588
+			 * Fires to add javascript variable to use in google map.
589
+			 *
590
+			 * @since 1.0.0
591
+			 */
592
+			do_action('geodir_add_listing_geocode_js_vars');
593
+			?>
594 594
             <?php if ($is_map_restrict) { ?>
595 595
             if (getCity.toLowerCase() != '<?php echo geodir_strtolower(addslashes_gpc($city));?>') {
596 596
                 alert('<?php echo addslashes_gpc(wp_sprintf(__('Please choose any address of the (%s) city only.','geodirectory'), $city));?>');
@@ -738,7 +738,7 @@  discard block
 block discarded – undo
738 738
 <?php
739 739
 $set_button_class = 'geodir_button';
740 740
 if (is_admin())
741
-    $set_button_class = 'button-primary';
741
+	$set_button_class = 'button-primary';
742 742
 ?>
743 743
 <input type="button" id="<?php echo $prefix; ?>set_address_button" class="<?php echo $set_button_class; ?>" value="<?php esc_attr_e($map_title, 'geodirectory'); ?>" style="float:none;"/>
744 744
 <div id="<?php echo $prefix; ?>d_mouseClick"></div>
Please login to merge, or discard this patch.
Spacing   +79 added lines, -79 removed lines patch added patch discarded remove patch
@@ -82,16 +82,16 @@  discard block
 block discarded – undo
82 82
     window.gdMaps = window.gdMaps || gdMaps;
83 83
     
84 84
     user_address = false;
85
-    jQuery('#<?php echo $prefix.'address';?>').keypress(function () {
85
+    jQuery('#<?php echo $prefix.'address'; ?>').keypress(function () {
86 86
         user_address = true;
87 87
     });
88 88
 
89 89
     baseMarker = '';
90 90
     geocoder = '';
91
-    var <?php echo $prefix;?>CITY_MAP_CENTER_LAT = <?php echo ($lat) ? $lat :  '39.952484'; ?>;
92
-    var <?php echo $prefix;?>CITY_MAP_CENTER_LNG = <?php echo ($lng) ? $lng :  '-75.163786'; ?>;
93
-    <?php if($lat_lng_blank){$lat='';$lng='';}?>
94
-    var <?php echo $prefix;?>CITY_MAP_ZOOMING_FACT = <?php echo ($mapzoom) ? $mapzoom : 12;?>;
91
+    var <?php echo $prefix; ?>CITY_MAP_CENTER_LAT = <?php echo ($lat) ? $lat : '39.952484'; ?>;
92
+    var <?php echo $prefix; ?>CITY_MAP_CENTER_LNG = <?php echo ($lng) ? $lng : '-75.163786'; ?>;
93
+    <?php if ($lat_lng_blank) {$lat = ''; $lng = ''; }?>
94
+    var <?php echo $prefix; ?>CITY_MAP_ZOOMING_FACT = <?php echo ($mapzoom) ? $mapzoom : 12; ?>;
95 95
     var minZoomLevel = <?php echo ($is_map_restrict) ? 5 : 0; ?>;
96 96
     var oldstr_address;
97 97
     var oldstr_zip;
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
              *
266 266
              * @since 1.6.16
267 267
              */
268
-            echo apply_filters("geodir_geocode_region_level",'["GB","ES"]');?>;
268
+            echo apply_filters("geodir_geocode_region_level", '["GB","ES"]'); ?>;
269 269
             if (jQuery.inArray(rr, $country_arr) !== -1) {
270 270
                 if (administrative_area_level_2.long_name) {
271 271
                     getState = administrative_area_level_2.long_name;
@@ -347,9 +347,9 @@  discard block
 block discarded – undo
347 347
             do_action('geodir_add_listing_geocode_js_vars');
348 348
             ?>
349 349
             <?php if ($is_map_restrict) { ?>
350
-            if (getCity.toLowerCase() != '<?php echo geodir_strtolower(addslashes_gpc($city));?>') {
351
-                alert('<?php echo addslashes_gpc(wp_sprintf(__('Please choose any address of the (%s) city only.','geodirectory'), $city));?>');
352
-                jQuery("#<?php echo $prefix.'map';?>").goMap();
350
+            if (getCity.toLowerCase() != '<?php echo geodir_strtolower(addslashes_gpc($city)); ?>') {
351
+                alert('<?php echo addslashes_gpc(wp_sprintf(__('Please choose any address of the (%s) city only.', 'geodirectory'), $city)); ?>');
352
+                jQuery("#<?php echo $prefix.'map'; ?>").goMap();
353 353
                 jQuery.goMap.map.setCenter(new google.maps.LatLng('<?php echo $default_lat; ?>', '<?php echo $default_lng; ?>'));
354 354
                 baseMarker.setPosition(new google.maps.LatLng('<?php echo $default_lat; ?>', '<?php echo $default_lng; ?>'));
355 355
                 updateMarkerPosition(baseMarker.getPosition());
@@ -358,11 +358,11 @@  discard block
 block discarded – undo
358 358
             <?php } ?>
359 359
             updateMarkerAddress(getAddress, getZip, getCity, getState, getCountry);
360 360
         } else {
361
-            updateMarkerAddress('<?php echo addslashes_gpc(__('Cannot determine address at this location.','geodirectory'));?>');
361
+            updateMarkerAddress('<?php echo addslashes_gpc(__('Cannot determine address at this location.', 'geodirectory')); ?>');
362 362
         }
363 363
     }
364 364
     function centerMap(latlng) {
365
-        jQuery("#<?php echo $prefix.'map';?>").goMap();
365
+        jQuery("#<?php echo $prefix.'map'; ?>").goMap();
366 366
         if (window.gdMaps == 'google') {
367 367
             jQuery.goMap.map.panTo(baseMarker.getPosition());
368 368
         } else if (window.gdMaps == 'osm') {
@@ -371,7 +371,7 @@  discard block
 block discarded – undo
371 371
         }
372 372
     }
373 373
     function centerMarker() {
374
-        jQuery("#<?php echo $prefix.'map';?>").goMap();
374
+        jQuery("#<?php echo $prefix.'map'; ?>").goMap();
375 375
         var center = jQuery.goMap.map.getCenter();
376 376
         if (window.gdMaps == 'google') {
377 377
             baseMarker.setPosition(center);
@@ -380,48 +380,48 @@  discard block
 block discarded – undo
380 380
         }
381 381
     }
382 382
     function updateMapZoom(zoom) {
383
-        jQuery('#<?php echo $prefix.'mapzoom';?>').val(zoom);
383
+        jQuery('#<?php echo $prefix.'mapzoom'; ?>').val(zoom);
384 384
     }
385 385
     function updateMarkerPosition(markerlatLng) {
386
-        jQuery("#<?php echo $prefix.'map';?>").goMap();
387
-        jQuery('#<?php echo $prefix.'latitude';?>').val(markerlatLng.lat());
388
-        jQuery('#<?php echo $prefix.'longitude';?>').val(markerlatLng.lng());
386
+        jQuery("#<?php echo $prefix.'map'; ?>").goMap();
387
+        jQuery('#<?php echo $prefix.'latitude'; ?>').val(markerlatLng.lat());
388
+        jQuery('#<?php echo $prefix.'longitude'; ?>').val(markerlatLng.lng());
389 389
     }
390 390
     function updateMarkerPositionOSM(markerlatLng) {
391
-        jQuery('#<?php echo $prefix.'latitude';?>').val(markerlatLng.lat);
392
-        jQuery('#<?php echo $prefix.'longitude';?>').val(markerlatLng.lng);
391
+        jQuery('#<?php echo $prefix.'latitude'; ?>').val(markerlatLng.lat);
392
+        jQuery('#<?php echo $prefix.'longitude'; ?>').val(markerlatLng.lng);
393 393
     }
394 394
     function updateMarkerAddress(getAddress, getZip, getCity, getState, getCountry) {
395
-        var set_map_val_in_fields = '<?php echo addslashes_gpc($auto_change_map_fields);?>';
396
-        <?php ob_start();?>
397
-        var old_country = jQuery("#<?php echo $prefix.'country';?>").val();
398
-        var old_region = jQuery("#<?php echo $prefix.'region';?>").val();
395
+        var set_map_val_in_fields = '<?php echo addslashes_gpc($auto_change_map_fields); ?>';
396
+        <?php ob_start(); ?>
397
+        var old_country = jQuery("#<?php echo $prefix.'country'; ?>").val();
398
+        var old_region = jQuery("#<?php echo $prefix.'region'; ?>").val();
399 399
         
400
-        if (user_address == false || jQuery('#<?php echo $prefix.'address';?>').val() == '') {
401
-            jQuery("#<?php echo $prefix.'address';?>").val(getAddress);
400
+        if (user_address == false || jQuery('#<?php echo $prefix.'address'; ?>').val() == '') {
401
+            jQuery("#<?php echo $prefix.'address'; ?>").val(getAddress);
402 402
         }
403 403
         if (getAddress) {
404 404
             oldstr_address = getAddress;
405 405
         }
406 406
 
407
-        jQuery("#<?php echo $prefix.'zip';?>").val(getZip);
407
+        jQuery("#<?php echo $prefix.'zip'; ?>").val(getZip);
408 408
         if (getZip) {
409 409
             oldstr_zip = getZip;
410 410
         }
411 411
         if (set_map_val_in_fields) {
412 412
             if (getCountry) {
413
-                jQuery('#<?php echo $prefix .'country'; ?> option[value=""]').attr("selected",false);
414
-                jQuery('#<?php echo $prefix.'country';?> option[data-country_code="' + getCountryISO + '"]').attr("selected", true);
415
-                jQuery("#<?php echo $prefix.'country';?>").trigger("chosen:updated");
413
+                jQuery('#<?php echo $prefix.'country'; ?> option[value=""]').attr("selected",false);
414
+                jQuery('#<?php echo $prefix.'country'; ?> option[data-country_code="' + getCountryISO + '"]').attr("selected", true);
415
+                jQuery("#<?php echo $prefix.'country'; ?>").trigger("chosen:updated");
416 416
             }
417 417
             if (getState) {
418
-                if (jQuery('input[id="<?php echo $prefix.'region';?>"]').attr('id')) {
419
-                    jQuery("#<?php echo $prefix.'region';?>").val(getState);
418
+                if (jQuery('input[id="<?php echo $prefix.'region'; ?>"]').attr('id')) {
419
+                    jQuery("#<?php echo $prefix.'region'; ?>").val(getState);
420 420
                 }
421 421
             }
422 422
             if (getCity) {
423
-                if (jQuery('input[id="<?php echo $prefix.'city';?>"]').attr('id')) {
424
-                    jQuery("#<?php echo $prefix.'city';?>").val(getCity);
423
+                if (jQuery('input[id="<?php echo $prefix.'city'; ?>"]').attr('id')) {
424
+                    jQuery("#<?php echo $prefix.'city'; ?>").val(getCity);
425 425
                 }
426 426
             }
427 427
         }
@@ -437,15 +437,15 @@  discard block
 block discarded – undo
437 437
         ?>
438 438
     }
439 439
     function geodir_codeAddress(set_on_map) {
440
-        var address = jQuery('#<?php echo $prefix.'address';?>').val();
441
-        var zip = jQuery('#<?php echo $prefix.'zip';?>').val();
442
-        var city = jQuery('#<?php echo $prefix.'city';?>').val();
443
-        var region = jQuery('#<?php echo $prefix.'region';?>').val();
444
-        var country = jQuery('#<?php echo $prefix.'country';?>').val();
445
-        var country_selected = jQuery('#<?php echo $prefix.'country';?>').find('option:selected');
440
+        var address = jQuery('#<?php echo $prefix.'address'; ?>').val();
441
+        var zip = jQuery('#<?php echo $prefix.'zip'; ?>').val();
442
+        var city = jQuery('#<?php echo $prefix.'city'; ?>').val();
443
+        var region = jQuery('#<?php echo $prefix.'region'; ?>').val();
444
+        var country = jQuery('#<?php echo $prefix.'country'; ?>').val();
445
+        var country_selected = jQuery('#<?php echo $prefix.'country'; ?>').find('option:selected');
446 446
         var ISO2 = country_selected.data('country_code');
447
-        if (!ISO2 && jQuery('#<?php echo $prefix.'country';?>').data('country_code')) {
448
-            ISO2 = jQuery('#<?php echo $prefix.'country';?>').data('country_code');
447
+        if (!ISO2 && jQuery('#<?php echo $prefix.'country'; ?>').data('country_code')) {
448
+            ISO2 = jQuery('#<?php echo $prefix.'country'; ?>').data('country_code');
449 449
         }
450 450
         if (ISO2 == '--') {
451 451
             ISO2 = '';
@@ -454,13 +454,13 @@  discard block
 block discarded – undo
454 454
             zip = '';
455 455
         }
456 456
         if (typeof city == "undefined") {
457
-            city = '<?php echo addslashes_gpc($city);?>';
457
+            city = '<?php echo addslashes_gpc($city); ?>';
458 458
         }
459 459
         if (typeof region == "undefined") {
460
-            region = '<?php echo addslashes_gpc($region);?>';
460
+            region = '<?php echo addslashes_gpc($region); ?>';
461 461
         }
462 462
         if (typeof country == "undefined") {
463
-            country = '<?php echo addslashes_gpc($country);?>';
463
+            country = '<?php echo addslashes_gpc($country); ?>';
464 464
         }
465 465
         var is_restrict = '<?php echo $is_map_restrict; ?>';
466 466
         <?php ob_start();
@@ -478,7 +478,7 @@  discard block
 block discarded – undo
478 478
             if( address == city || address == region || address == country || address == zip )
479 479
                 address = '';
480 480
             <?php
481
-            if(is_admin() && isset($_REQUEST['tab'])){?>
481
+            if (is_admin() && isset($_REQUEST['tab'])) {?>
482 482
             if (jQuery.trim(city) == '' || jQuery.trim(region) == '') {
483 483
                 address = '';
484 484
             }
@@ -525,7 +525,7 @@  discard block
 block discarded – undo
525 525
             geocoder.geocode({'address': address, 'country': ISO2},
526 526
                 function (results, status) {
527 527
                     console.log(status);
528
-                    jQuery("#<?php echo $prefix.'map';?>").goMap();
528
+                    jQuery("#<?php echo $prefix.'map'; ?>").goMap();
529 529
                     if (status == google.maps.GeocoderStatus.OK) {
530 530
                         baseMarker.setPosition(results[0].geometry.location);
531 531
                         jQuery.goMap.map.setCenter(results[0].geometry.location);
@@ -542,21 +542,21 @@  discard block
 block discarded – undo
542 542
                         geocodePosition(baseMarker.getPosition(), {'address': address, 'country': ISO2});
543 543
                         //}
544 544
                     } else {
545
-                        alert('<?php echo addslashes_gpc(__('Geocode was not successful for the following reason:','geodirectory'));?> ' + status);
545
+                        alert('<?php echo addslashes_gpc(__('Geocode was not successful for the following reason:', 'geodirectory')); ?> ' + status);
546 546
                     }
547 547
                 });
548 548
         }
549 549
     }
550 550
     function gdMaxMap() {
551
-        jQuery("#<?php echo $prefix.'map';?>").goMap();
551
+        jQuery("#<?php echo $prefix.'map'; ?>").goMap();
552 552
 
553
-        jQuery('#<?php echo $prefix.'map';?>').toggleClass('map-fullscreen');
553
+        jQuery('#<?php echo $prefix.'map'; ?>').toggleClass('map-fullscreen');
554 554
         jQuery('.map_category').toggleClass('map_category_fullscreen');
555
-        jQuery('#<?php echo $prefix;?>trigger').toggleClass('map_category_fullscreen');
555
+        jQuery('#<?php echo $prefix; ?>trigger').toggleClass('map_category_fullscreen');
556 556
         jQuery('body').toggleClass('body_fullscreen');
557
-        jQuery('#<?php echo $prefix;?>loading_div').toggleClass('loading_div_fullscreen');
558
-        jQuery('#<?php echo $prefix;?>advmap_nofound').toggleClass('nofound_fullscreen');
559
-        jQuery('#<?php echo $prefix;?>triggermap').toggleClass('triggermap_fullscreen');
557
+        jQuery('#<?php echo $prefix; ?>loading_div').toggleClass('loading_div_fullscreen');
558
+        jQuery('#<?php echo $prefix; ?>advmap_nofound').toggleClass('nofound_fullscreen');
559
+        jQuery('#<?php echo $prefix; ?>triggermap').toggleClass('triggermap_fullscreen');
560 560
         jQuery('.TopLeft').toggleClass('TopLeft_fullscreen');
561 561
         window.setTimeout(function () {
562 562
             if (window.gdMaps == 'google') {
@@ -592,9 +592,9 @@  discard block
 block discarded – undo
592 592
             do_action('geodir_add_listing_geocode_js_vars');
593 593
             ?>
594 594
             <?php if ($is_map_restrict) { ?>
595
-            if (getCity.toLowerCase() != '<?php echo geodir_strtolower(addslashes_gpc($city));?>') {
596
-                alert('<?php echo addslashes_gpc(wp_sprintf(__('Please choose any address of the (%s) city only.','geodirectory'), $city));?>');
597
-                jQuery("#<?php echo $prefix.'map';?>").goMap();
595
+            if (getCity.toLowerCase() != '<?php echo geodir_strtolower(addslashes_gpc($city)); ?>') {
596
+                alert('<?php echo addslashes_gpc(wp_sprintf(__('Please choose any address of the (%s) city only.', 'geodirectory'), $city)); ?>');
597
+                jQuery("#<?php echo $prefix.'map'; ?>").goMap();
598 598
                 centerMap(new L.latLng('<?php echo $default_lat; ?>', '<?php echo $default_lng; ?>'));
599 599
                 baseMarker.setLatLng(new L.latLng('<?php echo $default_lat; ?>', '<?php echo $default_lng; ?>'));
600 600
                 updateMarkerPositionOSM(baseMarker.getLatLng());
@@ -603,39 +603,39 @@  discard block
 block discarded – undo
603 603
             <?php } ?>
604 604
             updateMarkerAddress(getAddress, getZip, getCity, getState, getCountry);
605 605
         } else {
606
-            alert('<?php echo addslashes_gpc(__('Cannot determine address at this location.','geodirectory'));?>');
606
+            alert('<?php echo addslashes_gpc(__('Cannot determine address at this location.', 'geodirectory')); ?>');
607 607
         }
608 608
     }
609 609
     
610 610
     jQuery(function ($) {
611
-        $("#<?php echo $prefix.'map';?>").goMap({
612
-            latitude: <?php echo $prefix;?>CITY_MAP_CENTER_LAT,
613
-            longitude: <?php echo $prefix;?>CITY_MAP_CENTER_LNG,
614
-            zoom: <?php echo $prefix;?>CITY_MAP_ZOOMING_FACT,
611
+        $("#<?php echo $prefix.'map'; ?>").goMap({
612
+            latitude: <?php echo $prefix; ?>CITY_MAP_CENTER_LAT,
613
+            longitude: <?php echo $prefix; ?>CITY_MAP_CENTER_LNG,
614
+            zoom: <?php echo $prefix; ?>CITY_MAP_ZOOMING_FACT,
615 615
             maptype: 'ROADMAP', // Map type - HYBRID, ROADMAP, SATELLITE, TERRAIN
616 616
             streetViewControl: true,
617
-            <?php if(get_option('geodir_add_listing_mouse_scroll')) { echo 'scrollwheel: false,';}?>
617
+            <?php if (get_option('geodir_add_listing_mouse_scroll')) { echo 'scrollwheel: false,'; }?>
618 618
         });
619 619
 
620 620
         if (window.gdMaps) {
621 621
             geocoder = window.gdMaps == 'google' ? new google.maps.Geocoder() : [];
622 622
 
623 623
             baseMarker = $.goMap.createMarker({
624
-                latitude: <?php echo $prefix;?>CITY_MAP_CENTER_LAT,
625
-                longitude: <?php echo $prefix;?>CITY_MAP_CENTER_LNG,
624
+                latitude: <?php echo $prefix; ?>CITY_MAP_CENTER_LAT,
625
+                longitude: <?php echo $prefix; ?>CITY_MAP_CENTER_LNG,
626 626
                 id: 'baseMarker',
627
-                icon: '<?php echo $marker_icon;?>',
627
+                icon: '<?php echo $marker_icon; ?>',
628 628
                 draggable: true,
629 629
                 addToMap: true, // For OSM
630
-                w: parseFloat('<?php echo $icon_size['w'];?>'),
631
-                h: parseFloat('<?php echo $icon_size['h'];?>'),
630
+                w: parseFloat('<?php echo $icon_size['w']; ?>'),
631
+                h: parseFloat('<?php echo $icon_size['h']; ?>'),
632 632
             });
633 633
         } else {
634
-            jQuery('#<?php echo $prefix.'advmap_nofound';?>').hide();
635
-            jQuery('#<?php echo $prefix.'advmap_notloaded';?>').show();
634
+            jQuery('#<?php echo $prefix.'advmap_nofound'; ?>').hide();
635
+            jQuery('#<?php echo $prefix.'advmap_notloaded'; ?>').show();
636 636
         }
637 637
         
638
-        $("#<?php echo $prefix;?>set_address_button").click(function () {
638
+        $("#<?php echo $prefix; ?>set_address_button").click(function () {
639 639
             var set_on_map = true;
640 640
             geodir_codeAddress(set_on_map);
641 641
         });
@@ -669,14 +669,14 @@  discard block
 block discarded – undo
669 669
                 updateMapZoom($.goMap.map.zoom);
670 670
             });
671 671
 
672
-            var maxMap = document.getElementById('<?php echo $prefix;?>triggermap');
672
+            var maxMap = document.getElementById('<?php echo $prefix; ?>triggermap');
673 673
             google.maps.event.addDomListener(maxMap, 'click', gdMaxMap);
674 674
 
675 675
             <?php if ($is_map_restrict) { ?>
676
-            var CITY_ADDRESS = '<?php echo addslashes_gpc($city).','.addslashes_gpc($region).','.addslashes_gpc($country);?>';
676
+            var CITY_ADDRESS = '<?php echo addslashes_gpc($city).','.addslashes_gpc($region).','.addslashes_gpc($country); ?>';
677 677
             geocoder.geocode({'address': CITY_ADDRESS},
678 678
                 function (results, status) {
679
-                    $("#<?php echo $prefix.'map';?>").goMap();
679
+                    $("#<?php echo $prefix.'map'; ?>").goMap();
680 680
                     if (status == google.maps.GeocoderStatus.OK) {
681 681
                         // Bounds for North America
682 682
                         var bound_lat_lng = String(results[0].geometry.bounds);
@@ -687,13 +687,13 @@  discard block
 block discarded – undo
687 687
                             new google.maps.LatLng(bound_lat_lng[2], bound_lat_lng[3])
688 688
                         );
689 689
                     } else {
690
-                        alert("<?php _e('Geocode was not successful for the following reason:','geodirectory');?> " + status);
690
+                        alert("<?php _e('Geocode was not successful for the following reason:', 'geodirectory'); ?> " + status);
691 691
                     }
692 692
                 });
693 693
             <?php } ?>
694 694
             // Limit the zoom level
695 695
             google.maps.event.addListener($.goMap.map, 'zoom_changed', function () {
696
-                $("#<?php echo $prefix.'map';?>").goMap();
696
+                $("#<?php echo $prefix.'map'; ?>").goMap();
697 697
                 if ($.goMap.map.getZoom() < minZoomLevel) $.goMap.map.setZoom(minZoomLevel);
698 698
             });
699 699
         } else if (window.gdMaps == 'osm') {
@@ -719,10 +719,10 @@  discard block
 block discarded – undo
719 719
                 updateMapZoom($.goMap.map.getZoom());
720 720
             });
721 721
 
722
-            L.DomEvent.addListener($('<?php echo $prefix;?>triggermap'), 'click', gdMaxMap);
722
+            L.DomEvent.addListener($('<?php echo $prefix; ?>triggermap'), 'click', gdMaxMap);
723 723
 
724 724
             <?php if ($is_map_restrict) { ?>
725
-            var CITY_ADDRESS = '<?php echo addslashes_gpc($city).', '.addslashes_gpc($region).', '.addslashes_gpc($country);?>';
725
+            var CITY_ADDRESS = '<?php echo addslashes_gpc($city).', '.addslashes_gpc($region).', '.addslashes_gpc($country); ?>';
726 726
             geocodePositionOSM('', CITY_ADDRESS);
727 727
             <?php } ?>
728 728
             // Limit the zoom level
@@ -745,14 +745,14 @@  discard block
 block discarded – undo
745 745
 <div class="top_banner_section_inn geodir_map_container clearfix" style="margin-top:10px;">
746 746
     <div class="TopLeft"><span id="<?php echo $prefix; ?>triggermap" style="margin-top:-11px;margin-left:-12px;"></span></div>
747 747
     <div class="TopRight"></div>
748
-    <div id="<?php echo $prefix . 'map'; ?>" class="geodir_map" style="height:300px">
748
+    <div id="<?php echo $prefix.'map'; ?>" class="geodir_map" style="height:300px">
749 749
         <!-- new map start -->
750 750
         <div class="iprelative">
751
-            <div id="<?php echo $prefix . 'map'; ?>" style="float:right;height:300px;position:relative;" class="form_row clearfix"></div>
751
+            <div id="<?php echo $prefix.'map'; ?>" style="float:right;height:300px;position:relative;" class="form_row clearfix"></div>
752 752
             <div id="<?php echo $prefix; ?>loading_div" style="height:300px"></div>
753 753
             <div id="<?php echo $prefix; ?>advmap_counter"></div>
754 754
             <div id="<?php echo $prefix; ?>advmap_nofound"><?php echo MAP_NO_RESULTS; ?></div>
755
-            <div id="<?php echo $prefix;?>advmap_notloaded" class="advmap_notloaded"><?php _e('<h3>Map Not Loaded</h3><p>Sorry, unable to load Maps API.', 'geodirectory'); ?></div>
755
+            <div id="<?php echo $prefix; ?>advmap_notloaded" class="advmap_notloaded"><?php _e('<h3>Map Not Loaded</h3><p>Sorry, unable to load Maps API.', 'geodirectory'); ?></div>
756 756
         </div>
757 757
         <!-- new map end -->
758 758
     </div>
Please login to merge, or discard this patch.
Braces   +7 added lines, -5 removed lines patch added patch discarded remove patch
@@ -46,9 +46,10 @@  discard block
 block discarded – undo
46 46
 $default_lat = isset($default_location->city_latitude) ? $default_location->city_latitude : '';
47 47
 if (is_admin() && isset($_REQUEST['tab']) && $mapzoom == '') {
48 48
     $mapzoom = 4;
49
-    if (isset($_REQUEST['add_hood']))
50
-        $mapzoom = 10;
51
-}
49
+    if (isset($_REQUEST['add_hood'])) {
50
+            $mapzoom = 10;
51
+    }
52
+    }
52 53
 
53 54
 /**
54 55
  * Filter the auto change address fields values
@@ -737,8 +738,9 @@  discard block
 block discarded – undo
737 738
 </script>
738 739
 <?php
739 740
 $set_button_class = 'geodir_button';
740
-if (is_admin())
741
-    $set_button_class = 'button-primary';
741
+if (is_admin()) {
742
+    $set_button_class = 'button-primary';
743
+}
742 744
 ?>
743 745
 <input type="button" id="<?php echo $prefix; ?>set_address_button" class="<?php echo $set_button_class; ?>" value="<?php esc_attr_e($map_title, 'geodirectory'); ?>" style="float:none;"/>
744 746
 <div id="<?php echo $prefix; ?>d_mouseClick"></div>
Please login to merge, or discard this patch.