Completed
Pull Request — master (#164)
by Jesus
02:01
created
classes/locallib/notifier.php 1 patch
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -45,29 +45,29 @@  discard block
 block discarded – undo
45 45
      */
46 46
     public static function htmlmsg_instance_updated($msg)
47 47
     {
48
-        $messagetext = '<p>'.$msg->activity_type.' "'.$msg->activity_title.'" '.
49
-            get_string('email_body_notification_meeting_has_been', 'bigbluebuttonbn').' '.$msg->action.'.</p>'."\n";
50
-        $messagetext .= '<p><b>'.$msg->activity_title.'</b> '.
51
-            get_string('email_body_notification_meeting_details', 'bigbluebuttonbn').':'."\n";
52
-        $messagetext .= '<table border="0" style="margin: 5px 0 0 20px"><tbody>'."\n";
53
-        $messagetext .= '<tr><td style="font-weight:bold;color:#555;">'.
54
-            get_string('email_body_notification_meeting_title', 'bigbluebuttonbn').': </td><td>'."\n";
55
-        $messagetext .= $msg->activity_title.'</td></tr>'."\n";
56
-        $messagetext .= '<tr><td style="font-weight:bold;color:#555;">'.
57
-            get_string('email_body_notification_meeting_description', 'bigbluebuttonbn').': </td><td>'."\n";
58
-        $messagetext .= $msg->activity_description.'</td></tr>'."\n";
59
-        $messagetext .= '<tr><td style="font-weight:bold;color:#555;">'.
60
-            get_string('email_body_notification_meeting_start_date', 'bigbluebuttonbn').': </td><td>'."\n";
61
-        $messagetext .= $msg->activity_openingtime.'</td></tr>'."\n";
62
-        $messagetext .= '<tr><td style="font-weight:bold;color:#555;">'.
63
-            get_string('email_body_notification_meeting_end_date', 'bigbluebuttonbn').': </td><td>'."\n";
64
-        $messagetext .= $msg->activity_closingtime.'</td></tr>'."\n";
65
-        $messagetext .= '<tr><td style="font-weight:bold;color:#555;">'.$msg->action.' '.
66
-            get_string('email_body_notification_meeting_by', 'bigbluebuttonbn').': </td><td>'."\n";
67
-        $messagetext .= $msg->activity_owner.'</td></tr></tbody></table></p>'."\n";
68
-        $messagetext .= '<p><hr/><br/>'.get_string('email_footer_sent_by', 'bigbluebuttonbn').' '.
69
-            $msg->user_name.'('.$msg->user_email.') ';
70
-        $messagetext .= get_string('email_footer_sent_from', 'bigbluebuttonbn').' '.$msg->course_name.'.</p>';
48
+        $messagetext = '<p>' . $msg->activity_type . ' "' . $msg->activity_title . '" ' .
49
+            get_string('email_body_notification_meeting_has_been', 'bigbluebuttonbn') . ' ' . $msg->action . '.</p>' . "\n";
50
+        $messagetext .= '<p><b>' . $msg->activity_title . '</b> ' .
51
+            get_string('email_body_notification_meeting_details', 'bigbluebuttonbn') . ':' . "\n";
52
+        $messagetext .= '<table border="0" style="margin: 5px 0 0 20px"><tbody>' . "\n";
53
+        $messagetext .= '<tr><td style="font-weight:bold;color:#555;">' .
54
+            get_string('email_body_notification_meeting_title', 'bigbluebuttonbn') . ': </td><td>' . "\n";
55
+        $messagetext .= $msg->activity_title . '</td></tr>' . "\n";
56
+        $messagetext .= '<tr><td style="font-weight:bold;color:#555;">' .
57
+            get_string('email_body_notification_meeting_description', 'bigbluebuttonbn') . ': </td><td>' . "\n";
58
+        $messagetext .= $msg->activity_description . '</td></tr>' . "\n";
59
+        $messagetext .= '<tr><td style="font-weight:bold;color:#555;">' .
60
+            get_string('email_body_notification_meeting_start_date', 'bigbluebuttonbn') . ': </td><td>' . "\n";
61
+        $messagetext .= $msg->activity_openingtime . '</td></tr>' . "\n";
62
+        $messagetext .= '<tr><td style="font-weight:bold;color:#555;">' .
63
+            get_string('email_body_notification_meeting_end_date', 'bigbluebuttonbn') . ': </td><td>' . "\n";
64
+        $messagetext .= $msg->activity_closingtime . '</td></tr>' . "\n";
65
+        $messagetext .= '<tr><td style="font-weight:bold;color:#555;">' . $msg->action . ' ' .
66
+            get_string('email_body_notification_meeting_by', 'bigbluebuttonbn') . ': </td><td>' . "\n";
67
+        $messagetext .= $msg->activity_owner . '</td></tr></tbody></table></p>' . "\n";
68
+        $messagetext .= '<p><hr/><br/>' . get_string('email_footer_sent_by', 'bigbluebuttonbn') . ' ' .
69
+            $msg->user_name . '(' . $msg->user_email . ') ';
70
+        $messagetext .= get_string('email_footer_sent_from', 'bigbluebuttonbn') . ' ' . $msg->course_name . '.</p>';
71 71
         return $messagetext;
72 72
     }
73 73
 
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
         $course = $coursemodinfo->get_course($bigbluebuttonbn->course);
86 86
         $sender = $USER;
87 87
         // Prepare message.
88
-        $msg = (object) array();
88
+        $msg = (object)array();
89 89
         // Build the message_body.
90 90
         $msg->action = $action;
91 91
         $msg->activity_type = '';
@@ -117,9 +117,9 @@  discard block
 block discarded – undo
117 117
      */
118 118
     public static function htmlmsg_recording_ready($bigbluebuttonbn)
119 119
     {
120
-        return '<p>'.get_string('email_body_recording_ready_for', 'bigbluebuttonbn').
121
-            ' &quot;' . $bigbluebuttonbn->name . '&quot; '.
122
-            get_string('email_body_recording_ready_is_ready', 'bigbluebuttonbn').'.</p>';
120
+        return '<p>' . get_string('email_body_recording_ready_for', 'bigbluebuttonbn') .
121
+            ' &quot;' . $bigbluebuttonbn->name . '&quot; ' .
122
+            get_string('email_body_recording_ready_is_ready', 'bigbluebuttonbn') . '.</p>';
123 123
     }
124 124
 
125 125
     /**
Please login to merge, or discard this patch.
lib.php 1 patch
Spacing   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -28,23 +28,23 @@  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
 // JWT is included in Moodle 3.7 core, but a local package is still needed for backward compatibility.
43 43
 if (!class_exists('\Firebase\JWT\JWT')) {
44
-    if (file_exists($CFG->libdir.'/php-jwt/src/JWT.php')) {
45
-        require_once($CFG->libdir.'/php-jwt/src/JWT.php');
44
+    if (file_exists($CFG->libdir . '/php-jwt/src/JWT.php')) {
45
+        require_once($CFG->libdir . '/php-jwt/src/JWT.php');
46 46
     } else {
47
-        require_once($CFG->dirroot.'/mod/bigbluebuttonbn/vendor/firebase/php-jwt/src/JWT.php');
47
+        require_once($CFG->dirroot . '/mod/bigbluebuttonbn/vendor/firebase/php-jwt/src/JWT.php');
48 48
     }
49 49
 }
50 50
 
@@ -52,8 +52,8 @@  discard block
 block discarded – undo
52 52
     $CFG->bigbluebuttonbn = array();
53 53
 }
54 54
 
55
-if (file_exists(dirname(__FILE__).'/config.php')) {
56
-    require_once(dirname(__FILE__).'/config.php');
55
+if (file_exists(dirname(__FILE__) . '/config.php')) {
56
+    require_once(dirname(__FILE__) . '/config.php');
57 57
 }
58 58
 
59 59
 /*
@@ -111,19 +111,19 @@  discard block
 block discarded – undo
111 111
         return null;
112 112
     }
113 113
     $features = array(
114
-        (string) FEATURE_IDNUMBER => true,
115
-        (string) FEATURE_GROUPS => true,
116
-        (string) FEATURE_GROUPINGS => true,
117
-        (string) FEATURE_GROUPMEMBERSONLY => true,
118
-        (string) FEATURE_MOD_INTRO => true,
119
-        (string) FEATURE_BACKUP_MOODLE2 => true,
120
-        (string) FEATURE_COMPLETION_TRACKS_VIEWS => true,
121
-        (string) FEATURE_COMPLETION_HAS_RULES => true,
122
-        (string) FEATURE_GRADE_HAS_GRADE => false,
123
-        (string) FEATURE_GRADE_OUTCOMES => false,
124
-        (string) FEATURE_SHOW_DESCRIPTION => true,
114
+        (string)FEATURE_IDNUMBER => true,
115
+        (string)FEATURE_GROUPS => true,
116
+        (string)FEATURE_GROUPINGS => true,
117
+        (string)FEATURE_GROUPMEMBERSONLY => true,
118
+        (string)FEATURE_MOD_INTRO => true,
119
+        (string)FEATURE_BACKUP_MOODLE2 => true,
120
+        (string)FEATURE_COMPLETION_TRACKS_VIEWS => true,
121
+        (string)FEATURE_COMPLETION_HAS_RULES => true,
122
+        (string)FEATURE_GRADE_HAS_GRADE => false,
123
+        (string)FEATURE_GRADE_OUTCOMES => false,
124
+        (string)FEATURE_SHOW_DESCRIPTION => true,
125 125
     );
126
-    if (isset($features[(string) $feature])) {
126
+    if (isset($features[(string)$feature])) {
127 127
         return $features[$feature];
128 128
     }
129 129
     return null;
@@ -321,7 +321,7 @@  discard block
 block discarded – undo
321 321
 {
322 322
     global $DB;
323 323
     $sql  = "SELECT * FROM {bigbluebuttonbn_logs} ";
324
-    $sql .= "WHERE bigbluebuttonbnid = ? AND log = ? AND ". $DB->sql_compare_text('meta') . " = ?";
324
+    $sql .= "WHERE bigbluebuttonbnid = ? AND log = ? AND " . $DB->sql_compare_text('meta') . " = ?";
325 325
     $logs = $DB->get_records_sql($sql, array($bigbluebuttonbn->id, BIGBLUEBUTTONBN_LOG_EVENT_CREATE, "{\"record\":true}"));
326 326
     $meta = "{\"has_recordings\":" . empty($logs) ? "true" : "false" . "}";
327 327
     bigbluebuttonbn_log($bigbluebuttonbn, BIGBLUEBUTTONBN_LOG_EVENT_DELETE, [], $meta);
@@ -343,7 +343,7 @@  discard block
 block discarded – undo
343 343
 {
344 344
     if ($completed = bigbluebuttonbn_user_complete($course, $user, $bigbluebuttonbn)) {
345 345
         return fullname($user) . ' ' . get_string('view_message_has_joined', 'bigbluebuttonbn') . ' ' .
346
-            get_string('view_message_session_for', 'bigbluebuttonbn') . ' ' . (string) $completed . ' ' .
346
+            get_string('view_message_session_for', 'bigbluebuttonbn') . ' ' . (string)$completed . ' ' .
347 347
             get_string('view_message_times', 'bigbluebuttonbn');
348 348
     }
349 349
     return '';
@@ -545,7 +545,7 @@  discard block
 block discarded – undo
545 545
  */
546 546
 function bigbluebuttonbn_reset_recordings($courseid)
547 547
 {
548
-    require_once(__DIR__.'/locallib.php');
548
+    require_once(__DIR__ . '/locallib.php');
549 549
     // Criteria for search [courseid | bigbluebuttonbn=null | subset=false | includedeleted=true].
550 550
     $recordings = bigbluebuttonbn_get_recordings($courseid, null, false, true);
551 551
     // Remove all the recordings.
@@ -617,16 +617,16 @@  discard block
 block discarded – undo
617 617
     if ($bigbluebuttonbn->visible) {
618 618
         $classes = 'class="dimmed" ';
619 619
     }
620
-    $str  = '<div class="bigbluebuttonbn overview">'."\n";
621
-    $str .= '  <div class="name">'.get_string('modulename', 'bigbluebuttonbn').':&nbsp;'."\n";
622
-    $str .= '    <a '.$classes.'href="'.$CFG->wwwroot.'/mod/bigbluebuttonbn/view.php?id='.$bigbluebuttonbn->coursemodule.
623
-      '">'.$bigbluebuttonbn->name.'</a>'."\n";
624
-    $str .= '  </div>'."\n";
625
-    $str .= '  <div class="info">'.get_string($start, 'bigbluebuttonbn').': '.userdate($bigbluebuttonbn->openingtime).
626
-        '</div>'."\n";
627
-    $str .= '  <div class="info">'.get_string('ends_at', 'bigbluebuttonbn').': '.userdate($bigbluebuttonbn->closingtime)
628
-      .'</div>'."\n";
629
-    $str .= '</div>'."\n";
620
+    $str  = '<div class="bigbluebuttonbn overview">' . "\n";
621
+    $str .= '  <div class="name">' . get_string('modulename', 'bigbluebuttonbn') . ':&nbsp;' . "\n";
622
+    $str .= '    <a ' . $classes . 'href="' . $CFG->wwwroot . '/mod/bigbluebuttonbn/view.php?id=' . $bigbluebuttonbn->coursemodule .
623
+      '">' . $bigbluebuttonbn->name . '</a>' . "\n";
624
+    $str .= '  </div>' . "\n";
625
+    $str .= '  <div class="info">' . get_string($start, 'bigbluebuttonbn') . ': ' . userdate($bigbluebuttonbn->openingtime) .
626
+        '</div>' . "\n";
627
+    $str .= '  <div class="info">' . get_string('ends_at', 'bigbluebuttonbn') . ': ' . userdate($bigbluebuttonbn->closingtime)
628
+      .'</div>' . "\n";
629
+    $str .= '</div>' . "\n";
630 630
     return $str;
631 631
 }
632 632
 
@@ -718,7 +718,7 @@  discard block
 block discarded – undo
718 718
  **/
719 719
 function bigbluebuttonbn_process_pre_save_instance(&$bigbluebuttonbn)
720 720
 {
721
-    require_once(__DIR__.'/locallib.php');
721
+    require_once(__DIR__ . '/locallib.php');
722 722
     $bigbluebuttonbn->timemodified = time();
723 723
     if ((integer)$bigbluebuttonbn->instance == 0) {
724 724
         $bigbluebuttonbn->meetingid = 0;
@@ -913,7 +913,7 @@  discard block
 block discarded – undo
913 913
     if (count($files) == 1) {
914 914
         // Get the first (and only) file.
915 915
         $file = reset($files);
916
-        $filesrc = '/'.$file->get_filename();
916
+        $filesrc = '/' . $file->get_filename();
917 917
     }
918 918
     return $filesrc;
919 919
 }
@@ -985,7 +985,7 @@  discard block
 block discarded – undo
985 985
     if (!$filename) {
986 986
         return false;
987 987
     }
988
-    $fullpath = "/$context->id/mod_bigbluebuttonbn/$filearea/0/".$filename;
988
+    $fullpath = "/$context->id/mod_bigbluebuttonbn/$filearea/0/" . $filename;
989 989
     $fs = get_file_storage();
990 990
     $file = $fs->get_file_by_hash(sha1($fullpath));
991 991
     if (!$file || $file->is_directory()) {
Please login to merge, or discard this patch.
brokerlib.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
 {
216 216
     $callbackresponse['status'] = true;
217 217
     $callbackresponse['found'] = true;
218
-    $callbackresponse['published'] = (string) $recording['published'];
218
+    $callbackresponse['published'] = (string)$recording['published'];
219 219
     if (!isset($params['meta']) || empty($params['meta'])) {
220 220
         return $callbackresponse;
221 221
     }
@@ -576,8 +576,8 @@  discard block
 block discarded – undo
576 576
             array('HS256')
577 577
         );
578 578
     } catch (Exception $e) {
579
-        $error = 'Caught exception: '.$e->getMessage();
580
-        header('HTTP/1.0 400 Bad Request. '.$error);
579
+        $error = 'Caught exception: ' . $e->getMessage();
580
+        header('HTTP/1.0 400 Bad Request. ' . $error);
581 581
         return;
582 582
     }
583 583
     // Validate that the bigbluebuttonbn activity corresponds to the meeting_id received.
@@ -607,8 +607,8 @@  discard block
 block discarded – undo
607 607
         bigbluebuttonbn_log($bigbluebuttonbn, BIGBLUEBUTTON_LOG_EVENT_CALLBACK, $overrides, json_encode($meta));
608 608
         header('HTTP/1.0 202 Accepted');
609 609
     } catch (Exception $e) {
610
-        $error = 'Caught exception: '.$e->getMessage();
611
-        header('HTTP/1.0 503 Service Unavailable. '.$error);
610
+        $error = 'Caught exception: ' . $e->getMessage();
611
+        header('HTTP/1.0 503 Service Unavailable. ' . $error);
612 612
     }
613 613
 }
