[ Index ] |
PHP Cross Reference of phpwcms V1.5.0 _r431 (28.01.12) |
[Summary view] [Print] [Text view]
1 <?php 2 /************************************************************************************* 3 Copyright notice 4 5 (c) 2002-2012 Oliver Georgi <oliver@phpwcms.de> // All rights reserved. 6 7 This script is part of PHPWCMS. The PHPWCMS web content management system is 8 free software; you can redistribute it and/or modify it under the terms of 9 the GNU General Public License as published by the Free Software Foundation; 10 either version 2 of the License, or (at your option) any later version. 11 12 The GNU General Public License can be found at http://www.gnu.org/copyleft/gpl.html 13 A copy is found in the textfile GPL.txt and important notices to the license 14 from the author is found in LICENSE.txt distributed with these scripts. 15 16 This script is distributed in the hope that it will be useful, but WITHOUT ANY 17 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A 18 PARTICULAR PURPOSE. See the GNU General Public License for more details. 19 20 This copyright notice MUST APPEAR in all copies of the script! 21 *************************************************************************************/ 22 23 // ---------------------------------------------------------------- 24 // obligate check for phpwcms constants 25 if (!defined('PHPWCMS_ROOT')) { 26 die("You Cannot Access This Script Directly, Have a Nice Day."); 27 } 28 // ---------------------------------------------------------------- 29 30 // RSS feed 31 32 //$CNT_TMP .= headline($crow["acontent_title"], $crow["acontent_subtitle"], $template_default["article"]); 33 34 if( !empty($crow["acontent_form"]) && is_string($crow["acontent_form"]) ) { 35 $rssfeed = unserialize($crow["acontent_form"]); 36 } elseif( empty($rssfeed) || !is_array($rssfeed) ) { 37 $rssfeed = array(); 38 } 39 40 // Feed 41 if( isset($rssfeed['rssurl']) && !empty($rssfeed['rssurl']) ) { 42 43 if( empty($rssfeed['template']) || !is_file(PHPWCMS_TEMPLATE.'inc_cntpart/rssfeed/'.$rssfeed['template']) ) { 44 $rssfeed['template'] = render_device( @file_get_contents(PHPWCMS_TEMPLATE.'inc_default/rssfeed.tmpl') ); 45 } else { 46 $rssfeed['template'] = render_device( @file_get_contents(PHPWCMS_TEMPLATE.'inc_cntpart/rssfeed/'.$rssfeed['template']) ); 47 } 48 if(!$rssfeed['template']) { 49 50 $rssfeed['template'] = '<!--ITEM_START//--><p><a href="{LINK}" target="_blank">{TITLE}</a></p><!--ITEM_END//--> 51 <!--DIVIDER_START//--><div style="padding:0;margin:0;border-top:1px dotted #B2B2B2;height:1px;overflow:hidden;"><img src="img/leer.gif" width="1" height="1" alt="" /></div><!--DIVIDER_END//--> 52 <!--FEEDINFO_START//--><p style="margin-left:3px;margin-bottom:8px;">{IMAGE}</p><!--FEEDINFO_END//--> 53 <!--RSSFEED_START//-->[TITLE]<h3>{TITLE}</h3>[/TITLE][SUBTITLE]<h4>{SUBTITLE}</h4>[/SUBTITLE]<div>{FEEDINFO}{ITEMS}</div><!--RSSFEED_END//-->'; 54 55 } 56 57 // Get Template 58 $rss['template_ITEM'] = get_tmpl_section('ITEM', $rssfeed['template']); 59 $rss['template_DIVIDER'] = get_tmpl_section('DIVIDER', $rssfeed['template']); 60 $rss['template_FEEDINFO'] = get_tmpl_section('FEEDINFO', $rssfeed['template']); 61 $rss['template_RSSFEED'] = get_tmpl_section('RSSFEED', $rssfeed['template']); 62 63 // fallback for mb_convert_encoding() 64 if(!function_exists('iconv') && !function_exists('mb_convert_encoding')) { 65 66 function mb_convert_encoding($string='', $out_charset='utf-8', $in_charset='utf-8') { 67 if(strtolower($in_charset) == 'utf-16be') { 68 $in_charset = 'utf-8'; 69 } 70 if(strtolower($out_charset) == 'utf-16be') { 71 $out_charset = 'utf-8'; 72 } 73 return makeCharsetConversion($string, $in_charset, $out_charset); 74 } 75 76 } 77 78 // Load SimplePie 79 require_once (PHPWCMS_ROOT.'/include/inc_ext/SimplePie/simplepie.inc.php'); 80 //require_once(PHPWCMS_ROOT.'/include/inc_ext/SimplePie/idn/idna_convert.class.php'); 81 82 $rss_obj = new SimplePie(); 83 84 //$CNT_TMP .= dumpVar($rssfeed['rssurl'], 2); 85 86 // Feed URL 87 $rss_obj->set_feed_url( $rssfeed['rssurl'] ); 88 89 // Output Encoding Charset 90 $rss_obj->set_output_encoding( PHPWCMS_CHARSET ); 91 92 // Input Encoding Charset 93 if(!empty($rssfeed['content_type'])) { 94 $rss_obj->set_input_encoding( $rssfeed['content_type'] ); 95 } 96 97 98 // Feed Cache Timeout 99 if(!$rssfeed["timeout"]) { 100 // set to default value = 3600 seconds = 1 hour 101 $rssfeed["timeout"] = 3600; 102 } 103 if($rssfeed["cacheoff"]) { 104 // check if cache enabled or not 105 $rssfeed["timeout"] = 0; 106 } 107 108 if($rssfeed["timeout"]) { 109 110 $rss_obj->enable_cache( true ); 111 $rss_obj->set_cache_duration ( $rssfeed["timeout"] ); 112 $rss_obj->set_cache_location ( PHPWCMS_RSS ); 113 114 } else { 115 116 $rss_obj->enable_cache( false ); 117 118 } 119 120 //$rss_obj->enable_cache( false ); 121 122 // Remove surrounding DIV 123 $rss_obj->remove_div( true ); 124 125 // Strip all HTML Tags 126 $rss_obj->strip_htmltags( true ); 127 128 // Limit items 129 if($rssfeed["item"]) { 130 $rss_obj->set_item_limit( $rssfeed["item"] ); 131 } 132 133 // Init Feed 134 $rss_obj->init(); 135 136 /* 137 if($rss_obj->error()) { 138 139 $CNT_TMP .= $rss_obj->error(); 140 141 } 142 */ 143 144 if( $rss_obj->data ) { 145 146 // check RSS image 147 if( $rss_obj->get_image_url() ) { 148 149 $rss['temp_feedinfo'] = '<a href="'. ( $rss_obj->get_image_link() ? $rss_obj->get_image_link() : $rss_obj->get_permalink() ) .'" target="_blank">'; 150 $rss['temp_feedinfo'] .= '<img src="' . $rss_obj->get_image_url() . '" border="0" alt="' . $rss_obj->get_image_title() . '" />'; 151 $rss['temp_feedinfo'] .= '</a>'; 152 153 $rss['template_FEEDINFO'] = render_cnt_template($rss['template_FEEDINFO'], 'IMAGE', $rss['temp_feedinfo']); 154 155 } else { 156 157 $rss['template_FEEDINFO'] = render_cnt_template($rss['template_FEEDINFO'], 'IMAGE', ''); 158 159 } 160 161 $rss['template_FEEDINFO'] = render_cnt_template($rss['template_FEEDINFO'], 'TITLE', $rss_obj->get_title()); 162 $rss['template_FEEDINFO'] = render_cnt_template($rss['template_FEEDINFO'], 'DESCRIPTION', $rss_obj->get_description()); 163 164 165 $c = 0; 166 $rss['items'] = array(); 167 168 foreach($rss_obj->get_items() as $rssvalue) { 169 170 // general item info 171 $rss['items'][$c] = render_cnt_template($rss['template_ITEM'], 'LINK', $rssvalue->get_permalink() ); 172 $rss['items'][$c] = render_cnt_template($rss['items'][$c], 'TITLE', $rssvalue->get_title() ); 173 $rss['items'][$c] = render_cnt_template($rss['items'][$c], 'DESCRIPTION', $rssvalue->get_description() ); 174 $rss['items'][$c] = render_cnt_template($rss['items'][$c], 'CONTENT', $rssvalue->get_content() ); 175 176 // author 177 $rss['item_author'] = $rssvalue->get_author(); 178 $rss['items'][$c] = render_cnt_template($rss['items'][$c], 'AUTHOR', $rss['item_author'] ? $rss['item_author']->get_name() : '' ); 179 180 // item date 181 $rss['items'][$c] = render_cnt_date($rss['items'][$c], $rssvalue->get_date('U') ); 182 183 $c++; 184 185 if($rssfeed["item"] && $rssfeed["item"] == $c) { 186 187 break; 188 189 } 190 } 191 192 // whole rss feed 193 $rss['template_RSSFEED'] = render_cnt_template($rss['template_RSSFEED'], 'TITLE', html_entities($crow['acontent_title']) ); 194 $rss['template_RSSFEED'] = render_cnt_template($rss['template_RSSFEED'], 'SUBTITLE', html_entities($crow['acontent_subtitle']) ); 195 $rss['template_RSSFEED'] = render_cnt_template($rss['template_RSSFEED'], 'ITEMS', implode( LF , $rss['items'] ) ); 196 $rss['template_RSSFEED'] = str_replace('{FEEDINFO}', $rss['template_FEEDINFO'], $rss['template_RSSFEED']); 197 $rss['template_RSSFEED'] = render_cnt_template($rss['template_RSSFEED'], 'LINK', $rss_obj->get_permalink() ); 198 $rss['template_RSSFEED'] = str_replace('{DIVIDER}', $rss['template_DIVIDER'], $rss['template_RSSFEED']); 199 200 $CNT_TMP .= $rss['template_RSSFEED']; 201 202 } 203 204 } 205 unset($rss, $rssfeed); 206 207 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Sun Jan 29 16:31:14 2012 | Cross-referenced by PHPXref 0.7.1 |