Ejemplo n.º 1
0
 private function createRss($arSort = NULL)
 {
     $items = array();
     $lenta = $this->getAllRssItems($arSort);
     if (!empty($lenta["items"])) {
         foreach ($lenta["items"] as $item) {
             if (!$this->rss_list[$item["rss_id"]]) {
                 $this->rss_list[$item["rss_id"]] = RssClass::getById($item["rss_id"]);
             }
             $date_nf = $item["date"];
             $items[$item["id"]]["id"] = $item["id"];
             $items[$item["id"]]["title"] = $item["title"];
             $items[$item["id"]]["link"] = $item["link"];
             $items[$item["id"]]["date"] = $date_nf;
             $items[$item["id"]]["description"] = $item["description"];
             $items[$item["id"]]["audio"] = $item["audio"];
             $items[$item["id"]]["read"] = $item["read"];
             if ($this->rss_list[$item["rss_id"]]) {
                 $items[$item["id"]]["main_title"] = $this->rss_list[$item["rss_id"]]->getProperty("title");
                 $items[$item["id"]]["main_link"] = $this->rss_list[$item["rss_id"]]->getProperty("rss_url");
             }
         }
         $result["items"] = $items;
     } else {
         $result["message"] = "Вы не подписаны ни на одну ленту. Перейти в <a href='/personal/'>Личный кабинет</a>";
     }
     return $result;
 }
Ejemplo n.º 2
0
<?php

global $_USER;
$rss = RssClass::getByUserId($_USER->getProperty("id"));
$rssController = new RssController($rss->getProperty("url"), "rss/RssListChunk.php");
$rssController->printRss();
Ejemplo n.º 3
0
 public function insertRss($arParams)
 {
     $arFields = array("user_id" => $arParams["user_id"], "rss_url" => $arParams["rss_url"]);
     $this->insert("rss", $arFields);
     $fields = $this->select("rss", $arFields);
     if (!empty($fields)) {
         $rss = RssClass::getById($fields[0]["ID"]);
     } else {
         $rss = false;
     }
     return $rss;
 }
Ejemplo n.º 4
0
?>
">
	<p>
		<select name="select">
			  <option value="">-- select RSS</option>
			  <option value="http://rss.cnn.com/rss/cnn_world.rss">CNN</option>
			  <option value="http://feeds.reuters.com/Reuters/worldNews">Reuters</option>
			  <option value="posts.json">Local File</option>
		</select>
		<input type="submit" value="Select">
	</p>
</form>


<?php 
$RssClass = new RssClass();
$rssURL = $_POST['select'];
if ($rssURL) {
    $jfo = $RssClass->RSS($rssURL);
    // read the title value
    $title = $jfo->channel->title;
    $link = $jfo->channel->link;
    $description = $jfo->channel->description;
    $language = $jfo->channel->language;
    $pubDate = $RssClass->DateFormat($jfo->channel->pubDate);
    $image = $jfo->channel->image->url;
    // copy the posts array to a php var
    $items = $jfo->channel->item;
    ?>
	<div class="container">
		<p><img src="<?php