Source for file Plugin.php
Documentation is available at Plugin.php
/* vim: set expandtab tabstop=4 shiftwidth=4: */
// +----------------------------------------------------------------------+
// +----------------------------------------------------------------------+
// | Copyright (c) 1997-2002 The PHP Group |
// +----------------------------------------------------------------------+
// | This source file is subject to version 2.02 of the PHP license, |
// | that is bundled with this package in the file LICENSE, and is |
// | available at through the world-wide-web at |
// | http://www.php.net/license/2_02.txt. |
// | If you did not receive a copy of the PHP license and are unable to |
// | obtain it through the world-wide-web, please send a note to |
// | license@php.net so we can mail you a copy immediately. |
// +----------------------------------------------------------------------+
// | Authors: nobody <nobody@localhost> |
// +----------------------------------------------------------------------+
// $Id: Plugin.php 334846 2014-09-12 04:50:56Z alan_k $
// Plugin API provides support for < ? = $this->plugin(".....",.....); ? >
// or {this.plugin(#xxxxx#,#xxxx#):h}
// BASICALLY THIS IS SAVANT'S PLUGIN PROVIDER.
// @author Paul M. Jones <pmjones@ciaweb.net>
class HTML_Template_Flexy_Plugin
* reference to main engine..
* @var object HTML_Template_Flexy
var $flexy; // reference to flexy.
var $pluginCache = array (); // store of instanced plugins..
* Look up in all the plugins to see if the method exists, if it does, call it.
* @param array name of method, arguments.
* @return string hopefully
// attempt to load the plugin on-the-fly
$class = $this->_loadPlugins ($method);
//echo $class->toString();
return $class->toString ();
// first argument is always the plugin name; shift the first
// argument off the front of the array and reduce the number of
* Load the plugins, and lookup which one provides the required method
* @return string|PEAR_Error the class that provides it.
function _loadPlugins ($name)
// ahref = maps to {class_prefix}_ahref::ahref
$this->plugins = array ();
if (empty ($this->plugins)) {
foreach ($this->flexy->options ['plugins'] as $cname=> $file) {
$this->plugins[$cname] = new $cname;
$this->plugins[$cname]->flexy = &$this->flexy;
require_once 'HTML/Template/Flexy/Plugin/'. $cname . '.php';
$class = " HTML_Template_Flexy_Plugin_{$cname}";
$this->plugins[$class] = new $class;
$this->plugins[$class]->flexy = &$this->flexy;
foreach ($this->plugins as $class=> $o) {
//echo "checking :". get_class($o). ":: $name\n";
return HTML_Template_Flexy ::staticRaiseError (" could not find plugin with method: '$name'" );
Documentation generated on Mon, 11 Mar 2019 15:59:57 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.
|