Completed
Push — v2.2-stable ( a2b4f5...20d974 )
by Jesus
02:26
created
locallib.php 1 patch
Spacing   +87 added lines, -87 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
 /**
@@ -1001,21 +1001,21 @@  discard block
 block discarded – undo
1001 1001
  */
1002 1002
 function bigbluebuttonbn_events() {
1003 1003
     return array(
1004
-        (string) BIGBLUEBUTTON_EVENT_ACTIVITY_VIEWED,
1005
-        (string) BIGBLUEBUTTON_EVENT_ACTIVITY_MANAGEMENT_VIEWED,
1006
-        (string) BIGBLUEBUTTON_EVENT_LIVE_SESSION,
1007
-        (string) BIGBLUEBUTTON_EVENT_MEETING_CREATED,
1008
-        (string) BIGBLUEBUTTON_EVENT_MEETING_ENDED,
1009
-        (string) BIGBLUEBUTTON_EVENT_MEETING_JOINED,
1010
-        (string) BIGBLUEBUTTON_EVENT_MEETING_LEFT,
1011
-        (string) BIGBLUEBUTTON_EVENT_RECORDING_DELETED,
1012
-        (string) BIGBLUEBUTTON_EVENT_RECORDING_IMPORTED,
1013
-        (string) BIGBLUEBUTTON_EVENT_RECORDING_PROTECTED,
1014
-        (string) BIGBLUEBUTTON_EVENT_RECORDING_PUBLISHED,
1015
-        (string) BIGBLUEBUTTON_EVENT_RECORDING_UNPROTECTED,
1016
-        (string) BIGBLUEBUTTON_EVENT_RECORDING_UNPUBLISHED,
1017
-        (string) BIGBLUEBUTTON_EVENT_RECORDING_EDITED,
1018
-        (string) BIGBLUEBUTTON_EVENT_RECORDING_VIEWED
1004
+        (string)BIGBLUEBUTTON_EVENT_ACTIVITY_VIEWED,
1005
+        (string)BIGBLUEBUTTON_EVENT_ACTIVITY_MANAGEMENT_VIEWED,
1006
+        (string)BIGBLUEBUTTON_EVENT_LIVE_SESSION,
1007
+        (string)BIGBLUEBUTTON_EVENT_MEETING_CREATED,
1008
+        (string)BIGBLUEBUTTON_EVENT_MEETING_ENDED,
1009
+        (string)BIGBLUEBUTTON_EVENT_MEETING_JOINED,
1010
+        (string)BIGBLUEBUTTON_EVENT_MEETING_LEFT,
1011
+        (string)BIGBLUEBUTTON_EVENT_RECORDING_DELETED,
1012
+        (string)BIGBLUEBUTTON_EVENT_RECORDING_IMPORTED,
1013
+        (string)BIGBLUEBUTTON_EVENT_RECORDING_PROTECTED,
1014
+        (string)BIGBLUEBUTTON_EVENT_RECORDING_PUBLISHED,
1015
+        (string)BIGBLUEBUTTON_EVENT_RECORDING_UNPROTECTED,
1016
+        (string)BIGBLUEBUTTON_EVENT_RECORDING_UNPUBLISHED,
1017
+        (string)BIGBLUEBUTTON_EVENT_RECORDING_EDITED,
1018
+        (string)BIGBLUEBUTTON_EVENT_RECORDING_VIEWED
1019 1019
     );
1020 1020
 }
1021 1021
 
@@ -1026,21 +1026,21 @@  discard block
 block discarded – undo
1026 1026
  */
