FEEDZY RSS Feeds Lite - Version 2.3

Version Description

  • New hook: feedzy_feed_items
  • New hook: feedzy_item_keyword
  • Introduce SimplePie native strip_htmltags() method
  • Use PNG icon as SVG fallback on the visual editor button
  • Improve plugin's files structure
  • readme.txt and hooks documentation update
Download this release

Release Info

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

Code changes from version 2.2.2 to 2.3

css/feedzy-rss-feeds.css CHANGED
@@ -35,7 +35,8 @@
35
 
36
  /*TinyMce UI button*/
37
  i.mce-i-feedzy-icon {
38
- background-image: url('../img/feedzy.svg');
 
39
  }
40
  .mce-feedzy-media {
41
  padding-right: 25px;
35
 
36
  /*TinyMce UI button*/
37
  i.mce-i-feedzy-icon {
38
+ background-image: url('../img/feedzy.png');
39
+ background-image: none, url('../img/feedzy.svg'), url('../img/feedzy.png');
40
  }
41
  .mce-feedzy-media {
42
  padding-right: 25px;
feedzy-rss-feed.php CHANGED
@@ -5,7 +5,7 @@
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: 2.2.2
9
  * Text Domain: feedzy_rss_translate
10
  * Domain Path: /langs
11
  */
@@ -46,60 +46,7 @@ add_filter( 'plugin_row_meta', 'feedzy_meta_links', 10, 2 );
46
  /***************************************************************
47
  * Load plugin files
48
  ***************************************************************/
49
- $feedzyFiles = array( 'shortcode', 'widget','ui' );
50
  foreach( $feedzyFiles as $feedzyFile ){
51
  require_once( plugin_dir_path( __FILE__ ) . 'feedzy-rss-feeds-' . $feedzyFile . '.php' );
52
- }
53
-
54
-
55
- /***************************************************************
56
- * Enqueue custom CSS
57
- ***************************************************************/
58
- function feedzy_register_custom_style() {
59
- wp_register_style( 'feedzy-style', plugins_url('css/feedzy-rss-feeds.css', __FILE__ ), NULL, NULL );
60
- }
61
- function feedzy_print_custom_style() {
62
- global $feedzyStyle;
63
- if ( !$feedzyStyle )
64
- return;
65
-
66
- wp_print_styles( 'feedzy-style' );
67
- }
68
- add_action( 'init', 'feedzy_register_custom_style' );
69
- add_action( 'wp_footer', 'feedzy_print_custom_style' );
70
-
71
-
72
- /***************************************************************
73
- * Insert cover picture to main rss feed content
74
- ***************************************************************/
75
- function feedzy_insert_thumbnail_RSS( $content ) {
76
- global $post;
77
- if ( has_post_thumbnail( $post->ID ) ){
78
- $content = '' . get_the_post_thumbnail( $post->ID, 'thumbnail' ) . '' . $content;
79
- }
80
- return $content;
81
- }
82
- add_filter( 'the_excerpt_rss', 'feedzy_insert_thumbnail_RSS' );
83
- add_filter( 'the_content_feed', 'feedzy_insert_thumbnail_RSS' );
84
-
85
-
86
- /***************************************************************
87
- * Include cover picture (medium) to rss feed enclosure
88
- * and media:content
89
- ***************************************************************/
90
- function feedzy_include_thumbnail_RSS (){
91
- global $post;
92
-
93
- if ( has_post_thumbnail( $post->ID ) ){
94
-
95
- $postThumbnailId = get_post_thumbnail_id( $post->ID );
96
- $attachmentMeta = wp_get_attachment_metadata( $postThumbnailId );
97
- $imageUrl = wp_get_attachment_image_src( $postThumbnailId, 'medium' );
98
-
99
- echo '<enclosure url="' . $imageUrl[0] . '" length="' . filesize( get_attached_file( $postThumbnailId ) ) . '" type="image/jpg" />';
100
- echo '<media:content url="' . $imageUrl[0] . '" width="' . $attachmentMeta['sizes']['medium']['width'] . '" height="' . $attachmentMeta['sizes']['medium']['height'] . '" medium="image" type="' . $attachmentMeta['sizes']['medium']['mime-type'] . '" />';
101
-
102
- }
103
- }
104
- //add_action('rss_item', 'feedzy_include_thumbnail_RSS');
105
- //add_action('rss2_item', 'feedzy_include_thumbnail_RSS');
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: 2.3
9
  * Text Domain: feedzy_rss_translate
10
  * Domain Path: /langs
11
  */
46
  /***************************************************************
47
  * Load plugin files
48
  ***************************************************************/
49
+ $feedzyFiles = array( 'functions', 'shortcode', 'widget','ui' );
50
  foreach( $feedzyFiles as $feedzyFile ){
51
  require_once( plugin_dir_path( __FILE__ ) . 'feedzy-rss-feeds-' . $feedzyFile . '.php' );
52
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
feedzy-rss-feeds-functions.php ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /***************************************************************
3
+ * Enqueue feedzy CSS
4
+ ***************************************************************/
5
+ function feedzy_register_custom_style() {
6
+ wp_register_style( 'feedzy-style', plugins_url('css/feedzy-rss-feeds.css', __FILE__ ), NULL, NULL );
7
+ }
8
+ function feedzy_print_custom_style() {
9
+ global $feedzyStyle;
10
+ if ( !$feedzyStyle )
11
+ return;
12
+
13
+ wp_print_styles( 'feedzy-style' );
14
+ }
15
+ add_action( 'init', 'feedzy_register_custom_style' );
16
+ add_action( 'wp_footer', 'feedzy_print_custom_style' );
17
+
18
+
19
+ /***************************************************************
20
+ * Filter feed description input
21
+ ***************************************************************/
22
+ function feedzy_summary_input_filter( $description, $content, $feedURL ) {
23
+ $description = trim( strip_tags( $description ) );
24
+ $description = trim( chop( $description, '[&hellip;]' ) );
25
+
26
+ return $description;
27
+ }
28
+ add_filter('feedzy_summary_input', 'feedzy_summary_input_filter', 9, 3);
29
+
30
+
31
+ /***************************************************************
32
+ * Check if keywords are in title
33
+ ***************************************************************/
34
+ function feedzy_feed_item_keywords_title( $continue, $keywords_title, $item, $feedURL ){
35
+ if ( !empty( $keywords_title ) ) {
36
+ $continue = false;
37
+ foreach ( $keywords_title as $keyword ) {
38
+ if ( strpos( $item->get_title(), $keyword ) !== false ) {
39
+ $continue = true;
40
+ }
41
+ }
42
+ }
43
+ return $continue;
44
+ }
45
+ add_filter('feedzy_item_keyword', 'feedzy_feed_item_keywords_title', 9, 4);
46
+
47
+
48
+ /***************************************************************
49
+ * Insert cover picture to main rss feed content
50
+ ***************************************************************/
51
+ function feedzy_insert_thumbnail_RSS( $content ) {
52
+ global $post;
53
+ if ( has_post_thumbnail( $post->ID ) ){
54
+ $content = '' . get_the_post_thumbnail( $post->ID, 'thumbnail' ) . '' . $content;
55
+ }
56
+ return $content;
57
+ }
58
+ add_filter( 'the_excerpt_rss', 'feedzy_insert_thumbnail_RSS' );
59
+ add_filter( 'the_content_feed', 'feedzy_insert_thumbnail_RSS' );
60
+
61
+
62
+ /***************************************************************
63
+ * Include cover picture (medium) to rss feed enclosure
64
+ * and media:content
65
+ ***************************************************************/
66
+ function feedzy_include_thumbnail_RSS (){
67
+ global $post;
68
+
69
+ if ( has_post_thumbnail( $post->ID ) ){
70
+
71
+ $postThumbnailId = get_post_thumbnail_id( $post->ID );
72
+ $attachmentMeta = wp_get_attachment_metadata( $postThumbnailId );
73
+ $imageUrl = wp_get_attachment_image_src( $postThumbnailId, 'medium' );
74
+
75
+ echo '<enclosure url="' . $imageUrl[0] . '" length="' . filesize( get_attached_file( $postThumbnailId ) ) . '" type="image/jpg" />';
76
+ echo '<media:content url="' . $imageUrl[0] . '" width="' . $attachmentMeta['sizes']['medium']['width'] . '" height="' . $attachmentMeta['sizes']['medium']['height'] . '" medium="image" type="' . $attachmentMeta['sizes']['medium']['mime-type'] . '" />';
77
+
78
+ }
79
+ }
80
+ //add_action('rss_item', 'feedzy_include_thumbnail_RSS');
81
+ //add_action('rss2_item', 'feedzy_include_thumbnail_RSS');
feedzy-rss-feeds-shortcode.php CHANGED
@@ -40,6 +40,11 @@ function feedzy_rss( $atts, $content = '' ) {
40
  $feedzyStyle = true;
41
  $count = 0;
42
 
 
 
 
 
 
43
  //Retrieve & extract shorcode parameters
44
  extract( shortcode_atts( array(
45
  "feeds" => '', //comma separated feeds url
@@ -85,12 +90,6 @@ function feedzy_rss( $atts, $content = '' ) {
85
  $default = plugins_url( 'img/feedzy-default.jpg', __FILE__ );
86
  }
87
 
88
-
89
-
90
- if ( !class_exists( 'SimplePie' ) ){
91
- require_once( ABSPATH . WPINC . '/class-feed.php' );
92
- }
93
-
94
  if ( !empty( $feeds ) ) {
95
 
96
  $feedURL = explode( ',', $feeds );
@@ -100,9 +99,9 @@ function feedzy_rss( $atts, $content = '' ) {
100
  }
101
 
102
  }
103
-
104
- //Load SimplePie Instance
105
- $feed = new SimplePie();
106
  $feed->set_feed_url( $feedURL );
107
  $feed->enable_cache( true );
108
  $feed->enable_order_by_date( true );
@@ -111,7 +110,7 @@ function feedzy_rss( $atts, $content = '' ) {
111
  $feed->set_cache_duration( apply_filters( 'wp_feed_cache_transient_lifetime', 7200, $feedURL ) );
112
  do_action_ref_array( 'wp_feed_options', array( $feed, $feedURL ) );
113
  $feed->strip_comments( true );
114
- $feed->strip_htmltags( false );
115
  $feed->init();
116
  $feed->handle_content_type();
117
 
@@ -132,18 +131,10 @@ function feedzy_rss( $atts, $content = '' ) {
132
  }
133
 
134
  //Loop through RSS feed
135
- foreach ( $feed->get_items() as $item ) {
136
-
137
- $continue = true;
138
- //Check if keywords are in title
139
- if ( !empty( $keywords_title ) ) {
140
- $continue = false;
141
- foreach ( $keywords_title as $keyword ) {
142
- if ( strpos( $item->get_title(), $keyword ) !== false ) {
143
- $continue = true;
144
- }
145
- }
146
- }
147
 
148
  if ( $continue == true ) {
149
 
@@ -355,16 +346,4 @@ function feedzy_rss( $atts, $content = '' ) {
355
  return apply_filters( 'feedzy_global_output', $content, $feedURL );
356
 
357
  }//end of feedzy_rss
358
- add_shortcode( 'feedzy-rss', 'feedzy_rss' );
359
-
360
-
361
- /***************************************************************
362
- * Filter feed description input
363
- ***************************************************************/
364
- function feedzy_summary_input_filter( $description, $content, $feedURL ) {
365
- $description = trim( strip_tags( $description ) );
366
- $description = trim( chop( $description, '[&hellip;]' ) );
367
-
368
- return $description;
369
- }
370
- add_filter('feedzy_summary_input', 'feedzy_summary_input_filter', 9, 3);
40
  $feedzyStyle = true;
41
  $count = 0;
42
 
43
+ //Load SimplePie if not already
44
+ if ( !class_exists( 'SimplePie' ) ){
45
+ require_once( ABSPATH . WPINC . '/class-feed.php' );
46
+ }
47
+
48
  //Retrieve & extract shorcode parameters
49
  extract( shortcode_atts( array(
50
  "feeds" => '', //comma separated feeds url
90
  $default = plugins_url( 'img/feedzy-default.jpg', __FILE__ );
91
  }
92
 
 
 
 
 
 
 
93
  if ( !empty( $feeds ) ) {
94
 
95
  $feedURL = explode( ',', $feeds );
99
  }
100
 
101
  }
102
+
103
+ //Load SimplePie Instance
104
+ $feed = new SimplePie();
105
  $feed->set_feed_url( $feedURL );
106
  $feed->enable_cache( true );
107
  $feed->enable_order_by_date( true );
110
  $feed->set_cache_duration( apply_filters( 'wp_feed_cache_transient_lifetime', 7200, $feedURL ) );
111
  do_action_ref_array( 'wp_feed_options', array( $feed, $feedURL ) );
112
  $feed->strip_comments( true );
113
+ $feed->strip_htmltags( array( 'base', 'blink', 'body', 'doctype', 'embed', 'font', 'form', 'frame', 'frameset', 'html', 'iframe', 'input', 'marquee', 'meta', 'noscript', 'object', 'param', 'script', 'style' ) );
114
  $feed->init();
115
  $feed->handle_content_type();
116
 
131
  }
132
 
133
  //Loop through RSS feed
134
+ $items = apply_filters( 'feedzy_feed_items', $feed->get_items(), $feedURL );
135
+ foreach ( (array) $items as $item ) {
136
+
137
+ $continue = apply_filters( 'feedzy_item_keyword', true, $keywords_title, $item, $feedURL );
 
 
 
 
 
 
 
 
138
 
139
  if ( $continue == true ) {
140
 
346
  return apply_filters( 'feedzy_global_output', $content, $feedURL );
347
 
348
  }//end of feedzy_rss
349
+ add_shortcode( 'feedzy-rss', 'feedzy_rss' );
 
 
 
 
 
 
 
 
 
 
 
 
img/feedzy.png ADDED
Binary file
readme.txt CHANGED
@@ -1,10 +1,10 @@
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, tinyMCE, WYSIWYG, MCE, UI, flux, plugin, WordPress
5
  Requires at least: 3.7
6
  Tested up to: 4.1
7
- Stable tag: 2.2.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -60,6 +60,8 @@ By activating this plugin, your cover picture will be inserted into your RSS fee
60
 
61
  = Available Hooks =
62
 
 
 
63
  * feedzy_thumb_output
64
  * feedzy_title_output
65
  * feedzy_meta_args
@@ -102,6 +104,14 @@ Yes it is.
102
 
103
  == Changelog ==
104
 
 
 
 
 
 
 
 
 
105
  = 2.2.2 =
106
  * New hook: feedzy_meta_args
107
 
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, tinyMCE, WYSIWYG, MCE, UI, flux, plugin, WordPress, widget, importer, XML, ATOM, API, parser
5
  Requires at least: 3.7
6
  Tested up to: 4.1
7
+ Stable tag: 2.3
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
60
 
61
  = Available Hooks =
62
 
63
+ * feedzy_feed_items
64
+ * feedzy_item_keyword
65
  * feedzy_thumb_output
66
  * feedzy_title_output
67
  * feedzy_meta_args
104
 
105
  == Changelog ==
106
 
107
+ = 2.3 =
108
+ * New hook: feedzy_feed_items
109
+ * New hook: feedzy_item_keyword
110
+ * Introduce SimplePie native strip_htmltags() method
111
+ * Use PNG icon as SVG fallback on the visual editor button
112
+ * Improve plugin's files structure
113
+ * readme.txt and hooks documentation update
114
+
115
  = 2.2.2 =
116
  * New hook: feedzy_meta_args
117