@@ -27,10 +27,10 @@ discard block |
||
27 | 27 | * @licence http://www.gnu.org/licenses/gpl.txt |
28 | 28 | */ |
29 | 29 | |
30 | -require_once __DIR__ . '/pens_exception.php'; |
|
31 | -require_once __DIR__ . '/pens_request_receipt.php'; |
|
32 | -require_once __DIR__ . '/pens_request_collect.php'; |
|
33 | -require_once __DIR__ . '/pens_request_alert.php'; |
|
30 | +require_once __DIR__.'/pens_exception.php'; |
|
31 | +require_once __DIR__.'/pens_request_receipt.php'; |
|
32 | +require_once __DIR__.'/pens_request_collect.php'; |
|
33 | +require_once __DIR__.'/pens_request_alert.php'; |
|
34 | 34 | |
35 | 35 | /** |
36 | 36 | * PENSRequestFactory |
@@ -55,11 +55,11 @@ discard block |
||
55 | 55 | */ |
56 | 56 | public static function createPENSRequest($arguments) { |
57 | 57 | $command = $arguments["command"]; |
58 | - if($command == "alert") { |
|
58 | + if ($command == "alert") { |
|
59 | 59 | return new PENSRequestAlert($arguments); |
60 | - } else if($command == "collect") { |
|
60 | + } else if ($command == "collect") { |
|
61 | 61 | return new PENSRequestCollect($arguments); |
62 | - } else if($command == "receipt") { |
|
62 | + } else if ($command == "receipt") { |
|
63 | 63 | return new PENSRequestReceipt($arguments); |
64 | 64 | } else { |
65 | 65 | throw new PENSException(2002); |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | * @throws PENSException with code 2001 if invalid |
187 | 187 | */ |
188 | 188 | public function setPensVersion($pens_version) { |
189 | - if($pens_version == PENSConfig::$version) { |
|
189 | + if ($pens_version == PENSConfig::$version) { |
|
190 | 190 | $this->_pens_version = $pens_version; |
191 | 191 | } else { |
192 | 192 | throw new PENSException(2001); |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | * @throws PENSException with code 2002 if invalid |
206 | 206 | */ |
207 | 207 | protected function setCommand($command) { |
208 | - if(in_array($command, PENSConfig::$allowed_commands)) { |
|
208 | + if (in_array($command, PENSConfig::$allowed_commands)) { |
|
209 | 209 | $this->_command = $command; |
210 | 210 | } else { |
211 | 211 | throw new PENSException(2002); |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | * @throws PENSException with code 2003 if invalid |
225 | 225 | */ |
226 | 226 | public function setPackageType($package_type) { |
227 | - if(in_array($package_type, PENSConfig::$allowed_package_types)) { |
|
227 | + if (in_array($package_type, PENSConfig::$allowed_package_types)) { |
|
228 | 228 | $this->_package_type = $package_type; |
229 | 229 | } else { |
230 | 230 | throw new PENSException(2003); |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | * @throws PENSException with code 2004 if invalid |
244 | 244 | */ |
245 | 245 | public function setPackageTypeVersion($package_type_version) { |
246 | - if(empty($package_type_version)) { |
|
246 | + if (empty($package_type_version)) { |
|
247 | 247 | throw new PENSException(2004); |
248 | 248 | } else { |
249 | 249 | $this->_package_type_version = $package_type_version; |
@@ -262,7 +262,7 @@ discard block |
||
262 | 262 | * @throws PENSException with code 2005 if invalid |
263 | 263 | */ |
264 | 264 | public function setPackageFormat($package_format) { |
265 | - if(in_array($package_format, PENSConfig::$allowed_package_formats)) { |
|
265 | + if (in_array($package_format, PENSConfig::$allowed_package_formats)) { |
|
266 | 266 | $this->_package_format = $package_format; |
267 | 267 | } else { |
268 | 268 | throw new PENSException(2005); |
@@ -316,7 +316,7 @@ discard block |
||
316 | 316 | } |
317 | 317 | |
318 | 318 | public function setPackageUrlUserId($package_url_user_id) { |
319 | - if(!empty($package_url_user_id)) { |
|
319 | + if (!empty($package_url_user_id)) { |
|
320 | 320 | $this->_package_url_user_id = $package_url_user_id; |
321 | 321 | } |
322 | 322 | } |
@@ -326,7 +326,7 @@ discard block |
||
326 | 326 | } |
327 | 327 | |
328 | 328 | public function setPackageUrlAccount($package_url_account) { |
329 | - if(!empty($package_url_account)) { |
|
329 | + if (!empty($package_url_account)) { |
|
330 | 330 | $this->_package_url_account = $package_url_account; |
331 | 331 | } |
332 | 332 | } |
@@ -336,7 +336,7 @@ discard block |
||
336 | 336 | } |
337 | 337 | |
338 | 338 | public function setPackageUrlPassword($package_url_password) { |
339 | - if(!empty($package_url_password)) { |
|
339 | + if (!empty($package_url_password)) { |
|
340 | 340 | $this->_package_url_password = $package_url_password; |
341 | 341 | } |
342 | 342 | } |
@@ -354,13 +354,13 @@ discard block |
||
354 | 354 | * @todo Perform a better validation of the date |
355 | 355 | */ |
356 | 356 | public function setPackageUrlExpiry($package_url_expiry) { |
357 | - if(empty($package_url_expiry)) { |
|
357 | + if (empty($package_url_expiry)) { |
|
358 | 358 | throw new PENSException(2009); |
359 | 359 | } else { |
360 | 360 | try { |
361 | 361 | $expiry = new DateTime($package_url_expiry, new DateTimeZone('UTC')); |
362 | 362 | $this->_package_url_expiry = $expiry; |
363 | - } catch(Exception $e) { |
|
363 | + } catch (Exception $e) { |
|
364 | 364 | throw new PENSException(2009); |
365 | 365 | } |
366 | 366 | } |
@@ -378,7 +378,7 @@ discard block |
||
378 | 378 | * @throws PENSException with code 2010 if invalid |
379 | 379 | */ |
380 | 380 | public function setClient($client) { |
381 | - if(!empty($client)) { |
|
381 | + if (!empty($client)) { |
|
382 | 382 | $this->_client = $client; |
383 | 383 | } else { |
384 | 384 | throw new PENSException(2010); |
@@ -390,7 +390,7 @@ discard block |
||
390 | 390 | } |
391 | 391 | |
392 | 392 | public function setSystemUserId($system_user_id) { |
393 | - if(!empty($system_user_id)) { |
|
393 | + if (!empty($system_user_id)) { |
|
394 | 394 | $this->_system_user_id = $system_user_id; |
395 | 395 | } |
396 | 396 | } |
@@ -400,7 +400,7 @@ discard block |
||
400 | 400 | } |
401 | 401 | |
402 | 402 | public function setSystemPassword($system_password) { |
403 | - if(!empty($system_password)) { |
|
403 | + if (!empty($system_password)) { |
|
404 | 404 | $this->_system_password = $system_password; |
405 | 405 | } |
406 | 406 | } |
@@ -417,7 +417,7 @@ discard block |
||
417 | 417 | * @throws PENSException with code 2011 if invalid |
418 | 418 | */ |
419 | 419 | public function setReceipt($receipt) { |
420 | - if($this instanceof PENSRequestCollect) { |
|
420 | + if ($this instanceof PENSRequestCollect) { |
|
421 | 421 | if (preg_match('/'.ABSOLUTEURI_2396.'/', $receipt)) { |
422 | 422 | $this->_receipt = $receipt; |
423 | 423 | } else { |
@@ -431,8 +431,8 @@ discard block |
||
431 | 431 | } |
432 | 432 | |
433 | 433 | public function setAlerts($alerts) { |
434 | - if(!empty($alerts)) { |
|
435 | - if(preg_match('/'.ABSOLUTEURI_2396.'/', $alerts)) { |
|
434 | + if (!empty($alerts)) { |
|
435 | + if (preg_match('/'.ABSOLUTEURI_2396.'/', $alerts)) { |
|
436 | 436 | $this->_alerts = $alerts; |
437 | 437 | } else { |
438 | 438 | throw new PENSException(1201); |
@@ -445,7 +445,7 @@ discard block |
||
445 | 445 | } |
446 | 446 | |
447 | 447 | public function setVendorData($vendor_data) { |
448 | - if(!empty($vendor_data)) { |
|
448 | + if (!empty($vendor_data)) { |
|
449 | 449 | $this->_vendor_data = $vendor_data; |
450 | 450 | } |
451 | 451 | } |
@@ -26,9 +26,9 @@ discard block |
||
26 | 26 | * @licence http://www.gnu.org/licenses/gpl.txt |
27 | 27 | */ |
28 | 28 | |
29 | -require_once __DIR__ . '/pens_config.php'; |
|
30 | -require_once __DIR__ . '/pens_message.php'; |
|
31 | -require_once __DIR__ . '/pens_exception.php'; |
|
29 | +require_once __DIR__.'/pens_config.php'; |
|
30 | +require_once __DIR__.'/pens_message.php'; |
|
31 | +require_once __DIR__.'/pens_exception.php'; |
|
32 | 32 | |
33 | 33 | /** |
34 | 34 | * PENSResponse |
@@ -73,13 +73,13 @@ discard block |
||
73 | 73 | */ |
74 | 74 | public function __construct($error, $error_text = null, $pens_data = null) { |
75 | 75 | $this->_pens_version = PENSConfig::$version; |
76 | - if($error instanceof PENSException) { |
|
76 | + if ($error instanceof PENSException) { |
|
77 | 77 | $this->_error = $error->getCode(); |
78 | 78 | $this->_error_text = $error->getMessage(); |
79 | - } else if(is_string($error)){ |
|
79 | + } else if (is_string($error)) { |
|
80 | 80 | // Parse the string |
81 | 81 | $this->parseResponse($error); |
82 | - } else if(is_array($error)) { |
|
82 | + } else if (is_array($error)) { |
|
83 | 83 | // Try to build from array |
84 | 84 | $this->_error = $error["error"]; |
85 | 85 | $this->_error_text = $error["error-text"]; |
@@ -100,22 +100,22 @@ discard block |
||
100 | 100 | protected function parseResponse($response) { |
101 | 101 | $lines = explode(PENSConfig::$eol, $response); |
102 | 102 | $i = 1; |
103 | - foreach($lines as $line) { |
|
104 | - if($i < 5) { |
|
103 | + foreach ($lines as $line) { |
|
104 | + if ($i < 5) { |
|
105 | 105 | $pair = explode("=", $line); |
106 | - if($pair[0] == "error") { |
|
106 | + if ($pair[0] == "error") { |
|
107 | 107 | $this->_error = intval($pair[1]); |
108 | - } else if($pair[0] == "error-text") { |
|
108 | + } else if ($pair[0] == "error-text") { |
|
109 | 109 | $this->_error_text = $pair[1]; |
110 | - } else if($pair[0] == "version") { |
|
110 | + } else if ($pair[0] == "version") { |
|
111 | 111 | $this->_pens_version = $pair[1]; |
112 | - } else if($pair[0] == "pens-data") { |
|
113 | - if(!empty($pair[1])) { |
|
112 | + } else if ($pair[0] == "pens-data") { |
|
113 | + if (!empty($pair[1])) { |
|
114 | 114 | $this->_pens_data = $pair[1].PENSConfig::$eol; |
115 | 115 | } |
116 | 116 | } |
117 | 117 | } else { |
118 | - if(!empty($line)) { |
|
118 | + if (!empty($line)) { |
|
119 | 119 | $this->_pens_data .= $line.PENSConfig::$eol; |
120 | 120 | } |
121 | 121 | } |
@@ -23,7 +23,7 @@ |
||
23 | 23 | * @licence http://www.gnu.org/licenses/gpl.txt |
24 | 24 | */ |
25 | 25 | |
26 | -require_once __DIR__ . '/pens.php'; |
|
26 | +require_once __DIR__.'/pens.php'; |
|
27 | 27 | |
28 | 28 | class MyRequestHandler extends PENSRequestHandler { |
29 | 29 | public function processRequest($request, $response) { |
@@ -1,7 +1,7 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -require_once __DIR__ . '/pens/pens_request_factory.php'; |
|
4 | -require_once __DIR__ . '/pens/pens_response.php'; |
|
5 | -require_once __DIR__ . '/pens/pens_package_handler.php'; |
|
6 | -require_once __DIR__ . '/pens/pens_server.php'; |
|
7 | -require_once __DIR__ . '/pens/pens_client.php'; |
|
3 | +require_once __DIR__.'/pens/pens_request_factory.php'; |
|
4 | +require_once __DIR__.'/pens/pens_response.php'; |
|
5 | +require_once __DIR__.'/pens/pens_package_handler.php'; |
|
6 | +require_once __DIR__.'/pens/pens_server.php'; |
|
7 | +require_once __DIR__.'/pens/pens_client.php'; |
@@ -23,7 +23,7 @@ |
||
23 | 23 | * @licence http://www.gnu.org/licenses/gpl.txt |
24 | 24 | */ |
25 | 25 | |
26 | -require_once __DIR__ . '/pens.php'; |
|
26 | +require_once __DIR__.'/pens.php'; |
|
27 | 27 | |
28 | 28 | class MyPackageHandler extends PENSPackageHandler { |
29 | 29 | public function processPackage($request, $path_to_package) { |
@@ -79,14 +79,14 @@ discard block |
||
79 | 79 | public function exceptionTestForValue($key, $value, $code) { |
80 | 80 | try { |
81 | 81 | $myargs = $this->args; |
82 | - if($value === null) { |
|
82 | + if ($value === null) { |
|
83 | 83 | unset($myargs[$key]); |
84 | 84 | } else { |
85 | 85 | $myargs[$key] = $value; |
86 | 86 | } |
87 | 87 | $object = $this->createObject($myargs); |
88 | 88 | $this->fail(); |
89 | - } catch(PENSException $e) { |
|
89 | + } catch (PENSException $e) { |
|
90 | 90 | $this->assertEqual($e->getCode(), $code); |
91 | 91 | } |
92 | 92 | } |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | $myargs["receipt"] = "mailto:[email protected],[email protected]"; |
179 | 179 | $object = $this->createObject($myargs); |
180 | 180 | $this->pass(); |
181 | - } catch(PENSException $e) { |
|
181 | + } catch (PENSException $e) { |
|
182 | 182 | $this->fail(); |
183 | 183 | } |
184 | 184 | } |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | $this->assertEqual($object->getAlerts(), "http://myurl.com/alerts"); |
205 | 205 | $this->assertEqual($object->getVendorData(), "here are my data"); |
206 | 206 | |
207 | - } catch(PENSException $e) { |
|
207 | + } catch (PENSException $e) { |
|
208 | 208 | $this->fail(); |
209 | 209 | } |
210 | 210 | } |
@@ -129,9 +129,9 @@ |
||
129 | 129 | */ |
130 | 130 | public function getTourConfig() |
131 | 131 | { |
132 | - $pluginPath = api_get_path(PLUGIN_PATH) . 'tour/'; |
|
132 | + $pluginPath = api_get_path(PLUGIN_PATH).'tour/'; |
|
133 | 133 | |
134 | - $jsonContent = file_get_contents($pluginPath . 'config/tour.json'); |
|
134 | + $jsonContent = file_get_contents($pluginPath.'config/tour.json'); |
|
135 | 135 | |
136 | 136 | $jsonData = json_decode($jsonContent, true); |
137 | 137 |
@@ -5,10 +5,10 @@ |
||
5 | 5 | * @author Angel Fernando Quiroz Campos <[email protected]> |
6 | 6 | * @package chamilo.plugin.tour |
7 | 7 | */ |
8 | -require_once __DIR__ . '/config.php'; |
|
8 | +require_once __DIR__.'/config.php'; |
|
9 | 9 | |
10 | -$pluginPath = api_get_path(PLUGIN_PATH) . 'tour/'; |
|
11 | -$pluginWebPath = api_get_path(WEB_PLUGIN_PATH) . 'tour/'; |
|
10 | +$pluginPath = api_get_path(PLUGIN_PATH).'tour/'; |
|
11 | +$pluginWebPath = api_get_path(WEB_PLUGIN_PATH).'tour/'; |
|
12 | 12 | |
13 | 13 | $userId = api_get_user_id(); |
14 | 14 |