614 614
 
@@ -630,13 +630,13 @@  discard block
 block discarded – undo
630 630
     $importrecordings = $SESSION->bigbluebuttonbn_importrecordings;
631 631
     if (!isset($importrecordings[$params['id']])) {
632 632
         $error = "Recording {$params['id']} could not be found. It can not be imported";
633
-        header('HTTP/1.0 404 Not found. '.$error);
633
+        header('HTTP/1.0 404 Not found. ' . $error);
634 634
         return;
635 635
     }
636 636
     $callbackresponse = array('status' => true);
637 637
     $importrecordings[$params['id']]['imported'] = true;
638 638
     $overrides = array('meetingid' => $importrecordings[$params['id']]['meetingID']);
639
-    $meta = '{"recording":'.json_encode($importrecordings[$params['id']]).'}';
639
+    $meta = '{"recording":' . json_encode($importrecordings[$params['id']]) . '}';
640 640
     bigbluebuttonbn_log($bbbsession['bigbluebuttonbn'], BIGBLUEBUTTONBN_LOG_EVENT_IMPORT, $overrides, $meta);
641 641
     // Moodle event logger: Create an event for recording imported.
642 642
     if (isset($bbbsession['bigbluebutton']) && isset($bbbsession['cm'])) {
@@ -732,7 +732,7 @@  discard block
 block discarded – undo
732 732
     $action = strtolower($params['action']);
733 733
     $requiredparams = bigbluebuttonbn_broker_required_parameters();
734 734
     if (!array_key_exists($action, $requiredparams)) {
735
-        return 'Action '.$params['action'].' can not be performed.';
735
+        return 'Action ' . $params['action'] . ' can not be performed.';
736 736
     }
737 737
     return bigbluebuttonbn_broker_validate_parameters_message($params, $requiredparams[$action]);
738 738
 }
