Making WordPress.org


Ignore:
Timestamp:
07/07/2020 02:01:55 AM (6 years ago)
Author:
dd32
Message:

Theme Directory: Use a user-agent when fetching data from Themes SVN.

This fixes new themes having a blank description and tags.

This is needed as the SVN host rate limits/blocks requests with empty/non-valid user agents.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/theme-directory/theme-directory.php

    r10000 r10020  
    671671    );
    672672
    673     $theme_data = implode( '', file( $theme_file ) );
     673    $context = stream_context_create( array(
     674        'http' => array(
     675            'user_agent' => 'WordPress.org Theme Directory'
     676        )
     677    ) );
     678
     679    $theme_data = file_get_contents( $theme_file, false, $context );
     680
    674681    $theme_data = str_replace( '\r', '\n', $theme_data );
    675682    preg_match( '|^[ \t\/*#@]*Theme Name:(.*)$|mi', $theme_data, $theme_name );
Note: See TracChangeset for help on using the changeset viewer.