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


PHP GeneralUtility::getApplicationContext方法代码示例

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


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

示例1: isDevelopmentApplicationContext

 /**
  * @return bool
  */
 public function isDevelopmentApplicationContext()
 {
     if (GeneralUtility::getApplicationContext()->isDevelopment()) {
         return TRUE;
     }
     return FALSE;
 }
开发者ID:blumenbach,项目名称:bb-online.neu,代码行数:10,代码来源:ApplicationContext.php

示例2: __construct

 /**
  * Constructor
  *
  * @param \TYPO3\CMS\Backend\Controller\BackendController $backendReference TYPO3 backend object reference
  * @throws \UnexpectedValueException
  */
 public function __construct(\TYPO3\CMS\Backend\Controller\BackendController &$backendReference = NULL)
 {
     $this->backendReference = $backendReference;
     $this->cacheActions = array();
     $this->optionValues = array();
     $backendUser = $this->getBackendUser();
     // Clear all page-related caches
     if ($backendUser->isAdmin() || $backendUser->getTSConfigVal('options.clearCache.pages')) {
         $this->cacheActions[] = array('id' => 'pages', 'title' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:flushPageCachesTitle', TRUE), 'description' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:flushPageCachesDescription', TRUE), 'href' => $this->backPath . 'tce_db.php?vC=' . $backendUser->veriCode() . '&cacheCmd=pages&ajaxCall=1' . BackendUtility::getUrlToken('tceAction'), 'icon' => IconUtility::getSpriteIcon('actions-system-cache-clear-impact-low'));
         $this->optionValues[] = 'pages';
     }
     // Clear cache for ALL tables!
     if ($backendUser->isAdmin() || $backendUser->getTSConfigVal('options.clearCache.all')) {
         $this->cacheActions[] = array('id' => 'all', 'title' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:flushGeneralCachesTitle', TRUE), 'description' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:flushGeneralCachesDescription', TRUE), 'href' => $this->backPath . 'tce_db.php?vC=' . $backendUser->veriCode() . '&cacheCmd=all&ajaxCall=1' . BackendUtility::getUrlToken('tceAction'), 'icon' => IconUtility::getSpriteIcon('actions-system-cache-clear-impact-medium'));
         $this->optionValues[] = 'all';
     }
     // Clearing of system cache (core cache, class cache etc)
     // is only shown explicitly if activated for a BE-user (not activated for admins by default)
     // or if the system runs in development mode
     // or if $GLOBALS['TYPO3_CONF_VARS']['SYS']['clearCacheSystem'] is set (only for admins)
     if ($backendUser->getTSConfigVal('options.clearCache.system') || GeneralUtility::getApplicationContext()->isDevelopment() || (bool) $GLOBALS['TYPO3_CONF_VARS']['SYS']['clearCacheSystem'] === TRUE && $backendUser->isAdmin()) {
         $this->cacheActions[] = array('id' => 'system', 'title' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:flushSystemCachesTitle', TRUE), 'description' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:flushSystemCachesDescription', TRUE), 'href' => $this->backPath . 'tce_db.php?vC=' . $backendUser->veriCode() . '&cacheCmd=system&ajaxCall=1' . BackendUtility::getUrlToken('tceAction'), 'icon' => IconUtility::getSpriteIcon('actions-system-cache-clear-impact-high'));
         $this->optionValues[] = 'system';
     }
     // Hook for manipulating cacheActions
     if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['additionalBackendItems']['cacheActions'])) {
         foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['additionalBackendItems']['cacheActions'] as $cacheAction) {
             $hookObject = GeneralUtility::getUserObj($cacheAction);
             if (!$hookObject instanceof \TYPO3\CMS\Backend\Toolbar\ClearCacheActionsHookInterface) {
                 throw new \UnexpectedValueException('$hookObject must implement interface TYPO3\\CMS\\Backend\\Toolbar\\ClearCacheActionsHookInterface', 1228262000);
             }
             $hookObject->manipulateCacheActions($this->cacheActions, $this->optionValues);
         }
     }
 }
