Flexible Posts Widget - Version 3.4

Version Description

  • Added Finnish language support. (Props: @eccola)
  • Made the Template Filename field a select box based on the templates available in the current theme, the parent theme (if the current theme is a child theme) and the plugin's views folder. (Props @w3b-beweb)
  • Added a new default template (Default.php) that works better in most sidebar situations. The current default template (Widget.php) will be used by any existing widgets unless manually changed.
  • Added support to order posts by Modified Date.
  • Migrated admin CSS to SASS.
  • Much code clean up and refactoring.
  • Fixed an issue with language files not loading properly (Props @sajtdavid).
Download this release

Release Info

Developer dpe415
Plugin Icon wp plugin Flexible Posts Widget
Version 3.4
Comparing to
See all releases

Code changes from version 3.3.1 to 3.4

css/admin.css CHANGED
@@ -1,38 +1 @@
1
- /*
2
- * Flexible Posts Widget
3
- * Admin Styles
4
- * Author: dpe415
5
- * URI: http://wordpress.org/extend/plugins/flexible-posts-widget/
6
- */
7
-
8
- .cf:before,
9
- .cf:after {content:" "; display:table;}
10
- .cf:after {clear:both;}
11
- .cf {*zoom:1;}
12
-
13
- .dpe-fp-widget h4 {margin-bottom:0.5em;}
14
- .dpe-fp-widget select {background-color:#fff;}
15
-
16
- .dpe-fp-widget .ui-tabs-active {background:#fff; border-color: #DFDFDF #DFDFDF #FFFFFF;}
17
- .dpe-fp-widget .ui-tabs-active a {color:#333333;}
18
-
19
- .dpe-fp-widget .warning {color:#d21703;}
20
- .dpe-fp-widget .section {margin-bottom:1.33em; border-bottom:1px solid #dfdfdf;}
21
- .dpe-fp-widget .section.getemby {padding-bottom:1.333em;}
22
-
23
- .dpe-fp-widget .tabs-panel.tt {padding:1.333em 1em;}
24
- .dpe-fp-widget .tabs-panel.id {padding:1.333em 1em 0;}
25
- .dpe-fp-widget .tabs-panel .terms {max-height:110px; overflow:auto; border:1px solid #DFDFDF;}
26
- .dpe-fp-widget .tabs-panel .terms ul {margin-left:1em;}
27
- .dpe-fp-widget .tabs-panel .terms p {margin:1em;}
28
-
29
- .dpe-fp-widget .display p {margin-bottom:0.5em;}
30
- .dpe-fp-widget .display p:last-child {margin-bottom:1em;}
31
- .dpe-fp-widget .display label {float:left; padding-top:0.4em;}
32
- .dpe-fp-widget .display input {float:right; width:60px; text-align:right;}
33
- .dpe-fp-widget .display select {float:right; width:120px;}
34
-
35
- .dpe-fp-widget .check input {float:none; width:auto;}
36
- .dpe-fp-widget .check label {float:none; padding-top:0.2em;}
37
-
38
- .dpe-fp-widget .description {display:inline-block; padding-top:5px; font-size:80%;}
1
+ .dpe-fp-widget .cf{*zoom:1;}.dpe-fp-widget .cf:after{clear:both;}.dpe-fp-widget .cf:before,.dpe-fp-widget .cf:after{content:" ";display:table;}.dpe-fp-widget h4{margin-bottom:0.5em;}.dpe-fp-widget select{background-color:#fff;}.dpe-fp-widget .ui-tabs-active{background:#fff;border-color:#DFDFDF #DFDFDF #FFFFFF;}.dpe-fp-widget .ui-tabs-active a{color:#333333;}.dpe-fp-widget .warning{color:#d21703;}.dpe-fp-widget .section{margin-bottom:1.33em;border-bottom:1px solid #dfdfdf;}.dpe-fp-widget .section .getemby{padding-bottom:1.333em;}.dpe-fp-widget .tabs-panel.tt{padding:1.333em 1em;}.dpe-fp-widget .tabs-panel.id{padding:1.333em 1em 0;}.dpe-fp-widget .tabs-panel .terms{max-height:110px;overflow:auto;border:1px solid #DFDFDF;}.dpe-fp-widget .tabs-panel .terms ul{margin-left:1em;}.dpe-fp-widget .tabs-panel .terms p{margin:1em;}.dpe-fp-widget .display p{margin-bottom:0.5em;}.dpe-fp-widget .display p:last-child{margin-bottom:1em;}.dpe-fp-widget .display label{float:left;padding-top:0.4em;}.dpe-fp-widget .display input{float:right;width:60px;text-align:right;}.dpe-fp-widget .display select{float:right;width:120px;}.dpe-fp-widget .check input{float:none;width:auto;}.dpe-fp-widget .check label{float:none;padding-top:0.2em;}.dpe-fp-widget .description{display:inline-block;padding-top:5px;font-size:80%;}.dpe-fp-widget .templates p{margin:1.33em 0;}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
css/admin.scss ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Flexible Posts Widget
3
+ * Admin Styles
4
+ * Author: dpe415
5
+ * URI: http://wordpress.org/extend/plugins/flexible-posts-widget/
6
+ */
7
+
8
+
9
+ .dpe-fp-widget {
10
+
11
+ .cf {
12
+ *zoom:1;
13
+ &:after {clear:both;}
14
+ &:before, &:after {content:" "; display:table;}
15
+ }
16
+
17
+ h4 {margin-bottom:0.5em;}
18
+ select {background-color:#fff;}
19
+
20
+ .ui-tabs-active {
21
+ background:#fff; border-color: #DFDFDF #DFDFDF #FFFFFF;
22
+ a {color:#333333;}
23
+ }
24
+
25
+ .warning {color:#d21703;}
26
+
27
+ .section {
28
+ margin-bottom:1.33em; border-bottom:1px solid #dfdfdf;
29
+ .getemby {padding-bottom:1.333em;}
30
+ }
31
+
32
+ .tabs-panel {
33
+ &.tt {padding:1.333em 1em;}
34
+ &.id {padding:1.333em 1em 0;}
35
+ .terms {
36
+ max-height:110px; overflow:auto; border:1px solid #DFDFDF;
37
+ ul {margin-left:1em;}
38
+ p {margin:1em;}
39
+ }
40
+ }
41
+
42
+ .display {
43
+ p {
44
+ margin-bottom:0.5em;
45
+ &:last-child {margin-bottom:1em;}
46
+ }
47
+ label {float:left; padding-top:0.4em;}
48
+ input {float:right; width:60px; text-align:right;}
49
+ select {float:right; width:120px;}
50
+ }
51
+
52
+ .check {
53
+ input {float:none; width:auto;}
54
+ label {float:none; padding-top:0.2em;}
55
+ }
56
+
57
+ .description {display:inline-block; padding-top:5px; font-size:80%;}
58
+
59
+ .templates {
60
+ p {margin:1.33em 0;}
61
+ }
62
+
63
+ }
flexible-posts-widget.php CHANGED
@@ -14,7 +14,7 @@
14
  * Plugin Name: Flexible Posts Widget
15
  * Plugin URI: http://wordpress.org/extend/plugins/flexible-posts-widget
16
  * Description: An advanced posts display widget with many options: get posts by post type and taxonomy & term or by post ID; sorting & ordering; feature images; custom templates and more.
17
- * Version: 3.3.1
18
  * Author: dpe415
19
  * Author URI: http://dpedesign.com
20
  * Text Domain: flexible-posts-widget
@@ -54,8 +54,18 @@ if ( ! defined( 'WPINC' ) ) {
54
  class DPE_Flexible_Posts_Widget extends WP_Widget {
55
 
56
  /**
57
- * Unique identifier for your widget.
 
 
58
  *
 
 
 
 
 
 
 
 
59
  *
60
  * The variable name is used as a unique identifier for the widget
61
  *
@@ -68,7 +78,6 @@ class DPE_Flexible_Posts_Widget extends WP_Widget {
68
  /**
69
  * Unique identifier for your widget.
70
  *
71
- *
72
  * The variable name is used as the text domain when internationalizing strings
73
  * of text. Its value should match the Text Domain file header in the main
74
  * widget file.
@@ -78,6 +87,20 @@ class DPE_Flexible_Posts_Widget extends WP_Widget {
78
  * @var string
79
  */
80
  protected $widget_text_domain = 'flexible-posts-widget';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
81
 
82
 
83
  /*--------------------------------------------------*/
@@ -89,10 +112,6 @@ class DPE_Flexible_Posts_Widget extends WP_Widget {
89
  * loads localization files, and includes necessary stylesheets and JavaScript.
90
  */
91
  public function __construct() {
92
-
93
- // Define our version number
94
- if( ! defined( 'DPE_FP_Version' ) )
95
- define( 'DPE_FP_Version', '3.3' );
96
 
97
  // load plugin text domain
98
  add_action( 'init', array( $this, 'widget_textdomain' ) );
@@ -106,6 +125,9 @@ class DPE_Flexible_Posts_Widget extends WP_Widget {
106
  'description' => __( 'Display posts as widget items.', $this->get_widget_text_domain() ),
107
  )
108
  );
 
 
 
109
 
110
  // Register admin styles and scripts
111
  add_action( 'admin_enqueue_scripts', array( $this, 'register_admin_styles' ) );
@@ -137,6 +159,17 @@ class DPE_Flexible_Posts_Widget extends WP_Widget {
137
  public function get_widget_text_domain() {
138
  return $this->widget_text_domain;
139
  }
 
 
 
 
 
 
 
 
 
 
 
140
 
141
 
142
  /*--------------------------------------------------*/
@@ -159,18 +192,17 @@ class DPE_Flexible_Posts_Widget extends WP_Widget {
159
  $title = apply_filters( 'widget_title', empty( $title ) ? '' : $title );
160
 
161
  if ( empty( $template ) )
162
- $template = 'widget.php';
163
 
164
  // Setup the query arguments array
165
  $args = array();
166
 
167
  // Get posts by post_ids specifically (ignore post type & tax/term values).
168
  if ( !empty( $pids ) ) {
169
-
170
  // Setup the query
171
  $args['post__in'] = $pids;
172
- $args['post_type'] = get_post_types( array( 'public' => true ) );
173
-
174
 
175
  // Else get posts by post type and tax/term
176
  } else {
@@ -207,7 +239,7 @@ class DPE_Flexible_Posts_Widget extends WP_Widget {
207
  $flexible_posts = new WP_Query( $args );
208
 
209
  // Get and include the template we're going to use
210
- include( $this->getTemplateHierarchy( $template ) );
211
 
212
  // Be sure to reset any post_data before proceeding
213
  wp_reset_postdata();
@@ -226,41 +258,17 @@ class DPE_Flexible_Posts_Widget extends WP_Widget {
226
  */
227
  public function update( $new_instance, $old_instance ) {
228
 
229
- // Get our defaults to test against
230
- $this->posttypes = get_post_types( array( 'public' => true ), 'objects' );
231
- $this->taxonomies = get_taxonomies( array( 'public' => true ), 'objects' );
232
- $this->thumbsizes = get_intermediate_image_sizes();
233
- $this->orderbys = array(
234
- 'date' => __( 'Publish Date', 'flexible-posts-widget' ),
235
- 'title' => __( 'Title', 'flexible-posts-widget' ),
236
- 'menu_order' => __( 'Menu Order', 'flexible-posts-widget' ),
237
- 'ID' => __( 'Post ID', 'flexible-posts-widget' ),
238
- 'author' => __( 'Author', 'flexible-posts-widget' ),
239
- 'name' => __( 'Post Slug', 'flexible-posts-widget' ),
240
- 'comment_count' => __( 'Comment Count', 'flexible-posts-widget' ),
241
- 'rand' => __( 'Random', 'flexible-posts-widget' ),
242
- 'post__in' => __( 'Post ID Order', 'flexible-posts-widget' ),
243
- );
244
- $this->orders = array(
245
- 'ASC' => __( 'Ascending', 'flexible-posts-widget' ),
246
- 'DESC' => __( 'Descending', 'flexible-posts-widget' ),
247
- );
248
-
249
- $pt_names = get_post_types( array( 'public' => true ), 'names' );
250
- $tax_names = get_taxonomies( array( 'public' => true ), 'names' );
251
- $tax_names[] = 'none';
252
-
253
  // Validate posttype submissions
254
  $posttypes = array();
255
  foreach( $new_instance['posttype'] as $pt ) {
256
- if( in_array( $pt, $pt_names ) )
257
  $posttypes[] = $pt;
258
  }
259
  if( empty( $posttypes ) )
260
  $posttypes[] = 'post';
261
 
262
  // Validate taxonomy & term submissions
263
- if( in_array( $new_instance['taxonomy'], $tax_names ) ) {
264
  $taxonomy = $new_instance['taxonomy'];
265
  $terms = array();
266
  if( 'none' != $taxonomy ) {
@@ -286,7 +294,7 @@ class DPE_Flexible_Posts_Widget extends WP_Widget {
286
  foreach ( $pids_array as $id ) {
287
  $pids[] = absint( $id );
288
  }
289
- }
290
 
291
  $instance = $old_instance;
292
  $instance['title'] = strip_tags( $new_instance['title'] );
@@ -301,7 +309,7 @@ class DPE_Flexible_Posts_Widget extends WP_Widget {
301
  $instance['sticky'] = ( isset( $new_instance['sticky'] ) ? (int) $new_instance['sticky'] : '0' );
302
  $instance['thumbnail'] = ( isset( $new_instance['thumbnail'] ) ? (int) $new_instance['thumbnail'] : '0' );
303
  $instance['thumbsize'] = ( in_array ( $new_instance['thumbsize'], $this->thumbsizes ) ? $new_instance['thumbsize'] : '' );
304
- $instance['template'] = strip_tags( $new_instance['template'] );
305
  $instance['cur_tab'] = (int) $new_instance['cur_tab'];
306
 
307
  return $instance;
@@ -317,25 +325,6 @@ class DPE_Flexible_Posts_Widget extends WP_Widget {
317
  */
318
  public function form( $instance ) {
319
 
320
- $this->posttypes = get_post_types( array( 'public' => true ), 'objects' );
321
- $this->taxonomies = get_taxonomies( array( 'public' => true ), 'objects' );
322
- $this->thumbsizes = get_intermediate_image_sizes();
323
- $this->orderbys = array(
324
- 'date' => __( 'Publish Date', 'flexible-posts-widget' ),
325
- 'title' => __( 'Title', 'flexible-posts-widget' ),
326
- 'menu_order' => __( 'Menu Order', 'flexible-posts-widget' ),
327
- 'ID' => __( 'Post ID', 'flexible-posts-widget' ),
328
- 'author' => __( 'Author', 'flexible-posts-widget' ),
329
- 'name' => __( 'Post Slug', 'flexible-posts-widget' ),
330
- 'comment_count' => __( 'Comment Count', 'flexible-posts-widget' ),
331
- 'rand' => __( 'Random', 'flexible-posts-widget' ),
332
- 'post__in' => __( 'Post ID Order', 'flexible-posts-widget' ),
333
- );
334
- $this->orders = array(
335
- 'ASC' => __( 'Ascending', 'flexible-posts-widget' ),
336
- 'DESC' => __( 'Descending', 'flexible-posts-widget' ),
337
- );
338
-
339
  $instance = wp_parse_args( (array) $instance, array(
340
  'title' => '',
341
  'posttype' => array( 'post' ),
@@ -349,20 +338,21 @@ class DPE_Flexible_Posts_Widget extends WP_Widget {
349
  'sticky' => '0',
350
  'thumbnail' => '0',
351
  'thumbsize' => '',
352
- 'template' => 'widget.php',
353
  'cur_tab' => '0',
354
  ) );
355
 
356
  extract( $instance );
357
 
358
- include( $this->getTemplateHierarchy( 'admin' ) );
359
 
360
  }
361
 
362
  /**
363
- * Loads theme files in appropriate hierarchy: 1) child theme,
364
- * 2) parent template, 3) plugin resources. will look in the flexible-posts-widget/
365
- * directory in a theme and the views/ directory in the plugin
 
366
  *
367
  * Based on a function in the amazing image-widget
368
  * by Matt Wiebe at Modern Tribe, Inc.
@@ -371,17 +361,19 @@ class DPE_Flexible_Posts_Widget extends WP_Widget {
371
  * @param string $template template file to search for
372
  * @return template path
373
  **/
374
- public function getTemplateHierarchy( $template ) {
375
 
376
  // whether or not .php was added
377
  $template_slug = preg_replace( '/.php$/', '', $template );
378
  $template = $template_slug . '.php';
 
 
 
379
 
380
- if ( $theme_file = locate_template( array( 'flexible-posts-widget/' . $template ) ) ) {
 
381
  $file = $theme_file;
382
- } else {
383
- $file = 'views/' . $template;
384
- }
385
 
386
  return apply_filters( 'dpe_fpw_template_' . $template, $file );
387
 
@@ -395,9 +387,9 @@ class DPE_Flexible_Posts_Widget extends WP_Widget {
395
  * Loads the Widget's text domain for localization and translation.
396
  */
397
  public function widget_textdomain() {
398
-
399
- load_plugin_textdomain( $this->get_widget_slug(), false, plugin_dir_path( __FILE__ ) . 'languages/' );
400
-
401
  } // end widget_textdomain
402
 
403
  /**
@@ -409,7 +401,7 @@ class DPE_Flexible_Posts_Widget extends WP_Widget {
409
  $this->get_widget_slug() . '-admin',
410
  plugins_url( 'css/admin.css', __FILE__ ),
411
  array(),
412
- DPE_FP_Version
413
  );
414
 
415
  } // end register_admin_styles
@@ -429,14 +421,14 @@ class DPE_Flexible_Posts_Widget extends WP_Widget {
429
  $this->get_widget_slug() . '-admin',
430
  plugins_url( $source, __FILE__ ),
431
  array( 'jquery', 'jquery-ui-tabs' ),
432
- DPE_FP_Version,
433
  true
434
  );
435
 
436
  wp_localize_script( $this->get_widget_slug() . '-admin', 'fpwL10n', array(
437
- 'gettingTerms' => __( 'Getting terms...', 'flexible-posts-widget' ),
438
- 'selectTerms' => __( 'Select terms:', 'flexible-posts-widget' ),
439
- 'noTermsFound' => __( 'No terms found.', 'flexible-posts-widget' ),
440
  ) );
441
 
442
  } // end register_admin_scripts
@@ -464,7 +456,7 @@ class DPE_Flexible_Posts_Widget extends WP_Widget {
464
  $terms = get_terms( $taxonomy, $args );
465
 
466
  if( empty($terms) ) {
467
- $output = '<p>' . __( 'No terms found.', 'flexible-posts-widget' ) . '</p>';
468
  } else {
469
  $output = '<ul class="categorychecklist termschecklist form-no-clear">';
470
  foreach ( $terms as $option ) {
@@ -483,12 +475,9 @@ class DPE_Flexible_Posts_Widget extends WP_Widget {
483
  * Return a list of post types via AJAX
484
  */
485
  public function posttype_checklist( $posttype ) {
486
-
487
- //Get pubic post type objects
488
- $posttypes = get_post_types( array( 'public' => true ), 'objects' );
489
 
490
  $output = '<ul class="categorychecklist posttypechecklist form-no-clear">';
491
- foreach ( $posttypes as $type ) {
492
  $output .= "\n<li>" . '<label class="selectit"><input value="' . esc_attr( $type->name ) . '" type="checkbox" name="' . $this->get_field_name( 'posttype' ) . '[]"' . checked( in_array( $type->name, (array)$posttype ), true, false ) . ' /> ' . esc_html( $type->labels->name ) . "</label></li>\n";
493
  }
494
  $output .= "</ul>\n";
@@ -497,6 +486,146 @@ class DPE_Flexible_Posts_Widget extends WP_Widget {
497
 
498
  }
499
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
500
 
501
  } // class DPE_Flexible_Posts_Widget
502
 
14
  * Plugin Name: Flexible Posts Widget
15
  * Plugin URI: http://wordpress.org/extend/plugins/flexible-posts-widget
16
  * Description: An advanced posts display widget with many options: get posts by post type and taxonomy & term or by post ID; sorting & ordering; feature images; custom templates and more.
17
+ * Version: 3.4
18
  * Author: dpe415
19
  * Author URI: http://dpedesign.com
20
  * Text Domain: flexible-posts-widget
54
  class DPE_Flexible_Posts_Widget extends WP_Widget {
55
 
56
  /**
57
+ * Plugin version number
58
+ *
59
+ * The variable name is used as a unique identifier for the widget
60
  *
61
+ * @since 3.3.1
62
+ *
63
+ * @var string
64
+ */
65
+ protected $plugin_version = '3.4';
66
+
67
+ /**
68
+ * Unique identifier for your widget.
69
  *
70
  * The variable name is used as a unique identifier for the widget
71
  *
78
  /**
79
  * Unique identifier for your widget.
80
  *
 
81
  * The variable name is used as the text domain when internationalizing strings
82
  * of text. Its value should match the Text Domain file header in the main
83
  * widget file.
87
  * @var string
88
  */
89
  protected $widget_text_domain = 'flexible-posts-widget';
90
+
91
+ /**
92
+ * Setup a number of variables to hold our default values
93
+ *
94
+ * @since 3.3.1
95
+ */
96
+ protected $posttypes = '';
97
+ protected $pt_names = '';
98
+ protected $taxonomies = '';
99
+ protected $tax_names = '';
100
+ protected $thumbsizes = '';
101
+ protected $orderbys = '';
102
+ protected $orders = '';
103
+ protected $templates = '';
104
 
105
 
106
  /*--------------------------------------------------*/
112
  * loads localization files, and includes necessary stylesheets and JavaScript.
113
  */
114
  public function __construct() {
 
 
 
 
115
 
116
  // load plugin text domain
117
  add_action( 'init', array( $this, 'widget_textdomain' ) );
125
  'description' => __( 'Display posts as widget items.', $this->get_widget_text_domain() ),
126
  )
127
  );
128
+
129
+ // Setup the default variables after wp is loaded
130
+ add_action( 'wp_loaded', array( $this, 'setup_defaults' ) );
131
 
132
  // Register admin styles and scripts
133
  add_action( 'admin_enqueue_scripts', array( $this, 'register_admin_styles' ) );
159
  public function get_widget_text_domain() {
160
  return $this->widget_text_domain;
161
  }
162
+
163
+ /**
164
+ * Return the plugin version.
165
+ *
166
+ * @since 3.3.1
167
+ *
168
+ * @return Plugin version variable.
169
+ */
170
+ public function get_plugin_version() {
171
+ return $this->plugin_version;
172
+ }
173
 
174
 
175
  /*--------------------------------------------------*/
192
  $title = apply_filters( 'widget_title', empty( $title ) ? '' : $title );
193
 
194
  if ( empty( $template ) )
195
+ $template = 'default.php';
196
 
197
  // Setup the query arguments array
198
  $args = array();
199
 
200
  // Get posts by post_ids specifically (ignore post type & tax/term values).
201
  if ( !empty( $pids ) ) {
202
+
203
  // Setup the query
204
  $args['post__in'] = $pids;
205
+ $args['post_type'] = 'any';
 
206
 
207
  // Else get posts by post type and tax/term
208
  } else {
239
  $flexible_posts = new WP_Query( $args );
240
 
241
  // Get and include the template we're going to use
242
+ include( $this->get_template( $template ) );
243
 
244
  // Be sure to reset any post_data before proceeding
245
  wp_reset_postdata();
258
  */
259
  public function update( $new_instance, $old_instance ) {
260
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
261
  // Validate posttype submissions
262
  $posttypes = array();
263
  foreach( $new_instance['posttype'] as $pt ) {
264
+ if( in_array( $pt, $this->pt_names ) )
265
  $posttypes[] = $pt;
266
  }
267
  if( empty( $posttypes ) )
268
  $posttypes[] = 'post';
269
 
270
  // Validate taxonomy & term submissions
271
+ if( in_array( $new_instance['taxonomy'], $this->tax_names ) ) {
272
  $taxonomy = $new_instance['taxonomy'];
273
  $terms = array();
274
  if( 'none' != $taxonomy ) {
294
  foreach ( $pids_array as $id ) {
295
  $pids[] = absint( $id );
296
  }
297
+ }
298
 
299
  $instance = $old_instance;
300
  $instance['title'] = strip_tags( $new_instance['title'] );
309
  $instance['sticky'] = ( isset( $new_instance['sticky'] ) ? (int) $new_instance['sticky'] : '0' );
310
  $instance['thumbnail'] = ( isset( $new_instance['thumbnail'] ) ? (int) $new_instance['thumbnail'] : '0' );
311
  $instance['thumbsize'] = ( in_array ( $new_instance['thumbsize'], $this->thumbsizes ) ? $new_instance['thumbsize'] : '' );
312
+ $instance['template'] = ( array_key_exists( $new_instance['template'], $this->templates ) ? $new_instance['template'] : 'default.php' );
313
  $instance['cur_tab'] = (int) $new_instance['cur_tab'];
314
 
315
  return $instance;
325
  */
326
  public function form( $instance ) {
327
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
328
  $instance = wp_parse_args( (array) $instance, array(
329
  'title' => '',
330
  'posttype' => array( 'post' ),
338
  'sticky' => '0',
339
  'thumbnail' => '0',
340
  'thumbsize' => '',
341
+ 'template' => 'default.php',
342
  'cur_tab' => '0',
343
  ) );
344
 
345
  extract( $instance );
346
 
347
+ include( $this->get_template( 'admin' ) );
348
 
349
  }
350
 
351
  /**
352
+ * Loads theme files in appropriate hierarchy:
353
+ * 1. child theme 2. parent theme 3. plugin resources.
354
+ * Will look in the flexible-posts-widget/ directory in a theme
355
+ * and the views/ directory in the plugin
356
  *
357
  * Based on a function in the amazing image-widget
358
  * by Matt Wiebe at Modern Tribe, Inc.
361
  * @param string $template template file to search for
362
  * @return template path
363
  **/
364
+ public function get_template( $template ) {
365
 
366
  // whether or not .php was added
367
  $template_slug = preg_replace( '/.php$/', '', $template );
368
  $template = $template_slug . '.php';
369
+
370
+ // Set to the default
371
+ $file = 'views/' . $template;
372
 
373
+ // Look for a custom version
374
+ if ( $theme_file = locate_template( array( $this->get_widget_text_domain() . '/' . $template ) ) ) {
375
  $file = $theme_file;
376
+ }
 
 
377
 
378
  return apply_filters( 'dpe_fpw_template_' . $template, $file );
379
 
387
  * Loads the Widget's text domain for localization and translation.
388
  */
389
  public function widget_textdomain() {
390
+
391
+ load_plugin_textdomain( $this->get_widget_text_domain(), false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
392
+
393
  } // end widget_textdomain
394
 
395
  /**
401
  $this->get_widget_slug() . '-admin',
402
  plugins_url( 'css/admin.css', __FILE__ ),
403
  array(),
404
+ $this->get_plugin_version()
405
  );
406
 
407
  } // end register_admin_styles
421
  $this->get_widget_slug() . '-admin',
422
  plugins_url( $source, __FILE__ ),
423
  array( 'jquery', 'jquery-ui-tabs' ),
424
+ $this->get_plugin_version(),
425
  true
426
  );
427
 
428
  wp_localize_script( $this->get_widget_slug() . '-admin', 'fpwL10n', array(
429
+ 'gettingTerms' => __( 'Getting terms...', $this->get_widget_text_domain() ),
430
+ 'selectTerms' => __( 'Select terms:', $this->get_widget_text_domain() ),
431
+ 'noTermsFound' => __( 'No terms found.', $this->get_widget_text_domain() ),
432
  ) );
433
 
434
  } // end register_admin_scripts
456
  $terms = get_terms( $taxonomy, $args );
457
 
458
  if( empty($terms) ) {
459
+ $output = '<p>' . __( 'No terms found.', $this->get_widget_text_domain() ) . '</p>';
460
  } else {
461
  $output = '<ul class="categorychecklist termschecklist form-no-clear">';
462
  foreach ( $terms as $option ) {
475
  * Return a list of post types via AJAX
476
  */
477
  public function posttype_checklist( $posttype ) {
 
 
 
478
 
479
  $output = '<ul class="categorychecklist posttypechecklist form-no-clear">';
480
+ foreach ( $this->posttypes as $type ) {
481
  $output .= "\n<li>" . '<label class="selectit"><input value="' . esc_attr( $type->name ) . '" type="checkbox" name="' . $this->get_field_name( 'posttype' ) . '[]"' . checked( in_array( $type->name, (array)$posttype ), true, false ) . ' /> ' . esc_html( $type->labels->name ) . "</label></li>\n";
482
  }
483
  $output .= "</ul>\n";
486
 
487
  }
488
 
489
+ /**
490
+ * Setup a number of default variables used throughout the plugin
491
+ *
492
+ * Since 3.3.1
493
+ *
494
+ */
495
+ public function setup_defaults() {
496
+
497
+ // Get the registered post types
498
+ $this->posttypes = get_post_types( array( 'public' => true ), 'objects' );
499
+ $this->pt_names = get_post_types( array( 'public' => true ), 'names' );
500
+
501
+ // Get the registered taxonomies
502
+ $this->taxonomies = get_taxonomies( array( 'public' => true ), 'objects' );
503
+ $this->tax_names = get_taxonomies( array( 'public' => true ), 'names' );
504
+ $this->tax_names[] = 'none';
505
+
506
+ // Get the registered image sizes
507
+ $this->thumbsizes = get_intermediate_image_sizes();
508
+
509
+ // Set the options for orderby
510
+ $this->orderbys = array(
511
+ 'date' => __( 'Publish Date', $this->get_widget_text_domain() ),
512
+ 'modified' => __( 'Modified Date', $this->get_widget_text_domain() ),
513
+ 'title' => __( 'Title', $this->get_widget_text_domain() ),
514
+ 'menu_order' => __( 'Menu Order', $this->get_widget_text_domain() ),
515
+ 'ID' => __( 'Post ID', $this->get_widget_text_domain() ),
516
+ 'author' => __( 'Author', $this->get_widget_text_domain() ),
517
+ 'name' => __( 'Post Slug', $this->get_widget_text_domain() ),
518
+ 'comment_count' => __( 'Comment Count', $this->get_widget_text_domain() ),
519
+ 'rand' => __( 'Random', $this->get_widget_text_domain() ),
520
+ 'post__in' => __( 'Post ID Order', $this->get_widget_text_domain() ),
521
+ );
522
+
523
+ // Set the options for order
524
+ $this->orders = array(
525
+ 'ASC' => __( 'Ascending', $this->get_widget_text_domain() ),
526
+ 'DESC' => __( 'Descending', $this->get_widget_text_domain() ),
527
+ );
528
+
529
+ // Set the available templates
530
+ $this->templates = wp_cache_get( 'templates', $this->widget_slug );
531
+
532
+ if( false === $this->templates ) {
533
+ $this->templates = (array) $this->get_files( 'php', 0, true );
534
+ wp_cache_set( 'templates', $this->templates, $this->widget_slug );
535
+ }
536
+
537
+
538
+ }
539
+
540
+ /**
541
+ * Return template files from the current theme, parent theme and the plugin views directory.
542
+ *
543
+ * @since 3.3.1
544
+ * @access public
545
+ *
546
+ * Based on the function of the same name in wp-includes/class-wp-theme.php
547
+ *
548
+ * @param mixed $type Optional. Array of extensions to return. Defaults to all files (null).
549
+ * @param int $depth Optional. How deep to search for files. Defaults to a flat scan (0 depth). -1 depth is infinite.
550
+ * @param bool $search_parent Optional. Whether to return parent files. Defaults to false.
551
+ * @return array Array of files, keyed by the path to the file relative to the theme's directory, with the values
552
+ * being absolute paths.
553
+ */
554
+ public function get_files( $type = null, $depth = 0, $search_parent = false ) {
555
+
556
+ $files = array();
557
+ $theme_dir = get_stylesheet_directory() . '/' . $this->get_widget_text_domain();
558
+ $plugin_dir = dirname(__FILE__) . '/views';
559
+
560
+ // Check the current theme
561
+ if( is_dir( $theme_dir ) ) {
562
+ $files += (array) self::scandir( $theme_dir, $type, $depth );
563
+ }
564
+
565
+ // Check the parent theme
566
+ if ( $search_parent && is_child_theme() ) {
567
+ $parent_theme_dir = get_template_directory() . '/' . $this->get_widget_text_domain();
568
+ if( is_dir( $parent_theme_dir ) ) {
569
+ $files += (array) self::scandir( $parent_theme_dir, $type, $depth );
570
+ }
571
+ }
572
+
573
+ // Check the plugin views folder
574
+ if( is_dir( $plugin_dir ) ) {
575
+ $files += (array) self::scandir( $plugin_dir, $type, $depth );
576
+ // Remove the admin view
577
+ unset( $files['admin.php'] );
578
+ }
579
+
580
+ return $files;
581
+ }
582
+
583
+ /**
584
+ * Scans a directory for files of a certain extension.
585
+ *
586
+ * @since 3.3.1
587
+ * @access private
588
+ *
589
+ * Based on the function of the same name in wp-includes/class-wp-theme.php
590
+ *
591
+ * @param string $path Absolute path to search.
592
+ * @param mixed Array of extensions to find, string of a single extension, or null for all extensions.
593
+ * @param int $depth How deep to search for files. Optional, defaults to a flat scan (0 depth). -1 depth is infinite.
594
+ * @param string $relative_path The basename of the absolute path. Used to control the returned path
595
+ * for the found files, particularly when this function recurses to lower depths.
596
+ */
597
+ private static function scandir( $path, $extensions = null, $depth = 0, $relative_path = '' ) {
598
+ if ( ! is_dir( $path ) )
599
+ return false;
600
+
601
+ if ( $extensions ) {
602
+ $extensions = (array) $extensions;
603
+ $_extensions = implode( '|', $extensions );
604
+ }
605
+
606
+ $relative_path = trailingslashit( $relative_path );
607
+ if ( '/' == $relative_path )
608
+ $relative_path = '';
609
+
610
+ $results = scandir( $path );
611
+ $files = array();
612
+
613
+ foreach ( $results as $result ) {
614
+ if ( '.' == $result[0] )
615
+ continue;
616
+ if ( is_dir( $path . '/' . $result ) ) {
617
+ if ( ! $depth || 'CVS' == $result )
618
+ continue;
619
+ $found = self::scandir( $path . '/' . $result, $extensions, $depth - 1 , $relative_path . $result );
620
+ $files = array_merge_recursive( $files, $found );
621
+ } elseif ( ! $extensions || preg_match( '~\.(' . $_extensions . ')$~', $result ) ) {
622
+ $files[ $relative_path . $result ] = $path . '/' . $result;
623
+ }
624
+ }
625
+
626
+ return $files;
627
+ }
628
+
629
 
630
  } // class DPE_Flexible_Posts_Widget
631
 
languages/flexible-posts-widget-fi.mo ADDED
Binary file
languages/flexible-posts-widget-fi.po ADDED
@@ -0,0 +1,196 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (C) 2013 Flexible Posts Widget
2
+ # This file is distributed under the same license as the Flexible Posts Widget package.
3
+ msgid ""
4
+ msgstr ""
5
+ "Project-Id-Version: Flexible Posts Widget 3.2\n"
6
+ "Report-Msgid-Bugs-To: http://wordpress.org/tag/flexible-posts-widget\n"
7
+ "POT-Creation-Date: 2013-10-21 14:34:24+00:00\n"
8
+ "MIME-Version: 1.0\n"
9
+ "Content-Type: text/plain; charset=UTF-8\n"
10
+ "Content-Transfer-Encoding: 8bit\n"
11
+ "PO-Revision-Date: 2014-10-14 14:15+0200\n"
12
+ "Last-Translator: Esa Rantanen <esa@eccola.fi>\n"
13
+ "Language-Team: Eccola <esa@eccola.fi>\n"
14
+ "Plural-Forms: nplurals=2; plural=(n != 1);\n"
15
+ "X-Poedit-Language: Finnish\n"
16
+ "X-Poedit-Country: FINLAND\n"
17
+ "X-Poedit-SourceCharset: utf-8\n"
18
+
19
+ #: flexible-posts-widget.php:72
20
+ msgid "Display posts as widget items"
21
+ msgstr "Näytä postit vimpaimessa"
22
+
23
+ #: flexible-posts-widget.php:86
24
+ msgid "Getting terms..."
25
+ msgstr "Haen termit..."
26
+
27
+ #: flexible-posts-widget.php:87
28
+ #: views/admin.php:50
29
+ msgid "Select terms:"
30
+ msgstr "Valitse termit:"
31
+
32
+ #: flexible-posts-widget.php:88
33
+ #: flexible-posts-widget.php:375
34
+ #: views/admin.php:68
35
+ msgid "No terms found."
36
+ msgstr "Termejä ei löytynyt."
37
+
38
+ #: flexible-posts-widget.php:184
39
+ #: flexible-posts-widget.php:273
40
+ msgid "Publish Date"
41
+ msgstr "Julkaisupvm."
42
+
43
+ #: flexible-posts-widget.php:185
44
+ #: flexible-posts-widget.php:274
45
+ msgid "Title"
46
+ msgstr "Otsikko"
47
+
48
+ #: flexible-posts-widget.php:186
49
+ #: flexible-posts-widget.php:275
50
+ msgid "Menu Order"
51
+ msgstr "Järjestys"
52
+
53
+ #: flexible-posts-widget.php:187
54
+ #: flexible-posts-widget.php:276
55
+ #: views/admin.php:31
56
+ msgid "Post ID"
57
+ msgstr "Post ID"
58
+
59
+ #: flexible-posts-widget.php:188
60
+ #: flexible-posts-widget.php:277
61
+ msgid "Author"
62
+ msgstr "Kirjoittaja"
63
+
64
+ #: flexible-posts-widget.php:189
65
+ #: flexible-posts-widget.php:278
66
+ msgid "Post Slug"
67
+ msgstr "Postin slugi"
68
+
69
+ #: flexible-posts-widget.php:190
70
+ #: flexible-posts-widget.php:279
71
+ msgid "Comment Count"
72
+ msgstr "Kommenttien lukum."
73
+
74
+ #: flexible-posts-widget.php:191
75
+ #: flexible-posts-widget.php:280
76
+ msgid "Random"
77
+ msgstr "Satunnainen"
78
+
79
+ #: flexible-posts-widget.php:194
80
+ #: flexible-posts-widget.php:283
81
+ msgid "Ascending"
82
+ msgstr "Nouseva"
83
+
84
+ #: flexible-posts-widget.php:195
85
+ #: flexible-posts-widget.php:284
86
+ msgid "Descending"
87
+ msgstr "Laskeva"
88
+
89
+ #: views/admin.php:15
90
+ msgid "Widget title:"
91
+ msgstr "Vimpaimen otsikko:"
92
+
93
+ #: views/admin.php:21
94
+ msgid "Get posts by"
95
+ msgstr "Hae posteja:"
96
+
97
+ #: views/admin.php:29
98
+ msgid "Post Type"
99
+ msgstr "SIsältötyyppi"
100
+
101
+ #: views/admin.php:30
102
+ msgid "Taxonomy &amp; Term"
103
+ msgstr "Taksonomia ja termi"
104
+
105
+ #: views/admin.php:30
106
+ msgid "Tax &amp; Term"
107
+ msgstr "Taksonomia &amp; termi"
108
+
109
+ #: views/admin.php:31
110
+ msgid "ID"
111
+ msgstr "ID"
112
+
113
+ #: views/admin.php:40
114
+ msgid "Select a taxonomy:"
115
+ msgstr "Valitse taksonomia:"
116
+
117
+ #: views/admin.php:42
118
+ msgid "Ignore Taxonomy &amp; Term"
119
+ msgstr "Ohita Taksonomia &amp; termi"
120
+
121
+ #: views/admin.php:79
122
+ msgid "Comma-separated list of post IDs:"
123
+ msgstr "Postien ID:t pilkulla erotettuina:"
124
+
125
+ #: views/admin.php:81
126
+ msgid "Will override settings on the Post Type and Taxonomy &amp; Term tabs."
127
+ msgstr "Ohittaa Sisältötyyppi- ja Taksonomia ja termi -asetukset."
128
+
129
+ #: views/admin.php:81
130
+ msgid "See documentation."
131
+ msgstr "Katso dokumentaatio."
132
+
133
+ #: views/admin.php:92
134
+ msgid "Display options"
135
+ msgstr "Näyttöasetukset"
136
+
137
+ #: views/admin.php:95
138
+ msgid "Ignore sticky posts?"
139
+ msgstr "Ohita kiinnitetyt postit?"
140
+
141
+ #: views/admin.php:98
142
+ msgid "Number of posts to show:"
143
+ msgstr "Postien lukumäärä:"
144
+
145
+ #: views/admin.php:102
146
+ msgid "Number of posts to skip:"
147
+ msgstr "Hyppää näin monen postin yli:"
148
+
149
+ #: views/admin.php:106
150
+ msgid "Order posts by:"
151
+ msgstr "Järjestä postit:"
152
+
153
+ #: views/admin.php:116
154
+ msgid "Order:"
155
+ msgstr "Järjestys:"
156
+
157
+ #: views/admin.php:130
158
+ msgid "Display thumbnails?"
159
+ msgstr "Näytä artikkelikuvat?"
160
+
161
+ #: views/admin.php:133
162
+ msgid "Select a thumbnail size to show:"
163
+ msgstr "Valitse artikkelikuvan koko:"
164
+
165
+ #: views/admin.php:146
166
+ msgid "Template filename:"
167
+ msgstr "Mallin tiedotonimi:"
168
+
169
+ #: views/admin.php:149
170
+ msgid "See documentation for details."
171
+ msgstr "Katso dokumentaatio."
172
+
173
+ #: views/widget.php:39
174
+ msgid "No post found"
175
+ msgstr "Posteja ei löytynyt..."
176
+
177
+ #. Plugin Name of the plugin/theme
178
+ msgid "Flexible Posts Widget"
179
+ msgstr "Flexible Posts Widget"
180
+
181
+ #. Plugin URI of the plugin/theme
182
+ msgid "http://wordpress.org/extend/plugins/flexible-posts-widget/"
183
+ msgstr "http://wordpress.org/extend/plugins/flexible-posts-widget/"
184
+
185
+ #. Description of the plugin/theme
186
+ msgid "An advanced posts display widget with many options: get posts by post type and taxonomy & term or by post ID; sorting & ordering; feature images; custom templates and more."
187
+ msgstr "An advanced posts display widget with many options: get posts by post type and taxonomy & term or by post ID; sorting & ordering; feature images; custom templates and more."
188
+
189
+ #. Author of the plugin/theme
190
+ msgid "dpe415"
191
+ msgstr "dpe415"
192
+
193
+ #. Author URI of the plugin/theme
194
+ msgid "http://dpedesign.com"
195
+ msgstr "http://dpedesign.com"
196
+
languages/flexible-posts-widget.pot CHANGED
@@ -1,72 +1,85 @@
1
- # Copyright (C) 2013 Flexible Posts Widget
2
  # This file is distributed under the same license as the Flexible Posts Widget package.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: Flexible Posts Widget 3.2\n"
6
  "Report-Msgid-Bugs-To: http://wordpress.org/tag/flexible-posts-widget\n"
7
- "POT-Creation-Date: 2013-10-21 14:34:24+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=UTF-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
11
- "PO-Revision-Date: 2013-MO-DA HO:MI+ZONE\n"
12
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13
  "Language-Team: LANGUAGE <LL@li.org>\n"
14
 
15
- #: flexible-posts-widget.php:72
16
- msgid "Display posts as widget items"
 
 
17
  msgstr ""
18
 
19
- #: flexible-posts-widget.php:86
 
 
 
 
20
  msgid "Getting terms..."
21
  msgstr ""
22
 
23
- #: flexible-posts-widget.php:87 views/admin.php:50
24
  msgid "Select terms:"
25
  msgstr ""
26
 
27
- #: flexible-posts-widget.php:88 flexible-posts-widget.php:375
28
  #: views/admin.php:68
29
  msgid "No terms found."
30
  msgstr ""
31
 
32
- #: flexible-posts-widget.php:184 flexible-posts-widget.php:273
33
  msgid "Publish Date"
34
  msgstr ""
35
 
36
- #: flexible-posts-widget.php:185 flexible-posts-widget.php:274
 
 
 
 
37
  msgid "Title"
38
  msgstr ""
39
 
40
- #: flexible-posts-widget.php:186 flexible-posts-widget.php:275
41
  msgid "Menu Order"
42
  msgstr ""
43
 
44
- #: flexible-posts-widget.php:187 flexible-posts-widget.php:276
45
- #: views/admin.php:31
46
  msgid "Post ID"
47
  msgstr ""
48
 
49
- #: flexible-posts-widget.php:188 flexible-posts-widget.php:277
50
  msgid "Author"
51
  msgstr ""
52
 
53
- #: flexible-posts-widget.php:189 flexible-posts-widget.php:278
54
  msgid "Post Slug"
55
  msgstr ""
56
 
57
- #: flexible-posts-widget.php:190 flexible-posts-widget.php:279
58
  msgid "Comment Count"
59
  msgstr ""
60
 
61
- #: flexible-posts-widget.php:191 flexible-posts-widget.php:280
62
  msgid "Random"
63
  msgstr ""
64
 
65
- #: flexible-posts-widget.php:194 flexible-posts-widget.php:283
 
 
 
 
66
  msgid "Ascending"
67
  msgstr ""
68
 
69
- #: flexible-posts-widget.php:195 flexible-posts-widget.php:284
70
  msgid "Descending"
71
  msgstr ""
72
 
@@ -86,10 +99,6 @@ msgstr ""
86
  msgid "Taxonomy &amp; Term"
87
  msgstr ""
88
 
89
- #: views/admin.php:30
90
- msgid "Tax &amp; Term"
91
- msgstr ""
92
-
93
  #: views/admin.php:31
94
  msgid "ID"
95
  msgstr ""
@@ -150,20 +159,12 @@ msgstr ""
150
  msgid "Template filename:"
151
  msgstr ""
152
 
153
- #: views/admin.php:149
154
- msgid "See documentation for details."
155
- msgstr ""
156
-
157
- #: views/widget.php:39
158
  msgid "No post found"
159
  msgstr ""
160
 
161
- #. Plugin Name of the plugin/theme
162
- msgid "Flexible Posts Widget"
163
- msgstr ""
164
-
165
  #. Plugin URI of the plugin/theme
166
- msgid "http://wordpress.org/extend/plugins/flexible-posts-widget/"
167
  msgstr ""
168
 
169
  #. Description of the plugin/theme
1
+ # Copyright (C) 2014 Flexible Posts Widget
2
  # This file is distributed under the same license as the Flexible Posts Widget package.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: Flexible Posts Widget 3.4\n"
6
  "Report-Msgid-Bugs-To: http://wordpress.org/tag/flexible-posts-widget\n"
7
+ "POT-Creation-Date: 2014-10-29 20:24:59+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=UTF-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
11
+ "PO-Revision-Date: 2014-MO-DA HO:MI+ZONE\n"
12
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13
  "Language-Team: LANGUAGE <LL@li.org>\n"
14
 
15
+ #. #-#-#-#-# plugin.pot (Flexible Posts Widget 3.4) #-#-#-#-#
16
+ #. Plugin Name of the plugin/theme
17
+ #: flexible-posts-widget.php:122
18
+ msgid "Flexible Posts Widget"
19
  msgstr ""
20
 
21
+ #: flexible-posts-widget.php:125
22
+ msgid "Display posts as widget items."
23
+ msgstr ""
24
+
25
+ #: flexible-posts-widget.php:429
26
  msgid "Getting terms..."
27
  msgstr ""
28
 
29
+ #: flexible-posts-widget.php:430 views/admin.php:50
30
  msgid "Select terms:"
31
  msgstr ""
32
 
33
+ #: flexible-posts-widget.php:431 flexible-posts-widget.php:459
34
  #: views/admin.php:68
35
  msgid "No terms found."
36
  msgstr ""
37
 
38
+ #: flexible-posts-widget.php:511
39
  msgid "Publish Date"
40
  msgstr ""
41
 
42
+ #: flexible-posts-widget.php:512
43
+ msgid "Modified Date"
44
+ msgstr ""
45
+
46
+ #: flexible-posts-widget.php:513
47
  msgid "Title"
48
  msgstr ""
49
 
50
+ #: flexible-posts-widget.php:514
51
  msgid "Menu Order"
52
  msgstr ""
53
 
54
+ #: flexible-posts-widget.php:515 views/admin.php:31
 
55
  msgid "Post ID"
56
  msgstr ""
57
 
58
+ #: flexible-posts-widget.php:516
59
  msgid "Author"
60
  msgstr ""
61
 
62
+ #: flexible-posts-widget.php:517
63
  msgid "Post Slug"
64
  msgstr ""
65
 
66
+ #: flexible-posts-widget.php:518
67
  msgid "Comment Count"
68
  msgstr ""
69
 
70
+ #: flexible-posts-widget.php:519
71
  msgid "Random"
72
  msgstr ""
73
 
74
+ #: flexible-posts-widget.php:520
75
+ msgid "Post ID Order"
76
+ msgstr ""
77
+
78
+ #: flexible-posts-widget.php:525
79
  msgid "Ascending"
80
  msgstr ""
81
 
82
+ #: flexible-posts-widget.php:526
83
  msgid "Descending"
84
  msgstr ""
85
 
99
  msgid "Taxonomy &amp; Term"
100
  msgstr ""
101
 
 
 
 
 
102
  #: views/admin.php:31
103
  msgid "ID"
104
  msgstr ""
159
  msgid "Template filename:"
160
  msgstr ""
161
 
162
+ #: views/widget.php:45
 
 
 
 
163
  msgid "No post found"
164
  msgstr ""
165
 
 
 
 
 
166
  #. Plugin URI of the plugin/theme
167
+ msgid "http://wordpress.org/extend/plugins/flexible-posts-widget"
168
  msgstr ""
169
 
170
  #. Description of the plugin/theme
readme.html CHANGED
@@ -5,7 +5,7 @@
5
  <strong>Tags:</strong> widget, widgets, posts, categories, tags, recent posts, thumbnails, custom post types, custom taxonomies, feature image<br/>
6
  <strong>Requires at least:</strong> 3.2<br/>
7
  <strong>Tested up to:</strong> 4.0<br/>
8
- <strong>Stable tag:</strong> 3.3.1
9
  <strong>License:</strong> GPL2 or later<br/>
10
  <strong>License URI:</strong> http://www.gnu.org/licenses/gpl-2.0.html</p>
11
 
@@ -25,7 +25,7 @@
25
  <li>Control the number of posts displayed and the number of posts to offset.</li>
26
  <li>Option to display the post feature image.</li>
27
  <li>Select the post feature image size to display from existing image sizes: thumbnail, medium, large, post-thumbnail or any size defined by the current theme.</li>
28
- <li>Order posts by: date, ID, title, menu order, random, Post ID Order; and sort posts: ascending or descending.</li>
29
  <li>Each widget&rsquo;s output can be customized by user-defined templates added to the current theme folder.</li>
30
  </ul>
31
 
@@ -34,6 +34,7 @@
34
 
35
  <ul>
36
  <li>English</li>
 
37
  <li>Italian</li>
38
  <li>Polish</li>
39
  <li>Russian</li>
@@ -50,14 +51,14 @@
50
  </ol>
51
 
52
 
53
- <h3>To use a custom HTML output template</h3>
54
 
55
  <ol>
56
- <li>Create a folder called <code>flexible-posts-widget</code> in the root of your theme folder.</li>
57
  <li>Copy <code>widget.php</code> from within the plugin&rsquo;s <code>views</code> folder into your theme&rsquo;s new <code>flexible-posts-widget</code> folder.</li>
58
- <li>Optional: Rename your theme&rsquo;s <code>widget.php</code> template file to a name of your choice (to use different templates for each widget instance).</li>
59
  <li>Go to &lsquo;Appearance&rsquo; > &lsquo;Widgets&rsquo; in WordPress to configure an instance of the widget.</li>
60
- <li>In the &lsquo;Template Filename&rsquo; field enter the name of the template file you added to your theme. Example: <code>my-themes-widget.php</code></li>
61
  </ol>
62
 
63
 
@@ -111,29 +112,32 @@ echo $test_field_value;</code></p>
111
 
112
  <p>When upgrading between major releases (version 1.x to version 2.x to version 3.x, etc), please remember to verify your settings for any existing widgets. Not all settings combinations will be saved after a major release upgrade.</p>
113
 
114
- <h3>Default vs. Custom Templates</h3>
115
-
116
- <p>FPW comes with a default template for the widget output. If you would like to alter the widget display code, create a new folder called <code>flexible-posts-widget</code> in your template directory and copy over the &ldquo;views/widget.php&rdquo; file.</p>
117
-
118
- <p>Edit the new file in your theme to your desired HTML layout. Please do not edit the one in the plugin folder as that will cause conflicts when you update the plugin to the latest release.</p>
119
-
120
  <h3>Future updates &amp; feature requests list</h3>
121
 
122
  <ul>
123
- <li>Dynamically populate the &ldquo;Template Filename&rdquo; field based on the templates available.</li>
124
- <li>Add shortcode functionality.</li>
 
 
 
 
 
 
125
  </ul>
126
 
127
 
128
  <h2>Changelog</h2>
129
 
130
- <h3>3.3</h3>
131
 
132
  <ul>
133
- <li>Refactored the PHP Class to encapsulate the plugin.</li>
134
- <li>Added the ability to sort posts by &ldquo;Post ID Order&rdquo;. Useful when getting posts using the ID tab (<code>post__in</code>). (Props: @cinus89)</li>
135
- <li>Added Russian translation. (Props: @mizhgun)</li>
136
- <li>Tested To bump for WordPress 3.9 support.</li>
 
 
 
137
  </ul>
138
 
139
 
@@ -144,15 +148,17 @@ echo $test_field_value;</code></p>
144
  <li>Version bump for WordPress 4.0 support.</li>
145
  </ul>
146
 
 
147
  <h3>3.3</h3>
148
 
149
  <ul>
150
  <li>Refactored the PHP Class to encapsulate the plugin.</li>
151
- <li>Added the ability to sort posts by "Post ID Order". Useful when getting posts using the ID tab (`post__in`). (Props: @cinus89)</li>
152
  <li>Added Russian translation. (Props: @mizhgun)</li>
153
  <li>Tested To bump for WordPress 3.9 support.</li>
154
  </ul>
155
 
 
156
  <h3>3.2.2</h3>
157
 
158
  <ul>
5
  <strong>Tags:</strong> widget, widgets, posts, categories, tags, recent posts, thumbnails, custom post types, custom taxonomies, feature image<br/>
6
  <strong>Requires at least:</strong> 3.2<br/>
7
  <strong>Tested up to:</strong> 4.0<br/>
8
+ <strong>Stable tag:</strong> 3.4
9
  <strong>License:</strong> GPL2 or later<br/>
10
  <strong>License URI:</strong> http://www.gnu.org/licenses/gpl-2.0.html</p>
11
 
25
  <li>Control the number of posts displayed and the number of posts to offset.</li>
26
  <li>Option to display the post feature image.</li>
27
  <li>Select the post feature image size to display from existing image sizes: thumbnail, medium, large, post-thumbnail or any size defined by the current theme.</li>
28
+ <li>Order posts by: date, modified date, ID, title, menu order, random, Post ID Order; and sort posts: ascending or descending.</li>
29
  <li>Each widget&rsquo;s output can be customized by user-defined templates added to the current theme folder.</li>
30
  </ul>
31
 
34
 
35
  <ul>
36
  <li>English</li>
37
+ <li>Finnish</li>
38
  <li>Italian</li>
39
  <li>Polish</li>
40
  <li>Russian</li>
51
  </ol>
52
 
53
 
54
+ <h2>To use a custom HTML output template</h2>
55
 
56
  <ol>
57
+ <li>Create a folder called <code>flexible-posts-widget</code> in the root folder of the currently active theme.</li>
58
  <li>Copy <code>widget.php</code> from within the plugin&rsquo;s <code>views</code> folder into your theme&rsquo;s new <code>flexible-posts-widget</code> folder.</li>
59
+ <li>Rename your theme&rsquo;s <code>widget.php</code> template file to a name of your choice. Example: <code>my-template.php</code>.</li>
60
  <li>Go to &lsquo;Appearance&rsquo; > &lsquo;Widgets&rsquo; in WordPress to configure an instance of the widget.</li>
61
+ <li>In the &lsquo;Template Filename&rsquo; field choose the name of the template file you added to your theme. Example: <code>My Template</code></li>
62
  </ol>
63
 
64
 
112
 
113
  <p>When upgrading between major releases (version 1.x to version 2.x to version 3.x, etc), please remember to verify your settings for any existing widgets. Not all settings combinations will be saved after a major release upgrade.</p>
114
 
 
 
 
 
 
 
115
  <h3>Future updates &amp; feature requests list</h3>
116
 
117
  <ul>
118
+ <li>Multilingual support (Polylang, WPML, etc.)</li>
119
+ <li>Make Tax-Term drop-down hierarchical.</li>
120
+ <li>Use search box instead of ID text field for post id&rsquo;s</li>
121
+ <li>Shortcode functionality.</li>
122
+ <li>Get posts by Author.</li>
123
+ <li>Filter out the post currently being viewed.</li>
124
+ <li>Get posts from the same archive (term/post type/etc).</li>
125
+ <li>Limit results by a time period.</li>
126
  </ul>
127
 
128
 
129
  <h2>Changelog</h2>
130
 
131
+ <h3>3.4</h3>
132
 
133
  <ul>
134
+ <li>Added Finnish language support. (Props: @eccola)</li>
135
+ <li>Made the Template Filename field a select box based on the templates available in the current theme, the parent theme (if the current theme is a child theme) and the plugin&rsquo;s views folder. (Props @w3b-beweb)</li>
136
+ <li>Added a new default template (<code>Default.php</code>) that works better in most sidebar situations. The current default template (<code>Widget.php</code>) will be used by any existing widgets unless manually changed.</li>
137
+ <li>Added support to order posts by Modified Date.</li>
138
+ <li>Migrated admin CSS to SASS.</li>
139
+ <li>Much code clean up and refactoring.</li>
140
+ <li>Fixed an issue with language files not loading properly (Props @sajtdavid).</li>
141
  </ul>
142
 
143
 
148
  <li>Version bump for WordPress 4.0 support.</li>
149
  </ul>
150
 
151
+
152
  <h3>3.3</h3>
153
 
154
  <ul>
155
  <li>Refactored the PHP Class to encapsulate the plugin.</li>
156
+ <li>Added the ability to sort posts by &ldquo;Post ID Order&rdquo;. Useful when getting posts using the ID tab (<code>post__in</code>). (Props: @cinus89)</li>
157
  <li>Added Russian translation. (Props: @mizhgun)</li>
158
  <li>Tested To bump for WordPress 3.9 support.</li>
159
  </ul>
160
 
161
+
162
  <h3>3.2.2</h3>
163
 
164
  <ul>
readme.md CHANGED
@@ -4,7 +4,7 @@
4
  **Tags:** widget, widgets, posts, categories, tags, recent posts, thumbnails, custom post types, custom taxonomies, feature image
5
  **Requires at least:** 3.2
6
  **Tested up to:** 4.0
7
- **Stable tag:** 3.3.1
8
  **License:** GPL2 or later
9
  **License URI:** http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -21,11 +21,12 @@ Flexible Posts Widget (FPW) is more than just a simple alternative to the defaul
21
  * Control the number of posts displayed and the number of posts to offset.
22
  * Option to display the post feature image.
23
  * Select the post feature image size to display from existing image sizes: thumbnail, medium, large, post-thumbnail or any size defined by the current theme.
24
- * Order posts by: date, ID, title, menu order, random, Post ID Order; and sort posts: ascending or descending.
25
  * Each widget's output can be customized by user-defined templates added to the current theme folder.
26
 
27
  ### Supported Languages ###
28
  * English
 
29
  * Italian
30
  * Polish
31
  * Russian
@@ -37,12 +38,12 @@ Flexible Posts Widget (FPW) is more than just a simple alternative to the defaul
37
  1. Activate the plugin through the 'Plugins' menu in WordPress.
38
  1. Go to 'Appearance' > 'Widgets' and place the widget into a sidebar to configure it.
39
 
40
- ### To use a custom HTML output template ###
41
- 1. Create a folder called `flexible-posts-widget` in the root of your theme folder.
42
  1. Copy `widget.php` from within the plugin's `views` folder into your theme's new `flexible-posts-widget` folder.
43
- 1. Optional: Rename your theme's `widget.php` template file to a name of your choice (to use different templates for each widget instance).
44
  1. Go to 'Appearance' > 'Widgets' in WordPress to configure an instance of the widget.
45
- 1. In the 'Template Filename' field enter the name of the template file you added to your theme. Example: `my-themes-widget.php`
46
 
47
 
48
  ## Frequently Asked Questions ##
@@ -88,18 +89,28 @@ When upgrading from one major version to another (version 1.x to version 2.x to
88
  ### Upgrading from one major version to another ###
89
  When upgrading between major releases (version 1.x to version 2.x to version 3.x, etc), please remember to verify your settings for any existing widgets. Not all settings combinations will be saved after a major release upgrade.
90
 
91
- ### Default vs. Custom Templates ###
92
- FPW comes with a default template for the widget output. If you would like to alter the widget display code, create a new folder called `flexible-posts-widget` in your template directory and copy over the "views/widget.php" file.
93
-
94
- Edit the new file in your theme to your desired HTML layout. Please do not edit the one in the plugin folder as that will cause conflicts when you update the plugin to the latest release.
95
-
96
  ### Future updates & feature requests list ###
97
- * Dynamically populate the "Template Filename" field based on the templates available.
98
- * Add shortcode functionality.
 
 
 
 
 
 
99
 
100
 
101
  ## Changelog ##
102
 
 
 
 
 
 
 
 
 
 
103
  ### 3.3.1 ###
104
  * Added plugin icon.
105
  * Version bump for WordPress 4.0 support.
4
  **Tags:** widget, widgets, posts, categories, tags, recent posts, thumbnails, custom post types, custom taxonomies, feature image
5
  **Requires at least:** 3.2
6
  **Tested up to:** 4.0
7
+ **Stable tag:** 3.4
8
  **License:** GPL2 or later
9
  **License URI:** http://www.gnu.org/licenses/gpl-2.0.html
10
 
21
  * Control the number of posts displayed and the number of posts to offset.
22
  * Option to display the post feature image.
23
  * Select the post feature image size to display from existing image sizes: thumbnail, medium, large, post-thumbnail or any size defined by the current theme.
24
+ * Order posts by: date, modified date, ID, title, menu order, random, Post ID Order; and sort posts: ascending or descending.
25
  * Each widget's output can be customized by user-defined templates added to the current theme folder.
26
 
27
  ### Supported Languages ###
28
  * English
29
+ * Finnish
30
  * Italian
31
  * Polish
32
  * Russian
38
  1. Activate the plugin through the 'Plugins' menu in WordPress.
39
  1. Go to 'Appearance' > 'Widgets' and place the widget into a sidebar to configure it.
40
 
41
+ ## To use a custom HTML output template ##
42
+ 1. Create a folder called `flexible-posts-widget` in the root folder of the currently active theme.
43
  1. Copy `widget.php` from within the plugin's `views` folder into your theme's new `flexible-posts-widget` folder.
44
+ 1. Rename your theme's `widget.php` template file to a name of your choice. Example: `my-template.php`.
45
  1. Go to 'Appearance' > 'Widgets' in WordPress to configure an instance of the widget.
46
+ 1. In the 'Template Filename' field choose the name of the template file you added to your theme. Example: `My Template`
47
 
48
 
49
  ## Frequently Asked Questions ##
89
  ### Upgrading from one major version to another ###
90
  When upgrading between major releases (version 1.x to version 2.x to version 3.x, etc), please remember to verify your settings for any existing widgets. Not all settings combinations will be saved after a major release upgrade.
91
 
 
 
 
 
 
92
  ### Future updates & feature requests list ###
93
+ * Multilingual support (Polylang, WPML, etc.)
94
+ * Make Tax-Term drop-down hierarchical.
95
+ * Use search box instead of ID text field for post id's
96
+ * Shortcode functionality.
97
+ * Get posts by Author.
98
+ * Filter out the post currently being viewed.
99
+ * Get posts from the same archive (term/post type/etc).
100
+ * Limit results by a time period.
101
 
102
 
103
  ## Changelog ##
104
 
105
+ ### 3.4 ###
106
+ * Added Finnish language support. (Props: @eccola)
107
+ * Made the Template Filename field a select box based on the templates available in the current theme, the parent theme (if the current theme is a child theme) and the plugin's views folder. (Props @w3b-beweb)
108
+ * Added a new default template (`Default.php`) that works better in most sidebar situations. The current default template (`Widget.php`) will be used by any existing widgets unless manually changed.
109
+ * Added support to order posts by Modified Date.
110
+ * Migrated admin CSS to SASS.
111
+ * Much code clean up and refactoring.
112
+ * Fixed an issue with language files not loading properly (Props @sajtdavid).
113
+
114
  ### 3.3.1 ###
115
  * Added plugin icon.
116
  * Version bump for WordPress 4.0 support.
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i
4
  Tags: widget, widgets, posts, categories, tags, recent posts, thumbnails, custom post types, custom taxonomies, feature image
5
  Requires at least: 3.2
6
  Tested up to: 4.0
7
- Stable tag: 3.3.1
8
  License: GPL2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -21,11 +21,12 @@ Flexible Posts Widget (FPW) is more than just a simple alternative to the defaul
21
  * Control the number of posts displayed and the number of posts to offset.
22
  * Option to display the post feature image.
23
  * Select the post feature image size to display from existing image sizes: thumbnail, medium, large, post-thumbnail or any size defined by the current theme.
24
- * Order posts by: date, ID, title, menu order, random, Post ID Order; and sort posts: ascending or descending.
25
  * Each widget's output can be customized by user-defined templates added to the current theme folder.
26
 
27
  = Supported Languages =
28
  * English
 
29
  * Italian
30
  * Polish
31
  * Russian
@@ -38,11 +39,11 @@ Flexible Posts Widget (FPW) is more than just a simple alternative to the defaul
38
  1. Go to 'Appearance' > 'Widgets' and place the widget into a sidebar to configure it.
39
 
40
  = To use a custom HTML output template =
41
- 1. Create a folder called `flexible-posts-widget` in the root of your theme folder.
42
  1. Copy `widget.php` from within the plugin's `views` folder into your theme's new `flexible-posts-widget` folder.
43
- 1. Optional: Rename your theme's `widget.php` template file to a name of your choice (to use different templates for each widget instance).
44
  1. Go to 'Appearance' > 'Widgets' in WordPress to configure an instance of the widget.
45
- 1. In the 'Template Filename' field enter the name of the template file you added to your theme. Example: `my-themes-widget.php`
46
 
47
 
48
  == Frequently Asked Questions ==
@@ -96,18 +97,28 @@ When upgrading from one major version to another (version 1.x to version 2.x to
96
  = Upgrading from one major version to another =
97
  When upgrading between major releases (version 1.x to version 2.x to version 3.x, etc), please remember to verify your settings for any existing widgets. Not all settings combinations will be saved after a major release upgrade.
98
 
99
- = Default vs. Custom Templates =
100
- FPW comes with a default template for the widget output. If you would like to alter the widget display code, create a new folder called `flexible-posts-widget` in your template directory and copy over the "views/widget.php" file.
101
-
102
- Edit the new file in your theme to your desired HTML layout. Please do not edit the one in the plugin folder as that will cause conflicts when you update the plugin to the latest release.
103
-
104
  = Future updates & feature requests list =
105
- * Dynamically populate the "Template Filename" field based on the templates available.
106
- * Add shortcode functionality.
 
 
 
 
 
 
107
 
108
 
109
  == Changelog ==
110
 
 
 
 
 
 
 
 
 
 
111
  = 3.3.1 =
112
  * Added plugin icon.
113
  * Version bump for WordPress 4.0 support.
4
  Tags: widget, widgets, posts, categories, tags, recent posts, thumbnails, custom post types, custom taxonomies, feature image
5
  Requires at least: 3.2
6
  Tested up to: 4.0
7
+ Stable tag: 3.4
8
  License: GPL2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
21
  * Control the number of posts displayed and the number of posts to offset.
22
  * Option to display the post feature image.
23
  * Select the post feature image size to display from existing image sizes: thumbnail, medium, large, post-thumbnail or any size defined by the current theme.
24
+ * Order posts by: date, modified date, ID, title, menu order, random, Post ID Order; and sort posts: ascending or descending.
25
  * Each widget's output can be customized by user-defined templates added to the current theme folder.
26
 
27
  = Supported Languages =
28
  * English
29
+ * Finnish
30
  * Italian
31
  * Polish
32
  * Russian
39
  1. Go to 'Appearance' > 'Widgets' and place the widget into a sidebar to configure it.
40
 
41
  = To use a custom HTML output template =
42
+ 1. Create a folder called `flexible-posts-widget` in the root folder of the currently active theme.
43
  1. Copy `widget.php` from within the plugin's `views` folder into your theme's new `flexible-posts-widget` folder.
44
+ 1. Rename your theme's `widget.php` template file to a name of your choice. Example: `my-template.php`.
45
  1. Go to 'Appearance' > 'Widgets' in WordPress to configure an instance of the widget.
46
+ 1. In the 'Template Filename' field choose the name of the template file you added to your theme. Example: `My Template`
47
 
48
 
49
  == Frequently Asked Questions ==
97
  = Upgrading from one major version to another =
98
  When upgrading between major releases (version 1.x to version 2.x to version 3.x, etc), please remember to verify your settings for any existing widgets. Not all settings combinations will be saved after a major release upgrade.
99
 
 
 
 
 
 
100
  = Future updates & feature requests list =
101
+ * Multilingual support (Polylang, WPML, etc.)
102
+ * Make Tax-Term drop-down hierarchical.
103
+ * Use search box instead of ID text field for post id's
104
+ * Shortcode functionality.
105
+ * Get posts by Author.
106
+ * Filter out the post currently being viewed.
107
+ * Get posts from the same archive (term/post type/etc).
108
+ * Limit results by a time period.
109
 
110
 
111
  == Changelog ==
112
 
113
+ = 3.4 =
114
+ * Added Finnish language support. (Props: @eccola)
115
+ * Made the Template Filename field a select box based on the templates available in the current theme, the parent theme (if the current theme is a child theme) and the plugin's views folder. (Props @w3b-beweb)
116
+ * Added a new default template (`Default.php`) that works better in most sidebar situations. The current default template (`Widget.php`) will be used by any existing widgets unless manually changed.
117
+ * Added support to order posts by Modified Date.
118
+ * Migrated admin CSS to SASS.
119
+ * Much code clean up and refactoring.
120
+ * Fixed an issue with language files not loading properly (Props @sajtdavid).
121
+
122
  = 3.3.1 =
123
  * Added plugin icon.
124
  * Version bump for WordPress 4.0 support.
views/admin.php CHANGED
@@ -4,42 +4,42 @@
4
  */
5
 
6
  // Block direct requests
7
- if ( !defined('ABSPATH') )
8
- die('-1');
9
 
10
  ?>
11
  <div class="dpe-fp-widget">
12
 
13
  <div class="section title">
14
  <p>
15
- <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Widget title:', 'flexible-posts-widget'); ?></label>
16
- <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; ?>" />
17
  </p>
18
  </div>
19
 
20
  <div class="section getemby">
21
- <h4><?php _e('Get posts by', 'flexible-posts-widget'); ?></h4>
22
  <div class="inside">
23
 
24
- <div id="<?php echo $this->get_field_id('getemby'); ?>" class="categorydiv getembytabs">
25
 
26
- <input id="<?php echo $this->get_field_id('cur_tab'); ?>" class="cur_tab" name="<?php echo $this->get_field_name('cur_tab'); ?>" type="hidden" value="<?php echo $cur_tab; ?>" />
27
 
28
- <ul id="<?php echo $this->get_field_id('getemby-tabs'); ?>" class="category-tabs">
29
- <li><a title="<?php _e('Post Type', 'flexible-posts-widget'); ?>" href="#<?php echo $this->get_field_id('getemby-pt'); ?>"><?php _e('Post Type', 'flexible-posts-widget'); ?></a></li>
30
- <li><a title="<?php _e('Taxonomy &amp; Term', 'flexible-posts-widget'); ?>" href="#<?php echo $this->get_field_id('getemby-tt'); ?>"><?php _e('Taxonomy &amp; Term', 'flexible-posts-widget'); ?></a></li>
31
- <li><a title="<?php _e('Post ID', 'flexible-posts-widget'); ?>" href="#<?php echo $this->get_field_id('getemby-id'); ?>"><?php _e('ID', 'flexible-posts-widget'); ?></a></li>
32
  </ul>
33
 
34
- <div id="<?php echo $this->get_field_id('getemby-pt'); ?>" class="tabs-panel pt">
35
  <?php $this->posttype_checklist( $posttype ); ?>
36
  </div><!-- .pt.getemby -->
37
 
38
- <div id="<?php echo $this->get_field_id('getemby-tt'); ?>" class="tabs-panel tt" style="display:none;">
39
  <p>
40
- <label for="<?php echo $this->get_field_id('taxonomy'); ?>"><?php _e('Select a taxonomy:', 'flexible-posts-widget'); ?></label>
41
- <select class="widefat dpe-fp-taxonomy" name="<?php echo $this->get_field_name('taxonomy'); ?>" id="<?php echo $this->get_field_id('taxonomy'); ?>">
42
- <option value="none" <?php echo 'none' == $taxonomy ? ' selected="selected"' : ''; ?>><?php _e('Ignore Taxonomy &amp; Term', 'flexible-posts-widget'); ?></option>
43
  <?php
44
  foreach ($this->taxonomies as $option) {
45
  echo '<option value="' . $option->name . '"', $taxonomy == $option->name ? ' selected="selected"' : '', '>', $option->label, '</option>';
@@ -47,10 +47,10 @@ if ( !defined('ABSPATH') )
47
  ?>
48
  </select>
49
  </p>
50
- <label <?php echo 'none' == $taxonomy ? ' style="display:none;"' : ''; ?>><?php _e('Select terms:', 'flexible-posts-widget'); ?></label>
51
  <div class="terms" <?php echo 'none' == $taxonomy ? ' style="display:none;"' : ''; ?>>
52
  <?php
53
- if ( !empty($taxonomy) && 'none' != $taxonomy ) {
54
 
55
  $args = array (
56
  'hide_empty' => 0,
@@ -58,14 +58,14 @@ if ( !defined('ABSPATH') )
58
 
59
  $terms = get_terms( $taxonomy, $args );
60
 
61
- if( !empty( $terms ) ) {
62
  $output = '<ul class="categorychecklist termschecklist form-no-clear">';
63
  foreach ( $terms as $option ) {
64
- $output .= "\n<li>" . '<label class="selectit"><input value="' . esc_attr( $option->slug ) . '" type="checkbox" name="' . $this->get_field_name('term') . '[]"' . checked( in_array( $option->slug, (array)$term ), true, false ) . ' /> ' . esc_html( $option->name ) . "</label></li>\n";
65
  }
66
  $output .= "</ul>\n";
67
  } else {
68
- $output = '<p>' . __('No terms found.', 'flexible-posts-widget') . '</p>';
69
  }
70
 
71
  echo ( $output );
@@ -74,37 +74,37 @@ if ( !defined('ABSPATH') )
74
  </div>
75
  </div><!-- .tt.getemby -->
76
 
77
- <div id="<?php echo $this->get_field_id('getemby-id'); ?>" class="tabs-panel id" style="display:none;">
78
  <p>
79
- <label for="<?php echo $this->get_field_id('pids'); ?>"><?php _e('Comma-separated list of post IDs:', 'flexible-posts-widget'); ?></label><br />
80
- <input id="<?php echo $this->get_field_id('pids'); ?>" name="<?php echo $this->get_field_name('pids'); ?>" class="widefat" type="text" value="<?php echo ( empty( $pids ) ? '' : implode( ',', $pids ) ); ?>" /><br />
81
- <span class="description"><?php _e( 'Will override settings on the Post Type and Taxonomy &amp; Term tabs.', 'flexible-posts-widget' ); ?> <a target="_blank" href="http://wordpress.org/extend/plugins/flexible-posts-widget/faq/"><?php _e('See documentation.', 'flexible-posts-widget'); ?></a></span>
82
  </p>
83
  </div><!-- .id.getemby -->
84
 
85
- </div><!-- #<?php echo $this->get_field_id('getemby'); ?> -->
86
 
87
  </div><!-- .inside -->
88
 
89
  </div>
90
 
91
  <div class="section display">
92
- <h4><?php _e('Display options', 'flexible-posts-widget'); ?></h4>
93
  <p class="check cf">
94
- <input class="dpe-fp-sticky" id="<?php echo $this->get_field_id('sticky'); ?>" name="<?php echo $this->get_field_name('sticky'); ?>" type="checkbox" value="1" <?php checked( '1', $sticky ); ?>/>
95
- <label for="<?php echo $this->get_field_id('sticky'); ?>"><?php _e('Ignore sticky posts?', 'flexible-posts-widget'); ?></label>
96
  </p>
97
  <p class="cf">
98
- <label for="<?php echo $this->get_field_id('number'); ?>"><?php _e('Number of posts to show:', 'flexible-posts-widget'); ?></label>
99
- <input id="<?php echo $this->get_field_id('number'); ?>" name="<?php echo $this->get_field_name('number'); ?>" type="text" value="<?php echo $number; ?>" />
100
  </p>
101
  <p class="cf">
102
- <label for="<?php echo $this->get_field_id('offset'); ?>"><?php _e('Number of posts to skip:', 'flexible-posts-widget'); ?></label>
103
- <input id="<?php echo $this->get_field_id('offset'); ?>" name="<?php echo $this->get_field_name('offset'); ?>" type="text" value="<?php echo $offset; ?>" />
104
  </p>
105
  <p class="cf">
106
- <label for="<?php echo $this->get_field_id('orderby'); ?>"><?php _e('Order posts by:', 'flexible-posts-widget'); ?></label>
107
- <select name="<?php echo $this->get_field_name('orderby'); ?>" id="<?php echo $this->get_field_id('orderby'); ?>">
108
  <?php
109
  foreach ( $this->orderbys as $key => $value ) {
110
  echo '<option value="' . $key . '" id="' . $this->get_field_id( $key ) . '"', $orderby == $key ? ' selected="selected"' : '', '>', $value, '</option>';
@@ -113,8 +113,8 @@ if ( !defined('ABSPATH') )
113
  </select>
114
  </p>
115
  <p class="cf">
116
- <label for="<?php echo $this->get_field_id('order'); ?>"><?php _e('Order:', 'flexible-posts-widget'); ?></label>
117
- <select name="<?php echo $this->get_field_name('order'); ?>" id="<?php echo $this->get_field_id('order'); ?>">
118
  <?php
119
  foreach ( $this->orders as $key => $value ) {
120
  echo '<option value="' . $key . '" id="' . $this->get_field_id( $key ) . '"', $order == $key ? ' selected="selected"' : '', '>', $value, '</option>';
@@ -126,12 +126,12 @@ if ( !defined('ABSPATH') )
126
 
127
  <div class="section thumbnails">
128
  <p class="check">
129
- <input class="dpe-fp-thumbnail" id="<?php echo $this->get_field_id('thumbnail'); ?>" name="<?php echo $this->get_field_name('thumbnail'); ?>" type="checkbox" value="1" <?php checked( '1', $thumbnail ); ?>/>
130
- <label style="font-weight:bold;" for="<?php echo $this->get_field_id('thumbnail'); ?>"><?php _e('Display thumbnails?', 'flexible-posts-widget'); ?></label>
131
  </p>
132
  <p <?php echo $thumbnail ? '' : 'style="display:none;"'?> class="thumb-size">
133
- <label for="<?php echo $this->get_field_id('thumbsize'); ?>"><?php _e('Select a thumbnail size to show:', 'flexible-posts-widget'); ?></label>
134
- <select class="widefat" name="<?php echo $this->get_field_name('thumbsize'); ?>" id="<?php echo $this->get_field_id('thumbsize'); ?>">
135
  <?php
136
  foreach ($this->thumbsizes as $option) {
137
  echo '<option value="' . $option . '" id="' . $this->get_field_id( $option ) . '"', $thumbsize == $option ? ' selected="selected"' : '', '>', $option, '</option>';
@@ -141,12 +141,18 @@ if ( !defined('ABSPATH') )
141
  </p>
142
  </div>
143
 
144
- <div class="section template">
145
- <p style="margin:1.33em 0;">
146
- <label for="<?php echo $this->get_field_id('template'); ?>"><?php _e('Template filename:', 'flexible-posts-widget'); ?></label>
147
- <input id="<?php echo $this->get_field_id('template'); ?>" name="<?php echo $this->get_field_name('template'); ?>" type="text" value="<?php echo $template; ?>" />
148
- <br />
149
- <span style="padding-top:3px;" class="description"><a target="_blank" href="http://wordpress.org/extend/plugins/flexible-posts-widget/other_notes/"><?php _e('See documentation for details.', 'flexible-posts-widget'); ?></a></span>
 
 
 
 
 
 
150
  </p>
151
  </div>
152
 
4
  */
5
 
6
  // Block direct requests
7
+ if ( !defined( 'ABSPATH' ) )
8
+ die( '-1' );
9
 
10
  ?>
11
  <div class="dpe-fp-widget">
12
 
13
  <div class="section title">
14
  <p>
15
+ <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Widget title:', $this->get_widget_text_domain() ); ?></label>
16
+ <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; ?>" />
17
  </p>
18
  </div>
19
 
20
  <div class="section getemby">
21
+ <h4><?php _e( 'Get posts by', $this->get_widget_text_domain() ); ?></h4>
22
  <div class="inside">
23
 
24
+ <div id="<?php echo $this->get_field_id( 'getemby' ); ?>" class="categorydiv getembytabs">
25
 
26
+ <input id="<?php echo $this->get_field_id( 'cur_tab' ); ?>" class="cur_tab" name="<?php echo $this->get_field_name( 'cur_tab' ); ?>" type="hidden" value="<?php echo $cur_tab; ?>" />
27
 
28
+ <ul id="<?php echo $this->get_field_id( 'getemby-tabs' ); ?>" class="category-tabs">
29
+ <li><a title="<?php _e( 'Post Type', $this->get_widget_text_domain() ); ?>" href="#<?php echo $this->get_field_id( 'getemby-pt' ); ?>"><?php _e( 'Post Type', $this->get_widget_text_domain() ); ?></a></li>
30
+ <li><a title="<?php _e( 'Taxonomy &amp; Term', $this->get_widget_text_domain() ); ?>" href="#<?php echo $this->get_field_id( 'getemby-tt' ); ?>"><?php _e( 'Taxonomy &amp; Term', $this->get_widget_text_domain() ); ?></a></li>
31
+ <li><a title="<?php _e( 'Post ID', $this->get_widget_text_domain() ); ?>" href="#<?php echo $this->get_field_id( 'getemby-id' ); ?>"><?php _e( 'ID', $this->get_widget_text_domain() ); ?></a></li>
32
  </ul>
33
 
34
+ <div id="<?php echo $this->get_field_id( 'getemby-pt' ); ?>" class="tabs-panel pt">
35
  <?php $this->posttype_checklist( $posttype ); ?>
36
  </div><!-- .pt.getemby -->
37
 
38
+ <div id="<?php echo $this->get_field_id( 'getemby-tt' ); ?>" class="tabs-panel tt" style="display:none;">
39
  <p>
40
+ <label for="<?php echo $this->get_field_id( 'taxonomy' ); ?>"><?php _e( 'Select a taxonomy:', $this->get_widget_text_domain() ); ?></label>
41
+ <select class="widefat dpe-fp-taxonomy" name="<?php echo $this->get_field_name( 'taxonomy' ); ?>" id="<?php echo $this->get_field_id( 'taxonomy' ); ?>">
42
+ <option value="none" <?php echo 'none' == $taxonomy ? ' selected="selected"' : ''; ?>><?php _e( 'Ignore Taxonomy &amp; Term', $this->get_widget_text_domain() ); ?></option>
43
  <?php
44
  foreach ($this->taxonomies as $option) {
45
  echo '<option value="' . $option->name . '"', $taxonomy == $option->name ? ' selected="selected"' : '', '>', $option->label, '</option>';
47
  ?>
48
  </select>
49
  </p>
50
+ <label <?php echo 'none' == $taxonomy ? ' style="display:none;"' : ''; ?>><?php _e( 'Select terms:', $this->get_widget_text_domain() ); ?></label>
51
  <div class="terms" <?php echo 'none' == $taxonomy ? ' style="display:none;"' : ''; ?>>
52
  <?php
53
+ if ( !empty( $taxonomy ) && 'none' != $taxonomy ) {
54
 
55
  $args = array (
56
  'hide_empty' => 0,
58
 
59
  $terms = get_terms( $taxonomy, $args );
60
 
61
+ if( ! empty( $terms ) ) {
62
  $output = '<ul class="categorychecklist termschecklist form-no-clear">';
63
  foreach ( $terms as $option ) {
64
+ $output .= "\n<li>" . '<label class="selectit"><input value="' . esc_attr( $option->slug ) . '" type="checkbox" name="' . $this->get_field_name( 'term' ) . '[]"' . checked( in_array( $option->slug, (array)$term ), true, false ) . ' /> ' . esc_html( $option->name ) . "</label></li>\n";
65
  }
66
  $output .= "</ul>\n";
67
  } else {
68
+ $output = '<p>' . __( 'No terms found.', $this->get_widget_text_domain() ) . '</p>';
69
  }
70
 
71
  echo ( $output );
74
  </div>
75
  </div><!-- .tt.getemby -->
76
 
77
+ <div id="<?php echo $this->get_field_id( 'getemby-id' ); ?>" class="tabs-panel id" style="display:none;">
78
  <p>
79
+ <label for="<?php echo $this->get_field_id( 'pids' ); ?>"><?php _e( 'Comma-separated list of post IDs:', $this->get_widget_text_domain() ); ?></label><br />
80
+ <input id="<?php echo $this->get_field_id( 'pids' ); ?>" name="<?php echo $this->get_field_name( 'pids' ); ?>" class="widefat" type="text" value="<?php echo ( empty( $pids ) ? '' : implode( ',', $pids ) ); ?>" /><br />
81
+ <span class="description"><?php _e( 'Will override settings on the Post Type and Taxonomy &amp; Term tabs.', $this->get_widget_text_domain() ); ?> <a target="_blank" href="http://wordpress.org/extend/plugins/flexible-posts-widget/faq/"><?php _e( 'See documentation.', $this->get_widget_text_domain() ); ?></a></span>
82
  </p>
83
  </div><!-- .id.getemby -->
84
 
85
+ </div><!-- #<?php echo $this->get_field_id( 'getemby' ); ?> -->
86
 
87
  </div><!-- .inside -->
88
 
89
  </div>
90
 
91
  <div class="section display">
92
+ <h4><?php _e( 'Display options', $this->get_widget_text_domain() ); ?></h4>
93
  <p class="check cf">
94
+ <input class="dpe-fp-sticky" id="<?php echo $this->get_field_id( 'sticky' ); ?>" name="<?php echo $this->get_field_name( 'sticky' ); ?>" type="checkbox" value="1" <?php checked( '1', $sticky ); ?>/>
95
+ <label for="<?php echo $this->get_field_id( 'sticky' ); ?>"><?php _e( 'Ignore sticky posts?', $this->get_widget_text_domain() ); ?></label>
96
  </p>
97
  <p class="cf">
98
+ <label for="<?php echo $this->get_field_id( 'number' ); ?>"><?php _e( 'Number of posts to show:', $this->get_widget_text_domain() ); ?></label>
99
+ <input id="<?php echo $this->get_field_id( 'number' ); ?>" name="<?php echo $this->get_field_name( 'number' ); ?>" type="text" value="<?php echo $number; ?>" />
100
  </p>
101
  <p class="cf">
102
+ <label for="<?php echo $this->get_field_id( 'offset' ); ?>"><?php _e( 'Number of posts to skip:', $this->get_widget_text_domain() ); ?></label>
103
+ <input id="<?php echo $this->get_field_id( 'offset' ); ?>" name="<?php echo $this->get_field_name( 'offset' ); ?>" type="text" value="<?php echo $offset; ?>" />
104
  </p>
105
  <p class="cf">
106
+ <label for="<?php echo $this->get_field_id( 'orderby' ); ?>"><?php _e( 'Order posts by:', $this->get_widget_text_domain() ); ?></label>
107
+ <select name="<?php echo $this->get_field_name( 'orderby' ); ?>" id="<?php echo $this->get_field_id( 'orderby' ); ?>">
108
  <?php
109
  foreach ( $this->orderbys as $key => $value ) {
110
  echo '<option value="' . $key . '" id="' . $this->get_field_id( $key ) . '"', $orderby == $key ? ' selected="selected"' : '', '>', $value, '</option>';
113
  </select>
114
  </p>
115
  <p class="cf">
116
+ <label for="<?php echo $this->get_field_id( 'order' ); ?>"><?php _e( 'Order:', $this->get_widget_text_domain() ); ?></label>
117
+ <select name="<?php echo $this->get_field_name( 'order' ); ?>" id="<?php echo $this->get_field_id( 'order' ); ?>">
118
  <?php
119
  foreach ( $this->orders as $key => $value ) {
120
  echo '<option value="' . $key . '" id="' . $this->get_field_id( $key ) . '"', $order == $key ? ' selected="selected"' : '', '>', $value, '</option>';
126
 
127
  <div class="section thumbnails">
128
  <p class="check">
129
+ <input class="dpe-fp-thumbnail" id="<?php echo $this->get_field_id( 'thumbnail' ); ?>" name="<?php echo $this->get_field_name( 'thumbnail' ); ?>" type="checkbox" value="1" <?php checked( '1', $thumbnail ); ?>/>
130
+ <label style="font-weight:bold;" for="<?php echo $this->get_field_id( 'thumbnail' ); ?>"><?php _e( 'Display thumbnails?', $this->get_widget_text_domain() ); ?></label>
131
  </p>
132
  <p <?php echo $thumbnail ? '' : 'style="display:none;"'?> class="thumb-size">
133
+ <label for="<?php echo $this->get_field_id( 'thumbsize' ); ?>"><?php _e( 'Select a thumbnail size to show:', $this->get_widget_text_domain() ); ?></label>
134
+ <select class="widefat" name="<?php echo $this->get_field_name( 'thumbsize' ); ?>" id="<?php echo $this->get_field_id( 'thumbsize' ); ?>">
135
  <?php
136
  foreach ($this->thumbsizes as $option) {
137
  echo '<option value="' . $option . '" id="' . $this->get_field_id( $option ) . '"', $thumbsize == $option ? ' selected="selected"' : '', '>', $option, '</option>';
141
  </p>
142
  </div>
143
 
144
+ <div class="section templates">
145
+ <p>
146
+ <label for="<?php echo $this->get_field_id( 'template' ); ?>"><?php _e( 'Template filename:', $this->get_widget_text_domain() ); ?></label>
147
+ <?php
148
+ ?>
149
+ <select class="widefat" name="<?php echo $this->get_field_name( 'template' ); ?>" id="<?php echo $this->get_field_id( 'template' ); ?>">
150
+ <?php
151
+ foreach ($this->templates as $key => $value ) {
152
+ echo '<option value="' . $key . '" id="' . $this->get_field_id( $key ) . '"', $template == $key ? ' selected="selected"' : '', '>', ucwords( preg_replace( array( '/-/', '/_/' ), ' ', preg_replace( '/.php$/', '', $key ) ) ), '</option>';
153
+ }
154
+ ?>
155
+ </select>
156
  </p>
157
  </div>
158
 
views/default.php ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Flexible Posts Widget: Default widget template
4
+ *
5
+ * @since 3.4.0
6
+ *
7
+ * This template was added to overcome some often-requested changes
8
+ * to the old default template (widget.php).
9
+ */
10
+
11
+ // Block direct requests
12
+ if ( !defined('ABSPATH') )
13
+ die('-1');
14
+
15
+ echo $before_widget;
16
+
17
+ if ( !empty($title) )
18
+ echo $before_title . $title . $after_title;
19
+
20
+ if( $flexible_posts->have_posts() ):
21
+ ?>
22
+ <ul class="dpe-flexible-posts">
23
+ <?php while( $flexible_posts->have_posts() ) : $flexible_posts->the_post(); global $post; ?>
24
+ <li id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
25
+ <a href="<?php echo the_permalink(); ?>">
26
+ <?php
27
+ if( $thumbnail == true ) {
28
+ // If the post has a feature image, show it
29
+ if( has_post_thumbnail() ) {
30
+ the_post_thumbnail( $thumbsize );
31
+ // Else if the post has a mime type that starts with "image/" then show the image directly.
32
+ } elseif( 'image/' == substr( $post->post_mime_type, 0, 6 ) ) {
33
+ echo wp_get_attachment_image( $post->ID, $thumbsize );
34
+ }
35
+ }
36
+ ?>
37
+ <div class="title"><?php the_title(); ?></div>
38
+ </a>
39
+ </li>
40
+ <?php endwhile; ?>
41
+ </ul><!-- .dpe-flexible-posts -->
42
+ <?php
43
+ endif; // End have_posts()
44
+
45
+ echo $after_widget;
views/widget.php CHANGED
@@ -1,6 +1,12 @@
1
  <?php
2
  /**
3
- * Flexible Posts Widget: Default widget template
 
 
 
 
 
 
4
  */
5
 
6
  // Block direct requests
1
  <?php
2
  /**
3
+ * Flexible Posts Widget: Old Default widget template
4
+ *
5
+ * @since 1.0.0
6
+ *
7
+ * This is the ORIGINAL default template used by the plugin.
8
+ * There is a new default template (default.php) that will be
9
+ * used by default if no template was specified in a widget.
10
  */
11
 
12
  // Block direct requests