Code Duplication    Length = 57-58 lines in 2 locations

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

@@ 328-384 (lines=57) @@
325
	 *
326
	 * @return void
327
	 */
328
	public function enqueue_idc_notice_files() {
329
		wp_enqueue_script(
330
			'jetpack-idc-js',
331
			Assets::get_file_url_for_environment( '_inc/build/idc-notice.min.js', '_inc/idc-notice.js' ),
332
			array( 'jquery' ),
333
			JETPACK__VERSION,
334
			true
335
		);
336
337
		wp_localize_script(
338
			'jetpack-idc-js',
339
			'idcL10n',
340
			array(
341
				'apiRoot'         => esc_url_raw( rest_url() ),
342
				'nonce'           => wp_create_nonce( 'wp_rest' ),
343
				'tracksUserData'  => Jetpack_Tracks_Client::get_connected_user_tracks_identity(),
344
				'currentUrl'      => remove_query_arg( '_wpnonce', remove_query_arg( 'jetpack_idc_clear_confirmation' ) ),
345
				'tracksEventData' => array(
346
					'isAdmin'       => current_user_can( 'jetpack_disconnect' ),
347
					'currentScreen' => self::$current_screen ? self::$current_screen->id : false,
348
				),
349
			)
350
		);
351
352
		if ( ! wp_style_is( 'jetpack-dops-style' ) ) {
353
			wp_register_style(
354
				'jetpack-dops-style',
355
				plugins_url( '_inc/build/admin.css', JETPACK__PLUGIN_FILE ),
356
				array(),
357
				JETPACK__VERSION
358
			);
359
		}
360
361
		wp_enqueue_style(
362
			'jetpack-idc-css',
363
			plugins_url( 'css/jetpack-idc.css', JETPACK__PLUGIN_FILE ),
364
			array( 'jetpack-dops-style' ),
365
			JETPACK__VERSION
366
		);
367
368
		// Required for Tracks.
369
		wp_enqueue_script(
370
			'jp-tracks',
371
			'//stats.wp.com/w.js',
372
			array(),
373
			gmdate( 'YW' ),
374
			true
375
		);
376
377
		wp_enqueue_script(
378
			'jp-tracks-functions',
379
			plugins_url( '_inc/lib/tracks/tracks-callables.js', JETPACK__PLUGIN_FILE ),
380
			array(),
381
			JETPACK__VERSION,
382
			false
383
		);
384
	}
385
386
	/**
387
	 * Renders the notice header.

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
		?>