@@ -21,11 +21,11 @@ discard block |
||
21 | 21 | * Settings constructor. |
22 | 22 | */ |
23 | 23 | public function __construct() { |
24 | - if ( is_admin() ) { |
|
24 | + if (is_admin()) { |
|
25 | 25 | $this->general_settings = get_option('repro_settings'); |
26 | 26 | |
27 | - add_action( 'admin_menu', array( $this, 'add_admin_menu' ) ); |
|
28 | - add_action( 'admin_init', array( $this, 'settings_init' ) ); |
|
27 | + add_action('admin_menu', array($this, 'add_admin_menu')); |
|
28 | + add_action('admin_init', array($this, 'settings_init')); |
|
29 | 29 | } |
30 | 30 | } |
31 | 31 | |
@@ -33,27 +33,27 @@ discard block |
||
33 | 33 | * Add admin menu. |
34 | 34 | */ |
35 | 35 | public function add_admin_menu() { |
36 | - add_options_page( __( 'Real Estate Pro' ), __( 'Real Estate Pro' ), 'manage_options', 're-pro-settings', array( $this, 'render_settings' ) ); |
|
36 | + add_options_page(__('Real Estate Pro'), __('Real Estate Pro'), 'manage_options', 're-pro-settings', array($this, 'render_settings')); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | /** |
40 | 40 | * Initialize settings fields and sections. |
41 | 41 | */ |
42 | 42 | public function settings_init() { |
43 | - register_setting( 'repro_settings', 'repro_settings' ); |
|
43 | + register_setting('repro_settings', 'repro_settings'); |
|
44 | 44 | |
45 | 45 | // General Settings. |
46 | 46 | add_settings_section( |
47 | 47 | 'repro_settings', |
48 | - __( 'General Settings', 're-pro' ), |
|
49 | - array( $this, 'general_callback' ), |
|
48 | + __('General Settings', 're-pro'), |
|
49 | + array($this, 'general_callback'), |
|
50 | 50 | 'repro_general_settings' |
51 | 51 | ); |
52 | 52 | |
53 | 53 | add_settings_field( |
54 | 54 | 'google_maps', |
55 | - __( 'Google Maps Module', 're-pro' ), |
|
56 | - array( $this, 'google_maps' ), |
|
55 | + __('Google Maps Module', 're-pro'), |
|
56 | + array($this, 'google_maps'), |
|
57 | 57 | 'repro_general_settings', |
58 | 58 | 'repro_settings' |
59 | 59 | ); |
@@ -61,8 +61,8 @@ discard block |
||
61 | 61 | |
62 | 62 | add_settings_field( |
63 | 63 | 'greatschools_apikey', |
64 | - __( 'Great Schools API Key', 're-pro' ), |
|
65 | - array( $this, 'greatschools_module' ), |
|
64 | + __('Great Schools API Key', 're-pro'), |
|
65 | + array($this, 'greatschools_module'), |
|
66 | 66 | 'repro_general_settings', |
67 | 67 | 'repro_settings' |
68 | 68 | ); |
@@ -70,8 +70,8 @@ discard block |
||
70 | 70 | |
71 | 71 | add_settings_field( |
72 | 72 | 'zillow_apikey', |
73 | - __( 'Zillow API Key', 're-pro' ), |
|
74 | - array( $this, 'zillow_module' ), |
|
73 | + __('Zillow API Key', 're-pro'), |
|
74 | + array($this, 'zillow_module'), |
|
75 | 75 | 'repro_general_settings', |
76 | 76 | 'repro_settings' |
77 | 77 | ); |
@@ -79,8 +79,8 @@ discard block |
||
79 | 79 | |
80 | 80 | add_settings_field( |
81 | 81 | 'sa_apikey', |
82 | - __( 'Street Advisor API Key', 're-pro' ), |
|
83 | - array( $this, 'street_advisor' ), |
|
82 | + __('Street Advisor API Key', 're-pro'), |
|
83 | + array($this, 'street_advisor'), |
|
84 | 84 | 'repro_general_settings', |
85 | 85 | 'repro_settings' |
86 | 86 | ); |
@@ -91,36 +91,36 @@ discard block |
||
91 | 91 | * Feed section callback. |
92 | 92 | */ |
93 | 93 | public function general_callback() { |
94 | - echo esc_attr( 'Activate the modules you would like to use.', 're-pro' ); |
|
94 | + echo esc_attr('Activate the modules you would like to use.', 're-pro'); |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | /** |
98 | 98 | * Render Christies field. |
99 | 99 | */ |
100 | 100 | public function google_maps() { |
101 | - $gmaps_active = isset( $this->general_settings['gmaps_active'] ) ? $this->general_settings['gmaps_active'] : '0'; |
|
102 | - $gmaps_key = isset( $this->general_settings['gmaps_key'] ) ? $this->general_settings['gmaps_key'] : ''; |
|
103 | - $gmaps_style = isset( $this->general_settings['gmaps_style'] ) ? $this->general_settings['gmaps_style'] : ''; |
|
104 | - $gmaps_zoom = isset( $this->general_settings['gmaps_zoom'] ) ? $this->general_settings['gmaps_zoom'] : ''; |
|
101 | + $gmaps_active = isset($this->general_settings['gmaps_active']) ? $this->general_settings['gmaps_active'] : '0'; |
|
102 | + $gmaps_key = isset($this->general_settings['gmaps_key']) ? $this->general_settings['gmaps_key'] : ''; |
|
103 | + $gmaps_style = isset($this->general_settings['gmaps_style']) ? $this->general_settings['gmaps_style'] : ''; |
|
104 | + $gmaps_zoom = isset($this->general_settings['gmaps_zoom']) ? $this->general_settings['gmaps_zoom'] : ''; |
|
105 | 105 | |
106 | - $checked = checked( '1', $gmaps_active, false ); |
|
107 | - $is_active = ( '1' === $gmaps_active ) ? 'Deactivate Google maps module?' : 'Activate Google maps module?'; |
|
108 | - $disable_zoom = checked( '1', $gmaps_zoom, false ); |
|
106 | + $checked = checked('1', $gmaps_active, false); |
|
107 | + $is_active = ('1' === $gmaps_active) ? 'Deactivate Google maps module?' : 'Activate Google maps module?'; |
|
108 | + $disable_zoom = checked('1', $gmaps_zoom, false); |
|
109 | 109 | |
110 | - echo '<input style="vertical-align: top;" type="checkbox" name="repro_settings[gmaps_active]"' . esc_attr( $checked ) . ' value="1"> '; |
|
110 | + echo '<input style="vertical-align: top;" type="checkbox" name="repro_settings[gmaps_active]"' . esc_attr($checked) . ' value="1"> '; |
|
111 | 111 | echo '<div style="display: inline-block;">'; |
112 | - esc_attr_e( $is_active ); |
|
112 | + esc_attr_e($is_active); |
|
113 | 113 | echo '</div><br><br>'; |
114 | 114 | |
115 | 115 | echo '<input class="widefat" type="password" name="repro_settings[gmaps_key]" placeholder="Google maps API key" value="' . $gmaps_key . '">'; |
116 | 116 | echo '<span class="description"> Enter your google maps javascript api key</span><br><br>'; |
117 | 117 | |
118 | 118 | echo '<textarea style="width:500px;" rows="10" cols="50" name="repro_settings[gmaps_style]">'; |
119 | - esc_attr_e( $gmaps_style ); |
|
119 | + esc_attr_e($gmaps_style); |
|
120 | 120 | echo '</textarea>'; |
121 | 121 | echo '<br /><span class="description">Insert valid json to add custom style to maps. Json styles can be generated using <a target="_blank" href="https://snazzymaps.com/">Snazzy Maps</a> or the <a target="_blank" href="https://mapstyle.withgoogle.com/">Google Maps Styling Wizard</a></span><br><br>'; |
122 | 122 | |
123 | - echo '<input style="vertical-align: top;" type="checkbox" name="repro_settings[gmaps_zoom]"' . esc_attr( $disable_zoom ) . ' value="1"> '; |
|
123 | + echo '<input style="vertical-align: top;" type="checkbox" name="repro_settings[gmaps_zoom]"' . esc_attr($disable_zoom) . ' value="1"> '; |
|
124 | 124 | echo '<div style="display: inline-block;">'; |
125 | 125 | echo 'Disable scroll zoom in Google Maps'; |
126 | 126 | echo '</div>'; |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | |
130 | 130 | public function zillow_module() { |
131 | 131 | |
132 | - $zillow_apikey = isset( $this->general_settings['zillow_apikey'] ) ? $this->general_settings['zillow_apikey'] : ''; |
|
132 | + $zillow_apikey = isset($this->general_settings['zillow_apikey']) ? $this->general_settings['zillow_apikey'] : ''; |
|
133 | 133 | |
134 | 134 | echo '<input class="widefat" type="text" name="repro_settings[zillow_apikey]" placeholder="Zillow API Key" value="' . $zillow_apikey . '">'; |
135 | 135 | |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | |
138 | 138 | public function street_advisor() { |
139 | 139 | |
140 | - $sa_apikey = isset( $this->general_settings['sa_apikey'] ) ? $this->general_settings['sa_apikey'] : ''; |
|
140 | + $sa_apikey = isset($this->general_settings['sa_apikey']) ? $this->general_settings['sa_apikey'] : ''; |
|
141 | 141 | |
142 | 142 | echo '<input class="widefat" type="text" name="repro_settings[sa_apikey]" placeholder="Street Advisor API Key" value="' . $sa_apikey . '">'; |
143 | 143 | |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | */ |
152 | 152 | public function greatschools_module() { |
153 | 153 | |
154 | - $greatschools_apikey = isset( $this->general_settings['greatschools_apikey'] ) ? $this->general_settings['greatschools_apikey'] : ''; |
|
154 | + $greatschools_apikey = isset($this->general_settings['greatschools_apikey']) ? $this->general_settings['greatschools_apikey'] : ''; |
|
155 | 155 | |
156 | 156 | echo '<input class="widefat" type="text" name="repro_settings[greatschools_apikey]" placeholder="Great Schools API Key" value="' . $greatschools_apikey . '">'; |
157 | 157 | |
@@ -161,16 +161,16 @@ discard block |
||
161 | 161 | * Render full settings page. |
162 | 162 | */ |
163 | 163 | public function render_settings() { |
164 | - if ( ! current_user_can( 'manage_options' ) ) { |
|
165 | - wp_die( esc_attr( "You don't have access to this page", 're-pro' ) ); |
|
164 | + if ( ! current_user_can('manage_options')) { |
|
165 | + wp_die(esc_attr("You don't have access to this page", 're-pro')); |
|
166 | 166 | } |
167 | 167 | |
168 | 168 | echo '<div class="wrap">'; |
169 | 169 | echo '<form method="post" action="options.php">'; |
170 | - echo '<h1>' . esc_attr( 'Real Estate Pro', 're-pro' ) . '</h1>'; |
|
170 | + echo '<h1>' . esc_attr('Real Estate Pro', 're-pro') . '</h1>'; |
|
171 | 171 | |
172 | - settings_fields( 'repro_settings' ); |
|
173 | - do_settings_sections( 'repro_general_settings' ); |
|
172 | + settings_fields('repro_settings'); |
|
173 | + do_settings_sections('repro_general_settings'); |
|
174 | 174 | submit_button(); |
175 | 175 | |
176 | 176 | echo '</form>'; |
@@ -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'); |