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


PHP GeneralUtility::makeInstance方法代码示例

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


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

示例1: getExtensionSummary

 /**
  * Returns information about this extension plugin
  *
  * @param array $params Parameters to the hook
  *
  * @return string Information about pi1 plugin
  * @hook TYPO3_CONF_VARS|SC_OPTIONS|cms/layout/class.tx_cms_layout.php|list_type_Info|calendarize_calendar
  */
 public function getExtensionSummary(array $params)
 {
     $relIconPath = GeneralUtility::getIndpEnv('TYPO3_SITE_URL') . ExtensionManagementUtility::siteRelPath('calendarize') . 'ext_icon.png';
     $this->flexFormService = GeneralUtility::makeInstance('HDNET\\Calendarize\\Service\\FlexFormService');
     $this->layoutService = GeneralUtility::makeInstance('HDNET\\Calendarize\\Service\\ContentElementLayoutService');
     $this->layoutService->setTitle('<img src="' . $relIconPath . '" /> Calendarize');
     if ($params['row']['list_type'] != 'calendarize_calendar') {
         return '';
     }
     $this->flexFormService->load($params['row']['pi_flexform']);
     if (!$this->flexFormService->isValid()) {
         return '';
     }
     $actions = $this->flexFormService->get('switchableControllerActions', 'main');
     $parts = GeneralUtility::trimExplode(';', $actions, true);
     $parts = array_map(function ($element) {
         $split = explode('->', $element);
         return ucfirst($split[1]);
     }, $parts);
     $actionKey = lcfirst(implode('', $parts));
     $this->layoutService->addRow(LocalizationUtility::translate('mode', 'calendarize'), LocalizationUtility::translate('mode.' . $actionKey, 'calendarize'));
     $this->layoutService->addRow(LocalizationUtility::translate('configuration', 'calendarize'), $this->flexFormService->get('settings.configuration', 'main'));
     if ((bool) $this->flexFormService->get('settings.hidePagination', 'main')) {
         $this->layoutService->addRow(LocalizationUtility::translate('hide.pagination.teaser', 'calendarize'), '!!!');
     }
     $this->addPageIdsToTable();
     return $this->layoutService->render();
 }
开发者ID:kaptankorkut,项目名称:calendarize,代码行数:36,代码来源:CmsLayout.php

示例2: render

 /**
  * Render the captcha image html
  *
  * @param string suffix to be appended to the extenstion key when forming css class names
  * @return string The html used to render the captcha image
  */
 public function render($suffix = '')
 {
     $value = '';
     // Include the required JavaScript
     $GLOBALS['TSFE']->additionalHeaderData[$this->extensionKey . '_freeCap'] = '<script type="text/javascript" src="' . GeneralUtility::createVersionNumberedFilename(ExtensionManagementUtility::siteRelPath($this->extensionKey) . 'Resources/Public/JavaScript/freeCap.js') . '"></script>';
     // Disable caching
     $GLOBALS['TSFE']->no_cache = 1;
     // Get the plugin configuration
     $settings = $this->configurationManager->getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_SETTINGS, $this->extensionName);
     // Get the translation view helper
     $objectManager = GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
     $translator = $objectManager->get('SJBR\\SrFreecap\\ViewHelpers\\TranslateViewHelper');
     $translator->injectConfigurationManager($this->configurationManager);
     // Generate the image url
     $fakeId = GeneralUtility::shortMD5(uniqid(rand()), 5);
     $siteURL = GeneralUtility::getIndpEnv('TYPO3_SITE_URL');
     $L = GeneralUtility::_GP('L');
     $urlParams = array('eID' => 'sr_freecap_EidDispatcher', 'id' => $GLOBALS['TSFE']->id, 'vendorName' => 'SJBR', 'extensionName' => 'SrFreecap', 'pluginName' => 'ImageGenerator', 'controllerName' => 'ImageGenerator', 'actionName' => 'show', 'formatName' => 'png', 'L' => $GLOBALS['TSFE']->sys_language_uid);
     if ($GLOBALS['TSFE']->MP) {
         $urlParams['MP'] = $GLOBALS['TSFE']->MP;
     }
     $urlParams['set'] = $fakeId;
     $imageUrl = $siteURL . 'index.php?' . ltrim(GeneralUtility::implodeArrayForUrl('', $urlParams), '&');
     // Generate the html text
     $value = '<img' . $this->getClassAttribute('image', $suffix) . ' id="tx_srfreecap_captcha_image_' . $fakeId . '"' . ' src="' . htmlspecialchars($imageUrl) . '"' . ' alt="' . $translator->render('altText') . ' "/>' . '<span' . $this->getClassAttribute('cant-read', $suffix) . '>' . $translator->render('cant_read1') . ' <a href="#" onclick="this.blur();' . $this->extensionName . '.newImage(\'' . $fakeId . '\', \'' . $translator->render('noImageMessage') . '\');return false;">' . $translator->render('click_here') . '</a>' . $translator->render('cant_read2') . '</span>';
     return $value;
 }
