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


PHP GeneralUtility::getUrl方法代码示例

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


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

示例1: addLabel

 /**
  * Add the label to a XML file
  *
  * @param string $extensionKey
  * @param string $key
  * @param string $default
  *
  * @return NULL
  */
 public function addLabel($extensionKey, $key, $default)
 {
     // Excelude
     if (!strlen($default)) {
         return;
     }
     if (!strlen($key)) {
         return;
     }
     if (!strlen($extensionKey)) {
         return;
     }
     if (GeneralUtility::isFirstPartOfStr($key, 'LLL:')) {
         return;
     }
     $absolutePath = $this->getAbsoluteFilename($extensionKey);
     $content = GeneralUtility::getUrl($absolutePath);
     if (strpos($content, ' index="' . $key . '"') !== false || trim($content) === '') {
         return;
     }
     $replace = '<languageKey index="default" type="array">' . LF . TAB . TAB . TAB . '<label index="' . $key . '">' . $this->wrapCdata($default) . '</label>';
     $content = str_replace('<languageKey index="default" type="array">', $replace, $content);
     FileUtility::writeFileAndCreateFolder($absolutePath, $content);
     $this->clearCache();
 }
开发者ID:phogl,项目名称:autoloader,代码行数:34,代码来源:XmlWriter.php

