@@ -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 { |
@@ -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 | } |
@@ -99,7 +99,7 @@ |
||
| 99 | 99 | // Should double-check with paypal everytime ? |
| 100 | 100 | $context = $info->get_context(); |
| 101 | 101 | $allow = $DB->record_exists('availability_paypal_tnx', |
| 102 | - array('userid' => $userid, |
|
| 102 | + array('userid' => $userid, |
|
| 103 | 103 | 'contextid' => $context->id, |
| 104 | 104 | 'payment_status' => 'Completed')); |
| 105 | 105 | if ($not) { |
@@ -130,7 +130,7 @@ |
||
| 130 | 130 | <input type="hidden" name="no_note" value="1" /> |
| 131 | 131 | <input type="hidden" name="no_shipping" value="1" /> |
| 132 | 132 | <input type="hidden" name="notify_url" value="<?php echo "{$CFG->wwwroot}/availability/condition/paypal/ipn.php" ?>" /> |
| 133 | - <?php $returnurl = $CFG->wwwroot . '/availability/condition/paypal/view.php?contextid=' . $contextid; ?> |
|
| 133 | + <?php $returnurl = $CFG->wwwroot.'/availability/condition/paypal/view.php?contextid='.$contextid; ?> |
|
| 134 | 134 | <input type="hidden" name="return" value="<?php echo $returnurl; ?>" /> |
| 135 | 135 | <input type="hidden" name="cancel_return" value="<?php echo $returnurl; ?>" /> |
| 136 | 136 | <input type="hidden" name="rm" value="2" /> |
@@ -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'; |