开发者ID:olek07,项目名称:GiGaBonus,代码行数:33,代码来源:ImageViewHelper.php

示例3: __construct

 /**
  * Boots up:
  *  - objectManager to get class instances
  *  - configuration manager for ts settings
  *  - contentObjectRenderer for generating links etc.
  *  - termRepository to get the Terms
  *
  * @return WrapperService
  */
 public function __construct()
 {
     // Make instance of Object Manager
     /** @var ObjectManager $objectManager */
     $objectManager = GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
     // Get Configuration Manager
     /** @var ConfigurationManager $configurationManager */
     $configurationManager = $objectManager->get('TYPO3\\CMS\\Extbase\\Configuration\\ConfigurationManager');
     // Inject Content Object Renderer
     $this->cObj = $objectManager->get('TYPO3\\CMS\\Frontend\\ContentObject\\ContentObjectRenderer');
     // Get Query Settings
     /** @var QuerySettingsInterface $querySettings */
     $querySettings = $objectManager->get('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\QuerySettingsInterface');
     // Get termRepository
     $this->termRepository = $objectManager->get('Dpn\\DpnGlossary\\Domain\\Repository\\TermRepository');
     // Get Typoscript Configuration
     $this->tsConfig = $configurationManager->getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_FULL_TYPOSCRIPT);
     // Reduce TS config to plugin
     $this->tsConfig = $this->tsConfig['plugin.']['tx_dpnglossary.'];
     if (FALSE === empty($this->tsConfig)) {
         // Save extension settings without ts dots
         $this->settings = GeneralUtility::removeDotsFromTS($this->tsConfig['settings.']);
         // Set StoragePid in the query settings object
         $querySettings->setStoragePageIds(GeneralUtility::trimExplode(',', $this->tsConfig['persistence.']['storagePid']));
         // Set current language uid
         $querySettings->setLanguageUid($GLOBALS['TSFE']->sys_language_uid);
         // Assign query settings object to repository
         $this->termRepository->setDefaultQuerySettings($querySettings);
     }
 }
开发者ID:p2media,项目名称:dpn_glossary,代码行数:39,代码来源:WrapperService.php

示例4: getTargetUrl

 /**
  * Determine the url to view
  *
  * @return string
  */
 protected function getTargetUrl()
 {
     $pageIdToShow = (int) \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('id');
     $adminCommand = $this->getAdminCommand($pageIdToShow);
     $domainName = $this->getDomainName($pageIdToShow);
     // Mount point overlay: Set new target page id and mp parameter
     /** @var \TYPO3\CMS\Frontend\Page\PageRepository $sysPage */
     $sysPage = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\Page\\PageRepository');
     $sysPage->init(FALSE);
     $mountPointMpParameter = '';
     $finalPageIdToShow = $pageIdToShow;
     $mountPointInformation = $sysPage->getMountPointInfo($pageIdToShow);
     if ($mountPointInformation && $mountPointInformation['overlay']) {
         // New page id
         $finalPageIdToShow = $mountPointInformation['mount_pid'];
         $mountPointMpParameter = '&MP=' . $mountPointInformation['MPvar'];
     }
     // Modify relative path to protocol with host if domain record is given
     $protocolAndHost = '..';
     if ($domainName) {
         $protocol = 'http';
         $page = (array) $sysPage->getPage($finalPageIdToShow);
         if ($page['url_scheme'] == 2 || $page['url_scheme'] == 0 && \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_SSL')) {
             $protocol = 'https';
         }
         $protocolAndHost = $protocol . '://' . $domainName;
     }
     $url = $protocolAndHost . '/index.php?id=' . $finalPageIdToShow . $this->getTypeParameterIfSet($finalPageIdToShow) . $mountPointMpParameter . $adminCommand;
     return $url;
 }