Please login to merge, or discard this patch.
locallib.php 1 patch
Spacing   +58 added lines, -58 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 
32 32
 global $CFG;
33 33
 
34
-require_once(__DIR__.'/lib.php');
34
+require_once(__DIR__ . '/lib.php');
35 35
 
36 36
 /** @var BIGBLUEBUTTONBN_UPDATE_CACHE boolean set to true indicates that cache has to be updated */
37 37
 const BIGBLUEBUTTONBN_UPDATE_CACHE = true;
@@ -145,8 +145,8 @@  discard block
 block discarded – undo
145 145
     $data = null;
146 146
     if (!is_null($pname) && !is_null($purl)) {
147 147
         $method = 'POST';
148
-        $data = "<?xml version='1.0' encoding='UTF-8'?><modules><module name='presentation'><document url='".
149
-            $purl."' /></module></modules>";
148
+        $data = "<?xml version='1.0' encoding='UTF-8'?><modules><module name='presentation'><document url='" .
149
+            $purl . "' /></module></modules>";
150 150
     }
151 151
     $xml = bigbluebuttonbn_wrap_xml_load_file($createmeetingurl, $method, $data);
152 152
     if ($xml) {
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
                 foreach ($recordingxml->breakoutRooms->breakoutRoom as $breakoutroom) {
274 274
                     $url = \mod_bigbluebuttonbn\locallib\bigbluebutton::action_url(
275 275
                         'getRecordings',
276
-                        ['recordID' => implode(',', (array) $breakoutroom)]
276
+                        ['recordID' => implode(',', (array)$breakoutroom)]
277 277
                     );
278 278
                     $xml = bigbluebuttonbn_wrap_xml_load_file($url);
279 279
                     if ($xml && $xml->returncode == 'SUCCESS' && isset($xml->recordings)) {
@@ -331,7 +331,7 @@  discard block
 block discarded – undo
331 331
         // Override imported flag with actual ID.
332 332
         $recording['imported'] = $recordimported->id;
333 333
         if (isset($recordimported->protected)) {
334
-            $recording['protected'] = (string) $recordimported->protected;
334
+            $recording['protected'] = (string)$recordimported->protected;
335 335
         }
336 336
         $recordsimportedarray[$recording['recordID']] = $recording;
337 337
     }
@@ -363,21 +363,21 @@  discard block
 block discarded – undo
363 363
     // Add formats.
364 364
     $playbackarray = array();
365 365
     foreach ($recording->playback->format as $format) {
366
-        $playbackarray[(string) $format->type] = array('type' => (string) $format->type,
367
-            'url' => trim((string) $format->url), 'length' => (string) $format->length);
366
+        $playbackarray[(string)$format->type] = array('type' => (string)$format->type,
367
+            'url' => trim((string)$format->url), 'length' => (string)$format->length);
368 368
         // Add preview per format when existing.
369 369
         if ($format->preview) {
370
-            $playbackarray[(string) $format->type]['preview'] = bigbluebuttonbn_get_recording_preview_images($format->preview);
370
+            $playbackarray[(string)$format->type]['preview'] = bigbluebuttonbn_get_recording_preview_images($format->preview);
371 371
         }
372 372
     }
373 373
     // Add the metadata to the recordings array.
374 374
     $metadataarray = bigbluebuttonbn_get_recording_array_meta(get_object_vars($recording->metadata));
375
-    $recordingarray = array('recordID' => (string) $recording->recordID,
376
-        'meetingID' => (string) $recording->meetingID, 'meetingName' => (string) $recording->name,
377
-        'published' => (string) $recording->published, 'startTime' => (string) $recording->startTime,
378
-        'endTime' => (string) $recording->endTime, 'playbacks' => $playbackarray);
375
+    $recordingarray = array('recordID' => (string)$recording->recordID,
376
+        'meetingID' => (string)$recording->meetingID, 'meetingName' => (string)$recording->name,
377
+        'published' => (string)$recording->published, 'startTime' => (string)$recording->startTime,
378
+        'endTime' => (string)$recording->endTime, 'playbacks' => $playbackarray);
379 379
     if (isset($recording->protected)) {
380
-        $recordingarray['protected'] = (string) $recording->protected;
380
+        $recordingarray['protected'] = (string)$recording->protected;
381 381
     }
382 382
     return $recordingarray + $metadataarray;
383 383
 }
@@ -393,9 +393,9 @@  discard block
 block discarded – undo
393 393
 {
394 394
     $imagesarray = array();
395 395
     foreach ($preview->images->image as $image) {
396
-        $imagearray = array('url' => trim((string) $image));
396
+        $imagearray = array('url' => trim((string)$image));
397 397
         foreach ($image->attributes() as $attkey => $attvalue) {
398
-            $imagearray[$attkey] = (string) $attvalue;
398
+            $imagearray[$attkey] = (string)$attvalue;
399 399
         }
400 400
         array_push($imagesarray, $imagearray);
401 401
     }
@@ -416,7 +416,7 @@  discard block
 block discarded – undo
416 416
         if (is_object($value)) {
417 417
             $value = '';
418 418
         }
419
-        $metadataarray['meta_'.$key] = $value;
419
+        $metadataarray['meta_' . $key] = $value;
420 420
     }
421 421
     return $metadataarray;
422 422
 }
