本文整理汇总了PHP中KFactory::set方法的典型用法代码示例。如果您正苦于以下问题:PHP KFactory::set方法的具体用法?PHP KFactory::set怎么用?PHP KFactory::set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KFactory
的用法示例。
在下文中一共展示了KFactory::set方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct($subject, $config = array())
{
//Intercept the events for profiling
if(KDEBUG)
{
//Create the event profiler
$profiler = KFactory::get('com://admin/debug.profiler.events');
//Replace the event dispatcher
KFactory::set('koowa:event.dispatcher', $profiler);
}
parent::__construct($subject, $config);
}
示例2: _authenticateUser
/**
* Basic authentication support
*
* This functions tries to log the user in if authentication credentials are
* present in the request.
*
* @return boolean Returns TRUE is basic authentication was successful
*/
protected function _authenticateUser()
{
if(KRequest::has('server.PHP_AUTH_USER') && KRequest::has('server.PHP_AUTH_PW'))
{
$credentials = array(
'username' => KRequest::get('server.PHP_AUTH_USER', 'url'),
'password' => KRequest::get('server.PHP_AUTH_PW' , 'url'),
);
if(KFactory::get('joomla:application')->login($credentials) !== true)
{
throw new KException('Login failed', KHttpResponse::UNAUTHORIZED);
return false;
}
//Reset the user object in the factory
KFactory::set('joomla:user', JFactory::getUser());
//Force the token
KRequest::set('request._token', JUtility::getToken());
return true;
}
return false;
}