예제 #1
0
 /**
  * Adds T3Jquery as Lib
  * @return string
  */
 public function render()
 {
     // checks if t3jquery is loaded
     if (ExtensionManagementUtility::isLoaded('t3jquery')) {
     }
     // if t3jquery is loaded and the custom Library had been created
     if (T3JQUERY === true) {
         T3jqueryUtility::addJqJS();
     }
     return '';
 }
 /**
  * @param string $jsfile
  * @param string $jsurl
  * @param string $jsdata
  * @param string $jsready
  * @param boolean $forceOnTop
  * @param string $compress
  * @param string $type
  * @param boolean $tofooter
  * @param boolean $renderChildrenToData
  * @return string
  */
 public function render($jsfile = NULL, $jsurl = NULL, $jsdata = NULL, $jsready = NULL, $forceOnTop = NULL, $compress = NULL, $type = "text/javascript", $tofooter = null, $renderChildrenToData = false)
 {
     $buffer_data = NULL;
     $buffer_ready = NULL;
     if ($renderChildrenToData === true) {
         $buffer_data = $this->renderChildren();
     } else {
         $buffer_ready = $this->renderChildren();
     }
     // checks if t3jquery is loaded
     if (T3JQUERY === true) {
         $config = array();
         if ($jsfile !== NULL) {
             $config['jsfile'] = $jsfile;
         }
         if ($jsurl !== NULL) {
             $config['jsurl'] = $jsurl;
         }
         if ($jsdata !== NULL) {
             $config['jsdata'] = $buffer_data . "\n" . $jsdata;
         } else {
             $config['jsdata'] = $buffer_data;
         }
         if ($jsready !== NULL) {
             $config['jsready'] = $buffer_ready . "\n" . $jsready;
         } else {
             $config['jsready'] = $buffer_ready;
         }
         if ($forceOnTop !== NULL) {
             $config['forceOnTop'] = $forceOnTop;
         }
         if ($compress !== NULL) {
             $config['compress'] = $compress;
         }
         if ($type !== NULL) {
             $config['type'] = $type;
         }
         if ($tofooter !== NULL) {
             $config['tofooter'] = $tofooter;
         }
         T3jqueryUtility::addJS('', $config);
     }
     return '';
 }
예제 #3
0
    /**
     * 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;
    }
예제 #4
0
파일: index.php 프로젝트: clews/t3jquery
 /**
  * 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);
 }
예제 #5
0
 /**
  * Add inline code to the HTML
  *
  * @param string $name
  * @param string $block
  * @param array $conf
  * @return void
  */
 public static function addJsInlineCode($name, $block, $conf = array())
 {
     if ($conf['jsinline']) {
         $GLOBALS['TSFE']->inlineJS['t3jquery.jsdata.' . $name] = $block;
     } elseif (T3jqueryUtility::getIntFromVersion(TYPO3_version) >= 4003000) {
         /** @var PageRenderer $pagerender */
         $pagerender = $GLOBALS['TSFE']->getPageRenderer();
         if ($conf['tofooter'] == 'footer') {
             $pagerender->addJsFooterInlineCode($name, $block, $conf['compress'], $conf['forceOnTop']);
         } else {
             $pagerender->addJsInlineCode($name, $block, $conf['compress'], $conf['forceOnTop']);
         }
     } else {
         if ($conf['compress']) {
             $block = GeneralUtility::minifyJavaScript($block);
         }
         if ($conf['tofooter'] == 'footer') {
             $GLOBALS['TSFE']->additionalFooterData['t3jquery.jsdata.' . $name] = GeneralUtility::wrapJS($block, TRUE);
         } else {
             $GLOBALS['TSFE']->additionalHeaderData['t3jquery.jsdata.' . $name] = GeneralUtility::wrapJS($block, TRUE);
         }
     }
 }
예제 #6
0
<?php

/* Add Hooks */
if (TYPO3_MODE != 'BE') {
    $confArr = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['t3jquery']);
    if ($confArr['alwaysIntegrate']) {
        \T3Ext\T3jquery\Utility\T3jqueryUtility::addJqJS();
    }
}