From 29c1c72fc3b6c6e3ec9a4532ab1508eae0232c49 Mon Sep 17 00:00:00 2001 From: Lucas Simeon Date: Wed, 10 Aug 2022 17:43:52 +0200 Subject: [PATCH] Fix code style --- .../studiometa-maintenance-mode.php | 76 +++++++++---------- 1 file changed, 38 insertions(+), 38 deletions(-) diff --git a/template/web/wp-content/mu-plugins/studiometa-maintenance-mode/studiometa-maintenance-mode.php b/template/web/wp-content/mu-plugins/studiometa-maintenance-mode/studiometa-maintenance-mode.php index 77b76f0..6c1bb6d 100644 --- a/template/web/wp-content/mu-plugins/studiometa-maintenance-mode/studiometa-maintenance-mode.php +++ b/template/web/wp-content/mu-plugins/studiometa-maintenance-mode/studiometa-maintenance-mode.php @@ -30,51 +30,51 @@ public function toggle_maintenance() { $protocol = isset( $_SERVER['SERVER_PROTOCOL'] ) && 'HTTP/1.1' === $_SERVER['SERVER_PROTOCOL'] ? 'HTTP/1.1' : 'HTTP/1.0'; header( $protocol . ' 503 Service Unavailable', true, 503 ); - require_once WP_CONTENT_DIR . '/maintenance.php'; - die(); - } + require_once WP_CONTENT_DIR . '/maintenance.php'; + die(); + } - require_once ABSPATH . WPINC . '/functions.php'; - wp_load_translations_early(); + require_once ABSPATH . WPINC . '/functions.php'; + wp_load_translations_early(); - wp_die( - __( 'Briefly unavailable for scheduled maintenance. Check back in a minute.' ), - __( 'Maintenance' ), - 503 - ); + wp_die( + __( 'Briefly unavailable for scheduled maintenance. Check back in a minute.' ), + __( 'Maintenance' ), + 503 + ); } - /** - * Get the server variable REMOTE_ADDR, or the first ip of HTTP_X_FORWARDED_FOR (when using proxy). - * - * @return string $remote_addr ip of client - */ - private static function get_remote_addr() - { - if (function_exists('apache_request_headers')) { - $headers = apache_request_headers(); - } else { - $headers = $_SERVER; - } + /** + * Get the server variable REMOTE_ADDR, or the first ip of HTTP_X_FORWARDED_FOR (when using proxy). + * + * @return string $remote_addr ip of client + */ + private static function get_remote_addr() + { + if (function_exists('apache_request_headers')) { + $headers = apache_request_headers(); + } else { + $headers = $_SERVER; + } - if (array_key_exists('X-Forwarded-For', $headers)) { - $_SERVER['HTTP_X_FORWARDED_FOR'] = $headers['X-Forwarded-For']; - } + if (array_key_exists('X-Forwarded-For', $headers)) { + $_SERVER['HTTP_X_FORWARDED_FOR'] = $headers['X-Forwarded-For']; + } - if (isset($_SERVER['HTTP_X_FORWARDED_FOR']) && $_SERVER['HTTP_X_FORWARDED_FOR'] && (!isset($_SERVER['REMOTE_ADDR']) - || preg_match('/^127\..*/i', trim($_SERVER['REMOTE_ADDR'])) || preg_match('/^172\.16.*/i', trim($_SERVER['REMOTE_ADDR'])) - || preg_match('/^192\.168\.*/i', trim($_SERVER['REMOTE_ADDR'])) || preg_match('/^10\..*/i', trim($_SERVER['REMOTE_ADDR'])))) { - if (strpos($_SERVER['HTTP_X_FORWARDED_FOR'], ',')) { - $ips = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']); + if (isset($_SERVER['HTTP_X_FORWARDED_FOR']) && $_SERVER['HTTP_X_FORWARDED_FOR'] && (!isset($_SERVER['REMOTE_ADDR']) + || preg_match('/^127\..*/i', trim($_SERVER['REMOTE_ADDR'])) || preg_match('/^172\.16.*/i', trim($_SERVER['REMOTE_ADDR'])) + || preg_match('/^192\.168\.*/i', trim($_SERVER['REMOTE_ADDR'])) || preg_match('/^10\..*/i', trim($_SERVER['REMOTE_ADDR'])))) { + if (strpos($_SERVER['HTTP_X_FORWARDED_FOR'], ',')) { + $ips = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']); - return $ips[0]; - } else { - return $_SERVER['HTTP_X_FORWARDED_FOR']; - } - } else { - return $_SERVER['REMOTE_ADDR']; - } - } + return $ips[0]; + } else { + return $_SERVER['HTTP_X_FORWARDED_FOR']; + } + } else { + return $_SERVER['REMOTE_ADDR']; + } + } /** * Is maintenance?