/[refeed]/trunk/library/RF/Feed.class.php
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /trunk/library/RF/Feed.class.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2 - (show annotations)
Wed Jul 5 00:27:49 2006 UTC (17 years, 10 months ago) by dpavlin
File size: 4486 byte(s)
make working copy of trunk
1 <?php
2 // vim: ts=4 foldcolumn=4 foldmethod=marker
3 /**
4 * RF_Feed class found here.
5 *
6 * This file is part of Reblog,
7 * a derivative work of Feed On Feeds.
8 *
9 * Distributed under the Gnu Public License.
10 *
11 * @package Refeed
12 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
13 * @author Michal Migurski <mike@stamen.com>
14 * @author Michael Frumin <mfrumin@eyebeam.org>
15 * @copyright ©2004 Michael Frumin, Michal Migurski
16 * @link http://reblog.org Reblog
17 * @link http://feedonfeeds.com Feed On Feeds
18 * @version $Revision: 1.31 $
19 */
20
21 /**
22 * RF_Feed is a model class for feed instances.
23 * Feeds are typically retrieved, manipulated, and stored by {@link RF_Controller RF_Controller}.
24 */
25 class RF_Feed
26 {
27 /**
28 * Feed database unique ID
29 * @var int
30 */
31 var $id;
32
33 /**
34 * Feed URL, i.e. the RSS file
35 * @var string
36 */
37 var $url;
38
39 /**
40 * Feed title
41 * @see http://feedparser.org/docs/reference-feed-title.html
42 * @var string
43 */
44 var $title;
45
46 /**
47 * Feed link, i.e. the human-readable homepage
48 * @see http://feedparser.org/docs/reference-feed-link.html
49 * @var string
50 */
51 var $link;
52
53 /**
54 * Feed description
55 * @see http://feedparser.org/docs/reference-feed-tagline.html
56 * @var string
57 */
58 var $description;
59
60 /**
61 * Various per-user usage statistics, e.g. count of new items
62 * @var array
63 */
64 var $usage;
65
66 /**
67 * Flag: 1 means published, 0 means not
68 * @var int
69 */
70 var $published;
71
72 /**
73 * Associative array of metadata associated with feed
74 * @var array
75 */
76 var $metadata = array();
77
78
79 /**
80 * XML source for channel information
81 * @var string
82 */
83 var $xml;
84 /**
85 * @param array $args Associative of array of new feed properties;
86 * Only those found in RF_Feed propertyNames() are assigned.
87 * If specified, "id" must be numeric.
88 * @uses RF_Feed::propertyNames()
89 */
90 function RF_Feed($args)
91 {
92 foreach(array_keys(get_class_vars(get_class($this))) as $p)
93 if(isset($args[$p]))
94 $this->$p = $args[$p];
95
96 if(isset($this->id) && !is_numeric($this->id))
97 die("'{$this->id}' is not a valid feed ID, because it is not a number.");
98 }
99
100 /**
101 * @return int Feed's ID
102 * @uses RF_Feed::$id
103 */
104 function getID() { return $this->id; }
105
106 /**
107 * @param int $id Feed's ID
108 * @uses RF_Feed::$id
109 */
110 function setID($id) { $this->id = $id; }
111
112 /**
113 * @return string Name of database feeds table, from REBLOG_FEEDS_TABLE constant
114 * @uses REBLOG_FEEDS_TABLE Returned as a table name for feeds
115 */
116 function tableName()
117 {
118 if(defined('REBLOG_FEEDS_TABLE'))
119 return REBLOG_FEEDS_TABLE;
120
121 // old-style configuration vars
122 if(defined('REF_FEEDS_TABLE'))
123 return REF_FEEDS_TABLE;
124
125 return '';
126 }
127
128 /**
129 * @return string Name of database feeds userdata table, from REBLOG_FEEDS_USERDATA_TABLE constant
130 * @uses REBLOG_FEEDS_USERDATA_TABLE Returned as a table name for feeds userdata
131 */
132 function userdataTableName()
133 {
134 if(defined('REBLOG_FEEDS_USERDATA_TABLE'))
135 return REBLOG_FEEDS_USERDATA_TABLE;
136
137 // old-style configuration vars
138 if(defined('REF_FEEDS_USERDATA_TABLE'))
139 return REF_FEEDS_USERDATA_TABLE;
140
141 return '';
142 }
143
144 /**
145 * @return array Associative array of column names and values for feeds table
146 */
147 function columnNamesValues()
148 {
149 return array('url' => $this->url,
150 'title' => $this->title,
151 'link' => $this->link,
152 'description' => $this->description,
153 'xml' => $this->xml);
154 }
155 }
156
157 ?>

  ViewVC Help
Powered by ViewVC 1.1.26