本文整理汇总了PHP中CBLib\Application\Application::DI方法的典型用法代码示例。如果您正苦于以下问题:PHP Application::DI方法的具体用法?PHP Application::DI怎么用?PHP Application::DI使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CBLib\Application\Application
的用法示例。
在下文中一共展示了Application::DI方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: die
<?php
/**
* Community Builder (TM)
* @version $Id: $
* @package CommunityBuilder
* @copyright (C) 2004-2016 www.joomlapolis.com / Lightning MultiCom SA - and its licensors, all rights reserved
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU/GPL version 2
*/
// ensure this file is being included by a parent file
if (!(defined('_VALID_CB') || defined('_JEXEC') || defined('_VALID_MOS'))) {
die('Direct Access to this location is not allowed.');
}
// Auto-load and initialize everything that was in here:
/** @see CB\Legacy\LegacyComprofilerFunctions */
\CBLib\Application\Application::DI()->get('CB\\Legacy\\LegacyComprofilerFunctions');
/**
* The classes that were in here have moved to libraries/CBLib/CB/Legacy folder.
* The functions in here have moved to libraries/CBLib/CB/Legacy/LegacyComprofilerFunctions.php
*/
示例2: registerXml
private static function registerXml($action, $actionType)
{
global $_PLUGINS;
$di = Application::DI();
$extensionPath = $_PLUGINS->getPluginPath();
/** @var \CBLib\AhaWow\AutoLoaderXml $autoLoaderXml::_construct() */
$autoLoaderXml = $di->get('CBLib\\AhaWow\\AutoLoaderXml');
$autoLoaderXml->registerMap('com_comprofiler/' . $action . '/' . $actionType, $extensionPath . '/xml/edit.front.' . preg_replace('/[^A-Za-z0-9_\\.-]/', '', $actionType) . '.xml');
}
示例3: __construct
/**
* Constructor
*
* @param InputInterface $input The user form input
* @param SimpleXMLElement $controllerModel The model of the controller
* @param array $options The routing options
* @param RegistryInterface $pluginParams The parameters of the plugin
* @param SimpleXMLElement $types The types definitions in XML
* @param SimpleXMLElement $actions The actions definitions in XML
* @param SimpleXMLElement $views The views definitions in XML
* @param PluginTable $pluginObject The plugin object
* @param int $tabId The tab id (if there is one)
* @param DatabaseDriverInterface $db The tab id (if there is one)
* @param RegistryEditView $registryEditVew The Registry Edit View (the calling object)
*/
public function __construct(InputInterface $input, SimpleXMLElement $controllerModel, $options, RegistryInterface $pluginParams, SimpleXMLElement $types, SimpleXMLElement $actions, SimpleXMLElement $views, PluginTable $pluginObject = null, $tabId = null, DatabaseDriverInterface $db, RegistryEditView $registryEditVew)
{
$this->input = $input;
$this->state = Application::DI()->get('CBLib\\Session\\SessionStateInterface', array('input' => $this->input));
$this->_tableBrowserModel = $controllerModel;
$this->_options = $options;
$this->_pluginParams = $pluginParams;
$this->_types = $types;
$this->_actions = $actions;
$this->_views = $views;
$this->_pluginObject = $pluginObject;
$this->_tabid = $tabId;
$this->_db = $db;
$this->registryEditVew = $registryEditVew;
}
示例4: handleAction
/**
* Handles a request with a route to the controller action
*
* @param array $route Ordered Route array with at least option, view, ..., method (where method is view, edit, apply, save)
* @return string
*
* @throws \LogicException
*/
public function handleAction(array $route)
{
$option = $route['option'];
$view = $route['view'];
$method = $route['method'];
if (!$method) {
$method = isset($route['act']) ? $route['act'] : 'edit';
}
$frontOrAdmin = $this->clientId == 1 ? 'admin' : 'front';
/** @var AutoLoaderXml $autoLoaderXml */
$autoLoaderXml = Application::DI()->get('CBLib\\AhaWow\\AutoLoaderXml');
$element = $autoLoaderXml->loadXML($route);
if ($element) {
if ($view === null) {
$adminActionsModel = $element->getChildByNameAttr('actions', 'ui', $frontOrAdmin);
if ($adminActionsModel) {
$defaultAction = $adminActionsModel->getChildByNameAttr('action', 'name', 'default');
$actionRequest = $defaultAction->attributes('request');
$actionAction = $defaultAction->attributes('action');
if ($actionRequest === '') {
$view = $actionAction;
}
}
}
return $this->drawView($option, $view, $element, $method);
}
throw new \LogicException('No route found for this request.', 404);
}
示例5: loadLegacyCBueConfig
//.........这里部分代码省略.........
* It also loads the Language handler powering CBTxt.
*
* @param boolean $legacy prepare legacy config params
* @return void
*/
public static function loadLegacyCBueConfig($legacy = false)
{
global $ueConfig;
if (self::$configReady) {
$version = $ueConfig['version'];
$config = Application::Config();
$ueConfig = $config->asArray();
$ueConfig['version'] = $version;
// Legacy config options for B/C:
if ($legacy) {
if (isset($ueConfig['profile_viewaccesslevel'])) {
switch ((int) $ueConfig['profile_viewaccesslevel']) {
case 1:
// Public
// Public
case 5:
// Guest
$profileAccess = '1';
// Public
break;
case 3:
// Special
$profileAccess = '3';
// Author
break;
default:
$profileAccess = '2';
// Registered
break;
}
} else {
$profileAccess = '2';
// Registered
}
if (isset($ueConfig['moderator_viewaccesslevel'])) {
switch ((int) $ueConfig['moderator_viewaccesslevel']) {
case 1:
// Public
// Public
case 5:
// Guest
$modAccess = '1';
// Public
break;
case 2:
// Registered
$modAccess = '2';
// Registered
break;
default:
$modAccess = '6';
// Manager
break;
}
} else {
$modAccess = '6';
// Manager
}
$ueConfig['allow_profileviewbyGID'] = $profileAccess;
// "Allow Access To:"
$ueConfig['imageApproverGid'] = $modAccess;
// "Moderator Groups"
$ueConfig['reg_email_checker'] = '0';
// "Ajax Email checker"
$ueConfig['reg_toc_url'] = '';
// "URL to Terms & Conditions"
$ueConfig['num_per_page'] = '30';
// "Users Per Page"
$ueConfig['allow_profilelink'] = '1';
// "Allow Link to Profile"
$ueConfig['nesttabs'] = '0';
// "Nest Tabs"
$ueConfig['xhtmlComply'] = '1';
// "W3C XHTML 1.0 Trans. compliance"
$ueConfig['im_path'] = 'auto';
// "Path to ImageMagick"
$ueConfig['netpbm_path'] = 'auto';
// "Path to NetPBM"
$ueConfig['allowAvatar'] = '1';
// "Image"
$ueConfig['allowAvatarUpload'] = '1';
// "Allow Image Upload"
$ueConfig['allowAvatarGallery'] = '1';
// "Use Image Gallery"
}
$languageParams = array('debugMode' => $config->get('translations_debug', 0));
if ($languageParams['debugMode'] == 0) {
$languageParams['translationsLogger'] = null;
}
} else {
$languageParams = array();
}
// Set Language as singleton and instantiate it now that Config is read:
Application::DI()->get('Language', $languageParams);
}
示例6: editPluginView
/**
* Outputs legacy plugin views
*
* @deprecated 2.0 Use XML
*
* @param PluginTable $row
* @param string $option
* @param string $task
* @param int $uid
* @param string $action
* @param SimpleXMLElement $element
* @param string $mode
* @param Registry $pluginParams
* @return mixed|null
*/
public function editPluginView($row, $option, $task, $uid, $action, $element, $mode, $pluginParams)
{
global $_CB_framework, $_CB_database, $_PLUGINS;
if (!$row->id) {
$_CB_framework->enqueueMessage(CBTxt::T('Plugin id not found.'), 'error');
return null;
}
if (!$element) {
$_CB_framework->enqueueMessage(CBTxt::T('No plugin XML found.'), 'error');
return null;
}
$adminHandlerModel = $element->getChildByNameAttr('handler', 'ui', 'admin');
if (!$adminHandlerModel || $row->element == 'cbpaidsubscriptions') {
$adminActionsModel = $element->getChildByNameAttr('actions', 'ui', 'admin');
if ($adminActionsModel) {
// New CB 2.0 method:
$savedPluginId = $_PLUGINS->_loading;
$_PLUGINS->_loading = (int) $row->id;
/** @var ActionController $actionController */
/** @see CBLib\AhaWow\Controller\ActionController::__construct() */
$actionController = Application::DI()->get('CBLib\\AhaWow\\Controller\\ActionController');
$actionController->setData($row);
$displayMode = $mode == 'applyPlugin' ? 'apply' : ($mode == 'savePlugin' ? 'save' : 'edit');
echo $actionController->drawView($option, null, $element, $displayMode);
$_PLUGINS->_loading = $savedPluginId;
return null;
} else {
return null;
}
}
$class = $adminHandlerModel->attributes('class');
if ($class) {
if (!class_exists($class)) {
$_CB_framework->enqueueMessage(CBTxt::T('ADMIN_HANDLER_CLASS_CLASS_DOES_NOT_EXIST', 'Admin handler class [class] does not exist.', array('[class]' => $class)), 'error');
return null;
}
$handler = new $class($_CB_database);
/** @var stdClass|CBController_plugin|cbpaidAdminView $handler */
return $handler->editPluginView($row, $option, $task, $uid, $action, $element, $mode, $pluginParams);
} else {
// new method in CB 1.2.3:
$args = array(&$row, $option, $task, $uid, $action, &$element, $mode, &$pluginParams);
return $_PLUGINS->call($row->id, 'editPluginView', 'get' . $row->element . 'Tab', $args, null, true);
}
}