Version Description
- New param added to filter item with keywords
- Default thumb added
- Fix minor php issue
- Rename files of the plugin
- New logo + screenshot (assets)
Download this release
Release Info
Developer | briKou |
Plugin | FEEDZY RSS Feeds Lite |
Version | 1.5 |
Comparing to | |
See all releases |
Code changes from version 1.4 to 1.5
- css/feedzy-rss-feeds.css +38 -0
- feedzy-rss-feed.php +18 -92
- feedzy-rss-feeds-ui.php +39 -0
- feedzy-rss-feeds.php +336 -0
- feedzy-rss-style.css +1 -0
- img/feedzy-default.jpg +0 -0
- img/feedzy.svg +15 -0
- js/feedzy-rss-feeds-ui.js +170 -0
- readme.txt +31 -76
css/feedzy-rss-feeds.css
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* Plugin Name: FEEDZY RSS Feeds by b*web
|
3 |
+
* Plugin URI: http://b-website.com/
|
4 |
+
* Author: Brice CAPOBIANCO
|
5 |
+
*/
|
6 |
+
.feedzy-rss .rss_item {
|
7 |
+
border-bottom: 1px solid #eee;
|
8 |
+
padding: 1em 0 2em;
|
9 |
+
}
|
10 |
+
.feedzy-rss .rss_item .title {
|
11 |
+
font-weight: bold;
|
12 |
+
}
|
13 |
+
.feedzy-rss .rss_item:after{
|
14 |
+
content:'';
|
15 |
+
display:block;
|
16 |
+
clear: both;
|
17 |
+
}
|
18 |
+
.feedzy-rss .rss_item a.rss_image {
|
19 |
+
float: left;
|
20 |
+
text-decoration: none;
|
21 |
+
border: none;
|
22 |
+
}
|
23 |
+
.feedzy-rss .rss_item a.rss_image span{
|
24 |
+
display:inline-block;
|
25 |
+
background-size: cover;
|
26 |
+
background-position: 50%;
|
27 |
+
}
|
28 |
+
.feedzy-rss .rss_item .rss_image {
|
29 |
+
padding: 0.3em 1em 0 0;
|
30 |
+
}
|
31 |
+
.feedzy-rss .rss_item .rss_content small {
|
32 |
+
display: block;
|
33 |
+
font-size: 0.9em;
|
34 |
+
font-style:italic;
|
35 |
+
}
|
36 |
+
i.mce-i-feedzy-icon {
|
37 |
+
background-image: url('../img/feedzy.svg');
|
38 |
+
}
|
feedzy-rss-feed.php
CHANGED
@@ -3,9 +3,9 @@
|
|
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 easy to use, it aggregates RSS feeds into your WordPress site through simple shortcodes.
|
6 |
-
* Author: Brice CAPOBIANCO
|
7 |
* Author URI: http://b-website.com/
|
8 |
-
* Version: 1.
|
9 |
* Text Domain: feedzy_rss_translate
|
10 |
*/
|
11 |
|
@@ -15,7 +15,6 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
15 |
exit;
|
16 |
}
|
17 |
|
18 |
-
|
19 |
//Load plugin textdomain
|
20 |
if (!function_exists('feedzy_rss_load_textdomain')) {
|
21 |
function feedzy_rss_load_textdomain() {
|
@@ -25,21 +24,18 @@ if (!function_exists('feedzy_rss_load_textdomain')) {
|
|
25 |
add_action('init', 'feedzy_rss_load_textdomain');
|
26 |
}
|
27 |
|
28 |
-
|
29 |
//Enqueue custom CSS
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
|
|
39 |
}
|
40 |
-
add_action('init', 'register_feedzy_custom_style');
|
41 |
-
add_action('wp_footer', 'print_feedzy_custom_style');
|
42 |
-
|
43 |
|
44 |
//This function will get an image from the feed
|
45 |
if (!function_exists('returnImage')) {
|
@@ -52,7 +48,6 @@ if (!function_exists('returnImage')) {
|
|
52 |
}
|
53 |
}
|
54 |
|
55 |
-
|
56 |
//This function will filter out image url which we got from previous returnImage() function
|
57 |
if (!function_exists('scrapeImage')) {
|
58 |
function scrapeImage($text) {
|
@@ -64,18 +59,13 @@ if (!function_exists('scrapeImage')) {
|
|
64 |
}
|
65 |
}
|
66 |
|
67 |
-
|
68 |
//Main shortcode function
|
69 |
if (!function_exists('feedzy_rss')) {
|
70 |
function feedzy_rss( $atts, $content="" ) {
|
71 |
-
|
72 |
-
global $feedzyStyle;
|
73 |
-
$feedzyStyle = true;
|
74 |
-
|
75 |
//Retrieve & extract shorcode parameters
|
76 |
extract(shortcode_atts(array(
|
77 |
"feeds" => '', //comma separated feeds url
|
78 |
-
"max" => '', //number of feeds items
|
79 |
"feed_title" => 'yes', //display feed title true/false
|
80 |
"target" => '_blank', //_blank, _self
|
81 |
"title" => '', //strip title after X char
|
@@ -83,34 +73,22 @@ if (!function_exists('feedzy_rss')) {
|
|
83 |
"summary" => 'yes', //strip title
|
84 |
"summarylength" => '', //strip summary after X char
|
85 |
"thumb" => 'yes', //yes, no
|
86 |
-
"
|
87 |
-
"size" => '' //thumbs pixel size
|
88 |
), $atts));
|
89 |
$count = 0;
|
90 |
|
91 |
-
if(
|
92 |
-
$max = '5';
|
93 |
-
|
94 |
-
if(empty($size) || !ctype_digit($size))
|
95 |
$size = '150';
|
96 |
|
97 |
-
if(!empty($title) && !ctype_digit($title))
|
98 |
-
$title = '';
|
99 |
-
|
100 |
-
if(!empty($summarylength) && !ctype_digit($summarylength))
|
101 |
-
$summarylength = '';
|
102 |
-
|
103 |
if (!class_exists('SimplePie'))
|
104 |
require_once(ABSPATH . WPINC . '/class-feed.php');
|
105 |
|
106 |
if (!empty ($feeds)) {
|
107 |
-
|
108 |
$feedURL = explode(',',$feeds);
|
109 |
$feedURL = array_splice($feedURL, 0, 3);
|
110 |
if (count($feedURL) === 1) {
|
111 |
$feedURL = $feedURL[0];
|
112 |
};
|
113 |
-
|
114 |
}
|
115 |
|
116 |
//Process SimplePie
|
@@ -128,19 +106,15 @@ if (!function_exists('feedzy_rss')) {
|
|
128 |
$feed->handle_content_type();
|
129 |
|
130 |
if ($feed->error()) {
|
131 |
-
|
132 |
$content .= '<div id="message" class="error"><p>'. __( 'Sorry, this feed is currently unavailable or does not exists anymore.', 'feedzy_rss_translate' ) .'</p></div>';
|
133 |
-
|
134 |
}
|
135 |
|
136 |
$content .= '<div class="feedzy-rss">';
|
137 |
|
138 |
if($feed_title == 'yes'){
|
139 |
-
|
140 |
$content .= '<div class="rss_header">';
|
141 |
$content .= '<h2><a href="'. $feed->get_permalink() .'">'. $feed->get_title() .'</a> <span> '. $feed->get_description() .'</span></h2>';
|
142 |
$content .= '</div>';
|
143 |
-
|
144 |
}
|
145 |
|
146 |
//Loop through RSS feed
|
@@ -153,111 +127,66 @@ if (!function_exists('feedzy_rss')) {
|
|
153 |
//Fetch image thumbnail
|
154 |
if($thumb == 'yes'){
|
155 |
$thethumbnail = "";
|
156 |
-
|
157 |
if ($enclosure = $item->get_enclosure()) {
|
158 |
foreach ((array) $enclosure->get_link() as $thumbnail){
|
159 |
-
|
160 |
$pattern= '/https?:\/\/.*\.(?:jpg|JPG|jpe|JPE|jpeg|JPEG|gif|GIF|png|PNG)/iU';
|
161 |
$imgsrc = $thumbnail;
|
162 |
preg_match($pattern, $imgsrc, $matches);
|
163 |
$thumbnail = $matches[0];
|
164 |
-
|
165 |
if (!empty($thumbnail)){
|
166 |
-
|
167 |
$thethumbnail = $thumbnail;
|
168 |
break;
|
169 |
-
|
170 |
}
|
171 |
-
|
172 |
}
|
173 |
}
|
174 |
-
|
175 |
if(empty($thethumbnail)) {
|
176 |
-
|
177 |
$feedDescription = $item->get_description();
|
178 |
$image = returnImage($feedDescription);
|
179 |
$thethumbnail = scrapeImage($image);
|
180 |
-
|
181 |
}
|
182 |
-
|
183 |
if(empty($thethumbnail)) {
|
184 |
-
|
185 |
$feedDescription = $item->get_content();
|
186 |
$image = returnImage($feedDescription);
|
187 |
$thethumbnail = scrapeImage($image);
|
188 |
-
|
189 |
}
|
190 |
}
|
191 |
-
|
192 |
//Build element DOM
|
193 |
$content .= '<div class="rss_item">';
|
194 |
if($thumb == 'yes'){
|
195 |
-
|
196 |
-
|
197 |
-
$content .= '<a href="'.$item->get_permalink().'" class="rss_image" target="'. $target .'" style="width:'. $size .'px; height:'. $size .'px;" title="'.$item->get_title().'" >';
|
198 |
-
$content .= '<span style="width:'. $size .'px; height:'. $size .'px; background-image: none, url('.$thethumbnail.'), url('.$default.');" alt="'.$item->get_title().'"></span/></a>';
|
199 |
-
|
200 |
-
} else if(!empty($thethumbnail)) {
|
201 |
-
|
202 |
$content .= '<a href="'.$item->get_permalink().'" class="rss_image" target="'. $target .'" style="width:'. $size .'px; height:'. $size .'px;" title="'.$item->get_title().'" >';
|
203 |
$content .= '<span style="width:'. $size .'px; height:'. $size .'px; background-image:url('.$thethumbnail.');" alt="'.$item->get_title().'"></span/></a>';
|
204 |
-
|
205 |
-
} else if(empty($thethumbnail) && !empty($default)){
|
206 |
-
|
207 |
-
$content .= '<a href="'.$item->get_permalink().'" class="rss_image" target="'. $target .'" style="width:'. $size .'px; height:'. $size .'px;" title="'.$item->get_title().'" >';
|
208 |
-
$content .= '<span style="width:'. $size .'px; height:'. $size .'px; background-image:url('.$default.');" alt="'.$item->get_title().'"></span/></a>';
|
209 |
-
|
210 |
} else {
|
211 |
-
|
212 |
$content .= '<span class="rss_image" style="width:'. $size .'px; height:'. $size .'px;" /></span>';
|
213 |
-
|
214 |
}
|
215 |
}
|
216 |
$content .= '<span class="title"><a href="'. $item->get_permalink() .'" target="'. $target .'">';
|
217 |
if(is_numeric($title) && strlen($item->get_title()) > $title){
|
218 |
-
|
219 |
$content .= preg_replace('/\s+?(\S+)?$/', '', substr($item->get_title(), 0, $title)) .'...';
|
220 |
-
|
221 |
} else {
|
222 |
-
|
223 |
$content .= $item->get_title();
|
224 |
-
|
225 |
}
|
226 |
$content .= '</a></span>';
|
227 |
$content .= '<div class="rss_content">';
|
228 |
if($meta == 'yes'){
|
229 |
-
|
230 |
$content .= '<small>'. __( 'Posted by', 'feedzy_rss_translate' ) .' ';
|
231 |
-
|
232 |
if ($author = $item->get_author()) {
|
233 |
-
|
234 |
$domain = parse_url($item->get_permalink());
|
235 |
$content .= '<a href="http://'. $domain["host"]. '" target="'. $target .'" title="'.$domain["host"].'" >'. $author->get_name() .' </a>';
|
236 |
-
|
237 |
}
|
238 |
-
|
239 |
$content .= __( 'on', 'feedzy_rss_translate' ) .' '. $item->get_date(get_option('date_format')) .' '. __( 'at', 'feedzy_rss_translate' ) .' '. $item->get_date(get_option('time_format'));
|
240 |
$content .= '</small>';
|
241 |
-
|
242 |
}
|
243 |
if($summary == 'yes'){
|
244 |
-
|
245 |
$content .= '<p>';
|
246 |
$description = trim(strip_tags($item->get_description()));
|
247 |
$description = trim(chop($description,'[…]'));
|
248 |
-
|
249 |
if(is_numeric($summarylength) && strlen($description) > $summarylength){
|
250 |
-
|
251 |
$content .= preg_replace('/\s+?(\S+)?$/', '', substr($description, 0, $summarylength)) .' […]';
|
252 |
-
|
253 |
} else {
|
254 |
-
|
255 |
-
$content .= $description .' […]';
|
256 |
-
|
257 |
}
|
258 |
-
|
259 |
-
$content .= '</p>';
|
260 |
-
|
261 |
}
|
262 |
$content .= '</div>';
|
263 |
$content .= '</div>';
|
@@ -271,16 +200,13 @@ if (!function_exists('feedzy_rss')) {
|
|
271 |
add_shortcode( 'feedzy-rss', 'feedzy_rss' );
|
272 |
}
|
273 |
|
274 |
-
|
275 |
//Insert cover picture to main rss feed
|
276 |
if (!function_exists('insertThumbnailRSS')) {
|
277 |
function insertThumbnailRSS($content) {
|
278 |
global $post;
|
279 |
-
|
280 |
if ( has_post_thumbnail( $post->ID ) ){
|
281 |
$content = '' . get_the_post_thumbnail( $post->ID, 'thumbnail' ) . '' . $content;
|
282 |
}
|
283 |
-
|
284 |
return $content;
|
285 |
}
|
286 |
add_filter('the_excerpt_rss', 'insertThumbnailRSS');
|
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 easy to use, it aggregates RSS feeds into your WordPress site through simple shortcodes.
|
6 |
+
* Author: Brice CAPOBIANCO - b*web
|
7 |
* Author URI: http://b-website.com/
|
8 |
+
* Version: 1.01
|
9 |
* Text Domain: feedzy_rss_translate
|
10 |
*/
|
11 |
|
15 |
exit;
|
16 |
}
|
17 |
|
|
|
18 |
//Load plugin textdomain
|
19 |
if (!function_exists('feedzy_rss_load_textdomain')) {
|
20 |
function feedzy_rss_load_textdomain() {
|
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')) {
|
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) {
|
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
|
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
|
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
|
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 |
if($thumb == 'yes'){
|
156 |
+
if(!empty($thethumbnail)) {
|
|
|
|
|
|
|
|
|
|
|
|
|
157 |
$content .= '<a href="'.$item->get_permalink().'" class="rss_image" target="'. $target .'" style="width:'. $size .'px; height:'. $size .'px;" title="'.$item->get_title().'" >';
|
158 |
$content .= '<span style="width:'. $size .'px; height:'. $size .'px; background-image:url('.$thethumbnail.');" alt="'.$item->get_title().'"></span/></a>';
|
|
|
|
|
|
|
|
|
|
|
|
|
159 |
} else {
|
|
|
160 |
$content .= '<span class="rss_image" style="width:'. $size .'px; height:'. $size .'px;" /></span>';
|
|
|
161 |
}
|
162 |
}
|
163 |
$content .= '<span class="title"><a href="'. $item->get_permalink() .'" target="'. $target .'">';
|
164 |
if(is_numeric($title) && strlen($item->get_title()) > $title){
|
|
|
165 |
$content .= preg_replace('/\s+?(\S+)?$/', '', substr($item->get_title(), 0, $title)) .'...';
|
|
|
166 |
} else {
|
|
|
167 |
$content .= $item->get_title();
|
|
|
168 |
}
|
169 |
$content .= '</a></span>';
|
170 |
$content .= '<div class="rss_content">';
|
171 |
if($meta == 'yes'){
|
|
|
172 |
$content .= '<small>'. __( 'Posted by', 'feedzy_rss_translate' ) .' ';
|
|
|
173 |
if ($author = $item->get_author()) {
|
|
|
174 |
$domain = parse_url($item->get_permalink());
|
175 |
$content .= '<a href="http://'. $domain["host"]. '" target="'. $target .'" title="'.$domain["host"].'" >'. $author->get_name() .' </a>';
|
|
|
176 |
}
|
|
|
177 |
$content .= __( 'on', 'feedzy_rss_translate' ) .' '. $item->get_date(get_option('date_format')) .' '. __( 'at', 'feedzy_rss_translate' ) .' '. $item->get_date(get_option('time_format'));
|
178 |
$content .= '</small>';
|
|
|
179 |
}
|
180 |
if($summary == 'yes'){
|
|
|
181 |
$content .= '<p>';
|
182 |
$description = trim(strip_tags($item->get_description()));
|
183 |
$description = trim(chop($description,'[…]'));
|
|
|
184 |
if(is_numeric($summarylength) && strlen($description) > $summarylength){
|
|
|
185 |
$content .= preg_replace('/\s+?(\S+)?$/', '', substr($description, 0, $summarylength)) .' […]';
|
|
|
186 |
} else {
|
187 |
+
$content .= $description .' […]';
|
|
|
|
|
188 |
}
|
189 |
+
$content .= '</p>';
|
|
|
|
|
190 |
}
|
191 |
$content .= '</div>';
|
192 |
$content .= '</div>';
|
200 |
add_shortcode( 'feedzy-rss', 'feedzy_rss' );
|
201 |
}
|
202 |
|
|
|
203 |
//Insert cover picture to main rss feed
|
204 |
if (!function_exists('insertThumbnailRSS')) {
|
205 |
function insertThumbnailRSS($content) {
|
206 |
global $post;
|
|
|
207 |
if ( has_post_thumbnail( $post->ID ) ){
|
208 |
$content = '' . get_the_post_thumbnail( $post->ID, 'thumbnail' ) . '' . $content;
|
209 |
}
|
|
|
210 |
return $content;
|
211 |
}
|
212 |
add_filter('the_excerpt_rss', 'insertThumbnailRSS');
|
feedzy-rss-feeds-ui.php
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/***************************************************************
|
3 |
+
* Hooks custom TinyMCE button function
|
4 |
+
***************************************************************/
|
5 |
+
function feedzy_add_mce_button() {
|
6 |
+
|
7 |
+
if ( !current_user_can( 'edit_posts' ) && !current_user_can( 'edit_pages' ) )
|
8 |
+
return;
|
9 |
+
|
10 |
+
if ( 'true' == get_user_option( 'rich_editing' ) ) {
|
11 |
+
|
12 |
+
add_filter( 'mce_external_plugins', 'feedzy_add_tinymce_plugin' );
|
13 |
+
add_filter( 'mce_buttons', 'feedzy_register_mce_button' );
|
14 |
+
|
15 |
+
// Load stylesheet for tinyMCE button only
|
16 |
+
wp_enqueue_style( 'feedzy-rss-feeds', plugin_dir_url( __FILE__ ) . 'css/feedzy-rss-feeds.css', array(), NULL, NULL);
|
17 |
+
|
18 |
+
}
|
19 |
+
|
20 |
+
}
|
21 |
+
add_action('admin_head', 'feedzy_add_mce_button');
|
22 |
+
|
23 |
+
|
24 |
+
/***************************************************************
|
25 |
+
* Load custom js options - TinyMCE API
|
26 |
+
***************************************************************/
|
27 |
+
function feedzy_add_tinymce_plugin( $plugin_array ) {
|
28 |
+
$plugin_array['feedzy_mce_button'] = plugin_dir_url( __FILE__ ) . '/js/feedzy-rss-feeds-ui.js';
|
29 |
+
return $plugin_array;
|
30 |
+
}
|
31 |
+
|
32 |
+
|
33 |
+
/***************************************************************
|
34 |
+
* Register new button in the editor
|
35 |
+
***************************************************************/
|
36 |
+
function feedzy_register_mce_button( $buttons ) {
|
37 |
+
array_push( $buttons, 'feedzy_mce_button' );
|
38 |
+
return $buttons;
|
39 |
+
}
|
feedzy-rss-feeds.php
ADDED
@@ -0,0 +1,336 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 easy to use, it aggregates RSS feeds into your WordPress site through simple shortcodes.
|
6 |
+
* Author: Brice CAPOBIANCO
|
7 |
+
* Author URI: http://b-website.com/
|
8 |
+
* Version: 1.5
|
9 |
+
* Text Domain: feedzy_rss_translate
|
10 |
+
*/
|
11 |
+
|
12 |
+
|
13 |
+
/***************************************************************
|
14 |
+
* SECURITY : Exit if accessed directly
|
15 |
+
***************************************************************/
|
16 |
+
if ( !function_exists('add_action') ) {
|
17 |
+
header('Status: 403 Forbidden');
|
18 |
+
header('HTTP/1.1 403 Forbidden');
|
19 |
+
exit();
|
20 |
+
}
|
21 |
+
|
22 |
+
if ( !defined('ABSPATH') ) {
|
23 |
+
exit;
|
24 |
+
}
|
25 |
+
|
26 |
+
|
27 |
+
/***************************************************************
|
28 |
+
* Load plugin textdomain
|
29 |
+
***************************************************************/
|
30 |
+
if (!function_exists('feedzy_rss_load_textdomain')) {
|
31 |
+
function feedzy_rss_load_textdomain() {
|
32 |
+
$path = dirname(plugin_basename( __FILE__ )) . '/langs/';
|
33 |
+
$loaded = load_plugin_textdomain( 'feedzy_rss_translate', false, $path);
|
34 |
+
}
|
35 |
+
add_action('init', 'feedzy_rss_load_textdomain');
|
36 |
+
}
|
37 |
+
|
38 |
+
|
39 |
+
/***************************************************************
|
40 |
+
* Load plugin files
|
41 |
+
***************************************************************/
|
42 |
+
require_once( plugin_dir_path( __FILE__ ) . '/feedzy-rss-feeds-ui.php' );
|
43 |
+
|
44 |
+
|
45 |
+
/***************************************************************
|
46 |
+
* Enqueue custom CSS
|
47 |
+
***************************************************************/
|
48 |
+
function feedzy_register_custom_style() {
|
49 |
+
wp_register_style( 'feedzy-style', plugins_url('css/feedzy-rss-feeds.css', __FILE__ ), NULL, NULL);
|
50 |
+
}
|
51 |
+
function feedzy_print_custom_style() {
|
52 |
+
global $feedzyStyle;
|
53 |
+
if ( ! $feedzyStyle )
|
54 |
+
return;
|
55 |
+
|
56 |
+
wp_print_styles('feedzy-style');
|
57 |
+
}
|
58 |
+
add_action('init', 'feedzy_register_custom_style');
|
59 |
+
add_action('wp_footer', 'feedzy_print_custom_style');
|
60 |
+
|
61 |
+
|
62 |
+
/***************************************************************
|
63 |
+
* Get an image from the feed
|
64 |
+
***************************************************************/
|
65 |
+
if (!function_exists('feedzy_returnImage')) {
|
66 |
+
function feedzy_returnImage ($text) {
|
67 |
+
$text = html_entity_decode($text, ENT_QUOTES, 'UTF-8');
|
68 |
+
$pattern = "/<img[^>]+\>/i";
|
69 |
+
preg_match($pattern, $text, $matches);
|
70 |
+
$text = $matches[0];
|
71 |
+
return $text;
|
72 |
+
}
|
73 |
+
}
|
74 |
+
|
75 |
+
|
76 |
+
/***************************************************************
|
77 |
+
* Filter out image url which we got from previous returnImage() function
|
78 |
+
***************************************************************/
|
79 |
+
if (!function_exists('feedzy_scrapeImage')) {
|
80 |
+
function feedzy_scrapeImage($text) {
|
81 |
+
$pattern = '/src=[\'"]?([^\'" >]+)[\'" >]/';
|
82 |
+
preg_match($pattern, $text, $link);
|
83 |
+
$link = $link[1];
|
84 |
+
$link = urldecode($link);
|
85 |
+
return $link;
|
86 |
+
}
|
87 |
+
}
|
88 |
+
|
89 |
+
|
90 |
+
/***************************************************************
|
91 |
+
* Main shortcode function
|
92 |
+
***************************************************************/
|
93 |
+
if (!function_exists('feedzy_rss')) {
|
94 |
+
function feedzy_rss( $atts, $content="" ) {
|
95 |
+
|
96 |
+
global $feedzyStyle;
|
97 |
+
$feedzyStyle = true;
|
98 |
+
//Retrieve & extract shorcode parameters
|
99 |
+
extract(shortcode_atts(array(
|
100 |
+
"feeds" => '', //comma separated feeds url
|
101 |
+
"max" => '5', //number of feeds items (0 for unlimited)
|
102 |
+
"feed_title" => 'yes', //display feed title yes/no
|
103 |
+
"target" => '_blank', //_blank, _self
|
104 |
+
"title" => '', //strip title after X char
|
105 |
+
"meta" => 'yes', //yes, no
|
106 |
+
"summary" => 'yes', //strip title
|
107 |
+
"summarylength" => '', //strip summary after X char
|
108 |
+
"thumb" => 'yes', //yes, no
|
109 |
+
"default" => '', //default thumb URL if no image found (only if thumb is set to yes)
|
110 |
+
"size" => '', //thumbs pixel size
|
111 |
+
"keywords_title" => '' //only display item if title contains specific keywords (comma-separated list/case sensitive)
|
112 |
+
), $atts));
|
113 |
+
$count = 0;
|
114 |
+
|
115 |
+
if($max == '0'){
|
116 |
+
$max = '999';
|
117 |
+
} else if(empty($max) || !ctype_digit($max)) {
|
118 |
+
$max = '5';
|
119 |
+
}
|
120 |
+
|
121 |
+
if(empty($size) || !ctype_digit($size))
|
122 |
+
$size = '150';
|
123 |
+
|
124 |
+
if(!empty($title) && !ctype_digit($title))
|
125 |
+
$title = '';
|
126 |
+
|
127 |
+
if(!empty($keywords_title))
|
128 |
+
$keywords_title = array_map('trim', explode(',', $keywords_title));
|
129 |
+
|
130 |
+
if(!empty($summarylength) && !ctype_digit($summarylength))
|
131 |
+
$summarylength = '';
|
132 |
+
|
133 |
+
if(!empty($default)){
|
134 |
+
$default = $default;
|
135 |
+
} else {
|
136 |
+
$default = plugins_url('img/feedzy-default.jpg', __FILE__ );
|
137 |
+
}
|
138 |
+
|
139 |
+
|
140 |
+
|
141 |
+
if (!class_exists('SimplePie'))
|
142 |
+
require_once(ABSPATH . WPINC . '/class-feed.php');
|
143 |
+
|
144 |
+
if (!empty ($feeds)) {
|
145 |
+
|
146 |
+
$feedURL = explode(',',$feeds);
|
147 |
+
$feedURL = array_splice($feedURL, 0, 3);
|
148 |
+
if (count($feedURL) === 1) {
|
149 |
+
$feedURL = $feedURL[0];
|
150 |
+
};
|
151 |
+
|
152 |
+
}
|
153 |
+
|
154 |
+
//Process SimplePie
|
155 |
+
$feed = new SimplePie();
|
156 |
+
$feed->set_feed_url($feedURL);
|
157 |
+
$feed->enable_cache(true);
|
158 |
+
$feed->enable_order_by_date(true);
|
159 |
+
$feed->set_cache_class( 'WP_Feed_Cache' );
|
160 |
+
$feed->set_file_class( 'WP_SimplePie_File' );
|
161 |
+
$feed->set_cache_duration( apply_filters( 'wp_feed_cache_transient_lifetime', 7200, $feedURL ) );
|
162 |
+
do_action_ref_array( 'wp_feed_options', array( $feed, $feedURL ) );
|
163 |
+
$feed->strip_comments(true);
|
164 |
+
$feed->strip_htmltags(false);
|
165 |
+
$feed->init();
|
166 |
+
$feed->handle_content_type();
|
167 |
+
|
168 |
+
if ($feed->error()) {
|
169 |
+
|
170 |
+
$content .= '<div id="message" class="error"><p>'. __( 'Sorry, this feed is currently unavailable or does not exists anymore.', 'feedzy_rss_translate' ) .'</p></div>';
|
171 |
+
|
172 |
+
}
|
173 |
+
|
174 |
+
$content .= '<div class="feedzy-rss">';
|
175 |
+
|
176 |
+
if($feed_title == 'yes'){
|
177 |
+
|
178 |
+
$content .= '<div class="rss_header">';
|
179 |
+
$content .= '<h2><a href="'. $feed->get_permalink() .'">'. $feed->get_title() .'</a> <span> '. $feed->get_description() .'</span></h2>';
|
180 |
+
$content .= '</div>';
|
181 |
+
|
182 |
+
}
|
183 |
+
|
184 |
+
//Loop through RSS feed
|
185 |
+
foreach ($feed->get_items() as $item){
|
186 |
+
|
187 |
+
$continue = true;
|
188 |
+
//Check if keywords are in title
|
189 |
+
if(!empty($keywords_title)){
|
190 |
+
$continue = false;
|
191 |
+
foreach($keywords_title as $keyword){
|
192 |
+
if (strpos($item->get_title(), $keyword) !== false) {
|
193 |
+
$continue = true;
|
194 |
+
}
|
195 |
+
}
|
196 |
+
|
197 |
+
}
|
198 |
+
|
199 |
+
if($continue == true){
|
200 |
+
|
201 |
+
//Count items
|
202 |
+
if($count >= $max)
|
203 |
+
break;
|
204 |
+
$count++;
|
205 |
+
|
206 |
+
//Fetch image thumbnail
|
207 |
+
if($thumb == 'yes'){
|
208 |
+
$thethumbnail = "";
|
209 |
+
|
210 |
+
if ($enclosure = $item->get_enclosure()) {
|
211 |
+
foreach ((array) $enclosure->get_link() as $thumbnail){
|
212 |
+
|
213 |
+
$pattern= '/https?:\/\/.*\.(?:jpg|JPG|jpe|JPE|jpeg|JPEG|gif|GIF|png|PNG)/iU';
|
214 |
+
$imgsrc = $thumbnail;
|
215 |
+
preg_match($pattern, $imgsrc, $matches);
|
216 |
+
$thumbnail = $matches[0];
|
217 |
+
|
218 |
+
if (!empty($thumbnail)){
|
219 |
+
|
220 |
+
$thethumbnail = $thumbnail;
|
221 |
+
break;
|
222 |
+
|
223 |
+
}
|
224 |
+
|
225 |
+
}
|
226 |
+
}
|
227 |
+
|
228 |
+
if(empty($thethumbnail)) {
|
229 |
+
|
230 |
+
$feedDescription = $item->get_description();
|
231 |
+
$image = feedzy_returnImage($feedDescription);
|
232 |
+
$thethumbnail = feedzy_scrapeImage($image);
|
233 |
+
|
234 |
+
}
|
235 |
+
|
236 |
+
if(empty($thethumbnail)) {
|
237 |
+
|
238 |
+
$feedDescription = $item->get_content();
|
239 |
+
$image = feedzy_returnImage($feedDescription);
|
240 |
+
$thethumbnail = feedzy_scrapeImage($image);
|
241 |
+
|
242 |
+
}
|
243 |
+
}
|
244 |
+
|
245 |
+
//Build element DOM
|
246 |
+
$content .= '<div class="rss_item">';
|
247 |
+
if($thumb == 'yes'){
|
248 |
+
if(!empty($thethumbnail)){
|
249 |
+
|
250 |
+
$content .= '<a href="'.$item->get_permalink().'" class="rss_image" target="'. $target .'" style="width:'. $size .'px; height:'. $size .'px;" title="'.$item->get_title().'" >';
|
251 |
+
$content .= '<span style="width:'. $size .'px; height:'. $size .'px; background-image: none, url('.$thethumbnail.'), url('.$default.');" alt="'.$item->get_title().'"></span/></a>';
|
252 |
+
|
253 |
+
} else if(empty($thethumbnail)){
|
254 |
+
|
255 |
+
$content .= '<a href="'.$item->get_permalink().'" class="rss_image" target="'. $target .'" style="width:'. $size .'px; height:'. $size .'px;" title="'.$item->get_title().'" >';
|
256 |
+
$content .= '<span style="width:'. $size .'px; height:'. $size .'px; background-image:url('.$default.');" alt="'.$item->get_title().'"></span/></a>';
|
257 |
+
|
258 |
+
}
|
259 |
+
}
|
260 |
+
$content .= '<span class="title"><a href="'. $item->get_permalink() .'" target="'. $target .'">';
|
261 |
+
if(is_numeric($title) && strlen($item->get_title()) > $title){
|
262 |
+
|
263 |
+
$content .= preg_replace('/\s+?(\S+)?$/', '', substr($item->get_title(), 0, $title)) .'...';
|
264 |
+
|
265 |
+
} else {
|
266 |
+
|
267 |
+
$content .= $item->get_title();
|
268 |
+
|
269 |
+
}
|
270 |
+
$content .= '</a></span>';
|
271 |
+
$content .= '<div class="rss_content">';
|
272 |
+
if($meta == 'yes'){
|
273 |
+
|
274 |
+
$content .= '<small>'. __( 'Posted by', 'feedzy_rss_translate' ) .' ';
|
275 |
+
|
276 |
+
if ($author = $item->get_author()) {
|
277 |
+
|
278 |
+
$domain = parse_url($item->get_permalink());
|
279 |
+
$content .= '<a href="http://'. $domain["host"]. '" target="'. $target .'" title="'.$domain["host"].'" >'. $author->get_name() .' </a>';
|
280 |
+
|
281 |
+
}
|
282 |
+
|
283 |
+
$content .= __( 'on', 'feedzy_rss_translate' ) .' '. $item->get_date(get_option('date_format')) .' '. __( 'at', 'feedzy_rss_translate' ) .' '. $item->get_date(get_option('time_format'));
|
284 |
+
$content .= '</small>';
|
285 |
+
|
286 |
+
}
|
287 |
+
if($summary == 'yes'){
|
288 |
+
|
289 |
+
$content .= '<p>';
|
290 |
+
$description = trim(strip_tags($item->get_description()));
|
291 |
+
$description = trim(chop($description,'[…]'));
|
292 |
+
|
293 |
+
if(is_numeric($summarylength) && strlen($description) > $summarylength){
|
294 |
+
|
295 |
+
$content .= preg_replace('/\s+?(\S+)?$/', '', substr($description, 0, $summarylength)) .' […]';
|
296 |
+
|
297 |
+
} else {
|
298 |
+
|
299 |
+
$content .= $description .' […]';
|
300 |
+
|
301 |
+
}
|
302 |
+
|
303 |
+
$content .= '</p>';
|
304 |
+
|
305 |
+
}
|
306 |
+
$content .= '</div>';
|
307 |
+
$content .= '</div>';
|
308 |
+
|
309 |
+
} //endContinue
|
310 |
+
|
311 |
+
} //endforeach
|
312 |
+
|
313 |
+
$content .= '</div>';
|
314 |
+
return $content;
|
315 |
+
|
316 |
+
} //end of feedzy_rss
|
317 |
+
add_shortcode( 'feedzy-rss', 'feedzy_rss' );
|
318 |
+
}
|
319 |
+
|
320 |
+
|
321 |
+
/***************************************************************
|
322 |
+
* Insert cover picture to main rss feed
|
323 |
+
***************************************************************/
|
324 |
+
if (!function_exists('feedzy_insert_thumbnail_RSS')) {
|
325 |
+
function feedzy_insert_thumbnail_RSS($content) {
|
326 |
+
global $post;
|
327 |
+
|
328 |
+
if ( has_post_thumbnail( $post->ID ) ){
|
329 |
+
$content = '' . get_the_post_thumbnail( $post->ID, 'thumbnail' ) . '' . $content;
|
330 |
+
}
|
331 |
+
|
332 |
+
return $content;
|
333 |
+
}
|
334 |
+
add_filter('the_excerpt_rss', 'feedzy_insert_thumbnail_RSS');
|
335 |
+
add_filter('the_content_feed', 'feedzy_insert_thumbnail_RSS');
|
336 |
+
}
|
feedzy-rss-style.css
CHANGED
@@ -3,6 +3,7 @@
|
|
3 |
* Plugin URI: http://b-website.com/
|
4 |
* Author: Brice CAPOBIANCO - b*web
|
5 |
*/
|
|
|
6 |
.feedzy-rss .rss_item {
|
7 |
border-bottom: 1px solid #eee;
|
8 |
padding: 1em 0 2em;
|
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;
|
img/feedzy-default.jpg
ADDED
Binary file
|
img/feedzy.svg
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="utf-8"?>
|
2 |
+
<!-- Generator: Adobe Illustrator 15.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
3 |
+
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
4 |
+
<svg version="1.1" id="Calque_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
5 |
+
width="850.39px" height="850.39px" viewBox="0 0 850.39 850.39" enable-background="new 0 0 850.39 850.39" xml:space="preserve">
|
6 |
+
<ellipse fill="#DB3939" cx="425.195" cy="426.195" rx="425.195" ry="424.195"/>
|
7 |
+
<g>
|
8 |
+
<path fill="#EFEEEE" d="M683.719,670.664h-91.574V461.21L390.062,259.73H180.24v-91.361h247.806l255.673,255.072V670.664z
|
9 |
+
M683.719,670.664"/>
|
10 |
+
<path fill="#EFEEEE" d="M531.176,670.664H439.6V537.366L313.852,411.931H180.24v-91.362h171.472l179.464,179.025V670.664z
|
11 |
+
M531.176,670.664"/>
|
12 |
+
<path fill="#EFEEEE" d="M378.647,670.664h-91.576v-57.116l-49.567-49.451H180.24V472.86h95.248l103.16,102.797V670.664z
|
13 |
+
M378.647,670.664"/>
|
14 |
+
</g>
|
15 |
+
</svg>
|
js/feedzy-rss-feeds-ui.js
ADDED
@@ -0,0 +1,170 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* Plugin Name: FEEDZY RSS Feeds by b*web
|
3 |
+
* Plugin URI: http://b-website.com/
|
4 |
+
* Author: Brice CAPOBIANCO
|
5 |
+
*/
|
6 |
+
(function() {
|
7 |
+
tinymce.PluginManager.add('feedzy_mce_button', function( editor, url ) {
|
8 |
+
editor.addButton( 'feedzy_mce_button', {
|
9 |
+
icon: 'feedzy-icon',
|
10 |
+
onclick: function() {
|
11 |
+
editor.windowManager.open( {
|
12 |
+
title: 'Insert FEEDZY RSS Feeds Shortcode',
|
13 |
+
body: [
|
14 |
+
{
|
15 |
+
type: 'textbox',
|
16 |
+
name: 'feeds',
|
17 |
+
label: 'The feed(s) URL (comma-separated list)',
|
18 |
+
value: ''
|
19 |
+
},
|
20 |
+
{
|
21 |
+
type: 'textbox',
|
22 |
+
name: 'maximum',
|
23 |
+
label: 'Number of items to display.',
|
24 |
+
value: ''
|
25 |
+
},
|
26 |
+
{
|
27 |
+
type: 'listbox',
|
28 |
+
name: 'feed_title',
|
29 |
+
label: 'Should we display the RSS title ?',
|
30 |
+
'values': [
|
31 |
+
{text: 'Do not specify', value: ''},
|
32 |
+
{text: 'No', value: 'no'},
|
33 |
+
{text: 'Yes', value: 'yes'},
|
34 |
+
]
|
35 |
+
},
|
36 |
+
{
|
37 |
+
type: 'listbox',
|
38 |
+
name: 'target',
|
39 |
+
label: 'Links may be opened in the same window or a new tab.',
|
40 |
+
'values': [
|
41 |
+
{text: 'Do not specify', value: ''},
|
42 |
+
{text: '_blank', value: '_blank'},
|
43 |
+
{text: '_self', value: '_self'},
|
44 |
+
{text: '_parent', value: '_parent'},
|
45 |
+
{text: '_top', value: '_top'},
|
46 |
+
{text: 'framename', value: 'framename'}
|
47 |
+
]
|
48 |
+
},
|
49 |
+
{
|
50 |
+
type: 'textbox',
|
51 |
+
name: 'title',
|
52 |
+
label: 'Trim the title of the item after X characters.',
|
53 |
+
value: ''
|
54 |
+
},
|
55 |
+
{
|
56 |
+
type: 'listbox',
|
57 |
+
name: 'meta',
|
58 |
+
label: 'Should we display the date of publication and the author name?',
|
59 |
+
'values': [
|
60 |
+
{text: 'Do not specify', value: ''},
|
61 |
+
{text: 'No', value: 'no'},
|
62 |
+
{text: 'Yes', value: 'yes'},
|
63 |
+
]
|
64 |
+
},
|
65 |
+
{
|
66 |
+
type: 'listbox',
|
67 |
+
name: 'summary',
|
68 |
+
label: 'Should we display a description (abstract) of the retrieved item?',
|
69 |
+
'values': [
|
70 |
+
{text: 'Do not specify', value: ''},
|
71 |
+
{text: 'No', value: 'no'},
|
72 |
+
{text: 'Yes', value: 'yes'},
|
73 |
+
]
|
74 |
+
},
|
75 |
+
{
|
76 |
+
type: 'textbox',
|
77 |
+
name: 'summarylength',
|
78 |
+
label: 'Crop description (summary) of the element after X characters.',
|
79 |
+
value: ''
|
80 |
+
},
|
81 |
+
{
|
82 |
+
type: 'listbox',
|
83 |
+
name: 'thumb',
|
84 |
+
label: 'Should we display the first image of the content if it is available?',
|
85 |
+
'values': [
|
86 |
+
{text: 'Do not specify', value: ''},
|
87 |
+
{text: 'No', value: 'no'},
|
88 |
+
{text: 'Yes', value: 'yes'},
|
89 |
+
]
|
90 |
+
},
|
91 |
+
{
|
92 |
+
type: 'textbox',
|
93 |
+
name: 'defaultimg',
|
94 |
+
label: 'Default thumbnail URL if no image is found. ',
|
95 |
+
value: ''
|
96 |
+
},
|
97 |
+
{
|
98 |
+
type: 'textbox',
|
99 |
+
name: 'size',
|
100 |
+
label: 'Thumblails dimension. Do not include "px". Eg: 150',
|
101 |
+
value: ''
|
102 |
+
},
|
103 |
+
{
|
104 |
+
type: 'textbox',
|
105 |
+
name: 'keywords_title',
|
106 |
+
label: 'Only display item if title contains specific keyword(s) (comma-separated list/case sensitive).',
|
107 |
+
value: ''
|
108 |
+
}
|
109 |
+
],
|
110 |
+
onsubmit: function( e ) {
|
111 |
+
if(e.data.feeds != ''){
|
112 |
+
e.data.feeds = 'feeds="' + e.data.feeds + '" ';
|
113 |
+
} else {
|
114 |
+
e.data.feeds = 'feeds="http://b-website.com/feed" ';
|
115 |
+
}
|
116 |
+
if(e.data.maximum != ''){
|
117 |
+
e.data.maximum = 'max="' + e.data.maximum + '" ';
|
118 |
+
}
|
119 |
+
if(e.data.feed_title != ''){
|
120 |
+
e.data.feed_title = 'feed_title="' + e.data.feed_title + '" ';
|
121 |
+
}
|
122 |
+
if(e.data.target != ''){
|
123 |
+
e.data.target = 'target="' + e.data.target + '" ';
|
124 |
+
}
|
125 |
+
if(e.data.title != ''){
|
126 |
+
e.data.title = 'title="' + e.data.title + '" ';
|
127 |
+
}
|
128 |
+
if(e.data.meta != ''){
|
129 |
+
e.data.meta = 'meta="' + e.data.meta + '" ';
|
130 |
+
}
|
131 |
+
if(e.data.summary != ''){
|
132 |
+
e.data.summary = 'summary="' + e.data.summary + '" ';
|
133 |
+
}
|
134 |
+
if(e.data.summarylength != ''){
|
135 |
+
e.data.summarylength = 'summarylength="' + e.data.summarylength + '" ';
|
136 |
+
}
|
137 |
+
if(e.data.thumb != ''){
|
138 |
+
e.data.thumb = 'thumb="' + e.data.thumb + '" ';
|
139 |
+
}
|
140 |
+
if(e.data.defaultimg != ''){
|
141 |
+
e.data.defaultimg = 'default="' + e.data.defaultimg + '" ';
|
142 |
+
}
|
143 |
+
if(e.data.size != ''){
|
144 |
+
e.data.size = 'size="' + e.data.size + '" ';
|
145 |
+
}
|
146 |
+
if(e.data.keywords_title != ''){
|
147 |
+
e.data.keywords_title = 'keywords_title="' + e.data.keywords_title + '" ';
|
148 |
+
}
|
149 |
+
editor.insertContent(
|
150 |
+
'[feedzy-rss '
|
151 |
+
+ e.data.feeds
|
152 |
+
+ e.data.maximum
|
153 |
+
+ e.data.feed_title
|
154 |
+
+ e.data.target
|
155 |
+
+ e.data.title
|
156 |
+
+ e.data.meta
|
157 |
+
+ e.data.summary
|
158 |
+
+ e.data.summarylength
|
159 |
+
+ e.data.thumb
|
160 |
+
+ e.data.defaultimg
|
161 |
+
+ e.data.size
|
162 |
+
+ e.data.keywords_title
|
163 |
+
+ ']'
|
164 |
+
);
|
165 |
+
}
|
166 |
+
});
|
167 |
+
}
|
168 |
+
});
|
169 |
+
});
|
170 |
+
})();
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i
|
|
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.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -23,6 +23,8 @@ You may use this plugin in your widgets and your pages and reuse the shortcode s
|
|
23 |
|
24 |
By activating this plugin, your cover picture will be inserted into your RSS feeds. By doing so, you'll make it will easier for external sites to retrieve images from your feeds.
|
25 |
|
|
|
|
|
26 |
|
27 |
[CHECK OUT THE DEMO](http://b-website.com/feedzy-rss-feeds-wordpress-plugin-using-simplepie "Try It!")
|
28 |
|
@@ -32,92 +34,34 @@ By activating this plugin, your cover picture will be inserted into your RSS fee
|
|
32 |
|
33 |
= Shortcode Parameters =
|
34 |
|
35 |
-
|
36 |
-
|
37 |
-
*
|
38 |
-
*
|
39 |
-
*
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
*
|
45 |
-
*
|
46 |
-
*
|
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 may 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 retrieved item?
|
73 |
-
* Format : yes/no
|
74 |
-
* Default : yes
|
75 |
-
|
76 |
|
77 |
-
**summary**
|
78 |
|
79 |
-
|
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 |
-
|
94 |
-
* Format : yes/no
|
95 |
-
* Default : yes
|
96 |
|
97 |
|
98 |
-
|
99 |
|
100 |
-
|
101 |
-
* Format : URL
|
102 |
-
* Default : empty
|
103 |
|
104 |
|
105 |
-
**size**
|
106 |
|
107 |
-
|
108 |
-
* Format : numeric
|
109 |
-
* Default : 10
|
110 |
|
111 |
|
112 |
-
= Basic example =
|
113 |
-
|
114 |
-
`[feedzy-rss feeds="http://b-website.com/feed"]`
|
115 |
-
|
116 |
-
|
117 |
-
= Advanced example =
|
118 |
-
|
119 |
-
`[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" default="default-image.jpg"]`
|
120 |
-
|
121 |
|
122 |
== Installation ==
|
123 |
|
@@ -134,11 +78,19 @@ Yes it is.
|
|
134 |
== Screenshots ==
|
135 |
|
136 |
1. Simple example
|
|
|
137 |
|
138 |
|
139 |
== Changelog ==
|
140 |
|
141 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
142 |
= 1.4 =
|
143 |
* Add "default" parameter to fill image container if no image is fetch or if it is offline
|
144 |
* Add more control over numeric format in max, size, title & summarylength parameters
|
@@ -159,5 +111,8 @@ Yes it is.
|
|
159 |
|
160 |
== Upgrade Notice ==
|
161 |
|
|
|
|
|
|
|
162 |
= 1.0 =
|
163 |
* First release.
|
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.5
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
23 |
|
24 |
By activating this plugin, your cover picture will be inserted into your RSS feeds. By doing so, you'll make it will easier for external sites to retrieve images from your feeds.
|
25 |
|
26 |
+
Plugin is now using the TinyMCE API to improve UI and makes it easy to insert shortcodes!
|
27 |
+
|
28 |
|
29 |
[CHECK OUT THE DEMO](http://b-website.com/feedzy-rss-feeds-wordpress-plugin-using-simplepie "Try It!")
|
30 |
|
34 |
|
35 |
= Shortcode Parameters =
|
36 |
|
37 |
+
* feeds
|
38 |
+
* max
|
39 |
+
* feed_title
|
40 |
+
* target
|
41 |
+
* title
|
42 |
+
* meta
|
43 |
+
* summary
|
44 |
+
* summarylength
|
45 |
+
* thumb
|
46 |
+
* default
|
47 |
+
* size
|
48 |
+
* keywords_title
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
|
|
|
50 |
|
51 |
+
= Basic example =
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
|
53 |
+
`[feedzy-rss feeds="http://b-website.com/feed"]`
|
|
|
|
|
54 |
|
55 |
|
56 |
+
= Advanced example =
|
57 |
|
58 |
+
`[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" default="http://your-site/default-image.jpg" keywords_title="WordPress"]`
|
|
|
|
|
59 |
|
60 |
|
|
|
61 |
|
62 |
+
[FULL DOCUMENTAION AND EXAMPLES](http://b-website.com/feedzy-rss-feeds-wordpress-plugin-using-simplepie "Documentation & examples")
|
|
|
|
|
63 |
|
64 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
65 |
|
66 |
== Installation ==
|
67 |
|
78 |
== Screenshots ==
|
79 |
|
80 |
1. Simple example
|
81 |
+
2. Inserting a shortcode in the WYSIWYG
|
82 |
|
83 |
|
84 |
== Changelog ==
|
85 |
|
86 |
|
87 |
+
= 1.5 =
|
88 |
+
* New param added to filter item with keywords
|
89 |
+
* Default thumb added
|
90 |
+
* Fix minor php issue
|
91 |
+
* Rename files of the plugin
|
92 |
+
* New logo + screenshot (assets)
|
93 |
+
|
94 |
= 1.4 =
|
95 |
* Add "default" parameter to fill image container if no image is fetch or if it is offline
|
96 |
* Add more control over numeric format in max, size, title & summarylength parameters
|
111 |
|
112 |
== Upgrade Notice ==
|
113 |
|
114 |
+
= 1.5 =
|
115 |
+
* IMPORTANT: You have to reactivate the plugin after its update!
|
116 |
+
|
117 |
= 1.0 =
|
118 |
* First release.
|