Code Duplication    Length = 113-114 lines in 2 locations

modules/equal-housing/widgets/class-equal-housing-widget.php 1 location

@@ 8-120 (lines=113) @@
5
 *
6
 * @extends WP_Widget
7
 */
8
class EqualHousingWidget extends WP_Widget {
9
10
11
	/**
12
	 * __construct function.
13
	 *
14
	 * @access public
15
	 * @return void
16
	 */
17
	public function __construct() {
18
19
		parent::__construct(
20
			'equal_housing_logo',
21
			__( 'Equal Housing Opportunity', 're-pro' ),
22
			array(
23
				'description' => __( 'Display the Equal Housing Opportunity Logo.', 're-pro' ),
24
				'classname'   => 're-pro re-pro-widget equal-housing',
25
				'customize_selective_refresh' => true,
26
			)
27
		);
28
29
	}
30
31
	/**
32
	 * Display Equal Housing Widget.
33
	 *
34
	 * @access public
35
	 * @param mixed $args Arguments.
36
	 * @param mixed $instance Instance.
37
	 * @return void
38
	 */
39
	public function widget( $args, $instance ) {
40
41
		if ( ! empty( $instance['title'] ) ) {
42
			$title = $instance['title'];
43
		} else {
44
			$title = '';
45
		}
46
		$logo_size = $instance['logo_size'];
47
48
		echo $args['before_widget'];
49
50
		echo $args['before_title'] . esc_attr( $title ) . $args['after_title'];
51
52
		echo '<img src="'. esc_url( plugins_url( '../../../assets/images/equalhousing/equal_housing.svg', __FILE__ ) ) .'" alt="'. __( 'Equal Housing Opportunity', 're-pro' ) .'" height="' . $logo_size . '" width="' . $logo_size . '" class="re-pro equal-housing-opportunity">';
53
54
		echo $args['after_widget'];
55
56
	}
57
58
	/**
59
	 * Widget Form.
60
	 *
61
	 * @access public
62
	 * @param mixed $instance Instance.
63
	 * @return void
64
	 */
65
	public function form( $instance ) {
66
67
		// Set default values
68
		$instance = wp_parse_args( (array) $instance, array(
69
			'logo-size' => '32',
70
			'title' => '',
71
		) );
72
73
		// Retrieve an existing value from the database
74
		$title = ! empty( $instance['title'] ) ? $instance['title'] : '';
75
		$logo_size = ! empty( $instance['logo_size'] ) ? $instance['logo_size'] : '';
76
77
		// Form fields
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
		echo '<p>';
84
		echo '	<label for="' . $this->get_field_id( 'logo_size' ) . '" class="logo-size-label">' . __( 'Logo Size', 're-pro' ) . '</label>';
85
		echo '	<select id="' . $this->get_field_id( 'logo_size' ) . '" name="' . $this->get_field_name( 'logo_size' ) . '" class="widefat">';
86
		echo '		<option value="" ' . selected( $logo_size, '', false ) . '> ' . __( 'Choose', 're-pro' ) . '</option>';
87
		echo '		<option value="512" ' . selected( $logo_size, '512', false ) . '> ' . __( '512px', 're-pro' ) . '</option>';
88
		echo '		<option value="256" ' . selected( $logo_size, '256', false ) . '> ' . __( '256px', 're-pro' ) . '</option>';
89
		echo '		<option value="128" ' . selected( $logo_size, '128', false ) . '> ' . __( '128px', 're-pro' ) . '</option>';
90
		echo '		<option value="64" ' . selected( $logo_size, '64', false ) . '> ' . __( '64px', 're-pro' ) . '</option>';
91
		echo '		<option value="32" ' . selected( $logo_size, '32', false ) . '> ' . __( '32px', 're-pro' ) . '</option>';
92
		echo '		<option value="24" ' . selected( $logo_size, '24', false ) . '> ' . __( '24px', 're-pro' ) . '</option>';
93
		echo '		<option value="16" ' . selected( $logo_size, '16', false ) . '> ' . __( '16px', 're-pro' ) . '</option>';
94
		echo '		<option value="14" ' . selected( $logo_size, '14', false ) . '> ' . __( '14px', 're-pro' ) . '</option>';
95
		echo '	</select>';
96
		echo '	<span class="description">' . __( 'Choose the size of the logo you want to display.', 're-pro' ) . '</span>';
97
		echo '</p>';
98
99
	}
100
101
102
	/**
103
	 * Update Widget.
104
	 *
105
	 * @access public
106
	 * @param mixed $new_instance New Widget Instance.
107
	 * @param mixed $old_instance Old Widget instance.
108
	 * @return void
109
	 */
110
	public function update( $new_instance, $old_instance ) {
111
112
		$instance = $old_instance;
113
114
		$instance['title'] = ! empty( $new_instance['title'] ) ? strip_tags( $new_instance['title'] ) : '';
115
		$instance['logo_size'] = ! empty( $new_instance['logo_size'] ) ? strip_tags( $new_instance['logo_size'] ) : '';
116
117
		return $instance;
118
119
	}
120
}
121
122
123
/**

modules/realtor-com/widgets/class-realtor-widget.php 1 location

@@ 10-123 (lines=114) @@
7
 *
8
 * @extends WP_Widget
9
 */
