Completed
Push — master ( ab9e22...72dffb )
by Jesus
02:17
created
lib.php 2 patches
Doc Comments   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
  * @uses FEATURE_GRADE_OUTCOMES
103 103
  * @uses FEATURE_SHOW_DESCRIPTION
104 104
  * @param string $feature
105
- * @return mixed True if yes (some features may use other values)
105
+ * @return null|boolean True if yes (some features may use other values)
106 106
  */
107 107
 function bigbluebuttonbn_supports($feature) {
108 108
     if (!$feature) {
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
  *
188 188
  * @param int $id Id of the module instance
189 189
  *
190
- * @return bool Success/Failure
190
+ * @return boolean|null Success/Failure
191 191
  */
192 192
 function bigbluebuttonbn_delete_instance($id) {
193 193
     global $DB;
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
  *
215 215
  * @param object $bigbluebuttonbn Id of the module instance
216 216
  *
217
- * @return bool Success/Failure
217
+ * @return boolean|null Success/Failure
218 218
  */
219 219
 function bigbluebuttonbn_delete_instance_log($bigbluebuttonbn) {
220 220
     global $DB;
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
  * @param object $mod
236 236
  * @param object $bigbluebuttonbn
237 237
  *
238
- * @return bool
238
+ * @return string
239 239
  */
240 240
 function bigbluebuttonbn_user_outline($course, $user, $mod, $bigbluebuttonbn) {
241 241
     global $DB;
@@ -592,7 +592,7 @@  discard block
 block discarded – undo
592 592
  * @param stdClass $context       context object
593 593
  * @param string   $filearea      file area
594 594
  *
595
- * @return false|null false if file not valid
595
+ * @return boolean false if file not valid
596 596
  */
597 597
 function bigbluebuttonbn_pluginfile_valid($context, $filearea) {
598 598
     if ($context->contextlevel != CONTEXT_MODULE) {
Please login to merge, or discard this patch.
Spacing   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -28,28 +28,28 @@  discard block
 block discarded – undo
28 28
 
29 29
 global $CFG;
30 30
 
31
-require_once($CFG->dirroot.'/calendar/lib.php');
32
-require_once($CFG->dirroot.'/message/lib.php');
33
-require_once($CFG->dirroot.'/mod/lti/OAuth.php');
34
-require_once($CFG->dirroot.'/tag/lib.php');
35
-require_once($CFG->libdir.'/accesslib.php');
36
-require_once($CFG->libdir.'/completionlib.php');
37
-require_once($CFG->libdir.'/datalib.php');
38
-require_once($CFG->libdir.'/enrollib.php');
39
-require_once($CFG->libdir.'/filelib.php');
40
-require_once($CFG->libdir.'/formslib.php');
31
+require_once($CFG->dirroot . '/calendar/lib.php');
32
+require_once($CFG->dirroot . '/message/lib.php');
33
+require_once($CFG->dirroot . '/mod/lti/OAuth.php');
34
+require_once($CFG->dirroot . '/tag/lib.php');
35
+require_once($CFG->libdir . '/accesslib.php');
36
+require_once($CFG->libdir . '/completionlib.php');
37
+require_once($CFG->libdir . '/datalib.php');
38
+require_once($CFG->libdir . '/enrollib.php');
39
+require_once($CFG->libdir . '/filelib.php');
40
+require_once($CFG->libdir . '/formslib.php');
41 41
 
42 42
 
43
-if (file_exists(dirname(__FILE__).'/vendor/firebase/php-jwt/src/JWT.php')) {
44
-    require_once(dirname(__FILE__).'/vendor/firebase/php-jwt/src/JWT.php');
43
+if (file_exists(dirname(__FILE__) . '/vendor/firebase/php-jwt/src/JWT.php')) {
44
+    require_once(dirname(__FILE__) . '/vendor/firebase/php-jwt/src/JWT.php');
45 45
 }
46 46
 
47 47
 if (!isset($CFG->bigbluebuttonbn)) {
48 48
     $CFG->bigbluebuttonbn = array();
49 49
 }
50 50
 
51
-if (file_exists(dirname(__FILE__).'/config.php')) {
52
-    require_once(dirname(__FILE__).'/config.php');
51
+if (file_exists(dirname(__FILE__) . '/config.php')) {
52
+    require_once(dirname(__FILE__) . '/config.php');
53 53
 }
54 54
 
55 55
 /*
@@ -101,18 +101,18 @@  discard block
 block discarded – undo
101 101
         return null;
102 102
     }
103 103
     $features = array(
104
-        (string) FEATURE_IDNUMBER => true,
105
-        (string) FEATURE_GROUPS => true,
106
-        (string) FEATURE_GROUPINGS => true,
107
-        (string) FEATURE_GROUPMEMBERSONLY => true,
108
-        (string) FEATURE_MOD_INTRO => true,
109
-        (string) FEATURE_BACKUP_MOODLE2 => true,
110
-        (string) FEATURE_COMPLETION_TRACKS_VIEWS => true,
111
-        (string) FEATURE_GRADE_HAS_GRADE => false,
112
-        (string) FEATURE_GRADE_OUTCOMES => false,
113
-        (string) FEATURE_SHOW_DESCRIPTION => true,
104
+        (string)FEATURE_IDNUMBER => true,
105
+        (string)FEATURE_GROUPS => true,
106
+        (string)FEATURE_GROUPINGS => true,
107
+        (string)FEATURE_GROUPMEMBERSONLY => true,
108
+        (string)FEATURE_MOD_INTRO => true,
109
+        (string)FEATURE_BACKUP_MOODLE2 => true,
110
+        (string)FEATURE_COMPLETION_TRACKS_VIEWS => true,
111
+        (string)FEATURE_GRADE_HAS_GRADE => false,
112
+        (string)FEATURE_GRADE_OUTCOMES => false,
113
+        (string)FEATURE_SHOW_DESCRIPTION => true,
114 114
     );
115
-    if (isset($features[(string) $feature])) {
115
+    if (isset($features[(string)$feature])) {
116 116
         return $features[$feature];
117 117
     }
118 118
     return null;
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
 function bigbluebuttonbn_delete_instance_log($bigbluebuttonbn) {
212 212
     global $DB;
213 213
     $sql  = "SELECT * FROM {bigbluebuttonbn_logs} ";
214
-    $sql .= "WHERE bigbluebuttonbnid = ? AND log = ? AND ". $DB->sql_compare_text('meta') . " = ?";
214
+    $sql .= "WHERE bigbluebuttonbnid = ? AND log = ? AND " . $DB->sql_compare_text('meta') . " = ?";
215 215
     $logs = $DB->get_records_sql($sql, array($bigbluebuttonbn->id, BIGBLUEBUTTONBN_LOG_EVENT_CREATE, "{\"record\":true}"));
216 216
     $meta = "{\"has_recordings\":" . empty($logs) ? "true" : "false" . "}";
217 217
     bigbluebuttonbn_log($bigbluebuttonbn, BIGBLUEBUTTONBN_LOG_EVENT_DELETE, [], $meta);
@@ -234,10 +234,10 @@  discard block
 block discarded – undo
234 234
 function bigbluebuttonbn_user_outline($course, $user, $mod, $bigbluebuttonbn) {
235 235
     global $DB;
236 236
     $completed = $DB->count_records('bigbluebuttonbn_logs', array('courseid' => $course->id,
237
-        'bigbluebuttonbnid' => $bigbluebuttonbn->id, 'userid' => $user->id, 'log' => 'Join', ), '*');
237
+        'bigbluebuttonbnid' => $bigbluebuttonbn->id, 'userid' => $user->id, 'log' => 'Join',), '*');
238 238
     if ($completed > 0) {
239
-        return fullname($user).' '.get_string('view_message_has_joined', 'bigbluebuttonbn').' '.
240
-            get_string('view_message_session_for', 'bigbluebuttonbn').' '.(string) $completed.' '.
239
+        return fullname($user) . ' ' . get_string('view_message_has_joined', 'bigbluebuttonbn') . ' ' .
240
+            get_string('view_message_session_for', 'bigbluebuttonbn') . ' ' . (string)$completed . ' ' .
241 241
             get_string('view_message_times', 'bigbluebuttonbn');
242 242
     }
243 243
     return '';
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
 function bigbluebuttonbn_user_complete($course, $user, $mod, $bigbluebuttonbn) {
258 258
     global $DB;
259 259
     $completed = $DB->count_records('bigbluebuttonbn_logs', array('courseid' => $course->id,
260
-        'bigbluebuttonbnid' => $bigbluebuttonbn->id, 'userid' => $user->id, 'log' => 'Join', ),
260
+        'bigbluebuttonbnid' => $bigbluebuttonbn->id, 'userid' => $user->id, 'log' => 'Join',),
261 261
         '*', IGNORE_MULTIPLE);
262 262
     return $completed > 0;
263 263
 }
@@ -332,16 +332,16 @@  discard block
 block discarded – undo
332 332
     if ($bigbluebuttonbn->visible) {
333 333
         $classes = 'class="dimmed" ';
334 334
     }
335
-    $str  = '<div class="bigbluebuttonbn overview">'."\n";
336
-    $str .= '  <div class="name">'.get_string('modulename', 'bigbluebuttonbn').':&nbsp;'."\n";
337
-    $str .= '    <a '.$classes.'href="'.$CFG->wwwroot.'/mod/bigbluebuttonbn/view.php?id='.$bigbluebuttonbn->coursemodule.
338
-      '">'.$bigbluebuttonbn->name.'</a>'."\n";
339
-    $str .= '  </div>'."\n";
340
-    $str .= '  <div class="info">'.get_string($start, 'bigbluebuttonbn').': '.userdate($bigbluebuttonbn->openingtime).
341
-        '</div>'."\n";
342
-    $str .= '  <div class="info">'.get_string('ends_at', 'bigbluebuttonbn').': '.userdate($bigbluebuttonbn->closingtime)
343
-      .'</div>'."\n";
344
-    $str .= '</div>'."\n";
335
+    $str  = '<div class="bigbluebuttonbn overview">' . "\n";
336
+    $str .= '  <div class="name">' . get_string('modulename', 'bigbluebuttonbn') . ':&nbsp;' . "\n";
337
+    $str .= '    <a ' . $classes . 'href="' . $CFG->wwwroot . '/mod/bigbluebuttonbn/view.php?id=' . $bigbluebuttonbn->coursemodule .
338
+      '">' . $bigbluebuttonbn->name . '</a>' . "\n";
339
+    $str .= '  </div>' . "\n";
340
+    $str .= '  <div class="info">' . get_string($start, 'bigbluebuttonbn') . ': ' . userdate($bigbluebuttonbn->openingtime) .
341
+        '</div>' . "\n";
342
+    $str .= '  <div class="info">' . get_string('ends_at', 'bigbluebuttonbn') . ': ' . userdate($bigbluebuttonbn->closingtime)
343
+      .'</div>' . "\n";
344
+    $str .= '</div>' . "\n";
345 345
     return $str;
346 346
 }
347 347
 
@@ -559,7 +559,7 @@  discard block
 block discarded – undo
559 559
     if (count($files) == 1) {
560 560
         // Get the first (and only) file.
561 561
         $file = reset($files);
562
-        $filesrc = '/'.$file->get_filename();
562
+        $filesrc = '/' . $file->get_filename();
563 563
     }
564 564
     return $filesrc;
565 565
 }
@@ -627,7 +627,7 @@  discard block
 block discarded – undo
627 627
     if (!$filename) {
628 628
         return false;
629 629
     }
630
-    $fullpath = "/$context->id/mod_bigbluebuttonbn/$filearea/0/".$filename;
630
+    $fullpath = "/$context->id/mod_bigbluebuttonbn/$filearea/0/" . $filename;
631 631
     $fs = get_file_storage();
632 632
     $file = $fs->get_file_by_hash(sha1($fullpath));
633 633
     if (!$file || $file->is_directory()) {
Please login to merge, or discard this patch.
bbb_broker.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -23,8 +23,8 @@  discard block
 block discarded – undo
23 23
  * @author    Jesus Federico  (jesus [at] blindsidenetworks [dt] com)
24 24
  */
25 25
 
26
-require_once(dirname(dirname(dirname(__FILE__))).'/config.php');
27
-require_once(dirname(__FILE__).'/locallib.php');
26
+require_once(dirname(dirname(dirname(__FILE__))) . '/config.php');
27
+require_once(dirname(__FILE__) . '/locallib.php');
28 28
 
29 29
 use \Firebase\JWT\JWT;
30 30
 
@@ -42,13 +42,13 @@  discard block
 block discarded – undo
42 42
 require_login(0, false);
43 43
 
44 44
 if (empty($params['action'])) {
45
-    header('HTTP/1.0 400 Bad Request. Parameter ['.$params['action'].'] was not included');
45
+    header('HTTP/1.0 400 Bad Request. Parameter [' . $params['action'] . '] was not included');
46 46
     return;
47 47
 }
48 48
 
49 49
 $error = bigbluebuttonbn_broker_validate_parameters($params);
50 50
 if (!empty($error)) {
51
-    header('HTTP/1.0 400 Bad Request. '.$error);
51
+    header('HTTP/1.0 400 Bad Request. ' . $error);
52 52
     return;
53 53
 }
54 54
 
@@ -132,11 +132,11 @@  discard block
 block discarded – undo
132 132
         bigbluebuttonbn_broker_live_session_events($params, $bigbluebuttonbn, $cm);
133 133
         return;
134 134
     }
135
-    header('HTTP/1.0 400 Bad request. The action '. $a . ' doesn\'t exist');
135
+    header('HTTP/1.0 400 Bad request. The action ' . $a . ' doesn\'t exist');
136 136
     return;
137 137
 
138 138
 } catch (Exception $e) {
139
-    header('HTTP/1.0 500 Internal Server Error. '.$e->getMessage());
139
+    header('HTTP/1.0 500 Internal Server Error. ' . $e->getMessage());
140 140
     return;
141 141
 }
142 142
 
@@ -321,7 +321,7 @@  discard block
 block discarded – undo
321 321
 function bigbluebuttonbn_broker_recording_info_current($recording, $params) {
322 322
     $callbackresponse['status'] = true;
323 323
     $callbackresponse['found'] = true;
324
-    $callbackresponse['published'] = (string) $recording['published'];
324
+    $callbackresponse['published'] = (string)$recording['published'];
325 325
     if (!isset($params['meta']) || empty($params['meta'])) {
326 326
         return $callbackresponse;
327 327
     }
@@ -648,8 +648,8 @@  discard block
 block discarded – undo
648 648
         $decodedparameters = JWT::decode($params['signed_parameters'],
649 649
             \mod_bigbluebuttonbn\locallib\config::get('shared_secret'), array('HS256'));
650 650
     } catch (Exception $e) {
651
-        $error = 'Caught exception: '.$e->getMessage();
652
-        header('HTTP/1.0 400 Bad Request. '.$error);
651
+        $error = 'Caught exception: ' . $e->getMessage();
652
+        header('HTTP/1.0 400 Bad Request. ' . $error);
653 653
         return;
654 654
     }
655 655
     // Validate that the bigbluebuttonbn activity corresponds to the meeting_id received.
@@ -665,8 +665,8 @@  discard block
 block discarded – undo
665 665
         bigbluebuttonbn_send_notification_recording_ready($bigbluebuttonbn);
666 666
         header('HTTP/1.0 202 Accepted');
667 667
     } catch (Exception $e) {
668
-        $error = 'Caught exception: '.$e->getMessage();
669
-        header('HTTP/1.0 503 Service Unavailable. '.$error);
668
+        $error = 'Caught exception: ' . $e->getMessage();
669
+        header('HTTP/1.0 503 Service Unavailable. ' . $error);
670 670
     }
671 671
 }
672 672
 
@@ -687,13 +687,13 @@  discard block
 block discarded – undo
687 687
     $importrecordings = $SESSION->bigbluebuttonbn_importrecordings;
688 688
     if (!isset($importrecordings[$params['id']])) {
689 689
         $error = "Recording {$params['id']} could not be found. It can not be imported";
690
-        header('HTTP/1.0 404 Not found. '.$error);
690
+        header('HTTP/1.0 404 Not found. ' . $error);
691 691
         return;
692 692
     }
693 693
     $callbackresponse = array('status' => true);
694 694
     $importrecordings[$params['id']]['imported'] = true;
695 695
     $overrides = array('meetingid' => $importrecordings[$params['id']]['meetingID']);
696
-    $meta = '{"recording":'.json_encode($importrecordings[$params['id']]).'}';
696
+    $meta = '{"recording":' . json_encode($importrecordings[$params['id']]) . '}';
697 697
     bigbluebuttonbn_log($bbbsession['bigbluebuttonbn'], BIGBLUEBUTTONBN_LOG_EVENT_IMPORT, $overrides, $meta);
698 698
     // Moodle event logger: Create an event for recording imported.
699 699
     if (isset($bbbsession['bigbluebutton']) && isset($bbbsession['cm'])) {
@@ -719,8 +719,8 @@  discard block
 block discarded – undo
719 719
         $decodedparameters = JWT::decode($params['signed_parameters'],
720 720
             \mod_bigbluebuttonbn\locallib\config::get('shared_secret'), array('HS256'));
721 721
     } catch (Exception $e) {
722
-        $error = 'Caught exception: '.$e->getMessage();
723
-        header('HTTP/1.0 400 Bad Request. '.$error);
722
+        $error = 'Caught exception: ' . $e->getMessage();
723
+        header('HTTP/1.0 400 Bad Request. ' . $error);
724 724
         return;
725 725
     }
726 726
     // Validate that the bigbluebuttonbn activity corresponds to the meeting_id received.
@@ -761,7 +761,7 @@  discard block
 block discarded – undo
761 761
     }
762 762
     $action = strtolower($params['action']);
763 763
     if (!array_key_exists($action, $requiredparams)) {
764
-        return 'Action '.$params['action'].' can not be performed.';
764
+        return 'Action ' . $params['action'] . ' can not be performed.';
765 765
     }
766 766
     return bigbluebuttonbn_broker_validate_parameters_message($params, $requiredparams[$action]);
767 767
 }
Please login to merge, or discard this patch.
locallib.php 2 patches
Indentation   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -89,9 +89,9 @@  discard block
 block discarded – undo
89 89
  */
90 90
 function bigbluebuttonbn_get_join_url($meetingid, $username, $pw, $logouturl, $configtoken = null, $userid = null) {
91 91
     $data = ['meetingID' => $meetingid,
92
-              'fullName' => $username,
93
-              'password' => $pw,
94
-              'logoutURL' => $logouturl,
92
+                'fullName' => $username,
93
+                'password' => $pw,
94
+                'logoutURL' => $logouturl,
95 95
             ];
96 96
     if (!is_null($configtoken)) {
97 97
         $data['configToken'] = $configtoken;
@@ -143,23 +143,23 @@  discard block
 block discarded – undo
143 143
 function bigbluebuttonbn_get_meeting_info_array($meetingid) {
144 144
     $xml = bigbluebuttonbn_wrap_xml_load_file(
145 145
         \mod_bigbluebuttonbn\locallib\bigbluebutton::action_url('getMeetingInfo', ['meetingID' => $meetingid])
146
-      );
146
+        );
147 147
     if ($xml && $xml->returncode == 'SUCCESS' && empty($xml->messageKey)) {
148 148
         // Meeting info was returned.
149 149
         return array('returncode' => $xml->returncode,
150
-                     'meetingID' => $xml->meetingID,
151
-                     'moderatorPW' => $xml->moderatorPW,
152
-                     'attendeePW' => $xml->attendeePW,
153
-                     'hasBeenForciblyEnded' => $xml->hasBeenForciblyEnded,
154
-                     'running' => $xml->running,
155
-                     'recording' => $xml->recording,
156
-                     'startTime' => $xml->startTime,
157
-                     'endTime' => $xml->endTime,
158
-                     'participantCount' => $xml->participantCount,
159
-                     'moderatorCount' => $xml->moderatorCount,
160
-                     'attendees' => $xml->attendees,
161
-                     'metadata' => $xml->metadata,
162
-                   );
150
+                        'meetingID' => $xml->meetingID,
151
+                        'moderatorPW' => $xml->moderatorPW,
152
+                        'attendeePW' => $xml->attendeePW,
153
+                        'hasBeenForciblyEnded' => $xml->hasBeenForciblyEnded,
154
+                        'running' => $xml->running,
155
+                        'recording' => $xml->recording,
156
+                        'startTime' => $xml->startTime,
157
+                        'endTime' => $xml->endTime,
158
+                        'participantCount' => $xml->participantCount,
159
+                        'moderatorCount' => $xml->moderatorCount,
160
+                        'attendees' => $xml->attendees,
161
+                        'metadata' => $xml->metadata,
162
+                    );
163 163
     }
164 164
     if ($xml) {
165 165
         // Either failure or success without meeting info.
@@ -295,7 +295,7 @@  discard block
 block discarded – undo
295 295
 function bigbluebuttonbn_get_default_config_xml() {
296 296
     $xml = bigbluebuttonbn_wrap_xml_load_file(
297 297
         \mod_bigbluebuttonbn\locallib\bigbluebutton::action_url('getDefaultConfigXML')
298
-      );
298
+        );
299 299
     return $xml;
300 300
 }
301 301
 
@@ -396,7 +396,7 @@  discard block
 block discarded – undo
396 396
     foreach ($ids as $id) {
397 397
         $xml = bigbluebuttonbn_wrap_xml_load_file(
398 398
             \mod_bigbluebuttonbn\locallib\bigbluebutton::action_url('deleteRecordings', ['recordID' => $id])
399
-          );
399
+            );
400 400
         if ($xml && $xml->returncode != 'SUCCESS') {
401 401
             return false;
402 402
         }
@@ -415,7 +415,7 @@  discard block
 block discarded – undo
415 415
     foreach ($ids as $id) {
416 416
         $xml = bigbluebuttonbn_wrap_xml_load_file(
417 417
             \mod_bigbluebuttonbn\locallib\bigbluebutton::action_url('publishRecordings', ['recordID' => $id, 'publish' => $publish])
418
-          );
418
+            );
419 419
         if ($xml && $xml->returncode != 'SUCCESS') {
420 420
             return false;
421 421
         }
@@ -434,7 +434,7 @@  discard block
 block discarded – undo
434 434
     foreach ($ids as $id) {
435 435
         $xml = bigbluebuttonbn_wrap_xml_load_file(
436 436
             \mod_bigbluebuttonbn\locallib\bigbluebutton::action_url('updateRecordings', ['recordID' => $id] + (array) $params)
437
-          );
437
+            );
438 438
         if ($xml && $xml->returncode != 'SUCCESS') {
439 439
             return false;
440 440
         }
@@ -451,7 +451,7 @@  discard block
 block discarded – undo
451 451
 function bigbluebuttonbn_end_meeting($meetingid, $modpw) {
452 452
     $xml = bigbluebuttonbn_wrap_xml_load_file(
453 453
         \mod_bigbluebuttonbn\locallib\bigbluebutton::action_url('end', ['meetingID' => $meetingid, 'password' => $modpw])
454
-      );
454
+        );
455 455
     if ($xml) {
456 456
         // If the xml packet returned failure it displays the message to the user.
457 457
         return array('returncode' => $xml->returncode, 'message' => $xml->message, 'messageKey' => $xml->messageKey);
@@ -468,7 +468,7 @@  discard block
 block discarded – undo
468 468
 function bigbluebuttonbn_get_server_version() {
469 469
     $xml = bigbluebuttonbn_wrap_xml_load_file(
470 470
         \mod_bigbluebuttonbn\locallib\bigbluebutton::action_url()
471
-      );
471
+        );
472 472
     if ($xml && $xml->returncode == 'SUCCESS') {
473 473
         return $xml->version;
474 474
     }
@@ -535,10 +535,10 @@  discard block
 block discarded – undo
535 535
         }
536 536
         $options = array();
537 537
         $options['CURLOPT_HTTPHEADER'] = array(
538
-                 'Content-Type: '.$contenttype,
539
-                 'Content-Length: '.strlen($data),
540
-                 'Content-Language: en-US',
541
-               );
538
+                    'Content-Type: '.$contenttype,
539
+                    'Content-Length: '.strlen($data),
540
+                    'Content-Language: en-US',
541
+                );
542 542
 
543 543
         return $c->post($url, $data, $options);
544 544
     }
@@ -685,16 +685,16 @@  discard block
 block discarded – undo
685 685
         'all' => array(
686 686
             'name' => get_string('mod_form_field_participant_list_type_all', 'bigbluebuttonbn'),
687 687
             'children' => []
688
-          )
689
-      );
688
+            )
689
+        );
690 690
     $data['role'] = array(
691 691
         'name' => get_string('mod_form_field_participant_list_type_role', 'bigbluebuttonbn'),
692 692
         'children' => bigbluebuttonbn_get_roles_select($context)
693
-      );
693
+        );
694 694
     $data['user'] = array(
695 695
         'name' => get_string('mod_form_field_participant_list_type_user', 'bigbluebuttonbn'),
696 696
         'children' => bigbluebuttonbn_get_users_select($context)
697
-      );
697
+        );
698 698
     return $data;
