Code Duplication    Length = 14-18 lines in 3 locations

modules/widgets/wordpress-post-widget/class.jetpack-display-posts-widget-base.php 1 location

@@ 26-41 (lines=16) @@
23
	 */
24
	public $service_url = 'https://public-api.wordpress.com/rest/v1.1/';
25
26
	public function __construct() {
27
		parent::__construct(
28
		// internal id
29
			'jetpack_display_posts_widget',
30
			/** This filter is documented in modules/widgets/facebook-likebox.php */
31
			apply_filters( 'jetpack_widget_name', __( 'Display WordPress Posts', 'jetpack' ) ),
32
			array(
33
				'description' => __( 'Displays a list of recent posts from another WordPress.com or Jetpack-enabled blog.', 'jetpack' ),
34
				'customize_selective_refresh' => true,
35
			)
36
		);
37
38
		if ( is_customize_preview() ) {
39
			add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
40
		}
41
	}
42
43
	/**
44
	 * Enqueue CSS and JavaScript.

modules/widgets/google-translate.php 1 location

@@ 31-44 (lines=14) @@
28
	/**
29
	 * Register widget with WordPress.
30
	 */
31
	function __construct() {
32
		parent::__construct(
33
			'google_translate_widget',
34
			/** This filter is documented in modules/widgets/facebook-likebox.php */
35
			apply_filters( 'jetpack_widget_name', __( 'Google Translate', 'jetpack' ) ),
36
			array(
37
				'description'                 => __( 'Provide your readers with the option to translate your site into their preferred language.', 'jetpack' ),
38
				'customize_selective_refresh' => true,
39
			)
40
		);
41
		add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
42
43
		$this->default_title = esc_html__( 'Translate', 'jetpack' );
44
	}
45
46
	/**
47
	 * Enqueue frontend JS scripts.

modules/widgets/contact-info.php 1 location

@@ 24-41 (lines=18) @@
21
		/**
22
		 * Constructor
23
		 */
24
		function __construct() {
25
			$widget_ops = array(
26
				'classname'                   => 'widget_contact_info',
27
				'description'                 => __( 'Display a map with your location, hours, and contact information.', 'jetpack' ),
28
				'customize_selective_refresh' => true,
29
			);
30
			parent::__construct(
31
				'widget_contact_info',
32
				/** This filter is documented in modules/widgets/facebook-likebox.php */
33
				apply_filters( 'jetpack_widget_name', __( 'Contact Info & Map', 'jetpack' ) ),
34
				$widget_ops
35
			);
36
			$this->alt_option_name = 'widget_contact_info';
37
38
			if ( is_customize_preview() ) {
39
				add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
40
			}
41
		}
42
43
		/**
44
		 * Enqueue scripts and styles.