本文整理汇总了PHP中t3lib_div::quoteJSvalue方法的典型用法代码示例。如果您正苦于以下问题:PHP t3lib_div::quoteJSvalue方法的具体用法?PHP t3lib_div::quoteJSvalue怎么用?PHP t3lib_div::quoteJSvalue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类t3lib_div
的用法示例。
在下文中一共展示了t3lib_div::quoteJSvalue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render
/**
* Render videos from various video portals
*
* @param Tx_News_Domain_Model_Media $element
* @param integer $width
* @param integer $height
* @return string
*/
public function render(Tx_News_Domain_Model_Media $element, $width, $height)
{
$content = $finalUrl = '';
$url = Tx_News_Service_FileService::getCorrectUrl($element->getContent());
// get the correct rewritten url
$mediaWizard = tslib_mediaWizardManager::getValidMediaWizardProvider($url);
if ($mediaWizard !== NULL) {
$finalUrl = $mediaWizard->rewriteUrl($url);
}
// override width & height if both are set
if ($element->getWidth() > 0 && $element->getHeight() > 0) {
$width = $element->getWidth();
$height = $element->getHeight();
}
if (!empty($finalUrl)) {
$GLOBALS['TSFE']->getPageRenderer()->addJsFile('typo3conf/ext/news/Resources/Public/JavaScript/Contrib/swfobject-2-2.js');
$uniqueDivId = 'mediaelement' . Tx_News_Service_FileService::getUniqueId($element);
$content .= '<div id="' . htmlspecialchars($uniqueDivId) . '"></div>
<script type="text/javascript">
var params = { allowScriptAccess: "always" };
var atts = { id: ' . t3lib_div::quoteJSvalue($uniqueDivId) . ' };
swfobject.embedSWF(' . t3lib_div::quoteJSvalue($finalUrl) . ',
' . t3lib_div::quoteJSvalue($uniqueDivId) . ', "' . (int) $width . '", "' . (int) $height . '", "8", null, null, params, atts);
</script>';
}
return $content;
}
示例2: viewHelperReturnsCorrectJs
/**
* Test if default file format works
*
* @test
* @return void
*/
public function viewHelperReturnsCorrectJs()
{
$newsRepository = $this->objectManager->get('Tx_News_Domain_Repository_NewsRepository');
$newUid = $this->testingFramework->createRecord('tx_news_domain_model_news', array('pid' => 98, 'title' => 'fobar'));
$newsItem = $newsRepository->findByUid($newUid);
$language = 'en';
$viewHelper = new Tx_News_ViewHelpers_Social_DisqusViewHelper();
$settingsService = $this->getAccessibleMock('Tx_News_Service_SettingsService');
$settingsService->expects($this->any())->method('getSettings')->will($this->returnValue(array('disqusLang' => $language)));
$viewHelper->injectSettingsService($settingsService);
$actualResult = $viewHelper->render($newsItem, 'abcdef', 'http://typo3.org/dummy/fobar.html');
$expectedCode = '<script type="text/javascript">
var disqus_shortname = ' . t3lib_div::quoteJSvalue('abcdef', TRUE) . ';
var disqus_identifier = ' . t3lib_div::quoteJSvalue('news_' . $newUid, TRUE) . ';
var disqus_url = ' . t3lib_div::quoteJSvalue('http://typo3.org/dummy/fobar.html') . ';
var disqus_title = ' . t3lib_div::quoteJSvalue('fobar', TRUE) . ';
var disqus_config = function () {
this.language = ' . t3lib_div::quoteJSvalue($language) . ';
};
(function() {
var dsq = document.createElement("script"); dsq.type = "text/javascript"; dsq.async = true;
dsq.src = "http://" + disqus_shortname + ".disqus.com/embed.js";
(document.getElementsByTagName("head")[0] || document.getElementsByTagName("body")[0]).appendChild(dsq);
})();
</script>';
$this->assertEquals($expectedCode, $actualResult);
}
示例3: render
/**
* Render mp3 files
*
* @param Tx_News_Domain_Model_Media $element
* @param integer $width
* @param integer $height
* @param string $template
* @return string
*/
public function render(Tx_News_Domain_Model_Media $element, $width, $height, $template = '')
{
$url = Tx_News_Service_FileService::getCorrectUrl($element->getMultimedia());
$uniqueId = Tx_News_Service_FileService::getUniqueId($element);
$GLOBALS['TSFE']->getPageRenderer()->addJsFile(self::PATH_TO_JS . 'swfobject-2-2.js');
$GLOBALS['TSFE']->getPageRenderer()->addJsFile(self::PATH_TO_JS . 'audioplayer-noswfobject.js');
$inlineJs = '
AudioPlayer.setup("' . t3lib_div::getIndpEnv('TYPO3_SITE_URL') . self::PATH_TO_JS . 'audioplayer-player.swf", {
width: ' . (int) $width . '
});';
$GLOBALS['TSFE']->getPageRenderer()->addJsInlineCode('news_audio', $inlineJs);
$content = '<p id="' . htmlspecialchars($uniqueId) . '">' . htmlspecialchars($element->getCaption()) . '</p>
<script type="text/javascript">
AudioPlayer.embed(' . t3lib_div::quoteJSvalue($uniqueId) . ', {soundFile: ' . t3lib_div::quoteJSvalue($url) . '});
</script> ';
return $content;
}
示例4: render
/**
* Render disqus thread
*
* @param Tx_News_Domain_Model_News $newsItem news item
* @param string $shortName shortname
* @param string $link link
* @return string
*/
public function render(Tx_News_Domain_Model_News $newsItem, $shortName, $link)
{
$tsSettings = $this->pluginSettingsService->getSettings();
$code = '<script type="text/javascript">
var disqus_shortname = ' . t3lib_div::quoteJSvalue($shortName, TRUE) . ';
var disqus_identifier = \'news_' . $newsItem->getUid() . '\';
var disqus_url = ' . t3lib_div::quoteJSvalue($link, TRUE) . ';
var disqus_title = ' . t3lib_div::quoteJSvalue($newsItem->getTitle(), TRUE) . ';
var disqus_config = function () {
this.language = ' . t3lib_div::quoteJSvalue($tsSettings['disqusLang']) . ';
};
(function() {
var dsq = document.createElement("script"); dsq.type = "text/javascript"; dsq.async = true;
dsq.src = "http://" + disqus_shortname + ".disqus.com/embed.js";
(document.getElementsByTagName("head")[0] || document.getElementsByTagName("body")[0]).appendChild(dsq);
})();
</script>';
return $code;
}
示例5: wrapTitle
/**
* Wrapping $title in a-tags.
*
* @param string Title string
* @param string Item record
* @param integer Bank pointer (which mount point number)
* @return string
* @access private
*/
function wrapTitle($title, $row)
{
if ($row['uid']) {
# $aOnClick = 'return jumpToUrl(\''.$this->thisScript.'?act='.$GLOBALS['SOBE']->act.'&mode='.$GLOBALS['SOBE']->mode.'&bparams='.$GLOBALS['SOBE']->bparams.$this->getJumpToParam($row).'\');';
# $title = '<a href="#" onclick="'.htmlspecialchars($aOnClick).'">'.$title.'</a>';
$aOnClick = "return insertElement('" . $this->table . "', '" . $row['uid'] . "', 'db', " . t3lib_div::quoteJSvalue($title) . ", '', '', '');";
$ATag = '<a href="#" onclick="' . $aOnClick . '">';
$ATag_alt = substr($ATag, 0, -4) . ',\'\',1);">';
# $title = $ATag_alt.$title.'</a>';
$icon = '<img' . t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'], 'gfx/plusbullet2.gif', 'width="18" height="16"') . ' title="' . $GLOBALS['LANG']->getLL('addToList', 1) . '" alt="" />';
$title = $ATag_alt . $title . ' ' . $ATag . $icon . '</a>';
}
return $title;
}
示例6: generate_level
/**
* Generates a number of lines of JavaScript code for a menu level.
* Calls itself recursively for additional levels.
*
* @param integer Number of levels to generate
* @param integer Current level being generated - and if this number is less than $levels it will call itself recursively with $count incremented
* @param integer Page id of the starting point.
* @param array $this->menuArr passed along
* @param array Previous MP vars
* @return string JavaScript code lines.
* @access private
*/
function generate_level($levels, $count, $pid, $menuItemArray = '', $MP_array = array())
{
$levelConf = $this->mconf[$count . '.'];
// Translate PID to a mount page, if any:
$mount_info = $this->sys_page->getMountPointInfo($pid);
if (is_array($mount_info)) {
$MP_array[] = $mount_info['MPvar'];
$pid = $mount_info['mount_pid'];
}
// UIDs to ban:
$banUidArray = $this->getBannedUids();
// Initializing variables:
$var = $this->JSVarName;
$menuName = $this->JSMenuName;
$parent = $count == 1 ? 0 : $var . ($count - 1);
$prev = 0;
$c = 0;
$menuItems = is_array($menuItemArray) ? $menuItemArray : $this->sys_page->getMenu($pid);
foreach ($menuItems as $uid => $data) {
// $data['_MP_PARAM'] contains MP param for overlay mount points (MPs with "substitute this page" set)
// if present: add param to copy of MP array (copy used for that submenu branch only)
$MP_array_sub = $MP_array;
if (array_key_exists('_MP_PARAM', $data) && $data['_MP_PARAM']) {
$MP_array_sub[] = $data['_MP_PARAM'];
}
// Set "&MP=" var:
$MP_var = implode(',', $MP_array_sub);
$MP_params = $MP_var ? '&MP=' . rawurlencode($MP_var) : '';
$spacer = t3lib_div::inList($this->spacerIDList, $data['doktype']) ? 1 : 0;
// if item is a spacer, $spacer is set
if ($this->mconf['SPC'] || !$spacer) {
// If the spacer-function is not enabled, spacers will not enter the $menuArr
if (!t3lib_div::inList($this->doktypeExcludeList, $data['doktype']) && (!$data['nav_hide'] || $this->conf['includeNotInMenu']) && !t3lib_div::inArray($banUidArray, $uid)) {
// Page may not be 'not_in_menu' or 'Backend User Section' + not in banned uid's
if ($count < $levels) {
$addLines = $this->generate_level($levels, $count + 1, $data['uid'], '', $MP_array_sub);
} else {
$addLines = '';
}
$title = $data['title'];
$url = '';
$target = '';
if (!$addLines && !$levelConf['noLink'] || $levelConf['alwaysLink']) {
$LD = $this->menuTypoLink($data, $this->mconf['target'], '', '', array(), $MP_params, $this->mconf['forceTypeValue']);
// If access restricted pages should be shown in menus, change the link of such pages to link to a redirection page:
$this->changeLinksForAccessRestrictedPages($LD, $data, $this->mconf['target'], $this->mconf['forceTypeValue']);
$url = $GLOBALS['TSFE']->baseUrlWrap($LD['totalURL']);
$target = $LD['target'];
}
$codeLines .= LF . $var . $count . "=" . $menuName . ".add(" . $parent . "," . $prev . ",0," . t3lib_div::quoteJSvalue($title, true) . "," . t3lib_div::quoteJSvalue($url, true) . "," . t3lib_div::quoteJSvalue($target, true) . ");";
// If the active one should be chosen...
$active = $levelConf['showActive'] && $this->isActive($data['uid'], $MP_var);
// If the first item should be shown
$first = !$c && $levelConf['showFirst'];
// do it...
if ($active || $first) {
if ($count == 1) {
$codeLines .= LF . $menuName . ".openID = " . $var . $count . ";";
} else {
$codeLines .= LF . $menuName . ".entry[" . $parent . "].openID = " . $var . $count . ";";
}
}
// Add submenu...
$codeLines .= $addLines;
$prev = $var . $count;
$c++;
}
}
}
if ($this->mconf['firstLabelGeneral'] && !$levelConf['firstLabel']) {
$levelConf['firstLabel'] = $this->mconf['firstLabelGeneral'];
}
if ($levelConf['firstLabel'] && $codeLines) {
$codeLines .= LF . $menuName . '.defTopTitle[' . $count . '] = ' . t3lib_div::quoteJSvalue($levelConf['firstLabel'], true) . ';';
}
return $codeLines;
}
示例7: imageInsertJS
/**
* Echo the HTML page and JS that will insert the image
*
* @param string $url: the url of the image
* @param integer $width: the width of the image
* @param integer $height: the height of the image
* @param string $altText: text for the alt attribute of the image
* @param string $titleText: text for the title attribute of the image
* @param string $additionalParams: text representing more html attributes to be added on the img tag
* @return void
*/
protected function imageInsertJS($url, $width, $height, $altText = '', $titleText = '', $additionalParams = '')
{
echo '
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Untitled</title>
</head>
<script type="text/javascript">
/*<![CDATA[*/
var dialog = window.opener.HTMLArea.Dialog.TYPO3Image;
var plugin = dialog.plugin;
function insertImage(file,width,height,alt,title,additionalParams) {
plugin.insertImage(\'<img src="\'+file+\'" width="\'+parseInt(width)+\'" height="\'+parseInt(height)+\'"\'' . ($this->defaultClass ? '+\' class="' . $this->defaultClass . '"\'' : '') . '+(alt?\' alt="\'+alt+\'"\':\'\')+(title?\' title="\'+title+\'"\':\'\')+(additionalParams?\' \'+additionalParams:\'\')+\' />\');
}
/*]]>*/
</script>
<body>
<script type="text/javascript">
/*<![CDATA[*/
insertImage(' . t3lib_div::quoteJSvalue($url, 1) . ',' . $width . ',' . $height . ',' . t3lib_div::quoteJSvalue($altText, 1) . ',' . t3lib_div::quoteJSvalue($titleText, 1) . ',' . t3lib_div::quoteJSvalue($additionalParams, 1) . ');
/*]]>*/
</script>
</body>
</html>';
}
示例8: parseTemplate
//.........这里部分代码省略.........
}
if ($this->conf['scroll'] > 0) {
if ($this->conf['scroll'] > count($this->images)) {
$this->conf['scroll'] = count($this->images);
}
$options[] = "scroll: {$this->conf['scroll']}";
}
// init Callback
$initCallback[] = "imagecarousel.initCallback('#{$this->getContentKey()}',carousel,state)";
if ($this->conf['stoponmouseover'] == 1) {
$initCallback[] = "imagecarousel.initCallbackMouseover(carousel,state)";
}
$options[] = "initCallback: function(carousel,state){" . implode(";", $initCallback) . ";}";
// hide buttons
if ($this->conf['hidenextbutton']) {
$options[] = "buttonNextHTML: null";
}
if ($this->conf['hidepreviousbutton']) {
$options[] = "buttonPrevHTML: null";
}
// fallback for childElem
if (!$this->conf['carousel.'][$this->type . '.']['childElem']) {
$this->conf['carousel.'][$this->type . '.']['childElem'] = 'li';
}
$random_script = null;
if ($this->conf['random']) {
$random_script = "\n\timagecarousel.randomize('#{$this->getContentKey()}','{$this->conf['carousel.'][$this->type . '.']['childElem']}');";
}
// caption
$jQueryCaptify = null;
if ($this->conf['showCaption']) {
$captions = array();
if ($this->conf['animation']) {
$captions[] = "animation: " . t3lib_div::quoteJSvalue($this->conf['animation']);
}
if ($this->conf['position']) {
$captions[] = "position: " . t3lib_div::quoteJSvalue($this->conf['position']);
}
if ($this->conf['speedOver']) {
$captions[] = "speedOver: " . t3lib_div::quoteJSvalue($this->conf['speedOver']);
}
if ($this->conf['speedOut']) {
$captions[] = "speedOut: " . t3lib_div::quoteJSvalue($this->conf['speedOut']);
}
if ($this->conf['hideDelay']) {
$captions[] = "hideDelay: " . t3lib_div::quoteJSvalue($this->conf['hideDelay']);
}
if ($this->conf['prefix']) {
$captions[] = "prefix: " . t3lib_div::quoteJSvalue($this->conf['prefix']);
}
if ($this->conf['opacity']) {
$captions[] = "opacity: " . t3lib_div::quoteJSvalue($this->conf['opacity']);
}
if ($this->conf['className']) {
$captions[] = "className: " . t3lib_div::quoteJSvalue($this->conf['className']);
}
if ($this->conf['spanWidth']) {
$captions[] = "spanWidth: " . t3lib_div::quoteJSvalue($this->conf['spanWidth']);
}
$this->pagerenderer->addJsFile($this->conf['jQueryCaptify']);
$jQueryCaptify = "\n\tjQuery('#{$this->getContentKey()} img.captify').captify(" . (count($captions) ? "{\n\t\t" . implode(",\n\t\t", $captions) . "\n\t}" : "") . ");";
}
$this->pagerenderer->addJS($jQueryNoConflict . "\njQuery(document).ready(function() { {$random_script}\n\tjQuery('#{$this->getContentKey()}-outer').css('display', 'block');\n\tjQuery('#{$this->getContentKey()}').jcarousel(" . (count($options) ? "{\n\t\t" . implode(",\n\t\t", $options) . "\n\t}" : "") . ");{$jQueryCaptify}\n});\n");
if (is_numeric($this->conf['carouselwidth'])) {
$this->pagerenderer->addCSS("\n#c{$this->cObj->data['uid']} .jcarousel-clip-horizontal,\n#c{$this->cObj->data['uid']} .jcarousel-container-horizontal {\n\twidth: {$this->conf['carouselwidth']}px;" . ($this->conf['carouselheight'] ? "\n\theight: {$this->conf['carouselheight']}px;" : "") . "\n}\n");
}
示例9: renderFileList
/**
* Render list of files.
*
* @param array List of files. See t3lib_div::getFilesInDir
* @param string $mode EB mode: "db", "file", ...
* @return string HTML output
*/
function renderFileList($files, $mode = 'file', $act = '')
{
global $LANG, $BACK_PATH, $TCA, $TYPO3_CONF_VARS;
$out = '';
// sorting selector
// TODO move to scbase (see tx_dam_list_thumbs too)
$allFields = tx_dam_db::getFieldListForUser('tx_dam');
if (is_array($allFields) && count($allFields)) {
$fieldsSelItems = array();
foreach ($allFields as $field => $title) {
$fL = is_array($TCA['tx_dam']['columns'][$field]) ? preg_replace('#:$#', '', $GLOBALS['LANG']->sL($TCA['tx_dam']['columns'][$field]['label'])) : '[' . $field . ']';
$fieldsSelItems[$field] = t3lib_div::fixed_lgd_cs($fL, 15);
}
$sortingSelector = '<label>' . $GLOBALS['LANG']->sL('LLL:EXT:dam/lib/locallang.xml:labelSorting', 1) . '</label> ';
$sortingSelector .= t3lib_befunc::getFuncMenu($this->addParams, 'SET[txdam_sortField]', $this->damSC->MOD_SETTINGS['txdam_sortField'], $fieldsSelItems);
if ($this->damSC->MOD_SETTINGS['txdam_sortRev']) {
$params = (array) $this->addParams + array('SET[txdam_sortRev]' => '0');
$href = t3lib_div::linkThisScript($params);
$sortingSelector .= '<button name="SET[txdam_sortRev]" type="button" onclick="self.location.href=\'' . htmlspecialchars($href) . '\'">' . '<img' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/pil2up.gif', 'width="12" height="7"') . ' alt="" />' . '</button>';
} else {
$params = (array) $this->addParams + array('SET[txdam_sortRev]' => '1');
$href = t3lib_div::linkThisScript($params);
$sortingSelector .= '<button name="SET[txdam_sortRev]" type="button" onclick="self.location.href=\'' . htmlspecialchars($href) . '\'">' . '<img' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/pil2down.gif', 'width="12" height="7"') . ' alt="" />' . '</button>';
}
$sortingSelector = $this->getFormTag('', 'sortingSelector') . $sortingSelector . '</form>';
}
$out .= '<div id="medialistfunctions">';
$out .= $this->getSelectionSelector();
$out .= $this->getFormTag();
$out .= $this->damSC->getSearchBox('simple', false, '', true);
$out .= '</form>';
$out .= $sortingSelector;
$out .= '</div>';
$out .= $this->doc->spacer(10);
$out .= $this->damSC->getResultInfoBar();
$out .= $this->doc->spacer(10);
// Listing the files:
if (is_array($files) and count($files)) {
$displayThumbs = $this->displayThumbs();
$dragdropImage = $mode == 'rte' && ($act == 'dragdrop' || $act == 'media_dragdrop');
$addAllJS = '';
$displayItems = '';
if ($mode == 'rte' && $act == 'media') {
if (t3lib_div::inList($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['rtehtmlarea']['plugins']['TYPO3Link']['additionalAttributes'], 'usedamcolumn') && $this->thisConfig['buttons.']['link.'][$act . '.']['properties.']['title.']['useDAMColumn']) {
$displayItems = $this->thisConfig['buttons.']['link.'][$act . '.']['properties.']['title.']['useDAMColumn.']['displayItems'] ? $this->thisConfig['buttons.']['link.'][$act . '.']['properties.']['title.']['useDAMColumn.']['displayItems'] : '';
}
}
// Traverse the file list:
$lines = array();
foreach ($files as $fI) {
if (!$fI['__exists']) {
tx_dam::meta_updateStatus($fI);
continue;
}
// Create file icon:
$iconFile = tx_dam::icon_getFileType($fI);
$iconTag = tx_dam_guiFunc::icon_getFileTypeImgTag($fI);
$iconAndFilename = $iconTag . htmlspecialchars(t3lib_div::fixed_lgd_cs($fI['file_title'], max($GLOBALS['BE_USER']->uc['titleLen'], 120)));
// Create links for adding the file:
if (strstr($fI['file_name_absolute'], ',') || strstr($fI['file_name_absolute'], '|')) {
// In case an invalid character is in the filepath, display error message:
$eMsg = $LANG->JScharCode(sprintf($LANG->getLL('invalidChar'), ', |'));
$ATag_insert = '<a href="#" onclick="alert(' . $eMsg . ');return false;">';
// If filename is OK, just add it:
} else {
// JS: insertElement(table, uid, type, filename, fpath, filetype, imagefile ,action, close)
$onClick_params = implode(', ', array("'" . $fI['_ref_table'] . "'", "'" . $fI['_ref_id'] . "'", "'" . $mode . "'", t3lib_div::quoteJSvalue($fI['file_name']), t3lib_div::quoteJSvalue($fI['_ref_file_path']), "'" . $fI['file_type'] . "'", "'" . $iconFile . "'"));
$titleAttrib = tx_dam_guiFunc::icon_getTitleAttribute($fI);
if ($mode === 'rte' and $act === 'media') {
$onClick = 'return link_folder(\'' . t3lib_div::rawUrlEncodeFP(tx_dam::file_relativeSitePath($fI['_ref_file_path'])) . '\');';
if (t3lib_div::inList($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['rtehtmlarea']['plugins']['TYPO3Link']['additionalAttributes'], 'txdam')) {
$onClick = 'browse_links_setAdditionalValue(\'txdam\', \'' . $fI['uid'] . '\');' . $onClick;
}
if (t3lib_div::inList($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['rtehtmlarea']['plugins']['TYPO3Link']['additionalAttributes'], 'usedamcolumn') && $this->thisConfig['buttons.']['link.'][$act . '.']['properties.']['title.']['useDAMColumn']) {
$damTitle = t3lib_div::quoteJSvalue(tx_dam_guiFunc::meta_compileHoverText($fI, $displayItems, ', '));
$onClick = 'if (document.getElementById(\'rtehtmlarea-dam-browse-links-useDAMColumn\') && document.getElementById(\'rtehtmlarea-dam-browse-links-useDAMColumn\').checked) { document.getElementById(\'rtehtmlarea-browse-links-anchor_title\').value = ' . $damTitle . '; }' . $onClick;
}
$ATag_insert = '<a href="#" onclick="' . htmlspecialchars($onClick) . '"' . $titleAttrib . '>';
} elseif (!$dragdropImage) {
$onClick = 'return insertElement(' . $onClick_params . ');';
$ATag_add = '<a href="#" onclick="' . htmlspecialchars($onClick) . '"' . $titleAttrib . '>';
$addIcon = $ATag_add . '<img' . t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'], 'gfx/plusbullet2.gif', 'width="18" height="16"') . ' title="' . $LANG->getLL('addToList', 1) . '" alt="" /></a>';
$onClick = 'return insertElement(' . $onClick_params . ', \'\', 1);';
$ATag_insert = '<a href="#" onclick="' . htmlspecialchars($onClick) . '"' . $titleAttrib . '>';
$addAllJS .= $mode === 'rte' ? '' : 'insertElement(' . $onClick_params . '); ';
}
}
// Create link to showing details about the file in a window:
if ($fI['__exists']) {
$infoOnClick = 'launchView(\'' . t3lib_div::rawUrlEncodeFP($fI['file_name_absolute']) . '\', \'\'); return false;';
$ATag_info = '<a href="#" onclick="' . htmlspecialchars($infoOnClick) . '">';
$info = $ATag_info . '<img' . t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'], 'gfx/zoom2.gif', 'width="12" height="12"') . ' title="' . $LANG->getLL('info', 1) . '" alt="" /> ' . $LANG->getLL('info', 1) . '</a>';
$info = '<span class="button">' . $info . '</span>';
//.........这里部分代码省略.........
示例10: getUpdateJS
/**
* Returns a JavaScript <script> section with some function calls to JavaScript functions from "t3lib/jsfunc.updateform.js" (which is also included by setting a reference in $GLOBALS['TSFE']->additionalHeaderData['JSincludeFormupdate'])
* The JavaScript codes simply transfers content into form fields of a form which is probably used for editing information by frontend users. Used by fe_adminLib.inc.
*
* @param array Data array which values to load into the form fields from $formName (only field names found in $fieldList)
* @param string The form name
* @param string A prefix for the data array
* @param string The list of fields which are loaded
* @return string
* @access private
* @see user_feAdmin::displayCreateScreen()
*/
function getUpdateJS($dataArray, $formName, $arrPrefix, $fieldList)
{
$JSPart = '';
$updateValues = t3lib_div::trimExplode(',', $fieldList);
foreach ($updateValues as $fKey) {
$value = $dataArray[$fKey];
if (is_array($value)) {
foreach ($value as $Nvalue) {
$JSPart .= "\n\tupdateForm('" . $formName . "','" . $arrPrefix . "[" . $fKey . "][]'," . t3lib_div::quoteJSvalue($Nvalue, TRUE) . ");";
}
} else {
$JSPart .= "\n\tupdateForm('" . $formName . "','" . $arrPrefix . "[" . $fKey . "]'," . t3lib_div::quoteJSvalue($value, TRUE) . ");";
}
}
$JSPart = '<script type="text/javascript">
/*<![CDATA[*/ ' . $JSPart . '
/*]]>*/
</script>
';
$GLOBALS['TSFE']->additionalHeaderData['JSincludeFormupdate'] = '<script type="text/javascript" src="' . t3lib_div::createVersionNumberedFilename($GLOBALS['TSFE']->absRefPrefix . 't3lib/jsfunc.updateform.js') . '"></script>';
return $JSPart;
}
示例11: getUploadedFileList
/**
* Creates a list of uploaded files
*
* @param array $log: ...
* @return string HTML content
*/
function getUploadedFileList($files)
{
global $BACK_PATH, $LANG;
$content = '';
// init table layout
$tableLayout = array('table' => array('<table border="0" cellpadding="1" cellspacing="1" id="typo3-filelist">', '</table>'), 'defRow' => array('tr' => array('<tr>', '</tr>'), 'defCol' => array('<td valign="middle" class="bgColor4">', '</td>'), '990' => array('<td valign="middle" class="bgColor4">', '</td>'), '996' => array('<td valign="middle" class="bgColor5">', '</td>')), '0' => array('tr' => array('<tr class="c-headLine">', '</tr>'), 'defCol' => array('<td valign="middle" class="c-headLine">', '</td>'), '2' => array('<td valign="middle" class="c-headLine" style="width:165px;">', '</td>')));
$table = array();
$tr = 0;
// header
$td = 0;
$table[$tr][$td++] = ' ';
$table[$tr][$td++] = ' ';
$table[$tr][$td++] = $LANG->getLL('c_file');
$table[$tr][$td++] = $LANG->getLL('c_fileext');
$table[$tr][$td++] = $LANG->getLL('c_tstamp');
$table[$tr][$td++] = $LANG->getLL('c_size');
# $table[$tr][$td++] = $LANG->getLL('c_rw');
$table[$tr][$td++] = ' ';
if (is_object($this->ebObj) && !$this->rteMode) {
$table[$tr][$td++] = ' ';
}
$addAllJS = '';
foreach ($files as $item) {
$tr++;
$row = $item['meta'];
$fileIcon = tx_dam::icon_getFileTypeImgTag($row, 'title="' . htmlspecialchars($row['file_type']) . '"');
// Add row to table
$td = 0;
if ($row['uid']) {
#$table[$tr][$td++] = $this->pObj->doc->icons(-1); // Ok;
$table[$tr][$td++] = $this->enableBatchProcessing ? '<input type="checkbox" name="process_recs[]" value="' . $row['uid'] . '" />' : '';
$table[$tr][$td++] = $fileIcon;
// if upload is called from RTE, allow direct linking by a click on file name
if ($this->rteMode && is_object($this->ebObj)) {
$row = $this->ebObj->enhanceItemArray($row, $this->ebObj->mode);
$onClick = 'return link_folder(' . t3lib_div::quoteJSvalue(t3lib_div::rawUrlEncodeFP(tx_dam::file_relativeSitePath($row['_ref_file_path']))) . ');';
$ATag_insert = '<a href="#" onclick="' . htmlspecialchars($onClick) . '"' . $titleAttrib . '>';
$table[$tr][$td++] = $ATag_insert . htmlspecialchars(t3lib_div::fixed_lgd_cs($row['file_name'], 30)) . '</a>';
} else {
$table[$tr][$td++] = htmlspecialchars(t3lib_div::fixed_lgd_cs($row['file_name'], 30));
}
$table[$tr][$td++] = htmlspecialchars(strtoupper($row['file_type']));
$table[$tr][$td++] = date($GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy'], $row['file_ctime']);
$table[$tr][$td++] = htmlspecialchars(t3lib_div::formatSize($row['file_size']));
$table[$tr][$td++] = $this->pObj->btn_editRec_inNewWindow('tx_dam', $item['uid']);
if (is_object($this->ebObj)) {
if (intval($row['uid']) && !$this->rteMode) {
$row = $this->ebObj->enhanceItemArray($row, $this->ebObj->mode);
$iconFile = tx_dam::icon_getFileType($row);
$titleAttrib = tx_dam_guiFunc::icon_getTitleAttribute($row);
// JS: insertElement(table, uid, type, filename, fpath, filetype, imagefile ,action, close)
$onClick_params = implode(', ', array("'" . $row['_ref_table'] . "'", "'" . $row['_ref_id'] . "'", "'" . $this->ebObj->mode . "'", t3lib_div::quoteJSvalue($row['file_name']), t3lib_div::quoteJSvalue($row['_ref_file_path']), "'" . $row['file_type'] . "'", "'" . $iconFile . "'"));
$onClick = 'return insertElement(' . $onClick_params . ');';
$ATag_add = '<a href="#" onclick="' . htmlspecialchars($onClick) . '"' . $titleAttrib . '>';
$onClick = 'return insertElement(' . $onClick_params . ', \'\', 1);';
$ATag_insert = '<a href="#" onclick="' . htmlspecialchars($onClick) . '"' . $titleAttrib . '>';
$addAllJS .= 'insertElement(' . $onClick_params . '); ';
$table[$tr][$td++] = $ATag_add . '<img' . t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'], 'gfx/plusbullet2.gif', 'width="18" height="16"') . ' title="' . $LANG->getLL('addToList', 1) . '" alt="" /></a>';
} elseif ($this->rteMode) {
continue;
} else {
$table[$tr][$td++] = '';
}
}
} else {
// failure
$table[$tr][$td++] = $this->pObj->doc->icons(2);
// warning
$table[$tr][$td++] = $fileIcon;
$table[$tr][$td++] = htmlspecialchars(t3lib_div::fixed_lgd_cs($row['file_name'], 30));
$table[$tr][$td++] = htmlspecialchars(strtoupper($row['file_type']));
$table[$tr][$td++] = '';
$table[$tr][$td++] = '';
$table[$tr][$td++] = htmlspecialchars($this->getErrorMsgFromItem($item));
}
}
// render table
if ($tr) {
$code = '';
// folder_link expects a form named ltargetform to look for link settings, so we need this if it's called from RTE
if ($this->rteMode) {
$code .= '<form action="" name="ltargetform" id="ltargetform"></form>';
}
$code .= $this->pObj->doc->table($table, $tableLayout);
if ($addAllJS) {
$label = $LANG->getLL('eb_addAllToList', true);
$titleAttrib = ' title="' . $label . '"';
$onClick = $addAllJS . 'return true;';
$ATag_add = '<a href="#" onclick="' . htmlspecialchars($onClick) . '"' . $titleAttrib . '>';
$addIcon = $ATag_add . '<img' . t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'], 'gfx/plusbullet2.gif', 'width="18" height="16"') . ' alt="" />';
$addAllButton = '<div style="margin:1em 0 1em 1em;"><span class="button"' . $titleAttrib . '>' . $ATag_add . $addIcon . $label . '</a></span></div>';
$code = $code . $addAllButton;
}
} else {
//.........这里部分代码省略.........
示例12: setStartupModule
/**
* Sets the startup module from either GETvars module and mpdParams or user configuration.
*
* @return void
*/
protected function setStartupModule()
{
$startModule = preg_replace('/[^[:alnum:]_]/', '', t3lib_div::_GET('module'));
if (!$startModule) {
if ($GLOBALS['BE_USER']->uc['startModule']) {
$startModule = $GLOBALS['BE_USER']->uc['startModule'];
} else {
if ($GLOBALS['BE_USER']->uc['startInTaskCenter']) {
$startModule = 'user_task';
}
}
}
$moduleParameters = t3lib_div::_GET('modParams');
if ($startModule) {
return '
// start in module:
top.startInModule = [\'' . $startModule . '\', ' . t3lib_div::quoteJSvalue($moduleParameters) . '];
';
} else {
return '';
}
}
示例13: render
//.........这里部分代码省略.........
$theRedirect = isset($conf['redirect.']) ? $this->cObj->stdWrap($conf['redirect'], $conf['redirect.']) : $conf['redirect'];
// redirect should be set to the page to redirect to after an external script has been used. If internal scripts is used, and if no 'type' is set that dictates otherwise, redirect is used as the url to jump to as long as it's an integer (page)
$target = isset($conf['target.']) ? $this->cObj->stdWrap($conf['target'], $conf['target.']) : $conf['target'];
// redirect should be set to the page to redirect to after an external script has been used. If internal scripts is used, and if no 'type' is set that dictates otherwise, redirect is used as the url to jump to as long as it's an integer (page)
$noCache = isset($conf['no_cache.']) ? $this->cObj->stdWrap($conf['no_cache'], $conf['no_cache.']) : $conf['no_cache'];
// redirect should be set to the page to redirect to after an external script has been used. If internal scripts is used, and if no 'type' is set that dictates otherwise, redirect is used as the url to jump to as long as it's an integer (page)
$page = $GLOBALS['TSFE']->page;
if (!$theRedirect) {
// Internal: Just submit to current page
$LD = $GLOBALS['TSFE']->tmpl->linkData($page, $target, $noCache, 'index.php', '', $this->cObj->getClosestMPvalueForPage($page['uid']));
} elseif (t3lib_div::testInt($theRedirect)) {
// Internal: Submit to page with ID $theRedirect
$page = $GLOBALS['TSFE']->sys_page->getPage_noCheck($theRedirect);
$LD = $GLOBALS['TSFE']->tmpl->linkData($page, $target, $noCache, 'index.php', '', $this->cObj->getClosestMPvalueForPage($page['uid']));
} else {
// External URL, redirect-hidden field is rendered!
$LD = $GLOBALS['TSFE']->tmpl->linkData($page, $target, $noCache, '', '', $this->cObj->getClosestMPvalueForPage($page['uid']));
$LD['totalURL'] = $theRedirect;
$hiddenfields .= '<input type="hidden" name="redirect" value="' . htmlspecialchars($LD['totalURL']) . '" />';
// 18-09-00 added
}
// Formtype (where to submit to!):
if ($propertyOverride['type']) {
$formtype = $propertyOverride['type'];
} else {
$formtype = isset($conf['type.']) ? $this->cObj->stdWrap($conf['type'], $conf['type.']) : $conf['type'];
}
if (t3lib_div::testInt($formtype)) {
// Submit to a specific page
$page = $GLOBALS['TSFE']->sys_page->getPage_noCheck($formtype);
$LD_A = $GLOBALS['TSFE']->tmpl->linkData($page, $target, $noCache, '', '', $this->cObj->getClosestMPvalueForPage($page['uid']));
$action = $LD_A['totalURL'];
} elseif ($formtype) {
// Submit to external script
$LD_A = $LD;
$action = $formtype;
} elseif (t3lib_div::testInt($theRedirect)) {
$LD_A = $LD;
$action = $LD_A['totalURL'];
} else {
// Submit to "nothing" - which is current page
$LD_A = $GLOBALS['TSFE']->tmpl->linkData($GLOBALS['TSFE']->page, $target, $noCache, '', '', $this->cObj->getClosestMPvalueForPage($page['uid']));
$action = $LD_A['totalURL'];
}
// Recipient:
$theEmail = isset($conf['recipient.']) ? $this->cObj->stdWrap($conf['recipient'], $conf['recipient.']) : $conf['recipient'];
if ($theEmail && !$GLOBALS['TYPO3_CONF_VARS']['FE']['secureFormmail']) {
$theEmail = $GLOBALS['TSFE']->codeString($theEmail);
$hiddenfields .= '<input type="hidden" name="recipient" value="' . htmlspecialchars($theEmail) . '" />';
}
// location data:
$location = isset($conf['locationData.']) ? $this->cObj->stdWrap($conf['locationData'], $conf['locationData.']) : $conf['locationData'];
if ($location) {
if ($location == 'HTTP_POST_VARS' && isset($_POST['locationData'])) {
$locationData = t3lib_div::_POST('locationData');
} else {
// locationData is [hte page id]:[tablename]:[uid of record]. Indicates on which page the record (from tablename with uid) is shown. Used to check access.
$locationData = $GLOBALS['TSFE']->id . ':' . $this->cObj->currentRecord;
}
$hiddenfields .= '<input type="hidden" name="locationData" value="' . htmlspecialchars($locationData) . '" />';
}
// hidden fields:
if (is_array($conf['hiddenFields.'])) {
foreach ($conf['hiddenFields.'] as $hF_key => $hF_conf) {
if (substr($hF_key, -1) != '.') {
$hF_value = $this->cObj->cObjGetSingle($hF_conf, $conf['hiddenFields.'][$hF_key . '.'], 'hiddenfields');
if (strlen($hF_value) && t3lib_div::inList('recipient_copy,recipient', $hF_key)) {
if ($GLOBALS['TYPO3_CONF_VARS']['FE']['secureFormmail']) {
continue;
}
$hF_value = $GLOBALS['TSFE']->codeString($hF_value);
}
$hiddenfields .= '<input type="hidden" name="' . $hF_key . '" value="' . htmlspecialchars($hF_value) . '" />';
}
}
}
// Wrap all hidden fields in a div tag (see http://bugs.typo3.org/view.php?id=678)
$hiddenfields = isset($conf['hiddenFields.']['stdWrap.']) ? $this->cObj->stdWrap($hiddenfields, $conf['hiddenFields.']['stdWrap.']) : '<div style="display:none;">' . $hiddenfields . '</div>';
if ($conf['REQ']) {
$goodMess = isset($conf['goodMess.']) ? $this->cObj->stdWrap($conf['goodMess'], $conf['goodMess.']) : $conf['goodMess'];
$badMess = isset($conf['badMess.']) ? $this->cObj->stdWrap($conf['badMess'], $conf['badMess.']) : $conf['badMess'];
$emailMess = isset($conf['emailMess.']) ? $this->cObj->stdWrap($conf['emailMess'], $conf['emailMess.']) : $conf['emailMess'];
$validateForm = ' onsubmit="return validateForm(\'' . $formName . '\',\'' . implode(',', $fieldlist) . '\',' . t3lib_div::quoteJSvalue($goodMess) . ',' . t3lib_div::quoteJSvalue($badMess) . ',' . t3lib_div::quoteJSvalue($emailMess) . ')"';
$GLOBALS['TSFE']->additionalHeaderData['JSFormValidate'] = '<script type="text/javascript" src="' . t3lib_div::createVersionNumberedFilename($GLOBALS['TSFE']->absRefPrefix . 't3lib/jsfunc.validateform.js') . '"></script>';
} else {
$validateForm = '';
}
// Create form tag:
$theTarget = $theRedirect ? $LD['target'] : $LD_A['target'];
$method = isset($conf['method.']) ? $this->cObj->stdWrap($conf['method'], $conf['method.']) : $conf['method'];
$content = array('<form' . ' action="' . htmlspecialchars($action) . '"' . ' id="' . $formName . '"' . ($xhtmlStrict ? '' : ' name="' . $formName . '"') . ' enctype="' . $GLOBALS['TYPO3_CONF_VARS']['SYS']['form_enctype'] . '"' . ' method="' . ($method ? $method : 'post') . '"' . ($theTarget ? ' target="' . $theTarget . '"' : '') . $validateForm . '>', $hiddenfields . $content, '</form>');
$arrayReturnMode = isset($conf['arrayReturnMode.']) ? $this->cObj->stdWrap($conf['arrayReturnMode'], $conf['arrayReturnMode.']) : $conf['arrayReturnMode'];
if ($arrayReturnMode) {
$content['validateForm'] = $validateForm;
$content['formname'] = $formName;
return $content;
} else {
return implode('', $content);
}
}
示例14: imageInsertJS
function imageInsertJS($url, $width, $height, $altText, $titleText, $origFile)
{
global $TYPO3_CONF_VARS;
echo '
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Untitled</title>
</head>
<script type="text/javascript">
/*<![CDATA[*/
var plugin = window.parent.RTEarea["' . $this->editorNo . '"].editor.getPlugin("TYPO3Image");
function insertImage(file,width,height,alt,title) {
plugin.insertImage(\'<img src="\'+file+\'"' . ($this->defaultClass ? ' class="' . $this->defaultClass . '"' : '') . ' alt="\'+alt+\'" title="\'+title+\'" width="\'+parseInt(width)+\'" height="\'+parseInt(height)+\'" />\');
}
/*]]>*/
</script>
<body>
<script type="text/javascript">
/*<![CDATA[*/
insertImage(' . t3lib_div::quoteJSvalue($url, 1) . ',' . $width . ',' . $height . ',' . t3lib_div::quoteJSvalue($altText, 1) . ',' . t3lib_div::quoteJSvalue($titleText, 1) . ');
/*]]>*/
</script>
</body>
</html>';
}
示例15: outputError
/**
* Return a errormessage if needed
* @param string $msg
* @param boolean $js
* @return string
*/
public function outputError($msg = '', $js = FALSE)
{
t3lib_div::devLog($msg, $this->extKey, 3);
if ($this->confArr['frontendErrorMsg'] || !isset($this->confArr['frontendErrorMsg'])) {
return $js ? "alert(" . t3lib_div::quoteJSvalue($msg) . ")" : "<p>{$msg}</p>";
} else {
return NULL;
}
}