Vulnero

Seamless WordPress and Zend Framework Integration

The Vulnero plugin is initialized by the presence of the vulnero.php source file which has special file-level comments that tell WordPress it's a plugin. The file then sets some constants and creates a Zend_Application object which bootstraps your application.

Bootstrapping

Bootstrapping is the key benefit to using Vulnero, so the presence of the Zend_Application is a requirement. This also means you must be using a version of the Zend Framework greater than or equal to 1.8, though the newest 1.* is recommended. Version 2 of the framework is currently in beta and when released, will not be backwards compatible with 1.* versions. Vulnero does not support any 2.x version of the framework.

Your application's bootstrap is located at application/Bootstrap.php and extends Vulnero_Application_Bootstrap_Bootstrap. You can create new bootstrap items by simply creating a method in your Bootstrap class:

protected function _initSomethingNew()
{
    $value = get_some_value();
    return $value;
}

You can then access your bootstrap resource from other bootstrap items or from a controller:

public function visitAction()
{
    $something = $this->getInvokeArg('bootstrap')
                      ->bootstrap('something-new')
                      ->getResource('something-new');
    $this->view->something = $something;
}

Overriding Vulnero resources can also be done in your Bootstrap class. For example, if you don't wish to bootstrap a database connection, simply define the method yourself:

protected function _initDb() {} // disabling database bootstrapping

This will effectively disable the _initDb method in Vulnero_Application_Bootstrap_Bootstrap removing any expense that resource may incur. Not all resources can be excluded. Some commonly excluded resources are:

  • _initDb(): database
  • _initRouting(): routing