Completed
Push — 1.11.x ( 0609ac...d3f3e5 )
by José
161:19 queued 122:35
created
plugin/bbb/lib/bbb.lib.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
     /**
241 241
      * Returns a meeting "join" URL
242 242
      * @param string The name of the meeting (usually the course code)
243
-     * @return mixed The URL to join the meeting, or false on error
243
+     * @return false|string The URL to join the meeting, or false on error
244 244
      * @todo implement moderator pass
245 245
      * @assert ('') === false
246 246
      * @assert ('abcdefghijklmnopqrstuvwxyzabcdefghijklmno') === false
@@ -647,7 +647,7 @@  discard block
 block discarded – undo
647 647
      * Closes a meeting (usually when the user click on the close button from
648 648
      * the conferences listing.
649 649
      * @param string The internal ID of the meeting (id field for this meeting)
650
-     * @return void
650
+     * @return false|null
651 651
      * @assert (0) === false
652 652
      */
653 653
     public function endMeeting($id)
Please login to merge, or discard this patch.
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
 
211 211
         $params['record'] = api_get_course_setting('big_blue_button_record_and_store', $courseCode) == 1 ? true : false;
212 212
         $max = api_get_course_setting('big_blue_button_max_students_allowed', $courseCode);
213
-        $max =  isset($max) ? $max : -1;
213
+        $max = isset($max) ? $max : -1;
214 214
 
215 215
         $params['status'] = 1;
216 216
         // Generate a pseudo-global-unique-id to avoid clash of conferences on
@@ -243,23 +243,23 @@  discard block
 block discarded – undo
243 243
             $duration = 300;
244 244
 
245 245
             $bbbParams = array(
246
-                'meetingId' => $params['remote_id'], 					// REQUIRED
247
-                'meetingName' => $meetingName, 	// REQUIRED
248
-                'attendeePw' => $attendeePassword, 					// Match this value in getJoinMeetingURL() to join as attendee.
249
-                'moderatorPw' => $moderatorPassword, 					// Match this value in getJoinMeetingURL() to join as moderator.
250
-                'welcomeMsg' => $welcomeMessage, 					// ''= use default. Change to customize.
251
-                'dialNumber' => '', 					// The main number to call into. Optional.
252
-                'voiceBridge' => $params['voice_bridge'], 					// PIN to join voice. Required.
253
-                'webVoice' => '', 						// Alphanumeric to join voice. Optional.
246
+                'meetingId' => $params['remote_id'], // REQUIRED
247
+                'meetingName' => $meetingName, // REQUIRED
248
+                'attendeePw' => $attendeePassword, // Match this value in getJoinMeetingURL() to join as attendee.
249
+                'moderatorPw' => $moderatorPassword, // Match this value in getJoinMeetingURL() to join as moderator.
250
+                'welcomeMsg' => $welcomeMessage, // ''= use default. Change to customize.
251
+                'dialNumber' => '', // The main number to call into. Optional.
252
+                'voiceBridge' => $params['voice_bridge'], // PIN to join voice. Required.
253
+                'webVoice' => '', // Alphanumeric to join voice. Optional.
254 254
                 'logoutUrl' =>  $this->logoutUrl,
255
-                'maxParticipants' => $max, 				// Optional. -1 = unlimitted. Not supported in BBB. [number]
256
-                'record' => $record, 					// New. 'true' will tell BBB to record the meeting.
257
-                'duration' => $duration, 				// Default = 0 which means no set duration in minutes. [number]
255
+                'maxParticipants' => $max, // Optional. -1 = unlimitted. Not supported in BBB. [number]
256
+                'record' => $record, // New. 'true' will tell BBB to record the meeting.
257
+                'duration' => $duration, // Default = 0 which means no set duration in minutes. [number]
258 258
                 //'meta_category' => '', 				// Use to pass additional info to BBB server. See API docs.
259 259
             );
260 260
 
261 261
             if ($this->debug) {
262
-                error_log("create_meeting params: ".print_r($bbbParams,1));
262
+                error_log("create_meeting params: ".print_r($bbbParams, 1));
263 263
             }
264 264
 
