Changeset 1850196
- Timestamp:
- 03/30/2018 05:37:47 PM (7 years ago)
- Location:
- usgs-stream-flow-data
- Files:
-
- 31 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
usgs-stream-flow-data/trunk/README.txt
r1848795 r1850196 5 5 Requires at least: 3.7 6 6 Tested up to: 4.9.4 7 Stable tag: 2.6. 17 Stable tag: 2.6.2 8 8 License: GPLv2 or later 9 9 License URI: //www.gnu.org/licenses/gpl-2.0.html -
usgs-stream-flow-data/trunk/kwcusgs.php
r1848795 r1850196 13 13 * Plugin URI: //wordpress.org/plugins/usgs-stream-flow-data/ 14 14 * Description: USGS Stream Flow Data 15 * Version: 2.6. 115 * Version: 2.6.2 16 16 * Author: Chris Kindred 17 17 * Author URI: //www.kindredwebconsulting.com -
usgs-stream-flow-data/trunk/public/class-kwc-usgs.php
r1848669 r1850196 17 17 * @var string 18 18 */ 19 const VERSION = '2. 5.1';19 const VERSION = '2.6.2'; 20 20 21 21 /** … … 292 292 ), $atts ) ); 293 293 294 $thePage = get_transient( 'kwc_usgs-' . $location . $graph . $title );294 //$thePage = get_transient( 'kwc_usgs-' . $location . $graph . $title ); 295 295 296 296 if ( !$thePage ) { 297 $url = "https://waterservices.usgs.gov/nwis/iv?site=$location¶meterCd=00010,00060,00065&format=waterml"; 298 299 $response = wp_remote_get( $url ); 300 $data = wp_remote_retrieve_body( $response ); 301 302 if ( ! $data ) { 303 return 'USGS Not Responding.'; 304 } 305 306 $data = str_replace( 'ns1:', '', $data ); 297 $response = $this->get_usgs( $location ); 298 299 if( is_wp_error( $response ) ) { 300 return get_error_message( $response ); 301 } 302 303 if ( ! $response['response_code'] ) { 304 return $response['response_message']; 305 } 306 307 $data = str_replace( 'ns1:', '', $response['data'] ); 307 308 308 309 $xml_tree = simplexml_load_string( $data ); … … 374 375 $thePage .= "</div>"; 375 376 376 set_transient( 'kwc_usgs-' . $location . $graph . $title, $thePage, 60 * 15 );377 // set_transient( 'kwc_usgs-' . $location . $graph . $title, $thePage, 60 * 15 ); 377 378 } 378 379 return $thePage; 379 380 } 380 381 382 /** 383 * Makes USGS Call 384 * 385 * @param string $location 386 * @return mixed|array|WP_Error 387 */ 388 public function get_usgs( $location ) { 389 $url = "https://waterservices.usgs.gov/nwis/iv?site=$location¶meterCd=00010,00060,00065&format=waterml"; 390 $response = wp_remote_get( $url ); 391 if ( is_wp_error( $response ) ) { 392 return $response; 393 } 394 return array( 395 'response_code' => wp_remote_retrieve_response_code( $response ), 396 'response_message' => wp_remote_retrieve_response_message( $response ), 397 'data' => wp_remote_retrieve_body( $response ), 398 ); 399 } 400 381 401 }
Note: See TracChangeset
for help on using the changeset viewer.