public function JStop() { $result = parent::JStop(); $result .= ' <script> var vidiModuleUrl = \'' . BackendUtility::getModuleUrl(VidiModule::getSignature()) . '\'; var vidiModulePrefix = \'' . VidiModule::getParameterPrefix() . '\'; </script> '; return $result; }
/** * Parses the HTML tags that would have been inserted to the <head> of a HTML document and returns the found tags as multidimensional array. * * @return array The parsed tags with their attributes and innerHTML parts */ protected function getHeadTags() { $headTags = array(); $headDataRaw = $this->fObj->JStop() . $this->getJavaScriptAndStyleSheetsOfPageRenderer(); if ($headDataRaw) { // Create instance of the HTML parser: $parseObj = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Html\\HtmlParser'); // Removes script wraps: $headDataRaw = str_replace(array('/*<![CDATA[*/', '/*]]>*/'), '', $headDataRaw); // Removes leading spaces of a multiline string: $headDataRaw = trim(preg_replace('/(^|\\r|\\n)( |\\t)+/', '$1', $headDataRaw)); // Get script and link tags: $tags = array_merge($parseObj->getAllParts($parseObj->splitTags('link', $headDataRaw)), $parseObj->getAllParts($parseObj->splitIntoBlock('script', $headDataRaw))); foreach ($tags as $tagData) { $tagAttributes = $parseObj->get_tag_attributes($parseObj->getFirstTag($tagData), TRUE); $headTags[] = array('name' => $parseObj->getFirstTagName($tagData), 'attributes' => $tagAttributes[0], 'innerHTML' => $parseObj->removeFirstAndLastTag($tagData)); } } return $headTags; }