當前位置: 首頁>>代碼示例>>PHP>>正文


PHP PSU::html5_datetime方法代碼示例

本文整理匯總了PHP中PSU::html5_datetime方法的典型用法代碼示例。如果您正苦於以下問題:PHP PSU::html5_datetime方法的具體用法?PHP PSU::html5_datetime怎麽用?PHP PSU::html5_datetime使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在PSU的用法示例。


在下文中一共展示了PSU::html5_datetime方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: parse_data

 /**
  * Method to parse the source's data into a standard format
  */
 protected function parse_data()
 {
     // Create a normalized feed array (to be served later)
     $parsed_data = array();
     // Let's loop through each "tweet"
     foreach ($this->data as $tweet) {
         // Set reusable timestamp variable
         $timestamp = strtotime($tweet['created_at']);
         $parsed_data[] = array('source' => 'Twitter', 'title' => $tweet['user']['name'], 'userid' => $tweet['user']['id'], 'rawtime' => $tweet['created_at'], 'timestamp' => $timestamp, 'datetime' => \PSU::html5_datetime($timestamp), 'time_ago' => \PSU::date_diff($timestamp, time(), 'simple'), 'url' => 'https://twitter.com/' . $tweet['user']['screen_name'] . '/status/' . $tweet['id_str'], 'text' => $tweet['text']);
     }
     return $parsed_data;
 }
開發者ID:AholibamaSI,項目名稱:plymouth-webapp,代碼行數:15,代碼來源:Twitter.php

示例2: parse_data

 /**
  * Method to parse the source's data into a standard format
  */
 protected function parse_data()
 {
     // Create a normalized feed array (to be served later)
     $parsed_data = array();
     // Reference just the feed
     $feed = $this->data->feed;
     // If the feed doesn't have a title, give it a generic name
     $feed_title = $feed->title();
     if (strlen($feed_title) <= 0) {
         $feed_title = 'Plymouth State News';
     }
     // Let's loop through each article
     $item_count = 0;
     foreach ($feed as $item) {
         // If we've gone over the post limit setting, then break out of this loop
         if ($item_count > $this->post_limit) {
             // Stop adding posts from this feed
             break;
         }
         // Cut posts if they're too old
         $post_timestamp = strtotime($item->pubDate());
         if (time() - $post_timestamp > $this->old_post_days * 86400) {
             // Skip adding this one... its too old
             continue;
         }
         // Quick function to clean the posts text
         $clean_the_post = function ($post) {
             // Run some cleaners on the string
             $post = htmlspecialchars_decode($post);
             $post = html_entity_decode($post);
             $post = strip_tags($post);
             $post = \PSU::html_all_entities($post);
             $post = str_replace('&#12287;', '\'', $post);
             return $post;
         };
         $post_text = $clean_the_post($item->title());
         // Add the posts data to the normalized array
         $parsed_data[] = array('source' => 'RSS', 'title' => $feed_title, 'userid' => '', 'rawtime' => $item->pubDate(), 'timestamp' => $post_timestamp, 'datetime' => \PSU::html5_datetime($post_timestamp), 'time_ago' => \PSU::date_diff($post_timestamp, time(), 'simple'), 'url' => $item->link(), 'text' => $post_text, 'description' => $item->description(), 'content' => $item->content());
         $item_count++;
     }
     return $parsed_data;
 }
開發者ID:AholibamaSI,項目名稱:plymouth-webapp,代碼行數:45,代碼來源:Rss.php

示例3: parse_data

 /**
  * Method to parse the source's data into a standard format
  */
 protected function parse_data()
 {
     // Create a normalized feed array (to be served later)
     $parsed_data = array();
     // Let's loop through each post
     foreach ($this->data['data'] as $post) {
         // Set reusable timestamp variable
         $timestamp = strtotime($post['created_time']);
         // If the message data is empty, but the name/title isn't, just set the message to have the value of the name
         if (empty($post['message']) && !empty($post['name'])) {
             $post['message'] = $post['name'];
         }
         // If the post's message is empty $this->remove_empty_message_posts is set to true
         if (empty($post['message']) && $this->remove_empty_message_posts) {
             // Just skip adding the post
             continue;
         }
         $parsed_data[] = array('source' => 'Facebook', 'title' => $post['from']['name'], 'userid' => $post['from']['id'], 'rawtime' => $post['created_time'], 'timestamp' => $timestamp, 'datetime' => \PSU::html5_datetime($timestamp), 'time_ago' => \PSU::date_diff($timestamp, time(), 'simple'), 'url' => $post['actions'][0]['link'], 'text' => $post['message']);
     }
     return $parsed_data;
 }
開發者ID:AholibamaSI,項目名稱:plymouth-webapp,代碼行數:24,代碼來源:Facebook.php


注:本文中的PSU::html5_datetime方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。