php TYPO3-CMS-Backend-Utility-BackendUtility类(方法)实例源码

下面列出了php TYPO3-CMS-Backend-Utility-BackendUtility 类(方法)源码代码实例,从而了解它的用法。

作者:TYPO3Incubato    项目:TYPO3.CM   
/**
  * @param array $arguments
  * @param callable $renderChildrenClosure
  * @param RenderingContextInterface $renderingContext
  *
  * @return string
  */
 public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
 {
     $id = GeneralUtility::_GP('id');
     $pageRecord = BackendUtility::readPageAccess($id, $GLOBALS['BE_USER']->getPagePermsClause(1));
     // Add icon with clickmenu, etc:
     /** @var IconFactory $iconFactory */
     $iconFactory = GeneralUtility::makeInstance(IconFactory::class);
     if ($pageRecord['uid']) {
         // If there IS a real page
         $altText = BackendUtility::getRecordIconAltText($pageRecord, 'pages');
         $theIcon = '<span title="' . $altText . '">' . $iconFactory->getIconForRecord('pages', $pageRecord, Icon::SIZE_SMALL)->render() . '</span>';
         // Make Icon:
         $theIcon = BackendUtility::wrapClickMenuOnIcon($theIcon, 'pages', $pageRecord['uid']);
         // Setting icon with clickmenu + uid
         $theIcon .= ' <em>[PID: ' . $pageRecord['uid'] . ']</em>';
     } else {
         // On root-level of page tree
         // Make Icon
         $theIcon = '<span title="' . htmlspecialchars($GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename']) . '">' . $iconFactory->getIcon('apps-pagetree-page-domain', Icon::SIZE_SMALL)->render() . '</span>';
         if ($GLOBALS['BE_USER']->user['admin']) {
             $theIcon = BackendUtility::wrapClickMenuOnIcon($theIcon, 'pages', 0);
         }
     }
     return $theIcon;
 }

作者:Mr-Robot    项目:TYPO3.CM   
/**
  * Parses the passed TS-Config using conditions and caching
  *
  * @param string $TStext The TSConfig being parsed
  * @param string $type The type of TSConfig (either "userTS" or "PAGES")
  * @param integer $id The uid of the page being handled
  * @param array $rootLine The rootline of the page being handled
  * @return array Array containing the parsed TSConfig and a flag whether the content was retrieved from cache
  */
 public function parseTSconfig($TStext, $type, $id = 0, array $rootLine = array())
 {
     $this->type = $type;
     $this->id = $id;
     $this->rootLine = $rootLine;
     $hash = md5($type . ':' . $TStext);
     $cachedContent = BackendUtility::getHash($hash);
     if (is_array($cachedContent)) {
         $storedData = $cachedContent[0];
         $storedMD5 = $cachedContent[1];
         $storedData['match'] = array();
         $storedData = $this->matching($storedData);
         $checkMD5 = md5(serialize($storedData));
         if ($checkMD5 == $storedMD5) {
             $res = array('TSconfig' => $storedData['TSconfig'], 'cached' => 1);
         } else {
             $shash = md5($checkMD5 . $hash);
             $cachedSpec = BackendUtility::getHash($shash);
             if (is_array($cachedSpec)) {
                 $storedData = $cachedSpec;
                 $res = array('TSconfig' => $storedData['TSconfig'], 'cached' => 1);
             } else {
                 $storeData = $this->parseWithConditions($TStext);
                 BackendUtility::storeHash($shash, $storeData, $type . '_TSconfig');
                 $res = array('TSconfig' => $storeData['TSconfig'], 'cached' => 0);
             }
         }
     } else {
         $storeData = $this->parseWithConditions($TStext);
         $md5 = md5(serialize($storeData));
         BackendUtility::storeHash($hash, array($storeData, $md5), $type . '_TSconfig');
         $res = array('TSconfig' => $storeData['TSconfig'], 'cached' => 0);
     }
     return $res;
 }

作者:adroll    项目:TYPO3.CM   
/**
  * Wrapping icon in browse tree
  *
  * @param string $thePageIcon Icon IMG code
  * @param array $row Data row for element.
  * @return string Page icon
  */
 public function wrapIcon($thePageIcon, &$row)
 {
     // If the record is locked, present a warning sign.
     if ($lockInfo = \TYPO3\CMS\Backend\Utility\BackendUtility::isRecordLocked('pages', $row['uid'])) {
         $aOnClick = 'alert(' . GeneralUtility::quoteJSvalue($lockInfo['msg']) . ');return false;';
         $lockIcon = '<a href="#" onclick="' . htmlspecialchars($aOnClick) . '">' . IconUtility::getSpriteIcon('status-warning-in-use', array('title' => $lockInfo['msg'])) . '</a>';
     } else {
         $lockIcon = '';
     }
     // Wrap icon in click-menu link.
     if (!$this->ext_IconMode) {
         $thePageIcon = $GLOBALS['TBE_TEMPLATE']->wrapClickMenuOnIcon($thePageIcon, 'pages', $row['uid'], 0, '&bank=' . $this->bank);
     } elseif ($this->ext_IconMode === 'titlelink') {
         $aOnClick = 'return jumpTo(' . GeneralUtility::quoteJSvalue($this->getJumpToParam($row)) . ',this,' . GeneralUtility::quoteJSvalue($this->treeName) . ');';
         $thePageIcon = '<a href="#" onclick="' . htmlspecialchars($aOnClick) . '">' . $thePageIcon . '</a>';
     }
     // Wrap icon in a drag/drop span.
     $dragDropIcon = '<span class="dragIcon" id="dragIconID_' . $row['uid'] . '">' . $thePageIcon . '</span>';
     // Add Page ID:
     $pageIdStr = '';
     if ($this->ext_showPageId) {
         $pageIdStr = '<span class="dragId">[' . $row['uid'] . ']</span> ';
     }
     // Call stats information hook
     $stat = '';
     if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['GLOBAL']['recStatInfoHooks'])) {
         $_params = array('pages', $row['uid']);
         foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['GLOBAL']['recStatInfoHooks'] as $_funcRef) {
             $stat .= GeneralUtility::callUserFunction($_funcRef, $_params, $this);
         }
     }
     return $dragDropIcon . $lockIcon . $pageIdStr . $stat;
 }

