当前位置: 首页>>代码示例>>PHP>>正文


PHP feed类代码示例

本文整理汇总了PHP中feed的典型用法代码示例。如果您正苦于以下问题:PHP feed类的具体用法?PHP feed怎么用?PHP feed使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了feed类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: PageMain

function PageMain()
{
    global $TMPL, $LNG, $CONF, $db, $loggedIn, $settings;
    $feed = new feed();
    $feed->db = $db;
    $feed->url = $CONF['url'];
    if (isset($_SESSION['username']) && isset($_SESSION['password']) || isset($_COOKIE['username']) && isset($_COOKIE['password'])) {
        $verify = $loggedIn->verify();
        if ($verify['username']) {
            $feed->user = $verify;
            $feed->username = $verify['username'];
            $feed->id = $verify['idu'];
        }
    }
    $feed->per_page = $settings['qperpage'];
    $feed->categories = $feed->getCategories();
    $feed->time = $settings['time'];
    $feed->l_per_post = $settings['lperpost'];
    $TMPL_old = $TMPL;
    $TMPL = array();
    $skin = new skin('shared/rows');
    $rows = '';
    // If the $_GET keyword is empty [user]
    if ($_GET['q'] == '') {
        header("Location: " . $CONF['url'] . "/index.php?a=welcome");
    }
    if ($_GET['filter'] == 'tracks') {
        list($tracks, $error) = $feed->searchTracks(0, $_GET['q']);
        $TMPL['messages'] = $tracks;
    } elseif ($_GET['filter'] == 'playlists') {
        $playlist = $feed->getPlaylists(0, 2, $_GET['q']);
        $error = $feed->showError('no_results', 1);
        $TMPL['messages'] = empty($playlist) ? $error[0] : $playlist;
    } else {
        $TMPL['messages'] = $feed->getSearch(0, $settings['qperpage'], $_GET['q'], $_GET['filter']);
    }
    $rows = $skin->make();
    $skin = new skin('search/sidebar');
    $sidebar = '';
    $TMPL['trending'] = $feed->sidebarTrending($_GET['tag'], 10);
    $TMPL['filters'] = $feed->sidebarFilters($_GET['filter'], $_GET['q']);
    $TMPL['ad'] = generateAd($settings['ad6']);
    $sidebar = $skin->make();
    $TMPL = $TMPL_old;
    unset($TMPL_old);
    $TMPL['top'] = $top;
    $TMPL['rows'] = $rows;
    $TMPL['sidebar'] = $sidebar;
    if (isset($_GET['logout']) == 1) {
        $loggedIn->logOut();
        header("Location: " . $CONF['url'] . "/index.php?a=welcome");
    }
    $TMPL['url'] = $CONF['url'];
    $TMPL['title'] = $LNG['search'] . ' - ' . htmlspecialchars($_GET['q']) . ' - ' . $settings['title'];
    $TMPL['header'] = pageHeader($LNG['search'] . ' - ' . $_GET['q']);
    $skin = new skin('shared/content');
    return $skin->make();
}
开发者ID:Jeg72,项目名称:php_sound,代码行数:58,代码来源:search.php

示例2: rss

 /**
  * Demonstrates how to parse RSS feeds by using DOMDocument.
  */
 function rss()
 {
     // Parse an external atom feed
     $feed = feed::parse('http://codeigniter.com/feeds/atom/news/');
     // Show debug info
     echo Kohana::debug($feed);
     echo Kohana::lang('core.stats_footer');
 }
开发者ID:nicka1711,项目名称:hanami,代码行数:11,代码来源:examples.php

示例3: rss

 /**
  * Demonstrates how to parse RSS feeds by using DOMDocument.
  */
 function rss()
 {
     // Parse an external atom feed
     $feed = feed::parse('feed:http://github.com/feeds/enormego/commits/EightPHP/master');
     // Show debug info
     echo Eight::debug($feed);
     echo Eight::lang('core.stats_footer');
 }
开发者ID:enormego,项目名称:EightPHP,代码行数:11,代码来源:examples.php

示例4: test_create

 /**
  * @test
  *
  * @dataProvider provider_create
  *
  * @covers feed::create
  *
  * @param string  $info     info to pass
  * @param integer $items    items to add
  * @param integer $matcher  output
  */
 public function test_create($info, $items, $enviroment, $matcher_item, $matchers_image)
 {
     $this->setEnvironment($enviroment);
     $this->assertTag($matcher_item, feed::create($info, $items), '', FALSE);
     foreach ($matchers_image as $matcher_image) {
         $this->assertTag($matcher_image, feed::create($info, $items), '', FALSE);
     }
 }
