Browse Source

Use feed names coming from OPML

Use the feed names (text or title) provided by OPML and do not overwrite
them during import.
Alexandre Alapetite 12 năm trước cách đây
mục cha
commit
0696890c06
2 tập tin đã thay đổi với 9 bổ sung1 xóa
  1. 2 0
      app/models/Feed.php
  2. 7 1
      lib/lib_rss.php

+ 2 - 0
app/models/Feed.php

@@ -200,8 +200,10 @@ class Feed extends Model {
 					}
 					}
 					$this->_url ($subscribe_url);
 					$this->_url ($subscribe_url);
 				}
 				}
+				if (empty($this->name)) {	// May come from OPML
 				$title = $feed->get_title ();
 				$title = $feed->get_title ();
 				$this->_name (!is_null ($title) ? $title : $this->url);
 				$this->_name (!is_null ($title) ? $title : $this->url);
+				}
 				$this->_website ($feed->get_link ());
 				$this->_website ($feed->get_link ());
 				$this->_description ($feed->get_description ());
 				$this->_description ($feed->get_description ());
 
 

+ 7 - 1
lib/lib_rss.php

@@ -133,9 +133,15 @@ function getFeedsOutline ($outline, $cat_id) {
 
 
 function getFeed ($outline, $cat_id) {
 function getFeed ($outline, $cat_id) {
 	$url = (string) $outline['xmlUrl'];
 	$url = (string) $outline['xmlUrl'];
+	$title = '';
+	if (isset ($outline['text'])) {
+		$title = (string) $outline['text'];
+	} elseif (isset ($outline['title'])) {
+		$title = (string) $outline['title'];
+	}
 	$feed = new Feed ($url);
 	$feed = new Feed ($url);
 	$feed->_category ($cat_id);
 	$feed->_category ($cat_id);
-
+	$feed->_name ($title);
 	return $feed;
 	return $feed;
 }
 }