1027 1027
 function bigbluebuttonbn_events_action() {
1028 1028
     return array(
1029
-        'view' => (string) BIGBLUEBUTTON_EVENT_ACTIVITY_VIEWED,
1030
-        'view_management' => (string) BIGBLUEBUTTON_EVENT_ACTIVITY_MANAGEMENT_VIEWED,
1031
-        'live_action' => (string) BIGBLUEBUTTON_EVENT_LIVE_SESSION,
1032
-        'meeting_create' => (string) BIGBLUEBUTTON_EVENT_MEETING_CREATED,
1033
-        'meeting_end' => (string) BIGBLUEBUTTON_EVENT_MEETING_ENDED,
1034
-        'meeting_join' => (string) BIGBLUEBUTTON_EVENT_MEETING_JOINED,
1035
-        'meeting_left' => (string) BIGBLUEBUTTON_EVENT_MEETING_LEFT,
1036
-        'recording_delete' => (string) BIGBLUEBUTTON_EVENT_RECORDING_DELETED,
1037
-        'recording_import' => (string) BIGBLUEBUTTON_EVENT_RECORDING_IMPORTED,
1038
-        'recording_protect' => (string) BIGBLUEBUTTON_EVENT_RECORDING_PROTECTED,
1039
-        'recording_publish' => (string) BIGBLUEBUTTON_EVENT_RECORDING_PUBLISHED,
1040
-        'recording_unprotect' => (string) BIGBLUEBUTTON_EVENT_RECORDING_UNPROTECTED,
1041
-        'recording_unpublish' => (string) BIGBLUEBUTTON_EVENT_RECORDING_UNPUBLISHED,
1042
-        'recording_edit' => (string) BIGBLUEBUTTON_EVENT_RECORDING_EDITED,
1043
-        'recording_play' => (string) BIGBLUEBUTTON_EVENT_RECORDING_VIEWED
1029
+        'view' => (string)BIGBLUEBUTTON_EVENT_ACTIVITY_VIEWED,
1030
+        'view_management' => (string)BIGBLUEBUTTON_EVENT_ACTIVITY_MANAGEMENT_VIEWED,
1031
+        'live_action' => (string)BIGBLUEBUTTON_EVENT_LIVE_SESSION,
1032
+        'meeting_create' => (string)BIGBLUEBUTTON_EVENT_MEETING_CREATED,
1033
+        'meeting_end' => (string)BIGBLUEBUTTON_EVENT_MEETING_ENDED,
1034
+        'meeting_join' => (string)BIGBLUEBUTTON_EVENT_MEETING_JOINED,
1035
+        'meeting_left' => (string)BIGBLUEBUTTON_EVENT_MEETING_LEFT,
1036
+        'recording_delete' => (string)BIGBLUEBUTTON_EVENT_RECORDING_DELETED,
1037
+        'recording_import' => (string)BIGBLUEBUTTON_EVENT_RECORDING_IMPORTED,
1038
+        'recording_protect' => (string)BIGBLUEBUTTON_EVENT_RECORDING_PROTECTED,
1039
+        'recording_publish' => (string)BIGBLUEBUTTON_EVENT_RECORDING_PUBLISHED,
1040
+        'recording_unprotect' => (string)BIGBLUEBUTTON_EVENT_RECORDING_UNPROTECTED,
1041
+        'recording_unpublish' => (string)BIGBLUEBUTTON_EVENT_RECORDING_UNPUBLISHED,
1042
+        'recording_edit' => (string)BIGBLUEBUTTON_EVENT_RECORDING_EDITED,
1043
+        'recording_play' => (string)BIGBLUEBUTTON_EVENT_RECORDING_VIEWED
1044 1044
     );
1045 1045
 }
1046 1046
 
@@ -1071,7 +1071,7 @@  discard block
 block discarded – undo
1071 1071
     if (array_key_exists('other', $options)) {
1072 1072
         $eventproperties['other'] = $options['other'];
1073 1073
     }
1074
-    $event = call_user_func_array('\mod_bigbluebuttonbn\event\bigbluebuttonbn_'.$eventtype.'::create',
1074
+    $event = call_user_func_array('\mod_bigbluebuttonbn\event\bigbluebuttonbn_' . $eventtype . '::create',
1075 1075
       array($eventproperties));
1076 1076
     $event->trigger();
1077 1077
 }
@@ -1111,10 +1111,10 @@  discard block
 block discarded – undo
1111 1111
     $now = time();
1112 1112
     if (!$updatecache && isset($result) && $now < ($result['creation_time'] + $cachettl)) {
1113 1113
         // Use the value in the cache.
1114
-        return (array) json_decode($result['meeting_info']);
1114
+        return (array)json_decode($result['meeting_info']);
1115 1115
     }
1116 1116
     // Ping again and refresh the cache.