开发者ID:khanhdeux,项目名称:typo3test,代码行数:41,代码来源:ClearCacheToolbarItem.php

示例3: manipulateCacheActions

 /**
  * Modifies CacheMenuItems array
  *
  * @param array $cacheActions Array of CacheMenuItems
  * @param array $optionValues Array of AccessConfigurations-identifiers (typically  used by userTS with options.clearCache.identifier)
  */
 public function manipulateCacheActions(&$cacheActions, &$optionValues)
 {
     if ($this->getBackendUser()->getTSConfigVal('options.clearCache.system') || GeneralUtility::getApplicationContext()->isDevelopment() || (bool) $GLOBALS['TYPO3_CONF_VARS']['SYS']['clearCacheSystem'] === TRUE && $this->getBackendUser()->isAdmin()) {
         $cacheActions[] = array('id' => 'dyncss', 'title' => $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:flushSystemCachesTitle', TRUE), 'description' => $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:flushSystemCachesDescription', TRUE), 'href' => BackendUtility::getModuleUrl('tce_db') . '&vC=' . $this->getBackendUser()->veriCode() . '&cacheCmd=dyncss&ajaxCall=1' . BackendUtility::getUrlToken('tceAction'), 'icon' => IconUtility::getSpriteIcon('actions-system-cache-clear-impact-high'));
         $optionValues[] = 'dyncss';
     }
 }
开发者ID:blumenbach,项目名称:bb-online.neu,代码行数:13,代码来源:ClearCacheActionsHook.php

示例4: isDevelopmentApplicationContext

 /**
  * @return bool
  */
 public function isDevelopmentApplicationContext()
 {
     if (GeneralUtility::getApplicationContext()->isDevelopment()) {
         return true;
     }
     return false;
 }
开发者ID:hensoko,项目名称:TYPO3.dyncss,代码行数:10,代码来源:ApplicationContext.php

示例5: manipulateCacheActions

 /**
  * Modifies CacheMenuItems array
  *
  * @param array $cacheActions Array of CacheMenuItems
  * @param array $optionValues Array of AccessConfigurations-identifiers (typically  used by userTS with options.clearCache.identifier)
  *
  * @return void
  */
 public function manipulateCacheActions(&$cacheActions, &$optionValues)
 {
     if ($this->getBackendUser()->getTSConfigVal('options.clearCache.system') || GeneralUtility::getApplicationContext()->isDevelopment() || (bool) $GLOBALS['TYPO3_CONF_VARS']['SYS']['clearCacheSystem'] === TRUE && $this->getBackendUser()->isAdmin()) {
         $cacheActions[] = array('id' => 'dyncss', 'title' => $this->getLanguageService()->sL('LLL:EXT:dyncss/Resources/Private/Language/locallang.xlf:dyncss.toolbar.clearcache.title', TRUE), 'description' => $this->getLanguageService()->sL('LLL:EXT:dyncss/Resources/Private/Language/locallang.xlf:dyncss.toolbar.clearcache.description', TRUE), 'href' => BackendUtility::getModuleUrl('tce_db') . '&vC=' . $this->getBackendUser()->veriCode() . '&cacheCmd=dyncss&ajaxCall=1' . BackendUtility::getUrlToken('tceAction'), 'icon' => IconUtility::getSpriteIcon('extensions-dyncss-lightning-blue'));
         $optionValues[] = 'dyncss';
     }
 }
开发者ID:johannessteu,项目名称:TYPO3.dyncss,代码行数:15,代码来源:ClearCacheActionsHook.php