@@ -495,7 +495,7 @@  discard block
 block discarded – undo
495 495
     $ids = explode(',', $recordids);
496 496
     foreach ($ids as $id) {
497 497
         $xml = bigbluebuttonbn_wrap_xml_load_file(
498
-            \mod_bigbluebuttonbn\locallib\bigbluebutton::action_url('updateRecordings', ['recordID' => $id] + (array) $params)
498
+            \mod_bigbluebuttonbn\locallib\bigbluebutton::action_url('updateRecordings', ['recordID' => $id] + (array)$params)
499 499
           );
500 500
         if ($xml && $xml->returncode != 'SUCCESS') {
501 501
             return false;
@@ -563,7 +563,7 @@  discard block
 block discarded – undo
563 563
             return $xml;
564 564
         } catch (Exception $e) {
565 565
             libxml_use_internal_errors($previous);
566
-            $error = 'Caught exception: '.$e->getMessage();
566
+            $error = 'Caught exception: ' . $e->getMessage();
567 567
             debugging($error, DEBUG_DEVELOPER);
568 568
             return null;
569 569
         }
@@ -574,7 +574,7 @@  discard block
 block discarded – undo
574 574
         $response = simplexml_load_file($url, 'SimpleXMLElement', LIBXML_NOCDATA | LIBXML_NOBLANKS);
575 575
         return $response;
576 576
     } catch (Exception $e) {
577
-        $error = 'Caught exception: '.$e->getMessage();
577
+        $error = 'Caught exception: ' . $e->getMessage();
578 578
         debugging($error, DEBUG_DEVELOPER);
579 579
         libxml_use_internal_errors($previous);
580 580
         return null;
@@ -601,8 +601,8 @@  discard block
 block discarded – undo
601 601
         }
