当前位置: 首页>>代码示例>>PHP>>正文


PHP KFactory::addAdapter方法代码示例

本文整理汇总了PHP中KFactory::addAdapter方法的典型用法代码示例。如果您正苦于以下问题:PHP KFactory::addAdapter方法的具体用法?PHP KFactory::addAdapter怎么用?PHP KFactory::addAdapter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在KFactory的用法示例。


在下文中一共展示了KFactory::addAdapter方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 public function __construct($subject, $config = array())
 {
     // Check if Koowa is active
     if (JFactory::getApplication()->getCfg('dbtype') != 'mysqli') {
         JError::raiseWarning(0, JText::_("Koowa plugin requires MySQLi Database Driver. Please change your database configuration settings to 'mysqli'"));
         return;
     }
     // Check for suhosin
     if (in_array('suhosin', get_loaded_extensions())) {
         //Attempt setting the whitelist value
         @ini_set('suhosin.executor.include.whitelist', 'tmpl://, file://');
         //Checking if the whitelist is ok
         if (!@ini_get('suhosin.executor.include.whitelist') || strpos(@ini_get('suhosin.executor.include.whitelist'), 'tmpl://') === false) {
             JError::raiseWarning(0, sprintf(JText::_('Your server has Suhosin loaded. Please follow <a href="%s" target="_blank">this</a> tutorial.'), 'https://nooku.assembla.com/wiki/show/nooku-framework/Known_Issues'));
             return;
         }
     }
     //Set constants
     define('KDEBUG', JDEBUG);
     define('JPATH_IMAGES', JPATH_ROOT . '/images');
     //Set exception handler
     set_exception_handler(array($this, 'exceptionHandler'));
     // Require the library loader
     JLoader::import('libraries.koowa.koowa', JPATH_ROOT);
     JLoader::import('libraries.koowa.loader.loader', JPATH_ROOT);
     //Setup the loader
     KLoader::addAdapter(new KLoaderAdapterKoowa(Koowa::getPath()));
     KLoader::addAdapter(new KLoaderAdapterJoomla(JPATH_LIBRARIES));
     KLoader::addAdapter(new KLoaderAdapterModule(JPATH_BASE));
     KLoader::addAdapter(new KLoaderAdapterPlugin(JPATH_ROOT));
     KLoader::addAdapter(new KLoaderAdapterComponent(JPATH_BASE));
     //Setup the factory
     KFactory::addAdapter(new KFactoryAdapterKoowa());
     KFactory::addAdapter(new KFactoryAdapterJoomla());
     KFactory::addAdapter(new KFactoryAdapterModule());
     KFactory::addAdapter(new KFactoryAdapterPlugin());
     KFactory::addAdapter(new KFactoryAdapterComponent());
     //Setup the identifier application paths
     KIdentifier::registerApplication('site', JPATH_SITE);
     KIdentifier::registerApplication('admin', JPATH_ADMINISTRATOR);
     //Setup the request
     KRequest::root(str_replace('/' . JFactory::getApplication()->getName(), '', KRequest::base()));
     //Set factory identifier aliasses
     KFactory::map('lib.koowa.database.adapter.mysqli', 'admin::com.default.database.adapter.mysqli');
     //Load the koowa plugins
     JPluginHelper::importPlugin('koowa', null, true, KFactory::get('lib.koowa.event.dispatcher'));
     //Bugfix : Set offset accoording to user's timezone
     if (!KFactory::get('lib.joomla.user')->guest) {
         if ($offset = KFactory::get('lib.joomla.user')->getParam('timezone')) {
             KFactory::get('lib.joomla.config')->setValue('config.offset', $offset);
         }
     }
     parent::__construct($subject, $config);
 }
开发者ID:ravenlife,项目名称:Ninja-Framework,代码行数:54,代码来源:koowa.php

示例2: jimport

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' );

// Koowa : setup loader
JLoader::import('libraries.koowa.koowa'        , JPATH_ROOT);
JLoader::import('libraries.koowa.loader.loader', JPATH_ROOT);
		
KLoader::addAdapter(new KLoaderAdapterKoowa(Koowa::getPath()));
KLoader::addAdapter(new KLoaderAdapterJoomla(JPATH_LIBRARIES));
KLoader::addAdapter(new KLoaderAdapterModule(JPATH_BASE));
KLoader::addAdapter(new KLoaderAdapterPlugin(JPATH_ROOT));
KLoader::addAdapter(new KLoaderAdapterComponent(JPATH_BASE));
		
// Koowa : setup factory
KFactory::addAdapter(new KFactoryAdapterKoowa());
KFactory::addAdapter(new KFactoryAdapterJoomla());
KFactory::addAdapter(new KFactoryAdapterModule());
KFactory::addAdapter(new KFactoryAdapterPlugin());
KFactory::addAdapter(new KFactoryAdapterComponent());
		
//Koowa : register identifier application paths
KIdentifier::registerApplication('site' , JPATH_SITE);
KIdentifier::registerApplication('admin', JPATH_ADMINISTRATOR);

//Koowa : setup factory mappings
KFactory::map('koowa:database.adapter.mysqli', 'com://admin/default.database.adapter.mysqli');
开发者ID:raeldc,项目名称:com_learn,代码行数:31,代码来源:framework.php


注:本文中的KFactory::addAdapter方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。