@@ -21,11 +21,11 @@ discard block |
||
21 | 21 | */ |
22 | 22 | |
23 | 23 | /* Exit if accessed directly. */ |
24 | -if ( ! defined( 'ABSPATH' ) ) { exit; } |
|
24 | +if ( ! defined('ABSPATH')) { exit; } |
|
25 | 25 | |
26 | 26 | /** Instantiate the plugin. */ |
27 | 27 | new RePro(); |
28 | -require_once( 'settings.php' ); |
|
28 | +require_once('settings.php'); |
|
29 | 29 | |
30 | 30 | |
31 | 31 | /** |
@@ -41,12 +41,12 @@ discard block |
||
41 | 41 | */ |
42 | 42 | public function __construct() { |
43 | 43 | /* Define Constants */ |
44 | - define( 'REPRO_BASE_NAME', plugin_basename( __FILE__ ) ); |
|
45 | - define( 'REPRO_BASE_DIR', plugin_dir_path( __FILE__ ) ); |
|
46 | - define( 'REPRO_PLUGIN_FILE', REPRO_BASE_DIR . 're-pro.php' ); |
|
44 | + define('REPRO_BASE_NAME', plugin_basename(__FILE__)); |
|
45 | + define('REPRO_BASE_DIR', plugin_dir_path(__FILE__)); |
|
46 | + define('REPRO_PLUGIN_FILE', REPRO_BASE_DIR . 're-pro.php'); |
|
47 | 47 | |
48 | 48 | /* Include dependencies */ |
49 | - require_once( 'includes.php' ); |
|
49 | + require_once('includes.php'); |
|
50 | 50 | |
51 | 51 | $this->init(); |
52 | 52 | } |
@@ -59,48 +59,48 @@ discard block |
||
59 | 59 | * @return void |
60 | 60 | */ |
61 | 61 | private function init() { |
62 | - $this->general_settings = get_option( 're_pro_settings' ); |
|
62 | + $this->general_settings = get_option('re_pro_settings'); |
|
63 | 63 | |
64 | 64 | /* Language Support. */ |
65 | - load_plugin_textdomain( 're-pro', false, dirname( REPRO_BASE_NAME ) . '/languages' ); |
|
65 | + load_plugin_textdomain('re-pro', false, dirname(REPRO_BASE_NAME) . '/languages'); |
|
66 | 66 | |
67 | 67 | /* Plugin Activation/De-Activation. */ |
68 | - register_activation_hook( REPRO_PLUGIN_FILE, array( $this, 'activate' ) ); |
|
69 | - register_deactivation_hook( REPRO_PLUGIN_FILE, array( $this, 'deactivate' ) ); |
|
68 | + register_activation_hook(REPRO_PLUGIN_FILE, array($this, 'activate')); |
|
69 | + register_deactivation_hook(REPRO_PLUGIN_FILE, array($this, 'deactivate')); |
|
70 | 70 | |
71 | 71 | /* Set menu page. */ |
72 | - add_action( 'admin_menu', array( $this, 'admin_menu' ) ); |
|
72 | + add_action('admin_menu', array($this, 'admin_menu')); |
|
73 | 73 | |
74 | 74 | /** Enqueue css and js files. */ |
75 | - add_action( 'admin_enqueue_scripts', array( $this, 'admin_scripts' ) ); |
|
76 | - add_action( 'wp_enqueue_scripts', array( $this, 'widget_styles' ) ); |
|
75 | + add_action('admin_enqueue_scripts', array($this, 'admin_scripts')); |
|
76 | + add_action('wp_enqueue_scripts', array($this, 'widget_styles')); |
|
77 | 77 | |
78 | 78 | /* Add link to settings in plugins admin page. */ |
79 | - add_filter( 'plugin_action_links_' . REPRO_BASE_NAME , array( $this, 'plugin_links' ) ); |
|
79 | + add_filter('plugin_action_links_' . REPRO_BASE_NAME, array($this, 'plugin_links')); |
|
80 | 80 | |
81 | - add_filter( 'wpapi_google_map_data', array( $this, 'gmap_style' ), 1 ); |
|
81 | + add_filter('wpapi_google_map_data', array($this, 'gmap_style'), 1); |
|
82 | 82 | |
83 | 83 | $this->init_modules(); |
84 | 84 | } |
85 | 85 | |
86 | 86 | private function init_modules() { |
87 | - $gmaps_key = isset( $this->general_settings['gmaps_key'] ) ? $this->general_settings['gmaps_key'] : null; |
|
87 | + $gmaps_key = isset($this->general_settings['gmaps_key']) ? $this->general_settings['gmaps_key'] : null; |
|
88 | 88 | |
89 | - if ( isset( $this->general_settings['gmaps_active'] ) && isset( $gmaps_key ) ) { |
|
90 | - new WPAPI_GOOGLE_MAPS( $gmaps_key ); |
|
89 | + if (isset($this->general_settings['gmaps_active']) && isset($gmaps_key)) { |
|
90 | + new WPAPI_GOOGLE_MAPS($gmaps_key); |
|
91 | 91 | } |
92 | 92 | } |
93 | 93 | |
94 | - public function gmap_style( $map_data ) { |
|
94 | + public function gmap_style($map_data) { |
|
95 | 95 | // Grab style option. |
96 | - $map_json = ( isset( $this->general_settings['gmaps_style'] ) ) ? $this->general_settings['gmaps_style'] : '[]'; |
|
96 | + $map_json = (isset($this->general_settings['gmaps_style'])) ? $this->general_settings['gmaps_style'] : '[]'; |
|
97 | 97 | |
98 | 98 | // Validate JSON. |
99 | - json_decode( $map_json ); |
|
99 | + json_decode($map_json); |
|
100 | 100 | $json_valid = json_last_error(); |
101 | 101 | |
102 | 102 | // Set style to map_data. |
103 | - $map_data['style'] = ( $json_valid === JSON_ERROR_NONE ) ? $map_json : '[]'; |
|
103 | + $map_data['style'] = ($json_valid === JSON_ERROR_NONE) ? $map_json : '[]'; |
|
104 | 104 | |
105 | 105 | return $map_data; |
106 | 106 | } |
@@ -116,8 +116,8 @@ discard block |
||
116 | 116 | * Enqueue CSS. |
117 | 117 | */ |
118 | 118 | public function admin_scripts() { |
119 | - if ( ! is_admin() ) { |
|
120 | - wp_register_style( 're-pro', plugins_url( 'assets/css/re-pro-min.css', REPRO_PLUGIN_FILE ) ); |
|
119 | + if ( ! is_admin()) { |
|
120 | + wp_register_style('re-pro', plugins_url('assets/css/re-pro-min.css', REPRO_PLUGIN_FILE)); |
|
121 | 121 | // wp_enqueue_style( 're-pro' ); |
122 | 122 | } |
123 | 123 | } |
@@ -126,8 +126,8 @@ discard block |
||
126 | 126 | * Register Widget CSS. |
127 | 127 | */ |
128 | 128 | public function widget_styles() { |
129 | - wp_register_style( 're-pro-widgets', plugins_url( 'assets/css/re-pro-widgets.min.css', REPRO_PLUGIN_FILE ) ); |
|
130 | - wp_enqueue_style( 're-pro-widgets' ); |
|
129 | + wp_register_style('re-pro-widgets', plugins_url('assets/css/re-pro-widgets.min.css', REPRO_PLUGIN_FILE)); |
|
130 | + wp_enqueue_style('re-pro-widgets'); |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | /** |
@@ -150,9 +150,9 @@ discard block |
||
150 | 150 | * @param [Array] $links : Array of links on plugin page. |
151 | 151 | * @return [Array] : Array of links on plugin page. |
152 | 152 | */ |
153 | - public function plugin_links( $links ) { |
|
153 | + public function plugin_links($links) { |
|
154 | 154 | $settings_link = '<a href="options-general.php?page=re-pro-settings">Settings</a>'; |
155 | - array_unshift( $links, $settings_link ); |
|
155 | + array_unshift($links, $settings_link); |
|
156 | 156 | return $links; |
157 | 157 | } |
158 | 158 | } |
@@ -6,35 +6,35 @@ |
||
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 | |
13 | 13 | // Google maps. |
14 | -include_once( 'modules/google-maps/gmaps.php' ); |
|
14 | +include_once('modules/google-maps/gmaps.php'); |
|
15 | 15 | |
16 | 16 | // Equal Housing. |
17 | -include_once( 'modules/equal-housing/equal-housing.php' ); |
|
17 | +include_once('modules/equal-housing/equal-housing.php'); |
|
18 | 18 | |
19 | 19 | // Zillow. |
20 | -include_once( 'modules/zillow/zillow.php' ); |
|
20 | +include_once('modules/zillow/zillow.php'); |
|
21 | 21 | |
22 | -include_once( 'modules/trulia/trulia.php' ); |
|
22 | +include_once('modules/trulia/trulia.php'); |
|
23 | 23 | |
24 | -include_once( 'modules/inman/inman.php' ); |
|
24 | +include_once('modules/inman/inman.php'); |
|
25 | 25 | |
26 | -include_once( 'modules/homes-com/homes-com.php' ); |
|
26 | +include_once('modules/homes-com/homes-com.php'); |
|
27 | 27 | |
28 | 28 | |
29 | -include_once( 'modules/streetadvisor/streetadvisor.php' ); |
|
29 | +include_once('modules/streetadvisor/streetadvisor.php'); |
|
30 | 30 | |
31 | -include_once( 'modules/greatschools/greatschools.php' ); |
|
31 | +include_once('modules/greatschools/greatschools.php'); |
|
32 | 32 | |
33 | -include_once( 'modules/homefinder/homefinder.php' ); |
|
33 | +include_once('modules/homefinder/homefinder.php'); |
|
34 | 34 | |
35 | -include_once( 'modules/rentbits/rentbits.php' ); |
|
35 | +include_once('modules/rentbits/rentbits.php'); |
|
36 | 36 | |
37 | 37 | |
38 | -include_once( 'modules/users/class-user-roles.php' ); |
|
39 | -include_once( 'modules/users/class-user-fields.php' ); |
|
38 | +include_once('modules/users/class-user-roles.php'); |
|
39 | +include_once('modules/users/class-user-fields.php'); |
|
40 | 40 |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | * @param mixed $user User. |
10 | 10 | * @return void |
11 | 11 | */ |
12 | -function repro_user_profile_fields( $user ) { |
|
12 | +function repro_user_profile_fields($user) { |
|
13 | 13 | |
14 | 14 | ?> |
15 | 15 | |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | <th><label for="zillow-username">Zillow Username:</label></th> |
22 | 22 | |
23 | 23 | <td> |
24 | - <input type="text" name="zillow_username" id="zillow-username" value="<?php echo esc_attr( get_the_author_meta( 'zillow_username', $user->ID ) ); ?>" class="regular-text" /><br /> |
|
24 | + <input type="text" name="zillow_username" id="zillow-username" value="<?php echo esc_attr(get_the_author_meta('zillow_username', $user->ID)); ?>" class="regular-text" /><br /> |
|
25 | 25 | <span class="description">Please provide your Zillow Username.</span> |
26 | 26 | </td> |
27 | 27 | </tr> |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | <th><label for="trulia-username">Trulia Username:</label></th> |
31 | 31 | |
32 | 32 | <td> |
33 | - <input type="text" name="trulia_username" id="trulia-username" value="<?php echo esc_attr( get_the_author_meta( 'trulia_username', $user->ID ) ); ?>" class="regular-text" /><br /> |
|
33 | + <input type="text" name="trulia_username" id="trulia-username" value="<?php echo esc_attr(get_the_author_meta('trulia_username', $user->ID)); ?>" class="regular-text" /><br /> |
|
34 | 34 | <span class="description">Please provide your Trulia Username.</span> |
35 | 35 | </td> |
36 | 36 | </tr> |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | <th><label for="homescom-user-id">Homes.com User ID:</label></th> |
40 | 40 | |
41 | 41 | <td> |
42 | - <input type="text" name="homescom_user_id" id="homescom-user-id" value="<?php echo esc_attr( get_the_author_meta( 'homescom_user_id', $user->ID ) ); ?>" class="regular-text" /><br /> |
|
42 | + <input type="text" name="homescom_user_id" id="homescom-user-id" value="<?php echo esc_attr(get_the_author_meta('homescom_user_id', $user->ID)); ?>" class="regular-text" /><br /> |
|
43 | 43 | <span class="description">Please provide your Homes.com User ID.</span> |
44 | 44 | </td> |
45 | 45 | </tr> |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | <th><label for="realtorcom-url">Realtor.com Profile Url:</label></th> |
50 | 50 | |
51 | 51 | <td> |
52 | - <input type="text" name="realtorcom_url" id="realtorcom-url" value="<?php echo esc_attr( get_the_author_meta( 'realtorcom_url', $user->ID ) ); ?>" class="regular-text" /><br /> |
|
52 | + <input type="text" name="realtorcom_url" id="realtorcom-url" value="<?php echo esc_attr(get_the_author_meta('realtorcom_url', $user->ID)); ?>" class="regular-text" /><br /> |
|
53 | 53 | <span class="description">Please provide your Realtor.com URL.</span> |
54 | 54 | </td> |
55 | 55 | </tr> |
@@ -59,8 +59,8 @@ discard block |
||
59 | 59 | <?php |
60 | 60 | |
61 | 61 | } // End repro_user_profile_fields. |
62 | -add_action( 'show_user_profile', 'repro_user_profile_fields' ); |
|
63 | -add_action( 'edit_user_profile', 'repro_user_profile_fields' ); |
|
62 | +add_action('show_user_profile', 'repro_user_profile_fields'); |
|
63 | +add_action('edit_user_profile', 'repro_user_profile_fields'); |
|
64 | 64 | |
65 | 65 | /** |
66 | 66 | * repro_user_save_profile_fields function. |
@@ -69,18 +69,18 @@ discard block |
||
69 | 69 | * @param mixed $user_id User ID. |
70 | 70 | * @return void |
71 | 71 | */ |
72 | -function repro_user_save_profile_fields( $user_id ) { |
|
72 | +function repro_user_save_profile_fields($user_id) { |
|
73 | 73 | |
74 | - if ( ! current_user_can( 'edit_user', $user_id ) ) { |
|
74 | + if ( ! current_user_can('edit_user', $user_id)) { |
|
75 | 75 | return false; |
76 | 76 | } |
77 | 77 | |
78 | - update_user_meta( $user_id, 'zillow_username', $_POST['zillow_username'] ); |
|
79 | - update_user_meta( $user_id, 'trulia_username', $_POST['trulia_username'] ); |
|
80 | - update_user_meta( $user_id, 'homescom_user_id', $_POST['homescom_user_id'] ); |
|
81 | - update_user_meta( $user_id, 'realtorcom_url', $_POST['realtorcom_url'] ); |
|
78 | + update_user_meta($user_id, 'zillow_username', $_POST['zillow_username']); |
|
79 | + update_user_meta($user_id, 'trulia_username', $_POST['trulia_username']); |
|
80 | + update_user_meta($user_id, 'homescom_user_id', $_POST['homescom_user_id']); |
|
81 | + update_user_meta($user_id, 'realtorcom_url', $_POST['realtorcom_url']); |
|
82 | 82 | |
83 | 83 | } // End repro_user_save_profile_fields. |
84 | -add_action( 'personal_options_update', 'repro_user_save_profile_fields' ); |
|
85 | -add_action( 'edit_user_profile_update', 'repro_user_save_profile_fields' ); |
|
84 | +add_action('personal_options_update', 'repro_user_save_profile_fields'); |
|
85 | +add_action('edit_user_profile_update', 'repro_user_save_profile_fields'); |
|
86 | 86 |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | * @access private |
29 | 29 | * @return void |
30 | 30 | */ |
31 | - private function add_roles(){ |
|
31 | + private function add_roles() { |
|
32 | 32 | |
33 | 33 | // Add Lead. |
34 | 34 | add_role( |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | 'Lead' |
37 | 37 | ), |
38 | 38 | array( |
39 | - 'read' => true, // Allows a user to read. |
|
39 | + 'read' => true, // Allows a user to read. |
|
40 | 40 | 'create_posts' => false, // Allows user to create new posts. |
41 | 41 | 'edit_posts' => false, // Allows user to edit their own posts. |
42 | 42 | 'edit_others_posts' => false, // Allows user to edit others posts too. |
@@ -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'); |