wp/wp-includes/SimplePie/Parse/Date.php
changeset 16 a86126ab1dd4
parent 7 cf61fcea0001
--- a/wp/wp-includes/SimplePie/Parse/Date.php	Tue Oct 22 16:11:46 2019 +0200
+++ b/wp/wp-includes/SimplePie/Parse/Date.php	Tue Dec 15 13:49:49 2020 +0100
@@ -5,7 +5,7 @@
  * A PHP-Based RSS and Atom Feed Framework.
  * Takes the hard work out of managing a complete RSS/Atom solution.
  *
- * Copyright (c) 2004-2012, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors
+ * Copyright (c) 2004-2016, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without modification, are
@@ -33,10 +33,9 @@
  * POSSIBILITY OF SUCH DAMAGE.
  *
  * @package SimplePie
- * @version 1.3.1
- * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue
+ * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue
  * @author Ryan Parman
- * @author Geoffrey Sneddon
+ * @author Sam Sneddon
  * @author Ryan McCue
  * @link http://simplepie.org/ SimplePie
  * @license http://www.opensource.org/licenses/bsd-license.php BSD License
@@ -99,12 +98,20 @@
 		'dimanche' => 7,
 		// German
 		'montag' => 1,
+		'mo' => 1,
 		'dienstag' => 2,
+		'di' => 2,
 		'mittwoch' => 3,
+		'mi' => 3,
 		'donnerstag' => 4,
+		'do' => 4,
 		'freitag' => 5,
+		'fr' => 5,
 		'samstag' => 6,
+		'sa' => 6,
 		'sonnabend' => 6,
+		// AFAIK no short form for sonnabend
+		'so' => 7,
 		'sonntag' => 7,
 		// Italian
 		'lunedì' => 1,
@@ -146,6 +153,14 @@
 		'Παρ' => 5,
 		'Σαβ' => 6,
 		'Κυρ' => 7,
+		// Russian
+		'Пн.' => 1,
+		'Вт.' => 2,
+		'Ср.' => 3,
+		'Чт.' => 4,
+		'Пт.' => 5,
+		'Сб.' => 6,
+		'Вс.' => 7,
 	);
 
 	/**
@@ -173,7 +188,7 @@
 		'aug' => 8,
 		'august' => 8,
 		'sep' => 9,
-		'september' => 8,
+		'september' => 9,
 		'oct' => 10,
 		'october' => 10,
 		'nov' => 11,
@@ -208,17 +223,28 @@
 		'décembre' => 12,
 		// German
 		'januar' => 1,
+		'jan' => 1,
 		'februar' => 2,
+		'feb' => 2,
 		'märz' => 3,
+		'mär' => 3,
 		'april' => 4,
-		'mai' => 5,
+		'apr' => 4,
+		'mai' => 5, // no short form for may
 		'juni' => 6,
+		'jun' => 6,
 		'juli' => 7,
+		'jul' => 7,
 		'august' => 8,
+		'aug' => 8,
 		'september' => 9,
+		'sep' => 9,
 		'oktober' => 10,
+		'okt' => 10,
 		'november' => 11,
+		'nov' => 11,
 		'dezember' => 12,
+		'dez' => 12,
 		// Italian
 		'gennaio' => 1,
 		'febbraio' => 2,
@@ -290,7 +316,33 @@
 		'Σεπ' => 9,
 		'Οκτ' => 10,
 		'Νοέ' => 11,
-		'Δεκ' => 12,
+		'Δεκ' => 12,		
+		// Russian
+		'Янв' => 1,
+		'января' => 1,
+		'Фев' => 2,
+		'февраля' => 2,
+		'Мар' => 3,
+		'марта' => 3,
+		'Апр' => 4,
+		'апреля' => 4,
+		'Май' => 5,
+		'мая' => 5,
+		'Июн' => 6,
+		'июня' => 6,
+		'Июл' => 7,
+		'июля' => 7,
+		'Авг' => 8,
+		'августа' => 8,
+		'Сен' => 9,
+		'сентября' => 9,
+		'Окт' => 10,
+		'октября' => 10,
+		'Ноя' => 11,
+		'ноября' => 11,
+		'Дек' => 12,
+		'декабря' => 12,
+
 	);
 
 	/**
@@ -542,8 +594,8 @@
 	 */
 	public function __construct()
 	{
-		$this->day_pcre = '(' . implode(array_keys($this->day), '|') . ')';
-		$this->month_pcre = '(' . implode(array_keys($this->month), '|') . ')';
+		$this->day_pcre = '(' . implode('|', array_keys($this->day)) . ')';
+		$this->month_pcre = '(' . implode('|', array_keys($this->month)) . ')';
 
 		static $cache;
 		if (!isset($cache[get_class($this)]))
@@ -614,7 +666,7 @@
 	 *
 	 * @final
 	 * @access public
-	 * @param callable $callback
+	 * @param callback $callback
 	 */
 	public function add_callback($callback)
 	{
@@ -631,7 +683,7 @@
 	/**
 	 * Parse a superset of W3C-DTF (allows hyphens and colons to be omitted, as
 	 * well as allowing any of upper or lower case "T", horizontal tabs, or
-	 * spaces to be used as the time seperator (including more than one))
+	 * spaces to be used as the time separator (including more than one))
 	 *
 	 * @access protected
 	 * @return int Timestamp
@@ -691,14 +743,12 @@
 			}
 
 			// Convert the number of seconds to an integer, taking decimals into account
-			$second = round($match[6] + $match[7] / pow(10, strlen($match[7])));
+			$second = round((int)$match[6] + (int)$match[7] / (10 ** strlen($match[7])));
 
 			return gmmktime($match[4], $match[5], $second, $match[2], $match[3], $match[1]) - $timezone;
 		}
-		else
-		{
-			return false;
-		}
+
+		return false;
 	}
 
 	/**
@@ -721,7 +771,7 @@
 		{
 			$output .= substr($string, $position, $pos - $position);
 			$position = $pos + 1;
-			if ($string[$pos - 1] !== '\\')
+			if ($pos === 0 || $string[$pos - 1] !== '\\')
 			{
 				$depth++;
 				while ($depth && $position < $length)
@@ -849,10 +899,8 @@
 
 			return gmmktime($match[5], $match[6], $second, $month, $match[2], $match[4]) - $timezone;
 		}
-		else
-		{
-			return false;
-		}
+
+		return false;
 	}
 
 	/**
@@ -914,10 +962,8 @@
 
 			return gmmktime($match[5], $match[6], $match[7], $month, $match[2], $match[4]) - $timezone;
 		}
-		else
-		{
-			return false;
-		}
+
+		return false;
 	}
 
 	/**
@@ -956,10 +1002,8 @@
 			$month = $this->month[strtolower($match[2])];
 			return gmmktime($match[4], $match[5], $match[6], $month, $match[3], $match[7]);
 		}
-		else
-		{
-			return false;
-		}
+
+		return false;
 	}
 
 	/**
@@ -975,10 +1019,7 @@
 		{
 			return false;
 		}
-		else
-		{
-			return $strtotime;
-		}
+
+		return $strtotime;
 	}
 }
-