Plugin Directory

Changeset 698523


Ignore:
Timestamp:
04/16/2013 01:37:56 PM (13 years ago)
Author:
tkrivickas
Message:

APIs are now queried using WP HTTP API. Fixed channel count not updating when channel name in URL is mixed case.

Location:
live-stream-badger/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • live-stream-badger/trunk/class-query-twitch.php

    r697408 r698523  
    3737     */
    3838    function get_results() {
    39         error_log("Executing Twitch query: " . $this->query_string);
    40         $json_content = file_get_contents($this->query_string);
    41         $j = json_decode($json_content, TRUE);
     39        $response = wp_remote_retrieve_body( wp_remote_get( $this->query_string ) );
     40        if ( empty( $response ) )
     41            return NULL;
     42
     43        $j = json_decode($response, TRUE);
    4244        return $j;
    4345    }
  • live-stream-badger/trunk/class-stream-dto.php

    r698511 r698523  
    5959        $sb = new Stream_DTO();
    6060        $sb -> url = $stream_url;
    61         $sb -> channel_name = esc_attr($channel_name);
     61
     62        // Channel name should be always lowercase
     63        $sb -> channel_name = strtolower(esc_attr($channel_name));
    6264        return $sb;
    6365    }
  • live-stream-badger/trunk/stream-status-updater.php

    r697408 r698523  
    6565    $j_results = array( );
    6666    $json = $query->get_results( );
     67    if ( empty( $json ) )
     68        return;
     69
    6770    foreach ( $json as $j ) {
    6871        $j_live_user_split = explode( 'live_user_', $j['name'] );
     
    7275            continue;
    7376
     77        // Store results with channel key lower cased
     78        $j_channel_name = strtolower($j_channel_name);
    7479        $j_results[$j_channel_name] = $j;
    7580    }
Note: See TracChangeset for help on using the changeset viewer.