作者:hlo    项目:TYPO3.CM   
/**
  * MAIN function for page information display
  *
  * @return string Output HTML for the module.
  */
 public function main()
 {
     $theOutput = $this->pObj->doc->header($this->getLanguageService()->sL('LLL:EXT:frontend/Resources/Private/Language/locallang_webinfo.xlf:page_title'));
     $dblist = GeneralUtility::makeInstance(PageLayoutView::class);
     $dblist->descrTable = '_MOD_web_info';
     $dblist->thumbs = 0;
     $dblist->script = BackendUtility::getModuleUrl('web_info');
     $dblist->showIcon = 0;
     $dblist->setLMargin = 0;
     $dblist->agePrefixes = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.minutesHoursDaysYears');
     $dblist->pI_showUser = 1;
     // PAGES:
     $this->pObj->MOD_SETTINGS['pages_levels'] = $this->pObj->MOD_SETTINGS['depth'];
     // ONLY for the sake of dblist module which uses this value.
     $h_func = BackendUtility::getDropdownMenu($this->pObj->id, 'SET[depth]', $this->pObj->MOD_SETTINGS['depth'], $this->pObj->MOD_MENU['depth']);
     $h_func .= BackendUtility::getDropdownMenu($this->pObj->id, 'SET[pages]', $this->pObj->MOD_SETTINGS['pages'], $this->pObj->MOD_MENU['pages']);
     $dblist->start($this->pObj->id, 'pages', 0);
     $dblist->generateList();
     // CSH
     $theOutput .= $this->pObj->doc->section('', BackendUtility::cshItem($dblist->descrTable, 'pagetree_overview', null, '|<br />') . '<div class="form-inline form-inline-spaced">' . $h_func . '</div>' . $dblist->HTMLcode, 0, 1);
     // Additional footer content
     $footerContentHook = $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/web_info/class.tx_cms_webinfo.php']['drawFooterHook'];
     if (is_array($footerContentHook)) {
         foreach ($footerContentHook as $hook) {
             $params = array();
             $theOutput .= GeneralUtility::callUserFunction($hook, $params, $this);
         }
     }
     return $theOutput;
 }

