@@ -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( 'widgets/class-rentbits-widgets.php' ); |
|
11 | +include('widgets/class-rentbits-widgets.php'); |
|
12 | 12 | |
13 | -include( 'widgets/class-rental-comparison-widget.php' ); |
|
13 | +include('widgets/class-rental-comparison-widget.php'); |
|
14 | 14 | |
15 | -include( 'widgets/class-average-rental-rates-widget.php' ); |
|
15 | +include('widgets/class-average-rental-rates-widget.php'); |
@@ -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 | * RentbitsAverageRentalRatesWidget class. |
@@ -25,9 +25,9 @@ discard block |
||
25 | 25 | |
26 | 26 | parent::__construct( |
27 | 27 | 'rentbits_avg_rental_rates', |
28 | - __( 'Rentbits Average Rental Rates', 're-pro' ), |
|
28 | + __('Rentbits Average Rental Rates', 're-pro'), |
|
29 | 29 | array( |
30 | - 'description' => __( 'Display the current average rental price for any location.', 're-pro' ), |
|
30 | + 'description' => __('Display the current average rental price for any location.', 're-pro'), |
|
31 | 31 | 'classname' => 're-pro re-pro-widget rentbits-widget rentbits-avg-rental-rates', |
32 | 32 | 'customize_selective_refresh' => true, |
33 | 33 | ) |
@@ -41,18 +41,18 @@ 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 | - $title = ! empty( $instance['title'] ) ? $instance['title'] : ''; |
|
47 | - $location = ! empty( $instance['location'] ) ? $instance['location'] : ''; |
|
46 | + $title = ! empty($instance['title']) ? $instance['title'] : ''; |
|
47 | + $location = ! empty($instance['location']) ? $instance['location'] : ''; |
|
48 | 48 | |
49 | 49 | echo $args['before_widget']; |
50 | 50 | |
51 | - echo $args['before_title'] . esc_attr( $title ) . $args['after_title']; |
|
51 | + echo $args['before_title'] . esc_attr($title) . $args['after_title']; |
|
52 | 52 | |
53 | 53 | $rentbits_widgets = new RentbitsWidgets(); |
54 | 54 | |
55 | - $rentbits_widgets->get_average_rental_rates_widget( $location ); |
|
55 | + $rentbits_widgets->get_average_rental_rates_widget($location); |
|
56 | 56 | |
57 | 57 | echo $args['after_widget']; |
58 | 58 | } |
@@ -64,28 +64,28 @@ discard block |
||
64 | 64 | * @param mixed $instance Instance. |
65 | 65 | * @return void |
66 | 66 | */ |
67 | - public function form( $instance ) { |
|
67 | + public function form($instance) { |
|
68 | 68 | |
69 | 69 | // Set default values. |
70 | - $instance = wp_parse_args( (array) $instance, array( |
|
70 | + $instance = wp_parse_args((array) $instance, array( |
|
71 | 71 | 'title' => '', |
72 | 72 | 'location' => '', |
73 | - ) ); |
|
73 | + )); |
|
74 | 74 | |
75 | 75 | // Retrieve an existing value from the database. |
76 | - $title = ! empty( $instance['title'] ) ? $instance['title'] : ''; |
|
77 | - $location = ! empty( $instance['location'] ) ? $instance['location'] : ''; |
|
76 | + $title = ! empty($instance['title']) ? $instance['title'] : ''; |
|
77 | + $location = ! empty($instance['location']) ? $instance['location'] : ''; |
|
78 | 78 | |
79 | 79 | // Title. |
80 | 80 | echo '<p>'; |
81 | - echo ' <label for="' . $this->get_field_id( 'title' ) . '" class="title-label">' . __( 'Tile:', 're-pro' ) . '</label>'; |
|
82 | - echo ' <input id="' . $this->get_field_id( 'title' ) . '" name="' . $this->get_field_name( 'title' ) . '" value="' . $title . '" class="widefat">'; |
|
81 | + echo ' <label for="' . $this->get_field_id('title') . '" class="title-label">' . __('Tile:', 're-pro') . '</label>'; |
|
82 | + echo ' <input id="' . $this->get_field_id('title') . '" name="' . $this->get_field_name('title') . '" value="' . $title . '" class="widefat">'; |
|
83 | 83 | echo '</p>'; |
84 | 84 | |
85 | 85 | // Location. |
86 | 86 | echo '<p>'; |
87 | - echo ' <label for="' . $this->get_field_id( 'location' ) . '" class="title-label">' . __( 'Location:', 're-pro' ) . '</label>'; |
|
88 | - echo ' <input id="' . $this->get_field_id( 'location' ) . '" name="' . $this->get_field_name( 'location' ) . '" value="' . $location . '" class="widefat">'; |
|
87 | + echo ' <label for="' . $this->get_field_id('location') . '" class="title-label">' . __('Location:', 're-pro') . '</label>'; |
|
88 | + echo ' <input id="' . $this->get_field_id('location') . '" name="' . $this->get_field_name('location') . '" value="' . $location . '" class="widefat">'; |
|
89 | 89 | echo '</p>'; |
90 | 90 | |
91 | 91 | } |
@@ -98,12 +98,12 @@ discard block |
||
98 | 98 | * @param mixed $old_instance Old Instance. |
99 | 99 | * @return $instance |
100 | 100 | */ |
101 | - public function update( $new_instance, $old_instance ) { |
|
101 | + public function update($new_instance, $old_instance) { |
|
102 | 102 | |
103 | 103 | $instance = $old_instance; |
104 | 104 | |
105 | - $instance['title'] = ! empty( $new_instance['title'] ) ? strip_tags( $new_instance['title'] ) : ''; |
|
106 | - $instance['location'] = ! empty( $new_instance['location'] ) ? strip_tags( $new_instance['location'] ) : ''; |
|
105 | + $instance['title'] = ! empty($new_instance['title']) ? strip_tags($new_instance['title']) : ''; |
|
106 | + $instance['location'] = ! empty($new_instance['location']) ? strip_tags($new_instance['location']) : ''; |
|
107 | 107 | |
108 | 108 | return $instance; |
109 | 109 | } |
@@ -116,8 +116,8 @@ discard block |
||
116 | 116 | * @return void |
117 | 117 | */ |
118 | 118 | function repro_rentbits_avg_rental_rates() { |
119 | - if ( ! is_ssl() ) { |
|
120 | - register_widget( 'RentbitsAverageRentalRatesWidget' ); |
|
119 | + if ( ! is_ssl()) { |
|
120 | + register_widget('RentbitsAverageRentalRatesWidget'); |
|
121 | 121 | } |
122 | 122 | } |
123 | -add_action( 'widgets_init', 'repro_rentbits_avg_rental_rates' ); |
|
123 | +add_action('widgets_init', 'repro_rentbits_avg_rental_rates'); |
@@ -48,7 +48,7 @@ |
||
48 | 48 | * @access public |
49 | 49 | * @param mixed $loc1 First Location. |
50 | 50 | * @param mixed $loc2 Second Location. |
51 | - * @param mixed $loc3 Third Location. |
|
51 | + * @param mixed $loc3 Third Location. |
|
52 | 52 | * @param mixed $loc4 Fourth Location. |
53 | 53 | * @return void |
54 | 54 | */ |
@@ -6,9 +6,9 @@ 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 | -if ( ! class_exists( 'RentbitsWidgets' ) ) { |
|
11 | +if ( ! class_exists('RentbitsWidgets')) { |
|
12 | 12 | /** |
13 | 13 | * HomeFinderWidgets class. |
14 | 14 | */ |
@@ -28,15 +28,15 @@ discard block |
||
28 | 28 | * @return void |
29 | 29 | */ |
30 | 30 | public function __construct() { |
31 | - add_action( 'wp_footer', array( $this, 'rb_enqueue' ) ); |
|
31 | + add_action('wp_footer', array($this, 'rb_enqueue')); |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | /** |
35 | 35 | * Handle multiple rb widgets js enqueues. |
36 | 36 | */ |
37 | 37 | public function rb_enqueue() { |
38 | - wp_enqueue_script( 'rb-widgets-js', plugins_url( 'rb-widgets.js', __FILE__ ), array( 'jquery' ), null, true ); |
|
39 | - wp_localize_script( 'rb-widgets-js', 'rb_data', static::$rb_data ); |
|
38 | + wp_enqueue_script('rb-widgets-js', plugins_url('rb-widgets.js', __FILE__), array('jquery'), null, true); |
|
39 | + wp_localize_script('rb-widgets-js', 'rb_data', static::$rb_data); |
|
40 | 40 | |
41 | 41 | } |
42 | 42 | |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | * @param mixed $loc4 Fourth Location. |
53 | 53 | * @return void |
54 | 54 | */ |
55 | - public function get_rental_comparison_widget( $loc1, $loc2, $loc3, $loc4 ) { |
|
55 | + public function get_rental_comparison_widget($loc1, $loc2, $loc3, $loc4) { |
|
56 | 56 | |
57 | 57 | $url = 'http://rentbits.com/rb/pageinc.do?p=widget-cmp-price&loc1=' . $loc1 . '&loc2=' . $loc2 . '&loc3=' . $loc3 . '&loc4=' . $loc4; |
58 | 58 | |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | ); |
64 | 64 | static::$rb_data[] = $rb_data; |
65 | 65 | |
66 | - $index = count( static::$rb_data ) - 1; |
|
66 | + $index = count(static::$rb_data) - 1; |
|
67 | 67 | echo '<div id="rb-widget-' . $index . '"></div>'; |
68 | 68 | |
69 | 69 | } |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | * @param mixed $loc Location. |
76 | 76 | * @return void |
77 | 77 | */ |
78 | - public function get_average_rental_rates_widget( $loc ) { |
|
78 | + public function get_average_rental_rates_widget($loc) { |
|
79 | 79 | |
80 | 80 | $url = 'http://rentbits.com/rb/pageinc.do?p=widget-avg-price&loc=' . $loc; |
81 | 81 | |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | ); |
87 | 87 | static::$rb_data[] = $rb_data; |
88 | 88 | |
89 | - $index = count( static::$rb_data ) - 1; |
|
89 | + $index = count(static::$rb_data) - 1; |
|
90 | 90 | echo '<div id="rb-widget-' . $index . '"></div>'; |
91 | 91 | |
92 | 92 | } |
@@ -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 | * RentbitsRentalComparisonWidget class. |
@@ -25,9 +25,9 @@ discard block |
||
25 | 25 | |
26 | 26 | parent::__construct( |
27 | 27 | 'rentbits_rental_comparison', |
28 | - __( 'Rentbits Rental Comparison', 're-pro' ), |
|
28 | + __('Rentbits Rental Comparison', 're-pro'), |
|
29 | 29 | array( |
30 | - 'description' => __( 'Display the current average rental price for up to any four locations.', 're-pro' ), |
|
30 | + 'description' => __('Display the current average rental price for up to any four locations.', 're-pro'), |
|
31 | 31 | 'classname' => 're-pro re-pro-widget rentbits-widget rentbits-rental-comparison', |
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 | - $title = ! empty( $instance['title'] ) ? $instance['title'] : ''; |
|
47 | - $location1 = ! empty( $instance['location1'] ) ? $instance['location1'] : ''; |
|
48 | - $location2 = ! empty( $instance['location2'] ) ? $instance['location2'] : ''; |
|
49 | - $location3 = ! empty( $instance['location3'] ) ? $instance['location3'] : ''; |
|
50 | - $location4 = ! empty( $instance['location4'] ) ? $instance['location4'] : ''; |
|
46 | + $title = ! empty($instance['title']) ? $instance['title'] : ''; |
|
47 | + $location1 = ! empty($instance['location1']) ? $instance['location1'] : ''; |
|
48 | + $location2 = ! empty($instance['location2']) ? $instance['location2'] : ''; |
|
49 | + $location3 = ! empty($instance['location3']) ? $instance['location3'] : ''; |
|
50 | + $location4 = ! empty($instance['location4']) ? $instance['location4'] : ''; |
|
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 | $rentbits_widgets = new RentbitsWidgets(); |
57 | 57 | |
58 | - $rentbits_widgets->get_rental_comparison_widget( $location1, $location2, $location3, $location4 ); |
|
58 | + $rentbits_widgets->get_rental_comparison_widget($location1, $location2, $location3, $location4); |
|
59 | 59 | |
60 | 60 | echo $args['after_widget']; |
61 | 61 | } |
@@ -67,52 +67,52 @@ 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 | 'location1' => '', |
76 | 76 | 'location2' => '', |
77 | 77 | 'location3' => '', |
78 | 78 | 'location4' => '', |
79 | - ) ); |
|
79 | + )); |
|
80 | 80 | |
81 | 81 | // Retrieve an existing value from the database. |
82 | - $title = ! empty( $instance['title'] ) ? $instance['title'] : ''; |
|
83 | - $location1 = ! empty( $instance['location1'] ) ? $instance['location1'] : ''; |
|
84 | - $location2 = ! empty( $instance['location2'] ) ? $instance['location2'] : ''; |
|
85 | - $location3 = ! empty( $instance['location3'] ) ? $instance['location3'] : ''; |
|
86 | - $location4 = ! empty( $instance['location4'] ) ? $instance['location4'] : ''; |
|
82 | + $title = ! empty($instance['title']) ? $instance['title'] : ''; |
|
83 | + $location1 = ! empty($instance['location1']) ? $instance['location1'] : ''; |
|
84 | + $location2 = ! empty($instance['location2']) ? $instance['location2'] : ''; |
|
85 | + $location3 = ! empty($instance['location3']) ? $instance['location3'] : ''; |
|
86 | + $location4 = ! empty($instance['location4']) ? $instance['location4'] : ''; |
|
87 | 87 | |
88 | 88 | // Title. |
89 | 89 | echo '<p>'; |
90 | - echo ' <label for="' . $this->get_field_id( 'title' ) . '" class="title-label">' . __( 'Tile:', 're-pro' ) . '</label>'; |
|
91 | - echo ' <input id="' . $this->get_field_id( 'title' ) . '" name="' . $this->get_field_name( 'title' ) . '" value="' . $title . '" class="widefat">'; |
|
90 | + echo ' <label for="' . $this->get_field_id('title') . '" class="title-label">' . __('Tile:', 're-pro') . '</label>'; |
|
91 | + echo ' <input id="' . $this->get_field_id('title') . '" name="' . $this->get_field_name('title') . '" value="' . $title . '" class="widefat">'; |
|
92 | 92 | echo '</p>'; |
93 | 93 | |
94 | 94 | // Location 1. |
95 | 95 | echo '<p>'; |
96 | - echo ' <label for="' . $this->get_field_id( 'location1' ) . '" class="title-label">' . __( 'Location:', 're-pro' ) . '</label>'; |
|
97 | - echo ' <input id="' . $this->get_field_id( 'location1' ) . '" name="' . $this->get_field_name( 'location1' ) . '" value="' . $location1 . '" class="widefat">'; |
|
96 | + echo ' <label for="' . $this->get_field_id('location1') . '" class="title-label">' . __('Location:', 're-pro') . '</label>'; |
|
97 | + echo ' <input id="' . $this->get_field_id('location1') . '" name="' . $this->get_field_name('location1') . '" value="' . $location1 . '" class="widefat">'; |
|
98 | 98 | echo '</p>'; |
99 | 99 | |
100 | 100 | // Location 2. |
101 | 101 | echo '<p>'; |
102 | - echo ' <label for="' . $this->get_field_id( 'location2' ) . '" class="title-label">' . __( 'Location:', 're-pro' ) . '</label>'; |
|
103 | - echo ' <input id="' . $this->get_field_id( 'location2' ) . '" name="' . $this->get_field_name( 'location2' ) . '" value="' . $location2 . '" class="widefat">'; |
|
102 | + echo ' <label for="' . $this->get_field_id('location2') . '" class="title-label">' . __('Location:', 're-pro') . '</label>'; |
|
103 | + echo ' <input id="' . $this->get_field_id('location2') . '" name="' . $this->get_field_name('location2') . '" value="' . $location2 . '" class="widefat">'; |
|
104 | 104 | echo '</p>'; |
105 | 105 | |
106 | 106 | // Location 3. |
107 | 107 | echo '<p>'; |
108 | - echo ' <label for="' . $this->get_field_id( 'location3' ) . '" class="title-label">' . __( 'Location:', 're-pro' ) . '</label>'; |
|
109 | - echo ' <input id="' . $this->get_field_id( 'location3' ) . '" name="' . $this->get_field_name( 'location3' ) . '" value="' . $location3 . '" class="widefat">'; |
|
108 | + echo ' <label for="' . $this->get_field_id('location3') . '" class="title-label">' . __('Location:', 're-pro') . '</label>'; |
|
109 | + echo ' <input id="' . $this->get_field_id('location3') . '" name="' . $this->get_field_name('location3') . '" value="' . $location3 . '" class="widefat">'; |
|
110 | 110 | echo '</p>'; |
111 | 111 | |
112 | 112 | // Location 4. |
113 | 113 | echo '<p>'; |
114 | - echo ' <label for="' . $this->get_field_id( 'location4' ) . '" class="title-label">' . __( 'Location:', 're-pro' ) . '</label>'; |
|
115 | - echo ' <input id="' . $this->get_field_id( 'location4' ) . '" name="' . $this->get_field_name( 'location4' ) . '" value="' . $location4 . '" class="widefat">'; |
|
114 | + echo ' <label for="' . $this->get_field_id('location4') . '" class="title-label">' . __('Location:', 're-pro') . '</label>'; |
|
115 | + echo ' <input id="' . $this->get_field_id('location4') . '" name="' . $this->get_field_name('location4') . '" value="' . $location4 . '" class="widefat">'; |
|
116 | 116 | echo '</p>'; |
117 | 117 | |
118 | 118 | } |
@@ -125,15 +125,15 @@ discard block |
||
125 | 125 | * @param mixed $old_instance Old Instance. |
126 | 126 | * @return $instance |
127 | 127 | */ |
128 | - public function update( $new_instance, $old_instance ) { |
|
128 | + public function update($new_instance, $old_instance) { |
|
129 | 129 | |
130 | 130 | $instance = $old_instance; |
131 | 131 | |
132 | - $instance['title'] = ! empty( $new_instance['title'] ) ? strip_tags( $new_instance['title'] ) : ''; |
|
133 | - $instance['location1'] = ! empty( $new_instance['location1'] ) ? strip_tags( $new_instance['location1'] ) : ''; |
|
134 | - $instance['location2'] = ! empty( $new_instance['location2'] ) ? strip_tags( $new_instance['location2'] ) : ''; |
|
135 | - $instance['location3'] = ! empty( $new_instance['location3'] ) ? strip_tags( $new_instance['location3'] ) : ''; |
|
136 | - $instance['location4'] = ! empty( $new_instance['location4'] ) ? strip_tags( $new_instance['location4'] ) : ''; |
|
132 | + $instance['title'] = ! empty($new_instance['title']) ? strip_tags($new_instance['title']) : ''; |
|
133 | + $instance['location1'] = ! empty($new_instance['location1']) ? strip_tags($new_instance['location1']) : ''; |
|
134 | + $instance['location2'] = ! empty($new_instance['location2']) ? strip_tags($new_instance['location2']) : ''; |
|
135 | + $instance['location3'] = ! empty($new_instance['location3']) ? strip_tags($new_instance['location3']) : ''; |
|
136 | + $instance['location4'] = ! empty($new_instance['location4']) ? strip_tags($new_instance['location4']) : ''; |
|
137 | 137 | |
138 | 138 | return $instance; |
139 | 139 | } |
@@ -146,8 +146,8 @@ discard block |
||
146 | 146 | * @return void |
147 | 147 | */ |
148 | 148 | function repro_rentbits_rental_comparison() { |
149 | - if ( ! is_ssl() ) { |
|
150 | - register_widget( 'RentbitsRentalComparisonWidget' ); |
|
149 | + if ( ! is_ssl()) { |
|
150 | + register_widget('RentbitsRentalComparisonWidget'); |
|
151 | 151 | } |
152 | 152 | } |
153 | -add_action( 'widgets_init', 'repro_rentbits_rental_comparison' ); |
|
153 | +add_action('widgets_init', 'repro_rentbits_rental_comparison'); |
@@ -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 | * Google Maps Class. |
@@ -69,31 +69,31 @@ discard block |
||
69 | 69 | * @access public |
70 | 70 | * @param String $api_key : API Key. |
71 | 71 | */ |
72 | - public function __construct( $api_key ) { |
|
72 | + public function __construct($api_key) { |
|
73 | 73 | static::$api_key = $api_key; |
74 | 74 | |
75 | - add_action( 'wp_footer', array( $this, 'footer' ), 11 ); |
|
76 | - add_action( 'widgets_init', array( $this, 'register_widgets' ) ); |
|
77 | - add_action( 'wp_enqueue_scripts', array( $this, 'enqueue' ) ); |
|
78 | - add_shortcode( 'wp_google_maps', array( $this, 'shortcode' ) ); |
|
75 | + add_action('wp_footer', array($this, 'footer'), 11); |
|
76 | + add_action('widgets_init', array($this, 'register_widgets')); |
|
77 | + add_action('wp_enqueue_scripts', array($this, 'enqueue')); |
|
78 | + add_shortcode('wp_google_maps', array($this, 'shortcode')); |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | /** |
82 | 82 | * Enqueue JS. |
83 | 83 | */ |
84 | 84 | public function enqueue() { |
85 | - wp_enqueue_script( 'wpapi-google-maps', plugins_url( 'assets/js/google-maps.min.js', REPRO_PLUGIN_FILE ), array( 'jquery' ), null, true ); |
|
85 | + wp_enqueue_script('wpapi-google-maps', plugins_url('assets/js/google-maps.min.js', REPRO_PLUGIN_FILE), array('jquery'), null, true); |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | /** |
89 | 89 | * Handle multiple google maps js api enqueues on the footer. |
90 | 90 | */ |
91 | 91 | public function footer() { |
92 | - wp_localize_script( 'wpapi-google-maps', 'wpapi_gmaps', static::$map_data ); |
|
92 | + wp_localize_script('wpapi-google-maps', 'wpapi_gmaps', static::$map_data); |
|
93 | 93 | |
94 | 94 | // Only enqueue google maps API if yoast hasnt enqueued it already. |
95 | - if ( ! wp_script_is( 'maps-geocoder' ) ) { |
|
96 | - wp_enqueue_script( 'google-maps-api', 'https://maps.googleapis.com/maps/api/js?key=' . static::$api_key, array(), null ); |
|
95 | + if ( ! wp_script_is('maps-geocoder')) { |
|
96 | + wp_enqueue_script('google-maps-api', 'https://maps.googleapis.com/maps/api/js?key=' . static::$api_key, array(), null); |
|
97 | 97 | } |
98 | 98 | } |
99 | 99 | |
@@ -103,16 +103,16 @@ discard block |
||
103 | 103 | * @param [Mixed] $map_data : Array of map data to send to js. |
104 | 104 | * @param [Bool] $echo : If html should be returned or echoed, defaults to true. |
105 | 105 | */ |
106 | - public static function print_map( $map_data, $echo = true ) { |
|
106 | + public static function print_map($map_data, $echo = true) { |
|
107 | 107 | |
108 | - $map_data = apply_filters( 'wpapi_google_map_data', wp_parse_args( $map_data, static::$defaults ) ); |
|
108 | + $map_data = apply_filters('wpapi_google_map_data', wp_parse_args($map_data, static::$defaults)); |
|
109 | 109 | static::$map_data[] = $map_data; |
110 | 110 | |
111 | - $index = count( static::$map_data ) - 1; |
|
111 | + $index = count(static::$map_data) - 1; |
|
112 | 112 | |
113 | - $html = '<div id="wpapi-gmap-' . $index . '" style="width:' . esc_attr( $map_data['width'] ) . ';height:' . esc_attr( $map_data['height'] ) . '"></div>'; |
|
113 | + $html = '<div id="wpapi-gmap-' . $index . '" style="width:' . esc_attr($map_data['width']) . ';height:' . esc_attr($map_data['height']) . '"></div>'; |
|
114 | 114 | |
115 | - if ( $echo ) { |
|
115 | + if ($echo) { |
|
116 | 116 | echo $html; |
117 | 117 | } else { |
118 | 118 | return $html; |
@@ -124,11 +124,11 @@ discard block |
||
124 | 124 | * |
125 | 125 | * @param [type] $atts : shortcode attributes. |
126 | 126 | */ |
127 | - public function shortcode( $atts ) { |
|
127 | + public function shortcode($atts) { |
|
128 | 128 | // Set widget info. |
129 | - $atts = shortcode_atts( static::$defaults, $atts, 'wp_google_maps' ); |
|
129 | + $atts = shortcode_atts(static::$defaults, $atts, 'wp_google_maps'); |
|
130 | 130 | |
131 | - return static::print_map( $atts, false ); |
|
131 | + return static::print_map($atts, false); |
|
132 | 132 | |
133 | 133 | } |
134 | 134 | |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | * @return void |
140 | 140 | */ |
141 | 141 | public function register_widgets() { |
142 | - register_widget( 'WP_API_MAPS_WIDGET' ); |
|
142 | + register_widget('WP_API_MAPS_WIDGET'); |
|
143 | 143 | } |
144 | 144 | } |
145 | 145 |
@@ -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,84 +58,84 @@ 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 | - $scrollwheel['val'] = ! empty( $instance['scrollwheel'] ) ? $instance['scrollwheel'] : 0; |
|
74 | - |
|
75 | - $title['id'] = $this->get_field_id( 'title' ); |
|
76 | - $lat['id'] = $this->get_field_id( 'lat' ); |
|
77 | - $lng['id'] = $this->get_field_id( 'lng' ); |
|
78 | - $info['id'] = $this->get_field_id( 'info' ); |
|
79 | - $width['id'] = $this->get_field_id( 'width' ); |
|
80 | - $height['id'] = $this->get_field_id( 'height' ); |
|
81 | - $zoom['id'] = $this->get_field_id( 'zoom' ); |
|
82 | - $scrollwheel['id'] = $this->get_field_id( 'scrollwheel' ); |
|
83 | - |
|
84 | - $title['name'] = $this->get_field_name( 'title' ); |
|
85 | - $lat['name'] = $this->get_field_name( 'lat' ); |
|
86 | - $lng['name'] = $this->get_field_name( 'lng' ); |
|
87 | - $info['name'] = $this->get_field_name( 'info' ); |
|
88 | - $width['name'] = $this->get_field_name( 'width' ); |
|
89 | - $height['name'] = $this->get_field_name( 'height' ); |
|
90 | - $zoom['name'] = $this->get_field_name( 'zoom' ); |
|
91 | - $scrollwheel['name'] = $this->get_field_name( 'scrollwheel' ); |
|
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 | + $scrollwheel['val'] = ! empty($instance['scrollwheel']) ? $instance['scrollwheel'] : 0; |
|
74 | + |
|
75 | + $title['id'] = $this->get_field_id('title'); |
|
76 | + $lat['id'] = $this->get_field_id('lat'); |
|
77 | + $lng['id'] = $this->get_field_id('lng'); |
|
78 | + $info['id'] = $this->get_field_id('info'); |
|
79 | + $width['id'] = $this->get_field_id('width'); |
|
80 | + $height['id'] = $this->get_field_id('height'); |
|
81 | + $zoom['id'] = $this->get_field_id('zoom'); |
|
82 | + $scrollwheel['id'] = $this->get_field_id('scrollwheel'); |
|
83 | + |
|
84 | + $title['name'] = $this->get_field_name('title'); |
|
85 | + $lat['name'] = $this->get_field_name('lat'); |
|
86 | + $lng['name'] = $this->get_field_name('lng'); |
|
87 | + $info['name'] = $this->get_field_name('info'); |
|
88 | + $width['name'] = $this->get_field_name('width'); |
|
89 | + $height['name'] = $this->get_field_name('height'); |
|
90 | + $zoom['name'] = $this->get_field_name('zoom'); |
|
91 | + $scrollwheel['name'] = $this->get_field_name('scrollwheel'); |
|
92 | 92 | |
93 | 93 | // Widget title. |
94 | 94 | echo '<p>'; |
95 | - echo ' <label for="' . esc_attr( $title['id'] ) . '" class="wp-api-maps_title_label">' . esc_attr( 'Title:' ) . '</label>'; |
|
96 | - echo ' <input type="text" id="' . esc_attr( $title['id'] ) . '" name="' . esc_attr( $title['name'] ) . '" class="widefat" value="' . esc_attr( $title['val'] ) . '">'; |
|
95 | + echo ' <label for="' . esc_attr($title['id']) . '" class="wp-api-maps_title_label">' . esc_attr('Title:') . '</label>'; |
|
96 | + echo ' <input type="text" id="' . esc_attr($title['id']) . '" name="' . esc_attr($title['name']) . '" class="widefat" value="' . esc_attr($title['val']) . '">'; |
|
97 | 97 | echo '</p>'; |
98 | 98 | |
99 | 99 | // Widget width. |
100 | 100 | echo '<p>'; |
101 | - echo ' <label for="' . esc_attr( $width['id'] ) . '" class="wp-api-maps_width_label">' . esc_attr( 'Width:' ) . '</label>'; |
|
102 | - echo ' <input type="text" id="' . esc_attr( $width['id'] ) . '" name="' . esc_attr( $width['name'] ) . '" class="widefat" value="' . esc_attr( $width['val'] ) . '">'; |
|
101 | + echo ' <label for="' . esc_attr($width['id']) . '" class="wp-api-maps_width_label">' . esc_attr('Width:') . '</label>'; |
|
102 | + echo ' <input type="text" id="' . esc_attr($width['id']) . '" name="' . esc_attr($width['name']) . '" class="widefat" value="' . esc_attr($width['val']) . '">'; |
|
103 | 103 | echo '</p>'; |
104 | 104 | |
105 | 105 | // Widget height. |
106 | 106 | echo '<p>'; |
107 | - echo ' <label for="' . esc_attr( $height['id'] ) . '" class="wp-api-maps_height_label">' . esc_attr( 'Height:' ) . '</label>'; |
|
108 | - echo ' <input type="text" id="' . esc_attr( $height['id'] ) . '" name="' . esc_attr( $height['name'] ) . '" class="widefat" value="' . esc_attr( $height['val'] ) . '">'; |
|
107 | + echo ' <label for="' . esc_attr($height['id']) . '" class="wp-api-maps_height_label">' . esc_attr('Height:') . '</label>'; |
|
108 | + echo ' <input type="text" id="' . esc_attr($height['id']) . '" name="' . esc_attr($height['name']) . '" class="widefat" value="' . esc_attr($height['val']) . '">'; |
|
109 | 109 | echo '</p>'; |
110 | 110 | |
111 | 111 | // Latitude input. |
112 | 112 | echo '<p>'; |
113 | - echo ' <label for="' . esc_attr( $lat['id'] ) . '" class="wp-api-maps_lat_label">' . esc_attr( 'Latitude:' ) . '</label>'; |
|
114 | - echo ' <input type="text" id="' . esc_attr( $lat['id'] ) . '" name="' . esc_attr( $lat['name'] ) . '" class="widefat" value="' . esc_attr( $lat['val'] ) . '">'; |
|
113 | + echo ' <label for="' . esc_attr($lat['id']) . '" class="wp-api-maps_lat_label">' . esc_attr('Latitude:') . '</label>'; |
|
114 | + echo ' <input type="text" id="' . esc_attr($lat['id']) . '" name="' . esc_attr($lat['name']) . '" class="widefat" value="' . esc_attr($lat['val']) . '">'; |
|
115 | 115 | echo '</p>'; |
116 | 116 | |
117 | 117 | // Longitude input. |
118 | 118 | echo '<p>'; |
119 | - echo ' <label for="' . esc_attr( $lng['id'] ) . '" class="wp-api-maps_lng_label">' . esc_attr( 'Longitude:' ) . '</label>'; |
|
120 | - echo ' <input type="text" id="' . esc_attr( $lng['id'] ) . '" name="' . esc_attr( $lng['name'] ) . '" class="widefat" value="' . esc_attr( $lng['val'] ) . '">'; |
|
119 | + echo ' <label for="' . esc_attr($lng['id']) . '" class="wp-api-maps_lng_label">' . esc_attr('Longitude:') . '</label>'; |
|
120 | + echo ' <input type="text" id="' . esc_attr($lng['id']) . '" name="' . esc_attr($lng['name']) . '" class="widefat" value="' . esc_attr($lng['val']) . '">'; |
|
121 | 121 | echo '</p>'; |
122 | 122 | |
123 | 123 | // Info content input. |
124 | 124 | echo '<p>'; |
125 | - echo ' <label for="' . esc_attr( $info['id'] ) . '" class="wp-api-maps_info_label">' . esc_attr( 'Info window content:' ) . '</label>'; |
|
126 | - echo ' <input type="text" id="' . esc_attr( $info['id'] ) . '" name="' . esc_attr( $info['name'] ) . '" class="widefat" value="' . esc_attr( $info['val'] ) . '">'; |
|
125 | + echo ' <label for="' . esc_attr($info['id']) . '" class="wp-api-maps_info_label">' . esc_attr('Info window content:') . '</label>'; |
|
126 | + echo ' <input type="text" id="' . esc_attr($info['id']) . '" name="' . esc_attr($info['name']) . '" class="widefat" value="' . esc_attr($info['val']) . '">'; |
|
127 | 127 | echo '</p>'; |
128 | 128 | |
129 | 129 | // Zoom input. |
130 | 130 | echo '<p>'; |
131 | - echo ' <label for="' . esc_attr( $zoom['id'] ) . '" class="wp-api-maps_zoom_label">' . esc_attr( 'Zoom:' ) . '</label>'; |
|
132 | - echo ' <input type="text" id="' . esc_attr( $zoom['id'] ) . '" name="' . esc_attr( $zoom['name'] ) . '" class="widefat" value="' . esc_attr( $zoom['val'] ) . '">'; |
|
131 | + echo ' <label for="' . esc_attr($zoom['id']) . '" class="wp-api-maps_zoom_label">' . esc_attr('Zoom:') . '</label>'; |
|
132 | + echo ' <input type="text" id="' . esc_attr($zoom['id']) . '" name="' . esc_attr($zoom['name']) . '" class="widefat" value="' . esc_attr($zoom['val']) . '">'; |
|
133 | 133 | echo '</p>'; |
134 | 134 | |
135 | 135 | // ScrollWheel option. |
136 | 136 | echo '<p>'; |
137 | - echo ' <input value="1" type="checkbox"' . checked( esc_attr( $scrollwheel['val'] ), 1, false ) . 'id="' . esc_attr( $scrollwheel['id'] ) . '" name="' . esc_attr( $scrollwheel['name'] ) . '" />'; |
|
138 | - echo ' <label for="' . esc_attr( $scrollwheel['id'] ) . '">Disable Scroll Zoom</label>'; |
|
137 | + echo ' <input value="1" type="checkbox"' . checked(esc_attr($scrollwheel['val']), 1, false) . 'id="' . esc_attr($scrollwheel['id']) . '" name="' . esc_attr($scrollwheel['name']) . '" />'; |
|
138 | + echo ' <label for="' . esc_attr($scrollwheel['id']) . '">Disable Scroll Zoom</label>'; |
|
139 | 139 | echo '</p>'; |
140 | 140 | } |
141 | 141 | |
@@ -147,18 +147,18 @@ discard block |
||
147 | 147 | * @param mixed $old_instance Old Instance. |
148 | 148 | * @return $instance Instance. |
149 | 149 | */ |
150 | - public function update( $new_instance, $old_instance ) { |
|
150 | + public function update($new_instance, $old_instance) { |
|
151 | 151 | |
152 | 152 | $instance = $old_instance; |
153 | 153 | |
154 | - $instance['title'] = ! empty( $new_instance['title'] ) ? strip_tags( $new_instance['title'] ) : ''; |
|
155 | - $instance['width'] = ! empty( $new_instance['width'] ) ? strip_tags( $new_instance['width'] ) : ''; |
|
156 | - $instance['height'] = ! empty( $new_instance['height'] ) ? strip_tags( $new_instance['height'] ) : ''; |
|
157 | - $instance['lat'] = ! empty( $new_instance['lat'] ) ? strip_tags( $new_instance['lat'] ) : ''; |
|
158 | - $instance['lng'] = ! empty( $new_instance['lng'] ) ? strip_tags( $new_instance['lng'] ) : ''; |
|
159 | - $instance['info'] = ! empty( $new_instance['info'] ) ? strip_tags( $new_instance['info'] ) : ''; |
|
160 | - $instance['zoom'] = ! empty( $new_instance['zoom'] ) ? strip_tags( $new_instance['zoom'] ) : null; |
|
161 | - $instance['scrollwheel'] = ! empty( $new_instance['scrollwheel'] ) ? strip_tags( $new_instance['scrollwheel'] ) : 0; |
|
154 | + $instance['title'] = ! empty($new_instance['title']) ? strip_tags($new_instance['title']) : ''; |
|
155 | + $instance['width'] = ! empty($new_instance['width']) ? strip_tags($new_instance['width']) : ''; |
|
156 | + $instance['height'] = ! empty($new_instance['height']) ? strip_tags($new_instance['height']) : ''; |
|
157 | + $instance['lat'] = ! empty($new_instance['lat']) ? strip_tags($new_instance['lat']) : ''; |
|
158 | + $instance['lng'] = ! empty($new_instance['lng']) ? strip_tags($new_instance['lng']) : ''; |
|
159 | + $instance['info'] = ! empty($new_instance['info']) ? strip_tags($new_instance['info']) : ''; |
|
160 | + $instance['zoom'] = ! empty($new_instance['zoom']) ? strip_tags($new_instance['zoom']) : null; |
|
161 | + $instance['scrollwheel'] = ! empty($new_instance['scrollwheel']) ? strip_tags($new_instance['scrollwheel']) : 0; |
|
162 | 162 | |
163 | 163 | return $instance; |
164 | 164 | } |
@@ -169,9 +169,9 @@ discard block |
||
169 | 169 | * @param [Array] $args : Array of arguments to parse. |
170 | 170 | * @return [Array] : Parsed arguments. |
171 | 171 | */ |
172 | - private function parse_args( $args ) { |
|
172 | + private function parse_args($args) { |
|
173 | 173 | // Set default values. |
174 | - $args = wp_parse_args( $args, array( |
|
174 | + $args = wp_parse_args($args, array( |
|
175 | 175 | 'title' => '', |
176 | 176 | 'width' => '300px', |
177 | 177 | 'height' => '300px', |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | 'info' => '', |
181 | 181 | 'zoom' => 14, |
182 | 182 | 'scrollwheel' => 0, |
183 | - ) ); |
|
183 | + )); |
|
184 | 184 | |
185 | 185 | return $args; |
186 | 186 | } |
@@ -1,24 +1,24 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | // Google maps. |
4 | -include_once( 'google-maps/gmaps.php' ); |
|
4 | +include_once('google-maps/gmaps.php'); |
|
5 | 5 | |
6 | 6 | // Equal Housing. |
7 | -include_once( 'equal-housing/equal-housing.php' ); |
|
7 | +include_once('equal-housing/equal-housing.php'); |
|
8 | 8 | |
9 | 9 | // Zillow. |
10 | -include_once( 'zillow/zillow.php' ); |
|
10 | +include_once('zillow/zillow.php'); |
|
11 | 11 | |
12 | -include_once( 'trulia/trulia.php' ); |
|
12 | +include_once('trulia/trulia.php'); |
|
13 | 13 | |
14 | -include_once( 'inman/inman.php' ); |
|
14 | +include_once('inman/inman.php'); |
|
15 | 15 | |
16 | -include_once( 'homes-com/homes-com.php' ); |
|
16 | +include_once('homes-com/homes-com.php'); |
|
17 | 17 | |
18 | -include_once( 'streetadvisor/streetadvisor.php' ); |
|
18 | +include_once('streetadvisor/streetadvisor.php'); |
|
19 | 19 | |
20 | -include_once( 'greatschools/greatschools.php' ); |
|
20 | +include_once('greatschools/greatschools.php'); |
|
21 | 21 | |
22 | -include_once( 'homefinder/homefinder.php' ); |
|
22 | +include_once('homefinder/homefinder.php'); |
|
23 | 23 | |
24 | -include_once( 'rentbits/rentbits.php' ); |
|
24 | +include_once('rentbits/rentbits.php'); |
@@ -13,9 +13,9 @@ discard block |
||
13 | 13 | |
14 | 14 | parent::__construct( |
15 | 15 | 'getschools', |
16 | - __( 'GreatSchools - Get List of Schools', 're-pro' ), |
|
16 | + __('GreatSchools - Get List of Schools', 're-pro'), |
|
17 | 17 | array( |
18 | - 'description' => __( 'Get Schools', 're-pro' ), |
|
18 | + 'description' => __('Get Schools', 're-pro'), |
|
19 | 19 | ) |
20 | 20 | ); |
21 | 21 | |
@@ -29,39 +29,39 @@ discard block |
||
29 | 29 | * @param mixed $instance |
30 | 30 | * @return void |
31 | 31 | */ |
32 | - public function widget( $args, $instance ) { |
|
32 | + public function widget($args, $instance) { |
|
33 | 33 | |
34 | - $greatschools_title = !empty( $instance['greatschools_title'] ) ? $instance['greatschools_title'] : ''; |
|
35 | - $greatschools_state = !empty( $instance['greatschools_state'] ) ? $instance['greatschools_state'] : ''; |
|
36 | - $greatschools_city = !empty( $instance['greatschools_city'] ) ? $instance['greatschools_city'] : ''; |
|
34 | + $greatschools_title = ! empty($instance['greatschools_title']) ? $instance['greatschools_title'] : ''; |
|
35 | + $greatschools_state = ! empty($instance['greatschools_state']) ? $instance['greatschools_state'] : ''; |
|
36 | + $greatschools_city = ! empty($instance['greatschools_city']) ? $instance['greatschools_city'] : ''; |
|
37 | 37 | |
38 | 38 | // Call our API. |
39 | - $repro_settings = get_option( 'repro_settings' ); |
|
39 | + $repro_settings = get_option('repro_settings'); |
|
40 | 40 | $greatschools_apikey = $repro_settings['greatschools_apikey']; |
41 | 41 | |
42 | - $greatschools = new GreatSchoolsAPI( $greatschools_apikey ); |
|
43 | - $schools = $greatschools->get_schools( $greatschools_state,$greatschools_city ); |
|
42 | + $greatschools = new GreatSchoolsAPI($greatschools_apikey); |
|
43 | + $schools = $greatschools->get_schools($greatschools_state, $greatschools_city); |
|
44 | 44 | |
45 | 45 | |
46 | 46 | |
47 | 47 | echo $args['before_widget']; |
48 | 48 | |
49 | - echo $args['before_title'] . esc_attr( $greatschools_title ) . $args['after_title']; |
|
49 | + echo $args['before_title'] . esc_attr($greatschools_title) . $args['after_title']; |
|
50 | 50 | |
51 | 51 | // var_dump($schools); |
52 | 52 | |
53 | - foreach($schools as $school) { |
|
53 | + foreach ($schools as $school) { |
|
54 | 54 | |
55 | - foreach($school as $school_item) { |
|
55 | + foreach ($school as $school_item) { |
|
56 | 56 | |
57 | 57 | $name = $school_item['name']; |
58 | - $type =$school_item['type']; |
|
58 | + $type = $school_item['type']; |
|
59 | 59 | $grade_range = $school_item['gradeRange']; |
60 | 60 | $state = $school_item['state']; |
61 | 61 | $city = $school_item['city']; |
62 | 62 | $overview_link = $school_item['overviewLink']; |
63 | 63 | |
64 | - echo '<li><a href="'.$overview_link.'" rel="nofollow">' . $name . '</a></li>'; |
|
64 | + echo '<li><a href="' . $overview_link . '" rel="nofollow">' . $name . '</a></li>'; |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | |
@@ -71,48 +71,48 @@ discard block |
||
71 | 71 | |
72 | 72 | } |
73 | 73 | |
74 | - public function form( $instance ) { |
|
74 | + public function form($instance) { |
|
75 | 75 | |
76 | 76 | // Set default values |
77 | - $instance = wp_parse_args( (array) $instance, array( |
|
77 | + $instance = wp_parse_args((array) $instance, array( |
|
78 | 78 | 'greatschools_title' => '', |
79 | 79 | 'greatschools_state' => '', |
80 | 80 | 'greatschools_city' => '', |
81 | - ) ); |
|
81 | + )); |
|
82 | 82 | |
83 | 83 | // Retrieve an existing value from the database |
84 | - $greatschools_title = !empty( $instance['greatschools_title'] ) ? $instance['greatschools_title'] : ''; |
|
85 | - $greatschools_state = !empty( $instance['greatschools_state'] ) ? $instance['greatschools_state'] : ''; |
|
86 | - $greatschools_city = !empty( $instance['greatschools_city'] ) ? $instance['greatschools_city'] : ''; |
|
84 | + $greatschools_title = ! empty($instance['greatschools_title']) ? $instance['greatschools_title'] : ''; |
|
85 | + $greatschools_state = ! empty($instance['greatschools_state']) ? $instance['greatschools_state'] : ''; |
|
86 | + $greatschools_city = ! empty($instance['greatschools_city']) ? $instance['greatschools_city'] : ''; |
|
87 | 87 | |
88 | 88 | // Form fields |
89 | 89 | echo '<p>'; |
90 | - echo ' <label for="' . $this->get_field_id( 'greatschools_title' ) . '" class="greatschools_title_label">' . __( 'Title', 're-pro' ) . '</label>'; |
|
91 | - 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 ) . '">'; |
|
92 | - echo ' <span class="description">' . __( 'Title', 're-pro' ) . '</span>'; |
|
90 | + echo ' <label for="' . $this->get_field_id('greatschools_title') . '" class="greatschools_title_label">' . __('Title', 're-pro') . '</label>'; |
|
91 | + 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) . '">'; |
|
92 | + echo ' <span class="description">' . __('Title', 're-pro') . '</span>'; |
|
93 | 93 | echo '</p>'; |
94 | 94 | |
95 | 95 | echo '<p>'; |
96 | - echo ' <label for="' . $this->get_field_id( 'greatschools_state' ) . '" class="greatschools_state_label">' . __( 'State', 're-pro' ) . '</label>'; |
|
97 | - 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 ) . '">'; |
|
98 | - echo ' <span class="description">' . __( 'State', 're-pro' ) . '</span>'; |
|
96 | + echo ' <label for="' . $this->get_field_id('greatschools_state') . '" class="greatschools_state_label">' . __('State', 're-pro') . '</label>'; |
|
97 | + 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) . '">'; |
|
98 | + echo ' <span class="description">' . __('State', 're-pro') . '</span>'; |
|
99 | 99 | echo '</p>'; |
100 | 100 | |
101 | 101 | echo '<p>'; |
102 | - echo ' <label for="' . $this->get_field_id( 'greatschools_city' ) . '" class="greatschools_city_label">' . __( 'City', 're-pro' ) . '</label>'; |
|
103 | - 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 ) . '">'; |
|
104 | - echo ' <span class="description">' . __( 'City', 're-pro' ) . '</span>'; |
|
102 | + echo ' <label for="' . $this->get_field_id('greatschools_city') . '" class="greatschools_city_label">' . __('City', 're-pro') . '</label>'; |
|
103 | + 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) . '">'; |
|
104 | + echo ' <span class="description">' . __('City', 're-pro') . '</span>'; |
|
105 | 105 | echo '</p>'; |
106 | 106 | |
107 | 107 | } |
108 | 108 | |
109 | - public function update( $new_instance, $old_instance ) { |
|
109 | + public function update($new_instance, $old_instance) { |
|
110 | 110 | |
111 | 111 | $instance = $old_instance; |
112 | 112 | |
113 | - $instance['greatschools_title'] = !empty( $new_instance['greatschools_title'] ) ? strip_tags( $new_instance['greatschools_title'] ) : ''; |
|
114 | - $instance['greatschools_state'] = !empty( $new_instance['greatschools_state'] ) ? strip_tags( $new_instance['greatschools_state'] ) : ''; |
|
115 | - $instance['greatschools_city'] = !empty( $new_instance['greatschools_city'] ) ? strip_tags( $new_instance['greatschools_city'] ) : ''; |
|
113 | + $instance['greatschools_title'] = ! empty($new_instance['greatschools_title']) ? strip_tags($new_instance['greatschools_title']) : ''; |
|
114 | + $instance['greatschools_state'] = ! empty($new_instance['greatschools_state']) ? strip_tags($new_instance['greatschools_state']) : ''; |
|
115 | + $instance['greatschools_city'] = ! empty($new_instance['greatschools_city']) ? strip_tags($new_instance['greatschools_city']) : ''; |
|
116 | 116 | |
117 | 117 | return $instance; |
118 | 118 | |
@@ -122,11 +122,11 @@ discard block |
||
122 | 122 | |
123 | 123 | function greatschools_register_widgets() { |
124 | 124 | |
125 | - $repro_settings = get_option( 'repro_settings' ); |
|
125 | + $repro_settings = get_option('repro_settings'); |
|
126 | 126 | $greatschools_apikey = $repro_settings['greatschools_apikey']; |
127 | 127 | |
128 | - if ( ! empty( $greatschools_apikey) ) { |
|
129 | - register_widget( 'greatschools_getschools' ); |
|
128 | + if ( ! empty($greatschools_apikey)) { |
|
129 | + register_widget('greatschools_getschools'); |
|
130 | 130 | } |
131 | 131 | } |
132 | -add_action( 'widgets_init', 'greatschools_register_widgets' ); |
|
132 | +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 | -require_once( 'widgets/widget-getschools.php' ); |
|
5 | +require_once('widgets/widget-getschools.php'); |