@@ -37,8 +37,8 @@ discard block |
||
| 37 | 37 | |
| 38 | 38 | add_action( 'admin_init', 'checkForEduAdminPlugin' ); |
| 39 | 39 | function checkForEduAdminPlugin() { |
| 40 | - if ( is_admin() && current_user_can( 'activate_plugins' ) && ( ! is_plugin_active( 'eduadmin-booking/eduadmin.php' ) && ! is_plugin_active( 'eduadmin/eduadmin.php' ) ) ) { |
|
| 41 | - add_action( 'admin_notices', function () { |
|
| 40 | + if ( is_admin() && current_user_can( 'activate_plugins' ) && ( !is_plugin_active( 'eduadmin-booking/eduadmin.php' ) && !is_plugin_active( 'eduadmin/eduadmin.php' ) ) ) { |
|
| 41 | + add_action( 'admin_notices', function() { |
|
| 42 | 42 | ?> |
| 43 | 43 | <div class="error"> |
| 44 | 44 | <p><?php _e( 'This plugin requires the EduAdmin-WordPress-plugin to be installed and activated.', 'eduadmin-sveawebpay' ); ?></p> |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | } |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | -if ( ! class_exists( 'EDU_SveaWebPay_Loader' ) ): |
|
| 55 | +if ( !class_exists( 'EDU_SveaWebPay_Loader' ) ): |
|
| 56 | 56 | |
| 57 | 57 | final class EDU_SveaWebPay_Loader { |
| 58 | 58 | public function __construct() { |
@@ -36,9 +36,9 @@ discard block |
||
| 36 | 36 | */ |
| 37 | 37 | |
| 38 | 38 | add_action( 'admin_init', 'checkForEduAdminPlugin' ); |
| 39 | -function checkForEduAdminPlugin() { |
|
| 40 | - if ( is_admin() && current_user_can( 'activate_plugins' ) && ( ! is_plugin_active( 'eduadmin-booking/eduadmin.php' ) && ! is_plugin_active( 'eduadmin/eduadmin.php' ) ) ) { |
|
| 41 | - add_action( 'admin_notices', function () { |
|
| 39 | +function checkForEduAdminPlugin() {
|
|
| 40 | + if ( is_admin() && current_user_can( 'activate_plugins' ) && ( ! is_plugin_active( 'eduadmin-booking/eduadmin.php' ) && ! is_plugin_active( 'eduadmin/eduadmin.php' ) ) ) {
|
|
| 41 | + add_action( 'admin_notices', function () {
|
|
| 42 | 42 | ?> |
| 43 | 43 | <div class="error"> |
| 44 | 44 | <p><?php _e( 'This plugin requires the EduAdmin-WordPress-plugin to be installed and activated.', 'eduadmin-sveawebpay' ); ?></p> |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | } ); |
| 47 | 47 | deactivate_plugins( plugin_basename( __FILE__ ) ); |
| 48 | 48 | |
| 49 | - if ( isset( $_GET['activate'] ) ) { |
|
| 49 | + if ( isset( $_GET['activate'] ) ) {
|
|
| 50 | 50 | unset( $_GET['activate'] ); |
| 51 | 51 | } |
| 52 | 52 | } |
@@ -54,13 +54,13 @@ discard block |
||
| 54 | 54 | |
| 55 | 55 | if ( ! class_exists( 'EDU_SveaWebPay_Loader' ) ): |
| 56 | 56 | |
| 57 | - final class EDU_SveaWebPay_Loader { |
|
| 58 | - public function __construct() { |
|
| 57 | + final class EDU_SveaWebPay_Loader {
|
|
| 58 | + public function __construct() {
|
|
| 59 | 59 | add_action( 'plugins_loaded', array( $this, 'init' ) ); |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | - public function init() { |
|
| 63 | - if ( class_exists( 'EDU_Integration' ) ) { |
|
| 62 | + public function init() {
|
|
| 63 | + if ( class_exists( 'EDU_Integration' ) ) {
|
|
| 64 | 64 | require_once( __DIR__ . '/vendor/autoload.php' ); // Load dependencies |
| 65 | 65 | require_once( __DIR__ . '/class/class-edu-sveawebpay.php' ); |
| 66 | 66 | |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | } |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | - public function add_integration( $integrations ) { |
|
| 71 | + public function add_integration( $integrations ) {
|
|
| 72 | 72 | $integrations[] = 'EDU_SveaWebPay'; |
| 73 | 73 | |
| 74 | 74 | return $integrations; |
@@ -6,7 +6,7 @@ discard block |
||
| 6 | 6 | use Svea\WebPay\WebPay; |
| 7 | 7 | use Svea\WebPay\WebPayItem; |
| 8 | 8 | |
| 9 | -if ( ! class_exists( 'EDU_SveaWebPay' ) ): |
|
| 9 | +if ( !class_exists( 'EDU_SveaWebPay' ) ): |
|
| 10 | 10 | |
| 11 | 11 | /** |
| 12 | 12 | * EDU_SveaWebPay integrates EduAdmin-WordPress plugin with SveaWebPay as payment gateway |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | |
| 78 | 78 | $ebi = new EduAdmin_BookingInfo( $event_booking, $_customer, $_contact ); |
| 79 | 79 | |
| 80 | - if ( ! empty( EDU()->session['svea-order-id'] ) && ! empty( $_GET['svea_order_id'] ) && EDU()->session['svea-order-id'] === $_GET['svea_order_id'] ) { |
|
| 80 | + if ( !empty( EDU()->session['svea-order-id'] ) && !empty( $_GET['svea_order_id'] ) && EDU()->session['svea-order-id'] === $_GET['svea_order_id'] ) { |
|
| 81 | 81 | do_action( 'eduadmin-bookingcompleted', $ebi ); |
| 82 | 82 | } else { |
| 83 | 83 | do_action( 'eduadmin-processbooking', $ebi ); |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | return; |
| 94 | 94 | } |
| 95 | 95 | |
| 96 | - if ( ! empty( $_POST['act'] ) && ( 'bookCourse' === $_POST['act'] || 'bookProgramme' === $_POST['act'] ) ) { |
|
| 96 | + if ( !empty( $_POST['act'] ) && ( 'bookCourse' === $_POST['act'] || 'bookProgramme' === $_POST['act'] ) ) { |
|
| 97 | 97 | $ebi->NoRedirect = true; |
| 98 | 98 | } |
| 99 | 99 | } |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | foreach ( $countries as $country ) { |
| 190 | 190 | if ( $invoiceCountry == $country['CountryName'] ) { |
| 191 | 191 | $selectedCountry = $country['CountryCode']; |
| 192 | - if ( ! empty( $country['CultureName'] ) ) { |
|
| 192 | + if ( !empty( $country['CultureName'] ) ) { |
|
| 193 | 193 | $selectedLocale = $country['CultureName']; |
| 194 | 194 | } |
| 195 | 195 | break; |
@@ -205,7 +205,7 @@ discard block |
||
| 205 | 205 | |
| 206 | 206 | $eventName = ''; |
| 207 | 207 | |
| 208 | - if ( ! empty( $ebi->EventBooking['BookingId'] ) ) { |
|
| 208 | + if ( !empty( $ebi->EventBooking['BookingId'] ) ) { |
|
| 209 | 209 | $booking_id = intval( $ebi->EventBooking['BookingId'] ); |
| 210 | 210 | $reference_id = $booking_id; |
| 211 | 211 | |
@@ -214,7 +214,7 @@ discard block |
||
| 214 | 214 | $eventName = $_event['EventName']; |
| 215 | 215 | } |
| 216 | 216 | |
| 217 | - if ( ! empty( $ebi->EventBooking['ProgrammeBookingId'] ) ) { |
|
| 217 | + if ( !empty( $ebi->EventBooking['ProgrammeBookingId'] ) ) { |
|
| 218 | 218 | $programme_booking_id = intval( $ebi->EventBooking['ProgrammeBookingId'] ); |
| 219 | 219 | $reference_id = $programme_booking_id; |
| 220 | 220 | |
@@ -243,19 +243,19 @@ discard block |
||
| 243 | 243 | |
| 244 | 244 | $customer = WebPayItem::companyCustomer(); |
| 245 | 245 | |
| 246 | - $customerName = ! empty( $ebi->Customer['BillingInfo']['InvoiceName'] ) ? $ebi->Customer['BillingInfo']['InvoiceName'] : $ebi->Customer['CustomerName']; |
|
| 247 | - $streetAddress = ! empty( $ebi->Customer['BillingInfo']['Address'] ) ? $ebi->Customer['BillingInfo']['Address'] : $ebi->Customer['Address']; |
|
| 248 | - $zipCode = ! empty( $ebi->Customer['BillingInfo']['Zip'] ) ? $ebi->Customer['BillingInfo']['Zip'] : $ebi->Customer['Zip']; |
|
| 246 | + $customerName = !empty( $ebi->Customer['BillingInfo']['InvoiceName'] ) ? $ebi->Customer['BillingInfo']['InvoiceName'] : $ebi->Customer['CustomerName']; |
|
| 247 | + $streetAddress = !empty( $ebi->Customer['BillingInfo']['Address'] ) ? $ebi->Customer['BillingInfo']['Address'] : $ebi->Customer['Address']; |
|
| 248 | + $zipCode = !empty( $ebi->Customer['BillingInfo']['Zip'] ) ? $ebi->Customer['BillingInfo']['Zip'] : $ebi->Customer['Zip']; |
|
| 249 | 249 | $city = $ebi->Customer['BillingInfo']['City'] ? $ebi->Customer['BillingInfo']['City'] : $ebi->Customer['City']; |
| 250 | 250 | $phone = $ebi->Customer['Phone']; |
| 251 | - $email = ! empty( $ebi->Customer['BillingInfo']['Email'] ) ? $ebi->Customer['BillingInfo']['Email'] : $ebi->Customer['Email']; |
|
| 251 | + $email = !empty( $ebi->Customer['BillingInfo']['Email'] ) ? $ebi->Customer['BillingInfo']['Email'] : $ebi->Customer['Email']; |
|
| 252 | 252 | |
| 253 | 253 | $customer->setCompanyName( $customerName ); |
| 254 | 254 | $customer->setStreetAddress( $streetAddress ); |
| 255 | 255 | $customer->setZipCode( $zipCode ); |
| 256 | 256 | $customer->setLocality( $city ); |
| 257 | 257 | |
| 258 | - if ( ! empty( $phone ) ) { |
|
| 258 | + if ( !empty( $phone ) ) { |
|
| 259 | 259 | $customer->setPhoneNumber( $phone ); |
| 260 | 260 | $phonePreset = WebPayItem::presetValue() |
| 261 | 261 | ->setTypeName( \Svea\WebPay\Checkout\Model\PresetValue::PHONE_NUMBER ) |
@@ -326,7 +326,7 @@ discard block |
||
| 326 | 326 | ->setConfirmationUri( $defaultThankYou ) |
| 327 | 327 | ->setPushUri( $defaultPushUrl ) |
| 328 | 328 | ->setCheckoutUri( $defaultCancel ); // We have no "checkout"-url.. So we just cancel the booking instead. |
| 329 | - $wpForm = $wpBuild->createOrder(); |
|
| 329 | + $wpForm = $wpBuild->createOrder(); |
|
| 330 | 330 | |
| 331 | 331 | EDU()->session['svea-order-id'] = $wpForm['OrderId']; |
| 332 | 332 | |
@@ -334,7 +334,7 @@ discard block |
||
| 334 | 334 | } |
| 335 | 335 | |
| 336 | 336 | public function process_paymentstatus() { |
| 337 | - if ( ! empty( $_GET['svea_order_id'] ) && intval( $_GET['svea_order_id'] ) != 0 && ! empty( $_GET['status'] ) ) { |
|
| 337 | + if ( !empty( $_GET['svea_order_id'] ) && intval( $_GET['svea_order_id'] ) != 0 && !empty( $_GET['status'] ) ) { |
|
| 338 | 338 | |
| 339 | 339 | $booking_id = intval( $_GET['booking_id'] ); |
| 340 | 340 | $programme_booking_id = intval( $_GET['programme_booking_id'] ); |
@@ -344,7 +344,7 @@ discard block |
||
| 344 | 344 | exit( 0 ); |
| 345 | 345 | } |
| 346 | 346 | |
| 347 | - if ( isset( $_REQUEST['edu-thankyou'] ) && isset( $_REQUEST['svea'] ) && ! empty( $_GET['status'] ) ) { |
|
| 347 | + if ( isset( $_REQUEST['edu-thankyou'] ) && isset( $_REQUEST['svea'] ) && !empty( $_GET['status'] ) ) { |
|
| 348 | 348 | $booking_id = intval( $_GET['booking_id'] ); |
| 349 | 349 | $programme_booking_id = intval( $_GET['programme_booking_id'] ); |
| 350 | 350 | |