699 699
 }
700 700
 
@@ -737,7 +737,7 @@  discard block
 block discarded – undo
737 737
         'selectiontype' => 'all',
738 738
         'selectionid' => 'all',
739 739
         'role' => BIGBLUEBUTTONBN_ROLE_VIEWER
740
-      );
740
+        );
741 741
     $defaultrules = explode(',', \mod_bigbluebuttonbn\locallib\config::get('participant_moderator_default'));
742 742
     foreach ($defaultrules as $defaultrule) {
743 743
         if ($defaultrule == '0') {
@@ -750,9 +750,9 @@  discard block
 block discarded – undo
750 750
             continue;
751 751
         }
752 752
         $participantlist[] = array(
753
-              'selectiontype' => 'role',
754
-              'selectionid' => $defaultrule,
755
-              'role' => BIGBLUEBUTTONBN_ROLE_MODERATOR);
753
+                'selectiontype' => 'role',
754
+                'selectionid' => $defaultrule,
755
+                'role' => BIGBLUEBUTTONBN_ROLE_MODERATOR);
756 756
     }
757 757
     return $participantlist;
758 758
 }
@@ -791,11 +791,11 @@  discard block
 block discarded – undo
791 791
             'all' => get_string('mod_form_field_participant_list_type_all', 'bigbluebuttonbn'),
