Code Duplication    Length = 11-13 lines in 7 locations

src/wp-admin/includes/plugin-install.php 1 location

@@ 157-167 (lines=11) @@
154
		);
155
		$request = wp_remote_post( $url, $http_args );
156
157
		if ( $ssl && is_wp_error( $request ) ) {
158
			trigger_error(
159
				sprintf(
160
					/* translators: %s: support forums URL */
161
					__( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="%s">support forums</a>.' ),
162
					__( 'https://wordpress.org/support/' )
163
				) . ' ' . __( '(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)' ),
164
				headers_sent() || WP_DEBUG ? E_USER_WARNING : E_USER_NOTICE
165
			);
166
			$request = wp_remote_post( $http_url, $http_args );
167
		}
168
169
		if ( is_wp_error($request) ) {
170
			$res = new WP_Error( 'plugins_api_failed',

src/wp-admin/includes/theme.php 1 location

@@ 463-475 (lines=13) @@
460
		);
461
		$request = wp_remote_post( $url, $http_args );
462
463
		if ( $ssl && is_wp_error( $request ) ) {
464
			if ( ! wp_doing_ajax() ) {
465
				trigger_error(
466
					sprintf(
467
						/* translators: %s: support forums URL */
468
						__( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="%s">support forums</a>.' ),
469
						__( 'https://wordpress.org/support/' )
470
					) . ' ' . __( '(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)' ),
471
					headers_sent() || WP_DEBUG ? E_USER_WARNING : E_USER_NOTICE
472
				);
473
			}
474
			$request = wp_remote_post( $http_url, $http_args );
475
		}
476
477
		if ( is_wp_error($request) ) {
478
			$res = new WP_Error( 'themes_api_failed',

src/wp-admin/includes/translation-install.php 1 location

@@ 58-69 (lines=12) @@
55
56
		$request = wp_remote_post( $url, $options );
57
58
		if ( $ssl && is_wp_error( $request ) ) {
59
			trigger_error(
60
				sprintf(
61
					/* translators: %s: support forums URL */
62
					__( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="%s">support forums</a>.' ),
63
					__( 'https://wordpress.org/support/' )
64
				) . ' ' . __( '(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)' ),
65
				headers_sent() || WP_DEBUG ? E_USER_WARNING : E_USER_NOTICE
66
			);
67
68
			$request = wp_remote_post( $http_url, $options );
69
		}
70
71
		if ( is_wp_error( $request ) ) {
72
			$res = new WP_Error( 'translations_api_failed',

src/wp-admin/includes/update.php 1 location

@@ 114-124 (lines=11) @@
111
	);
112
113
	$response = wp_remote_get( $url, $options );
114
	if ( $ssl && is_wp_error( $response ) ) {
115
		trigger_error(
116
			sprintf(
117
				/* translators: %s: support forums URL */
118
				__( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="%s">support forums</a>.' ),
119
				__( 'https://wordpress.org/support/' )
120
			) . ' ' . __( '(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)' ),
121
			headers_sent() || WP_DEBUG ? E_USER_WARNING : E_USER_NOTICE
122
		);
123
		$response = wp_remote_get( $http_url, $options );
124
	}
125
126
	if ( is_wp_error( $response ) || 200 != wp_remote_retrieve_response_code( $response ) )
127
		return false;

src/wp-includes/update.php 3 locations

@@ 124-134 (lines=11) @@
121
	);
122
123
	$response = wp_remote_post( $url, $options );
124
	if ( $ssl && is_wp_error( $response ) ) {
125
		trigger_error(
126
			sprintf(
127
				/* translators: %s: support forums URL */
128
				__( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="%s">support forums</a>.' ),
129
				__( 'https://wordpress.org/support/' )
130
			) . ' ' . __( '(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)' ),
131
			headers_sent() || WP_DEBUG ? E_USER_WARNING : E_USER_NOTICE
132
		);
133
		$response = wp_remote_post( $http_url, $options );
134
	}
135
136
	if ( is_wp_error( $response ) || 200 != wp_remote_retrieve_response_code( $response ) ) {
137
		return;
@@ 316-326 (lines=11) @@
313
		$url = set_url_scheme( $url, 'https' );
314
315
	$raw_response = wp_remote_post( $url, $options );
316
	if ( $ssl && is_wp_error( $raw_response ) ) {
317
		trigger_error(
318
			sprintf(
319
				/* translators: %s: support forums URL */
320
				__( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="%s">support forums</a>.' ),
321
				__( 'https://wordpress.org/support/' )
322
			) . ' ' . __( '(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)' ),
323
			headers_sent() || WP_DEBUG ? E_USER_WARNING : E_USER_NOTICE
324
		);
325
		$raw_response = wp_remote_post( $http_url, $options );
326
	}
327
328
	if ( is_wp_error( $raw_response ) || 200 != wp_remote_retrieve_response_code( $raw_response ) ) {
329
		return;
@@ 494-504 (lines=11) @@
491
		$url = set_url_scheme( $url, 'https' );
492
493
	$raw_response = wp_remote_post( $url, $options );
494
	if ( $ssl && is_wp_error( $raw_response ) ) {
495
		trigger_error(
496
			sprintf(
497
				/* translators: %s: support forums URL */
498
				__( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="%s">support forums</a>.' ),
499
				__( 'https://wordpress.org/support/' )
500
			) . ' ' . __( '(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)' ),
501
			headers_sent() || WP_DEBUG ? E_USER_WARNING : E_USER_NOTICE
502
		);
503
		$raw_response = wp_remote_post( $http_url, $options );
504
	}
505
506
	if ( is_wp_error( $raw_response ) || 200 != wp_remote_retrieve_response_code( $raw_response ) ) {
507
		return;