Changeset 56975 for trunk/src/wp-includes/ID3/module.tag.id3v2.php
- Timestamp:
- 10/20/2023 01:27:56 PM (17 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/ID3/module.tag.id3v2.php
r54376 r56975 1495 1495 } 1496 1496 } 1497 } while (false); 1497 } while (false); // @phpstan-ignore-line 1498 1498 } 1499 1499 … … 3754 3754 */ 3755 3755 public static function IsANumber($numberstring, $allowdecimal=false, $allownegative=false) { 3756 for ($i = 0; $i < strlen($numberstring); $i++) { 3757 if ((chr($numberstring[$i]) < chr('0')) || (chr($numberstring[$i]) > chr('9'))) { 3758 if (($numberstring[$i] == '.') && $allowdecimal) { 3759 // allowed 3760 } elseif (($numberstring[$i] == '-') && $allownegative && ($i == 0)) { 3761 // allowed 3762 } else { 3763 return false; 3764 } 3765 } 3766 } 3767 return true; 3756 $pattern = '#^'; 3757 $pattern .= ($allownegative ? '\\-?' : ''); 3758 $pattern .= '[0-9]+'; 3759 $pattern .= ($allowdecimal ? '(\\.[0-9]+)?' : ''); 3760 $pattern .= '$#'; 3761 return preg_match($pattern, $numberstring); 3768 3762 } 3769 3763 … … 3774 3768 */ 3775 3769 public static function IsValidDateStampString($datestamp) { 3776 if (strlen($datestamp) != 8) { 3777 return false; 3778 } 3779 if (!self::IsANumber($datestamp, false)) { 3770 if (!preg_match('#^[12][0-9]{3}[01][0-9][0123][0-9]$#', $datestamp)) { 3780 3771 return false; 3781 3772 }
Note: See TracChangeset
for help on using the changeset viewer.