792 792
             'role' => get_string('mod_form_field_participant_list_type_role', 'bigbluebuttonbn'),
793 793
             'user' => get_string('mod_form_field_participant_list_type_user', 'bigbluebuttonbn'),
794
-          ],
794
+            ],
795 795
         'type_selected' => 'all',
796 796
         'options' => ['all' => '---------------'],
797 797
         'selected' => 'all',
798
-      ];
798
+        ];
799 799
 }
800 800
 
801 801
 /**
@@ -1070,7 +1070,7 @@  discard block
 block discarded – undo
1070 1070
     // Ping again and refresh the cache.
1071 1071
     $meetinginfo = (array) bigbluebuttonbn_wrap_xml_load_file(
1072 1072
         \mod_bigbluebuttonbn\locallib\bigbluebutton::action_url('getMeetingInfo', ['meetingID' => $meetingid])
1073
-      );
1073
+        );
1074 1074
     $cache->set($meetingid, array('creation_time' => time(), 'meeting_info' => json_encode($meetinginfo)));
1075 1075
     return $meetinginfo;
1076 1076
 }
@@ -1482,8 +1482,8 @@  discard block
 block discarded – undo
1482 1482
     }
1483 1483
     $id = 'playbacks-'.$recording['recordID'];
1484 1484
     $recordingtypes = html_writer::start_tag('div', array('id' => $id, 'data-imported' => $dataimported,
1485
-          'data-meetingid' => $recording['meetingID'], 'data-recordingid' => $recording['recordID'],
1486
-          'title' => $title, $visibility => $visibility));
1485
+            'data-meetingid' => $recording['meetingID'], 'data-recordingid' => $recording['recordID'],
1486
+            'title' => $title, $visibility => $visibility));
1487 1487
     foreach ($recording['playbacks'] as $playback) {
1488 1488
         $recordingtypes .= bigbluebuttonbn_get_recording_data_row_type($recording, $bbbsession, $playback);
1489 1489
     }
@@ -1507,7 +1507,7 @@  discard block
 block discarded – undo
1507 1507
     }
1508 1508
     $text = get_string('view_recording_format_'.$playback['type'], 'bigbluebuttonbn');
1509 1509
     $href = $CFG->wwwroot . '/mod/bigbluebuttonbn/bbb_view.php?action=play&bn=' . $bbbsession['bigbluebuttonbn']->id .
1510
-      '&mid='.$recording['meetingID'] . '&rid=' . $recording['recordID'] . '&rtype=' . $playback['type'];
1510
+        '&mid='.$recording['meetingID'] . '&rid=' . $recording['recordID'] . '&rtype=' . $playback['type'];
1511 1511
     if (!isset($recording['imported']) || !isset($recording['protected']) || $recording['protected'] === 'false') {
1512 1512
         $href .= '&href='.urlencode(trim($playback['url']));
1513 1513
     }
@@ -1518,7 +1518,7 @@  discard block
 block discarded – undo
1518 1518
         'data-action' => 'play',
1519 1519
         'data-target' => $playback['type'],
1520 1520
         'data-href' => $href,
1521
-      );
1521
+        );
1522 1522
     if (!bigbluebuttonbn_is_bn_server() && !bigbluebuttonbn_is_valid_resource(trim($playback['url']))) {
1523 1523
         $linkattributes['class'] = 'btn btn-sm btn-warning';
1524 1524
         $linkattributes['title'] = get_string('view_recording_format_errror_unreachable', 'bigbluebuttonbn');
@@ -1668,10 +1668,10 @@  discard block
 block discarded – undo
1668 1668
             'id' => $id,
1669 1669
             'onclick' => $onclick,
1670 1670
             'data-action' => $data['action']
1671
-          );
1671
+            );
1672 1672
         if (!isset($recording['imported'])) {
1673 1673
             $linkattributes['data-links'] = bigbluebuttonbn_count_recording_imported_instances(
1674
-              $recording['recordID']);
1674
+                $recording['recordID']);
1675 1675
         }
1676 1676
         if (isset($data['disabled'])) {
1677 1677
             $iconattributes['class'] .= ' fa-' . $data['disabled'];
@@ -2212,8 +2212,8 @@  discard block
 block discarded – undo
2212 2212
     $activitytime = '';
2213 2213
     if ($time) {
2214 2214
         $activitytime = calendar_day_representation($time).' '.
2215
-          get_string('mod_form_field_notification_msg_at', 'bigbluebuttonbn').' '.
2216
-          calendar_time_representation($time);
2215
+            get_string('mod_form_field_notification_msg_at', 'bigbluebuttonbn').' '.
2216
+            calendar_time_representation($time);
2217 2217
     }
2218 2218
     return $activitytime;
2219 2219
 }
@@ -2513,7 +2513,7 @@  discard block
 block discarded – undo
2513 2513
         $renderer->render_group_element('participant_moderator_default',
2514 2514
             $renderer->render_group_element_configmultiselect('participant_moderator_default',
2515 2515
                 array_keys($owner), array_merge($owner, $roles))
2516
-          );
2516
+            );
2517 2517
     }
2518 2518
 }
2519 2519
 
@@ -2617,7 +2617,7 @@  discard block
 block discarded – undo
2617 2617
         return $output;
2618 2618
     }
2619 2619
     $output .= $OUTPUT->box_start('box boxalignleft adminerror alert alert-' . $type . ' alert-block fade in',
2620
-      'bigbluebuttonbn_view_general_warning') . "\n";
2620
+        'bigbluebuttonbn_view_general_warning') . "\n";
2621 2621
     $output .= '    ' . $message . "\n";
2622 2622
     $output .= '  <div class="singlebutton pull-right">' . "\n";
2623 2623
     if (!empty($href)) {
Please login to merge, or discard this patch.
Spacing   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 
29 29
 global $CFG;
30 30
 
31
-require_once(dirname(__FILE__).'/lib.php');
31
+require_once(dirname(__FILE__) . '/lib.php');
32 32
 
33 33
 /** @var BIGBLUEBUTTONBN_UPDATE_CACHE boolean set to true indicates that cache has to be updated */
