@@ -6,27 +6,27 @@ |
||
6 | 6 | */ |
7 | 7 | |
8 | 8 | // Exit if accessed directly. |
9 | -if ( ! defined( 'ABSPATH' ) ) { exit; } |
|
9 | +if ( ! defined('ABSPATH')) { exit; } |
|
10 | 10 | |
11 | -include( 'widgets/class-homes-com-widgets.php' ); |
|
11 | +include('widgets/class-homes-com-widgets.php'); |
|
12 | 12 | |
13 | 13 | // Include Commute Time Widget. |
14 | -include( 'widgets/class-commute-time-widget.php' ); |
|
14 | +include('widgets/class-commute-time-widget.php'); |
|
15 | 15 | |
16 | 16 | // Include Featured Listings Widget. |
17 | -include( 'widgets/class-featured-listings-widget.php' ); |
|
17 | +include('widgets/class-featured-listings-widget.php'); |
|
18 | 18 | |
19 | 19 | // Include Home Values Widget. |
20 | -include( 'widgets/class-home-values-widget.php' ); |
|
20 | +include('widgets/class-home-values-widget.php'); |
|
21 | 21 | |
22 | 22 | // Include Search Widget. |
23 | -include( 'widgets/class-search-widget.php' ); |
|
23 | +include('widgets/class-search-widget.php'); |
|
24 | 24 | |
25 | 25 | // Include Mortgage Calculator Widget. |
26 | -include( 'widgets/class-mortgage-calculator-widget.php' ); |
|
26 | +include('widgets/class-mortgage-calculator-widget.php'); |
|
27 | 27 | |
28 | 28 | // Include Simple Search Widget. |
29 | -include( 'widgets/class-simple-search-widget.php' ); |
|
29 | +include('widgets/class-simple-search-widget.php'); |
|
30 | 30 | |
31 | 31 | // Include Tall Search Widget. |
32 | -include( 'widgets/class-tall-search-widget.php' ); |
|
32 | +include('widgets/class-tall-search-widget.php'); |
@@ -16,9 +16,9 @@ discard block |
||
16 | 16 | * GitHub Branch: master |
17 | 17 | */ |
18 | 18 | /* Exit if accessed directly */ |
19 | -if ( ! defined( 'ABSPATH' ) ) { exit; } |
|
19 | +if ( ! defined('ABSPATH')) { exit; } |
|
20 | 20 | /* Check if Class Exists. */ |
21 | -if ( ! class_exists( 'StreetAdvisorAPI' ) ) { |
|
21 | +if ( ! class_exists('StreetAdvisorAPI')) { |
|
22 | 22 | /** |
23 | 23 | * StreetAdvisor API Class. |
24 | 24 | */ |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | * @param mixed $api_key API Key. |
43 | 43 | * @return void |
44 | 44 | */ |
45 | - public function __construct( $api_key ) { |
|
45 | + public function __construct($api_key) { |
|
46 | 46 | static::$api_key = $api_key; |
47 | 47 | $this->args['headers'] = array( |
48 | 48 | 'Content-Type' => 'application/json', |
@@ -56,14 +56,14 @@ discard block |
||
56 | 56 | * @param mixed $request Request URL. |
57 | 57 | * @return $body Body. |
58 | 58 | */ |
59 | - private function fetch( $request ) { |
|
60 | - $response = wp_remote_get( $request, $this->args ); |
|
61 | - $code = wp_remote_retrieve_response_code( $response ); |
|
62 | - if ( 200 !== $code ) { |
|
63 | - return new WP_Error( 'response-error', sprintf( __( 'Server response code: %d', 'text-domain' ), $code ) ); |
|
59 | + private function fetch($request) { |
|
60 | + $response = wp_remote_get($request, $this->args); |
|
61 | + $code = wp_remote_retrieve_response_code($response); |
|
62 | + if (200 !== $code) { |
|
63 | + return new WP_Error('response-error', sprintf(__('Server response code: %d', 'text-domain'), $code)); |
|
64 | 64 | } |
65 | - $body = wp_remote_retrieve_body( $response ); |
|
66 | - return json_decode( $body, true ); |
|
65 | + $body = wp_remote_retrieve_body($response); |
|
66 | + return json_decode($body, true); |
|
67 | 67 | } |
68 | 68 | /** |
69 | 69 | * Get Location Data. |
@@ -74,9 +74,9 @@ discard block |
||
74 | 74 | * @param mixed $level Level. |
75 | 75 | * @return void |
76 | 76 | */ |
77 | - public function get_location_data( $latitude, $longitude, $level ) { |
|
78 | - $request = $this->base_uri . '/locations/overview/'.$latitude.'/'.$longitude.'/'.$level; |
|
79 | - return $this->fetch( $request ); |
|
77 | + public function get_location_data($latitude, $longitude, $level) { |
|
78 | + $request = $this->base_uri . '/locations/overview/' . $latitude . '/' . $longitude . '/' . $level; |
|
79 | + return $this->fetch($request); |
|
80 | 80 | } |
81 | 81 | /** |
82 | 82 | * Get Location Reviews. |
@@ -88,9 +88,9 @@ discard block |
||
88 | 88 | * @param int $review_count (default: 5) Total # of Reviews to display. |
89 | 89 | * @return void |
90 | 90 | */ |
91 | - public function get_location_reviews( $latitude, $longitude, $level, $review_count = '5' ) { |
|
92 | - $request = $this->base_uri . '/reviews/'.$latitude.'/'.$longitude.'/'.$level . '?take='. $review_count; |
|
93 | - return $this->fetch( $request ); |
|
91 | + public function get_location_reviews($latitude, $longitude, $level, $review_count = '5') { |
|
92 | + $request = $this->base_uri . '/reviews/' . $latitude . '/' . $longitude . '/' . $level . '?take=' . $review_count; |
|
93 | + return $this->fetch($request); |
|
94 | 94 | } |
95 | 95 | } |
96 | 96 | } |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | /* Exit if accessed directly */ |
4 | -if ( ! defined( 'ABSPATH' ) ) { exit; } |
|
4 | +if ( ! defined('ABSPATH')) { exit; } |
|
5 | 5 | |
6 | 6 | /** |
7 | 7 | * StreetAdvisor_Details class. |
@@ -20,9 +20,9 @@ discard block |
||
20 | 20 | |
21 | 21 | parent::__construct( |
22 | 22 | 'streetadvisor-reviews', |
23 | - __( 'Street Advisor - Location Reviews', 're-pro' ), |
|
23 | + __('Street Advisor - Location Reviews', 're-pro'), |
|
24 | 24 | array( |
25 | - 'description' => __( 'Street Advisor Location Reviews', 're-pro' ), |
|
25 | + 'description' => __('Street Advisor Location Reviews', 're-pro'), |
|
26 | 26 | ) |
27 | 27 | ); |
28 | 28 | |
@@ -36,17 +36,17 @@ discard block |
||
36 | 36 | * @param mixed $instance |
37 | 37 | * @return void |
38 | 38 | */ |
39 | - public function widget( $args, $instance ) { |
|
39 | + public function widget($args, $instance) { |
|
40 | 40 | |
41 | 41 | // Retrieve an existing value from the database |
42 | - $latitude = !empty( $instance['latitude'] ) ? $instance['latitude'] : ''; |
|
43 | - $longitude = !empty( $instance['longitude'] ) ? $instance['longitude'] : ''; |
|
44 | - $level = !empty( $instance['level'] ) ? $instance['level'] : ''; |
|
45 | - $title = !empty( $instance['title'] ) ? $instance['title'] : ''; |
|
42 | + $latitude = ! empty($instance['latitude']) ? $instance['latitude'] : ''; |
|
43 | + $longitude = ! empty($instance['longitude']) ? $instance['longitude'] : ''; |
|
44 | + $level = ! empty($instance['level']) ? $instance['level'] : ''; |
|
45 | + $title = ! empty($instance['title']) ? $instance['title'] : ''; |
|
46 | 46 | |
47 | - $streetadvisor = new StreetAdvisorAPI( 'b08f6473-8dee-41c3-9a3e-b32f335e9d2d' ); |
|
47 | + $streetadvisor = new StreetAdvisorAPI('b08f6473-8dee-41c3-9a3e-b32f335e9d2d'); |
|
48 | 48 | |
49 | -$reviews = $streetadvisor->get_location_reviews( $latitude, $longitude, $level ); |
|
49 | +$reviews = $streetadvisor->get_location_reviews($latitude, $longitude, $level); |
|
50 | 50 | |
51 | 51 | // var_dump($reviews); |
52 | 52 | /* |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | |
65 | 65 | echo $args['before_widget']; |
66 | 66 | |
67 | -echo $args['before_title'] . esc_attr( $title ) . $args['after_title']; |
|
67 | +echo $args['before_title'] . esc_attr($title) . $args['after_title']; |
|
68 | 68 | |
69 | 69 | foreach ($reviews['Items'] as $review) { |
70 | 70 | |
@@ -82,10 +82,10 @@ discard block |
||
82 | 82 | echo '<div class="review" itemprop="review" itemscope itemtype="https://schema.org/Review">'; |
83 | 83 | |
84 | 84 | // echo '<img src="'. $user_avatar_url .'">'; |
85 | - echo '<span itemprop="reviewRating">'.$rating.'</span> stars - <strong>"<span itemprop="name">' . $title . '</span>"</strong> |
|
86 | - <br /> by <span itemprop="author">'.$user_displayname.'</span><br /> |
|
87 | - Written on <meta itemprop="datePublished" content="' .$date .'">'.$date .' |
|
88 | - <br /><span itemprop="reviewBody">'.$content.'</span>'; |
|
85 | + echo '<span itemprop="reviewRating">' . $rating . '</span> stars - <strong>"<span itemprop="name">' . $title . '</span>"</strong> |
|
86 | + <br /> by <span itemprop="author">'.$user_displayname . '</span><br /> |
|
87 | + Written on <meta itemprop="datePublished" content="' .$date . '">' . $date . ' |
|
88 | + <br /><span itemprop="reviewBody">'.$content . '</span>'; |
|
89 | 89 | |
90 | 90 | // echo '<small>'.$legal . '</small>'; |
91 | 91 | |
@@ -108,46 +108,46 @@ discard block |
||
108 | 108 | * @param mixed $instance |
109 | 109 | * @return void |
110 | 110 | */ |
111 | - public function form( $instance ) { |
|
111 | + public function form($instance) { |
|
112 | 112 | |
113 | 113 | // Set default values |
114 | - $instance = wp_parse_args( (array) $instance, array( |
|
114 | + $instance = wp_parse_args((array) $instance, array( |
|
115 | 115 | 'latitude' => '', |
116 | 116 | 'longitude' => '', |
117 | 117 | 'level' => '', |
118 | 118 | 'title' => '', |
119 | - ) ); |
|
119 | + )); |
|
120 | 120 | |
121 | 121 | // Retrieve an existing value from the database |
122 | - $latitude = !empty( $instance['latitude'] ) ? $instance['latitude'] : ''; |
|
123 | - $longitude = !empty( $instance['longitude'] ) ? $instance['longitude'] : ''; |
|
124 | - $level = !empty( $instance['level'] ) ? $instance['level'] : ''; |
|
125 | - $title = !empty( $instance['title'] ) ? $instance['title'] : ''; |
|
122 | + $latitude = ! empty($instance['latitude']) ? $instance['latitude'] : ''; |
|
123 | + $longitude = ! empty($instance['longitude']) ? $instance['longitude'] : ''; |
|
124 | + $level = ! empty($instance['level']) ? $instance['level'] : ''; |
|
125 | + $title = ! empty($instance['title']) ? $instance['title'] : ''; |
|
126 | 126 | |
127 | 127 | // Form fields |
128 | 128 | echo '<p>'; |
129 | - echo ' <label for="' . $this->get_field_id( 'title' ) . '" class="title_label">' . __( 'Title', 're-pro' ) . '</label>'; |
|
130 | - echo ' <input type="text" id="' . $this->get_field_id( 'title' ) . '" name="' . $this->get_field_name( 'title' ) . '" class="widefat" placeholder="' . esc_attr__( '', 're-pro' ) . '" value="' . esc_attr( $title ) . '">'; |
|
131 | - echo ' <span class="description">' . __( 'Title', 're-pro' ) . '</span>'; |
|
129 | + echo ' <label for="' . $this->get_field_id('title') . '" class="title_label">' . __('Title', 're-pro') . '</label>'; |
|
130 | + echo ' <input type="text" id="' . $this->get_field_id('title') . '" name="' . $this->get_field_name('title') . '" class="widefat" placeholder="' . esc_attr__('', 're-pro') . '" value="' . esc_attr($title) . '">'; |
|
131 | + echo ' <span class="description">' . __('Title', 're-pro') . '</span>'; |
|
132 | 132 | echo '</p>'; |
133 | 133 | |
134 | 134 | |
135 | 135 | echo '<p>'; |
136 | - echo ' <label for="' . $this->get_field_id( 'latitude' ) . '" class="latitude_label">' . __( 'Latitude', 're-pro' ) . '</label>'; |
|
137 | - echo ' <input type="text" id="' . $this->get_field_id( 'latitude' ) . '" name="' . $this->get_field_name( 'latitude' ) . '" class="widefat" placeholder="' . esc_attr__( '', 're-pro' ) . '" value="' . esc_attr( $latitude ) . '">'; |
|
138 | - echo ' <span class="description">' . __( 'Latitude', 're-pro' ) . '</span>'; |
|
136 | + echo ' <label for="' . $this->get_field_id('latitude') . '" class="latitude_label">' . __('Latitude', 're-pro') . '</label>'; |
|
137 | + echo ' <input type="text" id="' . $this->get_field_id('latitude') . '" name="' . $this->get_field_name('latitude') . '" class="widefat" placeholder="' . esc_attr__('', 're-pro') . '" value="' . esc_attr($latitude) . '">'; |
|
138 | + echo ' <span class="description">' . __('Latitude', 're-pro') . '</span>'; |
|
139 | 139 | echo '</p>'; |
140 | 140 | |
141 | 141 | echo '<p>'; |
142 | - echo ' <label for="' . $this->get_field_id( 'longitude' ) . '" class="longitude_label">' . __( 'Longitude', 're-pro' ) . '</label>'; |
|
143 | - echo ' <input type="text" id="' . $this->get_field_id( 'longitude' ) . '" name="' . $this->get_field_name( 'longitude' ) . '" class="widefat" placeholder="' . esc_attr__( '', 're-pro' ) . '" value="' . esc_attr( $longitude ) . '">'; |
|
144 | - echo ' <span class="description">' . __( 'Longitude', 're-pro' ) . '</span>'; |
|
142 | + echo ' <label for="' . $this->get_field_id('longitude') . '" class="longitude_label">' . __('Longitude', 're-pro') . '</label>'; |
|
143 | + echo ' <input type="text" id="' . $this->get_field_id('longitude') . '" name="' . $this->get_field_name('longitude') . '" class="widefat" placeholder="' . esc_attr__('', 're-pro') . '" value="' . esc_attr($longitude) . '">'; |
|
144 | + echo ' <span class="description">' . __('Longitude', 're-pro') . '</span>'; |
|
145 | 145 | echo '</p>'; |
146 | 146 | |
147 | 147 | echo '<p>'; |
148 | - echo ' <label for="' . $this->get_field_id( 'level' ) . '" class="level_label">' . __( 'Level', 're-pro' ) . '</label>'; |
|
149 | - echo ' <input type="number" id="' . $this->get_field_id( 'level' ) . '" name="' . $this->get_field_name( 'level' ) . '" class="widefat" placeholder="' . esc_attr__( '', 're-pro' ) . '" value="' . esc_attr( $level ) . '">'; |
|
150 | - echo ' <span class="description">' . __( 'Level', 're-pro' ) . '</span>'; |
|
148 | + echo ' <label for="' . $this->get_field_id('level') . '" class="level_label">' . __('Level', 're-pro') . '</label>'; |
|
149 | + echo ' <input type="number" id="' . $this->get_field_id('level') . '" name="' . $this->get_field_name('level') . '" class="widefat" placeholder="' . esc_attr__('', 're-pro') . '" value="' . esc_attr($level) . '">'; |
|
150 | + echo ' <span class="description">' . __('Level', 're-pro') . '</span>'; |
|
151 | 151 | echo '</p>'; |
152 | 152 | |
153 | 153 | |
@@ -162,14 +162,14 @@ discard block |
||
162 | 162 | * @param mixed $old_instance |
163 | 163 | * @return void |
164 | 164 | */ |
165 | - public function update( $new_instance, $old_instance ) { |
|
165 | + public function update($new_instance, $old_instance) { |
|
166 | 166 | |
167 | 167 | $instance = $old_instance; |
168 | 168 | |
169 | - $instance['latitude'] = !empty( $new_instance['latitude'] ) ? strip_tags( $new_instance['latitude'] ) : ''; |
|
170 | - $instance['longitude'] = !empty( $new_instance['longitude'] ) ? strip_tags( $new_instance['longitude'] ) : ''; |
|
171 | - $instance['level'] = !empty( $new_instance['level'] ) ? strip_tags( $new_instance['level'] ) : ''; |
|
172 | - $instance['title'] = !empty( $new_instance['title'] ) ? strip_tags( $new_instance['title'] ) : ''; |
|
169 | + $instance['latitude'] = ! empty($new_instance['latitude']) ? strip_tags($new_instance['latitude']) : ''; |
|
170 | + $instance['longitude'] = ! empty($new_instance['longitude']) ? strip_tags($new_instance['longitude']) : ''; |
|
171 | + $instance['level'] = ! empty($new_instance['level']) ? strip_tags($new_instance['level']) : ''; |
|
172 | + $instance['title'] = ! empty($new_instance['title']) ? strip_tags($new_instance['title']) : ''; |
|
173 | 173 | |
174 | 174 | return $instance; |
175 | 175 | |
@@ -184,6 +184,6 @@ discard block |
||
184 | 184 | * @return void |
185 | 185 | */ |
186 | 186 | function streetadvisor_register_widgets() { |
187 | - register_widget( 'StreetAdvisor_Reviews' ); |
|
187 | + register_widget('StreetAdvisor_Reviews'); |
|
188 | 188 | } |
189 | -add_action( 'widgets_init', 'streetadvisor_register_widgets' ); |
|
189 | +add_action('widgets_init', 'streetadvisor_register_widgets'); |
@@ -6,10 +6,10 @@ |
||
6 | 6 | */ |
7 | 7 | |
8 | 8 | /* Exit if accessed directly. */ |
9 | -if ( ! defined( 'ABSPATH' ) ) { exit; } |
|
9 | +if ( ! defined('ABSPATH')) { exit; } |
|
10 | 10 | |
11 | -include( 'wp-streetadvisor-api.php' ); |
|
11 | +include('wp-streetadvisor-api.php'); |
|
12 | 12 | |
13 | -include( 'widgets/streetadvisor-details.php' ); |
|
13 | +include('widgets/streetadvisor-details.php'); |
|
14 | 14 | |
15 | 15 | // include( 'widgets/streetadvisor-reviews.php' ); |
@@ -15,9 +15,9 @@ discard block |
||
15 | 15 | GitHub Branch: master |
16 | 16 | */ |
17 | 17 | /* Exit if accessed directly */ |
18 | -if ( ! defined( 'ABSPATH' ) ) { exit; } |
|
18 | +if ( ! defined('ABSPATH')) { exit; } |
|
19 | 19 | /* Check if class exists. */ |
20 | -if ( ! class_exists( 'EnerscoreAPI' ) ) { |
|
20 | +if ( ! class_exists('EnerscoreAPI')) { |
|
21 | 21 | /** |
22 | 22 | * EnerscoreAPI class. |
23 | 23 | */ |
@@ -43,14 +43,14 @@ discard block |
||
43 | 43 | * @param mixed $request Request URL. |
44 | 44 | * @return $body Body. |
45 | 45 | */ |
46 | - private function fetch( $request ) { |
|
47 | - $response = wp_remote_get( $request ); |
|
48 | - $code = wp_remote_retrieve_response_code( $response ); |
|
49 | - if ( 200 !== $code ) { |
|
50 | - return new WP_Error( 'response-error', sprintf( __( 'Server response code: %d', 'text-domain' ), $code ) ); |
|
46 | + private function fetch($request) { |
|
47 | + $response = wp_remote_get($request); |
|
48 | + $code = wp_remote_retrieve_response_code($response); |
|
49 | + if (200 !== $code) { |
|
50 | + return new WP_Error('response-error', sprintf(__('Server response code: %d', 'text-domain'), $code)); |
|
51 | 51 | } |
52 | - $body = wp_remote_retrieve_body( $response ); |
|
53 | - return json_decode( $body ); |
|
52 | + $body = wp_remote_retrieve_body($response); |
|
53 | + return json_decode($body); |
|
54 | 54 | } |
55 | 55 | /** |
56 | 56 | * Get Energy Score for Address. |
@@ -59,12 +59,12 @@ discard block |
||
59 | 59 | * @param mixed $address Address. |
60 | 60 | * @return void |
61 | 61 | */ |
62 | - public function get_enerscore( $address ) { |
|
63 | - if ( empty( $address ) ) { |
|
64 | - return new WP_Error( 'required-fields', __( 'Required fields are empty.', 'text-domain' ) ); |
|
62 | + public function get_enerscore($address) { |
|
63 | + if (empty($address)) { |
|
64 | + return new WP_Error('required-fields', __('Required fields are empty.', 'text-domain')); |
|
65 | 65 | } |
66 | 66 | $request = $this->base_uri . $address; |
67 | - return $this->fetch( $request ); |
|
67 | + return $this->fetch($request); |
|
68 | 68 | } |
69 | 69 | } |
70 | 70 | } |
@@ -15,8 +15,8 @@ discard block |
||
15 | 15 | * GitHub Branch: master |
16 | 16 | */ |
17 | 17 | /* Exit if accessed directly */ |
18 | -if ( ! defined( 'ABSPATH' ) ) { exit; } |
|
19 | -if ( ! class_exists( 'GreatSchoolsAPI' ) ) { |
|
18 | +if ( ! defined('ABSPATH')) { exit; } |
|
19 | +if ( ! class_exists('GreatSchoolsAPI')) { |
|
20 | 20 | /** |
21 | 21 | * GreatSchools API Class. |
22 | 22 | */ |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | * @param string $output (default: 'json') Output. |
49 | 49 | * @return void |
50 | 50 | */ |
51 | - public function __construct( $api_key, $output = 'json' ) { |
|
51 | + public function __construct($api_key, $output = 'json') { |
|
52 | 52 | static::$api_key = $api_key; |
53 | 53 | static::$output = $output; |
54 | 54 | } |
@@ -59,13 +59,13 @@ discard block |
||
59 | 59 | * @param mixed $request Request URL. |
60 | 60 | * @return $body Body. |
61 | 61 | */ |
62 | - private function fetch( $request ) { |
|
63 | - $response = wp_remote_get( $request ); |
|
64 | - $code = wp_remote_retrieve_response_code( $response ); |
|
65 | - if ( 200 !== $code ) { |
|
66 | - return new WP_Error( 'response-error', sprintf( __( 'Server response code: %d', 'text-domain' ), $code ) ); |
|
62 | + private function fetch($request) { |
|
63 | + $response = wp_remote_get($request); |
|
64 | + $code = wp_remote_retrieve_response_code($response); |
|
65 | + if (200 !== $code) { |
|
66 | + return new WP_Error('response-error', sprintf(__('Server response code: %d', 'text-domain'), $code)); |
|
67 | 67 | } |
68 | - $body = wp_remote_retrieve_body( $response ); |
|
68 | + $body = wp_remote_retrieve_body($response); |
|
69 | 69 | return $body; |
70 | 70 | } |
71 | 71 | /** |
@@ -76,11 +76,11 @@ discard block |
||
76 | 76 | * @param mixed $city City. |
77 | 77 | * @return void |
78 | 78 | */ |
79 | - public function get_schools( $state, $city ) { |
|
79 | + public function get_schools($state, $city) { |
|
80 | 80 | $request = $this->base_uri . $state . '/' . $city . '?key=' . static::$api_key; |
81 | - $xml = simplexml_load_file( $request ); |
|
82 | - $json = wp_json_encode( $xml ); |
|
83 | - $results = json_decode( $json, true ); |
|
81 | + $xml = simplexml_load_file($request); |
|
82 | + $json = wp_json_encode($xml); |
|
83 | + $results = json_decode($json, true); |
|
84 | 84 | return $results; |
85 | 85 | } |
86 | 86 | /** |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | * @param mixed $limit Limit. |
100 | 100 | * @return void |
101 | 101 | */ |
102 | - public function get_nearby_schools( $state, $zip, $city, $address, $latitude, $longitude, $school_type, $level_code, $radius, $limit ) { |
|
102 | + public function get_nearby_schools($state, $zip, $city, $address, $latitude, $longitude, $school_type, $level_code, $radius, $limit) { |
|
103 | 103 | } |
104 | 104 | /** |
105 | 105 | * Returns a profile data for a specific school. |
@@ -109,11 +109,11 @@ discard block |
||
109 | 109 | * @param mixed $school_id School ID. |
110 | 110 | * @return void |
111 | 111 | */ |
112 | - public function get_school( $state, $school_id ) { |
|
113 | - $request = $this->base_uri . $state . '/'. $school_id .'?key=' . static::$api_key; |
|
114 | - $xml = simplexml_load_file( $request ); |
|
115 | - $json = wp_json_encode( $xml ); |
|
116 | - $results = json_decode( $json, true ); |
|
112 | + public function get_school($state, $school_id) { |
|
113 | + $request = $this->base_uri . $state . '/' . $school_id . '?key=' . static::$api_key; |
|
114 | + $xml = simplexml_load_file($request); |
|
115 | + $json = wp_json_encode($xml); |
|
116 | + $results = json_decode($json, true); |
|
117 | 117 | return $results; |
118 | 118 | } |
119 | 119 | /** |
@@ -124,11 +124,11 @@ discard block |
||
124 | 124 | * @param mixed $query_string Query String. |
125 | 125 | * @return void |
126 | 126 | */ |
127 | - public function search_for_schools( $state, $query_string, $level_code, $sort, $limit ) { |
|
128 | - $request = $this->base_uri . '/search/schools?key=' . static::$api_key . '&state=' . $state . '&q='. $query_string .'&levelCode='. $level_code .'&sort='. $sort .'&limit=' . $limit; |
|
129 | - $xml = simplexml_load_file( $request ); |
|
130 | - $json = wp_json_encode( $xml ); |
|
131 | - $results = json_decode( $json, true ); |
|
127 | + public function search_for_schools($state, $query_string, $level_code, $sort, $limit) { |
|
128 | + $request = $this->base_uri . '/search/schools?key=' . static::$api_key . '&state=' . $state . '&q=' . $query_string . '&levelCode=' . $level_code . '&sort=' . $sort . '&limit=' . $limit; |
|
129 | + $xml = simplexml_load_file($request); |
|
130 | + $json = wp_json_encode($xml); |
|
131 | + $results = json_decode($json, true); |
|
132 | 132 | return $results; |
133 | 133 | } |
134 | 134 | /** |
@@ -143,11 +143,11 @@ discard block |
||
143 | 143 | * @param mixed $topic_id Topic ID. |
144 | 144 | * @return void |
145 | 145 | */ |
146 | - public function get_school_reviews( $state, $city, $school_id, $cutoffage, $limit, $topic_id ) { |
|
147 | - $request = $this->base_uri . '/reviews/school/' . $state . '/'. $school_id .'?key=' . static::$api_key . '&limit='. $limit .'&cutoffAge='. $cutoffage .'&topicId=' . $topic_id; |
|
148 | - $xml = simplexml_load_file( $request ); |
|
149 | - $json = wp_json_encode( $xml ); |
|
150 | - $results = json_decode( $json, true ); |
|
146 | + public function get_school_reviews($state, $city, $school_id, $cutoffage, $limit, $topic_id) { |
|
147 | + $request = $this->base_uri . '/reviews/school/' . $state . '/' . $school_id . '?key=' . static::$api_key . '&limit=' . $limit . '&cutoffAge=' . $cutoffage . '&topicId=' . $topic_id; |
|
148 | + $xml = simplexml_load_file($request); |
|
149 | + $json = wp_json_encode($xml); |
|
150 | + $results = json_decode($json, true); |
|
151 | 151 | return $results; |
152 | 152 | } |
153 | 153 | /** |
@@ -158,9 +158,9 @@ discard block |
||
158 | 158 | */ |
159 | 159 | public function get_review_topics() { |
160 | 160 | $request = $this->base_uri . '/reviews/reviewTopics?key=' . static::$api_key; |
161 | - $xml = simplexml_load_file( $request ); |
|
162 | - $json = wp_json_encode( $xml ); |
|
163 | - $results = json_decode( $json, true ); |
|
161 | + $xml = simplexml_load_file($request); |
|
162 | + $json = wp_json_encode($xml); |
|
163 | + $results = json_decode($json, true); |
|
164 | 164 | return $results; |
165 | 165 | } |
166 | 166 | /** |
@@ -171,11 +171,11 @@ discard block |
||
171 | 171 | * @param mixed $school_id School ID. |
172 | 172 | * @return void |
173 | 173 | */ |
174 | - public function get_school_test_scores( $state, $school_id ) { |
|
175 | - $request = $this->base_uri . '/school/tests/' . $state . '/'. $school_id .'?key=' . static::$api_key; |
|
176 | - $xml = simplexml_load_file( $request ); |
|
177 | - $json = wp_json_encode( $xml ); |
|
178 | - $results = json_decode( $json, true ); |
|
174 | + public function get_school_test_scores($state, $school_id) { |
|
175 | + $request = $this->base_uri . '/school/tests/' . $state . '/' . $school_id . '?key=' . static::$api_key; |
|
176 | + $xml = simplexml_load_file($request); |
|
177 | + $json = wp_json_encode($xml); |
|
178 | + $results = json_decode($json, true); |
|
179 | 179 | return $results; |
180 | 180 | } |
181 | 181 | /** |
@@ -186,11 +186,11 @@ discard block |
||
186 | 186 | * @param mixed $school_id School ID. |
187 | 187 | * @return void |
188 | 188 | */ |
189 | - public function get_school_census_data( $state, $school_id ) { |
|
190 | - $request = $this->base_uri . '/school/census/' . $state . '/'. $school_id .'?key=' . static::$api_key; |
|
191 | - $xml = simplexml_load_file( $request ); |
|
192 | - $json = wp_json_encode( $xml ); |
|
193 | - $results = json_decode( $json, true ); |
|
189 | + public function get_school_census_data($state, $school_id) { |
|
190 | + $request = $this->base_uri . '/school/census/' . $state . '/' . $school_id . '?key=' . static::$api_key; |
|
191 | + $xml = simplexml_load_file($request); |
|
192 | + $json = wp_json_encode($xml); |
|
193 | + $results = json_decode($json, true); |
|
194 | 194 | return $results; |
195 | 195 | } |
196 | 196 | /** |
@@ -201,11 +201,11 @@ discard block |
||
201 | 201 | * @param mixed $city City. |
202 | 202 | * @return void |
203 | 203 | */ |
204 | - public function get_city_schools( $state, $city ) { |
|
205 | - $request = $this->base_uri . '/cities/' . $state . '/'. $city .'?key=' . static::$api_key; |
|
206 | - $xml = simplexml_load_file( $request ); |
|
207 | - $json = wp_json_encode( $xml ); |
|
208 | - $results = json_decode( $json, true ); |
|
204 | + public function get_city_schools($state, $city) { |
|
205 | + $request = $this->base_uri . '/cities/' . $state . '/' . $city . '?key=' . static::$api_key; |
|
206 | + $xml = simplexml_load_file($request); |
|
207 | + $json = wp_json_encode($xml); |
|
208 | + $results = json_decode($json, true); |
|
209 | 209 | return $results; |
210 | 210 | } |
211 | 211 | /** |
@@ -218,11 +218,11 @@ discard block |
||
218 | 218 | * @param mixed $sort Sort. |
219 | 219 | * @return void |
220 | 220 | */ |
221 | - public function get_nearby_cities( $state, $city, $radius, $sort = 'rating' ) { |
|
222 | - $request = $this->base_uri . '/cities/nearby/' . $state . '/'. $city .'?key=' . static::$api_key . '&radius='. $radius .'&sort=' . $sort; |
|
223 | - $xml = simplexml_load_file( $request ); |
|
224 | - $json = wp_json_encode( $xml ); |
|
225 | - $results = json_decode( $json, true ); |
|
221 | + public function get_nearby_cities($state, $city, $radius, $sort = 'rating') { |
|
222 | + $request = $this->base_uri . '/cities/nearby/' . $state . '/' . $city . '?key=' . static::$api_key . '&radius=' . $radius . '&sort=' . $sort; |
|
223 | + $xml = simplexml_load_file($request); |
|
224 | + $json = wp_json_encode($xml); |
|
225 | + $results = json_decode($json, true); |
|
226 | 226 | return $results; |
227 | 227 | } |
228 | 228 | /** |
@@ -233,11 +233,11 @@ discard block |
||
233 | 233 | * @param mixed $city City. |
234 | 234 | * @return void |
235 | 235 | */ |
236 | - public function get_districts( $state, $city ) { |
|
237 | - $request = $this->base_uri . '/districts/' . $state . '/'. $city .'?key=' . static::$api_key; |
|
238 | - $xml = simplexml_load_file( $request ); |
|
239 | - $json = wp_json_encode( $xml ); |
|
240 | - $results = json_decode( $json, true ); |
|
236 | + public function get_districts($state, $city) { |
|
237 | + $request = $this->base_uri . '/districts/' . $state . '/' . $city . '?key=' . static::$api_key; |
|
238 | + $xml = simplexml_load_file($request); |
|
239 | + $json = wp_json_encode($xml); |
|
240 | + $results = json_decode($json, true); |
|
241 | 241 | return $results; |
242 | 242 | } |
243 | 243 | } |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if ( ! class_exists( 'RealEstateTools' ) ) { |
|
3 | +if ( ! class_exists('RealEstateTools')) { |
|
4 | 4 | |
5 | 5 | /** |
6 | 6 | * RealEstateTools class. |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | * @param mixed $address |
25 | 25 | * @return void |
26 | 26 | */ |
27 | - public function extract_zipcode( $address ) { |
|
27 | + public function extract_zipcode($address) { |
|
28 | 28 | $zipcode = preg_match("/\b[A-Z]{2}\s+\d{5}(-\d{4})?\b/", $address, $matches); |
29 | 29 | return $matches[0]; |
30 | 30 | } |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | * @param mixed $text |
37 | 37 | * @return void |
38 | 38 | */ |
39 | - public function extract_bed_count( $text ) { |
|
39 | + public function extract_bed_count($text) { |
|
40 | 40 | $beds = preg_match("/\d (beds|Beds|Bedrooms)/", $text, $matches); |
41 | 41 | $beds_text = $matches[0]; |
42 | 42 | return $int = filter_var($beds_text, FILTER_SANITIZE_NUMBER_INT); |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | * @param mixed $text |
50 | 50 | * @return void |
51 | 51 | */ |
52 | - public function extract_bath_count( $text ) { |
|
52 | + public function extract_bath_count($text) { |
|
53 | 53 | $baths = preg_match("/\d (bath|Baths|Bathrooms)/", $text, $matches); |
54 | 54 | $baths_text = $matches[0]; |
55 | 55 | return $int = filter_var($beds_text, FILTER_SANITIZE_NUMBER_INT); |
@@ -62,8 +62,8 @@ discard block |
||
62 | 62 | * @param mixed $zip_code |
63 | 63 | * @return void |
64 | 64 | */ |
65 | - public function validate_usa_zipcode( $zip_code ) { |
|
66 | - if ( preg_match("/^([0-9]{5})(-[0-9]{4})?$/i", $zip_code) ) |
|
65 | + public function validate_usa_zipcode($zip_code) { |
|
66 | + if (preg_match("/^([0-9]{5})(-[0-9]{4})?$/i", $zip_code)) |
|
67 | 67 | return true; |
68 | 68 | else |
69 | 69 | return false; |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | * @return void |
79 | 79 | */ |
80 | 80 | public function is_valid_latitude($latitude) { |
81 | - if ( preg_match("/^-?([1-8]?[1-9]|[1-9]0)\.{1}\d{1,6}$/", $latitude) ) { |
|
81 | + if (preg_match("/^-?([1-8]?[1-9]|[1-9]0)\.{1}\d{1,6}$/", $latitude)) { |
|
82 | 82 | return true; |
83 | 83 | } else { |
84 | 84 | return false; |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | /* Exit if accessed directly. */ |
4 | -if ( ! defined( 'ABSPATH' ) ) { exit; } |
|
4 | +if ( ! defined('ABSPATH')) { exit; } |
|
5 | 5 | |
6 | 6 | require_once('widgets/inman-news-widget.php'); |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | /* Exit if accessed directly. */ |
4 | -if ( ! defined( 'ABSPATH' ) ) { exit; } |
|
4 | +if ( ! defined('ABSPATH')) { exit; } |
|
5 | 5 | |
6 | 6 | /** |
7 | 7 | * Inman Feed Widget |
@@ -27,9 +27,9 @@ discard block |
||
27 | 27 | |
28 | 28 | parent::__construct( |
29 | 29 | 'inman_news_widget', |
30 | - __( 'Inman News', 're-pro' ), |
|
30 | + __('Inman News', 're-pro'), |
|
31 | 31 | array( |
32 | - 'description' => __( 'Display the lastest news from Inman.', 're-pro' ), |
|
32 | + 'description' => __('Display the lastest news from Inman.', 're-pro'), |
|
33 | 33 | 'classname' => 're-pro re-pro-widget inman-widget inman-news-widget', |
34 | 34 | 'customize_selective_refresh' => true, |
35 | 35 | ) |
@@ -44,34 +44,34 @@ discard block |
||
44 | 44 | * @param mixed $instance Instance. |
45 | 45 | * @return void |
46 | 46 | */ |
47 | - public function widget( $args, $instance ) { |
|
47 | + public function widget($args, $instance) { |
|
48 | 48 | |
49 | 49 | |
50 | - $title = ! empty( $instance['title'] ) ? $instance['title'] : ''; |
|
51 | - $display_total = ! empty( $instance['display_total'] ) ? $instance['display_total'] : '3'; |
|
50 | + $title = ! empty($instance['title']) ? $instance['title'] : ''; |
|
51 | + $display_total = ! empty($instance['display_total']) ? $instance['display_total'] : '3'; |
|
52 | 52 | |
53 | 53 | |
54 | 54 | echo $args['before_widget']; |
55 | 55 | |
56 | - echo $args['before_title'] . esc_attr( $title ) . $args['after_title']; |
|
56 | + echo $args['before_title'] . esc_attr($title) . $args['after_title']; |
|
57 | 57 | |
58 | 58 | |
59 | - $rss = fetch_feed( 'https://feeds.feedburner.com/inmannews' ); |
|
59 | + $rss = fetch_feed('https://feeds.feedburner.com/inmannews'); |
|
60 | 60 | |
61 | 61 | |
62 | 62 | |
63 | - if( ! is_wp_error( $rss ) ) { |
|
63 | + if ( ! is_wp_error($rss)) { |
|
64 | 64 | |
65 | - $max_items = $rss->get_item_quantity( $display_total ); |
|
66 | - $rss_items = $rss->get_items( 0, $display_total ); |
|
65 | + $max_items = $rss->get_item_quantity($display_total); |
|
66 | + $rss_items = $rss->get_items(0, $display_total); |
|
67 | 67 | |
68 | 68 | // echo $rss->get_title(); |
69 | 69 | // echo '<small>'. $rss->get_description() . '.</small>'; |
70 | 70 | |
71 | - foreach( $rss_items as $item ) { |
|
71 | + foreach ($rss_items as $item) { |
|
72 | 72 | |
73 | 73 | echo '<div style="margin:20px 0;">'; |
74 | - echo '<h4><a href="'. $item->get_link() .'" rel="nofollow" target="_blank">' . $item->get_title() . '</a></h4>'; |
|
74 | + echo '<h4><a href="' . $item->get_link() . '" rel="nofollow" target="_blank">' . $item->get_title() . '</a></h4>'; |
|
75 | 75 | echo '</div>'; |
76 | 76 | |
77 | 77 | echo $item->get_content(); |
@@ -92,22 +92,22 @@ discard block |
||
92 | 92 | * @param mixed $instance Instance. |
93 | 93 | * @return void |
94 | 94 | */ |
95 | - public function form( $instance ) { |
|
95 | + public function form($instance) { |
|
96 | 96 | |
97 | 97 | // Set default values. |
98 | - $instance = wp_parse_args( (array) $instance, array( |
|
98 | + $instance = wp_parse_args((array) $instance, array( |
|
99 | 99 | 'title' => '', |
100 | 100 | |
101 | 101 | )); |
102 | 102 | |
103 | 103 | // Retrieve an existing value from the database. |
104 | - $title = ! empty( $instance['title'] ) ? $instance['title'] : ''; |
|
105 | - $display_total = ! empty( $instance['display_total'] ) ? $instance['display_total'] : ''; |
|
104 | + $title = ! empty($instance['title']) ? $instance['title'] : ''; |
|
105 | + $display_total = ! empty($instance['display_total']) ? $instance['display_total'] : ''; |
|
106 | 106 | |
107 | 107 | // Title. |
108 | 108 | echo '<p>'; |
109 | - echo ' <label for="' . $this->get_field_id( 'title' ) . '" class="title-label">' . __( 'Tile:', 're-pro' ) . '</label>'; |
|
110 | - echo ' <input id="' . $this->get_field_id( 'title' ) . '" name="' . $this->get_field_name( 'title' ) . '" value="' . $title . '" class="widefat">'; |
|
109 | + echo ' <label for="' . $this->get_field_id('title') . '" class="title-label">' . __('Tile:', 're-pro') . '</label>'; |
|
110 | + echo ' <input id="' . $this->get_field_id('title') . '" name="' . $this->get_field_name('title') . '" value="' . $title . '" class="widefat">'; |
|
111 | 111 | echo '</p>'; |
112 | 112 | |
113 | 113 | // TODO: Add field to select display total count, 1 - 20. |
@@ -122,12 +122,12 @@ discard block |
||
122 | 122 | * @param mixed $old_instance Old Instance. |
123 | 123 | * @return $instance |
124 | 124 | */ |
125 | - public function update( $new_instance, $old_instance ) { |
|
125 | + public function update($new_instance, $old_instance) { |
|
126 | 126 | |
127 | 127 | $instance = $old_instance; |
128 | 128 | |
129 | - $instance['title'] = ! empty( $new_instance['title'] ) ? strip_tags( $new_instance['title'] ) : ''; |
|
130 | - $instance['display_total'] = ! empty( $new_instance['display_total'] ) ? strip_tags( $new_instance['display_total'] ) : ''; |
|
129 | + $instance['title'] = ! empty($new_instance['title']) ? strip_tags($new_instance['title']) : ''; |
|
130 | + $instance['display_total'] = ! empty($new_instance['display_total']) ? strip_tags($new_instance['display_total']) : ''; |
|
131 | 131 | |
132 | 132 | return $instance; |
133 | 133 | } |
@@ -141,6 +141,6 @@ discard block |
||
141 | 141 | */ |
142 | 142 | function repro_inman_news_widget() { |
143 | 143 | |
144 | - register_widget( 'InmanNewsWidget' ); |
|
144 | + register_widget('InmanNewsWidget'); |
|
145 | 145 | } |
146 | -add_action( 'widgets_init', 'repro_inman_news_widget' ); |
|
146 | +add_action('widgets_init', 'repro_inman_news_widget'); |