作者:mkalu    项目:calendariz   
/**
  * Get event list
  *
  * @param $events
  *
  * @return string
  */
 protected function getEventList($events)
 {
     $items = [];
     foreach ($events as $event) {
         $startDateStamp = $event['start_date'] instanceof \DateTime ? $event['start_date']->getTimestamp() : $event['start_date'];
         $startDate = strftime('%a %d.%m.%G', $startDateStamp);
         $endDateStamp = $event['end_date'] instanceof \DateTime ? $event['end_date']->getTimestamp() : $event['end_date'];
         $endDate = strftime('%a %d.%m.%G', $endDateStamp);
         $entry = $startDate . ' - ' . $endDate;
         if (!$event['all_day']) {
             $start = BackendUtility::time($event['start_time'], false);
             if ((int) $event['end_time'] === AbstractTimeTable::DAY_END) {
                 $end = '"' . TranslateUtility::get('openEndTime') . '"';
             } else {
                 $end = BackendUtility::time($event['end_time'], false);
             }
             $entry .= ' (' . $start . ' - ' . $end . ')';
         }
         $items[] = $entry;
     }
     if (!sizeof($items)) {
         $items[] = TranslateUtility::get('noEvents');
     }
     return '<ul><li>' . implode('</li><li>', $items) . '</li></ul>';
 }

作者:hlo    项目:TYPO3.CM   
/**
  * Main function, adding the item to input menuItems array
  *
  * @param ClickMenu $backRef References to parent clickmenu objects.
  * @param array $menuItems Array of existing menu items accumulated. New element added to this.
  * @param string $table Table name of the element
  * @param int $uid Record UID of the element
  * @return array Modified menuItems array
  */
 public function main(&$backRef, $menuItems, $table, $uid)
 {
     $localItems = array();
     if (!$backRef->cmLevel && $uid > 0 && $GLOBALS['BE_USER']->check('modules', 'web_txversionM1')) {
         // Returns directly, because the clicked item was not from the pages table
         if (in_array('versioning', $backRef->disabledItems) || !$GLOBALS['TCA'][$table] || !$GLOBALS['TCA'][$table]['ctrl']['versioningWS']) {
             return $menuItems;
         }
         // Adds the regular item
         $LL = $this->includeLL();
         // "Versioning" element added:
         $url = \TYPO3\CMS\Backend\Utility\BackendUtility::getModuleUrl('web_txversionM1', array('table' => $table, 'uid' => $uid));
         $localItems[] = $backRef->linkItem($GLOBALS['LANG']->getLLL('title', $LL), $backRef->excludeIcon($this->iconFactory->getIcon('actions-version-open', Icon::SIZE_SMALL)->render()), $backRef->urlRefForCM($url), true);
         // Find position of "delete" element:
         $c = 0;
         foreach ($menuItems as $k => $value) {
             $c++;
             if ($k === 'delete') {
                 break;
             }
         }
         // .. subtract two (delete item + divider line)
         $c -= 2;
         // ... and insert the items just before the delete element.
         array_splice($menuItems, $c, 0, $localItems);
     }
     return $menuItems;
 }

作者:noxlud    项目:TYPO3v4-Cor   
/**
  * Main function
  * Will issue a location-header, redirecting either BACK or to a new alt_doc.php instance...
  *
  * @return void
  * @todo Define visibility
  */
 public function main()
 {
     // Get this record
     $origRow = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecord($this->P['table'], $this->P['uid']);
     // Get TSconfig for it.
     $TSconfig = \TYPO3\CMS\Backend\Utility\BackendUtility::getTCEFORM_TSconfig($this->table, is_array($origRow) ? $origRow : array('pid' => $this->P['pid']));
     // Set [params][pid]
     if (substr($this->P['params']['pid'], 0, 3) == '###' && substr($this->P['params']['pid'], -3) == '###') {
         $this->pid = intval($TSconfig['_' . substr($this->P['params']['pid'], 3, -3)]);
     } else {
         $this->pid = intval($this->P['params']['pid']);
     }
     // Make redirect:
     // If pid is blank OR if id is set, then return...
     if (!strcmp($this->pid, '') || strcmp($this->id, '')) {
         $redirectUrl = \TYPO3\CMS\Core\Utility\GeneralUtility::sanitizeLocalUrl($this->P['returnUrl']);
     } else {
         // Otherwise, show the list:
         $urlParameters = array();
         $urlParameters['id'] = $this->pid;
         $urlParameters['table'] = $this->P['params']['table'];
         $urlParameters['returnUrl'] = \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('REQUEST_URI');
         $redirectUrl = \TYPO3\CMS\Backend\Utility\BackendUtility::getModuleUrl('web_list', $urlParameters);
     }
     \TYPO3\CMS\Core\Utility\HttpUtility::redirect($redirectUrl);
 }

