Skip to content

YahnisElsts/wp-extension-meta

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 

Repository files navigation

WordPress Package Parser

A PHP library for parsing WordPress plugin and theme metadata. Point it at a ZIP package and it will:

  • Tell you whether it contains a plugin or a theme.
  • Give you the metadata from the comment header (Version, Description, Author URI, etc).
  • Parse readme.txt into a list of headers and sections.
  • Convert readme.txt contents from Markdown to HTML (optional).

Basic usage

Extract plugin metadata:

require 'wp-extension-meta/extension-meta.php';
$package = WshWordPressPackageParser::parsePackage('sample-plugin.zip', true);
print_r($package);

Sample output:

Array
(
    [header] => Array
        (
            [Name] => Plugin Name
            [PluginURI] => http://example.com/
            [Version] => 1.7
            [Description] => This plugin does stuff.
            [Author] => Yahnis Elsts
            [AuthorURI] => http://w-shadow.com/
            [TextDomain] => sample-plugin
            [DomainPath] => 
            [Network] => 
            [Title] => Plugin Name
        )

    [readme] => Array
        (
            [name] => Plugin Name
            [contributors] => Array
                (
                    [0] => whiteshadow
                )

            [tags] => Array
                (
                    [0] => sample
                    [1] => tag
                    [2] => stuff
                )

            [requires] => 3.2
            [tested] => 3.5.1
            [stable] => 1.7
            [short_description] => This is the short description from the readme. 
            [sections] => Array
                (
                    [Description] => This is the <em>Description</em> section of the readme.
                    [Installation] => ...
                    [Changelog] => ...
                )
        )
    [pluginFile] => sample-plugin/sample-plugin.php
    [stylesheet] => 
    [type] => plugin
)

Requirements

PHP 5.2.

Credits

Partially based on plugin header parsing code from the WordPress core.

About

A PHP library for parsing WordPress plugin and theme metadata. It can extract the version number and description from a plugin ZIP, parse readme.txt files and so on.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages