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


PHP Utility\GeneralUtility类代码示例

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


在下文中一共展示了GeneralUtility类的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: echoExceptionWeb

 /**
  * Echoes an exception for the web.
  *
  * @param \Exception $exception The exception
  * @return void
  */
 public function echoExceptionWeb(\Exception $exception)
 {
     $this->sendStatusHeaders($exception);
     $this->writeLogEntries($exception, self::CONTEXT_WEB);
     $messageObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\ErrorpageMessage', $this->getMessage($exception), $this->getTitle($exception));
     $messageObj->output();
 }
开发者ID:Mr-Robota,项目名称:TYPO3.CMS,代码行数:13,代码来源:ProductionExceptionHandler.php

示例3: autoPublishWorkspaces

    /**
     * This method is called by the Scheduler task that triggers
     * the autopublication process
     * It searches for workspaces whose publication date is in the past
     * and publishes them
     *
     * @return void
     */
    public function autoPublishWorkspaces()
    {
        // Temporarily set admin rights
        // @todo once workspaces are cleaned up a better solution should be implemented
        $currentAdminStatus = $GLOBALS['BE_USER']->user['admin'];
        $GLOBALS['BE_USER']->user['admin'] = 1;
        // Select all workspaces that needs to be published / unpublished:
        $workspaces = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('uid,swap_modes,publish_time,unpublish_time', 'sys_workspace', 'pid=0
				AND
				((publish_time!=0 AND publish_time<=' . (int) $GLOBALS['EXEC_TIME'] . ')
				OR (publish_time=0 AND unpublish_time!=0 AND unpublish_time<=' . (int) $GLOBALS['EXEC_TIME'] . '))' . \TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause('sys_workspace'));
        $workspaceService = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Workspaces\Service\WorkspaceService::class);
        foreach ($workspaces as $rec) {
            // First, clear start/end time so it doesn't get select once again:
            $fieldArray = $rec['publish_time'] != 0 ? array('publish_time' => 0) : array('unpublish_time' => 0);
            $GLOBALS['TYPO3_DB']->exec_UPDATEquery('sys_workspace', 'uid=' . (int) $rec['uid'], $fieldArray);
            // Get CMD array:
            $cmd = $workspaceService->getCmdArrayForPublishWS($rec['uid'], $rec['swap_modes'] == 1);
            // $rec['swap_modes']==1 means that auto-publishing will swap versions, not just publish and empty the workspace.
            // Execute CMD array:
            $tce = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\DataHandling\DataHandler::class);
            $tce->stripslashes_values = 0;
            $tce->start(array(), $cmd);
            $tce->process_cmdmap();
        }
        // Restore admin status
        $GLOBALS['BE_USER']->user['admin'] = $currentAdminStatus;
    }
开发者ID:rickymathew,项目名称:TYPO3.CMS,代码行数:36,代码来源:AutoPublishService.php

示例4: buildJavascriptConfiguration

 /**
  * Return JS configuration of the htmlArea plugins registered by the extension
  *
  * @return string JS configuration for registered plugins
  */
 public function buildJavascriptConfiguration()
 {
     $schema = array('types' => array(), 'properties' => array());
     // Parse configured schemas
     if (is_array($this->configuration['thisConfig']['schema.']) && is_array($this->configuration['thisConfig']['schema.']['sources.'])) {
         foreach ($this->configuration['thisConfig']['schema.']['sources.'] as $source) {
             $fileName = trim($source);
             $absolutePath = GeneralUtility::getFileAbsFileName($fileName);
             // Fallback to default schema file if configured file does not exists or is of zero size
             if (!$fileName || !file_exists($absolutePath) || !filesize($absolutePath)) {
                 $fileName = 'EXT:' . $this->extensionKey . '/Resources/Public/Rdf/MicrodataSchema/SchemaOrgAll.rdf';
             }
             $fileName = $this->getFullFileName($fileName);
             $rdf = file_get_contents($fileName);
             if ($rdf) {
                 $this->parseSchema($rdf, $schema);
             }
         }
     }
     uasort($schema['types'], array($this, 'compareLabels'));
     uasort($schema['properties'], array($this, 'compareLabels'));
     // Insert no type and no property entries
     $languageService = $this->getLanguageService();
     $noSchema = $languageService->sL('LLL:EXT:rtehtmlarea/Resources/Private/Language/Plugins/MicrodataSchema/locallang.xlf:No type');
     $noProperty = $languageService->sL('LLL:EXT:rtehtmlarea/Resources/Private/Language/Plugins/MicrodataSchema/locallang.xlf:No property');
     array_unshift($schema['types'], array('name' => 'none', 'label' => $noSchema));
     array_unshift($schema['properties'], array('name' => 'none', 'label' => $noProperty));
     // Store json encoded array in temporary file
     return 'RTEarea[editornumber].schemaUrl = "' . $this->writeTemporaryFile('schema_' . $this->configuration['language'], 'js', json_encode($schema)) . '";';
 }