1117
-    $meetinginfo = (array) bigbluebuttonbn_wrap_xml_load_file(
1117
+    $meetinginfo = (array)bigbluebuttonbn_wrap_xml_load_file(
1118 1118
         \mod_bigbluebuttonbn\locallib\bigbluebutton::action_url('getMeetingInfo', ['meetingID' => $meetingid])
1119 1119
       );
1120 1120
     $cache->set($meetingid, array('creation_time' => time(), 'meeting_info' => json_encode($meetinginfo)));
@@ -1225,7 +1225,7 @@  discard block
 block discarded – undo
1225 1225
  * @return object
1226 1226
  */
1227 1227
 function bigbluebuttonbn_set_config_xml($meetingid, $configxml) {
1228
-    $urldefaultconfig = \mod_bigbluebuttonbn\locallib\config::get('server_url').'api/setConfigXML?';
1228
+    $urldefaultconfig = \mod_bigbluebuttonbn\locallib\config::get('server_url') . 'api/setConfigXML?';
1229 1229
     $configxmlparams = bigbluebuttonbn_set_config_xml_params($meetingid, $configxml);
1230 1230
     $xml = bigbluebuttonbn_wrap_xml_load_file($urldefaultconfig, 'POST',
1231 1231
         $configxmlparams, 'application/x-www-form-urlencoded');
@@ -1241,8 +1241,8 @@  discard block
 block discarded – undo
1241 1241
  * @return string
1242 1242
  */
1243 1243
 function bigbluebuttonbn_set_config_xml_params($meetingid, $configxml) {
1244
-    $params = 'configXML='.urlencode($configxml).'&meetingID='.urlencode($meetingid);
1245
-    $configxmlparams = $params.'&checksum='.sha1('setConfigXML'.$params.\mod_bigbluebuttonbn\locallib\config::get('shared_secret'));
1244
+    $params = 'configXML=' . urlencode($configxml) . '&meetingID=' . urlencode($meetingid);
1245
+    $configxmlparams = $params . '&checksum=' . sha1('setConfigXML' . $params . \mod_bigbluebuttonbn\locallib\config::get('shared_secret'));
1246 1246
     return $configxmlparams;
1247 1247
 }
1248 1248
 
@@ -1256,7 +1256,7 @@  discard block
 block discarded – undo
1256 1256
  */
1257 1257
 function bigbluebuttonbn_set_config_xml_array($meetingid, $configxml) {
1258 1258
     $configxml = bigbluebuttonbn_setConfigXML($meetingid, $configxml);
1259
-    $configxmlarray = (array) $configxml;
1259
+    $configxmlarray = (array)$configxml;
1260 1260
     if ($configxmlarray['returncode'] != 'SUCCESS') {
1261 1261
         debugging('BigBlueButton was not able to set the custom config.xml file', DEBUG_DEVELOPER);
1262 1262
         return '';
@@ -1348,7 +1348,7 @@  discard block
 block discarded – undo
1348 1348
     global $USER;
1349 1349
     $starttime = $starttime - ($starttime % 1000);
1350 1350
     // Set formatted date.
1351
-    $dateformat = get_string('strftimerecentfull', 'langconfig').' %Z';
1351
+    $dateformat = get_string('strftimerecentfull', 'langconfig') . ' %Z';
1352 1352
     return userdate($starttime / 1000, $dateformat, usertimezone($USER->timezone));
1353 1353
 }
1354 1354
 
@@ -1464,7 +1464,7 @@  discard block
 block discarded – undo
1464 1464
  * @return string
1465 1465
  */
1466 1466
 function bigbluebuttonbn_get_recording_data_row_preview($recording) {
1467
-    $options = array('id' => 'preview-'.$recording['recordID']);
1467
+    $options = array('id' => 'preview-' . $recording['recordID']);
1468 1468
     if ($recording['published'] === 'false') {
1469 1469
         $options['hidden'] = 'hidden';
1470 1470
     }
@@ -1526,7 +1526,7 @@  discard block
 block discarded – undo
1526 1526
     if ($recording['published'] === 'false') {
1527 1527
         $visibility = 'hidden ';
1528 1528
     }
1529
-    $id = 'playbacks-'.$recording['recordID'];
1529
+    $id = 'playbacks-' . $recording['recordID'];
1530 1530
     $recordingtypes = html_writer::start_tag('div', array('id' => $id, 'data-imported' => $dataimported,
1531 1531
           'data-meetingid' => $recording['meetingID'], 'data-recordingid' => $recording['recordID'],
1532 1532
           'title' => $title, $visibility => $visibility));
@@ -1551,11 +1551,11 @@  discard block
 block discarded – undo
1551 1551
     if (!bigbluebuttonbn_include_recording_data_row_type($recording, $bbbsession, $playback)) {
1552 1552
         return '';
1553 1553
     }
1554
-    $text = get_string('view_recording_format_'.$playback['type'], 'bigbluebuttonbn');
1554
+    $text = get_string('view_recording_format_' . $playback['type'], 'bigbluebuttonbn');
1555 1555
     $href = $CFG->wwwroot . '/mod/bigbluebuttonbn/bbb_view.php?action=play&bn=' . $bbbsession['bigbluebuttonbn']->id .
1556
-      '&mid='.$recording['meetingID'] . '&rid=' . $recording['recordID'] . '&rtype=' . $playback['type'];
1556
+      '&mid=' . $recording['meetingID'] . '&rid=' . $recording['recordID'] . '&rtype=' . $playback['type'];
1557 1557
     if (!isset($recording['imported']) || !isset($recording['protected']) || $recording['protected'] === 'false') {
1558
-        $href .= '&href='.urlencode(trim($playback['url']));
1558
+        $href .= '&href=' . urlencode(trim($playback['url']));
1559 1559
     }
1560 1560
     $linkattributes = array(
1561 1561
         'id' => 'recording-play-' . $playback['type'] . '-' . $recording['recordID'],
@@ -1724,7 +1724,7 @@  discard block
 block discarded – undo
1724 1724
             $linkattributes['class'] = 'disabled';
1725 1725
             unset($linkattributes['onclick']);
1726 1726
         }
1727
-        $icon = new pix_icon('i/'.$data['tag'],
1727
+        $icon = new pix_icon('i/' . $data['tag'],
1728 1728
             get_string('view_recording_list_actionbar_' . $data['action'], 'bigbluebuttonbn'),
1729 1729
             'moodle', $iconattributes);
1730 1730
         return $OUTPUT->action_icon('#', $icon, null, $linkattributes, false);
@@ -1841,7 +1841,7 @@  discard block
 block discarded – undo
1841 1841
  */
1842 1842
 function bigbluebuttonbn_get_recording_table_row($bbbsession, $recording, $rowdata) {
1843 1843
     $row = new html_table_row();
1844
-    $row->id = 'recording-tr-'.$recording['recordID'];
1844
+    $row->id = 'recording-tr-' . $recording['recordID'];
1845 1845
     $row->attributes['data-imported'] = 'false';
1846 1846
     $texthead = '';
1847 1847
     $texttail = '';
@@ -1901,9 +1901,9 @@  discard block
 block discarded – undo
1901 1901
 function bigbluebuttonbn_send_notification_recording_ready($bigbluebuttonbn) {
1902 1902
     $sender = get_admin();
1903 1903
     // Prepare message.
1904
-    $messagetext = '<p>'.get_string('email_body_recording_ready_for', 'bigbluebuttonbn').
1905
-        ' "' . $bigbluebuttonbn->name . '" '.
1906
-        get_string('email_body_recording_ready_is_ready', 'bigbluebuttonbn').'.</p>';
1904
+    $messagetext = '<p>' . get_string('email_body_recording_ready_for', 'bigbluebuttonbn') .
1905
+        ' "' . $bigbluebuttonbn->name . '" ' .
1906
+        get_string('email_body_recording_ready_is_ready', 'bigbluebuttonbn') . '.</p>';
1907 1907
     $context = context_course::instance($bigbluebuttonbn->course);
1908 1908
     \mod_bigbluebuttonbn\locallib\notifier::notification_send($context, $sender, $bigbluebuttonbn, $messagetext);
1909 1909
 }
@@ -2125,7 +2125,7 @@  discard block
 block discarded – undo
2125 2125
     }
2126 2126
     // Prepare select for loading records based on existent bigbluebuttonbns.
2127 2127
     $sql = 'SELECT DISTINCT meetingid, bigbluebuttonbnid FROM {bigbluebuttonbn_logs} WHERE ';
2128
-    $sql .= '(bigbluebuttonbnid='.implode(' OR bigbluebuttonbnid=', array_keys($bigbluebuttonbns)).')';
2128
+    $sql .= '(bigbluebuttonbnid=' . implode(' OR bigbluebuttonbnid=', array_keys($bigbluebuttonbns)) . ')';
2129 2129
     // Include only Create events and exclude those with record not true.
2130 2130
     $sql .= ' AND log = ? AND meta LIKE ? AND meta LIKE ?';
2131 2131
     // Execute select for loading records based on existent bigbluebuttonbns.
@@ -2257,8 +2257,8 @@  discard block
 block discarded – undo
2257 2257
 function bigbluebuttonbn_format_activity_time($time) {
2258 2258
     $activitytime = '';
2259 2259
     if ($time) {
2260
-        $activitytime = calendar_day_representation($time).' '.
2261
-          get_string('mod_form_field_notification_msg_at', 'bigbluebuttonbn').' '.
2260
+        $activitytime = calendar_day_representation($time) . ' ' .
2261
+          get_string('mod_form_field_notification_msg_at', 'bigbluebuttonbn') . ' ' .
2262 2262
           calendar_time_representation($time);
2263 2263
     }
2264 2264
     return $activitytime;
@@ -2659,7 +2659,7 @@  discard block
 block discarded – undo
2659 2659
  *
2660 2660
  * @return string
2661 2661
  */
2662
-function bigbluebuttonbn_render_warning($message, $type='info', $href='', $text='', $class='') {
2662
+function bigbluebuttonbn_render_warning($message, $type = 'info', $href = '', $text = '', $class = '') {
2663 2663
     global $OUTPUT;
2664 2664
     $output = "\n";
2665 2665
     // Evaluates if config_warning is enabled.
@@ -2698,11 +2698,11 @@  discard block
 block discarded – undo
2698 2698
     if ($class == '') {
2699 2699
         $class = 'btn btn-secondary';
2700 2700
     }
2701
-    $output  = '  <form method="post" action="' . $href . '" class="form-inline">'."\n";
2702
-    $output .= '      <button type="submit" class="' . $class . '"'."\n";
2703
-    $output .= '          title="' . $title . '"'."\n";
2704
-    $output .= '          >' . $text . '</button>'."\n";
2705
-    $output .= '  </form>'."\n";
2701
+    $output  = '  <form method="post" action="' . $href . '" class="form-inline">' . "\n";
2702
+    $output .= '      <button type="submit" class="' . $class . '"' . "\n";
2703
+    $output .= '          title="' . $title . '"' . "\n";
2704
+    $output .= '          >' . $text . '</button>' . "\n";
2705
+    $output .= '  </form>' . "\n";
2706 2706
     return $output;
2707 2707
 }
2708 2708
 
Please login to merge, or discard this patch.
bbb_broker.php 2 patches
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -440,26 +440,26 @@  discard block
 block discarded – undo
440 440
             return array(
441 441
                 'status' => false,
442 442
                 'message' => get_string('view_recording_publish_link_deleted', 'bigbluebuttonbn')
443
-              );
443
+                );
444 444
         }
445 445
         if ($realrecordings[$params['id']]['published'] !== 'true') {
446 446
             return array(
447 447
                 'status' => false,
448 448
                 'message' => get_string('view_recording_publish_link_not_published', 'bigbluebuttonbn')
449
-              );
449
+                );
450 450
         }
451 451
         return array(
452 452
             'status' => bigbluebuttonbn_publish_recording_imported(
453 453
                 $recordings[$params['id']]['imported'], true
454 454
             )
455
-          );
455
+            );
456 456
     }
457 457
     // As the recordingid was not identified as imported recording link, execute actual publish.
458 458
     return array(
459 459
         'status' => bigbluebuttonbn_publish_recordings(
460 460
             $params['id'], 'true'
461 461
         )
462
-      );
462
+        );
463 463
 }