34 34
 const BIGBLUEBUTTONBN_UPDATE_CACHE = true;
@@ -118,8 +118,8 @@  discard block
 block discarded – undo
118 118
     $data = null;
119 119
     if (!is_null($pname) && !is_null($purl)) {
120 120
         $method = 'POST';
121
-        $data = "<?xml version='1.0' encoding='UTF-8'?><modules><module name='presentation'><document url='".
122
-            $purl."' /></module></modules>";
121
+        $data = "<?xml version='1.0' encoding='UTF-8'?><modules><module name='presentation'><document url='" .
122
+            $purl . "' /></module></modules>";
123 123
     }
124 124
     $xml = bigbluebuttonbn_wrap_xml_load_file($createmeetingurl, $method, $data);
125 125
     if ($xml) {
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
         // Override imported flag with actual ID.
281 281
         $recording['imported'] = $recordimported->id;
282 282
         if (isset($recordimported->protected)) {
283
-            $recording['protected'] = (string) $recordimported->protected;
283
+            $recording['protected'] = (string)$recordimported->protected;
284 284
         }
285 285
         $recordsimportedarray[$recording['recordID']] = $recording;
286 286
     }
@@ -310,21 +310,21 @@  discard block
 block discarded – undo
310 310
     // Add formats.
311 311
     $playbackarray = array();
312 312
     foreach ($recording->playback->format as $format) {
313
-        $playbackarray[(string) $format->type] = array('type' => (string) $format->type,
314
-            'url' => trim((string) $format->url), 'length' => (string) $format->length);
313
+        $playbackarray[(string)$format->type] = array('type' => (string)$format->type,
314
+            'url' => trim((string)$format->url), 'length' => (string)$format->length);
315 315
         // Add preview per format when existing.
316 316
         if ($format->preview) {
317
-            $playbackarray[(string) $format->type]['preview'] = bigbluebuttonbn_get_recording_preview_images($format->preview);
317
+            $playbackarray[(string)$format->type]['preview'] = bigbluebuttonbn_get_recording_preview_images($format->preview);
318 318
         }
319 319
     }
320 320
     // Add the metadata to the recordings array.
321 321
     $metadataarray = bigbluebuttonbn_get_recording_array_meta(get_object_vars($recording->metadata));
322
-    $recordingarray = array('recordID' => (string) $recording->recordID,
323
-        'meetingID' => (string) $recording->meetingID, 'meetingName' => (string) $recording->name,
324
-        'published' => (string) $recording->published, 'startTime' => (string) $recording->startTime,
325
-        'endTime' => (string) $recording->endTime, 'playbacks' => $playbackarray);
322
+    $recordingarray = array('recordID' => (string)$recording->recordID,
323
+        'meetingID' => (string)$recording->meetingID, 'meetingName' => (string)$recording->name,
324
+        'published' => (string)$recording->published, 'startTime' => (string)$recording->startTime,
325
+        'endTime' => (string)$recording->endTime, 'playbacks' => $playbackarray);
326 326
     if (isset($recording->protected)) {
327
-        $recordingarray['protected'] = (string) $recording->protected;
327
+        $recordingarray['protected'] = (string)$recording->protected;
328 328
     }
