Skip to:
Content

bbPress.org

Changeset 1841


Ignore:
Timestamp:
12/10/2008 06:58:13 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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bb-admin/includes/functions.bb-admin.php

    r1829 r1841  
    10021002        );
    10031003    }
    1004     $plugin_data = implode('', file($plugin_file));
     1004    $plugin_code = implode('', file($plugin_file));
     1005    // Grab just the first commented area from the file
     1006    if ( !preg_match( '|/\*(.*)\*/|msU', $plugin_code, $plugin_block ) )
     1007        return false;
     1008    $plugin_data = trim( $plugin_block[1] );
    10051009    if ( !preg_match("|Plugin Name:(.*)|i", $plugin_data, $plugin_name) )
    10061010        return false;
     
    11051109    if ( strpos($theme_file, '#') !== false )
    11061110        $theme_file = bb_get_theme_directory( $theme_file ) . 'style.css';
    1107     $theme_data = implode( '', file( $theme_file ) );
    1108     $theme_data = str_replace ( '\r', '\n', $theme_data );
     1111    $theme_code = implode( '', file( $theme_file ) );
     1112    $theme_code = str_replace ( '\r', '\n', $theme_code );
     1113    // Grab just the first commented area from the file
     1114    preg_match( '|/\*(.*)\*/|msU', $theme_code, $theme_block );
     1115    $theme_data = trim( $theme_block[1] );
    11091116    preg_match( '|Theme Name:(.*)|i', $theme_data, $theme_name );
    11101117    preg_match( '|Theme URI:(.*)|i', $theme_data, $theme_uri );
Note: See TracChangeset for help on using the changeset viewer.