464 464
 
465 465
 /**
@@ -480,26 +480,26 @@  discard block
 block discarded – undo
480 480
             return array(
481 481
                 'status' => false,
482 482
                 'message' => get_string('view_recording_unprotect_link_deleted', 'bigbluebuttonbn')
483
-              );
483
+                );
484 484
         }
485 485
         if ($realrecordings[$params['id']]['protected'] === 'true') {
486 486
             return array(
487 487
                 'status' => false,
488 488
                 'message' => get_string('view_recording_unprotect_link_not_unprotected', 'bigbluebuttonbn')
489
-              );
489
+                );
490 490
         }
491 491
         return array(
492 492
             'status' => bigbluebuttonbn_protect_recording_imported(
493 493
                 $recordings[$params['id']]['imported'], false
494 494
             )
495
-          );
495
+            );
496 496
     }
497 497
     // As the recordingid was not identified as imported recording link, execute actual uprotect.
498 498
     return array(
499 499
         'status' => bigbluebuttonbn_update_recordings(
500 500
             $params['id'], array('protect' => 'false')
501 501
         )
502
-      );
502
+        );
503 503
 }
504 504
 
505 505
 /**
@@ -518,7 +518,7 @@  discard block
 block discarded – undo
518 518
             'status' => bigbluebuttonbn_publish_recording_imported(
519 519
                 $recordings[$params['id']]['imported'], false
520 520
             )
521
-          );
521
+            );
522 522
     }
523 523
     // As the recordingid was not identified as imported recording link, execute unpublish on a real recording.
524 524
     // First: Unpublish imported links associated to the recording.
@@ -536,7 +536,7 @@  discard block
 block discarded – undo
536 536
         'status' => bigbluebuttonbn_publish_recordings(
537 537
             $params['id'], 'false'
538 538
         )
539
-      );
539
+        );
540 540
 }
541 541
 
542 542
 /**
@@ -555,7 +555,7 @@  discard block
 block discarded – undo
555 555
             'status' => bigbluebuttonbn_protect_recording_imported(
556 556
                 $recordings[$params['id']]['imported'], true
557 557
             )
558
-          );
558
+            );
559 559
     }
560 560
     // As the recordingid was not identified as imported recording link, execute protect on a real recording.
561 561
     // First: Protect imported links associated to the recording.
@@ -573,7 +573,7 @@  discard block
 block discarded – undo
573 573
         'status' => bigbluebuttonbn_update_recordings(
574 574
             $params['id'], array('protect' => 'true')
575 575
         )
576
-      );
576
+        );
577 577
 }
578 578
 
579 579
 /**
@@ -592,7 +592,7 @@  discard block
 block discarded – undo
592 592
             'status' => bigbluebuttonbn_delete_recording_imported(
593 593
                 $recordings[$params['id']]['imported']
594 594
             )
595
-          );
595
+            );
596 596
     }
597 597
     // As the recordingid was not identified as imported recording link, execute delete on a real recording.
598 598
     // First: Delete imported links associated to the recording.
@@ -606,7 +606,7 @@  discard block
 block discarded – undo
606 606
     // Second: Execute the actual delete.
607 607
     return array(
608 608
         'status' => bigbluebuttonbn_delete_recordings($params['id'])
609
-      );
609
+        );
610 610
 }
611 611
 
612 612
 /**
@@ -624,7 +624,7 @@  discard block
 block discarded – undo
624 624
             'status' => bigbluebuttonbn_update_recording_imported(
625 625
                 $recordings[$params['id']]['imported'], json_decode($params['meta'], true)
626 626
             )
627
-          );
627
+            );
628 628
     }
629 629
 
630 630
     // As the recordingid was not identified as imported recording link, execute update on a real recording.
@@ -634,7 +634,7 @@  discard block
 block discarded – undo
634 634
         'status' => bigbluebuttonbn_update_recordings(
635 635
             $params['id'], json_decode($params['meta'])
636 636
         )
637
-      );
637
+        );
638 638
 }
639 639
 
640 640
 /**
@@ -800,11 +800,11 @@  discard block
 block discarded – undo
800 800
     $params['recording_ready'] = [
801 801
             'bigbluebuttonbn' => 'An id for the bigbluebuttonbn instance should be included.',
802 802
             'signed_parameters' => 'A JWT encoded string must be included as [signed_parameters].'
803
-          ];
803
+            ];
804 804
     $params['live_session_events'] = [
805 805
             'bigbluebuttonbn' => 'An id for the bigbluebuttonbn instance should be included.',
806 806
             'signed_parameters' => 'A JWT encoded string must be included as [signed_parameters].'
807
-          ];
807
+            ];
808 808
     return $params;
809 809
 }
810 810
 
@@ -815,9 +815,9 @@  discard block
 block discarded – undo
815 815
  */