329 329
     return $recordingarray + $metadataarray;
330 330
 }
@@ -339,9 +339,9 @@  discard block
 block discarded – undo
339 339
 function bigbluebuttonbn_get_recording_preview_images($preview) {
340 340
     $imagesarray = array();
341 341
     foreach ($preview->images->image as $image) {
342
-        $imagearray = array('url' => trim((string) $image));
342
+        $imagearray = array('url' => trim((string)$image));
343 343
         foreach ($image->attributes() as $attkey => $attvalue) {
344
-            $imagearray[$attkey] = (string) $attvalue;
344
+            $imagearray[$attkey] = (string)$attvalue;
345 345
         }
346 346
         array_push($imagesarray, $imagearray);
347 347
     }
@@ -361,7 +361,7 @@  discard block
 block discarded – undo
361 361
         if (is_object($value)) {
362 362
             $value = '';
363 363
         }
364
-        $metadataarray['meta_'.$key] = $value;
364
+        $metadataarray['meta_' . $key] = $value;
365 365
     }
366 366
     return $metadataarray;
367 367
 }
@@ -433,7 +433,7 @@  discard block
 block discarded – undo
433 433
     $ids = explode(',', $recordids);
434 434
     foreach ($ids as $id) {
435 435
         $xml = bigbluebuttonbn_wrap_xml_load_file(
436
-            \mod_bigbluebuttonbn\locallib\bigbluebutton::action_url('updateRecordings', ['recordID' => $id] + (array) $params)
436
+            \mod_bigbluebuttonbn\locallib\bigbluebutton::action_url('updateRecordings', ['recordID' => $id] + (array)$params)
437 437
           );
438 438
         if ($xml && $xml->returncode != 'SUCCESS') {
439 439
             return false;
@@ -498,7 +498,7 @@  discard block
 block discarded – undo
498 498
             return $xml;
499 499
         } catch (Exception $e) {
500 500
             libxml_use_internal_errors($previous);
501
-            $error = 'Caught exception: '.$e->getMessage();
501
+            $error = 'Caught exception: ' . $e->getMessage();
502 502
             debugging($error, DEBUG_DEVELOPER);
503 503
             return null;
504 504
         }
@@ -509,7 +509,7 @@  discard block
 block discarded – undo
509 509
         $response = simplexml_load_file($url, 'SimpleXMLElement', LIBXML_NOCDATA | LIBXML_NOBLANKS);
510 510
         return $response;
511 511
     } catch (Exception $e) {
512
-        $error = 'Caught exception: '.$e->getMessage();
512
+        $error = 'Caught exception: ' . $e->getMessage();
513 513
         debugging($error, DEBUG_DEVELOPER);
514 514
         libxml_use_internal_errors($previous);
515 515
         return null;
@@ -535,8 +535,8 @@  discard block
 block discarded – undo
535 535
         }
536 536
         $options = array();
537 537
         $options['CURLOPT_HTTPHEADER'] = array(
538
-                 'Content-Type: '.$contenttype,
539
-                 'Content-Length: '.strlen($data),
538
+                 'Content-Type: ' . $contenttype,
539
+                 'Content-Length: ' . strlen($data),
540 540
                  'Content-Language: en-US',
541 541
                );
542 542
 
@@ -557,7 +557,7 @@  discard block
 block discarded – undo
557 557
  * @return void
558 558
  */
559 559
 function bigbluebuttonbn_end_meeting_if_running($bigbluebuttonbn) {
560
-    $meetingid = $bigbluebuttonbn->meetingid.'-'.$bigbluebuttonbn->course.'-'.$bigbluebuttonbn->id;
560
+    $meetingid = $bigbluebuttonbn->meetingid . '-' . $bigbluebuttonbn->course . '-' . $bigbluebuttonbn->id;
561 561
     if (bigbluebuttonbn_is_meeting_running($meetingid)) {
562 562
         bigbluebuttonbn_end_meeting($meetingid, $bigbluebuttonbn->moderatorpass);
563 563
     }
@@ -577,9 +577,9 @@  discard block
 block discarded – undo
577 577
     if ($userroles) {
578 578
         $where = '';
579 579
         foreach ($userroles as $userrole) {
580
-            $where .= (empty($where) ? ' WHERE' : ' OR').' id=' . $userrole->roleid;
580
+            $where .= (empty($where) ? ' WHERE' : ' OR') . ' id=' . $userrole->roleid;
581 581
         }
582
-        $userroles = $DB->get_records_sql('SELECT * FROM {role}'.$where);
582
+        $userroles = $DB->get_records_sql('SELECT * FROM {role}' . $where);
583 583
     }
584 584
     return $userroles;
585 585
 }
@@ -602,7 +602,7 @@  discard block
 block discarded – undo
602 602
  * @return array $users
603 603
  */
