Version Description
- Remove unnecessary and redundant feedzy_wp_widget_box div container in the widget's body
- Best compliance with WordPress coding standards
- Fix a PHP warning on SimplePie error display & log
- Readme.txt update
Download this release
Release Info
| Developer | briKou |
| Plugin | |
| Version | 2.7.1 |
| Comparing to | |
| See all releases | |
Code changes from version 2.7 to 2.7.1
- feedzy-rss-feed.php +13 -2
- feedzy-rss-feeds-functions.php +7 -7
- feedzy-rss-feeds-ui-lang.php +21 -19
- feedzy-rss-feeds-ui.php +1 -1
- feedzy-rss-feeds-widget.php +117 -92
- readme.txt +12 -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.7
|
| 9 |
* Text Domain: feedzy_rss_translate
|
| 10 |
* Text Domain Path: /langs
|
| 11 |
*/
|
|
@@ -30,7 +30,9 @@
|
|
| 30 |
* SECURITY : Exit if accessed directly
|
| 31 |
***************************************************************/
|
| 32 |
if ( !defined( 'ABSPATH' ) ) {
|
|
|
|
| 33 |
die( 'Direct access not allowed!' );
|
|
|
|
| 34 |
}
|
| 35 |
|
| 36 |
|
|
@@ -38,7 +40,9 @@ if ( !defined( 'ABSPATH' ) ) {
|
|
| 38 |
* Define constant
|
| 39 |
***************************************************************/
|
| 40 |
if ( !defined( 'FEEDZY_VERSION' ) ) {
|
| 41 |
-
|
|
|
|
|
|
|
| 42 |
}
|
| 43 |
|
| 44 |
|
|
@@ -46,8 +50,10 @@ if ( !defined( 'FEEDZY_VERSION' ) ) {
|
|
| 46 |
* Load plugin textdomain
|
| 47 |
***************************************************************/
|
| 48 |
function feedzy_rss_load_textdomain() {
|
|
|
|
| 49 |
$path = dirname(plugin_basename( __FILE__ )) . '/langs/';
|
| 50 |
load_plugin_textdomain( 'feedzy_rss_translate', false, $path );
|
|
|
|
| 51 |
}
|
| 52 |
add_action( 'init', 'feedzy_rss_load_textdomain' );
|
| 53 |
|
|
@@ -56,12 +62,15 @@ add_action( 'init', 'feedzy_rss_load_textdomain' );
|
|
| 56 |
* Add custom meta link on plugin list page
|
| 57 |
***************************************************************/
|
| 58 |
function feedzy_meta_links( $links, $file ) {
|
|
|
|
| 59 |
if ( $file === 'feedzy-rss-feeds/feedzy-rss-feed.php' ) {
|
| 60 |
$links[] = '<a href="http://b-website.com/feedzy-rss-feeds-wordpress-plugin-using-simplepie" target="_blank" title="'. __( 'Documentation and examples', 'feedzy_rss_translate' ) .'">'. __( 'Documentation and examples', 'feedzy_rss_translate' ) .'</a>';
|
| 61 |
$links[] = '<a href="http://b-website.com/category/plugins" target="_blank" title="'. __( 'More b*web Plugins', 'feedzy_rss_translate' ) .'">'. __( 'More b*web Plugins', 'feedzy_rss_translate' ) .'</a>';
|
| 62 |
$links[] = '<a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=7Z6YVM63739Y8" target="_blank" title="' . __( 'Donate to this plugin »' ) . '"><strong>' . __( 'Donate to this plugin »' ) . '</strong></a>';
|
| 63 |
}
|
|
|
|
| 64 |
return $links;
|
|
|
|
| 65 |
}
|
| 66 |
add_filter( 'plugin_row_meta', 'feedzy_meta_links', 10, 2 );
|
| 67 |
|
|
@@ -71,5 +80,7 @@ add_filter( 'plugin_row_meta', 'feedzy_meta_links', 10, 2 );
|
|
| 71 |
***************************************************************/
|
| 72 |
$feedzyFiles = array( 'functions', 'shortcode', 'widget','ui' );
|
| 73 |
foreach( $feedzyFiles as $feedzyFile ){
|
|
|
|
| 74 |
require_once( plugin_dir_path( __FILE__ ) . 'feedzy-rss-feeds-' . $feedzyFile . '.php' );
|
|
|
|
| 75 |
}
|
| 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.7.1
|
| 9 |
* Text Domain: feedzy_rss_translate
|
| 10 |
* Text Domain Path: /langs
|
| 11 |
*/
|
| 30 |
* SECURITY : Exit if accessed directly
|
| 31 |
***************************************************************/
|
| 32 |
if ( !defined( 'ABSPATH' ) ) {
|
| 33 |
+
|
| 34 |
die( 'Direct access not allowed!' );
|
| 35 |
+
|
| 36 |
}
|
| 37 |
|
| 38 |
|
| 40 |
* Define constant
|
| 41 |
***************************************************************/
|
| 42 |
if ( !defined( 'FEEDZY_VERSION' ) ) {
|
| 43 |
+
|
| 44 |
+
define( 'FEEDZY_VERSION', '2.7.1' );
|
| 45 |
+
|
| 46 |
}
|
| 47 |
|
| 48 |
|
| 50 |
* Load plugin textdomain
|
| 51 |
***************************************************************/
|
| 52 |
function feedzy_rss_load_textdomain() {
|
| 53 |
+
|
| 54 |
$path = dirname(plugin_basename( __FILE__ )) . '/langs/';
|
| 55 |
load_plugin_textdomain( 'feedzy_rss_translate', false, $path );
|
| 56 |
+
|
| 57 |
}
|
| 58 |
add_action( 'init', 'feedzy_rss_load_textdomain' );
|
| 59 |
|
| 62 |
* Add custom meta link on plugin list page
|
| 63 |
***************************************************************/
|
| 64 |
function feedzy_meta_links( $links, $file ) {
|
| 65 |
+
|
| 66 |
if ( $file === 'feedzy-rss-feeds/feedzy-rss-feed.php' ) {
|
| 67 |
$links[] = '<a href="http://b-website.com/feedzy-rss-feeds-wordpress-plugin-using-simplepie" target="_blank" title="'. __( 'Documentation and examples', 'feedzy_rss_translate' ) .'">'. __( 'Documentation and examples', 'feedzy_rss_translate' ) .'</a>';
|
| 68 |
$links[] = '<a href="http://b-website.com/category/plugins" target="_blank" title="'. __( 'More b*web Plugins', 'feedzy_rss_translate' ) .'">'. __( 'More b*web Plugins', 'feedzy_rss_translate' ) .'</a>';
|
| 69 |
$links[] = '<a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=7Z6YVM63739Y8" target="_blank" title="' . __( 'Donate to this plugin »' ) . '"><strong>' . __( 'Donate to this plugin »' ) . '</strong></a>';
|
| 70 |
}
|
| 71 |
+
|
| 72 |
return $links;
|
| 73 |
+
|
| 74 |
}
|
| 75 |
add_filter( 'plugin_row_meta', 'feedzy_meta_links', 10, 2 );
|
| 76 |
|
| 80 |
***************************************************************/
|
| 81 |
$feedzyFiles = array( 'functions', 'shortcode', 'widget','ui' );
|
| 82 |
foreach( $feedzyFiles as $feedzyFile ){
|
| 83 |
+
|
| 84 |
require_once( plugin_dir_path( __FILE__ ) . 'feedzy-rss-feeds-' . $feedzyFile . '.php' );
|
| 85 |
+
|
| 86 |
}
|
feedzy-rss-feeds-functions.php
CHANGED
|
@@ -21,22 +21,22 @@ add_filter( 'feedzy_default_image', 'feedzy_define_default_image' );
|
|
| 21 |
***************************************************************/
|
| 22 |
function feedzy_default_error_notice( $error, $feedURL ){
|
| 23 |
//Write in the log file
|
| 24 |
-
|
| 25 |
//Display the error message
|
| 26 |
-
return '<div id="message" class="error" data-error"' . esc_attr( $error ) . '"><p>' . __('Sorry, this feed is currently unavailable or does not exists anymore.', 'feedzy_rss_translate') . '</p></div>';
|
| 27 |
}
|
| 28 |
add_filter( 'feedzy_default_error', 'feedzy_default_error_notice', 9, 2 );
|
| 29 |
|
| 30 |
|
|
|
|
| 31 |
/***************************************************************
|
| 32 |
-
*
|
| 33 |
-
* Src: https://www.elegantthemes.com/blog/tips-tricks/using-the-wordpress-debug-log
|
| 34 |
***************************************************************/
|
| 35 |
-
function
|
| 36 |
if ( is_array( $error ) || is_object( $error ) ) {
|
| 37 |
-
|
| 38 |
} else {
|
| 39 |
-
|
| 40 |
}
|
| 41 |
}
|
| 42 |
|
| 21 |
***************************************************************/
|
| 22 |
function feedzy_default_error_notice( $error, $feedURL ){
|
| 23 |
//Write in the log file
|
| 24 |
+
error_log( 'Feedzy RSS Feeds - related feed: ' .$feedURL . ' - Error message: ' . feedzy_array_obj_string( $error ) );
|
| 25 |
//Display the error message
|
| 26 |
+
return '<div id="message" class="error" data-error"' . esc_attr( feedzy_array_obj_string( $error ) ) . '"><p>' . __('Sorry, this feed is currently unavailable or does not exists anymore.', 'feedzy_rss_translate') . '</p></div>';
|
| 27 |
}
|
| 28 |
add_filter( 'feedzy_default_error', 'feedzy_default_error_notice', 9, 2 );
|
| 29 |
|
| 30 |
|
| 31 |
+
|
| 32 |
/***************************************************************
|
| 33 |
+
* Convert array or object into string
|
|
|
|
| 34 |
***************************************************************/
|
| 35 |
+
function feedzy_array_obj_string ( $error ){
|
| 36 |
if ( is_array( $error ) || is_object( $error ) ) {
|
| 37 |
+
return print_r( $error, true );
|
| 38 |
} else {
|
| 39 |
+
return $error;
|
| 40 |
}
|
| 41 |
}
|
| 42 |
|
feedzy-rss-feeds-ui-lang.php
CHANGED
|
@@ -15,26 +15,28 @@ if ( ! class_exists( '_WP_Editors' ) )
|
|
| 15 |
require( ABSPATH . WPINC . '/class-wp-editor.php' );
|
| 16 |
|
| 17 |
function feedzy_tinymce_translation() {
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
'
|
| 21 |
-
'
|
| 22 |
-
'
|
| 23 |
-
'
|
| 24 |
-
'
|
| 25 |
-
'
|
| 26 |
-
'
|
| 27 |
-
'
|
| 28 |
-
'
|
| 29 |
-
'
|
| 30 |
-
'
|
| 31 |
-
'
|
| 32 |
-
'
|
| 33 |
-
'
|
| 34 |
-
'
|
| 35 |
-
'
|
|
|
|
| 36 |
);
|
| 37 |
-
|
|
|
|
| 38 |
$translated = 'tinyMCE.addI18n("' . $locale . '.feedzy_tinymce_plugin", ' . json_encode( $strings ) . ");\n";
|
| 39 |
|
| 40 |
return $translated;
|
| 15 |
require( ABSPATH . WPINC . '/class-wp-editor.php' );
|
| 16 |
|
| 17 |
function feedzy_tinymce_translation() {
|
| 18 |
+
|
| 19 |
+
$strings = array(
|
| 20 |
+
'plugin_title' => __( 'Insert FEEDZY RSS Feeds Shortcode', 'feedzy_rss_translate' ),
|
| 21 |
+
'feeds' => __( 'The feed(s) URL (comma-separated list).', 'feedzy_rss_translate' ) . ' ' . __( 'If your feed is not valid, it won\'t work.', 'feedzy_rss_translate' ),
|
| 22 |
+
'maximum' => __( 'Number of items to display.', 'feedzy_rss_translate' ),
|
| 23 |
+
'feed_title' => __( 'Should we display the RSS title?', 'feedzy_rss_translate' ),
|
| 24 |
+
'target' => __( 'Links may be opened in the same window or a new tab.', 'feedzy_rss_translate' ),
|
| 25 |
+
'title' => __( 'Trim the title of the item after X characters.', 'feedzy_rss_translate' ),
|
| 26 |
+
'meta' => __( 'Should we display the date of publication and the author name?', 'feedzy_rss_translate' ),
|
| 27 |
+
'summary' => __( 'Should we display a description (abstract) of the retrieved item?', 'feedzy_rss_translate' ),
|
| 28 |
+
'summarylength' => __( 'Crop description (summary) of the element after X characters.', 'feedzy_rss_translate' ),
|
| 29 |
+
'thumb' => __( 'Should we display the first image of the content if it is available?', 'feedzy_rss_translate' ),
|
| 30 |
+
'defaultimg' => __( 'Default thumbnail URL if no image is found.', 'feedzy_rss_translate' ),
|
| 31 |
+
'size' => __( 'Thumblails dimension. Do not include "px". Eg: 150', 'feedzy_rss_translate' ),
|
| 32 |
+
'keywords_title'=> __( 'Only display item if title contains specific keyword(s) (comma-separated list/case sensitive).', 'feedzy_rss_translate' ),
|
| 33 |
+
'text_default' => __( 'Do not specify', 'feedzy_rss_translate' ),
|
| 34 |
+
'text_no' => __( 'No', 'feedzy_rss_translate' ),
|
| 35 |
+
'text_yes' => __( 'Yes', 'feedzy_rss_translate' ),
|
| 36 |
+
'text_auto' => __( 'Auto', 'feedzy_rss_translate' )
|
| 37 |
);
|
| 38 |
+
|
| 39 |
+
$locale = _WP_Editors::$mce_locale;
|
| 40 |
$translated = 'tinyMCE.addI18n("' . $locale . '.feedzy_tinymce_plugin", ' . json_encode( $strings ) . ");\n";
|
| 41 |
|
| 42 |
return $translated;
|
feedzy-rss-feeds-ui.php
CHANGED
|
@@ -26,7 +26,7 @@ function feedzy_add_mce_button() {
|
|
| 26 |
}
|
| 27 |
|
| 28 |
}
|
| 29 |
-
add_action('init', 'feedzy_add_mce_button');
|
| 30 |
|
| 31 |
|
| 32 |
/***************************************************************
|
| 26 |
}
|
| 27 |
|
| 28 |
}
|
| 29 |
+
add_action( 'init', 'feedzy_add_mce_button' );
|
| 30 |
|
| 31 |
|
| 32 |
/***************************************************************
|
feedzy-rss-feeds-widget.php
CHANGED
|
@@ -3,40 +3,47 @@
|
|
| 3 |
* SECURITY : Exit if accessed directly
|
| 4 |
***************************************************************/
|
| 5 |
if ( !defined( 'ABSPATH' ) ) {
|
|
|
|
| 6 |
die( 'Direct access not allowed!' );
|
|
|
|
| 7 |
}
|
| 8 |
|
| 9 |
|
| 10 |
/***************************************************************
|
| 11 |
* Load the Widget options
|
| 12 |
***************************************************************/
|
| 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 |
-
|
|
|
|
|
|
|
| 19 |
}
|
| 20 |
|
| 21 |
//Widget form creation
|
| 22 |
-
function form($instance) {
|
| 23 |
|
| 24 |
//Check values
|
| 25 |
-
if( $instance) {
|
| 26 |
-
|
| 27 |
-
$
|
| 28 |
-
$
|
| 29 |
-
$
|
| 30 |
-
$
|
| 31 |
-
$
|
| 32 |
-
$
|
| 33 |
-
$
|
| 34 |
-
$
|
| 35 |
-
$
|
| 36 |
-
$
|
| 37 |
-
$
|
| 38 |
-
$
|
|
|
|
|
|
|
| 39 |
} else {
|
|
|
|
| 40 |
$title = '';
|
| 41 |
$textarea = '';
|
| 42 |
$feeds = '';
|
|
@@ -50,55 +57,56 @@ class feedzy_wp_widget extends WP_Widget {
|
|
| 50 |
$default = '';
|
| 51 |
$size = '';
|
| 52 |
$keywords_title = '';
|
|
|
|
| 53 |
}
|
| 54 |
?>
|
| 55 |
|
| 56 |
<p>
|
| 57 |
-
<label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Widget Title', 'feedzy_rss_translate'); ?></label>
|
| 58 |
-
<input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo $title; ?>" />
|
| 59 |
</p>
|
| 60 |
<p>
|
| 61 |
-
<label for="<?php echo $this->get_field_id('textarea'); ?>"><?php _e('Intro text', 'feedzy_rss_translate'); ?></label>
|
| 62 |
-
<textarea class="widefat" id="<?php echo $this->get_field_id('textarea'); ?>" name="<?php echo $this->get_field_name('textarea'); ?>"><?php echo $textarea; ?></textarea>
|
| 63 |
</p>
|
| 64 |
<p>
|
| 65 |
-
<label for="<?php echo $this->get_field_id('feeds'); ?>"><?php _e('The feed(s) URL (comma-separated list).', 'feedzy_rss_translate'); ?></label>
|
| 66 |
-
<input class="widefat" id="<?php echo $this->get_field_id('feeds'); ?>" name="<?php echo $this->get_field_name('feeds'); ?>" type="text" value="<?php echo $feeds; ?>" />
|
| 67 |
</p>
|
| 68 |
<p>
|
| 69 |
-
<label for="<?php echo $this->get_field_id('max'); ?>"><?php _e('Number of items to display.', 'feedzy_rss_translate'); ?></label>
|
| 70 |
-
<input class="widefat" id="<?php echo $this->get_field_id('max'); ?>" name="<?php echo $this->get_field_name('max'); ?>" type="text" value="<?php echo $max; ?>" />
|
| 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) {
|
| 78 |
echo '<option value="' . $option . '" id="' . $option . '"', $target == $option ? ' selected="selected"' : '', '>', $option, '</option>';
|
| 79 |
}
|
| 80 |
?>
|
| 81 |
</select>
|
| 82 |
</p>
|
| 83 |
<p>
|
| 84 |
-
<label for="<?php echo $this->get_field_id('titlelength'); ?>"><?php _e('Trim the title of the item after X characters.', 'feedzy_rss_translate'); ?></label>
|
| 85 |
-
<input class="widefat" id="<?php echo $this->get_field_id('titlelength'); ?>" name="<?php echo $this->get_field_name('titlelength'); ?>" type="text" value="<?php echo $titlelength; ?>" />
|
| 86 |
</p>
|
| 87 |
<p>
|
| 88 |
-
<input id="<?php echo $this->get_field_id('meta'); ?>" name="<?php echo $this->get_field_name('meta'); ?>" type="checkbox" value="1" <?php checked( '1', $meta ); ?> />
|
| 89 |
-
<label for="<?php echo $this->get_field_id('meta'); ?>"><?php _e('Should we display the date of publication and the author name?', 'feedzy_rss_translate'); ?></label>
|
| 90 |
</p>
|
| 91 |
<p>
|
| 92 |
-
<input id="<?php echo $this->get_field_id('summary'); ?>" name="<?php echo $this->get_field_name('summary'); ?>" type="checkbox" value="1" <?php checked( '1', $summary ); ?> />
|
| 93 |
-
<label for="<?php echo $this->get_field_id('summary'); ?>"><?php _e('Should we display a description (abstract) of the retrieved item?', 'feedzy_rss_translate'); ?></label>
|
| 94 |
</p>
|
| 95 |
<p>
|
| 96 |
-
<label for="<?php echo $this->get_field_id('summarylength'); ?>"><?php _e('Crop description (summary) of the element after X characters.', 'feedzy_rss_translate'); ?></label>
|
| 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' ){
|
|
@@ -108,28 +116,28 @@ class feedzy_wp_widget extends WP_Widget {
|
|
| 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>
|
| 124 |
-
<input class="widefat" id="<?php echo $this->get_field_id('default'); ?>" name="<?php echo $this->get_field_name('default'); ?>" type="text" value="<?php echo $default; ?>" />
|
| 125 |
</p>
|
| 126 |
<p>
|
| 127 |
-
<label for="<?php echo $this->get_field_id('size'); ?>"><?php _e('Thumblails dimension. Do not include "px". Eg: 150', 'feedzy_rss_translate'); ?></label>
|
| 128 |
-
<input class="widefat" id="<?php echo $this->get_field_id('size'); ?>" name="<?php echo $this->get_field_name('size'); ?>" type="text" value="<?php echo $size; ?>" />
|
| 129 |
</p>
|
| 130 |
<p>
|
| 131 |
-
<label for="<?php echo $this->get_field_id('keywords_title'); ?>"><?php _e('Only display item if title contains specific keyword(s) (comma-separated list/case sensitive).', 'feedzy_rss_translate'); ?></label>
|
| 132 |
-
<input class="widefat" id="<?php echo $this->get_field_id('keywords_title'); ?>" name="<?php echo $this->get_field_name('keywords_title'); ?>" type="text" value="<?php echo $keywords_title; ?>" />
|
| 133 |
</p>
|
| 134 |
|
| 135 |
<?php
|
|
@@ -138,83 +146,100 @@ class feedzy_wp_widget extends WP_Widget {
|
|
| 138 |
|
| 139 |
//Update widget
|
| 140 |
function update( $new_instance, $old_instance ) {
|
|
|
|
| 141 |
$instance = $old_instance;
|
| 142 |
-
|
|
|
|
|
|
|
| 143 |
if ( current_user_can( 'unfiltered_html' ) ) {
|
| 144 |
-
|
|
|
|
|
|
|
| 145 |
} else {
|
| 146 |
-
|
|
|
|
|
|
|
| 147 |
}
|
| 148 |
-
|
| 149 |
-
$instance['
|
| 150 |
-
$instance['
|
| 151 |
-
$instance['
|
| 152 |
-
$instance['
|
| 153 |
-
$instance['
|
| 154 |
-
$instance['
|
| 155 |
-
$instance['
|
| 156 |
-
$instance['
|
| 157 |
-
$instance['
|
| 158 |
-
$instance['
|
|
|
|
|
|
|
| 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 |
-
|
| 186 |
-
|
|
|
|
|
|
|
|
|
|
| 187 |
} else {
|
| 188 |
-
|
|
|
|
|
|
|
| 189 |
}
|
|
|
|
| 190 |
}
|
| 191 |
|
| 192 |
//Fix for versions before 2.3.1
|
| 193 |
-
if ( $instance['thumb'] == '1' ){
|
| 194 |
-
|
| 195 |
-
|
| 196 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 197 |
}
|
| 198 |
|
| 199 |
//Call the shortcode function
|
| 200 |
echo feedzy_rss( array(
|
| 201 |
-
"feeds"
|
| 202 |
-
"max"
|
| 203 |
-
"feed_title"
|
| 204 |
-
"target"
|
| 205 |
-
"title"
|
| 206 |
-
"meta"
|
| 207 |
-
"summary"
|
| 208 |
-
"summarylength"
|
| 209 |
-
"thumb"
|
| 210 |
-
"default"
|
| 211 |
-
"size"
|
| 212 |
-
"keywords_title"
|
| 213 |
) );
|
| 214 |
|
| 215 |
-
echo '</div>';
|
| 216 |
-
|
| 217 |
echo $after_widget;
|
| 218 |
|
| 219 |
}
|
|
|
|
| 220 |
}
|
| 3 |
* SECURITY : Exit if accessed directly
|
| 4 |
***************************************************************/
|
| 5 |
if ( !defined( 'ABSPATH' ) ) {
|
| 6 |
+
|
| 7 |
die( 'Direct access not allowed!' );
|
| 8 |
+
|
| 9 |
}
|
| 10 |
|
| 11 |
|
| 12 |
/***************************************************************
|
| 13 |
* Load the Widget options
|
| 14 |
***************************************************************/
|
| 15 |
+
add_action( 'widgets_init', create_function( '', 'return register_widget("feedzy_wp_widget");' ) );
|
| 16 |
class feedzy_wp_widget extends WP_Widget {
|
| 17 |
|
| 18 |
//Constructor
|
| 19 |
function feedzy_wp_widget() {
|
| 20 |
+
|
| 21 |
+
parent::__construct( false, $name = __( 'Feedzy RSS Feeds', 'feedzy_wp_widget' ) );
|
| 22 |
+
|
| 23 |
}
|
| 24 |
|
| 25 |
//Widget form creation
|
| 26 |
+
function form( $instance ) {
|
| 27 |
|
| 28 |
//Check values
|
| 29 |
+
if( $instance ) {
|
| 30 |
+
|
| 31 |
+
$title = esc_attr( $instance[ 'title' ] );
|
| 32 |
+
$textarea = esc_attr( $instance[ 'textarea' ] );
|
| 33 |
+
$feeds = esc_attr( $instance[ 'feeds' ] );
|
| 34 |
+
$max = esc_attr( $instance[ 'max' ] );
|
| 35 |
+
$target = esc_attr( $instance[ 'target' ] );
|
| 36 |
+
$titlelength = esc_attr( $instance[ 'titlelength' ] );
|
| 37 |
+
$meta = esc_attr( $instance[ 'meta' ] );
|
| 38 |
+
$summary = esc_attr( $instance[ 'summary' ] );
|
| 39 |
+
$summarylength = esc_attr( $instance[ 'summarylength' ] );
|
| 40 |
+
$thumb = esc_attr( $instance[ 'thumb' ] );
|
| 41 |
+
$default = esc_attr( $instance[ 'default' ] );
|
| 42 |
+
$size = esc_attr( $instance[ 'size' ] );
|
| 43 |
+
$keywords_title = esc_attr( $instance[ 'keywords_title' ] );
|
| 44 |
+
|
| 45 |
} else {
|
| 46 |
+
|
| 47 |
$title = '';
|
| 48 |
$textarea = '';
|
| 49 |
$feeds = '';
|
| 57 |
$default = '';
|
| 58 |
$size = '';
|
| 59 |
$keywords_title = '';
|
| 60 |
+
|
| 61 |
}
|
| 62 |
?>
|
| 63 |
|
| 64 |
<p>
|
| 65 |
+
<label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Widget Title', 'feedzy_rss_translate' ); ?></label>
|
| 66 |
+
<input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo $title; ?>" />
|
| 67 |
</p>
|
| 68 |
<p>
|
| 69 |
+
<label for="<?php echo $this->get_field_id( 'textarea' ); ?>"><?php _e( 'Intro text', 'feedzy_rss_translate' ); ?></label>
|
| 70 |
+
<textarea class="widefat" id="<?php echo $this->get_field_id( 'textarea' ); ?>" name="<?php echo $this->get_field_name( 'textarea' ); ?>"><?php echo $textarea; ?></textarea>
|
| 71 |
</p>
|
| 72 |
<p>
|
| 73 |
+
<label for="<?php echo $this->get_field_id( 'feeds' ); ?>"><?php _e( 'The feed(s) URL (comma-separated list).', 'feedzy_rss_translate' ); ?></label>
|
| 74 |
+
<input class="widefat" id="<?php echo $this->get_field_id( 'feeds' ); ?>" name="<?php echo $this->get_field_name( 'feeds' ); ?>" type="text" value="<?php echo $feeds; ?>" />
|
| 75 |
</p>
|
| 76 |
<p>
|
| 77 |
+
<label for="<?php echo $this->get_field_id( 'max' ); ?>"><?php _e( 'Number of items to display.', 'feedzy_rss_translate' ); ?></label>
|
| 78 |
+
<input class="widefat" id="<?php echo $this->get_field_id( 'max' ); ?>" name="<?php echo $this->get_field_name( 'max' ); ?>" type="text" value="<?php echo $max; ?>" />
|
| 79 |
</p>
|
| 80 |
<p>
|
| 81 |
+
<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>
|
| 82 |
+
<select id="<?php echo $this->get_field_id( 'target' ); ?>" name="<?php echo $this->get_field_name( 'target' ); ?>" class="widefat">
|
| 83 |
<?php
|
| 84 |
+
$options = array( '_blank', '_parent', '_self', '_top', 'framename' );
|
| 85 |
+
foreach ( $options as $option) {
|
| 86 |
echo '<option value="' . $option . '" id="' . $option . '"', $target == $option ? ' selected="selected"' : '', '>', $option, '</option>';
|
| 87 |
}
|
| 88 |
?>
|
| 89 |
</select>
|
| 90 |
</p>
|
| 91 |
<p>
|
| 92 |
+
<label for="<?php echo $this->get_field_id( 'titlelength' ); ?>"><?php _e( 'Trim the title of the item after X characters.', 'feedzy_rss_translate' ); ?></label>
|
| 93 |
+
<input class="widefat" id="<?php echo $this->get_field_id( 'titlelength' ); ?>" name="<?php echo $this->get_field_name( 'titlelength' ); ?>" type="text" value="<?php echo $titlelength; ?>" />
|
| 94 |
</p>
|
| 95 |
<p>
|
| 96 |
+
<input id="<?php echo $this->get_field_id( 'meta' ); ?>" name="<?php echo $this->get_field_name( 'meta' ); ?>" type="checkbox" value="1" <?php checked( '1', $meta ); ?> />
|
| 97 |
+
<label for="<?php echo $this->get_field_id( 'meta' ); ?>"><?php _e( 'Should we display the date of publication and the author name?', 'feedzy_rss_translate' ); ?></label>
|
| 98 |
</p>
|
| 99 |
<p>
|
| 100 |
+
<input id="<?php echo $this->get_field_id( 'summary' ); ?>" name="<?php echo $this->get_field_name( 'summary' ); ?>" type="checkbox" value="1" <?php checked( '1', $summary ); ?> />
|
| 101 |
+
<label for="<?php echo $this->get_field_id( 'summary' ); ?>"><?php _e( 'Should we display a description (abstract) of the retrieved item?', 'feedzy_rss_translate' ); ?></label>
|
| 102 |
</p>
|
| 103 |
<p>
|
| 104 |
+
<label for="<?php echo $this->get_field_id( 'summarylength' ); ?>"><?php _e( 'Crop description (summary) of the element after X characters.', 'feedzy_rss_translate' ); ?></label>
|
| 105 |
+
<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; ?>" />
|
| 106 |
</p>
|
| 107 |
<p>
|
| 108 |
+
<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>
|
| 109 |
+
<select id="<?php echo $this->get_field_id( 'thumb' ); ?>" name="<?php echo $this->get_field_name( 'thumb' ); ?>" class="widefat">
|
| 110 |
<?php
|
| 111 |
//Fix for versions before 2.3.1
|
| 112 |
if ( $thumb == '1' ){
|
| 116 |
}
|
| 117 |
|
| 118 |
$options = array(
|
| 119 |
+
array( 'no', __( 'No', 'feedzy_rss_translate' ) ),
|
| 120 |
+
array( 'yes', __( 'Yes', 'feedzy_rss_translate' ) ),
|
| 121 |
+
array( 'auto', __( 'Auto', 'feedzy_rss_translate' ) )
|
| 122 |
);
|
| 123 |
|
| 124 |
+
foreach ( $options as $option) {
|
| 125 |
echo '<option value="' . $option[0] . '" id="' . $option[0] . '"', $thumb == $option[0] ? ' selected="selected"' : '', '>', $option[1], '</option>';
|
| 126 |
}
|
| 127 |
?>
|
| 128 |
</select>
|
| 129 |
</p>
|
| 130 |
<p>
|
| 131 |
+
<label for="<?php echo $this->get_field_id( 'default' ); ?>"><?php _e( 'Default thumbnail URL if no image is found.', 'feedzy_rss_translate' ); ?></label>
|
| 132 |
+
<input class="widefat" id="<?php echo $this->get_field_id( 'default' ); ?>" name="<?php echo $this->get_field_name( 'default' ); ?>" type="text" value="<?php echo $default; ?>" />
|
| 133 |
</p>
|
| 134 |
<p>
|
| 135 |
+
<label for="<?php echo $this->get_field_id( 'size' ); ?>"><?php _e( 'Thumblails dimension. Do not include "px". Eg: 150', 'feedzy_rss_translate' ); ?></label>
|
| 136 |
+
<input class="widefat" id="<?php echo $this->get_field_id( 'size' ); ?>" name="<?php echo $this->get_field_name( 'size' ); ?>" type="text" value="<?php echo $size; ?>" />
|
| 137 |
</p>
|
| 138 |
<p>
|
| 139 |
+
<label for="<?php echo $this->get_field_id( 'keywords_title' ); ?>"><?php _e( 'Only display item if title contains specific keyword(s) (comma-separated list/case sensitive).', 'feedzy_rss_translate' ); ?></label>
|
| 140 |
+
<input class="widefat" id="<?php echo $this->get_field_id( 'keywords_title' ); ?>" name="<?php echo $this->get_field_name( 'keywords_title' ); ?>" type="text" value="<?php echo $keywords_title; ?>" />
|
| 141 |
</p>
|
| 142 |
|
| 143 |
<?php
|
| 146 |
|
| 147 |
//Update widget
|
| 148 |
function update( $new_instance, $old_instance ) {
|
| 149 |
+
|
| 150 |
$instance = $old_instance;
|
| 151 |
+
|
| 152 |
+
$instance[ 'title' ] = strip_tags( $new_instance[ 'title' ] );
|
| 153 |
+
|
| 154 |
if ( current_user_can( 'unfiltered_html' ) ) {
|
| 155 |
+
|
| 156 |
+
$instance[ 'textarea' ] = $new_instance[ 'textarea' ];
|
| 157 |
+
|
| 158 |
} else {
|
| 159 |
+
|
| 160 |
+
$instance[ 'textarea' ] = stripslashes( wp_filter_post_kses( addslashes( $new_instance[ 'textarea' ] ) ) );
|
| 161 |
+
|
| 162 |
}
|
| 163 |
+
|
| 164 |
+
$instance[ 'feeds' ] = strip_tags( $new_instance[ 'feeds' ] );
|
| 165 |
+
$instance[ 'max' ] = strip_tags( $new_instance[ 'max' ] );
|
| 166 |
+
$instance[ 'target' ] = strip_tags( $new_instance[ 'target' ] );
|
| 167 |
+
$instance[ 'titlelength' ] = strip_tags( $new_instance[ 'titlelength' ] );
|
| 168 |
+
$instance[ 'meta' ] = strip_tags( $new_instance[ 'meta' ] );
|
| 169 |
+
$instance[ 'summary' ] = strip_tags( $new_instance[ 'summary' ] );
|
| 170 |
+
$instance[ 'summarylength' ] = strip_tags( $new_instance[ 'summarylength' ] );
|
| 171 |
+
$instance[ 'thumb' ] = strip_tags( $new_instance[ 'thumb' ] );
|
| 172 |
+
$instance[ 'default' ] = strip_tags( $new_instance[ 'default' ] );
|
| 173 |
+
$instance[ 'size' ] = strip_tags( $new_instance[ 'size' ] );
|
| 174 |
+
$instance[ 'keywords_title' ] = strip_tags( $new_instance[ 'keywords_title' ] );
|
| 175 |
+
|
| 176 |
return $instance;
|
| 177 |
+
|
| 178 |
}
|
| 179 |
|
| 180 |
//Display widget
|
| 181 |
+
function widget( $args, $instance ) {
|
| 182 |
|
| 183 |
extract( $args );
|
| 184 |
|
| 185 |
+
$title = apply_filters( 'widget_title', $instance[ 'title' ] );
|
| 186 |
+
$textarea = apply_filters( 'widget_textarea', empty( $instance[ 'textarea' ] ) ? '' : $instance[ 'textarea' ], $instance );
|
| 187 |
|
| 188 |
+
//Display the widget body
|
| 189 |
echo $before_widget;
|
| 190 |
|
|
|
|
|
|
|
|
|
|
| 191 |
//Check if title is set
|
| 192 |
if ( $title )
|
| 193 |
echo $before_title . $title . $after_title;
|
| 194 |
|
| 195 |
//Check if text intro is set
|
| 196 |
+
if( isset( $instance[ 'textarea' ] ) && !empty( $instance[ 'textarea' ] ) )
|
| 197 |
+
echo '<p class="feedzy-widget-intro">' . wpautop( $textarea ) . '</p>';
|
| 198 |
|
| 199 |
$items = array( 'meta', 'summary' );
|
| 200 |
foreach( $items as $item ){
|
| 201 |
+
|
| 202 |
+
if( $instance[ $item ] == true ){
|
| 203 |
+
|
| 204 |
+
$instance[ $item ] = 'yes';
|
| 205 |
+
|
| 206 |
} else {
|
| 207 |
+
|
| 208 |
+
$instance[ $item ] = 'no';
|
| 209 |
+
|
| 210 |
}
|
| 211 |
+
|
| 212 |
}
|
| 213 |
|
| 214 |
//Fix for versions before 2.3.1
|
| 215 |
+
if ( $instance[ 'thumb' ] == '1' ){
|
| 216 |
+
|
| 217 |
+
$instance[ 'thumb' ] = 'yes';
|
| 218 |
+
|
| 219 |
+
} else if ( $instance[ 'thumb' ] == '0' ) {
|
| 220 |
+
|
| 221 |
+
$instance[ 'thumb' ] = 'no';
|
| 222 |
+
|
| 223 |
}
|
| 224 |
|
| 225 |
//Call the shortcode function
|
| 226 |
echo feedzy_rss( array(
|
| 227 |
+
"feeds" => $instance[ 'feeds' ],
|
| 228 |
+
"max" => $instance[ 'max' ],
|
| 229 |
+
"feed_title" => 'no',
|
| 230 |
+
"target" => $instance[ 'target' ],
|
| 231 |
+
"title" => $instance[ 'titlelength' ],
|
| 232 |
+
"meta" => $instance[ 'meta' ],
|
| 233 |
+
"summary" => $instance[ 'summary' ],
|
| 234 |
+
"summarylength" => $instance[ 'summarylength' ],
|
| 235 |
+
"thumb" => $instance[ 'thumb' ],
|
| 236 |
+
"default" => $instance[ 'default' ],
|
| 237 |
+
"size" => $instance[ 'size' ],
|
| 238 |
+
"keywords_title" => $instance[ 'keywords_title' ]
|
| 239 |
) );
|
| 240 |
|
|
|
|
|
|
|
| 241 |
echo $after_widget;
|
| 242 |
|
| 243 |
}
|
| 244 |
+
|
| 245 |
}
|
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.3.1
|
| 7 |
-
Stable tag: 2.7
|
| 8 |
License: GPLv2 or later
|
| 9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
| 10 |
|
|
@@ -32,6 +32,7 @@ By activating this plugin, your cover picture will be inserted into your RSS fee
|
|
| 32 |
|
| 33 |
= Shortcode Parameters =
|
| 34 |
|
|
|
|
| 35 |
* feeds
|
| 36 |
* max
|
| 37 |
* feed_title
|
|
@@ -44,6 +45,8 @@ By activating this plugin, your cover picture will be inserted into your RSS fee
|
|
| 44 |
* default
|
| 45 |
* size
|
| 46 |
* keywords_title
|
|
|
|
|
|
|
| 47 |
|
| 48 |
**Plugin is now using the TinyMCE API to improve UI and makes it easy to insert shortcodes!**
|
| 49 |
|
|
@@ -60,6 +63,7 @@ By activating this plugin, your cover picture will be inserted into your RSS fee
|
|
| 60 |
|
| 61 |
= Available Hooks =
|
| 62 |
|
|
|
|
| 63 |
* feedzy_feed_items
|
| 64 |
* feedzy_item_keyword
|
| 65 |
* feedzy_item_attributes
|
|
@@ -75,6 +79,7 @@ By activating this plugin, your cover picture will be inserted into your RSS fee
|
|
| 75 |
* feedzy_default_image
|
| 76 |
* feedzy_default_error
|
| 77 |
* shortcode_atts_feedzy_default
|
|
|
|
| 78 |
|
| 79 |
|
| 80 |
[FULL DOCUMENTATION AND EXAMPLES](http://b-website.com/feedzy-rss-feeds-wordpress-plugin-using-simplepie "Documentation & examples")
|
|
@@ -116,6 +121,12 @@ You have to check first if your feed is valid. Please test it here: https://vali
|
|
| 116 |
|
| 117 |
== Changelog ==
|
| 118 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 119 |
= 2.7 =
|
| 120 |
* Better displaying of fetching feeds errors (see error message div error-attr).
|
| 121 |
* Write errors in the WP log file
|
| 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.3.1
|
| 7 |
+
Stable tag: 2.7.1
|
| 8 |
License: GPLv2 or later
|
| 9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
| 10 |
|
| 32 |
|
| 33 |
= Shortcode Parameters =
|
| 34 |
|
| 35 |
+
`
|
| 36 |
* feeds
|
| 37 |
* max
|
| 38 |
* feed_title
|
| 45 |
* default
|
| 46 |
* size
|
| 47 |
* keywords_title
|
| 48 |
+
`
|
| 49 |
+
|
| 50 |
|
| 51 |
**Plugin is now using the TinyMCE API to improve UI and makes it easy to insert shortcodes!**
|
| 52 |
|
| 63 |
|
| 64 |
= Available Hooks =
|
| 65 |
|
| 66 |
+
`
|
| 67 |
* feedzy_feed_items
|
| 68 |
* feedzy_item_keyword
|
| 69 |
* feedzy_item_attributes
|
| 79 |
* feedzy_default_image
|
| 80 |
* feedzy_default_error
|
| 81 |
* shortcode_atts_feedzy_default
|
| 82 |
+
`
|
| 83 |
|
| 84 |
|
| 85 |
[FULL DOCUMENTATION AND EXAMPLES](http://b-website.com/feedzy-rss-feeds-wordpress-plugin-using-simplepie "Documentation & examples")
|
| 121 |
|
| 122 |
== Changelog ==
|
| 123 |
|
| 124 |
+
= 2.7.1 =
|
| 125 |
+
* Remove unnecessary and redundant feedzy_wp_widget_box div container in the widget's body
|
| 126 |
+
* Best compliance with WordPress coding standards
|
| 127 |
+
* Fix a PHP warning on SimplePie error display & log
|
| 128 |
+
* Readme.txt update
|
| 129 |
+
|
| 130 |
= 2.7 =
|
| 131 |
* Better displaying of fetching feeds errors (see error message div error-attr).
|
| 132 |
* Write errors in the WP log file
|