开发者ID:dachcom-digital,项目名称:TYPO3.CMS,代码行数:35,代码来源:MicroDataSchema.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: getMimeType

 /**
  * Return the mime type of a file.
  *
  * @return string|bool Returns the mime type or FALSE if the mime type could not be discovered
  */
 public function getMimeType()
 {
     $mimeType = FALSE;
     if ($this->isFile()) {
         $fileExtensionToMimeTypeMapping = $GLOBALS['TYPO3_CONF_VARS']['SYS']['FileInfo']['fileExtensionToMimeType'];
         $lowercaseFileExtension = strtolower($this->getExtension());
         if (!empty($fileExtensionToMimeTypeMapping[$lowercaseFileExtension])) {
             $mimeType = $fileExtensionToMimeTypeMapping[$lowercaseFileExtension];
         } else {
             if (function_exists('finfo_file')) {
                 $fileInfo = new \finfo();
                 $mimeType = $fileInfo->file($this->getPathname(), FILEINFO_MIME_TYPE);
             } elseif (function_exists('mime_content_type')) {
                 $mimeType = mime_content_type($this->getPathname());
             }
         }
     }
     if (isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][\TYPO3\CMS\Core\Type\File\FileInfo::class]['mimeTypeGuessers']) && is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][\TYPO3\CMS\Core\Type\File\FileInfo::class]['mimeTypeGuesser'])) {
         foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][\TYPO3\CMS\Core\Type\File\FileInfo::class]['mimeTypeGuesser'] as $mimeTypeGuesser) {
             $hookParameters = array('mimeType' => &$mimeType);
             \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($mimeTypeGuesser, $hookParameters, $this);
         }
     }
     return $mimeType;
 }
开发者ID:plan2net,项目名称:TYPO3.CMS,代码行数:30,代码来源:FileInfo.php

示例9: processDatamapPostProcessFieldArray

 /**
  * test process datamap post process field array
  *
  * @test
  */
 public function processDatamapPostProcessFieldArray()
 {
     $hook = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('GridElementsTeam\\Gridelements\\Hooks\\DataHandler');
     $status = '';
     $table = 'tt_content';
     $id = 12;
     $fieldArray = array();
     $map = array(array('tt_content', 0, NULL, 'noPid'), array('tt_content', 0, 23, 123));
     $parentObj = $this->getMock('TYPO3\\CMS\\Core\\DataHandling\\DataHandler', array('getSortNumber'));
     $parentObj->isImporting = FALSE;
     $parentObj->expects($this->any())->method('getSortNumber')->will($this->returnValueMap($map));
     $hook->processDatamap_postProcessFieldArray($status, $table, $id, $fieldArray, $parentObj);
     $this->assertEquals(array(), $fieldArray);
     $_GET['cmd'] = array('tt_content' => array(12 => array('copy' => '23x24')));
     $status = 'new';
     $expectedFieldArray['sorting'] = 123;
     $hook->processDatamap_postProcessFieldArray($status, $table, $id, $fieldArray, $parentObj);
     $this->assertEquals($expectedFieldArray, $fieldArray);
     $_GET['cmd'] = array('tt_content' => array(12 => array('copy' => '-2x24')));
     $t3lib_db = $this->getMock('t3lib_db', array('exec_SELECTgetSingleRow'));
     $t3lib_db->expects($this->once())->method('exec_SELECTgetSingleRow')->will($this->returnValue(array('pid' => 0)));
     $GLOBALS['TYPO3_DB'] = $t3lib_db;
     $expectedFieldArray['sorting'] = null;
     $hook->processDatamap_postProcessFieldArray($status, $table, $id, $fieldArray, $parentObj);
     $this->assertEquals($expectedFieldArray, $fieldArray);
     $t3lib_db = $this->getMock('t3lib_db', array('exec_SELECTgetSingleRow'));
     $t3lib_db->expects($this->once())->method('exec_SELECTgetSingleRow')->will($this->returnValue(array('pid' => 23)));
     $GLOBALS['TYPO3_DB'] = $t3lib_db;
     $expectedFieldArray['sorting'] = '123';
     $hook->processDatamap_postProcessFieldArray($status, $table, $id, $fieldArray, $parentObj);
     $this->assertEquals($expectedFieldArray, $fieldArray);
 }
开发者ID:blumenbach,项目名称:bb-online.neu,代码行数:37,代码来源:class.tx_gridelements_tcemainhookTest.php

