@@ -1,7 +1,7 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | /* Exit if accessed directly */ |
| 4 | -if ( ! defined( 'ABSPATH' ) ) { exit; } |
|
| 4 | +if ( ! defined('ABSPATH')) { exit; } |
|
| 5 | 5 | |
| 6 | 6 | /** |
| 7 | 7 | * StreetAdvisor_Details class. |
@@ -20,9 +20,9 @@ discard block |
||
| 20 | 20 | |
| 21 | 21 | parent::__construct( |
| 22 | 22 | 'streetadvisor-details', |
| 23 | - __( 'Street Advisor - Location Details', 're-pro' ), |
|
| 23 | + __('Street Advisor - Location Details', 're-pro'), |
|
| 24 | 24 | array( |
| 25 | - 'description' => __( 'Street Advisor Location Details', 're-pro' ), |
|
| 25 | + 'description' => __('Street Advisor Location Details', 're-pro'), |
|
| 26 | 26 | ) |
| 27 | 27 | ); |
| 28 | 28 | |
@@ -36,23 +36,23 @@ discard block |
||
| 36 | 36 | * @param mixed $instance |
| 37 | 37 | * @return void |
| 38 | 38 | */ |
| 39 | - public function widget( $args, $instance ) { |
|
| 39 | + public function widget($args, $instance) { |
|
| 40 | 40 | |
| 41 | 41 | // Retrieve an existing value from the database |
| 42 | - $latitude = !empty( $instance['latitude'] ) ? $instance['latitude'] : ''; |
|
| 43 | - $longitude = !empty( $instance['longitude'] ) ? $instance['longitude'] : ''; |
|
| 44 | - $level = !empty( $instance['level'] ) ? $instance['level'] : ''; |
|
| 45 | - $title = !empty( $instance['title'] ) ? $instance['title'] : ''; |
|
| 42 | + $latitude = ! empty($instance['latitude']) ? $instance['latitude'] : ''; |
|
| 43 | + $longitude = ! empty($instance['longitude']) ? $instance['longitude'] : ''; |
|
| 44 | + $level = ! empty($instance['level']) ? $instance['level'] : ''; |
|
| 45 | + $title = ! empty($instance['title']) ? $instance['title'] : ''; |
|
| 46 | 46 | |
| 47 | - $streetadvisor = new StreetAdvisorAPI( 'b08f6473-8dee-41c3-9a3e-b32f335e9d2d' ); |
|
| 47 | + $streetadvisor = new StreetAdvisorAPI('b08f6473-8dee-41c3-9a3e-b32f335e9d2d'); |
|
| 48 | 48 | |
| 49 | -$location = $streetadvisor->get_location_data( $latitude, $longitude, $level ); |
|
| 49 | +$location = $streetadvisor->get_location_data($latitude, $longitude, $level); |
|
| 50 | 50 | |
| 51 | 51 | $name = $location['Location']['Name']; |
| 52 | 52 | $ranking_description = $location['Location']['RankingDescription']; |
| 53 | 53 | $score = $location['Location']['Score']; |
| 54 | -$photo_url = esc_url( apply_filters( 'jetpack_photon_url', $location['Location']['PhotoUrl'] ) ); |
|
| 55 | -$streetadvisor_url = esc_url( $location['Location']['Url'] ); // Lets force HTTPS for this please ! |
|
| 54 | +$photo_url = esc_url(apply_filters('jetpack_photon_url', $location['Location']['PhotoUrl'])); |
|
| 55 | +$streetadvisor_url = esc_url($location['Location']['Url']); // Lets force HTTPS for this please ! |
|
| 56 | 56 | |
| 57 | 57 | $recommendations_greatfor = $location['Recommendations']['GreatFor']; |
| 58 | 58 | $recommendations_notgreatfor = $location['Recommendations']['NotGreatFor']; |
@@ -61,20 +61,20 @@ discard block |
||
| 61 | 61 | |
| 62 | 62 | echo $args['before_widget']; |
| 63 | 63 | |
| 64 | -echo $args['before_title'] . esc_attr( $title ) . $args['after_title']; |
|
| 64 | +echo $args['before_title'] . esc_attr($title) . $args['after_title']; |
|
| 65 | 65 | |
| 66 | 66 | echo '<style>.sa-column{width:100%;float:left;display:inline-block;}.streetadvisor-list{margin: 10px 0;}.streetadvisor-list li {list-style-type:circle !important;margin:0;padding:0;list-style-position: inside;}</style>'; |
| 67 | 67 | |
| 68 | -echo '<img id="" class="" src="'.$photo_url.'" srcset="" sizes="" alt="'. $name .'" height="" width="">'; |
|
| 68 | +echo '<img id="" class="" src="' . $photo_url . '" srcset="" sizes="" alt="' . $name . '" height="" width="">'; |
|
| 69 | 69 | |
| 70 | 70 | |
| 71 | -echo '<p>' . $name . ' has a score of <strong>' . $score . ' out of 10</strong> on <a href="'. $streetadvisor_url .'" rel="nofollow">StreetAdvisor</a>. '. $ranking_description .'</p>'; |
|
| 71 | +echo '<p>' . $name . ' has a score of <strong>' . $score . ' out of 10</strong> on <a href="' . $streetadvisor_url . '" rel="nofollow">StreetAdvisor</a>. ' . $ranking_description . '</p>'; |
|
| 72 | 72 | |
| 73 | 73 | echo '<div class="sa-column">'; |
| 74 | 74 | |
| 75 | 75 | echo '<strong>Great For:</strong>'; |
| 76 | 76 | echo '<ul class="re-pro streetadvisor-list streetadvisor-great-for">'; |
| 77 | -foreach($recommendations_greatfor as $greatfor_item) { |
|
| 77 | +foreach ($recommendations_greatfor as $greatfor_item) { |
|
| 78 | 78 | echo '<li>' . $greatfor_item . '</li>'; |
| 79 | 79 | } |
| 80 | 80 | echo '</ul>'; |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | echo '<div class="sa-column">'; |
| 84 | 84 | echo '<strong>Not Great For:</strong>'; |
| 85 | 85 | echo '<ul class="re-pro streetadvisor-list streetadvisor-not-great-for">'; |
| 86 | -foreach($recommendations_notgreatfor as $notgreatfor_item) { |
|
| 86 | +foreach ($recommendations_notgreatfor as $notgreatfor_item) { |
|
| 87 | 87 | echo '<li>' . $notgreatfor_item . '</li>'; |
| 88 | 88 | } |
| 89 | 89 | echo '</ul>'; |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | echo '<div class="sa-column">'; |
| 93 | 93 | echo '<strong>Who Lives Here:</strong>'; |
| 94 | 94 | echo '<ul class="re-pro streetadvisor-list streetadvisor-who-lives-here">'; |
| 95 | -foreach($recommendations_wholiveshere as $wholiveshere_item) { |
|
| 95 | +foreach ($recommendations_wholiveshere as $wholiveshere_item) { |
|
| 96 | 96 | echo '<li>' . $wholiveshere_item . '</li>'; |
| 97 | 97 | } |
| 98 | 98 | echo '</ul>'; |
@@ -109,45 +109,45 @@ discard block |
||
| 109 | 109 | * @param mixed $instance |
| 110 | 110 | * @return void |
| 111 | 111 | */ |
| 112 | - public function form( $instance ) { |
|
| 112 | + public function form($instance) { |
|
| 113 | 113 | |
| 114 | 114 | // Set default values |
| 115 | - $instance = wp_parse_args( (array) $instance, array( |
|
| 115 | + $instance = wp_parse_args((array) $instance, array( |
|
| 116 | 116 | 'latitude' => '', |
| 117 | 117 | 'longitude' => '', |
| 118 | 118 | 'level' => '', |
| 119 | 119 | 'title' => '', |
| 120 | - ) ); |
|
| 120 | + )); |
|
| 121 | 121 | |
| 122 | 122 | // Retrieve an existing value from the database |
| 123 | - $latitude = !empty( $instance['latitude'] ) ? $instance['latitude'] : ''; |
|
| 124 | - $longitude = !empty( $instance['longitude'] ) ? $instance['longitude'] : ''; |
|
| 125 | - $level = !empty( $instance['level'] ) ? $instance['level'] : ''; |
|
| 126 | - $title = !empty( $instance['title'] ) ? $instance['title'] : ''; |
|
| 123 | + $latitude = ! empty($instance['latitude']) ? $instance['latitude'] : ''; |
|
| 124 | + $longitude = ! empty($instance['longitude']) ? $instance['longitude'] : ''; |
|
| 125 | + $level = ! empty($instance['level']) ? $instance['level'] : ''; |
|
| 126 | + $title = ! empty($instance['title']) ? $instance['title'] : ''; |
|
| 127 | 127 | |
| 128 | 128 | // Form fields |
| 129 | 129 | echo '<p>'; |
| 130 | - echo ' <label for="' . $this->get_field_id( 'title' ) . '" class="title_label">' . __( 'Title', 're-pro' ) . '</label>'; |
|
| 131 | - echo ' <input type="text" id="' . $this->get_field_id( 'title' ) . '" name="' . $this->get_field_name( 'title' ) . '" class="widefat" placeholder="' . esc_attr__( '', 're-pro' ) . '" value="' . esc_attr( $title ) . '">'; |
|
| 132 | - echo ' <span class="description">' . __( 'Title', 're-pro' ) . '</span>'; |
|
| 130 | + echo ' <label for="' . $this->get_field_id('title') . '" class="title_label">' . __('Title', 're-pro') . '</label>'; |
|
| 131 | + echo ' <input type="text" id="' . $this->get_field_id('title') . '" name="' . $this->get_field_name('title') . '" class="widefat" placeholder="' . esc_attr__('', 're-pro') . '" value="' . esc_attr($title) . '">'; |
|
| 132 | + echo ' <span class="description">' . __('Title', 're-pro') . '</span>'; |
|
| 133 | 133 | echo '</p>'; |
| 134 | 134 | |
| 135 | 135 | echo '<p>'; |
| 136 | - echo ' <label for="' . $this->get_field_id( 'latitude' ) . '" class="latitude_label">' . __( 'Latitude', 're-pro' ) . '</label>'; |
|
| 137 | - echo ' <input type="text" id="' . $this->get_field_id( 'latitude' ) . '" name="' . $this->get_field_name( 'latitude' ) . '" class="widefat" placeholder="' . esc_attr__( '', 're-pro' ) . '" value="' . esc_attr( $latitude ) . '">'; |
|
| 138 | - echo ' <span class="description">' . __( 'Latitude', 're-pro' ) . '</span>'; |
|
| 136 | + echo ' <label for="' . $this->get_field_id('latitude') . '" class="latitude_label">' . __('Latitude', 're-pro') . '</label>'; |
|
| 137 | + echo ' <input type="text" id="' . $this->get_field_id('latitude') . '" name="' . $this->get_field_name('latitude') . '" class="widefat" placeholder="' . esc_attr__('', 're-pro') . '" value="' . esc_attr($latitude) . '">'; |
|
| 138 | + echo ' <span class="description">' . __('Latitude', 're-pro') . '</span>'; |
|
| 139 | 139 | echo '</p>'; |
| 140 | 140 | |
| 141 | 141 | echo '<p>'; |
| 142 | - echo ' <label for="' . $this->get_field_id( 'longitude' ) . '" class="longitude_label">' . __( 'Longitude', 're-pro' ) . '</label>'; |
|
| 143 | - echo ' <input type="text" id="' . $this->get_field_id( 'longitude' ) . '" name="' . $this->get_field_name( 'longitude' ) . '" class="widefat" placeholder="' . esc_attr__( '', 're-pro' ) . '" value="' . esc_attr( $longitude ) . '">'; |
|
| 144 | - echo ' <span class="description">' . __( 'Longitude', 're-pro' ) . '</span>'; |
|
| 142 | + echo ' <label for="' . $this->get_field_id('longitude') . '" class="longitude_label">' . __('Longitude', 're-pro') . '</label>'; |
|
| 143 | + echo ' <input type="text" id="' . $this->get_field_id('longitude') . '" name="' . $this->get_field_name('longitude') . '" class="widefat" placeholder="' . esc_attr__('', 're-pro') . '" value="' . esc_attr($longitude) . '">'; |
|
| 144 | + echo ' <span class="description">' . __('Longitude', 're-pro') . '</span>'; |
|
| 145 | 145 | echo '</p>'; |
| 146 | 146 | |
| 147 | 147 | echo '<p>'; |
| 148 | - echo ' <label for="' . $this->get_field_id( 'level' ) . '" class="level_label">' . __( 'Level', 're-pro' ) . '</label>'; |
|
| 149 | - echo ' <input type="number" id="' . $this->get_field_id( 'level' ) . '" name="' . $this->get_field_name( 'level' ) . '" class="widefat" placeholder="' . esc_attr__( '', 're-pro' ) . '" value="' . esc_attr( $level ) . '" step="1" min="0" max="50">'; |
|
| 150 | - echo ' <span class="description">' . __( 'Level', 're-pro' ) . '</span>'; |
|
| 148 | + echo ' <label for="' . $this->get_field_id('level') . '" class="level_label">' . __('Level', 're-pro') . '</label>'; |
|
| 149 | + echo ' <input type="number" id="' . $this->get_field_id('level') . '" name="' . $this->get_field_name('level') . '" class="widefat" placeholder="' . esc_attr__('', 're-pro') . '" value="' . esc_attr($level) . '" step="1" min="0" max="50">'; |
|
| 150 | + echo ' <span class="description">' . __('Level', 're-pro') . '</span>'; |
|
| 151 | 151 | echo '</p>'; |
| 152 | 152 | |
| 153 | 153 | |
@@ -163,14 +163,14 @@ discard block |
||
| 163 | 163 | * @param mixed $old_instance |
| 164 | 164 | * @return void |
| 165 | 165 | */ |
| 166 | - public function update( $new_instance, $old_instance ) { |
|
| 166 | + public function update($new_instance, $old_instance) { |
|
| 167 | 167 | |
| 168 | 168 | $instance = $old_instance; |
| 169 | 169 | |
| 170 | - $instance['latitude'] = !empty( $new_instance['latitude'] ) ? strip_tags( $new_instance['latitude'] ) : ''; |
|
| 171 | - $instance['longitude'] = !empty( $new_instance['longitude'] ) ? strip_tags( $new_instance['longitude'] ) : ''; |
|
| 172 | - $instance['level'] = !empty( $new_instance['level'] ) ? strip_tags( $new_instance['level'] ) : ''; |
|
| 173 | - $instance['title'] = !empty( $new_instance['title'] ) ? strip_tags( $new_instance['title'] ) : ''; |
|
| 170 | + $instance['latitude'] = ! empty($new_instance['latitude']) ? strip_tags($new_instance['latitude']) : ''; |
|
| 171 | + $instance['longitude'] = ! empty($new_instance['longitude']) ? strip_tags($new_instance['longitude']) : ''; |
|
| 172 | + $instance['level'] = ! empty($new_instance['level']) ? strip_tags($new_instance['level']) : ''; |
|
| 173 | + $instance['title'] = ! empty($new_instance['title']) ? strip_tags($new_instance['title']) : ''; |
|
| 174 | 174 | |
| 175 | 175 | return $instance; |
| 176 | 176 | |
@@ -185,6 +185,6 @@ discard block |
||
| 185 | 185 | * @return void |
| 186 | 186 | */ |
| 187 | 187 | function register_widgets() { |
| 188 | - register_widget( 'StreetAdvisor_Details' ); |
|
| 188 | + register_widget('StreetAdvisor_Details'); |
|
| 189 | 189 | } |
| 190 | -add_action( 'widgets_init', 'register_widgets' ); |
|
| 190 | +add_action('widgets_init', 'register_widgets'); |
|
@@ -6,10 +6,10 @@ |
||
| 6 | 6 | */ |
| 7 | 7 | |
| 8 | 8 | /* Exit if accessed directly. */ |
| 9 | -if ( ! defined( 'ABSPATH' ) ) { exit; } |
|
| 9 | +if ( ! defined('ABSPATH')) { exit; } |
|
| 10 | 10 | |
| 11 | -include( 'wp-streetadvisor-api.php' ); |
|
| 11 | +include('wp-streetadvisor-api.php'); |
|
| 12 | 12 | |
| 13 | -include( 'widgets/streetadvisor-details.php' ); |
|
| 13 | +include('widgets/streetadvisor-details.php'); |
|
| 14 | 14 | |
| 15 | 15 | // include( 'widgets/streetadvisor-reviews.php' ); |
@@ -15,8 +15,8 @@ discard block |
||
| 15 | 15 | * GitHub Branch: master |
| 16 | 16 | */ |
| 17 | 17 | /* Exit if accessed directly */ |
| 18 | -if ( ! defined( 'ABSPATH' ) ) { exit; } |
|
| 19 | -if ( ! class_exists( 'GreatSchoolsAPI' ) ) { |
|
| 18 | +if ( ! defined('ABSPATH')) { exit; } |
|
| 19 | +if ( ! class_exists('GreatSchoolsAPI')) { |
|
| 20 | 20 | /** |
| 21 | 21 | * GreatSchools API Class. |
| 22 | 22 | */ |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | * @param string $output (default: 'json') Output. |
| 49 | 49 | * @return void |
| 50 | 50 | */ |
| 51 | - public function __construct( $api_key, $output = 'json' ) { |
|
| 51 | + public function __construct($api_key, $output = 'json') { |
|
| 52 | 52 | static::$api_key = $api_key; |
| 53 | 53 | static::$output = $output; |
| 54 | 54 | } |
@@ -59,13 +59,13 @@ discard block |
||
| 59 | 59 | * @param mixed $request Request URL. |
| 60 | 60 | * @return $body Body. |
| 61 | 61 | */ |
| 62 | - private function fetch( $request ) { |
|
| 63 | - $response = wp_remote_get( $request ); |
|
| 64 | - $code = wp_remote_retrieve_response_code( $response ); |
|
| 65 | - if ( 200 !== $code ) { |
|
| 66 | - return new WP_Error( 'response-error', sprintf( __( 'Server response code: %d', 'text-domain' ), $code ) ); |
|
| 62 | + private function fetch($request) { |
|
| 63 | + $response = wp_remote_get($request); |
|
| 64 | + $code = wp_remote_retrieve_response_code($response); |
|
| 65 | + if (200 !== $code) { |
|
| 66 | + return new WP_Error('response-error', sprintf(__('Server response code: %d', 'text-domain'), $code)); |
|
| 67 | 67 | } |
| 68 | - $body = wp_remote_retrieve_body( $response ); |
|
| 68 | + $body = wp_remote_retrieve_body($response); |
|
| 69 | 69 | return $body; |
| 70 | 70 | } |
| 71 | 71 | /** |
@@ -76,11 +76,11 @@ discard block |
||
| 76 | 76 | * @param mixed $city City. |
| 77 | 77 | * @return void |
| 78 | 78 | */ |
| 79 | - public function get_schools( $state, $city ) { |
|
| 79 | + public function get_schools($state, $city) { |
|
| 80 | 80 | $request = $this->base_uri . $state . '/' . $city . '?key=' . static::$api_key; |
| 81 | - $xml = simplexml_load_file( $request ); |
|
| 82 | - $json = wp_json_encode( $xml ); |
|
| 83 | - $results = json_decode( $json, true ); |
|
| 81 | + $xml = simplexml_load_file($request); |
|
| 82 | + $json = wp_json_encode($xml); |
|
| 83 | + $results = json_decode($json, true); |
|
| 84 | 84 | return $results; |
| 85 | 85 | } |
| 86 | 86 | /** |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | * @param mixed $limit Limit. |
| 100 | 100 | * @return void |
| 101 | 101 | */ |
| 102 | - public function get_nearby_schools( $state, $zip, $city, $address, $latitude, $longitude, $school_type, $level_code, $radius, $limit ) { |
|
| 102 | + public function get_nearby_schools($state, $zip, $city, $address, $latitude, $longitude, $school_type, $level_code, $radius, $limit) { |
|
| 103 | 103 | } |
| 104 | 104 | /** |
| 105 | 105 | * Returns a profile data for a specific school. |
@@ -109,11 +109,11 @@ discard block |
||
| 109 | 109 | * @param mixed $school_id School ID. |
| 110 | 110 | * @return void |
| 111 | 111 | */ |
| 112 | - public function get_school( $state, $school_id ) { |
|
| 113 | - $request = $this->base_uri . $state . '/'. $school_id .'?key=' . static::$api_key; |
|
| 114 | - $xml = simplexml_load_file( $request ); |
|
| 115 | - $json = wp_json_encode( $xml ); |
|
| 116 | - $results = json_decode( $json, true ); |
|
| 112 | + public function get_school($state, $school_id) { |
|
| 113 | + $request = $this->base_uri . $state . '/' . $school_id . '?key=' . static::$api_key; |
|
| 114 | + $xml = simplexml_load_file($request); |
|
| 115 | + $json = wp_json_encode($xml); |
|
| 116 | + $results = json_decode($json, true); |
|
| 117 | 117 | return $results; |
| 118 | 118 | } |
| 119 | 119 | /** |
@@ -124,11 +124,11 @@ discard block |
||
| 124 | 124 | * @param mixed $query_string Query String. |
| 125 | 125 | * @return void |
| 126 | 126 | */ |
| 127 | - public function search_for_schools( $state, $query_string, $level_code, $sort, $limit ) { |
|
| 128 | - $request = $this->base_uri . '/search/schools?key=' . static::$api_key . '&state=' . $state . '&q='. $query_string .'&levelCode='. $level_code .'&sort='. $sort .'&limit=' . $limit; |
|
| 129 | - $xml = simplexml_load_file( $request ); |
|
| 130 | - $json = wp_json_encode( $xml ); |
|
| 131 | - $results = json_decode( $json, true ); |
|
| 127 | + public function search_for_schools($state, $query_string, $level_code, $sort, $limit) { |
|
| 128 | + $request = $this->base_uri . '/search/schools?key=' . static::$api_key . '&state=' . $state . '&q=' . $query_string . '&levelCode=' . $level_code . '&sort=' . $sort . '&limit=' . $limit; |
|
| 129 | + $xml = simplexml_load_file($request); |
|
| 130 | + $json = wp_json_encode($xml); |
|
| 131 | + $results = json_decode($json, true); |
|
| 132 | 132 | return $results; |
| 133 | 133 | } |
| 134 | 134 | /** |
@@ -143,11 +143,11 @@ discard block |
||
| 143 | 143 | * @param mixed $topic_id Topic ID. |
| 144 | 144 | * @return void |
| 145 | 145 | */ |
| 146 | - public function get_school_reviews( $state, $city, $school_id, $cutoffage, $limit, $topic_id ) { |
|
| 147 | - $request = $this->base_uri . '/reviews/school/' . $state . '/'. $school_id .'?key=' . static::$api_key . '&limit='. $limit .'&cutoffAge='. $cutoffage .'&topicId=' . $topic_id; |
|
| 148 | - $xml = simplexml_load_file( $request ); |
|
| 149 | - $json = wp_json_encode( $xml ); |
|
| 150 | - $results = json_decode( $json, true ); |
|
| 146 | + public function get_school_reviews($state, $city, $school_id, $cutoffage, $limit, $topic_id) { |
|
| 147 | + $request = $this->base_uri . '/reviews/school/' . $state . '/' . $school_id . '?key=' . static::$api_key . '&limit=' . $limit . '&cutoffAge=' . $cutoffage . '&topicId=' . $topic_id; |
|
| 148 | + $xml = simplexml_load_file($request); |
|
| 149 | + $json = wp_json_encode($xml); |
|
| 150 | + $results = json_decode($json, true); |
|
| 151 | 151 | return $results; |
| 152 | 152 | } |
| 153 | 153 | /** |
@@ -158,9 +158,9 @@ discard block |
||
| 158 | 158 | */ |
| 159 | 159 | public function get_review_topics() { |
| 160 | 160 | $request = $this->base_uri . '/reviews/reviewTopics?key=' . static::$api_key; |
| 161 | - $xml = simplexml_load_file( $request ); |
|
| 162 | - $json = wp_json_encode( $xml ); |
|
| 163 | - $results = json_decode( $json, true ); |
|
| 161 | + $xml = simplexml_load_file($request); |
|
| 162 | + $json = wp_json_encode($xml); |
|
| 163 | + $results = json_decode($json, true); |
|
| 164 | 164 | return $results; |
| 165 | 165 | } |
| 166 | 166 | /** |
@@ -171,11 +171,11 @@ discard block |
||
| 171 | 171 | * @param mixed $school_id School ID. |
| 172 | 172 | * @return void |
| 173 | 173 | */ |
| 174 | - public function get_school_test_scores( $state, $school_id ) { |
|
| 175 | - $request = $this->base_uri . '/school/tests/' . $state . '/'. $school_id .'?key=' . static::$api_key; |
|
| 176 | - $xml = simplexml_load_file( $request ); |
|
| 177 | - $json = wp_json_encode( $xml ); |
|
| 178 | - $results = json_decode( $json, true ); |
|
| 174 | + public function get_school_test_scores($state, $school_id) { |
|
| 175 | + $request = $this->base_uri . '/school/tests/' . $state . '/' . $school_id . '?key=' . static::$api_key; |
|
| 176 | + $xml = simplexml_load_file($request); |
|
| 177 | + $json = wp_json_encode($xml); |
|
| 178 | + $results = json_decode($json, true); |
|
| 179 | 179 | return $results; |
| 180 | 180 | } |
| 181 | 181 | /** |
@@ -186,11 +186,11 @@ discard block |
||
| 186 | 186 | * @param mixed $school_id School ID. |
| 187 | 187 | * @return void |
| 188 | 188 | */ |
| 189 | - public function get_school_census_data( $state, $school_id ) { |
|
| 190 | - $request = $this->base_uri . '/school/census/' . $state . '/'. $school_id .'?key=' . static::$api_key; |
|
| 191 | - $xml = simplexml_load_file( $request ); |
|
| 192 | - $json = wp_json_encode( $xml ); |
|
| 193 | - $results = json_decode( $json, true ); |
|
| 189 | + public function get_school_census_data($state, $school_id) { |
|
| 190 | + $request = $this->base_uri . '/school/census/' . $state . '/' . $school_id . '?key=' . static::$api_key; |
|
| 191 | + $xml = simplexml_load_file($request); |
|
| 192 | + $json = wp_json_encode($xml); |
|
| 193 | + $results = json_decode($json, true); |
|
| 194 | 194 | return $results; |
| 195 | 195 | } |
| 196 | 196 | /** |
@@ -201,11 +201,11 @@ discard block |
||
| 201 | 201 | * @param mixed $city City. |
| 202 | 202 | * @return void |
| 203 | 203 | */ |
| 204 | - public function get_city_schools( $state, $city ) { |
|
| 205 | - $request = $this->base_uri . '/cities/' . $state . '/'. $city .'?key=' . static::$api_key; |
|
| 206 | - $xml = simplexml_load_file( $request ); |
|
| 207 | - $json = wp_json_encode( $xml ); |
|
| 208 | - $results = json_decode( $json, true ); |
|
| 204 | + public function get_city_schools($state, $city) { |
|
| 205 | + $request = $this->base_uri . '/cities/' . $state . '/' . $city . '?key=' . static::$api_key; |
|
| 206 | + $xml = simplexml_load_file($request); |
|
| 207 | + $json = wp_json_encode($xml); |
|
| 208 | + $results = json_decode($json, true); |
|
| 209 | 209 | return $results; |
| 210 | 210 | } |
| 211 | 211 | /** |
@@ -218,11 +218,11 @@ discard block |
||
| 218 | 218 | * @param mixed $sort Sort. |
| 219 | 219 | * @return void |
| 220 | 220 | */ |
| 221 | - public function get_nearby_cities( $state, $city, $radius, $sort = 'rating' ) { |
|
| 222 | - $request = $this->base_uri . '/cities/nearby/' . $state . '/'. $city .'?key=' . static::$api_key . '&radius='. $radius .'&sort=' . $sort; |
|
| 223 | - $xml = simplexml_load_file( $request ); |
|
| 224 | - $json = wp_json_encode( $xml ); |
|
| 225 | - $results = json_decode( $json, true ); |
|
| 221 | + public function get_nearby_cities($state, $city, $radius, $sort = 'rating') { |
|
| 222 | + $request = $this->base_uri . '/cities/nearby/' . $state . '/' . $city . '?key=' . static::$api_key . '&radius=' . $radius . '&sort=' . $sort; |
|
| 223 | + $xml = simplexml_load_file($request); |
|
| 224 | + $json = wp_json_encode($xml); |
|
| 225 | + $results = json_decode($json, true); |
|
| 226 | 226 | return $results; |
| 227 | 227 | } |
| 228 | 228 | /** |
@@ -233,11 +233,11 @@ discard block |
||
| 233 | 233 | * @param mixed $city City. |
| 234 | 234 | * @return void |
| 235 | 235 | */ |
| 236 | - public function get_districts( $state, $city ) { |
|
| 237 | - $request = $this->base_uri . '/districts/' . $state . '/'. $city .'?key=' . static::$api_key; |
|
| 238 | - $xml = simplexml_load_file( $request ); |
|
| 239 | - $json = wp_json_encode( $xml ); |
|
| 240 | - $results = json_decode( $json, true ); |
|
| 236 | + public function get_districts($state, $city) { |
|
| 237 | + $request = $this->base_uri . '/districts/' . $state . '/' . $city . '?key=' . static::$api_key; |
|
| 238 | + $xml = simplexml_load_file($request); |
|
| 239 | + $json = wp_json_encode($xml); |
|
| 240 | + $results = json_decode($json, true); |
|
| 241 | 241 | return $results; |
| 242 | 242 | } |
| 243 | 243 | } |
@@ -1,6 +1,6 @@ |
||
| 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 | require_once('widgets/inman-news-widget.php'); |
@@ -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 | * Inman Feed Widget |
@@ -27,9 +27,9 @@ discard block |
||
| 27 | 27 | |
| 28 | 28 | parent::__construct( |
| 29 | 29 | 'inman_news_widget', |
| 30 | - __( 'Inman News', 're-pro' ), |
|
| 30 | + __('Inman News', 're-pro'), |
|
| 31 | 31 | array( |
| 32 | - 'description' => __( 'Display the lastest news from Inman.', 're-pro' ), |
|
| 32 | + 'description' => __('Display the lastest news from Inman.', 're-pro'), |
|
| 33 | 33 | 'classname' => 're-pro re-pro-widget inman-widget inman-news-widget', |
| 34 | 34 | 'customize_selective_refresh' => true, |
| 35 | 35 | ) |
@@ -44,34 +44,34 @@ discard block |
||
| 44 | 44 | * @param mixed $instance Instance. |
| 45 | 45 | * @return void |
| 46 | 46 | */ |
| 47 | - public function widget( $args, $instance ) { |
|
| 47 | + public function widget($args, $instance) { |
|
| 48 | 48 | |
| 49 | 49 | |
| 50 | - $title = ! empty( $instance['title'] ) ? $instance['title'] : ''; |
|
| 51 | - $display_total = ! empty( $instance['display_total'] ) ? $instance['display_total'] : '3'; |
|
| 50 | + $title = ! empty($instance['title']) ? $instance['title'] : ''; |
|
| 51 | + $display_total = ! empty($instance['display_total']) ? $instance['display_total'] : '3'; |
|
| 52 | 52 | |
| 53 | 53 | |
| 54 | 54 | echo $args['before_widget']; |
| 55 | 55 | |
| 56 | - echo $args['before_title'] . esc_attr( $title ) . $args['after_title']; |
|
| 56 | + echo $args['before_title'] . esc_attr($title) . $args['after_title']; |
|
| 57 | 57 | |
| 58 | 58 | |
| 59 | - $rss = fetch_feed( 'https://feeds.feedburner.com/inmannews' ); |
|
| 59 | + $rss = fetch_feed('https://feeds.feedburner.com/inmannews'); |
|
| 60 | 60 | |
| 61 | 61 | |
| 62 | 62 | |
| 63 | - if( ! is_wp_error( $rss ) ) { |
|
| 63 | + if ( ! is_wp_error($rss)) { |
|
| 64 | 64 | |
| 65 | - $max_items = $rss->get_item_quantity( $display_total ); |
|
| 66 | - $rss_items = $rss->get_items( 0, $display_total ); |
|
| 65 | + $max_items = $rss->get_item_quantity($display_total); |
|
| 66 | + $rss_items = $rss->get_items(0, $display_total); |
|
| 67 | 67 | |
| 68 | 68 | // echo $rss->get_title(); |
| 69 | 69 | // echo '<small>'. $rss->get_description() . '.</small>'; |
| 70 | 70 | |
| 71 | - foreach( $rss_items as $item ) { |
|
| 71 | + foreach ($rss_items as $item) { |
|
| 72 | 72 | |
| 73 | 73 | echo '<div style="margin:20px 0;">'; |
| 74 | - echo '<h4><a href="'. $item->get_link() .'" rel="nofollow" target="_blank">' . $item->get_title() . '</a></h4>'; |
|
| 74 | + echo '<h4><a href="' . $item->get_link() . '" rel="nofollow" target="_blank">' . $item->get_title() . '</a></h4>'; |
|
| 75 | 75 | echo '</div>'; |
| 76 | 76 | |
| 77 | 77 | echo $item->get_content(); |
@@ -92,22 +92,22 @@ discard block |
||
| 92 | 92 | * @param mixed $instance Instance. |
| 93 | 93 | * @return void |
| 94 | 94 | */ |
| 95 | - public function form( $instance ) { |
|
| 95 | + public function form($instance) { |
|
| 96 | 96 | |
| 97 | 97 | // Set default values. |
| 98 | - $instance = wp_parse_args( (array) $instance, array( |
|
| 98 | + $instance = wp_parse_args((array) $instance, array( |
|
| 99 | 99 | 'title' => '', |
| 100 | 100 | |
| 101 | 101 | )); |
| 102 | 102 | |
| 103 | 103 | // Retrieve an existing value from the database. |
| 104 | - $title = ! empty( $instance['title'] ) ? $instance['title'] : ''; |
|
| 105 | - $display_total = ! empty( $instance['display_total'] ) ? $instance['display_total'] : ''; |
|
| 104 | + $title = ! empty($instance['title']) ? $instance['title'] : ''; |
|
| 105 | + $display_total = ! empty($instance['display_total']) ? $instance['display_total'] : ''; |
|
| 106 | 106 | |
| 107 | 107 | // Title. |
| 108 | 108 | echo '<p>'; |
| 109 | - echo ' <label for="' . $this->get_field_id( 'title' ) . '" class="title-label">' . __( 'Tile:', 're-pro' ) . '</label>'; |
|
| 110 | - echo ' <input id="' . $this->get_field_id( 'title' ) . '" name="' . $this->get_field_name( 'title' ) . '" value="' . $title . '" class="widefat">'; |
|
| 109 | + echo ' <label for="' . $this->get_field_id('title') . '" class="title-label">' . __('Tile:', 're-pro') . '</label>'; |
|
| 110 | + echo ' <input id="' . $this->get_field_id('title') . '" name="' . $this->get_field_name('title') . '" value="' . $title . '" class="widefat">'; |
|
| 111 | 111 | echo '</p>'; |
| 112 | 112 | |
| 113 | 113 | // TODO: Add field to select display total count, 1 - 20. |
@@ -122,12 +122,12 @@ discard block |
||
| 122 | 122 | * @param mixed $old_instance Old Instance. |
| 123 | 123 | * @return $instance |
| 124 | 124 | */ |
| 125 | - public function update( $new_instance, $old_instance ) { |
|
| 125 | + public function update($new_instance, $old_instance) { |
|
| 126 | 126 | |
| 127 | 127 | $instance = $old_instance; |
| 128 | 128 | |
| 129 | - $instance['title'] = ! empty( $new_instance['title'] ) ? strip_tags( $new_instance['title'] ) : ''; |
|
| 130 | - $instance['display_total'] = ! empty( $new_instance['display_total'] ) ? strip_tags( $new_instance['display_total'] ) : ''; |
|
| 129 | + $instance['title'] = ! empty($new_instance['title']) ? strip_tags($new_instance['title']) : ''; |
|
| 130 | + $instance['display_total'] = ! empty($new_instance['display_total']) ? strip_tags($new_instance['display_total']) : ''; |
|
| 131 | 131 | |
| 132 | 132 | return $instance; |
| 133 | 133 | } |
@@ -141,6 +141,6 @@ discard block |
||
| 141 | 141 | */ |
| 142 | 142 | function repro_inman_news_widget() { |
| 143 | 143 | |
| 144 | - register_widget( 'InmanNewsWidget' ); |
|
| 144 | + register_widget('InmanNewsWidget'); |
|
| 145 | 145 | } |
| 146 | -add_action( 'widgets_init', 'repro_inman_news_widget' ); |
|
| 146 | +add_action('widgets_init', 'repro_inman_news_widget'); |
|
@@ -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 | * Trulia Feed Widget |
@@ -27,9 +27,9 @@ discard block |
||
| 27 | 27 | |
| 28 | 28 | parent::__construct( |
| 29 | 29 | 'trulia_rss_listing_widget', |
| 30 | - __( 'Trulia Listings RSS', 're-pro' ), |
|
| 30 | + __('Trulia Listings RSS', 're-pro'), |
|
| 31 | 31 | array( |
| 32 | - 'description' => __( 'Display listings from Trulia via a RSS Feed.', 're-pro' ), |
|
| 32 | + 'description' => __('Display listings from Trulia via a RSS Feed.', 're-pro'), |
|
| 33 | 33 | 'classname' => 're-pro re-pro-widget trulia-widget trulia-rss-listings-widget', |
| 34 | 34 | 'customize_selective_refresh' => true, |
| 35 | 35 | ) |
@@ -44,21 +44,21 @@ discard block |
||
| 44 | 44 | * @param mixed $instance Instance. |
| 45 | 45 | * @return void |
| 46 | 46 | */ |
| 47 | - public function widget( $args, $instance ) { |
|
| 47 | + public function widget($args, $instance) { |
|
| 48 | 48 | |
| 49 | - $iframe_id = ! empty( $args['widget_id'] ) ? $args['widget_id'] : ''; |
|
| 50 | - $title = ! empty( $instance['title'] ) ? $instance['title'] : ''; |
|
| 49 | + $iframe_id = ! empty($args['widget_id']) ? $args['widget_id'] : ''; |
|
| 50 | + $title = ! empty($instance['title']) ? $instance['title'] : ''; |
|
| 51 | 51 | |
| 52 | 52 | |
| 53 | 53 | echo $args['before_widget']; |
| 54 | 54 | |
| 55 | - echo $args['before_title'] . esc_attr( $title ) . $args['after_title']; |
|
| 55 | + echo $args['before_title'] . esc_attr($title) . $args['after_title']; |
|
| 56 | 56 | |
| 57 | 57 | |
| 58 | - $rss = fetch_feed( get_trulia_rss_listing_feed( 'for_sale', 'Sacramento', 'CA' ) ); |
|
| 58 | + $rss = fetch_feed(get_trulia_rss_listing_feed('for_sale', 'Sacramento', 'CA')); |
|
| 59 | 59 | |
| 60 | 60 | /* Sometimes the feed has errors so we must use SimplePie ForceFeed. */ |
| 61 | - add_action('wp_feed_options', 'trulia_force_feed' , 10, 1); |
|
| 61 | + add_action('wp_feed_options', 'trulia_force_feed', 10, 1); |
|
| 62 | 62 | function trulia_force_feed($rss) { |
| 63 | 63 | |
| 64 | 64 | $rss->force_feed(true); |
@@ -66,24 +66,24 @@ discard block |
||
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | // echo get_trulia_rss_listing_feed( 'for_sale', 'Sacramento', 'CA'); |
| 69 | - if( ! is_wp_error( $rss ) ) { |
|
| 69 | + if ( ! is_wp_error($rss)) { |
|
| 70 | 70 | |
| 71 | 71 | $max_items = $rss->get_item_quantity(3); |
| 72 | - $rss_items = $rss->get_items(0,3); |
|
| 72 | + $rss_items = $rss->get_items(0, 3); |
|
| 73 | 73 | |
| 74 | 74 | // echo $rss->get_title(); |
| 75 | 75 | // echo $rss->get_description(); |
| 76 | 76 | |
| 77 | - foreach( $rss_items as $item ) { |
|
| 77 | + foreach ($rss_items as $item) { |
|
| 78 | 78 | |
| 79 | 79 | echo '<div style="margin:20px 0;">'; |
| 80 | - echo '<h4><a href="'. $item->get_link() .'" rel="nofollow" target="_blank">' . $item->get_title() . '</a></h4>'; |
|
| 80 | + echo '<h4><a href="' . $item->get_link() . '" rel="nofollow" target="_blank">' . $item->get_title() . '</a></h4>'; |
|
| 81 | 81 | echo '</div>'; |
| 82 | 82 | |
| 83 | 83 | echo $item->get_content(); |
| 84 | 84 | |
| 85 | 85 | echo '<div style="margin:20px 0;text-align:right;">'; |
| 86 | - echo '<small> Updated on '.$item->get_date('F j, Y') . '.</small>'; |
|
| 86 | + echo '<small> Updated on ' . $item->get_date('F j, Y') . '.</small>'; |
|
| 87 | 87 | echo '</div>'; |
| 88 | 88 | } |
| 89 | 89 | |
@@ -101,22 +101,22 @@ discard block |
||
| 101 | 101 | * @param mixed $instance Instance. |
| 102 | 102 | * @return void |
| 103 | 103 | */ |
| 104 | - public function form( $instance ) { |
|
| 104 | + public function form($instance) { |
|
| 105 | 105 | |
| 106 | 106 | // Set default values. |
| 107 | - $instance = wp_parse_args( (array) $instance, array( |
|
| 107 | + $instance = wp_parse_args((array) $instance, array( |
|
| 108 | 108 | 'title' => '', |
| 109 | 109 | |
| 110 | 110 | )); |
| 111 | 111 | |
| 112 | 112 | // Retrieve an existing value from the database. |
| 113 | - $title = ! empty( $instance['title'] ) ? $instance['title'] : ''; |
|
| 113 | + $title = ! empty($instance['title']) ? $instance['title'] : ''; |
|
| 114 | 114 | |
| 115 | 115 | |
| 116 | 116 | // Title. |
| 117 | 117 | echo '<p>'; |
| 118 | - echo ' <label for="' . $this->get_field_id( 'title' ) . '" class="title-label">' . __( 'Tile:', 're-pro' ) . '</label>'; |
|
| 119 | - echo ' <input id="' . $this->get_field_id( 'title' ) . '" name="' . $this->get_field_name( 'title' ) . '" value="' . $title . '" class="widefat">'; |
|
| 118 | + echo ' <label for="' . $this->get_field_id('title') . '" class="title-label">' . __('Tile:', 're-pro') . '</label>'; |
|
| 119 | + echo ' <input id="' . $this->get_field_id('title') . '" name="' . $this->get_field_name('title') . '" value="' . $title . '" class="widefat">'; |
|
| 120 | 120 | echo '</p>'; |
| 121 | 121 | |
| 122 | 122 | |
@@ -130,11 +130,11 @@ discard block |
||
| 130 | 130 | * @param mixed $old_instance Old Instance. |
| 131 | 131 | * @return $instance |
| 132 | 132 | */ |
| 133 | - public function update( $new_instance, $old_instance ) { |
|
| 133 | + public function update($new_instance, $old_instance) { |
|
| 134 | 134 | |
| 135 | 135 | $instance = $old_instance; |
| 136 | 136 | |
| 137 | - $instance['title'] = ! empty( $new_instance['title'] ) ? strip_tags( $new_instance['title'] ) : ''; |
|
| 137 | + $instance['title'] = ! empty($new_instance['title']) ? strip_tags($new_instance['title']) : ''; |
|
| 138 | 138 | |
| 139 | 139 | return $instance; |
| 140 | 140 | } |
@@ -148,6 +148,6 @@ discard block |
||
| 148 | 148 | */ |
| 149 | 149 | function repro_trulia_rsslisting_widget() { |
| 150 | 150 | |
| 151 | - register_widget( 'TruliaRssListingWidget' ); |
|
| 151 | + register_widget('TruliaRssListingWidget'); |
|
| 152 | 152 | } |
| 153 | -add_action( 'widgets_init', 'repro_trulia_rsslisting_widget' ); |
|
| 153 | +add_action('widgets_init', 'repro_trulia_rsslisting_widget'); |
|
@@ -9,7 +9,7 @@ discard block |
||
| 9 | 9 | */ |
| 10 | 10 | |
| 11 | 11 | /* // Exit if accessed directly */ |
| 12 | -if ( ! defined( 'ABSPATH' ) ) { exit; } |
|
| 12 | +if ( ! defined('ABSPATH')) { exit; } |
|
| 13 | 13 | |
| 14 | 14 | /** |
| 15 | 15 | * The trulia_badges function. |
@@ -23,9 +23,9 @@ discard block |
||
| 23 | 23 | /* Style 1 */ |
| 24 | 24 | array( |
| 25 | 25 | 'id' => 'truila-btn-1-green', |
| 26 | - 'name' => __( 'Trulia Button - Green (96x40)', 're-pro' ), |
|
| 27 | - 'alt' => __( 'Trulia', 're-pro' ), |
|
| 28 | - 'title' => __( 'Trulia', 're-pro' ), |
|
| 26 | + 'name' => __('Trulia Button - Green (96x40)', 're-pro'), |
|
| 27 | + 'alt' => __('Trulia', 're-pro'), |
|
| 28 | + 'title' => __('Trulia', 're-pro'), |
|
| 29 | 29 | 'class' => 'trulia-badge', |
| 30 | 30 | 'url' => 'https://static.trulia-cdn.com/images/buttons/trulia_button_v01_green.gif', |
| 31 | 31 | 'width' => 96, |
@@ -33,9 +33,9 @@ discard block |
||
| 33 | 33 | ), |
| 34 | 34 | array( |
| 35 | 35 | 'id' => 'truila-btn-1-white', |
| 36 | - 'name' => __( 'Trulia Button - White (96x40)', 're-pro' ), |
|
| 37 | - 'alt' => __( 'Trulia', 're-pro' ), |
|
| 38 | - 'title' => __( 'Trulia', 're-pro' ), |
|
| 36 | + 'name' => __('Trulia Button - White (96x40)', 're-pro'), |
|
| 37 | + 'alt' => __('Trulia', 're-pro'), |
|
| 38 | + 'title' => __('Trulia', 're-pro'), |
|
| 39 | 39 | 'class' => 'trulia-badge', |
| 40 | 40 | 'url' => 'https://static.trulia-cdn.com/images/buttons/trulia_button_v01_white.gif', |
| 41 | 41 | 'width' => 96, |
@@ -43,9 +43,9 @@ discard block |
||
| 43 | 43 | ), |
| 44 | 44 | array( |
| 45 | 45 | 'id' => 'truila-btn-1-white-green', |
| 46 | - 'name' => __( 'Trulia Button - White/Green (96x40)', 're-pro' ), |
|
| 47 | - 'alt' => __( 'Trulia', 're-pro' ), |
|
| 48 | - 'title' => __( 'Trulia', 're-pro' ), |
|
| 46 | + 'name' => __('Trulia Button - White/Green (96x40)', 're-pro'), |
|
| 47 | + 'alt' => __('Trulia', 're-pro'), |
|
| 48 | + 'title' => __('Trulia', 're-pro'), |
|
| 49 | 49 | 'class' => 'trulia-badge', |
| 50 | 50 | 'url' => 'https://static.trulia-cdn.com/images/buttons/trulia_button_v01_white_green.gif', |
| 51 | 51 | 'width' => 96, |
@@ -54,9 +54,9 @@ discard block |
||
| 54 | 54 | /* Style 2 */ |
| 55 | 55 | array( |
| 56 | 56 | 'id' => 'truila-btn-2-green', |
| 57 | - 'name' => __( 'Trulia Button 2 - Green (87x33)', 're-pro' ), |
|
| 58 | - 'alt' => __( 'Trulia', 're-pro' ), |
|
| 59 | - 'title' => __( 'Trulia', 're-pro' ), |
|
| 57 | + 'name' => __('Trulia Button 2 - Green (87x33)', 're-pro'), |
|
| 58 | + 'alt' => __('Trulia', 're-pro'), |
|
| 59 | + 'title' => __('Trulia', 're-pro'), |
|
| 60 | 60 | 'class' => 'trulia-badge', |
| 61 | 61 | 'url' => 'https://static.trulia-cdn.com/images/buttons/trulia_button_v02_green.gif', |
| 62 | 62 | 'width' => 87, |
@@ -64,9 +64,9 @@ discard block |
||
| 64 | 64 | ), |
| 65 | 65 | array( |
| 66 | 66 | 'id' => 'truila-btn-2-white', |
| 67 | - 'name' => __( 'Trulia Button 2 - White (87x33)', 're-pro' ), |
|
| 68 | - 'alt' => __( 'Trulia', 're-pro' ), |
|
| 69 | - 'title' => __( 'Trulia', 're-pro' ), |
|
| 67 | + 'name' => __('Trulia Button 2 - White (87x33)', 're-pro'), |
|
| 68 | + 'alt' => __('Trulia', 're-pro'), |
|
| 69 | + 'title' => __('Trulia', 're-pro'), |
|
| 70 | 70 | 'class' => 'trulia-badge', |
| 71 | 71 | 'url' => 'https://static.trulia-cdn.com/images/buttons/trulia_button_v02_white.gif', |
| 72 | 72 | 'width' => 87, |
@@ -74,9 +74,9 @@ discard block |
||
| 74 | 74 | ), |
| 75 | 75 | array( |
| 76 | 76 | 'id' => 'truila-btn-2-white-green', |
| 77 | - 'name' => __( 'Trulia Button 2 - White/Green (87x33)', 're-pro' ), |
|
| 78 | - 'alt' => __( 'Trulia', 're-pro' ), |
|
| 79 | - 'title' => __( 'Trulia', 're-pro' ), |
|
| 77 | + 'name' => __('Trulia Button 2 - White/Green (87x33)', 're-pro'), |
|
| 78 | + 'alt' => __('Trulia', 're-pro'), |
|
| 79 | + 'title' => __('Trulia', 're-pro'), |
|
| 80 | 80 | 'class' => 'trulia-badge', |
| 81 | 81 | 'url' => 'https://static.trulia-cdn.com/images/buttons/trulia_button_v02_white_green.gif', |
| 82 | 82 | 'width' => 87, |
@@ -85,9 +85,9 @@ discard block |
||
| 85 | 85 | /* Style 3 */ |
| 86 | 86 | array( |
| 87 | 87 | 'id' => 'truila-btn-3-green', |
| 88 | - 'name' => __( 'Trulia Button 3 - Green (120x54)', 're-pro' ), |
|
| 89 | - 'alt' => __( 'Trulia', 're-pro' ), |
|
| 90 | - 'title' => __( 'Trulia', 're-pro' ), |
|
| 88 | + 'name' => __('Trulia Button 3 - Green (120x54)', 're-pro'), |
|
| 89 | + 'alt' => __('Trulia', 're-pro'), |
|
| 90 | + 'title' => __('Trulia', 're-pro'), |
|
| 91 | 91 | 'class' => 'trulia-badge', |
| 92 | 92 | 'url' => 'https://static.trulia-cdn.com/images/buttons/trulia_button_v03_green.gif', |
| 93 | 93 | 'width' => 120, |
@@ -95,9 +95,9 @@ discard block |
||
| 95 | 95 | ), |
| 96 | 96 | array( |
| 97 | 97 | 'id' => 'truila-btn-3-white', |
| 98 | - 'name' => __( 'Trulia Button 3 - White (120x54)', 're-pro' ), |
|
| 99 | - 'alt' => __( 'Trulia', 're-pro' ), |
|
| 100 | - 'title' => __( 'Trulia', 're-pro' ), |
|
| 98 | + 'name' => __('Trulia Button 3 - White (120x54)', 're-pro'), |
|
| 99 | + 'alt' => __('Trulia', 're-pro'), |
|
| 100 | + 'title' => __('Trulia', 're-pro'), |
|
| 101 | 101 | 'class' => 'trulia-badge', |
| 102 | 102 | 'url' => 'https://static.trulia-cdn.com/images/buttons/trulia_button_v03_white.gif', |
| 103 | 103 | 'width' => 120, |
@@ -105,9 +105,9 @@ discard block |
||
| 105 | 105 | ), |
| 106 | 106 | array( |
| 107 | 107 | 'id' => 'truila-btn-3-white-green', |
| 108 | - 'name' => __( 'Trulia Button 3 - White/Green (120x54)', 're-pro' ), |
|
| 109 | - 'alt' => __( 'Trulia', 're-pro' ), |
|
| 110 | - 'title' => __( 'Trulia', 're-pro' ), |
|
| 108 | + 'name' => __('Trulia Button 3 - White/Green (120x54)', 're-pro'), |
|
| 109 | + 'alt' => __('Trulia', 're-pro'), |
|
| 110 | + 'title' => __('Trulia', 're-pro'), |
|
| 111 | 111 | 'class' => 'trulia-badge', |
| 112 | 112 | 'url' => 'https://static.trulia-cdn.com/images/buttons/trulia_button_v03_white_green.gif', |
| 113 | 113 | 'width' => 120, |
@@ -20,9 +20,9 @@ discard block |
||
| 20 | 20 | |
| 21 | 21 | parent::__construct( |
| 22 | 22 | 'realtor_logo', |
| 23 | - __( 'Realtor Logo', 're-pro' ), |
|
| 23 | + __('Realtor Logo', 're-pro'), |
|
| 24 | 24 | array( |
| 25 | - 'description' => __( 'Display the Realtor Logo.', 're-pro' ), |
|
| 25 | + 'description' => __('Display the Realtor Logo.', 're-pro'), |
|
| 26 | 26 | 'classname' => 're-pro realtor', |
| 27 | 27 | ) |
| 28 | 28 | ); |
@@ -38,9 +38,9 @@ discard block |
||
| 38 | 38 | * @param mixed $instance |
| 39 | 39 | * @return void |
| 40 | 40 | */ |
| 41 | - public function widget( $args, $instance ) { |
|
| 41 | + public function widget($args, $instance) { |
|
| 42 | 42 | |
| 43 | - if ( ! empty( $instance['title'] ) ) { |
|
| 43 | + if ( ! empty($instance['title'])) { |
|
| 44 | 44 | $title = $instance['title']; |
| 45 | 45 | } else { |
| 46 | 46 | $title = ''; |
@@ -49,9 +49,9 @@ discard block |
||
| 49 | 49 | |
| 50 | 50 | echo $args['before_widget']; |
| 51 | 51 | |
| 52 | - echo $args['before_title'] . esc_attr( $title ) . $args['after_title']; |
|
| 52 | + echo $args['before_title'] . esc_attr($title) . $args['after_title']; |
|
| 53 | 53 | |
| 54 | - echo '<img src="'. esc_url( plugins_url( '../../assets/images/realtor/realtor.svg', __FILE__ ) ) .'" alt="'. __( 'Realtor', 're-pro' ) .'" height="' . $logo_size . '" width="' . $logo_size . '" class="re-pro realtor">'; |
|
| 54 | + echo '<img src="' . esc_url(plugins_url('../../assets/images/realtor/realtor.svg', __FILE__)) . '" alt="' . __('Realtor', 're-pro') . '" height="' . $logo_size . '" width="' . $logo_size . '" class="re-pro realtor">'; |
|
| 55 | 55 | |
| 56 | 56 | echo $args['after_widget']; |
| 57 | 57 | |
@@ -65,38 +65,38 @@ discard block |
||
| 65 | 65 | * @param mixed $instance |
| 66 | 66 | * @return void |
| 67 | 67 | */ |
| 68 | - public function form( $instance ) { |
|
| 68 | + public function form($instance) { |
|
| 69 | 69 | |
| 70 | 70 | // Set default values |
| 71 | - $instance = wp_parse_args( (array) $instance, array( |
|
| 71 | + $instance = wp_parse_args((array) $instance, array( |
|
| 72 | 72 | 'logo-size' => '32', |
| 73 | 73 | 'title' => '', |
| 74 | - ) ); |
|
| 74 | + )); |
|
| 75 | 75 | |
| 76 | 76 | // Retrieve an existing value from the database |
| 77 | - $title = ! empty( $instance['title'] ) ? $instance['title'] : ''; |
|
| 78 | - $logo_size = ! empty( $instance['logo_size'] ) ? $instance['logo_size'] : ''; |
|
| 77 | + $title = ! empty($instance['title']) ? $instance['title'] : ''; |
|
| 78 | + $logo_size = ! empty($instance['logo_size']) ? $instance['logo_size'] : ''; |
|
| 79 | 79 | |
| 80 | 80 | // Form fields |
| 81 | 81 | echo '<p>'; |
| 82 | - echo ' <label for="' . $this->get_field_id( 'title' ) . '" class="title-label">' . __( 'Tile', 're-pro' ) . '</label>'; |
|
| 83 | - echo ' <input id="' . $this->get_field_id( 'title' ) . '" name="' . $this->get_field_name( 'title' ) . '" value="' . $title . '" class="widefat">'; |
|
| 82 | + echo ' <label for="' . $this->get_field_id('title') . '" class="title-label">' . __('Tile', 're-pro') . '</label>'; |
|
| 83 | + echo ' <input id="' . $this->get_field_id('title') . '" name="' . $this->get_field_name('title') . '" value="' . $title . '" class="widefat">'; |
|
| 84 | 84 | echo '</p>'; |
| 85 | 85 | |
| 86 | 86 | echo '<p>'; |
| 87 | - echo ' <label for="' . $this->get_field_id( 'logo_size' ) . '" class="logo-size-label">' . __( 'Logo Size', 're-pro' ) . '</label>'; |
|
| 88 | - echo ' <select id="' . $this->get_field_id( 'logo_size' ) . '" name="' . $this->get_field_name( 'logo_size' ) . '" class="widefat">'; |
|
| 89 | - echo ' <option value="" ' . selected( $logo_size, '', false ) . '> ' . __( 'Choose', 're-pro' ) . '</option>'; |
|
| 90 | - echo ' <option value="512" ' . selected( $logo_size, '512', false ) . '> ' . __( '512px', 're-pro' ) . '</option>'; |
|
| 91 | - echo ' <option value="256" ' . selected( $logo_size, '256', false ) . '> ' . __( '256px', 're-pro' ) . '</option>'; |
|
| 92 | - echo ' <option value="128" ' . selected( $logo_size, '128', false ) . '> ' . __( '128px', 're-pro' ) . '</option>'; |
|
| 93 | - echo ' <option value="64" ' . selected( $logo_size, '64', false ) . '> ' . __( '64px', 're-pro' ) . '</option>'; |
|
| 94 | - echo ' <option value="32" ' . selected( $logo_size, '32', false ) . '> ' . __( '32px', 're-pro' ) . '</option>'; |
|
| 95 | - echo ' <option value="24" ' . selected( $logo_size, '24', false ) . '> ' . __( '24px', 're-pro' ) . '</option>'; |
|
| 96 | - echo ' <option value="16" ' . selected( $logo_size, '16', false ) . '> ' . __( '16px', 're-pro' ) . '</option>'; |
|
| 97 | - echo ' <option value="14" ' . selected( $logo_size, '14', false ) . '> ' . __( '14px', 're-pro' ) . '</option>'; |
|
| 87 | + echo ' <label for="' . $this->get_field_id('logo_size') . '" class="logo-size-label">' . __('Logo Size', 're-pro') . '</label>'; |
|
| 88 | + echo ' <select id="' . $this->get_field_id('logo_size') . '" name="' . $this->get_field_name('logo_size') . '" class="widefat">'; |
|
| 89 | + echo ' <option value="" ' . selected($logo_size, '', false) . '> ' . __('Choose', 're-pro') . '</option>'; |
|
| 90 | + echo ' <option value="512" ' . selected($logo_size, '512', false) . '> ' . __('512px', 're-pro') . '</option>'; |
|
| 91 | + echo ' <option value="256" ' . selected($logo_size, '256', false) . '> ' . __('256px', 're-pro') . '</option>'; |
|
| 92 | + echo ' <option value="128" ' . selected($logo_size, '128', false) . '> ' . __('128px', 're-pro') . '</option>'; |
|
| 93 | + echo ' <option value="64" ' . selected($logo_size, '64', false) . '> ' . __('64px', 're-pro') . '</option>'; |
|
| 94 | + echo ' <option value="32" ' . selected($logo_size, '32', false) . '> ' . __('32px', 're-pro') . '</option>'; |
|
| 95 | + echo ' <option value="24" ' . selected($logo_size, '24', false) . '> ' . __('24px', 're-pro') . '</option>'; |
|
| 96 | + echo ' <option value="16" ' . selected($logo_size, '16', false) . '> ' . __('16px', 're-pro') . '</option>'; |
|
| 97 | + echo ' <option value="14" ' . selected($logo_size, '14', false) . '> ' . __('14px', 're-pro') . '</option>'; |
|
| 98 | 98 | echo ' </select>'; |
| 99 | - echo ' <span class="description">' . __( 'Choose the size of the logo you want to display.', 're-pro' ) . '</span>'; |
|
| 99 | + echo ' <span class="description">' . __('Choose the size of the logo you want to display.', 're-pro') . '</span>'; |
|
| 100 | 100 | echo '</p>'; |
| 101 | 101 | |
| 102 | 102 | } |
@@ -110,12 +110,12 @@ discard block |
||
| 110 | 110 | * @param mixed $old_instance |
| 111 | 111 | * @return void |
| 112 | 112 | */ |
| 113 | - public function update( $new_instance, $old_instance ) { |
|
| 113 | + public function update($new_instance, $old_instance) { |
|
| 114 | 114 | |
| 115 | 115 | $instance = $old_instance; |
| 116 | 116 | |
| 117 | - $instance['title'] = ! empty( $new_instance['title'] ) ? strip_tags( $new_instance['title'] ) : ''; |
|
| 118 | - $instance['logo_size'] = ! empty( $new_instance['logo_size'] ) ? strip_tags( $new_instance['logo_size'] ) : ''; |
|
| 117 | + $instance['title'] = ! empty($new_instance['title']) ? strip_tags($new_instance['title']) : ''; |
|
| 118 | + $instance['logo_size'] = ! empty($new_instance['logo_size']) ? strip_tags($new_instance['logo_size']) : ''; |
|
| 119 | 119 | |
| 120 | 120 | return $instance; |
| 121 | 121 | |
@@ -130,6 +130,6 @@ discard block |
||
| 130 | 130 | * @return void |
| 131 | 131 | */ |
| 132 | 132 | function repro_register_realtorlogo_widget() { |
| 133 | - register_widget( 'RealtorLogoWidget' ); |
|
| 133 | + register_widget('RealtorLogoWidget'); |
|
| 134 | 134 | } |
| 135 | -add_action( 'widgets_init', 'repro_register_realtorlogo_widget' ); |
|
| 135 | +add_action('widgets_init', 'repro_register_realtorlogo_widget'); |
|
@@ -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 | /** |
@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | */ |
| 14 | 14 | function get_zillow_mandatory_disclaimer() { |
| 15 | 15 | echo '<p class="zillow-disclaimer">'; |
| 16 | - echo '<span>' . __( '© Zillow, Inc., 2006-', 're-pro') . date("Y") .'. Use is subject to <a href="https://www.zillow.com/corp/Terms.htm" title="'. __( 'Terms of Use', 're-pro') .'" target="_blank" rel="nofollow">'. __( 'Terms of Use', 're-pro') .'</a>.</span><br /> |
|
| 17 | -<span><a href="https://www.zillow.com/wikipages/What-is-a-Zestimate/" title="'. __( 'What\'s a Zestimate?', 're-pro') .'" target="_blank" rel="nofollow">'. __( 'What\'s a Zestimate?', 're-pro') .'</a></span>'; |
|
| 16 | + echo '<span>' . __('© Zillow, Inc., 2006-', 're-pro') . date("Y") . '. Use is subject to <a href="https://www.zillow.com/corp/Terms.htm" title="' . __('Terms of Use', 're-pro') . '" target="_blank" rel="nofollow">' . __('Terms of Use', 're-pro') . '</a>.</span><br /> |
|
| 17 | +<span><a href="https://www.zillow.com/wikipages/What-is-a-Zestimate/" title="'. __('What\'s a Zestimate?', 're-pro') . '" target="_blank" rel="nofollow">' . __('What\'s a Zestimate?', 're-pro') . '</a></span>'; |
|
| 18 | 18 | echo '</p>'; |
| 19 | 19 | } |