本文整理汇总了PHP中SimplePie_Misc::uncomment_rfc822方法的典型用法代码示例。如果您正苦于以下问题:PHP SimplePie_Misc::uncomment_rfc822方法的具体用法?PHP SimplePie_Misc::uncomment_rfc822怎么用?PHP SimplePie_Misc::uncomment_rfc822使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SimplePie_Misc
的用法示例。
在下文中一共展示了SimplePie_Misc::uncomment_rfc822方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: parse_date
function parse_date($dt, $rfc822_tz = true)
{
static $cache = array();
if (!isset($cache[$dt][$rfc822_tz])) {
$dt = SimplePie_Misc::uncomment_rfc822($dt);
/*
Capturing subpatterns:
1: RFC 822 date
2: RFC 822 day
3: RFC 822 month
4: RFC 822 year
5: ISO 8601 date
6: ISO 8601 century
7: ISO 8601 year
8: ISO 8601 month
9: ISO 8601 day
10: ISO 8601 ordinal day
11: ISO 8601 month
12: ISO 8601 day
13: ISO 8601 week
14: ISO 8601 day of week
15: Time
16: Hour
17: Hour Decimal
18: Minute
19: Minute Decimal
20: Second
21: Second Decimal
22: Timezone
23: Diff ±
24: Hour
25: Hour Decimal
26: Minute
27: Minute Decimal
28: Alphabetic Timezone
*/
if (preg_match('/^(?:(?:(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun)[,\\s]+)?(([0-9]{1,2})\\s*(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\\s*([0-9]{4}|[0-9]{2}))|(([0-9]{2})(?:([0-9]{2})(?:(?:-|\\s)*(?:([0-9]{2})([0-9]{2})|([0-9]{3})|([0-9]{2})(?:(?:-|\\s)*([0-9]{2}))?|W([0-9]{2})(?:(?:-|\\s)*([0-9]))?))?)?))((?:T|\\s)+([0-9]{2})(?:(?:,|\\.)([0-9]*)|(?:\\:|\\s)*([0-9]{2})(?:(?:,|\\.)([0-9]*)|(?:\\:|\\s)*([0-9]{2})(?:(?:,|\\.)([0-9]*))?)?)?(?:\\s)*((?:(\\+|-)([0-9]{2})(?:(?:,|\\.)([0-9]*)|(?:\\:|\\s)*(?:([0-9]{2})(?:(?:,|\\.)([0-9]*))?))?)|(UTC|GMT|EST|CST|MST|PST|EDT|CDT|MDT|PDT|UT|[A-IK-Z]))?)?$/i', $dt, $match)) {
// Fill all matches
for ($i = count($match); $i <= 28; $i++) {
$match[$i] = '';
}
// Set blank vars
$year = 1970;
$month = 1;
$day = 1;
$hour = 0;
$minute = 0;
$second = 0;
$timezone = false;
// RFC 822
if ($match[1] !== '') {
if (strlen($match[4]) == 2) {
$year = $match[4] < 70 ? "20{$match['4']}" : "19{$match['4']}";
} else {
$year = $match[4];
}
switch (strtolower($match[3])) {
case 'jan':
$month = 1;
break;
case 'feb':
$month = 2;
break;
case 'mar':
$month = 3;
break;
case 'apr':
$month = 4;
break;
case 'may':
$month = 5;
break;
case 'jun':
$month = 6;
break;
case 'jul':
$month = 7;
break;
case 'aug':
$month = 8;
break;
case 'sep':
$month = 9;
break;
case 'oct':
$month = 10;
break;
case 'nov':
$month = 11;
break;
case 'dec':
$month = 12;
break;
}
$day = $match[2];
} else {
// Year
if ($match[7] !== '') {
$year = "{$match['6']}{$match['7']}";
// Two Digit Month/Day
//.........这里部分代码省略.........