作者:khanhdeu    项目:typo3tes   
/**
  * Get the referenced record from the database
  *
  * Using the GET or POST variable 'P'
  *
  * @return boolean|\TYPO3\CMS\Form\Domain\Model\Content if found, FALSE if not
  */
 public function getRecord()
 {
     $record = FALSE;
     $getPostVariables = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('P');
     $table = (string) $getPostVariables['table'];
     $recordId = (int) $getPostVariables['uid'];
     $row = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecord($table, $recordId);
     if (is_array($row)) {
         // strip off the leading "[Translate to XY]" text after localizing the original record
         $languageField = $GLOBALS['TCA']['tt_content']['ctrl']['languageField'];
         $transOrigPointerField = $GLOBALS['TCA']['tt_content']['ctrl']['transOrigPointerField'];
         if ($row[$languageField] > 0 && $row[$transOrigPointerField] > 0) {
             $bodytext = preg_replace('/^\\[.*?\\] /', '', $row['bodytext'], 1);
         } else {
             $bodytext = $row['bodytext'];
         }
         /** @var $typoScriptParser \TYPO3\CMS\Core\TypoScript\Parser\TypoScriptParser */
         $typoScriptParser = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\TypoScript\\Parser\\TypoScriptParser');
         $typoScriptParser->parse($bodytext);
         /** @var $record \TYPO3\CMS\Form\Domain\Model\Content */
         $record = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Form\\Domain\\Model\\Content');
         $record->setUid($row['uid']);
         $record->setPageId($row['pid']);
         $record->setTyposcript($typoScriptParser->setup);
     }
     return $record;
 }

作者:khanhdeu    项目:typo3tes   
/**
  * This method forwards the call to Bootstrap's run() method. This method is invoked by the mod.php
  * function of TYPO3.
  *
  * @param string $moduleSignature
  * @throws \RuntimeException
  * @return boolean TRUE, if the request request could be dispatched
  * @see run()
  */
 public function callModule($moduleSignature)
 {
     if (!isset($GLOBALS['TBE_MODULES']['_configuration'][$moduleSignature])) {
         return FALSE;
     }
     $moduleConfiguration = $GLOBALS['TBE_MODULES']['_configuration'][$moduleSignature];
     // Check permissions and exit if the user has no permission for entry
     $GLOBALS['BE_USER']->modAccess($moduleConfiguration, TRUE);
     $id = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('id');
     if ($id && \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($id)) {
         // Check page access
         $permClause = $GLOBALS['BE_USER']->getPagePermsClause(TRUE);
         $access = is_array(\TYPO3\CMS\Backend\Utility\BackendUtility::readPageAccess((int) $id, $permClause));
         if (!$access) {
             throw new \RuntimeException('You don\'t have access to this page', 1289917924);
         }
     }
     // BACK_PATH is the path from the typo3/ directory from within the
     // directory containing the controller file. We are using mod.php dispatcher
     // and thus we are already within typo3/ because we call typo3/mod.php
     $GLOBALS['BACK_PATH'] = '';
     $configuration = array('extensionName' => $moduleConfiguration['extensionName'], 'pluginName' => $moduleSignature);
     if (isset($moduleConfiguration['vendorName'])) {
         $configuration['vendorName'] = $moduleConfiguration['vendorName'];
     }
     $bootstrap = $this->objectManager->get('TYPO3\\CMS\\Extbase\\Core\\BootstrapInterface');
     $content = $bootstrap->run('', $configuration);
     print $content;
     return TRUE;
 }

作者:viso    项目:medi   
/**
  * @param File $file
  * @return string
  */
 protected function getUri(File $file)
 {
     $metadataProperties = $file->_getMetaData();
     $parameterName = sprintf('edit[sys_file_metadata][%s]', $metadataProperties['uid']);
     $uri = BackendUtility::getModuleUrl('record_edit', array($parameterName => 'edit', 'returnUrl' => BackendUtility::getModuleUrl(GeneralUtility::_GP('M'), $this->getAdditionalParameters())));
     return $uri;
 }

