本文整理汇总了PHP中TYPO3\CMS\Core\Page\PageRenderer::addJsInlineCode方法的典型用法代码示例。如果您正苦于以下问题:PHP PageRenderer::addJsInlineCode方法的具体用法?PHP PageRenderer::addJsInlineCode怎么用?PHP PageRenderer::addJsInlineCode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\CMS\Core\Page\PageRenderer
的用法示例。
在下文中一共展示了PageRenderer::addJsInlineCode方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render
/**
* Load RequireJS code.
*
* @return void
* @api
*/
public function render()
{
$content = $this->renderChildren();
$this->pageRenderer->addJsInlineCode('vidi-inline', $content);
$configuration['paths']['Fab/Vidi'] = '../typo3conf/ext/vidi/Resources/Public/JavaScript';
$this->pageRenderer->addRequireJsConfiguration($configuration);
$this->pageRenderer->loadRequireJsModule('Fab/Vidi/Vidi/Main');
}
示例2: render
/**
* Main function generating the BE scaffolding
*
* @return void
*/
public function render()
{
$this->executeHook('renderPreProcess');
// Prepare the scaffolding, at this point extension may still add javascript and css
$logo = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Views\\LogoView');
$logo->setLogo('gfx/typo3logo_mini.png');
// Create backend scaffolding
$backendScaffolding = '
<div id="typo3-top-container" class="x-hide-display">
<div id="typo3-logo">' . $logo->render() . '</div>
<div id="typo3-top" class="typo3-top-toolbar">' . $this->renderToolbar() . '</div>
</div>';
/******************************************************
* Now put the complete backend document together
******************************************************/
foreach ($this->cssFiles as $cssFileName => $cssFile) {
$this->pageRenderer->addCssFile($cssFile);
// Load addditional css files to overwrite existing core styles
if (!empty($GLOBALS['TBE_STYLES']['stylesheets'][$cssFileName])) {
$this->pageRenderer->addCssFile($GLOBALS['TBE_STYLES']['stylesheets'][$cssFileName]);
}
}
if (!empty($this->css)) {
$this->pageRenderer->addCssInlineBlock('BackendInlineCSS', $this->css);
}
foreach ($this->jsFiles as $jsFile) {
$this->pageRenderer->addJsFile($jsFile);
}
$this->generateJavascript();
$this->pageRenderer->addJsInlineCode('BackendInlineJavascript', $this->js, FALSE);
$this->loadResourcesForRegisteredNavigationComponents();
// Add state provider
$GLOBALS['TBE_TEMPLATE']->setExtDirectStateProvider();
$states = $GLOBALS['BE_USER']->uc['BackendComponents']['States'];
// Save states in BE_USER->uc
$extOnReadyCode = '
Ext.state.Manager.setProvider(new TYPO3.state.ExtDirectProvider({
key: "BackendComponents.States",
autoRead: false
}));
';
if ($states) {
$extOnReadyCode .= 'Ext.state.Manager.getProvider().initState(' . json_encode($states) . ');';
}
$extOnReadyCode .= '
TYPO3.Backend = new TYPO3.Viewport(TYPO3.Viewport.configuration);
if (typeof console === "undefined") {
console = TYPO3.Backend.DebugConsole;
}
TYPO3.ContextHelpWindow.init();';
$this->pageRenderer->addExtOnReadyCode($extOnReadyCode);
// Set document title:
$title = $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'] ? $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'] . ' [TYPO3 ' . TYPO3_version . ']' : 'TYPO3 ' . TYPO3_version;
$this->content = $backendScaffolding;
// Renders the module page
$this->content = $GLOBALS['TBE_TEMPLATE']->render($title, $this->content);
$hookConfiguration = array('content' => &$this->content);
$this->executeHook('renderPostProcess', $hookConfiguration);
echo $this->content;
}
示例3: testAddJsInlineCode
/**
* test add JS inline
*/
public function testAddJsInlineCode()
{
$expectedReturnValue = 'var x = "testvar"';
$this->fixture->addJsInlineCode('test', 'var x = "testvar"');
$out = $this->fixture->render();
$this->assertContains($expectedReturnValue, $out);
}
示例4: addJSInlineCode
/**
* Add JS inline code
*
* @param string $name
* @param string $block
* @param boolean $compress
* @param boolean $forceOnTop
* @param string $position
*/
public function addJSInlineCode($name, $block, $compress = true, $forceOnTop = false, $position = 'footer')
{
if ($position === 'header') {
$this->pageRenderer->addJsInlineCode($name, $block, $compress, $forceOnTop);
} else {
$this->pageRenderer->addJsFooterInlineCode($name, $block, $compress, $forceOnTop);
}
}
示例5: main
/**
* Main function of the module. Write the content to $this->content
* If you chose "web" as main module, you will need to consider the $this->id parameter which will contain the uid-number of the page clicked in the page tree
*/
function main()
{
global $BE_USER, $LANG, $BACK_PATH, $TCA_DESCR, $TCA, $CLIENT, $TYPO3_CONF_VARS;
$PATH_TYPO3 = \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_SITE_URL') . 'typo3/';
if ($BE_USER->user["admin"]) {
// Draw the header.
$this->doc = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance("template");
$this->doc->backPath = $BACK_PATH;
$this->pageRenderer = $this->doc->getPageRenderer();
// Include Ext JS
$this->pageRenderer->loadExtJS(true, true);
$this->pageRenderer->enableExtJSQuickTips();
$this->pageRenderer->enableExtJsDebug();
$this->pageRenderer->addJsFile(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('caretaker') . 'res/js/tx.caretaker.js', 'text/javascript', FALSE, FALSE);
$this->pageRenderer->addJsFile(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('caretaker') . 'res/js/tx.caretaker.NodeTree.js', 'text/javascript', FALSE, FALSE);
//Add caretaker css
$this->pageRenderer->addCssFile(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('caretaker') . 'res/css/tx.caretaker.nodetree.css', 'stylesheet', 'all', '', FALSE);
// storage Pid
$confArray = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['caretaker']);
$storagePid = (int) $confArray['storagePid'];
$this->pageRenderer->addJsInlineCode('Caretaker_Nodetree', '
Ext.state.Manager.setProvider(new Ext.state.CookieProvider());
Ext.ns("tx.caretaker");
Ext.onReady(function() {
tx.caretaker.view = new Ext.Viewport({
layout: "fit",
items: {
id: "cartaker-tree",
xtype: "caretaker-nodetree",
autoScroll: true,
dataUrl: TYPO3.settings.ajaxUrls[\'tx_caretaker::treeloader\'],
addUrl: "' . $PATH_TYPO3 . 'alt_doc.php?edit[###NODE_TYPE###][' . $storagePid . ']=new",
editUrl: "' . $PATH_TYPO3 . 'alt_doc.php?edit[tx_caretaker_###NODE_TYPE###][###NODE_UID###]=edit",
hideUrl: "' . $PATH_TYPO3 . 'tce_db.php?&data[tx_caretaker_###NODE_TYPE###][###NODE_UID###][hidden]=1",
unhideUrl: "' . $PATH_TYPO3 . 'tce_db.php?&data[tx_caretaker_###NODE_TYPE###][###NODE_UID###][hidden]=0"
}
});
tx_caretaker_updateTreeById = function( id ){
tx_caretaker_tree = Ext.getCmp("cartaker-tree");
tx_caretaker_tree.reloadTreePartial( id );
}
});
');
$this->content .= $this->doc->startPage($LANG->getLL("title"));
$this->doc->form = '';
} else {
// If no access or if not admin
$this->doc = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\MediumDocumentTemplate');
$this->doc->backPath = $BACK_PATH;
$this->content .= $this->doc->startPage($LANG->getLL("title"));
$this->content .= $this->doc->header($LANG->getLL("title"));
$this->content .= $this->doc->spacer(5);
$this->content .= $this->doc->spacer(10);
}
}
示例6: getAjaxFunction
/**
* Returns JS callback for the given action
*
* @param null $action
* @param array $arguments
* @param null $controller
* @param null $extensionName
* @param null $pluginName
* @param string $format
* @param string $section
* @return string
*/
public function getAjaxFunction($action = NULL, array $arguments = array(), $controller = NULL, $extensionName = NULL, $pluginName = NULL, $format = '', $section = 'footer')
{
// current element needs to have additional logic...
$this->hijaxEventDispatcher->setIsHijaxElement(true);
$request = $this->mvcDispatcher->getCurrentRequest();
if ($request) {
if ($action === NULL) {
$action = $request->getControllerActionName();
}
if ($controller === NULL) {
$controller = $request->getControllerName();
}
if ($extensionName === NULL) {
$extensionName = $request->getControllerExtensionName();
}
if ($pluginName === NULL && TYPO3_MODE === 'FE') {
$pluginName = $this->extensionService->getPluginNameByAction($extensionName, $controller, $action);
}
if ($pluginName === NULL) {
$pluginName = $request->getPluginName();
}
}
$settings = array('extension' => $extensionName, 'plugin' => $pluginName, 'controller' => $controller, 'format' => $format ? $format : 'html', 'action' => $action, 'arguments' => $arguments, 'settingsHash' => $this->mvcDispatcher->getCurrentListener() ? $this->mvcDispatcher->getCurrentListener()->getId() : '', 'namespace' => $extensionName && $pluginName ? $this->extensionService->getPluginNamespace($extensionName, $pluginName) : '');
$functionName = 'extbaseHijax_' . md5(serialize($settings));
$content = "; {$functionName}=function(settings, pendingElement, loaders) {";
foreach ($settings as $k => $v) {
$content .= "if (typeof settings.{$k} == 'undefined') settings.{$k}=" . json_encode($v) . ";";
}
$content .= "return jQuery.hijax(settings, pendingElement, loaders);};";
if ($this->isCached()) {
if ($section == 'footer') {
$this->pageRenderer->addJsFooterInlineCode(md5($content), $content, FALSE, TRUE);
} else {
$this->pageRenderer->addJsInlineCode(md5($content), $content, FALSE, TRUE);
}
} else {
// additionalFooterData not possible in USER_INT
$GLOBALS['TSFE']->additionalHeaderData[md5($content)] = \TYPO3\CMS\Core\Utility\GeneralUtility::wrapJS($content);
}
return $functionName;
}
示例7: startPage
//.........这里部分代码省略.........
// This loads the tabulator-in-textarea feature. It automatically modifies
// every textarea which is found.
if (!$GLOBALS['BE_USER']->uc['disableTabInTextarea']) {
$this->loadJavascriptLib('sysext/backend/Resources/Public/JavaScript/tab.js');
}
// Include the JS for the Context Sensitive Help
if ($includeCsh) {
$this->loadCshJavascript();
}
// Get the browser info
$browserInfo = \TYPO3\CMS\Core\Utility\ClientUtility::getBrowserInfo(GeneralUtility::getIndpEnv('HTTP_USER_AGENT'));
// Set the XML prologue
$xmlPrologue = '<?xml version="1.0" encoding="' . $this->charset . '"?>';
// Set the XML stylesheet
$xmlStylesheet = '<?xml-stylesheet href="#internalStyle" type="text/css"?>';
// Add the XML prologue for XHTML doctypes
if (strpos($this->docType, 'xhtml') !== FALSE) {
// Put the XML prologue before or after the doctype declaration according to browser
if ($browserInfo['browser'] === 'msie' && $browserInfo['version'] < 7) {
$headerStart = $headerStart . LF . $xmlPrologue;
} else {
$headerStart = $xmlPrologue . LF . $headerStart;
}
// Add the xml stylesheet according to doctype
if ($this->docType !== 'xhtml_frames') {
$headerStart = $headerStart . LF . $xmlStylesheet;
}
}
$this->pageRenderer->setXmlPrologAndDocType($headerStart);
$this->pageRenderer->setHeadTag('<head>' . LF . '<!-- TYPO3 Script ID: ' . htmlspecialchars($this->scriptID) . ' -->');
$this->pageRenderer->setCharSet($this->charset);
$this->pageRenderer->addMetaTag($this->generator());
$this->pageRenderer->addMetaTag('<meta name="robots" content="noindex,follow" />');
$this->pageRenderer->setFavIcon($this->getBackendFavicon());
if ($this->useCompatibilityTag) {
$this->pageRenderer->addMetaTag($this->xUaCompatible($this->xUaCompatibilityVersion));
}
$this->pageRenderer->setTitle($title);
// add docstyles
$this->docStyle();
if ($this->extDirectStateProvider) {
$this->pageRenderer->addJsFile($this->backPath . 'sysext/backend/Resources/Public/JavaScript/ExtDirect.StateProvider.js');
}
// Add jsCode for overriding the console with a debug panel connection
$this->pageRenderer->addJsInlineCode('consoleOverrideWithDebugPanel', 'if (typeof top.Ext === "object") {
top.Ext.onReady(function() {
if (typeof console === "undefined") {
if (top && top.TYPO3 && top.TYPO3.Backend && top.TYPO3.Backend.DebugConsole) {
console = top.TYPO3.Backend.DebugConsole;
} else {
console = {
log: Ext.log,
info: Ext.log,
warn: Ext.log,
error: Ext.log
};
}
}
});
}
', FALSE);
$this->pageRenderer->addHeaderData($this->JScode);
foreach ($this->JScodeArray as $name => $code) {
$this->pageRenderer->addJsInlineCode($name, $code, FALSE);
}
if (count($this->JScodeLibArray)) {
foreach ($this->JScodeLibArray as $library) {
$this->pageRenderer->addHeaderData($library);
}
}
if ($this->extJScode) {
$this->pageRenderer->addExtOnReadyCode($this->extJScode);
}
// hook for additional headerData
if (isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/template.php']['preHeaderRenderHook'])) {
$preHeaderRenderHook =& $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/template.php']['preHeaderRenderHook'];
if (is_array($preHeaderRenderHook)) {
$hookParameters = array('pageRenderer' => &$this->pageRenderer);
foreach ($preHeaderRenderHook as $hookFunction) {
GeneralUtility::callUserFunction($hookFunction, $hookParameters, $this);
}
}
}
// Construct page header.
$str = $this->pageRenderer->render(PageRenderer::PART_HEADER);
$this->JScodeLibArray = array();
$this->JScode = $this->extJScode = '';
$this->JScodeArray = array();
$this->endOfPageJsBlock = $this->pageRenderer->render(PageRenderer::PART_FOOTER);
if ($this->docType == 'xhtml_frames') {
return $str;
} else {
$str .= $this->docBodyTagBegin() . ($this->divClass ? '
<!-- Wrapping DIV-section for whole page BEGIN -->
<div class="' . $this->divClass . '">
' : '') . trim($this->form);
}
return $str;
}
示例8: addJSCSS
//.........这里部分代码省略.........
*
* @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 = '';";
}
$pAddExtOnReadyCode .= "\n top.copyFromAnotherPageLinkTemplate = " . json_encode('<a class="t3js-paste-new btn btn-default" title="' . $this->getLanguageService()->sL('LLL:EXT:gridelements/Resources/Private/Language/locallang_db.xml:tx_gridelements_js.copyfrompage') . '">' . $iconFactory->getIcon('actions-insert-reference', Icon::SIZE_SMALL)->render() . '</a>') . ";";
$pageRenderer->addJsInlineCode('gridelementsExtOnReady', $pAddExtOnReadyCode);
}
}
示例9: main
/**
* Main function of the module. Write the content to $this->content
* If you chose "web" as main module, you will need to consider the $this->id parameter which will contain the uid-number of the page clicked in the page tree
*
* @return void
*/
function main()
{
global $BE_USER, $LANG, $BACK_PATH, $TCA_DESCR, $TCA, $CLIENT, $TYPO3_CONF_VARS;
$PATH_TYPO3 = \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_SITE_URL') . 'typo3/';
if ($BE_USER->user["admin"]) {
// find node
$node_repository = tx_caretaker_NodeRepository::getInstance();
$node = $node_repository->id2node($this->node_id, true);
if (!$node) {
$node = $node_repository->getRootNode();
}
// Draw the header.
$this->doc = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate');
$this->doc->backPath = $BACK_PATH;
$this->pageRenderer = $this->doc->getPageRenderer();
// Include Ext JS
$this->pageRenderer->loadExtJS();
$this->pageRenderer->addJsFile($BACK_PATH . \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('caretaker') . 'res/js/tx.caretaker.js');
$panels = array();
foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['caretaker']['extJsBackendPanels'] as $extJsBackendPanel) {
// register JS
foreach ($extJsBackendPanel['jsIncludes'] as $jsInclude) {
$filename = $BACK_PATH . '../' . str_replace(PATH_site, '', \TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName($jsInclude));
$this->pageRenderer->addJsFile($filename);
}
// register CSS
foreach ($extJsBackendPanel['cssIncludes'] as $cssInclude) {
$filename = $BACK_PATH . '../' . str_replace(PATH_site, '', \TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName($cssInclude));
$this->pageRenderer->addCssFile($filename);
}
// add ExtJs Panel
$panels[$extJsBackendPanel['id']] = $extJsBackendPanel['xtype'];
}
$this->pageRenderer->addJsFile($BACK_PATH . \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('caretaker') . 'res/js/tx.caretaker.NodeToolbar.js');
// Enable debug mode for Ext JS
$this->pageRenderer->enableExtJsDebug();
// storage Pid
$confArray = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['caretaker']);
$storagePid = (int) $confArray['storagePid'];
//Add caretaker css
$this->pageRenderer->addCssFile($BACK_PATH . \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('caretaker') . 'res/css/tx.caretaker.overview.css');
$pluginItems = array();
foreach ($panels as $id => $xtype) {
$pluginItems[] = '{ id: "' . $id . '", xtype: "' . $xtype . '" , back_path: back_path , node_id: node_id }';
}
$this->pageRenderer->addJsInlineCode('Caretaker_Overview', '
Ext.state.Manager.setProvider(new Ext.state.CookieProvider());
Ext.namespace("tx","tx.caretaker");
Ext.onReady( function() {
var back_path = "' . $this->doc->backPath . '";
var back_url = "' . urlencode(\TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_REQUEST_URL')) . '";
var path_typo3 = "' . \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_SITE_URL') . 'typo3/";
var add_url = "' . $PATH_TYPO3 . 'alt_doc.php?edit[###NODE_TYPE###][' . $storagePid . ']=new";
var node_id = "' . $node->getCaretakerNodeId() . '";
var node_type = "' . strtolower($node->getType()) . '";
var node_hidden = "' . $node->getHidden() . '";
var node_uid = "' . $node->getUid() . '";
var node_title = "' . htmlspecialchars($node->getTitle() ? $node->getTitle() : '[no title]') . '( ' . ($node->getTypeDescription() ? htmlspecialchars($node->getTypeDescription()) : $node->getType()) . ' )" ;
var node_state = "' . $node->getTestResult()->getState() . '" ;
var node_state_info = "' . $node->getTestResult()->getStateInfo() . '" ;
tx.caretaker.view = new Ext.Viewport({
layout: "fit",
items: {
xtype : "panel",
id : "node",
autoScroll: true,
title : node_title,
iconCls : "icon-caretaker-type-" + node_type,
tbar : {
xtype: "caretaker-nodetoolbar",
back_path: back_path,
path_typo3: path_typo3,
back_url: back_url,
add_url :add_url,
node_id: node_id,
node_type: node_type,
node_uid: node_uid,
node_hidden: node_hidden,
node_state: node_state,
node_state_info: node_state_info
},
items : [
{
xtype : "panel",
padding : "10",
layout : "fit",
id : "caretaker-panels",
items : [
' . implode(chr(10) . ',', $pluginItems) . chr(10) . '
]
}
//.........这里部分代码省略.........
示例10: render
/**
* @param string $src
* @param string $type
* @param boolean $compress
* @param boolean $forceOnTop
* @param string $allWrap
* @param boolean $excludeFromConcatenation
* @param string $section
* @param boolean $preventMarkupUpdateOnAjaxLoad
* @param boolean $moveToExternalFile
* @param boolean $noCache
* @param string $name
*
* @return string
*/
public function render($src = "", $type = 'text/javascript', $compress = TRUE, $forceOnTop = FALSE, $allWrap = '', $excludeFromConcatenation = FALSE, $section = 'footer', $preventMarkupUpdateOnAjaxLoad = false, $moveToExternalFile = false, $noCache = false, $name = '')
{
$content = $this->renderChildren();
if ($this->ajaxDispatcher->getIsActive()) {
if ($preventMarkupUpdateOnAjaxLoad) {
$this->ajaxDispatcher->setPreventMarkupUpdateOnAjaxLoad(true);
}
// need to just echo the code in ajax call
if (!$src) {
if ($compress) {
$content = $this->compressScript($content);
}
return \TYPO3\CMS\Core\Utility\GeneralUtility::wrapJS($content);
} else {
return '<script type="' . htmlspecialchars($type) . '" src="' . htmlspecialchars($src) . '"></script>';
}
} else {
if ($this->isCached()) {
if ($noCache) {
if ($src) {
$content = '<script type="' . htmlspecialchars($type) . '" src="' . htmlspecialchars($src) . '"></script>';
} else {
if ($compress) {
$content = $this->compressScript($content);
}
$content = \TYPO3\CMS\Core\Utility\GeneralUtility::wrapJS($content);
}
$tslibFE = GeneralUtility::makeInstance('EssentialDots\\ExtbaseHijax\\Tslib\\FE\\Hook');
/* @var $tslibFE \EssentialDots\ExtbaseHijax\Tslib\FE\Hook */
if ($section == 'footer') {
$tslibFE->addNonCacheableFooterCode($name ? $name : md5($content), $content);
} else {
$tslibFE->addNonCacheableHeaderCode($name ? $name : md5($content), $content);
}
return '';
} else {
if (!$src && $moveToExternalFile) {
$src = 'typo3temp' . DIRECTORY_SEPARATOR . 'extbase_hijax' . DIRECTORY_SEPARATOR . md5($content) . '.js';
\TYPO3\CMS\Core\Utility\GeneralUtility::writeFileToTypo3tempDir(PATH_site . $src, $content);
if ($GLOBALS['TSFE']) {
if ($GLOBALS['TSFE']->baseUrl) {
$src = $GLOBALS['TSFE']->baseUrl . $src;
} elseif ($GLOBALS['TSFE']->absRefPrefix) {
$src = $GLOBALS['TSFE']->absRefPrefix . $src;
}
}
}
if (!$src) {
if ($section == 'footer') {
$this->pageRenderer->addJsFooterInlineCode($name ? $name : md5($content), $content, $compress, $forceOnTop);
} else {
$this->pageRenderer->addJsInlineCode($name ? $name : md5($content), $content, $compress, $forceOnTop);
}
} else {
if ($section == 'footer') {
$this->pageRenderer->addJsFooterFile($src, $type, $compress, $forceOnTop, $allWrap, $excludeFromConcatenation);
} else {
$this->pageRenderer->addJsFile($src, $type, $compress, $forceOnTop, $allWrap, $excludeFromConcatenation);
}
}
}
} else {
// additionalFooterData not possible in USER_INT
if (!$src) {
$GLOBALS['TSFE']->additionalHeaderData[$name ? $name : md5($content)] = \TYPO3\CMS\Core\Utility\GeneralUtility::wrapJS($content);
} else {
$GLOBALS['TSFE']->additionalHeaderData[$name ? $name : md5($content)] = '<script type="' . htmlspecialchars($type) . '" src="' . htmlspecialchars($src) . '"></script>';
}
}
}
return '';
}
示例11: drawRTE
//.........这里部分代码省略.........
$this->contentISOLanguage = strtolower(trim($languageRow['lg_iso_2']) . (trim($languageRow['lg_country_iso_2']) ? '_' . trim($languageRow['lg_country_iso_2']) : ''));
$this->contentTypo3Language = strtolower(trim($languageRow['lg_typo3']));
}
} else {
$this->contentISOLanguage = $GLOBALS['TSFE']->sys_language_isocode ?: 'en';
$selectFields = 'lg_iso_2, lg_typo3';
$tableAB = 'static_languages';
$whereClause = 'lg_iso_2 = ' . $TYPO3_DB->fullQuoteStr(strtoupper($this->contentISOLanguage), $tableAB);
$res = $TYPO3_DB->exec_SELECTquery($selectFields, $tableAB, $whereClause);
while ($languageRow = $TYPO3_DB->sql_fetch_assoc($res)) {
$this->contentTypo3Language = strtolower(trim($languageRow['lg_typo3']));
}
}
}
$this->contentISOLanguage = $this->contentISOLanguage ?: ($GLOBALS['TSFE']->sys_language_isocode ?: 'en');
$this->contentTypo3Language = $this->contentTypo3Language ?: $GLOBALS['TSFE']->lang;
if ($this->contentTypo3Language == 'default') {
$this->contentTypo3Language = 'en';
}
// Character set
$this->charset = $TSFE->renderCharset;
$this->OutputCharset = $TSFE->metaCharset ?: $TSFE->renderCharset;
// Set the charset of the content
$this->contentCharset = $TSFE->csConvObj->charSetArray[$this->contentTypo3Language];
$this->contentCharset = $this->contentCharset ?: 'utf-8';
$this->contentCharset = trim($TSFE->config['config']['metaCharset']) ?: $this->contentCharset;
/* =======================================
* TOOLBAR CONFIGURATION
* =======================================
*/
$this->initializeToolbarConfiguration();
/* =======================================
* SET STYLES
* =======================================
*/
$width = 610;
if (isset($this->thisConfig['RTEWidthOverride'])) {
if (strstr($this->thisConfig['RTEWidthOverride'], '%')) {
if ($this->client['browser'] != 'msie') {
$width = (int) $this->thisConfig['RTEWidthOverride'] > 0 ? $this->thisConfig['RTEWidthOverride'] : '100%';
}
} else {
$width = (int) $this->thisConfig['RTEWidthOverride'] > 0 ? (int) $this->thisConfig['RTEWidthOverride'] : $width;
}
}
$RTEWidth = strstr($width, '%') ? $width : $width . 'px';
$editorWrapWidth = strstr($width, '%') ? $width : $width + 2 . 'px';
$height = 380;
$RTEHeightOverride = (int) $this->thisConfig['RTEHeightOverride'];
$height = $RTEHeightOverride > 0 ? $RTEHeightOverride : $height;
$RTEHeight = $height . 'px';
$editorWrapHeight = $height + 2 . 'px';
$this->RTEWrapStyle = $this->RTEWrapStyle ?: ($this->RTEdivStyle ?: 'height:' . $editorWrapHeight . '; width:' . $editorWrapWidth . ';');
$this->RTEdivStyle = $this->RTEdivStyle ?: 'position:relative; left:0px; top:0px; height:' . $RTEHeight . '; width:' . $RTEWidth . '; border: 1px solid black;';
/* =======================================
* LOAD JS, CSS and more
* =======================================
*/
$this->getPageRenderer();
// Register RTE in JS
$this->TCEform->additionalJS_post[] = $this->wrapCDATA($this->registerRTEinJS($this->TCEform->RTEcounter, '', '', '', $textAreaId));
// Set the save option for the RTE:
$this->TCEform->additionalJS_submit[] = $this->setSaveRTE($this->TCEform->RTEcounter, $this->TCEform->formName, $textAreaId);
// Loading ExtJs JavaScript files and inline code, if not configured in TS setup
if (!is_array($GLOBALS['TSFE']->pSetup['javascriptLibs.']['ExtJs.'])) {
$this->pageRenderer->loadExtJs();
$this->pageRenderer->enableExtJSQuickTips();
}
$this->pageRenderer->addJsFile($this->getFullFileName('typo3/js/extjs/ux/ext.resizable.js'));
$this->pageRenderer->addJsFile('sysext/backend/Resources/Public/JavaScript/notifications.js');
// Preloading the pageStyle and including RTE skin stylesheets
$this->addPageStyle();
$this->pageRenderer->addCssFile($this->siteURL . 'typo3/contrib/extjs/resources/css/ext-all-notheme.css');
$this->pageRenderer->addCssFile($this->siteURL . 'typo3/sysext/t3skin/extjs/xtheme-t3skin.css');
$this->addSkin();
$this->pageRenderer->addCssFile($this->siteURL . 'typo3/js/extjs/ux/resize.css');
// Add RTE JavaScript
$this->addRteJsFiles($this->TCEform->RTEcounter);
$this->pageRenderer->addJsFile($this->buildJSMainLangFile($this->TCEform->RTEcounter));
$this->pageRenderer->addJsInlineCode('HTMLArea-init', $this->getRteInitJsCode(), TRUE);
/* =======================================
* DRAW THE EDITOR
* =======================================
*/
// Transform value:
$value = $this->transformContent('rte', $PA['itemFormElValue'], $table, $field, $row, $specConf, $thisConfig, $RTErelPath, $thePidValue);
// Further content transformation by registered plugins
foreach ($this->registeredPlugins as $pluginId => $plugin) {
if ($this->isPluginEnabled($pluginId) && method_exists($plugin, 'transformContent')) {
$value = $plugin->transformContent($value);
}
}
// draw the textarea
$item = $this->triggerField($PA['itemFormElName']) . '
<div id="pleasewait' . $textAreaId . '" class="pleasewait" style="display: block;" >' . $TSFE->csConvObj->conv($TSFE->getLLL('Please wait', $this->LOCAL_LANG), $this->charset, $TSFE->renderCharset) . '</div>
<div id="editorWrap' . $textAreaId . '" class="editorWrap" style="visibility: hidden; ' . htmlspecialchars($this->RTEWrapStyle) . '">
<textarea id="RTEarea' . $textAreaId . '" name="' . htmlspecialchars($PA['itemFormElName']) . '" rows="0" cols="0" style="' . htmlspecialchars($this->RTEdivStyle) . '">' . \TYPO3\CMS\Core\Utility\GeneralUtility::formatForTextarea($value) . '</textarea>
</div>' . LF;
return $item;
}
示例12: render
/**
* Main function generating the BE scaffolding
*
* @return void
*/
public function render()
{
// Needed for the hooks below, as they previously were located in the global scope
// Caution: do not use the global variable anymore but only reference "$this", or use the "renderPreProcess"
$GLOBALS['TYPO3backend'] = $TYPO3backend = $this;
// Include extensions which may add css, javascript or toolbar items
if (is_array($GLOBALS['TYPO3_CONF_VARS']['typo3/backend.php']['additionalBackendItems'])) {
foreach ($GLOBALS['TYPO3_CONF_VARS']['typo3/backend.php']['additionalBackendItems'] as $additionalBackendItem) {
include_once $additionalBackendItem;
}
}
// Process ExtJS module js and css
if (is_array($GLOBALS['TBE_MODULES']['_configuration'])) {
foreach ($GLOBALS['TBE_MODULES']['_configuration'] as $moduleConfig) {
if (is_array($moduleConfig['cssFiles'])) {
foreach ($moduleConfig['cssFiles'] as $cssFileName => $cssFile) {
$files = array(GeneralUtility::getFileAbsFileName($cssFile));
$files = GeneralUtility::removePrefixPathFromList($files, PATH_site);
$this->addCssFile($cssFileName, '../' . $files[0]);
}
}
if (is_array($moduleConfig['jsFiles'])) {
foreach ($moduleConfig['jsFiles'] as $jsFile) {
$files = array(GeneralUtility::getFileAbsFileName($jsFile));
$files = GeneralUtility::removePrefixPathFromList($files, PATH_site);
$this->addJavascriptFile('../' . $files[0]);
}
}
}
}
$this->executeHook('renderPreProcess');
// Prepare the scaffolding, at this point extension may still add javascript and css
$view = $this->getFluidTemplateObject($this->templatePath . 'Backend/Main.html');
// Render the TYPO3 logo in the left corner
$logoUrl = $GLOBALS['TBE_STYLES']['logo'] ?: 'sysext/backend/Resources/Public/Images/typo3-topbar@2x.png';
$logoPath = GeneralUtility::resolveBackPath(PATH_typo3 . $logoUrl);
list($logoWidth, $logoHeight) = @getimagesize($logoPath);
// High-resolution?
if (strpos($logoUrl, '@2x.') !== FALSE) {
$logoWidth = $logoWidth / 2;
$logoHeight = $logoHeight / 2;
}
$view->assign('logoUrl', $logoUrl);
$view->assign('logoWidth', $logoWidth);
$view->assign('logoHeight', $logoHeight);
$view->assign('logoLink', TYPO3_URL_GENERAL);
$view->assign('applicationVersion', TYPO3_version);
$view->assign('siteName', $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename']);
$view->assign('moduleMenu', $this->generateModuleMenu());
$view->assign('toolbar', $this->renderToolbar());
/******************************************************
* Now put the complete backend document together
******************************************************/
foreach ($this->cssFiles as $cssFileName => $cssFile) {
$this->pageRenderer->addCssFile($cssFile);
// Load additional css files to overwrite existing core styles
if (!empty($GLOBALS['TBE_STYLES']['stylesheets'][$cssFileName])) {
$this->pageRenderer->addCssFile($GLOBALS['TBE_STYLES']['stylesheets'][$cssFileName]);
}
}
if (!empty($this->css)) {
$this->pageRenderer->addCssInlineBlock('BackendInlineCSS', $this->css);
}
foreach ($this->jsFiles as $jsFile) {
$this->pageRenderer->addJsFile($jsFile);
}
$this->generateJavascript();
$this->pageRenderer->addJsInlineCode('BackendInlineJavascript', $this->js, FALSE);
$this->loadResourcesForRegisteredNavigationComponents();
// Add state provider
$this->getDocumentTemplate()->setExtDirectStateProvider();
$states = $this->getBackendUser()->uc['BackendComponents']['States'];
// Save states in BE_USER->uc
$extOnReadyCode = '
Ext.state.Manager.setProvider(new TYPO3.state.ExtDirectProvider({
key: "BackendComponents.States",
autoRead: false
}));
';
if ($states) {
$extOnReadyCode .= 'Ext.state.Manager.getProvider().initState(' . json_encode($states) . ');';
}
$extOnReadyCode .= '
TYPO3.Backend = new TYPO3.Viewport(TYPO3.Viewport.configuration);
if (typeof console === "undefined") {
console = TYPO3.Backend.DebugConsole;
}';
$this->pageRenderer->addExtOnReadyCode($extOnReadyCode);
// Set document title:
$title = $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'] ? $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'] . ' [TYPO3 CMS ' . TYPO3_version . ']' : 'TYPO3 CMS ' . TYPO3_version;
// Renders the module page
$this->content = $this->getDocumentTemplate()->render($title, $view->render());
$hookConfiguration = array('content' => &$this->content);
$this->executeHook('renderPostProcess', $hookConfiguration);
echo $this->content;
//.........这里部分代码省略.........
示例13: drawRTE
//.........这里部分代码省略.........
} else {
$this->contentISOLanguage = trim($this->thisConfig['defaultContentLanguage']) ?: 'en';
$languageCodeParts = explode('_', $this->contentISOLanguage);
$this->contentISOLanguage = strtolower($languageCodeParts[0]) . ($languageCodeParts[1] ? '_' . strtoupper($languageCodeParts[1]) : '');
// Find the configured language in the list of localization locales
/** @var $locales \TYPO3\CMS\Core\Localization\Locales */
$locales = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Localization\Locales::class);
// If not found, default to 'en'
if (!in_array($this->contentISOLanguage, $locales->getLocales())) {
$this->contentISOLanguage = 'en';
}
}
// Create content laguage service
$this->contentLanguageService = GeneralUtility::makeInstance(\TYPO3\CMS\Lang\LanguageService::class);
$this->contentTypo3Language = $this->contentISOLanguage === 'en' ? 'default' : $this->contentISOLanguage;
$this->contentLanguageService->init($this->contentTypo3Language);
/* =======================================
* TOOLBAR CONFIGURATION
* =======================================
*/
$this->initializeToolbarConfiguration();
/* =======================================
* SET STYLES
* =======================================
*/
// Check if wizard_rte called this for fullscreen edtition
if (GeneralUtility::_GP('M') === 'wizard_rte') {
$this->fullScreen = TRUE;
$RTEWidth = '100%';
$RTEHeight = '100%';
$RTEPaddingRight = '0';
$editorWrapWidth = '100%';
} else {
$options = $GLOBALS['BE_USER']->userTS['options.'];
$RTEWidth = 530 + (isset($options['RTELargeWidthIncrement']) ? (int) $options['RTELargeWidthIncrement'] : 150);
/** @var InlineStackProcessor $inlineStackProcessor */
$inlineStackProcessor = GeneralUtility::makeInstance(InlineStackProcessor::class);
$inlineStackProcessor->initializeByGivenStructure($globalOptions['inlineStructure']);
$inlineStructureDepth = $inlineStackProcessor->getStructureDepth();
$RTEWidth -= $inlineStructureDepth > 0 ? ($inlineStructureDepth + 1) * 12 : 0;
$RTEWidthOverride = is_object($GLOBALS['BE_USER']) && isset($GLOBALS['BE_USER']->uc['rteWidth']) && trim($GLOBALS['BE_USER']->uc['rteWidth']) ? trim($GLOBALS['BE_USER']->uc['rteWidth']) : trim($this->thisConfig['RTEWidthOverride']);
if ($RTEWidthOverride) {
if (strstr($RTEWidthOverride, '%')) {
if ($this->client['browser'] != 'msie') {
$RTEWidth = (int) $RTEWidthOverride > 0 ? $RTEWidthOverride : '100%';
}
} else {
$RTEWidth = (int) $RTEWidthOverride > 0 ? (int) $RTEWidthOverride : $RTEWidth;
}
}
$RTEWidth = strstr($RTEWidth, '%') ? $RTEWidth : $RTEWidth . 'px';
$RTEHeight = 380 + (isset($options['RTELargeHeightIncrement']) ? (int) $options['RTELargeHeightIncrement'] : 0);
$RTEHeightOverride = is_object($GLOBALS['BE_USER']) && isset($GLOBALS['BE_USER']->uc['rteHeight']) && (int) $GLOBALS['BE_USER']->uc['rteHeight'] ? (int) $GLOBALS['BE_USER']->uc['rteHeight'] : (int) $this->thisConfig['RTEHeightOverride'];
$RTEHeight = $RTEHeightOverride > 0 ? $RTEHeightOverride : $RTEHeight;
$RTEPaddingRight = '2px';
$editorWrapWidth = '99%';
}
$editorWrapHeight = '100%';
$this->RTEdivStyle = 'position:relative; left:0px; top:0px; height:' . $RTEHeight . 'px; width:' . $RTEWidth . '; border: 1px solid black; padding: 2px ' . $RTEPaddingRight . ' 2px 2px;';
/* =======================================
* LOAD CSS AND JAVASCRIPT
* =======================================
*/
$this->pageRenderer = $GLOBALS['SOBE']->doc->getPageRenderer();
// Preloading the pageStyle and including RTE skin stylesheets
$resultArray = $this->addPageStyle($resultArray);
$resultArray = $this->addSkin($resultArray);
// Register RTE in JS
$resultArray['additionalJavaScriptPost'][] = $this->registerRTEinJS(NULL, $table, $row['uid'], $field, $textAreaId);
// Set the save option for the RTE
$resultArray['additionalJavaScriptSubmit'][] = $this->setSaveRTE(NULL, 'editform', $textAreaId, $PA['itemFormElName']);
// Loading ExtJs inline code
$this->pageRenderer->enableExtJSQuickTips();
// Add TYPO3 notifications JavaScript
$this->pageRenderer->addJsFile('sysext/backend/Resources/Public/JavaScript/notifications.js');
// Add RTE JavaScript
$this->addRteJsFiles();
$this->pageRenderer->addJsFile($this->createJavaScriptLanguageLabelsFromFiles());
$this->pageRenderer->addJsInlineCode('HTMLArea-init', $this->getRteInitJsCode(), TRUE);
/* =======================================
* DRAW THE EDITOR
* =======================================
*/
// Transform value:
$value = $this->transformContent('rte', $PA['itemFormElValue'], $table, $field, $row, $specConf, $thisConfig, $RTErelPath, $thePidValue);
// Further content transformation by registered plugins
foreach ($this->registeredPlugins as $pluginId => $plugin) {
if ($this->isPluginEnabled($pluginId) && method_exists($plugin, 'transformContent')) {
$value = $plugin->transformContent($value);
}
}
// Draw the textarea
$item = $this->triggerField($PA['itemFormElName']) . '
<div id="pleasewait' . $textAreaId . '" class="pleasewait" style="display: block;" >' . $languageService->getLL('Please wait') . '</div>
<div id="editorWrap' . $textAreaId . '" class="editorWrap" style="visibility: hidden; width:' . $editorWrapWidth . '; height:' . $editorWrapHeight . ';">
<textarea id="RTEarea' . $textAreaId . '" ' . $validatationDataAttribute . ' name="' . htmlspecialchars($PA['itemFormElName']) . '" rows="0" cols="0" style="' . htmlspecialchars($this->RTEdivStyle, ENT_COMPAT, 'UTF-8', FALSE) . '">' . GeneralUtility::formatForTextarea($value) . '</textarea>
</div>' . LF;
$resultArray['html'] = $item;
return $resultArray;
}
示例14: main
/**
* Main method of modfuncreport
*
* @return string Module content
*/
public function main()
{
$GLOBALS['LANG']->includeLLFile('EXT:linkvalidator/Resources/Private/Language/Module/locallang.xlf');
$this->searchLevel = GeneralUtility::_GP('search_levels');
if (isset($this->pObj->id)) {
$this->modTS = BackendUtility::getModTSconfig($this->pObj->id, 'mod.linkvalidator');
$this->modTS = $this->modTS['properties'];
}
$update = GeneralUtility::_GP('updateLinkList');
$prefix = '';
if (!empty($update)) {
$prefix = 'check';
}
$set = GeneralUtility::_GP($prefix . 'SET');
$this->pObj->handleExternalFunctionValue();
if (isset($this->searchLevel)) {
$this->pObj->MOD_SETTINGS['searchlevel'] = $this->searchLevel;
} else {
$this->searchLevel = $this->pObj->MOD_SETTINGS['searchlevel'];
}
if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['linkvalidator']['checkLinks'])) {
foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['linkvalidator']['checkLinks'] as $linkType => $value) {
// Compile list of all available types. Used for checking with button "Check Links".
if (strpos($this->modTS['linktypes'], $linkType) !== FALSE) {
$this->availableOptions[$linkType] = 1;
}
// Compile list of types currently selected by the checkboxes
if ($this->pObj->MOD_SETTINGS[$linkType] && empty($set) || $set[$linkType]) {
$this->checkOpt[$linkType] = 1;
$this->pObj->MOD_SETTINGS[$linkType] = 1;
} else {
$this->pObj->MOD_SETTINGS[$linkType] = 0;
unset($this->checkOpt[$linkType]);
}
}
}
$GLOBALS['BE_USER']->pushModuleData('web_info', $this->pObj->MOD_SETTINGS);
$this->initialize();
// Localization
$this->pageRenderer->addInlineLanguageLabelFile(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('linkvalidator', 'Resources/Private/Language/Module/locallang.xlf'));
$this->pageRenderer->addJsInlineCode('linkvalidator', 'function toggleActionButton(prefix) {
var buttonDisable = true;
Ext.select(\'.\' + prefix ,false).each(function(checkBox,i){
checkDom = checkBox.dom;
if (checkDom.checked){
buttonDisable = false;
}
});
if (prefix == \'check\'){
checkSub = document.getElementById(\'updateLinkList\');
} else {
checkSub = document.getElementById(\'refreshLinkList\');
}
checkSub.disabled = buttonDisable;
}');
// Add JS
$this->pageRenderer->addJsFile($this->doc->backPath . 'js/extjs/ux/Ext.ux.FitToParent.js');
$this->pageRenderer->addJsFile($this->doc->backPath . 'sysext/backend/Resources/Public/JavaScript/flashmessages.js');
$this->pageRenderer->addJsFile($this->doc->backPath . 'sysext/backend/Resources/Public/JavaScript/iframepanel.js');
if ($this->modTS['showCheckLinkTab'] == 1) {
$this->updateListHtml = '<input type="submit" name="updateLinkList" id="updateLinkList" value="' . $GLOBALS['LANG']->getLL('label_update') . '"/>';
}
$this->refreshListHtml = '<input type="submit" name="refreshLinkList" id="refreshLinkList" value="' . $GLOBALS['LANG']->getLL('label_refresh') . '"/>';
$this->processor = GeneralUtility::makeInstance('TYPO3\\CMS\\Linkvalidator\\LinkAnalyzer');
$this->updateBrokenLinks();
$brokenLinkOverView = $this->processor->getLinkCounts($this->pObj->id);
$this->checkOptHtml = $this->getCheckOptions($brokenLinkOverView);
$this->checkOptHtmlCheck = $this->getCheckOptions($brokenLinkOverView, 'check');
$this->createTabs();
return '<div id="linkvalidator-modfuncreport"></div>';
}
示例15: startPage
/**
* Returns page start
* This includes the proper header with charset, title, meta tag and beginning body-tag.
*
* @param string $title HTML Page title for the header
* @return string Returns the whole header section of a HTML-document based on settings in internal variables (like styles, javascript code, charset, generator and docType)
* @see endPage()
*/
public function startPage($title)
{
// hook pre start page
if (isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/template.php']['preStartPageHook'])) {
$preStartPageHook =& $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/template.php']['preStartPageHook'];
if (is_array($preStartPageHook)) {
$hookParameters = array('title' => &$title);
foreach ($preStartPageHook as $hookFunction) {
GeneralUtility::callUserFunction($hookFunction, $hookParameters, $this);
}
}
}
// alternative template for Header and Footer
if ($this->pageHeaderFooterTemplateFile) {
$file = GeneralUtility::getFileAbsFileName($this->pageHeaderFooterTemplateFile, true);
if ($file) {
$this->pageRenderer->setTemplateFile($file);
}
}
// Disable rendering of XHTML tags
$this->pageRenderer->setRenderXhtml(false);
$languageCode = $this->pageRenderer->getLanguage() === 'default' ? 'en' : $this->pageRenderer->getLanguage();
$this->pageRenderer->setHtmlTag('<html lang="' . $languageCode . '">');
$headerStart = '<!DOCTYPE html>';
$this->pageRenderer->setXmlPrologAndDocType($headerStart);
$this->pageRenderer->setHeadTag('<head>' . LF . '<!-- TYPO3 Script ID: ' . htmlspecialchars($this->scriptID) . ' -->');
header('Content-Type:text/html;charset=utf-8');
$this->pageRenderer->setCharSet('utf-8');
$this->pageRenderer->addMetaTag($this->generator());
$this->pageRenderer->addMetaTag('<meta name="robots" content="noindex,follow">');
$this->pageRenderer->addMetaTag('<meta charset="utf-8">');
$this->pageRenderer->addMetaTag('<meta name="viewport" content="width=device-width, initial-scale=1">');
$this->pageRenderer->setFavIcon($this->getBackendFavicon());
if ($this->useCompatibilityTag) {
$this->pageRenderer->addMetaTag($this->xUaCompatible($this->xUaCompatibilityVersion));
}
$this->pageRenderer->setTitle($title);
// add docstyles
$this->docStyle();
if ($this->extDirectStateProvider) {
$this->pageRenderer->addJsFile(ExtensionManagementUtility::extRelPath('backend') . 'Resources/Public/JavaScript/ExtDirect.StateProvider.js');
}
$this->pageRenderer->addHeaderData($this->JScode);
foreach ($this->JScodeArray as $name => $code) {
$this->pageRenderer->addJsInlineCode($name, $code, false);
}
if (!empty($this->JScodeLibArray)) {
GeneralUtility::deprecationLog('DocumentTemplate->JScodeLibArray is deprecated since TYPO3 CMS 7. Use the functionality within pageRenderer directly');
foreach ($this->JScodeLibArray as $library) {
$this->pageRenderer->addHeaderData($library);
}
}
if ($this->extJScode) {
$this->pageRenderer->addExtOnReadyCode($this->extJScode);
}
// Load jquery and twbs JS libraries on every backend request
$this->pageRenderer->loadJquery();
// Note: please do not reference "bootstrap" outside of the TYPO3 Core (not in your own extensions)
// as this is preliminary as long as Twitter bootstrap does not support AMD modules
// this logic will be changed once Twitter bootstrap 4 is included
$this->pageRenderer->addJsFile(ExtensionManagementUtility::extRelPath('core') . 'Resources/Public/JavaScript/Contrib/bootstrap/bootstrap.js');
// hook for additional headerData
if (isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/template.php']['preHeaderRenderHook'])) {
$preHeaderRenderHook =& $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/template.php']['preHeaderRenderHook'];
if (is_array($preHeaderRenderHook)) {
$hookParameters = array('pageRenderer' => &$this->pageRenderer);
foreach ($preHeaderRenderHook as $hookFunction) {
GeneralUtility::callUserFunction($hookFunction, $hookParameters, $this);
}
}
}
// Construct page header.
$str = $this->pageRenderer->render(PageRenderer::PART_HEADER);
$this->JScode = $this->extJScode = '';
$this->JScodeArray = array();
$this->endOfPageJsBlock = $this->pageRenderer->render(PageRenderer::PART_FOOTER);
$str .= $this->docBodyTagBegin() . ($this->divClass ? '
<!-- Wrapping DIV-section for whole page BEGIN -->
<div class="' . $this->divClass . '">
' : '') . trim($this->form);
return $str;
}