SimplePie_Parse_Date::remove_rfc2822_comments

Advertisement

Summery Summery

Remove RFC822 comments

Syntax Syntax

SimplePie_Parse_Date::remove_rfc2822_comments( $string )

Parameters Parameters

$data

(Required) Data to strip comments from

Return Return

(string) Comment stripped string

Source Source

File: wp-includes/SimplePie/Parse/Date.php

			6: Second
			7: Decimal fraction of a second
			8: Zulu
			9: Timezone ±
			10: Timezone hours
			11: Timezone minutes
			*/

			// Fill in empty matches
			for ($i = count($match); $i <= 3; $i++)
			{
				$match[$i] = '1';
			}

			for ($i = count($match); $i <= 7; $i++)
			{
				$match[$i] = '0';
			}

			// Numeric timezone
			if (isset($match[9]) && $match[9] !== '')
			{
				$timezone = $match[10] * 3600;
				$timezone += $match[11] * 60;
				if ($match[9] === '-')
				{
					$timezone = 0 - $timezone;
				}
			}
			else
			{
				$timezone = 0;
			}

			// Convert the number of seconds to an integer, taking decimals into account
			$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;
		}

		return false;
	}

	/**
	 * Remove RFC822 comments
	 *
	 * @access protected
	 * @param string $data Data to strip comments from
	 * @return string Comment stripped string
	 */
	public function remove_rfc2822_comments($string)
	{
		$string = (string) $string;

Advertisement

Advertisement

Leave a Reply