Code Duplication    Length = 57-58 lines in 2 locations

projects/plugins/jetpack/class.jetpack-idc.php 1 location

@@ 264-321 (lines=58) @@
261
	/**
262
	 * Enqueue scripts for the notice
263
	 */
264
	function enqueue_idc_notice_files() {
265
266
		wp_enqueue_script(
267
			'jetpack-idc-js',
268
			Assets::get_file_url_for_environment( '_inc/build/idc-notice.min.js', '_inc/idc-notice.js' ),
269
			array( 'jquery' ),
270
			JETPACK__VERSION,
271
			true
272
		);
273
274
		wp_localize_script(
275
			'jetpack-idc-js',
276
			'idcL10n',
277
			array(
278
				'apiRoot'         => esc_url_raw( rest_url() ),
279
				'nonce'           => wp_create_nonce( 'wp_rest' ),
280
				'tracksUserData'  => Jetpack_Tracks_Client::get_connected_user_tracks_identity(),
281
				'currentUrl'      => remove_query_arg( '_wpnonce', remove_query_arg( 'jetpack_idc_clear_confirmation' ) ),
282
				'tracksEventData' => array(
283
					'isAdmin'       => current_user_can( 'jetpack_disconnect' ),
284
					'currentScreen' => self::$current_screen ? self::$current_screen->id : false,
285
				),
286
			)
287
		);
288
289
		if ( ! wp_style_is( 'jetpack-dops-style' ) ) {
290
			wp_register_style(
291
				'jetpack-dops-style',
292
				plugins_url( '_inc/build/admin.css', JETPACK__PLUGIN_FILE ),
293
				array(),
294
				JETPACK__VERSION
295
			);
296
		}
297
298
		wp_enqueue_style(
299
			'jetpack-idc-css',
300
			plugins_url( 'css/jetpack-idc.css', JETPACK__PLUGIN_FILE ),
301
			array( 'jetpack-dops-style' ),
302
			JETPACK__VERSION
303
		);
304
305
		// Required for Tracks
306
		wp_enqueue_script(
307
			'jp-tracks',
308
			'//stats.wp.com/w.js',
309
			array(),
310
			gmdate( 'YW' ),
311
			true
312
		);
313
314
		wp_enqueue_script(
315
			'jp-tracks-functions',
316
			plugins_url( '_inc/lib/tracks/tracks-callables.js', JETPACK__PLUGIN_FILE ),
317
			array(),
318
			JETPACK__VERSION,
319
			false
320
		);
321
	}
322
323
	function render_notice_header() {
324
		?>

projects/packages/identity-crisis/src/class-identity-crisis.php 1 location

@@ 497-553 (lines=57) @@
494
	 *
495
	 * @return void
496
	 */
497
	public function enqueue_idc_notice_files() {
498
		wp_enqueue_script(
499
			'jetpack-idc-js',
500
			Assets::get_file_url_for_environment( '_inc/build/idc-notice.min.js', '_inc/idc-notice.js' ),
501
			array( 'jquery' ),
502
			JETPACK__VERSION,
503
			true
504
		);
505
506
		wp_localize_script(
507
			'jetpack-idc-js',
508
			'idcL10n',
509
			array(
510
				'apiRoot'         => esc_url_raw( rest_url() ),
511
				'nonce'           => wp_create_nonce( 'wp_rest' ),
512
				'tracksUserData'  => Jetpack_Tracks_Client::get_connected_user_tracks_identity(),
513
				'currentUrl'      => remove_query_arg( '_wpnonce', remove_query_arg( 'jetpack_idc_clear_confirmation' ) ),
514
				'tracksEventData' => array(
515
					'isAdmin'       => current_user_can( 'jetpack_disconnect' ),
516
					'currentScreen' => self::$current_screen ? self::$current_screen->id : false,
517
				),
518
			)
519
		);
520
521
		if ( ! wp_style_is( 'jetpack-dops-style' ) ) {
522
			wp_register_style(
523
				'jetpack-dops-style',
524
				plugins_url( '_inc/build/admin.css', JETPACK__PLUGIN_FILE ),
525
				array(),
526
				JETPACK__VERSION
527
			);
528
		}
529
530
		wp_enqueue_style(
531
			'jetpack-idc-css',
532
			plugins_url( 'css/jetpack-idc.css', JETPACK__PLUGIN_FILE ),
533
			array( 'jetpack-dops-style' ),
534
			JETPACK__VERSION
535
		);
536
537
		// Required for Tracks.
538
		wp_enqueue_script(
539
			'jp-tracks',
540
			'//stats.wp.com/w.js',
541
			array(),
542
			gmdate( 'YW' ),
543
			true
544
		);
545
546
		wp_enqueue_script(
547
			'jp-tracks-functions',
548
			plugins_url( '_inc/lib/tracks/tracks-callables.js', JETPACK__PLUGIN_FILE ),
549
			array(),
550
			JETPACK__VERSION,
551
			false
552
		);
553
	}
554
555
	/**
556
	 * Renders the notice header.