Changeset 2154475
- Timestamp:
- 09/10/2019 09:40:04 PM (7 years ago)
- Location:
- wp-soundsystem/trunk
- Files:
-
- 5 edited
-
classes/wpsstm-post-tracklist-class.php (modified) (5 diffs)
-
readme.txt (modified) (1 diff)
-
templates/frontend-importer-bangs.php (modified) (1 diff)
-
wp-soundsystem.php (modified) (2 diffs)
-
wpsstm-core-api.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wp-soundsystem/trunk/classes/wpsstm-post-tracklist-class.php
r2154350 r2154475 707 707 return $error; 708 708 } 709 709 710 710 /* 711 711 redirect URL … … 748 748 API 749 749 */ 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(); 756 756 757 757 if($error_code == 'rest_forbidden'){ … … 763 763 764 764 }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 771 765 $this->add_notice('wpsstm-api-error',$error_message ); 772 766 } 773 767 774 return $success; 775 776 }else{ 777 778 //Populate import ID (success) 779 $this->import_id = $success; 768 return $xspf; 780 769 781 770 } 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 } 813 773 814 774 /* … … 818 778 $json = json_encode($xspf); 819 779 $xspf = json_decode($json,TRUE); 820 821 $this->tracklist_log("...succeeded loading XSPF"); 780 $this->import_id = wpsstm_get_array_value('identifier',$xspf); 822 781 823 782 /* … … 933 892 934 893 $playlist = $this->import_xspf(); 894 if ( is_wp_error($playlist) ) return $playlist; 935 895 936 896 //update import ID if any (even if we received an error, we should have the import ID populated) 937 897 if ($this->import_id){ 938 $this->tracklist_log($this-> import_id,"storing import ID...");898 $this->tracklist_log($this->get_debug_url(),"import succeeded"); 939 899 update_post_meta( $this->post_id, self::$import_id_meta_name, $this->import_id ); 940 900 } 941 942 if ( is_wp_error($playlist) ) return $playlist;943 901 944 902 $updated = $this->update_radio_data($playlist); -
wp-soundsystem/trunk/readme.txt
r2154350 r2154475 128 128 129 129 == Changelog == 130 131 = 3.1.1 = 132 * faster REST import 130 133 131 134 = 3.1.0 = -
wp-soundsystem/trunk/templates/frontend-importer-bangs.php
r2154350 r2154475 7 7 foreach($api_items as $api_item){ 8 8 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']); 10 10 } 11 11 } -
wp-soundsystem/trunk/wp-soundsystem.php
r2154350 r2154475 6 6 Author: G.Breant 7 7 Author URI: https://profiles.wordpress.org/grosbouff/#content-plugins 8 Version: 3.1. 08 Version: 3.1.1 9 9 License: GPL2 10 10 */ … … 37 37 * @public string plugin version 38 38 */ 39 public $version = '3.1. 0';39 public $version = '3.1.1'; 40 40 /** 41 41 * @public string plugin DB version -
wp-soundsystem/trunk/wpsstm-core-api.php
r2153599 r2154475 1 1 <?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/'); 2 define('WPSSTM_API_URL','https://api.spiff-radio.org/'); 3 define('WPSSTM_API_REST',WPSSTM_API_URL . 'wp-json/'); 4 define('WPSSTM_API_CACHE',WPSSTM_API_URL . 'wordpress/wp-content/uploads/wpsstmapi/'); 5 4 6 define('WPSSTM_API_NAMESPACE','wpsstmapi/v1'); 5 7 define('WPSSTM_API_REGISTER_URL','https://api.spiff-radio.org/?p=10'); … … 25 27 if ( false === ( $valid = get_transient(self::$valid_token_transient_name ) ) ) { 26 28 27 $url = WPSSTM_API_ URL. 'simple-jwt-authentication/v1/token/validate';29 $url = WPSSTM_API_REST . 'simple-jwt-authentication/v1/token/validate'; 28 30 29 31 //build headers … … 125 127 } 126 128 127 $rest_url = WPSSTM_API_ URL. WPSSTM_API_NAMESPACE . '/' .$endpoint;129 $rest_url = WPSSTM_API_REST . WPSSTM_API_NAMESPACE . '/' .$endpoint; 128 130 129 131 //parameters
Note: See TracChangeset
for help on using the changeset viewer.