@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | */ |
| 118 | 118 | public function get_array() { |
| 119 | 119 | $array = array( |
| 120 | - 'amount' => number_format( $this->amount, 2, '.', '' ), |
|
| 120 | + 'amount' => number_format($this->amount, 2, '.', ''), |
|
| 121 | 121 | 'description' => $this->description, |
| 122 | 122 | 'method' => $this->method, |
| 123 | 123 | 'redirectUrl' => $this->redirect_url, |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | /* |
| 133 | 133 | * Array filter will remove values NULL, FALSE and empty strings ('') |
| 134 | 134 | */ |
| 135 | - $array = array_filter( $array ); |
|
| 135 | + $array = array_filter($array); |
|
| 136 | 136 | |
| 137 | 137 | return $array; |
| 138 | 138 | } |
@@ -7,31 +7,31 @@ |
||
| 7 | 7 | * @see https://github.com/WordPress/WordPress/blob/4.5.2/wp-admin/user-edit.php#L578-L600 |
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | -$customer_id_live = get_user_meta( $user->ID, '_pronamic_pay_mollie_customer_id', true ); |
|
| 11 | -$customer_id_test = get_user_meta( $user->ID, '_pronamic_pay_mollie_customer_id_test', true ); |
|
| 10 | +$customer_id_live = get_user_meta($user->ID, '_pronamic_pay_mollie_customer_id', true); |
|
| 11 | +$customer_id_test = get_user_meta($user->ID, '_pronamic_pay_mollie_customer_id_test', true); |
|
| 12 | 12 | |
| 13 | 13 | ?> |
| 14 | -<h2><?php esc_html_e( 'Mollie', 'pronamic_ideal' ); ?></h2> |
|
| 14 | +<h2><?php esc_html_e('Mollie', 'pronamic_ideal'); ?></h2> |
|
| 15 | 15 | |
| 16 | 16 | <table class="form-table"> |
| 17 | 17 | <tr> |
| 18 | 18 | <th> |
| 19 | 19 | <label for="pronamic_pay_mollie_customer_id_live"> |
| 20 | - <?php esc_html_e( 'Customer live ID', 'pronamic_ideal' ); ?> |
|
| 20 | + <?php esc_html_e('Customer live ID', 'pronamic_ideal'); ?> |
|
| 21 | 21 | </label> |
| 22 | 22 | </th> |
| 23 | 23 | <td> |
| 24 | - <input id="pronamic_pay_mollie_customer_id_live" name="pronamic_pay_mollie_customer_id_live" type="text" value="<?php echo esc_attr( $customer_id_live ); ?>" class="regular-text" readonly="readonly" /> |
|
| 24 | + <input id="pronamic_pay_mollie_customer_id_live" name="pronamic_pay_mollie_customer_id_live" type="text" value="<?php echo esc_attr($customer_id_live); ?>" class="regular-text" readonly="readonly" /> |
|
| 25 | 25 | </td> |
| 26 | 26 | </tr> |
| 27 | 27 | <tr> |
| 28 | 28 | <th> |
| 29 | 29 | <label for="pronamic_pay_mollie_customer_id_test"> |
| 30 | - <?php esc_html_e( 'Customer test ID', 'pronamic_ideal' ); ?> |
|
| 30 | + <?php esc_html_e('Customer test ID', 'pronamic_ideal'); ?> |
|
| 31 | 31 | </label> |
| 32 | 32 | </th> |
| 33 | 33 | <td> |
| 34 | - <input id="pronamic_pay_mollie_customer_id_test" name="pronamic_pay_mollie_customer_id_test" type="text" value="<?php echo esc_attr( $customer_id_test ); ?>" class="regular-text" readonly="readonly" /> |
|
| 34 | + <input id="pronamic_pay_mollie_customer_id_test" name="pronamic_pay_mollie_customer_id_test" type="text" value="<?php echo esc_attr($customer_id_test); ?>" class="regular-text" readonly="readonly" /> |
|
| 35 | 35 | </td> |
| 36 | 36 | </tr> |
| 37 | 37 | </table> |
@@ -29,29 +29,29 @@ discard block |
||
| 29 | 29 | $this->id = 'mollie'; |
| 30 | 30 | $this->name = 'Mollie'; |
| 31 | 31 | $this->url = 'http://www.mollie.com/en/'; |
| 32 | - $this->product_url = __( 'https://www.mollie.com/en/pricing', 'pronamic_ideal' ); |
|
| 32 | + $this->product_url = __('https://www.mollie.com/en/pricing', 'pronamic_ideal'); |
|
| 33 | 33 | $this->provider = 'mollie'; |
| 34 | 34 | |
| 35 | 35 | // Actions |
| 36 | - $function = array( __NAMESPACE__ . '\Listener', 'listen' ); |
|
| 36 | + $function = array(__NAMESPACE__ . '\Listener', 'listen'); |
|
| 37 | 37 | |
| 38 | - if ( ! has_action( 'wp_loaded', $function ) ) { |
|
| 39 | - add_action( 'wp_loaded', $function ); |
|
| 38 | + if ( ! has_action('wp_loaded', $function)) { |
|
| 39 | + add_action('wp_loaded', $function); |
|
| 40 | 40 | } |
| 41 | 41 | |
| 42 | - if ( is_admin() ) { |
|
| 43 | - $function = array( __CLASS__, 'user_profile' ); |
|
| 42 | + if (is_admin()) { |
|
| 43 | + $function = array(__CLASS__, 'user_profile'); |
|
| 44 | 44 | |
| 45 | - if ( ! has_action( 'show_user_profile', $function ) ) { |
|
| 46 | - add_action( 'show_user_profile', $function ); |
|
| 45 | + if ( ! has_action('show_user_profile', $function)) { |
|
| 46 | + add_action('show_user_profile', $function); |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | - if ( ! has_action( 'edit_user_profile', $function ) ) { |
|
| 50 | - add_action( 'edit_user_profile', $function ); |
|
| 49 | + if ( ! has_action('edit_user_profile', $function)) { |
|
| 50 | + add_action('edit_user_profile', $function); |
|
| 51 | 51 | } |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | - add_filter( 'pronamic_payment_provider_url_mollie', array( $this, 'payment_provider_url' ), 10, 2 ); |
|
| 54 | + add_filter('pronamic_payment_provider_url_mollie', array($this, 'payment_provider_url'), 10, 2); |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | public function get_config_factory_class() { |
@@ -83,8 +83,8 @@ discard block |
||
| 83 | 83 | * @since 1.1.6 |
| 84 | 84 | * @see https://github.com/WordPress/WordPress/blob/4.5.2/wp-admin/user-edit.php#L578-L600 |
| 85 | 85 | */ |
| 86 | - public static function user_profile( $user ) { |
|
| 87 | - include dirname( __FILE__ ) . '/../views/html-admin-user-profile.php'; |
|
| 86 | + public static function user_profile($user) { |
|
| 87 | + include dirname(__FILE__) . '/../views/html-admin-user-profile.php'; |
|
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | /** |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | * @param Payment $payment |
| 95 | 95 | * @return string |
| 96 | 96 | */ |
| 97 | - public function payment_provider_url( $url, $payment ) { |
|
| 97 | + public function payment_provider_url($url, $payment) { |
|
| 98 | 98 | return sprintf( |
| 99 | 99 | 'https://www.mollie.com/dashboard/payments/%s', |
| 100 | 100 | $payment->get_transaction_id() |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | * |
| 18 | 18 | * @return string|null |
| 19 | 19 | */ |
| 20 | - public static function transform( $locale ) { |
|
| 20 | + public static function transform($locale) { |
|
| 21 | 21 | // Supported locales |
| 22 | 22 | $supported = array( |
| 23 | 23 | Locales::DE, |
@@ -28,13 +28,13 @@ discard block |
||
| 28 | 28 | ); |
| 29 | 29 | |
| 30 | 30 | // Sub string |
| 31 | - $locale = substr( $locale, 0, 2 ); |
|
| 31 | + $locale = substr($locale, 0, 2); |
|
| 32 | 32 | |
| 33 | 33 | // Lower case |
| 34 | - $locale = strtolower( $locale ); |
|
| 34 | + $locale = strtolower($locale); |
|
| 35 | 35 | |
| 36 | 36 | // Is supported? |
| 37 | - if ( in_array( $locale, $supported, true ) ) { |
|
| 37 | + if (in_array($locale, $supported, true)) { |
|
| 38 | 38 | return $locale; |
| 39 | 39 | } |
| 40 | 40 | |
@@ -137,13 +137,13 @@ discard block |
||
| 137 | 137 | * |
| 138 | 138 | * @return string |
| 139 | 139 | */ |
| 140 | - public static function transform( $payment_method, $default = null ) { |
|
| 141 | - if ( ! is_scalar( $payment_method ) ) { |
|
| 140 | + public static function transform($payment_method, $default = null) { |
|
| 141 | + if ( ! is_scalar($payment_method)) { |
|
| 142 | 142 | return null; |
| 143 | 143 | } |
| 144 | 144 | |
| 145 | - if ( isset( self::$map[ $payment_method ] ) ) { |
|
| 146 | - return self::$map[ $payment_method ]; |
|
| 145 | + if (isset(self::$map[$payment_method])) { |
|
| 146 | + return self::$map[$payment_method]; |
|
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | return $default; |
@@ -158,14 +158,14 @@ discard block |
||
| 158 | 158 | * |
| 159 | 159 | * @return string |
| 160 | 160 | */ |
| 161 | - public static function transform_gateway_method( $method ) { |
|
| 162 | - if ( ! is_scalar( $method ) ) { |
|
| 161 | + public static function transform_gateway_method($method) { |
|
| 162 | + if ( ! is_scalar($method)) { |
|
| 163 | 163 | return null; |
| 164 | 164 | } |
| 165 | 165 | |
| 166 | - $payment_method = array_search( $method, self::$map, true ); |
|
| 166 | + $payment_method = array_search($method, self::$map, true); |
|
| 167 | 167 | |
| 168 | - if ( ! $payment_method ) { |
|
| 168 | + if ( ! $payment_method) { |
|
| 169 | 169 | return null; |
| 170 | 170 | } |
| 171 | 171 | |
@@ -19,8 +19,8 @@ discard block |
||
| 19 | 19 | * Settings constructor. |
| 20 | 20 | */ |
| 21 | 21 | public function __construct() { |
| 22 | - add_filter( 'pronamic_pay_gateway_sections', array( $this, 'sections' ) ); |
|
| 23 | - add_filter( 'pronamic_pay_gateway_fields', array( $this, 'fields' ) ); |
|
| 22 | + add_filter('pronamic_pay_gateway_sections', array($this, 'sections')); |
|
| 23 | + add_filter('pronamic_pay_gateway_fields', array($this, 'fields')); |
|
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | /** |
@@ -30,19 +30,19 @@ discard block |
||
| 30 | 30 | * |
| 31 | 31 | * @return array |
| 32 | 32 | */ |
| 33 | - public function sections( array $sections ) { |
|
| 33 | + public function sections(array $sections) { |
|
| 34 | 34 | // General. |
| 35 | 35 | $sections['mollie'] = array( |
| 36 | - 'title' => __( 'Mollie', 'pronamic_ideal' ), |
|
| 37 | - 'methods' => array( 'mollie' ), |
|
| 38 | - 'description' => __( 'Account details are provided by the payment provider after registration. These settings need to match with the payment provider dashboard.', 'pronamic_ideal' ), |
|
| 36 | + 'title' => __('Mollie', 'pronamic_ideal'), |
|
| 37 | + 'methods' => array('mollie'), |
|
| 38 | + 'description' => __('Account details are provided by the payment provider after registration. These settings need to match with the payment provider dashboard.', 'pronamic_ideal'), |
|
| 39 | 39 | ); |
| 40 | 40 | |
| 41 | 41 | // Transaction feedback. |
| 42 | 42 | $sections['mollie_feedback'] = array( |
| 43 | - 'title' => __( 'Transaction feedback', 'pronamic_ideal' ), |
|
| 44 | - 'methods' => array( 'mollie' ), |
|
| 45 | - 'description' => __( 'Payment status updates will be processed without any additional configuration. The <em>Webhook URL</em> is being used to receive the status updates.', 'pronamic_ideal' ), |
|
| 43 | + 'title' => __('Transaction feedback', 'pronamic_ideal'), |
|
| 44 | + 'methods' => array('mollie'), |
|
| 45 | + 'description' => __('Payment status updates will be processed without any additional configuration. The <em>Webhook URL</em> is being used to receive the status updates.', 'pronamic_ideal'), |
|
| 46 | 46 | ); |
| 47 | 47 | |
| 48 | 48 | return $sections; |
@@ -55,40 +55,40 @@ discard block |
||
| 55 | 55 | * |
| 56 | 56 | * @return array |
| 57 | 57 | */ |
| 58 | - public function fields( array $fields ) { |
|
| 58 | + public function fields(array $fields) { |
|
| 59 | 59 | // API Key. |
| 60 | 60 | $fields[] = array( |
| 61 | 61 | 'filter' => FILTER_SANITIZE_STRING, |
| 62 | 62 | 'section' => 'mollie', |
| 63 | 63 | 'meta_key' => '_pronamic_gateway_mollie_api_key', |
| 64 | - 'title' => _x( 'API Key', 'mollie', 'pronamic_ideal' ), |
|
| 64 | + 'title' => _x('API Key', 'mollie', 'pronamic_ideal'), |
|
| 65 | 65 | 'type' => 'text', |
| 66 | - 'classes' => array( 'regular-text', 'code' ), |
|
| 67 | - 'methods' => array( 'mollie' ), |
|
| 68 | - 'tooltip' => __( 'API key as mentioned in the payment provider dashboard', 'pronamic_ideal' ), |
|
| 66 | + 'classes' => array('regular-text', 'code'), |
|
| 67 | + 'methods' => array('mollie'), |
|
| 68 | + 'tooltip' => __('API key as mentioned in the payment provider dashboard', 'pronamic_ideal'), |
|
| 69 | 69 | ); |
| 70 | 70 | |
| 71 | 71 | // Transaction feedback. |
| 72 | 72 | $fields[] = array( |
| 73 | 73 | 'section' => 'mollie', |
| 74 | - 'title' => __( 'Transaction feedback', 'pronamic_ideal' ), |
|
| 74 | + 'title' => __('Transaction feedback', 'pronamic_ideal'), |
|
| 75 | 75 | 'type' => 'description', |
| 76 | 76 | 'html' => sprintf( |
| 77 | 77 | '<span class="dashicons dashicons-yes"></span> %s', |
| 78 | - __( 'Payment status updates will be processed without any additional configuration.', 'pronamic_ideal' ) |
|
| 78 | + __('Payment status updates will be processed without any additional configuration.', 'pronamic_ideal') |
|
| 79 | 79 | ), |
| 80 | 80 | ); |
| 81 | 81 | |
| 82 | 82 | // Webhook. |
| 83 | 83 | $fields[] = array( |
| 84 | 84 | 'section' => 'mollie_feedback', |
| 85 | - 'title' => __( 'Webhook URL', 'pronamic_ideal' ), |
|
| 85 | + 'title' => __('Webhook URL', 'pronamic_ideal'), |
|
| 86 | 86 | 'type' => 'text', |
| 87 | - 'classes' => array( 'large-text', 'code' ), |
|
| 88 | - 'value' => add_query_arg( 'mollie_webhook', '', home_url( '/' ) ), |
|
| 87 | + 'classes' => array('large-text', 'code'), |
|
| 88 | + 'value' => add_query_arg('mollie_webhook', '', home_url('/')), |
|
| 89 | 89 | 'readonly' => true, |
| 90 | - 'methods' => array( 'mollie' ), |
|
| 91 | - 'tooltip' => __( 'The Webhook URL as sent with each transaction to receive automatic payment status updates on.', 'pronamic_ideal' ), |
|
| 90 | + 'methods' => array('mollie'), |
|
| 91 | + 'tooltip' => __('The Webhook URL as sent with each transaction to receive automatic payment status updates on.', 'pronamic_ideal'), |
|
| 92 | 92 | ); |
| 93 | 93 | |
| 94 | 94 | return $fields; |
@@ -15,28 +15,28 @@ |
||
| 15 | 15 | */ |
| 16 | 16 | class Listener { |
| 17 | 17 | public static function listen() { |
| 18 | - if ( ! filter_has_var( INPUT_GET, 'mollie_webhook' ) || ! filter_has_var( INPUT_POST, 'id' ) ) { |
|
| 18 | + if ( ! filter_has_var(INPUT_GET, 'mollie_webhook') || ! filter_has_var(INPUT_POST, 'id')) { |
|
| 19 | 19 | return; |
| 20 | 20 | } |
| 21 | 21 | |
| 22 | - $transaction_id = filter_input( INPUT_POST, 'id', FILTER_SANITIZE_STRING ); |
|
| 22 | + $transaction_id = filter_input(INPUT_POST, 'id', FILTER_SANITIZE_STRING); |
|
| 23 | 23 | |
| 24 | - $payment = get_pronamic_payment_by_transaction_id( $transaction_id ); |
|
| 24 | + $payment = get_pronamic_payment_by_transaction_id($transaction_id); |
|
| 25 | 25 | |
| 26 | - if ( null === $payment ) { |
|
| 26 | + if (null === $payment) { |
|
| 27 | 27 | return; |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | // Add note. |
| 31 | 31 | $note = sprintf( |
| 32 | 32 | /* translators: %s: Mollie */ |
| 33 | - __( 'Webhook requested by %s.', 'pronamic_ideal' ), |
|
| 34 | - __( 'Mollie', 'pronamic_ideal' ) |
|
| 33 | + __('Webhook requested by %s.', 'pronamic_ideal'), |
|
| 34 | + __('Mollie', 'pronamic_ideal') |
|
| 35 | 35 | ); |
| 36 | 36 | |
| 37 | - $payment->add_note( $note ); |
|
| 37 | + $payment->add_note($note); |
|
| 38 | 38 | |
| 39 | 39 | // Update payment. |
| 40 | - Plugin::update_payment( $payment, false ); |
|
| 40 | + Plugin::update_payment($payment, false); |
|
| 41 | 41 | } |
| 42 | 42 | } |
@@ -15,11 +15,11 @@ |
||
| 15 | 15 | * @since 1.0.0 |
| 16 | 16 | */ |
| 17 | 17 | class ConfigFactory extends GatewayConfigFactory { |
| 18 | - public function get_config( $post_id ) { |
|
| 18 | + public function get_config($post_id) { |
|
| 19 | 19 | $config = new Config(); |
| 20 | 20 | |
| 21 | - $config->api_key = get_post_meta( $post_id, '_pronamic_gateway_mollie_api_key', true ); |
|
| 22 | - $config->mode = get_post_meta( $post_id, '_pronamic_gateway_mode', true ); |
|
| 21 | + $config->api_key = get_post_meta($post_id, '_pronamic_gateway_mollie_api_key', true); |
|
| 22 | + $config->mode = get_post_meta($post_id, '_pronamic_gateway_mode', true); |
|
| 23 | 23 | |
| 24 | 24 | return $config; |
| 25 | 25 | } |
@@ -79,8 +79,8 @@ |
||
| 79 | 79 | * |
| 80 | 80 | * @return string|null Pay status. |
| 81 | 81 | */ |
| 82 | - public static function transform( $status ) { |
|
| 83 | - switch ( $status ) { |
|
| 82 | + public static function transform($status) { |
|
| 83 | + switch ($status) { |
|
| 84 | 84 | case self::PENDING: |
| 85 | 85 | case self::OPEN: |
| 86 | 86 | return Core_Statuses::OPEN; |