602 602
         $options = array();
603 603
         $options['CURLOPT_HTTPHEADER'] = array(
604
-                 'Content-Type: '.$contenttype,
605
-                 'Content-Length: '.strlen($data),
604
+                 'Content-Type: ' . $contenttype,
605
+                 'Content-Length: ' . strlen($data),
606 606
                  'Content-Language: en-US',
607 607
                );
608 608
 
@@ -624,7 +624,7 @@  discard block
 block discarded – undo
624 624
  */
625 625
 function bigbluebuttonbn_end_meeting_if_running($bigbluebuttonbn)
626 626
 {
627
-    $meetingid = $bigbluebuttonbn->meetingid.'-'.$bigbluebuttonbn->course.'-'.$bigbluebuttonbn->id;
627
+    $meetingid = $bigbluebuttonbn->meetingid . '-' . $bigbluebuttonbn->course . '-' . $bigbluebuttonbn->id;
628 628
     if (bigbluebuttonbn_is_meeting_running($meetingid)) {
629 629
         bigbluebuttonbn_end_meeting($meetingid, $bigbluebuttonbn->moderatorpass);
630 630
     }
@@ -645,9 +645,9 @@  discard block
 block discarded – undo
645 645
     if ($userroles) {
646 646
         $where = '';
647 647
         foreach ($userroles as $userrole) {
648
-            $where .= (empty($where) ? ' WHERE' : ' OR').' id=' . $userrole->roleid;
648
+            $where .= (empty($where) ? ' WHERE' : ' OR') . ' id=' . $userrole->roleid;
649 649
         }
650
-        $userroles = $DB->get_records_sql('SELECT * FROM {role}'.$where);
650
+        $userroles = $DB->get_records_sql('SELECT * FROM {role}' . $where);
651 651
     }
652 652
     return $userroles;
653 653
 }
