Advanced Random Posts Widget - Version 1.5

Version Description

Download this release

Release Info

Developer satrya
Plugin Icon 128x128 Advanced Random Posts Widget
Version 1.5
Comparing to
See all releases

Code changes from version 1.4 to 1.5

arpw.php CHANGED
@@ -1,13 +1,13 @@
1
  <?php
2
  /*
3
- Plugin Name: Advanced Random Posts Widget
4
- Plugin URI: http://wordpress.org/extend/plugins/advanced-random-posts-widget/
5
- Description: Enables advanced random posts widget.
6
- Version: 1.4
7
- Author: Satrya
8
- Author URI: http://satrya.me/
9
  Author Email: satrya@satrya.me
10
- License: GPLv2
11
  */
12
 
13
  // Exit if accessed directly
@@ -24,13 +24,13 @@ class ARP_Widget {
24
  */
25
  public function __construct() {
26
 
27
- add_action( 'plugins_loaded', array( &$this, 'constants' ), 1 );
28
 
29
- add_action( 'plugins_loaded', array( &$this, 'i18n' ), 2 );
30
 
31
- add_action( 'plugins_loaded', array( &$this, 'includes' ), 3 );
32
 
33
- add_action( 'init', array( &$this, 'init' ) );
34
 
35
  }
36
 
@@ -41,9 +41,9 @@ class ARP_Widget {
41
  */
42
  public function constants() {
43
 
44
- define( 'ARPW_DIR', trailingslashit( plugin_dir_path( __FILE__ ) ) );
45
 
46
- define( 'ARPW_URI', trailingslashit( plugin_dir_url( __FILE__ ) ) );
47
 
48
  define( 'ARPW_INCLUDES', ARPW_DIR . trailingslashit( 'includes' ) );
49
 
@@ -55,10 +55,8 @@ class ARP_Widget {
55
  * @since 1.0
56
  */
57
  public function i18n() {
58
-
59
  /* Load the translation of the plugin. */
60
  load_plugin_textdomain( 'arpw', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
61
-
62
  }
63
 
64
  /**
@@ -67,23 +65,16 @@ class ARP_Widget {
67
  * @since 1.0
68
  */
69
  public function includes() {
70
-
71
  require_once( ARPW_INCLUDES . 'widget-advanced-random-posts.php' );
72
  }
73
 
74
  /**
75
- * Register custom style for the widget.
76
  *
77
- * @since 1.0
78
  */
79
- function init() {
80
-
81
- if( ! is_admin() ) {
82
-
83
- wp_enqueue_style( 'arpw-style', ARPW_URI . 'arpw.css' );
84
-
85
- }
86
-
87
  }
88
 
89
  }
1
  <?php
2
  /*
3
+ Plugin Name: Advanced Random Posts Widget
4
+ Plugin URI: http://wordpress.org/plugins/advanced-random-posts-widget/
5
+ Description: Enables advanced random posts widget.
6
+ Version: 1.5
7
+ Author: Satrya
8
+ Author URI: http://satrya.me/
9
  Author Email: satrya@satrya.me
10
+ License: GPLv2
11
  */
12
 
13
  // Exit if accessed directly
24
  */
25
  public function __construct() {
26
 
27
+ add_action( 'plugins_loaded' , array( &$this, 'constants' ), 1 );
28
 
29
+ add_action( 'plugins_loaded' , array( &$this, 'i18n' ), 2 );
30
 
31
+ add_action( 'plugins_loaded' , array( &$this, 'includes' ), 3 );
32
 
33
+ add_action( 'admin_enqueue_scripts', array( &$this, 'admin_style' ) );
34
 
35
  }
36
 
41
  */
42
  public function constants() {
43
 
44
+ define( 'ARPW_DIR' , trailingslashit( plugin_dir_path( __FILE__ ) ) );
45
 
46
+ define( 'ARPW_URI' , trailingslashit( plugin_dir_url( __FILE__ ) ) );
47
 
48
  define( 'ARPW_INCLUDES', ARPW_DIR . trailingslashit( 'includes' ) );
49
 
55
  * @since 1.0
56
  */
57
  public function i18n() {
 
58
  /* Load the translation of the plugin. */
59
  load_plugin_textdomain( 'arpw', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
 
60
  }
61
 
62
  /**
65
  * @since 1.0
66
  */
67
  public function includes() {
 
68
  require_once( ARPW_INCLUDES . 'widget-advanced-random-posts.php' );
69
  }
70
 
71
  /**
72
+ * Register custom style for the widget setting.
73
  *
74
+ * @since 1.5
75
  */
76
+ function admin_style() {
77
+ wp_enqueue_style( 'arpw-admin-style', ARPW_URI . 'includes/admin.css' );
 
 
 
 
 
 
78
  }
79
 
80
  }
includes/widget-advanced-random-posts.php CHANGED
@@ -11,13 +11,13 @@ class arpw_widget extends WP_Widget {
11
  function arpw_widget() {
12
 
13
  $widget_ops = array(
14
- 'classname' => 'arpw_widget random-posts',
15
  'description' => __( 'Enable advanced random posts widget.', 'arpw' )
16
  );
17
 
18
  $control_ops = array(
19
- 'width' => 300,
20
- 'height' => 350,
21
  'id_base' => 'arpw_widget'
22
  );
23
 
@@ -29,41 +29,52 @@ class arpw_widget extends WP_Widget {
29
  * Display widget
30
  */
31
  function widget( $args, $instance ) {
 
32
  extract( $args, EXTR_SKIP );
33
 
34
- $title = apply_filters( 'widget_title', $instance['title'] );
35
- $limit = $instance['limit'];
36
- $excerpt = $instance['excerpt'];
37
- $length = (int)( $instance['length'] );
38
- $thumb = $instance['thumb'];
 
39
  $thumb_height = (int)( $instance['thumb_height'] );
40
- $thumb_width = (int)( $instance['thumb_width'] );
41
- $cat = $instance['cat'];
42
- $date = $instance['date'];
43
- $css = wp_filter_nohtml_kses( $instance['css'] );
 
 
 
44
 
45
  echo $before_widget;
46
 
 
 
 
47
  if( $css )
48
  echo '<style>' . $css . '</style>';
49
 
50
- if ( ! empty( $title ) )
 
 
51
  echo $before_title . $title . $after_title;
52
 
53
  global $post;
54
 
55
  $args = array(
56
- 'numberposts' => $limit,
57
- 'cat' => $cat,
58
- 'post_type' => 'post',
59
- 'orderby' => 'rand'
 
60
  );
61
 
62
  $arpwwidget = get_posts( $args );
63
 
64
  if( $arpwwidget ) : ?>
65
 
66
- <div class="arpw-block">
67
 
68
  <ul>
69
 
@@ -71,7 +82,7 @@ class arpw_widget extends WP_Widget {
71
 
72
  <li class="arpw-clearfix">
73
 
74
- <?php if( has_post_thumbnail() && $thumb == true ) { ?>
75
 
76
  <a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'arpw' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark">
77
  <?php
@@ -102,7 +113,7 @@ class arpw_widget extends WP_Widget {
102
 
103
  </ul>
104
 
105
- </div><!-- .arpw-block - http://wordpress.org/extend/plugins/advanced-random-posts-widget/ -->
106
 
107
  <?php endif;
108
 
@@ -115,17 +126,21 @@ class arpw_widget extends WP_Widget {
115
  */
116
  function update( $new_instance, $old_instance ) {
117
 
118
- $instance = $old_instance;
119
- $instance['title'] = strip_tags( $new_instance['title'] );
120
- $instance['limit'] = $new_instance['limit'];
121
- $instance['excerpt'] = $new_instance['excerpt'];
122
- $instance['length'] = (int)( $new_instance['length'] );
123
- $instance['thumb'] = $new_instance['thumb'];
 
124
  $instance['thumb_height'] = (int)( $new_instance['thumb_height'] );
125
- $instance['thumb_width'] = (int)( $new_instance['thumb_width'] );
126
- $instance['cat'] = $new_instance['cat'];
127
- $instance['date'] = $new_instance['date'];
128
- $instance['css'] = wp_filter_nohtml_kses( $new_instance['css'] );
 
 
 
129
 
130
  return $instance;
131
 
@@ -138,82 +153,130 @@ class arpw_widget extends WP_Widget {
138
 
139
  /* Set up some default widget settings. */
140
  $defaults = array(
141
- 'title' => '',
142
- 'limit' => 5,
143
- 'excerpt' => '',
144
- 'length' => 10,
145
- 'thumb' => true,
 
146
  'thumb_height' => 45,
147
- 'thumb_width' => 45,
148
- 'cat' => '',
149
- 'date' => true,
150
- 'css' => ''
 
 
 
151
  );
152
 
153
- $instance = wp_parse_args( (array) $instance, $defaults );
154
- $title = strip_tags( $instance['title'] );
155
- $limit = $instance['limit'];
156
- $excerpt = $instance['excerpt'];
157
- $length = (int)($instance['length']);
158
- $thumb = $instance['thumb'];
 
159
  $thumb_height = (int)( $instance['thumb_height'] );
160
- $thumb_width = (int)( $instance['thumb_width'] );
161
- $cat = $instance['cat'];
162
- $date = $instance['date'];
163
- $css = wp_filter_nohtml_kses( $instance['css'] );
 
 
 
164
 
165
  ?>
166
 
 
 
167
  <p>
168
  <label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php _e( 'Title:', 'arpw' ); ?></label>
169
  <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text" value="<?php echo $title; ?>" />
170
  </p>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
171
  <p>
172
  <label for="<?php echo esc_attr( $this->get_field_id( 'limit' ) ); ?>"><?php _e( 'Limit:', 'arpw' ); ?></label>
173
- <select class="widefat" name="<?php echo $this->get_field_name( 'limit' ); ?>" id="<?php echo $this->get_field_id( 'limit' ); ?>">
174
- <?php for ( $i=1; $i<=20; $i++ ) { ?>
175
- <option <?php selected( $limit, $i ) ?> value="<?php echo $i; ?>"><?php echo $i; ?></option>
176
- <?php } ?>
177
- </select>
178
  </p>
179
  <p>
180
- <label for="<?php echo esc_attr( $this->get_field_id( 'date' ) ); ?>"><?php _e( 'Display date?', 'arpw' ); ?></label>
181
- <input id="<?php echo $this->get_field_id( 'date' ); ?>" name="<?php echo $this->get_field_name( 'date' ); ?>" type="checkbox" value="1" <?php checked( '1', $date ); ?> />&nbsp;
182
- </p>
 
 
 
 
 
 
 
183
  <p>
184
- <label for="<?php echo esc_attr( $this->get_field_id( 'excerpt' ) ); ?>"><?php _e( 'Display excerpt?', 'arpw' ); ?></label>
185
- <input id="<?php echo $this->get_field_id( 'excerpt' ); ?>" name="<?php echo $this->get_field_name( 'excerpt' ); ?>" type="checkbox" value="1" <?php checked( '1', $excerpt ); ?> />&nbsp;
186
- </p>
187
- <p>
188
- <label for="<?php echo esc_attr( $this->get_field_id( 'length' ) ); ?>"><?php _e( 'Excerpt length:', 'arpw' ); ?></label>
189
- <input id="<?php echo esc_attr( $this->get_field_id( 'length' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'length' ) ); ?>" type="text" value="<?php echo $length; ?>" />
 
 
 
190
  </p>
191
 
 
 
 
 
192
  <?php if( current_theme_supports( 'post-thumbnails' ) ) { ?>
193
 
194
  <p>
195
- <label for="<?php echo esc_attr( $this->get_field_id( 'thumb' ) ); ?>"><?php _e( 'Display thumbnail?', 'arpw' ); ?></label>
196
  <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 ); ?> />&nbsp;
197
  </p>
198
  <p>
199
- <label for="<?php echo esc_attr( $this->get_field_id( 'thumb_height' ) ); ?>"><?php _e( 'Thumbnail size (height x width):', 'arpw' ); ?></label>
200
- <input id="<?php echo esc_attr( $this->get_field_id( 'thumb_height' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'thumb_height' ) ); ?>" type="text" value="<?php echo $thumb_height; ?>" />
201
- <input id="<?php echo esc_attr( $this->get_field_id( 'thumb_width' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'thumb_width' ) ); ?>" type="text" value="<?php echo $thumb_width; ?>" />
202
  </p>
203
 
204
  <?php } ?>
205
 
206
  <p>
207
- <label for="<?php echo esc_attr( $this->get_field_id( 'cat' ) ); ?>"><?php _e( 'Limit to category: ' , 'arpw' ); ?></label>
208
- <?php wp_dropdown_categories( array( 'name' => $this->get_field_name( 'cat' ), 'show_option_all' => __( 'All categories' , 'arpw' ), 'hide_empty' => 1, 'hierarchical' => 1, 'selected' => $cat ) ); ?>
209
- </p>
210
- <p>
211
- <label for="<?php echo $this->get_field_id( 'css' ); ?>"><?php _e( 'Custom CSS:', 'arpw' ); ?></label>
212
- <textarea class="widefat" id="<?php echo $this->get_field_id( 'css' ); ?>" name="<?php echo $this->get_field_name( 'css' ); ?>" style="height:100px;"><?php echo $css; ?></textarea>
213
  </p>
 
214
  <p>
215
- <span style="color: #f00;"><?php printf( __( 'Advanced Random Posts Widget is a project by <a href="%s" target="_blank">Satrya</a>', 'arpw' ), esc_url( 'http://satrya.me/' ) ); ?></span>
216
- </p>
 
 
 
 
 
217
 
218
  <?php
219
  }
@@ -250,4 +313,17 @@ function arpw_excerpt( $length ) {
250
  return $excerpt;
251
 
252
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
253
  ?>
11
  function arpw_widget() {
12
 
13
  $widget_ops = array(
14
+ 'classname' => 'arpw_widget random-posts',
15
  'description' => __( 'Enable advanced random posts widget.', 'arpw' )
16
  );
17
 
18
  $control_ops = array(
19
+ 'width' => 800,
20
+ 'height' => 350,
21
  'id_base' => 'arpw_widget'
22
  );
23
 
29
  * Display widget
30
  */
31
  function widget( $args, $instance ) {
32
+
33
  extract( $args, EXTR_SKIP );
34
 
35
+ $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base );
36
+ $title_url = esc_url( $instance['title_url'] );
37
+ $limit = (int)( $instance['limit'] );
38
+ $excerpt = $instance['excerpt'];
39
+ $length = (int)( $instance['length'] );
40
+ $thumb = $instance['thumb'];
41
  $thumb_height = (int)( $instance['thumb_height'] );
42
+ $thumb_width = (int)( $instance['thumb_width'] );
43
+ $cat = $instance['cat'];
44
+ $tag = $instance['tag'];
45
+ $date = $instance['date'];
46
+ $css = wp_filter_nohtml_kses( $instance['css'] );
47
+ $css_id = $instance['css_id'];
48
+ $css_default = $instance['css_default'];
49
 
50
  echo $before_widget;
51
 
52
+ if ( $css_default == true )
53
+ arpw_custom_styles(); // load the custom style.
54
+
55
  if( $css )
56
  echo '<style>' . $css . '</style>';
57
 
58
+ if ( ! empty( $title_url ) && ! empty( $title ) )
59
+ echo $before_title . '<a href="' . $title_url . '" title="' . esc_attr( $title ) . '">' . $title . '</a>' . $after_title;
60
+ elseif ( ! empty( $title ) )
61
  echo $before_title . $title . $after_title;
62
 
63
  global $post;
64
 
65
  $args = array(
66
+ 'numberposts' => $limit,
67
+ 'category__in' => $cat,
68
+ 'tag__in' => $tag,
69
+ 'post_type' => 'post',
70
+ 'orderby' => 'rand'
71
  );
72
 
73
  $arpwwidget = get_posts( $args );
74
 
75
  if( $arpwwidget ) : ?>
76
 
77
+ <div <?php echo( ! empty( $css_id ) ? 'id="' . $css_id . '"' : '' ); ?> class="arpw-block">
78
 
79
  <ul>
80
 
82
 
83
  <li class="arpw-clearfix">
84
 
85
+ <?php if( $thumb == true && has_post_thumbnail() ) { ?>
86
 
87
  <a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'arpw' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark">
88
  <?php
113
 
114
  </ul>
115
 
116
+ </div><!-- .arpw-block - http://wordpress.org/plugins/advanced-random-posts-widget/ -->
117
 
118
  <?php endif;
119
 
126
  */
127
  function update( $new_instance, $old_instance ) {
128
 
129
+ $instance = $old_instance;
130
+ $instance['title'] = strip_tags( $new_instance['title'] );
131
+ $instance['title_url'] = esc_url_raw( $new_instance['title_url'] );
132
+ $instance['limit'] = (int)( $new_instance['limit'] );
133
+ $instance['excerpt'] = $new_instance['excerpt'];
134
+ $instance['length'] = (int)( $new_instance['length'] );
135
+ $instance['thumb'] = $new_instance['thumb'];
136
  $instance['thumb_height'] = (int)( $new_instance['thumb_height'] );
137
+ $instance['thumb_width'] = (int)( $new_instance['thumb_width'] );
138
+ $instance['cat'] = $new_instance['cat'];
139
+ $instance['tag'] = $new_instance['tag'];
140
+ $instance['date'] = $new_instance['date'];
141
+ $instance['css'] = wp_filter_nohtml_kses( $new_instance['css'] );
142
+ $instance['css_id'] = sanitize_html_class( $new_instance['css_id'] );
143
+ $instance['css_default'] = $new_instance['css_default'];
144
 
145
  return $instance;
146
 
153
 
154
  /* Set up some default widget settings. */
155
  $defaults = array(
156
+ 'title' => '',
157
+ 'title_url' => '',
158
+ 'limit' => 5,
159
+ 'excerpt' => '',
160
+ 'length' => 10,
161
+ 'thumb' => true,
162
  'thumb_height' => 45,
163
+ 'thumb_width' => 45,
164
+ 'cat' => '',
165
+ 'tag' => '',
166
+ 'date' => true,
167
+ 'css' => '',
168
+ 'css_id' => '',
169
+ 'css_default' => true
170
  );
171
 
172
+ $instance = wp_parse_args( (array) $instance, $defaults );
173
+ $title = strip_tags( $instance['title'] );
174
+ $title_url = esc_url( $instance['title_url'] );
175
+ $limit = (int)( $instance['limit'] );
176
+ $excerpt = $instance['excerpt'];
177
+ $length = (int)($instance['length']);
178
+ $thumb = $instance['thumb'];
179
  $thumb_height = (int)( $instance['thumb_height'] );
180
+ $thumb_width = (int)( $instance['thumb_width'] );
181
+ $cat = $instance['cat'];
182
+ $tag = $instance['tag'];
183
+ $date = $instance['date'];
184
+ $css = wp_filter_nohtml_kses( $instance['css'] );
185
+ $css_id = $instance['css_id'];
186
+ $css_default = $instance['css_default'];
187
 
188
  ?>
189
 
190
+ <div class="arpw-columns-3">
191
+
192
  <p>
193
  <label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php _e( 'Title:', 'arpw' ); ?></label>
194
  <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text" value="<?php echo $title; ?>" />
195
  </p>
196
+ <p>
197
+ <label for="<?php echo esc_attr( $this->get_field_id( 'title_url' ) ); ?>"><?php _e( 'Title URL:', 'arpw' ); ?></label>
198
+ <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title_url' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title_url' ) ); ?>" type="text" value="<?php echo $title_url; ?>" />
199
+ </p>
200
+ <p>
201
+ <label for="<?php echo esc_attr( $this->get_field_id( 'css_id' ) ); ?>"><?php _e( 'CSS ID:', 'arpw' ); ?></label>
202
+ <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'css_id' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'css_id' ) ); ?>" type="text" value="<?php echo $css_id; ?>" />
203
+ </p>
204
+ <p>
205
+ <label class="input-checkbox" for="<?php echo esc_attr( $this->get_field_id( 'css_default' ) ); ?>"><?php _e( 'Use Default Styles', 'arpw' ); ?></label>
206
+ <input id="<?php echo esc_attr( $this->get_field_id( 'css_default' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'css_default' ) ); ?>" type="checkbox" value="1" <?php checked( '1', $css_default ); ?> />&nbsp;
207
+ </p>
208
+ <p>
209
+ <label for="<?php echo $this->get_field_id( 'css' ); ?>"><?php _e( 'Custom CSS:', 'arpw' ); ?></label>
210
+ <textarea class="widefat" id="<?php echo $this->get_field_id( 'css' ); ?>" name="<?php echo $this->get_field_name( 'css' ); ?>" style="height:100px;"><?php echo $css; ?></textarea>
211
+ <small><?php _e( 'If you turn off the default styles, please create your own style.', 'arpw' ); ?></small>
212
+ </p>
213
+
214
+ </div><!-- .arpw-columns-3 -->
215
+
216
+ <div class="arpw-columns-3">
217
+
218
  <p>
219
  <label for="<?php echo esc_attr( $this->get_field_id( 'limit' ) ); ?>"><?php _e( 'Limit:', 'arpw' ); ?></label>
220
+ <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'limit' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'limit' ) ); ?>" type="text" value="<?php echo $limit; ?>"/>
 
 
 
 
221
  </p>
222
  <p>
223
+ <label for="<?php echo esc_attr( $this->get_field_id( 'cat' ) ); ?>"><?php _e( 'Limit to specific or multiple Category: ', 'arpw' ); ?></label>
224
+ <select class="widefat" multiple="multiple" id="<?php echo esc_attr( $this->get_field_id( 'cat' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'cat' ) ); ?>[]" style="width:100%;">
225
+ <optgroup label="<?php echo esc_attr_e( 'Categories', 'arpw' ); ?>">
226
+ <?php $categories = get_terms( 'category' ); ?>
227
+ <?php foreach( $categories as $category ) { ?>
228
+ <option value="<?php echo $category->term_id; ?>" <?php if ( is_array( $cat ) && in_array( $category->term_id, $cat ) ) echo ' selected="selected"'; ?>><?php echo $category->name; ?></option>
229
+ <?php } ?>
230
+ </optgroup>
231
+ </select>
232
+ </p>
233
  <p>
234
+ <label for="<?php echo esc_attr( $this->get_field_id( 'tag' ) ); ?>"><?php _e( 'Limit to specific or multiple Tag: ', 'arpw' ); ?></label>
235
+ <select class="widefat" multiple="multiple" id="<?php echo esc_attr( $this->get_field_id( 'tag' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'tag' ) ); ?>[]" style="width:100%;">
236
+ <optgroup label="Tags">
237
+ <?php $tags = get_terms( 'post_tag' ); ?>
238
+ <?php foreach( $tags as $post_tag ) { ?>
239
+ <option value="<?php echo $post_tag->term_id; ?>" <?php if ( is_array( $tag ) && in_array( $post_tag->term_id, $tag ) ) echo ' selected="selected"'; ?>><?php echo $post_tag->name; ?></option>
240
+ <?php } ?>
241
+ </optgroup>
242
+ </select>
243
  </p>
244
 
245
+ </div><!-- .arpw-columns-3 -->
246
+
247
+ <div class="arpw-columns-3 arpw-column-last">
248
+
249
  <?php if( current_theme_supports( 'post-thumbnails' ) ) { ?>
250
 
251
  <p>
252
+ <label class="input-checkbox" for="<?php echo esc_attr( $this->get_field_id( 'thumb' ) ); ?>"><?php _e( 'Display thumbnail?', 'arpw' ); ?></label>
253
  <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 ); ?> />&nbsp;
254
  </p>
255
  <p>
256
+ <label class="rpwe-block" for="<?php echo esc_attr( $this->get_field_id( 'thumb_height' ) ); ?>"><?php _e( 'Thumbnail size (height x width):', 'arpw' ); ?></label>
257
+ <input class= "small-input" id="<?php echo esc_attr( $this->get_field_id( 'thumb_height' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'thumb_height' ) ); ?>" type="text" value="<?php echo $thumb_height; ?>" />
258
+ <input class= "small-input" id="<?php echo esc_attr( $this->get_field_id( 'thumb_width' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'thumb_width' ) ); ?>" type="text" value="<?php echo $thumb_width; ?>" />
259
  </p>
260
 
261
  <?php } ?>
262
 
263
  <p>
264
+ <label class="input-checkbox" for="<?php echo esc_attr( $this->get_field_id( 'excerpt' ) ); ?>"><?php _e( 'Display excerpt?', 'arpw' ); ?></label>
265
+ <input id="<?php echo $this->get_field_id( 'excerpt' ); ?>" name="<?php echo $this->get_field_name( 'excerpt' ); ?>" type="checkbox" value="1" <?php checked( '1', $excerpt ); ?> />&nbsp;
266
+ </p>
267
+ <p>
268
+ <label for="<?php echo esc_attr( $this->get_field_id( 'length' ) ); ?>"><?php _e( 'Excerpt length:', 'arpw' ); ?></label>
269
+ <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'length' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'length' ) ); ?>" type="text" value="<?php echo $length; ?>" />
270
  </p>
271
+
272
  <p>
273
+ <label class="input-checkbox" for="<?php echo esc_attr( $this->get_field_id( 'date' ) ); ?>"><?php _e( 'Display date?', 'arpw' ); ?></label>
274
+ <input id="<?php echo $this->get_field_id( 'date' ); ?>" name="<?php echo $this->get_field_name( 'date' ); ?>" type="checkbox" value="1" <?php checked( '1', $date ); ?> />&nbsp;
275
+ </p>
276
+
277
+ </div><!-- .arpw-columns-3 .arpw-column-last -->
278
+
279
+ <div class="clear"></div>
280
 
281
  <?php
282
  }
313
  return $excerpt;
314
 
315
  }
316
+
317
+ /**
318
+ * Custom Styles.
319
+ *
320
+ * @since 1.5
321
+ */
322
+ function arpw_custom_styles() {
323
+ ?>
324
+ <style>
325
+ .arpw-block ul{list-style:none!important;margin-left:0!important;padding-left:0!important;}.arpw-block li{border-bottom:1px solid #eee;margin-bottom:10px;padding-bottom:10px;}.arpw-block a{display:inline!important;text-decoration:none;}.arpw-block h3{background:none!important;clear:none;margin-bottom:0!important;font-weight:400;font-size:12px!important;line-height:1.5;}.arpw-alignleft{border:1px solid #eee!important;box-shadow:none!important;display:inline;float:left;margin:2px 10px 0 0;padding:3px!important;}.arpw-summary{font-size:12px;}.arpw-time{color:#bbb;font-size:11px;}.arpw-clearfix:before,.arpw-clearfix:after{content:"";display:table;}.arpw-clearfix:after{clear:both;}.arpw-clearfix{zoom:1;}
326
+ </style>
327
+ <?php
328
+ }
329
  ?>
languages/arpw.mo CHANGED
Binary file
languages/arpw.po CHANGED
@@ -1,15 +1,15 @@
1
  msgid ""
2
  msgstr ""
3
  "Project-Id-Version: Advanced Random Posts Widget\n"
4
- "POT-Creation-Date: 2013-02-10 01:48+0700\n"
5
- "PO-Revision-Date: 2013-02-10 01:48+0700\n"
6
  "Last-Translator: M.Satrya <satrya@tokokoo.com>\n"
7
  "Language-Team: Satrya <satrya@satrya.me>\n"
8
  "Language: English\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=UTF-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
- "X-Generator: Poedit 1.5.5\n"
13
  "X-Poedit-KeywordsList: __;_e;esc_attr__;esc_attr_e\n"
14
  "X-Poedit-Basepath: .\n"
15
  "Plural-Forms: nplurals=2; plural=n != 1;\n"
@@ -24,55 +24,72 @@ msgstr ""
24
  msgid "Advanced Random Posts"
25
  msgstr ""
26
 
27
- #: ../includes/widget-advanced-random-posts.php:70
28
- #: ../includes/widget-advanced-random-posts.php:86
29
  #, php-format
30
  msgid "Permalink to %s"
31
  msgstr ""
32
 
33
- #: ../includes/widget-advanced-random-posts.php:90
34
  msgid " ago"
35
  msgstr ""
36
 
37
- #: ../includes/widget-advanced-random-posts.php:163
38
  msgid "Title:"
39
  msgstr ""
40
 
41
- #: ../includes/widget-advanced-random-posts.php:167
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
42
  msgid "Limit:"
43
  msgstr ""
44
 
45
- #: ../includes/widget-advanced-random-posts.php:175
46
- msgid "Display date?"
47
  msgstr ""
48
 
49
- #: ../includes/widget-advanced-random-posts.php:179
50
- msgid "Display excerpt?"
51
  msgstr ""
52
 
53
- #: ../includes/widget-advanced-random-posts.php:183
54
- msgid "Excerpt length:"
55
  msgstr ""
56
 
57
- #: ../includes/widget-advanced-random-posts.php:190
58
  msgid "Display thumbnail?"
59
  msgstr ""
60
 
61
- #: ../includes/widget-advanced-random-posts.php:194
62
  msgid "Thumbnail size (height x width):"
63
  msgstr ""
64
 
65
- #: ../includes/widget-advanced-random-posts.php:202
66
- msgid "Limit to category: "
67
  msgstr ""
68
 
69
- #: ../includes/widget-advanced-random-posts.php:203
70
- msgid "All categories"
71
  msgstr ""
72
 
73
- #: ../includes/widget-advanced-random-posts.php:206
74
- #, php-format
75
- msgid ""
76
- "Advanced Random Posts Widget is a project by <a href=\"%s\" target=\"_blank"
77
- "\">Satrya</a>"
78
  msgstr ""
1
  msgid ""
2
  msgstr ""
3
  "Project-Id-Version: Advanced Random Posts Widget\n"
4
+ "POT-Creation-Date: 2013-09-07 23:11+0700\n"
5
+ "PO-Revision-Date: 2013-09-07 23:11+0700\n"
6
  "Last-Translator: M.Satrya <satrya@tokokoo.com>\n"
7
  "Language-Team: Satrya <satrya@satrya.me>\n"
8
  "Language: English\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=UTF-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
+ "X-Generator: Poedit 1.5.7\n"
13
  "X-Poedit-KeywordsList: __;_e;esc_attr__;esc_attr_e\n"
14
  "X-Poedit-Basepath: .\n"
15
  "Plural-Forms: nplurals=2; plural=n != 1;\n"
24
  msgid "Advanced Random Posts"
25
  msgstr ""
26
 
27
+ #: ../includes/widget-advanced-random-posts.php:87
28
+ #: ../includes/widget-advanced-random-posts.php:99
29
  #, php-format
30
  msgid "Permalink to %s"
31
  msgstr ""
32
 
33
+ #: ../includes/widget-advanced-random-posts.php:103
34
  msgid " ago"
35
  msgstr ""
36
 
37
+ #: ../includes/widget-advanced-random-posts.php:193
38
  msgid "Title:"
39
  msgstr ""
40
 
41
+ #: ../includes/widget-advanced-random-posts.php:197
42
+ msgid "Title URL:"
43
+ msgstr ""
44
+
45
+ #: ../includes/widget-advanced-random-posts.php:201
46
+ msgid "CSS ID:"
47
+ msgstr ""
48
+
49
+ #: ../includes/widget-advanced-random-posts.php:205
50
+ msgid "Use Default Styles"
51
+ msgstr ""
52
+
53
+ #: ../includes/widget-advanced-random-posts.php:209
54
+ msgid "Custom CSS:"
55
+ msgstr ""
56
+
57
+ #: ../includes/widget-advanced-random-posts.php:211
58
+ msgid "If you turn off the default styles, please create your own style."
59
+ msgstr ""
60
+
61
+ #: ../includes/widget-advanced-random-posts.php:219
62
  msgid "Limit:"
63
  msgstr ""
64
 
65
+ #: ../includes/widget-advanced-random-posts.php:223
66
+ msgid "Limit to specific or multiple Category: "
67
  msgstr ""
68
 
69
+ #: ../includes/widget-advanced-random-posts.php:225
70
+ msgid "Categories"
71
  msgstr ""
72
 
73
+ #: ../includes/widget-advanced-random-posts.php:234
74
+ msgid "Limit to specific or multiple Tag: "
75
  msgstr ""
76
 
77
+ #: ../includes/widget-advanced-random-posts.php:252
78
  msgid "Display thumbnail?"
79
  msgstr ""
80
 
81
+ #: ../includes/widget-advanced-random-posts.php:256
82
  msgid "Thumbnail size (height x width):"
83
  msgstr ""
84
 
85
+ #: ../includes/widget-advanced-random-posts.php:264
86
+ msgid "Display excerpt?"
87
  msgstr ""
88
 
89
+ #: ../includes/widget-advanced-random-posts.php:268
90
+ msgid "Excerpt length:"
91
  msgstr ""
92
 
93
+ #: ../includes/widget-advanced-random-posts.php:273
94
+ msgid "Display date?"
 
 
 
95
  msgstr ""
readme.txt CHANGED
@@ -1,17 +1,19 @@
1
  === Plugin Name ===
2
  Contributors: satrya
3
  Tags: random posts, random, thumbnails, widget, widgets, sidebar, excerpt, multiple widgets
4
- Requires at least: 3.4
5
- Tested up to: 3.5.1
6
- Stable tag: 1.4
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
10
- Easily display random posts in a widget. Allows you to display them with thumbnails, post excerpt, specific category and more.
11
 
12
  == Description ==
13
 
14
- This plugin will enable a custom, flexible and advanced random posts widget. Allows you to display a list of random posts with thumbnail and excerpt also you can display it from all or a specific category.
 
 
15
 
16
  = Features Include: =
17
 
@@ -22,6 +24,14 @@ This plugin will enable a custom, flexible and advanced random posts widget. All
22
  * Support `get_the_image` function.
23
  * Multiple widgets.
24
 
 
 
 
 
 
 
 
 
25
  = Ugly Image Sizes =
26
  This plugin creates custom image sizes. If you use images that were uploaded to the media library before you installed this plugin, please install [Regenerate Thumbnails](http://wordpress.org/extend/plugins/regenerate-thumbnails/) plugin to corrected the sizes.
27
 
@@ -30,11 +40,10 @@ This plugin creates custom image sizes. If you use images that were uploaded to
30
  * [Open issue on github](https://github.com/satrya/advanced-random-posts-widget/issues).
31
  * [Rate/Review the plugin](http://wordpress.org/support/view/plugin-reviews/advanced-random-posts-widget).
32
 
33
- = Project Info: =
34
- * Developed by [Satrya](http://satrya.me/)
35
 
36
- = Demo =
37
- [Live demo](http://demo.themephe.com/tiga/blog/).
38
 
39
  == Installation ==
40
 
@@ -47,6 +56,17 @@ This plugin creates custom image sizes. If you use images that were uploaded to
47
 
48
  == Changelog ==
49
 
 
 
 
 
 
 
 
 
 
 
 
50
  = 1.4 - 04/19/2013 =
51
  * Change support uri
52
 
1
  === Plugin Name ===
2
  Contributors: satrya
3
  Tags: random posts, random, thumbnails, widget, widgets, sidebar, excerpt, multiple widgets
4
+ Requires at least: 3.5
5
+ Tested up to: 3.6
6
+ Stable tag: 1.5
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
10
+ Provides flexible and advanced random posts widget. Allows you to display them with thumbnails, post excerpt, multiple category and more.
11
 
12
  == Description ==
13
 
14
+ **After updating, please re-save the widget**
15
+
16
+ This plugin will enable a custom, flexible and super advanced random posts widget. Allows you to display a list of the most random posts with thumbnail, excerpt and post date, also you can display it from all or specific or multiple category or tag.
17
 
18
  = Features Include: =
19
 
24
  * Support `get_the_image` function.
25
  * Multiple widgets.
26
 
27
+ **New Features**
28
+
29
+ * CSS ID option
30
+ * Widget title url
31
+ * Turn on/off default style
32
+ * Limit to spesfic or multiple category
33
+ * Limit to spesfic or multiple tag
34
+
35
  = Ugly Image Sizes =
36
  This plugin creates custom image sizes. If you use images that were uploaded to the media library before you installed this plugin, please install [Regenerate Thumbnails](http://wordpress.org/extend/plugins/regenerate-thumbnails/) plugin to corrected the sizes.
37
 
40
  * [Open issue on github](https://github.com/satrya/advanced-random-posts-widget/issues).
41
  * [Rate/Review the plugin](http://wordpress.org/support/view/plugin-reviews/advanced-random-posts-widget).
42
 
43
+ = Developed by: =
44
+ * [Satrya](http://satrya.me/) - [Twitter](https://twitter.com/msattt)
45
 
46
+ **If you enjoy using this plugin, don't forget to rate it at [http://wordpress.org/support/view/plugin-reviews/advanced-random-posts-widget](http://wordpress.org/support/view/plugin-reviews/advanced-random-posts-widget)**
 
47
 
48
  == Installation ==
49
 
56
 
57
  == Changelog ==
58
 
59
+ 1.5 - 09/07/2013
60
+ * PLEASE RE-SAVE THE WIDGET
61
+ * Fix title widget filter bug
62
+ * Change Limit option to input text rather than selectbox
63
+ * Add CSS ID option
64
+ * Add widget title url
65
+ * Add turn on off default styles
66
+ * Add multiple category option
67
+ * Add multiple tag option
68
+ * Update language
69
+
70
  = 1.4 - 04/19/2013 =
71
  * Change support uri
72
 
screenshot-1.png CHANGED
Binary file