816 816
 function bigbluebuttonbn_broker_required_parameters_default($id) {
817 817
     return [
818
-              'id' => "The {$id} must be specified.",
819
-              'callback' => 'This call must include a javascript callback.'
820
-           ];
818
+                'id' => "The {$id} must be specified.",
819
+                'callback' => 'This call must include a javascript callback.'
820
+            ];
821 821
 }
822 822
 
823 823
 /**
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -24,8 +24,8 @@  discard block
 block discarded – undo
24 24
  */
25 25
 
26 26
 
27
-require_once(dirname(dirname(dirname(__FILE__))).'/config.php');
28
-require_once(dirname(__FILE__).'/locallib.php');
27
+require_once(dirname(dirname(dirname(__FILE__))) . '/config.php');
28
+require_once(dirname(__FILE__) . '/locallib.php');
29 29
 
30 30
 use \Firebase\JWT\JWT;
31 31
 
@@ -41,13 +41,13 @@  discard block
 block discarded – undo
41 41
 $params['meta'] = optional_param('meta', '', PARAM_TEXT);
42 42
 
43 43
 if (empty($params['action'])) {
44
-    header('HTTP/1.0 400 Bad Request. Parameter ['.$params['action'].'] was not included');
44
+    header('HTTP/1.0 400 Bad Request. Parameter [' . $params['action'] . '] was not included');
45 45
     return;
46 46
 }
