@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 2 | +if ( ! defined('ABSPATH')) { |
|
| 3 | 3 | exit; // Exit if accessed directly |
| 4 | 4 | } |
| 5 | 5 | |
@@ -20,32 +20,32 @@ discard block |
||
| 20 | 20 | * @since 4.0.0 |
| 21 | 21 | * @version 4.0.0 |
| 22 | 22 | */ |
| 23 | - public static function log( $message, $start_time = null, $end_time = null ) { |
|
| 24 | - if ( ! class_exists( 'WC_Logger' ) ) { |
|
| 23 | + public static function log($message, $start_time = null, $end_time = null) { |
|
| 24 | + if ( ! class_exists('WC_Logger')) { |
|
| 25 | 25 | return; |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | - if ( apply_filters( 'wc_stripe_logging', true, $message ) ) { |
|
| 29 | - if ( empty( self::$logger ) ) { |
|
| 30 | - if ( version_compare( WC_VERSION, '3.0.0', '>=' ) ) { |
|
| 28 | + if (apply_filters('wc_stripe_logging', true, $message)) { |
|
| 29 | + if (empty(self::$logger)) { |
|
| 30 | + if (version_compare(WC_VERSION, '3.0.0', '>=')) { |
|
| 31 | 31 | self::$logger = wc_get_logger(); |
| 32 | 32 | } else { |
| 33 | 33 | self::$logger = new WC_Logger(); |
| 34 | 34 | } |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | - $settings = get_option( 'woocommerce_stripe_settings' ); |
|
| 37 | + $settings = get_option('woocommerce_stripe_settings'); |
|
| 38 | 38 | |
| 39 | - if ( empty( $settings ) || isset( $settings['logging'] ) && 'yes' !== $settings['logging'] ) { |
|
| 39 | + if (empty($settings) || isset($settings['logging']) && 'yes' !== $settings['logging']) { |
|
| 40 | 40 | return; |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | - if ( ! is_null( $start_time ) ) { |
|
| 43 | + if ( ! is_null($start_time)) { |
|
| 44 | 44 | |
| 45 | - $formatted_start_time = date_i18n( get_option( 'date_format' ) . ' g:ia', $start_time ); |
|
| 46 | - $end_time = is_null( $end_time ) ? current_time( 'timestamp' ) : $end_time; |
|
| 47 | - $formatted_end_time = date_i18n( get_option( 'date_format' ) . ' g:ia', $end_time ); |
|
| 48 | - $elapsed_time = round( abs( $end_time - $start_time ) / 60, 2 ); |
|
| 45 | + $formatted_start_time = date_i18n(get_option('date_format') . ' g:ia', $start_time); |
|
| 46 | + $end_time = is_null($end_time) ? current_time('timestamp') : $end_time; |
|
| 47 | + $formatted_end_time = date_i18n(get_option('date_format') . ' g:ia', $end_time); |
|
| 48 | + $elapsed_time = round(abs($end_time - $start_time) / 60, 2); |
|
| 49 | 49 | |
| 50 | 50 | $log_entry = "\n" . '====Stripe Version: ' . WC_STRIPE_VERSION . '====' . "\n"; |
| 51 | 51 | $log_entry .= '====Start Log ' . $formatted_start_time . '====' . "\n" . $message . "\n"; |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | - self::$logger->add( self::WC_LOG_FILENAME, $log_entry ); |
|
| 60 | + self::$logger->add(self::WC_LOG_FILENAME, $log_entry); |
|
| 61 | 61 | } |
| 62 | 62 | } |
| 63 | 63 | } |