Version Description
- New feature: 'auto' thumbs option added
- New hook: feedzy_thumb_sizes
- Fix issue on max number of feeds to display
- Fix HTML decode in the feed's title
- Minor PHP improvements
- readme.txt and hooks documentation update
Download this release
Release Info
| Developer | briKou |
| Plugin | |
| Version | 2.4 |
| Comparing to | |
| See all releases | |
Code changes from version 2.3 to 2.4
- feedzy-rss-feed.php +1 -1
- feedzy-rss-feeds-functions.php +24 -0
- feedzy-rss-feeds-shortcode.php +37 -55
- feedzy-rss-feeds-ui-lang.php +1 -0
- feedzy-rss-feeds-widget.php +57 -31
- js/feedzy-rss-feeds-ui-mce.js +1 -0
- readme.txt +10 -1
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.
|
| 9 |
* Text Domain: feedzy_rss_translate
|
| 10 |
* Domain Path: /langs
|
| 11 |
*/
|
| 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.4
|
| 9 |
* Text Domain: feedzy_rss_translate
|
| 10 |
* Domain Path: /langs
|
| 11 |
*/
|
feedzy-rss-feeds-functions.php
CHANGED
|
@@ -16,6 +16,30 @@ 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 |
***************************************************************/
|
| 16 |
add_action( 'wp_footer', 'feedzy_print_custom_style' );
|
| 17 |
|
| 18 |
|
| 19 |
+
/***************************************************************
|
| 20 |
+
* Get an image from the feed
|
| 21 |
+
***************************************************************/
|
| 22 |
+
function feedzy_returnImage ($text) {
|
| 23 |
+
$text = html_entity_decode($text, ENT_QUOTES, 'UTF-8');
|
| 24 |
+
$pattern = "/<img[^>]+\>/i";
|
| 25 |
+
preg_match($pattern, $text, $matches);
|
| 26 |
+
$text = $matches[0];
|
| 27 |
+
return $text;
|
| 28 |
+
}
|
| 29 |
+
|
| 30 |
+
|
| 31 |
+
/***************************************************************
|
| 32 |
+
* Filter out image url which we got from previous returnImage() function
|
| 33 |
+
***************************************************************/
|
| 34 |
+
function feedzy_scrapeImage($text) {
|
| 35 |
+
$pattern = '/src=[\'"]?([^\'" >]+)[\'" >]/';
|
| 36 |
+
preg_match($pattern, $text, $link);
|
| 37 |
+
$link = $link[1];
|
| 38 |
+
$link = urldecode($link);
|
| 39 |
+
return $link;
|
| 40 |
+
}
|
| 41 |
+
|
| 42 |
+
|
| 43 |
/***************************************************************
|
| 44 |
* Filter feed description input
|
| 45 |
***************************************************************/
|
feedzy-rss-feeds-shortcode.php
CHANGED
|
@@ -7,30 +7,6 @@ if ( !defined( 'ABSPATH' ) ) {
|
|
| 7 |
}
|
| 8 |
|
| 9 |
|
| 10 |
-
/***************************************************************
|
| 11 |
-
* Get an image from the feed
|
| 12 |
-
***************************************************************/
|
| 13 |
-
function feedzy_returnImage ($text) {
|
| 14 |
-
$text = html_entity_decode($text, ENT_QUOTES, 'UTF-8');
|
| 15 |
-
$pattern = "/<img[^>]+\>/i";
|
| 16 |
-
preg_match($pattern, $text, $matches);
|
| 17 |
-
$text = $matches[0];
|
| 18 |
-
return $text;
|
| 19 |
-
}
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
/***************************************************************
|
| 23 |
-
* Filter out image url which we got from previous returnImage() function
|
| 24 |
-
***************************************************************/
|
| 25 |
-
function feedzy_scrapeImage($text) {
|
| 26 |
-
$pattern = '/src=[\'"]?([^\'" >]+)[\'" >]/';
|
| 27 |
-
preg_match($pattern, $text, $link);
|
| 28 |
-
$link = $link[1];
|
| 29 |
-
$link = urldecode($link);
|
| 30 |
-
return $link;
|
| 31 |
-
}
|
| 32 |
-
|
| 33 |
-
|
| 34 |
/***************************************************************
|
| 35 |
* Main shortcode function
|
| 36 |
***************************************************************/
|
|
@@ -55,8 +31,8 @@ function feedzy_rss( $atts, $content = '' ) {
|
|
| 55 |
"meta" => 'yes', //yes, no
|
| 56 |
"summary" => 'yes', //strip title
|
| 57 |
"summarylength" => '', //strip summary after X char
|
| 58 |
-
"thumb" => 'yes', //yes, no
|
| 59 |
-
"default" => '', //default thumb URL if no image found (only if thumb is set to yes)
|
| 60 |
"size" => '', //thumbs pixel size
|
| 61 |
"keywords_title" => '' //only display item if title contains specific keywords (comma-separated list/case sensitive)
|
| 62 |
), $atts ) );
|
|
@@ -70,6 +46,8 @@ function feedzy_rss( $atts, $content = '' ) {
|
|
| 70 |
if ( empty( $size ) || !ctype_digit( $size ) ){
|
| 71 |
$size = '150';
|
| 72 |
}
|
|
|
|
|
|
|
| 73 |
|
| 74 |
if ( !empty( $title ) && !ctype_digit( $title ) ){
|
| 75 |
$title = '';
|
|
@@ -91,9 +69,9 @@ function feedzy_rss( $atts, $content = '' ) {
|
|
| 91 |
}
|
| 92 |
|
| 93 |
if ( !empty( $feeds ) ) {
|
| 94 |
-
|
| 95 |
$feedURL = explode( ',', $feeds );
|
| 96 |
-
|
| 97 |
if ( count( $feedURL ) === 1 ) {
|
| 98 |
$feedURL = $feedURL[0];
|
| 99 |
}
|
|
@@ -102,17 +80,17 @@ function feedzy_rss( $atts, $content = '' ) {
|
|
| 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 );
|
| 108 |
-
$feed->set_cache_class( 'WP_Feed_Cache' );
|
| 109 |
-
$feed->set_file_class( 'WP_SimplePie_File' );
|
| 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 |
|
| 117 |
if ($feed->error()) {
|
| 118 |
|
|
@@ -125,7 +103,7 @@ function feedzy_rss( $atts, $content = '' ) {
|
|
| 125 |
if ($feed_title == 'yes') {
|
| 126 |
|
| 127 |
$content .= '<div class="rss_header">';
|
| 128 |
-
$content .= '<h2><a href="' . $feed->get_permalink() . '">' . $feed->get_title() . '</a> <span> ' . $feed->get_description() . '</span></h2>';
|
| 129 |
$content .= '</div>';
|
| 130 |
|
| 131 |
}
|
|
@@ -145,7 +123,7 @@ function feedzy_rss( $atts, $content = '' ) {
|
|
| 145 |
$count++;
|
| 146 |
|
| 147 |
//Fetch image thumbnail
|
| 148 |
-
if ( $thumb == 'yes' ) {
|
| 149 |
$thethumbnail = "";
|
| 150 |
|
| 151 |
|
|
@@ -223,31 +201,35 @@ function feedzy_rss( $atts, $content = '' ) {
|
|
| 223 |
}
|
| 224 |
|
| 225 |
//Padding ratio based on image size
|
| 226 |
-
$paddinTop = number_format( (15 / 150) * $
|
| 227 |
-
$paddinBottom = number_format( (25 / 150) * $
|
| 228 |
|
| 229 |
//Build element DOM
|
| 230 |
$content .= '<div class="rss_item" style="padding: ' . $paddinTop . 'px 0 ' . $paddinBottom . 'px">';
|
| 231 |
|
| 232 |
-
if ( $thumb == 'yes' ) {
|
| 233 |
|
| 234 |
$contentThumb = '';
|
| 235 |
|
| 236 |
-
|
| 237 |
-
$contentThumb .= '<a href="' . $item->get_permalink() . '" target="' . $target . '" title="' . $item->get_title() . '" >';
|
| 238 |
-
|
| 239 |
-
if ( !empty( $thethumbnail )) {
|
| 240 |
|
| 241 |
-
$contentThumb .= '<
|
| 242 |
-
|
| 243 |
-
} else if ( empty( $thethumbnail ) ) {
|
| 244 |
-
|
| 245 |
-
$contentThumb .= '<span style="width:' . $size . 'px; height:' . $size . 'px; background-image:url(' . $default . ');" alt="' . $item->get_title() . '"></span/>';
|
| 246 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 247 |
}
|
| 248 |
-
|
| 249 |
-
$contentThumb .= '</a>';
|
| 250 |
-
$contentThumb .= '</div>';
|
| 251 |
|
| 252 |
//Filter: feedzy_thumb_output
|
| 253 |
$content .= apply_filters( 'feedzy_thumb_output', $contentThumb, $feedURL );
|
| 7 |
}
|
| 8 |
|
| 9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
/***************************************************************
|
| 11 |
* Main shortcode function
|
| 12 |
***************************************************************/
|
| 31 |
"meta" => 'yes', //yes, no
|
| 32 |
"summary" => 'yes', //strip title
|
| 33 |
"summarylength" => '', //strip summary after X char
|
| 34 |
+
"thumb" => 'yes', //yes, no, auto
|
| 35 |
+
"default" => '', //default thumb URL if no image found (only if thumb is set to yes or auto)
|
| 36 |
"size" => '', //thumbs pixel size
|
| 37 |
"keywords_title" => '' //only display item if title contains specific keywords (comma-separated list/case sensitive)
|
| 38 |
), $atts ) );
|
| 46 |
if ( empty( $size ) || !ctype_digit( $size ) ){
|
| 47 |
$size = '150';
|
| 48 |
}
|
| 49 |
+
$sizes = array( 'width' => $size, 'height' => $size );
|
| 50 |
+
$sizes = apply_filters( 'feedzy_thumb_sizes', $sizes, $feedURL );
|
| 51 |
|
| 52 |
if ( !empty( $title ) && !ctype_digit( $title ) ){
|
| 53 |
$title = '';
|
| 69 |
}
|
| 70 |
|
| 71 |
if ( !empty( $feeds ) ) {
|
| 72 |
+
|
| 73 |
$feedURL = explode( ',', $feeds );
|
| 74 |
+
|
| 75 |
if ( count( $feedURL ) === 1 ) {
|
| 76 |
$feedURL = $feedURL[0];
|
| 77 |
}
|
| 80 |
|
| 81 |
//Load SimplePie Instance
|
| 82 |
$feed = new SimplePie();
|
| 83 |
+
$feed -> set_feed_url( $feedURL );
|
| 84 |
+
$feed -> enable_cache( true );
|
| 85 |
+
$feed -> enable_order_by_date( true );
|
| 86 |
+
$feed -> set_cache_class( 'WP_Feed_Cache' );
|
| 87 |
+
$feed -> set_file_class( 'WP_SimplePie_File' );
|
| 88 |
+
$feed -> set_cache_duration( apply_filters( 'wp_feed_cache_transient_lifetime', 7200, $feedURL ) );
|
| 89 |
do_action_ref_array( 'wp_feed_options', array( $feed, $feedURL ) );
|
| 90 |
+
$feed -> strip_comments( true );
|
| 91 |
+
$feed -> strip_htmltags( array( 'base', 'blink', 'body', 'doctype', 'embed', 'font', 'form', 'frame', 'frameset', 'html', 'iframe', 'input', 'marquee', 'meta', 'noscript', 'object', 'param', 'script', 'style' ) );
|
| 92 |
+
$feed -> init();
|
| 93 |
+
$feed -> handle_content_type();
|
| 94 |
|
| 95 |
if ($feed->error()) {
|
| 96 |
|
| 103 |
if ($feed_title == 'yes') {
|
| 104 |
|
| 105 |
$content .= '<div class="rss_header">';
|
| 106 |
+
$content .= '<h2><a href="' . $feed->get_permalink() . '" class="rss_title">' . html_entity_decode( $feed->get_title() ) . '</a> <span class="rss_description"> ' . $feed->get_description() . '</span></h2>';
|
| 107 |
$content .= '</div>';
|
| 108 |
|
| 109 |
}
|
| 123 |
$count++;
|
| 124 |
|
| 125 |
//Fetch image thumbnail
|
| 126 |
+
if ( $thumb == 'yes' || $thumb == 'auto' ) {
|
| 127 |
$thethumbnail = "";
|
| 128 |
|
| 129 |
|
| 201 |
}
|
| 202 |
|
| 203 |
//Padding ratio based on image size
|
| 204 |
+
$paddinTop = number_format( (15 / 150) * $sizes['height'], 0 );
|
| 205 |
+
$paddinBottom = number_format( (25 / 150) * $sizes['height'], 0 );
|
| 206 |
|
| 207 |
//Build element DOM
|
| 208 |
$content .= '<div class="rss_item" style="padding: ' . $paddinTop . 'px 0 ' . $paddinBottom . 'px">';
|
| 209 |
|
| 210 |
+
if ( $thumb == 'yes' || $thumb == 'auto' ) {
|
| 211 |
|
| 212 |
$contentThumb = '';
|
| 213 |
|
| 214 |
+
if ( ( ! empty( $thethumbnail ) && $thumb == 'auto' ) || $thumb == 'yes' ){
|
|
|
|
|
|
|
|
|
|
| 215 |
|
| 216 |
+
$contentThumb .= '<div class="rss_image" style="width:' . $sizes['width'] . 'px; height:' . $sizes['height'] . 'px;">';
|
| 217 |
+
$contentThumb .= '<a href="' . $item->get_permalink() . '" target="' . $target . '" title="' . $item->get_title() . '" >';
|
|
|
|
|
|
|
|
|
|
| 218 |
|
| 219 |
+
if ( !empty( $thethumbnail )) {
|
| 220 |
+
|
| 221 |
+
$contentThumb .= '<span style="width:' . $sizes['width'] . 'px; height:' . $sizes['height'] . 'px; background-image: none, url(' . $thethumbnail . '), url(' . $default . ');" alt="' . $item->get_title() . '"></span/>';
|
| 222 |
+
|
| 223 |
+
} else if ( empty( $thethumbnail ) && $thumb == 'yes' ) {
|
| 224 |
+
|
| 225 |
+
$contentThumb .= '<span style="width:' . $sizes['width'] . 'px; height:' . $sizes['height'] . 'px; background-image:url(' . $default . ');" alt="' . $item->get_title() . '"></span/>';
|
| 226 |
+
|
| 227 |
+
}
|
| 228 |
+
|
| 229 |
+
$contentThumb .= '</a>';
|
| 230 |
+
$contentThumb .= '</div>';
|
| 231 |
+
|
| 232 |
}
|
|
|
|
|
|
|
|
|
|
| 233 |
|
| 234 |
//Filter: feedzy_thumb_output
|
| 235 |
$content .= apply_filters( 'feedzy_thumb_output', $contentThumb, $feedURL );
|
feedzy-rss-feeds-ui-lang.php
CHANGED
|
@@ -32,6 +32,7 @@ function feedzy_tinymce_translation() {
|
|
| 32 |
'text_default' => __('Do not specify', 'feedzy_rss_translate'),
|
| 33 |
'text_no' => __('No', 'feedzy_rss_translate'),
|
| 34 |
'text_yes' => __('Yes', 'feedzy_rss_translate'),
|
|
|
|
| 35 |
);
|
| 36 |
$locale = _WP_Editors::$mce_locale;
|
| 37 |
$translated = 'tinyMCE.addI18n("' . $locale . '.feedzy_tinymce_plugin", ' . json_encode( $strings ) . ");\n";
|
| 32 |
'text_default' => __('Do not specify', 'feedzy_rss_translate'),
|
| 33 |
'text_no' => __('No', 'feedzy_rss_translate'),
|
| 34 |
'text_yes' => __('Yes', 'feedzy_rss_translate'),
|
| 35 |
+
'text_auto' => __('Auto', 'feedzy_rss_translate')
|
| 36 |
);
|
| 37 |
$locale = _WP_Editors::$mce_locale;
|
| 38 |
$translated = 'tinyMCE.addI18n("' . $locale . '.feedzy_tinymce_plugin", ' . json_encode( $strings ) . ");\n";
|
feedzy-rss-feeds-widget.php
CHANGED
|
@@ -13,15 +13,15 @@ if ( !defined( 'ABSPATH' ) ) {
|
|
| 13 |
add_action('widgets_init', create_function('', 'return register_widget("feedzy_wp_widget");'));
|
| 14 |
class feedzy_wp_widget extends WP_Widget {
|
| 15 |
|
| 16 |
-
//
|
| 17 |
function feedzy_wp_widget() {
|
| 18 |
parent::WP_Widget(false, $name = __('Feedzy RSS Feeds', 'feedzy_wp_widget') );
|
| 19 |
}
|
| 20 |
|
| 21 |
-
//
|
| 22 |
function form($instance) {
|
| 23 |
|
| 24 |
-
//
|
| 25 |
if( $instance) {
|
| 26 |
$title = esc_attr($instance['title']);
|
| 27 |
$textarea = esc_attr($instance['textarea']);
|
|
@@ -71,7 +71,7 @@ class feedzy_wp_widget extends WP_Widget {
|
|
| 71 |
</p>
|
| 72 |
<p>
|
| 73 |
<label for="<?php echo $this->get_field_id('target'); ?>"><?php _e('Links may be opened in the same window or a new tab.', 'feedzy_rss_translate'); ?></label>
|
| 74 |
-
<select
|
| 75 |
<?php
|
| 76 |
$options = array('_blank', '_parent', '_self', '_top', 'framename');
|
| 77 |
foreach ($options as $option) {
|
|
@@ -97,8 +97,27 @@ class feedzy_wp_widget extends WP_Widget {
|
|
| 97 |
<input class="widefat" id="<?php echo $this->get_field_id('summarylength'); ?>" name="<?php echo $this->get_field_name('summarylength'); ?>" type="text" value="<?php echo $summarylength; ?>" />
|
| 98 |
</p>
|
| 99 |
<p>
|
| 100 |
-
<input id="<?php echo $this->get_field_id('thumb'); ?>" name="<?php echo $this->get_field_name('thumb'); ?>" type="checkbox" value="1" <?php checked( '1', $thumb ); ?> />
|
| 101 |
<label for="<?php echo $this->get_field_id('thumb'); ?>"><?php _e('Should we display the first image of the content if it is available?', 'feedzy_rss_translate'); ?></label>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 102 |
</p>
|
| 103 |
<p>
|
| 104 |
<label for="<?php echo $this->get_field_id('default'); ?>"><?php _e('Default thumbnail URL if no image is found.', 'feedzy_rss_translate'); ?></label>
|
|
@@ -117,60 +136,67 @@ class feedzy_wp_widget extends WP_Widget {
|
|
| 117 |
|
| 118 |
}
|
| 119 |
|
| 120 |
-
//
|
| 121 |
-
function update($new_instance, $old_instance) {
|
| 122 |
$instance = $old_instance;
|
| 123 |
-
$instance['title'] = strip_tags($new_instance['title']);
|
| 124 |
-
if ( current_user_can('unfiltered_html') ) {
|
| 125 |
$instance['textarea'] = $new_instance['textarea'];
|
| 126 |
} else {
|
| 127 |
-
$instance['textarea'] = stripslashes( wp_filter_post_kses( addslashes($new_instance['textarea']) ) );
|
| 128 |
}
|
| 129 |
-
$instance['feeds'] = strip_tags($new_instance['feeds']);
|
| 130 |
-
$instance['max'] = strip_tags($new_instance['max']);
|
| 131 |
-
$instance['target'] = strip_tags($new_instance['target']);
|
| 132 |
-
$instance['titlelength'] = strip_tags($new_instance['titlelength']);
|
| 133 |
-
$instance['meta'] = strip_tags($new_instance['meta']);
|
| 134 |
-
$instance['summary'] = strip_tags($new_instance['summary']);
|
| 135 |
-
$instance['summarylength'] = strip_tags($new_instance['summarylength']);
|
| 136 |
-
$instance['thumb'] = strip_tags($new_instance['thumb']);
|
| 137 |
-
$instance['default'] = strip_tags($new_instance['default']);
|
| 138 |
-
$instance['size'] = strip_tags($new_instance['size']);
|
| 139 |
-
$instance['keywords_title'] = strip_tags($new_instance['keywords_title']);
|
| 140 |
return $instance;
|
| 141 |
}
|
| 142 |
|
| 143 |
-
//
|
| 144 |
function widget($args, $instance) {
|
| 145 |
|
| 146 |
extract( $args );
|
| 147 |
|
| 148 |
-
$title = apply_filters('widget_title', $instance['title']);
|
| 149 |
$textarea = apply_filters( 'widget_textarea', empty( $instance['textarea'] ) ? '' : $instance['textarea'], $instance );
|
| 150 |
|
| 151 |
echo $before_widget;
|
| 152 |
|
| 153 |
-
//
|
| 154 |
echo '<div class="widget-text feedzy_wp_widget_box">';
|
| 155 |
|
| 156 |
-
//
|
| 157 |
if ( $title )
|
| 158 |
echo $before_title . $title . $after_title;
|
| 159 |
|
| 160 |
-
//
|
| 161 |
if( isset( $instance['textarea'] ) && !empty( $instance['textarea'] ) )
|
| 162 |
echo '<p class="feedzy-widget-intro">' . wpautop($textarea) . '</p>';
|
| 163 |
-
|
| 164 |
-
|
| 165 |
-
$items
|
| 166 |
-
|
| 167 |
-
if($instance[$item] == true){
|
| 168 |
$instance[$item] = 'yes';
|
| 169 |
} else {
|
| 170 |
$instance[$item] = 'no';
|
| 171 |
}
|
| 172 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 173 |
|
|
|
|
| 174 |
echo feedzy_rss( array(
|
| 175 |
"feeds" => $instance['feeds'],
|
| 176 |
"max" => $instance['max'],
|
| 13 |
add_action('widgets_init', create_function('', 'return register_widget("feedzy_wp_widget");'));
|
| 14 |
class feedzy_wp_widget extends WP_Widget {
|
| 15 |
|
| 16 |
+
//Constructor
|
| 17 |
function feedzy_wp_widget() {
|
| 18 |
parent::WP_Widget(false, $name = __('Feedzy RSS Feeds', 'feedzy_wp_widget') );
|
| 19 |
}
|
| 20 |
|
| 21 |
+
//Widget form creation
|
| 22 |
function form($instance) {
|
| 23 |
|
| 24 |
+
//Check values
|
| 25 |
if( $instance) {
|
| 26 |
$title = esc_attr($instance['title']);
|
| 27 |
$textarea = esc_attr($instance['textarea']);
|
| 71 |
</p>
|
| 72 |
<p>
|
| 73 |
<label for="<?php echo $this->get_field_id('target'); ?>"><?php _e('Links may be opened in the same window or a new tab.', 'feedzy_rss_translate'); ?></label>
|
| 74 |
+
<select id="<?php echo $this->get_field_id('target'); ?>" name="<?php echo $this->get_field_name('target'); ?>" class="widefat">
|
| 75 |
<?php
|
| 76 |
$options = array('_blank', '_parent', '_self', '_top', 'framename');
|
| 77 |
foreach ($options as $option) {
|
| 97 |
<input class="widefat" id="<?php echo $this->get_field_id('summarylength'); ?>" name="<?php echo $this->get_field_name('summarylength'); ?>" type="text" value="<?php echo $summarylength; ?>" />
|
| 98 |
</p>
|
| 99 |
<p>
|
|
|
|
| 100 |
<label for="<?php echo $this->get_field_id('thumb'); ?>"><?php _e('Should we display the first image of the content if it is available?', 'feedzy_rss_translate'); ?></label>
|
| 101 |
+
<select id="<?php echo $this->get_field_id('thumb'); ?>" name="<?php echo $this->get_field_name('thumb'); ?>" class="widefat">
|
| 102 |
+
<?php
|
| 103 |
+
//Fix for versions before 2.3.1
|
| 104 |
+
if ( $thumb == '1' ){
|
| 105 |
+
$thumb = 'yes';
|
| 106 |
+
} else if ( $thumb == '0' ) {
|
| 107 |
+
$thumb = 'no';
|
| 108 |
+
}
|
| 109 |
+
|
| 110 |
+
$options = array(
|
| 111 |
+
array( 'no', __('No', 'feedzy_rss_translate') ),
|
| 112 |
+
array( 'yes', __('Yes', 'feedzy_rss_translate') ),
|
| 113 |
+
array( 'auto', __('Auto', 'feedzy_rss_translate') )
|
| 114 |
+
);
|
| 115 |
+
|
| 116 |
+
foreach ($options as $option) {
|
| 117 |
+
echo '<option value="' . $option[0] . '" id="' . $option[0] . '"', $thumb == $option[0] ? ' selected="selected"' : '', '>', $option[1], '</option>';
|
| 118 |
+
}
|
| 119 |
+
?>
|
| 120 |
+
</select>
|
| 121 |
</p>
|
| 122 |
<p>
|
| 123 |
<label for="<?php echo $this->get_field_id('default'); ?>"><?php _e('Default thumbnail URL if no image is found.', 'feedzy_rss_translate'); ?></label>
|
| 136 |
|
| 137 |
}
|
| 138 |
|
| 139 |
+
//Update widget
|
| 140 |
+
function update( $new_instance, $old_instance ) {
|
| 141 |
$instance = $old_instance;
|
| 142 |
+
$instance['title'] = strip_tags( $new_instance['title'] );
|
| 143 |
+
if ( current_user_can( 'unfiltered_html' ) ) {
|
| 144 |
$instance['textarea'] = $new_instance['textarea'];
|
| 145 |
} else {
|
| 146 |
+
$instance['textarea'] = stripslashes( wp_filter_post_kses( addslashes( $new_instance['textarea'] ) ) );
|
| 147 |
}
|
| 148 |
+
$instance['feeds'] = strip_tags( $new_instance['feeds'] );
|
| 149 |
+
$instance['max'] = strip_tags( $new_instance['max'] );
|
| 150 |
+
$instance['target'] = strip_tags( $new_instance['target'] );
|
| 151 |
+
$instance['titlelength'] = strip_tags( $new_instance['titlelength'] );
|
| 152 |
+
$instance['meta'] = strip_tags( $new_instance['meta'] );
|
| 153 |
+
$instance['summary'] = strip_tags( $new_instance['summary'] );
|
| 154 |
+
$instance['summarylength'] = strip_tags( $new_instance['summarylength'] );
|
| 155 |
+
$instance['thumb'] = strip_tags( $new_instance['thumb'] );
|
| 156 |
+
$instance['default'] = strip_tags( $new_instance['default'] );
|
| 157 |
+
$instance['size'] = strip_tags( $new_instance['size'] );
|
| 158 |
+
$instance['keywords_title'] = strip_tags( $new_instance['keywords_title'] );
|
| 159 |
return $instance;
|
| 160 |
}
|
| 161 |
|
| 162 |
+
//Display widget
|
| 163 |
function widget($args, $instance) {
|
| 164 |
|
| 165 |
extract( $args );
|
| 166 |
|
| 167 |
+
$title = apply_filters( 'widget_title', $instance['title'] );
|
| 168 |
$textarea = apply_filters( 'widget_textarea', empty( $instance['textarea'] ) ? '' : $instance['textarea'], $instance );
|
| 169 |
|
| 170 |
echo $before_widget;
|
| 171 |
|
| 172 |
+
//Display the widget body
|
| 173 |
echo '<div class="widget-text feedzy_wp_widget_box">';
|
| 174 |
|
| 175 |
+
//Check if title is set
|
| 176 |
if ( $title )
|
| 177 |
echo $before_title . $title . $after_title;
|
| 178 |
|
| 179 |
+
//Check if text intro is set
|
| 180 |
if( isset( $instance['textarea'] ) && !empty( $instance['textarea'] ) )
|
| 181 |
echo '<p class="feedzy-widget-intro">' . wpautop($textarea) . '</p>';
|
| 182 |
+
|
| 183 |
+
$items = array( 'meta', 'summary' );
|
| 184 |
+
foreach( $items as $item ){
|
| 185 |
+
if( $instance[$item] == true ){
|
|
|
|
| 186 |
$instance[$item] = 'yes';
|
| 187 |
} else {
|
| 188 |
$instance[$item] = 'no';
|
| 189 |
}
|
| 190 |
}
|
| 191 |
+
|
| 192 |
+
//Fix for versions before 2.3.1
|
| 193 |
+
if ( $instance['thumb'] == '1' ){
|
| 194 |
+
$instance['thumb'] = 'yes';
|
| 195 |
+
} else if ( $thumb == '0' ) {
|
| 196 |
+
$instance['thumb'] = 'no';
|
| 197 |
+
}
|
| 198 |
|
| 199 |
+
//Call the shortcode function
|
| 200 |
echo feedzy_rss( array(
|
| 201 |
"feeds" => $instance['feeds'],
|
| 202 |
"max" => $instance['max'],
|
js/feedzy-rss-feeds-ui-mce.js
CHANGED
|
@@ -86,6 +86,7 @@
|
|
| 86 |
{text: editor.getLang('feedzy_tinymce_plugin.text_default'), value: ''},
|
| 87 |
{text: editor.getLang('feedzy_tinymce_plugin.text_no'), value: 'no'},
|
| 88 |
{text: editor.getLang('feedzy_tinymce_plugin.text_yes'), value: 'yes'},
|
|
|
|
| 89 |
]
|
| 90 |
},
|
| 91 |
{
|
| 86 |
{text: editor.getLang('feedzy_tinymce_plugin.text_default'), value: ''},
|
| 87 |
{text: editor.getLang('feedzy_tinymce_plugin.text_no'), value: 'no'},
|
| 88 |
{text: editor.getLang('feedzy_tinymce_plugin.text_yes'), value: 'yes'},
|
| 89 |
+
{text: editor.getLang('feedzy_tinymce_plugin.text_auto'), value: 'auto'},
|
| 90 |
]
|
| 91 |
},
|
| 92 |
{
|
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, 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.
|
| 8 |
License: GPLv2 or later
|
| 9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
| 10 |
|
|
@@ -69,6 +69,7 @@ By activating this plugin, your cover picture will be inserted into your RSS fee
|
|
| 69 |
* feedzy_summary_input
|
| 70 |
* feedzy_summary_output
|
| 71 |
* feedzy_global_output
|
|
|
|
| 72 |
|
| 73 |
|
| 74 |
[FULL DOCUMENTATION AND EXAMPLES](http://b-website.com/feedzy-rss-feeds-wordpress-plugin-using-simplepie "Documentation & examples")
|
|
@@ -104,6 +105,14 @@ Yes it is.
|
|
| 104 |
|
| 105 |
== Changelog ==
|
| 106 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 107 |
= 2.3 =
|
| 108 |
* New hook: feedzy_feed_items
|
| 109 |
* New hook: feedzy_item_keyword
|
| 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.4
|
| 8 |
License: GPLv2 or later
|
| 9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
| 10 |
|
| 69 |
* feedzy_summary_input
|
| 70 |
* feedzy_summary_output
|
| 71 |
* feedzy_global_output
|
| 72 |
+
* feedzy_thumb_sizes
|
| 73 |
|
| 74 |
|
| 75 |
[FULL DOCUMENTATION AND EXAMPLES](http://b-website.com/feedzy-rss-feeds-wordpress-plugin-using-simplepie "Documentation & examples")
|
| 105 |
|
| 106 |
== Changelog ==
|
| 107 |
|
| 108 |
+
= 2.4 =
|
| 109 |
+
* New feature: 'auto' thumbs option added
|
| 110 |
+
* New hook: feedzy_thumb_sizes
|
| 111 |
+
* Fix issue on max number of feeds to display
|
| 112 |
+
* Fix HTML decode in the feed's title
|
| 113 |
+
* Minor PHP improvements
|
| 114 |
+
* readme.txt and hooks documentation update
|
| 115 |
+
|
| 116 |
= 2.3 =
|
| 117 |
* New hook: feedzy_feed_items
|
| 118 |
* New hook: feedzy_item_keyword
|
