parse_date() публичный Метод

public parse_date ( $dt )
Пример #1
0
 function test()
 {
     $this->result = SimplePie_Misc::parse_date($this->data);
 }
 * @license http://www.opensource.org/licenses/bsd-license.php BSD License
 * @todo phpDoc comments
 */
/**
 * SimplePie Name
 */
define('SIMPLEPIE_NAME', 'SimplePie');
/**
 * SimplePie Version
 */
define('SIMPLEPIE_VERSION', '1.3-dev');
/**
 * SimplePie Build
 * @todo Hardcode for release (there's no need to have to call SimplePie_Misc::parse_date() only every load of simplepie.inc)
 */
define('SIMPLEPIE_BUILD', gmdate('YmdHis', SimplePie_Misc::parse_date(substr('$Date$', 7, 25)) ? SimplePie_Misc::parse_date(substr('$Date$', 7, 25)) : filemtime(__FILE__)));
/**
 * SimplePie Website URL
 */
define('SIMPLEPIE_URL', 'http://simplepie.org');
/**
 * SimplePie Useragent
 * @see SimplePie::set_useragent()
 */
define('SIMPLEPIE_USERAGENT', SIMPLEPIE_NAME . '/' . SIMPLEPIE_VERSION . ' (Feed Parser; ' . SIMPLEPIE_URL . '; Allow like Gecko) Build/' . SIMPLEPIE_BUILD);
/**
 * SimplePie Linkback
 */
define('SIMPLEPIE_LINKBACK', '<a href="' . SIMPLEPIE_URL . '" title="' . SIMPLEPIE_NAME . ' ' . SIMPLEPIE_VERSION . '">' . SIMPLEPIE_NAME . '</a>');
/**
 * No Autodiscovery
 /**
  * Load Events
  *
  * Load Google Calendar events from SimplePie object
  *
  * @access	public
  * @param	SimplePie object
  * @return	void
  */
 function _load_events($feed)
 {
     foreach ($feed->get_items() as $event) {
         // grab Google-namespaced tags (<gd:when>, <gd:where>, etc.)
         $when = $event->get_item_tags('http://schemas.google.com/g/2005', 'when');
         $where = $event->get_item_tags('http://schemas.google.com/g/2005', 'where');
         $location = $where[0]['attribs']['']['valueString'];
         $startTime = $when[0]['attribs']['']['startTime'];
         $startTime = SimplePie_Misc::parse_date($startTime);
         $endTime = $when[0]['attribs']['']['endTime'];
         $endTime = SimplePie_Misc::parse_date($endTime);
         // provide event only if there's actually a title here (private events don't have titles)
         if (strlen(trim($event->get_title())) > 1) {
             $this->events[] = array('title' => $event->get_title(), 'description' => $event->get_description(), 'link' => $event->get_link(), 'start_time' => $startTime, 'end_time' => $endTime, 'location' => $location);
         }
     }
 }
Пример #4
0
 * @license http://www.opensource.org/licenses/bsd-license.php BSD License
 * @todo phpDoc comments
 */
/**
 * SimplePie Name
 */
define('SIMPLEPIE_NAME', 'SimplePie');
/**
 * SimplePie Version
 */
define('SIMPLEPIE_VERSION', 'Pecan');
/**
 * SimplePie Build
 * @todo Hardcode for release (there's no need to have to call SimplePie_Misc::parse_date() only every load of simplepie.inc)
 */
define('SIMPLEPIE_BUILD', gmdate('YmdHis', SimplePie_Misc::parse_date(substr('$Date: 2009-12-02 15:07:07 +0300 (Ср, 02 дек 2009) $', 7, 25)) ? SimplePie_Misc::parse_date(substr('$Date: 2009-12-02 15:07:07 +0300 (Ср, 02 дек 2009) $', 7, 25)) : filemtime(__FILE__)));
/**
 * SimplePie Website URL
 */
define('SIMPLEPIE_URL', 'http://simplepie.org');
/**
 * SimplePie Useragent
 * @see SimplePie::set_useragent()
 */