开发者ID:KarlDennisMatthaei1923,项目名称:PierraaDesign,代码行数:35,代码来源:ViewModuleController.php

示例5: prepareSubject

 /**
  * Prepare a DatabaseConnection subject.
  * Used by driver specific test cases.
  *
  * @param string $driver Driver to use like "mssql", "oci8" and "postgres7"
  * @param array $configuration Dbal configuration array
  * @return \TYPO3\CMS\Dbal\Database\DatabaseConnection|\PHPUnit_Framework_MockObject_MockObject|\TYPO3\CMS\Core\Tests\AccessibleObjectInterface
  */
 protected function prepareSubject($driver, array $configuration)
 {
     /** @var \TYPO3\CMS\Dbal\Database\DatabaseConnection|\PHPUnit_Framework_MockObject_MockObject|\TYPO3\CMS\Core\Tests\AccessibleObjectInterface $subject */
     $subject = $this->getAccessibleMock(\TYPO3\CMS\Dbal\Database\DatabaseConnection::class, array('getFieldInfoCache'), array(), '', false);
     $subject->conf = $configuration;
     // Disable caching
     $mockCacheFrontend = $this->getMock(\TYPO3\CMS\Core\Cache\Frontend\PhpFrontend::class, array(), array(), '', false);
     $subject->expects($this->any())->method('getFieldInfoCache')->will($this->returnValue($mockCacheFrontend));
     // Inject SqlParser - Its logic is tested with the tests, too.
     $sqlParser = $this->getAccessibleMock(\TYPO3\CMS\Dbal\Database\SqlParser::class, array('dummy'), array(), '', false);
     $sqlParser->_set('databaseConnection', $subject);
     $sqlParser->_set('sqlCompiler', GeneralUtility::makeInstance(\TYPO3\CMS\Dbal\Database\SqlCompilers\Adodb::class, $subject));
     $sqlParser->_set('nativeSqlCompiler', GeneralUtility::makeInstance(\TYPO3\CMS\Dbal\Database\SqlCompilers\Mysql::class, $subject));
     $subject->SQLparser = $sqlParser;
     // Mock away schema migration service from install tool
     $installerSqlMock = $this->getMock(\TYPO3\CMS\Install\Service\SqlSchemaMigrationService::class, array('getFieldDefinitions_fileContent'), array(), '', false);
     $installerSqlMock->expects($this->any())->method('getFieldDefinitions_fileContent')->will($this->returnValue(array()));
     $subject->_set('installerSql', $installerSqlMock);
     $subject->initialize();
     // Fake a working connection
     $handlerKey = '_DEFAULT';
     $subject->lastHandlerKey = $handlerKey;
     $adodbDriverClass = '\\ADODB_' . $driver;
     $subject->handlerInstance[$handlerKey] = new $adodbDriverClass();
     $subject->handlerInstance[$handlerKey]->DataDictionary = NewDataDictionary($subject->handlerInstance[$handlerKey]);
     $subject->handlerInstance[$handlerKey]->_connectionID = rand(1, 1000);
     return $subject;
 }
开发者ID:graurus,项目名称:testgit_t37,代码行数:36,代码来源:AbstractTestCase.php

示例6: getInterceptors

 /**
  * Returns all interceptors for a given Interception Point.
  *
  * @param int $interceptionPoint one of the \TYPO3\CMS\Fluid\Core\Parser\InterceptorInterface::INTERCEPT_* constants,
  * @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\CMS\Fluid\Core\Parser\InterceptorInterface>
  */
 public function getInterceptors($interceptionPoint)
 {
     if (isset($this->interceptors[$interceptionPoint]) && $this->interceptors[$interceptionPoint] instanceof \TYPO3\CMS\Extbase\Persistence\ObjectStorage) {
         return $this->interceptors[$interceptionPoint];
     }
     return \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\Persistence\ObjectStorage::class);
 }
开发者ID:plan2net,项目名称:TYPO3.CMS,代码行数:13,代码来源:Configuration.php

