18 require_once SQ_CORE_PACKAGE_PATH.
'/../include/asset.inc';
19 require_once SQ_CORE_PACKAGE_PATH.
'/data_source/data_source/data_source.inc';
20 require_once SQ_LIB_PATH.
'/html_form/html_form.inc';
46 parent::__construct($assetid);
61 $allowed_link[
'asset'][
'card'] =
'M';
62 $allowed_link[
'asset'][
'exclusive'] = FALSE;
64 $links[SQ_LINK_TYPE_1] = $allowed_link;
65 $links[SQ_LINK_TYPE_2] = $allowed_link;
66 $links[SQ_LINK_TYPE_3] = $allowed_link;
67 $links[SQ_LINK_NOTICE] = $allowed_link;
82 $GLOBALS[
'SQ_SYSTEM']->pm->startTimer($this);
84 $url = $this->
attr(
'url');
87 $result = parent::getResultSet($url);
90 if (isset($this->_tmp[$url])) {
91 $result = $this->_tmp[$url];
93 if (empty($result)) $result = $this->
getItems();
94 if (!empty($result)) {
95 parent::setResultSet($result, $url);
96 $this->_tmp[$url] = $result;
100 $GLOBALS[
'SQ_SYSTEM']->pm->stopTimer($this);
114 $new_result = Array();
116 if (!$result)
return Array();
118 $feed_reader = $this->reader;
119 $result = $feed_reader->getItems();
120 $type = $feed_reader->getRssType();
121 foreach ($result as $index => $info) {
122 foreach ($info as $tag => $val_array) {
125 if ($type ==
'atom_1.0') {
126 if (isset($val_array[
'value'])) {
129 $new_result[$index][
'description'] = $val_array[
'value'];
132 $new_result[$index][
'title'] = $val_array[
'value'];
137 if ($tag !=
'link') {
138 if (isset($val_array[
'value'])) {
139 $new_result[$index][$tag] = $val_array[
'value'];
142 if ($type ==
'atom_1.0') {
143 $new_result[$index][$tag] = $val_array[
'_attributes'][
'HREF'];
145 if (isset($val_array[
'_attributes'])) {
146 $attributes = $val_array[
'_attributes'];
147 foreach ($attributes as $attr => $value) {
148 $new_result[$index][$tag.
'_'.strtolower($attr)] = $value;
151 $new_result[$index][$tag] = $val_array[
'value'];
157 $date_f = substr($this->
attr(
'date_field'), strlen(
'ds__'));
158 if (!empty($date_f)) {
159 if (isset($info[$date_f])) {
160 $date_string = $info[$date_f][
'value'];
161 if ($type ==
'rss_2.0') {
163 $timestamp = strtotime($date_string);
166 $timestamp = iso8601_ts($date_string);
169 $new_result[$index][
'timestamp'] = $timestamp;
196 $keywords = parent::getAvailableKeywords();
197 $keywords[
'data_source_rss_channelInfo'] = translate(
'rss_channel_info');
198 $keywords[
'data_source_rss_imageInfo'] = translate(
'rss_image_info');
199 $keywords[
'data_source_rss_rss_type'] = translate(
'rss_type');
200 $keywords[
'data_source_rss_textinput'] = translate(
'rss_text_input');
201 $keywords[
'data_source_rss_items'] = translate(
'rss_items');
215 $url = $this->
attr(
'url');
216 require_once SQ_FUDGE_PATH.
'/rss_feeds/rss_feed_reader.inc';
218 $this->reader = $feed_reader;
220 if ($feed_reader->setInputFile($url)) {
221 $result = $feed_reader->parse();
244 if (strpos( $keyword,
'data_source_rss') === FALSE) {
245 $replacement = parent::getKeywordReplacement($keyword);
247 $keyword = substr($keyword, strlen(
'data_source_rss_'));
248 if (!empty($keyword)) {
250 $reader = $this->reader;
251 $function =
'get'.ucwords($keyword);
252 $result = $reader->{$function}();
254 if (is_array($result)) {
255 foreach ($result as $index => $info) {
256 foreach ($info as $tag => $val_array) {
257 if ($tag !=
'link') {
258 if (isset($val_array[
'value'])) {
259 $replacement[$index][$tag] = $val_array[
'value'];
262 if (isset($val_array[
'_attributes'])) {
263 $attributes = $val_array[
'_attributes'];
264 foreach ($attributes as $attr => $value) {
265 $replacement[$index][$tag.
'_'.strtolower($attr)] = $value;
268 $replacement[$index][$tag] = $val_array[
'value'];
277 foreach ($replacement as $replace) {
278 foreach ($replace as $key => $value) {
281 <td><?php echo $key;?></td>
282 <td><?php echo $value;?></td>
290 $replacement = ob_get_contents();
293 $replacement = $result;