Code Duplication    Length = 86-89 lines in 4 locations

modules/homefinder/widgets/class-foreclosure-homes-widget.php 1 location

@@ 16-101 (lines=86) @@
13
 *
14
 * @extends WP_Widget
15
 */
16
class HomeFinderForeclosureHomes extends WP_Widget {
17
18
	/**
19
	 * __construct function.
20
	 *
21
	 * @access public
22
	 * @return void
23
	 */
24
	public function __construct() {
25
26
		parent::__construct(
27
			'homefinder_forclosure_homes',
28
			__( 'HomeFinder Foreclosure Homes', 're-pro' ),
29
			array(
30
				'description' => __( 'Display a forclosures search box from HomeFinder.com', 're-pro' ),
31
				'classname'   => 're-pro re-pro-widget homefinder-widget homefinder-foreclosure-homes',
32
				'customize_selective_refresh' => true,
33
			)
34
		);
35
	}
36
37
	/**
38
	 * Widget function.
39
	 *
40
	 * @access public
41
	 * @param mixed $args Arguments.
42
	 * @param mixed $instance Instance.
43
	 */
44
	public function widget( $args, $instance ) {
45
46
		$widget_id = ! empty( $args['widget_id'] ) ? $args['widget_id'] : '';
47
		$title = ! empty( $instance['title'] ) ? $instance['title'] : '';
48
49
		echo $args['before_widget'];
50
51
		echo $args['before_title'] . esc_attr( $title ) . $args['after_title'];
52
53
		$homefinder_widgets = new HomeFinderWidgets();
54
55
		$homefinder_widgets->get_foreclosure_homes_widget();
56
57
		echo $args['after_widget'];
58
	}
59
60
	/**
61
	 * Form function.
62
	 *
63
	 * @access public
64
	 * @param mixed $instance Instance.
65
	 * @return void
66
	 */
67
	public function form( $instance ) {
68
69
		// Set default values.
70
		$instance = wp_parse_args( (array) $instance, array(
71
			'title' => '',
72
		) );
73
74
		// Retrieve an existing value from the database.
75
		$title = ! empty( $instance['title'] ) ? $instance['title'] : '';
76
77
		// Title.
78
		echo '<p>';
79
		echo '	<label for="' . $this->get_field_id( 'title' ) . '" class="title-label">' . __( 'Tile:', 're-pro' ) . '</label>';
80
		echo '	<input id="' . $this->get_field_id( 'title' ) . '" name="' . $this->get_field_name( 'title' ) . '" value="' . $title  . '" class="widefat">';
81
		echo '</p>';
82
83
	}
84
85
	/**
86
	 * Update Widget Instance.
87
	 *
88
	 * @access public
89
	 * @param mixed $new_instance New Instance.
90
	 * @param mixed $old_instance Old Instance.
91
	 * @return $instance
92
	 */
93
	public function update( $new_instance, $old_instance ) {
94
95
		$instance = $old_instance;
96
97
		$instance['title'] = ! empty( $new_instance['title'] ) ? strip_tags( $new_instance['title'] ) : '';
98
99
		return $instance;
100
	}
101
}
102
103
/**
104
 * Register HomeFinder.com Foreclosure Homes Widget.

modules/homefinder/widgets/class-homes-for-sale-widget.php 1 location

@@ 16-101 (lines=86) @@
13
 *
14
 * @extends WP_Widget
15
 */
