Code Duplication    Length = 5-7 lines in 3 locations

functions.opengraph.php 1 location

@@ 185-189 (lines=5) @@
182
		$_locale = get_locale();
183
184
		// We have to account for w.org vs WP.com locale divergence
185
		if ( defined( 'IS_WPCOM' ) && IS_WPCOM ) {
186
			$gp_locale = GP_Locales::by_field( 'slug', $_locale );
187
		} else {
188
			$gp_locale = GP_Locales::by_field( 'wp_locale', $_locale );
189
		}
190
	}
191
192
	if ( isset( $gp_locale->facebook_locale ) && ! empty( $gp_locale->facebook_locale ) ) {

modules/widgets/facebook-likebox.php 1 location

@@ 286-292 (lines=7) @@
283
			require JETPACK__GLOTPRESS_LOCALES_PATH;
284
		}
285
286
		if ( defined( 'IS_WPCOM' ) && IS_WPCOM ) {
287
			// WP.com: get_locale() returns 'it'
288
			$locale = GP_Locales::by_slug( $lang );
289
		} else {
290
			// Jetpack: get_locale() returns 'it_IT';
291
			$locale = GP_Locales::by_field( 'facebook_locale', $lang );
292
		}
293
294
		if ( ! $locale || empty( $locale->facebook_locale ) ) {
295
			return 'en_US'; // Facebook requires a locale when pulling their SDK.

modules/sharedaddy/sharing-sources.php 1 location

@@ 881-887 (lines=7) @@
878
			require JETPACK__GLOTPRESS_LOCALES_PATH;
879
		}
880
881
		if ( defined( 'IS_WPCOM' ) && IS_WPCOM ) {
882
			// WP.com: get_locale() returns 'it'
883
			$locale = GP_Locales::by_slug( $lang );
884
		} else {
885
			// Jetpack: get_locale() returns 'it_IT';
886
			$locale = GP_Locales::by_field( 'wp_locale', $lang );
887
		}
888
889
		if ( ! $locale ) {
890
			return false;