47 47
 
48 48
 $error = bigbluebuttonbn_broker_validate_parameters($params);
49 49
 if (!empty($error)) {
50
-    header('HTTP/1.0 400 Bad Request. '.$error);
50
+    header('HTTP/1.0 400 Bad Request. ' . $error);
51 51
     return;
52 52
 }
53 53
 
@@ -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
 
@@ -322,7 +322,7 @@  discard block
 block discarded – undo
322 322
 function bigbluebuttonbn_broker_recording_info_current($recording, $params) {
323 323
     $callbackresponse['status'] = true;
324 324
     $callbackresponse['found'] = true;
325
-    $callbackresponse['published'] = (string) $recording['published'];
325
+    $callbackresponse['published'] = (string)$recording['published'];
326 326
     if (!isset($params['meta']) || empty($params['meta'])) {
327 327
         return $callbackresponse;
328 328
     }
@@ -651,8 +651,8 @@  discard block
 block discarded – undo
651 651
         $decodedparameters = JWT::decode($params['signed_parameters'],
652 652
             \mod_bigbluebuttonbn\locallib\config::get('shared_secret'), array('HS256'));
653 653
     } catch (Exception $e) {
654
-        $error = 'Caught exception: '.$e->getMessage();
655
-        header('HTTP/1.0 400 Bad Request. '.$error);
654
+        $error = 'Caught exception: ' . $e->getMessage();
655
+        header('HTTP/1.0 400 Bad Request. ' . $error);
656 656
         return;
657 657
     }
658 658
     // Validate that the bigbluebuttonbn activity corresponds to the meeting_id received.