示例6: __construct

 /**
  * Constructor
  *
  * @throws \UnexpectedValueException
  */
 public function __construct()
 {
     $backendUser = $this->getBackendUser();
     $languageService = $this->getLanguageService();
     $this->iconFactory = GeneralUtility::makeInstance(IconFactory::class);
     $this->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Backend/Toolbar/ClearCacheMenu');
     // Clear all page-related caches
     if ($backendUser->isAdmin() || $backendUser->getTSConfigVal('options.clearCache.pages')) {
         $this->cacheActions[] = array('id' => 'pages', 'title' => $languageService->sL('LLL:EXT:lang/locallang_core.xlf:flushPageCachesTitle', true), 'description' => $languageService->sL('LLL:EXT:lang/locallang_core.xlf:flushPageCachesDescription', true), 'href' => BackendUtility::getModuleUrl('tce_db', ['vC' => $backendUser->veriCode(), 'cacheCmd' => 'pages', 'ajaxCall' => 1]), 'icon' => $this->iconFactory->getIcon('actions-system-cache-clear-impact-low', Icon::SIZE_SMALL)->render());
         $this->optionValues[] = 'pages';
     }
     // Clear cache for ALL tables!
     if ($backendUser->isAdmin() || $backendUser->getTSConfigVal('options.clearCache.all')) {
         $this->cacheActions[] = array('id' => 'all', 'title' => $languageService->sL('LLL:EXT:lang/locallang_core.xlf:flushGeneralCachesTitle', true), 'description' => $languageService->sL('LLL:EXT:lang/locallang_core.xlf:flushGeneralCachesDescription', true), 'href' => BackendUtility::getModuleUrl('tce_db', ['vC' => $backendUser->veriCode(), 'cacheCmd' => 'all', 'ajaxCall' => 1]), 'icon' => $this->iconFactory->getIcon('actions-system-cache-clear-impact-medium', Icon::SIZE_SMALL)->render());
         $this->optionValues[] = 'all';
     }
     // Clearing of system cache (core cache, class cache etc)
     // is only shown explicitly if activated for a BE-user (not activated for admins by default)
     // or if the system runs in development mode
     // or if $GLOBALS['TYPO3_CONF_VARS']['SYS']['clearCacheSystem'] is set (only for admins)
     if ($backendUser->getTSConfigVal('options.clearCache.system') || GeneralUtility::getApplicationContext()->isDevelopment() || (bool) $GLOBALS['TYPO3_CONF_VARS']['SYS']['clearCacheSystem'] === true && $backendUser->isAdmin()) {
         $this->cacheActions[] = array('id' => 'system', 'title' => $languageService->sL('LLL:EXT:lang/locallang_core.xlf:flushSystemCachesTitle', true), 'description' => $languageService->sL('LLL:EXT:lang/locallang_core.xlf:flushSystemCachesDescription', true), 'href' => BackendUtility::getModuleUrl('tce_db', ['vC' => $backendUser->veriCode(), 'cacheCmd' => 'system', 'ajaxCall' => 1]), 'icon' => $this->iconFactory->getIcon('actions-system-cache-clear-impact-high', Icon::SIZE_SMALL)->render());
         $this->optionValues[] = 'system';
     }
     // Hook for manipulating cacheActions
     if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['additionalBackendItems']['cacheActions'])) {
         foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['additionalBackendItems']['cacheActions'] as $cacheAction) {
             $hookObject = GeneralUtility::getUserObj($cacheAction);
             if (!$hookObject instanceof ClearCacheActionsHookInterface) {
                 throw new \UnexpectedValueException('$hookObject must implement interface ' . ClearCacheActionsHookInterface::class, 1228262000);
             }
             $hookObject->manipulateCacheActions($this->cacheActions, $this->optionValues);
         }
     }
 }
开发者ID:graurus,项目名称:testgit_t37,代码行数:40,代码来源:ClearCacheToolbarItem.php