作者:khanhdeu    项目:typo3tes   
/**
  * Provides form code and javascript for the user setup.
  *
  * @param array $parameters Parameters to the script
  * @param \TYPO3\CMS\Setup\Controller\SetupModuleController $userSetupObject Calling object: user setup module
  * @return string The code for the user setup
  */
 public function getLoginScripts(array $parameters, \TYPO3\CMS\Setup\Controller\SetupModuleController $userSetupObject)
 {
     $content = '';
     if ($this->isRsaAvailable()) {
         // If we can get the backend, we can proceed
         $backend = \TYPO3\CMS\Rsaauth\Backend\BackendFactory::getBackend();
         $javascriptPath = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath('rsaauth') . 'resources/';
         $files = array('jsbn/jsbn.js', 'jsbn/prng4.js', 'jsbn/rng.js', 'jsbn/rsa.js', 'jsbn/base64.js', 'rsaauth_min.js');
         $content = '';
         foreach ($files as $file) {
             $content .= '<script type="text/javascript" src="' . \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_SITE_URL') . $javascriptPath . $file . '"></script>';
         }
         // Generate a new key pair
         $keyPair = $backend->createNewKeyPair();
         // Save private key
         $storage = \TYPO3\CMS\Rsaauth\Storage\StorageFactory::getStorage();
         /** @var $storage \TYPO3\CMS\Rsaauth\Storage\AbstractStorage */
         $storage->put($keyPair->getPrivateKey());
         // Add form tag
         $form = '<form action="' . \TYPO3\CMS\Backend\Utility\BackendUtility::getModuleUrl('user_setup') . '" method="post" name="usersetup" enctype="application/x-www-form-urlencoded" onsubmit="tx_rsaauth_encryptUserSetup();">';
         // Add RSA hidden fields
         $form .= '<input type="hidden" id="rsa_n" name="n" value="' . htmlspecialchars($keyPair->getPublicKeyModulus()) . '" />';
         $form .= '<input type="hidden" id="rsa_e" name="e" value="' . sprintf('%x', $keyPair->getExponent()) . '" />';
         $userSetupObject->doc->form = $form;
     }
     return $content;
 }

作者:adroll    项目:TYPO3.CM   
/**
     * Return JS configuration of the htmlArea plugins registered by the extension
     *
     * @param string $rteNumberPlaceholder A dummy string for JS arrays
     * @return string JS configuration for registered plugins, in this case, JS configuration of block elements
     */
    public function buildJavascriptConfiguration($rteNumberPlaceholder)
    {
        $registerRTEinJavascriptString = '';
        $button = 'link';
        if (in_array($button, $this->toolbar)) {
            if (!is_array($this->thisConfig['buttons.']) || !is_array($this->thisConfig['buttons.'][$button . '.'])) {
                $registerRTEinJavascriptString .= '
			RTEarea[' . $rteNumberPlaceholder . '].buttons.' . $button . ' = new Object();';
            }
            $registerRTEinJavascriptString .= '
			RTEarea[' . $rteNumberPlaceholder . '].buttons.' . $button . '.pathLinkModule = ' . GeneralUtility::quoteJSvalue(BackendUtility::getModuleUrl('rtehtmlarea_wizard_browse_links')) . ';';
            if ($this->htmlAreaRTE->is_FE()) {
                $RTEProperties = $this->htmlAreaRTE->RTEsetup;
            } else {
                $RTEProperties = $this->htmlAreaRTE->RTEsetup['properties'];
            }
            if (is_array($RTEProperties['classesAnchor.'])) {
                $registerRTEinJavascriptString .= '
			RTEarea[' . $rteNumberPlaceholder . '].buttons.' . $button . '.classesAnchorUrl = "' . $this->htmlAreaRTE->writeTemporaryFile('classesAnchor_' . $this->htmlAreaRTE->contentLanguageUid, 'js', $this->buildJSClassesAnchorArray()) . '";';
            }
            $registerRTEinJavascriptString .= '
			RTEarea[' . $rteNumberPlaceholder . '].buttons.' . $button . '.additionalAttributes = "data-htmlarea-external' . ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$this->extensionKey]['plugins'][$this->pluginName]['additionalAttributes'] ? ',' . $GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$this->extensionKey]['plugins'][$this->pluginName]['additionalAttributes'] : '') . '";';
        }
        return $registerRTEinJavascriptString;
    }

作者:adroll    项目:TYPO3.CM   
/**
  * Main function, adding the item to input menuItems array
  *
  * @param ClickMenu $backRef References to parent clickmenu objects.
  * @param array $menuItems Array of existing menu items accumulated. New element added to this.
  * @param string $table Table name of the element
  * @param int $uid Record UID of the element
  * @return array Modified menuItems array
  */
 public function main(&$backRef, $menuItems, $table, $uid)
 {
     $localItems = array();
     if (!$backRef->cmLevel && $uid > 0 && $GLOBALS['BE_USER']->check('modules', 'web_txversionM1')) {
         // Returns directly, because the clicked item was not from the pages table
         if (in_array('versioning', $backRef->disabledItems) || !$GLOBALS['TCA'][$table] || !$GLOBALS['TCA'][$table]['ctrl']['versioningWS']) {
             return $menuItems;
         }
         // Adds the regular item
         $LL = $this->includeLL();
         // "Versioning" element added:
         $url = \TYPO3\CMS\Backend\Utility\BackendUtility::getModuleUrl('web_txversionM1', array('table' => $table, 'uid' => $uid));
         $localItems[] = $backRef->linkItem($GLOBALS['LANG']->getLLL('title', $LL), $backRef->excludeIcon('<img src="' . $backRef->backPath . \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('version') . 'Resources/Public/Icons/module-version.png" width="15" height="12" border="0" align="top" alt="" />'), $backRef->urlRefForCM($url), TRUE);
         // Find position of "delete" element:
         $c = 0;
         foreach ($menuItems as $k => $value) {
             $c++;
             if ($k === 'delete') {
                 break;
             }
         }
         // .. subtract two (delete item + divider line)
         $c -= 2;
         // ... and insert the items just before the delete element.
         array_splice($menuItems, $c, 0, $localItems);
     }
     return $menuItems;
 }

