FEEDZY RSS Feeds Lite - Version 1.0

Version Description

  • First release.

=

Download this release

Release Info

Developer briKou
Plugin Icon 128x128 FEEDZY RSS Feeds Lite
Version 1.0
Comparing to
See all releases

Version 1.0

feedzy-rss-feed.php ADDED
@@ -0,0 +1,212 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Plugin Name: FEEDZY RSS Feeds by b*web
4
+ * Plugin URI: http://b-website.com/feedzy-rss-feeds-plugin-wordpress-gratuit-utilisant-simplepie
5
+ * Description: FEEDZY RSS Feeds is a small and lightweight plugin. Fast and very easy to use, it allows you to aggregate RSS feeds into your WordPress site through fully customizable shortcodes.
6
+ * Author: Brice CAPOBIANCO - b*web
7
+ * Author URI: http://b-website.com/
8
+ * Version: 1.0
9
+ * Text Domain: feedzy_rss_translate
10
+ */
11
+
12
+
13
+ // Exit if accessed directly
14
+ if ( ! defined( 'ABSPATH' ) ) {
15
+ exit;
16
+ }
17
+
18
+ //Load plugin textdomain
19
+ if (!function_exists('feedzy_rss_load_textdomain')) {
20
+ function feedzy_rss_load_textdomain() {
21
+ $path = dirname(plugin_basename( __FILE__ )) . '/langs/';
22
+ $loaded = load_plugin_textdomain( 'feedzy_rss_translate', false, $path);
23
+ }
24
+ add_action('init', 'feedzy_rss_load_textdomain');
25
+ }
26
+
27
+ //Enqueue custom CSS
28
+ if (!function_exists('feedzy_rss_enqueue_custom_style')) {
29
+ function feedzy_rss_enqueue_custom_style() {
30
+ global $post;
31
+ if(function_exists('has_shortcode')) {
32
+ if(isset($post->post_content) AND has_shortcode( $post->post_content, 'feedzy-rss')) {
33
+ wp_enqueue_style( 'feedzy_rss_CSS', plugins_url('/feedzy-rss-style.css', __FILE__ ), NULL, NULL);
34
+ }
35
+ }
36
+ }
37
+ add_action( 'wp_enqueue_scripts', 'feedzy_rss_enqueue_custom_style');
38
+ }
39
+
40
+ //This function will get an image from the feed
41
+ if (!function_exists('returnImage')) {
42
+ function returnImage ($text) {
43
+ $text = html_entity_decode($text, ENT_QUOTES, 'UTF-8');
44
+ $pattern = "/<img[^>]+\>/i";
45
+ preg_match($pattern, $text, $matches);
46
+ $text = $matches[0];
47
+ return $text;
48
+ }
49
+ }
50
+
51
+ //This function will filter out image url which we got from previous returnImage() function
52
+ if (!function_exists('scrapeImage')) {
53
+ function scrapeImage($text) {
54
+ $pattern = '/src=[\'"]?([^\'" >]+)[\'" >]/';
55
+ preg_match($pattern, $text, $link);
56
+ $link = $link[1];
57
+ $link = urldecode($link);
58
+ return $link;
59
+ }
60
+ }
61
+
62
+ //Main shortcode function
63
+ if (!function_exists('feedzy_rss')) {
64
+ function feedzy_rss( $atts, $content="" ) {
65
+ //Retrieve & extract shorcode parameters
66
+ extract(shortcode_atts(array(
67
+ "feeds" => '', //comma separated feeds url
68
+ "max" => '5', //number of feeds items
69
+ "feed_title" => 'yes', //display feed title true/false
70
+ "target" => '_blank', //_blank, _self
71
+ "title" => '', //strip title after X char
72
+ "meta" => 'yes', //yes, no
73
+ "summary" => 'yes', //strip title
74
+ "summarylength" => '', //strip summary after X char
75
+ "thumb" => 'yes', //yes, no
76
+ "size" => '150' //thumbs pixel size
77
+ ), $atts));
78
+ $count = 0;
79
+
80
+ if(!is_numeric($size))
81
+ $size = '150';
82
+
83
+ if (!class_exists('SimplePie'))
84
+ require_once(ABSPATH . WPINC . '/class-feed.php');
85
+
86
+ if (!empty ($feeds)) {
87
+ $feedURL = explode(',',$feeds);
88
+ $feedURL = array_splice($feedURL, 0, 3);
89
+ if (count($feedURL) === 1) {
90
+ $feedURL = $feedURL[0];
91
+ };
92
+ }
93
+
94
+ //Process SimplePie
95
+ $feed = new SimplePie();
96
+ $feed->set_feed_url($feedURL);
97
+ $feed->enable_cache(true);
98
+ $feed->enable_order_by_date(true);
99
+ $feed->set_cache_class( 'WP_Feed_Cache' );
100
+ $feed->set_file_class( 'WP_SimplePie_File' );
101
+ $feed->set_cache_duration( apply_filters( 'wp_feed_cache_transient_lifetime', 7200, $feedURL ) );
102
+ do_action_ref_array( 'wp_feed_options', array( $feed, $feedURL ) );
103
+ $feed->strip_comments(true);
104
+ $feed->strip_htmltags(false);
105
+ $feed->init();
106
+ $feed->handle_content_type();
107
+
108
+ if ($feed->error()) {
109
+ $content .= '<div id="message" class="error"><p>'. __( 'Sorry, this feed is currently unavailable or does not exists anymore.', 'feedzy_rss_translate' ) .'</p></div>';
110
+ }
111
+
112
+ $content .= '<div class="feedzy-rss">';
113
+
114
+ if($feed_title == 'yes'){
115
+ $content .= '<div class="rss_header">';
116
+ $content .= '<h2><a href="'. $feed->get_permalink() .'">'. $feed->get_title() .'</a> <span> '. $feed->get_description() .'</span></h2>';
117
+ $content .= '</div>';
118
+ }
119
+
120
+ //Loop through RSS feed
121
+ foreach ($feed->get_items() as $item){
122
+
123
+ if($count >= $max)
124
+ break;
125
+ $count++;
126
+
127
+ //Fetch image thumbnail
128
+ if($thumb == 'yes'){
129
+ $thethumbnail = "";
130
+ if ($enclosure = $item->get_enclosure()) {
131
+ foreach ((array) $enclosure->get_link() as $thumbnail){
132
+ $pattern= '/https?:\/\/.*\.(?:jpg|JPG|jpe|JPE|jpeg|JPEG|gif|GIF|png|PNG)/iU';
133
+ $imgsrc = $thumbnail;
134
+ preg_match($pattern, $imgsrc, $matches);
135
+ $thumbnail = $matches[0];
136
+ if (!empty($thumbnail)){
137
+ $thethumbnail = $thumbnail;
138
+ break;
139
+ }
140
+ }
141
+ }
142
+ if(empty($thethumbnail)) {
143
+ $feedDescription = $item->get_description();
144
+ $image = returnImage($feedDescription);
145
+ $thethumbnail = scrapeImage($image);
146
+ }
147
+ if(empty($thethumbnail)) {
148
+ $feedDescription = $item->get_content();
149
+ $image = returnImage($feedDescription);
150
+ $thethumbnail = scrapeImage($image);
151
+ }
152
+ }
153
+ //Build element DOM
154
+ $content .= '<div class="rss_item">';
155
+ $content .= '<span class="title"><a href="'. $item->get_permalink() .'" target="'. $target .'">';
156
+ if(is_numeric($title) && strlen($item->get_title()) > $title){
157
+ $content .= preg_replace('/\s+?(\S+)?$/', '', substr($item->get_title(), 0, $title)) .'...';
158
+ } else {
159
+ $content .= $item->get_title();
160
+ }
161
+ $content .= '</a></span>';
162
+ if(!empty($thethumbnail)) {
163
+ $content .= '<a href="'.$item->get_permalink().'" class="rss_image" target="'. $target .'" style="width:'. $size .'px; height:'. $size .'px;" title="'.$item->get_title().'" >';
164
+ $content .= '<span style="width:'. $size .'px; height:'. $size .'px; background-image:url('.$thethumbnail.');" alt="'.$item->get_title().'"></span/></a>';
165
+ } else {
166
+ $content .= '<span class="rss_image" style="width:'. $size .'px; height:'. $size .'px;" /></span>';
167
+ }
168
+ $content .= '<div class="rss_content">';
169
+ if($meta == 'yes'){
170
+ $content .= '<small>'. __( 'Posted by', 'feedzy_rss_translate' ) .' ';
171
+ if ($author = $item->get_author()) {
172
+ $domain = parse_url($item->get_permalink());
173
+ $content .= '<a href="http://'. $domain["host"]. '" target="'. $target .'" title="'.$domain["host"].'" >'. $author->get_name() .' </a>';
174
+ }
175
+ $content .= __( 'on', 'feedzy_rss_translate' ) .' '. $item->get_date(get_option('date_format')) .' '. __( 'at', 'feedzy_rss_translate' ) .' '. $item->get_date(get_option('time_format'));
176
+ $content .= '</small>';
177
+ }
178
+ if($summary == 'yes'){
179
+ $content .= '<p>';
180
+ $description = trim(strip_tags($item->get_description()));
181
+ $description = trim(chop($description,'[&hellip;]'));
182
+ if(is_numeric($summarylength) && strlen($description) > $summarylength){
183
+ $content .= preg_replace('/\s+?(\S+)?$/', '', substr($description, 0, $summarylength)) .' […]';
184
+ } else {
185
+ $content .= $description .' […]';
186
+ }
187
+ $content .= '</p>';
188
+ }
189
+ $content .= '</div>';
190
+ $content .= '</div>';
191
+
192
+ } //endforeach
193
+
194
+ $content .= '</div>';
195
+ return $content;
196
+
197
+ } //end of feedzy_rss
198
+ add_shortcode( 'feedzy-rss', 'feedzy_rss' );
199
+ }
200
+
201
+ //Insert cover picture to main rss feed
202
+ if (!function_exists('insertThumbnailRSS')) {
203
+ function insertThumbnailRSS($content) {
204
+ global $post;
205
+ if ( has_post_thumbnail( $post->ID ) ){
206
+ $content = '' . get_the_post_thumbnail( $post->ID, 'thumbnail' ) . '' . $content;
207
+ }
208
+ return $content;
209
+ }
210
+ add_filter('the_excerpt_rss', 'insertThumbnailRSS');
211
+ add_filter('the_content_feed', 'insertThumbnailRSS');
212
+ }
feedzy-rss-style.css ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Plugin Name: FEEDZY RSS Feeds by b*web
3
+ * Plugin URI: http://b-website.com/
4
+ * Author: Brice CAPOBIANCO - b*web
5
+ */
6
+
7
+ .feedzy-rss .rss_item {
8
+ border-bottom: 1px solid #eee;
9
+ padding: 1em 0 2em;
10
+ }
11
+ .feedzy-rss .rss_item .title {
12
+ font-weight: bold;
13
+ }
14
+ .feedzy-rss .rss_item:after{
15
+ content:'';
16
+ display:block;
17
+ clear: both;
18
+ }
19
+ .feedzy-rss .rss_item .rss_image {
20
+ float: left;
21
+ }
22
+ .feedzy-rss .rss_item .rss_image span{
23
+ display:inline-block;
24
+ background-size: cover;
25
+ background-position: 50%;
26
+ }
27
+ .feedzy-rss .rss_item .rss_image {
28
+ padding: 0.3em 1em 0 0;
29
+ }
30
+ .feedzy-rss .rss_item .rss_content small {
31
+ display: block;
32
+ font-size: 0.9em;
33
+ font-style:italic;
34
+ }
index.php ADDED
@@ -0,0 +1,2 @@
 
 
1
+ <?php
2
+ //Kisses from France...
langs/feedzy_rss_translate-fr_FR.mo ADDED
Binary file
langs/feedzy_rss_translate-fr_FR.po ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: FEEDZY RSS Feeds v1.0\n"
4
+ "Report-Msgid-Bugs-To: \n"
5
+ "POT-Creation-Date: \n"
6
+ "PO-Revision-Date: 2014-09-18 07:52:32+0000\n"
7
+ "Last-Translator: superadminopl <brice.capobianco@openlog.fr>\n"
8
+ "Language-Team: \n"
9
+ "MIME-Version: 1.0\n"
10
+ "Content-Type: text/plain; charset=UTF-8\n"
11
+ "Content-Transfer-Encoding: 8bit\n"
12
+ "Plural-Forms: nplurals=2; plural=n>1;\n"
13
+ "X-Generator: CSL v1.x\n"
14
+ "X-Poedit-Language: French\n"
15
+ "X-Poedit-Country: FRANCE\n"
16
+ "X-Poedit-SourceCharset: utf-8\n"
17
+ "X-Poedit-KeywordsList: __;_e;__ngettext:1,2;_n:1,2;__ngettext_noop:1,2;_n_noop:1,2;_c,_nc:4c,1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2;\n"
18
+ "X-Poedit-Basepath: \n"
19
+ "X-Poedit-Bookmarks: \n"
20
+ "X-Poedit-SearchPath-0: .\n"
21
+ "X-Textdomain-Support: yes"
22
+
23
+ #: feedzy-rss-feed.php:108
24
+ #@ feedzy_rss_translate
25
+ msgid "Sorry, this feed is currently unavailable or does not exists anymore."
26
+ msgstr "Désolé, ce flux est actuellement indisponible ou n'existe plus."
27
+
28
+ #: feedzy-rss-feed.php:168
29
+ #@ feedzy_rss_translate
30
+ msgid "Posted by"
31
+ msgstr "Publié par"
32
+
33
+ #: feedzy-rss-feed.php:173
34
+ #@ feedzy_rss_translate
35
+ msgid "on"
36
+ msgstr "le"
37
+
38
+ #: feedzy-rss-feed.php:173
39
+ #@ feedzy_rss_translate
40
+ msgid "at"
41
+ msgstr "à"
42
+
readme.txt ADDED
@@ -0,0 +1,140 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ === FEEDZY RSS Feeds ===
2
+ Contributors: briKou
3
+ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=7Z6YVM63739Y8
4
+ Tags: RSS, SimplePie, shortcode, feed, thumbnail, image, rss feeds, aggregator
5
+ Requires at least: 3.7
6
+ Tested up to: 4.0
7
+ Stable tag: 1.0
8
+ License: GPLv2 or later
9
+ License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
+
11
+
12
+ FEEDZY RSS Feeds is a small and lightweight plugin. Fast and easy to use, it aggregates RSS feeds into your WordPress site through simple shortcodes.
13
+
14
+ == Description ==
15
+
16
+ FEEDZY RSS Feeds is a small and lightweight RSS aggregator plugin. Fast and very easy to use, it allows you to aggregate multiple RSS feeds into your WordPress site through fully customizable shortcodes.
17
+
18
+ The plugin uses the SimplePie CLASS php natively included in WordPress. SimplePie is a RSS parser that can read the information contained in a feed, process it, and finally display it.
19
+
20
+ FEEDZY RSS Feeds therefore support any additional library and uses only the bare minimum to ensure good performance (minimalistic CSS + cache).
21
+
22
+ You can use this plugin in your widgets and your pages and use the shortcode several times in the same page.
23
+
24
+ By activating this plugin, your cover picture will be insert into your RSS feeds. By this way, it will easier for external sites to retrieve image from your feeds.
25
+
26
+
27
+ [CHECK OUT THE DEMO](http://b-website.com/feedzy-rss-feeds-plugin-wordpress-gratuit-utilisant-simplepie "Try It!")
28
+
29
+
30
+ **Please ask for help or report bugs if something goes wrong. It is the best way to make the community go ahead !**
31
+
32
+
33
+ = Shortcode Parameters =
34
+
35
+ **feeds**
36
+
37
+ * Description : The url of the RSS feed to display. You can use multiple feeds URL separated by commas. The items are displayed in chronological order even if there is several feeds. It may be that you do not see the elements of a single stream if the others are older.
38
+ * Format : URL
39
+ * Default : empty
40
+
41
+
42
+ **max**
43
+
44
+ * Description : Number of items to display. It may be that the RSS feeds you want to display has less entries than the number you choose, in this case a maximum number of item will be displayed.
45
+ * Format : numeric
46
+ * Default : 5
47
+
48
+
49
+ **feed_title**
50
+
51
+ * Description : Should we display the RSS title ?
52
+ * Format : yes/no
53
+ * Default : yes
54
+
55
+
56
+ **target**
57
+
58
+ * Description : Links can be opened in the same window or a new tab. [See the official doc.](http://www.w3schools.com/tags/att_a_target.asp "HTML a target Attribute")
59
+ * Format : _blank/_self/_parent/_top/framename
60
+ * Default : _blank
61
+
62
+
63
+ **title**
64
+
65
+ * Description : Trim the title of the item after X characters. The title will ends with "..." if it has been cropped.
66
+ * Format : numeric
67
+ * Default : empty
68
+
69
+
70
+ **meta**
71
+
72
+ * Description : Should we display the date of publication and the author name of the recovered item?
73
+ * Format : yes/no
74
+ * Default : yes
75
+
76
+
77
+ **summary**
78
+
79
+ * Description : Should we display a description (abstract) of the recovered item?
80
+ * Format : yes/no
81
+ * Default : yes
82
+
83
+
84
+ **summarylength**
85
+
86
+ * Description : Crop description (summary) of the element after X characters. The title will ends with "..." if it has been cropped.
87
+ * Format : numeric
88
+ * Default : empty
89
+
90
+
91
+ **thumb**
92
+
93
+ * Description : Should we display the first image of the content if it is available?
94
+ * Format : yes/no
95
+ * Default : yes
96
+
97
+
98
+ **size**
99
+
100
+ * Description : If an image is available and is required to display, you can specify it size in pixels. The image is cropped with CSS to be perfectly square. Do not include "px".
101
+ * Format : numeric
102
+ * Default : 10
103
+
104
+
105
+ = Basic example =
106
+
107
+ `[feedzy-rss feeds="http://b-website.com/feed"]`
108
+
109
+
110
+ = Advanced examples =
111
+
112
+ `[feedzy-rss feeds="http://b-website.com/feed" max="2" feed_title="yes" target="_blank" title="50" meta="yes" summary="yes" summarylength="300" thumb="yes" size="100"]`
113
+
114
+
115
+ == Installation ==
116
+
117
+ 1. Upload and activate the plugin (or install it through the WP admin console)
118
+ 2. Insert shortode! ;)
119
+
120
+ == Frequently Asked Questions ==
121
+
122
+ = Is it responsiv frendly? =
123
+
124
+ Yes it is.
125
+
126
+
127
+ == Screenshots ==
128
+
129
+ 1. Simple example
130
+
131
+
132
+ == Changelog ==
133
+
134
+ = 1.0 =
135
+ * First release.
136
+
137
+ == Upgrade Notice ==
138
+
139
+ = 1.0 =
140
+ * First release.