Skip to:
Content

bbPress.org


Ignore:
Timestamp:
12/10/2008 07:10:24 AM (17 years ago)
Author:
sambauers
Message:

Only grab the first comment block when reading data from plugins and themes - speeds things up and avoids rogue plugins turning up in the plugins list. branches/0.9

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/0.9/bb-admin/admin-functions.php

    r1503 r1842  
    848848        );
    849849    }
    850     $plugin_data = implode('', file($plugin_file));
     850    $plugin_code = implode('', file($plugin_file));
     851    // Grab just the first commented area from the file
     852    if ( !preg_match( '|/\*(.*)\*/|msU', $plugin_code, $plugin_block ) )
     853        return false;
     854    $plugin_data = trim( $plugin_block[1] );
    851855    if ( !preg_match("|Plugin Name:(.*)|i", $plugin_data, $plugin_name) )
    852856        return false;
     
    917921    if ( strpos($theme_file, '#') !== false )
    918922        $theme_file = bb_get_theme_directory( $theme_file ) . 'style.css';
    919     $theme_data = implode( '', file( $theme_file ) );
    920     $theme_data = str_replace ( '\r', '\n', $theme_data );
     923    $theme_code = implode( '', file( $theme_file ) );
     924    $theme_code = str_replace ( '\r', '\n', $theme_code );
     925    // Grab just the first commented area from the file
     926    preg_match( '|/\*(.*)\*/|msU', $theme_code, $theme_block );
     927    $theme_data = trim( $theme_block[1] );
    921928    preg_match( '|Theme Name:(.*)|i', $theme_data, $theme_name );
    922929    preg_match( '|Theme URI:(.*)|i', $theme_data, $theme_uri );
Note: See TracChangeset for help on using the changeset viewer.