/*
Plugin Name: FeedList
Plugin URI: http://rawlinson.us/blog/articles/feedlist-plugin/
Description: Displays any ATOM or RSS feed in your blog.
Author: Bill Rawlinson
Author URI: http://blog.rawlinson.us/
Version: 2.22.3
*/
// include files
$relroot = dirname(__FILE__).'/../../../';
// get the magpie libary
if (file_exists($relroot . 'wp-includes/rss.php')) {
require_once($relroot . 'wp-includes/rss.php');
} else if(file_exists($relroot . 'wp-includes/rss-functions.php')){
require_once($relroot . 'wp-includes/rss-functions.php');
} else {
function FeedListInitError(){
?>
There was a problem initializing the feedlist plugin. Make sure the file feedlist.php is directly under your wp-content/plugins directory and not a subdirectory.
}
}
// end
// end
class FeedList {
var $dateFormat = "F j, Y, g:i a";
var $id;
var $items;
var $rs;
var $args;
var $feed;
var $output;
function FeedList($args){
$this->args = $args;
$this->id = md5(uniqid(rand(), true));
}
function GetID(){
$this->Debug($this->id);
}
/* core methods */
// called automagically if you use an inline filter (inside a post/page).
function FeedListFilter(){
return $this->BuildFeedOutput();
}
// call this if you want to process one feed
function FeedListFeed(){
echo $this->BuildFeedOutput();
}
// call this if you want to process a feed file
function FeedListFile(){
$this->args = $this->GetArgumentArray();
$this->output = '';
// Seed the random number generator:
srand((double)microtime()*1000000);
$feed = Array();
$feedInfo = $this->LoadFile($this->args['file']);
if(count($feedInfo)){ // we have some feeds
// Randomize the array:
shuffle($feedInfo);
// Make sure we are set to show something:
($this->args['feedsToShow'] < 1) ? 1 : $this->args['feedsToShow'];
($this->args['feedsToShow'] > sizeof($feedInfo)) ? sizeof($feedInfo) : $this->args['feedsToShow'];
// we will fetch each feed, then coallate items
for($i=0;$i<$this->args['feedsToShow'];$i++){
$thisFeed = $feedInfo[$i];
$urlAndTitle = preg_split("/~/", $thisFeed);
$feedUrl = trim($urlAndTitle[0]);
$feedTitle = trim($urlAndTitle[1]);
$this->rs = $this->GetFeed($feedUrl);
if($this->rs){
$this->items = $this->rs->items;
if($this->args['random']){
shuffle($this->items);
}
// Slice off the number of items that we want:
if ($this->args['num_items'] > 0)
{
$this->items = array_slice($this->items, 0, $this->args['num_items']);
}
if(!$this->args['mergeFeeds']){
$this->output.= '
';
} else {
$this->output = $this->args['before'] . 'No Items Were Found In the Provided Feeds. Perhaps there is a communication problem.' . $this->args['after'];
}
// coallate feed items
echo $this->output;
}
/* end core methods */
/* basic settings - you can edit these */
function GetSettings(){
/*
CONFIGURATION SETTINGS
----------------------
cacheTimeout how long should your cache file live in seconds? By default it is 21600 or 6 hours.
most sites prefer you use caching so please make sure you do!
connectionTimeout how long should I try to connect the feed provider before I give up, default is 15 seconds
showRssLinkListJS TRUE by default and will include a small block of JS in your header. If it is false the JS will not be
included. If you want the $new_window = 'true' option to use the JS then this must also be true.
Otherwise both true and simple will hardcode the target="_blank" into the new window links
*/
// DEFINE THE SETTINGS -- EDIT AS YOU NEED:
$feedListDebug = false; // To debug this script during programming (true/false).
$cacheTimeout = 21600; // 21600 sec is 6 hours.
$connectionTimeout = 15; // 15 seconds is default
$showRSSLinkListJS = true;
$Language = 'en_US'; // Choose your language (from the available languages below,in the translations):
$Translations = array(); // Please send in your suggestions/translations:
// English:
$Translations['en_US'] = array();
$Translations['en_US']['ReadMore'] = 'Read more...';
// Dutch:
$Translations['nl_NL'] = array();
$Translations['nl_NL']['ReadMore'] = '[lees verder]';
// French:
$Translations['fr_FR'] = array();
$Translations['fr_FR']['ReadMore'] = 'Lisez davantage';
$feedListFile = '/feeds.txt'; // IF you are going to use the random feedlist generator make sure this holds the correct name for your feed file:
// Build an array out of the settings and send them back:
$settings = array ( 'feedListDebug' => $feedListDebug,
'cacheTimeout' => $cacheTimeout,
'connectionTimeout' => $connectionTimeout,
'showRSSLinkListJS' => $showRSSLinkListJS,
'language' => $Language,
'translations' => $Translations,
'feedListFile' => $feedListFile
);
return $settings;
}
function GetDefaults(){
$settings = $this->GetSettings();
return array( 'rss_feed_url' => 'http://del.icio.us/rss',
'num_items' => 15,
'show_description' => true,
'random' => false,
'before' => '
',
'after' => '
',
'description_separator' => ' - ',
'encoding' => false,
'sort' => 'none',
'new_window' => false,
'ignore_cache' => false,
'suppress_link' => false,
'show_date' => false,
'additional_fields' => '',
'max_characters' => 0,
'max_char_wordbreak' => true,
'file'=>$settings['file'],
'feedsToShow'=>0,
'mergeFeeds'=>false,
'show_date_per_item' => false,
'show_description_only' => false
);
}
/* end basic settings */
function BuildFeedOutput(){
$this->args = $this->GetArgumentArray();
$this->rs = $this->GetFeed($this->args['rss_feed_url']);
$this->output = '';
if($this->rs){
$this->items = $this->rs->items;
if($this->args['random']){
shuffle($this->items);
}
// Slice off the number of items that we want:
if ($this->args['num_items'] > 0)
{
$this->items = array_slice($this->items, 0, $this->args['num_items']);
}
$this->output = $this->Draw();
}
return $this->output;
}
function Draw(){
$settings = $this->GetSettings();
$this->items = $this->NormalizeDates($this->items);
$this->items = $this->SortItems($this->items,$this->args['sort']);
// Explicitly set this because $new_window could be "simple":
$target = '';
if($this->args["new_window"] == true && $settings["showRSSLinkListJS"])
{
$target=' rel="external" ';
}
elseif ($this->args["new_window"] == true || $settings["new_window"] == 'simple')
{
$target=' target="_blank" ';
}
$this->output ='';
foreach($this->items as $item){
$thisLink = '';
$linkTitle = '';
$thisDescription = '';
$thisTitle = $item['title'];
$thisItemDate = '';
if($this->args['show_description_only']){
$this->args['show_description'] = true;
}
if ($this->args['encoding']){ // very poor and limited internationalization effort
$thisTitle = htmlentities(utf8_decode($thisTitle));
}
if (isset($item['content']['encoded']) || isset($item['description'])){
if (isset($item['description'])){
$thisDescription = $item['description'];
}
else{
$thisDescription = $item['content']['encoded'];
}
// Handle max_characters and max_char_wordbreak before the htmlentities makes it more complicated:
if (!empty($this->args['max_characters']) && is_numeric($this->args['max_characters']))
{
$thisDescription = substr($thisDescription, 0, $this->args['max_characters']);
// If true, we cut on the last space:
if (!empty($this->args['max_char_wordbreak']))
{
$max_char_pos = strrpos($thisDescription, ' ');
if ($max_char_pos > 0)
{
$thisDescription = substr($thisDescription, 0, $max_char_pos);
}
}
} else if ($encoding) {
//further really weak attempt at internationalization
$thisDescription = htmlentities(utf8_decode($thisDescription));
}
$linkTitle = $thisDescription;
$linkTitle = strip_tags($linkTitle);
$linkTitle = str_replace(array("\n", "\t", '"'), array('', '', "'"), $linkTitle);
$linkTitle = substr($linkTitle, 0, 300);
// if we are only showing the description we don't need the separator..
if (strlen(trim($thisDescription)) && !$this->args['show_description_only'])
{
$thisDescription = $this->args['description_separator'].$thisDescription;
}
}
// Only build the hyperlink if a link is provided..and we are not told to suppress the link:
if (!$this->args['suppress_link'] && strlen(trim($item['link'])) && strlen(trim($thisTitle)) && !$this->args['show_description_only']){
$thisLink = ''.$thisTitle.'';
}
elseif (strlen(trim($item['link'])) && $this->args['show_description'])
{
// If we don't have a title but we do have a description we want to show.. link the description
$thisLink = ''.$thisDescription.'';
$thisDescription = '';
}
else
{
$thisLink = '' . $thisTitle . '';
}
if($this->args['show_date_per_item']){
$thisItemDate = '
' . $item['feeddate'] . '
';
}
// Determine if any extra data should be shown:
$extraData = '';
if (strlen($this->args['additional_fields'])){
// Magpie converts all key names to lowercase so we do too:
$this->args['additional_fields'] = strtolower($this->args['additional_fields']);
// Get each additional field:
$addFields = explode('~', $this->args['additional_fields']);
foreach ($addFields as $addField)
{
// Determine if the field was a nested field:
$fieldDef = explode('.', $addField);
$thisNode = $item;
foreach($fieldDef as $fieldName)
{
// Check to see if the fieldName has a COLON in it, if so then we are referencing an array:
$thisField = explode(':', $fieldName);
$fieldName = $thisField[0];
$thisNode = $thisNode[$fieldName];
if (count($thisField) == 2)
{
$fieldName = $thisField[1];
$thisNode = $thisNode[$fieldName];
}
}
if (is_string($thisNode) && isset($thisNode))
{
$extraData .= '
The Jeri Kelly Table runner of the month club is now beginning. Every Month we will offer a fabric kit for the table runner collection based on Jeri’s Book: “Every Month”. You can pick and choose the table runners you want to make or you can sign up for the year long program and save. You MUST own the book to participate. The book costs a one time fee of $24.00 and includes 12 patterns plus a place mat pattern that coordinates with the sets. The fabric kit includes everything you need for backing, binding and quilt top. For each table runner, you will need to supply 1 yard of Steam A Seam II - LIGHT and 17″ x 44″ Low Loft Batting (available here on the web site).Year Long Program: Sign-up for a year, start anytime, you will receive 1 book (when you order it) and 12 fabric kits over the next 12 months. You will be charged $12.99 each month plus shipping. Your first kit for the current month will be sent right away and all subsequent kits will be sent by the second week of each month. Because these kits are seasonal,we will send you the June kit in May so you have time to sew and complete the kit for the next month.
If you have any questions, do not hesitate to let me know!
If you have followed the newsletter, or the blog for any length of time, you know by now that I lost my Gazebo in a winter snowstorm and decided to have raised beds installed. Well after long last the beds are planted with a glorious abundance of vegetables!!! I have to admit that this is very exciting for me. The vegetables are all planted! Here is a list of what I have planted:
1. Roma Classic Tomatoes
2. Bush Early Girl Hybrid Tomato
3. Red Bell Sweet Pepper
4. Orange California Wonder Bell Pepper
5. Romaine Lettuce x9
6. Sweet Basil x 2
7. Cilantro
8. Cucumbers x 2
9. Hood Strawberries x 2
10. Bush Sugar Snap Peas
11. Cabbage
12. Beets
13. Carrots
14. Butternut Squash
15. Brussels Sprouts
My friend and customer Norma has also given me:
16. Arugula
17. Baby Bok Choy
18. Summer Mellon
Then in some pots around the raised beds, I have some wonderful Herbs. Mint and Oregano. I am still looking for some Italian Parsley. I know this has nothing to do with quilting, but I just had to share this with all of you! There is still time for you to plant your own victory garden! I will keep you up to date as this my first official garden grows up!
Do you need a reason to get up in the morning or add bounce to your day? We think the Heart to Hand Breakfast Club will provide a great start to your day. Breakfast Club offers a breakfast treat, and coffee or tea, along with a Quilter’s recipe (pattern). The Breakfast Club patterns are designed for your dining (quilting) pleasure. Just bring in your sewing machine and tools along with a “Fabric Cinnamon Roll”. The size of the Fabric Cinnamon Rolls will depend on whether you are making a table runner or a king size quilt.
The staff at Heart to Hand is available during normal shop hours if you need assistance selecting fabrics for your Fabric Cinnamon Roll.
Meets: May 9th
Time: 11:00 to 4:30
Cost: $35
Buddy Special! Which is 20% off your class fee when you bring a buddy to take the class too. Register online or call the shop: 503-230-9075. You MUST register by Friday at 2:00pm so we can have your treats waiting for you!
This picture is of the Eggs Benedict 30″ x 35″ table topper. The great thing about this project is you use 2 1/2″ strips and can make 4 place mats, a table topper, A wall quilt, a lap quilt, a full/queen or a king all from the same pattern that we give you. So pick your project and come join us this Saturday.
Sharyle has an out of town engagement, and so Beth and I will be team teaching this class. Sharyle will return in June to teach Grannies Granola. June 13th.
May is our Anniversary month Beth, Dean and I have some special sales scheduled for you all month. This week it is Buy two yards of fabric and get one free. See the details below.
We also have special projects scheduled for this month. The first one is this adorable Heart To Hand Needle Case. From White Sewing comes this cute project. Take a traditional log cabin square and transform it into this charming and handy needle case. It’s fun…and it’s easy to make! Our kit includes fabric to make the case, felt, and muslin. You supply the leftover batting or flannel, and buttons. We will include a free copy of the pattern and templates. We are offering a variety of color options.
It’s Fabric Sale Time!!!
We have a lot of fabrics that we need to clear out so we can purchase new ones. This week we are offering a buy two yards of fabric and get one free sale. Limited to stock on hand. Put a total of three yards of fabric in your cart, and the server will charge you for the three but Susan will make the correction when she processes your order. You will need to pay regular shipping on all fabric.