16
class HomeFinderHomesForSale extends WP_Widget {
17
18
	/**
19
	 * __construct function.
20
	 *
21
	 * @access public
22
	 * @return void
23
	 */
24
	public function __construct() {
25
26
		parent::__construct(
27
			'homefinder_homes_for_sale',
28
			__( 'HomeFinder Homes for Sale', 're-pro' ),
29
			array(
30
				'description' => __( 'Display a search box from HomeFinder.com', 're-pro' ),
31
				'classname'   => 're-pro re-pro-widget homefinder-widget homefinder-homes-for-sale',
32
				'customize_selective_refresh' => true,
33
			)
34
		);
35
	}
36
37
	/**
38
	 * Widget function.
39
	 *
40
	 * @access public
41
	 * @param mixed $args Arguments.
42
	 * @param mixed $instance Instance.
43
	 */
44
	public function widget( $args, $instance ) {
45
46
		$widget_id = ! empty( $args['widget_id'] ) ? $args['widget_id'] : '';
47
		$title = ! empty( $instance['title'] ) ? $instance['title'] : '';
48
49
		echo $args['before_widget'];
50
51
		echo $args['before_title'] . esc_attr( $title ) . $args['after_title'];
52
53
		$homefinder_widgets = new HomeFinderWidgets();
54
55
		$homefinder_widgets->get_homes_for_sale_widget();
56
57
		echo $args['after_widget'];
58
	}
59
60
	/**
61
	 * Form function.
62
	 *
63
	 * @access public
64
	 * @param mixed $instance Instance.
65
	 * @return void
66
	 */
67
	public function form( $instance ) {
68
69
		// Set default values.
70
		$instance = wp_parse_args( (array) $instance, array(
71
			'title' => '',
72
		) );
73
74
		// Retrieve an existing value from the database.
75
		$title = ! empty( $instance['title'] ) ? $instance['title'] : '';
76
77
		// Title.
78
		echo '<p>';
79
		echo '	<label for="' . $this->get_field_id( 'title' ) . '" class="title-label">' . __( 'Tile:', 're-pro' ) . '</label>';
80
		echo '	<input id="' . $this->get_field_id( 'title' ) . '" name="' . $this->get_field_name( 'title' ) . '" value="' . $title  . '" class="widefat">';
81
		echo '</p>';
82
83
	}
84
85
	/**
86
	 * Update Widget Instance.
87
	 *
88
	 * @access public
89
	 * @param mixed $new_instance New Instance.
90
	 * @param mixed $old_instance Old Instance.
91
	 * @return $instance
92
	 */
93
	public function update( $new_instance, $old_instance ) {
94
95
		$instance = $old_instance;
96
97
		$instance['title'] = ! empty( $new_instance['title'] ) ? strip_tags( $new_instance['title'] ) : '';
98
99
		return $instance;
100
	}
101
}
102
103
/**
104
 * Register HomeFinder.com Homes for Sale Widget.

modules/homefinder/widgets/class-open-house-widget.php 1 location

@@ 16-101 (lines=86) @@
13
 *
14
 * @extends WP_Widget
15
 */
16
class HomeFinderOpenHouse extends WP_Widget {
17
18
	/**
19
	 * __construct function.
20
	 *
21
	 * @access public
22
	 * @return void
23
	 */
24
	public function __construct() {
25
26
		parent::__construct(
27
			'homefinder_open_house',
28
			__( 'HomeFinder Open House', 're-pro' ),
29
			array(
30
				'description' => __( 'Display a open house search box from HomeFinder.com', 're-pro' ),
31
				'classname'   => 're-pro re-pro-widget homefinder-widget homefinder-open-house',
32
				'customize_selective_refresh' => true,
33
			)
34
		);
35
	}
36
37
	/**
38
	 * Widget function.
39
	 *
40
	 * @access public
41
	 * @param mixed $args Arguments.
42
	 * @param mixed $instance Instance.
43
	 */
44
	public function widget( $args, $instance ) {
45
46
		$widget_id = ! empty( $args['widget_id'] ) ? $args['widget_id'] : '';
47
		$title = ! empty( $instance['title'] ) ? $instance['title'] : '';
48
49
		echo $args['before_widget'];
50
51
		echo $args['before_title'] . esc_attr( $title ) . $args['after_title'];
52
53
		$homefinder_widgets = new HomeFinderWidgets();
54
55
		$homefinder_widgets->get_open_house_widget();
56
57
		echo $args['after_widget'];
58
	}
59
60
	/**
61
	 * Form function.
62
	 *
63
	 * @access public
64
	 * @param mixed $instance Instance.
65
	 * @return void
66
	 */
67
	public function form( $instance ) {
68
69
		// Set default values.
70
		$instance = wp_parse_args( (array) $instance, array(
71
			'title' => '',
72
		) );
73
74
		// Retrieve an existing value from the database.
75
		$title = ! empty( $instance['title'] ) ? $instance['title'] : '';
76
77
		// Title.
78
		echo '<p>';
79
		echo '	<label for="' . $this->get_field_id( 'title' ) . '" class="title-label">' . __( 'Tile:', 're-pro' ) . '</label>';
80
		echo '	<input id="' . $this->get_field_id( 'title' ) . '" name="' . $this->get_field_name( 'title' ) . '" value="' . $title  . '" class="widefat">';
81
		echo '</p>';
82
83
	}
84
85
	/**
86
	 * Update Widget Instance.
87
	 *
88
	 * @access public
89
	 * @param mixed $new_instance New Instance.
90
	 * @param mixed $old_instance Old Instance.
91
	 * @return $instance
92
	 */
93
	public function update( $new_instance, $old_instance ) {
94
95
		$instance = $old_instance;
96
97
		$instance['title'] = ! empty( $new_instance['title'] ) ? strip_tags( $new_instance['title'] ) : '';
98
99
		return $instance;
100
	}
101
}
102
103
/**
104
 * Register HomeFinder.com Open House Widget.

modules/zillow/widgets/class-mortgage-rate-table-widget.php 1 location

@@ 17-105 (lines=89) @@
14
 *
15
 * @extends WP_Widget
16
 */