define('SIMPLEPIE_USERAGENT', SIMPLEPIE_NAME . '/' . SIMPLEPIE_VERSION . ' (Feed Parser; ' . SIMPLEPIE_URL . '; Allow like Gecko) Build/' . SIMPLEPIE_BUILD);
/**
 * SimplePie Linkback
 */
define('SIMPLEPIE_LINKBACK', '<a href="' . SIMPLEPIE_URL . '" title="' . SIMPLEPIE_NAME . ' ' . SIMPLEPIE_VERSION . '">' . SIMPLEPIE_NAME . '</a>');
/**
 * No Autodiscovery
Пример #5
0
 function get_date($date_format = 'j F Y, g:i a')
 {
     if (!isset($this->data['date'])) {
         if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'published')) {
             $this->data['date']['raw'] = $return[0]['data'];
         } elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'updated')) {
             $this->data['date']['raw'] = $return[0]['data'];
         } elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'issued')) {
             $this->data['date']['raw'] = $return[0]['data'];
         } elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'created')) {
             $this->data['date']['raw'] = $return[0]['data'];
         } elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'modified')) {
             $this->data['date']['raw'] = $return[0]['data'];
         } elseif ($return = $this->get_item_tags('', 'pubDate')) {
             $this->data['date']['raw'] = $return[0]['data'];
         } elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'date')) {
             $this->data['date']['raw'] = $return[0]['data'];
         } elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_10, 'date')) {
             $this->data['date']['raw'] = $return[0]['data'];
         }
         if (!empty($this->data['date']['raw'])) {
             $this->data['date']['parsed'] = SimplePie_Misc::parse_date($this->data['date']['raw']);
         } else {
             $this->data['date'] = null;
         }
     }
     if ($this->data['date']) {
         $date_format = (string) $date_format;
         switch ($date_format) {
             case '':
                 return $this->sanitize($this->data['date']['raw'], SIMPLEPIE_CONSTRUCT_TEXT);
             case 'U':
                 return $this->data['date']['parsed'];
             default:
                 return date($date_format, $this->data['date']['parsed']);
         }
     } else {
         return null;
     }
 }
     $author = strtolower($dynamicMeta[$cType_value . '_author']);
 }
 for ($count = 0, $index = 0; $index < $feedItems; $index++) {
     // Exp 1) Start $count and $index at 0; Exp 2) If $index is less than the total number of feed items, continue; Exp 3) Increment $index at the end of each iteration
     $item = $feed->get_item($index);
     // Get each feed item starting with the first,
     if ($count < $limit) {
         // and continue as long as the number of items to display is less than the limit (or until Exp 2 in the For loop returns false). Here instead of the For loop because the result is only taken from the last part of Exp 2
         // Individual event (feed item) author
         $postAuthor = strtolower($item->get_author()->get_name());
         // Individual event time info
         $when = $item->get_item_tags('http://schemas.google.com/g/2005', 'when');
         // Get the Google-namespaced <gd:when> tag
         $date = $when[0]['attribs']['']['startTime'];
         // Get the startTime attribute
         $sortDate = SimplePie_Misc::parse_date($date);
         // Convert to UNIX timestamp - this will be used for sorting
         $displayDate = date('M d, g:i a', $sortDate);
         // A more readable date for displaying
         // Individual location info
         $where = $item->get_item_tags('http://schemas.google.com/g/2005', 'where');
         // Get the Google-namespaced <gd:where> tag
         $venueName = $where[0]['attribs']['']['valueString'];
         // Get the valueString attribute (the venue name)
         $venueLink = $where[0]['child']['http://schemas.google.com/g/2005']['entryLink'][0]['attribs']['']['href'];
         // Get the entryLink href value (the venue link)
         $venueAddress = $where[0]['child']['http://schemas.google.com/g/2005']['entryLink'][0]['child']['http://schemas.google.com/g/2005']['entry'][0]['child']['http://schemas.google.com/g/2005']['postalAddress'][0]['data'];
         // Get the... event address
         // Individual event cost info
         $extendedProperty = $item->get_item_tags('http://schemas.google.com/g/2005', 'extendedProperty');
         // Get the Google-namespaced <gd:extendedProperty> tag