本文整理汇总了PHP中TYPO3\CMS\Backend\Utility\BackendUtility::getAjaxUrl方法的典型用法代码示例。如果您正苦于以下问题:PHP BackendUtility::getAjaxUrl方法的具体用法?PHP BackendUtility::getAjaxUrl怎么用?PHP BackendUtility::getAjaxUrl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\CMS\Backend\Utility\BackendUtility
的用法示例。
在下文中一共展示了BackendUtility::getAjaxUrl方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render
/**
* Handler for unknown types.
*
* @return array As defined in initializeResultArray() of AbstractNode
*/
public function render()
{
$resultArray = $this->initializeResultArray();
$languageService = $this->getLanguageService();
$row = $this->data['databaseRow'];
$parameterArray = $this->data['parameterArray'];
// If ratios are set do not add default options
if (isset($parameterArray['fieldConf']['config']['ratios'])) {
unset($this->defaultConfig['ratios']);
}
$config = ArrayUtility::arrayMergeRecursiveOverrule($this->defaultConfig, $parameterArray['fieldConf']['config']);
// By default we allow all image extensions that can be handled by the GFX functionality
if ($config['allowedExtensions'] === null) {
$config['allowedExtensions'] = $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'];
}
if ($config['readOnly']) {
$options = array();
$options['parameterArray'] = array('fieldConf' => array('config' => $config), 'itemFormElValue' => $parameterArray['itemFormElValue']);
$options['renderType'] = 'none';
return $this->nodeFactory->create($options)->render();
}
$file = $this->getFile($row, $config['file_field']);
if (!$file) {
return $resultArray;
}
$content = '';
$preview = '';
if (GeneralUtility::inList(mb_strtolower($config['allowedExtensions']), mb_strtolower($file->getExtension()))) {
// Get preview
$preview = $this->getPreview($file, $parameterArray['itemFormElValue']);
// Check if ratio labels hold translation strings
foreach ((array) $config['ratios'] as $ratio => $label) {
$config['ratios'][$ratio] = $languageService->sL($label, true);
}
$formFieldId = StringUtility::getUniqueId('formengine-image-manipulation-');
$wizardData = array('zoom' => $config['enableZoom'] ? '1' : '0', 'ratios' => json_encode($config['ratios']), 'file' => $file->getUid());
$wizardData['token'] = GeneralUtility::hmac(implode('|', $wizardData), 'ImageManipulationWizard');
$buttonAttributes = array('data-url' => BackendUtility::getAjaxUrl('wizard_image_manipulation', $wizardData), 'data-severity' => 'notice', 'data-image-name' => $file->getNameWithoutExtension(), 'data-image-uid' => $file->getUid(), 'data-file-field' => $config['file_field'], 'data-field' => $formFieldId);
$button = '<button class="btn btn-default t3js-image-manipulation-trigger"';
foreach ($buttonAttributes as $key => $value) {
$button .= ' ' . $key . '="' . htmlspecialchars($value) . '"';
}
$button .= '><span class="t3-icon fa fa-crop"></span>';
$button .= $languageService->sL('LLL:EXT:lang/locallang_wizards.xlf:imwizard.open-editor', true);
$button .= '</button>';
$inputField = '<input type="hidden" ' . 'id="' . $formFieldId . '" ' . 'name="' . $parameterArray['itemFormElName'] . '" ' . 'value="' . htmlspecialchars($parameterArray['itemFormElValue']) . '" />';
$content .= $inputField . $button;
$content .= $this->getImageManipulationInfoTable($parameterArray['itemFormElValue']);
$resultArray['requireJsModules'][] = array('TYPO3/CMS/Backend/ImageManipulation' => 'function(ImageManipulation){ImageManipulation.initializeTrigger()}');
}
$content .= '<p class="text-muted"><em>' . $languageService->sL('LLL:EXT:lang/locallang_wizards.xlf:imwizard.supported-types-message', true) . '<br />';
$content .= mb_strtoupper(implode(', ', GeneralUtility::trimExplode(',', $config['allowedExtensions'])));
$content .= '</em></p>';
$item = '<div class="media">';
$item .= $preview;
$item .= '<div class="media-body">' . $content . '</div>';
$item .= '</div>';
$resultArray['html'] = $item;
return $resultArray;
}
示例2: manipulateCacheActions
/**
* Modifies CacheMenuItems array
*
* @param array $cacheActions
* @param array $optionValues
*
* @return void
*/
public function manipulateCacheActions(&$cacheActions, &$optionValues)
{
if ($this->isProduction() || !$this->isAdmin()) {
return;
}
$cacheActions[] = ['id' => 'autoloader', 'title' => 'EXT:autoloader caches', 'href' => BackendUtility::getAjaxUrl('autoloader::clearCache'), 'icon' => '<img src="' . IconUtility::getByExtensionKey('autoloader') . '">'];
}
示例3: buildJavascriptConfiguration
/**
* Return JS configuration of the htmlArea plugins registered by the extension
*
* @param integer Relative id of the RTE editing area in the form
* @return string JS configuration for registered plugins
*/
public function buildJavascriptConfiguration($RTEcounter)
{
$button = 'spellcheck';
// Set the SpellChecker mode
$spellCheckerMode = isset($GLOBALS['BE_USER']->userTS['options.']['HTMLAreaPspellMode']) ? trim($GLOBALS['BE_USER']->userTS['options.']['HTMLAreaPspellMode']) : 'normal';
if (!in_array($spellCheckerMode, $this->spellCheckerModes)) {
$spellCheckerMode = 'normal';
}
// Set the use of personal dictionary
$enablePersonalDicts = $this->thisConfig['buttons.'][$button . '.']['enablePersonalDictionaries'] ? isset($GLOBALS['BE_USER']->userTS['options.']['enablePersonalDicts']) && $GLOBALS['BE_USER']->userTS['options.']['enablePersonalDicts'] ? TRUE : FALSE : FALSE;
if ($this->htmlAreaRTE->is_FE()) {
$enablePersonalDicts = FALSE;
}
$registerRTEinJavascriptString = '';
if (in_array($button, $this->toolbar)) {
if (!is_array($this->thisConfig['buttons.']) || !is_array($this->thisConfig['buttons.'][$button . '.'])) {
$registerRTEinJavascriptString .= '
RTEarea[' . $RTEcounter . '].buttons.' . $button . ' = new Object();';
}
$registerRTEinJavascriptString .= '
RTEarea[' . $RTEcounter . '].buttons.' . $button . '.contentTypo3Language = "' . $this->htmlAreaRTE->contentTypo3Language . '";
RTEarea[' . $RTEcounter . '].buttons.' . $button . '.contentISOLanguage = "' . $this->htmlAreaRTE->contentISOLanguage . '";
RTEarea[' . $RTEcounter . '].buttons.' . $button . '.contentCharset = "' . $this->htmlAreaRTE->contentCharset . '";
RTEarea[' . $RTEcounter . '].buttons.' . $button . '.spellCheckerMode = "' . $spellCheckerMode . '";
RTEarea[' . $RTEcounter . '].buttons.' . $button . '.enablePersonalDicts = ' . ($enablePersonalDicts ? 'true' : 'false') . ';';
$registerRTEinJavascriptString .= '
RTEarea[' . $RTEcounter . '].buttons.' . $button . '.path = "' . ($this->htmlAreaRTE->is_FE() || $this->htmlAreaRTE->isFrontendEditActive() ? ($GLOBALS['TSFE']->absRefPrefix ? $GLOBALS['TSFE']->absRefPrefix : '') . 'index.php?eID=rtehtmlarea_spellchecker' : $this->htmlAreaRTE->backPath . BackendUtility::getAjaxUrl('rtehtmlarea::spellchecker')) . '";';
}
return $registerRTEinJavascriptString;
}
示例4: generatePublicUrl
/**
* Generate public url for file
*
* @param Resource\ResourceStorage $storage
* @param Resource\Driver\DriverInterface $driver
* @param Resource\FileInterface $file
* @param $relativeToCurrentScript
* @param array $urlData
* @return void
*/
public function generatePublicUrl(Resource\ResourceStorage $storage, Resource\Driver\DriverInterface $driver, Resource\FileInterface $file, $relativeToCurrentScript, array $urlData)
{
// We only render special links for non-public files
if ($this->enabled && !$storage->isPublic()) {
$queryParameterArray = array('eID' => 'dumpFile', 't' => '');
if ($file instanceof Resource\File) {
$queryParameterArray['f'] = $file->getUid();
$queryParameterArray['t'] = 'f';
} elseif ($file instanceof Resource\ProcessedFile) {
$queryParameterArray['p'] = $file->getUid();
$queryParameterArray['t'] = 'p';
}
$queryParameterArray['token'] = GeneralUtility::hmac(implode('|', $queryParameterArray), 'BeResourceStorageDumpFile');
// $urlData['publicUrl'] is passed by reference, so we can change that here and the value will be taken into account
$urlData['publicUrl'] = BackendUtility::getAjaxUrl('FalSecuredownload::publicUrl', $queryParameterArray);
}
}
示例5: buildJavascriptConfiguration
/**
* Return JS configuration of the htmlArea plugins registered by the extension
*
* @return string JS configuration for registered plugins
*/
public function buildJavascriptConfiguration()
{
$jsArray = array();
$button = 'spellcheck';
// Set the SpellChecker mode
$spellCheckerMode = isset($GLOBALS['BE_USER']->userTS['options.']['HTMLAreaPspellMode']) ? trim($GLOBALS['BE_USER']->userTS['options.']['HTMLAreaPspellMode']) : 'normal';
if (!in_array($spellCheckerMode, $this->spellCheckerModes)) {
$spellCheckerMode = 'normal';
}
// Set the use of personal dictionary
$enablePersonalDicts = $this->configuration['thisConfig']['buttons.'][$button . '.']['enablePersonalDictionaries'] && !empty($GLOBALS['BE_USER']->userTS['options.']['enablePersonalDicts']);
if (in_array($button, $this->toolbar)) {
if (!is_array($this->configuration['thisConfig']['buttons.']) || !is_array($this->configuration['thisConfig']['buttons.'][$button . '.'])) {
$jsArray[] = 'RTEarea[editornumber].buttons.' . $button . ' = new Object();';
}
$jsArray[] = 'RTEarea[editornumber].buttons.' . $button . '.contentTypo3Language = "' . $this->configuration['contentTypo3Language'] . '";';
$jsArray[] = 'RTEarea[editornumber].buttons.' . $button . '.contentISOLanguage = "' . $this->configuration['contentISOLanguage'] . '";';
$jsArray[] = 'RTEarea[editornumber].buttons.' . $button . '.spellCheckerMode = "' . $spellCheckerMode . '";';
$jsArray[] = 'RTEarea[editornumber].buttons.' . $button . '.enablePersonalDicts = ' . ($enablePersonalDicts ? 'true' : 'false') . ';';
$jsArray[] = 'RTEarea[editornumber].buttons.' . $button . '.path = "' . ($this->isFrontend() || $this->isFrontendEditActive() ? ($GLOBALS['TSFE']->absRefPrefix ? $GLOBALS['TSFE']->absRefPrefix : '') . 'index.php?eID=rtehtmlarea_spellchecker' : BackendUtility::getAjaxUrl('rtehtmlarea::spellchecker')) . '";';
}
return implode(LF, $jsArray);
}
示例6: addAjaxUrlsToInlineSettings
/**
* Make URLs to all backend ajax handlers available as inline setting.
*/
protected function addAjaxUrlsToInlineSettings()
{
$ajaxUrls = array();
foreach (array_keys($GLOBALS['TYPO3_CONF_VARS']['BE']['AJAX']) as $ajaxHandler) {
$ajaxUrls[$ajaxHandler] = BackendUtility::getAjaxUrl($ajaxHandler);
}
$this->inlineSettings['ajaxUrls'] = $ajaxUrls;
}
示例7: manipulateCacheActions
/**
* Adds a menu entry to the clear cache menu to detect Solr connections.
*
* @param array $cacheActions Array of CacheMenuItems
* @param array $optionValues Array of AccessConfigurations-identifiers (typically used by userTS with options.clearCache.identifier)
*/
public function manipulateCacheActions(&$cacheActions, &$optionValues)
{
if ($GLOBALS['BE_USER']->isAdmin()) {
$title = 'Initialize Solr connections';
$cacheActions[] = array('id' => 'clearSolrConnectionCache', 'title' => $title, 'href' => BackendUtility::getAjaxUrl('solr::clearSolrConnectionCache'), 'icon' => IconUtility::getSpriteIcon('extensions-solr-InitSolrConnections'));
$optionValues[] = 'clearSolrConnectionCache';
}
}
示例8: manipulateCacheActions
/**
* Adds a menu entry to the clear cache menu to detect Solr connections.
*
* @param array $cacheActions Array of CacheMenuItems
* @param array $optionValues Array of AccessConfigurations-identifiers (typically used by userTS with options.clearCache.identifier)
*/
public function manipulateCacheActions(&$cacheActions, &$optionValues)
{
if ($GLOBALS['BE_USER']->isAdmin()) {
$title = 'Initialize Solr connections';
$iconFactory = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Imaging\\IconFactory');
$cacheActions[] = array('id' => 'clearSolrConnectionCache', 'title' => $title, 'href' => BackendUtility::getAjaxUrl('solr::clearSolrConnectionCache'), 'icon' => $iconFactory->getIcon('extensions-solr-module-initsolrconnections', Icon::SIZE_SMALL));
$optionValues[] = 'clearSolrConnectionCache';
}
}
示例9: getRoutingUrl
/**
* Returns the convenient path for the routing Urls based on the TYPO3 mode.
*
* @param string $namespace
* @return string
*/
public function getRoutingUrl($namespace)
{
if (TYPO3_MODE === 'FE') {
$url = GeneralUtility::locationHeaderUrl('?eID=ExtDirect&action=route&namespace=' . rawurlencode($namespace));
} else {
$url = BackendUtility::getAjaxUrl('ext_direct_route', array('namespace' => $namespace));
}
return $url;
}
示例10: manipulateCacheActions
/**
* Add new cache menu option.
*
* @param array $cacheActions
* @param array $optionValues
* @return void
*/
public function manipulateCacheActions(&$cacheActions, &$optionValues)
{
$cacheActions[] = array('id' => 'tev_cache_url', 'title' => 'Flush RealURL config', 'href' => BackendUtility::getAjaxUrl('TevTevAjax::clearRealurlConfig'), 'icon' => IconUtility::getSpriteIcon('actions-system-cache-clear-impact-low'));
$optionValues[] = 'clearCacheTevUrl';
}