265 265
             $status = false;
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
                 if (isset($result) && strval($result['returncode']) == 'SUCCESS') {
273 273
                     if ($this->debug) {
274 274
                         error_log(
275
-                            "create_meeting result: " . print_r($result, 1)
275
+                            "create_meeting result: ".print_r($result, 1)
276 276
                         );
277 277
                     }
278 278
                     $meeting = $this->joinMeeting($meetingName, true);
@@ -303,7 +303,7 @@  discard block
 block discarded – undo
303 303
 
304 304
         $courseId = api_get_course_int_id();
305 305
         $sessionId = api_get_session_id();
306
-        $conditions =  array(
306
+        $conditions = array(
307 307
             'where' => array(
308 308
                 'c_id = ? AND session_id = ? AND meeting_name = ? AND status = 1 AND access_url = ?' =>
309 309
                     array($courseId, $sessionId, $meetingName, $this->accessUrl)
@@ -312,7 +312,7 @@  discard block
 block discarded – undo
312 312
 
313 313
         if ($this->hasGroupSupport()) {
314 314
             $groupId = api_get_group_id();
315
-            $conditions =  array(
315
+            $conditions = array(
316 316
                 'where' => array(
317 317
                     'c_id = ? AND session_id = ? AND meeting_name = ? AND group_id = ? AND status = 1 AND access_url = ?' =>
318 318
                         array($courseId, $sessionId, $meetingName, $groupId, $this->accessUrl)
@@ -409,7 +409,7 @@  discard block
 block discarded – undo
409 409
 
410 410
             if ($this->debug) {
411 411
                 error_log(
412
-                    "meeting is running: " . intval($meetingInfoExists)
412
+                    "meeting is running: ".intval($meetingInfoExists)
413 413
                 );
414 414
             }
415 415
 
@@ -426,11 +426,11 @@  discard block
 block discarded – undo
426 426
 
427 427
         if ($meetingInfoExists) {
428 428
             $joinParams = array(
429
-                'meetingId' => $meetingData['remote_id'],	//	-- REQUIRED - A unique id for the meeting
430
-                'username' => $this->userCompleteName,	//-- REQUIRED - The name that will display for the user in the meeting
431
-                'password' => $pass,			//-- REQUIRED - The attendee or moderator password, depending on what's passed here
429
+                'meetingId' => $meetingData['remote_id'], //	-- REQUIRED - A unique id for the meeting
430
+                'username' => $this->userCompleteName, //-- REQUIRED - The name that will display for the user in the meeting
431
+                'password' => $pass, //-- REQUIRED - The attendee or moderator password, depending on what's passed here
432 432
                 //'createTime' => api_get_utc_datetime(),			//-- OPTIONAL - string. Leave blank ('') unless you set this correctly.
433
-                'userID' => api_get_user_id(),				//-- OPTIONAL - string
433
+                'userID' => api_get_user_id(), //-- OPTIONAL - string
434 434
                 'webVoiceConf' => ''	//	-- OPTIONAL - string
435 435
             );
436 436
             $url = $this->api->getJoinMeetingURL($joinParams);
@@ -439,7 +439,7 @@  discard block
 block discarded – undo
439 439
             $url = $this->logoutUrl;
440 440
         }
441 441
         if ($this->debug) {
442
-            error_log("return url :" . $url);
442
+            error_log("return url :".$url);
443 443
         }
444 444
 
445 445
         return $url;
@@ -480,7 +480,7 @@  discard block
 block discarded – undo
480 480
      */
481 481
     public function getAllMeetingsInCourse($courseId, $sessionId, $status)
482 482
     {
483
-        $conditions =  array(
483
+        $conditions = array(
484 484
             'where' => array(
485 485
                 'status = ? AND c_id = ? AND session_id = ? ' => array(
486 486
                     $status,
@@ -512,7 +512,7 @@  discard block
 block discarded – undo
512 512
         $courseId = api_get_course_int_id();
513 513
         $sessionId = api_get_session_id();
514 514
 
515
-        $conditions =  array(
515
+        $conditions = array(
516 516
             'where' => array(
517 517
                 'c_id = ? AND session_id = ? AND access_url = ?' => array(
518 518
                     $courseId,
@@ -524,7 +524,7 @@  discard block
 block discarded – undo
524 524
 
525 525
         if ($this->hasGroupSupport()) {
526 526
             $groupId = api_get_group_id();
527
-            $conditions =  array(
527
+            $conditions = array(
528 528
                 'where' => array(
529 529
                     'c_id = ? AND session_id = ? AND group_id = ? AND access_url = ?' =>
530 530
                         array($courseId, $sessionId, $groupId, $this->accessUrl)
@@ -533,7 +533,7 @@  discard block
 block discarded – undo
533 533
         }
534 534
 
535 535
         if ($isGlobalPerUser) {
536
-            $conditions =  array(
536
+            $conditions = array(
537 537
                 'where' => array(
538 538
                     'user_id = ? AND access_url = ?' =>
539 539
                         array($this->userId, $this->accessUrl)
@@ -568,7 +568,7 @@  discard block
 block discarded – undo
568 568
             }
569 569
             $meetingBBB['end_url'] = $this->endUrl($meetingDB);
570 570
 
571
-            if (isset($meetingBBB['returncode']) && (string)$meetingBBB['returncode'] == 'FAILED') {
571
+            if (isset($meetingBBB['returncode']) && (string) $meetingBBB['returncode'] == 'FAILED') {
572 572
                 if ($meetingDB['status'] == 1 && $this->isConferenceManager()) {
573 573
                     $this->endMeeting($meetingDB['id']);
574 574
                 }
@@ -737,7 +737,7 @@  discard block
 block discarded – undo
737 737
                     $actionLinksArray[] = $actionLinks;
738 738
                     $item['action_links'] = implode('<br />', $actionLinksArray);
739 739
                 }
740
-                $item['show_links']  = implode('<br />', $recordArray);
740
+                $item['show_links'] = implode('<br />', $recordArray);
741 741
                 $item['action_links'] = implode('<br />', $actionLinksArray);
742 742
             }
743 743
 
@@ -750,11 +750,11 @@  discard block
 block discarded – undo
750 750
 
751 751
             if ($meetingDB['status'] == 1) {
752 752
                 $joinParams = array(
753
-                    'meetingId' => $meetingDB['remote_id'],		//-- REQUIRED - A unique id for the meeting
754
-                    'username' => $this->userCompleteName,	//-- REQUIRED - The name that will display for the user in the meeting
755
-                    'password' => $pass,			//-- REQUIRED - The attendee or moderator password, depending on what's passed here
756
-                    'createTime' => '',			//-- OPTIONAL - string. Leave blank ('') unless you set this correctly.
757
-                    'userID' => '',			//	-- OPTIONAL - string
753
+                    'meetingId' => $meetingDB['remote_id'], //-- REQUIRED - A unique id for the meeting
754
+                    'username' => $this->userCompleteName, //-- REQUIRED - The name that will display for the user in the meeting
755
+                    'password' => $pass, //-- REQUIRED - The attendee or moderator password, depending on what's passed here
756
+                    'createTime' => '', //-- OPTIONAL - string. Leave blank ('') unless you set this correctly.
757
+                    'userID' => '', //	-- OPTIONAL - string
758 758
                     'webVoiceConf' => ''	//	-- OPTIONAL - string
759 759
                 );
760 760
                 $item['go_url'] = $this->protocol.$this->api->getJoinMeetingURL($joinParams);
@@ -815,8 +815,8 @@  discard block
 block discarded – undo
815 815
         $pass = $this->getUserMeetingPassword();
816 816
 
817 817
         $endParams = array(
818
-            'meetingId' => $meetingData['remote_id'],   // REQUIRED - We have to know which meeting to end.
819
-            'password' => $pass,        // REQUIRED - Must match moderator pass for meeting.
818
+            'meetingId' => $meetingData['remote_id'], // REQUIRED - We have to know which meeting to end.
819
+            'password' => $pass, // REQUIRED - Must match moderator pass for meeting.
820 820
         );
821 821
         $this->api->endMeetingWithXmlResponseArray($endParams);
822 822
         Database::update(
@@ -1067,7 +1067,7 @@  discard block
 block discarded – undo
1067 1067
      */
1068 1068
     public function redirectToBBB($url)
1069 1069
     {
1070
-        if (file_exists(__DIR__ . '/../config.vm.php')) {
1070
+        if (file_exists(__DIR__.'/../config.vm.php')) {
1071 1071
             // Using VM
1072 1072
             echo Display::url(get_lang('ClickToContinue'), $url);
1073 1073
             exit;
Please login to merge, or discard this patch.
plugin/bbb/lib/bbb_api.php 4 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -59,6 +59,9 @@
 block discarded – undo
59 59
 		$this->_bbbServerBaseUrl 	= CONFIG_SERVER_BASE_URL;
60 60
 	}
61 61
 
62
+	/**
63
+	 * @param string $url
64
+	 */
62 65
 	private function _processXmlResponse($url){
63 66
 	/*
64 67
 	A private utility method used by other public methods to process XML responses.
Please login to merge, or discard this patch.
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -55,25 +55,25 @@  discard block
 block discarded – undo
55 55
 	*/
56 56
 		// BASE CONFIGS - set these for your BBB server in config.php and they will
57 57
 		// simply flow in here via the constants:
58
-		$this->_securitySalt 		= CONFIG_SECURITY_SALT;
59
-		$this->_bbbServerBaseUrl 	= CONFIG_SERVER_BASE_URL;
58
+		$this->_securitySalt = CONFIG_SECURITY_SALT;
59
+		$this->_bbbServerBaseUrl = CONFIG_SERVER_BASE_URL;
60 60
 	}
61 61
 
62
-	private function _processXmlResponse($url){
62
+	private function _processXmlResponse($url) {
63 63
 	/*
64 64
 	A private utility method used by other public methods to process XML responses.
65 65
 	*/
66 66
 		if (extension_loaded('curl')) {
67
-			$ch = curl_init() or die ( curl_error($ch) );
67
+			$ch = curl_init() or die (curl_error($ch));
68 68
 			$timeout = 10;
69
-			curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false);
70
-			curl_setopt( $ch, CURLOPT_URL, $url );
71
-			curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 );
72
-			curl_setopt( $ch, CURLOPT_CONNECTTIMEOUT, $timeout);
73
-			$data = curl_exec( $ch );
74
-			curl_close( $ch );
75
-
76
-			if($data)
69
+			curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
70
+			curl_setopt($ch, CURLOPT_URL, $url);
71
+			curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
72
+			curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
73
+			$data = curl_exec($ch);
74
+			curl_close($ch);
75
+
76
+			if ($data)
77 77
 				return (new SimpleXMLElement($data));
78 78
 			else
79 79
 				return false;
@@ -137,10 +137,10 @@  discard block
 block discarded – undo
137 137
 		'&duration='.urlencode($creationParams['duration']);
138 138
 		//'&meta_category='.urlencode($creationParams['meta_category']);
139 139
 		$welcomeMessage = $creationParams['welcomeMsg'];
140
-		if(trim($welcomeMessage))
140
+		if (trim($welcomeMessage))
141 141
 			$params .= '&welcome='.urlencode($welcomeMessage);
142 142
 		// Return the complete URL:
143
-		return ( $creationUrl.$params.'&checksum='.sha1("create".$params.$this->_securitySalt) );
143
+		return ($creationUrl.$params.'&checksum='.sha1("create".$params.$this->_securitySalt));
144 144
 	}
145 145
 
146 146
 	public function createMeetingWithXmlResponseArray($creationParams) {
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
 		$xml = $this->_processXmlResponse($this->getCreateMeetingURL($creationParams));
166 166
 
167 167
         if ($xml) {
168
-			if($xml->meetingID)
168
+			if ($xml->meetingID)
169 169
 				return array(
170 170
 					'returncode' => $xml->returncode,
171 171
 					'message' => $xml->message,
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
 		$meetingId = '1234'		-- REQUIRED - The unique id for the meeting
284 284
 		*/
285 285
 		$xml = $this->_processXmlResponse($this->getIsMeetingRunningUrl($meetingId));
286
-		if($xml) {
286
+		if ($xml) {
287 287
 			return array(
288 288
 				'returncode' => $xml->returncode,
289 289
 				'running' => $xml->running 	// -- Returns true/false.
@@ -310,7 +310,7 @@  discard block
 block discarded – undo
310 310
 		and then handle the results that we get in the XML response.
311 311
 		*/
312 312
 		$xml = $this->_processXmlResponse($this->getGetMeetingsUrl());
313
-		if($xml) {
313
+		if ($xml) {
314 314
 			// If we don't get a success code, stop processing and return just the returncode:
315 315
 			if ($xml->returncode != 'SUCCESS') {
316 316
 				$result = array(
@@ -379,7 +379,7 @@  discard block
 block discarded – undo
379 379
 		);
380 380
 		*/
381 381
 		$xml = $this->_processXmlResponse($this->getMeetingInfoUrl($infoParams));
382
-		if($xml) {
382
+		if ($xml) {
383 383
 			// If we don't get a success code or messageKey, find out why:
384 384
 			if (($xml->returncode != 'SUCCESS') || ($xml->messageKey == null)) {
385 385
 				$result = array(
@@ -454,7 +454,7 @@  discard block
 block discarded – undo
454 454
 		probably be required in user code when 'recording' is set to true.
455 455
 		*/
456 456
 		$xml = $this->_processXmlResponse($this->getRecordingsUrl($recordingParams));
457
-		if($xml) {
457
+		if ($xml) {
458 458
 			// If we don't get a success code or messageKey, find out why:
459 459
 			if (($xml->returncode != 'SUCCESS') || ($xml->messageKey == null)) {
460 460
 				$result = array(
@@ -524,7 +524,7 @@  discard block
 block discarded – undo
524 524
 		);
525 525
 		*/
526 526
 		$xml = $this->_processXmlResponse($this->getPublishRecordingsUrl($recordingParams));
527
-		if($xml) {
527
+		if ($xml) {
528 528
 			return array(
529 529
 				'returncode' => $xml->returncode,
530 530
 				'published' => $xml->published 	// -- Returns true/false.
@@ -557,7 +557,7 @@  discard block
 block discarded – undo
557 557
 		*/
558 558
 
559 559
 		$xml = $this->_processXmlResponse($this->getDeleteRecordingsUrl($recordingParams));
560
-		if($xml) {
560
+		if ($xml) {
561 561
 			return array(
562 562
 				'returncode' => $xml->returncode,
563 563
 				'deleted' => $xml->deleted 	// -- Returns true/false.
Please login to merge, or discard this patch.
Braces   +28 added lines, -40 removed lines patch added patch discarded remove patch
@@ -73,10 +73,11 @@  discard block
 block discarded – undo
73 73
 			$data = curl_exec( $ch );
74 74
 			curl_close( $ch );
75 75
 
76
-			if($data)
77
-				return (new SimpleXMLElement($data));
78
-			else
79
-				return false;
76
+			if($data) {
77
+							return (new SimpleXMLElement($data));
78
+			} else {
79
+							return false;
80
+			}
80 81
 		}
81 82
 		return (simplexml_load_file($url));
82 83
 	}
@@ -85,11 +86,9 @@  discard block
 block discarded – undo
85 86
 		/* Process required params and throw errors if we don't get values */
86 87
 		if ((isset($param)) && ($param != '')) {
87 88
 			return $param;
88
-		}
89
-		elseif (!isset($param)) {
89
+		} elseif (!isset($param)) {
90 90
 			throw new Exception('Missing parameter.');
91
-		}
92
-		else {
91
+		} else {
93 92
 			throw new Exception(''.$param.' is required.');
94 93
 		}
95 94
 	}
@@ -99,8 +98,7 @@  discard block
 block discarded – undo
99 98
 		/* Don't know if we'll use this one, but let's build it in case. */
100 99
 		if ((isset($param)) && ($param != '')) {
101 100
 			return $param;
102
-		}
103
-		else {
101
+		} else {
104 102
 			$param = '';
105 103
 			return $param;
106 104
 		}
@@ -137,8 +135,9 @@  discard block
 block discarded – undo
137 135
 		'&duration='.urlencode($creationParams['duration']);
138 136
 		//'&meta_category='.urlencode($creationParams['meta_category']);
139 137
 		$welcomeMessage = $creationParams['welcomeMsg'];
140
-		if(trim($welcomeMessage))
141
-			$params .= '&welcome='.urlencode($welcomeMessage);
138
+		if(trim($welcomeMessage)) {
139
+					$params .= '&welcome='.urlencode($welcomeMessage);
140
+		}
142 141
 		// Return the complete URL:
143 142
 		return ( $creationUrl.$params.'&checksum='.sha1("create".$params.$this->_securitySalt) );
144 143
 	}
@@ -165,8 +164,8 @@  discard block
 block discarded – undo
165 164
 		$xml = $this->_processXmlResponse($this->getCreateMeetingURL($creationParams));
166 165
 
167 166
         if ($xml) {
168
-			if($xml->meetingID)
169
-				return array(
167
+			if($xml->meetingID) {
168
+							return array(
170 169
 					'returncode' => $xml->returncode,
171 170
 					'message' => $xml->message,
172 171
 					'messageKey' => $xml->messageKey,
@@ -176,14 +175,14 @@  discard block
 block discarded – undo
176 175
 					'hasBeenForciblyEnded' => $xml->hasBeenForciblyEnded,
177 176
 					'createTime' => $xml->createTime
178 177
 					);
179
-			else
180
-				return array(
178
+			} else {
179
+							return array(
181 180
 					'returncode' => $xml->returncode,
182 181
 					'message' => $xml->message,
183 182
 					'messageKey' => $xml->messageKey
184 183
 					);
185
-		}
186
-		else {
184
+			}
185
+		} else {
187 186
 			return null;
188 187
 		}
189 188
 	}
@@ -253,8 +252,7 @@  discard block
 block discarded – undo
253 252
 				'message' => $xml->message,
254 253
 				'messageKey' => $xml->messageKey
255 254
 				);
256
-		}
257
-		else {
255
+		} else {
258 256
 			return null;
259 257
 		}
260 258
 
@@ -288,8 +286,7 @@  discard block
 block discarded – undo
288 286
 				'returncode' => $xml->returncode,
289 287
 				'running' => $xml->running 	// -- Returns true/false.
290 288
 				);
291
-		}
292
-		else {
289
+		} else {
293 290
 			return null;
294 291
 		}
295 292
 
@@ -317,8 +314,7 @@  discard block
 block discarded – undo
317 314
 					'returncode' => $xml->returncode
318 315
 				);
319 316
 				return $result;
320
-			}
321
-			elseif ($xml->messageKey == 'noMeetings') {
317
+			} elseif ($xml->messageKey == 'noMeetings') {
322 318
 				/* No meetings on server, so return just this info: */
323 319
 				$result = array(
324 320
 					'returncode' => $xml->returncode,
@@ -326,8 +322,7 @@  discard block
 block discarded – undo
326 322
 					'message' => $xml->message
327 323
 				);
328 324
 				return $result;
329
-			}
330
-			else {
325
+			} else {
331 326
 				// In this case, we have success and meetings. First return general response:
332 327
 				$result = array(
333 328
 					'returncode' => $xml->returncode,
@@ -348,8 +343,7 @@  discard block
 block discarded – undo
348 343
 					}
349 344
 				return $result;
350 345
 			}
351
-		}
352
-		else {
346
+		} else {
353 347
 			return null;
354 348
 		}
355 349
 
@@ -388,8 +382,7 @@  discard block
 block discarded – undo
388 382
 					'message' => $xml->message
389 383
 				);
390 384
 				return $result;
391
-			}
392
-			else {
385
+			} else {
393 386
 				// In this case, we have success and meeting info:
394 387
 				$result = array(
395 388
 					'returncode' => $xml->returncode,
@@ -418,8 +411,7 @@  discard block
 block discarded – undo
418 411
 					}
419 412
 				return $result;
420 413
 			}
421
-		}
422
-		else {
414
+		} else {
423 415
 			return null;
424 416
 		}
425 417
 
@@ -463,8 +455,7 @@  discard block
 block discarded – undo
463 455
 					'message' => $xml->message
464 456
 				);
465 457
 				return $result;
466
-			}
467
-			else {
458
+			} else {
468 459
 				// In this case, we have success and recording info:
469 460
 				$result = array(
470 461
 					'returncode' => $xml->returncode,
@@ -495,8 +486,7 @@  discard block
 block discarded – undo
495 486
 					}
496 487
 				return $result;
497 488
 			}
498
-		}
499
-		else {
489
+		} else {
500 490
 			return null;
501 491
 		}
502 492
 	}
@@ -529,8 +519,7 @@  discard block
 block discarded – undo
529 519
 				'returncode' => $xml->returncode,
530 520
 				'published' => $xml->published 	// -- Returns true/false.
531 521
 				);
532
-		}
533
-		else {
522
+		} else {
534 523
 			return null;
535 524
 		}
536 525
 
@@ -562,8 +551,7 @@  discard block
 block discarded – undo
562 551
 				'returncode' => $xml->returncode,
563 552
 				'deleted' => $xml->deleted 	// -- Returns true/false.
564 553
 				);
565
-		}
566
-		else {
554
+		} else {
567 555
 			return null;
568 556
 		}
569 557
 
Please login to merge, or discard this patch.
Indentation   +403 added lines, -403 removed lines patch added patch discarded remove patch
@@ -44,107 +44,107 @@  discard block
 block discarded – undo
44 44
 
45 45
 class BigBlueButtonBN {
46 46
 
47
-	private $_securitySalt;
48
-	private $_bbbServerBaseUrl;
47
+    private $_securitySalt;
48
+    private $_bbbServerBaseUrl;
49 49
 
50
-	/* ___________ General Methods for the BigBlueButton Class __________ */
50
+    /* ___________ General Methods for the BigBlueButton Class __________ */
51 51
 
52
-	function __construct() {
53
-	/*
52
+    function __construct() {
53
+    /*
54 54
 	Establish just our basic elements in the constructor:
55 55
 	*/
56
-		// BASE CONFIGS - set these for your BBB server in config.php and they will
57
-		// simply flow in here via the constants:
58
-		$this->_securitySalt 		= CONFIG_SECURITY_SALT;
59
-		$this->_bbbServerBaseUrl 	= CONFIG_SERVER_BASE_URL;
60
-	}
61
-
62
-	private function _processXmlResponse($url){
63
-	/*
56
+        // BASE CONFIGS - set these for your BBB server in config.php and they will
57
+        // simply flow in here via the constants:
58
+        $this->_securitySalt 		= CONFIG_SECURITY_SALT;
59
+        $this->_bbbServerBaseUrl 	= CONFIG_SERVER_BASE_URL;
60
+    }
61
+
62
+    private function _processXmlResponse($url){
63
+    /*
64 64
 	A private utility method used by other public methods to process XML responses.
65 65
 	*/
66
-		if (extension_loaded('curl')) {
67
-			$ch = curl_init() or die ( curl_error($ch) );
68
-			$timeout = 10;
69
-			curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false);
70
-			curl_setopt( $ch, CURLOPT_URL, $url );
71
-			curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 );
72
-			curl_setopt( $ch, CURLOPT_CONNECTTIMEOUT, $timeout);
73
-			$data = curl_exec( $ch );
74
-			curl_close( $ch );
75
-
76
-			if($data)
77
-				return (new SimpleXMLElement($data));
78
-			else
79
-				return false;
80
-		}
81
-		return (simplexml_load_file($url));
82
-	}
83
-
84
-	private function _requiredParam($param) {
85
-		/* Process required params and throw errors if we don't get values */
86
-		if ((isset($param)) && ($param != '')) {
87
-			return $param;
88
-		}
89
-		elseif (!isset($param)) {
90
-			throw new Exception('Missing parameter.');
91
-		}
92
-		else {
93
-			throw new Exception(''.$param.' is required.');
94
-		}
95
-	}
96
-
97
-	private function _optionalParam($param) {
98
-		/* Pass most optional params through as set value, or set to '' */
99
-		/* Don't know if we'll use this one, but let's build it in case. */
100
-		if ((isset($param)) && ($param != '')) {
101
-			return $param;
102
-		}
103
-		else {
104
-			$param = '';
105
-			return $param;
106
-		}
107
-	}
108
-
109
-	/* __________________ BBB ADMINISTRATION METHODS _________________ */
110
-	/* The methods in the following section support the following categories of the BBB API:
66
+        if (extension_loaded('curl')) {
67
+            $ch = curl_init() or die ( curl_error($ch) );
68
+            $timeout = 10;
69
+            curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false);
70
+            curl_setopt( $ch, CURLOPT_URL, $url );
71
+            curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 );
72
+            curl_setopt( $ch, CURLOPT_CONNECTTIMEOUT, $timeout);
73
+            $data = curl_exec( $ch );
74
+            curl_close( $ch );
75
+
76
+            if($data)
77
+                return (new SimpleXMLElement($data));
78
+            else
79
+                return false;
80
+        }
81
+        return (simplexml_load_file($url));
82
+    }
83
+
84
+    private function _requiredParam($param) {
85
+        /* Process required params and throw errors if we don't get values */
86
+        if ((isset($param)) && ($param != '')) {
87
+            return $param;
88
+        }
89
+        elseif (!isset($param)) {
90
+            throw new Exception('Missing parameter.');
91
+        }
92
+        else {
93
+            throw new Exception(''.$param.' is required.');
94
+        }
95
+    }
96
+
97
+    private function _optionalParam($param) {
98
+        /* Pass most optional params through as set value, or set to '' */
99
+        /* Don't know if we'll use this one, but let's build it in case. */
100
+        if ((isset($param)) && ($param != '')) {
101
+            return $param;
102
+        }
103
+        else {
104
+            $param = '';
105
+            return $param;
106
+        }
107
+    }
108
+
109
+    /* __________________ BBB ADMINISTRATION METHODS _________________ */
110
+    /* The methods in the following section support the following categories of the BBB API:
111 111
 	-- create
112 112
 	-- join
113 113
 	-- end
114 114
 	*/
115 115
 
116
-	public function getCreateMeetingUrl($creationParams) {
117
-		/*
116
+    public function getCreateMeetingUrl($creationParams) {
117
+        /*
118 118
 		USAGE:
119 119
 		(see $creationParams array in createMeetingArray method.)
120 120
 		*/
121
-		$this->_meetingId = $this->_requiredParam($creationParams['meetingId']);
122
-		$this->_meetingName = $this->_requiredParam($creationParams['meetingName']);
123
-		// Set up the basic creation URL:
124
-		$creationUrl = $this->_bbbServerBaseUrl."api/create?";
125
-		// Add params:
126
-		$params =
127
-		'name='.urlencode($this->_meetingName).
128
-		'&meetingID='.urlencode($this->_meetingId).
129
-		'&attendeePW='.urlencode($creationParams['attendeePw']).
130
-		'&moderatorPW='.urlencode($creationParams['moderatorPw']).
131
-		'&dialNumber='.urlencode($creationParams['dialNumber']).
132
-		'&voiceBridge='.urlencode($creationParams['voiceBridge']).
133
-		'&webVoice='.urlencode($creationParams['webVoice']).
134
-		'&logoutURL='.urlencode($creationParams['logoutUrl']).
135
-		'&maxParticipants='.urlencode($creationParams['maxParticipants']).
136
-		'&record='.urlencode($creationParams['record']).
137
-		'&duration='.urlencode($creationParams['duration']);
138
-		//'&meta_category='.urlencode($creationParams['meta_category']);
139
-		$welcomeMessage = $creationParams['welcomeMsg'];
140
-		if(trim($welcomeMessage))
141
-			$params .= '&welcome='.urlencode($welcomeMessage);
142
-		// Return the complete URL:
143
-		return ( $creationUrl.$params.'&checksum='.sha1("create".$params.$this->_securitySalt) );
144
-	}
145
-
146
-	public function createMeetingWithXmlResponseArray($creationParams) {
147
-		/*
121
+        $this->_meetingId = $this->_requiredParam($creationParams['meetingId']);
122
+        $this->_meetingName = $this->_requiredParam($creationParams['meetingName']);
123
+        // Set up the basic creation URL:
124
+        $creationUrl = $this->_bbbServerBaseUrl."api/create?";
125
+        // Add params:
126
+        $params =
127
+        'name='.urlencode($this->_meetingName).
128
+        '&meetingID='.urlencode($this->_meetingId).
129
+        '&attendeePW='.urlencode($creationParams['attendeePw']).
130
+        '&moderatorPW='.urlencode($creationParams['moderatorPw']).
131
+        '&dialNumber='.urlencode($creationParams['dialNumber']).
132
+        '&voiceBridge='.urlencode($creationParams['voiceBridge']).
133
+        '&webVoice='.urlencode($creationParams['webVoice']).
134
+        '&logoutURL='.urlencode($creationParams['logoutUrl']).
135
+        '&maxParticipants='.urlencode($creationParams['maxParticipants']).
136
+        '&record='.urlencode($creationParams['record']).
137
+        '&duration='.urlencode($creationParams['duration']);
138
+        //'&meta_category='.urlencode($creationParams['meta_category']);
139
+        $welcomeMessage = $creationParams['welcomeMsg'];
140
+        if(trim($welcomeMessage))
141
+            $params .= '&welcome='.urlencode($welcomeMessage);
142
+        // Return the complete URL:
143
+        return ( $creationUrl.$params.'&checksum='.sha1("create".$params.$this->_securitySalt) );
144
+    }
145
+
146
+    public function createMeetingWithXmlResponseArray($creationParams) {
147
+        /*
148 148
 		USAGE:
149 149
 		$creationParams = array(
150 150
 			'name' => 'Meeting Name',	-- A name for the meeting (or username)
@@ -162,34 +162,34 @@  discard block
 block discarded – undo
162 162
 			'meta_category' => '', 		-- Use to pass additional info to BBB server. See API docs to enable.
163 163
 		);
164 164
 		*/
165
-		$xml = $this->_processXmlResponse($this->getCreateMeetingURL($creationParams));
165
+        $xml = $this->_processXmlResponse($this->getCreateMeetingURL($creationParams));
166 166
 
167 167
         if ($xml) {
168
-			if($xml->meetingID)
169
-				return array(
170
-					'returncode' => $xml->returncode->__toString(),
171
-					'message' => $xml->message->__toString(),
172
-					'messageKey' => $xml->messageKey->__toString(),
173
-					'meetingId' => $xml->meetingID->__toString(),
174
-					'attendeePw' => $xml->attendeePW->__toString(),
175
-					'moderatorPw' => $xml->moderatorPW->__toString(),
176
-					'hasBeenForciblyEnded' => $xml->hasBeenForciblyEnded->__toString(),
177
-					'createTime' => $xml->createTime->__toString()
178
-					);
179
-			else
180
-				return array(
181
-					'returncode' => $xml->returncode->__toString(),
182
-					'message' => $xml->message->__toString(),
183
-					'messageKey' => $xml->messageKey->__toString()
184
-					);
185
-		}
186
-		else {
187
-			return null;
188
-		}
189
-	}
190
-
191
-	public function getJoinMeetingURL($joinParams) {
192
-		/*
168
+            if($xml->meetingID)
169
+                return array(
170
+                    'returncode' => $xml->returncode->__toString(),
171
+                    'message' => $xml->message->__toString(),
172
+                    'messageKey' => $xml->messageKey->__toString(),
173
+                    'meetingId' => $xml->meetingID->__toString(),
174
+                    'attendeePw' => $xml->attendeePW->__toString(),
175
+                    'moderatorPw' => $xml->moderatorPW->__toString(),
176
+                    'hasBeenForciblyEnded' => $xml->hasBeenForciblyEnded->__toString(),
177
+                    'createTime' => $xml->createTime->__toString()
178
+                    );
179
+            else
180
+                return array(
181
+                    'returncode' => $xml->returncode->__toString(),
182
+                    'message' => $xml->message->__toString(),
183
+                    'messageKey' => $xml->messageKey->__toString()
184
+                    );
185
+        }
186
+        else {
187
+            return null;
188
+        }
189
+    }
190
+
191
+    public function getJoinMeetingURL($joinParams) {
192
+        /*
193 193
 		NOTE: At this point, we don't use a corresponding joinMeetingWithXmlResponse here because the API
194 194
 		doesn't respond on success, but you can still code that method if you need it. Or, you can take the URL
195 195
 		that's returned from this method and simply send your users off to that URL in your code.
@@ -203,249 +203,249 @@  discard block
 block discarded – undo
203 203
 			'webVoiceConf' => ''		-- OPTIONAL - string
204 204
 		);
205 205
 		*/
206
-		$this->_meetingId = $this->_requiredParam($joinParams['meetingId']);
207
-		$this->_username = $this->_requiredParam($joinParams['username']);
208
-		$this->_password = $this->_requiredParam($joinParams['password']);
209
-		// Establish the basic join URL:
210
-		$joinUrl = $this->_bbbServerBaseUrl."api/join?";
211
-		// Add parameters to the URL:
212
-		$params =
213
-		'meetingID='.urlencode($this->_meetingId).
214
-		'&fullName='.urlencode($this->_username).
215
-		'&password='.urlencode($this->_password).
216
-		'&userID='.urlencode($joinParams['userID']).
217
-		'&webVoiceConf='.urlencode($joinParams['webVoiceConf']);
218
-		// Only use createTime if we really want to use it. If it's '', then don't pass it:
219
-		if (((isset($joinParams['createTime'])) && ($joinParams['createTime'] != ''))) {
220
-			$params .= '&createTime='.urlencode($joinParams['createTime']);
221
-		}
222
-		// Return the URL:
223
-		return ($joinUrl.$params.'&checksum='.sha1("join".$params.$this->_securitySalt));
224
-	}
225
-
226
-	public function getEndMeetingURL($endParams) {
227
-		/* USAGE:
206
+        $this->_meetingId = $this->_requiredParam($joinParams['meetingId']);
207
+        $this->_username = $this->_requiredParam($joinParams['username']);
208
+        $this->_password = $this->_requiredParam($joinParams['password']);
209
+        // Establish the basic join URL:
210
+        $joinUrl = $this->_bbbServerBaseUrl."api/join?";
211
+        // Add parameters to the URL:
212
+        $params =
213
+        'meetingID='.urlencode($this->_meetingId).
214
+        '&fullName='.urlencode($this->_username).
215
+        '&password='.urlencode($this->_password).
216
+        '&userID='.urlencode($joinParams['userID']).
217
+        '&webVoiceConf='.urlencode($joinParams['webVoiceConf']);
218
+        // Only use createTime if we really want to use it. If it's '', then don't pass it:
219
+        if (((isset($joinParams['createTime'])) && ($joinParams['createTime'] != ''))) {
220
+            $params .= '&createTime='.urlencode($joinParams['createTime']);
221
+        }
222
+        // Return the URL:
223
+        return ($joinUrl.$params.'&checksum='.sha1("join".$params.$this->_securitySalt));
224
+    }
225
+
226
+    public function getEndMeetingURL($endParams) {
227
+        /* USAGE:
228 228
 		$endParams = array (
229 229
 			'meetingId' => '1234',		-- REQUIRED - The unique id for the meeting
230 230
 			'password' => 'mp'			-- REQUIRED - The moderator password for the meeting
231 231
 		);
232 232
 		*/
233
-		$this->_meetingId = $this->_requiredParam($endParams['meetingId']);
234
-		$this->_password = $this->_requiredParam($endParams['password']);
235
-		$endUrl = $this->_bbbServerBaseUrl."api/end?";
236
-		$params =
237
-		'meetingID='.urlencode($this->_meetingId).
238
-		'&password='.urlencode($this->_password);
239
-		return ($endUrl.$params.'&checksum='.sha1("end".$params.$this->_securitySalt));
240
-	}
241
-
242
-	public function endMeetingWithXmlResponseArray($endParams) {
243
-		/* USAGE:
233
+        $this->_meetingId = $this->_requiredParam($endParams['meetingId']);
234
+        $this->_password = $this->_requiredParam($endParams['password']);
235
+        $endUrl = $this->_bbbServerBaseUrl."api/end?";
236
+        $params =
237
+        'meetingID='.urlencode($this->_meetingId).
238
+        '&password='.urlencode($this->_password);
239
+        return ($endUrl.$params.'&checksum='.sha1("end".$params.$this->_securitySalt));
240
+    }
241
+
242
+    public function endMeetingWithXmlResponseArray($endParams) {
243
+        /* USAGE:
244 244
 		$endParams = array (
245 245
 			'meetingId' => '1234',		-- REQUIRED - The unique id for the meeting
246 246
 			'password' => 'mp'			-- REQUIRED - The moderator password for the meeting
247 247
 		);
248 248
 		*/
249
-		$xml = $this->_processXmlResponse($this->getEndMeetingURL($endParams));
250
-		if ($xml) {
251
-			return array(
252
-				'returncode' => $xml->returncode->__toString(),
253
-				'message' => $xml->message->__toString(),
254
-				'messageKey' => $xml->messageKey->__toString()
255
-				);
256
-		}
257
-		else {
258
-			return null;
259
-		}
260
-
261
-	}
262
-
263
-	/* __________________ BBB MONITORING METHODS _________________ */
264
-	/* The methods in the following section support the following categories of the BBB API:
249
+        $xml = $this->_processXmlResponse($this->getEndMeetingURL($endParams));
250
+        if ($xml) {
251
+            return array(
252
+                'returncode' => $xml->returncode->__toString(),
253
+                'message' => $xml->message->__toString(),
254
+                'messageKey' => $xml->messageKey->__toString()
255
+                );
256
+        }
257
+        else {
258
+            return null;
259
+        }
260
+
261
+    }
262
+
263
+    /* __________________ BBB MONITORING METHODS _________________ */
264
+    /* The methods in the following section support the following categories of the BBB API:
265 265
 	-- isMeetingRunning
266 266
 	-- getMeetings
267 267
 	-- getMeetingInfo
268 268
 	*/
269 269
 
270
-	public function getIsMeetingRunningUrl($meetingId) {
271
-		/* USAGE:
270
+    public function getIsMeetingRunningUrl($meetingId) {
271
+        /* USAGE:
272 272
 		$meetingId = '1234'		-- REQUIRED - The unique id for the meeting
273 273
 		*/
274
-		$this->_meetingId = $this->_requiredParam($meetingId);
275
-		$runningUrl = $this->_bbbServerBaseUrl."api/isMeetingRunning?";
276
-		$params =
277
-		'meetingID='.urlencode($this->_meetingId);
278
-		return ($runningUrl.$params.'&checksum='.sha1("isMeetingRunning".$params.$this->_securitySalt));
279
-	}
280
-
281
-	public function isMeetingRunningWithXmlResponseArray($meetingId) {
282
-		/* USAGE:
274
+        $this->_meetingId = $this->_requiredParam($meetingId);
275
+        $runningUrl = $this->_bbbServerBaseUrl."api/isMeetingRunning?";
276
+        $params =
277
+        'meetingID='.urlencode($this->_meetingId);
278
+        return ($runningUrl.$params.'&checksum='.sha1("isMeetingRunning".$params.$this->_securitySalt));
279
+    }
280
+
281
+    public function isMeetingRunningWithXmlResponseArray($meetingId) {
282
+        /* USAGE:
283 283
 		$meetingId = '1234'		-- REQUIRED - The unique id for the meeting
284 284
 		*/
285
-		$xml = $this->_processXmlResponse($this->getIsMeetingRunningUrl($meetingId));
286
-		if($xml) {
287
-			return array(
288
-				'returncode' => $xml->returncode->__toString(),
289
-				'running' => $xml->running->__toString() 	// -- Returns true/false.
290
-			);
291
-		}
292
-		else {
293
-			return null;
294
-		}
295
-
296
-	}
297
-
298
-	public function getGetMeetingsUrl() {
299
-		/* Simply formulate the getMeetings URL
285
+        $xml = $this->_processXmlResponse($this->getIsMeetingRunningUrl($meetingId));
286
+        if($xml) {
287
+            return array(
288
+                'returncode' => $xml->returncode->__toString(),
289
+                'running' => $xml->running->__toString() 	// -- Returns true/false.
290
+            );
291
+        }
292
+        else {
293
+            return null;
294
+        }
295
+
296
+    }
297
+
298
+    public function getGetMeetingsUrl() {
299
+        /* Simply formulate the getMeetings URL
300 300
 		We do this in a separate function so we have the option to just get this
301 301
 		URL and print it if we want for some reason.
302 302
 		*/
303
-		$getMeetingsUrl = $this->_bbbServerBaseUrl."api/getMeetings?checksum=".sha1("getMeetings".$this->_securitySalt);
304
-		return $getMeetingsUrl;
305
-	}
303
+        $getMeetingsUrl = $this->_bbbServerBaseUrl."api/getMeetings?checksum=".sha1("getMeetings".$this->_securitySalt);
304
+        return $getMeetingsUrl;
305
+    }
306 306
 
307
-	public function getMeetingsWithXmlResponseArray() {
308
-		/* USAGE:
307
+    public function getMeetingsWithXmlResponseArray() {
308
+        /* USAGE:
309 309
 		We don't need to pass any parameters with this one, so we just send the query URL off to BBB
310 310
 		and then handle the results that we get in the XML response.
311 311
 		*/
312
-		$xml = $this->_processXmlResponse($this->getGetMeetingsUrl());
313
-		if($xml) {
314
-			// If we don't get a success code, stop processing and return just the returncode:
315
-			if ($xml->returncode != 'SUCCESS') {
316
-				$result = array(
317
-					'returncode' => $xml->returncode->__toString()
318
-				);
319
-				return $result;
320
-			}
321
-			elseif ($xml->messageKey == 'noMeetings') {
322
-				/* No meetings on server, so return just this info: */
323
-				$result = array(
324
-					'returncode' => $xml->returncode->__toString(),
325
-					'messageKey' => $xml->messageKey->__toString(),
326
-					'message' => $xml->message->__toString()
327
-				);
328
-				return $result;
329
-			}
330
-			else {
331
-				// In this case, we have success and meetings. First return general response:
332
-				$result = array(
333
-					'returncode' => $xml->returncode->__toString(),
334
-					'messageKey' => $xml->messageKey->__toString(),
335
-					'message' => $xml->message->__toString()
336
-				);
337
-				// Then interate through meeting results and return them as part of the array:
338
-				foreach ($xml->meetings->meeting as $m) {
339
-					$result[] = array(
340
-						'meetingId' => $m->meetingID->__toString(),
341
-						'meetingName' => $m->meetingName->__toString(),
342
-						'createTime' => $m->createTime->__toString(),
343
-						'attendeePw' => $m->attendeePW->__toString(),
344
-						'moderatorPw' => $m->moderatorPW->__toString(),
345
-						'hasBeenForciblyEnded' => $m->hasBeenForciblyEnded->__toString(),
346
-						'running' => $m->running->__toString()
347
-					);
348
-				}
349
-				return $result;
350
-			}
351
-		}
352
-		else {
353
-			return null;
354
-		}
355
-
356
-	}
357
-
358
-	public function getMeetingInfoUrl($infoParams) {
359
-		/* USAGE:
312
+        $xml = $this->_processXmlResponse($this->getGetMeetingsUrl());
313
+        if($xml) {
314
+            // If we don't get a success code, stop processing and return just the returncode:
315
+            if ($xml->returncode != 'SUCCESS') {
316
+                $result = array(
317
+                    'returncode' => $xml->returncode->__toString()
318
+                );
319
+                return $result;
320
+            }
321
+            elseif ($xml->messageKey == 'noMeetings') {
322
+                /* No meetings on server, so return just this info: */
323
+                $result = array(
324
+                    'returncode' => $xml->returncode->__toString(),
325
+                    'messageKey' => $xml->messageKey->__toString(),
326
+                    'message' => $xml->message->__toString()
327
+                );
328
+                return $result;
329
+            }
330
+            else {
331
+                // In this case, we have success and meetings. First return general response:
332
+                $result = array(
333
+                    'returncode' => $xml->returncode->__toString(),
334
+                    'messageKey' => $xml->messageKey->__toString(),
335
+                    'message' => $xml->message->__toString()
336
+                );
337
+                // Then interate through meeting results and return them as part of the array:
338
+                foreach ($xml->meetings->meeting as $m) {
339
+                    $result[] = array(
340
+                        'meetingId' => $m->meetingID->__toString(),
341
+                        'meetingName' => $m->meetingName->__toString(),
342
+                        'createTime' => $m->createTime->__toString(),
343
+                        'attendeePw' => $m->attendeePW->__toString(),
344
+                        'moderatorPw' => $m->moderatorPW->__toString(),
345
+                        'hasBeenForciblyEnded' => $m->hasBeenForciblyEnded->__toString(),
346
+                        'running' => $m->running->__toString()
347
+                    );
348
+                }
349
+                return $result;
350
+            }
351
+        }
352
+        else {
353
+            return null;
354
+        }
355
+
356
+    }
357
+
358
+    public function getMeetingInfoUrl($infoParams) {
359
+        /* USAGE:
360 360
 		$infoParams = array(
361 361
 			'meetingId' => '1234',		-- REQUIRED - The unique id for the meeting
362 362
 			'password' => 'mp'			-- REQUIRED - The moderator password for the meeting
363 363
 		);
364 364
 		*/
365
-		$this->_meetingId = $this->_requiredParam($infoParams['meetingId']);
366
-		$this->_password = $this->_requiredParam($infoParams['password']);
367
-		$infoUrl = $this->_bbbServerBaseUrl."api/getMeetingInfo?";
368
-		$params =
369
-		'meetingID='.urlencode($this->_meetingId).
370
-		'&password='.urlencode($this->_password);
371
-		return ($infoUrl.$params.'&checksum='.sha1("getMeetingInfo".$params.$this->_securitySalt));
372
-	}
373
-
374
-	public function getMeetingInfoWithXmlResponseArray($infoParams) {
375
-		/* USAGE:
365
+        $this->_meetingId = $this->_requiredParam($infoParams['meetingId']);
366
+        $this->_password = $this->_requiredParam($infoParams['password']);
367
+        $infoUrl = $this->_bbbServerBaseUrl."api/getMeetingInfo?";
368
+        $params =
369
+        'meetingID='.urlencode($this->_meetingId).
370
+        '&password='.urlencode($this->_password);
371
+        return ($infoUrl.$params.'&checksum='.sha1("getMeetingInfo".$params.$this->_securitySalt));
372
+    }
373
+
374
+    public function getMeetingInfoWithXmlResponseArray($infoParams) {
375
+        /* USAGE:
376 376
 		$infoParams = array(
377 377
 			'meetingId' => '1234',		-- REQUIRED - The unique id for the meeting
378 378
 			'password' => 'mp'			-- REQUIRED - The moderator password for the meeting
379 379
 		);
380 380
 		*/
381
-		$xml = $this->_processXmlResponse($this->getMeetingInfoUrl($infoParams));
382
-		if($xml) {
383
-			// If we don't get a success code or messageKey, find out why:
384
-			if (($xml->returncode != 'SUCCESS') || ($xml->messageKey == null)) {
385
-				$result = array(
386
-					'returncode' => $xml->returncode->__toString(),
387
-					'messageKey' => $xml->messageKey->__toString(),
388
-					'message' => $xml->message->__toString()
389
-				);
390
-				return $result;
391
-			}
392
-			else {
393
-				// In this case, we have success and meeting info:
394
-				$result = array(
395
-					'returncode' => $xml->returncode->__toString(),
396
-					'meetingName' => $xml->meetingName->__toString(),
397
-					'meetingId' => $xml->meetingID->__toString(),
398
-					'createTime' => $xml->createTime->__toString(),
399
-					'voiceBridge' => $xml->voiceBridge->__toString(),
400
-					'attendeePw' => $xml->attendeePW->__toString(),
401
-					'moderatorPw' => $xml->moderatorPW->__toString(),
402
-					'running' => $xml->running->__toString(),
403
-					'recording' => $xml->recording->__toString(),
404
-					'hasBeenForciblyEnded' => $xml->hasBeenForciblyEnded->__toString(),
405
-					'startTime' => $xml->startTime->__toString(),
406
-					'endTime' => $xml->endTime->__toString(),
407
-					'participantCount' => $xml->participantCount->__toString(),
408
-					'maxUsers' => $xml->maxUsers->__toString(),
409
-					'moderatorCount' => $xml->moderatorCount->__toString(),
410
-				);
411
-				// Then interate through attendee results and return them as part of the array:
412
-				foreach ($xml->attendees->attendee as $a) {
413
-					$result[] = array(
414
-						'userId' => $a->userID->__toString(),
415
-						'fullName' => $a->fullName->__toString(),
416
-						'role' => $a->role->__toString()
417
-					);
418
-				}
419
-				return $result;
420
-			}
421
-		}
422
-		else {
423
-			return null;
424
-		}
425
-
426
-	}
427
-
428
-	/* __________________ BBB RECORDING METHODS _________________ */
429
-	/* The methods in the following section support the following categories of the BBB API:
381
+        $xml = $this->_processXmlResponse($this->getMeetingInfoUrl($infoParams));
382
+        if($xml) {
383
+            // If we don't get a success code or messageKey, find out why:
384
+            if (($xml->returncode != 'SUCCESS') || ($xml->messageKey == null)) {
385
+                $result = array(
386
+                    'returncode' => $xml->returncode->__toString(),
387
+                    'messageKey' => $xml->messageKey->__toString(),
388
+                    'message' => $xml->message->__toString()
389
+                );
390
+                return $result;
391
+            }
392
+            else {
393
+                // In this case, we have success and meeting info:
394
+                $result = array(
395
+                    'returncode' => $xml->returncode->__toString(),
396
+                    'meetingName' => $xml->meetingName->__toString(),
397
+                    'meetingId' => $xml->meetingID->__toString(),
398
+                    'createTime' => $xml->createTime->__toString(),
399
+                    'voiceBridge' => $xml->voiceBridge->__toString(),
400
+                    'attendeePw' => $xml->attendeePW->__toString(),
401
+                    'moderatorPw' => $xml->moderatorPW->__toString(),
402
+                    'running' => $xml->running->__toString(),
403
+                    'recording' => $xml->recording->__toString(),
404
+                    'hasBeenForciblyEnded' => $xml->hasBeenForciblyEnded->__toString(),
405
+                    'startTime' => $xml->startTime->__toString(),
406
+                    'endTime' => $xml->endTime->__toString(),
407
+                    'participantCount' => $xml->participantCount->__toString(),
408
+                    'maxUsers' => $xml->maxUsers->__toString(),
409
+                    'moderatorCount' => $xml->moderatorCount->__toString(),
410
+                );
411
+                // Then interate through attendee results and return them as part of the array:
412
+                foreach ($xml->attendees->attendee as $a) {
413
+                    $result[] = array(
414
+                        'userId' => $a->userID->__toString(),
415
+                        'fullName' => $a->fullName->__toString(),
416
+                        'role' => $a->role->__toString()
417
+                    );
418
+                }
419
+                return $result;
420
+            }
421
+        }
422
+        else {
423
+            return null;
424
+        }
425
+
426
+    }
427
+
428
+    /* __________________ BBB RECORDING METHODS _________________ */
429
+    /* The methods in the following section support the following categories of the BBB API:
430 430
 	-- getRecordings
431 431
 	-- publishRecordings
432 432
 	-- deleteRecordings
433 433
 	*/
434 434
 
435
-	public function getRecordingsUrl($recordingParams) {
436
-		/* USAGE:
435
+    public function getRecordingsUrl($recordingParams) {
436
+        /* USAGE:
437 437
 		$recordingParams = array(
438 438
 			'meetingId' => '1234',		-- OPTIONAL - comma separate if multiple ids
439 439
 		);
440 440
 		*/
441
-		$recordingsUrl = $this->_bbbServerBaseUrl."api/getRecordings?";
442
-		$params = 'meetingID='.urlencode($recordingParams['meetingId']);
443
-		return ($recordingsUrl.$params.'&checksum='.sha1("getRecordings".$params.$this->_securitySalt));
441
+        $recordingsUrl = $this->_bbbServerBaseUrl."api/getRecordings?";
442
+        $params = 'meetingID='.urlencode($recordingParams['meetingId']);
443
+        return ($recordingsUrl.$params.'&checksum='.sha1("getRecordings".$params.$this->_securitySalt));
444 444
 
445
-	}
445
+    }
446 446
 
447
-	public function getRecordingsWithXmlResponseArray($recordingParams) {
448
-		/* USAGE:
447
+    public function getRecordingsWithXmlResponseArray($recordingParams) {
448
+        /* USAGE:
449 449
 		$recordingParams = array(
450 450
 			'meetingId' => '1234',		-- OPTIONAL - comma separate if multiple ids
451 451
 		);
@@ -453,121 +453,121 @@  discard block
 block discarded – undo
453 453
 		when creating a meeting, it will kick users out after the duration. Should
454 454
 		probably be required in user code when 'recording' is set to true.
455 455
 		*/
456
-		$xml = $this->_processXmlResponse($this->getRecordingsUrl($recordingParams));
457
-		if($xml) {
458
-			// If we don't get a success code or messageKey, find out why:
459
-			if (($xml->returncode != 'SUCCESS') || ($xml->messageKey == null)) {
460
-				$result = array(
461
-					'returncode' => $xml->returncode->__toString(),
462
-					'messageKey' => $xml->messageKey->__toString(),
463
-					'message' => $xml->message->__toString()
464
-				);
465
-				return $result;
466
-			}
467
-			else {
468
-				// In this case, we have success and recording info:
469
-				$result = array(
470
-					'returncode' => $xml->returncode->__toString(),
471
-					'messageKey' => $xml->messageKey->__toString(),
472
-					'message' => $xml->message->__toString()
473
-				);
474
-
475
-				foreach ($xml->recordings->recording as $r) {
476
-					$result[] = array(
477
-						'recordId' => $r->recordID->__toString(),
478
-						'meetingId' => $r->meetingID->__toString(),
479
-						'name' => $r->name->__toString(),
480
-						'published' => $r->published->__toString(),
481
-						'startTime' => $r->startTime->__toString(),
482
-						'endTime' => $r->endTime->__toString(),
483
-						'playbackFormatType' => $r->playback->format->type->__toString(),
484
-						'playbackFormatUrl' => $r->playback->format->url->__toString(),
485
-						'playbackFormatLength' => $r->playback->format->length->__toString(),
486
-						'metadataTitle' => $r->metadata->title->__toString(),
487
-						'metadataSubject' => $r->metadata->subject->__toString(),
488
-						'metadataDescription' => $r->metadata->description->__toString(),
489
-						'metadataCreator' => $r->metadata->creator->__toString(),
490
-						'metadataContributor' => $r->metadata->contributor->__toString(),
491
-						'metadataLanguage' => $r->metadata->language->__toString(),
492
-						// Add more here as needed for your app depending on your
493
-						// use of metadata when creating recordings.
494
-						);
495
-					}
496
-				return $result;
497
-			}
498
-		}
499
-		else {
500
-			return null;
501
-		}
502
-	}
503
-
504
-	public function getPublishRecordingsUrl($recordingParams) {
505
-		/* USAGE:
456
+        $xml = $this->_processXmlResponse($this->getRecordingsUrl($recordingParams));
457
+        if($xml) {
458
+            // If we don't get a success code or messageKey, find out why:
459
+            if (($xml->returncode != 'SUCCESS') || ($xml->messageKey == null)) {
460
+                $result = array(
461
+                    'returncode' => $xml->returncode->__toString(),
462
+                    'messageKey' => $xml->messageKey->__toString(),
463
+                    'message' => $xml->message->__toString()
464
+                );
465
+                return $result;
466
+            }
467
+            else {
468
+                // In this case, we have success and recording info:
469
+                $result = array(
470
+                    'returncode' => $xml->returncode->__toString(),
471
+                    'messageKey' => $xml->messageKey->__toString(),
472
+                    'message' => $xml->message->__toString()
473
+                );
474
+
475
+                foreach ($xml->recordings->recording as $r) {
476
+                    $result[] = array(
477
+                        'recordId' => $r->recordID->__toString(),
478
+                        'meetingId' => $r->meetingID->__toString(),
479
+                        'name' => $r->name->__toString(),
480
+                        'published' => $r->published->__toString(),
481
+                        'startTime' => $r->startTime->__toString(),
482
+                        'endTime' => $r->endTime->__toString(),
483
+                        'playbackFormatType' => $r->playback->format->type->__toString(),
484
+                        'playbackFormatUrl' => $r->playback->format->url->__toString(),
485
+                        'playbackFormatLength' => $r->playback->format->length->__toString(),
486
+                        'metadataTitle' => $r->metadata->title->__toString(),
487
+                        'metadataSubject' => $r->metadata->subject->__toString(),
488
+                        'metadataDescription' => $r->metadata->description->__toString(),
489
+                        'metadataCreator' => $r->metadata->creator->__toString(),
490
+                        'metadataContributor' => $r->metadata->contributor->__toString(),
491
+                        'metadataLanguage' => $r->metadata->language->__toString(),
492
+                        // Add more here as needed for your app depending on your
493
+                        // use of metadata when creating recordings.
494
+                        );
495
+                    }
496
+                return $result;
497
+            }
498
+        }
499
+        else {
500
+            return null;
501
+        }
502
+    }
503
+
504
+    public function getPublishRecordingsUrl($recordingParams) {
505
+        /* USAGE:
506 506
 		$recordingParams = array(
507 507
 			'recordId' => '1234',		-- REQUIRED - comma separate if multiple ids
508 508
 			'publish' => 'true',		-- REQUIRED - boolean: true/false
509 509
 		);
510 510
 		*/
511
-		$recordingsUrl = $this->_bbbServerBaseUrl."api/publishRecordings?";
512
-		$params =
513
-		'recordID='.urlencode($recordingParams['recordId']).
514
-		'&publish='.urlencode($recordingParams['publish']);
515
-		return ($recordingsUrl.$params.'&checksum='.sha1("publishRecordings".$params.$this->_securitySalt));
511
+        $recordingsUrl = $this->_bbbServerBaseUrl."api/publishRecordings?";
512
+        $params =
513
+        'recordID='.urlencode($recordingParams['recordId']).
514
+        '&publish='.urlencode($recordingParams['publish']);
515
+        return ($recordingsUrl.$params.'&checksum='.sha1("publishRecordings".$params.$this->_securitySalt));
516 516
 
517
-	}
517
+    }
518 518
 
519
-	public function publishRecordingsWithXmlResponseArray($recordingParams) {
520
-		/* USAGE:
519
+    public function publishRecordingsWithXmlResponseArray($recordingParams) {
520
+        /* USAGE:
521 521
 		$recordingParams = array(
522 522
 			'recordId' => '1234',		-- REQUIRED - comma separate if multiple ids
523 523
 			'publish' => 'true',		-- REQUIRED - boolean: true/false
524 524
 		);
525 525
 		*/
526
-		$xml = $this->_processXmlResponse($this->getPublishRecordingsUrl($recordingParams));
527
-		if($xml) {
528
-			return array(
529
-				'returncode' => $xml->returncode->__toString(),
530
-				'published' => $xml->published->__toString() 	// -- Returns true/false.
531
-			);
532
-		}
533
-		else {
534
-			return null;
535
-		}
536
-
537
-
538
-	}
539
-
540
-	public function getDeleteRecordingsUrl($recordingParams) {
541
-		/* USAGE:
526
+        $xml = $this->_processXmlResponse($this->getPublishRecordingsUrl($recordingParams));
527
+        if($xml) {
528
+            return array(
529
+                'returncode' => $xml->returncode->__toString(),
530
+                'published' => $xml->published->__toString() 	// -- Returns true/false.
531
+            );
532
+        }
533
+        else {
534
+            return null;
535
+        }
536
+
537
+
538
+    }
539
+
540
+    public function getDeleteRecordingsUrl($recordingParams) {
541
+        /* USAGE:
542 542
 		$recordingParams = array(
543 543
 			'recordId' => '1234',		-- REQUIRED - comma separate if multiple ids
544 544
 		);
545 545
 		*/
546
-		$recordingsUrl = $this->_bbbServerBaseUrl."api/deleteRecordings?";
547
-		$params =
548
-		'recordID='.urlencode($recordingParams['recordId']);
549
-		return ($recordingsUrl.$params.'&checksum='.sha1("deleteRecordings".$params.$this->_securitySalt));
550
-	}
551
-
552
-	public function deleteRecordingsWithXmlResponseArray($recordingParams) {
553
-		/* USAGE:
546
+        $recordingsUrl = $this->_bbbServerBaseUrl."api/deleteRecordings?";
547
+        $params =
548
+        'recordID='.urlencode($recordingParams['recordId']);
549
+        return ($recordingsUrl.$params.'&checksum='.sha1("deleteRecordings".$params.$this->_securitySalt));
550
+    }
551
+
552
+    public function deleteRecordingsWithXmlResponseArray($recordingParams) {
553
+        /* USAGE:
554 554
 		$recordingParams = array(
555 555
 			'recordId' => '1234',		-- REQUIRED - comma separate if multiple ids
556 556
 		);
557 557
 		*/
558 558
 
559
-		$xml = $this->_processXmlResponse($this->getDeleteRecordingsUrl($recordingParams));
560
-		if($xml) {
561
-			return array(
562
-				'returncode' => $xml->returncode->__toString(),
563
-				'deleted' => $xml->deleted->__toString() 	// -- Returns true/false.
564
-			);
565
-		}
566
-		else {
567
-			return null;
568
-		}
569
-
570
-	}
559
+        $xml = $this->_processXmlResponse($this->getDeleteRecordingsUrl($recordingParams));
560
+        if($xml) {
561
+            return array(
562
+                'returncode' => $xml->returncode->__toString(),
563
+                'deleted' => $xml->deleted->__toString() 	// -- Returns true/false.
564
+            );
565
+        }
566
+        else {
567
+            return null;
568
+        }
569
+
570
+    }
571 571
 
572 572
 
573 573
 
Please login to merge, or discard this patch.
plugin/buycourses/src/paypalfunctions.php 3 patches
Doc Comments   +2 added lines patch added patch discarded remove patch
@@ -324,6 +324,8 @@
 block discarded – undo
324 324
  * @nvpStr is nvp string.
325 325
  * returns an associtive array containing the response from the server.
326 326
  *
327
+ * @param string $methodName
328
+ * @param string $nvpStr
327 329
  */
328 330
 function hash_call($methodName, $nvpStr)
329 331
 {
Please login to merge, or discard this patch.
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -111,8 +111,8 @@  discard block
 block discarded – undo
111 111
  *		phoneNum:			the phoneNum  entered on the merchant's site
112 112
  */
113 113
 function CallMarkExpressCheckout($paymentAmount, $currencyCodeType, $paymentType, $returnURL,
114
-                                 $cancelURL, $shipToName, $shipToStreet, $shipToCity, $shipToState,
115
-                                 $shipToCountryCode, $shipToZip, $shipToStreet2, $phoneNum
114
+                                    $cancelURL, $shipToName, $shipToStreet, $shipToCity, $shipToState,
115
+                                    $shipToCountryCode, $shipToZip, $shipToStreet2, $phoneNum
116 116
 )
117 117
 {
118 118
     // Construct the parameter string that describes the SetExpressCheckout API call in the shortcut implementation
@@ -265,8 +265,8 @@  discard block
 block discarded – undo
265 265
  */
266 266
 
267 267
 function DirectPayment($paymentType, $paymentAmount, $creditCardType, $creditCardNumber,
268
-                       $expDate, $cvv2, $firstName, $lastName, $street, $city, $state, $zip,
269
-                       $countryCode, $currencyCode)
268
+                        $expDate, $cvv2, $firstName, $lastName, $street, $city, $state, $zip,
269
+                        $countryCode, $currencyCode)
270 270
 {
271 271
     //Construct the parameter string that describes DoDirectPayment
272 272
     $nvpstr = "&AMT=" . $paymentAmount;
Please login to merge, or discard this patch.
Spacing   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -67,12 +67,12 @@  discard block
 block discarded – undo
67 67
 function CallShortcutExpressCheckout($paymentAmount, $currencyCodeType, $paymentType, $returnURL, $cancelURL, $extra)
68 68
 {
69 69
     // Construct the parameter string that describes the SetExpressCheckout API call in the shortcut implementation
70
-    $nvpstr = "&PAYMENTREQUEST_0_AMT=" . $paymentAmount;
71
-    $nvpstr .= "&PAYMENTREQUEST_0_ITEMAMT=" . $paymentAmount;
72
-    $nvpstr .= "&PAYMENTREQUEST_0_PAYMENTACTION=" . $paymentType;
73
-    $nvpstr .= "&RETURNURL=" . $returnURL;
74
-    $nvpstr .= "&CANCELURL=" . $cancelURL;
75
-    $nvpstr .= "&PAYMENTREQUEST_0_CURRENCYCODE=" . $currencyCodeType;
70
+    $nvpstr = "&PAYMENTREQUEST_0_AMT=".$paymentAmount;
71
+    $nvpstr .= "&PAYMENTREQUEST_0_ITEMAMT=".$paymentAmount;
72
+    $nvpstr .= "&PAYMENTREQUEST_0_PAYMENTACTION=".$paymentType;
73
+    $nvpstr .= "&RETURNURL=".$returnURL;
74
+    $nvpstr .= "&CANCELURL=".$cancelURL;
75
+    $nvpstr .= "&PAYMENTREQUEST_0_CURRENCYCODE=".$currencyCodeType;
76 76
     $nvpstr .= $extra;
77 77
 
78 78
     $_SESSION["currencyCodeType"] = $currencyCodeType;
@@ -116,20 +116,20 @@  discard block
 block discarded – undo
116 116
 )
117 117
 {
118 118
     // Construct the parameter string that describes the SetExpressCheckout API call in the shortcut implementation
119
-    $nvpstr = "&PAYMENTREQUEST_0_AMT=" . $paymentAmount;
120
-    $nvpstr = $nvpstr . "&PAYMENTREQUEST_0_PAYMENTACTION=" . $paymentType;
121
-    $nvpstr = $nvpstr . "&RETURNURL=" . $returnURL;
122
-    $nvpstr = $nvpstr . "&CANCELURL=" . $cancelURL;
123
-    $nvpstr = $nvpstr . "&PAYMENTREQUEST_0_CURRENCYCODE=" . $currencyCodeType;
124
-    $nvpstr = $nvpstr . "&ADDROVERRIDE=1";
125
-    $nvpstr = $nvpstr . "&PAYMENTREQUEST_0_SHIPTONAME=" . $shipToName;
126
-    $nvpstr = $nvpstr . "&PAYMENTREQUEST_0_SHIPTOSTREET=" . $shipToStreet;
127
-    $nvpstr = $nvpstr . "&PAYMENTREQUEST_0_SHIPTOSTREET2=" . $shipToStreet2;
128
-    $nvpstr = $nvpstr . "&PAYMENTREQUEST_0_SHIPTOCITY=" . $shipToCity;
129
-    $nvpstr = $nvpstr . "&PAYMENTREQUEST_0_SHIPTOSTATE=" . $shipToState;
130
-    $nvpstr = $nvpstr . "&PAYMENTREQUEST_0_SHIPTOCOUNTRYCODE=" . $shipToCountryCode;
131
-    $nvpstr = $nvpstr . "&PAYMENTREQUEST_0_SHIPTOZIP=" . $shipToZip;
132
-    $nvpstr = $nvpstr . "&PAYMENTREQUEST_0_SHIPTOPHONENUM=" . $phoneNum;
119
+    $nvpstr = "&PAYMENTREQUEST_0_AMT=".$paymentAmount;
120
+    $nvpstr = $nvpstr."&PAYMENTREQUEST_0_PAYMENTACTION=".$paymentType;
121
+    $nvpstr = $nvpstr."&RETURNURL=".$returnURL;
122
+    $nvpstr = $nvpstr."&CANCELURL=".$cancelURL;
123
+    $nvpstr = $nvpstr."&PAYMENTREQUEST_0_CURRENCYCODE=".$currencyCodeType;
124
+    $nvpstr = $nvpstr."&ADDROVERRIDE=1";
125
+    $nvpstr = $nvpstr."&PAYMENTREQUEST_0_SHIPTONAME=".$shipToName;
126
+    $nvpstr = $nvpstr."&PAYMENTREQUEST_0_SHIPTOSTREET=".$shipToStreet;
127
+    $nvpstr = $nvpstr."&PAYMENTREQUEST_0_SHIPTOSTREET2=".$shipToStreet2;
128
+    $nvpstr = $nvpstr."&PAYMENTREQUEST_0_SHIPTOCITY=".$shipToCity;
129
+    $nvpstr = $nvpstr."&PAYMENTREQUEST_0_SHIPTOSTATE=".$shipToState;
130
+    $nvpstr = $nvpstr."&PAYMENTREQUEST_0_SHIPTOCOUNTRYCODE=".$shipToCountryCode;
131
+    $nvpstr = $nvpstr."&PAYMENTREQUEST_0_SHIPTOZIP=".$shipToZip;
132
+    $nvpstr = $nvpstr."&PAYMENTREQUEST_0_SHIPTOPHONENUM=".$phoneNum;
133 133
 
134 134
     $_SESSION["currencyCodeType"] = $currencyCodeType;
135 135
     $_SESSION["PaymentType"] = $paymentType;
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
      * Build a second API request to PayPal, using the token as the
173 173
      * ID to get the details on the payment authorization
174 174
      */
175
-    $nvpstr = "&TOKEN=" . $token;
175
+    $nvpstr = "&TOKEN=".$token;
176 176
 
177 177
     /**
178 178
      * Make the API call and store the results in an array.
@@ -213,9 +213,9 @@  discard block
 block discarded – undo
213 213
     $payerID = urlencode($_SESSION['payer_id']);
214 214
     $serverName = urlencode($_SERVER['SERVER_NAME']);
215 215
 
216
-    $nvpstr = '&TOKEN=' . $token . '&PAYERID=' . $payerID . '&PAYMENTREQUEST_0_PAYMENTACTION=' . $paymentType . '&PAYMENTREQUEST_0_AMT=' . $FinalPaymentAmt;
217
-    $nvpstr .= '&PAYMENTREQUEST_0_CURRENCYCODE=' . $currencyCodeType . '&IPADDRESS=' . $serverName;
218
-    $nvpstr = '&' . http_build_query([
216
+    $nvpstr = '&TOKEN='.$token.'&PAYERID='.$payerID.'&PAYMENTREQUEST_0_PAYMENTACTION='.$paymentType.'&PAYMENTREQUEST_0_AMT='.$FinalPaymentAmt;
217
+    $nvpstr .= '&PAYMENTREQUEST_0_CURRENCYCODE='.$currencyCodeType.'&IPADDRESS='.$serverName;
218
+    $nvpstr = '&'.http_build_query([
219 219
         'TOKEN' => $token,
220 220
         'PAYERID' => $payerID,
221 221
         'PAYMENTACTION' => $paymentType,
@@ -269,20 +269,20 @@  discard block
 block discarded – undo
269 269
                        $countryCode, $currencyCode)
270 270
 {
271 271
     //Construct the parameter string that describes DoDirectPayment
272
-    $nvpstr = "&AMT=" . $paymentAmount;
273
-    $nvpstr = $nvpstr . "&CURRENCYCODE=" . $currencyCode;
274
-    $nvpstr = $nvpstr . "&PAYMENTACTION=" . $paymentType;
275
-    $nvpstr = $nvpstr . "&CREDITCARDTYPE=" . $creditCardType;
276
-    $nvpstr = $nvpstr . "&ACCT=" . $creditCardNumber;
277
-    $nvpstr = $nvpstr . "&EXPDATE=" . $expDate;
278
-    $nvpstr = $nvpstr . "&CVV2=" . $cvv2;
279
-    $nvpstr = $nvpstr . "&FIRSTNAME=" . $firstName;
280
-    $nvpstr = $nvpstr . "&LASTNAME=" . $lastName;
281
-    $nvpstr = $nvpstr . "&STREET=" . $street;
282
-    $nvpstr = $nvpstr . "&CITY=" . $city;
283
-    $nvpstr = $nvpstr . "&STATE=" . $state;
284
-    $nvpstr = $nvpstr . "&COUNTRYCODE=" . $countryCode;
285
-    $nvpstr = $nvpstr . "&IPADDRESS=" . $_SERVER['REMOTE_ADDR'];
272
+    $nvpstr = "&AMT=".$paymentAmount;
273
+    $nvpstr = $nvpstr."&CURRENCYCODE=".$currencyCode;
274
+    $nvpstr = $nvpstr."&PAYMENTACTION=".$paymentType;
275
+    $nvpstr = $nvpstr."&CREDITCARDTYPE=".$creditCardType;
276
+    $nvpstr = $nvpstr."&ACCT=".$creditCardNumber;
277
+    $nvpstr = $nvpstr."&EXPDATE=".$expDate;
278
+    $nvpstr = $nvpstr."&CVV2=".$cvv2;
279
+    $nvpstr = $nvpstr."&FIRSTNAME=".$firstName;
280
+    $nvpstr = $nvpstr."&LASTNAME=".$lastName;
281
+    $nvpstr = $nvpstr."&STREET=".$street;
282
+    $nvpstr = $nvpstr."&CITY=".$city;
283
+    $nvpstr = $nvpstr."&STATE=".$state;
284
+    $nvpstr = $nvpstr."&COUNTRYCODE=".$countryCode;
285
+    $nvpstr = $nvpstr."&IPADDRESS=".$_SERVER['REMOTE_ADDR'];
286 286
 
287 287
     $resArray = hash_call("DoDirectPayment", $nvpstr);
288 288
 
@@ -345,13 +345,13 @@  discard block
 block discarded – undo
345 345
     //if USE_PROXY constant set to TRUE in Constants.php, then only proxy will be enabled.
346 346
     //Set proxy name to PROXY_HOST and port number to PROXY_PORT in constants.php
347 347
     if ($USE_PROXY) {
348
-        curl_setopt($ch, CURLOPT_PROXY, $PROXY_HOST . ":" . $PROXY_PORT);
348
+        curl_setopt($ch, CURLOPT_PROXY, $PROXY_HOST.":".$PROXY_PORT);
349 349
     }
350 350
 
351 351
     //NVPRequest for submitting to server
352
-    $nvpreq = "METHOD=" . urlencode($methodName) . "&VERSION=" . urlencode($version) .
353
-        "&PWD=" . urlencode($API_Password) . "&USER=" . urlencode($API_UserName) .
354
-        "&SIGNATURE=" . urlencode($API_Signature) . $nvpStr . "&BUTTONSOURCE=" . urlencode($sBNCode);
352
+    $nvpreq = "METHOD=".urlencode($methodName)."&VERSION=".urlencode($version).
353
+        "&PWD=".urlencode($API_Password)."&USER=".urlencode($API_UserName).
354
+        "&SIGNATURE=".urlencode($API_Signature).$nvpStr."&BUTTONSOURCE=".urlencode($sBNCode);
355 355
 
356 356
     //setting the nvpreq as POST FIELD to curl
357 357
     curl_setopt($ch, CURLOPT_POSTFIELDS, $nvpreq);
@@ -385,8 +385,8 @@  discard block
 block discarded – undo
385 385
 {
386 386
     global $PAYPAL_URL;
387 387
     // Redirect to paypal.com here
388
-    $payPalURL = $PAYPAL_URL . $token;
389
-    header("Location: " . $payPalURL);
388
+    $payPalURL = $PAYPAL_URL.$token;
389
+    header("Location: ".$payPalURL);
390 390
     exit;
391 391
 }
392 392
 
Please login to merge, or discard this patch.
plugin/clockworksms/lib/clockworksms_plugin.class.php 1 patch
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@
 block discarded – undo
14 14
     /**
15 15
      * create (a singleton function that ensures ClockworksmsPlugin instance is
16 16
      * created only once. If it is already created, it returns the instance)
17
-     * @return  object  ClockworksmsPlugin instance
17
+     * @return  ClockworksmsPlugin  ClockworksmsPlugin instance
18 18
      */
19 19
     public static function create()
20 20
     {
Please login to merge, or discard this patch.
plugin/clockworksms/vendor/clockworksms_api.php 3 patches
Doc Comments   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -471,6 +471,8 @@  discard block
 block discarded – undo
471 471
   *
472 472
   * @param   string   method Clockwork method to call (sms/credit)
473 473
   * @param   string   data   Content of HTTP POST
474
+  * @param string $method
475
+  * @param string $data
474 476
   *
475 477
   * @return  string          Response from Clockwork
476 478
   * @author  Martin Steel
@@ -505,6 +507,7 @@  discard block
 block discarded – undo
505 507
   *
506 508
   * @param   string url      URL to send to
507 509
   * @param   string data     Data to POST
510
+  * @param string $url
508 511
   * @return  string          Response returned by server
509 512
   * @author  Martin Steel
510 513
   */
@@ -631,7 +634,7 @@  discard block
 block discarded – undo
631 634
    * Check if a number is a valid MSISDN
632 635
    *
633 636
    * @param string $val Value to check
634
-   * @return bool True if valid MSISDN
637
+   * @return integer True if valid MSISDN
635 638
    * @author James Inman
636 639
    * @since 1.3.0
637 640
    * @todo Take an optional country code and check that the number starts with it
Please login to merge, or discard this patch.
Indentation   +334 added lines, -334 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
 */
11 11
 
12 12
 if ( !class_exists('ClockworkException') ) {
13
-  require_once('exception.php');
13
+    require_once('exception.php');
14 14
 }
15 15
 
16 16
 /**
@@ -21,130 +21,130 @@  discard block
 block discarded – undo
21 21
 */
22 22
 class Clockwork {
23 23
 
24
-  /*
24
+    /*
25 25
   * Version of this class
26 26
   */
27
-  const VERSION           = '1.3.1';
28
-
29
-  /**
30
-  * All Clockwork API calls start with BASE_URL
31
-  * @author  Martin Steel
32
-  */
33
-  const API_BASE_URL      = 'api.clockworksms.com/xml/';
34
-
35
-  /**
36
-  * string to append to API_BASE_URL to check authentication
37
-  * @author  Martin Steel
38
-  */
39
-  const API_AUTH_METHOD   = 'authenticate';
40
-
41
-  /**
42
-  * string to append to API_BASE_URL for sending SMS
43
-  * @author  Martin Steel
44
-  */
45
-  const API_SMS_METHOD    = 'sms';
46
-
47
-  /**
48
-  * string to append to API_BASE_URL for checking message credit
49
-  * @author  Martin Steel
50
-  */
51
-  const API_CREDIT_METHOD = 'credit';
52
-
53
-  /**
54
-  * string to append to API_BASE_URL for checking account balance
55
-  * @author  Martin Steel
56
-  */
57
-  const API_BALANCE_METHOD = 'balance';
58
-
59
-  /** 
60
-  * Clockwork API Key
61
-  * 
62
-  * @var string
63
-  * @author  Martin Steel
64
-  */
65
-  public $key;
66
-
67
-  /**
68
-  * Use SSL when making HTTP requests
69
-  *
70
-  * If this is not set, SSL will be used where PHP supports it
71
-  *
72
-  * @var bool
73
-  * @author  Martin Steel
74
-  */
75
-  public $ssl;
76
-
77
-  /**
78
-  * Proxy server hostname (Optional)
79
-  *
80
-  * @var string
81
-  * @author  Martin Steel
82
-  */
83
-  public $proxy_host;
84
-
85
-  /**
86
-  * Proxy server port (Optional)
87
-  *
88
-  * @var integer
89
-  * @author  Martin Steel
90
-  */
91
-  public $proxy_port;
92
-
93
-  /**
94
-  * From address used on text messages
95
-  *
96
-  * @var string (11 characters or 12 numbers)
97
-  * @author  Martin Steel
98
-  */
99
-  public $from;
100
-
101
-  /**
102
-  * Allow long SMS messages (Cost up to 3 credits)
103
-  *
104
-  * @var bool
105
-  * @author  Martin Steel
106
-  */
107
-  public $long;
108
-
109
-  /**
110
-  * Truncate message text if it is too long
111
-  *
112
-  * @var bool
113
-  * @author  Martin Steel
114
-  */
115
-  public $truncate;
116
-
117
-  /**
118
-  * Enables various logging of messages when true.
119
-  *
120
-  * @var bool
121
-  * @author  Martin Steel
122
-  */
123
-  public $log;
124
-
125
-  /**
126
-  * What Clockwork should do if you send an invalid character
127
-  *
128
-  * Possible values:
129
-  *      'error'     - Return an error (Messasge is not sent)
130
-  *      'remove'    - Remove the invalid character(s)
131
-  *      'replace'   - Replace invalid characters where possible, remove others 
132
-  * @author  Martin Steel
133
-  */
134
-  public $invalid_char_action;
135
-
136
-  /**
137
-  * Create a new instance of the Clockwork wrapper
138
-  *
139
-  * @param   string  key         Your Clockwork API Key
140
-  * @param   array   options     Optional parameters for sending SMS
141
-  * @author  Martin Steel
142
-  */
143
-  public function __construct($key, array $options = array()) {
27
+    const VERSION           = '1.3.1';
28
+
29
+    /**
30
+     * All Clockwork API calls start with BASE_URL
31
+     * @author  Martin Steel
32
+     */
33
+    const API_BASE_URL      = 'api.clockworksms.com/xml/';
34
+
35
+    /**
36
+     * string to append to API_BASE_URL to check authentication
37
+     * @author  Martin Steel
38
+     */
39
+    const API_AUTH_METHOD   = 'authenticate';
40
+
41
+    /**
42
+     * string to append to API_BASE_URL for sending SMS
43
+     * @author  Martin Steel
44
+     */
45
+    const API_SMS_METHOD    = 'sms';
46
+
47
+    /**
48
+     * string to append to API_BASE_URL for checking message credit
49
+     * @author  Martin Steel
50
+     */
51
+    const API_CREDIT_METHOD = 'credit';
52
+
53
+    /**
54
+     * string to append to API_BASE_URL for checking account balance
55
+     * @author  Martin Steel
56
+     */
57
+    const API_BALANCE_METHOD = 'balance';
58
+
59
+    /** 
60
+     * Clockwork API Key
61
+     * 
62
+     * @var string
63
+     * @author  Martin Steel
64
+     */
65
+    public $key;
66
+
67
+    /**
68
+     * Use SSL when making HTTP requests
69
+     *
70
+     * If this is not set, SSL will be used where PHP supports it
71
+     *
72
+     * @var bool
73
+     * @author  Martin Steel
74
+     */
75
+    public $ssl;
76
+
77
+    /**
78
+     * Proxy server hostname (Optional)
79
+     *
80
+     * @var string
81
+     * @author  Martin Steel
82
+     */
83
+    public $proxy_host;
84
+
85
+    /**
86
+     * Proxy server port (Optional)
87
+     *
88
+     * @var integer
89
+     * @author  Martin Steel
90
+     */
91
+    public $proxy_port;
92
+
93
+    /**
94
+     * From address used on text messages
95
+     *
96
+     * @var string (11 characters or 12 numbers)
97
+     * @author  Martin Steel
98
+     */
99
+    public $from;
100
+
101
+    /**
102
+     * Allow long SMS messages (Cost up to 3 credits)
103
+     *
104
+     * @var bool
105
+     * @author  Martin Steel
106
+     */
107
+    public $long;
108
+
109
+    /**
110
+     * Truncate message text if it is too long
111
+     *
112
+     * @var bool
113
+     * @author  Martin Steel
114
+     */
115
+    public $truncate;
116
+
117
+    /**
118
+     * Enables various logging of messages when true.
119
+     *
120
+     * @var bool
121
+     * @author  Martin Steel
122
+     */
123
+    public $log;
124
+
125
+    /**
126
+     * What Clockwork should do if you send an invalid character
127
+     *
128
+     * Possible values:
129
+     *      'error'     - Return an error (Messasge is not sent)
130
+     *      'remove'    - Remove the invalid character(s)
131
+     *      'replace'   - Replace invalid characters where possible, remove others 
132
+     * @author  Martin Steel
133
+     */
134
+    public $invalid_char_action;
135
+
136
+    /**
137
+     * Create a new instance of the Clockwork wrapper
138
+     *
139
+     * @param   string  key         Your Clockwork API Key
140
+     * @param   array   options     Optional parameters for sending SMS
141
+     * @author  Martin Steel
142
+     */
143
+    public function __construct($key, array $options = array()) {
144 144
     if (empty($key)) {
145
-      throw new ClockworkException("Key can't be blank");      
145
+        throw new ClockworkException("Key can't be blank");      
146 146
     } else {
147
-      $this->key = $key;
147
+        $this->key = $key;
148 148
     }
149 149
         
150 150
     $this->ssl                  = (array_key_exists('ssl', $options)) ? $options['ssl'] : null;
@@ -155,22 +155,22 @@  discard block
 block discarded – undo
155 155
     $this->truncate             = (array_key_exists('truncate', $options)) ? $options['truncate'] : null;
156 156
     $this->invalid_char_action  = (array_key_exists('invalid_char_action', $options)) ? $options['invalid_char_action'] : null;
157 157
     $this->log                  = (array_key_exists('log', $options)) ? $options['log'] : false;
158
-  }
158
+    }
159 159
 
160
-  /**
161
-  * Send some text messages
162
-  * 
163
-  *
164
-  * @author  Martin Steel
165
-  */
166
-  public function send(array $sms) {
160
+    /**
161
+     * Send some text messages
162
+     * 
163
+     *
164
+     * @author  Martin Steel
165
+     */
166
+    public function send(array $sms) {
167 167
     if (!is_array($sms)) {
168
-      throw new ClockworkException("sms parameter must be an array");
168
+        throw new ClockworkException("sms parameter must be an array");
169 169
     }
170 170
     $single_message = $this->is_assoc($sms);
171 171
 
172 172
     if ($single_message) {
173
-      $sms = array($sms);
173
+        $sms = array($sms);
174 174
     }
175 175
 
176 176
     $req_doc = new DOMDocument('1.0', 'UTF-8');
@@ -182,70 +182,70 @@  discard block
 block discarded – undo
182 182
     $root->appendChild($user_node);
183 183
 
184 184
     for ($i = 0; $i < count($sms); $i++) {
185
-      $single = $sms[$i];
185
+        $single = $sms[$i];
186 186
 
187
-      $sms_node = $req_doc->createElement('SMS');
187
+        $sms_node = $req_doc->createElement('SMS');
188 188
            
189
-      // Phone number
190
-      $sms_node->appendChild($req_doc->createElement('To', $single['to'])); 
189
+        // Phone number
190
+        $sms_node->appendChild($req_doc->createElement('To', $single['to'])); 
191 191
             
192
-      // Message text
193
-      $content_node = $req_doc->createElement('Content');
194
-      $content_node->appendChild($req_doc->createTextNode($single['message']));
195
-      $sms_node->appendChild($content_node);
192
+        // Message text
193
+        $content_node = $req_doc->createElement('Content');
194
+        $content_node->appendChild($req_doc->createTextNode($single['message']));
195
+        $sms_node->appendChild($content_node);
196 196
 
197
-      // From
198
-      if (array_key_exists('from', $single) || isset($this->from)) {
197
+        // From
198
+        if (array_key_exists('from', $single) || isset($this->from)) {
199 199
         $from_node = $req_doc->createElement('From');
200 200
         $from_node->appendChild($req_doc->createTextNode(array_key_exists('from', $single) ? $single['from'] : $this->from));
201 201
         $sms_node->appendChild($from_node);
202
-      }
202
+        }
203 203
 
204
-      // Client ID
205
-      if (array_key_exists('client_id', $single)) {
204
+        // Client ID
205
+        if (array_key_exists('client_id', $single)) {
206 206
         $client_id_node = $req_doc->createElement('ClientID');
207 207
         $client_id_node->appendChild($req_doc->createTextNode($single['client_id']));
208 208
         $sms_node->appendChild($client_id_node);
209
-      }
209
+        }
210 210
 
211
-      // Long
212
-      if (array_key_exists('long', $single) || isset($this->long)) {
211
+        // Long
212
+        if (array_key_exists('long', $single) || isset($this->long)) {
213 213
         $long = array_key_exists('long', $single) ? $single['long'] : $this->long;
214 214
         $long_node = $req_doc->createElement('Long');
215 215
         $long_node->appendChild($req_doc->createTextNode($long ? 1 : 0));
216 216
         $sms_node->appendChild($long_node);
217
-      }
217
+        }
218 218
 
219
-      // Truncate
220
-      if (array_key_exists('truncate', $single) || isset($this->truncate)) {
219
+        // Truncate
220
+        if (array_key_exists('truncate', $single) || isset($this->truncate)) {
221 221
         $truncate = array_key_exists('truncate', $single) ? $single['truncate'] : $this->truncate;
222 222
         $trunc_node = $req_doc->createElement('Truncate');
223 223
         $trunc_node->appendChild($req_doc->createTextNode($truncate ? 1 : 0));
224 224
         $sms_node->appendChild($trunc_node);
225
-      }
225
+        }
226 226
 
227
-      // Invalid Char Action
228
-      if (array_key_exists('invalid_char_action', $single) || isset($this->invalid_char_action)) {
227
+        // Invalid Char Action
228
+        if (array_key_exists('invalid_char_action', $single) || isset($this->invalid_char_action)) {
229 229
         $action = array_key_exists('invalid_char_action', $single) ? $single['invalid_char_action'] : $this->invalid_char_action;
230 230
         switch (strtolower($action)) {
231
-          case 'error':
231
+            case 'error':
232 232
           $sms_node->appendChild($req_doc->createElement('InvalidCharAction', 1));
233
-          break;
234
-          case 'remove':
233
+            break;
234
+            case 'remove':
235 235
           $sms_node->appendChild($req_doc->createElement('InvalidCharAction', 2));
236
-          break;
237
-          case 'replace':
236
+            break;
237
+            case 'replace':
238 238
           $sms_node->appendChild($req_doc->createElement('InvalidCharAction', 3));
239
+            break;
240
+            default:
239 241
           break;
240
-          default:
241
-          break;
242 242
         }
243
-      }
243
+        }
244 244
 
245
-      // Wrapper ID
246
-      $sms_node->appendChild($req_doc->createElement('WrapperID', $i));
245
+        // Wrapper ID
246
+        $sms_node->appendChild($req_doc->createElement('WrapperID', $i));
247 247
 
248
-      $root->appendChild($sms_node);
248
+        $root->appendChild($sms_node);
249 249
     }
250 250
 
251 251
     $req_xml = $req_doc->saveXML();
@@ -259,12 +259,12 @@  discard block
 block discarded – undo
259 259
     $err_desc = null;
260 260
 
261 261
     foreach($resp_doc->documentElement->childNodes AS $doc_child) {
262
-      switch(strtolower($doc_child->nodeName)) {
262
+        switch(strtolower($doc_child->nodeName)) {
263 263
         case 'sms_resp':
264 264
         $resp = array();
265 265
         $wrapper_id = null;
266 266
         foreach($doc_child->childNodes AS $resp_node) {
267
-          switch(strtolower($resp_node->nodeName)) {
267
+            switch(strtolower($resp_node->nodeName)) {
268 268
             case 'messageid':
269 269
             $resp['id'] = $resp_node->nodeValue;
270 270
             break;
@@ -277,13 +277,13 @@  discard block
 block discarded – undo
277 277
             case 'wrapperid':
278 278
             $wrapper_id = $resp_node->nodeValue;
279 279
             break;
280
-          }
280
+            }
281 281
         }
282 282
         if( array_key_exists('error_code', $resp ) ) 
283 283
         {
284
-          $resp['success'] = 0;
284
+            $resp['success'] = 0;
285 285
         } else {
286
-          $resp['success'] = 1;
286
+            $resp['success'] = 1;
287 287
         }
288 288
         $resp['sms'] = $sms[$wrapper_id];
289 289
         array_push($response, $resp);
@@ -294,28 +294,28 @@  discard block
 block discarded – undo
294 294
         case 'errdesc':
295 295
         $err_desc = $doc_child->nodeValue;
296 296
         break;
297
-      }
297
+        }
298 298
     }
299 299
 
300 300
     if (isset($err_no)) {
301
-      throw new ClockworkException($err_desc, $err_no);      
301
+        throw new ClockworkException($err_desc, $err_no);      
302 302
     }
303 303
         
304 304
     if ($single_message) {
305
-      return $response[0];
305
+        return $response[0];
306 306
     } else {
307
-      return $response;
307
+        return $response;
308 308
     }
309
-  }
310
-
311
-  /**
312
-  * Check how many SMS credits you have available
313
-  *
314
-  * @return  integer   SMS credits remaining
315
-  * @deprecated Use checkBalance() instead
316
-  * @author  Martin Steel
317
-  */
318
-  public function checkCredit() {
309
+    }
310
+
311
+    /**
312
+     * Check how many SMS credits you have available
313
+     *
314
+     * @return  integer   SMS credits remaining
315
+     * @deprecated Use checkBalance() instead
316
+     * @author  Martin Steel
317
+     */
318
+    public function checkCredit() {
319 319
     // Create XML doc for request
320 320
     $req_doc = new DOMDocument('1.0', 'UTF-8');
321 321
     $root = $req_doc->createElement('Credit');
@@ -336,7 +336,7 @@  discard block
 block discarded – undo
336 336
     $err_desc = null;
337 337
         
338 338
     foreach ($resp_doc->documentElement->childNodes AS $doc_child) {
339
-      switch ($doc_child->nodeName) {
339
+        switch ($doc_child->nodeName) {
340 340
         case "Credit":
341 341
         $credit = $doc_child->nodeValue;
342 342
         break;
@@ -348,22 +348,22 @@  discard block
 block discarded – undo
348 348
         break;
349 349
         default:
350 350
         break;
351
-      }
351
+        }
352 352
     }
353 353
 
354 354
     if (isset($err_no)) {
355
-      throw new ClockworkException($err_desc, $err_no);
355
+        throw new ClockworkException($err_desc, $err_no);
356 356
     }
357 357
     return $credit;
358
-  }
358
+    }
359 359
 
360
-  /**
361
-  * Check your account balance
362
-  *
363
-  * @return  array   Array of account balance: 
364
-  * @author  Martin Steel
365
-  */
366
-  public function checkBalance() {
360
+    /**
361
+     * Check your account balance
362
+     *
363
+     * @return  array   Array of account balance: 
364
+     * @author  Martin Steel
365
+     */
366
+    public function checkBalance() {
367 367
     // Create XML doc for request
368 368
     $req_doc = new DOMDocument('1.0', 'UTF-8');
369 369
     $root = $req_doc->createElement('Balance');
@@ -384,20 +384,20 @@  discard block
 block discarded – undo
384 384
     $err_desc = null;
385 385
         
386 386
     foreach ($resp_doc->documentElement->childNodes as $doc_child) {
387
-      switch ($doc_child->nodeName) {
387
+        switch ($doc_child->nodeName) {
388 388
         case "Balance":
389 389
         $balance = number_format(floatval($doc_child->nodeValue), 2);
390 390
         break;
391 391
         case "Currency":
392 392
         foreach ($doc_child->childNodes as $resp_node) {
393
-          switch ($resp_node->tagName) {
393
+            switch ($resp_node->tagName) {
394 394
             case "Symbol":
395 395
             $symbol = $resp_node->nodeValue; 
396 396
             break;
397 397
             case "Code":
398 398
             $code = $resp_node->nodeValue; 
399 399
             break;
400
-          }
400
+            }
401 401
         }
402 402
         break;
403 403
         case "ErrNo":
@@ -408,23 +408,23 @@  discard block
 block discarded – undo
408 408
         break;
409 409
         default:
410 410
         break;
411
-      }
411
+        }
412 412
     }
413 413
 
414 414
     if (isset($err_no)) {
415
-      throw new ClockworkException($err_desc, $err_no);
415
+        throw new ClockworkException($err_desc, $err_no);
416 416
     }
417 417
         
418 418
     return array( 'symbol' => $symbol, 'balance' => $balance, 'code' => $code );
419
-  }
419
+    }
420 420
 
421
-  /**
422
-  * Check whether the API Key is valid
423
-  *
424
-  * @return  bool    True indicates a valid key
425
-  * @author  Martin Steel
426
-  */
427
-  public function checkKey() {
421
+    /**
422
+     * Check whether the API Key is valid
423
+     *
424
+     * @return  bool    True indicates a valid key
425
+     * @author  Martin Steel
426
+     */
427
+    public function checkKey() {
428 428
     // Create XML doc for request
429 429
     $req_doc = new DOMDocument('1.0', 'UTF-8');
430 430
     $root = $req_doc->createElement('Authenticate');
@@ -445,7 +445,7 @@  discard block
 block discarded – undo
445 445
     $err_desc = null;
446 446
 
447 447
     foreach ($resp_doc->documentElement->childNodes AS $doc_child) {
448
-      switch ($doc_child->nodeName) {
448
+        switch ($doc_child->nodeName) {
449 449
         case "CustID":
450 450
         $cust_id = $doc_child->nodeValue;
451 451
         break;
@@ -457,33 +457,33 @@  discard block
 block discarded – undo
457 457
         break;
458 458
         default:
459 459
         break;
460
-      }
460
+        }
461 461
     }
462 462
 
463 463
     if (isset($err_no)) {
464
-      throw new ClockworkException($err_desc, $err_no);
464
+        throw new ClockworkException($err_desc, $err_no);
465 465
     }
466 466
     return isset($cust_id);   
467
-  }
468
-
469
-  /**
470
-  * Make an HTTP POST to Clockwork
471
-  *
472
-  * @param   string   method Clockwork method to call (sms/credit)
473
-  * @param   string   data   Content of HTTP POST
474
-  *
475
-  * @return  string          Response from Clockwork
476
-  * @author  Martin Steel
477
-  */
478
-  protected function postToClockwork($method, $data) {
467
+    }
468
+
469
+    /**
470
+     * Make an HTTP POST to Clockwork
471
+     *
472
+     * @param   string   method Clockwork method to call (sms/credit)
473
+     * @param   string   data   Content of HTTP POST
474
+     *
475
+     * @return  string          Response from Clockwork
476
+     * @author  Martin Steel
477
+     */
478
+    protected function postToClockwork($method, $data) {
479 479
     if ($this->log) {
480
-      $this->logXML("API $method Request XML", $data);
480
+        $this->logXML("API $method Request XML", $data);
481 481
     }
482 482
     
483 483
     if( isset( $this->ssl ) ) {
484
-      $ssl = $this->ssl;
484
+        $ssl = $this->ssl;
485 485
     } else {
486
-      $ssl = $this->sslSupport();
486
+        $ssl = $this->sslSupport();
487 487
     }
488 488
 
489 489
     $url = $ssl ? 'https://' : 'http://';
@@ -492,152 +492,152 @@  discard block
 block discarded – undo
492 492
     $response = $this->xmlPost($url, $data);
493 493
 
494 494
     if ($this->log) {
495
-      $this->logXML("API $method Response XML", $response);
495
+        $this->logXML("API $method Response XML", $response);
496 496
     }
497 497
 
498 498
     return $response;
499
-  }
500
-
501
-  /**
502
-  * Make a HTTP POST
503
-  *
504
-  * cURL will be used if available, otherwise tries the PHP stream functions
505
-  *
506
-  * @param   string url      URL to send to
507
-  * @param   string data     Data to POST
508
-  * @return  string          Response returned by server
509
-  * @author  Martin Steel
510
-  */
511
-  protected function xmlPost($url, $data) {
499
+    }
500
+
501
+    /**
502
+     * Make a HTTP POST
503
+     *
504
+     * cURL will be used if available, otherwise tries the PHP stream functions
505
+     *
506
+     * @param   string url      URL to send to
507
+     * @param   string data     Data to POST
508
+     * @return  string          Response returned by server
509
+     * @author  Martin Steel
510
+     */
511
+    protected function xmlPost($url, $data) {
512 512
     if(extension_loaded('curl')) {
513
-      $ch = curl_init($url);
514
-      curl_setopt($ch, CURLOPT_POST, 1);
515
-      curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
516
-      curl_setopt($ch, CURLOPT_HTTPHEADER, Array("Content-Type: text/xml"));
517
-      curl_setopt($ch, CURLOPT_USERAGENT, 'Clockwork PHP Wrapper/1.0' . self::VERSION);
518
-      curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
519
-      if (isset($this->proxy_host) && isset($this->proxy_port)) {
513
+        $ch = curl_init($url);
514
+        curl_setopt($ch, CURLOPT_POST, 1);
515
+        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
516
+        curl_setopt($ch, CURLOPT_HTTPHEADER, Array("Content-Type: text/xml"));
517
+        curl_setopt($ch, CURLOPT_USERAGENT, 'Clockwork PHP Wrapper/1.0' . self::VERSION);
518
+        curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
519
+        if (isset($this->proxy_host) && isset($this->proxy_port)) {
520 520
         curl_setopt($ch, CURLOPT_PROXY, $this->proxy_host);
521 521
         curl_setopt($ch, CURLOPT_PROXYPORT, $this->proxy_port);
522
-      }
522
+        }
523 523
 
524
-      $response = curl_exec($ch);
525
-      $info = curl_getinfo($ch);
524
+        $response = curl_exec($ch);
525
+        $info = curl_getinfo($ch);
526 526
 
527
-      if ($response === false || $info['http_code'] != 200) {
527
+        if ($response === false || $info['http_code'] != 200) {
528 528
         throw new Exception('HTTP Error calling Clockwork API - HTTP Status: ' . $info['http_code'] . ' - cURL Erorr: ' . curl_error($ch));
529
-      } elseif (curl_errno($ch) > 0) {
529
+        } elseif (curl_errno($ch) > 0) {
530 530
         throw new Exception('HTTP Error calling Clockwork API - cURL Error: ' . curl_error($ch));
531
-      }
531
+        }
532 532
 
533
-      curl_close($ch);
533
+        curl_close($ch);
534 534
 
535
-      return $response;
535
+        return $response;
536 536
     } elseif (function_exists('stream_get_contents')) {
537
-      // Enable error Track Errors
538
-      $track = ini_get('track_errors');
539
-      ini_set('track_errors',true);
537
+        // Enable error Track Errors
538
+        $track = ini_get('track_errors');
539
+        ini_set('track_errors',true);
540 540
 
541
-      $params = array('http' => array(
542
-      'method'  => 'POST',
543
-      'header'  => "Content-Type: text/xml\r\nUser-Agent: mediaburst PHP Wrapper/" . self::VERSION . "\r\n",
544
-      'content' => $data
545
-      ));
541
+        $params = array('http' => array(
542
+        'method'  => 'POST',
543
+        'header'  => "Content-Type: text/xml\r\nUser-Agent: mediaburst PHP Wrapper/" . self::VERSION . "\r\n",
544
+        'content' => $data
545
+        ));
546 546
 
547
-      if (isset($this->proxy_host) && isset($this->proxy_port)) {
547
+        if (isset($this->proxy_host) && isset($this->proxy_port)) {
548 548
         $params['http']['proxy'] = 'tcp://'.$this->proxy_host . ':' . $this->proxy_port;
549 549
         $params['http']['request_fulluri'] = True;
550
-      }
550
+        }
551 551
 
552
-      $ctx = stream_context_create($params);
553
-      $fp = @fopen($url, 'rb', false, $ctx);
554
-      if (!$fp) {
552
+        $ctx = stream_context_create($params);
553
+        $fp = @fopen($url, 'rb', false, $ctx);
554
+        if (!$fp) {
555 555
         ini_set('track_errors',$track);
556 556
         throw new Exception("HTTP Error calling Clockwork API - fopen Error: $php_errormsg");
557
-      }
558
-      $response = @stream_get_contents($fp);
559
-      if ($response === false) {
557
+        }
558
+        $response = @stream_get_contents($fp);
559
+        if ($response === false) {
560 560
         ini_set('track_errors',$track);
561 561
         throw new Exception("HTTP Error calling Clockwork API - stream Error: $php_errormsg");
562
-      }
563
-      ini_set('track_errors',$track);
564
-      return $response;
562
+        }
563
+        ini_set('track_errors',$track);
564
+        return $response;
565 565
     } else {
566
-      throw new Exception("Clockwork requires PHP5 with cURL or HTTP stream support");
566
+        throw new Exception("Clockwork requires PHP5 with cURL or HTTP stream support");
567 567
     }
568
-  }
569
-
570
-  /**
571
-  * Does the server/HTTP wrapper support SSL
572
-  *
573
-  * This is a best guess effort, some servers have weird setups where even
574
-  * though cURL is compiled with SSL support is still fails to make
575
-  * any requests.
576
-  *
577
-  * @return bool     True if SSL is supported
578
-  * @author  Martin Steel
579
-  */
580
-  protected function sslSupport() {
568
+    }
569
+
570
+    /**
571
+     * Does the server/HTTP wrapper support SSL
572
+     *
573
+     * This is a best guess effort, some servers have weird setups where even
574
+     * though cURL is compiled with SSL support is still fails to make
575
+     * any requests.
576
+     *
577
+     * @return bool     True if SSL is supported
578
+     * @author  Martin Steel
579
+     */
580
+    protected function sslSupport() {
581 581
     $ssl = false;
582 582
     // See if PHP is compiled with cURL
583 583
     if (extension_loaded('curl')) {
584
-      $version = curl_version();
585
-      $ssl = ($version['features'] & CURL_VERSION_SSL) ? true : false;
584
+        $version = curl_version();
585
+        $ssl = ($version['features'] & CURL_VERSION_SSL) ? true : false;
586 586
     } elseif (extension_loaded('openssl')) {
587
-      $ssl = true;
587
+        $ssl = true;
588 588
     }
589 589
     return $ssl;
590
-  }
591
-
592
-  /**
593
-  * Log some XML, tidily if possible, in the PHP error log
594
-  *
595
-  * @param   string  log_msg The log message to prepend to the XML
596
-  * @param   string  xml     An XML formatted string
597
-  *
598
-  * @return  void
599
-  * @author  Martin Steel
600
-  */
601
-  protected function logXML($log_msg, $xml) {
590
+    }
591
+
592
+    /**
593
+     * Log some XML, tidily if possible, in the PHP error log
594
+     *
595
+     * @param   string  log_msg The log message to prepend to the XML
596
+     * @param   string  xml     An XML formatted string
597
+     *
598
+     * @return  void
599
+     * @author  Martin Steel
600
+     */
601
+    protected function logXML($log_msg, $xml) {
602 602
     // Tidy if possible
603 603
     if (class_exists('tidy')) {
604
-      $tidy = new tidy;
605
-      $config = array(
606
-      'indent'     => true,
607
-      'input-xml'  => true,
608
-      'output-xml' => true,
609
-      'wrap'       => 200
610
-      );
611
-      $tidy->parseString($xml, $config, 'utf8');
612
-      $tidy->cleanRepair();
613
-      $xml = $tidy;
604
+        $tidy = new tidy;
605
+        $config = array(
606
+        'indent'     => true,
607
+        'input-xml'  => true,
608
+        'output-xml' => true,
609
+        'wrap'       => 200
610
+        );
611
+        $tidy->parseString($xml, $config, 'utf8');
612
+        $tidy->cleanRepair();
613
+        $xml = $tidy;
614 614
     }
615 615
     // Output
616 616
     error_log("Clockwork $log_msg: $xml");
617
-  }
618
-
619
-  /**
620
-  * Check if an array is associative
621
-  *
622
-  * @param   array $array Array to check
623
-  * @return  bool
624
-  * @author  Martin Steel
625
-  */
626
-  protected function is_assoc($array) {
617
+    }
618
+
619
+    /**
620
+     * Check if an array is associative
621
+     *
622
+     * @param   array $array Array to check
623
+     * @return  bool
624
+     * @author  Martin Steel
625
+     */
626
+    protected function is_assoc($array) {
627 627
     return (bool)count(array_filter(array_keys($array), 'is_string'));
628
-  }
628
+    }
629 629
   
630
-  /**
631
-   * Check if a number is a valid MSISDN
632
-   *
633
-   * @param string $val Value to check
634
-   * @return bool True if valid MSISDN
635
-   * @author James Inman
636
-   * @since 1.3.0
637
-   * @todo Take an optional country code and check that the number starts with it
638
-   */
639
-  public static function is_valid_msisdn($val) {
630
+    /**
631
+     * Check if a number is a valid MSISDN
632
+     *
633
+     * @param string $val Value to check
634
+     * @return bool True if valid MSISDN
635
+     * @author James Inman
636
+     * @since 1.3.0
637
+     * @todo Take an optional country code and check that the number starts with it
638
+     */
639
+    public static function is_valid_msisdn($val) {
640 640
     return preg_match( '/^[1-9][0-9]{7,12}$/', $val );
641
-  }
641
+    }
642 642
 
643 643
 }
Please login to merge, or discard this patch.
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
 * @version     1.3.0
10 10
 */
11 11
 
12
-if ( !class_exists('ClockworkException') ) {
12
+if (!class_exists('ClockworkException')) {
13 13
   require_once('exception.php');
14 14
 }
15 15
 
@@ -24,25 +24,25 @@  discard block
 block discarded – undo
24 24
   /*
25 25
   * Version of this class
26 26
   */
27
-  const VERSION           = '1.3.1';
27
+  const VERSION = '1.3.1';
28 28
 
29 29
   /**
30 30
   * All Clockwork API calls start with BASE_URL
31 31
   * @author  Martin Steel
32 32
   */
33
-  const API_BASE_URL      = 'api.clockworksms.com/xml/';
33
+  const API_BASE_URL = 'api.clockworksms.com/xml/';
34 34
 
35 35
   /**
36 36
   * string to append to API_BASE_URL to check authentication
37 37
   * @author  Martin Steel
38 38
   */
39
-  const API_AUTH_METHOD   = 'authenticate';
39
+  const API_AUTH_METHOD = 'authenticate';
40 40
 
41 41
   /**
42 42
   * string to append to API_BASE_URL for sending SMS
43 43
   * @author  Martin Steel
44 44
   */
45
-  const API_SMS_METHOD    = 'sms';
45
+  const API_SMS_METHOD = 'sms';
46 46
 
47 47
   /**
48 48
   * string to append to API_BASE_URL for checking message credit
@@ -258,13 +258,13 @@  discard block
 block discarded – undo
258 258
     $err_no = null;
259 259
     $err_desc = null;
260 260
 
261
-    foreach($resp_doc->documentElement->childNodes AS $doc_child) {
262
-      switch(strtolower($doc_child->nodeName)) {
261
+    foreach ($resp_doc->documentElement->childNodes AS $doc_child) {
262
+      switch (strtolower($doc_child->nodeName)) {
263 263
         case 'sms_resp':
264 264
         $resp = array();
265 265
         $wrapper_id = null;
266
-        foreach($doc_child->childNodes AS $resp_node) {
267
-          switch(strtolower($resp_node->nodeName)) {
266
+        foreach ($doc_child->childNodes AS $resp_node) {
267
+          switch (strtolower($resp_node->nodeName)) {
268 268
             case 'messageid':
269 269
             $resp['id'] = $resp_node->nodeValue;
270 270
             break;
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
             break;
280 280
           }
281 281
         }
282
-        if( array_key_exists('error_code', $resp ) ) 
282
+        if (array_key_exists('error_code', $resp)) 
283 283
         {
284 284
           $resp['success'] = 0;
285 285
         } else {
@@ -415,7 +415,7 @@  discard block
 block discarded – undo
415 415
       throw new ClockworkException($err_desc, $err_no);
416 416
     }
417 417
         
418
-    return array( 'symbol' => $symbol, 'balance' => $balance, 'code' => $code );
418
+    return array('symbol' => $symbol, 'balance' => $balance, 'code' => $code);
419 419
   }
420 420
 
421 421
   /**
@@ -480,14 +480,14 @@  discard block
 block discarded – undo
480 480
       $this->logXML("API $method Request XML", $data);
481 481
     }
482 482
     
483
-    if( isset( $this->ssl ) ) {
483
+    if (isset($this->ssl)) {
484 484
       $ssl = $this->ssl;
485 485
     } else {
486 486
       $ssl = $this->sslSupport();
487 487
     }
488 488
 
489 489
     $url = $ssl ? 'https://' : 'http://';
490
-    $url .= self::API_BASE_URL . $method;
490
+    $url .= self::API_BASE_URL.$method;
491 491
 
492 492
     $response = $this->xmlPost($url, $data);
493 493
 
@@ -509,12 +509,12 @@  discard block
 block discarded – undo
509 509
   * @author  Martin Steel
510 510
   */
511 511
   protected function xmlPost($url, $data) {
512
-    if(extension_loaded('curl')) {
512
+    if (extension_loaded('curl')) {
513 513
       $ch = curl_init($url);
514 514
       curl_setopt($ch, CURLOPT_POST, 1);
515 515
       curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
516 516
       curl_setopt($ch, CURLOPT_HTTPHEADER, Array("Content-Type: text/xml"));
517
-      curl_setopt($ch, CURLOPT_USERAGENT, 'Clockwork PHP Wrapper/1.0' . self::VERSION);
517
+      curl_setopt($ch, CURLOPT_USERAGENT, 'Clockwork PHP Wrapper/1.0'.self::VERSION);
518 518
       curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
519 519
       if (isset($this->proxy_host) && isset($this->proxy_port)) {
520 520
         curl_setopt($ch, CURLOPT_PROXY, $this->proxy_host);
@@ -525,9 +525,9 @@  discard block
 block discarded – undo
525 525
       $info = curl_getinfo($ch);
526 526
 
527 527
       if ($response === false || $info['http_code'] != 200) {
528
-        throw new Exception('HTTP Error calling Clockwork API - HTTP Status: ' . $info['http_code'] . ' - cURL Erorr: ' . curl_error($ch));
528
+        throw new Exception('HTTP Error calling Clockwork API - HTTP Status: '.$info['http_code'].' - cURL Erorr: '.curl_error($ch));
529 529
       } elseif (curl_errno($ch) > 0) {
530
-        throw new Exception('HTTP Error calling Clockwork API - cURL Error: ' . curl_error($ch));
530
+        throw new Exception('HTTP Error calling Clockwork API - cURL Error: '.curl_error($ch));
531 531
       }
532 532
 
533 533
       curl_close($ch);
@@ -536,31 +536,31 @@  discard block
 block discarded – undo
536 536
     } elseif (function_exists('stream_get_contents')) {
537 537
       // Enable error Track Errors
538 538
       $track = ini_get('track_errors');
539
-      ini_set('track_errors',true);
539
+      ini_set('track_errors', true);
540 540
 
541 541
       $params = array('http' => array(
542 542
       'method'  => 'POST',
543
-      'header'  => "Content-Type: text/xml\r\nUser-Agent: mediaburst PHP Wrapper/" . self::VERSION . "\r\n",
543
+      'header'  => "Content-Type: text/xml\r\nUser-Agent: mediaburst PHP Wrapper/".self::VERSION."\r\n",
544 544
       'content' => $data
545 545
       ));
546 546
 
547 547
       if (isset($this->proxy_host) && isset($this->proxy_port)) {
548
-        $params['http']['proxy'] = 'tcp://'.$this->proxy_host . ':' . $this->proxy_port;
548
+        $params['http']['proxy'] = 'tcp://'.$this->proxy_host.':'.$this->proxy_port;
549 549
         $params['http']['request_fulluri'] = True;
550 550
       }
551 551
 
552 552
       $ctx = stream_context_create($params);
553 553
       $fp = @fopen($url, 'rb', false, $ctx);
554 554
       if (!$fp) {
555
-        ini_set('track_errors',$track);
555
+        ini_set('track_errors', $track);
556 556
         throw new Exception("HTTP Error calling Clockwork API - fopen Error: $php_errormsg");
557 557
       }
558 558
       $response = @stream_get_contents($fp);
559 559
       if ($response === false) {
560
-        ini_set('track_errors',$track);
560
+        ini_set('track_errors', $track);
561 561
         throw new Exception("HTTP Error calling Clockwork API - stream Error: $php_errormsg");
562 562
       }
563
-      ini_set('track_errors',$track);
563
+      ini_set('track_errors', $track);
564 564
       return $response;
565 565
     } else {
566 566
       throw new Exception("Clockwork requires PHP5 with cURL or HTTP stream support");
@@ -624,7 +624,7 @@  discard block
 block discarded – undo
624 624
   * @author  Martin Steel
625 625
   */
626 626
   protected function is_assoc($array) {
627
-    return (bool)count(array_filter(array_keys($array), 'is_string'));
627
+    return (bool) count(array_filter(array_keys($array), 'is_string'));
628 628
   }
629 629
   
630 630
   /**
@@ -637,7 +637,7 @@  discard block
 block discarded – undo
637 637
    * @todo Take an optional country code and check that the number starts with it
638 638
    */
639 639
   public static function is_valid_msisdn($val) {
640
-    return preg_match( '/^[1-9][0-9]{7,12}$/', $val );
640
+    return preg_match('/^[1-9][0-9]{7,12}$/', $val);
641 641
   }
642 642
 
643 643
 }
Please login to merge, or discard this patch.
plugin/courselegal/CourseLegalPlugin.php 3 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
      * @param int $courseId
63 63
      * @param int $sessionId
64 64
      *
65
-     * @return array
65
+     * @return string
66 66
      */
67 67
     public function getUserAcceptedLegal($userId, $courseId, $sessionId)
68 68
     {
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
     * @param int $courseCode
113 113
     * @param int $sessionId
114 114
     * @param boolean $sendEmail Optional. Indicate whether the mail must be sent. Default is true
115
-    * @return mixed
115
+    * @return false|string
116 116
     */
117 117
     public function saveUserLegal($userId, $courseCode, $sessionId, $sendEmail = true)
118 118
     {
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
      * @param int $courseId
219 219
      * @param int $sessionId
220 220
      *
221
-     * @return bool
221
+     * @return boolean|null
222 222
      */
223 223
     public function saveUserMailLegal($link, $userId, $courseId, $sessionId)
224 224
     {
Please login to merge, or discard this patch.
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -108,12 +108,12 @@
 block discarded – undo
108 108
     }
109 109
 
110 110
     /**
111
-    * @param int $userId
112
-    * @param int $courseCode
113
-    * @param int $sessionId
114
-    * @param boolean $sendEmail Optional. Indicate whether the mail must be sent. Default is true
115
-    * @return mixed
116
-    */
111
+     * @param int $userId
112
+     * @param int $courseCode
113
+     * @param int $sessionId
114
+     * @param boolean $sendEmail Optional. Indicate whether the mail must be sent. Default is true
115
+     * @return mixed
116
+     */
117 117
     public function saveUserLegal($userId, $courseCode, $sessionId, $sendEmail = true)
118 118
     {
119 119
         $courseInfo = api_get_course_info($courseCode);
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -421,7 +421,7 @@
 block discarded – undo
421 421
                 array('id = ? ' => $id)
422 422
             );
423 423
             if (!empty($legalData['filename'])) {
424
-                $fileToDelete = $coursePath . '/' . $legalData['filename'];
424
+                $fileToDelete = $coursePath.'/'.$legalData['filename'];
425 425
                 if (file_exists($fileToDelete)) {
426 426
                     unlink($fileToDelete);
427 427
                 }
Please login to merge, or discard this patch.
plugin/kannelsms/lib/kannelsms_plugin.class.php 1 patch
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@
 block discarded – undo
14 14
     /**
15 15
      * create (a singleton function that ensures KannelsmsPlugin instance is
16 16
      * created only once. If it is already created, it returns the instance)
17
-     * @return  object  KannelsmsPlugin instance
17
+     * @return  KannelsmsPlugin  KannelsmsPlugin instance
18 18
      */
19 19
     public static function create()
20 20
     {
Please login to merge, or discard this patch.
plugin/kannelsms/vendor/kannelsms_api.php 3 patches
Doc Comments   +5 added lines, -1 removed lines patch added patch discarded remove patch
@@ -138,6 +138,7 @@  discard block
 block discarded – undo
138 138
   *
139 139
   * @param   string  key         Your Kannel API Key
140 140
   * @param   array   options     Optional parameters for sending SMS
141
+  * @param string $key
141 142
   * @author  Martin Steel
142 143
   */
143 144
   public function __construct($key, array $options = array()) {
@@ -471,6 +472,8 @@  discard block
 block discarded – undo
471 472
   *
472 473
   * @param   string   method Kannel method to call (sms/credit)
473 474
   * @param   string   data   Content of HTTP POST
475
+  * @param string $method
476
+  * @param string $data
474 477
   *
475 478
   * @return  string          Response from Kannel
476 479
   * @author  Martin Steel
@@ -505,6 +508,7 @@  discard block
 block discarded – undo
505 508
   *
506 509
   * @param   string url      URL to send to
507 510
   * @param   string data     Data to POST
511
+  * @param string $url
508 512
   * @return  string          Response returned by server
509 513
   * @author  Martin Steel
510 514
   */
@@ -631,7 +635,7 @@  discard block
 block discarded – undo
631 635
    * Check if a number is a valid MSISDN
632 636
    *
633 637
    * @param string $val Value to check
634
-   * @return bool True if valid MSISDN
638
+   * @return integer True if valid MSISDN
635 639
    * @author James Inman
636 640
    * @since 1.3.0
637 641
    * @todo Take an optional country code and check that the number starts with it
Please login to merge, or discard this patch.
Indentation   +334 added lines, -334 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
 */
11 11
 
12 12
 if ( !class_exists('KannelException') ) {
13
-  require_once('exception.php');
13
+    require_once('exception.php');
14 14
 }
15 15
 
16 16
 /**
@@ -21,130 +21,130 @@  discard block
 block discarded – undo
21 21
 */
22 22
 class Kannel {
23 23
 
24
-  /*
24
+    /*
25 25
   * Version of this class
26 26
   */
27
-  const VERSION           = '1.3.1';
28
-
29
-  /**
30
-  * All Kannel API calls start with BASE_URL
31
-  * @author  Martin Steel
32
-  */
33
-  const API_BASE_URL      = 'api.kannelsms.com/xml/';
34
-
35
-  /**
36
-  * string to append to API_BASE_URL to check authentication
37
-  * @author  Martin Steel
38
-  */
39
-  const API_AUTH_METHOD   = 'authenticate';
40
-
41
-  /**
42
-  * string to append to API_BASE_URL for sending SMS
43
-  * @author  Martin Steel
44
-  */
45
-  const API_SMS_METHOD    = 'sms';
46
-
47
-  /**
48
-  * string to append to API_BASE_URL for checking message credit
49
-  * @author  Martin Steel
50
-  */
51
-  const API_CREDIT_METHOD = 'credit';
52
-
53
-  /**
54
-  * string to append to API_BASE_URL for checking account balance
55
-  * @author  Martin Steel
56
-  */
57
-  const API_BALANCE_METHOD = 'balance';
58
-
59
-  /** 
60
-  * Kannel API Key
61
-  * 
62
-  * @var string
63
-  * @author  Martin Steel
64
-  */
65
-  public $key;
66
-
67
-  /**
68
-  * Use SSL when making HTTP requests
69
-  *
70
-  * If this is not set, SSL will be used where PHP supports it
71
-  *
72
-  * @var bool
73
-  * @author  Martin Steel
74
-  */
75
-  public $ssl;
76
-
77
-  /**
78
-  * Proxy server hostname (Optional)
79
-  *
80
-  * @var string
81
-  * @author  Martin Steel
82
-  */
83
-  public $proxy_host;
84
-
85
-  /**
86
-  * Proxy server port (Optional)
87
-  *
88
-  * @var integer
89
-  * @author  Martin Steel
90
-  */
91
-  public $proxy_port;
92
-
93
-  /**
94
-  * From address used on text messages
95
-  *
96
-  * @var string (11 characters or 12 numbers)
97
-  * @author  Martin Steel
98
-  */
99
-  public $from;
100
-
101
-  /**
102
-  * Allow long SMS messages (Cost up to 3 credits)
103
-  *
104
-  * @var bool
105
-  * @author  Martin Steel
106
-  */
107
-  public $long;
108
-
109
-  /**
110
-  * Truncate message text if it is too long
111
-  *
112
-  * @var bool
113
-  * @author  Martin Steel
114
-  */
115
-  public $truncate;
116
-
117
-  /**
118
-  * Enables various logging of messages when true.
119
-  *
120
-  * @var bool
121
-  * @author  Martin Steel
122
-  */
123
-  public $log;
124
-
125
-  /**
126
-  * What Kannel should do if you send an invalid character
127
-  *
128
-  * Possible values:
129
-  *      'error'     - Return an error (Messasge is not sent)
130
-  *      'remove'    - Remove the invalid character(s)
131
-  *      'replace'   - Replace invalid characters where possible, remove others 
132
-  * @author  Martin Steel
133
-  */
134
-  public $invalid_char_action;
135
-
136
-  /**
137
-  * Create a new instance of the Kannel wrapper
138
-  *
139
-  * @param   string  key         Your Kannel API Key
140
-  * @param   array   options     Optional parameters for sending SMS
141
-  * @author  Martin Steel
142
-  */
143
-  public function __construct($key, array $options = array()) {
27
+    const VERSION           = '1.3.1';
28
+
29
+    /**
30
+     * All Kannel API calls start with BASE_URL
31
+     * @author  Martin Steel
32
+     */
33
+    const API_BASE_URL      = 'api.kannelsms.com/xml/';
34
+
35
+    /**
36
+     * string to append to API_BASE_URL to check authentication
37
+     * @author  Martin Steel
38
+     */
39
+    const API_AUTH_METHOD   = 'authenticate';
40
+
41
+    /**
42
+     * string to append to API_BASE_URL for sending SMS
43
+     * @author  Martin Steel
44
+     */
45
+    const API_SMS_METHOD    = 'sms';
46
+
47
+    /**
48
+     * string to append to API_BASE_URL for checking message credit
49
+     * @author  Martin Steel
50
+     */
51
+    const API_CREDIT_METHOD = 'credit';
52
+
53
+    /**
54
+     * string to append to API_BASE_URL for checking account balance
55
+     * @author  Martin Steel
56
+     */
57
+    const API_BALANCE_METHOD = 'balance';
58
+
59
+    /** 
60
+     * Kannel API Key
61
+     * 
62
+     * @var string
63
+     * @author  Martin Steel
64
+     */
65
+    public $key;
66
+
67
+    /**
68
+     * Use SSL when making HTTP requests
69
+     *
70
+     * If this is not set, SSL will be used where PHP supports it
71
+     *
72
+     * @var bool
73
+     * @author  Martin Steel
74
+     */
75
+    public $ssl;
76
+
77
+    /**
78
+     * Proxy server hostname (Optional)
79
+     *
80
+     * @var string
81
+     * @author  Martin Steel
82
+     */
83
+    public $proxy_host;
84
+
85
+    /**
86
+     * Proxy server port (Optional)
87
+     *
88
+     * @var integer
89
+     * @author  Martin Steel
90
+     */
91
+    public $proxy_port;
92
+
93
+    /**
94
+     * From address used on text messages
95
+     *
96
+     * @var string (11 characters or 12 numbers)
97
+     * @author  Martin Steel
98
+     */
99
+    public $from;
100
+
101
+    /**
102
+     * Allow long SMS messages (Cost up to 3 credits)
103
+     *
104
+     * @var bool
105
+     * @author  Martin Steel
106
+     */
107
+    public $long;
108
+
109
+    /**
110
+     * Truncate message text if it is too long
111
+     *
112
+     * @var bool
113
+     * @author  Martin Steel
114
+     */
115
+    public $truncate;
116
+
117
+    /**
118
+     * Enables various logging of messages when true.
119
+     *
120
+     * @var bool
121
+     * @author  Martin Steel
122
+     */
123
+    public $log;
124
+
125
+    /**
126
+     * What Kannel should do if you send an invalid character
127
+     *
128
+     * Possible values:
129
+     *      'error'     - Return an error (Messasge is not sent)
130
+     *      'remove'    - Remove the invalid character(s)
131
+     *      'replace'   - Replace invalid characters where possible, remove others 
132
+     * @author  Martin Steel
133
+     */
134
+    public $invalid_char_action;
135
+
136
+    /**
137
+     * Create a new instance of the Kannel wrapper
138
+     *
139
+     * @param   string  key         Your Kannel API Key
140
+     * @param   array   options     Optional parameters for sending SMS
141
+     * @author  Martin Steel
142
+     */
143
+    public function __construct($key, array $options = array()) {
144 144
     if (empty($key)) {
145
-      throw new KannelException("Key can't be blank");
145
+        throw new KannelException("Key can't be blank");
146 146
     } else {
147
-      $this->key = $key;
147
+        $this->key = $key;
148 148
     }
149 149
         
150 150
     $this->ssl                  = (array_key_exists('ssl', $options)) ? $options['ssl'] : null;
@@ -155,22 +155,22 @@  discard block
 block discarded – undo
155 155
     $this->truncate             = (array_key_exists('truncate', $options)) ? $options['truncate'] : null;
156 156
     $this->invalid_char_action  = (array_key_exists('invalid_char_action', $options)) ? $options['invalid_char_action'] : null;
157 157
     $this->log                  = (array_key_exists('log', $options)) ? $options['log'] : false;
158
-  }
158
+    }
159 159
 
160
-  /**
161
-  * Send some text messages
162
-  * 
163
-  *
164
-  * @author  Martin Steel
165
-  */
166
-  public function send(array $sms) {
160
+    /**
161
+     * Send some text messages
162
+     * 
163
+     *
164
+     * @author  Martin Steel
165
+     */
166
+    public function send(array $sms) {
167 167
     if (!is_array($sms)) {
168
-      throw new KannelException("sms parameter must be an array");
168
+        throw new KannelException("sms parameter must be an array");
169 169
     }
170 170
     $single_message = $this->is_assoc($sms);
171 171
 
172 172
     if ($single_message) {
173
-      $sms = array($sms);
173
+        $sms = array($sms);
174 174
     }
175 175
 
176 176
     $req_doc = new \DOMDocument('1.0', 'UTF-8');
@@ -182,70 +182,70 @@  discard block
 block discarded – undo
182 182
     $root->appendChild($user_node);
183 183
 
184 184
     for ($i = 0; $i < count($sms); $i++) {
185
-      $single = $sms[$i];
185
+        $single = $sms[$i];
186 186
 
187
-      $sms_node = $req_doc->createElement('SMS');
187
+        $sms_node = $req_doc->createElement('SMS');
188 188
            
189
-      // Phone number
190
-      $sms_node->appendChild($req_doc->createElement('To', $single['to'])); 
189
+        // Phone number
190
+        $sms_node->appendChild($req_doc->createElement('To', $single['to'])); 
191 191
             
192
-      // Message text
193
-      $content_node = $req_doc->createElement('Content');
194
-      $content_node->appendChild($req_doc->createTextNode($single['message']));
195
-      $sms_node->appendChild($content_node);
192
+        // Message text
193
+        $content_node = $req_doc->createElement('Content');
194
+        $content_node->appendChild($req_doc->createTextNode($single['message']));
195
+        $sms_node->appendChild($content_node);
196 196
 
197
-      // From
198
-      if (array_key_exists('from', $single) || isset($this->from)) {
197
+        // From
198
+        if (array_key_exists('from', $single) || isset($this->from)) {
199 199
         $from_node = $req_doc->createElement('From');
200 200
         $from_node->appendChild($req_doc->createTextNode(array_key_exists('from', $single) ? $single['from'] : $this->from));
201 201
         $sms_node->appendChild($from_node);
202
-      }
202
+        }
203 203
 
204
-      // Client ID
205
-      if (array_key_exists('client_id', $single)) {
204
+        // Client ID
205
+        if (array_key_exists('client_id', $single)) {
206 206
         $client_id_node = $req_doc->createElement('ClientID');
207 207
         $client_id_node->appendChild($req_doc->createTextNode($single['client_id']));
208 208
         $sms_node->appendChild($client_id_node);
209
-      }
209
+        }
210 210
 
211
-      // Long
212
-      if (array_key_exists('long', $single) || isset($this->long)) {
211
+        // Long
212
+        if (array_key_exists('long', $single) || isset($this->long)) {
213 213
         $long = array_key_exists('long', $single) ? $single['long'] : $this->long;
214 214
         $long_node = $req_doc->createElement('Long');
215 215
         $long_node->appendChild($req_doc->createTextNode($long ? 1 : 0));
216 216
         $sms_node->appendChild($long_node);
217
-      }
217
+        }
218 218
 
219
-      // Truncate
220
-      if (array_key_exists('truncate', $single) || isset($this->truncate)) {
219
+        // Truncate
220
+        if (array_key_exists('truncate', $single) || isset($this->truncate)) {
221 221
         $truncate = array_key_exists('truncate', $single) ? $single['truncate'] : $this->truncate;
222 222
         $trunc_node = $req_doc->createElement('Truncate');
223 223
         $trunc_node->appendChild($req_doc->createTextNode($truncate ? 1 : 0));
224 224
         $sms_node->appendChild($trunc_node);
225
-      }
225
+        }
226 226
 
227
-      // Invalid Char Action
228
-      if (array_key_exists('invalid_char_action', $single) || isset($this->invalid_char_action)) {
227
+        // Invalid Char Action
228
+        if (array_key_exists('invalid_char_action', $single) || isset($this->invalid_char_action)) {
229 229
         $action = array_key_exists('invalid_char_action', $single) ? $single['invalid_char_action'] : $this->invalid_char_action;
230 230
         switch (strtolower($action)) {
231
-          case 'error':
231
+            case 'error':
232 232
           $sms_node->appendChild($req_doc->createElement('InvalidCharAction', 1));
233
-          break;
234
-          case 'remove':
233
+            break;
234
+            case 'remove':
235 235
           $sms_node->appendChild($req_doc->createElement('InvalidCharAction', 2));
236
-          break;
237
-          case 'replace':
236
+            break;
237
+            case 'replace':
238 238
           $sms_node->appendChild($req_doc->createElement('InvalidCharAction', 3));
239
+            break;
240
+            default:
239 241
           break;
240
-          default:
241
-          break;
242 242
         }
243
-      }
243
+        }
244 244
 
245
-      // Wrapper ID
246
-      $sms_node->appendChild($req_doc->createElement('WrapperID', $i));
245
+        // Wrapper ID
246
+        $sms_node->appendChild($req_doc->createElement('WrapperID', $i));
247 247
 
248
-      $root->appendChild($sms_node);
248
+        $root->appendChild($sms_node);
249 249
     }
250 250
 
251 251
     $req_xml = $req_doc->saveXML();
@@ -259,12 +259,12 @@  discard block
 block discarded – undo
259 259
     $err_desc = null;
260 260
 
261 261
     foreach($resp_doc->documentElement->childNodes AS $doc_child) {
262
-      switch(strtolower($doc_child->nodeName)) {
262
+        switch(strtolower($doc_child->nodeName)) {
263 263
         case 'sms_resp':
264 264
         $resp = array();
265 265
         $wrapper_id = null;
266 266
         foreach($doc_child->childNodes AS $resp_node) {
267
-          switch(strtolower($resp_node->nodeName)) {
267
+            switch(strtolower($resp_node->nodeName)) {
268 268
             case 'messageid':
269 269
             $resp['id'] = $resp_node->nodeValue;
270 270
             break;
@@ -277,13 +277,13 @@  discard block
 block discarded – undo
277 277
             case 'wrapperid':
278 278
             $wrapper_id = $resp_node->nodeValue;
279 279
             break;
280
-          }
280
+            }
281 281
         }
282 282
         if( array_key_exists('error_code', $resp ) ) 
283 283
         {
284
-          $resp['success'] = 0;
284
+            $resp['success'] = 0;
285 285
         } else {
286
-          $resp['success'] = 1;
286
+            $resp['success'] = 1;
287 287
         }
288 288
         $resp['sms'] = $sms[$wrapper_id];
289 289
         array_push($response, $resp);
@@ -294,28 +294,28 @@  discard block
 block discarded – undo
294 294
         case 'errdesc':
295 295
         $err_desc = $doc_child->nodeValue;
296 296
         break;
297
-      }
297
+        }
298 298
     }
299 299
 
300 300
     if (isset($err_no)) {
301
-      throw new KannelException($err_desc, $err_no);
301
+        throw new KannelException($err_desc, $err_no);
302 302
     }
303 303
         
304 304
     if ($single_message) {
305
-      return $response[0];
305
+        return $response[0];
306 306
     } else {
307
-      return $response;
307
+        return $response;
308 308
     }
309
-  }
310
-
311
-  /**
312
-  * Check how many SMS credits you have available
313
-  *
314
-  * @return  integer   SMS credits remaining
315
-  * @deprecated Use checkBalance() instead
316
-  * @author  Martin Steel
317
-  */
318
-  public function checkCredit() {
309
+    }
310
+
311
+    /**
312
+     * Check how many SMS credits you have available
313
+     *
314
+     * @return  integer   SMS credits remaining
315
+     * @deprecated Use checkBalance() instead
316
+     * @author  Martin Steel
317
+     */
318
+    public function checkCredit() {
319 319
     // Create XML doc for request
320 320
     $req_doc = new \DOMDocument('1.0', 'UTF-8');
321 321
     $root = $req_doc->createElement('Credit');
@@ -336,7 +336,7 @@  discard block
 block discarded – undo
336 336
     $err_desc = null;
337 337
         
338 338
     foreach ($resp_doc->documentElement->childNodes AS $doc_child) {
339
-      switch ($doc_child->nodeName) {
339
+        switch ($doc_child->nodeName) {
340 340
         case "Credit":
341 341
         $credit = $doc_child->nodeValue;
342 342
         break;
@@ -348,22 +348,22 @@  discard block
 block discarded – undo
348 348
         break;
349 349
         default:
350 350
         break;
351
-      }
351
+        }
352 352
     }
353 353
 
354 354
     if (isset($err_no)) {
355
-      throw new KannelException($err_desc, $err_no);
355
+        throw new KannelException($err_desc, $err_no);
356 356
     }
357 357
     return $credit;
358
-  }
358
+    }
359 359
 
360
-  /**
361
-  * Check your account balance
362
-  *
363
-  * @return  array   Array of account balance: 
364
-  * @author  Martin Steel
365
-  */
366
-  public function checkBalance() {
360
+    /**
361
+     * Check your account balance
362
+     *
363
+     * @return  array   Array of account balance: 
364
+     * @author  Martin Steel
365
+     */
366
+    public function checkBalance() {
367 367
     // Create XML doc for request
368 368
     $req_doc = new \DOMDocument('1.0', 'UTF-8');
369 369
     $root = $req_doc->createElement('Balance');
@@ -384,20 +384,20 @@  discard block
 block discarded – undo
384 384
     $err_desc = null;
385 385
         
386 386
     foreach ($resp_doc->documentElement->childNodes as $doc_child) {
387
-      switch ($doc_child->nodeName) {
387
+        switch ($doc_child->nodeName) {
388 388
         case "Balance":
389 389
         $balance = number_format(floatval($doc_child->nodeValue), 2);
390 390
         break;
391 391
         case "Currency":
392 392
         foreach ($doc_child->childNodes as $resp_node) {
393
-          switch ($resp_node->tagName) {
393
+            switch ($resp_node->tagName) {
394 394
             case "Symbol":
395 395
             $symbol = $resp_node->nodeValue; 
396 396
             break;
397 397
             case "Code":
398 398
             $code = $resp_node->nodeValue; 
399 399
             break;
400
-          }
400
+            }
401 401
         }
402 402
         break;
403 403
         case "ErrNo":
@@ -408,23 +408,23 @@  discard block
 block discarded – undo
408 408
         break;
409 409
         default:
410 410
         break;
411
-      }
411
+        }
412 412
     }
413 413
 
414 414
     if (isset($err_no)) {
415
-      throw new KannelException($err_desc, $err_no);
415
+        throw new KannelException($err_desc, $err_no);
416 416
     }
417 417
         
418 418
     return array( 'symbol' => $symbol, 'balance' => $balance, 'code' => $code );
419
-  }
419
+    }
420 420
 
421
-  /**
422
-  * Check whether the API Key is valid
423
-  *
424
-  * @return  bool    True indicates a valid key
425
-  * @author  Martin Steel
426
-  */
427
-  public function checkKey() {
421
+    /**
422
+     * Check whether the API Key is valid
423
+     *
424
+     * @return  bool    True indicates a valid key
425
+     * @author  Martin Steel
426
+     */
427
+    public function checkKey() {
428 428
     // Create XML doc for request
429 429
     $req_doc = new \DOMDocument('1.0', 'UTF-8');
430 430
     $root = $req_doc->createElement('Authenticate');
@@ -445,7 +445,7 @@  discard block
 block discarded – undo
445 445
     $err_desc = null;
446 446
 
447 447
     foreach ($resp_doc->documentElement->childNodes AS $doc_child) {
448
-      switch ($doc_child->nodeName) {
448
+        switch ($doc_child->nodeName) {
449 449
         case "CustID":
450 450
         $cust_id = $doc_child->nodeValue;
451 451
         break;
@@ -457,33 +457,33 @@  discard block
 block discarded – undo
457 457
         break;
458 458
         default:
459 459
         break;
460
-      }
460
+        }
461 461
     }
462 462
 
463 463
     if (isset($err_no)) {
464
-      throw new KannelException($err_desc, $err_no);
464
+        throw new KannelException($err_desc, $err_no);
465 465
     }
466 466
     return isset($cust_id);   
467
-  }
468
-
469
-  /**
470
-  * Make an HTTP POST to Kannel
471
-  *
472
-  * @param   string   method Kannel method to call (sms/credit)
473
-  * @param   string   data   Content of HTTP POST
474
-  *
475
-  * @return  string          Response from Kannel
476
-  * @author  Martin Steel
477
-  */
478
-  protected function postToKannel($method, $data) {
467
+    }
468
+
469
+    /**
470
+     * Make an HTTP POST to Kannel
471
+     *
472
+     * @param   string   method Kannel method to call (sms/credit)
473
+     * @param   string   data   Content of HTTP POST
474
+     *
475
+     * @return  string          Response from Kannel
476
+     * @author  Martin Steel
477
+     */
478
+    protected function postToKannel($method, $data) {
479 479
     if ($this->log) {
480
-      $this->logXML("API $method Request XML", $data);
480
+        $this->logXML("API $method Request XML", $data);
481 481
     }
482 482
     
483 483
     if( isset( $this->ssl ) ) {
484
-      $ssl = $this->ssl;
484
+        $ssl = $this->ssl;
485 485
     } else {
486
-      $ssl = $this->sslSupport();
486
+        $ssl = $this->sslSupport();
487 487
     }
488 488
 
489 489
     $url = $ssl ? 'https://' : 'http://';
@@ -492,152 +492,152 @@  discard block
 block discarded – undo
492 492
     $response = $this->xmlPost($url, $data);
493 493
 
494 494
     if ($this->log) {
495
-      $this->logXML("API $method Response XML", $response);
495
+        $this->logXML("API $method Response XML", $response);
496 496
     }
497 497
 
498 498
     return $response;
499
-  }
500
-
501
-  /**
502
-  * Make a HTTP POST
503
-  *
504
-  * cURL will be used if available, otherwise tries the PHP stream functions
505
-  *
506
-  * @param   string url      URL to send to
507
-  * @param   string data     Data to POST
508
-  * @return  string          Response returned by server
509
-  * @author  Martin Steel
510
-  */
511
-  protected function xmlPost($url, $data) {
499
+    }
500
+
501
+    /**
502
+     * Make a HTTP POST
503
+     *
504
+     * cURL will be used if available, otherwise tries the PHP stream functions
505
+     *
506
+     * @param   string url      URL to send to
507
+     * @param   string data     Data to POST
508
+     * @return  string          Response returned by server
509
+     * @author  Martin Steel
510
+     */
511
+    protected function xmlPost($url, $data) {
512 512
     if(extension_loaded('curl')) {
513
-      $ch = curl_init($url);
514
-      curl_setopt($ch, CURLOPT_POST, 1);
515
-      curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
516
-      curl_setopt($ch, CURLOPT_HTTPHEADER, Array("Content-Type: text/xml"));
517
-      curl_setopt($ch, CURLOPT_USERAGENT, 'Kannel PHP Wrapper/1.0' . self::VERSION);
518
-      curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
519
-      if (isset($this->proxy_host) && isset($this->proxy_port)) {
513
+        $ch = curl_init($url);
514
+        curl_setopt($ch, CURLOPT_POST, 1);
515
+        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
516
+        curl_setopt($ch, CURLOPT_HTTPHEADER, Array("Content-Type: text/xml"));
517
+        curl_setopt($ch, CURLOPT_USERAGENT, 'Kannel PHP Wrapper/1.0' . self::VERSION);
518
+        curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
519
+        if (isset($this->proxy_host) && isset($this->proxy_port)) {
520 520
         curl_setopt($ch, CURLOPT_PROXY, $this->proxy_host);
521 521
         curl_setopt($ch, CURLOPT_PROXYPORT, $this->proxy_port);
522
-      }
522
+        }
523 523
 
524
-      $response = curl_exec($ch);
525
-      $info = curl_getinfo($ch);
524
+        $response = curl_exec($ch);
525
+        $info = curl_getinfo($ch);
526 526
 
527
-      if ($response === false || $info['http_code'] != 200) {
527
+        if ($response === false || $info['http_code'] != 200) {
528 528
         throw new \Exception('HTTP Error calling Kannel API - HTTP Status: ' . $info['http_code'] . ' - cURL Erorr: ' . curl_error($ch));
529
-      } elseif (curl_errno($ch) > 0) {
529
+        } elseif (curl_errno($ch) > 0) {
530 530
         throw new \Exception('HTTP Error calling Kannel API - cURL Error: ' . curl_error($ch));
531
-      }
531
+        }
532 532
 
533
-      curl_close($ch);
533
+        curl_close($ch);
534 534
 
535
-      return $response;
535
+        return $response;
536 536
     } elseif (function_exists('stream_get_contents')) {
537
-      // Enable error Track Errors
538
-      $track = ini_get('track_errors');
539
-      ini_set('track_errors',true);
537
+        // Enable error Track Errors
538
+        $track = ini_get('track_errors');
539
+        ini_set('track_errors',true);
540 540
 
541
-      $params = array('http' => array(
542
-      'method'  => 'POST',
543
-      'header'  => "Content-Type: text/xml\r\nUser-Agent: mediaburst PHP Wrapper/" . self::VERSION . "\r\n",
544
-      'content' => $data
545
-      ));
541
+        $params = array('http' => array(
542
+        'method'  => 'POST',
543
+        'header'  => "Content-Type: text/xml\r\nUser-Agent: mediaburst PHP Wrapper/" . self::VERSION . "\r\n",
544
+        'content' => $data
545
+        ));
546 546
 
547
-      if (isset($this->proxy_host) && isset($this->proxy_port)) {
547
+        if (isset($this->proxy_host) && isset($this->proxy_port)) {
548 548
         $params['http']['proxy'] = 'tcp://'.$this->proxy_host . ':' . $this->proxy_port;
549 549
         $params['http']['request_fulluri'] = True;
550
-      }
550
+        }
551 551
 
552
-      $ctx = stream_context_create($params);
553
-      $fp = @fopen($url, 'rb', false, $ctx);
554
-      if (!$fp) {
552
+        $ctx = stream_context_create($params);
553
+        $fp = @fopen($url, 'rb', false, $ctx);
554
+        if (!$fp) {
555 555
         ini_set('track_errors',$track);
556 556
         throw new \Exception("HTTP Error calling Kannel API - fopen Error: $php_errormsg");
557
-      }
558
-      $response = @stream_get_contents($fp);
559
-      if ($response === false) {
557
+        }
558
+        $response = @stream_get_contents($fp);
559
+        if ($response === false) {
560 560
         ini_set('track_errors',$track);
561 561
         throw new \Exception("HTTP Error calling Kannel API - stream Error: $php_errormsg");
562
-      }
563
-      ini_set('track_errors',$track);
564
-      return $response;
562
+        }
563
+        ini_set('track_errors',$track);
564
+        return $response;
565 565
     } else {
566
-      throw new \Exception("Kannel requires PHP5 with cURL or HTTP stream support");
566
+        throw new \Exception("Kannel requires PHP5 with cURL or HTTP stream support");
567 567
     }
568
-  }
569
-
570
-  /**
571
-  * Does the server/HTTP wrapper support SSL
572
-  *
573
-  * This is a best guess effort, some servers have weird setups where even
574
-  * though cURL is compiled with SSL support is still fails to make
575
-  * any requests.
576
-  *
577
-  * @return bool     True if SSL is supported
578
-  * @author  Martin Steel
579
-  */
580
-  protected function sslSupport() {
568
+    }
569
+
570
+    /**
571
+     * Does the server/HTTP wrapper support SSL
572
+     *
573
+     * This is a best guess effort, some servers have weird setups where even
574
+     * though cURL is compiled with SSL support is still fails to make
575
+     * any requests.
576
+     *
577
+     * @return bool     True if SSL is supported
578
+     * @author  Martin Steel
579
+     */
580
+    protected function sslSupport() {
581 581
     $ssl = false;
582 582
     // See if PHP is compiled with cURL
583 583
     if (extension_loaded('curl')) {
584
-      $version = curl_version();
585
-      $ssl = ($version['features'] & CURL_VERSION_SSL) ? true : false;
584
+        $version = curl_version();
585
+        $ssl = ($version['features'] & CURL_VERSION_SSL) ? true : false;
586 586
     } elseif (extension_loaded('openssl')) {
587
-      $ssl = true;
587
+        $ssl = true;
588 588
     }
589 589
     return $ssl;
590
-  }
591
-
592
-  /**
593
-  * Log some XML, tidily if possible, in the PHP error log
594
-  *
595
-  * @param   string  log_msg The log message to prepend to the XML
596
-  * @param   string  xml     An XML formatted string
597
-  *
598
-  * @return  void
599
-  * @author  Martin Steel
600
-  */
601
-  protected function logXML($log_msg, $xml) {
590
+    }
591
+
592
+    /**
593
+     * Log some XML, tidily if possible, in the PHP error log
594
+     *
595
+     * @param   string  log_msg The log message to prepend to the XML
596
+     * @param   string  xml     An XML formatted string
597
+     *
598
+     * @return  void
599
+     * @author  Martin Steel
600
+     */
601
+    protected function logXML($log_msg, $xml) {
602 602
     // Tidy if possible
603 603
     if (class_exists('tidy')) {
604
-      $tidy = new \tidy;
605
-      $config = array(
606
-      'indent'     => true,
607
-      'input-xml'  => true,
608
-      'output-xml' => true,
609
-      'wrap'       => 200
610
-      );
611
-      $tidy->parseString($xml, $config, 'utf8');
612
-      $tidy->cleanRepair();
613
-      $xml = $tidy;
604
+        $tidy = new \tidy;
605
+        $config = array(
606
+        'indent'     => true,
607
+        'input-xml'  => true,
608
+        'output-xml' => true,
609
+        'wrap'       => 200
610
+        );
611
+        $tidy->parseString($xml, $config, 'utf8');
612
+        $tidy->cleanRepair();
613
+        $xml = $tidy;
614 614
     }
615 615
     // Output
616 616
     error_log("Kannel $log_msg: $xml");
617
-  }
618
-
619
-  /**
620
-  * Check if an array is associative
621
-  *
622
-  * @param   array $array Array to check
623
-  * @return  bool
624
-  * @author  Martin Steel
625
-  */
626
-  protected function is_assoc($array) {
617
+    }
618
+
619
+    /**
620
+     * Check if an array is associative
621
+     *
622
+     * @param   array $array Array to check
623
+     * @return  bool
624
+     * @author  Martin Steel
625
+     */
626
+    protected function is_assoc($array) {
627 627
     return (bool)count(array_filter(array_keys($array), 'is_string'));
628
-  }
628
+    }
629 629
   
630
-  /**
631
-   * Check if a number is a valid MSISDN
632
-   *
633
-   * @param string $val Value to check
634
-   * @return bool True if valid MSISDN
635
-   * @author James Inman
636
-   * @since 1.3.0
637
-   * @todo Take an optional country code and check that the number starts with it
638
-   */
639
-  public static function is_valid_msisdn($val) {
630
+    /**
631
+     * Check if a number is a valid MSISDN
632
+     *
633
+     * @param string $val Value to check
634
+     * @return bool True if valid MSISDN
635
+     * @author James Inman
636
+     * @since 1.3.0
637
+     * @todo Take an optional country code and check that the number starts with it
638
+     */
639
+    public static function is_valid_msisdn($val) {
640 640
     return preg_match( '/^[1-9][0-9]{7,12}$/', $val );
641
-  }
641
+    }
642 642
 
643 643
 }
Please login to merge, or discard this patch.
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
 * @version     1.3.0
10 10
 */
11 11
 
12
-if ( !class_exists('KannelException') ) {
12
+if (!class_exists('KannelException')) {
13 13
   require_once('exception.php');
14 14
 }
15 15
 
@@ -24,25 +24,25 @@  discard block
 block discarded – undo
24 24
   /*
25 25
   * Version of this class
26 26
   */
27
-  const VERSION           = '1.3.1';
27
+  const VERSION = '1.3.1';
28 28
 
29 29
   /**
30 30
   * All Kannel API calls start with BASE_URL
31 31
   * @author  Martin Steel
32 32
   */
33
-  const API_BASE_URL      = 'api.kannelsms.com/xml/';
33
+  const API_BASE_URL = 'api.kannelsms.com/xml/';
34 34
 
35 35
   /**
36 36
   * string to append to API_BASE_URL to check authentication
37 37
   * @author  Martin Steel
38 38
   */
39
-  const API_AUTH_METHOD   = 'authenticate';
39
+  const API_AUTH_METHOD = 'authenticate';
40 40
 
41 41
   /**
42 42
   * string to append to API_BASE_URL for sending SMS
43 43
   * @author  Martin Steel
44 44
   */
45
-  const API_SMS_METHOD    = 'sms';
45
+  const API_SMS_METHOD = 'sms';
46 46
 
47 47
   /**
48 48
   * string to append to API_BASE_URL for checking message credit
@@ -258,13 +258,13 @@  discard block
 block discarded – undo
258 258
     $err_no = null;
259 259
     $err_desc = null;
260 260
 
261
-    foreach($resp_doc->documentElement->childNodes AS $doc_child) {
262
-      switch(strtolower($doc_child->nodeName)) {
261
+    foreach ($resp_doc->documentElement->childNodes AS $doc_child) {
262
+      switch (strtolower($doc_child->nodeName)) {
263 263
         case 'sms_resp':
264 264
         $resp = array();
265 265
         $wrapper_id = null;
266
-        foreach($doc_child->childNodes AS $resp_node) {
267
-          switch(strtolower($resp_node->nodeName)) {
266
+        foreach ($doc_child->childNodes AS $resp_node) {
267
+          switch (strtolower($resp_node->nodeName)) {
268 268
             case 'messageid':
269 269
             $resp['id'] = $resp_node->nodeValue;
270 270
             break;
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
             break;
280 280
           }
281 281
         }
282
-        if( array_key_exists('error_code', $resp ) ) 
282
+        if (array_key_exists('error_code', $resp)) 
283 283
         {
284 284
           $resp['success'] = 0;
285 285
         } else {
@@ -415,7 +415,7 @@  discard block
 block discarded – undo
415 415
       throw new KannelException($err_desc, $err_no);
416 416
     }
417 417
         
418
-    return array( 'symbol' => $symbol, 'balance' => $balance, 'code' => $code );
418
+    return array('symbol' => $symbol, 'balance' => $balance, 'code' => $code);
419 419
   }
420 420
 
421 421
   /**
@@ -480,14 +480,14 @@  discard block
 block discarded – undo
480 480
       $this->logXML("API $method Request XML", $data);
481 481
     }
482 482
     
483
-    if( isset( $this->ssl ) ) {
483
+    if (isset($this->ssl)) {
484 484
       $ssl = $this->ssl;
485 485
     } else {
486 486
       $ssl = $this->sslSupport();
487 487
     }
488 488
 
489 489
     $url = $ssl ? 'https://' : 'http://';
490
-    $url .= self::API_BASE_URL . $method;
490
+    $url .= self::API_BASE_URL.$method;
491 491
 
492 492
     $response = $this->xmlPost($url, $data);
493 493
 
@@ -509,12 +509,12 @@  discard block
 block discarded – undo
509 509
   * @author  Martin Steel
510 510
   */
511 511
   protected function xmlPost($url, $data) {
512
-    if(extension_loaded('curl')) {
512
+    if (extension_loaded('curl')) {
513 513
       $ch = curl_init($url);
514 514
       curl_setopt($ch, CURLOPT_POST, 1);
515 515
       curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
516 516
       curl_setopt($ch, CURLOPT_HTTPHEADER, Array("Content-Type: text/xml"));
517
-      curl_setopt($ch, CURLOPT_USERAGENT, 'Kannel PHP Wrapper/1.0' . self::VERSION);
517
+      curl_setopt($ch, CURLOPT_USERAGENT, 'Kannel PHP Wrapper/1.0'.self::VERSION);
518 518
       curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
519 519
       if (isset($this->proxy_host) && isset($this->proxy_port)) {
520 520
         curl_setopt($ch, CURLOPT_PROXY, $this->proxy_host);
@@ -525,9 +525,9 @@  discard block
 block discarded – undo
525 525
       $info = curl_getinfo($ch);
526 526
 
527 527
       if ($response === false || $info['http_code'] != 200) {
528
-        throw new \Exception('HTTP Error calling Kannel API - HTTP Status: ' . $info['http_code'] . ' - cURL Erorr: ' . curl_error($ch));
528
+        throw new \Exception('HTTP Error calling Kannel API - HTTP Status: '.$info['http_code'].' - cURL Erorr: '.curl_error($ch));
529 529
       } elseif (curl_errno($ch) > 0) {
530
-        throw new \Exception('HTTP Error calling Kannel API - cURL Error: ' . curl_error($ch));
530
+        throw new \Exception('HTTP Error calling Kannel API - cURL Error: '.curl_error($ch));
531 531
       }
532 532
 
533 533
       curl_close($ch);
@@ -536,31 +536,31 @@  discard block
 block discarded – undo
536 536
     } elseif (function_exists('stream_get_contents')) {
537 537
       // Enable error Track Errors
538 538
       $track = ini_get('track_errors');
539
-      ini_set('track_errors',true);
539
+      ini_set('track_errors', true);
540 540
 
541 541
       $params = array('http' => array(
542 542
       'method'  => 'POST',
543
-      'header'  => "Content-Type: text/xml\r\nUser-Agent: mediaburst PHP Wrapper/" . self::VERSION . "\r\n",
543
+      'header'  => "Content-Type: text/xml\r\nUser-Agent: mediaburst PHP Wrapper/".self::VERSION."\r\n",
544 544
       'content' => $data
545 545
       ));
546 546
 
547 547
       if (isset($this->proxy_host) && isset($this->proxy_port)) {
548
-        $params['http']['proxy'] = 'tcp://'.$this->proxy_host . ':' . $this->proxy_port;
548
+        $params['http']['proxy'] = 'tcp://'.$this->proxy_host.':'.$this->proxy_port;
549 549
         $params['http']['request_fulluri'] = True;
550 550
       }
551 551
 
552 552
       $ctx = stream_context_create($params);
553 553
       $fp = @fopen($url, 'rb', false, $ctx);
554 554
       if (!$fp) {
555
-        ini_set('track_errors',$track);
555
+        ini_set('track_errors', $track);
556 556
         throw new \Exception("HTTP Error calling Kannel API - fopen Error: $php_errormsg");
557 557
       }
558 558
       $response = @stream_get_contents($fp);
559 559
       if ($response === false) {
560
-        ini_set('track_errors',$track);
560
+        ini_set('track_errors', $track);
561 561
         throw new \Exception("HTTP Error calling Kannel API - stream Error: $php_errormsg");
562 562
       }
563
-      ini_set('track_errors',$track);
563
+      ini_set('track_errors', $track);
564 564
       return $response;
565 565
     } else {
566 566
       throw new \Exception("Kannel requires PHP5 with cURL or HTTP stream support");
@@ -624,7 +624,7 @@  discard block
 block discarded – undo
624 624
   * @author  Martin Steel
625 625
   */
626 626
   protected function is_assoc($array) {
627
-    return (bool)count(array_filter(array_keys($array), 'is_string'));
627
+    return (bool) count(array_filter(array_keys($array), 'is_string'));
628 628
   }
629 629
   
630 630
   /**
@@ -637,7 +637,7 @@  discard block
 block discarded – undo
637 637
    * @todo Take an optional country code and check that the number starts with it
638 638
    */
639 639
   public static function is_valid_msisdn($val) {
640
-    return preg_match( '/^[1-9][0-9]{7,12}$/', $val );
640
+    return preg_match('/^[1-9][0-9]{7,12}$/', $val);
641 641
   }
642 642
 
643 643
 }
Please login to merge, or discard this patch.
plugin/openmeetings/lib/openmeetings.class.php 3 patches
Doc Comments   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -213,7 +213,8 @@
 block discarded – undo
213 213
     /**
214 214
      * Returns a meeting "join" URL
215 215
      * @param string The name of the meeting (usually the course code)
216
-     * @return mixed The URL to join the meeting, or false on error
216
+     * @param false|string $meetingId
217
+     * @return false|null The URL to join the meeting, or false on error
217 218
      * @todo implement moderator pass
218 219
      * @assert ('') === false
219 220
      * @assert ('abcdefghijklmnopqrstuvwxyzabcdefghijklmno') === false
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -49,9 +49,9 @@  discard block
 block discarded – undo
49 49
         $om_user   = $plugin->get('user');
50 50
         $om_pass   = $plugin->get('pass');
51 51
         $accessUrl = api_get_access_url($_configuration['access_url']);
52
-        $this->externalType = substr($accessUrl['url'], strpos($accessUrl['url'], '://')+3, -1);
52
+        $this->externalType = substr($accessUrl['url'], strpos($accessUrl['url'], '://') + 3, -1);
53 53
         if (strcmp($this->externalType, 'localhost') == 0) {
54
-            $this->externalType = substr(api_get_path(WEB_PATH), strpos(api_get_path(WEB_PATH), '://')+3, -1);
54
+            $this->externalType = substr(api_get_path(WEB_PATH), strpos(api_get_path(WEB_PATH), '://') + 3, -1);
55 55
         }
56 56
         $this->externalType = 'chamilolms.'.$this->externalType;
57 57
         $this->table = \Database::get_main_table('plugin_openmeetings');
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
             // This fills the following attributes: status, name, comment, chamiloCourseId, chamiloSessionId
162 162
             $room = new Room();
163 163
             $room->loadRoomId($meetingData['room_id']);
164
-            $roomArray = (array)$room;
164
+            $roomArray = (array) $room;
165 165
             $roomArray['SID'] = $this->sessionId;
166 166
             $roomId = $this->gateway->updateRoomWithModeration($room);
167 167
             if ($roomId != $meetingData['room_id']) {
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
             $room->SID = $this->sessionId;
177 177
             $room->name = $this->roomName;
178 178
             //$room->roomtypes_id = $room->roomtypes_id;
179
-            $room->comment = urlencode(get_lang('Course').': ' . $params['meeting_name'] . ' - '.$_configuration['software_name']);
179
+            $room->comment = urlencode(get_lang('Course').': '.$params['meeting_name'].' - '.$_configuration['software_name']);
180 180
             //$room->numberOfPartizipants = $room->numberOfPartizipants;
181 181
             $room->ispublic = $room->getString('isPublic', 'false');
182 182
             //$room->appointment = $room->getString('appointment');
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
             $params['room_id'] = $roomId;
201 201
             $params['c_id'] = api_get_course_int_id();
202 202
             $params['session_id'] = api_get_session_id();
203
-            $params['record'] = ($room->allowRecording?1:0);
203
+            $params['record'] = ($room->allowRecording ? 1 : 0);
204 204
 
205 205
             $id = \Database::insert($this->table, $params);
206 206
 
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
         }
239 239
         $params = array('room_id' => $meetingData['room_id']);
240 240
         $returnVal = $this->setUserObjectAndGenerateRoomHashByURLAndRecFlag($params);
241
-        $iframe = $this->url . "/?" ."secureHash=" . $returnVal;
241
+        $iframe = $this->url."/?"."secureHash=".$returnVal;
242 242
         printf("<iframe src='%s' width='%s' height = '%s' />", $iframe, "100%", 640);
243 243
     }
244 244
 
@@ -346,7 +346,7 @@  discard block
 block discarded – undo
346 346
         $userId = $_SESSION['_user']['user_id'];
347 347
         $systemType = 'Chamilo';
348 348
         $room_id = $params['room_id'];
349
-        $becomeModerator = ( $this->isTeacher() ? 1 : 0 );
349
+        $becomeModerator = ($this->isTeacher() ? 1 : 0);
350 350
         $allowRecording = 1; //Provisional
351 351
 
352 352
         $urlWsdl = $this->url."/services/UserService?wsdl";
@@ -420,7 +420,7 @@  discard block
 block discarded – undo
420 420
                 error_log(__FILE__.'+'.__LINE__.' Meetings found: '.print_r($meetingDb, 1));
421 421
                 $remoteMeeting = array();
422 422
                 $meetingDb['created_at'] = api_get_local_time($meetingDb['created_at']);
423
-                $meetingDb['closed_at'] = (!empty($meetingDb['closed_at']) ? api_get_local_time($meetingDb['closed_at']):'');
423
+                $meetingDb['closed_at'] = (!empty($meetingDb['closed_at']) ? api_get_local_time($meetingDb['closed_at']) : '');
424 424
                 // Fixed value for now
425 425
                 $meetingDb['participantCount'] = 40;
426 426
                 $rec = $this->gateway->getFlvRecordingByRoomId($meetingDb['room_id']);
@@ -436,7 +436,7 @@  discard block
 block discarded – undo
436 436
                         \Display::url('[.avi]', $link2, array('target' => '_blank'));
437 437
 
438 438
                 }
439
-                $item['show_links']  = implode('<br />', $links);
439
+                $item['show_links'] = implode('<br />', $links);
440 440
 
441 441
                 // The following code is currently commented because the web service
442 442
                 // says this is not allowed by the SOAP user.
@@ -486,7 +486,7 @@  discard block
 block discarded – undo
486 486
                 $remoteMeeting = $current_room;
487 487
                 */
488 488
 
489
-                if (empty( $remoteMeeting )) {
489
+                if (empty($remoteMeeting)) {
490 490
                 /*
491 491
                     error_log(__FILE__.'+'.__LINE__.' Empty remote Meeting for now');
492 492
                     if ($meetingDb['status'] == 1 && $this->isTeacher()) {
Please login to merge, or discard this patch.
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
             return false;
127 127
         }
128 128
     }
129
-    */
129
+     */
130 130
 
131 131
     /*
132 132
      * Creating a Room for the meeting
@@ -256,10 +256,10 @@  discard block
 block discarded – undo
256 256
         return true;
257 257
     }
258 258
 
259
-     /**
260
-     * Gets the password for a specific meeting for the current user
261
-     * @return string A moderator password if user is teacher, or the course code otherwise
262
-     */
259
+        /**
260
+         * Gets the password for a specific meeting for the current user
261
+         * @return string A moderator password if user is teacher, or the course code otherwise
262
+         */
263 263
     public function getMeetingUserPassword()
264 264
     {
265 265
         if ($this->isTeacher()) {
@@ -538,7 +538,7 @@  discard block
 block discarded – undo
538 538
     //
539 539
     //            }
540 540
     //
541
-                 //$item['created_at'] = api_convert_and_format_date($meetingDb['created_at']);
541
+                    //$item['created_at'] = api_convert_and_format_date($meetingDb['created_at']);
542 542
     //            //created_at
543 543
     //
544 544
     //            $item['publish_url'] = api_get_self().'?action=publish&id='.$meetingDb['id'];
Please login to merge, or discard this patch.