本文整理汇总了PHP中TYPO3\CMS\Core\Utility\VersionNumberUtility类的典型用法代码示例。如果您正苦于以下问题:PHP VersionNumberUtility类的具体用法?PHP VersionNumberUtility怎么用?PHP VersionNumberUtility使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了VersionNumberUtility类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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 . '/';
}
示例2: convertDependenciesToObjects
/**
* Converts string dependencies to an object storage of dependencies
*
* @param string $dependencies
* @return \SplObjectStorage
*/
public function convertDependenciesToObjects($dependencies)
{
$dependenciesObject = new \SplObjectStorage();
$unserializedDependencies = unserialize($dependencies);
if (!is_array($unserializedDependencies)) {
return $dependenciesObject;
}
foreach ($unserializedDependencies as $dependencyType => $dependencyValues) {
// Dependencies might be given as empty string, e.g. conflicts => ''
if (!is_array($dependencyValues)) {
continue;
}
foreach ($dependencyValues as $dependency => $versions) {
if ($dependencyType && $dependency) {
$versionNumbers = \TYPO3\CMS\Core\Utility\VersionNumberUtility::convertVersionsStringToVersionNumbers($versions);
$lowest = $versionNumbers[0];
if (count($versionNumbers) === 2) {
$highest = $versionNumbers[1];
} else {
$highest = '';
}
/** @var $dependencyObject \TYPO3\CMS\Extensionmanager\Domain\Model\Dependency */
$dependencyObject = $this->objectManager->get(\TYPO3\CMS\Extensionmanager\Domain\Model\Dependency::class);
$dependencyObject->setType($dependencyType);
$dependencyObject->setIdentifier($dependency);
$dependencyObject->setLowestVersion($lowest);
$dependencyObject->setHighestVersion($highest);
$dependenciesObject->attach($dependencyObject);
unset($dependencyObject);
}
}
}
return $dependenciesObject;
}
示例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: 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);
}
示例5: 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);
}
示例6: 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);
}
}
示例7: getVersion
/**
* Get TYPO3 Version
*
* @param null $version
* @return string
*/
public static function getVersion($version = null)
{
if ($version === null) {
$version = TYPO3_version;
}
return VersionNumberUtility::convertIntegerToVersionNumber($version);
}
示例8: __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';
}
}
示例9: 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;
}
示例10: 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;
}
示例11: 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;
}
示例12: 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;
}
示例13: 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;
}
示例14: 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;
}
示例15: 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');
}
}
}