本文整理汇总了PHP中KLoader::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP KLoader::getInstance方法的具体用法?PHP KLoader::getInstance怎么用?PHP KLoader::getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KLoader
的用法示例。
在下文中一共展示了KLoader::getInstance方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Constructor
*
* Prevent creating instances of this class by making the contructor private
*
* @param array An optional array with configuration options.
*/
private final function __construct($config = array())
{
//Initialize the path
$this->_path = dirname(__FILE__);
//Load the legacy functions
require_once $this->_path . '/legacy.php';
//Setup the loader
require_once $this->_path . '/loader/loader.php';
$loader = KLoader::getInstance($config);
//Setup the factory
$service = KService::getInstance($config);
$service->set('koowa:loader', $loader);
}
示例2: jimport
jimport('joomla.environment.uri');
jimport('joomla.html.html');
jimport('joomla.html.parameter');
jimport('joomla.utilities.utility');
jimport('joomla.event.event');
jimport('joomla.event.dispatcher');
jimport('joomla.language.language');
jimport('joomla.utilities.string');
jimport('joomla.plugin.helper');
require_once JPATH_CONFIGURATION . '/configuration.php';
require_once JPATH_LIBRARIES . '/anahita/anahita.php';
$config = new JConfig();
//instantiate anahita and nooku
Anahita::getInstance(array('cache_prefix' => md5($config->secret) . '-cache-koowa', 'cache_enabled' => $config->caching));
KServiceIdentifier::setApplication('site', JPATH_SITE);
KServiceIdentifier::setApplication('admin', JPATH_ADMINISTRATOR);
KLoader::addAdapter(new AnLoaderAdapterComponent(array('basepath' => JPATH_BASE)));
KServiceIdentifier::addLocator(KService::get('anahita:service.locator.component'));
KLoader::addAdapter(new KLoaderAdapterPlugin(array('basepath' => JPATH_ROOT)));
KServiceIdentifier::addLocator(KService::get('koowa:service.locator.plugin'));
KLoader::addAdapter(new AnLoaderAdapterTemplate(array('basepath' => JPATH_BASE)));
KServiceIdentifier::addLocator(KService::get('anahita:service.locator.template'));
KService::setAlias('koowa:database.adapter.mysqli', 'com://admin/default.database.adapter.mysqli');
KService::setAlias('anahita:domain.store.database', 'com:base.domain.store.database');
KService::setAlias('anahita:domain.space', 'com:base.domain.space');
//make sure for the autoloader to be reigstered after nooku
$autoloader = (require_once JPATH_VENDOR . '/autoload.php');
$autoloader->unregister();
$autoloader->register();
KLoader::getInstance()->loadIdentifier('com://site/application.aliases');
示例3: renderComponent
static function renderComponent($name, $params = array())
{
global $mainframe, $option;
// Define component path
define('JPATH_COMPONENT', JPATH_BASE . DS . 'components' . DS . $name);
define('JPATH_COMPONENT_SITE', JPATH_SITE . DS . 'components' . DS . $name);
define('JPATH_COMPONENT_ADMINISTRATOR', JPATH_ADMINISTRATOR . DS . 'components' . DS . $name);
if (!file_exists(JPATH_COMPONENT)) {
JError::raiseError(404, JText::_('Component Not Found'));
}
$file = substr($name, 4);
// get component path
if ($mainframe->isAdmin() && file_exists(JPATH_COMPONENT . DS . 'admin.' . $file . '.php')) {
$path = JPATH_COMPONENT . DS . 'admin.' . $file . '.php';
} else {
$path = JPATH_COMPONENT . DS . $file . '.php';
}
$identifier = KService::getIdentifier("com:{$file}.aliases");
$identifier->application = $mainframe->isAdmin() ? 'admin' : 'site';
$lang =& JFactory::getLanguage();
$lang->load($name);
KLoader::getInstance()->loadIdentifier($identifier);
//new way of doing it
if (!file_exists($path)) {
$identifier->name = 'dispatcher';
register_default(array('identifier' => $identifier, 'default' => 'ComBaseDispatcherDefault'));
$dispatcher = ComBaseDispatcher::getInstance();
KService::setAlias('component.dispatcher', $dispatcher->getIdentifier());
KService::set('component.dispatcher', $dispatcher);
return $dispatcher->dispatch();
} else {
$contents = self::_renderComponent($path);
// Build the component toolbar
jimport('joomla.application.helper');
if (($path = JApplicationHelper::getPath('toolbar')) && $mainframe->isAdmin()) {
// Get the task again, in case it has changed
$task = JRequest::getString('task');
// Make the toolbar
include_once $path;
}
return $contents;
}
}