@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | |
35 | 35 | $form = new FormValidator('form'); |
36 | 36 | |
37 | - $renderer =& $form->defaultRenderer(); |
|
37 | + $renderer = & $form->defaultRenderer(); |
|
38 | 38 | $renderer->setFormTemplate('<form{attributes}><table border="0" cellpadding="5" cellspacing="0" width="100%">{content}</table></form>'); |
39 | 39 | $renderersetCustomElementTemplate->setCustomElementTemplate('<tr><td>{element}</td></tr>'); |
40 | 40 | |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | $form2 = new FormValidator('form'); |
55 | 55 | |
56 | 56 | if (!empty($option2) && !empty($urlOption2)) { |
57 | - $renderer =& $form2->defaultRenderer(); |
|
57 | + $renderer = & $form2->defaultRenderer(); |
|
58 | 58 | $renderer->setHeaderTemplate(''); |
59 | 59 | $renderer->setFormTemplate('<form{attributes}><table border="0" cellpadding="5" cellspacing="0" width="100%">{content}</table></form>'); |
60 | 60 | $renderer->setCustomElementTemplate('<tr><td>{element}</td></tr>'); |
@@ -41,9 +41,9 @@ |
||
41 | 41 | $defaults['option1_url'] = api_get_plugin_setting('before_login', 'option1_url'); |
42 | 42 | $defaults['option2_url'] = api_get_plugin_setting('before_login', 'option2_url'); |
43 | 43 | |
44 | -$plugin_info['templates'] = array('template.tpl'); |
|
44 | +$plugin_info['templates'] = array('template.tpl'); |
|
45 | 45 | if (file_exists(__DIR__.'/custom.template.tpl')) { |
46 | - $plugin_info['templates'] = array( 'custom.template.tpl'); |
|
46 | + $plugin_info['templates'] = array('custom.template.tpl'); |
|
47 | 47 | } |
48 | 48 | $form->setDefaults($defaults); |
49 | 49 |
@@ -24,13 +24,13 @@ |
||
24 | 24 | */ |
25 | 25 | |
26 | 26 | //the plugin title |
27 | -$plugin_info['title']='PENS'; |
|
27 | +$plugin_info['title'] = 'PENS'; |
|
28 | 28 | //the comments that go with the plugin |
29 | -$plugin_info['comment']="PENS implementation for Chamilo"; |
|
29 | +$plugin_info['comment'] = "PENS implementation for Chamilo"; |
|
30 | 30 | //the locations where this plugin can be shown |
31 | -$plugin_info['location']=array(); |
|
31 | +$plugin_info['location'] = array(); |
|
32 | 32 | //the plugin version |
33 | -$plugin_info['version']='1.1'; |
|
33 | +$plugin_info['version'] = '1.1'; |
|
34 | 34 | //the plugin author |
35 | -$plugin_info['author']='Guillaume Viguier-Just, Yannick Warnier'; |
|
35 | +$plugin_info['author'] = 'Guillaume Viguier-Just, Yannick Warnier'; |
|
36 | 36 | $plugin_info = PENSPlugin::create()->get_info(); |
37 | 37 | \ No newline at end of file |
@@ -25,8 +25,8 @@ discard block |
||
25 | 25 | * @licence http://www.gnu.org/licenses/gpl.txt |
26 | 26 | */ |
27 | 27 | |
28 | -require_once __DIR__ . '/../../main/inc/global.inc.php'; |
|
29 | -require_once __DIR__ . '/lib/pens.php'; |
|
28 | +require_once __DIR__.'/../../main/inc/global.inc.php'; |
|
29 | +require_once __DIR__.'/lib/pens.php'; |
|
30 | 30 | |
31 | 31 | /** |
32 | 32 | * ChamiloPens |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | * @param PENSRequest Request |
115 | 115 | */ |
116 | 116 | public function __construct($request) { |
117 | - if($request instanceof PENSRequest) { |
|
117 | + if ($request instanceof PENSRequest) { |
|
118 | 118 | $this->_id = 0; |
119 | 119 | $this->_pens_version = $request->getPensVersion(); |
120 | 120 | $this->_package_type = $request->getPackageType(); |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | $this->_client = $request->getClient(); |
125 | 125 | $this->_vendor_data = $request->getVendorData(); |
126 | 126 | $this->_package_name = $request->getFilename(); |
127 | - } else if(is_array($request)) { |
|
127 | + } else if (is_array($request)) { |
|
128 | 128 | $this->_id = $request['id']; |
129 | 129 | $this->_pens_version = $request['pens_version']; |
130 | 130 | $this->_package_type = $request['package_type']; |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | $this->_vendor_data = $request['vendor_data']; |
136 | 136 | $this->_package_name = $request['package_name']; |
137 | 137 | $this->_created_at = new DateTime($request['created_at'], new DateTimeZone('UTC')); |
138 | - if(!empty($request['updated_at'])) { |
|
138 | + if (!empty($request['updated_at'])) { |
|
139 | 139 | $this->_updated_at = new DateTime($request['updated_at'], new DateTimeZone('UTC')); |
140 | 140 | } |
141 | 141 | } |
@@ -151,16 +151,16 @@ discard block |
||
151 | 151 | $clean_vendor_data = Database::escape_string($this->_vendor_data); |
152 | 152 | $created_at = api_get_utc_datetime(); |
153 | 153 | $table = Database::get_main_table(ChamiloPens::TABLE_NAME); |
154 | - $sql_query = "INSERT INTO $table (pens_version, package_type, package_type_version, package_format, package_id, client, vendor_data, package_name, created_at) VALUES (" . |
|
155 | - "'". $this->_pens_version. "', " . |
|
156 | - "'".$this->_package_type. "', " . |
|
157 | - "'".$clean_package_type_version. "', " . |
|
158 | - "'".$this->_package_format. "', " . |
|
159 | - "'".$clean_package_id. "', " . |
|
160 | - "'".$clean_client."', " . |
|
161 | - "'".$clean_vendor_data."', " . |
|
162 | - "'".$this->_package_name."', " . |
|
163 | - "'".$created_at."') ON DUPLICATE KEY UPDATE " . |
|
154 | + $sql_query = "INSERT INTO $table (pens_version, package_type, package_type_version, package_format, package_id, client, vendor_data, package_name, created_at) VALUES (". |
|
155 | + "'".$this->_pens_version."', ". |
|
156 | + "'".$this->_package_type."', ". |
|
157 | + "'".$clean_package_type_version."', ". |
|
158 | + "'".$this->_package_format."', ". |
|
159 | + "'".$clean_package_id."', ". |
|
160 | + "'".$clean_client."', ". |
|
161 | + "'".$clean_vendor_data."', ". |
|
162 | + "'".$this->_package_name."', ". |
|
163 | + "'".$created_at."') ON DUPLICATE KEY UPDATE ". |
|
164 | 164 | "pens_version = VALUES(pens_version), ". |
165 | 165 | "package_type = VALUES(package_type), ". |
166 | 166 | "package_type_version = VALUES(package_type_version), ". |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | $sql_query = "SELECT * FROM $table WHERE package_id = '".$package_id."';"; |
183 | 183 | $results = Database::query($sql_query); |
184 | 184 | $number = Database::num_rows($results); |
185 | - if($number == 1) { |
|
185 | + if ($number == 1) { |
|
186 | 186 | $obj = Database::fetch_assoc($results); |
187 | 187 | return new ChamiloPens($obj); |
188 | 188 | } else { |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | $sql_query = "SELECT * FROM $table ORDER BY created_at;"; |
201 | 201 | $results = Database::query($sql_query); |
202 | 202 | $return = array(); |
203 | - while($assoc = Database::fetch_assoc($results)) { |
|
203 | + while ($assoc = Database::fetch_assoc($results)) { |
|
204 | 204 | $return[] = new ChamiloPens($assoc); |
205 | 205 | } |
206 | 206 | return $return; |
@@ -24,19 +24,19 @@ |
||
24 | 24 | * @licence http://www.gnu.org/licenses/gpl.txt |
25 | 25 | */ |
26 | 26 | |
27 | -require_once __DIR__ . '/../../main/inc/global.inc.php'; |
|
28 | -require_once __DIR__ . '/lib/pens.php'; |
|
29 | -require_once __DIR__ . '/chamilo_pens.php'; |
|
27 | +require_once __DIR__.'/../../main/inc/global.inc.php'; |
|
28 | +require_once __DIR__.'/lib/pens.php'; |
|
29 | +require_once __DIR__.'/chamilo_pens.php'; |
|
30 | 30 | |
31 | 31 | class ChamiloPackageHandler extends PENSPackageHandler { |
32 | 32 | public function processPackage($request, $path_to_package) { |
33 | 33 | $server = PENSServer::singleton(); |
34 | 34 | // Moves the package to archive/pens |
35 | - $path_to_archives = api_get_path(SYS_ARCHIVE_PATH) . 'pens'; |
|
36 | - if(!is_dir($path_to_archives)) { |
|
35 | + $path_to_archives = api_get_path(SYS_ARCHIVE_PATH).'pens'; |
|
36 | + if (!is_dir($path_to_archives)) { |
|
37 | 37 | mkdir($path_to_archives, 0777, true); |
38 | 38 | } |
39 | - rename($path_to_package, $path_to_archives . '/' . $request->getFilename()); |
|
39 | + rename($path_to_package, $path_to_archives.'/'.$request->getFilename()); |
|
40 | 40 | // Insert the request in the database |
41 | 41 | $chamilo_pens = new ChamiloPens($request); |
42 | 42 | $chamilo_pens->save(); |
@@ -26,7 +26,7 @@ |
||
26 | 26 | * @licence http://www.gnu.org/licenses/gpl.txt |
27 | 27 | */ |
28 | 28 | |
29 | -require_once __DIR__ . '/pens_request.php'; |
|
29 | +require_once __DIR__.'/pens_request.php'; |
|
30 | 30 | |
31 | 31 | /** |
32 | 32 | * PENSRequestAlert |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | * Singleton method |
62 | 62 | */ |
63 | 63 | public static function singleton() { |
64 | - if(!isset(self::$_instance)) { |
|
64 | + if (!isset(self::$_instance)) { |
|
65 | 65 | $c = __CLASS__; |
66 | 66 | self::$_instance = new $c; |
67 | 67 | } |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | * @param PENSRequestHandler Request handler |
86 | 86 | */ |
87 | 87 | public function setRequestHandler($request_handler) { |
88 | - if($request_handler instanceof PENSRequestHandler) { |
|
88 | + if ($request_handler instanceof PENSRequestHandler) { |
|
89 | 89 | $this->_request_handler = $request_handler; |
90 | 90 | } |
91 | 91 | } |
@@ -98,14 +98,14 @@ discard block |
||
98 | 98 | try { |
99 | 99 | $request = $this->parseRequest(); |
100 | 100 | $command = $request->getCommand(); |
101 | - if($command == "alert" || $command == "receipt") { |
|
102 | - if(!is_null($this->_request_handler)) { |
|
101 | + if ($command == "alert" || $command == "receipt") { |
|
102 | + if (!is_null($this->_request_handler)) { |
|
103 | 103 | // Call the handler |
104 | 104 | $this->_request_handler->processRequest($request, new PENSResponse($_REQUEST)); |
105 | 105 | } |
106 | 106 | $this->sendResponse(new PENSResponse(0, $command." received and understood")); |
107 | 107 | } |
108 | - } catch(PENSException $e) { |
|
108 | + } catch (PENSException $e) { |
|
109 | 109 | // If we could not parse the request, send the error |
110 | 110 | $this->sendResponse(new PENSResponse($e)); |
111 | 111 | } |
@@ -90,7 +90,7 @@ |
||
90 | 90 | * Sets the message based on the code |
91 | 91 | */ |
92 | 92 | protected function setMessageBasedOnCode() { |
93 | - if(empty($this->message) && !empty(self::$_code_to_messages[$this->code])) { |
|
93 | + if (empty($this->message) && !empty(self::$_code_to_messages[$this->code])) { |
|
94 | 94 | $this->message = self::$_code_to_messages[$this->code]; |
95 | 95 | } |
96 | 96 | } |
@@ -26,7 +26,7 @@ |
||
26 | 26 | * @licence http://www.gnu.org/licenses/gpl.txt |
27 | 27 | */ |
28 | 28 | |
29 | -require_once __DIR__ . '/pens_request.php'; |
|
29 | +require_once __DIR__.'/pens_request.php'; |
|
30 | 30 | |
31 | 31 | /** |
32 | 32 | * PENSRequestCollect |