示例7: render

 /**
  * JavaScript file to load
  *
  * @param string $file
  * @param bool $canBeMinified
  */
 public function render($file, $canBeMinified = false)
 {
     // Sipped minified file in Production context.
     if ($canBeMinified && (string) GeneralUtility::getApplicationContext() === 'Production') {
         $file = str_replace('.js', '.min.js', $file);
     }
     $this->getPageRenderer()->addJsFooterFile($file);
 }
开发者ID:visol,项目名称:ext-votable,代码行数:14,代码来源:ScriptViewHelper.php

示例8: addDebugInfoToBody

 /**
  * Get a body message when email is not in production.
  *
  * @param string $messageBody
  * @return string
  */
 protected function addDebugInfoToBody($messageBody)
 {
     $to = $this->getTo();
     $cc = $this->getCc();
     $bcc = $this->getBcc();
     $messageBody = sprintf("%s CONTEXT: this message is for testing purposes. In Production, it will be sent as follows. \nto: %s\n%s%s\n%s", strtoupper((string) GeneralUtility::getApplicationContext()), implode(',', array_keys($to)), empty($cc) ? '' : sprintf("cc: %s \n", implode(',', array_keys($cc))), empty($bbc) ? '' : sprintf("bcc: %s \n", implode(',', array_keys($bcc))), $messageBody);
     return $messageBody;
 }
开发者ID:Ecodev,项目名称:formule,代码行数:14,代码来源:MailMessage.php

示例9: setUp

 /**
  * Set up
  */
 protected function setUp()
 {
     require_once 'Fixtures/ConditionMatcherUserFuncs.php';
     $this->backupApplicationContext = GeneralUtility::getApplicationContext();
     $this->conditionMatcher = $this->getMockForAbstractClass(AbstractConditionMatcher::class);
     $this->evaluateConditionCommonMethod = new \ReflectionMethod(AbstractConditionMatcher::class, 'evaluateConditionCommon');
     $this->evaluateConditionCommonMethod->setAccessible(TRUE);
 }
开发者ID:plan2net,项目名称:TYPO3.CMS,代码行数:11,代码来源:AbstractConditionMatcherTest.php

示例10: setUp

 /**
  * Set up
  *
  * This setUp() does not call its parent implementation to avoid database cleaning
  *
  * @return void
  */
 protected function setUp()
 {
     if (!(in_array(GeneralUtility::getApplicationContext(), $this->allowedApplicationContexts) || in_array($_SERVER['HOSTNAME'], $this->allowedDomains) || in_array($_SERVER['HTTP_HOST'], $this->allowedDomains))) {
         $this->markTestSkipped(sprintf('This test is only allowed in contexts "%s" or on domains "%s"', implode(', ', $this->allowedApplicationContexts), implode(', ', $this->allowedDomains)));
     }
     $fixtureImporter = GeneralUtility::makeInstance('Tx_PtExtbase_Testing_FixtureFramework_FixtureImporter');
     /** @var Tx_PtExtbase_Testing_FixtureFramework_FixtureImporter $fixtureImporter */
     $fixtureImporter->import($this->getFixtures());
 }
开发者ID:punktde,项目名称:pt_extbase,代码行数:16,代码来源:DatabaseTestCase.php

示例11: configureAll

 public static function configureAll()
 {
     if (!preg_match('#/Heroku$#', GeneralUtility::getApplicationContext())) {
         return;
     }
     static::configureDatabase();
     static::configureSessionStorage();
     static::relaxBackendIpRestriction();
 }
开发者ID:cedricziel,项目名称:typo3-cloudoconfiguration,代码行数:9,代码来源:HerokuAutoConfiguration.php

示例12: getPriority

 /**
  * If context is set to production, priority
  * of this preset is raised.
  *
  * @return int Priority of preset
  */
 public function getPriority()
 {
     $context = \TYPO3\CMS\Core\Utility\GeneralUtility::getApplicationContext();
     $priority = $this->priority;
     if ($context->isProduction()) {
         $priority = $priority + 20;
     }
     return $priority;
 }
