Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Major changes. Less deprecated functions and fixed whitespace bug

  • Loading branch information...
commit 8cba253d9a424427073670908bc625ff19be2fea 1 parent 228b4fb
Dave Rupert authored May 11, 2010
19  readme.txt
@@ -21,7 +21,6 @@ Features
21 21
 * You can choose to ignore the CSS from the plugin and create your own.
22 22
 
23 23
 
24  
-
25 24
 == Installation ==
26 25
 
27 26
 There are a few ways to get the plugin working.  Here's the normal way:
@@ -38,7 +37,7 @@ If you don't use sidebars and are a SUPER-DIY "roll your own" kind of guy/gal, t
38 37
 1. "Remove" the widget immediately or drag it to "Inactive Widgets".
39 38
 1. In your theme add the following php snippet `<?php do_action('wp_dribbble'); ?>`
40 39
 
41  
-Roll Your Own CSS
  40
+= Roll Your Own CSS =
42 41
 
43 42
 By default the application will include the following CSS in an inline CSS block, which may or may not validate.  If you hate inline CSS or think you can it CSS better, just uncheck the option.
44 43
 
@@ -86,19 +85,17 @@ And here's the generated code (pretty much the same as Dribbble's).
86 85
 
87 86
 = Can I do my own CSS? =
88 87
 
89  
-Yes.  Here's the CSS Dribbble uses (more or less). 
90  
-
91  
-= What about foo bar? =
  88
+Yes.  Just uncheck the "Include CSS?" option and then get to CSSing.
92 89
 
93  
-Answer to foo bar dilemma.
94 90
 
95  
-== Screenshots ==
96  
-
97  
-1. This screen shot description corresponds to screenshot-1.(png|jpg|jpeg|gif). Note that the screenshot is taken from
98  
-the directory of the stable readme.txt, so in this case, `/tags/4.3/screenshot-1.png` (or jpg, jpeg, gif)
99  
-2. This is the second screen shot
100 91
 
101 92
 == Changelog ==
102 93
 
  94
+= 1.0.1 =
  95
+* Now with less deprecated functions!
  96
+* Fixed issue with needless expand($args) call.
  97
+* Added border-bottom to shots CSS with no-shadow.
  98
+* Fixed issue where RSS feed rendered invalid because of extra whitespace.
  99
+
103 100
 = 1.0 =
104 101
 * First version suckkkkaaz.
41  wp-dribbble.php
@@ -4,7 +4,7 @@
4 4
 Plugin URI: http://daverupert.com/category/wordpress/wp-dribbble/
5 5
 Description: Pull in your Dribbble Feed.
6 6
 Author: Dave Rupert
7  
-Version: 1
  7
+Version: 1.0.1
8 8
 Author URI: http://daverupert.com/
9 9
 */
10 10
 /*
@@ -25,22 +25,30 @@
25 25
 */
26 26
 
