Code Duplication    Length = 7-8 lines in 2 locations

modules/infinite-scroll.php 1 location

@@ 143-149 (lines=7) @@
140
		// Abort if Stats module isn't active
141
		if ( in_array( 'stats', Jetpack::get_active_modules() ) ) {
142
			// Abort if user is logged in but logged-in users shouldn't be tracked.
143
			if ( is_user_logged_in() && function_exists( 'stats_get_options' ) ) {
144
				$stats_options = stats_get_options();
145
				$track_loggedin_users = isset( $stats_options['reg_users'] ) ? (bool) $stats_options['reg_users'] : false;
146
147
				if ( ! $track_loggedin_users )
148
					return $settings;
149
			}
150
151
			// We made it this far, so gather the data needed to track IS views
152
			$settings['stats'] = 'blog=' . Jetpack_Options::get_option( 'id' ) . '&host=' . wp_parse_url( get_option( 'home' ), PHP_URL_HOST ) . '&v=ext&j=' . JETPACK__API_VERSION . ':' . JETPACK__VERSION;

modules/carousel/jetpack-carousel.php 1 location

@@ 323-330 (lines=8) @@
320
				$localize_strings['stats'] = 'blog=' . Jetpack_Options::get_option( 'id' ) . '&host=' . wp_parse_url( get_option( 'home' ), PHP_URL_HOST ) . '&v=ext&j=' . JETPACK__API_VERSION . ':' . JETPACK__VERSION;
321
322
				// Set the stats as empty if user is logged in but logged-in users shouldn't be tracked.
323
				if ( is_user_logged_in() && function_exists( 'stats_get_options' ) ) {
324
					$stats_options        = stats_get_options();
325
					$track_loggedin_users = isset( $stats_options['reg_users'] ) ? (bool) $stats_options['reg_users'] : false;
326
327
					if ( ! $track_loggedin_users ) {
328
						$localize_strings['stats'] = '';
329
					}
330
				}
331
			}
332
333
			/**