@@ -219,7 +219,7 @@  | 
                                                    ||
| 219 | 219 | |
| 220 | 220 | // Pass $view=true to filter hidden caps if the user cannot see them.  | 
                                                        
| 221 | 221 | if ($users = get_users_by_capability($context, 'moodle/course:update', 'u.*', 'u.id ASC',  | 
                                                        
| 222 | -                                             '', '', '', '', false, true)) { | 
                                                        |
| 222 | +                                                '', '', '', '', false, true)) { | 
                                                        |
| 223 | 223 | $users = sort_by_roleassignment_authority($users, $context);  | 
                                                        
| 224 | 224 | $teacher = array_shift($users);  | 
                                                        
| 225 | 225 |          } else { | 
                                                        
@@ -31,7 +31,7 @@ discard block  | 
                                                    ||
| 31 | 31 | |
| 32 | 32 |  require("../../../config.php"); | 
                                                        
| 33 | 33 | require_once($CFG->libdir.'/eventslib.php');  | 
                                                        
| 34 | -require_once($CFG->libdir . '/filelib.php');  | 
                                                        |
| 34 | +require_once($CFG->libdir.'/filelib.php');  | 
                                                        |
| 35 | 35 | |
| 36 | 36 | // PayPal does not like when we return error messages here,  | 
                                                        
| 37 | 37 | // the custom handler just logs exceptions and stops.  | 
                                                        
@@ -76,15 +76,15 @@ discard block  | 
                                                    ||
| 76 | 76 |  $custom = optional_param('custom', '', PARAM_TEXT); | 
                                                        
| 77 | 77 |  $custom = explode('-', $custom); | 
                                                        
| 78 | 78 | $data->userid = (int)$custom[0];  | 
                                                        
| 79 | -$data->contextid = (int)$custom[1];  | 
                                                        |
| 79 | +$data->contextid = (int)$custom[1];  | 
                                                        |
| 80 | 80 | $data->timeupdated = time();  | 
                                                        
| 81 | 81 | |
| 82 | -if (! $user = $DB->get_record("user", array("id" => $data->userid))) { | 
                                                        |
| 82 | +if (!$user = $DB->get_record("user", array("id" => $data->userid))) { | 
                                                        |
| 83 | 83 |      paypal_message_error_to_admin("Not a valid user id", $data); | 
                                                        
| 84 | 84 | die;  | 
                                                        
| 85 | 85 | }  | 
                                                        
| 86 | 86 | |
| 87 | -if (! $context = context::instance_by_id($data->contextid, IGNORE_MISSING)) { | 
                                                        |
| 87 | +if (!$context = context::instance_by_id($data->contextid, IGNORE_MISSING)) { | 
                                                        |
| 88 | 88 |      paypal_message_error_to_admin("Not a valid context id", $data); | 
                                                        
| 89 | 89 | die;  | 
                                                        
| 90 | 90 | }  | 
                                                        
@@ -167,8 +167,8 @@ discard block  | 
                                                    ||
| 167 | 167 | |
| 168 | 168 | // If our status is not completed or not pending on an echeck clearance then ignore and die.  | 
                                                        
| 169 | 169 | // This check is redundant at present but may be useful if paypal extend the return codes in the future.  | 
                                                        
| 170 | - if (! ( $data->payment_status == "Completed" or  | 
                                                        |
| 171 | -               ($data->payment_status == "Pending" and $data->pending_reason == "echeck") ) ) { | 
                                                        |
| 170 | + if (!($data->payment_status == "Completed" or  | 
                                                        |
| 171 | +               ($data->payment_status == "Pending" and $data->pending_reason == "echeck"))) { | 
                                                        |
| 172 | 172 | die;  | 
                                                        
| 173 | 173 | }  | 
                                                        
| 174 | 174 | |
@@ -202,10 +202,10 @@ discard block  | 
                                                    ||
| 202 | 202 | $coursecontext = context_course::instance($course->id, IGNORE_MISSING);  | 
                                                        
| 203 | 203 | |
| 204 | 204 | // Check that amount paid is the correct amount.  | 
                                                        
| 205 | -        if ( (float) $paypal->cost < 0 ) { | 
                                                        |
| 206 | - $cost = (float) 0;  | 
                                                        |
| 205 | +        if ((float)$paypal->cost < 0) { | 
                                                        |
| 206 | + $cost = (float)0;  | 
                                                        |
| 207 | 207 |          } else { | 
                                                        
| 208 | - $cost = (float) $paypal->cost;  | 
                                                        |
| 208 | + $cost = (float)$paypal->cost;  | 
                                                        |
| 209 | 209 | }  | 
                                                        
| 210 | 210 | |
| 211 | 211 | // Use the same rounding of floats as on the plugin form.  | 
                                                        
@@ -288,7 +288,7 @@ discard block  | 
                                                    ||
| 288 | 288 | }  | 
                                                        
| 289 | 289 | */  | 
                                                        
| 290 | 290 | |
| 291 | -    } else if (strcmp ($result, "INVALID") == 0) { // ERROR. | 
                                                        |
| 291 | +    } else if (strcmp($result, "INVALID") == 0) { // ERROR. | 
                                                        |
| 292 | 292 |          $DB->insert_record("paypal_transactions", $data, false); | 
                                                        
| 293 | 293 |          paypal_message_error_to_admin("Received an invalid payment notification!! (Fake payment?)", $data); | 
                                                        
| 294 | 294 | }  | 
                                                        
@@ -26,5 +26,5 @@  | 
                                                    ||
| 26 | 26 | $plugin->version = 2015051100;  | 
                                                        
| 27 | 27 | $plugin->requires = 2015050500;  | 
                                                        
| 28 | 28 | $plugin->release = 1;  | 
                                                        
| 29 | -$plugin->maturity = MATURITY_STABLE;  | 
                                                        |
| 29 | +$plugin->maturity = MATURITY_STABLE;  | 
                                                        |
| 30 | 30 | $plugin->component = 'availability_paypal';  | 
                                                        
@@ -95,7 +95,7 @@  | 
                                                    ||
| 95 | 95 | // should double-check with paypal everytime ?  | 
                                                        
| 96 | 96 | $context = $info->get_context();  | 
                                                        
| 97 | 97 |          return $DB->record_exists('paypal_transactions', | 
                                                        
| 98 | -                                  array('userid' => $userid, | 
                                                        |
| 98 | +                                    array('userid' => $userid, | 
                                                        |
| 99 | 99 | 'contextid' => $context->id,  | 
                                                        
| 100 | 100 | 'payment_status' => 'Completed'));  | 
                                                        
| 101 | 101 | }  |