2017 © Pedro Peláez
 

library oow

Object-Oriented approach to WordPress plugin development

image

eabay/oow

Object-Oriented approach to WordPress plugin development

  • Monday, November 2, 2015
  • by eabay
  • Repository
  • 4 Watchers
  • 21 Stars
  • 327 Installations
  • PHP
  • 2 Dependents
  • 0 Suggesters
  • 2 Forks
  • 1 Open issues
  • 7 Versions
  • 0 % Grown

The README.md

What is Oow?

Oow is a library that contains components to ease WordPress plugin development., (*1)

Design

If you are familiar with how Doctrine2 works, there is just a little to explain. There is a PluginManager to handle your standalone plugin classes by reading annotations. Don't worry if this doesn't make any sense to you. Continue to read. :), (*2)

PluginManager

PluginManager is at the heart of the library and all classes is registered to WordPress hooks with it., (*3)

Plugins

Plugins are just standalone PHP classes. They don't have to extend any base class and don't have to follow any naming conventions. Annotations in docblocks are used to handle classes., (*4)

Requirements

Installation

with Composer

Add eabay/oow as a dependency in your composer.json file., (*5)

Usage

First create a plugin class:, (*6)

``` php <?php namespace Plugins;, (*7)

/** @Plugin */ class HelloWorld { /** @Hook(tag="wp_footer",priority=50) */ public function sayHello() { echo 'Hello World'; } }, (*8)


Go to your plugin file and register your plugin with `PluginManager`; ``` php <?php /* Plugin Name: Hello World */ use Oow\Plugin\PluginManager; use Plugins\HelloWorld; $manager = new PluginManager; $manager->addPlugin(new HelloWorld);

This will print Hello World in the page footer. Check https://github.com/eabay/oow-sample-plugin for sample plugin., (*9)

You are free to create your classes as you want. @Plugin class annotation makes your class a plugin and @Hook method annotation hooks your its methods to actions and filters. If you semantically distinguish you action and filter hooks you can use @Action and @Filter annotations in method docblocks. Those are just synonyms and do exactly the same., (*10)

The parameters of @Hook is the same as add_filter function except that function_to_add is the method you assign and accepted_args is the number of arguments that method has. priority is optional and its default is 10., (*11)

Please check Doctrine Annotations documentation to learn more about annotations., (*12)

Contributing

Fork the project, create a feature branch, and send me a pull request., (*13)

The Versions

02/11 2015

dev-master

9999999-dev https://github.com/eabay/oow

Object-Oriented approach to WordPress plugin development

  Sources   Download

MIT

The Requires

 

plugin wordpress wordpress plugin development

02/11 2015

1.4.0

1.4.0.0 https://github.com/eabay/oow

Object-Oriented approach to WordPress plugin development

  Sources   Download

MIT

The Requires

 

plugin wordpress wordpress plugin development

30/10 2015

1.3.0

1.3.0.0 https://github.com/eabay/oow

Object-Oriented approach to WordPress plugin development

  Sources   Download

MIT

The Requires

 

plugin wordpress wordpress plugin development

25/10 2015

1.2.1

1.2.1.0 https://github.com/eabay/oow

Object-Oriented approach to WordPress plugin development

  Sources   Download

MIT

The Requires

 

plugin wordpress wordpress plugin development

19/10 2015

1.2.0

1.2.0.0 https://github.com/eabay/oow

Object-Oriented approach to WordPress plugin development

  Sources   Download

MIT

The Requires

 

plugin wordpress wordpress plugin development

16/10 2015

1.1.0

1.1.0.0 https://github.com/eabay/oow

Object-Oriented approach to WordPress plugin development

  Sources   Download

MIT

The Requires

 

plugin wordpress wordpress plugin development

22/07 2013

1.0.0

1.0.0.0 https://github.com/eabay/oow

Object-Oriented approach to WordPress plugin development

  Sources   Download

MIT

The Requires

 

plugin wordpress wordpress plugin development