10
class RealtorLogoWidget extends WP_Widget {
11
12
13
	/**
14
	 * __construct function.
15
	 *
16
	 * @access public
17
	 * @return void
18
	 */
19
	public function __construct() {
20
21
		parent::__construct(
22
			'realtor_logo',
23
			__( 'Realtor Logo', 're-pro' ),
24
			array(
25
				'description' => __( 'Display the Realtor Logo.', 're-pro' ),
26
				'classname'   => 're-pro realtor',
27
			)
28
		);
29
30
	}
31
32
33
	/**
34
	 * Display Realtor Logo Widget.
35
	 *
36
	 * @access public
37
	 * @param mixed $args
38
	 * @param mixed $instance
39
	 * @return void
40
	 */
41
	public function widget( $args, $instance ) {
42
43
		if ( ! empty( $instance['title'] ) ) {
44
			$title = $instance['title'];
45
		} else {
46
			$title = '';
47
		}
48
		$logo_size = $instance['logo_size'];
49
50
		echo $args['before_widget'];
51
52
		echo $args['before_title'] . esc_attr( $title ) . $args['after_title'];
53
54
		echo '<img src="'. esc_url( plugins_url( '../../assets/images/realtor/realtor.svg', __FILE__ ) ) .'" alt="'. __( 'Realtor', 're-pro' ) .'" height="' . $logo_size . '" width="' . $logo_size . '" class="re-pro realtor">';
55
56
		echo $args['after_widget'];
57
58
	}
59
60
61
	/**
62
	 * Widget Form.
63
	 *
64
	 * @access public
65
	 * @param mixed $instance
66
	 * @return void
67
	 */
68
	public function form( $instance ) {
69
70
		// Set default values
71
		$instance = wp_parse_args( (array) $instance, array(
72
			'logo-size' => '32',
73
			'title' => '',
74
		) );
75
76
		// Retrieve an existing value from the database
77
		$title = ! empty( $instance['title'] ) ? $instance['title'] : '';
78
		$logo_size = ! empty( $instance['logo_size'] ) ? $instance['logo_size'] : '';
79
80
		// Form fields
81
		echo '<p>';
82
		echo '	<label for="' . $this->get_field_id( 'title' ) . '" class="title-label">' . __( 'Tile', 're-pro' ) . '</label>';
83
		echo '	<input id="' . $this->get_field_id( 'title' ) . '" name="' . $this->get_field_name( 'title' ) . '" value="' . $title  . '" class="widefat">';
84
		echo '</p>';
85
86
		echo '<p>';
87
		echo '	<label for="' . $this->get_field_id( 'logo_size' ) . '" class="logo-size-label">' . __( 'Logo Size', 're-pro' ) . '</label>';
88
		echo '	<select id="' . $this->get_field_id( 'logo_size' ) . '" name="' . $this->get_field_name( 'logo_size' ) . '" class="widefat">';
89
		echo '		<option value="" ' . selected( $logo_size, '', false ) . '> ' . __( 'Choose', 're-pro' ) . '</option>';
90
		echo '		<option value="512" ' . selected( $logo_size, '512', false ) . '> ' . __( '512px', 're-pro' ) . '</option>';
91
		echo '		<option value="256" ' . selected( $logo_size, '256', false ) . '> ' . __( '256px', 're-pro' ) . '</option>';
92
		echo '		<option value="128" ' . selected( $logo_size, '128', false ) . '> ' . __( '128px', 're-pro' ) . '</option>';
93
		echo '		<option value="64" ' . selected( $logo_size, '64', false ) . '> ' . __( '64px', 're-pro' ) . '</option>';
94
		echo '		<option value="32" ' . selected( $logo_size, '32', false ) . '> ' . __( '32px', 're-pro' ) . '</option>';
95
		echo '		<option value="24" ' . selected( $logo_size, '24', false ) . '> ' . __( '24px', 're-pro' ) . '</option>';
96
		echo '		<option value="16" ' . selected( $logo_size, '16', false ) . '> ' . __( '16px', 're-pro' ) . '</option>';
97
		echo '		<option value="14" ' . selected( $logo_size, '14', false ) . '> ' . __( '14px', 're-pro' ) . '</option>';
98
		echo '	</select>';
99
		echo '	<span class="description">' . __( 'Choose the size of the logo you want to display.', 're-pro' ) . '</span>';
100
		echo '</p>';
101
102
	}
103
104
105
	/**
106
	 * Update Widget.
107
	 *
108
	 * @access public
109
	 * @param mixed $new_instance
110
	 * @param mixed $old_instance
111
	 * @return void
112
	 */
113
	public function update( $new_instance, $old_instance ) {
114
115
		$instance = $old_instance;
116
117
		$instance['title'] = ! empty( $new_instance['title'] ) ? strip_tags( $new_instance['title'] ) : '';
118
		$instance['logo_size'] = ! empty( $new_instance['logo_size'] ) ? strip_tags( $new_instance['logo_size'] ) : '';
119
120
		return $instance;
121
122
	}
123
}
124
125
126
/**