开发者ID:reznikds,项目名称:Reznik,代码行数:19,代码来源:FeedTest.php

示例5: server

 public static function server($server)
 {
     $server = strtolower($server);
     $servers = feed::servers();
     if (in_array($server, array_keys($servers))) {
         return $servers[$server];
     }
     return false;
 }
开发者ID:hzhou9,项目名称:coupon_deal,代码行数:9,代码来源:feed.php

示例6: campaigns

 public function campaigns($limit = 20)
 {
     $this->info['description'] = 'Spicer\'s Campaigns';
     $this->info['lastBuildDate'] = date(DATE_RFC2822, Orm::factory('campaign')->where('status', 'approved')->find()->created);
     $campaigns = Orm::factory('campaign')->where('status', 'approved')->find_all($limit);
     foreach ($campaigns as $campaign) {
         $items[] = array('title' => $campaign->name, 'link' => 'campaigns/view/' . $campaign->name, 'guid' => 'campaigns/view/' . $campaign->name, 'description' => $campaign->description, 'author' => 'admin@spicers.com.au (Spicers)', 'pubDate' => date(DATE_RFC2822, $campaign->created));
     }
     echo feed::create($this->info, $items);
 }
开发者ID:HIVE-Creative,项目名称:spicers,代码行数:10,代码来源:rss.php

示例7: get_replies

 /**
  * Get all the replies from a specified url
  *
  * @param string $href - replies feed url 
  * @param boolean $formatted - format the data in a more usable manner (my personal opinion)
  * @return array of replies
  */
 public static function get_replies($href, $formatted = true)
 {
     $data = feed::parse($href);
     if (!$formatted) {
         return $data;
     }
     $replies = array();
     // format the data in a more organised manner (personal opinion)
     foreach ($data as $d) {
         $replies[] = array("date" => $d['published'], "content" => $d['content'], "author" => $d['author']);
     }
     return $replies;
 }
开发者ID:sydlawrence,项目名称:Google-Buzz-Kohana-Module,代码行数:20,代码来源:buzz.php

示例8: get

 static function get($block_id)
 {
     $block = new Block();
     switch ($block_id) {
         case "welcome":
             $block->css_id = "gWelcome";
             $block->title = t("Welcome to Gallery3");
             $block->content = new View("admin_block_welcome.html");
             break;
         case "photo_stream":
             $block->css_id = "gPhotoStream";
             $block->title = t("Photo Stream");
             $block->content = new View("admin_block_photo_stream.html");
             $block->content->photos = ORM::factory("item")->where("type", "photo")->orderby("created", "DESC")->find_all(10);
             break;
         case "log_entries":
             $block->css_id = "gLogEntries";
             $block->title = t("Log Entries");
             $block->content = new View("admin_block_log_entries.html");
             $block->content->entries = ORM::factory("log")->orderby("timestamp", "DESC")->find_all(5);
             break;
         case "stats":
             $block->css_id = "gStats";
             $block->title = t("Gallery Stats");
             $block->content = new View("admin_block_stats.html");
             $block->content->album_count = ORM::factory("item")->where("type", "album")->where("id <>", 1)->count_all();
             $block->content->photo_count = ORM::factory("item")->where("type", "photo")->count_all();
             break;
         case "platform_info":
             $block->css_id = "gPlatform";
             $block->title = t("Platform Information");
             $block->content = new View("admin_block_platform.html");
             if (is_readable("/proc/loadavg")) {
                 $block->content->load_average = join(" ", array_slice(split(" ", array_shift(file("/proc/loadavg"))), 0, 3));
             } else {
                 $block->content->load_average = t("Unavailable");
             }
             break;
         case "project_news":
             $block->css_id = "gProjectNews";
             $block->title = t("Gallery Project News");
             $block->content = new View("admin_block_news.html");
             $block->content->feed = feed::parse("http://gallery.menalto.com/node/feed", 3);
             break;
         case "block_adder":
             $block->css_id = "gBlockAdder";
             $block->title = t("Dashboard Content");
             $block->content = self::get_add_block_form();
     }
     return $block;
 }
开发者ID:kstyrvoll,项目名称:gallery3,代码行数:51,代码来源:gallery_block.php

