本文整理汇总了PHP中t3lib_div::slashJS方法的典型用法代码示例。如果您正苦于以下问题:PHP t3lib_div::slashJS方法的具体用法?PHP t3lib_div::slashJS怎么用?PHP t3lib_div::slashJS使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类t3lib_div
的用法示例。
在下文中一共展示了t3lib_div::slashJS方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: main
/**
* Main function, returning the HTML content of the module
*
* @return string HTML
*/
function main() {
require_once(t3lib_extMgm::extPath(STATIC_INFO_TABLES_EXTkey).'class.tx_staticinfotables_encoding.php');
$tableArray = array ('static_countries', 'static_country_zones', 'static_languages', 'static_currencies');
$content = '';
$content.= '<br />Convert character encoding of the static info tables.';
$content.= '<br />The default encoding is UTF-8.';
$destEncoding = htmlspecialchars(t3lib_div::_GP('dest_encoding'));
if(t3lib_div::_GP('convert') AND ($destEncoding != '')) {
foreach ($tableArray as $table) {
$content .= '<p>'.htmlspecialchars($table.' > '.$destEncoding).'</p>';
tx_staticinfotables_encoding::convertEncodingTable($table, 'utf-8', $destEncoding);
}
$content .= '<p>You must enter the charset \''.$destEncoding.'\' now manually in the EM for static_info_tables!</p>';
$content .= '<p>Done</p>';
} else {
$content .= '<form name="static_info_tables_form" action="'.htmlspecialchars(t3lib_div::linkThisScript()).'" method="post">';
$linkScript = t3lib_div::slashJS(t3lib_div::linkThisScript());
$content .= '<br /><br />';
$content .= 'This conversion works only once. When you converted the tables and you want to do it again to another encoding you have to reinstall the tables with the Extension Manager or select \'UPDATE!\'.';
$content .= '<br /><br />';
$content .= 'Destination character encoding:';
$content .= '<br />'.tx_staticinfotables_encoding::getEncodingSelect('dest_encoding', '', '', $TYPO3_CONF_VARS['EXTCONF'][STATIC_INFO_TABLES_EXTkey]['charset']);
$content .= '<br /><br />';
$content .= '<input type="submit" name="convert" value="Convert" onclick="this.form.action=\''.$linkScript.'\';submit();" />';
$content .= '</form>';
}
return $content;
}
示例2: wrapTitle
/**
* wraps the record titles in the tree with links or not depending on if they are in the TCEforms_nonSelectableItemsArray.
*
* @param string $title: the title
* @param array $v: an array with uid and title of the current item.
* @return string the wrapped title
*/
function wrapTitle($title, $v)
{
if ($v['uid'] > 0) {
if (in_array($v['uid'], $this->TCEforms_nonSelectableItemsArray)) {
return '<a href="#" title="' . $v['description'] . '"><span style="color:#999;cursor:default;">' . $title . '</span></a>';
} else {
$hrefTitle = $v['description'];
$aOnClick = 'setFormValueFromBrowseWin(\'' . $this->TCEforms_itemFormElName . '\',' . $v['uid'] . ',\'' . t3lib_div::slashJS($title) . '\' ); return false;';
return '<a href="#" onclick="' . htmlspecialchars($aOnClick) . '" title="' . htmlentities($v['description']) . '">' . $title . '</a>';
}
} else {
return $GLOBALS['LANG']->sL('LLL:EXT:ab_linklist/locallang_db.php:tx_ablinklist_categories', 1);
}
}
示例3: wrapTitle
/**
* wraps the record titles in the tree with links or not depending on if they are in the TCEforms_nonSelectableItemsArray.
*
* @param string $title: the title
* @param array $v: an array with uid and title of the current item.
* @return string the wrapped title
*/
function wrapTitle($title, $v)
{
if ($v['uid'] > 0) {
$hrefTitle = htmlentities('[id=' . $v['uid'] . '] ' . $v['description']);
if (in_array($v['uid'], $this->TCEforms_nonSelectableItemsArray) || $this->disableAll) {
$style = $this->getTitleStyles($v, $hrefTitle);
return '<a href="#" title="' . $hrefTitle . '"><span style="color:#999;cursor:default;' . $style . '">' . $title . '</span></a>';
} else {
$aOnClick = 'setFormValueFromBrowseWin(\'' . $this->TCEforms_itemFormElName . '\',' . $v['uid'] . ',\'' . t3lib_div::slashJS($title) . '\'); return false;';
$style = $this->getTitleStyles($v, $hrefTitle);
return '<a href="#" onclick="' . htmlspecialchars($aOnClick) . '" title="' . $hrefTitle . '"><span style="' . $style . '">' . $title . '</span></a>';
}
} else {
if ($this->useStoragePid || isset($v['doktype'])) {
$pid = $this->storagePid ? $this->storagePid : $v['pid'];
$pidLbl = sprintf($GLOBALS['LANG']->sL('LLL:EXT:tt_news/locallang_tca.xml:tt_news.treeSelect.pageTitleSuffix'), $pid);
} else {
$pidLbl = $GLOBALS['LANG']->sL('LLL:EXT:tt_news/locallang_tca.xml:tt_news.treeSelect.pageTitleSuffixNoGrsp');
}
$pidLbl = ' <span class="typo3-dimmed"><em>' . $pidLbl . '</em></span>';
return $title . $pidLbl;
}
}
示例4: renderSuggestSelector
/**
* Renders an ajax-enabled text field. Also adds required JS
*
* @param string $fieldname The fieldname in the form
* @param string $table The table we render this selector for
* @param string $field The field we render this selector for
* @param array $row The row which is currently edited
* @param array $config The TSconfig of the field
* @return string The HTML code for the selector
*/
public function renderSuggestSelector($fieldname, $table, $field, array $row, array $config)
{
$this->suggestCount++;
$containerCssClass = $this->cssClass . ' ' . $this->cssClass . '-position-right';
$suggestId = 'suggest-' . $table . '-' . $field . '-' . $row['uid'];
$selector = '
<div class="' . $containerCssClass . '" id="' . $suggestId . '">
<input type="text" id="' . $fieldname . 'Suggest" value="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:labels.findRecord') . '" class="' . $this->cssClass . '-search" />
<div class="' . $this->cssClass . '-indicator" style="display: none;" id="' . $fieldname . 'SuggestIndicator">
<img src="' . $GLOBALS['BACK_PATH'] . 'gfx/spinner.gif" alt="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:alttext.suggestSearching') . '" />
</div>
<div class="' . $this->cssClass . '-choices" style="display: none;" id="' . $fieldname . 'SuggestChoices"></div>
</div>';
// get minimumCharacters from TCA
if (isset($config['fieldConf']['config']['wizards']['suggest']['default']['minimumCharacters'])) {
$minChars = intval($config['fieldConf']['config']['wizards']['suggest']['default']['minimumCharacters']);
}
// overwrite it with minimumCharacters from TSConfig (TCEFORM) if given
if (isset($config['fieldTSConfig']['suggest.']['default.']['minimumCharacters'])) {
$minChars = intval($config['fieldTSConfig']['suggest.']['default.']['minimumCharacters']);
}
$minChars = $minChars > 0 ? $minChars : 2;
// replace "-" with ucwords for the JS object name
$jsObj = str_replace(' ', '', ucwords(str_replace('-', ' ', t3lib_div::strtolower($suggestId))));
$this->TCEformsObj->additionalJS_post[] = '
var ' . $jsObj . ' = new TCEForms.Suggest("' . $fieldname . '", "' . $table . '", "' . $field . '", "' . $row['uid'] . '", ' . $row['pid'] . ', ' . $minChars . ');
' . $jsObj . '.defaultValue = "' . t3lib_div::slashJS($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:labels.findRecord')) . '";
';
return $selector;
}
示例5: ext_printFields
//.........这里部分代码省略.........
// Check if $params['value'] is in the list of resources.
if ($selectThisFile && $selectThisFile == $val) {
$sel = ' selected';
if ($onlineResourceFlag <= 0) {
$theImage = t3lib_BEfunc::thumbCode(array('resources' => $selectThisFile), 'sys_template', 'resources', $GLOBALS['BACK_PATH'], '');
} else {
$theImage = t3lib_BEfunc::thumbCode(array('resources' => $fI['file']), 'sys_template', 'resources', $GLOBALS['BACK_PATH'], '', $fI['path']);
}
}
if ($onlineResourceFlag <= 0) {
$onlineResourceFlag--;
// Value is set with a *
$val = $this->ext_setStar($val);
$p_field .= '<option value="' . htmlspecialchars($val) . '"' . $sel . '>' . $val . $dims . '</option>';
} else {
$p_field .= '<option value="' . htmlspecialchars($val) . '"' . $sel . '>' . $fI['file'] . $dims . '</option>';
}
}
}
if (trim($params['value']) && !$selectThisFile) {
$val = $params['value'];
$p_field .= '<option value=""></option>';
$p_field .= '<option value="' . htmlspecialchars($val) . '" selected>' . $val . '</option>';
}
$p_field = '<select id="' . $fN . '" name="' . $fN . '" onChange="uFormUrl(' . $aname . ')">' . $p_field . '</select>';
$p_field .= $theImage;
if (!$this->ext_noCEUploadAndCopying) {
// Copy a resource
$copyFile = $this->extractFromResources($this->setup['resources'], $params['value']);
if (!$copyFile) {
if ($params['value']) {
$copyFile = PATH_site . $this->ext_detectAndFixExtensionPrefix($params['value']);
}
} else {
$copyFile = '';
}
if ($copyFile && @is_file($copyFile)) {
$p_field .= '<img src="clear.gif" width="20" ' . 'height="1" alt="" />' . t3lib_iconWorks::getSpriteIcon('actions-edit-copy') . '<input type="checkbox" ' . 'name="_copyResource[' . $params['name'] . ']" value="' . htmlspecialchars($copyFile) . '" onclick="uFormUrl(' . $aname . ');if (this.checked && !confirm(\'' . t3lib_div::slashJS(htmlspecialchars(sprintf($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_tsparser.xml:tsparser_ext.make_copy'), $params['value']))) . '\')) this.checked=false;" />';
}
// Upload?
$p_field .= '<br />';
$p_field .= '<input id="' . $fN . '" type="file" name="upload_' . $fN . '"' . $GLOBALS['TBE_TEMPLATE']->formWidth() . ' onChange="uFormUrl(' . $aname . ')" size="50" />';
}
break;
case 'user':
$userFunction = $typeDat['paramstr'];
$userFunctionParams = array('fieldName' => $fN, 'fieldValue' => $fV);
$p_field = t3lib_div::callUserFunction($userFunction, $userFunctionParams, $this, '');
break;
case 'small':
default:
$fwidth = $typeDat['type'] == 'small' ? 10 : 46;
$p_field = '<input id="' . $fN . '" type="text" name="' . $fN . '" value="' . $fV . '"' . $GLOBALS['TBE_TEMPLATE']->formWidth($fwidth) . ' onChange="uFormUrl(' . $aname . ')" />';
break;
}
// Define default names and IDs
$userTyposcriptID = 'userTS-' . $params['name'];
$defaultTyposcriptID = 'defaultTS-' . $params['name'];
$checkboxName = 'check[' . $params['name'] . ']';
$checkboxID = $checkboxName;
// Handle type=color specially
if ($typeDat['type'] == 'color' && substr($params['value'], 0, 2) != '{$') {
$color = '<div id="colorbox-' . $fN . '" class="typo3-tstemplate-ceditor-colorblock" style="background-color:' . $params['value'] . ';"> </div>';
} else {
$color = '';
}
if (!$this->ext_dontCheckIssetValues) {
/* Set the default styling options */
if (isset($this->objReg[$params['name']])) {
$checkboxValue = 'checked';
$userTyposcriptStyle = '';
$defaultTyposcriptStyle = 'style="display:none;"';
} else {
$checkboxValue = '';
$userTyposcriptStyle = 'style="display:none;"';
$defaultTyposcriptStyle = '';
}
$deleteIconHTML = t3lib_iconWorks::getSpriteIcon('actions-edit-undo', array('class' => "typo3-tstemplate-ceditor-control undoIcon", 'alt' => "Revert to default Constant", 'title' => "Revert to default Constant", 'rel' => $params['name']));
$editIconHTML = t3lib_iconWorks::getSpriteIcon('actions-document-open', array('class' => "typo3-tstemplate-ceditor-control editIcon", 'alt' => "Edit this Constant", 'title' => "Edit this Constant", 'rel' => $params['name']));
$constantCheckbox = '<input type="hidden" name="' . $checkboxName . '" id="' . $checkboxID . '" value="' . $checkboxValue . '"/>';
// If there's no default value for the field, use a static label.
if (!$params['default_value']) {
$params['default_value'] = '[Empty]';
}
$constantDefaultRow = '<div class="typo3-tstemplate-ceditor-row" id="' . $defaultTyposcriptID . '" ' . $defaultTyposcriptStyle . '>' . $editIconHTML . htmlspecialchars($params['default_value']) . $color . '</div>';
}
$constantEditRow = '<div class="typo3-tstemplate-ceditor-row" id="' . $userTyposcriptID . '" ' . $userTyposcriptStyle . '>' . $deleteIconHTML . $p_field . $color . '</div>';
$constantLabel = '<dt class="typo3-tstemplate-ceditor-label">' . htmlspecialchars($head) . '</dt>';
$constantName = '<dt class="typo3-dimmed">[' . $params['name'] . ']</dt>';
$constantDescription = $body ? '<dd>' . htmlspecialchars($body) . '</dd>' : '';
$constantData = '<dd>' . $constantCheckbox . $constantEditRow . $constantDefaultRow . '</dd>';
$output .= '<a name="' . $raname . '"></a>' . $help['constants'][$params['name']];
$output .= '<dl class="typo3-tstemplate-ceditor-constant">' . $constantLabel . $constantName . $constantDescription . $constantData . '</dl>';
} else {
debug('Error. Constant did not exist. Should not happen.');
}
}
}
return $output;
}
示例6: debug_typo3PrintError
/**
* This prints out a TYPO3 error message.
*
* @param string Header string
* @param string Message string
* @param boolean If set, then this will produce a alert() line for inclusion in JavaScript.
* @param string URL for the <base> tag (if you want it)
* @return string
*/
public function debug_typo3PrintError($header, $text, $js, $baseUrl = '')
{
if ($js) {
$errorMessage = 'alert(\'' . t3lib_div::slashJS($header . '\\n' . $text) . '\');';
} else {
$errorMessage = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml11.dtd">
<?xml version="1.0" encoding="utf-8"?>
<html>
<head>
' . ($baseUrl ? '<base href="' . htmlspecialchars($baseUrl) . '" />' : '') . '
<title>Error!</title>
<style type="text/css"><!--/*--><![CDATA[/*><!--*/
body { font-family:Verdana,Arial,Helvetica,sans-serif; font-size: 90%; text-align: center; background-color: #ffffff; }
h1 { font-size: 1.2em; margin: 0 0 1em 0; }
p { margin: 0; text-align: left; }
img { border: 0; margin: 10px 0; }
div.center div { margin: 0 auto; }
.errorBox { width: 400px; padding: 0.5em; border: 1px solid black; background-color: #F4F0E8; }
/*]]>*/--></style>
</head>
<body>
<div class="center">
<img src="' . TYPO3_mainDir . 'gfx/typo3logo.gif" width="123" height="34" alt="" />
<div class="errorBox">
<h1>' . $header . '</h1>
<p>' . $text . '</p>
</div>
</div>
</body>
</html>';
}
// Hook to modify error message
if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_timetrack.php']['debug_typo3PrintError'])) {
$params = array('header' => $header, 'text' => $text, 'js' => $js, 'baseUrl' => $baseUrl, 'errorMessage' => &$errorMessage);
$null = null;
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_timetrack.php']['debug_typo3PrintError'] as $hookMethod) {
t3lib_div::callUserFunction($hookMethod, $params, $null);
}
}
echo $errorMessage;
}
示例7: typo3PrintError
/**
* Print error message with header, text etc.
* Usage: 19
*
* @param string Header string
* @param string Content string
* @param boolean Will return an alert() with the content of header and text.
* @param boolean Print header.
* @return void
* @deprecated since TYPO3 4.5, will be removed in TYPO3 4.7 - use RuntimeException from now on
*/
public static function typo3PrintError($header, $text, $js = '', $head = 1)
{
// This prints out a TYPO3 error message.
// If $js is set the message will be output in JavaScript
if ($js) {
echo "alert('" . t3lib_div::slashJS($header . '\\n' . $text) . "');";
} else {
t3lib_div::logDeprecatedFunction();
$messageObj = t3lib_div::makeInstance('t3lib_message_ErrorPageMessage', $text, $header);
$messageObj->output();
}
}
示例8: wrapTitle
function wrapTitle($title, $row, $bank)
{
if ($row['uid'] > 0) {
if (in_array($row['uid'], $this->TCEforms_nonSelectableItemsArray)) {
$style = $this->getTitleStyles($row);
return '<a href="#" title="' . $title . ' [uid: ' . $row['uid'] . ']"><span style="color: #999; cursor:default; ' . $style . '">' . $title . '</span></a>';
} else {
$aOnClick = 'setFormValueFromBrowseWin(\'' . $this->TCEforms_itemFormElName . '\', ' . $row['uid'] . ', \'' . t3lib_div::slashJS($title) . '\'); return false;';
$style = $this->getTitleStyles($row);
return '<a href="#" onclick="' . htmlspecialchars($aOnClick) . '" title="' . $title . ' [uid: ' . $row['uid'] . ']"><span style="' . $style . '">' . $title . '</span></a>';
}
} else {
$pidLbl = ' <span class="typo3-dimmed"><em>' . $GLOBALS['LANG']->sL('LLL:EXT:cps_tcatree/locallang_tca.xml:cps_tcatree.treeview.allPages') . '</em></span>';
return $title . $pidLbl;
}
}
示例9: dbFileIcons
//.........这里部分代码省略.........
}
$pTitle = is_array($pRec) ? $pRec[$GLOBALS['TCA'][$pp['table']]['ctrl']['label']] : NULL;
}
if ($pTitle) {
$pTitle = $pTitle ? t3lib_div::fixed_lgd_cs($pTitle, $this->tceforms->titleLen) : t3lib_BEfunc::getNoRecordTitle();
$pUid = $pp['table'] . '_' . $pp['id'];
$uidList[] = $pUid;
$opt[] = '<option value="' . htmlspecialchars($pUid) . '">' . htmlspecialchars($pTitle) . '</option>';
}
}
break;
case 'folder':
case 'file':
while (list(, $pp) = each($itemArray)) {
$pParts = explode('|', $pp);
$uidList[] = $pUid = $pTitle = $pParts[0];
$opt[] = '<option value="' . htmlspecialchars(rawurldecode($pParts[0])) . '">' . htmlspecialchars(rawurldecode($pParts[0])) . '</option>';
}
break;
default:
while (list(, $pp) = each($itemArray)) {
$pParts = explode('|', $pp, 2);
$uidList[] = $pUid = $pParts[0];
$pTitle = $pParts[1] ? $pParts[1] : $pParts[0];
$opt[] = '<option value="' . htmlspecialchars(rawurldecode($pUid)) . '">' . htmlspecialchars(rawurldecode($pTitle)) . '</option>';
}
break;
}
}
// Create selector box of the options
$sSize = $params['autoSizeMax'] ? t3lib_div::intInRange($itemArrayC + 1, t3lib_div::intInRange($params['size'], 1), $params['autoSizeMax']) : $params['size'];
if (!$selector) {
$selector = '<select size="' . $sSize . '"' . $this->tceforms->insertDefStyle('group') . ' multiple="multiple" name="' . $fName . '_list" ' . $onFocus . $params['style'] . $disabled . '>' . implode('', $opt) . '</select>';
}
$icons = array('L' => array(), 'R' => array());
if (!$params['readOnly']) {
if (!$params['noBrowser']) {
$aOnClick = 'setFormValueOpenBrowser(\'' . $modeEB . '\',\'' . ($fName . '|||' . $allowed . '|' . $userEBParam . '|') . '\'); return false;';
$icons['R'][] = '<a href="#" onclick="' . htmlspecialchars($aOnClick) . '">' . '<img' . t3lib_iconWorks::skinImg($this->tceforms->backPath, 'gfx/insert3.gif', 'width="14" height="14"') . ' border="0" ' . t3lib_BEfunc::titleAltAttrib($this->tceforms->getLL('l_browse_' . ($mode === 'file' ? 'file' : 'db'))) . ' />' . '</a>';
}
if (!$params['dontShowMoveIcons']) {
if ($sSize >= 5) {
$icons['L'][] = '<a href="#" onclick="setFormValueManipulate(\'' . $fName . '\',\'Top\'); return false;">' . '<img' . t3lib_iconWorks::skinImg($this->tceforms->backPath, 'gfx/group_totop.gif', 'width="14" height="14"') . ' border="0" ' . t3lib_BEfunc::titleAltAttrib($this->tceforms->getLL('l_move_to_top')) . ' />' . '</a>';
}
$icons['L'][] = '<a href="#" onclick="setFormValueManipulate(\'' . $fName . '\',\'Up\'); return false;">' . '<img' . t3lib_iconWorks::skinImg($this->tceforms->backPath, 'gfx/up.gif', 'width="14" height="14"') . ' border="0" ' . t3lib_BEfunc::titleAltAttrib($this->tceforms->getLL('l_move_up')) . ' />' . '</a>';
$icons['L'][] = '<a href="#" onclick="setFormValueManipulate(\'' . $fName . '\',\'Down\'); return false;">' . '<img' . t3lib_iconWorks::skinImg($this->tceforms->backPath, 'gfx/down.gif', 'width="14" height="14"') . ' border="0" ' . t3lib_BEfunc::titleAltAttrib($this->tceforms->getLL('l_move_down')) . ' />' . '</a>';
if ($sSize >= 5) {
$icons['L'][] = '<a href="#" onclick="setFormValueManipulate(\'' . $fName . '\',\'Bottom\'); return false;">' . '<img' . t3lib_iconWorks::skinImg($this->tceforms->backPath, 'gfx/group_tobottom.gif', 'width="14" height="14"') . ' border="0" ' . t3lib_BEfunc::titleAltAttrib($this->tceforms->getLL('l_move_to_bottom')) . ' />' . '</a>';
}
}
// todo Clipboard
$clipElements = $this->tceforms->getClipboardElements($allowed, $mode);
if (count($clipElements)) {
$aOnClick = '';
# $counter = 0;
foreach ($clipElements as $elValue) {
if ($mode === 'file' or $mode === 'folder') {
$itemTitle = 'unescape(\'' . rawurlencode(tx_dam::file_basename($elValue)) . '\')';
} else {
// 'db' mode assumed
list($itemTable, $itemUid) = explode('|', $elValue);
if (function_exists('t3lib_BEfunc::getRecordWSOL')) {
$rec = t3lib_BEfunc::getRecordWSOL($itemTable, $itemUid);
} else {
$rec = t3lib_BEfunc::getRecord($itemTable, $itemUid);
}
$itemTitle = $GLOBALS['LANG']->JScharCode(t3lib_BEfunc::getRecordTitle($itemTable, $rec));
$elValue = $itemTable . '_' . $itemUid;
}
$aOnClick .= 'setFormValueFromBrowseWin(\'' . $fName . '\',\'' . t3lib_div::slashJS(t3lib_div::rawUrlEncodeJS($elValue)) . '\',' . t3lib_div::slashJS($itemTitle) . ');';
#$aOnClick .= 'setFormValueFromBrowseWin(\''.$fName.'\',unescape(\''.rawurlencode(str_replace('%20', ' ', $elValue)).'\'),'.$itemTitle.');';
# $counter++;
# if ($params['maxitems'] && $counter >= $params['maxitems']) { break; } // Makes sure that no more than the max items are inserted... for convenience.
}
$aOnClick .= 'return false;';
$icons['R'][] = '<a href="#" onclick="' . htmlspecialchars($aOnClick) . '">' . '<img' . t3lib_iconWorks::skinImg($this->tceforms->backPath, 'gfx/insert5.png', 'width="14" height="14"') . ' border="0" ' . t3lib_BEfunc::titleAltAttrib(sprintf($this->tceforms->getLL('l_clipInsert_' . ($mode === 'file' ? 'file' : 'db')), count($clipElements))) . ' />' . '</a>';
}
$icons['L'][] = '<a href="#" onclick="setFormValueManipulate(\'' . $fName . '\',\'Remove\'); return false;">' . '<img' . t3lib_iconWorks::skinImg($this->tceforms->backPath, 'gfx/group_clear.gif', 'width="14" height="14"') . ' border="0" ' . t3lib_BEfunc::titleAltAttrib($this->tceforms->getLL('l_remove_selected')) . ' />' . '</a>';
}
$str = '<table border="0" cellpadding="0" cellspacing="0" width="1">
' . ($params['headers'] ? '
<tr>
<td>' . $this->tceforms->wrapLabels($params['headers']['selector']) . '</td>
<td></td>
<td></td>
<td></td>
<td>' . ($params['thumbnails'] ? $this->tceforms->wrapLabels($params['headers']['items']) : '') . '</td>
</tr>' : '') . '
<tr>
<td valign="top">' . $selector . '<br />' . $this->tceforms->wrapLabels($params['info']) . '</td>
<td valign="top">' . implode('<br />', $icons['L']) . '</td>
<td valign="top">' . implode('<br />', $icons['R']) . '</td>
<td style="height:5px;"><span></span></td>
<td valign="top">' . $this->tceforms->wrapLabels($params['thumbnails']) . '</td>
</tr>
</table>';
// Creating the hidden field which contains the actual value as a comma list.
$str .= '<input type="hidden" name="' . $fName . '" value="' . htmlspecialchars(implode(',', $uidList)) . '" />';
return $str;
}
示例10: arrayToCode
/**
* Enter description here...
*
* @param unknown_type $array
* @param unknown_type $lines
* @param unknown_type $level
* @return unknown
*/
public static function arrayToCode($array, $level = 0)
{
$lines = 'array(' . LF;
$level++;
foreach ($array as $k => $v) {
if (strlen($k) && is_array($v)) {
$lines .= str_repeat(TAB, $level) . "'" . $k . "' => " . self::arrayToCode($v, $level);
} elseif (strlen($k)) {
$lines .= str_repeat(TAB, $level) . "'" . $k . "' => " . (t3lib_div::testInt($v) ? intval($v) : "'" . t3lib_div::slashJS(trim($v), 1) . "'") . ',' . LF;
}
}
$lines .= str_repeat(TAB, $level - 1) . ')' . ($level - 1 == 0 ? '' : ',' . LF);
return $lines;
}
示例11: main
//.........这里部分代码省略.........
$options[] = "animationTime: {$this->conf['config.']['sliderTransitionduration']}";
}
if ($this->conf['config.']['sliderAutoplay']) {
$options[] = "autoPlay: true";
} else {
$options[] = "autoPlay: false";
}
if ($this->conf['config.']['delayDuration'] > 0) {
$options[] = "delay: {$this->conf['config.']['delayDuration']}";
$options[] = "startStopped: " . ($this->conf['config.']['sliderAutoStart'] ? 'false' : 'true');
$options[] = "stopAtEnd: " . ($this->conf['config.']['sliderStopAtEnd'] ? 'true' : 'false');
} else {
// Toggle only if not autoplay
$options[] = "toggleArrows: " . ($this->conf['config.']['sliderToggleArrows'] ? 'true' : 'false');
$options[] = "toggleControls: " . ($this->conf['config.']['sliderToggleControls'] ? 'true' : 'false');
}
$sliderWidth = trim($this->conf['config.']['sliderWidth']);
$sliderHeight = trim($this->conf['config.']['sliderHeight']);
if ($sliderWidth || $sliderHeight) {
if (is_numeric($sliderWidth)) {
$sliderWidth .= 'px';
}
if (is_numeric($sliderHeight)) {
$sliderHeight .= 'px';
}
$this->pagerenderer->addCSS("#{$this->getContentKey()} {\n" . ($sliderWidth ? "\twidth: {$sliderWidth};\n" : "") . ($sliderHeight ? "\theight: {$sliderHeight};\n" : "") . "}");
}
if ($this->conf['config.']['sliderResizeContents']) {
$options[] = "resizeContents: true";
}
$this->pagerenderer->addCssFile($this->conf['sliderCSS']);
$this->pagerenderer->addCssFileInc($this->conf['sliderCSSie7'], 'lte IE 7');
if ($this->conf['config.']['sliderTheme']) {
$options[] = "theme: '" . t3lib_div::slashJS($this->conf['config.']['sliderTheme']) . "'";
if (substr($this->confArr['anythingSliderThemeFolder'], 0, 4) === 'EXT:') {
list($extKey, $local) = explode('/', substr($this->confArr['anythingSliderThemeFolder'], 4), 2);
$anythingSliderThemeFolder = t3lib_extMgm::siteRelPath($extKey) . $local;
} else {
$anythingSliderThemeFolder = $this->confArr['anythingSliderThemeFolder'];
}
$this->pagerenderer->addCssFile(t3lib_div::slashJS($anythingSliderThemeFolder) . $this->conf['config.']['sliderTheme'] . '/style.css');
}
if ($this->conf['config.']['sliderMode']) {
$options[] = "mode: '" . $this->conf['config.']['sliderMode'] . "'";
}
$options[] = "buildArrows: " . ($this->conf['config.']['sliderBuildArrows'] ? 'true' : 'false');
$options[] = "allowRapidChange: " . ($this->conf['config.']['sliderAllowRapidChange'] ? 'true' : 'false');
$options[] = "resumeOnVideoEnd: " . ($this->conf['config.']['sliderResumeOnVideoEnd'] ? 'true' : 'false');
$options[] = "playRtl: " . ($this->conf['config.']['sliderPlayRtl'] ? 'true' : 'false');
$options[] = "hashTags: " . ($this->conf['config.']['sliderHashTags'] ? 'true' : 'false');
$options[] = "pauseOnHover: " . ($this->conf['config.']['sliderPauseOnHover'] ? 'true' : 'false');
$options[] = "buildNavigation: " . ($this->conf['config.']['sliderNavigation'] ? 'true' : 'false');
$options[] = "buildStartStop: " . ($this->conf['config.']['sliderStartStop'] ? 'true' : 'false');
$options[] = "startText: '" . t3lib_div::slashJS($this->pi_getLL('slider_start')) . "'";
$options[] = "stopText: '" . t3lib_div::slashJS($this->pi_getLL('slider_stop')) . "'";
if ($this->pi_getLL('slider_forward')) {
$options[] = "forwardText: '" . t3lib_div::slashJS($this->pi_getLL('slider_forward')) . "'";
}
if ($this->pi_getLL('slider_back')) {
$options[] = "backText: '" . t3lib_div::slashJS($this->pi_getLL('slider_back')) . "'";
}
// define the paneltext
if ($this->conf['config.']['sliderPanelFromHeader']) {
$tab = array();
for ($a = 0; $a < $this->contentCount; $a++) {
$tab[] = "if(i==" . ($a + 1) . ") return " . t3lib_div::quoteJSvalue($this->titles[$a]) . ";";
示例12: pi_addJS
/**
*
* @return void
*/
function pi_addJS()
{
$this->pagerenderer->addJS("\nvar feuser_friends = {\n\tdialogToAdd: function(uid) {\n\t\tjQuery('#dialog').remove();\n\t\tjQuery.ajax({\n\t\t\ttype: 'get',\n\t\t\turl: 'index.php',\n\t\t\tdata: 'type={$this->conf['ajaxTypeNum']}&tx_feuserfriends_pi1[addfriendrequest]='+uid,\n\t\t\tsuccess: function(html, status) {\n\t\t\t\tjQuery('body').append('<div id=\"dialog\">'+html+'</div>');\n\t\t\t\tjQuery('#dialog').dialog({\n\t\t\t\t\tbuttons: {\n\t\t\t\t\t\t'" . t3lib_div::slashJS($this->pi_getLL('ok')) . "': function() {\n\t\t\t\t\t\t\tjQuery.ajax({\n\t\t\t\t\t\t\t\ttype: 'get',\n\t\t\t\t\t\t\t\turl: 'index.php',\n\t\t\t\t\t\t\t\tdata: 'type={$this->conf['ajaxTypeNum']}&tx_feuserfriends_pi1[addfriendrequest]='+uid+'&tx_feuserfriends_pi1[send]=1'+'&'+jQuery('textarea[name=\"tx_feuserfriends_pi1[invitation]\"]').serialize(),\n\t\t\t\t\t\t\t\tsuccess: function(html, status) {\n\t\t\t\t\t\t\t\t\tif ('{$this->conf['messageTagID']}' == '') {\n\t\t\t\t\t\t\t\t\t\talert(html);\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\tjQuery('#" . $this->conf['messageTagID'] . "').html(html);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tjQuery(this).dialog('close');\n\t\t\t\t\t\t},\n\t\t\t\t\t\t'" . t3lib_div::slashJS($this->pi_getLL('cancel')) . "': function() {\n\t\t\t\t\t\t\tjQuery(this).dialog('close');\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\ttitle: '" . t3lib_div::slashJS($this->pi_getLL('friends_add_title')) . "'\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\t},\n\tdialogToRemove: function(uid) {\n\t\tjQuery('#dialog').remove();\n\t\tjQuery.ajax({\n\t\t\ttype: 'get',\n\t\t\turl: 'index.php',\n\t\t\tdata: 'type={$this->conf['ajaxTypeNum']}&tx_feuserfriends_pi1[removefriend]='+uid,\n\t\t\tsuccess: function(html, status) {\n\t\t\t\tjQuery('body').append('<div id=\"dialog\">'+html+'</div>');\n\t\t\t\tjQuery('#dialog').dialog({\n\t\t\t\t\tbuttons: {\n\t\t\t\t\t\t'" . t3lib_div::slashJS($this->pi_getLL('cancel')) . "': function() {\n\t\t\t\t\t\t\tjQuery(this).dialog('close');\n\t\t\t\t\t\t},\n\t\t\t\t\t\t'" . t3lib_div::slashJS($this->pi_getLL('ok')) . "': function() {\n\t\t\t\t\t\t\tjQuery.ajax({\n\t\t\t\t\t\t\t\ttype: 'get',\n\t\t\t\t\t\t\t\turl: 'index.php',\n\t\t\t\t\t\t\t\tdata: 'type={$this->conf['ajaxTypeNum']}&tx_feuserfriends_pi1[removefriend]='+uid+'&tx_feuserfriends_pi1[send]=1',\n\t\t\t\t\t\t\t\tsuccess: function(html, status) {\n\t\t\t\t\t\t\t\t\tif ('{$this->conf['messageTagID']}' == '') {\n\t\t\t\t\t\t\t\t\t\talert(html);\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\tjQuery('#" . $this->conf['messageTagID'] . "').html(html);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tjQuery('#friends_'+uid).hide('blind');\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tjQuery(this).dialog('close');\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\ttitle: '" . t3lib_div::slashJS($this->pi_getLL('friends_remove_title')) . "'\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\t},\n\tdialogToAccept: function(uid) {\n\t\tjQuery('#dialog').remove();\n\t\tjQuery.ajax({\n\t\t\ttype: 'get',\n\t\t\turl: 'index.php',\n\t\t\tdata: 'type={$this->conf['ajaxTypeNum']}&tx_feuserfriends_pi1[showfriendrequest]='+uid,\n\t\t\tsuccess: function(html, status) {\n\t\t\t\tjQuery('body').append('<div id=\"dialog\">'+html+'</div>');\n\t\t\t\tjQuery('#dialog').dialog({\n\t\t\t\t\tbuttons: {\n\t\t\t\t\t\t'" . t3lib_div::slashJS($this->pi_getLL('friends_request_accept')) . "': function() {\n\t\t\t\t\t\t\tjQuery.ajax({\n\t\t\t\t\t\t\t\ttype: 'get',\n\t\t\t\t\t\t\t\turl: 'index.php',\n\t\t\t\t\t\t\t\tdata: 'type={$this->conf['ajaxTypeNum']}&tx_feuserfriends_pi1[acceptfriend]='+uid,\n\t\t\t\t\t\t\t\tsuccess: function(html, status) {\n\t\t\t\t\t\t\t\t\tjQuery('#friendsrequest_link_'+uid).hide('blind');\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tjQuery(this).dialog('close');\n\t\t\t\t\t\t},\n\t\t\t\t\t\t'" . t3lib_div::slashJS($this->pi_getLL('friends_request_reject')) . "': function() {\n\t\t\t\t\t\t\tjQuery.ajax({\n\t\t\t\t\t\t\t\ttype: 'get',\n\t\t\t\t\t\t\t\turl: 'index.php',\n\t\t\t\t\t\t\t\tdata: 'type={$this->conf['ajaxTypeNum']}&tx_feuserfriends_pi1[rejectfriend]='+uid,\n\t\t\t\t\t\t\t\tsuccess: function(html, status) {\n\t\t\t\t\t\t\t\t\tjQuery('#friendsrequest_link_'+uid).hide('blind');\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tjQuery(this).dialog('close');\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\ttitle: '" . t3lib_div::slashJS($this->pi_getLL('friends_request_title')) . "'\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\t},\n\tdialogSendMessage: function(uid) {\n\t\tjQuery('#dialog').remove();\n\t\tjQuery.ajax({\n\t\t\ttype: 'get',\n\t\t\turl: 'index.php',\n\t\t\tdata: 'type={$this->conf['ajaxTypeNum']}&tx_feuserfriends_pi1[sendmessage]='+uid,\n\t\t\tsuccess: function(html, status) {\n\t\t\t\tjQuery('body').append('<div id=\"dialog\">'+html+'</div>');\n\t\t\t\tjQuery('#dialog').dialog({\n\t\t\t\t\tbuttons: {\n\t\t\t\t\t\t'" . t3lib_div::slashJS($this->pi_getLL('ok')) . "': function() {\n\t\t\t\t\t\t\tjQuery.ajax({\n\t\t\t\t\t\t\t\ttype: 'get',\n\t\t\t\t\t\t\t\turl: 'index.php',\n\t\t\t\t\t\t\t\tdata: 'type={$this->conf['ajaxTypeNum']}&tx_feuserfriends_pi1[sendmessage]='+uid+'&tx_feuserfriends_pi1[send]=1'+'&'+jQuery('textarea[name=\"tx_feuserfriends_pi1[message]\"]').serialize(),\n\t\t\t\t\t\t\t\tsuccess: function(html, status) {\n\t\t\t\t\t\t\t\t\tif ('{$this->conf['messageTagID']}' == '') {\n\t\t\t\t\t\t\t\t\t\talert(html);\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\tjQuery('#" . $this->conf['messageTagID'] . "').html(html);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tjQuery(this).dialog('close');\n\t\t\t\t\t\t},\n\t\t\t\t\t\t'" . t3lib_div::slashJS($this->pi_getLL('cancel')) . "': function() {\n\t\t\t\t\t\t\tjQuery(this).dialog('close');\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\ttitle: '" . t3lib_div::slashJS($this->pi_getLL('friends_add_title')) . "'\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\t}\n};");
}
示例13: debug_typo3PrintError
/**
* This prints out a TYPO3 error message.
*
* @param string Header string
* @param string Message string
* @param boolean If set, then this will produce a alert() line for inclusion in JavaScript.
* @param string URL for the <base> tag (if you want it)
* @return string
* @deprecated since TYPO3 4.5, will be removed in TYPO3 4.7 - use RuntimeException from now on
*/
public function debug_typo3PrintError($header, $text, $js, $baseUrl = '')
{
if ($js) {
$errorMessage = 'alert(\'' . t3lib_div::slashJS($header . '\\n' . $text) . '\');';
} else {
t3lib_div::logDeprecatedFunction();
$messageObj = t3lib_div::makeInstance('t3lib_message_ErrorPageMessage', $text, $header);
$errorMessage = $messageObj->render();
}
// Hook to modify error message
if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_timetrack.php']['debug_typo3PrintError'])) {
$params = array('header' => $header, 'text' => $text, 'js' => $js, 'baseUrl' => $baseUrl, 'errorMessage' => &$errorMessage);
$null = NULL;
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_timetrack.php']['debug_typo3PrintError'] as $hookMethod) {
t3lib_div::callUserFunction($hookMethod, $params, $null);
}
}
echo $errorMessage;
}
示例14: typo3PrintError
/**
* Print error message with header, text etc.
* Usage: 19
*
* @param string Header string
* @param string Content string
* @param boolean Will return an alert() with the content of header and text.
* @param boolean Print header.
* @return void
*/
public static function typo3PrintError($header, $text, $js = '', $head = 1)
{
// This prints out a TYPO3 error message.
// If $js is set the message will be output in JavaScript
if ($js) {
echo "alert('" . t3lib_div::slashJS($header . '\\n' . $text) . "');";
} else {
echo $head ? '<html>
<head>
<title>Error!</title>
</head>
<body bgcolor="white" topmargin="0" leftmargin="0" marginwidth="0" marginheight="0">' : '';
echo '<div align="center">
<table border="0" cellspacing="0" cellpadding="0" width="333">
<tr>
<td align="center">' . ($GLOBALS['TBE_STYLES']['logo_login'] ? '<img src="' . $GLOBALS['BACK_PATH'] . $GLOBALS['TBE_STYLES']['logo_login'] . '" alt="" />' : '<img src="' . $GLOBALS['BACK_PATH'] . 'gfx/typo3logo.gif" width="123" height="34" vspace="10" />') . '</td>
</tr>
<tr>
<td bgcolor="black">
<table width="100%" border="0" cellspacing="1" cellpadding="10">
<tr>
<td bgcolor="#F4F0E8">
<font face="verdana,arial,helvetica" size="2">';
echo '<strong><center><font size="+1">' . $header . '</font></center></strong><br />' . $text;
echo ' </font>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>';
echo $head ? '
</body>
</html>' : '';
}
}
示例15: getExtSlider
public function getExtSlider($PA, &$fObj)
{
$checkboxCode = NULL;
// Define the unique vars
$id_slider = uniqid('tceforms-slider-');
$id_checkbox = uniqid('tceforms-check-');
$var = uniqid('slider_');
// The config from TCA-Field
$conf = $PA['fieldConf']['config'];
// Label
$label = $conf['label'];
// define the options
if (is_numeric($conf['width'])) {
$option[] = "width: {$conf['width']}";
}
$lower = 0;
if (is_numeric($conf['range']['lower'])) {
$lower = $conf['range']['lower'];
$option[] = "minValue: {$lower}";
}
if (is_numeric($conf['range']['upper'])) {
$option[] = "maxValue: {$conf['range']['upper']}";
}
if (is_numeric($conf['decimalPrecision'])) {
$option[] = "decimalPrecision: {$conf['decimalPrecision']}";
}
//
$default = is_numeric($conf['default']) ? $conf['default'] : $lower;
$value = is_numeric($PA['itemFormElValue']) ? $PA['itemFormElValue'] : $default;
$option[] = "value: " . $value;
$emptyValue = $conf['emptyValue'] ? $conf['emptyValue'] : '0';
if (!is_numeric($PA['itemFormElValue']) && $emptyValue) {
$disabled = TRUE;
} else {
$disabled = FALSE;
}
$option[] = "disabled: " . ($disabled ? 'true' : 'false');
$option[] = "renderTo: '{$id_slider}-outer'";
// Language vars
$from_ts = $GLOBALS['LANG']->sL('LLL:EXT:jftcaforms/locallang_db.xml:tt_content.pi_flexform.from_ts');
if (!$from_ts) {
$from_ts = 'From TS';
}
// get the pagerenderer
$pagerender = $GLOBALS['TBE_TEMPLATE']->getPageRenderer();
// Fix slider in hidden tabPanel
$pagerender->addExtOnReadyCode("\n\t\tExt.override(Ext.Slider, {\n\t\t\tgetRatio: function() {\n\t\t\t\tvar w = this.innerEl.getComputedWidth();\n\t\t\t\tvar v = this.maxValue - this.minValue;\n\t\t\t\treturn (v == 0 ? w : (w/v));\n\t\t\t}\n\t\t});", TRUE);
// Add the slider
$pagerender->addExtOnReadyCode("\n\t\tvar {$var} = new Ext.Slider({\n\t\t\t" . implode(",\n\t", $option) . "\n\t\t});\n\t\t{$var}.on('change', function(slider, newValue) {\n\t\t\tExt.get('{$id_slider}').set({value: newValue});\n\t\t\tExt.get('{$id_slider}-num').update(newValue ? newValue : '0');\n\t\t});");
// The code for the checkbox will only be rendered, when emptyValue is set
if ($emptyValue) {
$pagerender->addExtOnReadyCode("\n\t\t\tExt.get('{$id_checkbox}').on('click', function(obj1, obj2) {\n\t\t\t\tif (obj2.checked) {\n\t\t\t\t\tExt.get('{$id_slider}').set({value: ''});\n\t\t\t\t\tExt.get('{$id_slider}-num').update('" . t3lib_div::slashJS($from_ts) . "');\n\t\t\t\t\t{$var}.disable();\n\t\t\t\t} else {\n\t\t\t\t\t{$var}.enable();\n\t\t\t\t\tvar newValue = {$var}.getValue();\n\t\t\t\t\tExt.get('{$id_slider}').set({value: newValue});\n\t\t\t\t\tExt.get('{$id_slider}-num').update(newValue ? newValue : '{$lower}');\n\t\t\t\t}\n\t\t\t});");
$checkboxCode = '<input type="checkbox" class="checkbox" id="' . $id_checkbox . '" name="' . $PA['itemFormElName'] . '_cb" style="float:left;"' . ($disabled ? ' checked="checked"' : '') . '>';
}
return '' . '<input type="hidden" name="' . $PA['itemFormElName'] . '" value="' . ($disabled ? '' : $value) . '" id="' . $id_slider . '"/>' . $checkboxCode . '<div id="' . $id_slider . '-num">' . ($disabled ? $from_ts : $value) . '</div>' . '<div id="' . $id_slider . '-outer"></div>';
}