summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/jetpack/class.jetpack-heartbeat.php')
-rw-r--r--plugins/jetpack/class.jetpack-heartbeat.php13
1 files changed, 10 insertions, 3 deletions
diff --git a/plugins/jetpack/class.jetpack-heartbeat.php b/plugins/jetpack/class.jetpack-heartbeat.php
index 5af7f50a..2f337310 100644
--- a/plugins/jetpack/class.jetpack-heartbeat.php
+++ b/plugins/jetpack/class.jetpack-heartbeat.php
@@ -1,8 +1,16 @@
-<?php
+<?php // phpcs:ignore WordPress.Files.FileName.InvalidClassFileName
+/**
+ * Jetpack Heartbeat.
+ *
+ * @package automattic/jetpack
+ */
use Automattic\Jetpack\Connection\Manager;
use Automattic\Jetpack\Heartbeat;
+/**
+ * Jetpack Heartbeat.
+ */
class Jetpack_Heartbeat {
/**
@@ -41,7 +49,6 @@ class Jetpack_Heartbeat {
* Constructor for singleton
*
* @since 2.3.3
- * @return Jetpack_Heartbeat
*/
private function __construct() {
add_filter( 'jetpack_heartbeat_stats_array', array( $this, 'add_stats_to_heartbeat' ) );
@@ -103,7 +110,7 @@ class Jetpack_Heartbeat {
}
if ( ! empty( $_SERVER['SERVER_ADDR'] ) || ! empty( $_SERVER['LOCAL_ADDR'] ) ) {
- $ip = ! empty( $_SERVER['SERVER_ADDR'] ) ? $_SERVER['SERVER_ADDR'] : $_SERVER['LOCAL_ADDR'];
+ $ip = ! empty( $_SERVER['SERVER_ADDR'] ) ? wp_unslash( $_SERVER['SERVER_ADDR'] ) : wp_unslash( $_SERVER['LOCAL_ADDR'] ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- Sanitized just below.
$ip_arr = array_map( 'intval', explode( '.', $ip ) );
if ( 4 === count( $ip_arr ) ) {
$return[ "{$prefix}ip-2-octets" ] = implode( '.', array_slice( $ip_arr, 0, 2 ) );