示例7: execute

 /**
  * Returns an URL that switches the sorting indicator according to the
  * given sorting direction
  *
  * @param array $arguments Expects 'asc' or 'desc' as sorting direction in key 0
  * @return string
  * @throws \InvalidArgumentException when providing an invalid sorting direction
  */
 public function execute(array $arguments = array())
 {
     $content = '';
     $sortDirection = trim($arguments[0]);
     $configuration = Util::getSolrConfiguration();
     $contentObject = GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\ContentObject\\ContentObjectRenderer');
     $defaultImagePrefix = 'EXT:solr/Resources/Public/Images/Indicator';
     $sortViewHelperConfiguration = $configuration->getViewHelpersSortIndicatorConfiguration();
     switch ($sortDirection) {
         case 'asc':
             $imageConfiguration = $sortViewHelperConfiguration['up.'];
             if (!isset($imageConfiguration['file'])) {
                 $imageConfiguration['file'] = $defaultImagePrefix . 'Up.png';
             }
             $content = $contentObject->cObjGetSingle('IMAGE', $imageConfiguration);
             break;
         case 'desc':
             $imageConfiguration = $sortViewHelperConfiguration['down.'];
             if (!isset($imageConfiguration['file'])) {
                 $imageConfiguration['file'] = $defaultImagePrefix . 'Down.png';
             }
             $content = $contentObject->cObjGetSingle('IMAGE', $imageConfiguration);
             break;
         case '###SORT.CURRENT_DIRECTION###':
         case '':
             // ignore
             break;
         default:
             throw new \InvalidArgumentException('Invalid sorting direction "' . $arguments[0] . '", must be "asc" or "desc".', 1390868460);
     }
     return $content;
 }
开发者ID:hnadler,项目名称:ext-solr,代码行数:40,代码来源:SortIndicator.php

示例8: flash

 public function flash($message, $severity = \TYPO3\CMS\Core\Messaging\FlashMessage::OK)
 {
     $flashMessage = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Messaging\FlashMessage::class, $message, '', $severity, true);
     $flashMessageService = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Messaging\FlashMessageService::class);
     $defaultFlashMessageQueue = $flashMessageService->getMessageQueueByIdentifier();
     $defaultFlashMessageQueue->enqueue($flashMessage);
 }
开发者ID:ksjogo,项目名称:typo3-ext-semantic-images,代码行数:7,代码来源:FileUpload.php

示例9: setUp

 public function setUp()
 {
     $GLOBALS['TSFE'] = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\Controller\\TypoScriptFrontendController', $GLOBALS['TYPO3_CONF_VARS'], 0);
     $GLOBALS['TSFE']->sys_page = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\Page\\PageRepository');
     $this->view = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_gridelements_view');
     $this->view->cObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\ContentObject\\ContentObjectRenderer');
 }
开发者ID:raimundlandig,项目名称:winkel.de-DEV,代码行数:7,代码来源:class.tx_gridelements_pagerendererhookTest.php

示例10: dispatchControllerAction

 public function dispatchControllerAction($requestArguments)
 {
     $result = [];
     $extensionName = true === isset($requestArguments['mvc']['extensionName']) ? $requestArguments['mvc']['extensionName'] : null;
     $controllerName = true === isset($requestArguments['mvc']['controller']) ? $requestArguments['mvc']['controller'] : null;
     $vendorName = true === isset($requestArguments['mvc']['vendor']) ? $requestArguments['mvc']['vendor'] : null;
     $actionName = true === isset($requestArguments['mvc']['action']) ? $requestArguments['mvc']['action'] : null;
     $arguments = true === isset($requestArguments['arguments']) ? $requestArguments['arguments'] : [];
     if ($extensionName && $vendorName && $controllerName && $actionName) {
         /** @var Request $request */
         $request = GeneralUtility::makeInstance(Request::class);
         $request->setControllerExtensionName($extensionName);
         $request->setControllerVendorName($vendorName);
         $request->setControllerName($controllerName);
         $request->setControllerActionName($actionName);
         $request->setArguments($arguments);
         /** @var Response $response */
         $response = GeneralUtility::makeInstance(Response::class);
         /** @var Dispatcher $dispatcher */
         $dispatcher = GeneralUtility::makeInstance(Dispatcher::class);
         $dispatcher->dispatch($request, $response);
         $result = $response->getContent();
     }
     return $result;
 }