@@ -672,7 +672,7 @@  discard block
 block discarded – undo
672 672
  */
673 673
 function bigbluebuttonbn_get_users(context $context = null)
674 674
 {
675
-    $users = (array) get_enrolled_users($context, '', 0, 'u.*', null, 0, 0, true);
675
+    $users = (array)get_enrolled_users($context, '', 0, 'u.*', null, 0, 0, true);
676 676
     foreach ($users as $key => $value) {
677 677
         $users[$key] = fullname($value);
678 678
     }
@@ -688,7 +688,7 @@  discard block
 block discarded – undo
688 688
  */
689 689
 function bigbluebuttonbn_get_users_select(context $context = null)
690 690
 {
691
-    $users = (array) get_enrolled_users($context, '', 0, 'u.*', null, 0, 0, true);
691
+    $users = (array)get_enrolled_users($context, '', 0, 'u.*', null, 0, 0, true);
692 692
     foreach ($users as $key => $value) {
693 693
         $users[$key] = array('id' => $value->id, 'name' => fullname($value));
694 694
     }
@@ -704,7 +704,7 @@  discard block
 block discarded – undo
704 704
  */
705 705
 function bigbluebuttonbn_get_roles(context $context = null)
706 706
 {
707
-    $roles = (array) role_get_names($context);
707
+    $roles = (array)role_get_names($context);
708 708
     foreach ($roles as $key => $value) {
709 709
         $roles[$key] = $value->localname;
710 710
     }
@@ -720,7 +720,7 @@  discard block
 block discarded – undo
720 720
  */
721 721
 function bigbluebuttonbn_get_roles_select(context $context = null)
722 722
 {
723
-    $roles = (array) role_get_names($context);
723
+    $roles = (array)role_get_names($context);
724 724
     foreach ($roles as $key => $value) {
725 725
         $roles[$key] = array('id' => $value->id, 'name' => $value->localname);
726 726
     }
@@ -736,7 +736,7 @@  discard block
 block discarded – undo
736 736
  */
737 737
 function bigbluebuttonbn_get_role($id)
738 738
 {
739
-    $roles = (array) role_get_names();
739
+    $roles = (array)role_get_names();
740 740
     if (is_numeric($id) && isset($roles[$id])) {
741 741
         return (object)$roles[$id];
742 742
     }
@@ -1130,7 +1130,7 @@  discard block
 block discarded – undo
1130 1130
 {
1131 1131
     $mt = microtime();
1132 1132
     $rand = mt_rand();
1133
-    return md5($mt.$rand);
1133
+    return md5($mt . $rand);
1134 1134
 }
1135 1135
 
1136 1136
 /**
@@ -1226,10 +1226,10 @@  discard block
 block discarded – undo
1226 1226
     $now = time();
1227 1227
     if (!$updatecache && isset($result) && $now < ($result['creation_time'] + $cachettl)) {
1228 1228
         // Use the value in the cache.
1229
-        return (array) json_decode($result['meeting_info']);
1229
+        return (array)json_decode($result['meeting_info']);
1230 1230
     }
1231 1231
     // Ping again and refresh the cache.
1232
-    $meetinginfo = (array) bigbluebuttonbn_wrap_xml_load_file(
1232
+    $meetinginfo = (array)bigbluebuttonbn_wrap_xml_load_file(
1233 1233
         \mod_bigbluebuttonbn\locallib\bigbluebutton::action_url('getMeetingInfo', ['meetingID' => $meetingid])
1234 1234
       );
1235 1235
     $cache->set($meetingid, array('creation_time' => time(), 'meeting_info' => json_encode($meetinginfo)));
@@ -1346,7 +1346,7 @@  discard block
 block discarded – undo
1346 1346
  */
1347 1347
 function bigbluebuttonbn_set_config_xml($meetingid, $configxml)
1348 1348
 {
1349
-    $urldefaultconfig = \mod_bigbluebuttonbn\locallib\config::get('server_url').'api/setConfigXML?';
1349
+    $urldefaultconfig = \mod_bigbluebuttonbn\locallib\config::get('server_url') . 'api/setConfigXML?';
1350 1350
     $configxmlparams = bigbluebuttonbn_set_config_xml_params($meetingid, $configxml);
1351 1351
     $xml = bigbluebuttonbn_wrap_xml_load_file(
1352 1352
         $urldefaultconfig,
@@ -1367,8 +1367,8 @@  discard block
 block discarded – undo
1367 1367
  */
1368 1368
 function bigbluebuttonbn_set_config_xml_params($meetingid, $configxml)
1369 1369
 {
1370
-    $params = 'configXML='.urlencode($configxml).'&meetingID='.urlencode($meetingid);
1371
-    $configxmlparams = $params.'&checksum='.sha1('setConfigXML'.$params.\mod_bigbluebuttonbn\locallib\config::get('shared_secret'));
1370
+    $params = 'configXML=' . urlencode($configxml) . '&meetingID=' . urlencode($meetingid);
1371
+    $configxmlparams = $params . '&checksum=' . sha1('setConfigXML' . $params . \mod_bigbluebuttonbn\locallib\config::get('shared_secret'));
1372 1372
     return $configxmlparams;
1373 1373
 }
1374 1374
 
@@ -1383,7 +1383,7 @@  discard block
 block discarded – undo
1383 1383
 function bigbluebuttonbn_set_config_xml_array($meetingid, $configxml)
1384 1384
 {
1385 1385
     $configxml = bigbluebuttonbn_setConfigXML($meetingid, $configxml);
1386
-    $configxmlarray = (array) $configxml;
1386
+    $configxmlarray = (array)$configxml;
1387 1387
     if ($configxmlarray['returncode'] != 'SUCCESS') {
1388 1388
         debugging('BigBlueButton was not able to set the custom config.xml file', DEBUG_DEVELOPER);
1389 1389
         return '';
@@ -1482,7 +1482,7 @@  discard block
 block discarded – undo
1482 1482
     global $USER;
1483 1483
     $starttime = $starttime - ($starttime % 1000);
1484 1484
     // Set formatted date.
1485
-    $dateformat = get_string('strftimerecentfull', 'langconfig').' %Z';
1485
+    $dateformat = get_string('strftimerecentfull', 'langconfig') . ' %Z';
1486 1486
     return userdate($starttime / 1000, $dateformat, usertimezone($USER->timezone));
1487 1487
 }
1488 1488
 
@@ -1604,7 +1604,7 @@  discard block
 block discarded – undo
1604 1604
  */
1605 1605
 function bigbluebuttonbn_get_recording_data_row_preview($recording)
1606 1606
 {
1607
-    $options = array('id' => 'preview-'.$recording['recordID']);
1607
+    $options = array('id' => 'preview-' . $recording['recordID']);
1608 1608
     if ($recording['published'] === 'false') {
1609 1609
         $options['hidden'] = 'hidden';
1610 1610
     }
@@ -1672,7 +1672,7 @@  discard block
 block discarded – undo
1672 1672
     if ($recording['published'] === 'false') {
1673 1673
         $visibility = 'hidden ';
1674 1674
     }
1675
-    $id = 'playbacks-'.$recording['recordID'];
1675
+    $id = 'playbacks-' . $recording['recordID'];
1676 1676
     $recordingtypes = html_writer::start_tag('div', array('id' => $id, 'data-imported' => $dataimported,
1677 1677
           'data-meetingid' => $recording['meetingID'], 'data-recordingid' => $recording['recordID'],
1678 1678
           'title' => $title, $visibility => $visibility));
@@ -1697,11 +1697,11 @@  discard block
 block discarded – undo
1697 1697
     if (!bigbluebuttonbn_include_recording_data_row_type($recording, $bbbsession, $playback)) {
1698 1698
         return '';
1699 1699
     }
1700
-    $text = get_string('view_recording_format_'.$playback['type'], 'bigbluebuttonbn');
1700
+    $text = get_string('view_recording_format_' . $playback['type'], 'bigbluebuttonbn');
1701 1701
     $href = $CFG->wwwroot . '/mod/bigbluebuttonbn/bbb_view.php?action=play&bn=' . $bbbsession['bigbluebuttonbn']->id .
1702
-      '&mid='.$recording['meetingID'] . '&rid=' . $recording['recordID'] . '&rtype=' . $playback['type'];
1702
+      '&mid=' . $recording['meetingID'] . '&rid=' . $recording['recordID'] . '&rtype=' . $playback['type'];
1703 1703
     if (!isset($recording['imported']) || !isset($recording['protected']) || $recording['protected'] === 'false') {
1704
-        $href .= '&href='.urlencode(trim($playback['url']));
1704
+        $href .= '&href=' . urlencode(trim($playback['url']));
1705 1705
     }
1706 1706
     $linkattributes = array(
1707 1707
         'id' => 'recording-play-' . $playback['type'] . '-' . $recording['recordID'],
@@ -1887,7 +1887,7 @@  discard block
 block discarded – undo
1887 1887
             unset($linkattributes['onclick']);
1888 1888
         }
1889 1889
         $icon = new pix_icon(
1890
-            'i/'.$data['tag'],
1890
+            'i/' . $data['tag'],
1891 1891
             get_string('view_recording_list_actionbar_' . $data['action'], 'bigbluebuttonbn'),
1892 1892
             'moodle',
1893 1893
             $iconattributes
@@ -2051,7 +2051,7 @@  discard block
 block discarded – undo
2051 2051
  */
2052 2052
 function bigbluebuttonbn_get_recording_table_row($bbbsession, $recording, $rowdata) {
2053 2053
     $row = new html_table_row();
2054
-    $row->id = 'recording-tr-'.$recording['recordID'];
2054
+    $row->id = 'recording-tr-' . $recording['recordID'];
2055 2055
     $row->attributes['data-imported'] = 'false';
2056 2056
     $texthead = '';
2057 2057
     $texttail = '';
@@ -2421,7 +2421,7 @@  discard block
 block discarded – undo
2421 2421
     }
2422 2422
     // Prepare select for loading records based on existent bigbluebuttonbns.
2423 2423
     $sql = 'SELECT DISTINCT meetingid, bigbluebuttonbnid FROM {bigbluebuttonbn_logs} WHERE ';
2424
-    $sql .= '(bigbluebuttonbnid='.implode(' OR bigbluebuttonbnid=', array_keys($bigbluebuttonbns)).')';
2424
+    $sql .= '(bigbluebuttonbnid=' . implode(' OR bigbluebuttonbnid=', array_keys($bigbluebuttonbns)) . ')';
2425 2425
     // Include only Create events and exclude those with record not true.
2426 2426
     $sql .= ' AND log = ? AND meta LIKE ? AND meta LIKE ?';
2427 2427
     // Execute select for loading records based on existent bigbluebuttonbns.
@@ -2605,8 +2605,8 @@  discard block
 block discarded – undo
2605 2605
 function bigbluebuttonbn_format_activity_time($time) {
2606 2606
     $activitytime = '';
2607 2607
     if ($time) {
2608
-        $activitytime = calendar_day_representation($time).' '.
2609
-          get_string('mod_form_field_notification_msg_at', 'bigbluebuttonbn').' '.
2608
+        $activitytime = calendar_day_representation($time) . ' ' .
2609
+          get_string('mod_form_field_notification_msg_at', 'bigbluebuttonbn') . ' ' .
2610 2610
           calendar_time_representation($time);
2611 2611
     }
2612 2612
     return $activitytime;
@@ -3148,7 +3148,7 @@  discard block
 block discarded – undo
3148 3148
  *
3149 3149
  * @return string
3150 3150
  */
3151
-function bigbluebuttonbn_render_warning($message, $type='info', $href='', $text='', $class='') {
3151
+function bigbluebuttonbn_render_warning($message, $type = 'info', $href = '', $text = '', $class = '') {
3152 3152
     global $OUTPUT;
3153 3153
     $output = "\n";
3154 3154
     // Evaluates if config_warning is enabled.
@@ -3189,11 +3189,11 @@  discard block
 block discarded – undo
3189 3189
     if ($class == '') {
3190 3190
         $class = 'btn btn-secondary';
3191 3191
     }
3192
-    $output  = '  <form method="post" action="' . $href . '" class="form-inline">'."\n";
3193
-    $output .= '      <button type="submit" class="' . $class . '"'."\n";
3194
-    $output .= '          title="' . $title . '"'."\n";
3195
-    $output .= '          >' . $text . '</button>'."\n";
3196
-    $output .= '  </form>'."\n";
3192
+    $output  = '  <form method="post" action="' . $href . '" class="form-inline">' . "\n";
3193
+    $output .= '      <button type="submit" class="' . $class . '"' . "\n";
3194
+    $output .= '          title="' . $title . '"' . "\n";
3195
+    $output .= '          >' . $text . '</button>' . "\n";
3196
+    $output .= '  </form>' . "\n";
3197 3197
     return $output;
3198 3198
 }
3199 3199
 
@@ -3358,7 +3358,7 @@  discard block
 block discarded – undo
3358 3358
     $bbbsession['modPW'] = $bbbsession['bigbluebuttonbn']->moderatorpass;
3359 3359
     $bbbsession['viewerPW'] = $bbbsession['bigbluebuttonbn']->viewerpass;
3360 3360
     // Database info related to the activity.
3361
-    $bbbsession['meetingid'] = $bbbsession['bigbluebuttonbn']->meetingid.'-'.$bbbsession['course']->id.'-'.
3361
+    $bbbsession['meetingid'] = $bbbsession['bigbluebuttonbn']->meetingid . '-' . $bbbsession['course']->id . '-' .
3362 3362
         $bbbsession['bigbluebuttonbn']->id;
3363 3363
     $bbbsession['meetingname'] = $bbbsession['bigbluebuttonbn']->name;
3364 3364
     $bbbsession['meetingdescription'] = $bbbsession['bigbluebuttonbn']->intro;
@@ -3390,12 +3390,12 @@  discard block
 block discarded – undo
3390 3390
     if ($bbbsession['bigbluebuttonbn']->record) {
3391 3391
         // Check if is enable record all from start.
3392 3392
         if ($bbbsession['recordallfromstart']) {
3393
-            $bbbsession['welcome'] .= '<br><br>'.get_string(
3393
+            $bbbsession['welcome'] .= '<br><br>' . get_string(
3394 3394
                 'bbbrecordallfromstartwarning',
3395 3395
                 'bigbluebuttonbn'
3396 3396
             );
3397 3397
         } else {
3398
-            $bbbsession['welcome'] .= '<br><br>'.get_string('bbbrecordwarning', 'bigbluebuttonbn');
3398
+            $bbbsession['welcome'] .= '<br><br>' . get_string('bbbrecordwarning', 'bigbluebuttonbn');
3399 3399
         }
3400 3400
     }
3401 3401
     $bbbsession['openingtime'] = $bbbsession['bigbluebuttonbn']->openingtime;
@@ -3410,7 +3410,7 @@  discard block
 block discarded – undo
3410 3410
     $bbbsession['originServerName'] = $parsedurl['host'];
3411 3411
     $bbbsession['originServerUrl'] = $CFG->wwwroot;
3412 3412
     $bbbsession['originServerCommonName'] = '';
3413
-    $bbbsession['originTag'] = 'moodle-mod_bigbluebuttonbn ('.get_config('mod_bigbluebuttonbn', 'version').')';
3413
+    $bbbsession['originTag'] = 'moodle-mod_bigbluebuttonbn (' . get_config('mod_bigbluebuttonbn', 'version') . ')';
3414 3414
     $bbbsession['bnserver'] = bigbluebuttonbn_is_bn_server();
3415 3415
     // Setting for clienttype, assign flash if not enabled, or default if not editable.
3416 3416
     $bbbsession['clienttype'] = BIGBLUEBUTTON_CLIENTTYPE_FLASH;
@@ -3473,7 +3473,7 @@  discard block
 block discarded – undo
3473 3473
     );
3474 3474
 
3475 3475
     // Check status and set extra values.
3476
-    $activitystatus = bigbluebuttonbn_view_get_activity_status($bbbsession);  // In locallib.
3476
+    $activitystatus = bigbluebuttonbn_view_get_activity_status($bbbsession); // In locallib.
3477 3477
     if ($activitystatus == 'ended') {
3478 3478
         $bbbsession['presentation'] = bigbluebuttonbn_get_presentation_array(
3479 3479
             $bbbsession['context'],
Please login to merge, or discard this patch.