@@ -34,13 +34,13 @@ discard block |
||
34 | 34 | |
35 | 35 | public function __construct(Google_Client $client) |
36 | 36 | { |
37 | - if (!extension_loaded('curl')) { |
|
38 | - $error = 'The cURL IO handler requires the cURL extension to be enabled'; |
|
39 | - $client->getLogger()->critical($error); |
|
40 | - throw new Google_IO_Exception($error); |
|
41 | - } |
|
37 | + if (!extension_loaded('curl')) { |
|
38 | + $error = 'The cURL IO handler requires the cURL extension to be enabled'; |
|
39 | + $client->getLogger()->critical($error); |
|
40 | + throw new Google_IO_Exception($error); |
|
41 | + } |
|
42 | 42 | |
43 | - parent::__construct($client); |
|
43 | + parent::__construct($client); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | /** |
@@ -52,83 +52,83 @@ discard block |
||
52 | 52 | */ |
53 | 53 | public function executeRequest(Google_Http_Request $request) |
54 | 54 | { |
55 | - $curl = curl_init(); |
|
56 | - |
|
57 | - if ($request->getPostBody()) { |
|
58 | - curl_setopt($curl, CURLOPT_POSTFIELDS, $request->getPostBody()); |
|
59 | - } |
|
60 | - |
|
61 | - $requestHeaders = $request->getRequestHeaders(); |
|
62 | - if ($requestHeaders && is_array($requestHeaders)) { |
|
63 | - $curlHeaders = array(); |
|
64 | - foreach ($requestHeaders as $k => $v) { |
|
65 | - $curlHeaders[] = "$k: $v"; |
|
66 | - } |
|
67 | - curl_setopt($curl, CURLOPT_HTTPHEADER, $curlHeaders); |
|
68 | - } |
|
69 | - curl_setopt($curl, CURLOPT_URL, $request->getUrl()); |
|
70 | - |
|
71 | - curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $request->getRequestMethod()); |
|
72 | - curl_setopt($curl, CURLOPT_USERAGENT, $request->getUserAgent()); |
|
73 | - |
|
74 | - curl_setopt($curl, CURLOPT_FOLLOWLOCATION, false); |
|
75 | - curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, true); |
|
76 | - // 1 is CURL_SSLVERSION_TLSv1, which is not always defined in PHP. |
|
77 | - curl_setopt($curl, CURLOPT_SSLVERSION, 1); |
|
78 | - curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); |
|
79 | - curl_setopt($curl, CURLOPT_HEADER, true); |
|
80 | - |
|
81 | - if ($request->canGzip()) { |
|
82 | - curl_setopt($curl, CURLOPT_ENCODING, 'gzip,deflate'); |
|
83 | - } |
|
55 | + $curl = curl_init(); |
|
56 | + |
|
57 | + if ($request->getPostBody()) { |
|
58 | + curl_setopt($curl, CURLOPT_POSTFIELDS, $request->getPostBody()); |
|
59 | + } |
|
60 | + |
|
61 | + $requestHeaders = $request->getRequestHeaders(); |
|
62 | + if ($requestHeaders && is_array($requestHeaders)) { |
|
63 | + $curlHeaders = array(); |
|
64 | + foreach ($requestHeaders as $k => $v) { |
|
65 | + $curlHeaders[] = "$k: $v"; |
|
66 | + } |
|
67 | + curl_setopt($curl, CURLOPT_HTTPHEADER, $curlHeaders); |
|
68 | + } |
|
69 | + curl_setopt($curl, CURLOPT_URL, $request->getUrl()); |
|
70 | + |
|
71 | + curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $request->getRequestMethod()); |
|
72 | + curl_setopt($curl, CURLOPT_USERAGENT, $request->getUserAgent()); |
|
73 | + |
|
74 | + curl_setopt($curl, CURLOPT_FOLLOWLOCATION, false); |
|
75 | + curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, true); |
|
76 | + // 1 is CURL_SSLVERSION_TLSv1, which is not always defined in PHP. |
|
77 | + curl_setopt($curl, CURLOPT_SSLVERSION, 1); |
|
78 | + curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); |
|
79 | + curl_setopt($curl, CURLOPT_HEADER, true); |
|
80 | + |
|
81 | + if ($request->canGzip()) { |
|
82 | + curl_setopt($curl, CURLOPT_ENCODING, 'gzip,deflate'); |
|
83 | + } |
|
84 | 84 | |
85 | - $options = $this->client->getClassConfig('Google_IO_Curl', 'options'); |
|
86 | - if (is_array($options)) { |
|
87 | - $this->setOptions($options); |
|
88 | - } |
|
85 | + $options = $this->client->getClassConfig('Google_IO_Curl', 'options'); |
|
86 | + if (is_array($options)) { |
|
87 | + $this->setOptions($options); |
|
88 | + } |
|
89 | 89 | |
90 | - foreach ($this->options as $key => $var) { |
|
91 | - curl_setopt($curl, $key, $var); |
|
92 | - } |
|
93 | - |
|
94 | - if (!isset($this->options[CURLOPT_CAINFO])) { |
|
95 | - curl_setopt($curl, CURLOPT_CAINFO, dirname(__FILE__) . '/cacerts.pem'); |
|
96 | - } |
|
97 | - |
|
98 | - $this->client->getLogger()->debug( |
|
99 | - 'cURL request', |
|
100 | - array( |
|
101 | - 'url' => $request->getUrl(), |
|
102 | - 'method' => $request->getRequestMethod(), |
|
103 | - 'headers' => $requestHeaders, |
|
104 | - 'body' => $request->getPostBody() |
|
105 | - ) |
|
106 | - ); |
|
107 | - |
|
108 | - $response = curl_exec($curl); |
|
109 | - if ($response === false) { |
|
110 | - $error = curl_error($curl); |
|
111 | - $code = curl_errno($curl); |
|
112 | - $map = $this->client->getClassConfig('Google_IO_Exception', 'retry_map'); |
|
113 | - |
|
114 | - $this->client->getLogger()->error('cURL ' . $error); |
|
115 | - throw new Google_IO_Exception($error, $code, null, $map); |
|
116 | - } |
|
117 | - $headerSize = curl_getinfo($curl, CURLINFO_HEADER_SIZE); |
|
118 | - |
|
119 | - list($responseHeaders, $responseBody) = $this->parseHttpResponse($response, $headerSize); |
|
120 | - $responseCode = curl_getinfo($curl, CURLINFO_HTTP_CODE); |
|
121 | - |
|
122 | - $this->client->getLogger()->debug( |
|
123 | - 'cURL response', |
|
124 | - array( |
|
125 | - 'code' => $responseCode, |
|
126 | - 'headers' => $responseHeaders, |
|
127 | - 'body' => $responseBody, |
|
128 | - ) |
|
129 | - ); |
|
130 | - |
|
131 | - return array($responseBody, $responseHeaders, $responseCode); |
|
90 | + foreach ($this->options as $key => $var) { |
|
91 | + curl_setopt($curl, $key, $var); |
|
92 | + } |
|
93 | + |
|
94 | + if (!isset($this->options[CURLOPT_CAINFO])) { |
|
95 | + curl_setopt($curl, CURLOPT_CAINFO, dirname(__FILE__) . '/cacerts.pem'); |
|
96 | + } |
|
97 | + |
|
98 | + $this->client->getLogger()->debug( |
|
99 | + 'cURL request', |
|
100 | + array( |
|
101 | + 'url' => $request->getUrl(), |
|
102 | + 'method' => $request->getRequestMethod(), |
|
103 | + 'headers' => $requestHeaders, |
|
104 | + 'body' => $request->getPostBody() |
|
105 | + ) |
|
106 | + ); |
|
107 | + |
|
108 | + $response = curl_exec($curl); |
|
109 | + if ($response === false) { |
|
110 | + $error = curl_error($curl); |
|
111 | + $code = curl_errno($curl); |
|
112 | + $map = $this->client->getClassConfig('Google_IO_Exception', 'retry_map'); |
|
113 | + |
|
114 | + $this->client->getLogger()->error('cURL ' . $error); |
|
115 | + throw new Google_IO_Exception($error, $code, null, $map); |
|
116 | + } |
|
117 | + $headerSize = curl_getinfo($curl, CURLINFO_HEADER_SIZE); |
|
118 | + |
|
119 | + list($responseHeaders, $responseBody) = $this->parseHttpResponse($response, $headerSize); |
|
120 | + $responseCode = curl_getinfo($curl, CURLINFO_HTTP_CODE); |
|
121 | + |
|
122 | + $this->client->getLogger()->debug( |
|
123 | + 'cURL response', |
|
124 | + array( |
|
125 | + 'code' => $responseCode, |
|
126 | + 'headers' => $responseHeaders, |
|
127 | + 'body' => $responseBody, |
|
128 | + ) |
|
129 | + ); |
|
130 | + |
|
131 | + return array($responseBody, $responseHeaders, $responseCode); |
|
132 | 132 | } |
133 | 133 | |
134 | 134 | /** |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | */ |
138 | 138 | public function setOptions($options) |
139 | 139 | { |
140 | - $this->options = $options + $this->options; |
|
140 | + $this->options = $options + $this->options; |
|
141 | 141 | } |
142 | 142 | |
143 | 143 | /** |
@@ -146,12 +146,12 @@ discard block |
||
146 | 146 | */ |
147 | 147 | public function setTimeout($timeout) |
148 | 148 | { |
149 | - // Since this timeout is really for putting a bound on the time |
|
150 | - // we'll set them both to the same. If you need to specify a longer |
|
151 | - // CURLOPT_TIMEOUT, or a higher CONNECTTIMEOUT, the best thing to |
|
152 | - // do is use the setOptions method for the values individually. |
|
153 | - $this->options[CURLOPT_CONNECTTIMEOUT] = $timeout; |
|
154 | - $this->options[CURLOPT_TIMEOUT] = $timeout; |
|
149 | + // Since this timeout is really for putting a bound on the time |
|
150 | + // we'll set them both to the same. If you need to specify a longer |
|
151 | + // CURLOPT_TIMEOUT, or a higher CONNECTTIMEOUT, the best thing to |
|
152 | + // do is use the setOptions method for the values individually. |
|
153 | + $this->options[CURLOPT_CONNECTTIMEOUT] = $timeout; |
|
154 | + $this->options[CURLOPT_TIMEOUT] = $timeout; |
|
155 | 155 | } |
156 | 156 | |
157 | 157 | /** |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | */ |
161 | 161 | public function getTimeout() |
162 | 162 | { |
163 | - return $this->options[CURLOPT_TIMEOUT]; |
|
163 | + return $this->options[CURLOPT_TIMEOUT]; |
|
164 | 164 | } |
165 | 165 | |
166 | 166 | /** |
@@ -172,8 +172,8 @@ discard block |
||
172 | 172 | */ |
173 | 173 | protected function needsQuirk() |
174 | 174 | { |
175 | - $ver = curl_version(); |
|
176 | - $versionNum = $ver['version_number']; |
|
177 | - return $versionNum < Google_IO_Curl::NO_QUIRK_VERSION; |
|
175 | + $ver = curl_version(); |
|
176 | + $versionNum = $ver['version_number']; |
|
177 | + return $versionNum < Google_IO_Curl::NO_QUIRK_VERSION; |
|
178 | 178 | } |
179 | 179 | } |
@@ -22,7 +22,7 @@ discard block |
||
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_Curl extends Google_IO_Abstract |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | } |
93 | 93 | |
94 | 94 | if (!isset($this->options[CURLOPT_CAINFO])) { |
95 | - curl_setopt($curl, CURLOPT_CAINFO, dirname(__FILE__) . '/cacerts.pem'); |
|
95 | + curl_setopt($curl, CURLOPT_CAINFO, dirname(__FILE__).'/cacerts.pem'); |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | $this->client->getLogger()->debug( |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | $code = curl_errno($curl); |
112 | 112 | $map = $this->client->getClassConfig('Google_IO_Exception', 'retry_map'); |
113 | 113 | |
114 | - $this->client->getLogger()->error('cURL ' . $error); |
|
114 | + $this->client->getLogger()->error('cURL '.$error); |
|
115 | 115 | throw new Google_IO_Exception($error, $code, null, $map); |
116 | 116 | } |
117 | 117 | $headerSize = curl_getinfo($curl, CURLINFO_HEADER_SIZE); |
@@ -34,24 +34,24 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 | } |
@@ -22,7 +22,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
@@ -35,20 +35,20 @@ discard block |
||
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 |
||
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 | } |
@@ -16,7 +16,7 @@ |
||
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 |
@@ -28,19 +28,19 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 | } |
@@ -20,7 +20,7 @@ discard block |
||
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 |
||
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 |
||
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 | } |
@@ -1,12 +1,12 @@ discard block |
||
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 |
||
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 |
@@ -46,17 +46,13 @@ |
||
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 |
@@ -7,61 +7,61 @@ discard block |
||
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("′", "⁄", "–", "“", ''); |
|
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("′", "⁄", "–", "“", ''); |
|
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 |
||
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("'", "/", "-", '"', '\\', '''); |
|
88 | - $replarr = array("′", "⁄", "–", "“", '', "′"); |
|
87 | + $srcharr = array("'", "/", "-", '"', '\\', '''); |
|
88 | + $replarr = array("′", "⁄", "–", "“", '', "′"); |
|
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 |
||
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 |
||
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 |
||
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 |
@@ -12,7 +12,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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"}]'; |
@@ -111,11 +111,13 @@ discard block |
||
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 |
||
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 |
||
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 |
@@ -16,100 +16,100 @@ |
||
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 |
@@ -37,23 +37,23 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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) { |
@@ -46,23 +46,26 @@ discard block |
||
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 |
||
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])) { |
@@ -10,13 +10,13 @@ |
||
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 |
@@ -9,15 +9,15 @@ |
||
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 |
@@ -12,7 +12,7 @@ |
||
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 |
@@ -18,9 +18,9 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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; ?> |
@@ -39,12 +39,12 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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; ?> |
@@ -19,8 +19,9 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 | } |