27 27
 function wpDribbble() { 
28  
-	include_once(ABSPATH . WPINC . '/rss.php');
29  
-  extract($args);
  28
+	include_once(ABSPATH . WPINC . '/feed.php');
30 29
  
31 30
   $options = get_option("widget_wpDribbble");
32 31
 	$playerName = $options['playerName'];
33  
-	$maxitems = $options['maxItems'];
34 32
 
35  
-	$rss = fetch_rss("http://dribbble.com/players/$playerName/shots.rss");
36  
-	$items = array_slice($rss->items, 0, $maxitems);
  33
+	if(function_exists('fetch_feed')):
  34
+		$rss = fetch_feed("http://dribbble.com/players/$playerName/shots.rss");
  35
+		add_filter( 'wp_feed_cache_transient_lifetime', create_function( '$a', 'return 1800;' ) );
  36
+		if (!is_wp_error( $rss ) ) : 
  37
+			$items = $rss->get_items(0, $rss->get_item_quantity($options['maxItems'])); 
  38
+		endif;
  39
+	endif;
37 40
 
38  
-if (!empty($items)): ?>
  41
+	if (!empty($items)): ?>
39 42
 <ol class="dribbbles">
40 43
 <?php	
41 44
 foreach ( $items as $item ):
42  
-	preg_match("/(http).*(jpg|jpeg|gif|png)/",  $item['description'], $image_url);
43  
-	$image = $image_url[0];
  45
+	$title = $item->get_title();
  46
+	$link = $item->get_permalink();
  47
+	$date = $item->get_date('F d, Y');
  48
+	$description = $item->get_description();
  49
+
  50
+	preg_match("/src=\"(http.*(jpg|jpeg|gif|png))/", $description, $image_url);
  51
+	$image = $image_url[1];
44 52
 	if(!$options['bigImage']) {
45 53
 		$image = preg_replace('/.(jpg|jpeg|gif|png)/', '_teaser.$1',$image); #comment this out if you want to use the big 400x300 image
46 54
 	}
@@ -49,10 +57,10 @@ function wpDribbble() {
49 57
 	<div class="dribbble"> 
50 58
 		<div class="dribbble-shot"> 
51 59
 			<div class="dribbble-img"> 
52  
-				<a href="<?php echo $item['link']; ?>" class="dribbble-link"><img src="<?php echo $image ?>" alt="<?php echo $item['title'];?>"/></a> 
53  
-				<a href="<?php echo $item['link']; ?>" class="dribbble-over"><strong><?php echo $item['title']; ?></strong> 
  60
+				<a href="<?php echo $link; ?>" class="dribbble-link"><img src="<?php echo $image; ?>" alt="<?php echo $title;?>"/></a> 
  61
+				<a href="<?php echo $link; ?>" class="dribbble-over"><strong><?php echo $title; ?></strong> 
54 62
 					<span class="dim"><?php echo $options['playerName'] ?></span>
55  
-					<em><?php echo date('F d, Y', strtotime($item['pubdate'])); ?></em> 
  63
+					<em><?php echo $date; ?></em> 
56 64
 				</a>
57 65
 			</div>
58 66
 		</div>
@@ -71,7 +79,7 @@ function wpDribbble_head() {
71 79
 <style type="text/css">
72 80
 .dribbbles{list-style-type:none;margin:0px 0px 1.5em;}
73 81
 .dribbbles li{font-size:15px;position:relative;width:220px;padding:0;margin:0 0 1.5em 0;}
74  
-.dribbbles .dribbble{font-family:"Helvetica Nueue", Helvetica, Arial, sans-serif;position:relative;clear:left;overflow:hidden;<?php if($options['dropShadow']):?>padding:0 0 10px 0;background:url(<?php echo $dir; ?>images/dribbblesprite.png) no-repeat -10px -480px;<?php endif;?>}
  82
+.dribbbles .dribbble{font-family:"Helvetica Nueue", Helvetica, Arial, sans-serif;position:relative;clear:left;overflow:hidden;<?php if($options['dropShadow']):?>padding:0 0 10px 0;background:url(<?php echo $dir; ?>images/dribbblesprite.png) no-repeat -10px -480px;<?php else:?>border-bottom:1px solid #e5e5e5;<?php endif;?>}
75 83
 .dribbbles .dribbble-shot{padding:10px;background:url(<?php echo $dir; ?>images/dribbblesprite.png) no-repeat -10px -330px;}
76 84
 .dribbbles .dribbble-over{position:absolute;top:10px;left:10px;z-index:1;width:180px;height:130px;margin:0!important;padding:10px;font-size:0.8em;line-height:2em;text-decoration:none;color:#888;background:url(<?php echo $dir; ?>images/dribbblesprite.png) no-repeat -110px -160px;}
77 85
 .dribbbles .dribbble-link{position:relative;z-index:2;}
@@ -93,7 +101,7 @@ function wpDribbble_control() {
93 101
   	'maxItems' => '5',
94 102
   	'includeCSS' => true,
95 103
   	'dropShadow' => true,
96  
-  	'dropShadow' => false
  104
+  	'bigImage' => false
97 105
     );
98 106
   }
99 107
   if ($_POST['wpDribbble-Submit']) {
@@ -159,7 +167,7 @@ function widget_wpDribbble($args) {
159 167
 function wpDribbble_init()
160 168
 {
161 169
   $options = get_option("widget_wpDribbble");
162  
-  register_sidebar_widget(__('Dribbble'), 'widget_wpDribbble');
  170
+  wp_register_sidebar_widget(__('Dribbble'),__('Dribbble'), 'widget_wpDribbble' ,array('description' => 'Pull in your latest Dribbble shots'));
163 171
   register_widget_control(   'Dribbble', 'wpDribbble_control');
164 172
 	add_action( 'wp_dribbble', 'wpDribbble' );
165 173
 	if($options['includeCSS']) {
@@ -167,5 +175,4 @@ function wpDribbble_init()
167 175
 	}
168 176
 }
169 177
 add_action("plugins_loaded", "wpDribbble_init");
170  
-?>
171  
- 
  178
+?>

0 notes on commit 8cba253

Please sign in to comment.
Something went wrong with that request. Please try again.