17
class ZillowLargeRateTableWidget extends WP_Widget {
18
19
20
	/**
21
	 * __construct function.
22
	 *
23
	 * @access public
24
	 * @return void
25
	 */
26
	public function __construct() {
27
28
		parent::__construct(
29
			'zillow_lg_ratetable_widget',
30
			__( 'Zillow Large Mortgage Rate Table', 're-pro' ),
31
			array(
32
				'description' => __( 'Display a large Mortgage Rate Table from Zillow.', 're-pro' ),
33
				'classname'   => 're-pro re-pro-widget zillow-widget zillow-widget-lg-rate-table',
34
				'customize_selective_refresh' => true,
35
			)
36
		);
37
	}
38
39
	/**
40
	 * Widget function.
41
	 *
42
	 * @access public
43
	 * @param mixed $args Arguments.
44
	 * @param mixed $instance Instance.
45
	 * @return void
46
	 */
47
	public function widget( $args, $instance ) {
48
49
		$iframe_id = ! empty( $args['widget_id'] ) ? $args['widget_id'] : '';
50
		$title = ! empty( $instance['title'] ) ? $instance['title'] : '';
51
52
53
		echo $args['before_widget'];
54
55
		echo $args['before_title'] . esc_attr( $title ) . $args['after_title'];
56
57
		$zillow_widgets = new ZillowWidgets();
58
59
		return $zillow_widgets->get_mortage_rate_widget( $iframe_id );
60
61
		echo $args['after_widget'];
62
	}
63
64
	/**
65
	 * Form function.
66
	 *
67
	 * @access public
68
	 * @param mixed $instance Instance.
69
	 * @return void
70
	 */
71
	public function form( $instance ) {
72
73
		// Set default values.
74
		$instance = wp_parse_args( (array) $instance, array(
75
			'title' => '',
76
		));
77
78
		// Retrieve an existing value from the database.
79
		$title = ! empty( $instance['title'] ) ? $instance['title'] : '';
80
81
		// Title.
82
		echo '<p>';
83
		echo '	<label for="' . $this->get_field_id( 'title' ) . '" class="title-label">' . __( 'Tile:', 're-pro' ) . '</label>';
84
		echo '	<input id="' . $this->get_field_id( 'title' ) . '" name="' . $this->get_field_name( 'title' ) . '" value="' . $title  . '" class="widefat">';
85
		echo '</p>';
86
87
	}
88
89
	/**
90
	 * Update Widget Instance.
91
	 *
92
	 * @access public
93
	 * @param mixed $new_instance New Instance.
94
	 * @param mixed $old_instance Old Instance.
95
	 * @return $instance
96
	 */
97
	public function update( $new_instance, $old_instance ) {
98
99
		$instance = $old_instance;
100
101
		$instance['title'] = ! empty( $new_instance['title'] ) ? strip_tags( $new_instance['title'] ) : '';
102
103
		return $instance;
104
	}
105
}
106
107
/**
108
 * Register Zillow Affordability Calculator Widget.