diff --git a/includes/Wpup/Package.php b/includes/Wpup/Package.php index b2f842f..24ad4f1 100644 --- a/includes/Wpup/Package.php +++ b/includes/Wpup/Package.php @@ -123,12 +123,14 @@ public static function extractMetadata($zipFilename){ if ( isset($packageInfo['header']) && !empty($packageInfo['header']) ){ $mapping = array( 'Name' => 'name', - 'Version' => 'version', - 'PluginURI' => 'homepage', - 'ThemeURI' => 'homepage', - 'Author' => 'author', - 'AuthorURI' => 'author_homepage', - 'DetailsURI' => 'details_url', //Only for themes. + 'Version' => 'version', + 'PluginURI' => 'homepage', + 'ThemeURI' => 'homepage', + 'Author' => 'author', + 'AuthorURI' => 'author_homepage', + 'DetailsURI' => 'details_url', //Only for themes. + 'Depends' => 'depends', // plugin-dependencies plugin + 'Provides' => 'provides', // plugin-dependencies plugin ); foreach($mapping as $headerField => $metaField){ if ( array_key_exists($headerField, $packageInfo['header']) && !empty($packageInfo['header'][$headerField]) ){ @@ -145,7 +147,10 @@ public static function extractMetadata($zipFilename){ } if ( !empty($packageInfo['readme']) ){ - $mapping = array('requires', 'tested'); + $mapping = array( + 'requires', + 'tested', + ); foreach($mapping as $readmeField){ if ( !empty($packageInfo['readme'][$readmeField]) ){ $meta[$readmeField] = $packageInfo['readme'][$readmeField]; diff --git a/includes/extension-meta/extension-meta.php b/includes/extension-meta/extension-meta.php index fd30bda..f88d165 100644 --- a/includes/extension-meta/extension-meta.php +++ b/includes/extension-meta/extension-meta.php @@ -262,6 +262,9 @@ public static function getPluginHeaders($fileContents) { 'TextDomain' => 'Text Domain', 'DomainPath' => 'Domain Path', 'Network' => 'Network', + 'Depends' => 'Depends', + 'Provides' => 'Provides', + //Site Wide Only is deprecated in favor of Network. '_sitewide' => 'Site Wide Only', ); @@ -277,6 +280,16 @@ public static function getPluginHeaders($fileContents) { //For backward compatibility by default Title is the same as Name. $headers['Title'] = $headers['Name']; + + //"Depends" is a comma-separated list. Convert it to an array. + if ( !empty($headers['Depends']) ){ + $headers['Depends'] = array_map('trim', explode(',', $headers['Depends'])); + } + + //Same for "Provides" + if ( !empty($headers['Provides']) ){ + $headers['Provides'] = array_map('trim', explode(',', $headers['Provides'])); + } //If it doesn't have a name, it's probably not a plugin. if ( empty($headers['Name']) ){