@@ -822,10 +822,10 @@ function ( $url ) {
822822 * @since 3.1.7
823823 * @access private
824824 *
825- * @param string $feed_url The feed URL.
826- * @param string $cache The cache string (eg. 1_hour, 30_min etc.).
827- * @param array $sc The shortcode attributes.
828- * @param bool $allow_https Defaults to constant FEEDZY_ALLOW_HTTPS.
825+ * @param string|array<string> $feed_url The feed URL.
826+ * @param string $cache The cache string (eg. 1_hour, 30_min etc.).
827+ * @param array $sc The shortcode attributes.
828+ * @param bool $allow_https Defaults to constant FEEDZY_ALLOW_HTTPS.
829829 *
830830 * @return SimplePie
831831 */
@@ -860,7 +860,7 @@ private function init_feed( $feed_url, $cache, $sc, $allow_https = FEEDZY_ALLOW_
860860
861861 $ feed ->get_registry ()->register ( SimplePie \File::class, 'WP_SimplePie_File ' , true );
862862 $ default_agent = $ this ->get_default_user_agent ( $ feed_url );
863- $ feed ->set_useragent ( apply_filters ( 'http_headers_useragent ' , $ default_agent ) );
863+ $ feed ->set_useragent ( apply_filters ( 'http_headers_useragent ' , $ default_agent, is_array ( $ feed_url ) ? reset ( $ feed_url ) : $ feed_url ) );
864864 if ( false === apply_filters ( 'feedzy_disable_db_cache ' , false , $ feed_url ) ) {
865865 SimplePie_Cache::register ( 'wp_transient ' , 'WP_Feed_Cache_Transient ' );
866866 $ feed ->set_cache_location ( 'wp_transient ' );
@@ -917,7 +917,7 @@ function ( $time ) use ( $cache_time ) {
917917 if ( isset ( $ _SERVER ['HTTP_USER_AGENT ' ] ) ) {
918918 // phpcs:ignore WordPressVIPMinimum.Variables.RestrictedVariables.cache_constraints___SERVER__HTTP_USER_AGENT__
919919 $ set_server_agent = sanitize_text_field ( wp_unslash ( $ _SERVER ['HTTP_USER_AGENT ' ] ) . SIMPLEPIE_USERAGENT );
920- $ feed ->set_useragent ( apply_filters ( 'http_headers_useragent ' , $ set_server_agent ) );
920+ $ feed ->set_useragent ( apply_filters ( 'http_headers_useragent ' , $ set_server_agent, is_array ( $ feed_url ) ? reset ( $ feed_url ) : $ feed_url ) );
921921 }
922922
923923 $ feed ->init ();
0 commit comments