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


PHP Environment::getContext方法代码示例

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


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

示例1: cacheDomainForActiveRequest

 /**
  * @Flow\Around("method(TYPO3\Neos\Domain\Repository\DomainRepository->findOneByActiveRequest())")
  * @param \TYPO3\Flow\Aop\JoinPointInterface $joinPoint The current join point
  * @return mixed
  */
 public function cacheDomainForActiveRequest(JoinPointInterface $joinPoint)
 {
     if ($this->domainForActiveRequest === FALSE || $this->environment->getContext()->isTesting()) {
         $domain = $joinPoint->getAdviceChain()->proceed($joinPoint);
         $this->domainForActiveRequest = $domain;
     }
     return $this->domainForActiveRequest;
 }
开发者ID:radmiraal,项目名称:neos-development-collection,代码行数:13,代码来源:SiteRepositoryCachingAspect.php

示例2: initializeAction

 /**
  * Initializes the controller
  */
 protected function initializeAction()
 {
     $context = $this->env->getContext();
     if ($context == 'Development') {
         $this->context = 'DEV';
     } else {
         $this->context = 'PRD';
     }
 }
开发者ID:randomresult,项目名称:WMDB.Forger,代码行数:12,代码来源:StandardController.php

示例3: handle

 /**
  * Handle an exception depending on the context with an HTML message or XML comment
  *
  * @param array $typoScriptPath path causing the exception
  * @param \Exception $exception exception to handle
  * @param integer $referenceCode
  * @return string
  */
 protected function handle($typoScriptPath, \Exception $exception, $referenceCode)
 {
     $context = $this->environment->getContext();
     if ($context->isDevelopment()) {
         $handler = new HtmlMessageHandler();
     } else {
         $handler = new XmlCommentHandler();
     }
     $handler->setRuntime($this->getRuntime());
     return $handler->handleRenderingException($typoScriptPath, $exception);
 }
开发者ID:radmiraal,项目名称:neos-development-collection,代码行数:19,代码来源:ContextDependentHandler.php

示例4: initializeAction

 /**
  * Initializes the controller
  */
 protected function initializeAction()
 {
     $context = $this->env->getContext();
     if ($context == 'Development') {
         $this->context = 'DEV';
     } else {
         $this->context = 'PRD';
     }
     $this->connection = new Es\ElasticSearchConnection();
     $this->connection->init();
 }
开发者ID:randomresult,项目名称:WMDB.Forger,代码行数:14,代码来源:ManagementController.php

示例5: initializeAction

 /**
  * Initializes the controller
  */
 protected function initializeAction()
 {
     date_default_timezone_set('UTC');
     $context = $this->env->getContext();
     if ($context == 'Development') {
         $this->context = 'DEV';
     } else {
         $this->context = 'PRD';
     }
     $this->connection = new Es\ElasticSearchConnection();
     $this->connection->init();
     $this->sprintConfig = $this->ConfigurationManager->getConfiguration('Sprints');
 }
开发者ID:randomresult,项目名称:WMDB.Forger,代码行数:16,代码来源:SprintController.php

示例6: initializeAction

 protected function initializeAction()
 {
     date_default_timezone_set('UTC');
     $this->connection = new Es\ElasticSearchConnection();
     $this->connection->init();
     $context = $this->env->getContext();
     if ($context == 'Development') {
         $this->context = 'DEV';
     } else {
         $this->context = 'PRD';
     }
     if (isset($_GET['page'])) {
         $this->currentPage = intval($_GET['page']);
     }
 }
开发者ID:randomresult,项目名称:WMDB.Forger,代码行数:15,代码来源:GerritController.php

示例7: verifyAuthentication

 /**
  * Verifies the authentication token.
  *
  * @param string $authenticationHash
  * @param string $parameters
  *
  */
 private function verifyAuthentication($authenticationHash, $parameters)
 {
     if (md5($this->settings['webserviceKey'] . $parameters) == $authenticationHash || $this->environment->getContext() == 'Development') {
         return TRUE;
     }
     return FALSE;
 }
开发者ID:sdrech,项目名称:example_quiz,代码行数:14,代码来源:ServiceController.php

