TruliaWidgets::get_rental_market_widget()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 5
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
1
<?php
0 ignored issues
show
Coding Style Compatibility introduced by
For compatibility and reusability of your code, PSR1 recommends that a file should introduce either new symbols (like classes, functions, etc.) or have side-effects (like outputting something, or including other files), but not both at the same time. The first symbol is defined on line 11 and the first side effect is on line 4.

The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.

The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.

To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.

Loading history...
2
3
/* Exit if accessed directly. */
4
if ( ! defined( 'ABSPATH' ) ) { exit; }
5
6
if ( ! class_exists( 'TruliaWidgets' ) ) {
7
8
	/**
9
	 * TruliaWidgets class.
10
	 */
11
	class TruliaWidgets {
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
12
13
		/**
14
		 * __construct function.
15
		 *
16
		 * @access public
17
		 * @return void
0 ignored issues
show
Comprehensibility Best Practice introduced by
Adding a @return annotation to constructors is generally not recommended as a constructor does not have a meaningful return value.

Adding a @return annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.

Please refer to the PHP core documentation on constructors.

Loading history...
18
		 */
19
		public function __construct() {
20
		}
21
22
23
		/**
24
		 * trulia_iframe_css function.
25
		 *
26
		 * @access public
27
		 * @return void
28
		 */
29
		public function trulia_iframe_css() {
30
31
		?>
32
33
		<style>
34
			.trulia-iframe {
35
				display:block;
36
				max-width:100%;
37
			}
38
		</style>
39
40
		<?php
41
42
		}
43
44
		/**
45
		 * Trulia Iframe ID Names.
46
		 *
47
		 * @access public
48
		 * @param string $iframe_id (default: '')
49
		 * @return void
50
		 */
51
		public function trulia_iframe_id( $iframe_id = '' ) {
52
53
			if( '' !== $iframe_id  ) {
54
				return sanitize_html_class( $iframe_id ) . '-iframe';
55
			}
56
57
		}
58
59
		/**
60
		 * Trulia Iframe Class Names.
61
		 *
62
		 * @access public
63
		 * @param string $widget_name (default: '')
64
		 * @return void
65
		 */
66 View Code Duplication
		public function trulia_iframe_class( $widget_name = '' ) {
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
67
68
			if( '' !== $widget_name ) {
69
				return 'trulia trulia-iframe trulia-' . sanitize_html_class( $widget_name ) . '-iframe';
70
			} else {
71
				return 'trulia-iframe';
72
			}
73
74
		}
75
76
		/**
77
		 * get_community_advice_widget function.
78
		 *
79
		 * @access public
80
		 * @param string $iframe_id (default: '')
81
		 * @param mixed $display_answers
82
		 * @param mixed $title
83
		 * @param string $email (default: '')
84
		 * @return void
85
		 */
86
		public function get_community_advice_widget( $iframe_id = '', $display_answers, $title, $email = '' ) {
0 ignored issues
show
Unused Code introduced by
The parameter $display_answers is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $title is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $email is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
87
			echo '<iframe id="'. $this->trulia_iframe_id( $iframe_id ) .'" class="'. $this->trulia_iframe_class( 'community-advice' ) .'" src="https://synd.trulia.com/tools/expert-community-advice/embedded?params%5Bwhose_answer%5D=&params%5Bdisplay_answers%5D=true&params%5Btitle%5D=Expert+Community+Advice&params%5Bcolor%5D=grey&params%5Bemail%5D=&params%5Buser_url%5D=&params%5Bwidth%5D=300&params%5Bheight%5D=350&params%5Bguid%5D=58237a792f772"></iframe>';
88
		}
89
90
		/**
91
		 * get_rent_buy_calc_widget function.
92
		 *
93
		 * @access public
94
		 * @param string $iframe_id (default: '')
95
		 * @param mixed $location
96
		 * @param mixed $width
97
		 * @param mixed $height
98
		 * @param string $email (default: '')
99
		 * @return void
100
		 */
101
		public function get_rent_buy_calc_widget( $iframe_id = '', $location, $width, $height, $email = '' ) {
0 ignored issues
show
Unused Code introduced by
The parameter $location is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $width is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $height is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $email is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
102
			echo '<iframe id="'. $this->trulia_iframe_id( $iframe_id ) .'" class="'. $this->trulia_iframe_class( 'rent-buy-calc' ) .'" src="https://synd.trulia.com/tools/rent-vs-buy-calculator/embedded?params%5Btool_metro_area%5D=31084&params%5Btitle%5D=Rent+vs.+Buy+Calculator&params%5Bcolor%5D=grey&params%5Bemail%5D=&params%5Buser_url%5D=&params%5Bwidth%5D=600&params%5Bheight%5D=300&params%5Bguid%5D=582379f9264e8"></iframe>';
103
		}
104
105
		/**
106
		 * get_rental_market_widget function.
107
		 *
108
		 * @access public
109
		 * @param string $iframe_id (default: '')
110
		 * @param mixed $location
111
		 * @param mixed $width
112
		 * @param mixed $height
113
		 * @param string $email (default: '')
114
		 * @return void
115
		 */
116
		public function get_rental_market_widget( $iframe_id = '', $location, $width, $height, $email = '' ) {
0 ignored issues
show
Unused Code introduced by
The parameter $location is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $width is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $height is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $email is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
117
118
			echo '<iframe id="'. $this->trulia_iframe_id( $iframe_id ) .'" class="'. $this->trulia_iframe_class( 'rental-market' ) .'" src="https://synd.trulia.com/tools/rental-market-monitor/embedded?params%5Blocation%5D=Los+Angeles%2C+CA&params%5BlocationId%5D=22637&params%5Bcolor%5D=grey&params%5Bemail%5D=&params%5Buser_url%5D=&params%5Btitle%5D=Rental+Market+Monitor&params%5Bwidth%5D=300&params%5Bheight%5D=250&params%5Bguid%5D=582379637cf2e"></iframe>';
119
120
		}
121
122
123
		/**
124
		 * get_map_search_widget function.
125
		 *
126
		 * @access public
127
		 * @param string $iframe_id (default: '')
128
		 * @param mixed $location
129
		 * @param mixed $width
130
		 * @param mixed $height
131
		 * @param string $email (default: '')
132
		 * @return void
133
		 */
134
		public function get_map_search_widget( $iframe_id = '', $location, $width, $height, $email = '' ) {
0 ignored issues
show
Unused Code introduced by
The parameter $location is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $width is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $height is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $email is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
135
			echo '<iframe id="'. $this->trulia_iframe_id( $iframe_id ) .'" class="'. $this->trulia_iframe_class( 'map-search' ) .'" src="https://synd.trulia.com/tools/map-search/embedded?params%5Blocation%5D=West+Hills%2C+CA&params%5BlocationId%5D=39307&params%5Bagent_id%5D=&params%5Bproperty_status%5D=for+sale&params%5Btitle%5D=Map+Search&params%5Bcolor%5D=grey&params%5Bemail%5D=&params%5Buser_url%5D=&params%5Bwidth%5D=600&params%5Bheight%5D=300&params%5Bguid%5D=582378f4c0432"></iframe>';
136
		}
137
138
		/**
139
		 * get_home_gallery_widget function.
140
		 *
141
		 * @access public
142
		 * @param string $iframe_id (default: '')
143
		 * @param mixed $location
144
		 * @param mixed $width
145
		 * @param mixed $height
146
		 * @param string $email (default: '')
147
		 * @return void
148
		 */
149
		public function get_home_gallery_widget( $iframe_id = '', $location, $width, $height, $email = '' ) {
0 ignored issues
show
Unused Code introduced by
The parameter $location is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $width is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $height is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $email is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
150
			echo '<iframe id="'. $this->trulia_iframe_id( $iframe_id ) .'" class="'. $this->trulia_iframe_class( 'home-gallery' ) .'" src="https://synd.trulia.com/tools/home-gallery/embedded?params%5Blocation%5D=Los+Angeles%2C+CA&params%5BlocationId%5D=22637&params%5Bmin_price%5D=&params%5Bmax_price%5D=&params%5Bnum_beds%5D=&params%5Bnum_baths%5D=&params%5Bagent_id%5D=&params%5Bspeed%5D=5000&params%5Btitle%5D=Home+Gallery&params%5Bcolor%5D=green&params%5Bemail%5D=&params%5Buser_url%5D=&params%5Bwidth%5D=300&params%5Bheight%5D=300&params%5Bguid%5D=582371b703b0d&params%5Bslides_per_page%5D=3&city=Los Angeles&state_code=CA"></iframe>';
151
		}
152
153
		/**
154
		 * get_home_showcase_widget function.
155
		 *
156
		 * @access public
157
		 * @param string $iframe_id (default: '')
158
		 * @param mixed $location
159
		 * @param mixed $width
160
		 * @param mixed $height
161
		 * @param string $email (default: '')
162
		 * @return void
163
		 */
164
		public function get_home_showcase_widget( $iframe_id = '', $location, $width, $height, $email = '' ) {
0 ignored issues
show
Unused Code introduced by
The parameter $location is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $width is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $height is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $email is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
165
			echo '<iframe id="'. $this->trulia_iframe_id( $iframe_id ) .'" class="'. $this->trulia_iframe_class( 'home-showcase' ) .'" src="https://synd.trulia.com/tools/home-showcase/embedded?params%5Blocation%5D=Los+Angeles%2C+CA&params%5BlocationId%5D=22637&params%5Bmin_price%5D=&params%5Bmax_price%5D=&params%5Bnum_beds%5D=&params%5Bnum_baths%5D=&params%5Bagent_id%5D=&params%5Bspeed%5D=5000&params%5Btitle%5D=My+Listings&params%5Bcolor%5D=grey&params%5Bemail%5D=&params%5Buser_url%5D=&params%5Bwidth%5D=300&params%5Bheight%5D=350&params%5Bguid%5D=582370ce64073"></iframe>';
166
		}
167
168
		/**
169
		 * get_homefinder_widget function.
170
		 *
171
		 * @access public
172
		 * @param string $iframe_id (default: '')
173
		 * @param mixed $location
174
		 * @param mixed $width
175
		 * @param mixed $height
176
		 * @param string $email (default: '')
177
		 * @return void
178
		 */
179
		public function get_homefinder_widget( $iframe_id = '', $location, $width, $height, $email = '' ) {
0 ignored issues
show
Unused Code introduced by
The parameter $location is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $width is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $height is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $email is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
180
			echo '<iframe id="'. $this->trulia_iframe_id( $iframe_id ) .'" class="'. $this->trulia_iframe_class( 'homefinder' ) .'"  src="https://synd.trulia.com/tools/home-finder/embedded?params%5Blocation%5D=&params%5BlocationId%5D=&params%5Bcolor%5D=green&params%5Bemail%5D=&params%5Buser_url%5D=&params%5Btitle%5D=Home+Finder&params%5Bwidth%5D=300&params%5Bheight%5D=350&params%5Bguid%5D=58236f71d7732"></iframe>';
181
		}
182
183
		/**
184
		 * get_market_monitor_widget function.
185
		 *
186
		 * @access public
187
		 * @param string $iframe_id (default: '')
188
		 * @param mixed $location
189
		 * @param mixed $width
190
		 * @param mixed $height
191
		 * @param string $email (default: '')
192
		 * @return void
193
		 */
194
		public function get_market_monitor_widget( $iframe_id = '', $location, $width, $height, $email = '' ) {
0 ignored issues
show
Unused Code introduced by
The parameter $location is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $width is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $height is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $email is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
195
196
			echo '<iframe id="'. $this->trulia_iframe_id( $iframe_id ) .'" class="'. $this->trulia_iframe_class( 'market-monitor' ) .'" src="https://synd.trulia.com/tools/market-monitor/embedded?params%5Blocation%5D=Los+Angeles%2C+CA&params%5BlocationId%5D=22637&params%5Blisting_price_type%5D=average&params%5Bshow_inventory%5D=1&params%5Btitle%5D=Market+Monitor&params%5Bcolor%5D=grey&params%5Bemail%5D=&params%5Buser_url%5D=&params%5Bwidth%5D=300&params%5Bheight%5D=250&params%5Bguid%5D=58236e004595a"></iframe>';
197
		}
198
199
		/**
200
		 * get_affordability_calc_widget function. (https://www.trulia.com/tools/affordability-calculator/)
201
		 *
202
		 * @access public
203
		 * @param mixed $color
204
		 * @param mixed $title
205
		 * @param mixed $email
206
		 * @param mixed $width
207
		 * @param mixed $height
208
		 * @return void
209
		 */
210
		public function get_affordability_calc_widget( $iframe_id = '', $color, $title, $width, $height, $email = '' ) {
0 ignored issues
show
Unused Code introduced by
The parameter $color is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $title is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $width is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $height is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $email is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
211
212
		echo '<iframe id="'. $this->trulia_iframe_id( $iframe_id ) .'" class="'. $this->trulia_iframe_class( 'affordability-calc' ) .'" src="https://synd.trulia.com/tools/affordability-calculator/embedded?params%5Bcolor%5D=grey&params%5Bemail%5D=&params%5Buser_url%5D=&params%5Btitle%5D=Affordability+Calculator&params%5Bwidth%5D=600&params%5Bheight%5D=300&params%5Bguid%5D=58236d0b501ae"></iframe>';
213
214
		}
215
216
	}
217
}
218