本文整理汇总了PHP中CitruscartHelperBase::addIncludePath方法的典型用法代码示例。如果您正苦于以下问题:PHP CitruscartHelperBase::addIncludePath方法的具体用法?PHP CitruscartHelperBase::addIncludePath怎么用?PHP CitruscartHelperBase::addIncludePath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CitruscartHelperBase
的用法示例。
在下文中一共展示了CitruscartHelperBase::addIncludePath方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getInstance
/**
* Returns a reference to the a Helper object, only creating it if it doesn't already exist
*
* @param type $type The helper type to instantiate
* @param string $prefix A prefix for the helper class name. Optional.
* @return helper The Helper Object
*/
public static function getInstance($type = 'Base', $prefix = 'CitruscartHelper')
{
//parent::getInstance( $type , $prefix );
static $instances;
if (!isset($instances)) {
$instances = array();
}
$type = preg_replace('/[^A-Z0-9_\\.-]/i', '', $type);
// The Base helper is in _base.php, but it's named CitruscartHelperBase
if (strtolower($type) == 'Base') {
$helperClass = $prefix . ucfirst($type);
$type = '_Base';
}
$helperClass = $prefix . ucfirst($type);
if (empty($instances[$helperClass])) {
if (!class_exists($helperClass)) {
jimport('joomla.filesystem.path');
if ($path = JPath::find(CitruscartHelperBase::addIncludePath(), strtolower($type) . '.php')) {
require_once $path;
if (!class_exists($helperClass)) {
JError::raiseWarning(0, 'Helper class ' . $helperClass . ' not found in file.');
return false;
}
} else {
JError::raiseWarning(0, 'Helper ' . $type . ' not supported. File not found.');
return false;
}
}
$instance = new $helperClass();
$instances[$helperClass] = $instance;
}
return $instances[$helperClass];
}