本文整理汇总了PHP中TYPO3\CMS\Core\Utility\GeneralUtility::compat_version方法的典型用法代码示例。如果您正苦于以下问题:PHP GeneralUtility::compat_version方法的具体用法?PHP GeneralUtility::compat_version怎么用?PHP GeneralUtility::compat_version使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\CMS\Core\Utility\GeneralUtility
的用法示例。
在下文中一共展示了GeneralUtility::compat_version方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: renderForeignRecordHeaderControl_postProcess
/**
* Post-processing to define which control items to show. Possibly own icons can be added here.
*
* @param string $parentUid The uid of the parent (embedding) record (uid or NEW...)
* @param string $foreignTable The table (foreign_table) we create control-icons for
* @param array $childRecord The current record of that foreign_table
* @param array $childConfig TCA configuration of the current field of the child record
* @param boolean $isVirtual Defines whether the current records is only virtually shown and not physically part of the parent record
* @param array $controlItems (reference) Associative array with the currently available control items
*
* @return void
*/
public function renderForeignRecordHeaderControl_postProcess($parentUid, $foreignTable, array $childRecord, array $childConfig, $isVirtual, array &$controlItems)
{
if ($foreignTable != 'sys_file_reference') {
return;
}
if (!GeneralUtility::isFirstPartOfStr($childRecord['uid_local'], 'sys_file_')) {
return;
}
$parts = BackendUtility::splitTable_Uid($childRecord['uid_local']);
if (!isset($parts[1])) {
return;
}
$table = $childRecord['tablenames'];
$uid = $parentUid;
$arguments = GeneralUtility::_GET();
if ($this->isValidRecord($table, $uid) && isset($arguments['edit'])) {
$returnUrl = ['edit' => $arguments['edit'], 'returnUrl' => $arguments['returnUrl']];
if (GeneralUtility::compat_version('7.0')) {
$returnUrlGenerated = BackendUtility::getModuleUrl('record_edit', $returnUrl);
} else {
$returnUrlGenerated = 'alt_doc.php?' . ltrim(GeneralUtility::implodeArrayForUrl('', $returnUrl, '', true, true), '&') . BackendUtility::getUrlToken('editRecord');
}
$wizardArguments = ['P' => ['referenceUid' => $childRecord['uid'], 'returnUrl' => $returnUrlGenerated]];
$wizardUri = BackendUtility::getModuleUrl('focuspoint', $wizardArguments);
} else {
$wizardUri = 'javascript:alert(\'Please save the base record first, because open this wizard will not save the changes in the current form!\');';
}
/** @var WizardService $wizardService */
$wizardService = GeneralUtility::makeInstance('HDNET\\Focuspoint\\Service\\WizardService');
$this->arrayUnshiftAssoc($controlItems, 'focuspoint', $wizardService->getWizardButton($wizardUri));
}
示例2: getTca
/**
* Get TCA information
*
* @param string $tableName
*
* @return array
*/
public function getTca($tableName)
{
$tca = ['ctrl' => ['languageField' => 'sys_language_uid', 'transOrigPointerField' => 'l10n_parent', 'transOrigDiffSourceField' => 'l10n_diffsource'], 'columns' => ['sys_language_uid' => ['exclude' => 1, 'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.language', 'config' => ['type' => 'select', 'renderType' => 'selectSingle', 'default' => '0', 'special' => 'languages', 'items' => [['LLL:EXT:lang/locallang_general.xml:LGL.allLanguages', -1, 'flags-multiple']]]], 'l10n_parent' => ['displayCond' => 'FIELD:sys_language_uid:>:0', 'exclude' => 1, 'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.l18n_parent', 'config' => ['type' => 'select', 'renderType' => 'selectSingle', 'items' => [['', 0]], 'foreign_table' => $tableName, 'foreign_table_where' => 'AND ' . $tableName . '.pid=###CURRENT_PID### AND ' . $tableName . '.sys_language_uid IN (-1,0)', 'foreign_table_loadIcons' => false, 'noIconsBelowSelect' => true]], 'l10n_diffsource' => ['config' => ['type' => 'passthrough']]], 'palettes' => ['language' => ['showitem' => 'sys_language_uid, l10n_parent, l10n_diffsource']]];
if (!GeneralUtility::compat_version('7.0')) {
$tca['columns']['l10n_parent']['config']['iconsInOptionTags'] = false;
}
return $tca;
}
示例3: getWizardIcon
/**
* Get the wizard icon
*
* @return string
*/
protected function getWizardIcon()
{
if (GeneralUtility::compat_version('7.6')) {
/** @var \TYPO3\CMS\Core\Imaging\IconFactory $iconFactory */
$iconFactory = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Imaging\\IconFactory');
$icon = $iconFactory->getIcon('tcarecords-tx_focuspoint_domain_model_filestandalone-default', Icon::SIZE_SMALL, null);
return $icon->render();
}
return IconUtility::getSpriteIcon('extensions-focuspoint-focuspoint');
}
示例4: render
/**
* Render a edit link for the backend preview
*
* @param array $data Row of the content element
*
* @return string
*/
public function render(array $data)
{
$urlParameter = ['edit[tt_content][' . $data['uid'] . ']' => 'edit', 'returnUrl' => GeneralUtility::getIndpEnv('TYPO3_REQUEST_URL')];
if (GeneralUtility::compat_version('7.0')) {
$url = BackendUtility::getModuleUrl('record_edit', $urlParameter);
} else {
$url = $GLOBALS['BACK_PATH'] . 'alt_doc.php?' . http_build_query($urlParameter);
}
return '<a href="' . $url . '">' . $this->renderChildren() . '</a>';
}
示例5: render
/**
* Uses GeneralUtility::compat_version to return a classname which can be used in backend views
*
* @todo: Remove condition, when TYPO3 6.2 is deprecated
*
* @return string
*/
public function render()
{
if (GeneralUtility::compat_version('7.6')) {
return 'typo3-76';
} elseif (GeneralUtility::compat_version('6.2')) {
return 'typo3-62';
} else {
return '';
}
}
示例6: render
/**
* Returns a URL to link to FormEngine
*
* @param string $parameters Is a set of GET params to send to FormEngine
* @return string URL to FormEngine module + parameters
* @see \TYPO3\CMS\Backend\Utility\BackendUtility::getModuleUrl()
*/
public function render($parameters)
{
// Make sure record_edit module is available
if (GeneralUtility::compat_version('7.0')) {
$parameters = GeneralUtility::explodeUrl2Array($parameters);
return BackendUtility::getModuleUrl('record_edit', $parameters);
} else {
return 'alt_doc.php?' . $parameters;
}
}
示例7: render
/**
* Resize the image (if required) and returns its path. If the image was not changed, the path will be equal to $src
*
* @see http://typo3.org/documentation/document-library/references/doc_core_tsref/4.2.0/view/1/5/#id4164427
*
* @param string $src
* @param FileInterface|AbstractFileFolder $image
* @param string $width width of the image. This can be a numeric value representing the fixed width of the image in pixels. But you can also perform simple calculations by adding "m" or "c" to the value. See imgResource.width for possible options.
* @param string $height height of the image. This can be a numeric value representing the fixed height of the image in pixels. But you can also perform simple calculations by adding "m" or "c" to the value. See imgResource.width for possible options.
* @param integer $minWidth minimum width of the image
* @param integer $minHeight minimum height of the image
* @param integer $maxWidth maximum width of the image
* @param integer $maxHeight maximum height of the image
* @param boolean $treatIdAsReference given src argument is a sys_file_reference record
* @param string $ratio
*
* @throws \TYPO3\CMS\Fluid\Core\ViewHelper\Exception
* @return string path to the image
*/
public function render($src = null, $image = null, $width = null, $height = null, $minWidth = null, $minHeight = null, $maxWidth = null, $maxHeight = null, $treatIdAsReference = false, $ratio = '1:1')
{
if (GeneralUtility::compat_version('7.0')) {
return self::renderStatic(['src' => $src, 'image' => $image, 'width' => $width, 'height' => $height, 'minWidth' => $minWidth, 'minHeight' => $minHeight, 'maxWidth' => $maxWidth, 'maxHeight' => $maxHeight, 'treatIdAsReference' => $treatIdAsReference, 'crop' => null, 'ratio' => $ratio], $this->buildRenderChildrenClosure(), $this->renderingContext);
}
/** @var \HDNET\Focuspoint\Service\FocusCropService $service */
$service = GeneralUtility::makeInstance('HDNET\\Focuspoint\\Service\\FocusCropService');
$src = $service->getCroppedImageSrcForViewHelper($src, $image, $treatIdAsReference, $ratio);
return parent::render($src, null, $width, $height, $minWidth, $minHeight, $maxWidth, $maxHeight, false);
}
示例8: proc
/**
* Processing the wizard items array
*
* @param array $wizardItems : The wizard items
*
* @return array Modified array with wizard items
*/
function proc($wizardItems)
{
$LL = $this->includeLocalLang();
$icon = 'EXT:html5videoplayer/Resources/Public/Icons/Wizicon.gif';
if (!GeneralUtility::compat_version('7.0')) {
$icon = ExtensionManagementUtility::extRelPath('html5videoplayer') . '/Resources/Public/Icons/Wizicon.gif';
}
$wizardItems['plugins_tx_html5videoplayer_pi1'] = array('icon' => $icon, 'title' => $this->getLanguage()->getLLL('list_title', $LL), 'description' => $this->getLanguage()->getLLL('list_plus_wiz_description', $LL), 'params' => '&defVals[tt_content][CType]=list&defVals[tt_content][list_type]=html5videoplayer_pivideoplayer');
return $wizardItems;
}
示例9: viewHelperThrowsExceptionIfFileNotFoundFor
/**
* Test if exception handling works
* Using expectedException does not work supporting 7 + 8.
*
* @test
* @return void
*/
public function viewHelperThrowsExceptionIfFileNotFoundFor()
{
try {
$viewHelper = new FileSizeViewHelper();
$viewHelper->render('fo', 'bar');
} catch (\Exception $e) {
$expectedException = GeneralUtility::compat_version('8.0.0') ? 'TYPO3Fluid\\Fluid\\Core\\Exception' : 'TYPO3\\CMS\\Fluid\\Core\\ViewHelper\\Exception\\InvalidVariableException';
$this->assertEquals($expectedException, get_class($e));
}
}
示例10: user_templateLayout
/**
* Itemsproc function to extend the selection of templateLayouts in the plugin
*
* @todo: Remove condition when TYPO3 6.2 is deprecated
*
* @param array $config Configuration array
*
* @return void
*/
public function user_templateLayout(array &$config)
{
if (GeneralUtility::compat_version('7.6')) {
$templateLayouts = $this->getTemplateLayoutsFromTsConfig($config['flexParentDatabaseRow']['pid']);
} else {
$templateLayouts = $this->getTemplateLayoutsFromTsConfig($config['row']['pid']);
}
foreach ($templateLayouts as $index => $layout) {
$additionalLayout = [$GLOBALS['LANG']->sL($layout, true), $index];
array_push($config['items'], $additionalLayout);
}
}
示例11: render
/**
* include inlineJs
*
* @param string $inlineJS
* @param int $currentCeUid
* @return void
*/
public function render($inlineJS, $currentRow)
{
$block = 'jQuery(function(){' . $inlineJS . '});';
$name = 't3sbootstrap-thumbnailrow-' . $currentRow;
if (\TYPO3\CMS\Core\Utility\GeneralUtility::compat_version('7.4')) {
/* @var $pageRenderer \TYPO3\CMS\Core\Page\PageRenderer */
$pageRenderer = $this->objectManager->get('TYPO3\\CMS\\Core\\Page\\PageRenderer');
$pageRenderer->addJsFooterInlineCode($name, $block);
} else {
$GLOBALS['TSFE']->getPageRenderer()->addJsFooterInlineCode($name, $block);
}
}
示例12: clear
/**
* clear Cache ajax handler
*
* @param array $ajaxParams
* @param AjaxRequestHandler $ajaxObj
*/
public function clear($ajaxParams, AjaxRequestHandler $ajaxObj)
{
if ($this->isProduction() || !$this->isAdmin()) {
return;
}
/** @var \TYPO3\CMS\Core\Cache\CacheManager $cacheManager */
$cacheManager = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Cache\\CacheManager');
$cacheManager->getCache('autoloader')->flush();
// Dump new class loading information
if (GeneralUtility::compat_version('7.0') && !\TYPO3\CMS\Core\Core\Bootstrap::usesComposerClassLoading()) {
ClassLoadingInformation::dumpClassLoadingInformation();
}
}
示例13: render
/**
* Renders a edit link for the given Event UID
*
* @todo: Remove condition, when TYPO3 6.2 is deprecated
*
* @param int $uid
* @return string
*/
public function render($uid)
{
$pid = (int) GeneralUtility::_GET('id');
if (GeneralUtility::compat_version('7.6')) {
$parameters = ['edit[tx_sfeventmgt_domain_model_event][' . (int) $uid . ']' => 'edit'];
$parameters['returnUrl'] = 'index.php?M=web_SfEventMgtTxSfeventmgtM1&id=' . $pid . $this->getModuleToken();
$url = BackendUtility::getModuleUrl('record_edit', $parameters);
} else {
$returnUrl = 'mod.php?M=web_SfEventMgtTxSfeventmgtM1&id=' . $pid . $this->getModuleToken();
$url = 'alt_doc.php?edit[tx_sfeventmgt_domain_model_event][' . (int) $uid . ']=edit&returnUrl=' . urlencode($returnUrl);
}
return $url;
}
示例14: render
/**
* Returns a URL to link to quick command
*
* @param string $parameters Is a set of GET params to send to FormEngine
* @return string URL to FormEngine module + parameters
*/
public function render($parameters)
{
$parameters = GeneralUtility::explodeUrl2Array($parameters);
$parameters['vC'] = $this->getBackendUserAuthentication()->veriCode();
$parameters['prErr'] = 1;
$parameters['uPT'] = 1;
// Make sure record_edit module is available
if (GeneralUtility::compat_version('7.0')) {
$url = BackendUtility::getModuleUrl('tce_db', $parameters);
} else {
$url = 'tce_db.php?' . GeneralUtility::implodeArrayForUrl('', $parameters);
}
return $url . BackendUtility::getUrlToken('tceAction');
}
示例15: preProcess
/**
* Preprocesses the preview rendering of a content element.
*
* @param PageLayoutView $parentObject Calling parent object
* @param bool $drawItem Whether to draw the item using the default functionalities
* @param string $headerContent Header content
* @param string $itemContent Item content
* @param array $row Record row of tt_content
*
* @return void
*/
public function preProcess(PageLayoutView &$parentObject, &$drawItem, &$headerContent, &$itemContent, array &$row)
{
if (!$this->isAutoloaderContenobject($row)) {
return;
}
if (!$this->hasBackendPreview($row)) {
return;
}
if (!GeneralUtility::compat_version('7.0') && !ExtensionManagementUtility::isLoaded('css_styled_content')) {
// @todo avoid exception in the backend of TYPO3 6.2. Check why the backend is broken
return;
}
$itemContent = $this->getBackendPreview($row);
$drawItem = false;
}