@@ -204,7 +204,8 @@ public function getJsonData() {
204204
205205 $ chart_id = $ params ['chart ' ];
206206
207- if ( empty ( $ chart_id ) ) {
207+ $ chart = $ chart_id ? get_post ( $ chart_id ) : null ;
208+ if ( ! $ chart || Visualizer_Plugin::CPT_VISUALIZER !== $ chart ->post_type || ! current_user_can ( 'edit_post ' , $ chart_id ) ) {
208209 wp_die ();
209210 }
210211
@@ -1037,7 +1038,7 @@ public function renderFlattrScript() {
10371038 * Used as a fallback when the URL path has no recognisable file extension
10381039 * (e.g. SharePoint, signed S3 URLs, or "download?id=…" endpoints).
10391040 *
1040- * Uses wp_safe_remote_get() to block requests to private/loopback addresses ,
1041+ * Uses the shared remote-fetch policy to block non-public destinations ,
10411042 * and streams the response to a temp file so no body data is held in memory
10421043 * regardless of whether the server honours the Range header.
10431044 *
@@ -1056,14 +1057,15 @@ private static function _url_is_xlsx( $url ) {
10561057 return false ;
10571058 }
10581059
1059- $ response = wp_safe_remote_get (
1060+ $ response = Visualizer_Remote_Fetch:: request (
10601061 $ url ,
10611062 array (
1062- 'timeout ' => 10 ,
1063- 'user-agent ' => 'WordPress/ ' . get_bloginfo ( 'version ' ),
1064- 'headers ' => array ( 'Range ' => 'bytes=0-3 ' ),
1065- 'stream ' => true ,
1066- 'filename ' => $ tmpfile ,
1063+ 'timeout ' => 10 ,
1064+ 'user-agent ' => 'WordPress/ ' . get_bloginfo ( 'version ' ),
1065+ 'headers ' => array ( 'Range ' => 'bytes=0-3 ' ),
1066+ 'stream ' => true ,
1067+ 'filename ' => $ tmpfile ,
1068+ 'limit_response_size ' => 4 ,
10671069 )
10681070 );
10691071
0 commit comments