示例8: handle

 /**
  * renders the exception to nice html content element to display, edit, remove, ...
  *
  * @param string $typoScriptPath - path causing the exception
  * @param \Exception $exception - exception to handle
  * @param integer $referenceCode - might be unset
  * @return string
  */
 protected function handle($typoScriptPath, \Exception $exception, $referenceCode)
 {
     $handler = new ContextDependentHandler();
     $handler->setRuntime($this->runtime);
     $output = $handler->handleRenderingException($typoScriptPath, $exception);
     $currentContext = $this->getRuntime()->getCurrentContext();
     if (isset($currentContext['node'])) {
         /** @var NodeInterface $node */
         $node = $currentContext['node'];
         $applicationContext = $this->environment->getContext();
         if ($applicationContext->isProduction() && $this->privilegeManager->isPrivilegeTargetGranted('TYPO3.Neos:Backend.GeneralAccess') && $node->getContext()->getWorkspaceName() !== 'live') {
             $output = '<div class="neos-rendering-exception"><div class="neos-rendering-exception-title">Failed to render element' . $output . '</div></div>';
         }
         return $this->contentElementWrappingService->wrapContentObject($node, $output, $typoScriptPath);
     }
     return $output;
 }
开发者ID:robertlemke,项目名称:neos-development-collection,代码行数:25,代码来源:NodeWrappingHandler.php

示例9: extractMetadata

 /**
  * Extract metadata from the content and store it
  *
  * @param string $entryIdentifier The entry identifier
  * @param string $content The raw content including serialized metadata
  * @return string The content without metadata
  * @throws InvalidDataException
  */
 protected function extractMetadata($entryIdentifier, $content)
 {
     $separatorIndex = strpos($content, self::SEPARATOR);
     if ($separatorIndex === FALSE) {
         $exception = new InvalidDataException('Could not find cache metadata in entry with identifier ' . $entryIdentifier, 1433155925);
         if ($this->environment->getContext()->isProduction()) {
             $this->systemLogger->logException($exception);
         } else {
             throw $exception;
         }
     }
     $metadataJson = substr($content, 0, $separatorIndex);
     $metadata = json_decode($metadataJson, TRUE);
     if ($metadata === NULL) {
         $exception = new InvalidDataException('Invalid cache metadata in entry with identifier ' . $entryIdentifier, 1433155926);
         if ($this->environment->getContext()->isProduction()) {
             $this->systemLogger->logException($exception);
         } else {
             throw $exception;
         }
     }
     $this->metadata[$entryIdentifier] = $metadata;
     return substr($content, $separatorIndex + 1);
 }
开发者ID:johannessteu,项目名称:MOC.Varnish,代码行数:32,代码来源:MetadataAwareStringFrontend.php

示例10: hasFrozenCacheInProduction

 /**
  * @return boolean
  */
 protected function hasFrozenCacheInProduction()
 {
     return $this->environment->getContext()->isProduction() && $this->reflectionDataRuntimeCache->getBackend()->isFrozen();
 }
开发者ID:mkeitsch,项目名称:flow-development-collection,代码行数:7,代码来源:ReflectionService.php

示例11: initializeView

 /**
  * Initializes the view with common variables.
  *
  * @param \TYPO3\Flow\Mvc\View\ViewInterface $view
  * @return void
  */
 protected function initializeView(\TYPO3\Flow\Mvc\View\ViewInterface $view)
 {
     // We don't need to do all this for json responses.
     if ($this->request->hasArgument('json')) {
         return;
     }
     // Are user an Editor?
     $isEditor = 0;
     if ($this->securityContext->hasRole('_OurBrand_.Business:worker')) {
         $isEditor = 1;
     }
     // Are user an Admin?
     $isAdmin = 0;
     if ($this->currentUser->isAdministrator()) {
         $isAdmin = 1;
     }
     $inDev = 0;
     if (strstr($_SERVER['HTTP_HOST'], '.local')) {
         $inDev = 1;
     }
     // Get file stamp
     $fileStamp = time();
     if ($this->environment->getContext() == 'Production' && file_exists(FLOW_PATH_ROOT . 'Data/Temporary/Production/Configuration/ProductionConfigurations.php')) {
         $fileStamp = @filemtime(FLOW_PATH_ROOT . 'Data/Temporary/Production/Configuration/ProductionConfigurations.php');
     }
     // Exercise categories
     $exerciseCategoryRepository = new \_OurBrand_\Quiz\Domain\Repository\ExerciseCategoryRepository();
     $exerciseCategories = $exerciseCategoryRepository->findAll();
     $subjectRepository = new \_OurBrand_\Quiz\Domain\Repository\SubjectRepository();
     $this->view->assign('archiveUri', $this->getArchiveUri());
     $this->view->assign('UIPath', $this->settings['UIPath']);
     $this->view->assign('isEditor', $isEditor);
     $this->view->assign('isAdmin', $isAdmin);
     $this->view->assign('inDev', $inDev);
     $this->view->assign('logintime', $fileStamp);
     // When was system updated?
     $this->view->assign('exerciseCategories', $exerciseCategories);
     $this->view->assign('user', $this->currentUser);
     if ($this->request->hasArgument('exercise') || $this->request->hasArgument('currentExercise')) {
         $exercise = $this->getExerciseFromArgument();
         if (is_a($exercise, '\\_OurBrand_\\Quiz\\Domain\\Model\\Exercise')) {
             // Set type
             $objectName = explode('\\', get_class($exercise));
             $exerciseType = $this->exerciseTypeRepository->findOneByObjectName(array_pop($objectName));
             $exercise->setType($exerciseType);
             $durations = $this->getDurationsForExercise($this->settings['exercise']['durations']);
             $this->view->assign('editExerciseDurations', $durations);
             $this->view->assign('editExerciseCategories', $this->getExerciseCategories($exercise));
             $this->view->assign('editExerciseDifficulties', $this->getDifficultiesForExercise());
             $this->view->assign('previewExerciseDuration', $this->getExerciseDurationLabel($exercise));
             $this->view->assign('previewExerciseSkill', $this->getExerciseSkillLabel($exercise));
             $this->view->assign('previewExerciseDifficulty', $this->getExerciseDifficultyLabel($exercise));
             $this->view->assign('previewExerciseIsHintSet', $exercise->getHint() != '' ? 1 : 0);
             $this->view->assign('previewExerciseIsExplanationSet', $exercise->getExplanation() != '' ? 1 : 0);
             $this->view->assign('subjectOptions', $subjectRepository->findAll());
             $this->view->assign('subjectPlaceholder', $this->translateById('quiz.placeholder.subject'));
         }
         $quiz = $exercise->getQuiz();
     } else {
         if ($this->request->hasArgument('quiz')) {
             $quiz = $this->getQuizFromArgument();
         }
     }
     // Get/Set duration.
     $duration = 0;
     if (isset($quiz) && is_a($quiz, '\\_OurBrand_\\Quiz\\Domain\\Model\\Quiz')) {
         $duration = $quiz->getDuration();
     }
     $this->view->assign('duration', gmdate("H:i", $duration));
 }
