17
17
*/
18
18
class Client
19
19
{
20
+ static protected $ UserAgent = 'Seti \'s JiraApi Rest Client v1.5.* ' ;
21
+
20
22
static protected $ isJIRAUtf8 = true ;
21
23
22
24
static protected $ jMapper = null ;
@@ -191,6 +193,7 @@ public function exec($context, $post_data = null, $custom_request = null, $tries
191
193
curl_setopt ($ ch , CURLOPT_SSL_VERIFYHOST , $ this ->getConfiguration ()->isCurlOptSslVerifyHost ());
192
194
curl_setopt ($ ch , CURLOPT_SSL_VERIFYPEER , $ this ->getConfiguration ()->isCurlOptSslVerifyPeer ());
193
195
curl_setopt ($ ch , CURLOPT_FOLLOWLOCATION , true );
196
+ curl_setopt ($ ch , CURLOPT_USERAGENT , self ::$ UserAgent . ($ this ->getConfiguration ()->getUserAgent () ? ' [] ' : '' ));
194
197
curl_setopt ($ ch , CURLOPT_HTTPHEADER ,
195
198
array ('Accept: */* ' , 'Content-Type: application/json ' ));
196
199
curl_setopt ($ ch , CURLOPT_VERBOSE , $ this ->getConfiguration ()->isCurlOptVerbose ());
@@ -208,7 +211,7 @@ public function exec($context, $post_data = null, $custom_request = null, $tries
208
211
$ url .= '&startAt= ' .$ post_data ->startAt ;
209
212
$ url .= '&maxResults= ' .$ post_data ->maxResults ;
210
213
$ url .= '&expand= ' .$ post_data ->expand ;
211
- if (isset ($ post_data ->fields ) && !empty ($ post_data ->fields )) $ url .= '&fields= ' .$ post_data -> fields ;
214
+ if (isset ($ post_data ->fields ) && !empty ($ post_data ->fields )) $ url .= '&fields= ' .( is_array ( $ post_data -> fields ) ? implode ( ' , ' , $ post_data -> fields ) : $ post_data -> fields ) ;
212
215
$ post_data = null ;
213
216
curl_setopt ($ ch , CURLOPT_POST , false );
214
217
curl_setopt ($ ch , CURLOPT_URL , $ url );
0 commit comments