Category Posts Widget - Version 4.1.7

Version Description

  • April 14th 2016 =
  • Fixed division by zero bug.
Download this release

Release Info

Developer Kometschuh
Plugin Icon 128x128 Category Posts Widget
Version 4.1.7
Comparing to
See all releases

Code changes from version 4.1.6 to 4.1.7

Files changed (3) hide show
  1. cat-posts.css +1 -1
  2. cat-posts.php +26 -11
  3. readme.txt +16 -7
cat-posts.css CHANGED
@@ -1,6 +1,6 @@
1
  /*
2
  Default CSS Styles for the Category Posts Widget plugin
3
- Version: 4.1.6
4
  */
5
 
6
  /*--------------------------------------------------------------
1
  /*
2
  Default CSS Styles for the Category Posts Widget plugin
3
+ Version: 4.1.7
4
  */
5
 
6
  /*--------------------------------------------------------------
cat-posts.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: Category Posts Widget
4
  Plugin URI: http://mkrdip.me/category-posts-widget
5
  Description: Adds a widget that shows the most recent posts from a single category.
6
  Author: Mrinal Kanti Roy
7
- Version: 4.1.6
8
  Author URI: http://mkrdip.me
9
  */
10
 
@@ -246,14 +246,20 @@ class CategoryPosts extends WP_Widget {
246
  override the thumbnail htmo to insert cropping when needed
247
  */
248
  function post_thumbnail_html($html, $post_id, $post_thumbnail_id, $size, $attr){
249
- if ( empty($this->instance['thumb_w']) || empty($this->instance['thumb_w']))
250
  return $html; // bail out if no full dimensions defined
251
 
252
  $meta = image_get_intermediate_size($post_thumbnail_id,$size);
 
 
 
 
 
 
253
  $origfile = get_attached_file( $post_thumbnail_id, true); // the location of the full file
254
  $file = dirname($origfile) .'/'.$meta['file']; // the location of the file displayed as thumb
255
  list( $width, $height ) = getimagesize($file); // get actual size of the thumb file
256
-
257
  if ($width / $height == $this->instance['thumb_w'] / $this->instance['thumb_h']) {
258
  // image is same ratio as asked for, nothing to do here as the browser will handle it correctly
259
  ;
@@ -305,6 +311,13 @@ class CategoryPosts extends WP_Widget {
305
  return ' <a class="cat-post-excerpt-more" href="'. get_permalink($post->ID) . '">' . $this->instance["excerpt_more_text"] . '</a>';
306
  }
307
 
 
 
 
 
 
 
 
308
  /**
309
  * Excerpt allow HTML
310
  */
@@ -428,7 +441,10 @@ class CategoryPosts extends WP_Widget {
428
  if( isset( $instance['excerpt_allow_html'] ) ) {
429
  remove_filter('get_the_excerpt', 'wp_trim_excerpt');
430
  add_filter('the_excerpt', array($this,'allow_html_excerpt'));
 
 
431
  }
 
432
 
433
  echo $before_widget;
434
 
@@ -522,7 +538,8 @@ class CategoryPosts extends WP_Widget {
522
  remove_filter('excerpt_length', $new_excerpt_length);
523
  remove_filter('excerpt_more', array($this,'excerpt_more_filter'));
524
  add_filter('get_the_excerpt', 'wp_trim_excerpt');
525
- remove_filter('get_the_excerpt', array($this,'allow_html_excerpt'));
 
526
 
527
  wp_reset_postdata();
528
 
@@ -610,7 +627,7 @@ class CategoryPosts extends WP_Widget {
610
 
611
  ?>
612
  <div class="category-widget-cont">
613
- <p><a target="_blank" href="http://tiptoppress.com/terms-tags-and-categories-posts-widget/">Get the Pro Version</a></p>
614
  <p><a target="_blank" href="http://tiptoppress.com/category-posts-widget/documentation/">Documentation</a></p>
615
  <h4><?php _e('Title','categoryposts')?></h4>
616
  <div>
@@ -812,13 +829,11 @@ class CategoryPosts extends WP_Widget {
812
  <input class="widefat" style="width:60%;" placeholder="<?php _e('... more by this topic','categoryposts')?>" id="<?php echo $this->get_field_id("footer_link"); ?>" name="<?php echo $this->get_field_name("footer_link"); ?>" type="text" value="<?php echo esc_attr($instance["footer_link"]); ?>" />
813
  </label>
814
  </p>
815
- </div>
816
- <h4>Follow us on</h4>
817
- <div>
818
- <a target="_blank" href="https://www.facebook.com/TipTopPress">Facebook</a> and
819
  <a target="_blank" href="https://twitter.com/TipTopPress">Twitter</a></br></br>
820
- </br>
821
- </div>
822
  </div>
823
  <?php
824
  }
4
  Plugin URI: http://mkrdip.me/category-posts-widget
5
  Description: Adds a widget that shows the most recent posts from a single category.
6
  Author: Mrinal Kanti Roy
7
+ Version: 4.1.7
8
  Author URI: http://mkrdip.me
9
  */
10
 
246
  override the thumbnail htmo to insert cropping when needed
247
  */
248
  function post_thumbnail_html($html, $post_id, $post_thumbnail_id, $size, $attr){
249
+ if ( empty($this->instance['thumb_w']) || empty($this->instance['thumb_h']))
250
  return $html; // bail out if no full dimensions defined
251
 
252
  $meta = image_get_intermediate_size($post_thumbnail_id,$size);
253
+
254
+ if ( empty( $meta )) {
255
+ $post_img = wp_get_attachment_metadata($post_thumbnail_id, $size);
256
+ $meta['file'] = basename( $post_img['file'] );
257
+ }
258
+
259
  $origfile = get_attached_file( $post_thumbnail_id, true); // the location of the full file
260
  $file = dirname($origfile) .'/'.$meta['file']; // the location of the file displayed as thumb
261
  list( $width, $height ) = getimagesize($file); // get actual size of the thumb file
262
+
263
  if ($width / $height == $this->instance['thumb_w'] / $this->instance['thumb_h']) {
264
  // image is same ratio as asked for, nothing to do here as the browser will handle it correctly
265
  ;
311
  return ' <a class="cat-post-excerpt-more" href="'. get_permalink($post->ID) . '">' . $this->instance["excerpt_more_text"] . '</a>';
312
  }
313
 
314
+ /**
315
+ * Explicite excerpt
316
+ */
317
+ function explicite_the_excerpt($text) {
318
+ return apply_filters('the_content', $text);
319
+ }
320
+
321
  /**
322
  * Excerpt allow HTML
323
  */
441
  if( isset( $instance['excerpt_allow_html'] ) ) {
442
  remove_filter('get_the_excerpt', 'wp_trim_excerpt');
443
  add_filter('the_excerpt', array($this,'allow_html_excerpt'));
444
+ } else {
445
+ add_filter('the_excerpt', array($this,'explicite_the_excerpt'));
446
  }
447
+
448
 
449
  echo $before_widget;
450
 
538
  remove_filter('excerpt_length', $new_excerpt_length);
539
  remove_filter('excerpt_more', array($this,'excerpt_more_filter'));
540
  add_filter('get_the_excerpt', 'wp_trim_excerpt');
541
+ remove_filter('the_excerpt', array($this,'allow_html_excerpt'));
542
+ remove_filter('the_excerpt', array($this,'explicite_the_excerpt'));
543
 
544
  wp_reset_postdata();
545
 
627
 
628
  ?>
629
  <div class="category-widget-cont">
630
+ <p><a target="_blank" href="http://tiptoppress.com/term-and-category-based-posts-widget/">Get the Pro Version</a></p>
631
  <p><a target="_blank" href="http://tiptoppress.com/category-posts-widget/documentation/">Documentation</a></p>
632
  <h4><?php _e('Title','categoryposts')?></h4>
633
  <div>
829
  <input class="widefat" style="width:60%;" placeholder="<?php _e('... more by this topic','categoryposts')?>" id="<?php echo $this->get_field_id("footer_link"); ?>" name="<?php echo $this->get_field_name("footer_link"); ?>" type="text" value="<?php echo esc_attr($instance["footer_link"]); ?>" />
830
  </label>
831
  </p>
832
+ </div>
833
+ <p style="text-align:right;">
834
+ Follow us on <a target="_blank" href="https://www.facebook.com/TipTopPress">Facebook</a> and
 
835
  <a target="_blank" href="https://twitter.com/TipTopPress">Twitter</a></br></br>
836
+ </p>
 
837
  </div>
838
  <?php
839
  }
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://mkrdip.me/donate
4
  Tags: category, posts, widget, single category widget, posts widget, category recent posts
5
  Requires at least: 2.8
6
  Tested up to: 4.5
7
- Stable tag: 4.1.6
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -14,17 +14,17 @@ Adds a widget that shows the most recent posts from a single category.
14
  Category Posts Widget is a light widget designed to do one thing and do it well: display the most recent posts from a certain category.
15
 
16
  = Term and Category based Posts Widget =
17
- It's the pro version and available at on <a target="_blank" href="http://tiptoppress.com/">Tip Top Press</a> created for big Wordpress sites.
18
  We giving you a 50%-special discount code: **'WordPress'**. (Enter it after checkout.)
19
  = Pro features =
20
- * Custom Post Types, Terms and Custom Taxonomies
21
- * Multi selection
22
- * Different styles, like vertical scrolling ticker
23
 
24
  = Features =
25
  * Option to change ordering of posts.
26
  * Option to show post thumbnail & set dimension by width & height.
27
- * Option to crop thumbnails with CSS. <a target="_blank" href="http://tiptoppress.com/css-image-crop/">What is 'CSS Image Crop'?</a>
28
  * Option to set mouse hover effects for post thumbnail.
29
  * Option to put thumbnail on top
30
  * Option to hide posts which have no thumbnail.
@@ -47,7 +47,7 @@ We giving you a 50%-special discount code: **'WordPress'**. (Enter it after chec
47
  * Localization support.
48
 
49
  = Documentation =
50
- Formatting date and time: See <a target="_blank" href="https://codex.wordpress.org/Formatting_Date_and_Time">Formatting Date and Time</a>.
51
 
52
  = Contribute =
53
  While using this plugin if you find any bug or any conflict, please submit an issue at
@@ -81,11 +81,20 @@ Please use the option: "Disable widget CSS".
81
  = I want the title as a link pointing to the selected Categorie page? =
82
  Enable the check box "Make widget title link".
83
 
 
 
 
 
 
 
84
  == Screenshots ==
85
  1. The widget configuration dialog.
86
  2. Front end of the widget using a default WordPress Theme.
87
 
88
  == Changelog ==
 
 
 
89
  = 4.1.6 - April 13th 2016 =
90
  * Add option CSS cropping for thumbnails.
91
  * Add option to set mouse hover effects for post thumbnail.
4
  Tags: category, posts, widget, single category widget, posts widget, category recent posts
5
  Requires at least: 2.8
6
  Tested up to: 4.5
7
+ Stable tag: 4.1.7
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
14
  Category Posts Widget is a light widget designed to do one thing and do it well: display the most recent posts from a certain category.
15
 
16
  = Term and Category based Posts Widget =
17
+ It's the pro version and available at on [Tip Top Press](http://tiptoppress.com) created for big Wordpress sites.
18
  We giving you a 50%-special discount code: **'WordPress'**. (Enter it after checkout.)
19
  = Pro features =
20
+ * Custom Post Types, Terms and Custom Taxonomies.
21
+ * Multi selection.
22
+ * Different styles, like vertical scrolling ticker [Demo](http://demo.tiptoppress.com).
23
 
24
  = Features =
25
  * Option to change ordering of posts.
26
  * Option to show post thumbnail & set dimension by width & height.
27
+ * Option to crop thumbnails with CSS. [What is 'CSS Image Crop'?](http://tiptoppress.com/css-image-crop)
28
  * Option to set mouse hover effects for post thumbnail.
29
  * Option to put thumbnail on top
30
  * Option to hide posts which have no thumbnail.
47
  * Localization support.
48
 
49
  = Documentation =
50
+ Formatting date and time: See [Formatting Date and Time](https://codex.wordpress.org/Formatting_Date_and_Time).
51
 
52
  = Contribute =
53
  While using this plugin if you find any bug or any conflict, please submit an issue at
81
  = I want the title as a link pointing to the selected Categorie page? =
82
  Enable the check box "Make widget title link".
83
 
84
+ = Parse error: syntax error, unexpected T_FUNCTION in /home/www/blog/wp-content/plugins/category-posts/cat-posts.php on line 58 =
85
+ Some of the features that were used in that version needs PHP 5.3+.
86
+ We apologies for any headache this may cause you, but frankly it is better for you to check with your hosting company how can you upgrade the PHP version that you are using, and not only in order to use this plugin. PHP 5.2 should be considered insecure now, and for your own sake you should upgrade.
87
+ PHP 5.2 is very old and any support for it from the php developers had ended more then 5 years ago [php.net/eol.php](http://php.net/eol.php).
88
+ We know there are peopel how use PHP 5.2 [wordpress.org/about/stats](https://wordpress.org/about/stats/) and we can't imagine this people will have no other problems, if they don't update.
89
+
90
  == Screenshots ==
91
  1. The widget configuration dialog.
92
  2. Front end of the widget using a default WordPress Theme.
93
 
94
  == Changelog ==
95
+ = 4.1.7 - April 14th 2016 =
96
+ * Fixed division by zero bug.
97
+
98
  = 4.1.6 - April 13th 2016 =
99
  * Add option CSS cropping for thumbnails.
100
  * Add option to set mouse hover effects for post thumbnail.