@@ -668,8 +668,8 @@  discard block
 block discarded – undo
668 668
         bigbluebuttonbn_send_notification_recording_ready($bigbluebuttonbn);
669 669
         header('HTTP/1.0 202 Accepted');
670 670
     } catch (Exception $e) {
671
-        $error = 'Caught exception: '.$e->getMessage();
672
-        header('HTTP/1.0 503 Service Unavailable. '.$error);
671
+        $error = 'Caught exception: ' . $e->getMessage();
672
+        header('HTTP/1.0 503 Service Unavailable. ' . $error);
673 673
     }
674 674
 }
675 675
 
@@ -690,13 +690,13 @@  discard block
 block discarded – undo
690 690
     $importrecordings = $SESSION->bigbluebuttonbn_importrecordings;
691 691
     if (!isset($importrecordings[$params['id']])) {
692 692
         $error = "Recording {$params['id']} could not be found. It can not be imported";
693
-        header('HTTP/1.0 404 Not found. '.$error);
693
+        header('HTTP/1.0 404 Not found. ' . $error);
694 694
         return;
695 695
     }
696 696
     $callbackresponse = array('status' => true);
697 697
     $importrecordings[$params['id']]['imported'] = true;
698 698
     $overrides = array('meetingid' => $importrecordings[$params['id']]['meetingID']);
699
-    $meta = '{"recording":'.json_encode($importrecordings[$params['id']]).'}';
699
+    $meta = '{"recording":' . json_encode($importrecordings[$params['id']]) . '}';
700 700
     bigbluebuttonbn_log($bbbsession['bigbluebuttonbn'], BIGBLUEBUTTONBN_LOG_EVENT_IMPORT, $overrides, $meta);
701 701
     // Moodle event logger: Create an event for recording imported.
702 702
     if (isset($bbbsession['bigbluebutton']) && isset($bbbsession['cm'])) {
@@ -722,8 +722,8 @@  discard block
 block discarded – undo
722 722
         $decodedparameters = JWT::decode($params['signed_parameters'],
723 723
             \mod_bigbluebuttonbn\locallib\config::get('shared_secret'), array('HS256'));
724 724
     } catch (Exception $e) {
725
-        $error = 'Caught exception: '.$e->getMessage();
726
-        header('HTTP/1.0 400 Bad Request. '.$error);
725
+        $error = 'Caught exception: ' . $e->getMessage();
726
+        header('HTTP/1.0 400 Bad Request. ' . $error);
727 727
         return;
728 728
     }
729 729
     // Validate that the bigbluebuttonbn activity corresponds to the meeting_id received.
@@ -758,7 +758,7 @@  discard block
 block discarded – undo
758 758
     $requiredparams = bigbluebuttonbn_broker_required_parameters();
759 759
     $action = strtolower($params['action']);
760 760
     if (!array_key_exists($action, $requiredparams)) {
761
-        return 'Action '.$params['action'].' can not be performed.';
761
+        return 'Action ' . $params['action'] . ' can not be performed.';
762 762
     }
763 763
     return bigbluebuttonbn_broker_validate_parameters_message($params, $requiredparams[$action]);
764 764
 }
