Skip to:
Content

bbPress.org

Changeset 2053


Ignore:
Timestamp:
04/08/2009 09:21:07 PM (17 years ago)
Author:
mdawaffe
Message:

updates to bb_get_plugin_data() for 0.9: don't read the whole file. Look in first plugin data block, not first comment block (which could be PHPDoc)

File:
1 edited

Legend:

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

    r1842 r2053  
    848848        );
    849849    }
    850     $plugin_code = implode('', file($plugin_file));
     850
     851    // Pull only the first 8kiB of the file in.
     852    $fp = fopen( $plugin_file, 'r' );
     853    $plugin_code = fread( $fp, 8192 );
     854    fclose($fp);
     855
    851856    // Grab just the first commented area from the file
    852     if ( !preg_match( '|/\*(.*)\*/|msU', $plugin_code, $plugin_block ) )
     857    if ( !preg_match( '|/\*(.*?Plugin Name:.*?)\*/|ims', $plugin_code, $plugin_block ) )
    853858        return false;
    854859    $plugin_data = trim( $plugin_block[1] );
    855     if ( !preg_match("|Plugin Name:(.*)|i", $plugin_data, $plugin_name) )
    856         return false;
     860
     861    preg_match("|Plugin Name:(.*)|i", $plugin_data, $plugin_name);
    857862    preg_match("|Plugin URI:(.*)|i", $plugin_data, $plugin_uri);
    858863    preg_match("|Description:(.*)|i", $plugin_data, $description);
Note: See TracChangeset for help on using the changeset viewer.