Plugin Directory

Changeset 2154475


Ignore:
Timestamp:
09/10/2019 09:40:04 PM (7 years ago)
Author:
grosbouff
Message:

3.1.1

Location:
wp-soundsystem/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • wp-soundsystem/trunk/classes/wpsstm-post-tracklist-class.php

    r2154350 r2154475  
    707707                return $error;
    708708        }
    709        
     709
    710710        /*
    711711        redirect URL
     
    748748            API
    749749            */
    750             $success = WPSSTM_Core_API::api_request('import',$params);
    751 
    752             if ( is_wp_error($success) ){
    753 
    754                 $error_code = $success->get_error_code();
    755                 $error_message = $success->get_error_message();
     750            $xspf = WPSSTM_Core_API::api_request('import',$params);
     751
     752            if ( is_wp_error($xspf) ){
     753
     754                $error_code = $xspf->get_error_code();
     755                $error_message = $xspf->get_error_message();
    756756
    757757                if($error_code == 'rest_forbidden'){
     
    763763
    764764                }else{
    765 
    766                     //Populate import ID (error)
    767                     if ( $import_id = $success->get_error_data('import_error') ){
    768                         $this->import_id = $import_id;
    769                     }
    770 
    771765                    $this->add_notice('wpsstm-api-error',$error_message  );
    772766                }
    773767
    774                 return $success;
    775                
    776             }else{
    777                
    778                 //Populate import ID (success)
    779                 $this->import_id = $success;
     768                return $xspf;
    780769               
    781770            }
    782            
    783             if (!$success){
    784                 $error_msg = __('Missing import ID','wpsstm');
    785                 $this->tracklist_log($error_msg);
    786                 return new WP_Error( 'missing_import_id',$error_msg );
    787             }
    788 
    789            
    790            
    791 
    792             /*
    793             get XSPF
    794             */
    795             $xspf_url = WPSSTM_API_CACHE . sprintf('%s.xspf',$this->import_id);
    796             $response = wp_remote_get( $xspf_url );
    797             $response_code = wp_remote_retrieve_response_code($response);
    798            
    799             if( $response_code > 400){
    800                 $response_msg = wp_remote_retrieve_response_message($response);
    801                 $error_msg = sprintf('[%s] %s',$response_code,$response_msg);
    802                 $error_msg = sprintf( __('Unable to load XSPF file: %s','wpsstm'),$error_msg );
    803                
    804                 $this->tracklist_log($xspf_url,$error_msg);
    805                
    806                 return new WP_Error( 'missing_api_xspf',$error_msg, $xspf_url );
    807             }
    808            
    809             $xspf = wp_remote_retrieve_body( $response );
    810         }
    811 
    812         if ( is_wp_error($xspf) ) return $xspf;
     771
     772        }
    813773
    814774        /*
     
    818778        $json = json_encode($xspf);
    819779        $xspf = json_decode($json,TRUE);
    820 
    821         $this->tracklist_log("...succeeded loading XSPF");
     780        $this->import_id = wpsstm_get_array_value('identifier',$xspf);
    822781
    823782        /*
     
    933892       
    934893        $playlist = $this->import_xspf();
     894        if ( is_wp_error($playlist) ) return $playlist;
    935895       
    936896        //update import ID if any (even if we received an error, we should have the import ID populated)
    937897        if ($this->import_id){
    938             $this->tracklist_log($this->import_id,"storing import ID...");
     898            $this->tracklist_log($this->get_debug_url(),"import succeeded");
    939899            update_post_meta( $this->post_id, self::$import_id_meta_name, $this->import_id );
    940900        }
    941 
    942         if ( is_wp_error($playlist) ) return $playlist;
    943901
    944902        $updated = $this->update_radio_data($playlist);
  • wp-soundsystem/trunk/readme.txt

    r2154350 r2154475  
    128128
    129129== Changelog ==
     130
     131= 3.1.1 =
     132* faster REST import
    130133
    131134= 3.1.0 =
  • wp-soundsystem/trunk/templates/frontend-importer-bangs.php

    r2154350 r2154475  
    77    foreach($api_items as $api_item){
    88
    9         $items[] = sprintf('<strong>%s</strong> <code>%s</code>',$api_item['name'],$api_item['code']);
     9        $items[] = sprintf('<code>%s</code> <span>%s</span>',$api_item['code'],$api_item['name']);
    1010    }
    1111}
  • wp-soundsystem/trunk/wp-soundsystem.php

    r2154350 r2154475  
    66Author: G.Breant
    77Author URI: https://profiles.wordpress.org/grosbouff/#content-plugins
    8 Version: 3.1.0
     8Version: 3.1.1
    99License: GPL2
    1010*/
     
    3737    * @public string plugin version
    3838    */
    39     public $version = '3.1.0';
     39    public $version = '3.1.1';
    4040    /**
    4141    * @public string plugin DB version
  • wp-soundsystem/trunk/wpsstm-core-api.php

    r2153599 r2154475  
    11<?php
    2 define('WPSSTM_API_URL','https://api.spiff-radio.org/wp-json/');
    3 define('WPSSTM_API_CACHE','https://api.spiff-radio.org/wordpress/wp-content/uploads/wpsstmapi/');
     2define('WPSSTM_API_URL','https://api.spiff-radio.org/');
     3define('WPSSTM_API_REST',WPSSTM_API_URL . 'wp-json/');
     4define('WPSSTM_API_CACHE',WPSSTM_API_URL . 'wordpress/wp-content/uploads/wpsstmapi/');
     5
    46define('WPSSTM_API_NAMESPACE','wpsstmapi/v1');
    57define('WPSSTM_API_REGISTER_URL','https://api.spiff-radio.org/?p=10');
     
    2527        if ( false === ( $valid = get_transient(self::$valid_token_transient_name ) ) ) {
    2628
    27             $url = WPSSTM_API_URL . 'simple-jwt-authentication/v1/token/validate';
     29            $url = WPSSTM_API_REST . 'simple-jwt-authentication/v1/token/validate';
    2830           
    2931            //build headers
     
    125127        }
    126128       
    127         $rest_url = WPSSTM_API_URL . WPSSTM_API_NAMESPACE . '/' .$endpoint;
     129        $rest_url = WPSSTM_API_REST . WPSSTM_API_NAMESPACE . '/' .$endpoint;
    128130
    129131        //parameters
Note: See TracChangeset for help on using the changeset viewer.