示例9: index

 public function index()
 {
     $this->template->content = new View('feed');
     $this->template->title = 'Feed';
     $limit = '0,20';
     if (isset($_POST['limit'])) {
         $limit = $_POST['limit'];
     }
     $messages = Message_Model::get_translated_messages($limit);
     $info = array('notes' => 'This is an RSS feed of the translated SMS messages.');
     $items = array();
     foreach ($messages as $id => $msg) {
         $items[] = array('title' => string_manipulation::xmlentities($msg['sms']), 'link' => 'http://localhost:8888/SMSTurks/feed/' . $id, 'description' => string_manipulation::xmlentities($msg['translation']), 'author' => $msg['number'], 'pubDate' => date('D, d M Y H:i:s O', strtotime($msg['received'])));
     }
     $this->template->content->display = feed::create($info, $items);
 }
开发者ID:ushahidi,项目名称:SMS-Turks,代码行数:16,代码来源:feed.php

示例10: get

 static function get($block_id)
 {
     $block = new Block();
     switch ($block_id) {
         case "welcome":
             $block->css_id = "gWelcome";
             $block->title = t("Welcome to Gallery3");
             $block->content = new View("admin_block_welcome.html");
             break;
         case "photo_stream":
             $block->css_id = "gPhotoStream";
             $block->title = t("Photo Stream");
             $block->content = new View("admin_block_photo_stream.html");
             $block->content->photos = ORM::factory("item")->where("type", "photo")->orderby("created", "desc")->find_all(10);
             break;
         case "log_entries":
             $block->css_id = "gLogEntries";
             $block->title = t("Log Entries");
             $block->content = new View("admin_block_log_entries.html");
             $block->content->entries = ORM::factory("log")->orderby("timestamp", "desc")->find_all(5);
             break;
         case "stats":
             $block->css_id = "gStats";
             $block->title = t("Gallery Stats");
             $block->content = new View("admin_block_stats.html");
             $block->content->album_count = ORM::factory("item")->where("type", "album")->count_all();
             $block->content->photo_count = ORM::factory("item")->where("type", "photo")->count_all();
             break;
         case "platform_info":
             $block->css_id = "gPlatform";
             $block->title = t("Platform Information");
             $block->content = new View("admin_block_platform.html");
             break;
         case "project_news":
             $block->css_id = "gProjectNews";
             $block->title = t("Gallery Project News");
             $block->content = new View("admin_block_news.html");
             $block->content->feed = feed::parse("http://gallery.menalto.com/node/feed", 3);
             break;
         case "block_adder":
             $block->css_id = "gBlockAdder";
             $block->title = t("Dashboard Content");
             $block->content = self::get_add_block_form();
     }
     return $block;
 }
开发者ID:Juuro,项目名称:Dreamapp-Website,代码行数:46,代码来源:core_block.php

示例11: comments

 public function comments()
 {
     header('Content-Type: text/xml; charset=UTF-8', TRUE);
     if ($cache = $this->cache->get('s7n_blog_feed_comments')) {
         echo $cache;
         return;
     }
     $comments = ORM::factory('blog_comment')->orderby('id', 'desc')->find_all(20);
     $info = array('title' => config::get('s7n.site_title') . ' (Latest Comments)', 'link' => url::current_site(), 'generator' => 'S7Ncms - http://www.s7n.de/');
     $items = array();
     foreach ($comments as $comment) {
         $items[] = array('author' => html::specialchars($comment->author), 'pubDate' => date('r', strtotime($comment->date)), 'title' => 'New comment for "' . $comment->blog_post->title . '"', 'description' => html::specialchars($comment->content), 'link' => $comment->blog_post->url(), 'guid' => $comment->blog_post->url());
     }
     $feed = feed::create($info, $items);
     $this->cache->set('s7n_blog_feed_comments', $feed);
     echo $feed;
 }
开发者ID:googlecode-mirror,项目名称:s7ncms,代码行数:17,代码来源:feed.php

示例12: _t

			</dl>
