本文整理汇总了PHP中PluginManager::offsetSet方法的典型用法代码示例。如果您正苦于以下问题:PHP PluginManager::offsetSet方法的具体用法?PHP PluginManager::offsetSet怎么用?PHP PluginManager::offsetSet使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PluginManager
的用法示例。
在下文中一共展示了PluginManager::offsetSet方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __autoload
<?php
error_reporting(0);
function __autoload($classname)
{
require_once $classname . ".php";
}
// First, create an instance. We'll probably do this in our bootstrap.
$pluginMGR = new PluginManager();
// then create a plugin or two
$ship = new ShippingPlugin();
$pay = new PaymentPlugin();
// now stash it
$pluginMGR->offsetSet('shipping', $ship);
$pluginMGR->offsetSet('payment', $pay);
// optionally, stash it in your main app registry via the usual Zend_Registry class
// LATER ...
// in a page/route/controller thingee, we'd do something like this.
echo "exec all\n";
$pluginMGR->execPlugins('all');
// or this
echo "exec some\n";
$pluginMGR->execPlugins(array('payment', 'shipping'));
// or just one
echo "exec just one\n";
$pluginMGR->execPluginByName('shipping');
// now make it go away
echo "unregister the plugin\n";
$pluginMGR->unregisterPlugin('shipping');
// we now cannot use the shipping plugin any more in the context of this script
echo "try to re-exec\n";