Please login to merge, or discard this patch.
classes/locallib/notifier.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
     public static function notification_process($context, $bigbluebuttonbn, $action) {
48 48
         global $USER;
49 49
         // Prepare message.
50
-        $msg = (object) array();
50
+        $msg = (object)array();
51 51
         // Build the message_body.
52 52
         $msg->action = $action;
53 53
         $msg->activity_type = '';
@@ -72,26 +72,26 @@  discard block
 block discarded – undo
72 72
      * @return string
73 73
      */
74 74
     public static function notification_msg_html($msg) {
75
-        $messagetext = '<p>'.$msg->activity_type.' "'.$msg->activity_title.'" '.
76
-            get_string('email_body_notification_meeting_has_been', 'bigbluebuttonbn').' '.$msg->action.'.</p>'."\n";
77
-        $messagetext .= '<p><b>'.$msg->activity_title.'</b> '.
78
-            get_string('email_body_notification_meeting_details', 'bigbluebuttonbn').':'."\n";
79
-        $messagetext .= '<table border="0" style="margin: 5px 0 0 20px"><tbody>'."\n";
80
-        $messagetext .= '<tr><td style="font-weight:bold;color:#555;">'.
81
-            get_string('email_body_notification_meeting_title', 'bigbluebuttonbn').': </td><td>'."\n";
82
-        $messagetext .= $msg->activity_title.'</td></tr>'."\n";
83
-        $messagetext .= '<tr><td style="font-weight:bold;color:#555;">'.
84
-            get_string('email_body_notification_meeting_description', 'bigbluebuttonbn').': </td><td>'."\n";
85
-        $messagetext .= $msg->activity_description.'</td></tr>'."\n";
86
-        $messagetext .= '<tr><td style="font-weight:bold;color:#555;">'.
87
-            get_string('email_body_notification_meeting_start_date', 'bigbluebuttonbn').': </td><td>'."\n";
88
-        $messagetext .= $msg->activity_openingtime.'</td></tr>'."\n";
89
-        $messagetext .= '<tr><td style="font-weight:bold;color:#555;">'.
90
-            get_string('email_body_notification_meeting_end_date', 'bigbluebuttonbn').': </td><td>'."\n";
91
-        $messagetext .= $msg->activity_closingtime.'</td></tr>'."\n";
92
-        $messagetext .= '<tr><td style="font-weight:bold;color:#555;">'.$msg->action.' '.
93
-            get_string('email_body_notification_meeting_by', 'bigbluebuttonbn').': </td><td>'."\n";
94
-        $messagetext .= $msg->activity_owner.'</td></tr></tbody></table></p>'."\n";
75
+        $messagetext = '<p>' . $msg->activity_type . ' "' . $msg->activity_title . '" ' .
76
+            get_string('email_body_notification_meeting_has_been', 'bigbluebuttonbn') . ' ' . $msg->action . '.</p>' . "\n";
77
+        $messagetext .= '<p><b>' . $msg->activity_title . '</b> ' .
78
+            get_string('email_body_notification_meeting_details', 'bigbluebuttonbn') . ':' . "\n";
79
+        $messagetext .= '<table border="0" style="margin: 5px 0 0 20px"><tbody>' . "\n";
80
+        $messagetext .= '<tr><td style="font-weight:bold;color:#555;">' .
81
+            get_string('email_body_notification_meeting_title', 'bigbluebuttonbn') . ': </td><td>' . "\n";
82
+        $messagetext .= $msg->activity_title . '</td></tr>' . "\n";
83
+        $messagetext .= '<tr><td style="font-weight:bold;color:#555;">' .
84
+            get_string('email_body_notification_meeting_description', 'bigbluebuttonbn') . ': </td><td>' . "\n";
85
+        $messagetext .= $msg->activity_description . '</td></tr>' . "\n";
86
+        $messagetext .= '<tr><td style="font-weight:bold;color:#555;">' .
87
+            get_string('email_body_notification_meeting_start_date', 'bigbluebuttonbn') . ': </td><td>' . "\n";
88
+        $messagetext .= $msg->activity_openingtime . '</td></tr>' . "\n";
89
+        $messagetext .= '<tr><td style="font-weight:bold;color:#555;">' .
90
+            get_string('email_body_notification_meeting_end_date', 'bigbluebuttonbn') . ': </td><td>' . "\n";
91
+        $messagetext .= $msg->activity_closingtime . '</td></tr>' . "\n";
92
+        $messagetext .= '<tr><td style="font-weight:bold;color:#555;">' . $msg->action . ' ' .
93
+            get_string('email_body_notification_meeting_by', 'bigbluebuttonbn') . ': </td><td>' . "\n";
94
+        $messagetext .= $msg->activity_owner . '</td></tr></tbody></table></p>' . "\n";
95 95
         return $messagetext;
96 96
     }
97 97
 
@@ -108,14 +108,14 @@  discard block
 block discarded – undo
108 108
         global $DB;
109 109
         $course = $DB->get_record('course', array('id' => $bigbluebuttonbn->course), '*', MUST_EXIST);
110 110
         // Complete message.
111
-        $msg = (object) array();
111
+        $msg = (object)array();
112 112
         $msg->user_name = fullname($sender);
113 113
         $msg->user_email = $sender->email;
114 114
         $msg->course_name = "$course->fullname";
115
-        $message .= '<p><hr/><br/>'.get_string('email_footer_sent_by', 'bigbluebuttonbn').' '.
116
-            $msg->user_name.'('.$msg->user_email.') ';
117
-        $message .= get_string('email_footer_sent_from', 'bigbluebuttonbn').' '.$msg->course_name.'.</p>';
118
-        $users = (array) get_enrolled_users($context, '', 0, 'u.*', null, 0, 0, true);
115
+        $message .= '<p><hr/><br/>' . get_string('email_footer_sent_by', 'bigbluebuttonbn') . ' ' .
116
+            $msg->user_name . '(' . $msg->user_email . ') ';
117
+        $message .= get_string('email_footer_sent_from', 'bigbluebuttonbn') . ' ' . $msg->course_name . '.</p>';
118
+        $users = (array)get_enrolled_users($context, '', 0, 'u.*', null, 0, 0, true);
119 119
         foreach ($users as $user) {
120 120
             if ($user->id != $sender->id) {
121 121
                 message_post_message($sender, $user, $message, FORMAT_MOODLE);
Please login to merge, or discard this patch.