本文整理汇总了PHP中KService::setAlias方法的典型用法代码示例。如果您正苦于以下问题:PHP KService::setAlias方法的具体用法?PHP KService::setAlias怎么用?PHP KService::setAlias使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KService
的用法示例。
在下文中一共展示了KService::setAlias方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: __construct
public function __construct($subject, $config = array())
{
// Turn off E_STRICT errors for now
error_reporting(error_reporting() & ~E_STRICT);
// Check if database type is MySQLi
if (JFactory::getApplication()->getCfg('dbtype') != 'mysqli') {
if (JFactory::getApplication()->getName() === 'administrator') {
$string = version_compare(JVERSION, '1.6', '<') ? 'mysqli' : 'MySQLi';
$link = JRoute::_('index.php?option=com_config');
$error = 'In order to use Joomlatools framework, your database type in Global Configuration should be set to <strong>%1$s</strong>. Please go to <a href="%2$s">Global Configuration</a> and in the \'Server\' tab change your Database Type to <strong>%1$s</strong>.';
JError::raiseWarning(0, sprintf(JText::_($error), $string, $link));
}
return;
}
// Set pcre.backtrack_limit to a larger value
// See: https://bugs.php.net/bug.php?id=40846
if (version_compare(PHP_VERSION, '5.3.6', '<=') && @ini_get('pcre.backtrack_limit') < 1000000) {
@ini_set('pcre.backtrack_limit', 1000000);
}
//Set constants
define('KDEBUG', JDEBUG);
//Set path definitions
define('JPATH_FILES', JPATH_ROOT);
define('JPATH_IMAGES', JPATH_ROOT . DIRECTORY_SEPARATOR . 'images');
//Set exception handler
set_exception_handler(array($this, 'exceptionHandler'));
// Koowa : setup
require_once JPATH_LIBRARIES . '/koowa/koowa.php';
Koowa::getInstance(array('cache_prefix' => md5(JFactory::getApplication()->getCfg('secret')) . '-cache-koowa', 'cache_enabled' => false));
KLoader::addAdapter(new KLoaderAdapterModule(array('basepath' => JPATH_BASE)));
KLoader::addAdapter(new KLoaderAdapterPlugin(array('basepath' => JPATH_ROOT)));
KLoader::addAdapter(new KLoaderAdapterComponent(array('basepath' => JPATH_BASE)));
KServiceIdentifier::addLocator(KService::get('koowa:service.locator.module'));
KServiceIdentifier::addLocator(KService::get('koowa:service.locator.plugin'));
KServiceIdentifier::addLocator(KService::get('koowa:service.locator.component'));
KServiceIdentifier::setApplication('site', JPATH_SITE);
KServiceIdentifier::setApplication('admin', JPATH_ADMINISTRATOR);
KService::setAlias('koowa:database.adapter.mysqli', 'com://admin/default.database.adapter.mysqli');
KService::setAlias('translator', 'com:default.translator');
//Setup the request
if (JFactory::getApplication()->getName() !== 'site') {
KRequest::root(str_replace('/' . JFactory::getApplication()->getName(), '', KRequest::base()));
}
//Load the koowa plugins
JPluginHelper::importPlugin('koowa', null, true);
//Bugfix : Set offset accoording to user's timezone
if (!JFactory::getUser()->guest) {
if ($offset = JFactory::getUser()->getParam('timezone')) {
if (version_compare(JVERSION, '3.0', '>=')) {
JFactory::getConfig()->set('offset', $offset);
} else {
JFactory::getConfig()->setValue('config.offset', $offset);
}
}
}
// Load language files for the framework
KService::get('com:default.translator')->loadLanguageFiles();
parent::__construct($subject, $config);
}
示例3: setAliases
public function setAliases()
{
if (!$this->_loaded) {
$maps = array('com://site/wufoo.model.forms' => 'com://admin/wufoo.model.forms', 'com://site/wufoo.model.entries' => 'com://admin/wufoo.model.entries');
foreach ($maps as $alias => $identifier) {
KService::setAlias($alias, $identifier);
}
$this->setLoaded(true);
}
return $this;
}
示例4: setAliases
public function setAliases()
{
if (!$this->_loaded) {
$maps = array('com://site/events.database.table.events' => 'com://admin/events.database.table.events');
foreach ($maps as $alias => $identifier) {
KService::setAlias($alias, $identifier);
}
$this->setLoaded(true);
}
return $this;
}
示例5: setAliases
public function setAliases()
{
if (!$this->_loaded) {
$maps = array();
foreach ($maps as $alias => $identifier) {
KService::setAlias($alias, $identifier);
}
$this->setLoaded(true);
}
return $this;
}
示例6: setAliases
public function setAliases()
{
if (!$this->_loaded) {
$maps = array('com://admin/users.template.helper.listbox' => 'com://admin/logman.template.helper.listbox', 'com://admin/users.template.helper.autocomplete' => 'com://admin/logman.template.helper.autocomplete');
foreach ($maps as $from => $to) {
KService::setAlias($from, $to);
}
$this->setLoaded(true);
}
return $this;
}
示例7: setAliases
public function setAliases()
{
if (!$this->_loaded) {
$loader = KService::get('koowa:loader');
if (KRequest::get('get.view', 'cmd') === 'doclink') {
$loader->loadIdentifier('com://site/docman.model.default');
}
// This is here because if we map the controller, backend view will be used instead of the frontend
$loader->loadIdentifier('com://admin/docman.controller.file');
$loader->loadIdentifier('com://admin/docman.controller.behaviors.permissions');
$loader->loadIdentifier('com://admin/default.controller.toolbars.default');
$loader->loadIdentifier('com://admin/docman.controller.toolbars.default');
$loader->loadIdentifier('com://admin/docman.model.documents');
$maps = array(
'com://site/docman.controller.doclink' => 'com://admin/docman.controller.doclink',
'com://site/docman.controller.file' => 'com://admin/docman.controller.file',
'com://site/docman.controller.behavior.aclable' => 'com://admin/docman.controller.behavior.aclable',
'com://site/docman.controller.behavior.image' => 'com://admin/docman.controller.behavior.image',
'com://site/docman.model.files' => 'com://admin/docman.model.files',
'com://site/docman.model.nodes' => 'com://admin/docman.model.nodes',
'com://site/docman.database.table.nodes' => 'com://admin/docman.database.table.nodes',
'com://site/docman.database.table.categories' => 'com://admin/docman.database.table.categories',
'com://site/docman.database.table.documents' => 'com://admin/docman.database.table.documents',
'com://site/docman.database.row.node' => 'com://admin/docman.database.row.node',
'com://site/docman.database.row.category' => 'com://admin/docman.database.row.category',
'com://site/docman.database.row.document' => 'com://admin/docman.database.row.document',
'com://site/docman.database.row.file' => 'com://admin/docman.database.row.file',
'com://site/docman.database.rowset.nodes' => 'com://admin/docman.database.rowset.nodes',
'com://site/docman.database.rowset.files' => 'com://admin/docman.database.rowset.files',
'com://site/docman.template.helper.grid' => 'com://admin/docman.template.helper.grid',
'com://site/docman.template.helper.listbox' => 'com://admin/docman.template.helper.listbox',
'com://site/docman.template.helper.toolbar' => 'com://admin/default.template.helper.toolbar',
'com://site/docman.template.helper.modal' => 'com://admin/docman.template.helper.modal',
'com://site/docman.template.filter.bootstrap' => 'com://admin/docman.template.filter.bootstrap',
'com://site/docman.template.filter.form' => 'com://admin/docman.template.filter.form',
'com://site/docman.template.filter.style' => 'com://admin/docman.template.filter.style'
);
foreach ($maps as $alias => $identifier) {
KService::setAlias($alias, $identifier);
}
$this->setLoaded(true);
}
return $this;
}
示例8: _actionDispatch
protected function _actionDispatch(KCommandContext $context)
{
if ($this->_request->routed) {
// 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_fileman.fix.the.session.bug', microtime(true));
// Use our own ACL instead of com_files'
KService::setAlias('com://admin/files.controller.behavior.executable', 'com://admin/fileman.controller.behavior.executable');
$context->result = $this->getService('com://admin/files.dispatcher')->dispatch();
return $context->result;
}
return parent::_actionDispatch($context);
}
示例9: _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;
}
}
示例10: 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));
示例11:
<?
KService::setAlias('com://site/calendar.model.events', 'com://admin/calendar.model.events');
KService::setAlias('com://site/calendar.database.table.events', 'com://admin/calendar.database.table.events');
KService::setAlias('com://site/calendar.database.table.days', 'com://admin/calendar.database.table.days');
KService::setAlias('com://site/calendar.template.helper.behavior', 'com://site/news.template.helper.behavior');
示例12:
<?php
KService::setAlias('com://site/kutafuta.model.terms', 'com://admin/kutafuta.model.terms');
KService::setAlias('com://site/kutafuta.database.row.term', 'com://admin/kutafuta.database.row.term');
echo KService::get('com://site/kutafuta.dispatcher')->dispatch();
示例13: onAfterRoute
public function onAfterRoute()
{
//map the actor helper class to a custom class PlgSystemActorhelper
KService::setAlias('com://site/actors.template.helper', 'plg://site/system.username.helper');
KService::setAlias('com://site/actors.template.helper.story', 'plg://site/system.username.story');
}
示例14: 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);
示例15: __construct
public function __construct($subject, $config = array())
{
// Turn off E_STRICT errors for now
error_reporting(error_reporting() & ~E_STRICT);
// Command line fixes for Joomla
if (PHP_SAPI === 'cli') {
if (!isset($_SERVER['HTTP_HOST'])) {
$_SERVER['HTTP_HOST'] = '';
}
if (!isset($_SERVER['REQUEST_METHOD'])) {
$_SERVER['REQUEST_METHOD'] = '';
}
}
// 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.'), 'http://www.joomlatools.com/framework-known-issues'));
return;
}
}
//Safety Extender compatibility
if (extension_loaded('safeex') && strpos('tmpl', @ini_get('safeex.url_include_proto_whitelist')) === false) {
$whitelist = @ini_get('safeex.url_include_proto_whitelist');
$whitelist = (strlen($whitelist) ? $whitelist . ',' : '') . 'tmpl';
@ini_set('safeex.url_include_proto_whitelist', $whitelist);
}
// Set pcre.backtrack_limit to a larger value
// See: https://bugs.php.net/bug.php?id=40846
if (version_compare(PHP_VERSION, '5.3.6', '<=') && @ini_get('pcre.backtrack_limit') < 1000000) {
@ini_set('pcre.backtrack_limit', 1000000);
}
//Set constants
define('KDEBUG', JDEBUG);
//Set path definitions
define('JPATH_FILES', JPATH_ROOT);
define('JPATH_IMAGES', JPATH_ROOT . DS . 'images');
//Set exception handler
set_exception_handler(array($this, 'exceptionHandler'));
// Koowa : setup
require_once JPATH_LIBRARIES . '/koowa/koowa.php';
Koowa::getInstance(array('cache_prefix' => md5(JFactory::getApplication()->getCfg('secret')) . '-cache-koowa', 'cache_enabled' => false));
KLoader::addAdapter(new KLoaderAdapterModule(array('basepath' => JPATH_BASE)));
KLoader::addAdapter(new KLoaderAdapterPlugin(array('basepath' => JPATH_ROOT)));
KLoader::addAdapter(new KLoaderAdapterComponent(array('basepath' => JPATH_BASE)));
KServiceIdentifier::addLocator(KService::get('koowa:service.locator.module'));
KServiceIdentifier::addLocator(KService::get('koowa:service.locator.plugin'));
KServiceIdentifier::addLocator(KService::get('koowa:service.locator.component'));
KServiceIdentifier::setApplication('site', JPATH_SITE);
KServiceIdentifier::setApplication('admin', JPATH_ADMINISTRATOR);
KService::setAlias('koowa:database.adapter.mysqli', 'com://admin/default.database.adapter.mysqli');
KService::setAlias('translator', 'com:default.translator');
//Setup the request
KRequest::root(str_replace('/' . JFactory::getApplication()->getName(), '', KRequest::base()));
//Load the koowa plugins
JPluginHelper::importPlugin('koowa', null, true, KService::get('com://admin/default.event.dispatcher'));
//Bugfix : Set offset accoording to user's timezone
if (!JFactory::getUser()->guest) {
if ($offset = JFactory::getUser()->getParam('timezone')) {
JFactory::getConfig()->setValue('config.offset', $offset);
}
}
// Load language files for the framework
KService::get('com:default.translator')->loadLanguageFiles();
parent::__construct($subject, $config);
}