@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | // @codingStandardsIgnoreLine |
| 34 | 34 | require("../../../config.php"); |
| 35 | 35 | |
| 36 | -require_once($CFG->libdir . '/filelib.php'); |
|
| 36 | +require_once($CFG->libdir.'/filelib.php'); |
|
| 37 | 37 | |
| 38 | 38 | // PayPal does not like when we return error messages here, |
| 39 | 39 | // 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 | availability_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 | availability_paypal_message_error_to_admin("Not a valid context id", $data); |
| 89 | 89 | die; |
| 90 | 90 | } |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | |
| 144 | 144 | // If currency is incorrectly set then someone maybe trying to cheat the system. |
| 145 | 145 | if ($data->payment_currency != $paypal->currency) { |
| 146 | - $str = "Currency does not match course settings, received: " . $data->payment_currency; |
|
| 146 | + $str = "Currency does not match course settings, received: ".$data->payment_currency; |
|
| 147 | 147 | availability_paypal_message_error_to_admin($str, $data); |
| 148 | 148 | die; |
| 149 | 149 | } |
@@ -168,8 +168,8 @@ discard block |
||
| 168 | 168 | |
| 169 | 169 | // If our status is not completed or not pending on an echeck clearance then ignore and die. |
| 170 | 170 | // This check is redundant at present but may be useful if paypal extend the return codes in the future. |
| 171 | - if (! ( $data->payment_status == "Completed" or |
|
| 172 | - ($data->payment_status == "Pending" and $data->pending_reason == "echeck") ) ) { |
|
| 171 | + if (!($data->payment_status == "Completed" or |
|
| 172 | + ($data->payment_status == "Pending" and $data->pending_reason == "echeck"))) { |
|
| 173 | 173 | die; |
| 174 | 174 | } |
| 175 | 175 | |
@@ -203,10 +203,10 @@ discard block |
||
| 203 | 203 | $coursecontext = context_course::instance($course->id, IGNORE_MISSING); |
| 204 | 204 | |
| 205 | 205 | // Check that amount paid is the correct amount. |
| 206 | - if ( (float) $paypal->cost < 0 ) { |
|
| 207 | - $cost = (float) 0; |
|
| 206 | + if ((float)$paypal->cost < 0) { |
|
| 207 | + $cost = (float)0; |
|
| 208 | 208 | } else { |
| 209 | - $cost = (float) $paypal->cost; |
|
| 209 | + $cost = (float)$paypal->cost; |
|
| 210 | 210 | } |
| 211 | 211 | |
| 212 | 212 | // Use the same rounding of floats as on the plugin form. |
@@ -228,7 +228,7 @@ discard block |
||
| 228 | 228 | $teacher = false; |
| 229 | 229 | } |
| 230 | 230 | |
| 231 | - } else if (strcmp ($result, "INVALID") == 0) { // ERROR. |
|
| 231 | + } else if (strcmp($result, "INVALID") == 0) { // ERROR. |
|
| 232 | 232 | $DB->insert_record("availability_paypal_tnx", $data, false); |
| 233 | 233 | availability_paypal_message_error_to_admin("Received an invalid payment notification!! (Fake payment?)", $data); |
| 234 | 234 | } |
@@ -27,5 +27,5 @@ |
||
| 27 | 27 | $plugin->version = 2020021800; |
| 28 | 28 | $plugin->requires = 2018120300; |
| 29 | 29 | $plugin->release = 8; |
| 30 | -$plugin->maturity = MATURITY_STABLE; |
|
| 30 | +$plugin->maturity = MATURITY_STABLE; |
|
| 31 | 31 | $plugin->component = 'availability_paypal'; |