本文整理汇总了PHP中KService::setConfig方法的典型用法代码示例。如果您正苦于以下问题:PHP KService::setConfig方法的具体用法?PHP KService::setConfig怎么用?PHP KService::setConfig使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KService
的用法示例。
在下文中一共展示了KService::setConfig方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _beforeDispatch
protected function _beforeDispatch(KCommandContext $context)
{
if ($this->getRequest()->container === 'docman-files') {
KService::setConfig('com://admin/files.controller.file', array('behaviors' => array('com://admin/docman.controller.behavior.file')));
KService::setConfig('com://admin/files.controller.folder', array('behaviors' => array('com://admin/docman.controller.behavior.folder')));
KService::setAlias('com://admin/files.model.containers', 'com://admin/docman.model.containers');
KService::setAlias('com://site/files.model.containers', 'com://admin/docman.model.containers');
}
// Use our own ACL instead of com_files'
KService::setAlias('com://admin/files.controller.behavior.executable', 'com://admin/docman.controller.behavior.executable');
if ($this->getRequest()->routed) {
$app = JFactory::getApplication();
$behavior = 'com://admin/docman.controller.behavior.cacheable';
// If the upload_folder parameter is set, we change the container path so results are different
if ($app->isSite() && $app->getMenu()->getActive()->params->get('upload_folder')) {
$behavior = $this->getService($behavior, array('only_clear' => true));
}
foreach (array('file', 'folder', 'node', 'thumbnail') as $name) {
KService::setConfig('com://admin/files.controller.' . $name, array('behaviors' => array($behavior)));
}
if (!in_array($this->getRequest()->container, array('docman-files', 'docman-icons', 'docman-images'))) {
$this->getRequest()->container = 'docman-files';
}
if ($this->getRequest()->container === 'docman-icons') {
KService::setConfig('com://admin/files.controller.file', array('behaviors' => array('com://admin/docman.controller.behavior.icon')));
}
// Work-around the bug here: http://joomlacode.org/gf/project/joomla/tracker/?action=TrackerItemEdit&tracker_item_id=28249
JFactory::getSession()->set('com_docman.fix.the.session.bug', microtime(true));
$context->result = $this->getService('com://admin/files.dispatcher', array('request' => array('container' => $this->getRequest()->container)))->dispatch();
return false;
}
}
示例2: inject
/**
* Injects behaviors to target identifiers.
*
* @param array $dependencies Associative array with target identifiers as keys and arrays
* with behavior identifiers as values.
*
* @see ComLogmanPluginInjector::inject()
*/
public final function inject($dependencies = array())
{
foreach ($dependencies as $target => $behaviors) {
$behaviors = (array) $behaviors;
foreach ($behaviors as $behavior) {
KService::setConfig($target, array('behaviors' => array($behavior)));
}
}
}
示例3: _beforeDispatch
protected function _beforeDispatch(KCommandContext $context)
{
// Use our own ACL instead of com_files'
KService::setAlias('com://admin/files.controller.behavior.executable', 'com://admin/fileman.controller.behavior.executable');
// Cache the hell out of JSON requests
foreach (array('file', 'folder', 'node', 'thumbnail') as $name) {
KService::setConfig('com://admin/files.controller.' . $name, array('behaviors' => array('com://admin/fileman.controller.behavior.cacheable')));
}
if ($this->getRequest()->routed) {
$this->getRequest()->container = 'fileman-files';
// Work-around the bug here: http://joomlacode.org/gf/project/joomla/tracker/?action=TrackerItemEdit&tracker_item_id=28249
// TODO: Move this to the Nooku Framework plugin
JFactory::getSession()->set('com_docman.fix.the.session.bug', microtime(true));
// Swap the language object temporarily to use our own translator
/*$lang = JFactory::getLanguage();
JFactory::$language = $this->getService('com://admin/docman.language.decorator', array('object' => $lang));*/
$context->result = $this->getService('com://admin/files.dispatcher')->dispatch();
//JFactory::$language = $lang;
return false;
}
}
示例4: _actionBrowse
/**
* Return a set of notification objects
*
* @param KCommandContext $context Context parameter
*
* @return AnDomainEntitysetDefault
*/
protected function _actionBrowse($context)
{
$this->actor->resetNotifications();
if ($this->actor->eql(get_viewer())) {
$title = JText::_('COM-NOTIFICATIONS-ACTORBAR-YOUR-NOTIFICATIONS');
} else {
$title = sprintf(JText::_('COM-NOTIFICATIONS-ACTORBAR-ACTOR-NOTIFICATIONS'), $this->actor->name);
}
$this->getToolbar('actorbar')->setTitle($title);
$context->query = $this->actor->getNotifications()->getQuery();
$set = parent::_actionBrowse($context)->order('creationTime', 'DESC');
if ($this->new) {
$set->id($this->actor->newNotificationIds->toArray());
}
//only zero the notifications if the viewer is the same as the
//actor. prevents from admin zeroing others notifications
if ($set->count() > 0 && get_viewer()->eql($this->actor)) {
//set the number of notification, since it's going to be
//reset by the time it gets to the mod_viewer
KService::setConfig('com://site/viewer.html', array('data' => array('num_notifications' => $this->actor->numOfNewNotifications())));
$this->registerCallback('after.get', array($this->actor, 'viewedNotifications'), $set->toArray());
}
return $set;
}
示例5: JConfig
<?php
/**
* LICENSE: ##LICENSE##
*
* @category Anahita
* @author Arash Sanieyan <ash@anahitapolis.com>
* @author Rastin Mehr <rastin@anahitapolis.com>
* @copyright 2008 - 2010 rmdStudio Inc./Peerglobe Technology Inc
* @license GNU GPLv3 <http://www.gnu.org/licenses/gpl-3.0.html>
* @version SVN: $Id: view.php 13650 2012-04-11 08:56:41Z asanieyan $
* @link http://www.anahitapolis.com
*/
$config = new JConfig();
$config->cache_prefix = md5($config->secret) . '-cache-system';
$config->cache_enabled = $config->caching;
KService::setAlias('application.registry', 'com://site/application.registry');
KService::setAlias('application', 'com://site/application');
KService::setConfig('application.registry', array('cache_prefix' => $config->cache_prefix, 'cache_enabled' => $config->cache_enabled));
示例6: dirname
if (!defined('JPATH_BASE')) {
$base = dirname($_SERVER['DOCUMENT_ROOT'] . $_SERVER['SCRIPT_NAME']);
$base = str_replace('/components/com_notifications', '', $base);
define('JPATH_BASE', $base);
require_once JPATH_BASE . '/includes/framework.php';
KService::get('com://site/application.dispatcher')->load();
}
class ComNotificationsRouterApplication extends ComApplicationRouter
{
/**
* Always return absolute URL.
*
* (non-PHPdoc)
*
* @see ComApplicationRouter::build()
*/
public function build(&$query = '', $fqr = false)
{
return parent::build($query, true);
}
}
KService::setAlias('com://site/application.router', 'com://site/notifications.router.application');
$base_url = KService::get('koowa:http.url', array('url' => rtrim(JURI::base(), '/')));
KService::setConfig('com://site/application.router', array('base_url' => $base_url));
$controller = KService::get('com://site/notifications.controller.processor', array('base_url' => $base_url));
$ids = (array) KRequest::get('get.id', 'int', array());
if (!empty($ids)) {
$controller->id($ids);
}
$controller->process();
exit(0);
示例7: __construct
/**
* Constructor
*/
public function __construct($dispatcher, $config = array())
{
if (!$config instanceof KConfig) {
$config = new KConfig($config);
}
//Inject the identifier
$config->service_identifier = KService::getIdentifier('plg:koowa.' . $config['name']);
//Inject the service container
$config->service_container = KService::getInstance();
parent::__construct($config);
//Set the plugin params
if (is_string($config->params)) {
$config->params = $this->_parseParams($config->params);
}
$this->_params = $config->params;
//Setup lazy wiring for publishers we are subscribing too
foreach ($config->event_publishers as $publisher) {
KService::setConfig($publisher, array('event_subscribers' => array($this)));
}
if ($dispatcher instanceof KEventDispatcher) {
$dispatcher->addEventSubscriber($this);
}
}