作者:raimundlandi    项目:winkel.de-DE   
/**
  * Generate a different preview link     *
  * @param string $status status
  * @param string $table table name
  * @param integer $recordUid id of the record
  * @param array $fields fieldArray
  * @param \TYPO3\CMS\Core\DataHandling\DataHandler $parentObject parent Object
  * @return void
  */
 public function processDatamap_afterDatabaseOperations($status, $table, $recordUid, array $fields, \TYPO3\CMS\Core\DataHandling\DataHandler $parentObject)
 {
     // Clear category cache
     if ($table === 'sys_category') {
         /** @var \TYPO3\CMS\Core\Cache\Frontend\FrontendInterface $cache */
         $cache = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Cache\\CacheManager')->getCache('cache_news_category');
         $cache->flush();
     }
     // Preview link
     if ($table === 'tx_news_domain_model_news') {
         // direct preview
         if (!is_numeric($recordUid)) {
             $recordUid = $parentObject->substNEWwithIDs[$recordUid];
         }
         if (isset($GLOBALS['_POST']['_savedokview_x']) && !$fields['type']) {
             // If "savedokview" has been pressed and current article has "type" 0 (= normal news article)
             $pagesTsConfig = \TYPO3\CMS\Backend\Utility\BackendUtility::getPagesTSconfig($GLOBALS['_POST']['popViewId']);
             if ($pagesTsConfig['tx_news.']['singlePid']) {
                 $record = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecord('tx_news_domain_model_news', $recordUid);
                 $parameters = array('no_cache' => 1, 'tx_news_pi1[controller]' => 'News', 'tx_news_pi1[action]' => 'detail', 'tx_news_pi1[news_preview]' => $record['uid']);
                 if ($record['sys_language_uid'] > 0) {
                     if ($record['l10n_parent'] > 0) {
                         $parameters['tx_news_pi1[news_preview]'] = $record['l10n_parent'];
                     }
                     $parameters['L'] = $record['sys_language_uid'];
                 }
                 $GLOBALS['_POST']['popViewId_addParams'] = \TYPO3\CMS\Core\Utility\GeneralUtility::implodeArrayForUrl('', $parameters, '', FALSE, TRUE);
                 $GLOBALS['_POST']['popViewId'] = $pagesTsConfig['tx_news.']['singlePid'];
             }
         }
     }
 }

作者:plan2ne    项目:TYPO3.CM   
/**
  * This will render a selector box element, or possibly a special construction with two selector boxes.
  *
  * @return array As defined in initializeResultArray() of AbstractNode
  */
 public function render()
 {
     $table = $this->globalOptions['table'];
     $field = $this->globalOptions['fieldName'];
     $row = $this->globalOptions['databaseRow'];
     $parameterArray = $this->globalOptions['parameterArray'];
     // Field configuration from TCA:
     $config = $parameterArray['fieldConf']['config'];
     $disabled = '';
     if ($this->isGlobalReadonly() || $config['readOnly']) {
         $disabled = ' disabled="disabled"';
     }
     $this->resultArray = $this->initializeResultArray();
     // "Extra" configuration; Returns configuration for the field based on settings found in the "types" fieldlist.
     $specConf = BackendUtility::getSpecConfParts($parameterArray['fieldConf']['defaultExtras']);
     $selItems = FormEngineUtility::getSelectItems($table, $field, $row, $parameterArray);
     // Creating the label for the "No Matching Value" entry.
     $noMatchingLabel = isset($parameterArray['fieldTSConfig']['noMatchingValue_label']) ? $this->getLanguageService()->sL($parameterArray['fieldTSConfig']['noMatchingValue_label']) : '[ ' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:labels.noMatchingValue') . ' ]';
     $html = $this->getSingleField_typeSelect_singlebox($table, $field, $row, $parameterArray, $config, $selItems, $noMatchingLabel);
     // Wizards:
     if (!$disabled) {
         $html = $this->renderWizards(array($html), $config['wizards'], $table, $row, $field, $parameterArray, $parameterArray['itemFormElName'], $specConf);
     }
     $this->resultArray['html'] = $html;
     return $this->resultArray;
 }

