@@ -15,13 +15,11 @@ function contact_info_widget_init() {
15
15
*/
16
16
class Contact_Info_Widget extends WP_Widget {
17
17
18
- public $ text_domain = "contact-info " ;
19
-
20
18
public $ defaults = array (
21
- 'title ' => 'Hours & Info ' ,
22
- 'address ' => "3999 Mission Boulevard, \nSan Diego CA 92109 " ,
23
- 'phone ' => '1-202-555-1212 ' ,
24
- 'hours ' => "Lunch: 11am - 2pm \nDinner: M-Th 5pm - 11pm, Fri-Sat:5pm - 1am " ,
19
+ 'title ' => __ ( 'Hours & Info ' , ' jetpack ' ) ,
20
+ 'address ' => __ ( "3999 Mission Boulevard, \nSan Diego CA 92109 " , ' jetpack ' ) ,
21
+ 'phone ' => _x ( '1-202-555-1212 ' , ' Example of a phone number ' , ' jetpack ' ) ,
22
+ 'hours ' => __ ( "Lunch: 11am - 2pm \nDinner: M-Th 5pm - 11pm, Fri-Sat:5pm - 1am " , ' jetpack ' ) ,
25
23
'showmap ' => 1 ,
26
24
'lat ' => null ,
27
25
'lon ' => null
@@ -33,8 +31,15 @@ class Contact_Info_Widget extends WP_Widget {
33
31
* @return void
34
32
**/
35
33
function __construct () {
36
- $ widget_ops = array ( 'classname ' => 'widget_contact_info ' , 'description ' => __ ( 'Display your location, hours, and contact information. ' , $ this ->text_domain ) );
37
- parent ::__construct ( 'widget_contact_info ' , __ ( 'Contact Info ' , $ this ->text_domain ), $ widget_ops );
34
+ $ widget_ops = array (
35
+ 'classname ' => 'widget_contact_info ' ,
36
+ 'description ' => __ ( 'Display your location, hours, and contact information. ' , 'jetpack ' )
37
+ );
38
+ parent ::__construct (
39
+ 'widget_contact_info ' ,
40
+ apply_filters ( 'jetpack_widget_name ' , __ ( 'Contact Info ' , 'jetpack ' ) ),
41
+ $ widget_ops
42
+ );
38
43
$ this ->alt_option_name = 'widget_contact_info ' ;
39
44
}
40
45
@@ -132,7 +137,7 @@ function update( $new_instance, $old_instance ) {
132
137
133
138
if ( ! $ json ) {
134
139
// The read failed :(
135
- esc_html_e ( "There was a problem getting the data to display this address on a map. Please refresh your browser and try again. " , $ this -> text_domain );
140
+ esc_html_e ( "There was a problem getting the data to display this address on a map. Please refresh your browser and try again. " , ' jetpack ' );
136
141
die ();
137
142
}
138
143
@@ -174,30 +179,30 @@ function form( $instance ) {
174
179
175
180
$ disabled = !$ this ->has_good_map ( $ instance );
176
181
?>
177
- <p><label for="<?php echo esc_attr ( $ this ->get_field_id ( 'title ' ) ); ?> "><?php esc_html_e ( 'Title: ' , $ this -> text_domain ); ?> </label>
182
+ <p><label for="<?php echo esc_attr ( $ this ->get_field_id ( 'title ' ) ); ?> "><?php esc_html_e ( 'Title: ' , ' jetpack ' ); ?> </label>
178
183
179
184
<input class="widefat" id="<?php echo esc_attr ( $ this ->get_field_id ( 'title ' ) ); ?> " name="<?php echo esc_attr ( $ this ->get_field_name ( 'title ' ) ); ?> " type="text" value="<?php echo esc_attr ( $ title ); ?> " /></p>
180
185
181
- <p><label for="<?php echo esc_attr ( $ this ->get_field_id ( 'address ' ) ); ?> "><?php esc_html_e ( 'Address: ' , $ this -> text_domain ); ?> </label>
186
+ <p><label for="<?php echo esc_attr ( $ this ->get_field_id ( 'address ' ) ); ?> "><?php esc_html_e ( 'Address: ' , ' jetpack ' ); ?> </label>
182
187
<textarea class="widefat" id="<?php echo esc_attr ( $ this ->get_field_id ( 'address ' ) ); ?> " name="<?php echo esc_attr ( $ this ->get_field_name ( 'address ' ) ); ?> "><?php echo esc_textarea ( $ address ); ?> </textarea>
183
188
<?php
184
189
if ( $ this ->has_good_map ( $ instance ) ) {
185
190
?>
186
191
<input class="" id="<?php echo esc_attr ( $ this ->get_field_id ( 'showmap ' ) ); ?> " name="<?php echo esc_attr ( $ this ->get_field_name ( 'showmap ' ) ); ?> " value="1" type="checkbox" <?php checked ( $ showmap , 1 ); ?> />
187
- <label for="<?php echo esc_attr ( $ this ->get_field_id ( 'showmap ' ) ); ?> "><?php esc_html_e ( 'Show map ' , $ this -> text_domain ); ?> </label></p>
192
+ <label for="<?php echo esc_attr ( $ this ->get_field_id ( 'showmap ' ) ); ?> "><?php esc_html_e ( 'Show map ' , ' jetpack ' ); ?> </label></p>
188
193
<?php
189
194
} else {
190
195
?>
191
- <span class="error-message"><?php _e (" Sorry. We can not plot this address. a map will not be displayed. Is the address formatted correctly? " ); ?> </span></p>
196
+ <span class="error-message"><?php _e ( ' Sorry. We can not plot this address. A map will not be displayed. Is the address formatted correctly? ' , ' jetpack ' ); ?> </span></p>
192
197
<input id="<?php echo esc_attr ( $ this ->get_field_id ( 'showmap ' ) ); ?> " name="<?php echo esc_attr ( $ this ->get_field_name ( 'showmap ' ) ); ?> " value="<?php echo ( intval ( $ instance ['showmap ' ] ) ); ?> " type="hidden" />
193
198
<?php
194
199
}
195
200
?>
196
201
197
- <p><label for="<?php echo esc_attr ( $ this ->get_field_id ( 'phone ' ) ); ?> "><?php esc_html_e ( 'Phone: ' , $ this -> text_domain ); ?> </label>
202
+ <p><label for="<?php echo esc_attr ( $ this ->get_field_id ( 'phone ' ) ); ?> "><?php esc_html_e ( 'Phone: ' , ' jetpack ' ); ?> </label>
198
203
<input class="widefat" id="<?php echo esc_attr ( $ this ->get_field_id ( 'phone ' ) ); ?> " name="<?php echo esc_attr ( $ this ->get_field_name ( 'phone ' ) ); ?> " type="text" value="<?php echo esc_attr ( $ phone ); ?> " /></p>
199
204
200
- <p><label for="<?php echo esc_attr ( $ this ->get_field_id ( 'hours ' ) ); ?> "><?php esc_html_e ( 'Hours: ' , $ this -> text_domain ); ?> </label>
205
+ <p><label for="<?php echo esc_attr ( $ this ->get_field_id ( 'hours ' ) ); ?> "><?php esc_html_e ( 'Hours: ' , ' jetpack ' ); ?> </label>
201
206
202
207
<textarea class="widefat" id="<?php echo esc_attr ( $ this ->get_field_id ( 'hours ' ) ); ?> " name="<?php echo esc_attr ( $ this ->get_field_name ( 'hours ' ) ); ?> "><?php echo esc_textarea ( $ hours ); ?> </textarea></p>
203
208
@@ -215,8 +220,8 @@ function build_map( $lat, $lon ) {
215
220
216
221
wp_enqueue_script ( "jquery " );
217
222
wp_enqueue_script ( "google-maps " , "https://maps.googleapis.com/maps/api/js?sensor=false " );
218
- wp_enqueue_script ( "contact-info-map-js " , plugins_url ( 'contact-info-map.js ' , __FILE__ ), array ( 'jquery ' , 'google-maps ' ), 20150127 );
219
- wp_enqueue_style ( "contact-info-map-css " , plugins_url ( 'contact-info-map.css ' , __FILE__ ), null , 20150127 );
223
+ wp_enqueue_script ( "contact-info-map-js " , plugins_url ( 'contact-info/contact-info -map.js ' , __FILE__ ), array ( 'jquery ' , 'google-maps ' ), 20150127 );
224
+ wp_enqueue_style ( "contact-info-map-css " , plugins_url ( 'contact-info/contact-info -map.css ' , __FILE__ ), null , 20150127 );
220
225
221
226
$ lat = esc_attr ( $ lat );
222
227
$ lon = esc_attr ( $ lon );
0 commit comments