<?php		
	if(feed::doesExistXmlURL($feed['xmlURL'])) {
?>			
		<div class="warning_messages_wrap">
			<br />
				<?php echo _t('이 블로그는 이미 등록되어 있어 재등록 하실 수 없습니다.');?>		
			<br /><br />
			<a href="#" class="normalbutton" onclick="history.back(); return false;"><span><?php echo _t('뒤로');?></span></a>

		</div>
<?php
	} else {
		$result = $event->on('Add.getFeed', $xml);
		if(!is_array($result)) {
			$result = feed::getFeedItems($xml);
		}

		requireComponent('Bloglounge.Data.Groups');

		$groups = Group::getGroupsAll();
		$users = User::getMembers();

		if(count($result)>0) {
?>
			<dl>
					<dt><?php echo _t('글');?></dt>
					<dd class="text">
						<?php echo _f('가장 최신의 글 "%1"(을)를 포함한 %2개의 글이 존재합니다.','<span class="point">'.UTF8::lessen($result[0]['title'],40).'</span>', '<span class="cnt">'.count($result).'</span>');?>
					</dd>
			</dl>
开发者ID:ncloud,项目名称:bloglounge,代码行数:31,代码来源:index.php

示例13: _parse_feed

 /**
  * parse feed and send feed items to database
  */
 private function _parse_feed()
 {
     // Max number of feeds to keep
     $max_feeds = 100;
     // Today's Date
     $today = strtotime('now');
     // Get All Feeds From DB
     $feeds = ORM::factory('feed')->find_all();
     foreach ($feeds as $feed) {
         $last_update = $feed->feed_update;
         // Has it been more than 24 hours since the last update?
         // Since its a manual refresh, we don't need to set a time
         if ((int) $today - (int) $last_update > 0) {
             // Parse Feed URL using Feed Helper
             $feed_data = feed::simplepie($feed->feed_url);
             foreach ($feed_data->get_items(0, 50) as $feed_data_item) {
                 $title = $feed_data_item->get_title();
                 $link = $feed_data_item->get_link();
                 $description = $feed_data_item->get_description();
                 $date = $feed_data_item->get_date();
                 $latitude = $feed_data_item->get_latitude();
                 $longitude = $feed_data_item->get_longitude();
                 // Make Sure Title is Set (Atleast)
                 if (isset($title) && !empty($title)) {
                     // We need to check for duplicates!!!
                     // Maybe combination of Title + Date? (Kinda Heavy on the Server :-( )
                     $dupe_count = ORM::factory('feed_item')->where('item_title', $title)->where('item_date', date("Y-m-d H:i:s", strtotime($date)))->count_all();
                     if ($dupe_count == 0) {
                         // Does this feed have a location??
                         $location_id = 0;
                         // STEP 1: SAVE LOCATION
                         if ($latitude && $longitude) {
                             $location = new Location_Model();
                             $location->location_name = Kohana::lang('ui_admin.unknown');
                             $location->latitude = $latitude;
                             $location->longitude = $longitude;
                             $location->location_date = date("Y-m-d H:i:s", time());
                             $location->save();
                             $location_id = $location->id;
                         }
                         $newitem = new Feed_Item_Model();
                         $newitem->feed_id = $feed->id;
                         $newitem->location_id = $location_id;
                         $newitem->item_title = $title;
                         if (isset($description) && !empty($description)) {
                             $newitem->item_description = $description;
                         }
                         if (isset($link) && !empty($link)) {
                             $newitem->item_link = $link;
                         }
                         if (isset($date) && !empty($date)) {
                             $newitem->item_date = date("Y-m-d H:i:s", strtotime($date));
                         } else {
                             $newitem->item_date = date("Y-m-d H:i:s", time());
                         }
                         if (isset($feed_type) && !empty($feed_type)) {
                             $newitem->feed_type = $feed_type;
                         }
                         $newitem->save();
                     }
                 }
             }
             // Get Feed Item Count
             $feed_count = ORM::factory('feed_item')->where('feed_id', $feed->id)->count_all();
             if ($feed_count > $max_feeds) {
                 // Excess Feeds
                 $feed_excess = $feed_count - $max_feeds;
                 // Delete Excess Feeds
                 foreach (ORM::factory('feed_item')->where('feed_id', $feed->id)->orderby('id', 'ASC')->limit($feed_excess)->find_all() as $del_feed) {
                     $del_feed->delete($del_feed->id);
                 }
             }
             // Set feed update date
             $feed->feed_update = strtotime('now');
             $feed->save();
         }
     }
 }
开发者ID:kvin33,项目名称:Ushahidi_Web,代码行数:81,代码来源:manage.php

示例14: PageMain

function PageMain()
{
    global $TMPL, $LNG, $CONF, $db, $loggedIn, $settings;
    if (isset($_SESSION['username']) && isset($_SESSION['password']) || isset($_COOKIE['username']) && isset($_COOKIE['password'])) {
        $verify = $loggedIn->verify();
        if (empty($verify['username'])) {
            // If fake cookies are set, or they are set wrong, delete everything and redirect to home-page
            $loggedIn->logOut();
            header("Location: " . $CONF['url'] . "/index.php?a=welcome");
        } else {
            // Start displaying the Feed
            $feed = new feed();
            $feed->db = $db;
            $feed->url = $CONF['url'];
            $feed->user = $verify;
            $feed->id = $verify['idu'];
            $feed->username = $verify['username'];
            $feed->per_page = $settings['perpage'];
            $feed->time = $settings['time'];
            $feed->censor = $settings['censor'];
            $feed->smiles = $settings['smiles'];
            $feed->c_per_page = $settings['cperpage'];
            $feed->c_start = 0;
            $feed->l_per_post = $settings['lperpost'];
            $feed->online_time = $settings['conline'];
            $feed->friends_online = $settings['ronline'];
            $feed->subscriptionsList = $feed->getSubs($verify['idu'], 0);
            $feed->subscribersList = $feed->getSubs($verify['idu'], 1);
            $feed->updateStatus($verify['offline']);
            // Useed in timeline javascript which checks for new messages
            $TMPL['subs'] = 1;
            $TMPL_old = $TMPL;
            $TMPL = array();
            $skin = new skin('shared/rows');
            $rows = '';
            if (empty($_GET['filter'])) {
                $_GET['filter'] = '';
            }
            // Allowed types
            list($timeline, $message) = $feed->getFeed(0, $_GET['filter']);
            $TMPL['messages'] = $timeline;
            $rows = $skin->make();
            $skin = new skin('feed/sidebar');
            $sidebar = '';
            $TMPL['editprofile'] = $feed->fetchProfileWidget($verify['username'], realName($verify['username'], $verify['first_name'], $verify['last_name']), $verify['image']);
            $TMPL['sidebar'] = $feed->sidebarTypes($_GET['filter'], $feed->subscriptions);
            $TMPL['dates'] = $feed->sidebarDates($_GET['filter'], $feed->subscriptions);
            $TMPL['trending'] = $feed->sidebarTrending($_GET['tag'], 5);
            $TMPL['users'] = $feed->onlineUsers();
            $TMPL['subscriptions'] = $feed->sidebarSubs(0, 0);
            $TMPL['subscribers'] = $feed->sidebarSubs(1, 0);
            $TMPL['friendsactivity'] = $feed->sidebarFriendsActivity(20, 1);
            if (count($feed->subscriptionsList[0]) < 6) {
                $TMPL['suggestions'] = $feed->sidebarSuggestions();
            }
            $TMPL['ad'] = generateAd($settings['ad3']);
            $sidebar = $skin->make();
            $skin = new skin('shared/top');
            $top = '';
            // $TMPL['top'] = $feed->getForm();
            $TMPL['theme_url'] = $CONF['theme_url'];
            $TMPL['private_message'] = $verify['privacy'];
            $TMPL['avatar'] = $verify['image'];
            $TMPL['url'] = $CONF['url'];
            $top = $skin->make();
            $TMPL = $TMPL_old;
            unset($TMPL_old);
            $TMPL['top'] = $top;
            $TMPL['rows'] = $rows;
            $TMPL['sidebar'] = $sidebar;
            // If the username input string is an e-mail, switch the query
            if (isset($_SESSION['username'])) {
                if (filter_var($_SESSION['username'], FILTER_VALIDATE_EMAIL)) {
                    $result = $db->query("SELECT * FROM `users` WHERE `email` = '" . $_SESSION['username'] . "' AND `password` = '" . $_SESSION['password'] . "'");
                } else {
                    $result = $db->query("SELECT * FROM `users` WHERE `username` = '" . $_SESSION['username'] . "' AND `password` = '" . $_SESSION['password'] . "'");
                }
            } elseif (isset($_COOKIE['username'])) {
                if (filter_var($_COOKIE['username'], FILTER_VALIDATE_EMAIL)) {
                    $result = $db->query("SELECT * FROM `users` WHERE `email` = '" . $_COOKIE['username'] . "' AND `password` = '" . $_COOKIE['password'] . "'");
                } else {
                    $result = $db->query("SELECT * FROM `users` WHERE `username` = '" . $_COOKIE['username'] . "' AND `password` = '" . $_COOKIE['password'] . "'");
                }
            }
            while ($row = $result->fetch_assoc()) {
                $status = $row['status'];
            }
            if ($status == 0) {
                header("Location: " . $CONF['url'] . "/index.php?a=contact");
            } elseif ($status == 1) {
                header("Location: " . $CONF['url'] . "/index.php?a=employee");
            }
        }
    } else {
        // If the session or cookies are not set, redirect to home-page
        header("Location: " . $CONF['url'] . "/index.php?a=welcome");
    }
    if (isset($_GET['logout']) == 1) {
        $loggedIn->logOut();
        header("Location: " . $CONF['url'] . "/index.php?a=welcome");
//.........这里部分代码省略.........
开发者ID:Broomble,项目名称:AlumniSocialnetwork,代码行数:101,代码来源:feed.php

示例15: index

 /**
  * parse feed and send feed items to database
  */
 public function index()
 {
     // Max number of feeds to keep
     $max_feeds = 100;
     // Today's Date
     $today = strtotime('now');
     // Get All Feeds From DB
     $feeds = ORM::factory('feed')->find_all();
     foreach ($feeds as $feed) {
         $last_update = $feed->feed_update;
         // Parse Feed URL using Feed Helper
         $feed_data = feed::simplepie($feed->feed_url);
         foreach ($feed_data->get_items(0, 50) as $feed_data_item) {
             $title = $feed_data_item->get_title();
             $link = $feed_data_item->get_link();
             $description = $feed_data_item->get_description();
             $date = $feed_data_item->get_date();
             $latitude = $feed_data_item->get_latitude();
             $longitude = $feed_data_item->get_longitude();
             $categories = $feed_data_item->get_categories();
             // HT: new code
             $category_ids = new stdClass();
             // HT: new code
             // Make Sure Title is Set (Atleast)
             if (isset($title) && !empty($title)) {
                 // We need to check for duplicates!!!
                 // Maybe combination of Title + Date? (Kinda Heavy on the Server :-( )
                 $dupe_count = ORM::factory('feed_item')->where('item_title', $title)->where('item_date', date("Y-m-d H:i:s", strtotime($date)))->count_all();
                 if ($dupe_count == 0) {
                     // Does this feed have a location??
                     $location_id = 0;
                     // STEP 1: SAVE LOCATION
                     if ($latitude and $longitude) {
                         $location = new Location_Model();
                         $location->location_name = "Unknown";
                         $location->latitude = $latitude;
                         $location->longitude = $longitude;
                         $location->location_date = date("Y-m-d H:i:s", time());
                         $location->save();
                         $location_id = $location->id;
                     }
                     $newitem = new Feed_Item_Model();
                     $newitem->feed_id = $feed->id;
                     $newitem->location_id = $location_id;
                     $newitem->item_title = $title;
                     if (isset($description) and !empty($description)) {
                         $newitem->item_description = $description;
                     }
                     if (isset($link) and !empty($link)) {
                         $newitem->item_link = $link;
                     }
                     if (isset($date) and !empty($date)) {
                         $newitem->item_date = date("Y-m-d H:i:s", strtotime($date));
                     } else {
                         $newitem->item_date = date("Y-m-d H:i:s", time());
                     }
                     // HT: new code
                     if (!empty($categories)) {
                         foreach ($categories as $category) {
                             $categoryData = ORM::factory('category')->where('category_title', $category->term)->find();
                             if ($categoryData->loaded == TRUE) {
                                 $category_ids->feed_item_category[$categoryData->id] = $categoryData->id;
                             } elseif (Kohana::config('settings.allow_feed_category')) {
                                 $newcategory = new Category_Model();
                                 $newcategory->category_title = $category->term;
                                 $newcategory->parent_id = 0;
                                 $newcategory->category_description = $category->term;
                                 $newcategory->category_color = '000000';
                                 $newcategory->category_visible = 0;
                                 $newcategory->save();
                                 $category_ids->feed_item_category[$newcategory->id] = $newcategory->id;
                             }
                         }
                     }
                     // HT: End of new code
                     $newitem->save();
                     // HT: New code
                     if (!empty($category_ids->feed_item_category)) {
                         feed::save_category($category_ids, $newitem);
                     }
                     // HT: End of New code
                     // Action::feed_item_add - Feed Item Received!
                     Event::run('ushahidi_action.feed_item_add', $newitem);
                 }
             }
         }
         // Get Feed Item Count
         $feed_count = ORM::factory('feed_item')->where('feed_id', $feed->id)->count_all();
         if ($feed_count > $max_feeds) {
             // Excess Feeds
             $feed_excess = $feed_count - $max_feeds;
         }
         // Set feed update date
         $feed->feed_update = strtotime('now');
         $feed->save();
     }
 }
开发者ID:Dirichi,项目名称:Ushahidi_Web,代码行数:100,代码来源:s_feeds.php


注:本文中的feed类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。