Version Description
- Minor Template and CSS changes
- New hook: feedzy_thumb_output
- New hook: feedzy_title_output
- New hook: feedzy_meta_output
- New hook: feedzy_summary_output
- New hook: feedzy_global_output
- readme.txt update
Download this release
Release Info
| Developer | briKou |
| Plugin | |
| Version | 1.7 |
| Comparing to | |
| See all releases | |
Code changes from version 1.6.1 to 1.7
- css/feedzy-rss-feeds.css +2 -2
- feedzy-rss-feed.php +265 -261
- img/feedzy.svg +5 -9
- img/icon-bweb.png +0 -0
- img/icon-bweb.svg +25 -0
- readme.txt +17 -6
css/feedzy-rss-feeds.css
CHANGED
|
@@ -14,12 +14,12 @@
|
|
| 14 |
display:block;
|
| 15 |
clear: both;
|
| 16 |
}
|
| 17 |
-
.feedzy-rss .rss_item
|
| 18 |
float: left;
|
| 19 |
text-decoration: none;
|
| 20 |
border: none;
|
| 21 |
}
|
| 22 |
-
.feedzy-rss .rss_item
|
| 23 |
display:inline-block;
|
| 24 |
background-size: cover;
|
| 25 |
background-position: 50%;
|
| 14 |
display:block;
|
| 15 |
clear: both;
|
| 16 |
}
|
| 17 |
+
.feedzy-rss .rss_item .rss_image {
|
| 18 |
float: left;
|
| 19 |
text-decoration: none;
|
| 20 |
border: none;
|
| 21 |
}
|
| 22 |
+
.feedzy-rss .rss_item .rss_image span{
|
| 23 |
display:inline-block;
|
| 24 |
background-size: cover;
|
| 25 |
background-position: 50%;
|
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: 1.
|
| 9 |
* Text Domain: feedzy_rss_translate
|
| 10 |
* Domain Path: /langs
|
| 11 |
*/
|
|
@@ -43,7 +43,7 @@ if (!function_exists('feedzy_rss_load_textdomain')) {
|
|
| 43 |
if ( ! function_exists( 'feedzy_meta_links' ) ) {
|
| 44 |
function feedzy_meta_links( $links, $file ) {
|
| 45 |
if ( strpos( $file, 'feedzy-rss-feed.php' ) !== false ) {
|
| 46 |
-
$links[0] = '<a href="http://b-website.com/" target="_blank"><img src="' . plugins_url('img/icon-bweb.
|
| 47 |
$links[] = '<a href="http://b-website.com/feedzy-rss-feeds-wordpress-plugin-using-simplepie" target="_blank" title="'. __( 'Documentation and examples', 'feedzy_rss_translate' ) .'"><strong style="color:#db3939">'. __( 'Documentation and examples', 'feedzy_rss_translate' ) .'</strong></a>';
|
| 48 |
$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>';
|
| 49 |
$links[] = '<a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=7Z6YVM63739Y8" target="_blank" title="'. __( 'Donate', 'feedzy_rss_translate' ) .'"><strong>'. __( 'Donate', 'feedzy_rss_translate' ) .'</strong></a>';
|
|
@@ -109,274 +109,278 @@ if (!function_exists('feedzy_scrapeImage')) {
|
|
| 109 |
* Main shortcode function
|
| 110 |
***************************************************************/
|
| 111 |
if (!function_exists('feedzy_rss')) {
|
| 112 |
-
function feedzy_rss( $atts, $content="" ) {
|
| 113 |
-
|
| 114 |
-
global $feedzyStyle;
|
| 115 |
-
$feedzyStyle = true;
|
| 116 |
-
//Retrieve & extract shorcode parameters
|
| 117 |
-
extract(shortcode_atts(array(
|
| 118 |
-
"feeds" => '', //comma separated feeds url
|
| 119 |
-
"max" => '5', //number of feeds items (0 for unlimited)
|
| 120 |
-
"feed_title" => 'yes', //display feed title yes/no
|
| 121 |
-
"target" => '_blank', //_blank, _self
|
| 122 |
-
"title" => '', //strip title after X char
|
| 123 |
-
"meta" => 'yes', //yes, no
|
| 124 |
-
"summary" => 'yes', //strip title
|
| 125 |
-
"summarylength" => '', //strip summary after X char
|
| 126 |
-
"thumb" => 'yes', //yes, no
|
| 127 |
-
"default" => '', //default thumb URL if no image found (only if thumb is set to yes)
|
| 128 |
-
"size" => '', //thumbs pixel size
|
| 129 |
-
"keywords_title" => '' //only display item if title contains specific keywords (comma-separated list/case sensitive)
|
| 130 |
-
), $atts));
|
| 131 |
-
$count = 0;
|
| 132 |
-
|
| 133 |
-
if($max == '0'){
|
| 134 |
-
$max = '999';
|
| 135 |
-
} else if(empty($max) || !ctype_digit($max)) {
|
| 136 |
-
$max = '5';
|
| 137 |
-
}
|
| 138 |
-
|
| 139 |
-
if(empty($size) || !ctype_digit($size))
|
| 140 |
-
$size = '150';
|
| 141 |
-
|
| 142 |
-
if(!empty($title) && !ctype_digit($title))
|
| 143 |
-
$title = '';
|
| 144 |
-
|
| 145 |
-
if(!empty($keywords_title))
|
| 146 |
-
$keywords_title = array_map('trim', explode(',', $keywords_title));
|
| 147 |
-
|
| 148 |
-
if(!empty($summarylength) && !ctype_digit($summarylength))
|
| 149 |
-
$summarylength = '';
|
| 150 |
-
|
| 151 |
-
if(!empty($default)){
|
| 152 |
-
$default = $default;
|
| 153 |
-
} else {
|
| 154 |
-
$default = plugins_url('img/feedzy-default.jpg', __FILE__ );
|
| 155 |
-
}
|
| 156 |
-
|
| 157 |
-
|
| 158 |
-
|
| 159 |
-
if (!class_exists('SimplePie'))
|
| 160 |
-
require_once(ABSPATH . WPINC . '/class-feed.php');
|
| 161 |
|
| 162 |
-
|
| 163 |
-
|
| 164 |
-
|
| 165 |
-
|
| 166 |
-
|
| 167 |
-
|
| 168 |
-
|
| 169 |
-
|
| 170 |
-
|
| 171 |
-
|
| 172 |
-
|
| 173 |
-
|
| 174 |
-
|
| 175 |
-
|
| 176 |
-
|
| 177 |
-
|
| 178 |
-
|
| 179 |
-
|
| 180 |
-
|
| 181 |
-
|
| 182 |
-
|
| 183 |
-
|
| 184 |
-
|
| 185 |
-
|
| 186 |
-
|
| 187 |
-
|
| 188 |
-
|
| 189 |
-
|
| 190 |
-
|
| 191 |
|
| 192 |
-
|
| 193 |
-
|
| 194 |
-
if($feed_title == 'yes'){
|
| 195 |
-
|
| 196 |
-
$content .= '<div class="rss_header">';
|
| 197 |
-
$content .= '<h2><a href="'. $feed->get_permalink() .'">'. $feed->get_title() .'</a> <span> '. $feed->get_description() .'</span></h2>';
|
| 198 |
-
$content .= '</div>';
|
| 199 |
-
|
| 200 |
-
}
|
| 201 |
|
| 202 |
-
|
| 203 |
-
|
| 204 |
-
|
| 205 |
-
$continue = true;
|
| 206 |
-
//Check if keywords are in title
|
| 207 |
-
if(!empty($keywords_title)){
|
| 208 |
-
$continue = false;
|
| 209 |
-
foreach($keywords_title as $keyword){
|
| 210 |
-
if (strpos($item->get_title(), $keyword) !== false) {
|
| 211 |
-
$continue = true;
|
| 212 |
-
}
|
| 213 |
-
}
|
| 214 |
-
|
| 215 |
-
}
|
| 216 |
-
|
| 217 |
-
if($continue == true){
|
| 218 |
-
|
| 219 |
-
//Count items
|
| 220 |
-
if($count >= $max)
|
| 221 |
-
break;
|
| 222 |
-
$count++;
|
| 223 |
-
|
| 224 |
-
//Fetch image thumbnail
|
| 225 |
-
if($thumb == 'yes'){
|
| 226 |
-
$thethumbnail = "";
|
| 227 |
|
| 228 |
-
|
| 229 |
-
|
| 230 |
-
|
| 231 |
-
//item thumb
|
| 232 |
-
if ($thumbnail = $enclosure->get_thumbnail()){
|
| 233 |
-
|
| 234 |
-
$thethumbnail = $thumbnail;
|
| 235 |
-
|
| 236 |
-
}
|
| 237 |
-
|
| 238 |
-
//media:thumbnail
|
| 239 |
-
if(isset($enclosure->thumbnails)){
|
| 240 |
-
|
| 241 |
-
foreach ((array) $enclosure->thumbnails as $thumbnail){
|
| 242 |
-
|
| 243 |
-
$thethumbnail = $thumbnail;
|
| 244 |
-
|
| 245 |
-
}
|
| 246 |
-
|
| 247 |
-
}
|
| 248 |
-
|
| 249 |
-
//enclosure
|
| 250 |
-
if( $thumbnail = $enclosure->embed() ) {
|
| 251 |
-
|
| 252 |
-
$pattern= '/https?:\/\/.*\.(?:jpg|JPG|jpe|JPE|jpeg|JPEG|gif|GIF|png|PNG)/iU';
|
| 253 |
-
|
| 254 |
-
if (preg_match($pattern, $thumbnail, $matches)){
|
| 255 |
-
|
| 256 |
-
$thethumbnail = $matches[0];
|
| 257 |
-
|
| 258 |
-
}
|
| 259 |
-
|
| 260 |
-
}
|
| 261 |
-
|
| 262 |
-
//media:content
|
| 263 |
-
foreach ((array) $enclosure->get_link() as $thumbnail){
|
| 264 |
-
|
| 265 |
-
$pattern= '/https?:\/\/.*\.(?:jpg|JPG|jpe|JPE|jpeg|JPEG|gif|GIF|png|PNG)/iU';
|
| 266 |
-
$imgsrc = $thumbnail;
|
| 267 |
-
|
| 268 |
-
|
| 269 |
-
if ( preg_match($pattern, $imgsrc, $matches) ){
|
| 270 |
-
|
| 271 |
-
$thethumbnail = $matches[0];;
|
| 272 |
-
break;
|
| 273 |
-
|
| 274 |
-
}
|
| 275 |
-
|
| 276 |
-
}
|
| 277 |
-
}
|
| 278 |
-
|
| 279 |
-
//description image
|
| 280 |
-
if(empty($thethumbnail)) {
|
| 281 |
-
|
| 282 |
-
$feedDescription = $item->get_description();
|
| 283 |
-
$image = feedzy_returnImage($feedDescription);
|
| 284 |
-
$thethumbnail = feedzy_scrapeImage($image);
|
| 285 |
-
|
| 286 |
-
}
|
| 287 |
-
|
| 288 |
-
//content image
|
| 289 |
-
if(empty($thethumbnail)) {
|
| 290 |
-
|
| 291 |
-
$feedDescription = $item->get_content();
|
| 292 |
-
$image = feedzy_returnImage($feedDescription);
|
| 293 |
-
$thethumbnail = feedzy_scrapeImage($image);
|
| 294 |
-
|
| 295 |
-
}
|
| 296 |
-
|
| 297 |
-
|
| 298 |
-
}
|
| 299 |
-
|
| 300 |
-
//Padding ratio based on image size
|
| 301 |
-
$paddinTop = number_format((15/150)*$size,0);
|
| 302 |
-
$paddinBottom = number_format((25/150)*$size,0);
|
| 303 |
-
|
| 304 |
-
//Build element DOM
|
| 305 |
-
$content .= '<div class="rss_item" style="padding: ' . $paddinTop . 'px 0 ' . $paddinBottom . 'px">';
|
| 306 |
-
if($thumb == 'yes'){
|
| 307 |
|
| 308 |
-
|
| 309 |
-
|
| 310 |
-
|
| 311 |
-
|
| 312 |
-
|
| 313 |
-
|
| 314 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 315 |
|
| 316 |
-
|
| 317 |
-
|
| 318 |
-
|
| 319 |
-
|
| 320 |
-
|
| 321 |
-
}
|
| 322 |
-
$content .= '<span class="title"><a href="'. $item->get_permalink() .'" target="'. $target .'">';
|
| 323 |
-
if(is_numeric($title) && strlen($item->get_title()) > $title){
|
| 324 |
|
| 325 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 326 |
|
| 327 |
-
|
| 328 |
-
|
| 329 |
-
|
| 330 |
-
|
| 331 |
-
|
| 332 |
-
$content .= '</a></span>';
|
| 333 |
$content .= '<div class="rss_content">';
|
| 334 |
-
|
| 335 |
-
|
| 336 |
-
|
| 337 |
-
|
| 338 |
-
|
| 339 |
-
|
| 340 |
-
|
| 341 |
-
|
| 342 |
-
|
| 343 |
-
|
| 344 |
-
|
| 345 |
-
|
| 346 |
-
|
| 347 |
-
|
| 348 |
-
|
| 349 |
-
|
| 350 |
-
|
| 351 |
-
|
| 352 |
-
|
| 353 |
-
|
| 354 |
-
|
| 355 |
-
|
| 356 |
-
|
| 357 |
-
|
| 358 |
-
|
| 359 |
-
|
| 360 |
-
|
| 361 |
-
|
| 362 |
-
|
| 363 |
-
|
| 364 |
-
|
| 365 |
-
|
| 366 |
-
|
| 367 |
-
|
| 368 |
-
|
| 369 |
-
|
| 370 |
-
|
| 371 |
-
|
| 372 |
-
|
| 373 |
-
|
| 374 |
-
|
| 375 |
-
|
| 376 |
-
|
| 377 |
-
|
| 378 |
-
|
| 379 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 380 |
}
|
| 381 |
|
| 382 |
|
| 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.7
|
| 9 |
* Text Domain: feedzy_rss_translate
|
| 10 |
* Domain Path: /langs
|
| 11 |
*/
|
| 43 |
if ( ! function_exists( 'feedzy_meta_links' ) ) {
|
| 44 |
function feedzy_meta_links( $links, $file ) {
|
| 45 |
if ( strpos( $file, 'feedzy-rss-feed.php' ) !== false ) {
|
| 46 |
+
$links[0] = '<a href="http://b-website.com/" target="_blank"><img src="' . plugins_url('img/icon-bweb.svg', __FILE__ ) . '" style="margin-bottom: -4px; width: 18px;" alt="b*web"/></a> '. $links[0];
|
| 47 |
$links[] = '<a href="http://b-website.com/feedzy-rss-feeds-wordpress-plugin-using-simplepie" target="_blank" title="'. __( 'Documentation and examples', 'feedzy_rss_translate' ) .'"><strong style="color:#db3939">'. __( 'Documentation and examples', 'feedzy_rss_translate' ) .'</strong></a>';
|
| 48 |
$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>';
|
| 49 |
$links[] = '<a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=7Z6YVM63739Y8" target="_blank" title="'. __( 'Donate', 'feedzy_rss_translate' ) .'"><strong>'. __( 'Donate', 'feedzy_rss_translate' ) .'</strong></a>';
|
| 109 |
* Main shortcode function
|
| 110 |
***************************************************************/
|
| 111 |
if (!function_exists('feedzy_rss')) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 112 |
|
| 113 |
+
function feedzy_rss($atts, $content = "") {
|
| 114 |
+
|
| 115 |
+
global $feedzyStyle;
|
| 116 |
+
$feedzyStyle = true;
|
| 117 |
+
//Retrieve & extract shorcode parameters
|
| 118 |
+
extract(shortcode_atts(array(
|
| 119 |
+
"feeds" => '', //comma separated feeds url
|
| 120 |
+
"max" => '5', //number of feeds items (0 for unlimited)
|
| 121 |
+
"feed_title" => 'yes', //display feed title yes/no
|
| 122 |
+
"target" => '_blank', //_blank, _self
|
| 123 |
+
"title" => '', //strip title after X char
|
| 124 |
+
"meta" => 'yes', //yes, no
|
| 125 |
+
"summary" => 'yes', //strip title
|
| 126 |
+
"summarylength" => '', //strip summary after X char
|
| 127 |
+
"thumb" => 'yes', //yes, no
|
| 128 |
+
"default" => '', //default thumb URL if no image found (only if thumb is set to yes)
|
| 129 |
+
"size" => '', //thumbs pixel size
|
| 130 |
+
"keywords_title" => '' //only display item if title contains specific keywords (comma-separated list/case sensitive)
|
| 131 |
+
), $atts));
|
| 132 |
+
$count = 0;
|
| 133 |
+
|
| 134 |
+
if ($max == '0') {
|
| 135 |
+
$max = '999';
|
| 136 |
+
} else if (empty($max) || !ctype_digit($max)) {
|
| 137 |
+
$max = '5';
|
| 138 |
+
}
|
| 139 |
+
|
| 140 |
+
if (empty($size) || !ctype_digit($size))
|
| 141 |
+
$size = '150';
|
| 142 |
|
| 143 |
+
if (!empty($title) && !ctype_digit($title))
|
| 144 |
+
$title = '';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 145 |
|
| 146 |
+
if (!empty($keywords_title))
|
| 147 |
+
$keywords_title = array_map('trim', explode(',', $keywords_title));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 148 |
|
| 149 |
+
if (!empty($summarylength) && !ctype_digit($summarylength))
|
| 150 |
+
$summarylength = '';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 151 |
|
| 152 |
+
if (!empty($default)) {
|
| 153 |
+
$default = $default;
|
| 154 |
+
} else {
|
| 155 |
+
$default = plugins_url('img/feedzy-default.jpg', __FILE__);
|
| 156 |
+
}
|
| 157 |
+
|
| 158 |
+
|
| 159 |
+
|
| 160 |
+
if (!class_exists('SimplePie'))
|
| 161 |
+
require_once(ABSPATH . WPINC . '/class-feed.php');
|
| 162 |
+
|
| 163 |
+
if (!empty($feeds)) {
|
| 164 |
+
|
| 165 |
+
$feedURL = explode(',', $feeds);
|
| 166 |
+
$feedURL = array_splice($feedURL, 0, 3);
|
| 167 |
+
if (count($feedURL) === 1) {
|
| 168 |
+
$feedURL = $feedURL[0];
|
| 169 |
+
};
|
| 170 |
+
}
|
| 171 |
+
|
| 172 |
+
//Process SimplePie
|
| 173 |
+
$feed = new SimplePie();
|
| 174 |
+
$feed->set_feed_url($feedURL);
|
| 175 |
+
$feed->enable_cache(true);
|
| 176 |
+
$feed->enable_order_by_date(true);
|
| 177 |
+
$feed->set_cache_class('WP_Feed_Cache');
|
| 178 |
+
$feed->set_file_class('WP_SimplePie_File');
|
| 179 |
+
$feed->set_cache_duration(apply_filters('wp_feed_cache_transient_lifetime', 7200, $feedURL));
|
| 180 |
+
do_action_ref_array('wp_feed_options', array($feed, $feedURL));
|
| 181 |
+
$feed->strip_comments(true);
|
| 182 |
+
$feed->strip_htmltags(false);
|
| 183 |
+
$feed->init();
|
| 184 |
+
$feed->handle_content_type();
|
| 185 |
+
|
| 186 |
+
if ($feed->error()) {
|
| 187 |
+
|
| 188 |
+
$content .= '<div id="message" class="error"><p>' . __('Sorry, this feed is currently unavailable or does not exists anymore.', 'feedzy_rss_translate') . '</p></div>';
|
| 189 |
+
}
|
| 190 |
+
|
| 191 |
+
$content .= '<div class="feedzy-rss">';
|
| 192 |
+
|
| 193 |
+
if ($feed_title == 'yes') {
|
| 194 |
+
|
| 195 |
+
$content .= '<div class="rss_header">';
|
| 196 |
+
$content .= '<h2><a href="' . $feed->get_permalink() . '">' . $feed->get_title() . '</a> <span> ' . $feed->get_description() . '</span></h2>';
|
| 197 |
+
$content .= '</div>';
|
| 198 |
+
}
|
| 199 |
+
|
| 200 |
+
//Loop through RSS feed
|
| 201 |
+
foreach ($feed->get_items() as $item) {
|
| 202 |
+
|
| 203 |
+
$continue = true;
|
| 204 |
+
//Check if keywords are in title
|
| 205 |
+
if (!empty($keywords_title)) {
|
| 206 |
+
$continue = false;
|
| 207 |
+
foreach ($keywords_title as $keyword) {
|
| 208 |
+
if (strpos($item->get_title(), $keyword) !== false) {
|
| 209 |
+
$continue = true;
|
| 210 |
+
}
|
| 211 |
+
}
|
| 212 |
+
}
|
| 213 |
+
|
| 214 |
+
if ($continue == true) {
|
| 215 |
+
|
| 216 |
+
//Count items
|
| 217 |
+
if ($count >= $max)
|
| 218 |
+
break;
|
| 219 |
+
$count++;
|
| 220 |
+
|
| 221 |
+
//Fetch image thumbnail
|
| 222 |
+
if ($thumb == 'yes') {
|
| 223 |
+
$thethumbnail = "";
|
| 224 |
+
|
| 225 |
+
|
| 226 |
+
if ($enclosure == $item->get_enclosure()) {
|
| 227 |
+
|
| 228 |
+
//item thumb
|
| 229 |
+
if ($thumbnail = $enclosure->get_thumbnail()) {
|
| 230 |
+
|
| 231 |
+
$thethumbnail = $thumbnail;
|
| 232 |
+
}
|
| 233 |
+
|
| 234 |
+
//media:thumbnail
|
| 235 |
+
if (isset($enclosure->thumbnails)) {
|
| 236 |
+
|
| 237 |
+
foreach ((array) $enclosure->thumbnails as $thumbnail) {
|
| 238 |
+
|
| 239 |
+
$thethumbnail = $thumbnail;
|
| 240 |
+
}
|
| 241 |
+
}
|
| 242 |
+
|
| 243 |
+
//enclosure
|
| 244 |
+
if ($thumbnail = $enclosure->embed()) {
|
| 245 |
+
|
| 246 |
+
$pattern = '/https?:\/\/.*\.(?:jpg|JPG|jpe|JPE|jpeg|JPEG|gif|GIF|png|PNG)/iU';
|
| 247 |
+
|
| 248 |
+
if (preg_match($pattern, $thumbnail, $matches)) {
|
| 249 |
+
|
| 250 |
+
$thethumbnail = $matches[0];
|
| 251 |
+
}
|
| 252 |
+
}
|
| 253 |
+
|
| 254 |
+
//media:content
|
| 255 |
+
foreach ((array) $enclosure->get_link() as $thumbnail) {
|
| 256 |
+
|
| 257 |
+
$pattern = '/https?:\/\/.*\.(?:jpg|JPG|jpe|JPE|jpeg|JPEG|gif|GIF|png|PNG)/iU';
|
| 258 |
+
$imgsrc = $thumbnail;
|
| 259 |
+
|
| 260 |
+
|
| 261 |
+
if (preg_match($pattern, $imgsrc, $matches)) {
|
| 262 |
+
|
| 263 |
+
$thethumbnail = $matches[0];
|
| 264 |
+
;
|
| 265 |
+
break;
|
| 266 |
+
}
|
| 267 |
+
}
|
| 268 |
+
}
|
| 269 |
+
|
| 270 |
+
//description image
|
| 271 |
+
if (empty($thethumbnail)) {
|
| 272 |
+
|
| 273 |
+
$feedDescription = $item->get_description();
|
| 274 |
+
$image = feedzy_returnImage($feedDescription);
|
| 275 |
+
$thethumbnail = feedzy_scrapeImage($image);
|
| 276 |
+
}
|
| 277 |
+
|
| 278 |
+
//content image
|
| 279 |
+
if (empty($thethumbnail)) {
|
| 280 |
+
|
| 281 |
+
$feedDescription = $item->get_content();
|
| 282 |
+
$image = feedzy_returnImage($feedDescription);
|
| 283 |
+
$thethumbnail = feedzy_scrapeImage($image);
|
| 284 |
+
}
|
| 285 |
+
}
|
| 286 |
+
|
| 287 |
+
//Padding ratio based on image size
|
| 288 |
+
$paddinTop = number_format((15 / 150) * $size, 0);
|
| 289 |
+
$paddinBottom = number_format((25 / 150) * $size, 0);
|
| 290 |
+
|
| 291 |
+
//Build element DOM
|
| 292 |
+
$content .= '<div class="rss_item" style="padding: ' . $paddinTop . 'px 0 ' . $paddinBottom . 'px">';
|
| 293 |
+
if ($thumb == 'yes') {
|
| 294 |
+
|
| 295 |
+
$contentThumb = '';
|
| 296 |
+
|
| 297 |
+
$contentThumb .= '<div class="rss_image" style="width:' . $size . 'px; height:' . $size . 'px;">';
|
| 298 |
+
$contentThumb .= '<a href="' . $item->get_permalink() . '" target="' . $target . '" title="' . $item->get_title() . '" >';
|
| 299 |
+
|
| 300 |
+
if (!empty($thethumbnail)) {
|
| 301 |
+
$contentThumb .= '<span style="width:' . $size . 'px; height:' . $size . 'px; background-image: none, url(' . $thethumbnail . '), url(' . $default . ');" alt="' . $item->get_title() . '"></span/>';
|
| 302 |
+
} else if (empty($thethumbnail)) {
|
| 303 |
+
$contentThumb .= '<span style="width:' . $size . 'px; height:' . $size . 'px; background-image:url(' . $default . ');" alt="' . $item->get_title() . '"></span/>';
|
| 304 |
+
}
|
| 305 |
|
| 306 |
+
$contentThumb .= '</a>';
|
| 307 |
+
$contentThumb .= '</div>';
|
| 308 |
+
|
| 309 |
+
//Filter: feedzy_thumb_output
|
| 310 |
+
$content .= apply_filters( 'feedzy_thumb_output', $contentThumb );
|
|
|
|
|
|
|
|
|
|
| 311 |
|
| 312 |
+
}
|
| 313 |
+
|
| 314 |
+
$contentTitle = '';
|
| 315 |
+
$contentTitle .= '<span class="title"><a href="' . $item->get_permalink() . '" target="' . $target . '">';
|
| 316 |
+
|
| 317 |
+
if (is_numeric($title) && strlen($item->get_title()) > $title) {
|
| 318 |
+
|
| 319 |
+
$contentTitle .= preg_replace('/\s+?(\S+)?$/', '', substr($item->get_title(), 0, $title)) . '...';
|
| 320 |
+
} else {
|
| 321 |
+
|
| 322 |
+
$contentTitle .= $item->get_title();
|
| 323 |
+
}
|
| 324 |
|
| 325 |
+
$contentTitle .= '</a></span>';
|
| 326 |
+
|
| 327 |
+
//Filter: feedzy_title_output
|
| 328 |
+
$content .= apply_filters( 'feedzy_title_output', $contentTitle );
|
| 329 |
+
|
|
|
|
| 330 |
$content .= '<div class="rss_content">';
|
| 331 |
+
|
| 332 |
+
if ($meta == 'yes') {
|
| 333 |
+
|
| 334 |
+
$contentMeta = '';
|
| 335 |
+
$contentMeta .= '<small>' . __('Posted by', 'feedzy_rss_translate') . ' ';
|
| 336 |
+
|
| 337 |
+
if ($author = $item->get_author()) {
|
| 338 |
+
|
| 339 |
+
$domain = parse_url($item->get_permalink());
|
| 340 |
+
$contentMeta .= '<a href="http://' . $domain["host"] . '" target="' . $target . '" title="' . $domain["host"] . '" >' . $author->get_name() . ' </a>';
|
| 341 |
+
}
|
| 342 |
+
|
| 343 |
+
$contentMeta .= __('on', 'feedzy_rss_translate') . ' ' . $item->get_date(get_option('date_format')) . ' ' . __('at', 'feedzy_rss_translate') . ' ' . $item->get_date(get_option('time_format'));
|
| 344 |
+
$contentMeta .= '</small>';
|
| 345 |
+
|
| 346 |
+
//Filter: feedzy_meta_output
|
| 347 |
+
$content .= apply_filters( 'feedzy_meta_output', $contentMeta );
|
| 348 |
+
|
| 349 |
+
}
|
| 350 |
+
if ($summary == 'yes') {
|
| 351 |
+
|
| 352 |
+
|
| 353 |
+
$contentSummary = '';
|
| 354 |
+
$contentSummary .= '<p>';
|
| 355 |
+
|
| 356 |
+
$description = trim(strip_tags($item->get_description()));
|
| 357 |
+
$description = trim(chop($description, '[…]'));
|
| 358 |
+
|
| 359 |
+
if (is_numeric($summarylength) && strlen($description) > $summarylength) {
|
| 360 |
+
|
| 361 |
+
$contentSummary .= preg_replace('/\s+?(\S+)?$/', '', substr($description, 0, $summarylength)) . ' […]';
|
| 362 |
+
} else {
|
| 363 |
+
|
| 364 |
+
$contentSummary .= $description . ' […]';
|
| 365 |
+
}
|
| 366 |
+
|
| 367 |
+
$contentSummary .= '</p>';
|
| 368 |
+
|
| 369 |
+
//Filter: feedzy_summary_output
|
| 370 |
+
$content .= apply_filters( 'feedzy_summary_output', $contentSummary, $item->get_permalink() );
|
| 371 |
+
|
| 372 |
+
}
|
| 373 |
+
$content .= '</div>';
|
| 374 |
+
$content .= '</div>';
|
| 375 |
+
} //endContinue
|
| 376 |
+
} //endforeach
|
| 377 |
+
|
| 378 |
+
$content .= '</div>';
|
| 379 |
+
return apply_filters( 'feedzy_global_output', $content );
|
| 380 |
+
}
|
| 381 |
+
|
| 382 |
+
//end of feedzy_rss
|
| 383 |
+
add_shortcode('feedzy-rss', 'feedzy_rss');
|
| 384 |
}
|
| 385 |
|
| 386 |
|
img/feedzy.svg
CHANGED
|
@@ -3,13 +3,9 @@
|
|
| 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 |
-
<
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 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>
|
| 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 |
+
<path fill="#DB3939" d="M425.195,2C190.366,2,0,191.918,0,426.195C0,660.472,190.366,850.39,425.195,850.39
|
| 7 |
+
c234.828,0,425.195-189.918,425.195-424.195C850.39,191.918,660.023,2,425.195,2z M378.648,670.664L378.648,670.664h-91.578v-57.115
|
| 8 |
+
l-49.567-49.451H180.24v-91.236h95.248l103.161,102.797V670.664z M531.175,670.664h-91.576V537.367L313.852,411.931H180.24v-91.362
|
| 9 |
+
h171.472l179.463,179.024V670.664z M683.718,670.664h-91.574V461.21L390.063,259.73H180.24v-91.361h247.806l255.672,255.072V670.664
|
| 10 |
+
z"/>
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
</svg>
|
img/icon-bweb.png
DELETED
|
Binary file
|
img/icon-bweb.svg
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
<path fill="#DC363B" d="M424.78,0.589C190.447,0.589,0.482,190.554,0.482,424.887c0,234.333,189.965,424.298,424.298,424.298
|
| 7 |
+
c234.333,0,424.297-189.965,424.297-424.298C849.078,190.554,659.113,0.589,424.78,0.589z M702.785,318.275
|
| 8 |
+
c-11.24,9.729-34.131,21.508-68.65,35.322c-23.918,9.533-38.666,17.224-44.242,23.076c-5.574,5.841-8.277,16.263-8.104,31.271
|
| 9 |
+
c0.99,21.921,8.318,51.36,22.006,88.31c13.688,36.934,22.533,64.604,26.541,82.984c1.656,8.002,0.635,15.938-3.068,23.807
|
| 10 |
+
c-3.699,7.857-9.555,14.082-17.596,18.67c-10.541,6.564-23.846,6.854-39.902,0.885c-16.061-5.977-42.666-21.096-79.832-45.355
|
| 11 |
+
c-2.139-1.24-5.014-3.037-8.635-5.418c-11.445-7.875-19.645-13.486-24.619-16.84c-4.977-3.365-11.771-7.178-20.375-11.447
|
| 12 |
+
c-8.607-4.279-14.279-7.232-17.02-8.855c-2.731-1.635-7.56-2.771-14.483-3.426c-6.92-0.66-11.457-0.877-13.599-0.633
|
| 13 |
+
c-2.141,0.223-6.675,2.051-13.59,5.469c-6.92,3.406-11.759,6.494-14.527,9.262c-2.768,2.756-8.338,7.881-16.714,15.357
|
| 14 |
+
c-8.372,7.467-14.986,13.838-19.849,19.129c-4.858,5.277-12.864,13.77-24.02,25.479c-3.745,4.109-6.552,7.197-8.423,9.258
|
| 15 |
+
c-10.437,11.129-18.385,19.137-23.846,24.025c-5.462,4.879-10.796,9.383-16.003,13.488c-5.203,4.096-10.063,5.877-14.553,5.354
|
| 16 |
+
c-4.492-0.537-8.934-1.555-13.313-3.043c-4.375-1.504-10.734-4.201-19.06-8.121c-16.212-8.762-26.084-16.115-29.613-22.063
|
| 17 |
+
c-3.521-5.959-3.563-15.244-0.115-27.852c1.917-7.92,8.024-18.262,18.329-31.031c10.305-12.787,21.383-23.834,33.231-33.174
|
| 18 |
+
c34.839-27.451,52.71-47.795,53.629-61.029c0.913-13.248-14.33-24.658-45.751-34.238c-20.731-6.363-35.218-12.56-43.455-18.579
|
| 19 |
+
c-8.241-6.031-12.895-14.148-13.958-24.364c-2.42-20.795,3.207-36.006,16.884-45.607c13.675-9.618,32.229-11.729,55.684-6.34
|
| 20 |
+
c12.335,3.081,24.446,4.6,36.332,4.553c11.887-0.065,19.903-1.716,24.027-4.966c4.132-3.255,12.937-16.455,26.424-39.594
|
| 21 |
+
c13.49-23.153,27.66-49.299,42.511-78.464c20.869-41.483,36.889-69.531,48.067-84.153c11.172-14.63,21.615-21.7,31.32-21.19
|
| 22 |
+
c13.639,0.305,26.379,6.134,38.219,17.472c11.84,11.321,17.072,22.778,15.705,34.336c-1.428,9.269,3.594,30.046,15.07,62.337
|
| 23 |
+
c10.363,27.92,22.086,43.713,35.16,47.386c13.076,3.664,35.197-2.42,66.377-18.257c21.139-10.845,38.715-14.216,52.715-10.107
|
| 24 |
+
c14.006,4.093,23.828,15.277,29.479,33.529C717.632,297.406,714.033,308.539,702.785,318.275z"/>
|
| 25 |
+
</svg>
|
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
|
| 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 |
|
|
@@ -58,6 +58,14 @@ By activating this plugin, your cover picture will be inserted into your RSS fee
|
|
| 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 DOCUMENTATION AND EXAMPLES](http://b-website.com/feedzy-rss-feeds-wordpress-plugin-using-simplepie "Documentation & examples")
|
| 63 |
|
|
@@ -90,11 +98,14 @@ Yes it is.
|
|
| 90 |
|
| 91 |
== Changelog ==
|
| 92 |
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
*
|
| 96 |
-
*
|
| 97 |
-
|
|
|
|
|
|
|
|
|
|
| 98 |
|
| 99 |
= 1.6 =
|
| 100 |
* Minor CSS fix
|
| 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.0
|
| 7 |
+
Stable tag: 1.7
|
| 8 |
License: GPLv2 or later
|
| 9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
| 10 |
|
| 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 |
+
= Available Hooks =
|
| 62 |
+
|
| 63 |
+
* feedzy_thumb_output
|
| 64 |
+
* feedzy_title_output
|
| 65 |
+
* feedzy_meta_output
|
| 66 |
+
* feedzy_summary_output
|
| 67 |
+
* feedzy_global_output
|
| 68 |
+
|
| 69 |
|
| 70 |
[FULL DOCUMENTATION AND EXAMPLES](http://b-website.com/feedzy-rss-feeds-wordpress-plugin-using-simplepie "Documentation & examples")
|
| 71 |
|
| 98 |
|
| 99 |
== Changelog ==
|
| 100 |
|
| 101 |
+
= 1.7 =
|
| 102 |
+
* Minor Template and CSS changes
|
| 103 |
+
* New hook: feedzy_thumb_output
|
| 104 |
+
* New hook: feedzy_title_output
|
| 105 |
+
* New hook: feedzy_meta_output
|
| 106 |
+
* New hook: feedzy_summary_output
|
| 107 |
+
* New hook: feedzy_global_output
|
| 108 |
+
* readme.txt update
|
| 109 |
|
| 110 |
= 1.6 =
|
| 111 |
* Minor CSS fix
|
