WordPress.org

Plugin Directory

Changeset 507906


Ignore:
Timestamp:
02/20/12 21:30:55 (2 years ago)
Author:
stefsoton
Message:

updating to version 0.6

Location:
rss-just-better/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • rss-just-better/trunk/RSS-just-better.php

    r417264 r507906  
    44 * Plugin URI: http://www.stefaniamarchisio.com/rss-just-better-plugin-for-wordpress/ 
    55 * Description: A customizable list of feed items given: URL and number of displayable items. It works as both widget and shortcode. Compatible with RSS vers. 0.91, 0.92 and 2.0 & Atom 1.0. 
    6  * Version: 0.5 
    7  * Author: Stef Marchisio 
     6 * Version: 0.6 
     7 * Author: Stefania Marchisio 
    88 * Author URI: http://stefaniamarchisio.com/about/ 
    99 * 
     
    1616This is a wordpress plugin compatible with wordpress 2.8+ as a widget; wordpress 2.5+ as shortcode. 
    1717 
    18 Copyright (C) 2010  Stefania Marchisio (email: mywizardwebs@gmail.com) 
     18Copyright (C) 2012  Stefania Marchisio (email: stefonthenet@gmail.com) 
    1919 
    2020This program is free software; you can redistribute it and/or 
     
    8181    $title = apply_filters('widget_title', $instance['title'] ); 
    8282    $feed = $instance['name']; 
     83    $cachefeed = $instance['cachefeed']; 
     84 
    8385    $filter = $instance['filter']; 
    8486 
     
    8688    $list = $instance['list']; 
    8789    $target= $instance['target']; 
     90 
    8891    /* Boolean vars */ 
    8992    $lkbtitle = isset( $instance['lkbtitle'] ) ? $instance['lkbtitle'] : false; 
     
    105108 
    106109    /* Call the function to read the feed content */ 
    107         echo rssjb_List($feed, $filter, $num, $list, $target, $pubdate, $pubtime, $pubauthor, $excerpt, $charex); 
     110        echo rssjb_List($feed, $filter, $num, $list, $target, $pubdate, $pubtime, $pubauthor, $excerpt, $charex, $cachefeed); 
    108111 
    109112    /* After widget (defined by themes). */ 
     
    117120    $instance = $old_instance; 
    118121 
    119     /* Strip tags for title and name to remove HTML (important for text inputs). */ 
     122    /* Strip tags for title & name 2 remove HTML (important for text inputs). */ 
    120123    $instance['title'] = strip_tags($new_instance['title']); 
    121124    $instance['name'] = strip_tags($new_instance['name']); 
     
    125128    $instance['number'] = strip_tags($new_instance['number']); 
    126129    $instance['charex'] = strip_tags($new_instance['charex']); 
     130    $instance['cachefeed'] = strip_tags($new_instance['cachefeed']); 
    127131 
    128132    /* No need to strip tags for drop-down menus */ 
     
    148152 
    149153    /* Default widget settings. */ 
    150     $defaults = array( 'title' => __('The Latest RSS Items', 'RSSjb'), 'name' => __('http://feeds.feedburner.com/StefaniasBlog?format=xml', 'RSSjb'), 'lkbtitle' => 'off', 'filter' => '', 'number' => '5', 'pubdate' => 'off', 'pubtime' => 'off', 'pubauthor' => 'on', 'excerpt' => 'off', 'charex' => '150', 'list' => 'ul', 'target' => '_blank'); 
     154    $defaults = array( 'title' => __('The Latest RSS Items', 'RSSjb'), 'name' => __('http://feeds.feedburner.com/StefaniasBlog?format=xml', 'RSSjb'), 'lkbtitle' => 'off', 'filter' => '', 'number' => '5', 'pubdate' => 'off', 'pubtime' => 'off', 'pubauthor' => 'on', 'excerpt' => 'off', 'charex' => '150', 'list' => 'ul', 'target' => '_blank', 'cachefeed' => '3600'); 
    151155 
    152156    $instance = wp_parse_args( (array) $instance, $defaults );  
     157 
    153158?> 
    154159    <!-- Widget Title: Text Input --> 
     
    168173    <label for="<?php echo $this->get_field_id( 'name' ); ?>"><?php _e('Feed URL:', 'RSSjb'); ?></label> 
    169174    <input id="<?php echo $this->get_field_id( 'name' ); ?>" name="<?php echo $this->get_field_name( 'name' ); ?>" value="<?php echo $instance['name']; ?>" style="width:100%;" /> 
     175    </p> 
     176 
     177    <!-- Cache Refresh Frequency(sec.): Text Input --> 
     178    <p> 
     179    <label for="<?php echo $this->get_field_id( 'cachefeed' ); ?>"><?php _e('Cache Refresh Frequency (in sec.):', 'RSSjb'); ?></label> 
     180    <input id="<?php echo $this->get_field_id( 'cachefeed' ); ?>" name="<?php echo $this->get_field_name( 'cachefeed' ); ?>" value="<?php echo $instance['cachefeed']; ?>" style="width:100%;" /> 
    170181    </p> 
    171182 
     
    240251 */ 
    241252// add_shortcode('RSSjb', 'RSSjb_funct'); 
    242  
    243253add_shortcode('RSSjb', array('RSSjbClass', 'RSSjb_funct')); 
    244254 
     
    262272            "charex" => '150', 
    263273            "title" => '', 
    264             "link" => 'false' 
     274            "link" => 'false', 
     275            "cachefeed" => '3600' 
    265276    ), $atts)); 
    266277 
    267     // For debug purposes only 
    268     // echo "<h1>feed: $feed - filter: $filter - num: $num - list: $list - target: $target - pubdate: $pubdate - pubtime: $pubtime - pubauthor: $pubauthor - excerpt: $excerpt - charex: $charex - title: $title - link: $link</h1>"; 
    269      
    270     // taxonomy issue? 
    271     // if (!$feed) $jbfeed = $feed; 
    272278 
    273279    if ($feed) { 
     
    275281        /* Display title and/or link-to-feed from given attributes */ 
    276282            $tle = ""; 
    277             if ( $link !== false && $link !== "false" ) {  
     283            if ( filter_var($link, FILTER_VALIDATE_BOOLEAN) ) {  
    278284            $tle = "<a target='$target' href='$feed'><img src='/wp-content/plugins/google-news-widget/rss-cube.gif' width='25px' height='25px' alt=' [feed link] '></a> ";  
    279285        } 
     
    281287                $tle .= "<b>$title</b>";  
    282288            }  
    283         return $tle . rssjb_List($feed, $filter, $num, $list, $target, $pubdate, $pubtime, $pubauthor, $excerpt, $charex); 
     289        return $tle . rssjb_List($feed, $filter, $num, $list, $target, $pubdate, $pubtime, $pubauthor, $excerpt, $charex, $cachefeed); 
    284290    } else { 
    285291 
     
    289295    } 
    290296} 
     297 
    291298 
    292299/* 
     
    296303*/ 
    297304 
    298 function rssjb_List($feed, $filter, $num, $list, $target, $pubdate, $pubtime, $pubauthor, $excerpt, $charex) { 
     305function rssjb_List($feed, $filter, $num, $list, $target, $pubdate, $pubtime, $pubauthor, $excerpt, $charex, $cachefeed) { 
    299306    include_once(ABSPATH . WPINC . '/feed.php'); 
    300307 
     
    303310    $flist = "Error message: "; 
    304311 
    305     // check whether a feed URL has been entered 
     312    // check whether a feed's URL has been entered 
    306313    if ($feed) { 
    307314 
    308     if ( $rss = fetch_feed($feed) ) {  
     315    // set cache recreation frequency (in seconds) 
     316    add_filter( 'wp_feed_cache_transient_lifetime' , create_function( '$a', 'return '.$cachefeed.';' )  ); 
     317    // fetch feed using simplepie. Returns a standard simplepie object 
     318    $rss = fetch_feed($feed); 
     319    // unset cache recreation frequency 
     320    remove_filter( 'wp_feed_cache_transient_lifetime' , create_function( '$a', 'return 42300;' )  ); 
     321     
     322    if ( $rss ) {  
    309323 
    310324    if (!is_wp_error( $rss )) { 
     
    366380                    if ( $permalink ) $flist .= "</a>";  
    367381         
    368                     if ( $item->get_date() && $pubdate !== false && $pubdate !== "false" ) 
     382                    if ( $item->get_date() && filter_var($pubdate, FILTER_VALIDATE_BOOLEAN) ) 
    369383                    $flist .= ' - ' . date ( get_option('date_format'), strtotime( $item->get_date() )); 
    370384 
    371                         if ( $item->get_date() && $pubtime !== false && $pubtime !== "false") 
     385                        if ( $item->get_date() && filter_var($pubtime, FILTER_VALIDATE_BOOLEAN) ) 
    372386                    $flist .= ' at ' . date ( get_option('time_format'), strtotime( $item->get_date() ));  
    373387 
    374                     if ( $desc && $excerpt != false && $excerpt != "false") { 
     388                    if ( $desc && filter_var($excerpt, FILTER_VALIDATE_BOOLEAN) ) { 
    375389                        if ( $charex > '0' ) {  
    376390                            $flist .= '<br/>'. substr($desc, 0, $charex); 
     
    402416 
    403417    // if pubauthor has been selected 
    404     if ($pubauthor !== false && $pubauthor !== "false") { 
    405         $flist .= '<p style="text-align:center; font-size: 0.8em">powered by <a target="_blank" href=" * Plugin URI: http://www.stefaniamarchisio.com/rss-just-better-plugin-for-wordpress/">RSS Just Better</a></p>'; 
     418    if ( filter_var($pubauthor, FILTER_VALIDATE_BOOLEAN) ) { 
     419        $flist .= '<p style="text-align:center; font-size: 0.8em">powered by <a target="_blank" href="http://www.stefaniamarchisio.com/rss-just-better-plugin-for-wordpress/">RSS Just Better</a> 0.6 plugin</p>'; 
    406420    } 
    407421    return $flist; 
  • rss-just-better/trunk/readme.txt

    r417264 r507906  
    33Donate link: http://www.stefaniamarchisio.com/donations/ 
    44Tags: RSS, Atom, feed, XML, syndication, syndicate, syndicating, news, widget, shortcode 
     5Author URI: http://www.stefaniamarchisio.com 
     6Plugin URI: http://www.stefaniamarchisio.com/RSS-just-better-plugin/ 
    57Requires at least: 2.8 
    6 Tested up to: 3.2 
    7 Stable tag: 0.5 
     8Tested up to: 3.3.1 
     9Stable tag: 0.6 
    810 
    911== Description == 
     
    4143 
    4244== Changelog == 
     45 
     46= 0.6 = 
     47 
     48* New feature: the user is able to set the cache refresh time both in the widget form and the shortcode 
     49* Change: Replaced old email address (mywizardwebs@) with new (stefonthenet@) 
     50* Change: Added the plugin version number in the "Powered from" line at the botton 
     51* Change: Renamed plugin from Google News Widget/Shortcode to Google News Just Better 
     52* Change: Author URI, Plugin URI added to readme.txt file 
     53* Change: Improved description of sample shortcode 
     54 
     55* Fixed bug: Boolean variables were not properly tested and caused some inconsistent views when the plugin was used as a shortcode 
    4356 
    4457= 0.5 = 
     
    126139 
    127140* In Posts/Pages->Add New or Edit of your wp adminstration, select the HTML tab in the entry form; 
    128 * enter [RSSjb feed="..."] where "..." is any rss or atom feed you wish to display;  
     141* enter the following: 
     142[RSSjb feed="replace-with-the-rss-or-atom-feed's-URL-you-wish-to-display"]  
     143 
    129144That's the sole mandatory attribute. Optional attributes are: 
    130145 
    131146* filter: enter any keyword which needs to be present or avoided in the titles of the choosen feed's items. (*) 
    132 * num: number of items to be displayed (default: 3); 
     147* num: number of items to be displayed (default: 3) (**); 
    133148* pubdate: either true or false to display the publication date/not (default: false); 
    134149* pubtime: either true or false to display the publication time/not (default: false); 
     
    140155 
    141156(*) Notes on 'filter' attribute: 
    142 You can enter one of more words to be able to select your feed's items by keyword. 
    143 So if you write "foo bar" you will INCLUDE ONLY those titles where ANY of the two word(s) is present  
    144 and if you write "-foo -bar" you will EXCLUDE ALL those titles where any of the two words is present instead. 
    145 You can also mix inclusive and exclusive terms as in "foo -bar" of course (it will include only titles with "foo" and without "bar".) 
    146 Search is case insensitive and searches for keywords in the titles only. 
    147 Wildshars, quotes and boolean are not enabled for this search. 
    148  
     1571. You can enter one of more words to be able to select your feed's items by keyword. So if you write "foo bar" you will INCLUDE ONLY those titles where ANY of the two word(s) is present and if you write "-foo -bar" you will EXCLUDE ALL those titles where any of the two words is present instead. 
     1582. You can also mix inclusive and exclusive terms as in "foo -bar" of course (it will include only titles with "foo" and without "bar".) 
     1593. Search is case insensitive and searches for keywords in the titles only. 
     1604. Wildshars, quotes and boolean are not enabled for this search. 
     161(**) Note on 'num' attribute: 
     162The maximum number of displayable articles/items depends on the number of articles stored into the XML page (RSS/Atom feed page) of the website you want to syndicate (i.e. if you wish to display the latest 15 items and the XML page contains 10 only, then only 10 will be displayed). 
    149163Example of shortcode with all attributes and default values:  
    150164[RSSjb feed="http://feeds.feedburner.com/StefaniasBlog" filter="" num="5", list="ul", target="_blank", pubdate="false", pubtime="false", pubauthor="true", excerpt="false", charex="150", title="", link="false"] 
     
    157171 
    158172== Interaction == 
    159 * Would you like to see a new feature in this plugin? Please write me here: mywizardwebs@gmail.com; 
     173* Would you like to see a new feature in this plugin? Please write me here: stefonthenet@gmail.com; 
    160174* Would you like to see a broken/orphan plugin working again? Write me anyhow, I might (hey, MIGHT not will/shall) find the time to give it a look. 
Note: See TracChangeset for help on using the changeset viewer.