示例2: buildJavascriptConfiguration

 /**
  * Return JS configuration of the htmlArea plugins registered by the extension
  *
  * @return 	string		JS configuration for registered plugins
  */
 public function buildJavascriptConfiguration()
 {
     $registerRTEinJavascriptString = '';
     if (!file_exists(PATH_site . $this->jsonFileName)) {
         $schema = array('types' => array(), 'properties' => array());
         $fileName = 'EXT:rte_schema/Resources/Public/RDF/schema.rdfa';
         $fileName = GeneralUtility::getFileAbsFileName($fileName);
         $rdf = GeneralUtility::getUrl($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
         if ($this->isFrontend()) {
             $noSchema = $GLOBALS['TSFE']->getLLL('No type', $this->LOCAL_LANG);
             $noProperty = $GLOBALS['TSFE']->getLLL('No property', $this->LOCAL_LANG);
         } else {
             $noSchema = $GLOBALS['LANG']->getLL('No type');
             $noProperty = $GLOBALS['LANG']->getLL('No property');
         }
         array_unshift($schema['types'], array('name' => 'none', 'domain' => $noSchema, 'comment' => ''));
         array_unshift($schema['properties'], array('name' => 'none', 'domain' => $noProperty, 'comment' => ''));
         GeneralUtility::writeFileToTypo3tempDir(PATH_site . $this->jsonFileName, json_encode($schema));
     }
     $output = ($this->isFrontend() && $GLOBALS['TSFE']->absRefPrefix ? $GLOBALS['TSFE']->absRefPrefix : '../') . $this->jsonFileName;
     $registerRTEinJavascriptString = 'RTEarea[editornumber].schemaUrl = "' . ($this->isFrontend() && $GLOBALS['TSFE']->absRefPrefix ? $GLOBALS['TSFE']->absRefPrefix : '') . $output . '";';
     return $registerRTEinJavascriptString;
 }
开发者ID:kalypso63,项目名称:rte_schema,代码行数:34,代码来源:SchemaAttr.php

示例3: 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 = GeneralUtility::getUrl($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:plan2net,项目名称:TYPO3.CMS,代码行数:35,代码来源:MicroDataSchema.php

示例4: prepareLoader

 /**
  * Get all the complex data for the loader.
  * This return value will be cached and stored in the database
  * There is no file monitoring for this cache
  *
  * @param Loader $loader
  * @param int    $type
  *
  * @return array
  */
 public function prepareLoader(Loader $loader, $type)
 {
     $grids = [];
     if (!ExtensionManagementUtility::isLoaded('gridelements')) {
         return $grids;
     }
     $commandPath = ExtensionManagementUtility::extPath($loader->getExtensionKey()) . 'Resources/Private/Grids/';
     $files = FileUtility::getBaseFilesWithExtensionInDir($commandPath, 'ts,txt');
     foreach ($files as $file) {
         $pathInfo = PathUtility::pathinfo($file);
         $iconPath = 'EXT:' . $loader->getExtensionKey() . '/Resources/Public/Icons/Grids/' . $pathInfo['filename'] . '.';
         $extension = IconUtility::getIconFileExtension(GeneralUtility::getFileAbsFileName($iconPath));
         $translationKey = 'grid.' . $pathInfo['filename'];
         if ($type === LoaderInterface::EXT_TABLES) {
             TranslateUtility::assureLabel($translationKey, $loader->getExtensionKey(), $pathInfo['filename']);
         }
         $path = 'EXT:' . $loader->getExtensionKey() . '/Resources/Private/Grids/' . $file;
         $icon = $extension ? $iconPath . $extension : false;
         $label = TranslateUtility::getLllString($translationKey, $loader->getExtensionKey());
         $content = GeneralUtility::getUrl(GeneralUtility::getFileAbsFileName($path));
         $flexForm = 'EXT:' . $loader->getExtensionKey() . '/Configuration/FlexForms/Grids/' . $pathInfo['filename'] . '.xml';
         $flexFormFile = GeneralUtility::getFileAbsFileName($flexForm);
         $flexFormContent = is_file($flexFormFile) ? GeneralUtility::getUrl($flexFormFile) : false;
         $grids[] = $this->getPageTsConfig($pathInfo['filename'], $label, $content, $icon, $flexFormContent);
     }
     return $grids;
 }
开发者ID:c2po,项目名称:autoloader,代码行数:37,代码来源:Gridelement.php

示例5: importCommand

 /**
  * Import command
  *
  * @param string $icsCalendarUri
  * @param int    $pid
  */
 public function importCommand($icsCalendarUri = NULL, $pid = NULL)
 {
     if ($icsCalendarUri === NULL || !filter_var($icsCalendarUri, FILTER_VALIDATE_URL)) {
         $this->enqueueMessage('You have to enter a valid URL to the iCalendar ICS', 'Error', FlashMessage::ERROR);
     }
     if (!MathUtility::canBeInterpretedAsInteger($pid)) {
         $this->enqueueMessage('You have to enter a valid PID for the new created elements', 'Error', FlashMessage::ERROR);
     }
     // fetch external URI and write to file
     $this->enqueueMessage('Start to checkout the calendar: ' . $icsCalendarUri, 'Calendar', FlashMessage::INFO);
     $relativeIcalFile = 'typo3temp/ical.' . GeneralUtility::shortMD5($icsCalendarUri) . '.ical';
     $absoluteIcalFile = GeneralUtility::getFileAbsFileName($relativeIcalFile);
     $content = GeneralUtility::getUrl($icsCalendarUri);
     GeneralUtility::writeFile($absoluteIcalFile, $content);
     // get Events from file
     $icalEvents = $this->getIcalEvents($absoluteIcalFile);
     $this->enqueueMessage('Found ' . sizeof($icalEvents) . ' events in the given calendar', 'Items', FlashMessage::INFO);
     $events = $this->prepareEvents($icalEvents);
     $this->enqueueMessage('This is just a first draft. There are same missing fields. Will be part of the next release', 'Items', FlashMessage::ERROR);
     return;
     foreach ($events as $event) {
         $eventObject = $this->eventRepository->findOneByImportId($event['uid']);
         if ($eventObject instanceof Event) {
             // update
             $eventObject->setTitle($event['title']);
             $eventObject->setDescription($this->nl2br($event['description']));
             $this->eventRepository->update($eventObject);
             $this->enqueueMessage('Update Event Meta data: ' . $eventObject->getTitle(), 'Update');
         } else {
             // create
             $eventObject = new Event();
             $eventObject->setPid($pid);
             $eventObject->setImportId($event['uid']);
             $eventObject->setTitle($event['title']);
             $eventObject->setDescription($this->nl2br($event['description']));
             $configuration = new Configuration();
             $configuration->setType(Configuration::TYPE_TIME);
             $configuration->setFrequency(Configuration::FREQUENCY_NONE);
             /** @var \DateTime $startDate */
             $startDate = clone $event['start'];
             $startDate->setTime(0, 0, 0);
             $configuration->setStartDate($startDate);
             /** @var \DateTime $endDate */
             $endDate = clone $event['end'];
             $endDate->setTime(0, 0, 0);
             $configuration->setEndDate($endDate);
             $startTime = $this->dateTimeToDaySeconds($event['start']);
             if ($startTime > 0) {
                 $configuration->setStartTime($startTime);
                 $configuration->setEndTime($this->dateTimeToDaySeconds($event['end']));
                 $configuration->setAllDay(FALSE);
             } else {
                 $configuration->setAllDay(TRUE);
             }
             $eventObject->addCalendarize($configuration);
             $this->eventRepository->add($eventObject);
             $this->enqueueMessage('Add Event: ' . $eventObject->getTitle(), 'Add');
         }
     }
 }
开发者ID:sirdiego,项目名称:calendarize,代码行数:66,代码来源:ImportCommandController.php

示例6: unserialize

 /**
  * @param $status
  * @param $table
  * @param $id
  * @param $fieldArray
  * @param $self
  */
 function processDatamap_postProcessFieldArray($status, $table, $id, &$fieldArray, &$self)
 {
     if ($table == 'tx_html5videoplayer_domain_model_video') {
         $data = $fieldArray;
         if ($status == 'update') {
             $data = array_merge($GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow('*', 'tx_html5videoplayer_domain_model_video', 'uid=' . (int) $id), $data);
         }
         $vimeoUrl = $data['vimeo'];
         if (($status == 'update' || $status == 'new') && $vimeoUrl != '' && GeneralUtility::isValidUrl($vimeoUrl)) {
             if (preg_match('/https?:\\/\\/(?:www\\.)?vimeo.com\\/(?:channels\\/(?:\\w+\\/)?|groups\\/([^\\/]*)\\/videos\\/|album\\/(\\d+)\\/video\\/|)(\\d+)(?:$|\\/|\\?)/i', $vimeoUrl, $matches)) {
                 $videoId = $matches[3];
                 $videoData = unserialize(GeneralUtility::getUrl('http://vimeo.com/api/v2/video/' . $videoId . '.php'));
                 if (is_array($videoData)) {
                     // We're only interested in index zero.
                     $videoData = $videoData[0];
                     if (!isset($data['title']) || trim($data['title']) == '') {
                         $fieldArray['title'] = $videoData['title'];
                     }
                     if (!isset($data['description']) || trim($data['description']) == '') {
                         $fieldArray['description'] = $videoData['description'];
                     }
                     if (!isset($data['posterimage']) || trim($data['posterimage']) == '') {
                         $resourceFactory = ResourceFactory::getInstance();
                         $folder = $resourceFactory->retrieveFileOrFolderObject($this->getUploadFolder());
                         $thumbnailData = GeneralUtility::getUrl($videoData['thumbnail_large']);
                         $file = $folder->createFile(basename($videoData['thumbnail_large']) . '.jpg');
                         $file->setContents($thumbnailData);
                         $fieldArray['posterimage'] = 'file:' . $file->getUid();
                     }
                 }
             }
         }
     }
 }
开发者ID:visol,项目名称:html5videoplayer,代码行数:41,代码来源:VimeoProcessDatamap.php

示例7: parseSingleFile

 /**
  * Parse a single file and does some magic
  * - Remove the <?php tags
  * - Remove the class definition (if set)
  *
  * @param string $filePath path of the file
  * @param boolean $baseClass If class definition should be removed
  * @return string path of the saved file
  * @throws \Exception
  * @throws \InvalidArgumentException
  */
 protected function parseSingleFile($filePath, $baseClass = false)
 {
     if (!is_file($filePath)) {
         throw new \InvalidArgumentException(sprintf('File "%s" could not be found', $filePath));
     }
     $code = GeneralUtility::getUrl($filePath);
     if ($baseClass) {
         $closingBracket = strrpos($code, '}');
         $content = substr($code, 0, $closingBracket);
         $content = str_replace('<?php', '', $content);
         return $content;
     } else {
         /** @var ClassParser $classParser */
         $classParser = GeneralUtility::makeInstance(ClassParser::class);
         $classParser->parse($filePath);
         $classParserInformation = $classParser->getFirstClass();
         $codeInLines = explode(LF, $code);
         if (isset($classParserInformation['eol'])) {
             $innerPart = array_slice($codeInLines, $classParserInformation['start'], $classParserInformation['eol'] - $classParserInformation['start'] - 1);
         } else {
             $innerPart = array_slice($codeInLines, $classParserInformation['start']);
         }
         if (trim($innerPart[0] === '{')) {
             unset($innerPart[0]);
         }
         $codePart = implode(LF, $innerPart);
         $closingBracket = strrpos($codePart, '}');
         $content = $this->getPartialInfo($filePath) . substr($codePart, 0, $closingBracket);
         return $content;
     }
 }
开发者ID:mrmoree,项目名称:vkmh_typo3,代码行数:42,代码来源:ClassCacheManager.php

示例8: render

 /**
  * @param array|NULL $backendUser
  * @param int $size
  * @param bool $showIcon
  * @return string
  */
 public function render(array $backendUser = NULL, $size = 32, $showIcon = FALSE)
 {
     $size = (int) $size;
     if (!is_array($backendUser)) {
         $backendUser = $this->getBackendUser()->user;
     }
     $image = parent::render($backendUser, $size, $showIcon);
     if (!StringUtility::beginsWith($image, '<span class="avatar"><span class="avatar-image"></span>') || empty($backendUser['email'])) {
         return $image;
     }
     $cachedFilePath = PATH_site . 'typo3temp/t3gravatar/';
     $cachedFileName = sha1($backendUser['email'] . $size) . '.jpg';
     if (!file_exists($cachedFilePath . $cachedFileName)) {
         $gravatar = 'https://www.gravatar.com/avatar/' . md5(strtolower($backendUser['email'])) . '?s=' . $size . '&d=404';
         $gravatarImage = GeneralUtility::getUrl($gravatar);
         if (empty($gravatarImage)) {
             return $image;
         }
         GeneralUtility::writeFileToTypo3tempDir($cachedFileName, $gravatarImage);
     }
     // Icon
     $icon = '';
     if ($showIcon) {
         $icon = '<span class="avatar-icon">' . IconUtility::getSpriteIconForRecord('be_users', $backendUser) . '</span>';
     }
     $relativeFilePath = PathUtility::getRelativePath(PATH_typo3, $cachedFilePath);
     return '<span class="avatar"><span class="avatar-image">' . '<img src="' . $relativeFilePath . $cachedFileName . '" width="' . $size . '" height="' . $size . '" /></span>' . $icon . '</span>';
 }
开发者ID:smichaelsen,项目名称:t3gravatar,代码行数:34,代码来源:Avatar.php

示例9: processDatamap_postProcessFieldArray

 function processDatamap_postProcessFieldArray($status, $table, $id, &$fieldArray, &$reference)
 {
     if ($table == 'tx_mia3location_domain_model_location') {
         $where = 'uid = ' . $id;
         $rows = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('*', $table, $where);
         if (!is_array($rows)) {
             return;
         }
         $row = current($rows);
         $address = implode(',', array($row['street'], $row['zip'], $row['city'], 'Deutschland'));
         // if there is a longitude and latitude present
         // do not update these fields and just return
         if (isset($row['longitude']) && !empty($row['longitude']) && (isset($row['latitude']) && !empty($row['latitude']))) {
             return;
         }
         $apiURL = 'https://maps.googleapis.com/maps/api/geocode/json?address=' . urlencode($address) . '&sensor=false&language=de';
         $addressData = \TYPO3\CMS\Core\Utility\GeneralUtility::getUrl($apiURL);
         $adr = json_decode($addressData);
         $coordinates = $adr->results[0]->geometry->location;
         if ($coordinates !== null) {
             if (!empty($fieldArray['latitude']) && $fieldArray['latitude'] !== $row['latitude']) {
             } else {
                 $fieldArray['latitude'] = $coordinates->lat;
             }
             if (!empty($fieldArray['longitude']) && $fieldArray['longitude'] !== $row['longitude']) {
             } else {
                 $fieldArray['longitude'] = $coordinates->lng;
             }
         }
     }
 }
开发者ID:mia3,项目名称:mia3_location,代码行数:31,代码来源:TCEFetchCoordinates.php

示例10: importCommand

 /**
  * Import command
  *
  * @param string $icsCalendarUri
  * @param int    $pid
  */
 public function importCommand($icsCalendarUri = null, $pid = null)
 {
     if ($icsCalendarUri === null || !filter_var($icsCalendarUri, FILTER_VALIDATE_URL)) {
         $this->enqueueMessage('You have to enter a valid URL to the iCalendar ICS', 'Error', FlashMessage::ERROR);
         return;
     }
     if (!MathUtility::canBeInterpretedAsInteger($pid)) {
         $this->enqueueMessage('You have to enter a valid PID for the new created elements', 'Error', FlashMessage::ERROR);
         return;
     }
     // fetch external URI and write to file
     $this->enqueueMessage('Start to checkout the calendar: ' . $icsCalendarUri, 'Calendar', FlashMessage::INFO);
     $relativeIcalFile = 'typo3temp/ical.' . GeneralUtility::shortMD5($icsCalendarUri) . '.ical';
     $absoluteIcalFile = GeneralUtility::getFileAbsFileName($relativeIcalFile);
     $content = GeneralUtility::getUrl($icsCalendarUri);
     GeneralUtility::writeFile($absoluteIcalFile, $content);
     // get Events from file
     $icalEvents = $this->getIcalEvents($absoluteIcalFile);
     $this->enqueueMessage('Found ' . sizeof($icalEvents) . ' events in the given calendar', 'Items', FlashMessage::INFO);
     $events = $this->prepareEvents($icalEvents);
     $this->enqueueMessage('Found ' . sizeof($events) . ' events in ' . $icsCalendarUri, 'Items', FlashMessage::INFO);
     /** @var Dispatcher $signalSlotDispatcher */
     $signalSlotDispatcher = GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\SignalSlot\\Dispatcher');
     $this->enqueueMessage('Send the ' . __CLASS__ . '::importCommand signal for each event.', 'Signal', FlashMessage::INFO);
     foreach ($events as $event) {
         $arguments = ['event' => $event, 'commandController' => $this, 'pid' => $pid, 'handled' => false];
         $signalSlotDispatcher->dispatch(__CLASS__, 'importCommand', $arguments);
     }
 }
开发者ID:kaptankorkut,项目名称:calendarize,代码行数:35,代码来源:ImportCommandController.php

示例11: loadXclassTemplate

 /**
  * Load the xclass template and cache it in a local property
  *
  * @return null
  */
 protected function loadXclassTemplate()
 {
     if (!self::$xclassTemplate) {
         $xclassTemplatePath = ExtensionManagementUtility::extPath('autoloader') . 'Resources/Private/Templates/Xclass/Aspect.tmpl';
         self::$xclassTemplate = GeneralUtility::getUrl($xclassTemplatePath);
     }
 }
开发者ID:phogl,项目名称:autoloader,代码行数:12,代码来源:RegisterAspect.php

示例12: createBackendLayout

 /**
  * Creates a new backend layout using the given record data.
  *
  * @param string $file
  * @return BackendLayout
  */
 protected function createBackendLayout($file)
 {
     $fileInformation = pathinfo($file);
     $backendLayout = BackendLayout::create($fileInformation['filename'], $this->getTitle($fileInformation), GeneralUtility::getUrl($file));
     $this->addIcon($fileInformation, $backendLayout);
     return $backendLayout;
 }
开发者ID:japjazz,项目名称:ot_website,代码行数:13,代码来源:FileProvider.php

示例13: doUpdate

 /**
  * Do the language pack update
  *
  * @param string $extensionKey: extension key of the language pack
  * @return void
  */
 public function doUpdate($extensionKey)
 {
     $extPath = ExtensionManagementUtility::extPath($extensionKey);
     $fileContent = explode(LF, GeneralUtility::getUrl($extPath . 'ext_tables_static+adt.sql'));
     // SQL parser was moved from core to dbal in TYPO3 CMS 7.5
     if (is_object($GLOBALS['TYPO3_DB']->SQLparser)) {
         $sqlParser = $GLOBALS['TYPO3_DB']->SQLparser;
     } else {
         $sqlParser = $this->objectManager->get('SJBR\\StaticInfoTables\\Database\\SqlParser');
     }
     foreach ($fileContent as $line) {
         $line = trim($line);
         if ($line && preg_match('#^UPDATE#i', $line)) {
             $parsedResult = $sqlParser->parseSQL($line);
             // WHERE clause
             $whereClause = $sqlParser->compileWhereClause($parsedResult['WHERE']);
             // Fields
             $fields = array();
             foreach ($parsedResult['FIELDS'] as $fN => $fV) {
                 $fields[$fN] = $fV[0];
             }
             $res = $GLOBALS['TYPO3_DB']->exec_UPDATEquery($parsedResult['TABLE'], $whereClause, $fields, TRUE);
         }
     }
 }
开发者ID:khanhdeux,项目名称:typo3test,代码行数:31,代码来源:DatabaseUpdateUtility.php

示例14: checkAndCreateTcaInformation

 /**
  * Check and create the TCA information
  * disable this for better performance
  */
 public static function checkAndCreateTcaInformation()
 {
     $register = SmartObjectRegister::getRegister();
     $baseTemplatePath = ExtensionManagementUtility::extPath('autoloader', 'Resources/Private/Templates/TcaFiles/');
     $defaultTemplate = GeneralUtility::getUrl($baseTemplatePath . 'Default.tmpl');
     $overrideTemplate = GeneralUtility::getUrl($baseTemplatePath . 'Override.tmpl');
     $search = ['__modelName__', '__tableName__', '__extensionKey__'];
     foreach ($register as $model) {
         $extensionKey = ClassNamingUtility::getExtensionKeyByModel($model);
         $basePath = ExtensionManagementUtility::extPath($extensionKey) . 'Configuration/TCA/';
         $tableName = ModelUtility::getTableNameByModelReflectionAnnotation($model);
         if ($tableName !== '') {
             $tcaFileName = $basePath . 'Overrides/' . $tableName . '.php';
             $template = $overrideTemplate;
         } else {
             $tableName = ModelUtility::getTableNameByModelName($model);
             $tcaFileName = $basePath . $tableName . '.php';
             $template = $defaultTemplate;
         }
         if (!is_file($tcaFileName)) {
             $replace = [str_replace('\\', '\\\\', $model), $tableName, $extensionKey];
             $content = str_replace($search, $replace, $template);
             FileUtility::writeFileAndCreateFolder($tcaFileName, $content);
         }
     }
 }
开发者ID:c2po,项目名称:autoloader,代码行数:30,代码来源:SmartObjectManager.php

示例15: execute

 /**
  * This is the main method that is called when a task is executed
  * It MUST be implemented by all classes inheriting from this one
  * Note that there is no error handling, errors and failures are expected
  * to be handled and logged by the client implementations.
  * Should return true on successful execution, false on error.
  *
  * @return boolean Returns true on successful execution, false on error
  */
 public function execute()
 {
     $success = false;
     $this->init();
     /** @var \TYPO3\CMS\Core\Registry $registry */
     $registry = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Registry');
     $syncLock = $registry->get(static::$package, 'synchronisationLock');
     $content = GeneralUtility::getUrl($this->config['masterUrl']);
     if ($content && ($syncLock === 0 || $syncLock < time())) {
         $lockUntil = time() - $this->config['updateInterval'] + self::LOCK_INTERVAL;
         $registry->set(static::$package, 'synchronisationLock', $lockUntil);
         $response = json_decode($content, true);
         if ($response['success']) {
             $key = $this->config['preSharedKey'];
             $encrypted = $response['data'];
             $data = rtrim(mcrypt_decrypt(MCRYPT_RIJNDAEL_256, md5($key), base64_decode($encrypted), MCRYPT_MODE_CBC, md5(md5($key))), "");
             $records = json_decode($data, true);
             if (count($records)) {
                 $this->synchronizeUsers($records);
                 $success = true;
             } else {
                 GeneralUtility::sysLog('No users to be synchronized', self::$extKey, 3);
             }
         } else {
             GeneralUtility::sysLog($response['errors'][0], self::$extKey, 3);
         }
         $registry->set(static::$package, 'synchronisationLock', 0);
     }
     return $success;
 }
开发者ID:sruegg,项目名称:t3ext-causal_accounts,代码行数:39,代码来源:SynchronizationTask.php


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