Coder Social home page Coder Social logo

dexit / wp-extension-meta Goto Github PK

View Code? Open in Web Editor NEW

This project forked from yahniselsts/wp-extension-meta

0.0 1.0 0.0 48 KB

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.

PHP 100.00%

wp-extension-meta's Introduction

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.

wp-extension-meta's People

Contributors

butlerblog avatar yahniselsts avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.