开发者ID:romaincanon,项目名称:TYPO3-Site-Factory,代码行数:25,代码来源:AjaxController.php

示例11: createRule

 /**
  * Create a rule object according to class
  * and sent some arguments
  *
  * @param string $class Name of the validation rule
  * @param array $arguments Configuration of the rule
  * @return AbstractValidator The rule object
  */
 public function createRule($class, $arguments = array())
 {
     $class = strtolower((string) $class);
     $className = 'TYPO3\\CMS\\Form\\Validation\\' . ucfirst($class) . 'Validator';
     $rule = GeneralUtility::makeInstance($className, $arguments);
     return $rule;
 }
开发者ID:adrolli,项目名称:TYPO3.CMS,代码行数:15,代码来源:ValidatorUtility.php

示例12: __construct

 /**
  * Constructor
  */
 public function __construct()
 {
     $this->objectManager = GeneralUtility::makeInstance(ObjectManager::class);
     $this->injectConfigurationService($this->objectManager->get(ConfigurationService::class));
     $this->injectPageService($this->objectManager->get(PageService::class));
     $this->injectWorkspacesAwareRecordService($this->objectManager->get(WorkspacesAwareRecordService::class));
 }
开发者ID:fluidtypo3,项目名称:fluidpages,代码行数:10,代码来源:BackendLayoutDataProvider.php

示例13: getTables

 /**
  * Get tables for menu example
  *
  * @param int $startUid UID from selected page
  * @param int $depth How many levels recursive
  * @return string The tables to be displayed
  */
 public function getTables($startUid, $depth = 0)
 {
     $deletedRecordsTotal = 0;
     $lang = $this->getLanguageService();
     $tables = array();
     foreach (RecyclerUtility::getModifyableTables() as $tableName) {
         $deletedField = RecyclerUtility::getDeletedField($tableName);
         if ($deletedField) {
             // Determine whether the table has deleted records:
             $deletedCount = $this->getDatabaseConnection()->exec_SELECTcountRows('uid', $tableName, $deletedField . '<>0');
             if ($deletedCount) {
                 /* @var $deletedDataObject \TYPO3\CMS\Recycler\Domain\Model\DeletedRecords */
                 $deletedDataObject = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Recycler\Domain\Model\DeletedRecords::class);
                 $deletedData = $deletedDataObject->loadData($startUid, $tableName, $depth)->getDeletedRows();
                 if (isset($deletedData[$tableName])) {
                     if ($deletedRecordsInTable = count($deletedData[$tableName])) {
                         $deletedRecordsTotal += $deletedRecordsInTable;
                         $tables[] = array($tableName, $deletedRecordsInTable, RecyclerUtility::getUtf8String($lang->sL($GLOBALS['TCA'][$tableName]['ctrl']['title'])));
                     }
                 }
             }
         }
     }
     $jsonArray = $tables;
     array_unshift($jsonArray, array('', $deletedRecordsTotal, $lang->sL('LLL:EXT:recycler/mod1/locallang.xlf:label_allrecordtypes')));
     return $jsonArray;
 }
开发者ID:plan2net,项目名称:TYPO3.CMS,代码行数:34,代码来源:Tables.php

示例14: setUp

 public function setUp()
 {
     parent::setUp();
     $this->objectManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
     $this->categoryRepository = $this->objectManager->get('Tx_News_Domain_Repository_NewsRepository');
     $this->importDataSet(__DIR__ . '/../Fixtures/tx_news_domain_model_category.xml');
 }
开发者ID:woehrlag,项目名称:Intranet,代码行数:7,代码来源:CategoryRepositoryTest.php

示例15: __construct

 /**
  * CONSTRUCTOR
  */
 public function __construct()
 {
     $objectManager = GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
     $this->configurationManager = $objectManager->get('TYPO3\\CMS\\Extbase\\Configuration\\BackendConfigurationManager');
     $this->configurationService = $objectManager->get('FluidTYPO3\\Fluidpages\\Service\\ConfigurationService');
     $this->pageService = $objectManager->get('FluidTYPO3\\Fluidpages\\Service\\PageService');
 }
开发者ID:chrmue01,项目名称:typo3-starter-kit,代码行数:10,代码来源:PageLayoutSelector.php


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