当前位置: 首页>>代码示例>>PHP>>正文


PHP MathUtility::canBeInterpretedAsFloat方法代码示例

本文整理汇总了PHP中TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsFloat方法的典型用法代码示例。如果您正苦于以下问题:PHP MathUtility::canBeInterpretedAsFloat方法的具体用法?PHP MathUtility::canBeInterpretedAsFloat怎么用?PHP MathUtility::canBeInterpretedAsFloat使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TYPO3\CMS\Core\Utility\MathUtility的用法示例。


在下文中一共展示了MathUtility::canBeInterpretedAsFloat方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: clearUrlCache

 /**
  * Clears the URL cache according to parameters.
  *
  * @param array $parameters
  * @return void
  */
 public function clearUrlCache(array $parameters)
 {
     $cacheCommand = $parameters['cacheCmd'];
     if (MathUtility::canBeInterpretedAsFloat($cacheCommand)) {
         $cacheInstance = CacheFactory::getCache();
         $cacheInstance->clearUrlCacheForPage((int) $cacheCommand);
     }
 }
开发者ID:rvock,项目名称:typo3-realurl,代码行数:14,代码来源:Cache.php

示例2: evaluateFieldValue

 /**
  * Validates the given longitude value (between -180 and 180 degrees)
  * @see https://developers.google.com/maps/documentation/javascript/reference?hl=fr#LatLng
  *
  * @param mixed $value The value that has to be checked.
  * @param string $is_in Is-In String
  * @param int $set Determines if the field can be set (value correct) or not
  *
  * @return string The new value of the field
  */
 public function evaluateFieldValue($value, $is_in, &$set)
 {
     $newValue = '0.000000';
     $set = TRUE;
     if (MathUtility::canBeInterpretedAsFloat($value) && ((double) $value >= -180 && (double) $value <= 180)) {
         $newValue = number_format((double) $value, 6);
     }
     return $newValue;
 }
开发者ID:phathoang,项目名称:sf_event_mgt,代码行数:19,代码来源:LongitudeEvaluator.php

示例3: canBeInterpretedAsFloatReturnsFalse

 /**
  * @test
  * @dataProvider functionCanBeInterpretedAsFloatInvalidDataProvider
  */
 public function canBeInterpretedAsFloatReturnsFalse($int)
 {
     $this->assertFalse(\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsFloat($int));
 }
开发者ID:rickymathew,项目名称:TYPO3.CMS,代码行数:8,代码来源:MathUtilityTest.php

示例4: updateIndex

 /**
  * Updates the index entry for a given file.
  *
  * @param \TYPO3\CMS\Core\Resource\File $file
  * @param integer $width
  * @param integer $height
  * @param array $metadata EXIF metadata
  * @return void
  */
 protected static function updateIndex(\TYPO3\CMS\Core\Resource\File $file = null, $width, $height, array $metadata = array())
 {
     if (version_compare(TYPO3_version, '6.99.99', '<=')) {
         /** @var \TYPO3\CMS\Core\Resource\Service\IndexerService $indexerService */
         $indexerService = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Resource\\Service\\IndexerService');
         $indexerService->indexFile($file);
     }
     if (count($metadata) > 0) {
         /** @var \TYPO3\CMS\Core\Resource\Index\MetaDataRepository $metadataRepository */
         $metadataRepository = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Resource\Index\MetaDataRepository::class);
         // Will take care of creating the record if it does not exist yet
         $currentMetadata = $metadataRepository->findByFile($file);
         $newMetadata = [];
         // Pre-populate with metadata coming from external extractors
         foreach ($currentMetadata as $key => $value) {
             if (!empty($metadata[$key])) {
                 // Known issue with "creator_tool" having a software version sometimes
                 if ($key === 'creator_tool' && MathUtility::canBeInterpretedAsFloat($metadata[$key])) {
                     continue;
                 }
                 $newMetadata[$key] = $metadata[$key];
             }
         }
         // Width and height are always wrong since we resized the image
         unset($newMetadata['width']);
         unset($newMetadata['height']);
         // We deal with resized images so unit is always pixels
         $newMetadata['unit'] = 'px';
         // Mapping for the built-in PHP-based metadata extractor
         $mapping = ['color_space' => 'ColorSpace', 'content_creation_date' => 'DateTimeOriginal', 'creator' => 'IPTCCreator|Company', 'creator_tool' => 'Model|Make|Software', 'description' => 'ImageDescription', 'keywords' => 'IPTCKeywords', 'latitude' => 'GPSLatitudeDecimal', 'longitude' => 'GPSLongitudeDecimal', 'location_city' => 'IPTCCity', 'location_country' => 'IPTCCountry', 'location_region' => 'IPTCRegion', 'note' => 'IPTCLocation', 'publisher' => 'IPTCCredit', 'source' => 'IPTCSource', 'title' => 'IPTCTitle'];
         foreach ($mapping as $falKey => $metadataKeyMapping) {
             if (!empty($newMetadata[$falKey])) {
                 // We already have a known-to-be-valid metadata for this FAL property
                 continue;
             }
             $metatadaKeys = explode('|', $metadataKeyMapping);
             foreach ($metatadaKeys as $metadataKey) {
                 $value = null;
                 if (isset($metadata[$metadataKey])) {
                     $value = trim($metadata[$metadataKey]);
                     if (ord($value) === 1) {
                         $value = null;
                     }
                     switch ($metadataKey) {
                         case 'ColorSpace':
                             if ($value == 1) {
                                 $value = 'RGB';
                             } else {
                                 // Unknown
                                 $value = null;
                             }
                             break;
                         case 'DateTimeOriginal':
                             $value = strtotime($value);
                             break;
                     }
                 }
                 if (!empty($value)) {
                     $newMetadata[$falKey] = $value;
                     break;
                 }
             }
         }
         $metadataRepository->update($file->getUid(), $newMetadata);
     }
 }
开发者ID:girardiv,项目名称:image_autoresize,代码行数:75,代码来源:FAL.php


注:本文中的TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsFloat方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。