@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | */ |
7 | 7 | |
8 | 8 | /* Exit if accessed directly. */ |
9 | -if ( ! defined( 'ABSPATH' ) ) { exit; } |
|
9 | +if ( ! defined('ABSPATH')) { exit; } |
|
10 | 10 | |
11 | 11 | /** |
12 | 12 | * HomesTallSearchWidget class. |
@@ -25,9 +25,9 @@ discard block |
||
25 | 25 | |
26 | 26 | parent::__construct( |
27 | 27 | 'homes_tall_search', |
28 | - __( 'Homes Real Estate Search - Tall', 're-pro' ), |
|
28 | + __('Homes Real Estate Search - Tall', 're-pro'), |
|
29 | 29 | array( |
30 | - 'description' => __( 'Display a tall search box from Homes.com', 're-pro' ), |
|
30 | + 'description' => __('Display a tall search box from Homes.com', 're-pro'), |
|
31 | 31 | 'classname' => 're-pro re-pro-widget homes-widget homes-tall-search', |
32 | 32 | 'customize_selective_refresh' => true, |
33 | 33 | ) |
@@ -41,21 +41,21 @@ discard block |
||
41 | 41 | * @param mixed $args Arguments. |
42 | 42 | * @param mixed $instance Instance. |
43 | 43 | */ |
44 | - public function widget( $args, $instance ) { |
|
44 | + public function widget($args, $instance) { |
|
45 | 45 | |
46 | - $iframe_id = ! empty( $args['widget_id'] ) ? $args['widget_id'] : ''; |
|
47 | - $title = ! empty( $instance['title'] ) ? $instance['title'] : ''; |
|
48 | - $location = ! empty( $instance['location'] ) ? $instance['location'] : ''; |
|
49 | - $color = ! empty( $instance['color'] ) ? $instance['color'] : ''; |
|
50 | - $status = ! empty( $instance['status'] ) ? $instance['status'] : ''; |
|
46 | + $iframe_id = ! empty($args['widget_id']) ? $args['widget_id'] : ''; |
|
47 | + $title = ! empty($instance['title']) ? $instance['title'] : ''; |
|
48 | + $location = ! empty($instance['location']) ? $instance['location'] : ''; |
|
49 | + $color = ! empty($instance['color']) ? $instance['color'] : ''; |
|
50 | + $status = ! empty($instance['status']) ? $instance['status'] : ''; |
|
51 | 51 | |
52 | 52 | echo $args['before_widget']; |
53 | 53 | |
54 | - echo $args['before_title'] . esc_attr( $title ) . $args['after_title']; |
|
54 | + echo $args['before_title'] . esc_attr($title) . $args['after_title']; |
|
55 | 55 | |
56 | 56 | $homes_widgets = new HomesWidgets(); |
57 | 57 | |
58 | - $homes_widgets->get_tall_search( $iframe_id, $location, $color, $status ); |
|
58 | + $homes_widgets->get_tall_search($iframe_id, $location, $color, $status); |
|
59 | 59 | |
60 | 60 | echo $args['after_widget']; |
61 | 61 | } |
@@ -67,46 +67,46 @@ discard block |
||
67 | 67 | * @param mixed $instance Instance. |
68 | 68 | * @return void |
69 | 69 | */ |
70 | - public function form( $instance ) { |
|
70 | + public function form($instance) { |
|
71 | 71 | |
72 | 72 | // Set default values. |
73 | - $instance = wp_parse_args( (array) $instance, array( |
|
73 | + $instance = wp_parse_args((array) $instance, array( |
|
74 | 74 | 'title' => '', |
75 | 75 | 'location' => '', |
76 | 76 | 'color' => '0054a0', |
77 | 77 | 'status' => 'FOR SALE', |
78 | - ) ); |
|
78 | + )); |
|
79 | 79 | |
80 | 80 | // Retrieve an existing value from the database. |
81 | - $title = ! empty( $instance['title'] ) ? $instance['title'] : ''; |
|
82 | - $location = ! empty( $instance['location'] ) ? $instance['location'] : ''; |
|
83 | - $color = ! empty( $instance['color'] ) ? $instance['color'] : ''; |
|
84 | - $status = ! empty( $instance['status'] ) ? $instance['status'] : ''; |
|
81 | + $title = ! empty($instance['title']) ? $instance['title'] : ''; |
|
82 | + $location = ! empty($instance['location']) ? $instance['location'] : ''; |
|
83 | + $color = ! empty($instance['color']) ? $instance['color'] : ''; |
|
84 | + $status = ! empty($instance['status']) ? $instance['status'] : ''; |
|
85 | 85 | |
86 | 86 | // Title. |
87 | 87 | echo '<p>'; |
88 | - echo ' <label for="' . $this->get_field_id( 'title' ) . '" class="title-label">' . __( 'Tile:', 're-pro' ) . '</label>'; |
|
89 | - echo ' <input id="' . $this->get_field_id( 'title' ) . '" name="' . $this->get_field_name( 'title' ) . '" value="' . $title . '" class="widefat">'; |
|
88 | + echo ' <label for="' . $this->get_field_id('title') . '" class="title-label">' . __('Tile:', 're-pro') . '</label>'; |
|
89 | + echo ' <input id="' . $this->get_field_id('title') . '" name="' . $this->get_field_name('title') . '" value="' . $title . '" class="widefat">'; |
|
90 | 90 | echo '</p>'; |
91 | 91 | |
92 | 92 | // Location. |
93 | 93 | echo '<p>'; |
94 | - echo ' <label for="' . $this->get_field_id( 'location' ) . '" class="title-label">' . __( 'Location:', 're-pro' ) . '</label>'; |
|
95 | - echo ' <input id="' . $this->get_field_id( 'location' ) . '" name="' . $this->get_field_name( 'location' ) . '" value="' . $location . '" class="widefat">'; |
|
94 | + echo ' <label for="' . $this->get_field_id('location') . '" class="title-label">' . __('Location:', 're-pro') . '</label>'; |
|
95 | + echo ' <input id="' . $this->get_field_id('location') . '" name="' . $this->get_field_name('location') . '" value="' . $location . '" class="widefat">'; |
|
96 | 96 | echo '</p>'; |
97 | 97 | |
98 | 98 | // Color. |
99 | 99 | echo '<p>'; |
100 | - echo ' <label for="' . $this->get_field_id( 'color' ) . '" class="title-label">' . __( 'Color:', 're-pro' ) . '</label>'; |
|
101 | - echo ' <input id="' . $this->get_field_id( 'color' ) . '" name="' . $this->get_field_name( 'color' ) . '" value="' . $color . '" class="widefat">'; |
|
100 | + echo ' <label for="' . $this->get_field_id('color') . '" class="title-label">' . __('Color:', 're-pro') . '</label>'; |
|
101 | + echo ' <input id="' . $this->get_field_id('color') . '" name="' . $this->get_field_name('color') . '" value="' . $color . '" class="widefat">'; |
|
102 | 102 | echo '</p>'; |
103 | 103 | |
104 | 104 | // Listing Status. |
105 | 105 | echo '<p>'; |
106 | - echo ' <label for="' . $this->get_field_id( 'status' ) . '" class="title-label">' . __( 'Search Types:', 're-pro' ) . '</label>'; |
|
106 | + echo ' <label for="' . $this->get_field_id('status') . '" class="title-label">' . __('Search Types:', 're-pro') . '</label>'; |
|
107 | 107 | echo ' <br />'; |
108 | - echo ' <input id="' . $this->get_field_id( 'status' ) . '" type="radio" name="' . $this->get_field_name( 'status' ) . '" value="FOR SALE"' . checked( $status, 'FOR SALE', false ) . '>For Sale<br />' . "\n"; |
|
109 | - echo ' <input id="' . $this->get_field_id( 'status' ) . '" type="radio" name="' . $this->get_field_name( 'status' ) . '" value="FOR RENT"' . checked( $status, 'FOR RENT', false ) . '>For Rent<br />' . "\n"; |
|
108 | + echo ' <input id="' . $this->get_field_id('status') . '" type="radio" name="' . $this->get_field_name('status') . '" value="FOR SALE"' . checked($status, 'FOR SALE', false) . '>For Sale<br />' . "\n"; |
|
109 | + echo ' <input id="' . $this->get_field_id('status') . '" type="radio" name="' . $this->get_field_name('status') . '" value="FOR RENT"' . checked($status, 'FOR RENT', false) . '>For Rent<br />' . "\n"; |
|
110 | 110 | echo '</p>'; |
111 | 111 | } |
112 | 112 | |
@@ -118,14 +118,14 @@ discard block |
||
118 | 118 | * @param mixed $old_instance Old Instance. |
119 | 119 | * @return $instance |
120 | 120 | */ |
121 | - public function update( $new_instance, $old_instance ) { |
|
121 | + public function update($new_instance, $old_instance) { |
|
122 | 122 | |
123 | 123 | $instance = $old_instance; |
124 | 124 | |
125 | - $instance['title'] = ! empty( $new_instance['title'] ) ? strip_tags( $new_instance['title'] ) : ''; |
|
126 | - $instance['location'] = ! empty( $new_instance['location'] ) ? strip_tags( $new_instance['location'] ) : ''; |
|
127 | - $instance['color'] = ! empty( $new_instance['color'] ) ? strip_tags( $new_instance['color'] ) : ''; |
|
128 | - $instance['status'] = ! empty( $new_instance['status'] ) ? strip_tags( $new_instance['status'] ) : ''; |
|
125 | + $instance['title'] = ! empty($new_instance['title']) ? strip_tags($new_instance['title']) : ''; |
|
126 | + $instance['location'] = ! empty($new_instance['location']) ? strip_tags($new_instance['location']) : ''; |
|
127 | + $instance['color'] = ! empty($new_instance['color']) ? strip_tags($new_instance['color']) : ''; |
|
128 | + $instance['status'] = ! empty($new_instance['status']) ? strip_tags($new_instance['status']) : ''; |
|
129 | 129 | |
130 | 130 | return $instance; |
131 | 131 | } |
@@ -138,8 +138,8 @@ discard block |
||
138 | 138 | * @return void |
139 | 139 | */ |
140 | 140 | function repro_homes_com_tall_search() { |
141 | - if ( ! is_ssl() ) { |
|
142 | - register_widget( 'HomesTallSearchWidget' ); |
|
141 | + if ( ! is_ssl()) { |
|
142 | + register_widget('HomesTallSearchWidget'); |
|
143 | 143 | } |
144 | 144 | } |
145 | -add_action( 'widgets_init', 'repro_homes_com_tall_search' ); |
|
145 | +add_action('widgets_init', 'repro_homes_com_tall_search'); |
@@ -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'); |
@@ -22,9 +22,9 @@ discard block |
||
22 | 22 | |
23 | 23 | parent::__construct( |
24 | 24 | 'wp-api-maps', |
25 | - __( 'Google Maps' ), |
|
25 | + __('Google Maps'), |
|
26 | 26 | array( |
27 | - 'description' => __( 'Display a location on google maps' ), |
|
27 | + 'description' => __('Display a location on google maps'), |
|
28 | 28 | 'classname' => 'wp-api-libraries', |
29 | 29 | ) |
30 | 30 | ); |
@@ -38,17 +38,17 @@ discard block |
||
38 | 38 | * @param mixed $instance Instance. |
39 | 39 | * @return void |
40 | 40 | */ |
41 | - public function widget( $args, $instance ) { |
|
42 | - $instance = $this->parse_args( $instance ); |
|
41 | + public function widget($args, $instance) { |
|
42 | + $instance = $this->parse_args($instance); |
|
43 | 43 | |
44 | 44 | // Display widget title. |
45 | - if ( isset( $instance['title'] ) ) { |
|
45 | + if (isset($instance['title'])) { |
|
46 | 46 | echo $args['before_title']; |
47 | - echo esc_attr( $instance['title'] ); |
|
47 | + echo esc_attr($instance['title']); |
|
48 | 48 | echo $args['after_title']; |
49 | 49 | } |
50 | 50 | |
51 | - WPAPI_GOOGLE_MAPS::print_map( $instance ); |
|
51 | + WPAPI_GOOGLE_MAPS::print_map($instance); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | /** |
@@ -58,75 +58,75 @@ discard block |
||
58 | 58 | * @param mixed $instance Instance. |
59 | 59 | * @return void |
60 | 60 | */ |
61 | - public function form( $instance ) { |
|
61 | + public function form($instance) { |
|
62 | 62 | // Set default values. |
63 | - $instance = $this->parse_args( $instance ); |
|
63 | + $instance = $this->parse_args($instance); |
|
64 | 64 | |
65 | 65 | // Retrieve an existing value from the database. |
66 | - $title['val'] = ! empty( $instance['title'] ) ? $instance['title'] : ''; |
|
67 | - $lat['val'] = ! empty( $instance['lat'] ) ? $instance['lat'] : ''; |
|
68 | - $lng['val'] = ! empty( $instance['lng'] ) ? $instance['lng'] : ''; |
|
69 | - $info['val'] = ! empty( $instance['info'] ) ? $instance['info'] : ''; |
|
70 | - $width['val'] = ! empty( $instance['width'] ) ? $instance['width'] : ''; |
|
71 | - $height['val'] = ! empty( $instance['height'] ) ? $instance['height'] : ''; |
|
72 | - $zoom['val'] = ! empty( $instance['zoom'] ) ? $instance['zoom'] : ''; |
|
73 | - |
|
74 | - $title['id'] = $this->get_field_id( 'title' ); |
|
75 | - $lat['id'] = $this->get_field_id( 'lat' ); |
|
76 | - $lng['id'] = $this->get_field_id( 'lng' ); |
|
77 | - $info['id'] = $this->get_field_id( 'info' ); |
|
78 | - $width['id'] = $this->get_field_id( 'width' ); |
|
79 | - $height['id'] = $this->get_field_id( 'height' ); |
|
80 | - $zoom['id'] = $this->get_field_id( 'zoom' ); |
|
81 | - |
|
82 | - $title['name'] = $this->get_field_name( 'title' ); |
|
83 | - $lat['name'] = $this->get_field_name( 'lat' ); |
|
84 | - $lng['name'] = $this->get_field_name( 'lng' ); |
|
85 | - $info['name'] = $this->get_field_name( 'info' ); |
|
86 | - $width['name'] = $this->get_field_name( 'width' ); |
|
87 | - $height['name'] = $this->get_field_name( 'height' ); |
|
88 | - $zoom['name'] = $this->get_field_name( 'zoom' ); |
|
66 | + $title['val'] = ! empty($instance['title']) ? $instance['title'] : ''; |
|
67 | + $lat['val'] = ! empty($instance['lat']) ? $instance['lat'] : ''; |
|
68 | + $lng['val'] = ! empty($instance['lng']) ? $instance['lng'] : ''; |
|
69 | + $info['val'] = ! empty($instance['info']) ? $instance['info'] : ''; |
|
70 | + $width['val'] = ! empty($instance['width']) ? $instance['width'] : ''; |
|
71 | + $height['val'] = ! empty($instance['height']) ? $instance['height'] : ''; |
|
72 | + $zoom['val'] = ! empty($instance['zoom']) ? $instance['zoom'] : ''; |
|
73 | + |
|
74 | + $title['id'] = $this->get_field_id('title'); |
|
75 | + $lat['id'] = $this->get_field_id('lat'); |
|
76 | + $lng['id'] = $this->get_field_id('lng'); |
|
77 | + $info['id'] = $this->get_field_id('info'); |
|
78 | + $width['id'] = $this->get_field_id('width'); |
|
79 | + $height['id'] = $this->get_field_id('height'); |
|
80 | + $zoom['id'] = $this->get_field_id('zoom'); |
|
81 | + |
|
82 | + $title['name'] = $this->get_field_name('title'); |
|
83 | + $lat['name'] = $this->get_field_name('lat'); |
|
84 | + $lng['name'] = $this->get_field_name('lng'); |
|
85 | + $info['name'] = $this->get_field_name('info'); |
|
86 | + $width['name'] = $this->get_field_name('width'); |
|
87 | + $height['name'] = $this->get_field_name('height'); |
|
88 | + $zoom['name'] = $this->get_field_name('zoom'); |
|
89 | 89 | |
90 | 90 | // Widget title. |
91 | 91 | echo '<p>'; |
92 | - echo ' <label for="' . esc_attr( $title['id'] ) . '" class="wp-api-maps_title_label">' . esc_attr( 'Title:' ) . '</label>'; |
|
93 | - echo ' <input type="text" id="' . esc_attr( $title['id'] ) . '" name="' . esc_attr( $title['name'] ) . '" class="widefat" value="' . esc_attr( $title['val'] ) . '">'; |
|
92 | + echo ' <label for="' . esc_attr($title['id']) . '" class="wp-api-maps_title_label">' . esc_attr('Title:') . '</label>'; |
|
93 | + echo ' <input type="text" id="' . esc_attr($title['id']) . '" name="' . esc_attr($title['name']) . '" class="widefat" value="' . esc_attr($title['val']) . '">'; |
|
94 | 94 | echo '</p>'; |
95 | 95 | |
96 | 96 | // Widget width. |
97 | 97 | echo '<p>'; |
98 | - echo ' <label for="' . esc_attr( $width['id'] ) . '" class="wp-api-maps_width_label">' . esc_attr( 'Width:' ) . '</label>'; |
|
99 | - echo ' <input type="text" id="' . esc_attr( $width['id'] ) . '" name="' . esc_attr( $width['name'] ) . '" class="widefat" value="' . esc_attr( $width['val'] ) . '">'; |
|
98 | + echo ' <label for="' . esc_attr($width['id']) . '" class="wp-api-maps_width_label">' . esc_attr('Width:') . '</label>'; |
|
99 | + echo ' <input type="text" id="' . esc_attr($width['id']) . '" name="' . esc_attr($width['name']) . '" class="widefat" value="' . esc_attr($width['val']) . '">'; |
|
100 | 100 | echo '</p>'; |
101 | 101 | |
102 | 102 | // Widget height. |
103 | 103 | echo '<p>'; |
104 | - echo ' <label for="' . esc_attr( $height['id'] ) . '" class="wp-api-maps_height_label">' . esc_attr( 'Height:' ) . '</label>'; |
|
105 | - echo ' <input type="text" id="' . esc_attr( $height['id'] ) . '" name="' . esc_attr( $height['name'] ) . '" class="widefat" value="' . esc_attr( $height['val'] ) . '">'; |
|
104 | + echo ' <label for="' . esc_attr($height['id']) . '" class="wp-api-maps_height_label">' . esc_attr('Height:') . '</label>'; |
|
105 | + echo ' <input type="text" id="' . esc_attr($height['id']) . '" name="' . esc_attr($height['name']) . '" class="widefat" value="' . esc_attr($height['val']) . '">'; |
|
106 | 106 | echo '</p>'; |
107 | 107 | |
108 | 108 | // Latitude input. |
109 | 109 | echo '<p>'; |
110 | - echo ' <label for="' . esc_attr( $lat['id'] ) . '" class="wp-api-maps_lat_label">' . esc_attr( 'Latitude:' ) . '</label>'; |
|
111 | - echo ' <input type="text" id="' . esc_attr( $lat['id'] ) . '" name="' . esc_attr( $lat['name'] ) . '" class="widefat" value="' . esc_attr( $lat['val'] ) . '">'; |
|
110 | + echo ' <label for="' . esc_attr($lat['id']) . '" class="wp-api-maps_lat_label">' . esc_attr('Latitude:') . '</label>'; |
|
111 | + echo ' <input type="text" id="' . esc_attr($lat['id']) . '" name="' . esc_attr($lat['name']) . '" class="widefat" value="' . esc_attr($lat['val']) . '">'; |
|
112 | 112 | echo '</p>'; |
113 | 113 | |
114 | 114 | // Longitude input. |
115 | 115 | echo '<p>'; |
116 | - echo ' <label for="' . esc_attr( $lng['id'] ) . '" class="wp-api-maps_lng_label">' . esc_attr( 'Longitude:' ) . '</label>'; |
|
117 | - echo ' <input type="text" id="' . esc_attr( $lng['id'] ) . '" name="' . esc_attr( $lng['name'] ) . '" class="widefat" value="' . esc_attr( $lng['val'] ) . '">'; |
|
116 | + echo ' <label for="' . esc_attr($lng['id']) . '" class="wp-api-maps_lng_label">' . esc_attr('Longitude:') . '</label>'; |
|
117 | + echo ' <input type="text" id="' . esc_attr($lng['id']) . '" name="' . esc_attr($lng['name']) . '" class="widefat" value="' . esc_attr($lng['val']) . '">'; |
|
118 | 118 | echo '</p>'; |
119 | 119 | |
120 | 120 | // Info content input. |
121 | 121 | echo '<p>'; |
122 | - echo ' <label for="' . esc_attr( $info['id'] ) . '" class="wp-api-maps_info_label">' . esc_attr( 'Info window content:' ) . '</label>'; |
|
123 | - echo ' <input type="text" id="' . esc_attr( $info['id'] ) . '" name="' . esc_attr( $info['name'] ) . '" class="widefat" value="' . esc_attr( $info['val'] ) . '">'; |
|
122 | + echo ' <label for="' . esc_attr($info['id']) . '" class="wp-api-maps_info_label">' . esc_attr('Info window content:') . '</label>'; |
|
123 | + echo ' <input type="text" id="' . esc_attr($info['id']) . '" name="' . esc_attr($info['name']) . '" class="widefat" value="' . esc_attr($info['val']) . '">'; |
|
124 | 124 | echo '</p>'; |
125 | 125 | |
126 | 126 | // Zoom input. |
127 | 127 | echo '<p>'; |
128 | - echo ' <label for="' . esc_attr( $zoom['id'] ) . '" class="wp-api-maps_zoom_label">' . esc_attr( 'Zoom:' ) . '</label>'; |
|
129 | - echo ' <input type="text" id="' . esc_attr( $zoom['id'] ) . '" name="' . esc_attr( $zoom['name'] ) . '" class="widefat" value="' . esc_attr( $zoom['val'] ) . '">'; |
|
128 | + echo ' <label for="' . esc_attr($zoom['id']) . '" class="wp-api-maps_zoom_label">' . esc_attr('Zoom:') . '</label>'; |
|
129 | + echo ' <input type="text" id="' . esc_attr($zoom['id']) . '" name="' . esc_attr($zoom['name']) . '" class="widefat" value="' . esc_attr($zoom['val']) . '">'; |
|
130 | 130 | echo '</p>'; |
131 | 131 | } |
132 | 132 | |
@@ -138,17 +138,17 @@ discard block |
||
138 | 138 | * @param mixed $old_instance Old Instance. |
139 | 139 | * @return $instance Instance. |
140 | 140 | */ |
141 | - public function update( $new_instance, $old_instance ) { |
|
141 | + public function update($new_instance, $old_instance) { |
|
142 | 142 | |
143 | 143 | $instance = $old_instance; |
144 | 144 | |
145 | - $instance['title'] = ! empty( $new_instance['title'] ) ? strip_tags( $new_instance['title'] ) : ''; |
|
146 | - $instance['width'] = ! empty( $new_instance['width'] ) ? strip_tags( $new_instance['width'] ) : ''; |
|
147 | - $instance['height'] = ! empty( $new_instance['height'] ) ? strip_tags( $new_instance['height'] ) : ''; |
|
148 | - $instance['lat'] = ! empty( $new_instance['lat'] ) ? strip_tags( $new_instance['lat'] ) : ''; |
|
149 | - $instance['lng'] = ! empty( $new_instance['lng'] ) ? strip_tags( $new_instance['lng'] ) : ''; |
|
150 | - $instance['info'] = ! empty( $new_instance['info'] ) ? strip_tags( $new_instance['info'] ) : ''; |
|
151 | - $instance['zoom'] = ! empty( $new_instance['zoom'] ) ? strip_tags( $new_instance['zoom'] ) : null; |
|
145 | + $instance['title'] = ! empty($new_instance['title']) ? strip_tags($new_instance['title']) : ''; |
|
146 | + $instance['width'] = ! empty($new_instance['width']) ? strip_tags($new_instance['width']) : ''; |
|
147 | + $instance['height'] = ! empty($new_instance['height']) ? strip_tags($new_instance['height']) : ''; |
|
148 | + $instance['lat'] = ! empty($new_instance['lat']) ? strip_tags($new_instance['lat']) : ''; |
|
149 | + $instance['lng'] = ! empty($new_instance['lng']) ? strip_tags($new_instance['lng']) : ''; |
|
150 | + $instance['info'] = ! empty($new_instance['info']) ? strip_tags($new_instance['info']) : ''; |
|
151 | + $instance['zoom'] = ! empty($new_instance['zoom']) ? strip_tags($new_instance['zoom']) : null; |
|
152 | 152 | |
153 | 153 | return $instance; |
154 | 154 | } |
@@ -159,9 +159,9 @@ discard block |
||
159 | 159 | * @param [Array] $args : Array of arguments to parse. |
160 | 160 | * @return [Array] : Parsed arguments. |
161 | 161 | */ |
162 | - private function parse_args( $args ) { |
|
162 | + private function parse_args($args) { |
|
163 | 163 | // Set default values. |
164 | - $args = wp_parse_args( $args, array( |
|
164 | + $args = wp_parse_args($args, array( |
|
165 | 165 | 'title' => '', |
166 | 166 | 'width' => '300px', |
167 | 167 | 'height' => '300px', |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | 'lng' => '178.0650', |
170 | 170 | 'info' => '', |
171 | 171 | 'zoom' => 8, |
172 | - ) ); |
|
172 | + )); |
|
173 | 173 | |
174 | 174 | return $args; |
175 | 175 | } |
@@ -17,9 +17,9 @@ discard block |
||
17 | 17 | */ |
18 | 18 | |
19 | 19 | // Exit if accessed directly. |
20 | -if ( ! defined( 'ABSPATH' ) ) { exit; } |
|
21 | -if ( ! class_exists( 'WPAPI_GOOGLE_MAPS' ) ) { |
|
22 | - require_once( 'maps-widget.php' ); |
|
20 | +if ( ! defined('ABSPATH')) { exit; } |
|
21 | +if ( ! class_exists('WPAPI_GOOGLE_MAPS')) { |
|
22 | + require_once('maps-widget.php'); |
|
23 | 23 | |
24 | 24 | /** |
25 | 25 | * GreatSchools API Class. |
@@ -68,31 +68,31 @@ discard block |
||
68 | 68 | * @access public |
69 | 69 | * @param String $api_key : API Key. |
70 | 70 | */ |
71 | - public function __construct( $api_key ) { |
|
71 | + public function __construct($api_key) { |
|
72 | 72 | static::$api_key = $api_key; |
73 | 73 | |
74 | - add_action( 'wp_footer', array( $this, 'footer' ), 11 ); |
|
75 | - add_action( 'widgets_init', array( $this, 'register_widgets' ) ); |
|
76 | - add_action( 'wp_enqueue_scripts', array( $this, 'enqueue' ) ); |
|
77 | - add_shortcode( 'wp_google_maps', array( $this, 'shortcode' ) ); |
|
74 | + add_action('wp_footer', array($this, 'footer'), 11); |
|
75 | + add_action('widgets_init', array($this, 'register_widgets')); |
|
76 | + add_action('wp_enqueue_scripts', array($this, 'enqueue')); |
|
77 | + add_shortcode('wp_google_maps', array($this, 'shortcode')); |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | /** |
81 | 81 | * Enqueue JS. |
82 | 82 | */ |
83 | 83 | public function enqueue() { |
84 | - wp_enqueue_script( 'wpapi-google-maps',plugins_url( 'google-maps.js', __FILE__ ), array( 'jquery' ), null, true ); |
|
84 | + wp_enqueue_script('wpapi-google-maps', plugins_url('google-maps.js', __FILE__), array('jquery'), null, true); |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | /** |
88 | 88 | * Handle multiple google maps js api enqueues on the footer. |
89 | 89 | */ |
90 | 90 | public function footer() { |
91 | - wp_localize_script( 'wpapi-google-maps', 'wpapi_gmaps', static::$map_data ); |
|
91 | + wp_localize_script('wpapi-google-maps', 'wpapi_gmaps', static::$map_data); |
|
92 | 92 | |
93 | 93 | // Only enqueue google maps API if yoast hasnt enqueued it already. |
94 | - if ( ! wp_script_is( 'maps-geocoder' ) ) { |
|
95 | - wp_enqueue_script( 'google-maps-api', 'https://maps.googleapis.com/maps/api/js?key=' . static::$api_key, array(), null ); |
|
94 | + if ( ! wp_script_is('maps-geocoder')) { |
|
95 | + wp_enqueue_script('google-maps-api', 'https://maps.googleapis.com/maps/api/js?key=' . static::$api_key, array(), null); |
|
96 | 96 | } |
97 | 97 | } |
98 | 98 | |
@@ -102,16 +102,16 @@ discard block |
||
102 | 102 | * @param [Mixed] $map_data : Array of map data to send to js. |
103 | 103 | * @param [Bool] $echo : If html should be returned or echoed, defaults to true. |
104 | 104 | */ |
105 | - public static function print_map( $map_data, $echo = true ) { |
|
105 | + public static function print_map($map_data, $echo = true) { |
|
106 | 106 | |
107 | - $map_data = apply_filters( 'wpapi_google_map_data', wp_parse_args( $map_data, static::$defaults ) ); |
|
107 | + $map_data = apply_filters('wpapi_google_map_data', wp_parse_args($map_data, static::$defaults)); |
|
108 | 108 | static::$map_data[] = $map_data; |
109 | 109 | |
110 | - $index = count( static::$map_data ) - 1; |
|
110 | + $index = count(static::$map_data) - 1; |
|
111 | 111 | |
112 | - $html = '<div id="wpapi-gmap-' . $index . '" style="width:' . esc_attr( $map_data['width'] ) . ';height:' . esc_attr( $map_data['height'] ) . '"></div>'; |
|
112 | + $html = '<div id="wpapi-gmap-' . $index . '" style="width:' . esc_attr($map_data['width']) . ';height:' . esc_attr($map_data['height']) . '"></div>'; |
|
113 | 113 | |
114 | - if ( $echo ) { |
|
114 | + if ($echo) { |
|
115 | 115 | echo $html; |
116 | 116 | } else { |
117 | 117 | return $html; |
@@ -123,11 +123,11 @@ discard block |
||
123 | 123 | * |
124 | 124 | * @param [type] $atts : shortcode attributes. |
125 | 125 | */ |
126 | - public function shortcode( $atts ) { |
|
126 | + public function shortcode($atts) { |
|
127 | 127 | // Set widget info. |
128 | - $atts = shortcode_atts( static::$defaults, $atts, 'wp_google_maps' ); |
|
128 | + $atts = shortcode_atts(static::$defaults, $atts, 'wp_google_maps'); |
|
129 | 129 | |
130 | - return static::print_map( $atts, false ); |
|
130 | + return static::print_map($atts, false); |
|
131 | 131 | |
132 | 132 | } |
133 | 133 | |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | * @return void |
139 | 139 | */ |
140 | 140 | public function register_widgets() { |
141 | - register_widget( 'WP_API_MAPS_WIDGET' ); |
|
141 | + register_widget('WP_API_MAPS_WIDGET'); |
|
142 | 142 | } |
143 | 143 | } |
144 | 144 |
@@ -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'); |
@@ -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-details', |
23 | - __( 'Street Advisor - Location Details', 're-pro' ), |
|
23 | + __('Street Advisor - Location Details', 're-pro'), |
|
24 | 24 | array( |
25 | - 'description' => __( 'Street Advisor Location Details', 're-pro' ), |
|
25 | + 'description' => __('Street Advisor Location Details', 're-pro'), |
|
26 | 26 | ) |
27 | 27 | ); |
28 | 28 | |
@@ -36,23 +36,23 @@ 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 | -$location = $streetadvisor->get_location_data( $latitude, $longitude, $level ); |
|
49 | +$location = $streetadvisor->get_location_data($latitude, $longitude, $level); |
|
50 | 50 | |
51 | 51 | $name = $location['Location']['Name']; |
52 | 52 | $ranking_description = $location['Location']['RankingDescription']; |
53 | 53 | $score = $location['Location']['Score']; |
54 | -$photo_url = esc_url( apply_filters( 'jetpack_photon_url', $location['Location']['PhotoUrl'] ) ); |
|
55 | -$streetadvisor_url = esc_url( $location['Location']['Url'] ); // Lets force HTTPS for this please ! |
|
54 | +$photo_url = esc_url(apply_filters('jetpack_photon_url', $location['Location']['PhotoUrl'])); |
|
55 | +$streetadvisor_url = esc_url($location['Location']['Url']); // Lets force HTTPS for this please ! |
|
56 | 56 | |
57 | 57 | $recommendations_greatfor = $location['Recommendations']['GreatFor']; |
58 | 58 | $recommendations_notgreatfor = $location['Recommendations']['NotGreatFor']; |
@@ -61,20 +61,20 @@ discard block |
||
61 | 61 | |
62 | 62 | echo $args['before_widget']; |
63 | 63 | |
64 | -echo $args['before_title'] . esc_attr( $title ) . $args['after_title']; |
|
64 | +echo $args['before_title'] . esc_attr($title) . $args['after_title']; |
|
65 | 65 | |
66 | 66 | echo '<style>.sa-column{width:100%;float:left;display:inline-block;}.streetadvisor-list{margin: 10px 0;}.streetadvisor-list li {list-style-type:circle !important;margin:0;padding:0;list-style-position: inside;}</style>'; |
67 | 67 | |
68 | -echo '<img id="" class="" src="'.$photo_url.'" srcset="" sizes="" alt="'. $name .'" height="" width="">'; |
|
68 | +echo '<img id="" class="" src="' . $photo_url . '" srcset="" sizes="" alt="' . $name . '" height="" width="">'; |
|
69 | 69 | |
70 | 70 | |
71 | -echo '<p>' . $name . ' has a score of <strong>' . $score . ' out of 10</strong> on <a href="'. $streetadvisor_url .'" rel="nofollow">StreetAdvisor</a>. '. $ranking_description .'</p>'; |
|
71 | +echo '<p>' . $name . ' has a score of <strong>' . $score . ' out of 10</strong> on <a href="' . $streetadvisor_url . '" rel="nofollow">StreetAdvisor</a>. ' . $ranking_description . '</p>'; |
|
72 | 72 | |
73 | 73 | echo '<div class="sa-column">'; |
74 | 74 | |
75 | 75 | echo '<strong>Great For:</strong>'; |
76 | 76 | echo '<ul class="re-pro streetadvisor-list streetadvisor-great-for">'; |
77 | -foreach($recommendations_greatfor as $greatfor_item) { |
|
77 | +foreach ($recommendations_greatfor as $greatfor_item) { |
|
78 | 78 | echo '<li>' . $greatfor_item . '</li>'; |
79 | 79 | } |
80 | 80 | echo '</ul>'; |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | echo '<div class="sa-column">'; |
84 | 84 | echo '<strong>Not Great For:</strong>'; |
85 | 85 | echo '<ul class="re-pro streetadvisor-list streetadvisor-not-great-for">'; |
86 | -foreach($recommendations_notgreatfor as $notgreatfor_item) { |
|
86 | +foreach ($recommendations_notgreatfor as $notgreatfor_item) { |
|
87 | 87 | echo '<li>' . $notgreatfor_item . '</li>'; |
88 | 88 | } |
89 | 89 | echo '</ul>'; |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | echo '<div class="sa-column">'; |
93 | 93 | echo '<strong>Who Lives Here:</strong>'; |
94 | 94 | echo '<ul class="re-pro streetadvisor-list streetadvisor-who-lives-here">'; |
95 | -foreach($recommendations_wholiveshere as $wholiveshere_item) { |
|
95 | +foreach ($recommendations_wholiveshere as $wholiveshere_item) { |
|
96 | 96 | echo '<li>' . $wholiveshere_item . '</li>'; |
97 | 97 | } |
98 | 98 | echo '</ul>'; |
@@ -109,45 +109,45 @@ discard block |
||
109 | 109 | * @param mixed $instance |
110 | 110 | * @return void |
111 | 111 | */ |
112 | - public function form( $instance ) { |
|
112 | + public function form($instance) { |
|
113 | 113 | |
114 | 114 | // Set default values |
115 | - $instance = wp_parse_args( (array) $instance, array( |
|
115 | + $instance = wp_parse_args((array) $instance, array( |
|
116 | 116 | 'latitude' => '', |
117 | 117 | 'longitude' => '', |
118 | 118 | 'level' => '', |
119 | 119 | 'title' => '', |
120 | - ) ); |
|
120 | + )); |
|
121 | 121 | |
122 | 122 | // Retrieve an existing value from the database |
123 | - $latitude = !empty( $instance['latitude'] ) ? $instance['latitude'] : ''; |
|
124 | - $longitude = !empty( $instance['longitude'] ) ? $instance['longitude'] : ''; |
|
125 | - $level = !empty( $instance['level'] ) ? $instance['level'] : ''; |
|
126 | - $title = !empty( $instance['title'] ) ? $instance['title'] : ''; |
|
123 | + $latitude = ! empty($instance['latitude']) ? $instance['latitude'] : ''; |
|
124 | + $longitude = ! empty($instance['longitude']) ? $instance['longitude'] : ''; |
|
125 | + $level = ! empty($instance['level']) ? $instance['level'] : ''; |
|
126 | + $title = ! empty($instance['title']) ? $instance['title'] : ''; |
|
127 | 127 | |
128 | 128 | // Form fields |
129 | 129 | echo '<p>'; |
130 | - echo ' <label for="' . $this->get_field_id( 'title' ) . '" class="title_label">' . __( 'Title', 're-pro' ) . '</label>'; |
|
131 | - 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 ) . '">'; |
|
132 | - echo ' <span class="description">' . __( 'Title', 're-pro' ) . '</span>'; |
|
130 | + echo ' <label for="' . $this->get_field_id('title') . '" class="title_label">' . __('Title', 're-pro') . '</label>'; |
|
131 | + 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) . '">'; |
|
132 | + echo ' <span class="description">' . __('Title', 're-pro') . '</span>'; |
|
133 | 133 | echo '</p>'; |
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 ) . '" step="1" min="0" max="50">'; |
|
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) . '" step="1" min="0" max="50">'; |
|
150 | + echo ' <span class="description">' . __('Level', 're-pro') . '</span>'; |
|
151 | 151 | echo '</p>'; |
152 | 152 | |
153 | 153 | |
@@ -163,14 +163,14 @@ discard block |
||
163 | 163 | * @param mixed $old_instance |
164 | 164 | * @return void |
165 | 165 | */ |
166 | - public function update( $new_instance, $old_instance ) { |
|
166 | + public function update($new_instance, $old_instance) { |
|
167 | 167 | |
168 | 168 | $instance = $old_instance; |
169 | 169 | |
170 | - $instance['latitude'] = !empty( $new_instance['latitude'] ) ? strip_tags( $new_instance['latitude'] ) : ''; |
|
171 | - $instance['longitude'] = !empty( $new_instance['longitude'] ) ? strip_tags( $new_instance['longitude'] ) : ''; |
|
172 | - $instance['level'] = !empty( $new_instance['level'] ) ? strip_tags( $new_instance['level'] ) : ''; |
|
173 | - $instance['title'] = !empty( $new_instance['title'] ) ? strip_tags( $new_instance['title'] ) : ''; |
|
170 | + $instance['latitude'] = ! empty($new_instance['latitude']) ? strip_tags($new_instance['latitude']) : ''; |
|
171 | + $instance['longitude'] = ! empty($new_instance['longitude']) ? strip_tags($new_instance['longitude']) : ''; |
|
172 | + $instance['level'] = ! empty($new_instance['level']) ? strip_tags($new_instance['level']) : ''; |
|
173 | + $instance['title'] = ! empty($new_instance['title']) ? strip_tags($new_instance['title']) : ''; |
|
174 | 174 | |
175 | 175 | return $instance; |
176 | 176 | |
@@ -185,6 +185,6 @@ discard block |
||
185 | 185 | * @return void |
186 | 186 | */ |
187 | 187 | function register_widgets() { |
188 | - register_widget( 'StreetAdvisor_Details' ); |
|
188 | + register_widget('StreetAdvisor_Details'); |
|
189 | 189 | } |
190 | -add_action( 'widgets_init', 'register_widgets' ); |
|
190 | +add_action('widgets_init', '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' ); |
@@ -6,44 +6,44 @@ discard block |
||
6 | 6 | |
7 | 7 | parent::__construct( |
8 | 8 | 'getschools', |
9 | - __( 'GreatSchools - Get List of Schools', 're-pro' ), |
|
9 | + __('GreatSchools - Get List of Schools', 're-pro'), |
|
10 | 10 | array( |
11 | - 'description' => __( 'Get Schools', 're-pro' ), |
|
11 | + 'description' => __('Get Schools', 're-pro'), |
|
12 | 12 | ) |
13 | 13 | ); |
14 | 14 | |
15 | 15 | } |
16 | 16 | |
17 | - public function widget( $args, $instance ) { |
|
17 | + public function widget($args, $instance) { |
|
18 | 18 | |
19 | - $greatschools_title = !empty( $instance['greatschools_title'] ) ? $instance['greatschools_title'] : ''; |
|
20 | - $greatschools_state = !empty( $instance['greatschools_state'] ) ? $instance['greatschools_state'] : ''; |
|
21 | - $greatschools_city = !empty( $instance['greatschools_city'] ) ? $instance['greatschools_city'] : ''; |
|
19 | + $greatschools_title = ! empty($instance['greatschools_title']) ? $instance['greatschools_title'] : ''; |
|
20 | + $greatschools_state = ! empty($instance['greatschools_state']) ? $instance['greatschools_state'] : ''; |
|
21 | + $greatschools_city = ! empty($instance['greatschools_city']) ? $instance['greatschools_city'] : ''; |
|
22 | 22 | |
23 | 23 | // Call our API. |
24 | - $greatschools = new GreatSchoolsAPI( '' ); |
|
25 | - $schools = $greatschools->get_schools($greatschools_state,$greatschools_city); |
|
24 | + $greatschools = new GreatSchoolsAPI(''); |
|
25 | + $schools = $greatschools->get_schools($greatschools_state, $greatschools_city); |
|
26 | 26 | |
27 | 27 | |
28 | 28 | |
29 | 29 | echo $args['before_widget']; |
30 | 30 | |
31 | - echo $args['before_title'] . esc_attr( $greatschools_title ) . $args['after_title']; |
|
31 | + echo $args['before_title'] . esc_attr($greatschools_title) . $args['after_title']; |
|
32 | 32 | |
33 | 33 | // var_dump($schools); |
34 | 34 | |
35 | - foreach($schools as $school) { |
|
35 | + foreach ($schools as $school) { |
|
36 | 36 | |
37 | - foreach($school as $school_item) { |
|
37 | + foreach ($school as $school_item) { |
|
38 | 38 | |
39 | 39 | $name = $school_item['name']; |
40 | - $type =$school_item['type']; |
|
40 | + $type = $school_item['type']; |
|
41 | 41 | $grade_range = $school_item['gradeRange']; |
42 | 42 | $state = $school_item['state']; |
43 | 43 | $city = $school_item['city']; |
44 | 44 | $overview_link = $school_item['overviewLink']; |
45 | 45 | |
46 | - echo '<li><a href="'.$overview_link.'" rel="nofollow">' . $name . '</a></li>'; |
|
46 | + echo '<li><a href="' . $overview_link . '" rel="nofollow">' . $name . '</a></li>'; |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | |
@@ -53,48 +53,48 @@ discard block |
||
53 | 53 | |
54 | 54 | } |
55 | 55 | |
56 | - public function form( $instance ) { |
|
56 | + public function form($instance) { |
|
57 | 57 | |
58 | 58 | // Set default values |
59 | - $instance = wp_parse_args( (array) $instance, array( |
|
59 | + $instance = wp_parse_args((array) $instance, array( |
|
60 | 60 | 'greatschools_title' => '', |
61 | 61 | 'greatschools_state' => '', |
62 | 62 | 'greatschools_city' => '', |
63 | - ) ); |
|
63 | + )); |
|
64 | 64 | |
65 | 65 | // Retrieve an existing value from the database |
66 | - $greatschools_title = !empty( $instance['greatschools_title'] ) ? $instance['greatschools_title'] : ''; |
|
67 | - $greatschools_state = !empty( $instance['greatschools_state'] ) ? $instance['greatschools_state'] : ''; |
|
68 | - $greatschools_city = !empty( $instance['greatschools_city'] ) ? $instance['greatschools_city'] : ''; |
|
66 | + $greatschools_title = ! empty($instance['greatschools_title']) ? $instance['greatschools_title'] : ''; |
|
67 | + $greatschools_state = ! empty($instance['greatschools_state']) ? $instance['greatschools_state'] : ''; |
|
68 | + $greatschools_city = ! empty($instance['greatschools_city']) ? $instance['greatschools_city'] : ''; |
|
69 | 69 | |
70 | 70 | // Form fields |
71 | 71 | echo '<p>'; |
72 | - echo ' <label for="' . $this->get_field_id( 'greatschools_title' ) . '" class="greatschools_title_label">' . __( 'Title', 're-pro' ) . '</label>'; |
|
73 | - echo ' <input type="text" id="' . $this->get_field_id( 'greatschools_title' ) . '" name="' . $this->get_field_name( 'greatschools_title' ) . '" class="widefat" placeholder="' . esc_attr__( '', 're-pro' ) . '" value="' . esc_attr( $greatschools_title ) . '">'; |
|
74 | - echo ' <span class="description">' . __( 'Title', 're-pro' ) . '</span>'; |
|
72 | + echo ' <label for="' . $this->get_field_id('greatschools_title') . '" class="greatschools_title_label">' . __('Title', 're-pro') . '</label>'; |
|
73 | + echo ' <input type="text" id="' . $this->get_field_id('greatschools_title') . '" name="' . $this->get_field_name('greatschools_title') . '" class="widefat" placeholder="' . esc_attr__('', 're-pro') . '" value="' . esc_attr($greatschools_title) . '">'; |
|
74 | + echo ' <span class="description">' . __('Title', 're-pro') . '</span>'; |
|
75 | 75 | echo '</p>'; |
76 | 76 | |
77 | 77 | echo '<p>'; |
78 | - echo ' <label for="' . $this->get_field_id( 'greatschools_state' ) . '" class="greatschools_state_label">' . __( 'State', 're-pro' ) . '</label>'; |
|
79 | - echo ' <input type="text" id="' . $this->get_field_id( 'greatschools_state' ) . '" name="' . $this->get_field_name( 'greatschools_state' ) . '" class="widefat" placeholder="' . esc_attr__( '', 're-pro' ) . '" value="' . esc_attr( $greatschools_state ) . '">'; |
|
80 | - echo ' <span class="description">' . __( 'State', 're-pro' ) . '</span>'; |
|
78 | + echo ' <label for="' . $this->get_field_id('greatschools_state') . '" class="greatschools_state_label">' . __('State', 're-pro') . '</label>'; |
|
79 | + echo ' <input type="text" id="' . $this->get_field_id('greatschools_state') . '" name="' . $this->get_field_name('greatschools_state') . '" class="widefat" placeholder="' . esc_attr__('', 're-pro') . '" value="' . esc_attr($greatschools_state) . '">'; |
|
80 | + echo ' <span class="description">' . __('State', 're-pro') . '</span>'; |
|
81 | 81 | echo '</p>'; |
82 | 82 | |
83 | 83 | echo '<p>'; |
84 | - echo ' <label for="' . $this->get_field_id( 'greatschools_city' ) . '" class="greatschools_city_label">' . __( 'City', 're-pro' ) . '</label>'; |
|
85 | - echo ' <input type="text" id="' . $this->get_field_id( 'greatschools_city' ) . '" name="' . $this->get_field_name( 'greatschools_city' ) . '" class="widefat" placeholder="' . esc_attr__( '', 're-pro' ) . '" value="' . esc_attr( $greatschools_city ) . '">'; |
|
86 | - echo ' <span class="description">' . __( 'City', 're-pro' ) . '</span>'; |
|
84 | + echo ' <label for="' . $this->get_field_id('greatschools_city') . '" class="greatschools_city_label">' . __('City', 're-pro') . '</label>'; |
|
85 | + echo ' <input type="text" id="' . $this->get_field_id('greatschools_city') . '" name="' . $this->get_field_name('greatschools_city') . '" class="widefat" placeholder="' . esc_attr__('', 're-pro') . '" value="' . esc_attr($greatschools_city) . '">'; |
|
86 | + echo ' <span class="description">' . __('City', 're-pro') . '</span>'; |
|
87 | 87 | echo '</p>'; |
88 | 88 | |
89 | 89 | } |
90 | 90 | |
91 | - public function update( $new_instance, $old_instance ) { |
|
91 | + public function update($new_instance, $old_instance) { |
|
92 | 92 | |
93 | 93 | $instance = $old_instance; |
94 | 94 | |
95 | - $instance['greatschools_title'] = !empty( $new_instance['greatschools_title'] ) ? strip_tags( $new_instance['greatschools_title'] ) : ''; |
|
96 | - $instance['greatschools_state'] = !empty( $new_instance['greatschools_state'] ) ? strip_tags( $new_instance['greatschools_state'] ) : ''; |
|
97 | - $instance['greatschools_city'] = !empty( $new_instance['greatschools_city'] ) ? strip_tags( $new_instance['greatschools_city'] ) : ''; |
|
95 | + $instance['greatschools_title'] = ! empty($new_instance['greatschools_title']) ? strip_tags($new_instance['greatschools_title']) : ''; |
|
96 | + $instance['greatschools_state'] = ! empty($new_instance['greatschools_state']) ? strip_tags($new_instance['greatschools_state']) : ''; |
|
97 | + $instance['greatschools_city'] = ! empty($new_instance['greatschools_city']) ? strip_tags($new_instance['greatschools_city']) : ''; |
|
98 | 98 | |
99 | 99 | return $instance; |
100 | 100 | |
@@ -103,6 +103,6 @@ discard block |
||
103 | 103 | } |
104 | 104 | |
105 | 105 | function greatschools_register_widgets() { |
106 | - register_widget( 'greatschools_getschools' ); |
|
106 | + register_widget('greatschools_getschools'); |
|
107 | 107 | } |
108 | -add_action( 'widgets_init', 'greatschools_register_widgets' ); |
|
108 | +add_action('widgets_init', 'greatschools_register_widgets'); |
@@ -1,5 +1,5 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -require_once( 'wp-greatschools-api.php' ); |
|
3 | +require_once('wp-greatschools-api.php'); |
|
4 | 4 | |
5 | 5 | // require_once( 'widgets/widget-getschools.php' ); |