/** * Safe the file to disc * * @param $block string */ protected function safeJqFile($block = '') { \TYPO3\CMS\Core\Utility\GeneralUtility::writeFile($this->configDir . \T3Ext\T3jquery\Utility\T3jqueryUtility::getJqName(), $block); }
/** * Shows the update Message * @param $params * @param $tsObj * @return string */ public function displayMessage(&$params, &$tsObj) { $out = ''; if (T3jqueryUtility::getIntFromVersion(TYPO3_version) < 4003000) { // 4.3.0 comes with flashmessages styles. For older versions we include the needed styles here $cssPath = $GLOBALS['BACK_PATH'] . ExtensionManagementUtility::extRelPath('t3jquery'); $out .= '<link rel="stylesheet" type="text/css" href="' . $cssPath . 'compat/flashmessages.css" media="screen" />'; } // get all supported UI-Versions from folder $supportedUiVersions = GeneralUtility::get_dirs(GeneralUtility::getFileAbsFileName("EXT:t3jquery/Resources/Public/Res/jquery/ui/")); if (is_array($supportedUiVersions)) { foreach ($supportedUiVersions as $supportedUiVersion) { if (file_exists(GeneralUtility::getFileAbsFileName("EXT:t3jquery/Resources/Public/Res/jquery/ui/") . $supportedUiVersion . '/jquery.xml')) { $this->supportedUiVersion[] = $supportedUiVersion; } } } // get all supported TOOLS-Versions from folder $supportedToolsVersions = GeneralUtility::get_dirs(GeneralUtility::getFileAbsFileName("EXT:t3jquery/Resources/Public/Res/jquery/tools/")); if (is_array($supportedToolsVersions)) { foreach ($supportedToolsVersions as $supportedToolsVersion) { if (file_exists(GeneralUtility::getFileAbsFileName("EXT:t3jquery/Resources/Public/Res/jquery/tools/") . $supportedToolsVersion . '/jquery.xml')) { $this->supportedToolsVersion[] = $supportedToolsVersion; } } } // get the conf array $this->confArr = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['t3jquery']); // if form is submited, the POST values are taken $post = GeneralUtility::_POST(); if (count($post) > 0) { $jQueryUiVersion = $post['data']['jQueryUiVersion']; $jQueryToolsVersion = $post['data']['jQueryTOOLSVersion']; $jQueryVersion = $post['data']['jQueryVersion'] . "-" . $post['data']['jQueryUiVersion'] . ($post['data']['jQueryTOOLSVersion'] ? "-" . $post['data']['jQueryTOOLSVersion'] : ""); $configDir = $post['data']['configDir'] . (preg_match("/\\/\$/", $configDir) ? "" : "/"); } else { $jQueryUiVersion = $this->confArr['jQueryUiVersion']; $jQueryToolsVersion = $this->confArr['jQueryTOOLSVersion']; $jQueryVersion = T3JQUERYVERSION; $configDir = T3jqueryUtility::getJqPath(); } if ($this->checkConfig() === FALSE) { $out .= ' <div class="typo3-message message-warning"> <div class="message-header">' . $GLOBALS['LANG']->sL('LLL:EXT:t3jquery/Resources/Private/Language/locallang.xml:extmng.checkConfigHeader') . '</div> <div class="message-body"> ' . $GLOBALS['LANG']->sL('LLL:EXT:t3jquery/Resources/Private/Language/locallang.xml:extmng.checkConfig') . ' </div> </div>'; } elseif ($this->confArr['integrateFromCDN'] || $post['data']['integrateFromCDN']) { // Nothing to check } else { // check the actual version if ($jQueryUiVersion && !in_array($jQueryUiVersion, $this->supportedUiVersion) || $jQueryToolsVersion && !in_array($jQueryToolsVersion, $this->supportedToolsVersion)) { $out .= ' <div class="typo3-message message-information"> <div class="message-header">' . $GLOBALS['LANG']->sL('LLL:EXT:t3jquery/Resources/Private/Language/locallang.xml:extmng.updatermsgHeader') . '</div> <div class="message-body"> ' . $GLOBALS['LANG']->sL('LLL:EXT:t3jquery/Resources/Private/Language/locallang.xml:extmng.updatermsg') . ' </div> </div>'; } // Check if the library exists if (!file_exists(PATH_site . $configDir . T3jqueryUtility::getJqName())) { $out .= ' <a href="javascript:void();" onclick="top.goToModule(\'tools_txt3jqueryM1\',\'\',\'createLib=1\');this.blur();return false;"> <div class="typo3-message message-warning"> <div class="message-header">' . $GLOBALS['LANG']->sL('LLL:EXT:t3jquery/Resources/Private/Language/locallang.xml:extmng.updatermsgHeader2') . '</div> <div class="message-body"> ' . sprintf($GLOBALS['LANG']->sL('LLL:EXT:t3jquery/Resources/Private/Language/locallang.xml:extmng.updatermsg2'), $configDir . T3jqueryUtility::getJqName()) . ' </div> </div> </a>'; } } $out = '<div style="position:absolute;top:10px;right:10px; width:300px;">' . $out . '</div>'; return $out; }
/** * Get the jquery script tag. * For backend usage only. * @param boolean $urlOnly If TRUE, only the URL is returned, not a full script tag * @return string HTML Script tag to load the jQuery JavaScript library */ public static function getJqJSBE($urlOnly = FALSE) { $file = T3jqueryUtility::getJqPath() . T3jqueryUtility::getJqName(); if (file_exists(PATH_site . $file)) { $url = GeneralUtility::resolveBackPath($GLOBALS['BACK_PATH'] . '../' . $file); if ($urlOnly) { return $url; } else { return '<script type="text/javascript" src="' . $url . '"></script>'; } } else { GeneralUtility::devLog('\'' . T3jqueryUtility::getJqName() . '\' does not exists!', 't3jquery', 3); } return FALSE; }