开发者ID:TYPO3Incubator,项目名称:TYPO3.CMS,代码行数:15,代码来源:LivePreset.php

示例13: connect

 protected function connect()
 {
     // Load system specific configuration for Apache mode
     $dpppConfiguration = __DIR__ . '/../../../../../../configurations/' . GeneralUtility::getApplicationContext() . '/AdditionalConfiguration.php';
     if (file_exists($dpppConfiguration)) {
         @(include $dpppConfiguration);
     }
     $credentials = $GLOBALS['TYPO3_CONF_VARS']['DB'];
     $this->mySQLConnection = new \PDO('mysql:host=' . $credentials['host'] . ';dbname=' . $credentials['database'], $credentials['username'], $credentials['password']);
 }
开发者ID:punktde,项目名称:pt_extbase,代码行数:10,代码来源:MySqlLockTestSecondInstance.php

示例14: render

 /**
  * @throws \TYPO3\CMS\Fluid\Core\ViewHelper\Exception\InvalidVariableException
  * @return string
  */
 public function render()
 {
     $redirectTo = $this->getRedirectService()->redirectionForCurrentContext();
     $output = '';
     // Means we want to redirect email.
     if (!empty($redirectTo)) {
         $contentElement = $this->templateVariableContainer->get('contentElement');
         $settings = $this->getFlexFormService()->extractSettings($contentElement['pi_flexform']);
         $to = $this->getEmailAddressService()->parse($settings['emailAdminTo']);
         #$cc = $this->getEmailAddressService()->parse($settings['emailAdminCc']);
         #$bcc = $this->getEmailAddressService()->parse($settings['emailAdminBcc']);
         $templateService = $this->getTemplateService($settings['template']);
         $output = sprintf("<pre style='clear: both'>%s CONTEXT<br /> %s %s %s %s %s</pre>", strtoupper((string) GeneralUtility::getApplicationContext()), $this->hasEmails($settings) ? '<br />- All emails will be redirected to ' . implode(', ', array_keys($redirectTo)) . '.' : '', empty($to) ? '' : '<br />- Admin email will be sent to: ' . implode(', ', array_keys($to)), empty($settings['emailUserTo']) ? '' : '<br/>- User email will be sent using the field "' . $settings['emailUserTo'] . '"', $this->isSenderOk($settings) ? '' : '<br/>- ATTENTION! No sender could be found. This will be a problem when sending emails.', $templateService->hasPersistingTable() ? '<br/>- Submitted data will be persisted into "' . $templateService->getPersistingTable() . '"' : '');
     }
     return $output;
 }
开发者ID:Ecodev,项目名称:formule,代码行数:20,代码来源:DevelopmentViewHelper.php

示例15: sendMailToWinkel

 /**
  * @param $subject
  * @param $message
  */
 public static function sendMailToWinkel($subject, $message)
 {
     $isDev = GeneralUtility::getApplicationContext()->isDevelopment();
     if ($isDev === false) {
         /* @var \TYPO3\CMS\Core\Mail\MailMessage */
         $mail = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Mail\\MailMessage');
         $mail->setFrom(array('noreply@winkel.de' => 'WINKEL GmbH'));
         $mail->setTo(array('komponentenanfrage@winkel.de' => 'Produktanfrage'));
         $mail->setSubject($subject);
         $mail->setBody($message);
         //        if ($_FILES['tx_winkelproducts_pi1']['name']['flangeplate-pdf'] != '') {
         //            $attachment = Swift_Attachment::fromPath($fileName, $mimeType);
         //            $attachment->setFilename($_FILES['tx_winkelproducts_pi1']['name']['flangeplate-pdf']);
         //            $mail->attach($attachment);
         //        }
         $mail->send();
     }
 }
开发者ID:raimundlandig,项目名称:winkel.de-DEV,代码行数:22,代码来源:SendMail.php


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