作者:nicksergi    项目:TYPO3v4-Cor   
/**
  * Checks whether a an BE user account named admin with default password exists.
  *
  * @return \TYPO3\CMS\Reports\Status An tx_reports_reports_status_Status object representing whether a default admin account exists
  */
 protected function getAdminAccountStatus()
 {
     $value = $GLOBALS['LANG']->getLL('status_ok');
     $message = '';
     $severity = \TYPO3\CMS\Reports\Status::OK;
     $whereClause = 'username = ' . $GLOBALS['TYPO3_DB']->fullQuoteStr('admin', 'be_users') . \TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause('be_users');
     $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid, username, password', 'be_users', $whereClause);
     if ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
         $secure = TRUE;
         // Check against salted password
         if (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('saltedpasswords')) {
             if (\TYPO3\CMS\Saltedpasswords\Utility\SaltedPasswordsUtility::isUsageEnabled('BE')) {
                 /** @var $saltingObject \TYPO3\CMS\Saltedpasswords\Salt\SaltInterface */
                 $saltingObject = \TYPO3\CMS\Saltedpasswords\Salt\SaltFactory::getSaltingInstance($row['password']);
                 if (is_object($saltingObject)) {
                     if ($saltingObject->checkPassword('password', $row['password'])) {
                         $secure = FALSE;
                     }
                 }
             }
         }
         // Check against plain MD5
         if ($row['password'] === '5f4dcc3b5aa765d61d8327deb882cf99') {
             $secure = FALSE;
         }
         if (!$secure) {
             $value = $GLOBALS['LANG']->getLL('status_insecure');
             $severity = \TYPO3\CMS\Reports\Status::ERROR;
             $editUserAccountUrl = 'alt_doc.php?returnUrl=mod.php?M=tools_txreportsM1&edit[be_users][' . $row['uid'] . ']=edit';
             $message = sprintf($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:warning.backend_admin'), '<a href="' . $editUserAccountUrl . '">', '</a>');
         }
     }
     $GLOBALS['TYPO3_DB']->sql_free_result($res);
     return \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Reports\\Status', $GLOBALS['LANG']->getLL('status_adminUserAccount'), $value, $message, $severity);
 }

作者:TYPO3Incubato    项目:TYPO3.CM   
/**
  * Renders a HTML Block with file information
  *
  * @param File $file
  * @return string
  */
 protected function renderFileInformationContent(File $file = null)
 {
     /** @var LanguageService $lang */
     $lang = $GLOBALS['LANG'];
     if ($file !== null) {
         $processedFile = $file->process(ProcessedFile::CONTEXT_IMAGEPREVIEW, array('width' => 150, 'height' => 150));
         $previewImage = $processedFile->getPublicUrl(true);
         $content = '';
         if ($file->isMissing()) {
             $flashMessage = \TYPO3\CMS\Core\Resource\Utility\BackendUtility::getFlashMessageForMissingFile($file);
             $content .= $flashMessage->render();
         }
         if ($previewImage) {
             $content .= '<img src="' . htmlspecialchars($previewImage) . '" ' . 'width="' . $processedFile->getProperty('width') . '" ' . 'height="' . $processedFile->getProperty('height') . '" ' . 'alt="" class="t3-tceforms-sysfile-imagepreview" />';
         }
         $content .= '<strong>' . htmlspecialchars($file->getName()) . '</strong>';
         $content .= ' (' . htmlspecialchars(GeneralUtility::formatSize($file->getSize())) . 'bytes)<br />';
         $content .= BackendUtility::getProcessedValue('sys_file', 'type', $file->getType()) . ' (' . $file->getMimeType() . ')<br />';
         $content .= $lang->sL('LLL:EXT:lang/locallang_misc.xlf:fileMetaDataLocation', true) . ': ';
         $content .= htmlspecialchars($file->getStorage()->getName()) . ' - ' . htmlspecialchars($file->getIdentifier()) . '<br />';
         $content .= '<br />';
     } else {
         $content = '<h2>' . $lang->sL('LLL:EXT:lang/locallang_misc.xlf:fileMetaErrorInvalidRecord', true) . '</h2>';
     }
     return $content;
 }