示例10: __construct

 /**
  * Constructor
  */
 public function __construct(\TYPO3\CMS\Core\Mail\MailMessage $mailMessage, array $typoScript)
 {
     $this->localCobj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::class);
     $this->localizationHandler = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Form\Localization::class);
     $this->mailMessage = $mailMessage;
     $this->typoScript = $typoScript;
 }
开发者ID:plan2net,项目名称:TYPO3.CMS,代码行数:10,代码来源:MailView.php

示例11: renderTypoLink

 protected function renderTypoLink($linkData)
 {
     $cObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\ContentObject\\ContentObjectRenderer');
     /** @var \TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer $cObj */
     $configuration = array('parameter' => $linkData, 'returnLast' => true);
     return $cObj->typolink('', $configuration);
 }
开发者ID:EricVal,项目名称:yag_themepack_jquery,代码行数:7,代码来源:GalleriaViewHelper.php

示例12: viewHelperReturnsCorrectJs

    /**
     * Test if default file format works
     *
     * @test
     * @return void
     */
    public function viewHelperReturnsCorrectJs()
    {
        $newsItem = new Tx_News_Domain_Model_News();
        $newsItem->setTitle('fobar');
        $language = 'en';
        $viewHelper = new Tx_News_ViewHelpers_Social_DisqusViewHelper();
        $settingsService = $this->getAccessibleMock('Tx_News_Service_SettingsService');
        $settingsService->expects($this->any())->method('getSettings')->will($this->returnValue(array('disqusLocale' => $language)));
        $viewHelper->injectSettingsService($settingsService);
        $actualResult = $viewHelper->render($newsItem, 'abcdef', 'http://typo3.org/dummy/fobar.html');
        $expectedCode = '<script type="text/javascript">
					var disqus_shortname = ' . \TYPO3\CMS\Core\Utility\GeneralUtility::quoteJSvalue('abcdef', TRUE) . ';
					var disqus_identifier = ' . \TYPO3\CMS\Core\Utility\GeneralUtility::quoteJSvalue('news_' . $newUid, TRUE) . ';
					var disqus_url = ' . \TYPO3\CMS\Core\Utility\GeneralUtility::quoteJSvalue('http://typo3.org/dummy/fobar.html') . ';
					var disqus_title = ' . \TYPO3\CMS\Core\Utility\GeneralUtility::quoteJSvalue('fobar', TRUE) . ';
					var disqus_config = function () {
						this.language = ' . \TYPO3\CMS\Core\Utility\GeneralUtility::quoteJSvalue($language) . ';
					};

					(function() {
						var dsq = document.createElement("script"); dsq.type = "text/javascript"; dsq.async = true;
						dsq.src = "http://" + disqus_shortname + ".disqus.com/embed.js";
						(document.getElementsByTagName("head")[0] || document.getElementsByTagName("body")[0]).appendChild(dsq);
					})();
				</script>';
        $this->assertEquals($expectedCode, $actualResult);
    }
开发者ID:woehrlag,项目名称:Intranet,代码行数:33,代码来源:DisqusViewHelperTest.php

示例13: __construct

 /**
  * Initialize the live search
  */
 public function __construct()
 {
     // @todo Use the autoloader for this. Not sure why its not working.
     require_once PATH_t3lib . 'search/class.t3lib_search_livesearch_queryParser.php';
     $this->liveSearch = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Search\\LiveSearch\\LiveSearch');
     $this->queryParser = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Search\\LiveSearch\\QueryParser');
 }
开发者ID:noxludo,项目名称:TYPO3v4-Core,代码行数:10,代码来源:LiveSearchDataProvider.php

示例14: includeLocalLang

 /**
  * Reads the [extDir]/locallang.xml and returns the \$LOCAL_LANG array found in that file.
  *
  * @return	The array with language labels
  */
 function includeLocalLang()
 {
     $llFile = TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('ke_search') . 'pi2/locallang.xml';
     $xmlParser = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Localization\\Parser\\LocallangXmlParser');
     $LOCAL_LANG = $xmlParser->getParsedData($llFile, $GLOBALS['LANG']->lang);
     return $LOCAL_LANG;
 }
开发者ID:mneuhaus,项目名称:ke_search,代码行数:12,代码来源:class.tx_kesearch_pi2_wizicon.php

示例15: filter

 /**
  * Return filtered value
  * Removes potential XSS code from the input string.
  *
  * Using an external class by Travis Puderbaugh <kallahar@quickwired.com>
  *
  * @param string $value Unfiltered value
  * @return string The filtered value
  */
 public function filter($value)
 {
     $value = stripslashes($value);
     $value = html_entity_decode($value, ENT_QUOTES);
     $filteredValue = \TYPO3\CMS\Core\Utility\GeneralUtility::removeXSS($value);
     return $filteredValue;
 }
开发者ID:nicksergio,项目名称:TYPO3v4-Core,代码行数:16,代码来源:RemoveXssFilter.php


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