开发者ID:sdrech,项目名称:example_quiz,代码行数:76,代码来源:AbstractController.php

示例12: initialize

 /**
  * Initialize the reflection service lazily
  *
  * This method must be run only after all dependencies have been injected.
  *
  * @return void
  */
 protected function initialize()
 {
     $this->context = $this->environment->getContext();
     if ($this->context->isProduction() && $this->reflectionDataRuntimeCache->getBackend()->isFrozen()) {
         $this->classReflectionData = $this->reflectionDataRuntimeCache->get('__classNames');
         $this->annotatedClasses = $this->reflectionDataRuntimeCache->get('__annotatedClasses');
         $this->loadFromClassSchemaRuntimeCache = true;
     } else {
         $this->loadClassReflectionCompiletimeCache();
     }
     $this->annotationReader = new AnnotationReader();
     foreach ($this->settings['reflection']['ignoredTags'] as $tagName => $ignoreFlag) {
         // Make this setting backwards compatible with old array schema (deprecated since 3.0)
         if (is_numeric($tagName) && is_string($ignoreFlag)) {
             AnnotationReader::addGlobalIgnoredName($ignoreFlag);
         }
         if ($ignoreFlag === true) {
             AnnotationReader::addGlobalIgnoredName($tagName);
         }
     }
     AnnotationRegistry::registerLoader([$this->classLoader, 'loadClass']);
     $this->initialized = true;
 }
开发者ID:kszyma,项目名称:flow-development-collection,代码行数:30,代码来源:ReflectionService.php

示例13: initializeServeAction

 public function initializeServeAction()
 {
     if ($this->environment->getContext()->isDevelopment()) {
         $this->targetDirectory = 'app';
     }
 }
开发者ID:HofUniversityIWS,项目名称:backend,代码行数:6,代码来源:FrontendController.php

示例14: initialize

 /**
  * Initialize the reflection service lazily
  *
  * This method must be run only after all dependencies have been injected.
  *
  * @return void
  */
 protected function initialize()
 {
     $this->context = $this->environment->getContext();
     if ($this->context->isProduction() && $this->reflectionDataRuntimeCache->getBackend()->isFrozen()) {
         $this->classReflectionData = $this->reflectionDataRuntimeCache->get('__classNames');
         $this->annotatedClasses = $this->reflectionDataRuntimeCache->get('__annotatedClasses');
         $this->loadFromClassSchemaRuntimeCache = TRUE;
     } else {
         $this->loadClassReflectionCompiletimeCache();
     }
     $this->annotationReader = new AnnotationReader();
     foreach ($this->settings['reflection']['ignoredTags'] as $tag) {
         AnnotationReader::addGlobalIgnoredName($tag);
     }
     AnnotationRegistry::registerLoader(array($this->classLoader, 'loadClass'));
     $this->initialized = TRUE;
 }
开发者ID:animaltool,项目名称:webinterface,代码行数:24,代码来源:ReflectionService.php


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