作者:nicksergi    项目:TYPO3v4-Cor   
/**
  * MAIN function for page information display
  *
  * @return string Output HTML for the module.
  * @todo Define visibility
  */
 public function main()
 {
     global $BACK_PATH, $LANG, $SOBE;
     $dblist = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\View\\PageLayoutView');
     $dblist->descrTable = '_MOD_' . $GLOBALS['MCONF']['name'];
     $dblist->backPath = $BACK_PATH;
     $dblist->thumbs = 0;
     $dblist->script = 'index.php';
     $dblist->showIcon = 0;
     $dblist->setLMargin = 0;
     $dblist->agePrefixes = $LANG->sL('LLL:EXT:lang/locallang_core.php:labels.minutesHoursDaysYears');
     $dblist->pI_showUser = 1;
     // PAGES:
     $this->pObj->MOD_SETTINGS['pages_levels'] = $this->pObj->MOD_SETTINGS['depth'];
     // ONLY for the sake of dblist module which uses this value.
     $h_func = \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncMenu($this->pObj->id, 'SET[depth]', $this->pObj->MOD_SETTINGS['depth'], $this->pObj->MOD_MENU['depth'], 'index.php');
     $h_func .= \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncMenu($this->pObj->id, 'SET[pages]', $this->pObj->MOD_SETTINGS['pages'], $this->pObj->MOD_MENU['pages'], 'index.php');
     $dblist->start($this->pObj->id, 'pages', 0);
     $dblist->generateList();
     // CSH
     $theOutput .= $this->pObj->doc->header($LANG->getLL('page_title'));
     $theOutput .= $this->pObj->doc->section('', \TYPO3\CMS\Backend\Utility\BackendUtility::cshItem($dblist->descrTable, 'pagetree_overview', $GLOBALS['BACK_PATH'], '|<br />') . $h_func . $dblist->HTMLcode, 0, 1);
     // Additional footer content
     $footerContentHook = $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/web_info/class.tx_cms_webinfo.php']['drawFooterHook'];
     if (is_array($footerContentHook)) {
         foreach ($footerContentHook as $hook) {
             $params = array();
             $theOutput .= \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($hook, $params, $this);
         }
     }
     return $theOutput;
 }

作者:khanhdeu    项目:typo3tes   
/**
  * 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);
         }
     }
 }

作者:khanhdeu    项目:typo3tes   
/**
  * @test
  */
 public function exportGroupFileAndFileReferenceItem()
 {
     $this->export->setRecordTypesIncludeFields(array('pages' => array('title', 'deleted', 'doktype', 'hidden', 'perms_everybody'), 'sys_file' => array('storage', 'type', 'metadata', 'extension', 'identifier', 'identifier_hash', 'folder_hash', 'mime_type', 'name', 'sha1', 'size', 'creation_date', 'modification_date'), 'sys_file_storage' => array('name', 'description', 'driver', 'configuration', 'is_default', 'is_browsable', 'is_public', 'is_writable', 'is_online'), 'tx_impexpgroupfiles_item' => array('title', 'deleted', 'hidden', 'images', 'image_references', 'flexform')));
     $this->export->relOnlyTables = array('sys_file', 'sys_file_storage');
     $this->export->export_addRecord('pages', BackendUtility::getRecord('pages', 2));
     $this->export->export_addRecord('tx_impexpgroupfiles_item', BackendUtility::getRecord('tx_impexpgroupfiles_item', 2));
     $this->setPageTree(2, 0);
     // After adding ALL records we set relations:
     for ($a = 0; $a < 10; $a++) {
         $addR = $this->export->export_addDBRelations($a);
         if (!count($addR)) {
             break;
         }
     }
     // hacky, but the timestamp will change on every clone, so set the file
     // modification timestamp to the asserted value
     $success = @touch(PATH_site . 'uploads/tx_impexpgroupfiles/typo3_image4.jpg', 1393866824);
     if (!$success) {
         $this->markTestSkipped('Could not set file modification timestamp for a fixture binary file. This is required for running the test successful.');
     }
     $this->export->export_addFilesFromRelations();
     $this->export->export_addFilesFromSysFilesRecords();
     $out = $this->export->compileMemoryToFileContent('xml');
     $this->assertXmlStringEqualsXmlFile(__DIR__ . '/../../Fixtures/ImportExportXml/impexp-group-file-and-file_reference-item-in-ff.xml', $out);
 }


问题


面经


文章

微信
公众号

扫码关注公众号