本文整理汇总了PHP中TYPO3\CMS\Core\Page\PageRenderer::getCharSet方法的典型用法代码示例。如果您正苦于以下问题:PHP PageRenderer::getCharSet方法的具体用法?PHP PageRenderer::getCharSet怎么用?PHP PageRenderer::getCharSet使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\CMS\Core\Page\PageRenderer
的用法示例。
在下文中一共展示了PageRenderer::getCharSet方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addJS
/**
* method that adds JS files within the page renderer
*
* @param array $parameters : An array of available parameters while adding JS to the page renderer
* @param \TYPO3\CMS\Core\Page\PageRenderer $pageRenderer : The parent object that triggered this hook
*
* @return void
*/
protected function addJS($parameters, &$pageRenderer)
{
$formprotection = FormProtectionFactory::get();
if (count($parameters['jsFiles'])) {
if (method_exists($GLOBALS['SOBE']->doc, 'issueCommand')) {
/** @var \TYPO3\CMS\Backend\Clipboard\Clipboard $clipObj */
$clipObj = GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Clipboard\\Clipboard');
// Start clipboard
$clipObj->initializeClipboard();
$clipBoardHasContent = FALSE;
if (isset($clipObj->clipData['normal']['el']) && strpos(key($clipObj->clipData['normal']['el']), 'tt_content') !== FALSE) {
$pasteURL = str_replace('&', '&', $clipObj->pasteUrl('tt_content', 'DD_PASTE_UID', 0));
if (isset($clipObj->clipData['normal']['mode'])) {
$clipBoardHasContent = 'copy';
} else {
$clipBoardHasContent = 'move';
}
}
$moveParams = '&cmd[tt_content][DD_DRAG_UID][move]=DD_DROP_UID';
$moveURL = str_replace('&', '&', htmlspecialchars($GLOBALS['SOBE']->doc->issueCommand($moveParams, 1)));
$copyParams = '&cmd[tt_content][DD_DRAG_UID][copy]=DD_DROP_UID&DDcopy=1';
$copyURL = str_replace('&', '&', htmlspecialchars($GLOBALS['SOBE']->doc->issueCommand($copyParams, 1)));
// add JavaScript library
$pageRenderer->addJsFile($GLOBALS['BACK_PATH'] . ExtensionManagementUtility::extRelPath('gridelements') . 'Resources/Public/Backend/JavaScript/dbNewContentElWizardFixDTM.js', $type = 'text/javascript', $compress = TRUE, $forceOnTop = FALSE, $allWrap = '');
// add JavaScript library
$pageRenderer->addJsFile($GLOBALS['BACK_PATH'] . ExtensionManagementUtility::extRelPath('gridelements') . 'Resources/Public/Backend/JavaScript/GridElementsDD.js', $type = 'text/javascript', $compress = TRUE, $forceOnTop = FALSE, $allWrap = '');
// add JavaScript library
$pageRenderer->addJsFile($GLOBALS['BACK_PATH'] . ExtensionManagementUtility::extRelPath('gridelements') . 'Resources/Public/Backend/JavaScript/GridElementsListView.js', $type = 'text/javascript', $compress = TRUE, $forceOnTop = FALSE, $allWrap = '');
if (!$pageRenderer->getCharSet()) {
$pageRenderer->setCharSet($GLOBALS['LANG']->charSet ? $GLOBALS['LANG']->charSet : 'utf-8');
}
if (is_array($clipObj->clipData['normal']['el'])) {
$arrCBKeys = array_keys($clipObj->clipData['normal']['el']);
$intFirstCBEl = str_replace('tt_content|', '', $arrCBKeys[0]);
}
// pull locallang_db.xml to JS side - only the tx_gridelements_js-prefixed keys
$pageRenderer->addInlineLanguageLabelFile('EXT:gridelements/Resources/Private/Language/locallang_db.xml', 'tx_gridelements_js');
$pRaddExtOnReadyCode = '
TYPO3.l10n = {
localize: function(langKey){
return TYPO3.lang[langKey];
}
}
';
$allowedCTypesAndGridTypesClassesByColPos = array();
$layoutSetup = GeneralUtility::callUserFunction('TYPO3\\CMS\\Backend\\View\\BackendLayoutView->getSelectedBackendLayout', intval(GeneralUtility::_GP('id')), $this);
if (is_array($layoutSetup) && !empty($layoutSetup['__config']['backend_layout.']['rows.'])) {
foreach ($layoutSetup['__config']['backend_layout.']['rows.'] as $rows) {
foreach ($rows as $row) {
if (!empty($layoutSetup['__config']['backend_layout.']['rows.'])) {
foreach ($row as $col) {
$classes = '';
if ($col['allowed']) {
$allowed = explode(',', $col['allowed']);
foreach ($allowed as $ctypes) {
$ctypes = trim($ctypes);
if ($ctypes === '*') {
$classes = 't3-allow-all';
break;
} else {
$ctypes = explode(',', $ctypes);
foreach ($ctypes as $ctype) {
$classes .= 't3-allow-' . $ctype . ' ';
}
}
}
} else {
$classes = 't3-allow-all';
}
if ($col['allowedGridTypes']) {
$allowedGridTypes = explode(',', $col['allowedGridTypes']);
$classes .= 't3-allow-gridelements_pi1 ';
foreach ($allowedGridTypes as $gridTypes) {
$gridTypes = trim($gridTypes);
if ($gridTypes !== '*') {
$gridTypes = explode(',', $gridTypes);
foreach ($gridTypes as $gridType) {
$classes .= 't3-allow-gridtype-' . $gridType . ' ';
}
}
}
} else {
if ($classes !== 't3-allow-all') {
$classes .= 't3-allow-gridelements_pi1 ';
}
}
$allowedCTypesAndGridTypesClassesByColPos[] = $col['colPos'] . ':' . trim($classes);
}
}
}
}
}
//.........这里部分代码省略.........
示例2: addJSCSS
/**
* wrapper function called by hook (\TYPO3\CMS\Core\Page\PageRenderer->render-preProcess)
*
* @param array $parameters : An array of available parameters
* @param \TYPO3\CMS\Core\Page\PageRenderer $pageRenderer : The parent object that triggered this hook
*
* @return void
*/
public function addJSCSS($parameters, &$pageRenderer)
{
if (get_class($GLOBALS['SOBE']) === 'TYPO3\\CMS\\Recordlist\\RecordList') {
$pageRenderer->loadRequireJsModule('TYPO3/CMS/Gridelements/GridElementsOnReady');
return;
}
if (get_class($GLOBALS['SOBE']) === 'TYPO3\\CMS\\Backend\\Controller\\PageLayoutController') {
$iconFactory = GeneralUtility::makeInstance(IconFactory::class);
$pageRenderer->loadRequireJsModule('TYPO3/CMS/Gridelements/GridElementsOnReady');
$pageRenderer->loadRequireJsModule('TYPO3/CMS/Gridelements/GridElementsDragDrop');
$pageRenderer->loadRequireJsModule('TYPO3/CMS/Gridelements/GridElementsDragInWizard');
/** @var Clipboard $clipObj */
$clipObj = GeneralUtility::makeInstance(Clipboard::class);
// Start clipboard
$clipObj->initializeClipboard();
$clipObj->lockToNormal();
if (!$pageRenderer->getCharSet()) {
$pageRenderer->setCharSet($GLOBALS['LANG']->charSet ? $GLOBALS['LANG']->charSet : 'utf-8');
}
// pull locallang_db.xml to JS side - only the tx_gridelements_js-prefixed keys
$pageRenderer->addInlineLanguageLabelFile('EXT:gridelements/Resources/Private/Language/locallang_db.xml', 'tx_gridelements_js');
$pAddExtOnReadyCode = '
TYPO3.l10n = {
localize: function(langKey){
return TYPO3.lang[langKey];
}
}
';
$allowedContentTypesClassesByColPos = array();
$allowedGridTypesClassesByColPos = array();
$layoutSetup = GeneralUtility::callUserFunction('TYPO3\\CMS\\Backend\\View\\BackendLayoutView->getSelectedBackendLayout', intval(GeneralUtility::_GP('id')), $this);
if (is_array($layoutSetup) && !empty($layoutSetup['__config']['backend_layout.']['rows.'])) {
foreach ($layoutSetup['__config']['backend_layout.']['rows.'] as $rows) {
foreach ($rows as $row) {
if (!empty($layoutSetup['__config']['backend_layout.']['rows.'])) {
foreach ($row as $col) {
$classes = '';
$gridClasses = '';
if ($col['allowed']) {
$allowed = explode(',', $col['allowed']);
foreach ($allowed as $contentTypes) {
$contentTypes = trim($contentTypes);
if ($contentTypes === '*') {
$classes = 't3-allow-all';
break;
} else {
$contentTypes = explode(',', $contentTypes);
foreach ($contentTypes as $contentType) {
$classes .= 't3-allow-' . $contentType . ' ';
}
}
}
} else {
$classes = 't3-allow-all';
}
if ($col['allowedGridTypes']) {
$allowedGridTypes = explode(',', $col['allowedGridTypes']);
$classes .= 't3-allow-gridelements_pi1 ';
foreach ($allowedGridTypes as $gridTypes) {
$gridTypes = trim($gridTypes);
if ($gridTypes !== '*') {
$gridTypes = explode(',', $gridTypes);
foreach ($gridTypes as $gridType) {
$gridClasses .= 't3-allow-gridtype t3-allow-gridtype-' . $gridType . ' ';
}
}
}
if ($classes !== 't3-allow-all') {
$classes .= 't3-allow-gridelements_pi1 ';
}
}
$allowedContentTypesClassesByColPos[$col['colPos']] .= ' ' . trim($classes);
$allowedGridTypesClassesByColPos[$col['colPos']] .= ' ' . trim($gridClasses);
}
}
}
}
}
// add Ext.onReady() code from file
$pAddExtOnReadyCode .= "\n top.pageColumnsAllowedCTypes = " . json_encode($allowedContentTypesClassesByColPos) . ";\n top.pageColumnsAllowedGridTypes = " . json_encode($allowedGridTypesClassesByColPos) . ";\n top.pasteReferenceAllowed = " . ($this->getBackendUser()->checkAuthMode('tt_content', 'CType', 'shortcut', 'explicitAllow') ? 'true' : 'false') . ";\n top.skipDraggableDetails = " . ($this->getBackendUser()->uc['dragAndDropHideNewElementWizardInfoOverlay'] ? 'true' : 'false') . ";\n top.backPath = '" . $GLOBALS['BACK_PATH'] . "';\n top.browserUrl = '" . BackendUtility::getModuleUrl('wizard_element_browser') . "'";
$elFromTable = $clipObj->elFromTable('tt_content');
if (!empty($elFromTable)) {
$pasteItem = substr(key($elFromTable), 11);
$pasteRecord = BackendUtility::getRecord('tt_content', (int) $pasteItem);
$pasteTitle = $pasteRecord['header'] ? $pasteRecord['header'] : $pasteItem;
$copyMode = $clipObj->clipData['normal']['mode'] ? '-' . $clipObj->clipData['normal']['mode'] : '';
$pAddExtOnReadyCode .= "\n top.pasteIntoLinkTemplate = " . json_encode('<a data-pasteitem="' . $pasteItem . '" data-pastetitle="' . $pasteTitle . '" class="t3js-paste t3js-paste' . $copyMode . ' t3js-paste-into btn btn-default" title="' . $this->getLanguageService()->sL('LLL:EXT:gridelements/Resources/Private/Language/locallang_db.xml:tx_gridelements_js.pasteinto') . '">' . $iconFactory->getIcon('actions-document-paste-into', Icon::SIZE_SMALL)->render() . '</a>') . ";\n top.pasteAfterLinkTemplate = " . json_encode('<a data-pasteitem="' . $pasteItem . '" data-pastetitle="' . $pasteTitle . '" class="t3js-paste t3js-paste' . $copyMode . ' t3js-paste-after btn btn-default" title="' . $this->getLanguageService()->sL('LLL:EXT:gridelements/Resources/Private/Language/locallang_db.xml:tx_gridelements_js.pasteafter') . '">' . $iconFactory->getIcon('actions-document-paste-into', Icon::SIZE_SMALL)->render() . '</a>') . ";";
if ($this->getBackendUser()->checkAuthMode('tt_content', 'CType', 'shortcut', 'explicitAllow')) {
$pAddExtOnReadyCode .= "\n top.pasteReferencesAllowed = true;";
}
} else {
$pAddExtOnReadyCode .= "\n top.pasteIntoLinkTemplate = '';\n top.pasteAfterLinkTemplate = '';";
//.........这里部分代码省略.........