604 604
 function bigbluebuttonbn_get_users(context $context = null) {
605
-    $users = (array) get_enrolled_users($context, '', 0, 'u.*', null, 0, 0, true);
605
+    $users = (array)get_enrolled_users($context, '', 0, 'u.*', null, 0, 0, true);
606 606
     foreach ($users as $key => $value) {
607 607
         $users[$key] = fullname($value);
608 608
     }
@@ -617,7 +617,7 @@  discard block
 block discarded – undo
617 617
  * @return array $users
618 618
  */
619 619
 function bigbluebuttonbn_get_users_select(context $context = null) {
620
-    $users = (array) get_enrolled_users($context, '', 0, 'u.*', null, 0, 0, true);
620
+    $users = (array)get_enrolled_users($context, '', 0, 'u.*', null, 0, 0, true);
621 621
     foreach ($users as $key => $value) {
622 622
         $users[$key] = array('id' => $value->id, 'name' => fullname($value));
623 623
     }
@@ -632,7 +632,7 @@  discard block
 block discarded – undo
632 632
  * @return array $roles
633 633
  */
634 634
 function bigbluebuttonbn_get_roles(context $context = null) {
635
-    $roles = (array) role_get_names($context);
635
+    $roles = (array)role_get_names($context);
636 636
     foreach ($roles as $key => $value) {
637 637
         $roles[$key] = $value->localname;
638 638
     }
@@ -647,7 +647,7 @@  discard block
 block discarded – undo
647 647
  * @return array $users
648 648
  */
649 649
 function bigbluebuttonbn_get_roles_select(context $context = null) {
650
-    $roles = (array) role_get_names($context);
650
+    $roles = (array)role_get_names($context);
651 651
     foreach ($roles as $key => $value) {
652 652
         $roles[$key] = array('id' => $value->id, 'name' => $value->localname);
653 653
     }
@@ -662,7 +662,7 @@  discard block
 block discarded – undo
662 662
  * @return object $role
663 663
  */
664 664
 function bigbluebuttonbn_get_role($id) {
665
-    $roles = (array) role_get_names();
665
+    $roles = (array)role_get_names();
666 666
     if (is_numeric($id) && isset($roles[$id])) {
667 667
         return (object)$roles[$id];
668 668
     }
@@ -819,7 +819,7 @@  discard block
 block discarded – undo
819 819
     if (!isguestuser()) {
820 820
         $userroles = bigbluebuttonbn_get_user_roles($context, $userid);
821 821
     }
822
-    return bigbluebuttonbn_is_moderator_validator($participantlist, $userid , $userroles);
822
+    return bigbluebuttonbn_is_moderator_validator($participantlist, $userid, $userroles);
823 823
 }
824 824
 
825 825
 /**
@@ -975,7 +975,7 @@  discard block
 block discarded – undo
975 975
 function bigbluebuttonbn_generate_nonce() {
976 976
     $mt = microtime();
977 977
     $rand = mt_rand();
978
-    return md5($mt.$rand);
978
+    return md5($mt . $rand);
979 979
 }
980 980
 
981 981
 /**
@@ -1065,10 +1065,10 @@  discard block
 block discarded – undo
1065 1065
     $now = time();
1066 1066
     if (!$updatecache && isset($result) && $now < ($result['creation_time'] + $cachettl)) {
1067 1067
         // Use the value in the cache.
1068
-        return (array) json_decode($result['meeting_info']);
1068
+        return (array)json_decode($result['meeting_info']);
1069 1069
     }
1070 1070
     // Ping again and refresh the cache.
1071
-    $meetinginfo = (array) bigbluebuttonbn_wrap_xml_load_file(
1071
+    $meetinginfo = (array)bigbluebuttonbn_wrap_xml_load_file(
1072 1072
         \mod_bigbluebuttonbn\locallib\bigbluebutton::action_url('getMeetingInfo', ['meetingID' => $meetingid])
1073 1073
       );
1074 1074
     $cache->set($meetingid, array('creation_time' => time(), 'meeting_info' => json_encode($meetinginfo)));
@@ -1179,7 +1179,7 @@  discard block
 block discarded – undo
1179 1179
  * @return object
1180 1180
  */
1181 1181
 function bigbluebuttonbn_set_config_xml($meetingid, $configxml) {
1182
-    $urldefaultconfig = \mod_bigbluebuttonbn\locallib\config::get('server_url').'api/setConfigXML?';
1182
+    $urldefaultconfig = \mod_bigbluebuttonbn\locallib\config::get('server_url') . 'api/setConfigXML?';
1183 1183
     $configxmlparams = bigbluebuttonbn_set_config_xml_params($meetingid, $configxml);
1184 1184
     $xml = bigbluebuttonbn_wrap_xml_load_file($urldefaultconfig, 'POST',
1185 1185
         $configxmlparams, 'application/x-www-form-urlencoded');
@@ -1195,8 +1195,8 @@  discard block
 block discarded – undo
1195 1195
  * @return string
1196 1196
  */
1197 1197
 function bigbluebuttonbn_set_config_xml_params($meetingid, $configxml) {
1198
-    $params = 'configXML='.urlencode($configxml).'&meetingID='.urlencode($meetingid);
1199
-    $configxmlparams = $params.'&checksum='.sha1('setConfigXML'.$params.\mod_bigbluebuttonbn\locallib\config::get('shared_secret'));
1198
+    $params = 'configXML=' . urlencode($configxml) . '&meetingID=' . urlencode($meetingid);
1199
+    $configxmlparams = $params . '&checksum=' . sha1('setConfigXML' . $params . \mod_bigbluebuttonbn\locallib\config::get('shared_secret'));
1200 1200
     return $configxmlparams;
1201 1201
 }
1202 1202
 
@@ -1210,7 +1210,7 @@  discard block
 block discarded – undo
1210 1210
  */
1211 1211
 function bigbluebuttonbn_set_config_xml_array($meetingid, $configxml) {
1212 1212
     $configxml = bigbluebuttonbn_setConfigXML($meetingid, $configxml);
1213
-    $configxmlarray = (array) $configxml;
1213
+    $configxmlarray = (array)$configxml;
1214 1214
     if ($configxmlarray['returncode'] != 'SUCCESS') {
1215 1215
         debugging('BigBlueButton was not able to set the custom config.xml file', DEBUG_DEVELOPER);
1216 1216
         return '';
@@ -1302,7 +1302,7 @@  discard block
 block discarded – undo
1302 1302
     global $USER;
1303 1303
     $starttime = $starttime - ($starttime % 1000);
1304 1304
     // Set formatted date.
1305
-    $dateformat = get_string('strftimerecentfull', 'langconfig').' %Z';
1305
+    $dateformat = get_string('strftimerecentfull', 'langconfig') . ' %Z';
1306 1306
     return userdate($starttime / 1000, $dateformat, usertimezone($USER->timezone));
1307 1307
 }
1308 1308
 
@@ -1418,7 +1418,7 @@  discard block
 block discarded – undo
1418 1418
  * @return string
1419 1419
  */
1420 1420
 function bigbluebuttonbn_get_recording_data_row_preview($recording) {
1421
-    $options = array('id' => 'preview-'.$recording['recordID']);
1421
+    $options = array('id' => 'preview-' . $recording['recordID']);
1422 1422
     if ($recording['published'] === 'false') {
1423 1423
         $options['hidden'] = 'hidden';
1424 1424
     }
@@ -1480,7 +1480,7 @@  discard block
 block discarded – undo
1480 1480
     if ($recording['published'] === 'false') {
1481 1481
         $visibility = 'hidden ';
1482 1482
     }
1483
-    $id = 'playbacks-'.$recording['recordID'];
1483
+    $id = 'playbacks-' . $recording['recordID'];
1484 1484
     $recordingtypes = html_writer::start_tag('div', array('id' => $id, 'data-imported' => $dataimported,
1485 1485
           'data-meetingid' => $recording['meetingID'], 'data-recordingid' => $recording['recordID'],
1486 1486
           'title' => $title, $visibility => $visibility));
@@ -1505,11 +1505,11 @@  discard block
 block discarded – undo
1505 1505
     if (!bigbluebuttonbn_include_recording_data_row_type($recording, $bbbsession, $playback)) {
1506 1506
         return '';
1507 1507
     }
1508
-    $text = get_string('view_recording_format_'.$playback['type'], 'bigbluebuttonbn');
1508
+    $text = get_string('view_recording_format_' . $playback['type'], 'bigbluebuttonbn');
1509 1509
     $href = $CFG->wwwroot . '/mod/bigbluebuttonbn/bbb_view.php?action=play&bn=' . $bbbsession['bigbluebuttonbn']->id .
1510
-      '&mid='.$recording['meetingID'] . '&rid=' . $recording['recordID'] . '&rtype=' . $playback['type'];
1510
+      '&mid=' . $recording['meetingID'] . '&rid=' . $recording['recordID'] . '&rtype=' . $playback['type'];
1511 1511
     if (!isset($recording['imported']) || !isset($recording['protected']) || $recording['protected'] === 'false') {
1512
-        $href .= '&href='.urlencode(trim($playback['url']));
1512
+        $href .= '&href=' . urlencode(trim($playback['url']));
1513 1513
     }
1514 1514
     $linkattributes = array(
1515 1515
         'id' => 'recording-play-' . $playback['type'] . '-' . $recording['recordID'],
@@ -1678,7 +1678,7 @@  discard block
 block discarded – undo
1678 1678
             $linkattributes['class'] = 'disabled';
1679 1679
             unset($linkattributes['onclick']);
1680 1680
         }
1681
-        $icon = new pix_icon('i/'.$data['tag'],
1681
+        $icon = new pix_icon('i/' . $data['tag'],
1682 1682
             get_string('view_recording_list_actionbar_' . $data['action'], 'bigbluebuttonbn'),
1683 1683
             'moodle', $iconattributes);
1684 1684
         return $OUTPUT->action_icon('#', $icon, null, $linkattributes, false);
@@ -1795,7 +1795,7 @@  discard block
 block discarded – undo
1795 1795
  */
1796 1796
 function bigbluebuttonbn_get_recording_table_row($bbbsession, $recording, $rowdata) {
1797 1797
     $row = new html_table_row();
1798
-    $row->id = 'recording-tr-'.$recording['recordID'];
1798
+    $row->id = 'recording-tr-' . $recording['recordID'];
1799 1799
     $row->attributes['data-imported'] = 'false';
1800 1800
     $texthead = '';
1801 1801
     $texttail = '';
@@ -1855,9 +1855,9 @@  discard block
 block discarded – undo
1855 1855
 function bigbluebuttonbn_send_notification_recording_ready($bigbluebuttonbn) {
1856 1856
     $sender = get_admin();
1857 1857
     // Prepare message.
1858
-    $messagetext = '<p>'.get_string('email_body_recording_ready_for', 'bigbluebuttonbn').
1859
-        ' &quot;' . $bigbluebuttonbn->name . '&quot; '.
1860
-        get_string('email_body_recording_ready_is_ready', 'bigbluebuttonbn').'.</p>';
1858
+    $messagetext = '<p>' . get_string('email_body_recording_ready_for', 'bigbluebuttonbn') .
1859
+        ' &quot;' . $bigbluebuttonbn->name . '&quot; ' .
1860
+        get_string('email_body_recording_ready_is_ready', 'bigbluebuttonbn') . '.</p>';
1861 1861
     $context = context_course::instance($bigbluebuttonbn->course);
1862 1862
     \mod_bigbluebuttonbn\locallib\notifier::notification_send($context, $sender, $bigbluebuttonbn, $messagetext);
1863 1863
 }
@@ -2079,7 +2079,7 @@  discard block
 block discarded – undo
2079 2079
     }
2080 2080
     // Prepare select for loading records based on existent bigbluebuttonbns.
2081 2081
     $sql = 'SELECT DISTINCT meetingid, bigbluebuttonbnid FROM {bigbluebuttonbn_logs} WHERE ';
2082
-    $sql .= '(bigbluebuttonbnid='.implode(' OR bigbluebuttonbnid=', array_keys($bigbluebuttonbns)).')';
2082
+    $sql .= '(bigbluebuttonbnid=' . implode(' OR bigbluebuttonbnid=', array_keys($bigbluebuttonbns)) . ')';
2083 2083
     // Include only Create events and exclude those with record not true.
2084 2084
     $sql .= ' AND log = ? AND meta LIKE ? AND meta LIKE ?';
2085 2085
     // Execute select for loading records based on existent bigbluebuttonbns.
@@ -2211,8 +2211,8 @@  discard block
 block discarded – undo
2211 2211
 function bigbluebuttonbn_format_activity_time($time) {
2212 2212
     $activitytime = '';
2213 2213
     if ($time) {
2214
-        $activitytime = calendar_day_representation($time).' '.
2215
-          get_string('mod_form_field_notification_msg_at', 'bigbluebuttonbn').' '.
2214
+        $activitytime = calendar_day_representation($time) . ' ' .
2215
+          get_string('mod_form_field_notification_msg_at', 'bigbluebuttonbn') . ' ' .
2216 2216
           calendar_time_representation($time);
2217 2217
     }
2218 2218
     return $activitytime;
@@ -2609,7 +2609,7 @@  discard block
 block discarded – undo
2609 2609
  *
2610 2610
  * @return string
2611 2611
  */
2612
-function bigbluebuttonbn_render_warning($message, $type='info', $href='', $text='', $class='') {
2612
+function bigbluebuttonbn_render_warning($message, $type = 'info', $href = '', $text = '', $class = '') {
2613 2613
     global $OUTPUT;
2614 2614
     $output = "\n";
2615 2615
     // Evaluates if config_warning is enabled.
@@ -2648,11 +2648,11 @@  discard block
 block discarded – undo
2648 2648
     if ($class == '') {
2649 2649
         $class = 'btn btn-secondary';
2650 2650
     }
2651
-    $output  = '  <form method="post" action="' . $href . '" class="form-inline">'."\n";
2652
-    $output .= '      <button type="submit" class="' . $class . '"'."\n";
2653
-    $output .= '          title="' . $title . '"'."\n";
2654
-    $output .= '          >' . $text . '</button>'."\n";
2655
-    $output .= '  </form>'."\n";
2651
+    $output  = '  <form method="post" action="' . $href . '" class="form-inline">' . "\n";
2652
+    $output .= '      <button type="submit" class="' . $class . '"' . "\n";
2653
+    $output .= '          title="' . $title . '"' . "\n";
2654
+    $output .= '          >' . $text . '</button>' . "\n";
2655
+    $output .= '  </form>' . "\n";
2656 2656
     return $output;
2657 2657
 }
2658 2658
 
Please login to merge, or discard this patch.
bbb_view.php 2 patches
Switch Indentation   +78 added lines, -78 removed lines patch added patch discarded remove patch
@@ -61,94 +61,94 @@
 block discarded – undo
61 61
 }
62 62
 
63 63
 switch (strtolower($action)) {
64
-    case 'logout':
65
-        if (isset($errors) && $errors != '') {
66
-            bigbluebutton_bbb_view_errors($errors, $id);
67
-            break;
68
-        }
69
-        if (is_null($bbbsession)) {
70
-            bigbluebutton_bbb_view_close_window_manually();
71
-            break;
72
-        }
73
-        // Moodle event logger: Create an event for meeting left.
74
-        bigbluebuttonbn_event_log(\mod_bigbluebuttonbn\event\events::$events['meeting_left'], $bigbluebuttonbn);
75
-        // Update the cache.
76
-        $meetinginfo = bigbluebuttonbn_get_meeting_info($bbbsession['meetingid'], BIGBLUEBUTTONBN_UPDATE_CACHE);
77
-        // Close the tab or window where BBB was opened.
78
-        bigbluebutton_bbb_view_close_window();
79
-        break;
80
-    case 'join':
81
-        if (is_null($bbbsession)) {
82
-            print_error('view_error_unable_join', 'bigbluebuttonbn');
83
-            break;
84
-        }
85
-        // See if the session is in progress.
86
-        if (bigbluebuttonbn_is_meeting_running($bbbsession['meetingid'])) {
87
-            // Since the meeting is already running, we just join the session.
88
-            bigbluebutton_bbb_view_join_meeting($bbbsession, $cm, $bigbluebuttonbn);
89
-            break;
90
-        }
91
-        // If user is not administrator nor moderator (user is steudent) and waiting is required.
92
-        if (!$bbbsession['administrator'] && !$bbbsession['moderator'] && $bbbsession['wait']) {
93
-            header('Location: '.$bbbsession['logoutURL']);
64
+        case 'logout':
65
+            if (isset($errors) && $errors != '') {
66
+                bigbluebutton_bbb_view_errors($errors, $id);
67
+                break;
68
+            }
69
+            if (is_null($bbbsession)) {
70
+                bigbluebutton_bbb_view_close_window_manually();
71
+                break;
72
+            }
73
+            // Moodle event logger: Create an event for meeting left.
74
+            bigbluebuttonbn_event_log(\mod_bigbluebuttonbn\event\events::$events['meeting_left'], $bigbluebuttonbn);
75
+            // Update the cache.
76
+            $meetinginfo = bigbluebuttonbn_get_meeting_info($bbbsession['meetingid'], BIGBLUEBUTTONBN_UPDATE_CACHE);
77
+            // Close the tab or window where BBB was opened.
78
+            bigbluebutton_bbb_view_close_window();
94 79
             break;
95
-        }
96
-        // As the meeting doesn't exist, try to create it.
97
-        $response = bigbluebuttonbn_get_create_meeting_array(
98
-            bigbluebutton_bbb_view_create_meeting_data($bbbsession),
99
-            bigbluebutton_bbb_view_create_meeting_metadata($bbbsession),
100
-            $bbbsession['presentation']['name'],
101
-            $bbbsession['presentation']['url']
102
-        );
103
-        if (empty($response)) {
104
-            // The server is unreachable.
105
-            if ($bbbsession['administrator']) {
106
-                print_error('view_error_unable_join', 'bigbluebuttonbn',
107
-                    $CFG->wwwroot.'/admin/settings.php?section=modsettingbigbluebuttonbn');
80
+        case 'join':
81
+            if (is_null($bbbsession)) {
82
+                print_error('view_error_unable_join', 'bigbluebuttonbn');
83
+                break;
84
+            }
85
+            // See if the session is in progress.
86
+            if (bigbluebuttonbn_is_meeting_running($bbbsession['meetingid'])) {
87
+                // Since the meeting is already running, we just join the session.
88
+                bigbluebutton_bbb_view_join_meeting($bbbsession, $cm, $bigbluebuttonbn);
108 89
                 break;
109 90
             }
110
-            if ($bbbsession['moderator']) {
111
-                print_error('view_error_unable_join_teacher', 'bigbluebuttonbn',
91
+            // If user is not administrator nor moderator (user is steudent) and waiting is required.
92
+            if (!$bbbsession['administrator'] && !$bbbsession['moderator'] && $bbbsession['wait']) {
93
+                header('Location: '.$bbbsession['logoutURL']);
94
+                break;
95
+            }
96
+            // As the meeting doesn't exist, try to create it.
97
+            $response = bigbluebuttonbn_get_create_meeting_array(
98
+                bigbluebutton_bbb_view_create_meeting_data($bbbsession),
99
+                bigbluebutton_bbb_view_create_meeting_metadata($bbbsession),
100
+                $bbbsession['presentation']['name'],
101
+                $bbbsession['presentation']['url']
102
+            );
103
+            if (empty($response)) {
104
+                // The server is unreachable.
105
+                if ($bbbsession['administrator']) {
106
+                    print_error('view_error_unable_join', 'bigbluebuttonbn',
107
+                        $CFG->wwwroot.'/admin/settings.php?section=modsettingbigbluebuttonbn');
108
+                    break;
109
+                }
110
+                if ($bbbsession['moderator']) {
111
+                    print_error('view_error_unable_join_teacher', 'bigbluebuttonbn',
112
+                        $CFG->wwwroot.'/admin/settings.php?section=modsettingbigbluebuttonbn');
113
+                    break;
114
+                }
115
+                print_error('view_error_unable_join_student', 'bigbluebuttonbn',
112 116
                     $CFG->wwwroot.'/admin/settings.php?section=modsettingbigbluebuttonbn');
113 117
                 break;
114 118
             }
115
-            print_error('view_error_unable_join_student', 'bigbluebuttonbn',
116
-                $CFG->wwwroot.'/admin/settings.php?section=modsettingbigbluebuttonbn');
117
-            break;
118
-        }
119
-        if ($response['returncode'] == 'FAILED') {
120
-            // The meeting was not created.
121
-            if (!$printerrorkey) {
122
-                print_error($response['message'], 'bigbluebuttonbn');
119
+            if ($response['returncode'] == 'FAILED') {
120
+                // The meeting was not created.
121
+                if (!$printerrorkey) {
122
+                    print_error($response['message'], 'bigbluebuttonbn');
123
+                    break;
124
+                }
125
+                $printerrorkey = bigbluebuttonbn_get_error_key($response['messageKey'], 'view_error_create');
126
+                print_error($printerrorkey, 'bigbluebuttonbn');
127
+                break;
128
+            }
129
+            if ($response['hasBeenForciblyEnded'] == 'true') {
130
+                print_error(get_string('index_error_forciblyended', 'bigbluebuttonbn'));
123 131
                 break;
124 132
             }
125
-            $printerrorkey = bigbluebuttonbn_get_error_key($response['messageKey'], 'view_error_create');
126
-            print_error($printerrorkey, 'bigbluebuttonbn');
133
+            // Moodle event logger: Create an event for meeting created.
134
+            bigbluebuttonbn_event_log(\mod_bigbluebuttonbn\event\events::$events['meeting_create'], $bigbluebuttonbn);
135
+            // Internal logger: Insert a record with the meeting created.
136
+            $overrides = array('meetingid' => $bbbsession['meetingid']);
137
+            $meta = '{"record":'.($bbbsession['record'] ? 'true' : 'false').'}';
138
+            bigbluebuttonbn_log($bbbsession['bigbluebuttonbn'], BIGBLUEBUTTONBN_LOG_EVENT_CREATE, $overrides, $meta);
139
+            // Since the meeting is already running, we just join the session.
140
+            bigbluebutton_bbb_view_join_meeting($bbbsession, $cm, $bigbluebuttonbn);
127 141
             break;
128
-        }
129
-        if ($response['hasBeenForciblyEnded'] == 'true') {
130
-            print_error(get_string('index_error_forciblyended', 'bigbluebuttonbn'));
142
+        case 'play':
143
+            $href = bigbluebutton_bbb_view_playback_href($href, $mid, $rid, $rtype);
144
+            // Moodle event logger: Create an event for meeting left.
145
+            bigbluebuttonbn_event_log(\mod_bigbluebuttonbn\event\events::$events['recording_play'], $bigbluebuttonbn,
146
+                ['other' => $rid]);
147
+            // Execute the redirect.
148
+            header('Location: '.urldecode($href));
131 149
             break;
132
-        }
133
-        // Moodle event logger: Create an event for meeting created.
134
-        bigbluebuttonbn_event_log(\mod_bigbluebuttonbn\event\events::$events['meeting_create'], $bigbluebuttonbn);
135
-        // Internal logger: Insert a record with the meeting created.
136
-        $overrides = array('meetingid' => $bbbsession['meetingid']);
137
-        $meta = '{"record":'.($bbbsession['record'] ? 'true' : 'false').'}';
138
-        bigbluebuttonbn_log($bbbsession['bigbluebuttonbn'], BIGBLUEBUTTONBN_LOG_EVENT_CREATE, $overrides, $meta);
139
-        // Since the meeting is already running, we just join the session.
140
-        bigbluebutton_bbb_view_join_meeting($bbbsession, $cm, $bigbluebuttonbn);
141
-        break;
142
-    case 'play':
143
-        $href = bigbluebutton_bbb_view_playback_href($href, $mid, $rid, $rtype);
144
-        // Moodle event logger: Create an event for meeting left.
145
-        bigbluebuttonbn_event_log(\mod_bigbluebuttonbn\event\events::$events['recording_play'], $bigbluebuttonbn,
146
-            ['other' => $rid]);
147
-        // Execute the redirect.
148
-        header('Location: '.urldecode($href));
149
-        break;
150
-    default:
151
-        bigbluebutton_bbb_view_close_window();
150
+        default:
151
+            bigbluebutton_bbb_view_close_window();
152 152
 }
153 153
 
154 154
 /**
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -23,8 +23,8 @@  discard block
 block discarded – undo
23 23
  * @author    Jesus Federico  (jesus [at] blindsidenetworks [dt] com)
24 24
  */
25 25
 
26
-require_once(dirname(dirname(dirname(__FILE__))).'/config.php');
27
-require_once(dirname(__FILE__).'/locallib.php');
26
+require_once(dirname(dirname(dirname(__FILE__))) . '/config.php');
27
+require_once(dirname(__FILE__) . '/locallib.php');
28 28
 
29 29
 $action = required_param('action', PARAM_TEXT);
30 30
 $id = optional_param('id', 0, PARAM_INT);
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
         }
91 91
         // If user is not administrator nor moderator (user is steudent) and waiting is required.
92 92
         if (!$bbbsession['administrator'] && !$bbbsession['moderator'] && $bbbsession['wait']) {
93
-            header('Location: '.$bbbsession['logoutURL']);
93
+            header('Location: ' . $bbbsession['logoutURL']);
94 94
             break;
95 95
         }
96 96
         // As the meeting doesn't exist, try to create it.
@@ -104,16 +104,16 @@  discard block
 block discarded – undo
104 104
             // The server is unreachable.
105 105
             if ($bbbsession['administrator']) {
106 106
                 print_error('view_error_unable_join', 'bigbluebuttonbn',
107
-                    $CFG->wwwroot.'/admin/settings.php?section=modsettingbigbluebuttonbn');
107
+                    $CFG->wwwroot . '/admin/settings.php?section=modsettingbigbluebuttonbn');
108 108
                 break;
109 109
             }
110 110
             if ($bbbsession['moderator']) {
111 111
                 print_error('view_error_unable_join_teacher', 'bigbluebuttonbn',
112
-                    $CFG->wwwroot.'/admin/settings.php?section=modsettingbigbluebuttonbn');
112
+                    $CFG->wwwroot . '/admin/settings.php?section=modsettingbigbluebuttonbn');
113 113
                 break;
114 114
             }
115 115
             print_error('view_error_unable_join_student', 'bigbluebuttonbn',
116
-                $CFG->wwwroot.'/admin/settings.php?section=modsettingbigbluebuttonbn');
116
+                $CFG->wwwroot . '/admin/settings.php?section=modsettingbigbluebuttonbn');
117 117
             break;
118 118
         }
119 119
         if ($response['returncode'] == 'FAILED') {
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
         bigbluebuttonbn_event_log(\mod_bigbluebuttonbn\event\events::$events['meeting_create'], $bigbluebuttonbn);
135 135
         // Internal logger: Insert a record with the meeting created.
136 136
         $overrides = array('meetingid' => $bbbsession['meetingid']);
137
-        $meta = '{"record":'.($bbbsession['record'] ? 'true' : 'false').'}';
137
+        $meta = '{"record":' . ($bbbsession['record'] ? 'true' : 'false') . '}';
138 138
         bigbluebuttonbn_log($bbbsession['bigbluebuttonbn'], BIGBLUEBUTTONBN_LOG_EVENT_CREATE, $overrides, $meta);
139 139
         // Since the meeting is already running, we just join the session.
140 140
         bigbluebutton_bbb_view_join_meeting($bbbsession, $cm, $bigbluebuttonbn);
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
         bigbluebuttonbn_event_log(\mod_bigbluebuttonbn\event\events::$events['recording_play'], $bigbluebuttonbn,
146 146
             ['other' => $rid]);
147 147
         // Execute the redirect.
148
-        header('Location: '.urldecode($href));
148
+        header('Location: ' . urldecode($href));
149 149
         break;
150 150
     default:
151 151
         bigbluebutton_bbb_view_close_window();
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
         $data['welcome'] .= '<br><br>';
231 231
         $data['welcome'] .= str_replace(
232 232
             '%duration%',
233
-            (string) $durationtime,
233
+            (string)$durationtime,
234 234
             get_string('bbbdurationwarning', 'bigbluebuttonbn')
235 235
           );
236 236
     }
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
     $meetinginfo = bigbluebuttonbn_get_meeting_info($bbbsession['meetingid'], BIGBLUEBUTTONBN_UPDATE_CACHE);
319 319
     if ($bbbsession['userlimit'] > 0 && intval($meetinginfo['participantCount']) >= $bbbsession['userlimit']) {
320 320
         // No more users allowed to join.
321
-        header('Location: '.$bbbsession['logoutURL']);
321
+        header('Location: ' . $bbbsession['logoutURL']);
322 322
         return;
323 323
     }
324 324
     // Build the URL.
@@ -337,7 +337,7 @@  discard block
 block discarded – undo
337 337
     bigbluebuttonbn_participant_joined($bbbsession['meetingid'],
338 338
         ($bbbsession['administrator'] || $bbbsession['moderator']));
339 339
     // Execute the redirect.
340
-    header('Location: '.$joinurl);
340
+    header('Location: ' . $joinurl);
341 341
 }
342 342
 
343 343
 /**
@@ -349,13 +349,13 @@  discard block
 block discarded – undo
349 349
  */
350 350
 function bigbluebutton_bbb_view_errors($serrors, $id) {
351 351
     global $CFG, $OUTPUT;
352
-    $errors = (array) json_decode(urldecode($serrors));
352
+    $errors = (array)json_decode(urldecode($serrors));
353 353
     $msgerrors = '';
354 354
     foreach ($errors as $error) {
355
-        $msgerrors .= html_writer::tag('p', $error->{'message'}, array('class' => 'alert alert-danger'))."\n";
355
+        $msgerrors .= html_writer::tag('p', $error->{'message'}, array('class' => 'alert alert-danger')) . "\n";
356 356
     }
357 357
     echo $OUTPUT->header();
358 358
     print_error('view_error_bigbluebutton', 'bigbluebuttonbn',
359
-        $CFG->wwwroot.'/mod/bigbluebuttonbn/view.php?id='.$id, $msgerrors, $serrors);
359
+        $CFG->wwwroot . '/mod/bigbluebuttonbn/view.php?id=' . $id, $msgerrors, $serrors);
360 360
     echo $OUTPUT->footer();
361 361
 }
Please login to merge, or discard this patch.