Changeset 664524
- Timestamp:
- 02/06/2013 08:37:21 PM (13 years ago)
- Location:
- feedlist/trunk/feedList
- Files:
-
- 3 edited
-
feedlist.php (modified) (21 diffs)
-
handler_image.php (modified) (1 diff)
-
readme.txt (modified) (18 diffs)
Legend:
- Unmodified
- Added
- Removed
-
feedlist/trunk/feedList/feedlist.php
r487789 r664524 6 6 Author: Bill Rawlinson 7 7 Author URI: http://blog.rawlinson.us/ 8 Version: 2. 61.038 Version: 2.70.00 9 9 */ 10 10 … … 21 21 $relroot = ABSPATH . '/'; 22 22 require_once('feedListExtensions.php'); 23 23 24 24 25 25 … … 44 44 // end 45 45 46 47 46 47 48 48 class FeedList { 49 49 var $dateFormat = "F j, Y, g:i a"; … … 105 105 $feedUrl = trim($urlAndTitle[0]); 106 106 $feedTitle = trim($urlAndTitle[1]); 107 107 108 108 $this->rs = $this->GetFeed($feedUrl); 109 109 … … 122 122 if($this->args['show_date']){ 123 123 $this->output .= '<div class="feedDate">updated: '. 124 $this->NormalizeDate($this->rs) . '</div>'; 124 $this->NormalizeDate($this->rs) . '</div>'; 125 125 // fl_tz_convert($this->rs->last_modified,0,Date('I')).'</div>'; 126 126 } … … 138 138 if($this->args['mergeFeeds']){ 139 139 $this->output.=$this->Draw($feed,$this->args); 140 } 141 140 } 141 142 142 $this->output .= '</ul>'; 143 143 … … 178 178 $connectionTimeout = 15; // 15 seconds is default 179 179 $showRSSLinkListJS = true; 180 180 181 181 $Language = 'en_US'; // Choose your language (from the available languages below,in the translations): 182 183 182 183 184 184 $Translations = array(); // Please send in your suggestions/translations: 185 185 … … 195 195 $Translations['fr_FR'] = array(); 196 196 $Translations['fr_FR']['ReadMore'] = 'Lisez davantage'; 197 197 198 198 $feedListFile = ABSPATH . 'wp-content\plugins\feeds.txt'; // IF you are going to use the random feedlist generator make sure this holds the correct name for your feed file: 199 199 … … 239 239 'language'=> $settings['language'] 240 240 ); 241 241 242 242 } 243 243 /* end basic settings */ … … 313 313 $thisDescription = $item['content']['encoded']; 314 314 } 315 315 316 316 // Handle max_characters and max_char_wordbreak before the htmlentities makes it more complicated: 317 317 if (!empty($this->args['max_characters']) && is_numeric($this->args['max_characters'])) … … 327 327 $thisDescription = substr($thisDescription, 0, $max_char_pos); 328 328 } 329 } 330 331 } else if ($encoding) { 329 } 330 331 } else if ($encoding) { 332 332 //further really weak attempt at internationalization 333 333 $thisDescription = html_entity_decode($thisDescription, ENT_QUOTES, "UTF-8"); … … 338 338 $linkTitle = str_replace(array("\n", "\t", '"'), array('', '', "'"), $linkTitle); 339 339 $linkTitle = substr($linkTitle, 0, 300); 340 340 341 341 // if we are only showing the description we don't need the separator.. 342 342 if (strlen(trim($thisDescription)) && !$this->args['show_description_only']) … … 444 444 } 445 445 return $newItems; 446 } 446 } 447 447 448 448 function NormalizeDate($item){ … … 464 464 function TimezoneConvert($datetime,$tz_from,$tz_to,$format='d M Y h:ia T'){ 465 465 return date($format,strtotime($datetime)+(3600*($tz_to - $tz_from))); 466 } 466 } 467 467 468 468 function MakeNumericOnly($val){ … … 507 507 array_multisort($sortByLower, $sort[1], $sort[2], $this->items); 508 508 } 509 509 510 510 return $this->items; 511 511 } 512 512 513 513 function LoadFile($file){ 514 /* 514 /* 515 515 load the $feedListFile contents into an array, using the --NEXT-- text as 516 516 a delimeter between feeds and a tilde (~) between URL and TITLE … … 524 524 $a = array(); 525 525 foreach($this->args as $d=>$v){ 526 if($this->args[$d] === 'true') { 526 if($this->args[$d] === 'true') { 527 527 $a[$d] = 1; 528 528 }else if($this->args[$d] === 'false'){ … … 571 571 } 572 572 return $this->feed; 573 573 574 574 } 575 575 … … 649 649 return $feed->FeedListFile(); 650 650 } 651 651 652 652 function feedListFilter($args){ 653 653 $args = explode(",",$args[1]); … … 707 707 708 708 709 709 710 710 if(function_exists('register_deactivation_hook')) 711 711 { 712 register_deactivation_hook(__FILE__, 'cleanupFeedlistCache'); 712 register_deactivation_hook(__FILE__, 'cleanupFeedlistCache'); 713 713 } 714 714 … … 720 720 721 721 722 if(function_exists('add_action')) { 723 function rssLinkList_JS(){ 724 725 $jsstring = '<script type="text/javascript"><!-- 726 727 function addEvent(elm, evType, fn, useCapture) 728 // addEvent and removeEvent 729 // cross-browser event handling for IE5+, NS6 and Mozilla 730 // By Scott Andrew 731 { 732 if (elm.addEventListener){ 733 elm.addEventListener(evType, fn, useCapture); 734 return true; 735 } else if (elm.attachEvent){ 736 var r = elm.attachEvent("on"+evType, fn); 737 return r; 738 } else { 739 // alert("Handler could not be removed"); 740 } 741 } 742 function externalLinks() { 743 if (!document.getElementsByTagName) return; 744 var anchors = document.getElementsByTagName("a"); 722 if(function_exists('add_action')) { 723 function rssLinkList_JS(){ 724 725 $jsstring = '<script type="text/javascript"><!-- 726 727 function addEvent(elm, evType, fn, useCapture) 728 // addEvent and removeEvent 729 // cross-browser event handling for IE5+, NS6 and Mozilla 730 // By Scott Andrew 731 { 732 if (elm.addEventListener){ 733 elm.addEventListener(evType, fn, useCapture); 734 return true; 735 } else if (elm.attachEvent){ 736 var r = elm.attachEvent("on"+evType, fn); 737 return r; 738 } else { 739 // alert("Handler could not be removed"); 740 } 741 } 742 function externalLinks() { 743 if (!document.getElementsByTagName) return; 744 var anchors = document.getElementsByTagName("a"); 745 745 var newwindows =0; 746 for (var i=0; i<anchors.length; i++) { 747 var anchor = anchors[i]; 746 for (var i=0; i<anchors.length; i++) { 747 var anchor = anchors[i]; 748 748 if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "external") { 749 anchor.setAttribute("target","_blank"); 749 anchor.setAttribute("target","_blank"); 750 750 newwindows++; 751 751 } 752 } 753 } 754 755 addEvent(window, "load", externalLinks); 756 757 //--> 758 </script> 759 '; 760 761 762 echo $jsstring; 752 } 753 } 754 755 addEvent(window, "load", externalLinks); 756 757 //--> 758 </script> 759 '; 760 761 762 echo $jsstring; 763 763 } 764 764 … … 766 766 $jsFeed = new FeedList(''); 767 767 $settings = $jsFeed->GetSettings(); 768 769 if($settings["showRSSLinkListJS"]){ 770 add_action('wp_head', 'rssLinkList_JS'); 771 } 768 769 if($settings["showRSSLinkListJS"]){ 770 add_action('wp_head', 'rssLinkList_JS'); 771 } 772 772 } 773 774 773 774 775 775 ?> -
feedlist/trunk/feedList/handler_image.php
r305767 r664524 3 3 4 4 require_once('simplepie.inc'); 5 SimplePie_Misc::display_cached_file( $_GET['i'], '../../cache', 'spi');5 SimplePie_Misc::display_cached_file(SimplePie_Sanitize::sanitize($_GET['i'],SIMPLEPIE_CONSTRUCT_IRI), '../../cache', 'spi'); 6 6 ?> -
feedlist/trunk/feedList/readme.txt
r664275 r664524 5 5 Requires at least: 1.5 6 6 Tested up to: 3.3 (php 5.3.5) 7 Stable tag: 2. 61.037 Stable tag: 2.70.00 8 8 License: GPLv2 or later (same as wordpress uses). Truth be told I don't really understand all of the different open source licenseing options. See the Description for more info. 9 9 … … 38 38 UPGRADING: 39 39 40 1.) jot down your configuration information in feedList.php 40 1.) jot down your configuration information in feedList.php 41 41 42 42 2.) Overwrite your feedlist.php file … … 55 55 56 56 == Change Log == 57 DATE MODIFICATION 57 DATE MODIFICATION 58 58 AUTHOR 59 59 ------------------------------------------------------------------------------------------------------- 60 12 October 2005 Initial Version 60 12 October 2005 Initial Version 61 61 Bill Rawlinson - released version 2.0B 62 rewrite of rssLinkedList NOTE a 63 major change - the caching is handled 64 by Wordpress now so you don't need a 62 rewrite of rssLinkedList NOTE a 63 major change - the caching is handled 64 by Wordpress now so you don't need a 65 65 cache directory. 66 66 … … 68 68 06 Nov 2005 Simplified Interface and Rewrite Docs 69 69 70 15 Nov 2005 Fixed some bugs 70 15 Nov 2005 Fixed some bugs 71 71 72 72 01 Dec 2005 Fixed a bug where the description wasn't being shown for atom feeds … … 109 109 110 110 29 Oct 2010 Made the language option request specific while keeping the global setting as the default choice 111 111 112 112 09 Jan 2012 Fixed mistake that was causing eof error when php demands <?php instead of just a <? on line 37 113 113 114 114 10 Jan 2012 prior tag was broken.. need to fix directory structure. 115 116 06 Feb 2013 Fix security vulnerability that allowed potential cross site scripting attack http://secunia.com/advisories/42197/ 115 117 ------------------------------------------------------------------------------------------------------- 116 118 117 119 == LICENSE == 118 This program is free software; you can redistribute it and/or 119 modify it under the terms of the GNU General Public License 120 (GPL) as published by the Free Software Foundation; either 121 version 2 of the License, or (at your option) any later 120 This program is free software; you can redistribute it and/or 121 modify it under the terms of the GNU General Public License 122 (GPL) as published by the Free Software Foundation; either 123 version 2 of the License, or (at your option) any later 122 124 version. 123 125 124 126 125 127 == POTENTIAL ISSUES == 126 May not handle internationalization very well. Has seen very 128 May not handle internationalization very well. Has seen very 127 129 limited testing with non UTF-8 encoding. 128 130 … … 132 134 133 135 == USAGE == 134 From anywhere in your WordPress template, call the function 135 "feedList(...)", which takes the following parameters (all 136 From anywhere in your WordPress template, call the function 137 "feedList(...)", which takes the following parameters (all 136 138 parameters have default values) you can pass in either a named array of parameters or 137 139 pass the parameters in order as follows: … … 142 144 * show_description (default: true) - Whether or not to display the "description" field 143 145 * random (default: false) - Whether or not to randomize the items 144 * before (default: "<li>") - Tag placed before the item 145 * after (default: "</li>") - Tag placed after the item 146 * before (default: "<li>") - Tag placed before the item 147 * after (default: "</li>") - Tag placed after the item 146 148 * description_separator (default: " - ") - Between the link and the item 147 149 * encoding (default: false) - Change to true if you are reading in a ISO-8859-1 formatted file. Basically, if you see a bunch of question marks (?) in your titles set this to true and see if it fixes the problem. … … 172 174 "additional_fields"=>'summary~dc.subject' 173 175 ) 174 176 175 177 In this example the list of fields is summary and dc.subject - dc.subject drills down into the rss structure to reach the node <item><dc><subject></subject></dc></title> - del.icio.us currently exports the list of tags 176 178 in the dc.subject field. … … 179 181 180 182 * max_char_wordbreak - Used only if max_characters is NOT 0. Prevent breaking up words. 181 true - we cut on the last space before max_characters. 183 true - we cut on the last space before max_characters. 182 184 false - cuts right at the max_characters point 183 185 … … 193 195 nl_NL - Dutch [shows, lees verder] 194 196 en_US - US English [shows, Read more...] 195 197 196 198 FILTER USAGE 197 199 198 200 * basic: 199 <!--rss:[URL]--> 201 <!--rss:[URL]--> 200 202 201 203 NOTE if you aren't using named parameters with the fitler then ONLY provide the url after the rss: or else it won't work. Left as rss: for backwards compatability but will work with ATOM feeds as well. … … 204 206 <!--rss:rss_feed_url:=http://del.icio.us/rss/finalcut/wishlist,num_items:=5,random:=true--> 205 207 206 NOTE when using the filter and named parameters ALL parameters including the URL must be named. Also note that if you are providing different HTML for the before or after parameter you must escape it. For instance if you want before='<li>' then you must pass before='<li>' 208 NOTE when using the filter and named parameters ALL parameters including the URL must be named. Also note that if you are providing different HTML for the before or after parameter you must escape it. For instance if you want before='<li>' then you must pass before='<li>' 207 209 208 210 Finally note the whole thing must be on ONE line. No line breaks or else it won't work. … … 214 216 NOTE: if you aren't using named parameters with the filter only provide the full path to the file or else it won't work. 215 217 NOTE: if you don't provide a filepath the default one set in the file, feedlist.php near line 187 will be used (typically siteroot\wp-content\plugins\feeds.txt) 216 218 217 219 * Named Parameters 218 220 <!--rssFile:feedsToShow:=1,num_items:=3,file:=c:\dev\websites\wordpress\wp-content\plugins\feeds2.txt--> … … 225 227 NAMED PARAMETER EXAMPLE -- PREFERRED METHOD 226 228 <ol> 227 <?php 229 <?php 228 230 feedList(array("rss_feed_url"=>"http://www.auf-der-hoehe.de/index.php?id=23&type=333&feed_id=71&no_cache=1", 229 231 "num_items"=>10, … … 234 236 "show_date"=>true 235 237 ) 236 ); 238 ); 237 239 ?> 238 240 </ol> … … 240 242 BASIC 241 243 <ol> 242 <?php 243 feedList("http://del.icio.us/rss/finalcut"); 244 <?php 245 feedList("http://del.icio.us/rss/finalcut"); 244 246 ?> 245 247 </ol> … … 253 255 254 256 <ol> 255 <?php 256 feedList("http://del.icio.us/rss/finalcut"); 257 <?php 258 feedList("http://del.icio.us/rss/finalcut"); 257 259 feedList("http://www.43things.com/rss/uber/author?username=FinalCut"); 258 260 ?> … … 301 303 302 304 303 ADVANCED: 305 ADVANCED: 304 306 <?php randomFeedList("feedsToShow=2&num_items=3") ?> 305 307 306 308 there are ALOT of parameters you can pass into randomFeedList. I am taking a different approach to it here than I do elsewhere in the feedList plugin. 307 If you want to pass parameters they must be passed in as shown separating each additional name/value pair with an ampersand &. 308 309 309 If you want to pass parameters they must be passed in as shown separating each additional name/value pair with an ampersand &. 310 311 310 312 PARAMETERS 311 313 file - the path to your feedfile (default: '.wp-content/plugins/feeds.txt') … … 326 328 327 329 328 330 329 331 CRAZY ADVANCED CALLING: 330 332
Note: See TracChangeset
for help on using the changeset viewer.