Making WordPress.org

Changeset 11035


Ignore:
Timestamp:
06/17/2021 05:55:59 AM (3 years ago)
Author:
dd32
Message:

Theme Directory: Update the upload handler to use Theme Check v20210617

See https://github.com/WordPress/theme-check/releases

File:
1 edited

Legend:

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

    r11034 r11035  
    741741    public function check_theme( $files ) {
    742742        // Load the theme checking code.
    743         if ( ! function_exists( 'run_themechecks' ) ) {
     743        if ( ! function_exists( 'run_themechecks_against_theme' ) ) {
    744744            include_once WP_PLUGIN_DIR . '/theme-check/checkbase.php';
    745745        }
    746746
    747         list( $php_files, $css_files, $other_files ) = $this->separate_files( $files );
    748 
    749747        // Run the checks.
    750         $result = run_themechecks( $php_files, $css_files, $other_files );
     748        $result = run_themechecks_against_theme( $this->theme, $this->theme_slug );
    751749
    752750        // Display the errors.
     
    12661264
    12671265        return $files;
    1268     }
    1269 
    1270     /**
    1271      * Separates files in three buckets, PHP files, CSS files, and others.
    1272      *
    1273      * Most likely used in preparation for the Theme Check plugin.
    1274      *
    1275      * @param array $files Files to separate.
    1276      * @return array
    1277      */
    1278     public function separate_files( $files ) {
    1279         $php_files = $css_files = $other_files = array();
    1280 
    1281         foreach ( $files as $file ) {
    1282             // PHP files.
    1283             if ( true === fnmatch( "*.php", $file ) ) {
    1284                 $php_files[ $file ] = php_strip_whitespace( $file );
    1285 
    1286                 // CSS files.
    1287             } else if ( true === fnmatch( "*.css", $file ) ) {
    1288                 $css_files[ $file ] = file_get_contents( $file );
    1289 
    1290                 // All the rest.
    1291             } else {
    1292                 $other_files[ $file ] = file_get_contents( $file );
    1293             }
    1294         }
    1295 
    1296         return array( $php_files, $css_files, $other_files );
    12971266    }
    12981267
Note: See TracChangeset for help on using the changeset viewer.