当前位置: 首页>>代码示例>>PHP>>正文


PHP PageRenderer::addJsLibrary方法代码示例

本文整理汇总了PHP中TYPO3\CMS\Core\Page\PageRenderer::addJsLibrary方法的典型用法代码示例。如果您正苦于以下问题:PHP PageRenderer::addJsLibrary方法的具体用法?PHP PageRenderer::addJsLibrary怎么用?PHP PageRenderer::addJsLibrary使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TYPO3\CMS\Core\Page\PageRenderer的用法示例。


在下文中一共展示了PageRenderer::addJsLibrary方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: initializeAction

 /**
  * Initializes the controller before invoking an action method.
  *
  * @return void
  */
 protected function initializeAction()
 {
     $this->pageRenderer->addInlineLanguageLabelFile('EXT:scheduler_timeline/Resources/Private/Language/locallang.xml');
     $this->pageRenderer->addCssFile(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('scheduler_timeline') . 'Resources/Public/StyleSheet/timeline.css');
     $this->pageRenderer->addCssFile(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('scheduler_timeline') . 'Resources/Public/StyleSheet/bars.css');
     $this->pageRenderer->addJsLibrary('jquery', \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('scheduler_timeline') . 'Resources/Public/JavaScript/jquery-1.6.2.min.js');
     $this->pageRenderer->addJsLibrary('jquery_tooltip', \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('scheduler_timeline') . 'Resources/Public/JavaScript/tooltip.js');
     $this->pageRenderer->addJsLibrary('jquery_tooltip_dynamic', \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('scheduler_timeline') . 'Resources/Public/JavaScript/tooltip.dynamic.js');
     $this->addJsFileToPageRenderer(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('scheduler_timeline') . 'Resources/Public/JavaScript/common.js');
 }
开发者ID:AOEpeople,项目名称:scheduler_timeline,代码行数:15,代码来源:TimelineController.php

示例2: testAddJsLibrary

 /**
  * test add JS library file
  */
 public function testAddJsLibrary()
 {
     $expectedRegExp = '#<script src="fileadmin/test\\.(js|\\d+\\.js|js\\?\\d+)" type="text/javascript"></script>#';
     $this->fixture->addJsLibrary('test', 'fileadmin/test.js');
     $out = $this->fixture->render();
     $this->assertRegExp($expectedRegExp, $out);
 }
开发者ID:nicksergio,项目名称:TYPO3v4-Core,代码行数:10,代码来源:PageRendererTest.php

示例3: renderPreProcess

 /**
  * Insert javascript-tags for jQuery
  *
  * @param array $params
  * @param \TYPO3\CMS\Core\Page\PageRenderer $pObj
  * @return void
  */
 public function renderPreProcess($params, $pObj)
 {
     // Get plugin-configuration
     $conf = $GLOBALS['TSFE']->tmpl->setup['plugin.']['tx_libjquery.']['settings.'];
     // Generate script-tag for jquery if CDN is set
     if (!empty($conf['cdn']) && array_key_exists($conf['cdn'], $this->jQueryCdnUrls)) {
         // Set version-number for CDN
         if (!(int) $conf['version'] || $conf['version'] === 'latest') {
             $versionCdn = end($this->availableLocalJqueryVersions);
         } else {
             $versionCdn = VersionNumberUtility::convertVersionNumberToInteger($conf['version']);
         }
         // Set correct version-number for local version
         if (!in_array($versionCdn, $this->availableLocalJqueryVersions)) {
             $versionLocal = $this->getNearestVersion($versionCdn);
         } else {
             $versionLocal = $versionCdn;
         }
         $fallbackTag = '';
         // Choose minified version if debug is disabled
         $minPart = (int) $conf['debug'] ? '' : '.min';
         // Deliver gzipped-version if compression is activated and client supports gzip (compression done with "gzip --best -k -S .gzip")
         $gzipPart = (int) $GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['compressionLevel'] ? '.gzip' : '';
         // Set path and placeholders for local file
         $this->jQueryCdnUrls['local'] = $conf['localPath'] . 'jquery-%1$s%2$s.js';
         // Generate tags for local or CDN (and fallback)
         if ($conf['cdn'] === 'local') {
             // Get local version and replace placeholders
             $file = sprintf($this->jQueryCdnUrls['local'], VersionNumberUtility::convertIntegerToVersionNumber($versionLocal), $minPart) . $gzipPart;
             $file = str_replace(PATH_site, '', GeneralUtility::getFileAbsFileName($file));
         } else {
             // Get CDN and replace placeholders
             $file = sprintf($this->jQueryCdnUrls[$conf['cdn']], VersionNumberUtility::convertIntegerToVersionNumber($versionCdn), $minPart);
             // Generate fallback if required
             if ((int) $conf['localFallback']) {
                 // Get local fallback version and replace placeholders
                 $fileFallback = sprintf($this->jQueryCdnUrls['local'], VersionNumberUtility::convertIntegerToVersionNumber($versionLocal), $minPart) . $gzipPart;
                 // Get absolute path to the fallback-file
                 $fileFallback = str_replace(PATH_site, '', GeneralUtility::getFileAbsFileName($fileFallback));
                 // Wrap it in some javascript code which will enable the fallback
                 $fallbackTag = '<script>window.jQuery || document.write(\'<script src="' . htmlspecialchars($fileFallback) . '" type="text/javascript"><\\/script>\')</script>' . LF;
             }
         }
         $pObj->addJsLibrary('lib_jquery', $file, 'text/javascript', FALSE, TRUE, '|' . LF . $fallbackTag . '', TRUE);
     }
 }
开发者ID:sonority,项目名称:lib_jquery,代码行数:53,代码来源:PageRenderer.php


注:本文中的TYPO3\CMS\Core\Page\PageRenderer::addJsLibrary方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。