本文整理汇总了PHP中TYPO3\CMS\Core\Utility\VersionNumberUtility::convertVersionNumberToInteger方法的典型用法代码示例。如果您正苦于以下问题:PHP VersionNumberUtility::convertVersionNumberToInteger方法的具体用法?PHP VersionNumberUtility::convertVersionNumberToInteger怎么用?PHP VersionNumberUtility::convertVersionNumberToInteger使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\CMS\Core\Utility\VersionNumberUtility
的用法示例。
在下文中一共展示了VersionNumberUtility::convertVersionNumberToInteger方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: isVersionSuitable
/**
* Check if current TYPO3 version is suitable for the extension
*
* @param string $lowestVersion
* @param string $highestVersion
* @return bool
*/
protected static function isVersionSuitable($lowestVersion, $highestVersion)
{
$numericTypo3Version = VersionNumberUtility::convertVersionNumberToInteger(VersionNumberUtility::getNumericTypo3Version());
$numericLowestVersion = VersionNumberUtility::convertVersionNumberToInteger($lowestVersion);
$numericHighestVersion = VersionNumberUtility::convertVersionNumberToInteger($highestVersion);
return MathUtility::isIntegerInRange($numericTypo3Version, $numericLowestVersion, $numericHighestVersion);
}
示例2: getUpdateObjectInstance
/**
* Creates instance of an Update object
*
* @param string $className The class name
* @param string $identifier The identifier of Update object - needed to fetch user input
* @return AbstractUpdate Newly instantiated Update object
*/
protected function getUpdateObjectInstance($className, $identifier)
{
//$userInput = $this->postValues['values'][$identifier];
$userInput = NULL;
$versionAsInt = \TYPO3\CMS\Core\Utility\VersionNumberUtility::convertVersionNumberToInteger(TYPO3_version);
return \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance($className, $identifier, $versionAsInt, $userInput, $this);
}
示例3: migrateRecord
/**
* Processes the actual transformation from CSV to sys_file_references
*
* @param array $record
* @return void
*/
protected function migrateRecord(array $record)
{
$collections = array();
$files = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $record['image'], TRUE);
$descriptions = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode('
', $record['imagecaption']);
$titleText = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode('
', $record['imagetitletext']);
$i = 0;
foreach ($files as $file) {
if (file_exists(PATH_site . 'uploads/tx_cal/pics/' . $file)) {
\TYPO3\CMS\Core\Utility\GeneralUtility::upload_copy_move(PATH_site . 'uploads/tx_cal/pics/' . $file, $this->targetDirectory . $file);
$fileObject = $this->storage->getFile(self::FOLDER_ContentUploads . '/' . $file);
//TYPO3 >= 6.2.0
if (\TYPO3\CMS\Core\Utility\VersionNumberUtility::convertVersionNumberToInteger(TYPO3_version) >= 6002000) {
$this->fileIndexRepository->add($fileObject);
} else {
//TYPO3 6.1.0
$this->fileRepository->addToIndex($fileObject);
}
$dataArray = array('uid_local' => $fileObject->getUid(), 'tablenames' => $this->getRecordTableName(), 'uid_foreign' => $record['uid'], 'pid' => $record['pid'], 'fieldname' => 'image', 'sorting_foreign' => $i);
if (isset($descriptions[$i])) {
$dataArray['description'] = $descriptions[$i];
}
if (isset($titleText[$i])) {
$dataArray['alternative'] = $titleText[$i];
}
$GLOBALS['TYPO3_DB']->exec_INSERTquery('sys_file_reference', $dataArray);
unlink(PATH_site . 'uploads/tx_cal/pics/' . $file);
}
$i++;
}
$this->cleanRecord($record, $i, $collections);
}
示例4: init
/**
* Initialize all required repository and factory objects.
*
* @throws \RuntimeException
*/
protected function init()
{
$fileadminDirectory = rtrim($GLOBALS['TYPO3_CONF_VARS']['BE']['fileadminDir'], '/') . '/';
/** @var $storageRepository \TYPO3\CMS\Core\Resource\StorageRepository */
$storageRepository = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Resource\\StorageRepository');
$storages = $storageRepository->findAll();
foreach ($storages as $storage) {
$storageRecord = $storage->getStorageRecord();
$configuration = $storage->getConfiguration();
$isLocalDriver = $storageRecord['driver'] === 'Local';
$isOnFileadmin = !empty($configuration['basePath']) && \TYPO3\CMS\Core\Utility\GeneralUtility::isFirstPartOfStr($configuration['basePath'], $fileadminDirectory);
if ($isLocalDriver && $isOnFileadmin) {
$this->storage = $storage;
break;
}
}
if (!isset($this->storage)) {
throw new \RuntimeException('Local default storage could not be initialized - might be due to missing sys_file* tables.');
}
$this->fileFactory = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Resource\\ResourceFactory');
//TYPO3 >= 6.2.0
if (\TYPO3\CMS\Core\Utility\VersionNumberUtility::convertVersionNumberToInteger(TYPO3_version) >= 6002000) {
$this->fileIndexRepository = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Resource\\Index\\FileIndexRepository');
} else {
//TYPO3 = 6.1
$this->fileRepository = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Resource\\FileRepository');
}
$this->targetDirectory = PATH_site . $fileadminDirectory . self::FOLDER_ContentUploads . '/';
}
示例5: constructPostProcess
/**
* constructPostProcess
*
* @param array $config
* @param \TYPO3\CMS\Backend\Controller\BackendController $backendReference
*/
public function constructPostProcess($config, &$backendReference)
{
$lastPwChange = $GLOBALS['BE_USER']->user['tx_besecurepw_lastpwchange'];
$lastLogin = $GLOBALS['BE_USER']->user['lastlogin'];
// get configuration of a secure password
$extConf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['be_secure_pw']);
$validUntilConfiguration = trim($extConf['validUntil']);
$validUntil = 0;
if ($validUntilConfiguration != '') {
$validUntil = strtotime('- ' . $validUntilConfiguration);
}
if ($validUntilConfiguration != '' && ($lastPwChange == 0 || $lastPwChange < $validUntil) || $lastLogin == 0) {
// let the popup pop up :)
$generatedLabels = array('passwordReminderWindow_title' => $GLOBALS['LANG']->sL('LLL:EXT:be_secure_pw/Resources/Private/Language/locallang_reminder.xml:passwordReminderWindow_title'), 'passwordReminderWindow_message' => $GLOBALS['LANG']->sL('LLL:EXT:be_secure_pw/Resources/Private/Language/locallang_reminder.xml:passwordReminderWindow_message'), 'passwordReminderWindow_button_changePassword' => $GLOBALS['LANG']->sL('LLL:EXT:be_secure_pw/Resources/Private/Language/locallang_reminder.xml:passwordReminderWindow_button_changePassword'), 'passwordReminderWindow_button_postpone' => $GLOBALS['LANG']->sL('LLL:EXT:be_secure_pw/Resources/Private/Language/locallang_reminder.xml:passwordReminderWindow_button_postpone'));
// Convert labels/settings back to UTF-8 since json_encode() only works with UTF-8:
if ($GLOBALS['LANG']->charSet !== 'utf-8') {
$GLOBALS['LANG']->csConvObj->convArray($generatedLabels, $GLOBALS['LANG']->charSet, 'utf-8');
}
$labelsForJS = 'TYPO3.LLL.beSecurePw = ' . json_encode($generatedLabels) . ';';
$backendReference->addJavascript($labelsForJS);
$version7 = \TYPO3\CMS\Core\Utility\VersionNumberUtility::convertVersionNumberToInteger('7.0.0');
$currentVersion = \TYPO3\CMS\Core\Utility\VersionNumberUtility::convertVersionNumberToInteger(TYPO3_version);
if ($currentVersion < $version7) {
$javaScriptFile = 'passwordreminder.js';
} else {
$javaScriptFile = 'passwordreminder7.js';
}
$backendReference->addJavascriptFile($GLOBALS['BACK_PATH'] . '../' . ExtensionManagementUtility::siteRelPath('be_secure_pw') . 'Resources/Public/JavaScript/' . $javaScriptFile);
}
}
示例6: __construct
/**
* Initializes the install service
*/
public function __construct()
{
if (VersionNumberUtility::convertVersionNumberToInteger(TYPO3_version) >= 7000000) {
$this->messageQueueByIdentifier = 'extbase.flashmessages.tx_extensionmanager_tools_extensionmanagerextensionmanager';
} else {
$this->messageQueueByIdentifier = 'core.template.flashMessages';
}
}
示例7: addConfigToParams
/**
* @param array $params
* @return array
*/
protected function addConfigToParams(array $params)
{
if (VersionNumberUtility::convertVersionNumberToInteger(TYPO3_version) < 7000000) {
$params['config']['init']['emptyUrlReturnValue'] = GeneralUtility::getIndpEnv('TYPO3_SITE_URL');
}
$params['config']['preVars'] = array('0' => array('GETvar' => 'no_cache', 'valueMap' => array('nc' => '1'), 'noMatch' => 'bypass'), '1' => array('GETvar' => 'L', 'valueMap' => array('de' => '1', 'da' => '2'), 'noMatch' => 'bypass'));
$params['config']['postVarSets']['_DEFAULT']['page'] = array(0 => array('GETvar' => 'page'));
return $params;
}
示例8: includeLocalLang
public function includeLocalLang()
{
$llFile = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('cal') . 'Resources/Private/Language/locallang_plugin.xml';
if (\TYPO3\CMS\Core\Utility\VersionNumberUtility::convertVersionNumberToInteger(TYPO3_version) >= 4006000) {
$localizationParser = new \TYPO3\CMS\Core\Localization\Parser\LocallangXmlParser();
$LOCAL_LANG = $localizationParser->getParsedData($llFile, $GLOBALS['LANG']->lang);
} else {
$LOCAL_LANG = \TYPO3\CMS\Core\Utility\GeneralUtility::readLLfile($llFile, $GLOBALS['LANG']->lang);
}
return $LOCAL_LANG;
}
示例9: convertVersionNumberToInteger
/**
* Returns TRUE if the current TYPO3 version is compatible to the input version
* Notice that this function compares branches, not versions
* (4.0.1 would be > 4.0.0 although they use the same compat_version)
*
* @param string $verNumberStr Minimum branch number: format "4.0" NOT "4.0.0"
* @return boolean Returns TRUE if compatible with the provided version number
*/
public static function convertVersionNumberToInteger($verNumberStr)
{
$result = '';
if (self::isEqualOrHigherSixZero()) {
$result = \TYPO3\CMS\Core\Utility\VersionNumberUtility::convertVersionNumberToInteger($verNumberStr);
} elseif (class_exists('t3lib_utility_VersionNumber')) {
$result = t3lib_utility_VersionNumber::convertVersionNumberToInteger($verNumberStr);
} else {
$result = t3lib_div::int_from_ver($verNumberStr);
}
return $result;
}
示例10: clearCache
public static function clearCache()
{
if (\TYPO3\CMS\Core\Utility\VersionNumberUtility::convertVersionNumberToInteger(TYPO3_version) >= 7005000) {
$pageCache = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Cache\\CacheManager')->getCache('cache_pages');
$pageCache->flushByTag('cal');
} else {
// only use cachingFramework if initialized and configured in TYPO3
if (\TYPO3\CMS\Core\Cache\Cache::isCachingFrameworkInitialized() && TYPO3_UseCachingFramework && is_object($GLOBALS['typo3CacheManager'])) {
$pageCache = $GLOBALS['typo3CacheManager']->getCache('cache_pages');
$pageCache->flushByTag('cal');
}
}
}
示例11: includeLocalLang
/**
* Reads the [extDir]/locallang.xml and returns the $LOCAL_LANG array found in that file.
*
* @return The array with language labels
*/
public function includeLocalLang()
{
$llFile = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('jfmulticontent') . 'locallang.xml';
$version = \TYPO3\CMS\Core\Utility\VersionNumberUtility::convertVersionNumberToInteger(TYPO3_version);
if ($version < 4006000) {
$LOCAL_LANG = \TYPO3\CMS\Core\Utility\GeneralUtility::readLLXMLfile($llFile, $GLOBALS['LANG']->lang);
} else {
/** @var $llxmlParser t3lib_l10n_parser_Llxml */
$llxmlParser = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Localization\\Parser\\LocallangXmlParser');
$LOCAL_LANG = $llxmlParser->getParsedData($llFile, $GLOBALS['LANG']->lang);
}
return $LOCAL_LANG;
}
示例12: includeLocalLang
/**
* Reads the [extDir]/locallang.xml and returns the $LOCAL_LANG array found in that file.
*
* @return array The array with language labels
*/
protected function includeLocalLang()
{
$llFile = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('listfeusers') . 'locallang.xml';
$version = class_exists('\\TYPO3\\CMS\\Core\\Utility\\VersionNumberUtility') ? \TYPO3\CMS\Core\Utility\VersionNumberUtility::convertVersionNumberToInteger(TYPO3_version) : t3lib_div::int_from_ver(TYPO3_version);
if ($version < 4006000) {
$LOCAL_LANG = t3lib_div::readLLXMLfile($llFile, $GLOBALS['LANG']->lang);
} else {
/** @var $llxmlParser t3lib_l10n_parser_Llxml */
$llxmlParser = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Localization\\Parser\\LocallangXmlParser');
$LOCAL_LANG = $llxmlParser->getParsedData($llFile, $GLOBALS['LANG']->lang);
}
return $LOCAL_LANG;
}
示例13: getNumericTYPO3versionNumber
/**
* Returns the current TYPO3 version number as an integer, eg. 4005000 for version 4.5
*
* @return int
*/
public function getNumericTYPO3versionNumber()
{
if (class_exists(VersionNumberUtility)) {
$numeric_typo3_version = \TYPO3\CMS\Core\Utility\VersionNumberUtility::convertVersionNumberToInteger(TYPO3_version);
} else {
if (class_exists('t3lib_utility_VersionNumber')) {
$numeric_typo3_version = t3lib_utility_VersionNumber::convertVersionNumberToInteger(TYPO3_version);
} else {
$numeric_typo3_version = t3lib_div::int_from_ver(TYPO3_version);
}
}
return $numeric_typo3_version;
}
示例14: render
/**
* @param string $identifier
* @param string $size
* @param null $overlay
* @param string $state
* @param string $alternativeMarkupIdentifier
* @return string
*/
public function render($identifier, $size = 'small', $overlay = null, $state = 'default', $alternativeMarkupIdentifier = null)
{
if (VersionNumberUtility::convertVersionNumberToInteger(VersionNumberUtility::getNumericTypo3Version()) < 7000000) {
/** @var \TYPO3\CMS\Fluid\ViewHelpers\Be\Buttons\IconViewHelper $iconViewHelper */
$iconViewHelper = $this->objectManager->get('TYPO3\\CMS\\Fluid\\ViewHelpers\\Be\\Buttons\\IconViewHelper');
$iconViewHelper->setRenderingContext($this->renderingContext);
return $iconViewHelper->render('', $identifier);
} else {
/** @var \TYPO3\CMS\Core\ViewHelpers\IconViewHelper $iconViewHelper */
$iconViewHelper = $this->objectManager->get('TYPO3\\CMS\\Core\\ViewHelpers\\IconViewHelper');
$iconViewHelper->setRenderingContext($this->renderingContext);
return $iconViewHelper->render($identifier, $size, $overlay, $state, $alternativeMarkupIdentifier);
}
}
示例15: render
/**
* Check if TYPO3 Version is correct
*
* @return bool
*/
public function render()
{
// settings
$_EXTKEY = 'powermail';
require_once \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('powermail') . 'ext_emconf.php';
$versionString = $EM_CONF['powermail']['constraints']['depends']['typo3'];
$versions = explode('-', $versionString);
$powermailVersion = VersionNumberUtility::convertVersionNumberToInteger(TYPO3_version);
$isAboveMinVersion = $powermailVersion > VersionNumberUtility::convertVersionNumberToInteger($versions[0]);
$isBelowMaxVersion = $powermailVersion < VersionNumberUtility::convertVersionNumberToInteger($versions[1]);
if ($isAboveMinVersion && $isBelowMaxVersion) {
return TRUE;
}
return FALSE;
}