Recent Posts Widget Extended - Version 2.0

Version Description

Download this release

Release Info

Developer satrya
Plugin Icon 128x128 Recent Posts Widget Extended
Version 2.0
Comparing to
See all releases

Code changes from version 1.1.0 to 2.0

assets/css/rpwe-admin.css CHANGED
@@ -1,18 +1,102 @@
1
- .rpwe-options small {
2
- font-size: 0.7em;
3
- color: #999;
4
- }
5
-
6
- .rpwe-info {
7
- font-size: 0.8em;
8
- line-height: 1.4;
9
- }
10
-
11
- .rpwe-options .small-input {
12
- width: 32% !important;
13
- display: inline-block !important;
14
- }
15
-
16
- .rpwe-block {
17
- display: block;
18
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .rpwe-options small {
2
+ font-size: 13px;
3
+ line-height: 1.4;
4
+ color: #5a5a5a;
5
+ }
6
+
7
+ .rpwe-info {
8
+ font-size: 13px;
9
+ line-height: 1.4;
10
+ }
11
+
12
+ .rpwe-options .small-input {
13
+ width: 32% !important;
14
+ display: inline-block !important;
15
+ }
16
+
17
+ .rpwe-block {
18
+ display: block;
19
+ }
20
+
21
+ /* === TABS === */
22
+ .widgets-holder-wrap .widget-inside.rpwe-bg,
23
+ .customize-control-widget_form.wide-widget-control .widget-inside.rpwe-bg,
24
+ .wp-block-legacy-widget__edit-form.rpwe-bg,
25
+ .wp-block-legacy-widget__edit-form.rpwe-bg .widget-inside {
26
+ background-color: #f3f3f3;
27
+ }
28
+
29
+ .rpwe-tabs {
30
+ display: flex;
31
+ flex-flow: row wrap;
32
+ justify-content: space-between;
33
+ }
34
+
35
+ .rpwe-tabs ul {
36
+ width: 100px;
37
+ }
38
+
39
+ .rpwe-tabs li {
40
+ padding: 0;
41
+ margin-bottom: 0;
42
+ }
43
+
44
+ .rpwe-tabs li.active a {
45
+ background-color: #fff;
46
+ }
47
+
48
+ .rpwe-tabs li a {
49
+ text-decoration: none;
50
+ display: block;
51
+ padding: 10px;
52
+ border-radius: 3px 0 0 3px;
53
+ }
54
+
55
+ .wp-block-legacy-widget__edit-form .rpwe-tabs li a {
56
+ font-size: 1rem;
57
+ }
58
+
59
+ #rpwe-tabs-nav {
60
+ width: 20%;
61
+ flex: 0 0 20%;
62
+ list-style: none;
63
+ padding-left: 0;
64
+ }
65
+
66
+ .wp-block-legacy-widget__edit-form #rpwe-tabs-nav {
67
+ margin-top: 0;
68
+ }
69
+
70
+ #rpwe-tabs-content {
71
+ width: 80%;
72
+ flex: 0 0 80%;
73
+ }
74
+
75
+ .rpwe-tab-content {
76
+ overflow: hidden;
77
+ min-height: 320px;
78
+ margin-top: 1em;
79
+ margin-bottom: 1em;
80
+ padding: 1em 1.5em 1em 1.5em;
81
+ background-color: #fff;
82
+ border-radius: 0 3px 3px 3px;
83
+ }
84
+
85
+ .wp-block-legacy-widget__edit-form .rpwe-tab-content {
86
+ margin-top: 0;
87
+ }
88
+
89
+ .customize-control-widget_form.wide-widget-control
90
+ .widget-inside.rpwe-bg
91
+ .rpwe-tab-content {
92
+ margin-top: 0;
93
+ max-width: 300px;
94
+ width: 300px;
95
+ }
96
+
97
+ .customize-control-widget_form.wide-widget-control
98
+ .widget-inside.rpwe-bg
99
+ #rpwe-tabs-nav {
100
+ min-width: 80px;
101
+ width: 80px;
102
+ }
assets/css/rpwe-frontend.css ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .rpwe-block ul {
2
+ list-style: none !important;
3
+ margin-left: 0 !important;
4
+ padding-left: 0 !important;
5
+ }
6
+
7
+ .rpwe-block li {
8
+ border-bottom: 1px solid #eee;
9
+ margin-bottom: 10px;
10
+ padding-bottom: 10px;
11
+ list-style-type: none;
12
+ }
13
+
14
+ .rpwe-block a {
15
+ display: inline !important;
16
+ text-decoration: none;
17
+ }
18
+
19
+ .rpwe-block h3 {
20
+ background: none !important;
21
+ clear: none;
22
+ margin-bottom: 0 !important;
23
+ margin-top: 0 !important;
24
+ font-weight: 400;
25
+ font-size: 12px !important;
26
+ line-height: 1.5em;
27
+ }
28
+
29
+ .rpwe-thumb {
30
+ border: 1px solid #eee !important;
31
+ box-shadow: none !important;
32
+ margin: 2px 10px 2px 0;
33
+ padding: 3px !important;
34
+ }
35
+
36
+ .rpwe-summary {
37
+ font-size: 12px;
38
+ }
39
+
40
+ .rpwe-time {
41
+ color: #bbb;
42
+ font-size: 11px;
43
+ }
44
+
45
+ .rpwe-comment {
46
+ color: #bbb;
47
+ font-size: 11px;
48
+ padding-left: 5px;
49
+ }
50
+
51
+ .rpwe-alignleft {
52
+ display: inline;
53
+ float: left;
54
+ }
55
+
56
+ .rpwe-alignright {
57
+ display: inline;
58
+ float: right;
59
+ }
60
+
61
+ .rpwe-aligncenter {
62
+ display: block;
63
+ margin-left: auto;
64
+ margin-right: auto;
65
+ }
66
+
67
+ .rpwe-clearfix:before,
68
+ .rpwe-clearfix:after {
69
+ content: "";
70
+ display: table !important;
71
+ }
72
+
73
+ .rpwe-clearfix:after {
74
+ clear: both;
75
+ }
76
+
77
+ .rpwe-clearfix {
78
+ zoom: 1;
79
+ }
assets/js/rpwe-admin.js ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ jQuery(document).ready(function ($) {
2
+ /**
3
+ * Add custom class
4
+ */
5
+ $('.rpwe-options').closest('.widget-inside').addClass('rpwe-bg')
6
+
7
+ /**
8
+ * Tabs
9
+ */
10
+ // Show the first tab and hide the rest.
11
+ $('#rpwe-tabs-nav li:first-child').addClass('active')
12
+ $('.rpwe-tab-content').hide()
13
+ $('.rpwe-tab-content:first-child').show()
14
+
15
+ // Click the navigation.
16
+ $('body').on('click', '#rpwe-tabs-nav li', function (e) {
17
+ e.preventDefault()
18
+
19
+ $('#rpwe-tabs-nav li').removeClass('active')
20
+ $(this).addClass('active')
21
+ $('.rpwe-tab-content').hide()
22
+
23
+ const activeTab = $(this).find('a').attr('href')
24
+ console.log(activeTab)
25
+ $(`${activeTab}.rpwe-tab-content`).fadeIn()
26
+ return false
27
+ })
28
+ })
classes/class-image-resizer.php ADDED
@@ -0,0 +1,251 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Title : Aqua Resizer
4
+ * Description : Resizes WordPress images on the fly
5
+ * Version : 1.2.0
6
+ * Author : Syamil MJ
7
+ * Author URI : http://aquagraphite.com
8
+ * License : WTFPL - http://sam.zoy.org/wtfpl/
9
+ * Documentation : https://github.com/sy4mil/Aqua-Resizer/
10
+ *
11
+ * I changed the function and class name for compatibility purpose. It somtimes conflicted with a theme which uses the same library.
12
+ *
13
+ * @param string $url - (required) must be uploaded using wp media uploader
14
+ * @param int $width - (required)
15
+ * @param int $height - (optional)
16
+ * @param bool $crop - (optional) default to soft crop
17
+ * @param bool $single - (optional) returns an array if false
18
+ * @param bool $upscale - (optional) resizes smaller images
19
+ * @uses wp_upload_dir()
20
+ * @uses image_resize_dimensions()
21
+ * @uses wp_get_image_editor()
22
+ *
23
+ * @return str|array
24
+ * @package Posts Extended
25
+ */
26
+
27
+ if ( ! class_exists( 'Image_Resizer' ) ) {
28
+
29
+ /**
30
+ * Resize image on the fly.
31
+ */
32
+ class Image_Resizer {
33
+ /**
34
+ * The singleton instance.
35
+ *
36
+ * @var null
37
+ */
38
+ private static $instance = null;
39
+
40
+ /**
41
+ * No initialization allowed
42
+ */
43
+ private function __construct() {
44
+ }
45
+
46
+ /**
47
+ * No cloning allowed
48
+ */
49
+ private function __clone() {
50
+ }
51
+
52
+ /**
53
+ * For your custom default usage you may want to initialize an Image_Resizer object by yourself and then have own defaults
54
+ */
55
+ public static function get_instance() {
56
+ self::$instance = new self();
57
+ return self::$instance;
58
+ }
59
+
60
+ /**
61
+ * Process the image.
62
+ *
63
+ * @param string $url The image url.
64
+ * @param int $width the image width.
65
+ * @param int $height the image height.
66
+ * @param boolean $crop Crop the image.
67
+ * @param boolean $single Return image output.
68
+ * @param boolean $upscale Upscale the image.
69
+ *
70
+ * @return (string|array)[]
71
+ */
72
+ public function process( $url, $width = null, $height = null, $crop = null, $single = true, $upscale = false ) {
73
+ // Validate inputs.
74
+ if ( ! $url || ( ! $width && ! $height ) ) {
75
+ return false;
76
+ }
77
+
78
+ // Caipt'n, ready to hook.
79
+ if ( true === $upscale ) {
80
+ add_filter( 'image_resize_dimensions', array( $this, 'rpwe_upscale' ), 10, 6 );
81
+ }
82
+
83
+ // Define upload path & dir.
84
+ $upload_info = wp_upload_dir();
85
+ $upload_dir = $upload_info['basedir'];
86
+ $upload_url = $upload_info['baseurl'];
87
+
88
+ $http_prefix = 'http://';
89
+ $https_prefix = 'https://';
90
+
91
+ // if the $url scheme differs from $upload_url scheme, make them match
92
+ // if the schemes differe, images don't show up.
93
+ if ( ! strncmp( $url, $https_prefix, strlen( $https_prefix ) ) ) { // if url begins with https:// make $upload_url begin with https:// as well.
94
+ $upload_url = str_replace( $http_prefix, $https_prefix, $upload_url );
95
+ } elseif ( ! strncmp( $url, $http_prefix, strlen( $http_prefix ) ) ) { // if url begins with http:// make $upload_url begin with http:// as well.
96
+ $upload_url = str_replace( $https_prefix, $http_prefix, $upload_url );
97
+ }
98
+
99
+ // Check if $img_url is local.
100
+ if ( false === strpos( $url, $upload_url ) ) {
101
+ return false;
102
+ }
103
+
104
+ // Define path of image.
105
+ $rel_path = str_replace( $upload_url, '', $url );
106
+ $img_path = $upload_dir . $rel_path;
107
+
108
+ // Check if img path exists, and is an image indeed.
109
+ if ( ! file_exists( $img_path ) || ! getimagesize( $img_path ) ) {
110
+ return false;
111
+ }
112
+
113
+ // Get image info.
114
+ $info = pathinfo( $img_path );
115
+ $ext = $info['extension'];
116
+ list($orig_w, $orig_h) = getimagesize( $img_path );
117
+
118
+ // Get image size after cropping.
119
+ $dims = image_resize_dimensions( $orig_w, $orig_h, $width, $height, $crop );
120
+
121
+ // Check if $dims is array.
122
+ // https://github.com/gasatrya/recent-posts-widget-extended/issues/7.
123
+ // Thanks to @aadilovic-tfb.
124
+ if ( is_array( $dims ) ) {
125
+ $dst_w = $dims[4];
126
+ $dst_h = $dims[5];
127
+ } else {
128
+ $dst_w = null;
129
+ $dst_h = null;
130
+ }
131
+
132
+ // Return the original image only if it exactly fits the needed measures.
133
+ if ( ! $dims && ( ( ( null === $height && $orig_w === $width ) xor ( null === $width && $orig_h === $height ) ) xor ( $height === $orig_h && $width === $orig_w ) ) ) {
134
+ $img_url = $url;
135
+ $dst_w = $orig_w;
136
+ $dst_h = $orig_h;
137
+ } else {
138
+ // Use this to check if cropped image already exists, so we can return that instead.
139
+ $suffix = "{$dst_w}x{$dst_h}";
140
+ $dst_rel_path = str_replace( '.' . $ext, '', $rel_path );
141
+ $destfilename = "{$upload_dir}{$dst_rel_path}-{$suffix}.{$ext}";
142
+
143
+ if ( ! $dims || ( true === $crop && false === $upscale && ( $dst_w < $width || $dst_h < $height ) ) ) {
144
+ // Can't resize, so return false saying that the action to do could not be processed as planned.
145
+ return false;
146
+
147
+ // Else check if cache exists.
148
+ } elseif ( file_exists( $destfilename ) && getimagesize( $destfilename ) ) {
149
+ $img_url = "{$upload_url}{$dst_rel_path}-{$suffix}.{$ext}";
150
+
151
+ // Else, we resize the image and return the new resized image url.
152
+ } else {
153
+
154
+ $editor = wp_get_image_editor( $img_path );
155
+
156
+ if ( is_wp_error( $editor ) || is_wp_error( $editor->resize( $width, $height, $crop ) ) ) {
157
+ return false;
158
+ }
159
+
160
+ $resized_file = $editor->save();
161
+
162
+ if ( ! is_wp_error( $resized_file ) ) {
163
+ $resized_rel_path = str_replace( $upload_dir, '', $resized_file['path'] );
164
+ $img_url = $upload_url . $resized_rel_path;
165
+ } else {
166
+ return false;
167
+ }
168
+ }
169
+ }
170
+
171
+ // Okay, leave the ship.
172
+ if ( true === $upscale ) {
173
+ remove_filter( 'image_resize_dimensions', array( $this, 'rpwe_upscale' ) );
174
+ }
175
+
176
+ // Return the output.
177
+ if ( $single ) {
178
+ // str return.
179
+ $image = $img_url;
180
+ } else {
181
+ // array return.
182
+ $image = array(
183
+ 0 => $img_url,
184
+ 1 => $dst_w,
185
+ 2 => $dst_h,
186
+ );
187
+ }
188
+
189
+ return $image;
190
+ }
191
+
192
+ /**
193
+ * Callback to overwrite WP computing of thumbnail measures
194
+ *
195
+ * @param null|mixed $default Whether to preempt output of the resize dimensions.
196
+ * @param int $orig_w Width.
197
+ * @param int $orig_h Height.
198
+ * @param int $dest_w New width.
199
+ * @param int $dest_h New height.
200
+ * @param boolean $crop Crop image.
201
+ *
202
+ * @return array
203
+ */
204
+ public function rpwe_upscale( $default, $orig_w, $orig_h, $dest_w, $dest_h, $crop ) {
205
+ if ( ! $crop ) {
206
+ return null; // Let the WordPress default function handle this.
207
+ }
208
+
209
+ // Here is the point we allow to use larger image size than the original one.
210
+ $aspect_ratio = $orig_w / $orig_h;
211
+ $new_w = $dest_w;
212
+ $new_h = $dest_h;
213
+
214
+ if ( ! $new_w ) {
215
+ $new_w = intval( $new_h * $aspect_ratio );
216
+ }
217
+
218
+ if ( ! $new_h ) {
219
+ $new_h = intval( $new_w / $aspect_ratio );
220
+ }
221
+
222
+ $size_ratio = max( $new_w / $orig_w, $new_h / $orig_h );
223
+
224
+ $crop_w = round( $new_w / $size_ratio );
225
+ $crop_h = round( $new_h / $size_ratio );
226
+
227
+ $s_x = floor( ( $orig_w - $crop_w ) / 2 );
228
+ $s_y = floor( ( $orig_h - $crop_h ) / 2 );
229
+
230
+ return array( 0, 0, (int) $s_x, (int) $s_y, (int) $new_w, (int) $new_h, (int) $crop_w, (int) $crop_h );
231
+ }
232
+ }
233
+ }
234
+
235
+ if ( ! function_exists( 'rpwe_image_resize' ) ) {
236
+ /**
237
+ * Wrapper function
238
+ *
239
+ * @param string $url The image url.
240
+ * @param int $width The image width.
241
+ * @param int $height The image height.
242
+ * @param boolean $crop Crop image.
243
+ * @param boolean $single Image output.
244
+ * @param boolean $upscale Image upscale.
245
+ * @return (string|array)[]
246
+ */
247
+ function rpwe_image_resize( $url, $width = null, $height = null, $crop = null, $single = true, $upscale = false ) {
248
+ $resize_image = Image_Resizer::get_instance();
249
+ return $resize_image->process( $url, $width, $height, $crop, $single, $upscale );
250
+ }
251
+ }
classes/class-rpwe-widget.php ADDED
@@ -0,0 +1,233 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * The custom recent posts widget.
4
+ * This widget gives total control over the output to the user.
5
+ *
6
+ * @package Recent Posts Extended
7
+ */
8
+
9
+ /**
10
+ * Custom widget.
11
+ */
12
+ class RPWE_Widget extends WP_Widget {
13
+
14
+ /**
15
+ * Sets up the widgets.
16
+ */
17
+ public function __construct() {
18
+
19
+ // Set up the widget options.
20
+ $widget_options = array(
21
+ 'classname' => 'rpwe_widget recent-posts-extended',
22
+ 'description' => __( 'An advanced widget that gives you total control over the output of your site’s most recent Posts.', 'recent-posts-widget-extended' ),
23
+ 'customize_selective_refresh' => true,
24
+ );
25
+
26
+ // Widget options.
27
+ $control_options = array(
28
+ 'width' => 500,
29
+ );
30
+
31
+ // Create the widget.
32
+ parent::__construct(
33
+ 'rpwe_widget',
34
+ __( 'Recent Posts Extended', 'recent-posts-widget-extended' ),
35
+ $widget_options,
36
+ $control_options
37
+ );
38
+
39
+ $this->alt_option_name = 'rpwe_widget';
40
+
41
+ // Action to load custom script.
42
+ add_action( 'load-widgets.php', array( $this, 'rpwe_widget_script' ) );
43
+ }
44
+
45
+ /**
46
+ * Load custom script.
47
+ */
48
+ public function rpwe_widget_script() {
49
+ add_action( 'admin_print_footer_scripts-widgets.php', array( $this, 'rpwe_custom_script' ) );
50
+ }
51
+
52
+ /**
53
+ * The custom script.
54
+ */
55
+ public function rpwe_custom_script() {
56
+ ?>
57
+ <script>
58
+ ( function ( $ ) {
59
+ function rpwe_custom_bg_class() {
60
+ $( '.rpwe-options' ).closest( '.widget-inside' ).addClass( 'rpwe-bg' )
61
+ $( '.rpwe-options' ).closest( '.wp-block-legacy-widget__edit-form' ).addClass( 'rpwe-bg' )
62
+ }
63
+
64
+ function rpwe_custom_tabs() {
65
+ // Show the first tab and hide the rest.
66
+ $( '#rpwe-tabs-nav li:first-child' ).addClass( 'active' )
67
+ $( '.rpwe-tab-content' ).hide()
68
+ $( '.rpwe-tab-content:first-child' ).show()
69
+
70
+ // Click the navigation.
71
+ $( 'body' ).on( 'click', '#rpwe-tabs-nav li', function ( e ) {
72
+ e.preventDefault()
73
+
74
+ $( '#rpwe-tabs-nav li' ).removeClass( 'active' )
75
+ $( this ).addClass( 'active' )
76
+ $( '.rpwe-tab-content' ).hide()
77
+
78
+ const activeTab = $( this ).find( 'a' ).attr( 'href' )
79
+ $( `${activeTab}.rpwe-tab-content` ).show()
80
+ return false
81
+ })
82
+ }
83
+
84
+ rpwe_custom_bg_class()
85
+ rpwe_custom_tabs()
86
+
87
+ $( document ).on( 'widget-added', function () {
88
+ rpwe_custom_bg_class()
89
+ rpwe_custom_tabs()
90
+ } );
91
+
92
+ $( document ).on( 'widget-updated', function () {
93
+ rpwe_custom_bg_class()
94
+ rpwe_custom_tabs()
95
+ } );
96
+ } )( jQuery )
97
+ </script>
98
+ <?php
99
+ }
100
+
101
+ /**
102
+ * Outputs the widget based on the arguments input through the widget controls.
103
+ *
104
+ * @param array $args the arguments.
105
+ * @param array $instance form data.
106
+ * @return void
107
+ */
108
+ public function widget( $args, $instance ) {
109
+
110
+ $recent = rpwe_get_recent_posts( $instance );
111
+
112
+ if ( $instance['styles_default'] ) {
113
+ wp_enqueue_style( 'rpwe-style' );
114
+ }
115
+
116
+ if ( $recent ) {
117
+
118
+ // Output the theme's $before_widget wrapper.
119
+ echo $args['before_widget']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
120
+
121
+ // If the default style is disabled then use the custom css if it's not empty.
122
+ if ( ! $instance['styles_default'] && ! empty( $instance['css'] ) ) {
123
+ echo '<style>' . esc_attr( $instance['css'] ) . '</style>';
124
+ }
125
+
126
+ // If both title and title url is not empty, display it.
127
+ if ( ! empty( $instance['title_url'] ) && ! empty( $instance['title'] ) ) {
128
+ echo $args['before_title'] . '<a href="' . esc_url( $instance['title_url'] ) . '" title="' . esc_attr( $instance['title'] ) . '">' . apply_filters( 'widget_title', esc_attr( $instance['title'] ), $instance, $this->id_base ) . '</a>' . $args['after_title']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
129
+
130
+ // If the title not empty, display it.
131
+ } elseif ( ! empty( $instance['title'] ) ) {
132
+ echo $args['before_title'] . apply_filters( 'widget_title', esc_attr( $instance['title'] ), $instance, $this->id_base ) . $args['after_title']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
133
+ }
134
+
135
+ // Get the recent posts query.
136
+ echo $recent; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
137
+
138
+ // Close the theme's widget wrapper.
139
+ echo $args['after_widget']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
140
+ }
141
+ }
142
+
143
+ /**
144
+ * Updates the widget control options for the particular instance of the widget.
145
+ *
146
+ * @param array $new_instance new instance.
147
+ * @param array $old_instance old instance.
148
+ * @return array
149
+ */
150
+ public function update( $new_instance, $old_instance ) {
151
+
152
+ // Validate post_type submissions.
153
+ $name = get_post_types( array( 'public' => true ), 'names' );
154
+ $types = array();
155
+ foreach ( $new_instance['post_type'] as $type ) {
156
+ if ( in_array( $type, $name, true ) ) {
157
+ $types[] = $type;
158
+ }
159
+ }
160
+ if ( empty( $types ) ) {
161
+ $types[] = 'post';
162
+ }
163
+
164
+ $instance = $old_instance;
165
+ $instance['title'] = sanitize_text_field( $new_instance['title'] );
166
+ $instance['title_url'] = esc_url_raw( $new_instance['title_url'] );
167
+
168
+ $instance['ignore_sticky'] = isset( $new_instance['ignore_sticky'] ) ? (bool) $new_instance['ignore_sticky'] : 0;
169
+ $instance['exclude_current'] = isset( $new_instance['exclude_current'] ) ? (bool) $new_instance['exclude_current'] : 0;
170
+ $instance['limit'] = intval( $new_instance['limit'] );
171
+ $instance['offset'] = intval( $new_instance['offset'] );
172
+ $instance['order'] = stripslashes( $new_instance['order'] );
173
+ $instance['orderby'] = stripslashes( $new_instance['orderby'] );
174
+ $instance['post_type'] = $types;
175
+ $instance['post_status'] = stripslashes( $new_instance['post_status'] );
176
+ $instance['cat'] = $new_instance['cat'];
177
+ $instance['tag'] = $new_instance['tag'];
178
+ $instance['taxonomy'] = esc_attr( $new_instance['taxonomy'] );
179
+
180
+ $instance['excerpt'] = isset( $new_instance['excerpt'] ) ? (bool) $new_instance['excerpt'] : false;
181
+ $instance['length'] = intval( $new_instance['length'] );
182
+ $instance['date'] = isset( $new_instance['date'] ) ? (bool) $new_instance['date'] : false;
183
+ $instance['date_relative'] = isset( $new_instance['date_relative'] ) ? (bool) $new_instance['date_relative'] : false;
184
+ $instance['date_modified'] = isset( $new_instance['date_modified'] ) ? (bool) $new_instance['date_modified'] : false;
185
+ $instance['readmore'] = isset( $new_instance['readmore'] ) ? (bool) $new_instance['readmore'] : false;
186
+ $instance['readmore_text'] = sanitize_text_field( $new_instance['readmore_text'] );
187
+ $instance['comment_count'] = isset( $new_instance['comment_count'] ) ? (bool) $new_instance['comment_count'] : false;
188
+
189
+ // New.
190
+ $instance['post_title'] = isset( $new_instance['post_title'] ) ? (bool) $new_instance['post_title'] : false;
191
+ $instance['link_target'] = isset( $new_instance['link_target'] ) ? (bool) $new_instance['link_target'] : false;
192
+
193
+ $instance['thumb'] = isset( $new_instance['thumb'] ) ? (bool) $new_instance['thumb'] : false;
194
+ $instance['thumb_height'] = intval( $new_instance['thumb_height'] );
195
+ $instance['thumb_width'] = intval( $new_instance['thumb_width'] );
196
+ $instance['thumb_default'] = esc_url_raw( $new_instance['thumb_default'] );
197
+ $instance['thumb_align'] = esc_attr( $new_instance['thumb_align'] );
198
+
199
+ $instance['styles_default'] = isset( $new_instance['styles_default'] ) ? (bool) $new_instance['styles_default'] : false;
200
+ $instance['css_id'] = sanitize_html_class( $new_instance['css_id'] );
201
+ $instance['css_class'] = sanitize_html_class( $new_instance['css_class'] );
202
+ $instance['css'] = $new_instance['css'];
203
+
204
+ if ( current_user_can( 'unfiltered_html' ) ) {
205
+ $instance['before'] = $new_instance['before'];
206
+ } else {
207
+ $instance['before'] = wp_kses_post( $new_instance['before'] );
208
+ }
209
+
210
+ if ( current_user_can( 'unfiltered_html' ) ) {
211
+ $instance['after'] = $new_instance['after'];
212
+ } else {
213
+ $instance['after'] = wp_kses_post( $new_instance['after'] );
214
+ }
215
+
216
+ return $instance;
217
+ }
218
+
219
+ /**
220
+ * Displays the widget control options in the Widgets admin screen.
221
+ *
222
+ * @param array $instance the widget settings.
223
+ * @return void
224
+ */
225
+ public function form( $instance ) {
226
+
227
+ // Merge the user-selected arguments with the defaults.
228
+ $instance = wp_parse_args( (array) $instance, rpwe_get_default_args() );
229
+
230
+ // Loads the widget form.
231
+ include RPWE_INCLUDES . '/form.php';
232
+ }
233
+ }
classes/widget.php DELETED
@@ -1,157 +0,0 @@
1
- <?php
2
-
3
- /**
4
- * The custom recent posts widget.
5
- * This widget gives total control over the output to the user.
6
- */
7
- class Recent_Posts_Widget_Extended extends WP_Widget {
8
-
9
- /**
10
- * Sets up the widgets.
11
- *
12
- * @since 0.1
13
- */
14
- public function __construct() {
15
-
16
- /* Set up the widget options. */
17
- $widget_options = array(
18
- 'classname' => 'rpwe_widget recent-posts-extended',
19
- 'description' => __('An advanced widget that gives you total control over the output of your site’s most recent Posts.', 'recent-posts-widget-extended'),
20
- 'customize_selective_refresh' => true
21
- );
22
-
23
- $control_options = array(
24
- 'width' => 750,
25
- 'height' => 350
26
- );
27
-
28
- /* Create the widget. */
29
- parent::__construct(
30
- 'rpwe_widget', // $this->id_base
31
- __('Recent Posts Extended', 'recent-posts-widget-extended'), // $this->name
32
- $widget_options, // $this->widget_options
33
- $control_options // $this->control_options
34
- );
35
-
36
- $this->alt_option_name = 'rpwe_widget';
37
- }
38
-
39
- /**
40
- * Outputs the widget based on the arguments input through the widget controls.
41
- *
42
- * @since 0.1
43
- */
44
- public function widget($args, $instance) {
45
- extract($args);
46
-
47
- $recent = rpwe_get_recent_posts($instance);
48
-
49
- if ($recent) {
50
-
51
- // Output the theme's $before_widget wrapper.
52
- echo $before_widget;
53
-
54
- // If both title and title url is not empty, display it.
55
- if (!empty($instance['title_url']) && !empty($instance['title'])) {
56
- echo $before_title . '<a href="' . esc_url($instance['title_url']) . '" title="' . esc_attr($instance['title']) . '">' . apply_filters('widget_title', $instance['title'], $instance, $this->id_base) . '</a>' . $after_title;
57
-
58
- // If the title not empty, display it.
59
- } elseif (!empty($instance['title'])) {
60
- echo $before_title . apply_filters('widget_title', $instance['title'], $instance, $this->id_base) . $after_title;
61
- }
62
-
63
- // Get the recent posts query.
64
- echo $recent;
65
-
66
- // Close the theme's widget wrapper.
67
- echo $after_widget;
68
- }
69
- }
70
-
71
- /**
72
- * Updates the widget control options for the particular instance of the widget.
73
- *
74
- * @since 0.1
75
- */
76
- public function update($new_instance, $old_instance) {
77
-
78
- // Validate post_type submissions
79
- $name = get_post_types(array('public' => true), 'names');
80
- $types = array();
81
- foreach ($new_instance['post_type'] as $type) {
82
- if (in_array($type, $name)) {
83
- $types[] = $type;
84
- }
85
- }
86
- if (empty($types)) {
87
- $types[] = 'post';
88
- }
89
-
90
- $instance = $old_instance;
91
- $instance['title'] = sanitize_text_field($new_instance['title']);
92
- $instance['title_url'] = esc_url_raw($new_instance['title_url']);
93
-
94
- $instance['ignore_sticky'] = isset($new_instance['ignore_sticky']) ? (bool) $new_instance['ignore_sticky'] : 0;
95
- $instance['exclude_current'] = isset($new_instance['exclude_current']) ? (bool) $new_instance['exclude_current'] : 0;
96
- $instance['limit'] = intval($new_instance['limit']);
97
- $instance['offset'] = intval($new_instance['offset']);
98
- $instance['order'] = stripslashes($new_instance['order']);
99
- $instance['orderby'] = stripslashes($new_instance['orderby']);
100
- $instance['post_type'] = $types;
101
- $instance['post_status'] = stripslashes($new_instance['post_status']);
102
- $instance['cat'] = $new_instance['cat'];
103
- $instance['tag'] = $new_instance['tag'];
104
- $instance['taxonomy'] = esc_attr($new_instance['taxonomy']);
105
-
106
- $instance['excerpt'] = isset($new_instance['excerpt']) ? (bool) $new_instance['excerpt'] : false;
107
- $instance['length'] = intval($new_instance['length']);
108
- $instance['date'] = isset($new_instance['date']) ? (bool) $new_instance['date'] : false;
109
- $instance['date_relative'] = isset($new_instance['date_relative']) ? (bool) $new_instance['date_relative'] : false;
110
- $instance['date_modified'] = isset($new_instance['date_modified']) ? (bool) $new_instance['date_modified'] : false;
111
- $instance['readmore'] = isset($new_instance['readmore']) ? (bool) $new_instance['readmore'] : false;
112
- $instance['readmore_text'] = sanitize_text_field($new_instance['readmore_text']);
113
- $instance['comment_count'] = isset($new_instance['comment_count']) ? (bool) $new_instance['comment_count'] : false;
114
-
115
- $instance['thumb'] = isset($new_instance['thumb']) ? (bool) $new_instance['thumb'] : false;
116
- $instance['thumb_height'] = intval($new_instance['thumb_height']);
117
- $instance['thumb_width'] = intval($new_instance['thumb_width']);
118
- $instance['thumb_default'] = esc_url_raw($new_instance['thumb_default']);
119
- $instance['thumb_align'] = esc_attr($new_instance['thumb_align']);
120
-
121
- $instance['styles_default'] = isset($new_instance['styles_default']) ? (bool) $new_instance['styles_default'] : false;
122
- $instance['cssID'] = sanitize_html_class($new_instance['cssID']);
123
- $instance['css_class'] = sanitize_html_class($new_instance['css_class']);
124
- $instance['css'] = $new_instance['css'];
125
-
126
- if (current_user_can('unfiltered_html')) {
127
- $instance['before'] = $new_instance['before'];
128
- } else {
129
- $instance['before'] = wp_kses_post($new_instance['before']);
130
- }
131
-
132
- if (current_user_can('unfiltered_html')) {
133
- $instance['after'] = $new_instance['after'];
134
- } else {
135
- $instance['after'] = wp_kses_post($new_instance['after']);
136
- }
137
-
138
- return $instance;
139
- }
140
-
141
- /**
142
- * Displays the widget control options in the Widgets admin screen.
143
- *
144
- * @since 0.1
145
- */
146
- public function form($instance) {
147
-
148
- // Merge the user-selected arguments with the defaults.
149
- $instance = wp_parse_args((array) $instance, rpwe_get_default_args());
150
-
151
- // Extract the array to allow easy use of variables.
152
- extract($instance);
153
-
154
- // Loads the widget form.
155
- include(RPWE_INCLUDES . 'form.php');
156
- }
157
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/defaults.php ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Defaults
4
+ *
5
+ * @package Recent Posts Extended
6
+ */
7
+
8
+ /**
9
+ * Sets up the default arguments.
10
+ */
11
+ function rpwe_get_default_args() {
12
+
13
+ $css_defaults = ".rpwe-block ul{\nlist-style: none !important;\nmargin-left: 0 !important;\npadding-left: 0 !important;\n}\n\n.rpwe-block li{\nborder-bottom: 1px solid #eee;\nmargin-bottom: 10px;\npadding-bottom: 10px;\nlist-style-type: none;\n}\n\n.rpwe-block a{\ndisplay: inline !important;\ntext-decoration: none;\n}\n\n.rpwe-block h3{\nbackground: none !important;\nclear: none;\nmargin-bottom: 0 !important;\nmargin-top: 0 !important;\nfont-weight: 400;\nfont-size: 12px !important;\nline-height: 1.5em;\n}\n\n.rpwe-thumb{\nborder: 1px solid #eee !important;\nbox-shadow: none !important;\nmargin: 2px 10px 2px 0;\npadding: 3px !important;\n}\n\n.rpwe-summary{\nfont-size: 12px;\n}\n\n.rpwe-time{\ncolor: #bbb;\nfont-size: 11px;\n}\n\n.rpwe-comment{\ncolor: #bbb;\nfont-size: 11px;\npadding-left: 5px;\n}\n\n.rpwe-alignleft{\ndisplay: inline;\nfloat: left;\n}\n\n.rpwe-alignright{\ndisplay: inline;\nfloat: right;\n}\n\n.rpwe-aligncenter{\ndisplay: block;\nmargin-left: auto;\nmargin-right: auto;\n}\n\n.rpwe-clearfix:before,\n.rpwe-clearfix:after{\ncontent: \"\";\ndisplay: table !important;\n}\n\n.rpwe-clearfix:after{\nclear: both;\n}\n\n.rpwe-clearfix{\nzoom: 1;\n}\n";
14
+
15
+ $defaults = array(
16
+ 'title' => esc_attr__( 'Recent Posts', 'rpwe' ),
17
+ 'title_url' => '',
18
+
19
+ 'limit' => 5,
20
+ 'offset' => 0,
21
+ 'order' => 'DESC',
22
+ 'orderby' => 'date',
23
+ 'cat' => array(),
24
+ 'tag' => array(),
25
+ 'taxonomy' => '',
26
+ 'post_type' => array( 'post' ),
27
+ 'post_status' => 'publish',
28
+ 'ignore_sticky' => 1,
29
+ 'exclude_current' => 1,
30
+
31
+ 'excerpt' => false,
32
+ 'length' => 10,
33
+ 'thumb' => true,
34
+ 'thumb_height' => 45,
35
+ 'thumb_width' => 45,
36
+ 'thumb_default' => 'https://via.placeholder.com/45x45/f0f0f0/ccc',
37
+ 'thumb_align' => 'rpwe-alignleft',
38
+ 'date' => true,
39
+ 'date_relative' => false,
40
+ 'date_modified' => false,
41
+ 'readmore' => false,
42
+ 'readmore_text' => __( 'Read More &raquo;', 'recent-posts-widget-extended' ),
43
+ 'comment_count' => false,
44
+
45
+ // New.
46
+ 'post_title' => true,
47
+ 'link_target' => false,
48
+
49
+ 'styles_default' => true,
50
+ 'css' => $css_defaults,
51
+ 'cssID' => '', // Deprecated.
52
+ 'css_id' => '',
53
+ 'css_class' => '',
54
+ 'before' => '',
55
+ 'after' => '',
56
+ );
57
+
58
+ // Allow plugins/themes developer to filter the default arguments.
59
+ return apply_filters( 'rpwe_default_args', $defaults );
60
+ }
includes/form.php CHANGED
@@ -1,279 +1,341 @@
1
- <?php
2
-
3
- /**
4
- * Widget forms.
5
- */
6
- ?>
7
-
8
- <div class="rpwe-options">
9
-
10
- <p>
11
- <label for="<?php echo $this->get_field_id('title'); ?>">
12
- <?php _e('Title', 'recent-posts-widget-extended'); ?>
13
- </label>
14
- <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr($instance['title']); ?>" />
15
- </p>
16
-
17
- <p>
18
- <label for="<?php echo $this->get_field_id('title_url'); ?>">
19
- <?php _e('Title URL', 'recent-posts-widget-extended'); ?>
20
- </label>
21
- <input class="widefat" id="<?php echo $this->get_field_id('title_url'); ?>" name="<?php echo $this->get_field_name('title_url'); ?>" type="text" value="<?php echo esc_url($instance['title_url']); ?>" />
22
- </p>
23
-
24
- <p>
25
- <label for="<?php echo $this->get_field_id('cssID'); ?>">
26
- <?php _e('CSS ID', 'recent-posts-widget-extended'); ?>
27
- </label>
28
- <input class="widefat" id="<?php echo $this->get_field_id('cssID'); ?>" name="<?php echo $this->get_field_name('cssID'); ?>" type="text" value="<?php echo sanitize_html_class($instance['cssID']); ?>" />
29
- </p>
30
-
31
- <p>
32
- <label for="<?php echo $this->get_field_id('css_class'); ?>">
33
- <?php _e('CSS Class', 'recent-posts-widget-extended'); ?>
34
- </label>
35
- <input class="widefat" id="<?php echo $this->get_field_id('css_class'); ?>" name="<?php echo $this->get_field_name('css_class'); ?>" type="text" value="<?php echo sanitize_html_class($instance['css_class']); ?>" />
36
- </p>
37
-
38
- <p>
39
- <label for="<?php echo $this->get_field_id('before'); ?>">
40
- <?php _e('HTML or text before the recent posts', 'recent-posts-widget-extended'); ?>
41
- </label>
42
- <textarea class="widefat" id="<?php echo $this->get_field_id('before'); ?>" name="<?php echo $this->get_field_name('before'); ?>" rows="5"><?php echo htmlspecialchars(stripslashes($instance['before'])); ?></textarea>
43
- </p>
44
-
45
- <p>
46
- <label for="<?php echo $this->get_field_id('after'); ?>">
47
- <?php _e('HTML or text after the recent posts', 'recent-posts-widget-extended'); ?>
48
- </label>
49
- <textarea class="widefat" id="<?php echo $this->get_field_id('after'); ?>" name="<?php echo $this->get_field_name('after'); ?>" rows="5"><?php echo htmlspecialchars(stripslashes($instance['after'])); ?></textarea>
50
- </p>
51
-
52
-
53
- <p>
54
- <input class="checkbox" type="checkbox" <?php checked($instance['ignore_sticky'], 1); ?> id="<?php echo $this->get_field_id('ignore_sticky'); ?>" name="<?php echo $this->get_field_name('ignore_sticky'); ?>" />
55
- <label for="<?php echo $this->get_field_id('ignore_sticky'); ?>">
56
- <?php _e('Ignore sticky posts', 'recent-posts-widget-extended'); ?>
57
- </label>
58
- </p>
59
-
60
- <p>
61
- <input class="checkbox" type="checkbox" <?php checked($instance['exclude_current'], 1); ?> id="<?php echo $this->get_field_id('exclude_current'); ?>" name="<?php echo $this->get_field_name('exclude_current'); ?>" />
62
- <label for="<?php echo $this->get_field_id('exclude_current'); ?>">
63
- <?php _e('Exclude current post', 'recent-posts-widget-extended'); ?>
64
- </label>
65
- </p>
66
-
67
- <div class="rpwe-multiple-check-form">
68
- <label>
69
- <?php _e('Post Types', 'recent-posts-widget-extended'); ?>
70
- </label>
71
- <?php foreach (get_post_types(array('public' => true), 'objects') as $type) : ?>
72
- <p>
73
- <input type="checkbox" value="<?php echo esc_attr($type->name); ?>" id="<?php echo $this->get_field_id('post_type') . '-' . $type->name; ?>" name="<?php echo $this->get_field_name('post_type'); ?>[]" <?php checked(is_array($instance['post_type']) && in_array($type->name, $instance['post_type'])); ?> />
74
- <label for="<?php echo $this->get_field_id('post_type') . '-' . $type->name; ?>">
75
- <?php echo esc_html($type->labels->name); ?>
76
- </label>
77
- </p>
78
- <?php endforeach; ?>
79
- </div>
80
-
81
- <p>
82
- <label for="<?php echo $this->get_field_id('post_status'); ?>">
83
- <?php _e('Post Status', 'recent-posts-widget-extended'); ?>
84
- </label>
85
- <select class="widefat" id="<?php echo $this->get_field_id('post_status'); ?>" name="<?php echo $this->get_field_name('post_status'); ?>" style="width:100%;">
86
- <?php foreach (array_keys(get_object_vars(wp_count_posts('post'))) as $status_value => $status_label) { ?>
87
- <option value="<?php echo esc_attr($status_label); ?>" <?php selected($instance['post_status'], $status_label); ?>><?php echo esc_html(ucfirst($status_label)); ?></option>
88
- <?php } ?>
89
- </select>
90
- </p>
91
-
92
- <p>
93
- <label for="<?php echo $this->get_field_id('order'); ?>">
94
- <?php _e('Order', 'recent-posts-widget-extended'); ?>
95
- </label>
96
- <select class="widefat" id="<?php echo $this->get_field_id('order'); ?>" name="<?php echo $this->get_field_name('order'); ?>" style="width:100%;">
97
- <option value="DESC" <?php selected($instance['order'], 'DESC'); ?>><?php _e('Descending', 'rpwe') ?></option>
98
- <option value="ASC" <?php selected($instance['order'], 'ASC'); ?>><?php _e('Ascending', 'rpwe') ?></option>
99
- </select>
100
- </p>
101
-
102
- <p>
103
- <label for="<?php echo $this->get_field_id('orderby'); ?>">
104
- <?php _e('Orderby', 'recent-posts-widget-extended'); ?>
105
- </label>
106
- <select class="widefat" id="<?php echo $this->get_field_id('orderby'); ?>" name="<?php echo $this->get_field_name('orderby'); ?>" style="width:100%;">
107
- <option value="ID" <?php selected($instance['orderby'], 'ID'); ?>><?php _e('ID', 'rpwe') ?></option>
108
- <option value="author" <?php selected($instance['orderby'], 'author'); ?>><?php _e('Author', 'rpwe') ?></option>
109
- <option value="title" <?php selected($instance['orderby'], 'title'); ?>><?php _e('Title', 'rpwe') ?></option>
110
- <option value="date" <?php selected($instance['orderby'], 'date'); ?>><?php _e('Date', 'rpwe') ?></option>
111
- <option value="modified" <?php selected($instance['orderby'], 'modified'); ?>><?php _e('Modified', 'rpwe') ?></option>
112
- <option value="rand" <?php selected($instance['orderby'], 'rand'); ?>><?php _e('Random', 'rpwe') ?></option>
113
- <option value="comment_count" <?php selected($instance['orderby'], 'comment_count'); ?>><?php _e('Comment Count', 'rpwe') ?></option>
114
- <option value="menu_order" <?php selected($instance['orderby'], 'menu_order'); ?>><?php _e('Menu Order', 'rpwe') ?></option>
115
- </select>
116
- </p>
117
-
118
- <div class="rpwe-multiple-check-form">
119
- <label>
120
- <?php _e('Limit to Category', 'recent-posts-widget-extended'); ?>
121
- </label>
122
-
123
- <?php foreach (rpwe_cats_list() as $category) : ?>
124
- <p>
125
- <input type="checkbox" value="<?php echo (int) $category->term_id; ?>" id="<?php echo $this->get_field_id('cat') . '-' . (int) $category->term_id; ?>" name="<?php echo $this->get_field_name('cat'); ?>[]" <?php checked(is_array($instance['cat']) && in_array($category->term_id, $instance['cat'])); ?> />
126
- <label for="<?php echo $this->get_field_id('cat') . '-' . (int) $category->term_id; ?>">
127
- <?php echo esc_html($category->name); ?>
128
- </label>
129
- </p>
130
- <?php endforeach; ?>
131
- </div>
132
-
133
- <div class="rpwe-multiple-check-form">
134
- <label>
135
- <?php _e('Limit to Tag', 'recent-posts-widget-extended'); ?>
136
- </label>
137
- <?php foreach (rpwe_tags_list() as $post_tag) : ?>
138
- <p>
139
- <input type="checkbox" value="<?php echo (int) $post_tag->term_id; ?>" id="<?php echo $this->get_field_id('tag') . '-' . (int) $post_tag->term_id; ?>" name="<?php echo $this->get_field_name('tag'); ?>[]" <?php checked(is_array($instance['tag']) && in_array($post_tag->term_id, $instance['tag'])); ?> />
140
- <label for="<?php echo $this->get_field_id('tag') . '-' . (int) $post_tag->term_id; ?>">
141
- <?php echo esc_html($post_tag->name); ?>
142
- </label>
143
- </p>
144
- <?php endforeach; ?>
145
- </div>
146
-
147
- <p>
148
- <label for="<?php echo $this->get_field_id('taxonomy'); ?>">
149
- <?php _e('Limit to Taxonomy', 'recent-posts-widget-extended'); ?>
150
- </label>
151
- <input type="text" class="widefat" id="<?php echo $this->get_field_id('taxonomy'); ?>" name="<?php echo $this->get_field_name('taxonomy'); ?>" value="<?php echo esc_attr($instance['taxonomy']); ?>" />
152
- <small><?php _e('Ex: category=1,2,4&amp;post_tag=6,12. ', 'rpwe'); ?>
153
- <?php _e('Available: ', 'rpwe');
154
- echo implode(', ', get_taxonomies(array('public' => true))); ?></small>
155
- </p>
156
-
157
- <p>
158
- <label for="<?php echo $this->get_field_id('limit'); ?>">
159
- <?php _e('Number of posts to show', 'recent-posts-widget-extended'); ?>
160
- </label>
161
- <input class="widefat" id="<?php echo $this->get_field_id('limit'); ?>" name="<?php echo $this->get_field_name('limit'); ?>" type="number" step="1" min="-1" value="<?php echo (int)($instance['limit']); ?>" />
162
- </p>
163
-
164
- <p>
165
- <label for="<?php echo $this->get_field_id('offset'); ?>">
166
- <?php _e('Offset', 'recent-posts-widget-extended'); ?>
167
- </label>
168
- <input class="widefat" id="<?php echo $this->get_field_id('offset'); ?>" name="<?php echo $this->get_field_name('offset'); ?>" type="number" step="1" min="0" value="<?php echo (int)($instance['offset']); ?>" />
169
- <small><?php _e('The number of posts to skip', 'recent-posts-widget-extended'); ?></small>
170
- </p>
171
-
172
- <?php if (current_theme_supports('post-thumbnails')) { ?>
173
-
174
- <p>
175
- <input id="<?php echo $this->get_field_id('thumb'); ?>" name="<?php echo $this->get_field_name('thumb'); ?>" type="checkbox" <?php checked($instance['thumb']); ?> />
176
- <label for="<?php echo $this->get_field_id('thumb'); ?>">
177
- <?php _e('Display Thumbnail', 'recent-posts-widget-extended'); ?>
178
- </label>
179
- </p>
180
-
181
- <p>
182
- <label class="rpwe-block" for="<?php echo $this->get_field_id('thumb_height'); ?>">
183
- <?php _e('Thumbnail (height,width,align)', 'recent-posts-widget-extended'); ?>
184
- </label>
185
-
186
- <input class="small-input" id="<?php echo $this->get_field_id('thumb_height'); ?>" name="<?php echo $this->get_field_name('thumb_height'); ?>" type="number" step="1" min="0" value="<?php echo (int)($instance['thumb_height']); ?>" />
187
-
188
- <input class="small-input" id="<?php echo $this->get_field_id('thumb_width'); ?>" name="<?php echo $this->get_field_name('thumb_width'); ?>" type="number" step="1" min="0" value="<?php echo (int)($instance['thumb_width']); ?>" />
189
-
190
- <select class="small-input" id="<?php echo $this->get_field_id('thumb_align'); ?>" name="<?php echo $this->get_field_name('thumb_align'); ?>">
191
- <option value="rpwe-alignleft" <?php selected($instance['thumb_align'], 'rpwe-alignleft'); ?>><?php _e('Left', 'recent-posts-widget-extended') ?></option>
192
- <option value="rpwe-alignright" <?php selected($instance['thumb_align'], 'rpwe-alignright'); ?>><?php _e('Right', 'recent-posts-widget-extended') ?></option>
193
- <option value="rpwe-aligncenter" <?php selected($instance['thumb_align'], 'rpwe-aligncenter'); ?>><?php _e('Center', 'recent-posts-widget-extended') ?></option>
194
- </select>
195
- </p>
196
-
197
- <p>
198
- <label for="<?php echo $this->get_field_id('thumb_default'); ?>">
199
- <?php _e('Default Thumbnail', 'recent-posts-widget-extended'); ?>
200
- </label>
201
- <input class="widefat" id="<?php echo $this->get_field_id('thumb_default'); ?>" name="<?php echo $this->get_field_name('thumb_default'); ?>" type="text" value="<?php echo $instance['thumb_default']; ?>" />
202
- <small><?php _e('Leave it blank to disable.', 'recent-posts-widget-extended'); ?></small>
203
- </p>
204
-
205
- <?php } ?>
206
-
207
- <p>
208
- <input id="<?php echo $this->get_field_id('excerpt'); ?>" name="<?php echo $this->get_field_name('excerpt'); ?>" type="checkbox" <?php checked($instance['excerpt']); ?> />
209
- <label for="<?php echo $this->get_field_id('excerpt'); ?>">
210
- <?php _e('Display Excerpt', 'recent-posts-widget-extended'); ?>
211
- </label>
212
- </p>
213
-
214
- <p>
215
- <label for="<?php echo $this->get_field_id('length'); ?>">
216
- <?php _e('Excerpt Length', 'recent-posts-widget-extended'); ?>
217
- </label>
218
- <input class="widefat" id="<?php echo $this->get_field_id('length'); ?>" name="<?php echo $this->get_field_name('length'); ?>" type="number" step="1" min="0" value="<?php echo (int)($instance['length']); ?>" />
219
- </p>
220
-
221
- <p>
222
- <input id="<?php echo $this->get_field_id('readmore'); ?>" name="<?php echo $this->get_field_name('readmore'); ?>" type="checkbox" <?php checked($instance['readmore']); ?> />
223
- <label for="<?php echo $this->get_field_id('readmore'); ?>">
224
- <?php _e('Display Readmore', 'recent-posts-widget-extended'); ?>
225
- </label>
226
- </p>
227
-
228
- <p>
229
- <label for="<?php echo $this->get_field_id('readmore_text'); ?>">
230
- <?php _e('Readmore Text', 'recent-posts-widget-extended'); ?>
231
- </label>
232
- <input class="widefat" id="<?php echo $this->get_field_id('readmore_text'); ?>" name="<?php echo $this->get_field_name('readmore_text'); ?>" type="text" value="<?php echo strip_tags($instance['readmore_text']); ?>" />
233
- </p>
234
-
235
- <p>
236
- <input id="<?php echo $this->get_field_id('comment_count'); ?>" name="<?php echo $this->get_field_name('comment_count'); ?>" type="checkbox" <?php checked($instance['comment_count']); ?> />
237
- <label for="<?php echo $this->get_field_id('comment_count'); ?>">
238
- <?php _e('Display Comment Count', 'recent-posts-widget-extended'); ?>
239
- </label>
240
- </p>
241
-
242
- <p>
243
- <input id="<?php echo $this->get_field_id('date'); ?>" name="<?php echo $this->get_field_name('date'); ?>" type="checkbox" <?php checked($instance['date']); ?> />
244
- <label for="<?php echo $this->get_field_id('date'); ?>">
245
- <?php _e('Display Date', 'recent-posts-widget-extended'); ?>
246
- </label>
247
- </p>
248
-
249
- <p>
250
- <input id="<?php echo $this->get_field_id('date_modified'); ?>" name="<?php echo $this->get_field_name('date_modified'); ?>" type="checkbox" <?php checked($instance['date_modified']); ?> />
251
- <label for="<?php echo $this->get_field_id('date_modified'); ?>">
252
- <?php _e('Display Modification Date', 'recent-posts-widget-extended'); ?>
253
- </label>
254
- </p>
255
-
256
- <p>
257
- <input id="<?php echo $this->get_field_id('date_relative'); ?>" name="<?php echo $this->get_field_name('date_relative'); ?>" type="checkbox" <?php checked($instance['date_relative']); ?> />
258
- <label for="<?php echo $this->get_field_id('date_relative'); ?>">
259
- <?php _e('Use Relative Date. eg: 5 days ago', 'recent-posts-widget-extended'); ?>
260
- </label>
261
- </p>
262
-
263
-
264
- <p>
265
- <input id="<?php echo $this->get_field_id('styles_default'); ?>" name="<?php echo $this->get_field_name('styles_default'); ?>" type="checkbox" <?php checked($instance['styles_default']); ?> />
266
- <label for="<?php echo $this->get_field_id('styles_default'); ?>">
267
- <?php _e('Use Default Styles', 'recent-posts-widget-extended'); ?>
268
- </label>
269
- </p>
270
-
271
- <p>
272
- <label for="<?php echo $this->get_field_id('css'); ?>">
273
- <?php _e('Custom CSS', 'recent-posts-widget-extended'); ?>
274
- </label>
275
- <textarea class="widefat" id="<?php echo $this->get_field_id('css'); ?>" name="<?php echo $this->get_field_name('css'); ?>" style="height:180px;"><?php echo $instance['css']; ?></textarea>
276
- <small><?php _e('If you turn off the default styles, you can use these css code to customize the recent posts style.', 'recent-posts-widget-extended'); ?></small>
277
- </p>
278
-
279
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Widget forms.
4
+ *
5
+ * @package Recent Posts Extended
6
+ */
7
+
8
+ ?>
9
+
10
+ <div class="rpwe-options">
11
+
12
+ <div class="rpwe-tabs">
13
+
14
+ <ul id="rpwe-tabs-nav">
15
+ <li><a href="#tab1"><?php esc_html_e( 'General', 'recent-posts-widget-extended' ); ?></a></li>
16
+ <li><a href="#tab2"><?php esc_html_e( 'Posts', 'recent-posts-widget-extended' ); ?></a></li>
17
+ <li><a href="#tab3"><?php esc_html_e( 'Image', 'recent-posts-widget-extended' ); ?></a></li>
18
+ <li><a href="#tab4"><?php esc_html_e( 'Excerpt', 'recent-posts-widget-extended' ); ?></a></li>
19
+ <li><a href="#tab5"><?php esc_html_e( 'Control', 'recent-posts-widget-extended' ); ?></a></li>
20
+ <li><a href="#tab6"><?php esc_html_e( 'Style', 'recent-posts-widget-extended' ); ?></a></li>
21
+ </ul>
22
+
23
+ <div id="rpwe-tabs-content">
24
+
25
+ <div id="tab1" class="rpwe-tab-content">
26
+ <p>
27
+ <label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>">
28
+ <?php esc_attr_e( 'Title', 'recent-posts-widget-extended' ); ?>
29
+ </label>
30
+ <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 esc_attr( $instance['title'] ); ?>" />
31
+ </p>
32
+
33
+ <p>
34
+ <label for="<?php echo esc_attr( $this->get_field_id( 'title_url' ) ); ?>">
35
+ <?php esc_attr_e( 'Title URL', 'recent-posts-widget-extended' ); ?>
36
+ </label>
37
+ <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 esc_url( $instance['title_url'] ); ?>" />
38
+ </p>
39
+
40
+ <p>
41
+ <label for="<?php echo esc_attr( $this->get_field_id( 'css_id' ) ); ?>">
42
+ <?php esc_attr_e( 'Container ID', 'recent-posts-widget-extended' ); ?>
43
+ </label>
44
+ <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 esc_attr( $instance['css_id'] ); ?>" />
45
+ </p>
46
+
47
+ <p>
48
+ <label for="<?php echo esc_attr( $this->get_field_id( 'css_class' ) ); ?>">
49
+ <?php esc_attr_e( 'Container Class', 'recent-posts-widget-extended' ); ?>
50
+ </label>
51
+ <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'css_class' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'css_class' ) ); ?>" type="text" value="<?php echo esc_attr( $instance['css_class'] ); ?>" />
52
+ </p>
53
+
54
+ <p>
55
+ <label for="<?php echo esc_attr( $this->get_field_id( 'before' ) ); ?>">
56
+ <?php esc_attr_e( 'HTML or text before the recent posts', 'recent-posts-widget-extended' ); ?>
57
+ </label>
58
+ <textarea class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'before' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'before' ) ); ?>" rows="5"><?php echo wp_kses_post( htmlspecialchars( stripslashes( $instance['before'] ) ) ); ?></textarea>
59
+ </p>
60
+
61
+ <p>
62
+ <label for="<?php echo esc_attr( $this->get_field_id( 'after' ) ); ?>">
63
+ <?php esc_attr_e( 'HTML or text after the recent posts', 'recent-posts-widget-extended' ); ?>
64
+ </label>
65
+ <textarea class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'after' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'after' ) ); ?>" rows="5"><?php echo wp_kses_post( htmlspecialchars( stripslashes( $instance['after'] ) ) ); ?></textarea>
66
+ </p>
67
+ </div>
68
+
69
+ <div id="tab2" class="rpwe-tab-content">
70
+
71
+ <p>
72
+ <input class="checkbox" type="checkbox" <?php checked( $instance['ignore_sticky'], 1 ); ?> id="<?php echo esc_attr( $this->get_field_id( 'ignore_sticky' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'ignore_sticky' ) ); ?>" />
73
+ <label for="<?php echo esc_attr( $this->get_field_id( 'ignore_sticky' ) ); ?>">
74
+ <?php esc_attr_e( 'Ignore sticky posts', 'recent-posts-widget-extended' ); ?>
75
+ </label>
76
+ </p>
77
+
78
+ <p>
79
+ <input class="checkbox" type="checkbox" <?php checked( $instance['exclude_current'], 1 ); ?> id="<?php echo esc_attr( $this->get_field_id( 'exclude_current' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'exclude_current' ) ); ?>" />
80
+ <label for="<?php echo esc_attr( $this->get_field_id( 'exclude_current' ) ); ?>">
81
+ <?php esc_attr_e( 'Exclude current post', 'recent-posts-widget-extended' ); ?>
82
+ </label>
83
+ </p>
84
+
85
+ <div class="rpwe-multiple-check-form">
86
+ <label>
87
+ <?php esc_attr_e( 'Post Types', 'recent-posts-widget-extended' ); ?>
88
+ </label>
89
+ <?php foreach ( get_post_types( array( 'public' => true ), 'objects' ) as $posttype ) : ?>
90
+ <p>
91
+ <input type="checkbox" value="<?php echo esc_attr( $posttype->name ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'post_type' ) ) . '-' . esc_attr( $posttype->name ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'post_type' ) ); ?>[]" <?php checked( is_array( $instance['post_type'] ) && in_array( $posttype->name, $instance['post_type'], true ) ); ?> />
92
+ <label for="<?php echo esc_attr( $this->get_field_id( 'post_type' ) ) . '-' . esc_attr( $posttype->name ); ?>">
93
+ <?php echo esc_html( $posttype->labels->name ); ?>
94
+ </label>
95
+ </p>
96
+ <?php endforeach; ?>
97
+ </div>
98
+
99
+ <p>
100
+ <label for="<?php echo esc_attr( $this->get_field_id( 'post_status' ) ); ?>">
101
+ <?php esc_attr_e( 'Post Status', 'recent-posts-widget-extended' ); ?>
102
+ </label>
103
+ <select class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'post_status' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'post_status' ) ); ?>" style="width:100%;">
104
+ <?php foreach ( array_keys( get_object_vars( wp_count_posts( 'post' ) ) ) as $status_value => $status_label ) { ?>
105
+ <option value="<?php echo esc_attr( $status_label ); ?>" <?php selected( $instance['post_status'], $status_label ); ?>><?php echo esc_html( ucfirst( $status_label ) ); ?></option>
106
+ <?php } ?>
107
+ </select>
108
+ </p>
109
+
110
+ <p>
111
+ <label for="<?php echo esc_attr( $this->get_field_id( 'order' ) ); ?>">
112
+ <?php esc_attr_e( 'Order', 'recent-posts-widget-extended' ); ?>
113
+ </label>
114
+ <select class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'order' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'order' ) ); ?>" style="width:100%;">
115
+ <option value="DESC" <?php selected( $instance['order'], 'DESC' ); ?>><?php esc_attr_e( 'Descending', 'rpwe' ); ?></option>
116
+ <option value="ASC" <?php selected( $instance['order'], 'ASC' ); ?>><?php esc_attr_e( 'Ascending', 'rpwe' ); ?></option>
117
+ </select>
118
+ </p>
119
+
120
+ <p>
121
+ <label for="<?php echo esc_attr( $this->get_field_id( 'orderby' ) ); ?>">
122
+ <?php esc_attr_e( 'Orderby', 'recent-posts-widget-extended' ); ?>
123
+ </label>
124
+ <select class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'orderby' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'orderby' ) ); ?>" style="width:100%;">
125
+ <option value="ID" <?php selected( $instance['orderby'], 'ID' ); ?>><?php esc_attr_e( 'ID', 'rpwe' ); ?></option>
126
+ <option value="author" <?php selected( $instance['orderby'], 'author' ); ?>><?php esc_attr_e( 'Author', 'rpwe' ); ?></option>
127
+ <option value="title" <?php selected( $instance['orderby'], 'title' ); ?>><?php esc_attr_e( 'Title', 'rpwe' ); ?></option>
128
+ <option value="date" <?php selected( $instance['orderby'], 'date' ); ?>><?php esc_attr_e( 'Date', 'rpwe' ); ?></option>
129
+ <option value="modified" <?php selected( $instance['orderby'], 'modified' ); ?>><?php esc_attr_e( 'Modified', 'rpwe' ); ?></option>
130
+ <option value="rand" <?php selected( $instance['orderby'], 'rand' ); ?>><?php esc_attr_e( 'Random', 'rpwe' ); ?></option>
131
+ <option value="comment_count" <?php selected( $instance['orderby'], 'comment_count' ); ?>><?php esc_attr_e( 'Comment Count', 'rpwe' ); ?></option>
132
+ <option value="menu_order" <?php selected( $instance['orderby'], 'menu_order' ); ?>><?php esc_attr_e( 'Menu Order', 'rpwe' ); ?></option>
133
+ </select>
134
+ </p>
135
+
136
+ <div class="rpwe-multiple-check-form">
137
+ <label>
138
+ <?php esc_attr_e( 'Limit to Category', 'recent-posts-widget-extended' ); ?>
139
+ </label>
140
+
141
+ <?php foreach ( rpwe_cats_list() as $category ) : ?>
142
+ <p>
143
+ <input type="checkbox" value="<?php echo (int) $category->term_id; ?>" id="<?php echo esc_attr( $this->get_field_id( 'cat' ) ) . '-' . (int) $category->term_id; ?>" name="<?php echo esc_attr( $this->get_field_name( 'cat' ) ); ?>[]" <?php checked( is_array( $instance['cat'] ) && in_array( $category->term_id, $instance['cat'], true ) ); ?> />
144
+ <label for="<?php echo esc_attr( $this->get_field_id( 'cat' ) ) . '-' . (int) $category->term_id; ?>">
145
+ <?php echo esc_html( $category->name ); ?>
146
+ </label>
147
+ </p>
148
+ <?php endforeach; ?>
149
+ </div>
150
+
151
+ <div class="rpwe-multiple-check-form">
152
+ <label>
153
+ <?php esc_attr_e( 'Limit to Tag', 'recent-posts-widget-extended' ); ?>
154
+ </label>
155
+ <?php foreach ( rpwe_tags_list() as $post_tag ) : ?>
156
+ <p>
157
+ <input type="checkbox" value="<?php echo (int) $post_tag->term_id; ?>" id="<?php echo esc_attr( $this->get_field_id( 'tag' ) ) . '-' . (int) $post_tag->term_id; ?>" name="<?php echo esc_attr( $this->get_field_name( 'tag' ) ); ?>[]" <?php checked( is_array( $instance['tag'] ) && in_array( $post_tag->term_id, $instance['tag'], true ) ); ?> />
158
+ <label for="<?php echo esc_attr( $this->get_field_id( 'tag' ) ) . '-' . (int) $post_tag->term_id; ?>">
159
+ <?php echo esc_html( $post_tag->name ); ?>
160
+ </label>
161
+ </p>
162
+ <?php endforeach; ?>
163
+ </div>
164
+
165
+ <p>
166
+ <label for="<?php echo esc_attr( $this->get_field_id( 'taxonomy' ) ); ?>">
167
+ <?php esc_attr_e( 'Limit to Taxonomy', 'recent-posts-widget-extended' ); ?>
168
+ </label>
169
+ <input type="text" class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'taxonomy' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'taxonomy' ) ); ?>" value="<?php echo esc_attr( $instance['taxonomy'] ); ?>" />
170
+ <small>
171
+ <?php esc_attr_e( 'Ex: category=1,2,4&amp;post_tag=6,12. ', 'rpwe' ); ?>
172
+ <?php
173
+ esc_attr_e( 'Available: ', 'rpwe' );
174
+ echo implode( ', ', get_taxonomies( array( 'public' => true ) ) );
175
+ ?>
176
+ </small>
177
+ </p>
178
+
179
+ <p>
180
+ <label for="<?php echo esc_attr( $this->get_field_id( 'limit' ) ); ?>">
181
+ <?php esc_attr_e( 'Number of posts to show', 'recent-posts-widget-extended' ); ?>
182
+ </label>
183
+ <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'limit' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'limit' ) ); ?>" type="number" step="1" min="-1" value="<?php echo (int) ( $instance['limit'] ); ?>" />
184
+ </p>
185
+
186
+ <p>
187
+ <label for="<?php echo esc_attr( $this->get_field_id( 'offset' ) ); ?>">
188
+ <?php esc_attr_e( 'Offset', 'recent-posts-widget-extended' ); ?>
189
+ </label>
190
+ <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'offset' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'offset' ) ); ?>" type="number" step="1" min="0" value="<?php echo (int) ( $instance['offset'] ); ?>" />
191
+ <small><?php esc_attr_e( 'The number of posts to skip', 'recent-posts-widget-extended' ); ?></small>
192
+ </p>
193
+ </div>
194
+
195
+ <div id="tab3" class="rpwe-tab-content">
196
+ <?php if ( current_theme_supports( 'post-thumbnails' ) ) { ?>
197
+
198
+ <p>
199
+ <input id="<?php echo esc_attr( $this->get_field_id( 'thumb' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'thumb' ) ); ?>" type="checkbox" <?php checked( $instance['thumb'] ); ?> />
200
+ <label for="<?php echo esc_attr( $this->get_field_id( 'thumb' ) ); ?>">
201
+ <?php esc_attr_e( 'Display Thumbnail', 'recent-posts-widget-extended' ); ?>
202
+ </label>
203
+ </p>
204
+
205
+ <p>
206
+ <label class="rpwe-block" for="<?php echo esc_attr( $this->get_field_id( 'thumb_height' ) ); ?>">
207
+ <?php esc_attr_e( 'Thumbnail (height,width,align)', 'recent-posts-widget-extended' ); ?>
208
+ </label>
209
+
210
+ <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="number" step="1" min="0" value="<?php echo (int) ( $instance['thumb_height'] ); ?>" />
211
+
212
+ <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="number" step="1" min="0" value="<?php echo (int) ( $instance['thumb_width'] ); ?>" />
213
+
214
+ <select class="small-input" id="<?php echo esc_attr( $this->get_field_id( 'thumb_align' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'thumb_align' ) ); ?>">
215
+ <option value="rpwe-alignleft" <?php selected( $instance['thumb_align'], 'rpwe-alignleft' ); ?>><?php esc_attr_e( 'Left', 'recent-posts-widget-extended' ); ?></option>
216
+ <option value="rpwe-alignright" <?php selected( $instance['thumb_align'], 'rpwe-alignright' ); ?>><?php esc_attr_e( 'Right', 'recent-posts-widget-extended' ); ?></option>
217
+ <option value="rpwe-aligncenter" <?php selected( $instance['thumb_align'], 'rpwe-aligncenter' ); ?>><?php esc_attr_e( 'Center', 'recent-posts-widget-extended' ); ?></option>
218
+ </select>
219
+ </p>
220
+
221
+ <p>
222
+ <label for="<?php echo esc_attr( $this->get_field_id( 'thumb_default' ) ); ?>">
223
+ <?php esc_attr_e( 'Default Thumbnail', 'recent-posts-widget-extended' ); ?>
224
+ </label>
225
+ <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'thumb_default' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'thumb_default' ) ); ?>" type="text" value="<?php echo esc_url( $instance['thumb_default'] ); ?>" />
226
+ <small><?php esc_attr_e( 'Leave it blank to disable.', 'recent-posts-widget-extended' ); ?></small>
227
+ </p>
228
+
229
+ <?php } ?>
230
+ </div>
231
+
232
+ <div id="tab4" class="rpwe-tab-content">
233
+ <p>
234
+ <input id="<?php echo esc_attr( $this->get_field_id( 'excerpt' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'excerpt' ) ); ?>" type="checkbox" <?php checked( $instance['excerpt'] ); ?> />
235
+ <label for="<?php echo esc_attr( $this->get_field_id( 'excerpt' ) ); ?>">
236
+ <?php esc_attr_e( 'Display Excerpt', 'recent-posts-widget-extended' ); ?>
237
+ </label>
238
+ </p>
239
+
240
+ <p>
241
+ <label for="<?php echo esc_attr( $this->get_field_id( 'length' ) ); ?>">
242
+ <?php esc_attr_e( 'Excerpt Length', 'recent-posts-widget-extended' ); ?>
243
+ </label>
244
+ <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'length' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'length' ) ); ?>" type="number" step="1" min="0" value="<?php echo (int) ( $instance['length'] ); ?>" />
245
+ </p>
246
+
247
+ <p>
248
+ <input id="<?php echo esc_attr( $this->get_field_id( 'readmore' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'readmore' ) ); ?>" type="checkbox" <?php checked( $instance['readmore'] ); ?> />
249
+ <label for="<?php echo esc_attr( $this->get_field_id( 'readmore' ) ); ?>">
250
+ <?php esc_attr_e( 'Display Readmore', 'recent-posts-widget-extended' ); ?>
251
+ </label>
252
+ </p>
253
+
254
+ <p>
255
+ <label for="<?php echo esc_attr( $this->get_field_id( 'readmore_text' ) ); ?>">
256
+ <?php esc_attr_e( 'Readmore Text', 'recent-posts-widget-extended' ); ?>
257
+ </label>
258
+ <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'readmore_text' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'readmore_text' ) ); ?>" type="text" value="<?php echo esc_attr( $instance['readmore_text'] ); ?>" />
259
+ </p>
260
+ </div>
261
+
262
+ <div id="tab5" class="rpwe-tab-content">
263
+ <p>
264
+ <input id="<?php echo esc_attr( $this->get_field_id( 'post_title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'post_title' ) ); ?>" type="checkbox" <?php checked( $instance['post_title'] ); ?> />
265
+ <label for="<?php echo esc_attr( $this->get_field_id( 'post_title' ) ); ?>">
266
+ <?php esc_attr_e( 'Display post title', 'recent-posts-widget-extended' ); ?>
267
+ </label>
268
+ </p>
269
+ <p>
270
+ <input id="<?php echo esc_attr( $this->get_field_id( 'comment_count' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'comment_count' ) ); ?>" type="checkbox" <?php checked( $instance['comment_count'] ); ?> />
271
+ <label for="<?php echo esc_attr( $this->get_field_id( 'comment_count' ) ); ?>">
272
+ <?php esc_attr_e( 'Display comment count', 'recent-posts-widget-extended' ); ?>
273
+ </label>
274
+ </p>
275
+
276
+ <p>
277
+ <input id="<?php echo esc_attr( $this->get_field_id( 'date' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'date' ) ); ?>" type="checkbox" <?php checked( $instance['date'] ); ?> />
278
+ <label for="<?php echo esc_attr( $this->get_field_id( 'date' ) ); ?>">
279
+ <?php esc_attr_e( 'Display date', 'recent-posts-widget-extended' ); ?>
280
+ </label>
281
+ </p>
282
+
283
+ <p>
284
+ <input id="<?php echo esc_attr( $this->get_field_id( 'date_modified' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'date_modified' ) ); ?>" type="checkbox" <?php checked( $instance['date_modified'] ); ?> />
285
+ <label for="<?php echo esc_attr( $this->get_field_id( 'date_modified' ) ); ?>">
286
+ <?php esc_attr_e( 'Use a modification date', 'recent-posts-widget-extended' ); ?>
287
+ </label>
288
+ </p>
289
+
290
+ <p>
291
+ <input id="<?php echo esc_attr( $this->get_field_id( 'date_relative' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'date_relative' ) ); ?>" type="checkbox" <?php checked( $instance['date_relative'] ); ?> />
292
+ <label for="<?php echo esc_attr( $this->get_field_id( 'date_relative' ) ); ?>">
293
+ <?php esc_attr_e( 'Use relative date. eg: 5 days ago', 'recent-posts-widget-extended' ); ?>
294
+ </label>
295
+ </p>
296
+
297
+ <p>
298
+ <input id="<?php echo esc_attr( $this->get_field_id( 'link_target' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'link_target' ) ); ?>" type="checkbox" <?php checked( $instance['link_target'] ); ?> />
299
+ <label for="<?php echo esc_attr( $this->get_field_id( 'link_target' ) ); ?>">
300
+ <?php esc_attr_e( 'Open links in new tab', 'recent-posts-widget-extended' ); ?>
301
+ </label>
302
+ </p>
303
+ </div>
304
+
305
+ <div id="tab6" class="rpwe-tab-content">
306
+ <p>
307
+ <input id="<?php echo esc_attr( $this->get_field_id( 'styles_default' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'styles_default' ) ); ?>" type="checkbox" <?php checked( $instance['styles_default'] ); ?> />
308
+ <label for="<?php echo esc_attr( $this->get_field_id( 'styles_default' ) ); ?>">
309
+ <?php esc_attr_e( 'Use Default Styles', 'recent-posts-widget-extended' ); ?>
310
+ </label>
311
+ </p>
312
+
313
+ <p>
314
+ <label for="<?php echo esc_attr( $this->get_field_id( 'css' ) ); ?>">
315
+ <?php esc_attr_e( 'Custom CSS', 'recent-posts-widget-extended' ); ?>
316
+ </label>
317
+ <textarea class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'css' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'css' ) ); ?>" style="height:180px;" readonly><?php echo esc_attr( $instance['css'] ); ?></textarea>
318
+ <small><?php esc_attr_e( 'Custom CSS is no longer editable, please copy and paste your custom CSS to', 'recent-posts-widget-extended' ); ?></small>
319
+ <small>
320
+ <?php
321
+ printf(
322
+ '<a href="%1$s">%2$s</a>.',
323
+ esc_url(
324
+ add_query_arg(
325
+ array(
326
+ array( 'autofocus' => array( 'section' => 'custom_css' ) ),
327
+ 'return' => rawurlencode( remove_query_arg( wp_removable_query_args(), wp_unslash( $_SERVER['REQUEST_URI'] ) ) ),
328
+ ),
329
+ admin_url( 'customize.php' )
330
+ )
331
+ ),
332
+ __( 'Additional CSS panel' )
333
+ );
334
+ ?>
335
+ </small>
336
+ </p>
337
+ </div>
338
+
339
+ </div>
340
+ </div>
341
+ </div>
includes/functions.php CHANGED
@@ -1,384 +1,183 @@
1
- <?php
2
-
3
- /**
4
- * Various functions used by the plugin.
5
- */
6
-
7
- /**
8
- * Sets up the default arguments.
9
- *
10
- * @since 0.9.4
11
- */
12
- function rpwe_get_default_args() {
13
-
14
- $css_defaults = ".rpwe-block ul{\nlist-style: none !important;\nmargin-left: 0 !important;\npadding-left: 0 !important;\n}\n\n.rpwe-block li{\nborder-bottom: 1px solid #eee;\nmargin-bottom: 10px;\npadding-bottom: 10px;\nlist-style-type: none;\n}\n\n.rpwe-block a{\ndisplay: inline !important;\ntext-decoration: none;\n}\n\n.rpwe-block h3{\nbackground: none !important;\nclear: none;\nmargin-bottom: 0 !important;\nmargin-top: 0 !important;\nfont-weight: 400;\nfont-size: 12px !important;\nline-height: 1.5em;\n}\n\n.rpwe-thumb{\nborder: 1px solid #eee !important;\nbox-shadow: none !important;\nmargin: 2px 10px 2px 0;\npadding: 3px !important;\n}\n\n.rpwe-summary{\nfont-size: 12px;\n}\n\n.rpwe-time{\ncolor: #bbb;\nfont-size: 11px;\n}\n\n.rpwe-comment{\ncolor: #bbb;\nfont-size: 11px;\npadding-left: 5px;\n}\n\n.rpwe-alignleft{\ndisplay: inline;\nfloat: left;\n}\n\n.rpwe-alignright{\ndisplay: inline;\nfloat: right;\n}\n\n.rpwe-aligncenter{\ndisplay: block;\nmargin-left: auto;\nmargin-right: auto;\n}\n\n.rpwe-clearfix:before,\n.rpwe-clearfix:after{\ncontent: \"\";\ndisplay: table !important;\n}\n\n.rpwe-clearfix:after{\nclear: both;\n}\n\n.rpwe-clearfix{\nzoom: 1;\n}\n";
15
-
16
- $defaults = array(
17
- 'title' => esc_attr__('Recent Posts', 'rpwe'),
18
- 'title_url' => '',
19
-
20
- 'limit' => 5,
21
- 'offset' => 0,
22
- 'order' => 'DESC',
23
- 'orderby' => 'date',
24
- 'cat' => array(),
25
- 'tag' => array(),
26
- 'taxonomy' => '',
27
- 'post_type' => array('post'),
28
- 'post_status' => 'publish',
29
- 'ignore_sticky' => 1,
30
- 'exclude_current' => 1,
31
-
32
- 'excerpt' => false,
33
- 'length' => 10,
34
- 'thumb' => true,
35
- 'thumb_height' => 45,
36
- 'thumb_width' => 45,
37
- 'thumb_default' => 'http://placehold.it/45x45/f0f0f0/ccc',
38
- 'thumb_align' => 'rpwe-alignleft',
39
- 'date' => true,
40
- 'date_relative' => false,
41
- 'date_modified' => false,
42
- 'readmore' => false,
43
- 'readmore_text' => __('Read More &raquo;', 'recent-posts-widget-extended'),
44
- 'comment_count' => false,
45
-
46
- 'styles_default' => true,
47
- 'css' => $css_defaults,
48
- 'cssID' => '',
49
- 'css_class' => '',
50
- 'before' => '',
51
- 'after' => ''
52
- );
53
-
54
- // Allow plugins/themes developer to filter the default arguments.
55
- return apply_filters('rpwe_default_args', $defaults);
56
- }
57
-
58
- /**
59
- * Outputs the recent posts.
60
- *
61
- * @since 0.9.4
62
- */
63
- function rpwe_recent_posts($args = array()) {
64
- echo rpwe_get_recent_posts($args);
65
- }
66
-
67
- /**
68
- * Generates the posts markup.
69
- *
70
- * @since 0.9.4
71
- * @param array $args
72
- * @return string|array The HTML for the random posts.
73
- */
74
- function rpwe_get_recent_posts($args = array()) {
75
-
76
- // Set up a default, empty variable.
77
- $html = '';
78
-
79
- // Merge the input arguments and the defaults.
80
- $args = wp_parse_args($args, rpwe_get_default_args());
81
-
82
- // Extract the array to allow easy use of variables.
83
- extract($args);
84
-
85
- // Allow devs to hook in stuff before the loop.
86
- do_action('rpwe_before_loop');
87
-
88
- // Display the default style of the plugin.
89
- if ($args['styles_default'] === true) {
90
- rpwe_custom_styles();
91
- }
92
-
93
- // If the default style is disabled then use the custom css if it's not empty.
94
- if ($args['styles_default'] === false && !empty($args['css'])) {
95
- echo '<style>' . $args['css'] . '</style>';
96
- }
97
-
98
- // Get the posts query.
99
- $posts = rpwe_get_posts($args);
100
-
101
- if ($posts->have_posts()) :
102
-
103
- // Recent posts wrapper
104
- $html = '<div ' . (!empty($args['cssID']) ? 'id="' . sanitize_html_class($args['cssID']) . '"' : '') . ' class="rpwe-block ' . (!empty($args['css_class']) ? '' . sanitize_html_class($args['css_class']) . '' : '') . '">';
105
-
106
- $html .= '<ul class="rpwe-ul">';
107
-
108
- while ($posts->have_posts()) : $posts->the_post();
109
-
110
- // Thumbnails
111
- $thumb_id = get_post_thumbnail_id(); // Get the featured image id.
112
- $img_url = wp_get_attachment_url($thumb_id); // Get img URL.
113
-
114
- // Display the image url and crop using the resizer.
115
- $image = rpwe_resize($img_url, $args['thumb_width'], $args['thumb_height'], true);
116
-
117
- // Start recent posts markup.
118
- $html .= '<li class="rpwe-li rpwe-clearfix">';
119
-
120
- if ($args['thumb']) :
121
-
122
- // Check if post has post thumbnail.
123
- if (has_post_thumbnail()) :
124
- $html .= '<a class="rpwe-img" href="' . esc_url(get_permalink()) . '">';
125
- if ($image) :
126
- $html .= '<img class="' . esc_attr($args['thumb_align']) . ' rpwe-thumb" src="' . esc_url($image) . '" alt="' . esc_attr(get_the_title()) . '" height="' . absint($args['thumb_height']) . '" width="' . absint($args['thumb_width']) . '">';
127
- else :
128
- $html .= get_the_post_thumbnail(
129
- get_the_ID(),
130
- array($args['thumb_width'], $args['thumb_height']),
131
- array(
132
- 'class' => $args['thumb_align'] . ' rpwe-thumb the-post-thumbnail',
133
- 'alt' => esc_attr(get_the_title())
134
- )
135
- );
136
- endif;
137
- $html .= '</a>';
138
-
139
- // If no post thumbnail found, check if Get The Image plugin exist and display the image.
140
- elseif (function_exists('get_the_image')) :
141
- $html .= get_the_image(array(
142
- 'height' => (int) $args['thumb_height'],
143
- 'width' => (int) $args['thumb_width'],
144
- 'image_class' => esc_attr($args['thumb_align']) . ' rpwe-thumb get-the-image',
145
- 'image_scan' => true,
146
- 'echo' => false,
147
- 'default_image' => esc_url($args['thumb_default'])
148
- ));
149
-
150
- // Display default image.
151
- elseif (!empty($args['thumb_default'])) :
152
- $html .= sprintf(
153
- '<a class="rpwe-img" href="%1$s" rel="bookmark"><img class="%2$s rpwe-thumb rpwe-default-thumb" src="%3$s" alt="%4$s" width="%5$s" height="%6$s"></a>',
154
- esc_url(get_permalink()),
155
- esc_attr($args['thumb_align']),
156
- esc_url($args['thumb_default']),
157
- esc_attr(get_the_title()),
158
- (int) $args['thumb_width'],
159
- (int) $args['thumb_height']
160
- );
161
-
162
- endif;
163
-
164
- endif;
165
-
166
- $html .= '<h3 class="rpwe-title"><a href="' . esc_url(get_permalink()) . '" title="' . sprintf(esc_attr__('Permalink to %s', 'recent-posts-widget-extended'), the_title_attribute('echo=0')) . '" rel="bookmark">' . esc_attr(get_the_title()) . '</a></h3>';
167
-
168
- if ($args['date']) :
169
- $date = get_the_date();
170
- if ($args['date_relative']) :
171
- $date = sprintf(__('%s ago', 'recent-posts-widget-extended'), human_time_diff(get_the_date('U'), current_time('timestamp')));
172
- endif;
173
- $html .= '<time class="rpwe-time published" datetime="' . esc_html(get_the_date('c')) . '">' . esc_html($date) . '</time>';
174
- elseif ($args['date_modified']) : // if both date functions are provided, we use date to be backwards compatible
175
- $date = get_the_modified_date();
176
- if ($args['date_relative']) :
177
- $date = sprintf(__('%s ago', 'recent-posts-widget-extended'), human_time_diff(get_the_modified_date('U'), current_time('timestamp')));
178
- endif;
179
- $html .= '<time class="rpwe-time modfied" datetime="' . esc_html(get_the_modified_date('c')) . '">' . esc_html($date) . '</time>';
180
- endif;
181
-
182
- if ($args['comment_count']) :
183
- if (get_comments_number() == 0) {
184
- $comments = __('No Comments', 'recent-posts-widget-extended');
185
- } elseif (get_comments_number() > 1) {
186
- $comments = sprintf(__('%s Comments', 'recent-posts-widget-extended'), get_comments_number());
187
- } else {
188
- $comments = __('1 Comment', 'recent-posts-widget-extended');
189
- }
190
- $html .= '<a class="rpwe-comment comment-count" href="' . get_comments_link() . '">' . $comments . '</a>';
191
- endif;
192
-
193
- if ($args['excerpt']) :
194
- $html .= '<div class="rpwe-summary">';
195
- $html .= wp_trim_words(apply_filters('rpwe_excerpt', get_the_excerpt()), $args['length'], ' &hellip;');
196
- if ($args['readmore']) :
197
- $html .= '<a href="' . esc_url(get_permalink()) . '" class="more-link">' . $args['readmore_text'] . '</a>';
198
- endif;
199
- $html .= '</div>';
200
- endif;
201
-
202
- $html .= '</li>';
203
-
204
- endwhile;
205
-
206
- $html .= '</ul>';
207
-
208
- $html .= '</div><!-- Generated by http://wordpress.org/plugins/recent-posts-widget-extended/ -->';
209
-
210
- endif;
211
-
212
- // Restore original Post Data.
213
- wp_reset_postdata();
214
-
215
- // Allow devs to hook in stuff after the loop.
216
- do_action('rpwe_after_loop');
217
-
218
- // Return the posts markup.
219
- return wp_kses_post($args['before']) . apply_filters('rpwe_markup', $html, $args) . wp_kses_post($args['after']);
220
- }
221
-
222
- /**
223
- * The posts query.
224
- *
225
- * @since 0.0.1
226
- * @param array $args
227
- * @return array
228
- */
229
- function rpwe_get_posts($args = array()) {
230
-
231
- // Query arguments.
232
- $query = array(
233
- 'offset' => $args['offset'],
234
- 'posts_per_page' => $args['limit'],
235
- 'orderby' => $args['orderby'],
236
- 'order' => $args['order'],
237
- 'post_type' => $args['post_type'],
238
- 'post_status' => $args['post_status'],
239
- 'ignore_sticky_posts' => $args['ignore_sticky'],
240
- );
241
-
242
- // Exclude current post
243
- if ($args['exclude_current']) {
244
- $query['post__not_in'] = array(get_the_ID());
245
- }
246
-
247
- // Limit posts based on category.
248
- if (!empty($args['cat'])) {
249
- $query['category__in'] = $args['cat'];
250
- }
251
-
252
- // Limit posts based on post tag.
253
- if (!empty($args['tag'])) {
254
- $query['tag__in'] = $args['tag'];
255
- }
256
-
257
- /**
258
- * Taxonomy query.
259
- * Prop Miniloop plugin by Kailey Lampert.
260
- */
261
- if (!empty($args['taxonomy'])) {
262
-
263
- parse_str($args['taxonomy'], $taxes);
264
-
265
- $operator = 'IN';
266
- $tax_query = array();
267
- foreach (array_keys($taxes) as $k => $slug) {
268
- $ids = explode(',', $taxes[$slug]);
269
- if (count($ids) == 1 && $ids['0'] < 0) {
270
- // If there is only one id given, and it's negative
271
- // Let's treat it as 'posts not in'
272
- $ids['0'] = $ids['0'] * -1;
273
- $operator = 'NOT IN';
274
- }
275
- $tax_query[] = array(
276
- 'taxonomy' => $slug,
277
- 'field' => 'id',
278
- 'terms' => $ids,
279
- 'operator' => $operator
280
- );
281
- }
282
-
283
- $query['tax_query'] = $tax_query;
284
- }
285
-
286
- // Allow plugins/themes developer to filter the default query.
287
- $query = apply_filters('rpwe_default_query_arguments', $query);
288
-
289
- // Perform the query.
290
- $posts = new WP_Query($query);
291
-
292
- return $posts;
293
- }
294
-
295
- /**
296
- * Custom Styles.
297
- *
298
- * @since 0.8
299
- */
300
- function rpwe_custom_styles() {
301
- ?>
302
- <style>
303
- .rpwe-block ul {
304
- list-style: none !important;
305
- margin-left: 0 !important;
306
- padding-left: 0 !important;
307
- }
308
-
309
- .rpwe-block li {
310
- border-bottom: 1px solid #eee;
311
- margin-bottom: 10px;
312
- padding-bottom: 10px;
313
- list-style-type: none;
314
- }
315
-
316
- .rpwe-block a {
317
- display: inline !important;
318
- text-decoration: none;
319
- }
320
-
321
- .rpwe-block h3 {
322
- background: none !important;
323
- clear: none;
324
- margin-bottom: 0 !important;
325
- margin-top: 0 !important;
326
- font-weight: 400;
327
- font-size: 12px !important;
328
- line-height: 1.5em;
329
- }
330
-
331
- .rpwe-thumb {
332
- border: 1px solid #EEE !important;
333
- box-shadow: none !important;
334
- margin: 2px 10px 2px 0;
335
- padding: 3px !important;
336
- }
337
-
338
- .rpwe-summary {
339
- font-size: 12px;
340
- }
341
-
342
- .rpwe-time {
343
- color: #bbb;
344
- font-size: 11px;
345
- }
346
-
347
- .rpwe-comment {
348
- color: #bbb;
349
- font-size: 11px;
350
- padding-left: 5px;
351
- }
352
-
353
- .rpwe-alignleft {
354
- display: inline;
355
- float: left;
356
- }
357
-
358
- .rpwe-alignright {
359
- display: inline;
360
- float: right;
361
- }
362
-
363
- .rpwe-aligncenter {
364
- display: block;
365
- margin-left: auto;
366
- margin-right: auto;
367
- }
368
-
369
- .rpwe-clearfix:before,
370
- .rpwe-clearfix:after {
371
- content: "";
372
- display: table !important;
373
- }
374
-
375
- .rpwe-clearfix:after {
376
- clear: both;
377
- }
378
-
379
- .rpwe-clearfix {
380
- zoom: 1;
381
- }
382
- </style>
383
- <?php
384
- }
1
+ <?php
2
+ /**
3
+ * Various functions used by the plugin.
4
+ *
5
+ * @package Recent Posts Extended
6
+ */
7
+
8
+ /**
9
+ * Function to display the recent posts.
10
+ *
11
+ * @param array $args the arguments.
12
+ * @return void
13
+ */
14
+ function rpwe_recent_posts( $args = array() ) {
15
+ echo wp_kses_post( rpwe_get_recent_posts( $args ) );
16
+ }
17
+
18
+ /**
19
+ * Generates the posts markup.
20
+ *
21
+ * @param array $args the arguments.
22
+ * @return string|array The HTML for the posts.
23
+ */
24
+ function rpwe_get_recent_posts( $args = array() ) {
25
+
26
+ // Set up a default, empty variable.
27
+ $html = '';
28
+
29
+ // Merge the input arguments and the defaults.
30
+ $args = wp_parse_args( $args, rpwe_get_default_args() );
31
+
32
+ // Allow devs to hook in stuff before the loop.
33
+ do_action( 'rpwe_before_loop' );
34
+
35
+ // Get the posts query.
36
+ $posts = rpwe_get_posts( $args );
37
+
38
+ if ( $posts->have_posts() ) {
39
+
40
+ // Link target.
41
+ $link_target = $args['link_target'] ? '_blank' : '_self';
42
+
43
+ // Recent posts wrapper.
44
+ $wrapper_id = $args['css_id'] ? ' id="' . esc_attr( $args['css_id'] ) . '"' : '';
45
+ $wrapper_class = $args['css_class'] ? ' class="rpwe-block ' . esc_attr( $args['css_class'] ) . '"' : ' class="rpwe-block"';
46
+ $html .= '<div ' . $wrapper_id . $wrapper_class . '>';
47
+
48
+ // Text or HTML before the posts.
49
+ $html .= apply_filters( 'rpwe_before', wp_kses_post( $args['before'] ) );
50
+
51
+ // List wrapper.
52
+ $html .= '<ul class="rpwe-ul">';
53
+
54
+ // Start the query.
55
+ while ( $posts->have_posts() ) {
56
+ $posts->the_post();
57
+
58
+ // Start recent posts markup.
59
+ $html .= '<li class="rpwe-li rpwe-clearfix">';
60
+
61
+ if ( $args['thumb'] ) {
62
+
63
+ // Thumbnails.
64
+ $thumb_id = get_post_thumbnail_id(); // Get the featured image id.
65
+ $img_url = wp_get_attachment_url( $thumb_id ); // Get img URL.
66
+ $image = rpwe_image_resize( $img_url, $args['thumb_width'], $args['thumb_height'], true ); // Rezize image on the fly.
67
+
68
+ // Check if post has post thumbnail.
69
+ if ( has_post_thumbnail() ) {
70
+
71
+ // Thumbnail link.
72
+ $html .= '<a class="rpwe-img" href="' . esc_url( get_permalink() ) . '" target="' . $link_target . '">';
73
+
74
+ // Display the image.
75
+ if ( $image ) {
76
+ $html .= '<img class="' . esc_attr( $args['thumb_align'] ) . ' rpwe-thumb" src="' . esc_url( $image ) . '" alt="' . esc_attr( get_the_title() ) . '" height="' . absint( $args['thumb_height'] ) . '" width="' . absint( $args['thumb_width'] ) . '" loading="lazy" decoding="async">';
77
+ } else {
78
+ $html .= get_the_post_thumbnail(
79
+ get_the_ID(),
80
+ array( $args['thumb_width'], $args['thumb_height'] ),
81
+ array(
82
+ 'class' => $args['thumb_align'] . ' rpwe-thumb the-post-thumbnail',
83
+ 'alt' => esc_attr( get_the_title() ),
84
+ )
85
+ );
86
+ }
87
+
88
+ // Thumbnail link close.
89
+ $html .= '</a>';
90
+
91
+ // If no post thumbnail found, check if Get The Image plugin exist and display the image.
92
+ } elseif ( function_exists( 'get_the_image' ) ) {
93
+ $html .= get_the_image(
94
+ array(
95
+ 'height' => (int) $args['thumb_height'],
96
+ 'width' => (int) $args['thumb_width'],
97
+ 'image_class' => esc_attr( $args['thumb_align'] ) . ' rpwe-thumb get-the-image',
98
+ 'image_scan' => true,
99
+ 'echo' => false,
100
+ 'default_image' => esc_url( $args['thumb_default'] ),
101
+ )
102
+ );
103
+
104
+ // Display default image.
105
+ } elseif ( ! empty( $args['thumb_default'] ) ) {
106
+ $html .= sprintf(
107
+ '<a class="rpwe-img" href="%1$s" rel="bookmark"><img class="%2$s rpwe-thumb rpwe-default-thumb" src="%3$s" alt="%4$s" width="%5$s" height="%6$s"></a>',
108
+ esc_url( get_permalink() ),
109
+ esc_attr( $args['thumb_align'] ),
110
+ esc_url( $args['thumb_default'] ),
111
+ esc_attr( get_the_title() ),
112
+ (int) $args['thumb_width'],
113
+ (int) $args['thumb_height']
114
+ );
115
+
116
+ }
117
+ }
118
+
119
+ // The title.
120
+ if ( $args['post_title'] ) {
121
+ $html .= apply_filters( 'rpwe_post_title_wrap_open', '<h3 class="rpwe-title">' );
122
+ $html .= '<a href="' . esc_url( get_permalink() ) . '" target="' . $link_target . '">' . esc_attr( get_the_title() ) . '</a>';
123
+ $html .= apply_filters( 'rpwe_post_title_wrap_close', '</h3>' );
124
+ }
125
+
126
+ if ( $args['date'] ) {
127
+ $date = get_the_date();
128
+ if ( $args['date_relative'] ) {
129
+ /* translators: %s: current time */
130
+ $date = sprintf( __( '%s ago', 'recent-posts-widget-extended' ), human_time_diff( get_the_date( 'U' ), strtotime( wp_date( 'Y-m-d H:i:s' ) ) ) );
131
+ }
132
+ $html .= '<time class="rpwe-time published" datetime="' . esc_html( get_the_date( 'c' ) ) . '">' . esc_html( $date ) . '</time>';
133
+ } elseif ( $args['date_modified'] ) { // if both date functions are provided, we use date to be backwards compatible.
134
+ $date = get_the_modified_date();
135
+ if ( $args['date_relative'] ) {
136
+ /* translators: %s: current time */
137
+ $date = sprintf( __( '%s ago', 'recent-posts-widget-extended' ), human_time_diff( get_the_modified_date( 'U' ), strtotime( wp_date( 'Y-m-d H:i:s' ) ) ) );
138
+ }
139
+ $html .= '<time class="rpwe-time modfied" datetime="' . esc_html( get_the_modified_date( 'c' ) ) . '">' . esc_html( $date ) . '</time>';
140
+ }
141
+
142
+ if ( $args['comment_count'] ) {
143
+ if ( get_comments_number() === 0 ) {
144
+ $comments = __( 'No Comments', 'recent-posts-widget-extended' );
145
+ } elseif ( get_comments_number() > 1 ) {
146
+ /* translators: %s: comment count */
147
+ $comments = sprintf( __( '%s Comments', 'recent-posts-widget-extended' ), get_comments_number() );
148
+ } else {
149
+ $comments = __( '1 Comment', 'recent-posts-widget-extended' );
150
+ }
151
+ $html .= '<a class="rpwe-comment comment-count" href="' . get_comments_link() . '">' . $comments . '</a>';
152
+ }
153
+
154
+ if ( $args['excerpt'] ) {
155
+ $html .= '<div class="rpwe-summary">';
156
+ $html .= wp_trim_words( apply_filters( 'rpwe_excerpt', get_the_excerpt() ), $args['length'], ' &hellip;' );
157
+ if ( $args['readmore'] ) {
158
+ $html .= '<a href="' . esc_url( get_permalink() ) . '" class="more-link">' . $args['readmore_text'] . '</a>';
159
+ }
160
+ $html .= '</div>';
161
+ }
162
+
163
+ $html .= '</li>';
164
+
165
+ }
166
+
167
+ $html .= '</ul>';
168
+
169
+ $html .= apply_filters( 'rpwe_after', wp_kses_post( $args['after'] ) );
170
+
171
+ $html .= '</div><!-- Generated by http://wordpress.org/plugins/recent-posts-widget-extended/ -->';
172
+
173
+ }
174
+
175
+ // Restore original Post Data.
176
+ wp_reset_postdata();
177
+
178
+ // Allow devs to hook in stuff after the loop.
179
+ do_action( 'rpwe_after_loop' );
180
+
181
+ // Return the posts markup.
182
+ return apply_filters( 'rpwe_markup', $html, $args );
183
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/helpers.php CHANGED
@@ -1,47 +1,59 @@
1
- <?php
2
-
3
- /**
4
- * Function helper
5
- */
6
-
7
- /**
8
- * Display list of tags for widget.
9
- *
10
- * @since 0.9.9.1
11
- */
12
- function rpwe_tags_list() {
13
-
14
- // Arguments
15
- $args = array(
16
- 'number' => 99
17
- );
18
-
19
- // Allow dev to filter the arguments
20
- $args = apply_filters('rpwe_tags_list_args', $args);
21
-
22
- // Get the tags
23
- $tags = get_terms('post_tag', $args);
24
-
25
- return $tags;
26
- }
27
-
28
- /**
29
- * Display list of categories for widget.
30
- *
31
- * @since 0.9.9.1
32
- */
33
- function rpwe_cats_list() {
34
-
35
- // Arguments
36
- $args = array(
37
- 'number' => 99
38
- );
39
-
40
- // Allow dev to filter the arguments
41
- $args = apply_filters('rpwe_cats_list_args', $args);
42
-
43
- // Get the cats
44
- $cats = get_terms('category', $args);
45
-
46
- return $cats;
47
- }
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Function helper
4
+ *
5
+ * @package Recent Posts Extended
6
+ */
7
+
8
+ /**
9
+ * Display list of tags for widget.
10
+ */
11
+ function rpwe_tags_list() {
12
+
13
+ // Arguments.
14
+ $args = array(
15
+ 'number' => 99,
16
+ );
17
+
18
+ // Allow dev to filter the arguments.
19
+ $args = apply_filters( 'rpwe_tags_list_args', $args );
20
+
21
+ // Get the tags.
22
+ $tags = get_terms( 'post_tag', $args );
23
+
24
+ return $tags;
25
+ }
26
+
27
+ /**
28
+ * Display list of categories for widget.
29
+ */
30
+ function rpwe_cats_list() {
31
+
32
+ // Arguments.
33
+ $args = array(
34
+ 'number' => 99,
35
+ );
36
+
37
+ // Allow dev to filter the arguments.
38
+ $args = apply_filters( 'rpwe_cats_list_args', $args );
39
+
40
+ // Get the cats.
41
+ $cats = get_terms( 'category', $args );
42
+
43
+ return $cats;
44
+ }
45
+
46
+ /**
47
+ * Validate boolean value
48
+ *
49
+ * @param string $input User input.
50
+ * @return bool
51
+ */
52
+ function rpwe_string_to_boolean( $input ) {
53
+ $allowed_strings = array( '0', '1', 'true', 'false' );
54
+ if ( in_array( $input, $allowed_strings, true ) ) {
55
+ return filter_var( $input, FILTER_VALIDATE_BOOLEAN );
56
+ } else {
57
+ return false;
58
+ }
59
+ }
includes/query.php ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * The query
4
+ *
5
+ * @package Recent Posts Extended
6
+ */
7
+
8
+ /**
9
+ * The posts query.
10
+ *
11
+ * @param array $args the arguments.
12
+ * @return object
13
+ */
14
+ function rpwe_get_posts( $args = array() ) {
15
+
16
+ // Query arguments.
17
+ $query = array(
18
+ 'offset' => $args['offset'],
19
+ 'posts_per_page' => $args['limit'],
20
+ 'orderby' => $args['orderby'],
21
+ 'order' => $args['order'],
22
+ 'post_type' => $args['post_type'],
23
+ 'post_status' => $args['post_status'],
24
+ 'ignore_sticky_posts' => $args['ignore_sticky'],
25
+ );
26
+
27
+ // Exclude current post.
28
+ if ( $args['exclude_current'] ) {
29
+ $query['post__not_in'] = array( get_the_ID() );
30
+ }
31
+
32
+ // Limit posts based on category.
33
+ if ( ! empty( $args['cat'] ) ) {
34
+ $query['category__in'] = $args['cat'];
35
+ }
36
+
37
+ // Limit posts based on post tag.
38
+ if ( ! empty( $args['tag'] ) ) {
39
+ $query['tag__in'] = $args['tag'];
40
+ }
41
+
42
+ /**
43
+ * Taxonomy query.
44
+ * Prop Miniloop plugin by Kailey Lampert.
45
+ */
46
+ if ( ! empty( $args['taxonomy'] ) ) {
47
+
48
+ parse_str( $args['taxonomy'], $taxes );
49
+
50
+ $operator = 'IN';
51
+ $tax_query = array();
52
+ foreach ( array_keys( $taxes ) as $k => $slug ) {
53
+ $ids = explode( ',', $taxes[ $slug ] );
54
+ if ( count( $ids ) === 1 && $ids['0'] < 0 ) {
55
+ // If there is only one id given, and it's negative
56
+ // Let's treat it as 'posts not in'.
57
+ $ids['0'] = $ids['0'] * -1;
58
+ $operator = 'NOT IN';
59
+ }
60
+ $tax_query[] = array(
61
+ 'taxonomy' => $slug,
62
+ 'field' => 'id',
63
+ 'terms' => $ids,
64
+ 'operator' => $operator,
65
+ );
66
+ }
67
+
68
+ $query['tax_query'] = $tax_query; // phpcs:ignore Standard.Category.SniffName.ErrorCode: slow query ok.
69
+ }
70
+
71
+ // Allow plugins/themes developer to filter the default query.
72
+ $query = apply_filters( 'rpwe_default_query_arguments', $query );
73
+
74
+ // Perform the query.
75
+ $posts = new WP_Query( $query );
76
+
77
+ return $posts;
78
+ }
includes/resizer.php DELETED
@@ -1,207 +0,0 @@
1
- <?php
2
-
3
- /**
4
- * Title : Aqua Resizer
5
- * Description : Resizes WordPress images on the fly
6
- * Version : 1.2.0
7
- * Author : Syamil MJ
8
- * Author URI : http://aquagraphite.com
9
- * License : WTFPL - http://sam.zoy.org/wtfpl/
10
- * Documentation : https://github.com/sy4mil/Aqua-Resizer/
11
- *
12
- * I changed the function and class name for compatibility purpose. It somtimes conflicted with a theme which uses the same library.
13
- *
14
- * @param string $url - (required) must be uploaded using wp media uploader
15
- * @param int $width - (required)
16
- * @param int $height - (optional)
17
- * @param bool $crop - (optional) default to soft crop
18
- * @param bool $single - (optional) returns an array if false
19
- * @param bool $upscale - (optional) resizes smaller images
20
- * @uses wp_upload_dir()
21
- * @uses image_resize_dimensions()
22
- * @uses wp_get_image_editor()
23
- *
24
- * @return str|array
25
- */
26
-
27
- if (!class_exists('Rpwe_Resize')) {
28
- class Rpwe_Resize {
29
- /**
30
- * The singleton instance
31
- */
32
- static private $instance = null;
33
-
34
- /**
35
- * No initialization allowed
36
- */
37
- private function __construct() {
38
- }
39
-
40
- /**
41
- * No cloning allowed
42
- */
43
- private function __clone() {
44
- }
45
-
46
- /**
47
- * For your custom default usage you may want to initialize an Rpwe_Resize object by yourself and then have own defaults
48
- */
49
- static public function getInstance() {
50
- if (self::$instance == null) {
51
- self::$instance = new self;
52
- }
53
-
54
- return self::$instance;
55
- }
56
-
57
- /**
58
- * Run, forest.
59
- */
60
- public function process($url, $width = null, $height = null, $crop = null, $single = true, $upscale = false) {
61
- // Validate inputs.
62
- if (!$url || (!$width && !$height)) return false;
63
-
64
- // Caipt'n, ready to hook.
65
- if (true === $upscale) add_filter('image_resize_dimensions', array($this, 'rpwe_upscale'), 10, 6);
66
-
67
- // Define upload path & dir.
68
- $upload_info = wp_upload_dir();
69
- $upload_dir = $upload_info['basedir'];
70
- $upload_url = $upload_info['baseurl'];
71
-
72
- $http_prefix = "http://";
73
- $https_prefix = "https://";
74
-
75
- /* if the $url scheme differs from $upload_url scheme, make them match
76
- if the schemes differe, images don't show up. */
77
- if (!strncmp($url, $https_prefix, strlen($https_prefix))) { //if url begins with https:// make $upload_url begin with https:// as well
78
- $upload_url = str_replace($http_prefix, $https_prefix, $upload_url);
79
- } elseif (!strncmp($url, $http_prefix, strlen($http_prefix))) { //if url begins with http:// make $upload_url begin with http:// as well
80
- $upload_url = str_replace($https_prefix, $http_prefix, $upload_url);
81
- }
82
-
83
-
84
- // Check if $img_url is local.
85
- if (false === strpos($url, $upload_url)) return false;
86
-
87
- // Define path of image.
88
- $rel_path = str_replace($upload_url, '', $url);
89
- $img_path = $upload_dir . $rel_path;
90
-
91
- // Check if img path exists, and is an image indeed.
92
- if (!file_exists($img_path) or !getimagesize($img_path)) return false;
93
-
94
- // Get image info.
95
- $info = pathinfo($img_path);
96
- $ext = $info['extension'];
97
- list($orig_w, $orig_h) = getimagesize($img_path);
98
-
99
- // Get image size after cropping.
100
- $dims = image_resize_dimensions($orig_w, $orig_h, $width, $height, $crop);
101
- $dst_w = $dims[4];
102
- $dst_h = $dims[5];
103
-
104
- // Return the original image only if it exactly fits the needed measures.
105
- if (!$dims && (((null === $height && $orig_w == $width) xor (null === $width && $orig_h == $height)) xor ($height == $orig_h && $width == $orig_w))) {
106
- $img_url = $url;
107
- $dst_w = $orig_w;
108
- $dst_h = $orig_h;
109
- } else {
110
- // Use this to check if cropped image already exists, so we can return that instead.
111
- $suffix = "{$dst_w}x{$dst_h}";
112
- $dst_rel_path = str_replace('.' . $ext, '', $rel_path);
113
- $destfilename = "{$upload_dir}{$dst_rel_path}-{$suffix}.{$ext}";
114
-
115
- if (!$dims || (true == $crop && false == $upscale && ($dst_w < $width || $dst_h < $height))) {
116
- // Can't resize, so return false saying that the action to do could not be processed as planned.
117
- return false;
118
- }
119
- // Else check if cache exists.
120
- elseif (file_exists($destfilename) && getimagesize($destfilename)) {
121
- $img_url = "{$upload_url}{$dst_rel_path}-{$suffix}.{$ext}";
122
- }
123
- // Else, we resize the image and return the new resized image url.
124
- else {
125
-
126
- $editor = wp_get_image_editor($img_path);
127
-
128
- if (is_wp_error($editor) || is_wp_error($editor->resize($width, $height, $crop)))
129
- return false;
130
-
131
- $resized_file = $editor->save();
132
-
133
- if (!is_wp_error($resized_file)) {
134
- $resized_rel_path = str_replace($upload_dir, '', $resized_file['path']);
135
- $img_url = $upload_url . $resized_rel_path;
136
- } else {
137
- return false;
138
- }
139
- }
140
- }
141
-
142
- // Okay, leave the ship.
143
- if (true === $upscale) remove_filter('image_resize_dimensions', array($this, 'rpwe_upscale'));
144
-
145
- // Return the output.
146
- if ($single) {
147
- // str return.
148
- $image = $img_url;
149
- } else {
150
- // array return.
151
- $image = array(
152
- 0 => $img_url,
153
- 1 => $dst_w,
154
- 2 => $dst_h
155
- );
156
- }
157
-
158
- return $image;
159
- }
160
-
161
- /**
162
- * Callback to overwrite WP computing of thumbnail measures
163
- */
164
- function rpwe_upscale($default, $orig_w, $orig_h, $dest_w, $dest_h, $crop) {
165
- if (!$crop) return null; // Let the wordpress default function handle this.
166
-
167
- // Here is the point we allow to use larger image size than the original one.
168
- $aspect_ratio = $orig_w / $orig_h;
169
- $new_w = $dest_w;
170
- $new_h = $dest_h;
171
-
172
- if (!$new_w) {
173
- $new_w = intval($new_h * $aspect_ratio);
174
- }
175
-
176
- if (!$new_h) {
177
- $new_h = intval($new_w / $aspect_ratio);
178
- }
179
-
180
- $size_ratio = max($new_w / $orig_w, $new_h / $orig_h);
181
-
182
- $crop_w = round($new_w / $size_ratio);
183
- $crop_h = round($new_h / $size_ratio);
184
-
185
- $s_x = floor(($orig_w - $crop_w) / 2);
186
- $s_y = floor(($orig_h - $crop_h) / 2);
187
-
188
- return array(0, 0, (int) $s_x, (int) $s_y, (int) $new_w, (int) $new_h, (int) $crop_w, (int) $crop_h);
189
- }
190
- }
191
- }
192
-
193
-
194
-
195
-
196
-
197
- if (!function_exists('rpwe_resize')) {
198
-
199
- /**
200
- * This is just a tiny wrapper function for the class above so that there is no
201
- * need to change any code in your own WP themes. Usage is still the same :)
202
- */
203
- function rpwe_resize($url, $width = null, $height = null, $crop = null, $single = true, $upscale = false) {
204
- $rpwe_resize = Rpwe_Resize::getInstance();
205
- return $rpwe_resize->process($url, $width, $height, $crop, $single, $upscale);
206
- }
207
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/shortcode.php CHANGED
@@ -1,20 +1,41 @@
1
- <?php
2
-
3
- /**
4
- * Shortcode helper
5
- */
6
-
7
- /**
8
- * Display recent posts with shortcode.
9
- *
10
- * @since 0.9.4
11
- */
12
- function rpwe_shortcode($atts, $content) {
13
- if (isset($atts['cssid'])) {
14
- $atts['cssID'] = $atts['cssid'];
15
- unset($atts['cssid']);
16
- }
17
- $args = shortcode_atts(rpwe_get_default_args(), $atts);
18
- return rpwe_get_recent_posts($args);
19
- }
20
- add_shortcode('rpwe', 'rpwe_shortcode');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Shortcode helper
4
+ *
5
+ * @package Recent Posts Extended
6
+ */
7
+
8
+ /**
9
+ * Recent posts shortcode.
10
+ *
11
+ * @param array $atts the arguments.
12
+ * @return string|array The HTML for the posts.
13
+ */
14
+ function rpwe_shortcode( $atts ) {
15
+
16
+ // Breaking changes from version 1.x.x to 2.0.
17
+ if ( isset( $atts['cssid'] ) ) {
18
+ $atts['css_id'] = $atts['cssid'];
19
+ } elseif ( isset( $atts['cssID'] ) ) {
20
+ $atts['css_id'] = $atts['cssID'];
21
+ }
22
+
23
+ // Convert string to boolean.
24
+ $attr_strings = array( 'excerpt', 'thumb', 'date', 'date_relative', 'date_modified', 'readmore', 'comment_count', 'post_title', 'link_target', 'styles_default' );
25
+ foreach ( $attr_strings as $attr ) {
26
+ if ( isset( $atts[ $attr ] ) ) {
27
+ $atts[ $attr ] = rpwe_string_to_boolean( $atts[ $attr ] );
28
+ }
29
+ }
30
+
31
+ // Merge the default arguments with the shortcode attributes.
32
+ $atts = shortcode_atts( rpwe_get_default_args(), $atts );
33
+
34
+ // load default style.
35
+ if ( $atts['styles_default'] ) {
36
+ wp_enqueue_style( 'rpwe-style' );
37
+ }
38
+
39
+ return rpwe_get_recent_posts( $atts );
40
+ }
41
+ add_shortcode( 'rpwe', 'rpwe_shortcode' );
languages/recent-posts-widget-extended-de_DE.mo DELETED
Binary file
languages/recent-posts-widget-extended-de_DE.po DELETED
@@ -1,266 +0,0 @@
1
- # Copyright (C) 2015 Satrya
2
- # This file is distributed under the same license as the Recent Posts Widget Extended package.
3
- msgid ""
4
- msgstr ""
5
- "Project-Id-Version: Recent Posts Widget Extended 0.9.9.3\n"
6
- "Report-Msgid-Bugs-To: https://themephe.com/\n"
7
- "POT-Creation-Date: 2015-09-19 14:47:10+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: 2015-09-22 14:41+0200\n"
12
- "Last-Translator: ThemePhe (support@themephe.com)\n"
13
- "Language-Team: ThemePhe (support@themephe.com)\n"
14
- "X-Generator: Poedit 1.8.4\n"
15
- "Plural-Forms: nplurals=2; plural=n != 1;\n"
16
- "X-Poedit-Basepath: ..\n"
17
- "X-Poedit-SourceCharset: utf-8\n"
18
- "X-Poedit-KeywordsList: __;_e;__ngettext:1,2;_n:1,2;__ngettext_noop:1,2;_n_noop:1,2;_c;_nc:4c,1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;"
19
- "_nx_noop:4c,1,2\n"
20
- "X-Textdomain-Support: yes\n"
21
- "Language: de_DE\n"
22
- "X-Poedit-SearchPath-0: .\n"
23
-
24
- #: classes/widget.php:24
25
- msgid "An advanced widget that gives you total control over the output of your site’s most recent Posts."
26
- msgstr "ein widget, dass dir die totale Kontrolle über dieAusgabe der letzten Beiträge ermöglicht."
27
-
28
- #: classes/widget.php:35
29
- msgid "Recent Posts Extended"
30
- msgstr "Recent Posts Extended"
31
-
32
- #: includes/form.php:17 includes/form.php:119
33
- msgid "Title"
34
- msgstr "Titel"
35
-
36
- #: includes/form.php:24
37
- msgid "Title URL"
38
- msgstr "Titel URL"
39
-
40
- #: includes/form.php:31
41
- msgid "CSS ID"
42
- msgstr "CSS ID"
43
-
44
- #: includes/form.php:38
45
- msgid "CSS Class"
46
- msgstr "CSS Klasse"
47
-
48
- #: includes/form.php:45
49
- msgid "HTML or text before the recent posts"
50
- msgstr "HTML oder Text vor dem Modul"
51
-
52
- #: includes/form.php:52
53
- msgid "HTML or text after the recent posts"
54
- msgstr "HTML oder Text nach dem Modul"
55
-
56
- #: includes/form.php:64
57
- msgid "Ignore sticky posts"
58
- msgstr "angepinnte(sticky) Beiträge ignorieren"
59
-
60
- #: includes/form.php:71
61
- msgid "Exclude current post"
62
- msgstr "letzten Beitrag ausschliessen"
63
-
64
- #: includes/form.php:77
65
- msgid "Post Types"
66
- msgstr "Beitragstypen"
67
-
68
- #: includes/form.php:93
69
- msgid "Post Status"
70
- msgstr "Beitrags-Status"
71
-
72
- #: includes/form.php:104
73
- msgid "Order"
74
- msgstr "Reihenfolge"
75
-
76
- #: includes/form.php:107
77
- msgid "Descending"
78
- msgstr "Absteigend"
79
-
80
- #: includes/form.php:108
81
- msgid "Ascending"
82
- msgstr "Aufsteigend"
83
-
84
- #: includes/form.php:114
85
- msgid "Orderby"
86
- msgstr "Sortieren nach"
87
-
88
- #: includes/form.php:117
89
- msgid "ID"
90
- msgstr "ID"
91
-
92
- #: includes/form.php:118
93
- msgid "Author"
94
- msgstr "Autor"
95
-
96
- #: includes/form.php:120
97
- msgid "Date"
98
- msgstr "Datum"
99
-
100
- #: includes/form.php:121
101
- msgid "Modified"
102
- msgstr "Änderungsdatum"
103
-
104
- #: includes/form.php:122
105
- msgid "Random"
106
- msgstr "Zufall"
107
-
108
- #: includes/form.php:123
109
- msgid "Comment Count"
110
- msgstr "Anzahl Kommentare"
111
-
112
- #: includes/form.php:124
113
- msgid "Menu Order"
114
- msgstr "Menü Reihenfolge"
115
-
116
- #: includes/form.php:130
117
- msgid "Limit to Category"
118
- msgstr "Begrenzen auf Kategorie(n)"
119
-
120
- #: includes/form.php:146
121
- msgid "Limit to Tag"
122
- msgstr "Begrenzen auf Schlagwort(e)"
123
-
124
- #: includes/form.php:162
125
- msgid "Limit to Taxonomy"
126
- msgstr "Begrenzen auf Taxonomie(n)"
127
-
128
- #: includes/form.php:165
129
- msgid "Ex: category=1,2,4&amp;post_tag=6,12"
130
- msgstr "z.B.: category=1,2,4&amp;post_tag=6,12"
131
-
132
- #: includes/form.php:166
133
- msgid "Available: "
134
- msgstr "Verfügbar:"
135
-
136
- #: includes/form.php:175
137
- msgid "Number of posts to show"
138
- msgstr "Anzahl der zu zeigenden Beiträge"
139
-
140
- #: includes/form.php:182
141
- msgid "Offset"
142
- msgstr "Abweichen / überpringen"
143
-
144
- #: includes/form.php:185
145
- msgid "The number of posts to skip"
146
- msgstr "Anzahl der Beiträge die übersprungen werden sollen"
147
-
148
- #: includes/form.php:193
149
- msgid "Display Thumbnail"
150
- msgstr "Thumbnail anzeigen"
151
-
152
- #: includes/form.php:199
153
- msgid "Thumbnail (height,width,align)"
154
- msgstr "Thumbnail (höhe,breite,ausrichtung)"
155
-
156
- #: includes/form.php:204
157
- msgid "Left"
158
- msgstr "Links"
159
-
160
- #: includes/form.php:205
161
- msgid "Right"
162
- msgstr "Rechts"
163
-
164
- #: includes/form.php:206
165
- msgid "Center"
166
- msgstr "Mitte"
167
-
168
- #: includes/form.php:212
169
- msgid "Default Thumbnail"
170
- msgstr "Standard Thumbnail"
171
-
172
- #: includes/form.php:215
173
- msgid "Leave it blank to disable."
174
- msgstr "Feld leer lassen zum deaktivieren."
175
-
176
- #: includes/form.php:223
177
- msgid "Display Excerpt"
178
- msgstr "Textauszug anzeigen"
179
-
180
- #: includes/form.php:229
181
- msgid "Excerpt Length"
182
- msgstr "Textauszug Länge"
183
-
184
- #: includes/form.php:237
185
- msgid "Display Readmore"
186
- msgstr "<weiterlesen> anzeigen"
187
-
188
- #: includes/form.php:243
189
- msgid "Readmore Text"
190
- msgstr "<weiterlesen> Text"
191
-
192
- #: includes/form.php:251
193
- msgid "Display Comment Count"
194
- msgstr "Kommentar Zähler anzeigen"
195
-
196
- #: includes/form.php:258
197
- msgid "Display Date"
198
- msgstr "Datum anzeigen"
199
-
200
- #: includes/form.php:265
201
- msgid "Display Modification Date"
202
- msgstr "Änderungsdatum anzeigen"
203
-
204
- #: includes/form.php:272
205
- msgid "Use Relative Date. eg: 5 days ago"
206
- msgstr "Relatives Datum verwenden. z.B. vor 5 Tagen"
207
-
208
- #: includes/form.php:284
209
- msgid "Use Default Styles"
210
- msgstr "Verwende standard styles"
211
-
212
- #: includes/form.php:290
213
- msgid "Custom CSS"
214
- msgstr "Benutzerdefiniertes CSS"
215
-
216
- #: includes/form.php:293
217
- msgid "If you turn off the default styles, you can use these css code to customize the recent posts style."
218
- msgstr "Wenn standard styles deaktiviert wird, können diese styles zum anpassen des benutzerdefinierten styles verwendet werden"
219
-
220
- #: includes/functions.php:22
221
- msgid "Recent Posts"
222
- msgstr "letzte Beiträge"
223
-
224
- #: includes/functions.php:48
225
- msgid "Read More &raquo;"
226
- msgstr "weiterlesen &raquo;"
227
-
228
- #: includes/functions.php:170
229
- msgid "Permalink to %s"
230
- msgstr "Permalink to %s"
231
-
232
- #: includes/functions.php:175 includes/functions.php:181
233
- msgid "%s ago"
234
- msgstr "vor %s"
235
-
236
- #: includes/functions.php:188
237
- msgid "No Comments"
238
- msgstr "keine Kommentare"
239
-
240
- #: includes/functions.php:190
241
- msgid "%s Comments"
242
- msgstr "%s Kommentare"
243
-
244
- #: includes/functions.php:192
245
- msgid "1 Comment"
246
- msgstr "ein Kommentar"
247
-
248
- #. Plugin Name of the plugin/theme
249
- msgid "Recent Posts Widget Extended"
250
- msgstr "Recent Posts Widget Extended"
251
-
252
- #. Plugin URI of the plugin/theme
253
- msgid "https://themephe.com/items/recent-posts-widget-extended/"
254
- msgstr "https://themephe.com/items/recent-posts-widget-extended/"
255
-
256
- #. Description of the plugin/theme
257
- msgid "Enables advanced widget that gives you total control over the output of your site’s most recent Posts."
258
- msgstr "Stellt ein widget zur Verfügung dass dir die totale Kontrolle über dieAusgabe der letzten Beiträge ermöglicht."
259
-
260
- #. Author of the plugin/theme
261
- msgid "Satrya"
262
- msgstr "Satrya"
263
-
264
- #. Author URI of the plugin/theme
265
- msgid "https://themephe.com/"
266
- msgstr "https://themephe.com/"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
languages/recent-posts-widget-extended-fa_IR.mo DELETED
Binary file
languages/recent-posts-widget-extended-fa_IR.po DELETED
@@ -1,278 +0,0 @@
1
- # Copyright (C) 2015 Satrya
2
- # This file is distributed under the same license as the Recent Posts Widget Extended package.
3
- msgid ""
4
- msgstr ""
5
- "Project-Id-Version: Recent Posts Widget Extended 0.9.9.4\n"
6
- "Report-Msgid-Bugs-To: https://themephe.com/\n"
7
- "POT-Creation-Date: 2016-01-10 19:09+0330\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: 2016-01-10 19:25+0330\n"
12
- "Last-Translator: ThemePhe (support@themephe.com)\n"
13
- "Language-Team: ThemePhe (support@themephe.com)\n"
14
- "X-Generator: Poedit 1.8.2\n"
15
- "Plural-Forms: nplurals=1; plural=0;\n"
16
- "X-Poedit-Basepath: ..\n"
17
- "X-Poedit-SourceCharset: utf-8\n"
18
- "X-Poedit-KeywordsList: __;_e;__ngettext:1,2;_n:1,2;__ngettext_noop:1,2;"
19
- "_n_noop:1,2;_c;_nc:4c,1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2\n"
20
- "X-Textdomain-Support: yes\n"
21
- "Language: fa_IR\n"
22
- "X-Poedit-SearchPath-0: .\n"
23
-
24
- #: classes/widget.php:24
25
- msgid ""
26
- "An advanced widget that gives you total control over the output of your "
27
- "site’s most recent Posts."
28
- msgstr ""
29
- "ویجت پیشرفته ای که به شما امکان کنترل کامل بر روی خروجی \"نوشته های اخیر\" "
30
- "را می دهد."
31
-
32
- #: classes/widget.php:35
33
- msgid "Recent Posts Extended"
34
- msgstr "پست های اخیر (با امکانات وسیع)"
35
-
36
- #: includes/form.php:17 includes/form.php:119
37
- msgid "Title"
38
- msgstr "عنوان"
39
-
40
- #: includes/form.php:24
41
- msgid "Title URL"
42
- msgstr "URL عنوان (لینک)"
43
-
44
- #: includes/form.php:31
45
- msgid "CSS ID"
46
- msgstr "شناسه CSS"
47
-
48
- #: includes/form.php:38
49
- msgid "CSS Class"
50
- msgstr "کلاس CSS"
51
-
52
- #: includes/form.php:45
53
- msgid "HTML or text before the recent posts"
54
- msgstr "قرار دادن کد HTML یا متن قبل از پست های اخیر"
55
-
56
- #: includes/form.php:52
57
- msgid "HTML or text after the recent posts"
58
- msgstr "قرار دادن کد HTML یا متن بعد از پست های اخیر"
59
-
60
- #: includes/form.php:64
61
- msgid "Ignore sticky posts"
62
- msgstr "قرار ندادن نوشته‎های ثابت در نوشته‎های اخیر "
63
-
64
- #: includes/form.php:71
65
- msgid "Exclude current post"
66
- msgstr "نوشته ی فعلی را نمایش نده."
67
-
68
- #: includes/form.php:77
69
- msgid "Post Types"
70
- msgstr "نوع نوشته‎ها"
71
-
72
- #: includes/form.php:93
73
- msgid "Post Status"
74
- msgstr "وضعیت نوشته"
75
-
76
- #: includes/form.php:104
77
- msgid "Order"
78
- msgstr "ترتیب قرار گیری"
79
-
80
- #: includes/form.php:107
81
- msgid "Descending"
82
- msgstr "نزولی"
83
-
84
- #: includes/form.php:108
85
- msgid "Ascending"
86
- msgstr "صعودی"
87
-
88
- #: includes/form.php:114
89
- msgid "Orderby"
90
- msgstr "مرتب سازی بر اساس"
91
-
92
- #: includes/form.php:117
93
- msgid "ID"
94
- msgstr "شماره"
95
-
96
- #: includes/form.php:118
97
- msgid "Author"
98
- msgstr "نویسنده"
99
-
100
- #: includes/form.php:120
101
- msgid "Date"
102
- msgstr "تاریخ"
103
-
104
- #: includes/form.php:121
105
- msgid "Modified"
106
- msgstr "تاریخ ویرایش"
107
-
108
- #: includes/form.php:122
109
- msgid "Random"
110
- msgstr "تصادفی"
111
-
112
- #: includes/form.php:123
113
- msgid "Comment Count"
114
- msgstr "تعداد دیدگاه‎ها"
115
-
116
- #: includes/form.php:124
117
- msgid "Menu Order"
118
- msgstr "ترتیب منو"
119
-
120
- #: includes/form.php:130
121
- msgid "Limit to Category"
122
- msgstr "محدود به دسته"
123
-
124
- #: includes/form.php:146
125
- msgid "Limit to Tag"
126
- msgstr "محدود به برچسب"
127
-
128
- #: includes/form.php:162
129
- msgid "Limit to Taxonomy"
130
- msgstr "محدودیت برا اساس طبقه بندی"
131
-
132
- #: includes/form.php:165
133
- msgid "Ex: category=1,2,4&amp;post_tag=6,12"
134
- msgstr "مثال: دسته ی = 1،2،4 و post_tag = 6،12"
135
-
136
- #: includes/form.php:166
137
- msgid "Available: "
138
- msgstr "در دسترس:"
139
-
140
- #: includes/form.php:175
141
- msgid "Number of posts to show"
142
- msgstr "تعداد پست ها جهت نمایش :"
143
-
144
- #: includes/form.php:182
145
- msgid "Offset"
146
- msgstr ""
147
-
148
- #: includes/form.php:185
149
- msgid "The number of posts to skip"
150
- msgstr "تعداد نوشته‎هایی که نادیده گرفته شوند"
151
-
152
- #: includes/form.php:193
153
- msgid "Display Thumbnail"
154
- msgstr "نمایش بندانگشتی"
155
-
156
- #: includes/form.php:199
157
- msgid "Thumbnail (height,width,align)"
158
- msgstr "اندازه ی تصویر بند انگشتی (ارتفاع، عرض، چین)"
159
-
160
- #: includes/form.php:204
161
- msgid "Left"
162
- msgstr "چپ"
163
-
164
- #: includes/form.php:205
165
- msgid "Right"
166
- msgstr "راست"
167
-
168
- #: includes/form.php:206
169
- msgid "Center"
170
- msgstr "وسط"
171
-
172
- #: includes/form.php:212
173
- msgid "Default Thumbnail"
174
- msgstr "عکس بند انگشتی پیش فرض"
175
-
176
- #: includes/form.php:215
177
- msgid "Leave it blank to disable."
178
- msgstr "(برای غیر فعال بودن خالی بگذارید.)"
179
-
180
- #: includes/form.php:223
181
- msgid "Display Excerpt"
182
- msgstr "نمایش خلاصه؟"
183
-
184
- #: includes/form.php:229
185
- msgid "Excerpt Length"
186
- msgstr "طول خلاصه مطلب"
187
-
188
- #: includes/form.php:237
189
- msgid "Display Readmore"
190
- msgstr "نمایش ادامه مطلب؟"
191
-
192
- #: includes/form.php:243
193
- msgid "Readmore Text"
194
- msgstr "متن ادامه ی مطلب"
195
-
196
- #: includes/form.php:251
197
- msgid "Display Comment Count"
198
- msgstr "نمایش تعداد دیدگاه ها"
199
-
200
- #: includes/form.php:258
201
- msgid "Display Date"
202
- msgstr "نمایش تاریخ"
203
-
204
- #: includes/form.php:265
205
- msgid "Display Modification Date"
206
- msgstr "نمایش تاریخ اصلاح نوشته"
207
-
208
- #: includes/form.php:272
209
- msgid "Use Relative Date. eg: 5 days ago"
210
- msgstr "استفاده از تاریخ نسبی. به عنوان مثال: 5 روز پیش"
211
-
212
- #: includes/form.php:284
213
- msgid "Use Default Styles"
214
- msgstr "استفاده از استایل پیشفرض."
215
-
216
- #: includes/form.php:290
217
- msgid "Custom CSS"
218
- msgstr "CSS سفارشی"
219
-
220
- #: includes/form.php:293
221
- msgid ""
222
- "If you turn off the default styles, you can use these css code to customize "
223
- "the recent posts style."
224
- msgstr ""
225
- "اگر شما \"استفاده از استایل پیشفرض\" را غیرفعال کنید، می توانید از کدهای "
226
- "CSS بالا برای سفارشی سازی استفاده کنید."
227
-
228
- #: includes/functions.php:22
229
- msgid "Recent Posts"
230
- msgstr "نوشته‎های اخیر"
231
-
232
- #: includes/functions.php:48
233
- msgid "Read More &raquo;"
234
- msgstr "ادامه‎ی مطلب &raquo;"
235
-
236
- #: includes/functions.php:170
237
- msgid "Permalink to %s"
238
- msgstr "پیوند یکتا به %s"
239
-
240
- #: includes/functions.php:175 includes/functions.php:181
241
- msgid "%s ago"
242
- msgstr "%s قبل"
243
-
244
- #: includes/functions.php:188
245
- msgid "No Comments"
246
- msgstr "بدون دیدگاه"
247
-
248
- #: includes/functions.php:190
249
- msgid "%s Comments"
250
- msgstr "%s دیدگاه"
251
-
252
- #: includes/functions.php:192
253
- msgid "1 Comment"
254
- msgstr "یک دیدگاه"
255
-
256
- #. Plugin Name of the plugin/theme
257
- msgid "Recent Posts Widget Extended"
258
- msgstr "پست های اخیر (با امکانات وسیع)"
259
-
260
- #. Plugin URI of the plugin/theme
261
- msgid "http://www.theme-junkie.com/plugins/recent-posts-widget-extended/"
262
- msgstr "http://www.theme-junkie.com/plugins/recent-posts-widget-extended/"
263
-
264
- #. Description of the plugin/theme
265
- msgid ""
266
- "Enables advanced widget that gives you total control over the output of your "
267
- "site’s most recent Posts."
268
- msgstr ""
269
- "ویجت پیشرفته ای که به شما امکان کنترل کامل بر روی خروجی \"نوشته های اخیر\" "
270
- "را می دهد."
271
-
272
- #. Author of the plugin/theme
273
- msgid "Satrya"
274
- msgstr "Satrya"
275
-
276
- #. Author URI of the plugin/theme
277
- msgid "http://www.theme-junkie.com/"
278
- msgstr "http://www.theme-junkie.com/"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
languages/recent-posts-widget-extended-fr_FR.mo DELETED
Binary file
languages/recent-posts-widget-extended-fr_FR.po DELETED
@@ -1,195 +0,0 @@
1
- msgid ""
2
- msgstr ""
3
- "Project-Id-Version: Recent Posts Widget Extended\n"
4
- "POT-Creation-Date: 2014-04-11 12:32-0500\n"
5
- "PO-Revision-Date: 2014-04-11 12:40-0500\n"
6
- "Last-Translator: Matthieu Durocher <matthieu@technocyclope.com>\n"
7
- "Language-Team: Matthieu Durocher <matthieu@technocyclope.com>\n"
8
- "Language: fr_FR\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.6.4\n"
13
- "X-Poedit-Basepath: ..\n"
14
- "X-Poedit-SourceCharset: UTF-8\n"
15
- "X-Poedit-KeywordsList: __;_e;_n:1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;esc_attr__;"
16
- "esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c;_n_noop:1,2;"
17
- "_nx_noop:3c,1,2;__ngettext_noop:1,2\n"
18
- "Plural-Forms: nplurals=2; plural=(n > 1);\n"
19
- "X-Poedit-SearchPath-0: .\n"
20
-
21
- #: includes/widget-recent-posts-extended.php:19
22
- msgid ""
23
- "An advanced widget that gives you total control over the output of your "
24
- "site’s most recent Posts."
25
- msgstr ""
26
- "Un widget de pointe qui vous donne un contrôle total sur l'affichage des "
27
- "derniers billets de votre site."
28
-
29
- #: includes/widget-recent-posts-extended.php:28
30
- msgid "Recent Posts Extended"
31
- msgstr "Recent Posts Extended"
32
-
33
- #: includes/widget-recent-posts-extended.php:119
34
- #: includes/widget-recent-posts-extended.php:159
35
- #, php-format
36
- msgid "Permalink to %s"
37
- msgstr "Lien vers %s"
38
-
39
- #: includes/widget-recent-posts-extended.php:251
40
- msgid "Read More &raquo;"
41
- msgstr "Lire la suite..."
42
-
43
- #: includes/widget-recent-posts-extended.php:286
44
- msgid "Title:"
45
- msgstr "Titre :"
46
-
47
- #: includes/widget-recent-posts-extended.php:290
48
- msgid "Title URL:"
49
- msgstr "Lien du titre :"
50
-
51
- #: includes/widget-recent-posts-extended.php:294
52
- msgid "CSS ID:"
53
- msgstr "CSS ID :"
54
-
55
- #: includes/widget-recent-posts-extended.php:298
56
- msgid "Use Default Styles"
57
- msgstr "Utilisez les styles par défaut"
58
-
59
- #: includes/widget-recent-posts-extended.php:302
60
- msgid "CSS:"
61
- msgstr "CSS :"
62
-
63
- #: includes/widget-recent-posts-extended.php:304
64
- msgid "If you turn off the default styles, please create your own style."
65
- msgstr ""
66
- "Si vous désactivez les styles par défaut, s'il vous plaît créer votre propre "
67
- "style."
68
-
69
- #: includes/widget-recent-posts-extended.php:312
70
- msgid "Limit:"
71
- msgstr "Limite :"
72
-
73
- #: includes/widget-recent-posts-extended.php:316
74
- msgid "Offset (the number of posts to skip):"
75
- msgstr "Décalage (le nombre de postes à sauter) :"
76
-
77
- #: includes/widget-recent-posts-extended.php:320
78
- msgid "Order:"
79
- msgstr "Ordre :"
80
-
81
- #: includes/widget-recent-posts-extended.php:322
82
- msgid "DESC"
83
- msgstr "DESC"
84
-
85
- #: includes/widget-recent-posts-extended.php:323
86
- msgid "ASC"
87
- msgstr "ASC"
88
-
89
- #: includes/widget-recent-posts-extended.php:327
90
- msgid "Orderby:"
91
- msgstr "Ordre par :"
92
-
93
- #: includes/widget-recent-posts-extended.php:329
94
- msgid "ID"
95
- msgstr "ID"
96
-
97
- #: includes/widget-recent-posts-extended.php:330
98
- msgid "Author"
99
- msgstr "Auteur"
100
-
101
- #: includes/widget-recent-posts-extended.php:331
102
- msgid "Title"
103
- msgstr "Titre"
104
-
105
- #: includes/widget-recent-posts-extended.php:332
106
- msgid "Date"
107
- msgstr "Date"
108
-
109
- #: includes/widget-recent-posts-extended.php:333
110
- msgid "Modified"
111
- msgstr "Modifié"
112
-
113
- #: includes/widget-recent-posts-extended.php:334
114
- msgid "Random"
115
- msgstr "Au hasard"
116
-
117
- #: includes/widget-recent-posts-extended.php:335
118
- msgid "Comment Count"
119
- msgstr "Décompte des commentaires"
120
-
121
- #: includes/widget-recent-posts-extended.php:336
122
- msgid "Menu Order"
123
- msgstr "Ordre du menu"
124
-
125
- #: includes/widget-recent-posts-extended.php:340
126
- msgid "Limit to Category: "
127
- msgstr "Limiter à une catégorie :"
128
-
129
- #: includes/widget-recent-posts-extended.php:351
130
- msgid "Limit to Tag: "
131
- msgstr "Limiter à un mot clé :"
132
-
133
- #: includes/widget-recent-posts-extended.php:363
134
- msgid "Choose the Post Type: "
135
- msgstr "Choisir le type d'article :"
136
-
137
- #: includes/widget-recent-posts-extended.php:379
138
- msgid "Display Thumbnail"
139
- msgstr "Affichage de la miniature"
140
-
141
- #: includes/widget-recent-posts-extended.php:383
142
- msgid "Thumbnail (height, width, align):"
143
- msgstr "miniature (hauteur, largeur, alignement) :"
144
-
145
- #: includes/widget-recent-posts-extended.php:387
146
- msgid "Left"
147
- msgstr "Gauche"
148
-
149
- #: includes/widget-recent-posts-extended.php:388
150
- msgid "Right"
151
- msgstr "Droite"
152
-
153
- #: includes/widget-recent-posts-extended.php:389
154
- msgid "Center"
155
- msgstr "Centre"
156
-
157
- #: includes/widget-recent-posts-extended.php:393
158
- msgid "Default Thumbnail:"
159
- msgstr "Miniature par défaut :"
160
-
161
- #: includes/widget-recent-posts-extended.php:395
162
- msgid "Leave it blank to disable."
163
- msgstr "Laissez ce champ vide pour désactiver."
164
-
165
- #: includes/widget-recent-posts-extended.php:401
166
- msgid "Display Excerpt"
167
- msgstr "Affichage de l'extrait"
168
-
169
- #: includes/widget-recent-posts-extended.php:405
170
- msgid "Excerpt Length:"
171
- msgstr "Longueur de l'extrait"
172
-
173
- #: includes/widget-recent-posts-extended.php:409
174
- msgid "Display Readmore"
175
- msgstr "Affichage de «Lire la suite»"
176
-
177
- #: includes/widget-recent-posts-extended.php:413
178
- msgid "Readmore Text:"
179
- msgstr "Texte «Lire la suite» :"
180
-
181
- #: includes/widget-recent-posts-extended.php:417
182
- msgid "Display Date"
183
- msgstr "Affichage de la date"
184
-
185
- #: includes/widget-recent-posts-extended.php:421
186
- msgid "Date Format:"
187
- msgstr "Format de date :"
188
-
189
- #: includes/widget-recent-posts-extended.php:423
190
- msgid ""
191
- "<a href=\"http://codex.wordpress.org/Formatting_Date_and_Time\" target="
192
- "\"_blank\">Date reference</a>"
193
- msgstr ""
194
- "<a href=\"http://codex.wordpress.org/Formatting_Date_and_Time\" target="
195
- "\"_blank\">Référence pour les formats de date</a>"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
languages/recent-posts-widget-extended-pt_BR.mo DELETED
Binary file
languages/recent-posts-widget-extended-pt_BR.po DELETED
@@ -1,254 +0,0 @@
1
- # Copyright (C) 2014 Satrya
2
- # This file is distributed under the same license as the Recent Posts Widget Extended package.
3
- msgid ""
4
- msgstr ""
5
- "Project-Id-Version: Recent Posts Widget Extended 0.9.9\n"
6
- "Report-Msgid-Bugs-To: http://satrya.me/\n"
7
- "POT-Creation-Date: 2014-12-06 07:06:48+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: 2015-05-19 16:59-0300\n"
12
- "Last-Translator: Gil Barbara <gilbarbara@gmail.com>\n"
13
- "Language-Team: Satrya (satrya@satrya.me)\n"
14
- "X-Generator: Poedit 1.7.7\n"
15
- "Plural-Forms: nplurals=2; plural=(n > 1);\n"
16
- "X-Poedit-Basepath: ..\n"
17
- "X-Poedit-SourceCharset: UTF-8\n"
18
- "X-Poedit-KeywordsList: __;_e;__ngettext:1,2;_n:1,2;__ngettext_noop:1,2;_n_noop:1,2;_c;"
19
- "_nc:4c,1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2\n"
20
- "X-Textdomain-Support: yes\n"
21
- "Language: pt_BR\n"
22
- "X-Poedit-SearchPath-0: .\n"
23
-
24
- #: classes/widget.php:24
25
- msgid ""
26
- "An advanced widget that gives you total control over the output of your site’s most recent "
27
- "Posts."
28
- msgstr ""
29
- "Um widget avançado que lhe dá controle total sobre a saída dos tópicos mais recentes do seu "
30
- "site."
31
-
32
- #: classes/widget.php:35
33
- msgid "Recent Posts Extended"
34
- msgstr "Tópicos Recentes Extendido"
35
-
36
- #: includes/form.php:17 includes/form.php:112
37
- msgid "Title"
38
- msgstr "Título"
39
-
40
- #: includes/form.php:24
41
- msgid "Title URL"
42
- msgstr "Título URL"
43
-
44
- #: includes/form.php:31
45
- msgid "CSS ID"
46
- msgstr "ID CSS"
47
-
48
- #: includes/form.php:38
49
- msgid "CSS Class"
50
- msgstr "Classe CSS"
51
-
52
- #: includes/form.php:45
53
- msgid "HTML or text before the recent posts"
54
- msgstr "HTML ou texto antes dos tópicos recentes"
55
-
56
- #: includes/form.php:52
57
- msgid "HTML or text after the recent posts"
58
- msgstr "HTML ou texto após os tópicos recentes"
59
-
60
- #: includes/form.php:64
61
- msgid "Ignore sticky posts"
62
- msgstr "Ignorar Tópicos Fixos"
63
-
64
- #: includes/form.php:70
65
- msgid "Post Types"
66
- msgstr "Tipos de Tópicos"
67
-
68
- #: includes/form.php:86
69
- msgid "Post Status"
70
- msgstr "Estado dos Tópicos"
71
-
72
- #: includes/form.php:97
73
- msgid "Order"
74
- msgstr "Ordem"
75
-
76
- #: includes/form.php:100
77
- msgid "Descending"
78
- msgstr "Descendente"
79
-
80
- #: includes/form.php:101
81
- msgid "Ascending"
82
- msgstr "Ascendente"
83
-
84
- #: includes/form.php:107
85
- msgid "Orderby"
86
- msgstr "Ordenar por"
87
-
88
- #: includes/form.php:110
89
- msgid "ID"
90
- msgstr "ID"
91
-
92
- #: includes/form.php:111
93
- msgid "Author"
94
- msgstr "Autor"
95
-
96
- #: includes/form.php:113
97
- msgid "Date"
98
- msgstr "Data"
99
-
100
- #: includes/form.php:114
101
- msgid "Modified"
102
- msgstr "Modificado"
103
-
104
- #: includes/form.php:115
105
- msgid "Random"
106
- msgstr "Aleatório"
107
-
108
- #: includes/form.php:116
109
- msgid "Comment Count"
110
- msgstr "Contagem de comentários"
111
-
112
- #: includes/form.php:117
113
- msgid "Menu Order"
114
- msgstr "Ordem do Menu"
115
-
116
- #: includes/form.php:123
117
- msgid "Limit to Category"
118
- msgstr "Limitar para Categoria"
119
-
120
- #: includes/form.php:139
121
- msgid "Limit to Tag"
122
- msgstr "Limitar para Tag"
123
-
124
- #: includes/form.php:155
125
- msgid "Limit to Taxonomy"
126
- msgstr "Limitar para Taxonomia"
127
-
128
- #: includes/form.php:158
129
- msgid "Ex: category=1,2,4&amp;post_tag=6,12"
130
- msgstr "Ex: category=1,2,4&amp;post_tag=6,12"
131
-
132
- #: includes/form.php:159
133
- msgid "Available: "
134
- msgstr "Disponível:"
135
-
136
- #: includes/form.php:168
137
- msgid "Number of posts to show"
138
- msgstr "Número de tópicos para mostrar"
139
-
140
- #: includes/form.php:175
141
- msgid "Offset"
142
- msgstr "Deslocamento"
143
-
144
- #: includes/form.php:178
145
- msgid "The number of posts to skip"
146
- msgstr "O número de tópicos para ignorar"
147
-
148
- #: includes/form.php:186
149
- msgid "Display Thumbnail"
150
- msgstr "Mostrar Miniatura"
151
-
152
- #: includes/form.php:192
153
- msgid "Thumbnail (height,width,align)"
154
- msgstr "Miniatura (altura,largura,alinhamento)"
155
-
156
- #: includes/form.php:197
157
- msgid "Left"
158
- msgstr "Esquerda"
159
-
160
- #: includes/form.php:198
161
- msgid "Right"
162
- msgstr "Direita"
163
-
164
- #: includes/form.php:199
165
- msgid "Center"
166
- msgstr "Centro"
167
-
168
- #: includes/form.php:205
169
- msgid "Default Thumbnail"
170
- msgstr "Miniatura Padrão"
171
-
172
- #: includes/form.php:208
173
- msgid "Leave it blank to disable."
174
- msgstr "Deixe em branco para desabilitar."
175
-
176
- #: includes/form.php:216
177
- msgid "Display Excerpt"
178
- msgstr "Exibir Resumo"
179
-
180
- #: includes/form.php:222
181
- msgid "Excerpt Length"
182
- msgstr "Comprimento do Resumo"
183
-
184
- #: includes/form.php:230
185
- msgid "Display Readmore"
186
- msgstr "Mostrar Leia mais"
187
-
188
- #: includes/form.php:236
189
- msgid "Readmore Text"
190
- msgstr "Texto do Leia mais"
191
-
192
- #: includes/form.php:244
193
- msgid "Display Date"
194
- msgstr "Mostrar Data"
195
-
196
- #: includes/form.php:250
197
- msgid "Use Relative Date. eg: 5 days ago"
198
- msgstr "Usar Datas Relativas. ex: 5 dias atrás"
199
-
200
- #: includes/form.php:261
201
- msgid "Use Default Styles"
202
- msgstr "Usar Estilos Padrão"
203
-
204
- #: includes/form.php:267
205
- msgid "Custom CSS"
206
- msgstr "CSS Personalizado"
207
-
208
- #: includes/form.php:270
209
- msgid ""
210
- "If you turn off the default styles, you can use these css code to customize the recent "
211
- "posts style."
212
- msgstr ""
213
- "Se você desativar os estilos padrão, você pode usar esses códigos css para personalizar o "
214
- "estilo de tópicos recentes."
215
-
216
- #: includes/functions.php:22
217
- msgid "Recent Posts"
218
- msgstr "Tópicos Recentes"
219
-
220
- #: includes/functions.php:46
221
- msgid "Read More &raquo;"
222
- msgstr "Leia Mais &raquo;"
223
-
224
- #: includes/functions.php:166
225
- msgid "Permalink to %s"
226
- msgstr "Link Permanente para %s"
227
-
228
- #: includes/functions.php:171
229
- msgid "%s ago"
230
- msgstr "%s atrás"
231
-
232
- #. Plugin Name of the plugin/theme
233
- msgid "Recent Posts Widget Extended"
234
- msgstr "Widget de Tópicos Recentes Extendido"
235
-
236
- #. Plugin URI of the plugin/theme
237
- msgid "http://satrya.me/wordpress-plugins/recent-posts-widget-extended/"
238
- msgstr "http://satrya.me/wordpress-plugins/recent-posts-widget-extended/"
239
-
240
- #. Description of the plugin/theme
241
- msgid ""
242
- "Enables advanced widget that gives you total control over the output of your site’s most "
243
- "recent Posts."
244
- msgstr ""
245
- "Habilita Widget avançada que lhe dá controle total sobre a saída dos tópicos mais recentes "
246
- "do seu site."
247
-
248
- #. Author of the plugin/theme
249
- msgid "Satrya"
250
- msgstr "Satrya"
251
-
252
- #. Author URI of the plugin/theme
253
- msgid "http://satrya.me/"
254
- msgstr "http://satrya.me/"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
languages/recent-posts-widget-extended.pot CHANGED
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2021 Recent Posts Widget Extended
2
  # This file is distributed under the same license as the Recent Posts Widget Extended package.
3
  msgid ""
4
  msgstr ""
@@ -6,6 +6,7 @@ msgstr ""
6
  "MIME-Version: 1.0\n"
7
  "Content-Type: text/plain; charset=UTF-8\n"
8
  "Content-Transfer-Encoding: 8bit\n"
 
9
  "X-Poedit-Basepath: ..\n"
10
  "X-Poedit-KeywordsList: __;_e;_ex:1,2c;_n:1,2;_n_noop:1,2;_nx:1,2,4c;_nx_noop:1,2,3c;_x:1,2c;esc_attr__;esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c\n"
11
  "X-Poedit-SearchPath-0: .\n"
@@ -13,178 +14,207 @@ msgstr ""
13
  "X-Poedit-SourceCharset: UTF-8\n"
14
  "Plural-Forms: nplurals=2; plural=(n != 1);\n"
15
 
16
- #: classes/widget.php:19
17
  msgid "An advanced widget that gives you total control over the output of your site’s most recent Posts."
18
  msgstr ""
19
 
20
- #: classes/widget.php:31
21
  msgid "Recent Posts Extended"
22
  msgstr ""
23
 
24
- #: includes/form.php:12
25
- msgid "Title"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
26
  msgstr ""
27
 
28
  #: includes/form.php:19
 
 
 
 
 
 
 
 
 
 
 
 
29
  msgid "Title URL"
30
  msgstr ""
31
 
32
- #: includes/form.php:26
33
- msgid "CSS ID"
34
  msgstr ""
35
 
36
- #: includes/form.php:33
37
- msgid "CSS Class"
38
  msgstr ""
39
 
40
- #: includes/form.php:40
41
  msgid "HTML or text before the recent posts"
42
  msgstr ""
43
 
44
- #: includes/form.php:47
45
  msgid "HTML or text after the recent posts"
46
  msgstr ""
47
 
48
- #: includes/form.php:56
49
  msgid "Ignore sticky posts"
50
  msgstr ""
51
 
52
- #: includes/form.php:63
53
  msgid "Exclude current post"
54
  msgstr ""
55
 
56
- #: includes/form.php:69
57
  msgid "Post Types"
58
  msgstr ""
59
 
60
- #: includes/form.php:83
61
  msgid "Post Status"
62
  msgstr ""
63
 
64
- #: includes/form.php:94
65
  msgid "Order"
66
  msgstr ""
67
 
68
- #: includes/form.php:104
69
  msgid "Orderby"
70
  msgstr ""
71
 
72
- #: includes/form.php:120
73
  msgid "Limit to Category"
74
  msgstr ""
75
 
76
- #: includes/form.php:135
77
  msgid "Limit to Tag"
78
  msgstr ""
79
 
80
- #: includes/form.php:149
81
  msgid "Limit to Taxonomy"
82
  msgstr ""
83
 
84
- #: includes/form.php:159
85
  msgid "Number of posts to show"
86
  msgstr ""
87
 
88
- #: includes/form.php:166
89
  msgid "Offset"
90
  msgstr ""
91
 
92
- #: includes/form.php:169
93
  msgid "The number of posts to skip"
94
  msgstr ""
95
 
96
- #: includes/form.php:177
97
  msgid "Display Thumbnail"
98
  msgstr ""
99
 
100
- #: includes/form.php:183
101
  msgid "Thumbnail (height,width,align)"
102
  msgstr ""
103
 
104
- #: includes/form.php:191
105
  msgid "Left"
106
  msgstr ""
107
 
108
- #: includes/form.php:192
109
  msgid "Right"
110
  msgstr ""
111
 
112
- #: includes/form.php:193
113
  msgid "Center"
114
  msgstr ""
115
 
116
- #: includes/form.php:199
117
  msgid "Default Thumbnail"
118
  msgstr ""
119
 
120
- #: includes/form.php:202
121
  msgid "Leave it blank to disable."
122
  msgstr ""
123
 
124
- #: includes/form.php:210
125
  msgid "Display Excerpt"
126
  msgstr ""
127
 
128
- #: includes/form.php:216
129
  msgid "Excerpt Length"
130
  msgstr ""
131
 
132
- #: includes/form.php:224
133
  msgid "Display Readmore"
134
  msgstr ""
135
 
136
- #: includes/form.php:230
137
  msgid "Readmore Text"
138
  msgstr ""
139
 
140
- #: includes/form.php:238
141
- msgid "Display Comment Count"
142
  msgstr ""
143
 
144
- #: includes/form.php:245
145
- msgid "Display Date"
146
  msgstr ""
147
 
148
- #: includes/form.php:252
149
- msgid "Display Modification Date"
150
  msgstr ""
151
 
152
- #: includes/form.php:259
153
- msgid "Use Relative Date. eg: 5 days ago"
154
  msgstr ""
155
 
156
- #: includes/form.php:267
157
- msgid "Use Default Styles"
158
  msgstr ""
159
 
160
- #: includes/form.php:273
161
- msgid "Custom CSS"
162
  msgstr ""
163
 
164
- #: includes/form.php:276
165
- msgid "If you turn off the default styles, you can use these css code to customize the recent posts style."
166
  msgstr ""
167
 
168
- #: includes/functions.php:43
169
- msgid "Read More &raquo;"
170
  msgstr ""
171
 
172
- #: includes/functions.php:166
173
- msgid "Permalink to %s"
174
  msgstr ""
175
 
176
- #: includes/functions.php:177, includes/functions.php:171
 
177
  msgid "%s ago"
178
  msgstr ""
179
 
180
- #: includes/functions.php:188
181
  msgid "1 Comment"
182
  msgstr ""
183
 
184
- #: includes/functions.php:186
185
  msgid "%s Comments"
186
  msgstr ""
187
 
188
- #: includes/functions.php:184
189
  msgid "No Comments"
190
  msgstr ""
1
+ # Copyright (C) 2022 Recent Posts Widget Extended
2
  # This file is distributed under the same license as the Recent Posts Widget Extended package.
3
  msgid ""
4
  msgstr ""
6
  "MIME-Version: 1.0\n"
7
  "Content-Type: text/plain; charset=UTF-8\n"
8
  "Content-Transfer-Encoding: 8bit\n"
9
+ "POT-Creation-Date: 2022-09-22 17:06+0000\n"
10
  "X-Poedit-Basepath: ..\n"
11
  "X-Poedit-KeywordsList: __;_e;_ex:1,2c;_n:1,2;_n_noop:1,2;_nx:1,2,4c;_nx_noop:1,2,3c;_x:1,2c;esc_attr__;esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c\n"
12
  "X-Poedit-SearchPath-0: .\n"
14
  "X-Poedit-SourceCharset: UTF-8\n"
15
  "Plural-Forms: nplurals=2; plural=(n != 1);\n"
16
 
17
+ #: classes/class-rpwe-widget.php:22
18
  msgid "An advanced widget that gives you total control over the output of your site’s most recent Posts."
19
  msgstr ""
20
 
21
+ #: classes/class-rpwe-widget.php:34
22
  msgid "Recent Posts Extended"
23
  msgstr ""
24
 
25
+ #: includes/defaults.php:42
26
+ msgid "Read More &raquo;"
27
+ msgstr ""
28
+
29
+ #: includes/form.php:15
30
+ msgid "General"
31
+ msgstr ""
32
+
33
+ #: includes/form.php:16
34
+ msgid "Posts"
35
+ msgstr ""
36
+
37
+ #: includes/form.php:17
38
+ msgid "Image"
39
+ msgstr ""
40
+
41
+ #: includes/form.php:18
42
+ msgid "Excerpt"
43
  msgstr ""
44
 
45
  #: includes/form.php:19
46
+ msgid "Control"
47
+ msgstr ""
48
+
49
+ #: includes/form.php:20
50
+ msgid "Style"
51
+ msgstr ""
52
+
53
+ #: includes/form.php:28
54
+ msgid "Title"
55
+ msgstr ""
56
+
57
+ #: includes/form.php:35
58
  msgid "Title URL"
59
  msgstr ""
60
 
61
+ #: includes/form.php:42
62
+ msgid "Container ID"
63
  msgstr ""
64
 
65
+ #: includes/form.php:49
66
+ msgid "Container Class"
67
  msgstr ""
68
 
69
+ #: includes/form.php:56
70
  msgid "HTML or text before the recent posts"
71
  msgstr ""
72
 
73
+ #: includes/form.php:63
74
  msgid "HTML or text after the recent posts"
75
  msgstr ""
76
 
77
+ #: includes/form.php:74
78
  msgid "Ignore sticky posts"
79
  msgstr ""
80
 
81
+ #: includes/form.php:81
82
  msgid "Exclude current post"
83
  msgstr ""
84
 
85
+ #: includes/form.php:87
86
  msgid "Post Types"
87
  msgstr ""
88
 
89
+ #: includes/form.php:101
90
  msgid "Post Status"
91
  msgstr ""
92
 
93
+ #: includes/form.php:112
94
  msgid "Order"
95
  msgstr ""
96
 
97
+ #: includes/form.php:122
98
  msgid "Orderby"
99
  msgstr ""
100
 
101
+ #: includes/form.php:138
102
  msgid "Limit to Category"
103
  msgstr ""
104
 
105
+ #: includes/form.php:153
106
  msgid "Limit to Tag"
107
  msgstr ""
108
 
109
+ #: includes/form.php:167
110
  msgid "Limit to Taxonomy"
111
  msgstr ""
112
 
113
+ #: includes/form.php:181
114
  msgid "Number of posts to show"
115
  msgstr ""
116
 
117
+ #: includes/form.php:188
118
  msgid "Offset"
119
  msgstr ""
120
 
121
+ #: includes/form.php:191
122
  msgid "The number of posts to skip"
123
  msgstr ""
124
 
125
+ #: includes/form.php:201
126
  msgid "Display Thumbnail"
127
  msgstr ""
128
 
129
+ #: includes/form.php:207
130
  msgid "Thumbnail (height,width,align)"
131
  msgstr ""
132
 
133
+ #: includes/form.php:215
134
  msgid "Left"
135
  msgstr ""
136
 
137
+ #: includes/form.php:216
138
  msgid "Right"
139
  msgstr ""
140
 
141
+ #: includes/form.php:217
142
  msgid "Center"
143
  msgstr ""
144
 
145
+ #: includes/form.php:223
146
  msgid "Default Thumbnail"
147
  msgstr ""
148
 
149
+ #: includes/form.php:226
150
  msgid "Leave it blank to disable."
151
  msgstr ""
152
 
153
+ #: includes/form.php:236
154
  msgid "Display Excerpt"
155
  msgstr ""
156
 
157
+ #: includes/form.php:242
158
  msgid "Excerpt Length"
159
  msgstr ""
160
 
161
+ #: includes/form.php:250
162
  msgid "Display Readmore"
163
  msgstr ""
164
 
165
+ #: includes/form.php:256
166
  msgid "Readmore Text"
167
  msgstr ""
168
 
169
+ #: includes/form.php:266
170
+ msgid "Display post title"
171
  msgstr ""
172
 
173
+ #: includes/form.php:272
174
+ msgid "Display comment count"
175
  msgstr ""
176
 
177
+ #: includes/form.php:279
178
+ msgid "Display date"
179
  msgstr ""
180
 
181
+ #: includes/form.php:286
182
+ msgid "Use a modification date"
183
  msgstr ""
184
 
185
+ #: includes/form.php:293
186
+ msgid "Use relative date. eg: 5 days ago"
187
  msgstr ""
188
 
189
+ #: includes/form.php:300
190
+ msgid "Open links in new tab"
191
  msgstr ""
192
 
193
+ #: includes/form.php:309
194
+ msgid "Use Default Styles"
195
  msgstr ""
196
 
197
+ #: includes/form.php:315
198
+ msgid "Custom CSS"
199
  msgstr ""
200
 
201
+ #: includes/form.php:318
202
+ msgid "Custom CSS is no longer editable, please copy and paste your custom CSS to"
203
  msgstr ""
204
 
205
+ #. translators: %s: current time
206
+ #: includes/functions.php:137, includes/functions.php:130
207
  msgid "%s ago"
208
  msgstr ""
209
 
210
+ #: includes/functions.php:149
211
  msgid "1 Comment"
212
  msgstr ""
213
 
214
+ #: includes/functions.php:147
215
  msgid "%s Comments"
216
  msgstr ""
217
 
218
+ #: includes/functions.php:144
219
  msgid "No Comments"
220
  msgstr ""
readme.txt CHANGED
@@ -1,252 +1,278 @@
1
- === Recent Posts Widget Extended ===
2
- Contributors: idenovasi, satrya
3
- Donate link: https://paypal.me/satrya
4
- Tags: recent posts, random posts, popular posts, thumbnails, widget, widgets, sidebar, excerpt, category, post tag, taxonomy, post type, post status, shortcode, multiple widgets
5
- Requires at least: 5.8
6
- Tested up to: 5.8
7
- Requires PHP: 7.2
8
- Stable tag: 1.1.0
9
- License: GPLv2 or later
10
- License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
-
12
- Provides flexible and advanced recent posts. Display it via shortcode or widget with thumbnails, post excerpt, taxonomy and more.
13
-
14
- == Description ==
15
-
16
- This plugin will enable a custom, flexible and super [advanced recent posts](https://idenovasi.com/projects/recent-posts-widget-extended/), you can display it via shortcode or widget. Allows you to display a list of the most recent posts with thumbnail, excerpt and post date, also you can display it from all or specific or multiple taxonomy, post type and much more!
17
-
18
- = Features Include =
19
-
20
- * Taxonomy support!
21
- * Post status option.
22
- * Custom html or text before and/or after recent posts.
23
- * Available filter for dev.
24
- * Shortcode feature.
25
- * Better image cropping.
26
- * Allow you to set title url.
27
- * Display by date, comment count or random.
28
- * Display thumbnails, with customizable size and alignment.
29
- * Display excerpt, with customizable length.
30
- * Display from all, specific or multiple category.
31
- * Display from all, specific or multiple tag.
32
- * Display post date.
33
- * Display modification date
34
- * Display comment count
35
- * Exclude current post
36
- * Read more option.
37
- * Post type option.
38
- * Custom CSS.
39
- * Multiple widgets.
40
-
41
- = Support this project =
42
-
43
- * [Translate to your language](https://translate.wordpress.org/projects/wp-plugins/recent-posts-widget-extended/).
44
- * Contribute on [Github](https://github.com/idenovasi/recent-posts-widget-extended).
45
- * [Donate](https://paypal.me/satrya).
46
-
47
- == Installation ==
48
-
49
- **Through Dashboard**
50
-
51
- 1. Log in to your WordPress admin panel and go to Plugins -> Add New
52
- 2. Type **recent posts widget extended** in the search box and click on search button.
53
- 3. Find Recent Posts Widget Extended plugin.
54
- 4. Then click on Install Now after that activate the plugin.
55
- 5. Go to the widgets page **Appearance -> Widgets**.
56
- 6. Find **Recent Posts Extended** widget.
57
-
58
- **Installing Via FTP**
59
-
60
- 1. Download the plugin to your hardisk.
61
- 2. Unzip.
62
- 3. Upload the **recent-posts-widget-extended** folder into your plugins directory.
63
- 4. Log in to your WordPress admin panel and click the Plugins menu.
64
- 5. Then activate the plugin.
65
- 6. Go to the widgets page **Appearance -> Widgets**.
66
- 7. Find **Recent Posts Extended** widget.
67
-
68
- == Frequently Asked Questions ==
69
-
70
- = How to filter the post query? =
71
- You can use `rpwe_default_query_arguments` to filter it. Example:
72
- `
73
- add_filter( 'rpwe_default_query_arguments', 'your_custom_function' );
74
- function your_custom_function( $args ) {
75
- $args['posts_per_page'] = 10; // Changing the number of posts to show.
76
- return $args;
77
- }
78
- `
79
-
80
- = How to filter the post excerpt? =
81
- Post excerpt now comes with filter to easily dev to change/customize it. `apply_filters( 'rpwe_excerpt', get_the_excerpt() )`
82
-
83
- = Ordering not working! =
84
- Did you installed any Post or Post Type Order? Please try to deactivate it and try again the ordering. [(related question)](http://wordpress.org/support/topic/ordering-set-to-descending-not-working)
85
-
86
- = No image options =
87
- Your theme needs to support Post Thumbnail, please go to http://codex.wordpress.org/Post_Thumbnails to read more info and how to activate it in your theme.
88
-
89
- = How to add custom style? =
90
- First, please uncheck the **Use Default Style** option then place the css code below in the Custom CSS box, then you can customize it to fit your needs
91
- `
92
- .rpwe-block ul {
93
- list-style: none !important;
94
- margin-left: 0 !important;
95
- padding-left: 0 !important;
96
- }
97
- .rpwe-block li {
98
- border-bottom: 1px solid #eee;
99
- margin-bottom: 10px;
100
- padding-bottom: 10px;
101
- list-style-type: none;
102
- }
103
- .rpwe-block a {
104
- display: inline !important;
105
- text-decoration: none;
106
- }
107
- .rpwe-block h3 {
108
- background: none !important;
109
- clear: none;
110
- margin-bottom: 0 !important;
111
- margin-top: 0 !important;
112
- font-weight: 400;
113
- font-size: 12px !important;
114
- line-height: 1.5em;
115
- }
116
- .rpwe-thumb {
117
- border: 1px solid #eee !important;
118
- box-shadow: none !important;
119
- margin: 2px 10px 2px 0;
120
- padding: 3px !important;
121
- }
122
- .rpwe-summary {
123
- font-size: 12px;
124
- }
125
- .rpwe-time {
126
- color: #bbb;
127
- font-size: 11px;
128
- }
129
- .rpwe-alignleft {
130
- display: inline;
131
- float: left;
132
- }
133
- .rpwe-alignright {
134
- display: inline;
135
- float: right;
136
- }
137
- .rpwe-aligncenter {
138
- display: block;
139
- margin-left: auto;
140
- margin-right: auto;
141
- }
142
- .rpwe-clearfix:before,.rpwe-clearfix:after {
143
- content: "";
144
- display: table !important;
145
- }
146
- .rpwe-clearfix:after {
147
- clear: both;
148
- }
149
- .rpwe-clearfix {
150
- zoom: 1;
151
- }
152
- `
153
-
154
- = Why so many !important in the css code? =
155
- I know it's not good but I have a good reason, the `!important` is to make sure the built-in style compatible with all themes. But if you don't like it, you can turn of the **Use Default Styles** and remove all custom css code in the **Custom CSS** box then create your own style.
156
-
157
- = Available filters =
158
- Default arguments
159
- `
160
- rpwe_default_args
161
- `
162
-
163
- Post excerpt
164
- `
165
- rpwe_excerpt
166
- `
167
-
168
- Post markup
169
- `
170
- rpwe_markup
171
- `
172
-
173
- Post query arguments
174
- `
175
- rpwe_default_query_arguments
176
- `
177
-
178
- == Screenshots ==
179
-
180
- 1. The widget settings
181
-
182
- == Shorcode Explanation ==
183
-
184
- Explanation of shortcode options:
185
-
186
- Basic shortcode
187
- `
188
- [rpwe]
189
- `
190
-
191
- Display 10 recent posts
192
- `
193
- [rpwe limit="10"]
194
- `
195
-
196
- Display 10 recent posts with thumbnail
197
- `
198
- [rpwe limit="10" thumb="true"]
199
- `
200
-
201
- **Here's the full default shortcode arguments**
202
- `
203
- limit="5"
204
- offset=""
205
- order="DESC"
206
- orderby="date"
207
- post_type="post"
208
- cat=""
209
- tag=""
210
- taxonomy=""
211
- post_type="post"
212
- post_status="publish"
213
- ignore_sticky="1"
214
- taxonomy=""
215
- excerpt="false"
216
- length="10"
217
- thumb="true"
218
- thumb_height="45"
219
- thumb_width="45"
220
- thumb_default="http://placehold.it/45x45/f0f0f0/ccc"
221
- thumb_align="rpwe-alignleft"
222
- date="true"
223
- readmore="false"
224
- readmore_text="Read More &raquo;"
225
- styles_default="true"
226
- cssID=""
227
- before=""
228
- after=""
229
- `
230
-
231
- == Changelog ==
232
-
233
- **1.1.0**
234
-
235
- Release Date: Oct 25, 2021
236
-
237
- This release comes with several fixes and enhancements to support the new Widget Block in WordPress 5.8.
238
-
239
- **Enhancements:**
240
-
241
- - Adds `height` and `width` attribute to the image thumbnail.
242
-
243
- **Bugfixes:**
244
-
245
- - Fixes a bug the widget couldn't load on new Widgets Block page.
246
-
247
- **Warning:**
248
-
249
- Current thumbnail resize system will be deprecated and replaced with WordPress built-in thumbnail resize function.
250
-
251
-
252
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ === Recent Posts Widget Extended ===
2
+ Contributors: satrya
3
+ Donate link: https://paypal.me/satrya
4
+ Tags: recent posts, random posts, popular posts, thumbnails, widget, widgets, sidebar, excerpt, category, post tag, taxonomy, post type, post status, shortcode, multiple widgets
5
+ Requires at least: 5.8
6
+ Tested up to: 6.0
7
+ Requires PHP: 7.2
8
+ Stable tag: 2.0
9
+ License: GPLv3 or later
10
+ License URI: https://www.gnu.org/licenses/gpl-3.0.html
11
+
12
+ Provides flexible and advanced recent posts. Display it via shortcode or widget with thumbnails, post excerpt, taxonomy and more.
13
+
14
+ == Description ==
15
+
16
+ = Support this project =
17
+
18
+ If you are enjoying this plugin. I would appreciate a cup of coffee to help me keep coding and supporting the project! [Support & donate](https://paypal.me/satrya).
19
+
20
+ = Plugin description =
21
+
22
+ This plugin will enable a custom, flexible and advanced recent posts, you can display it via shortcode or widget. Allows you to display a list of the most recent posts with thumbnail, excerpt and post date, also you can display it from all or specific or multiple taxonomy, post type and much more!
23
+
24
+ = Features Include =
25
+
26
+ * Display by date, comment count or random.
27
+ * Enable thumbnails, with customizable size and alignment.
28
+ * Enable excerpt, with customizable length.
29
+ * Display from all, specific or multiple category or tag.
30
+ * Enable post date.
31
+ * Display modification date.
32
+ * Display comment count.
33
+ * Post type support.
34
+ * Taxonomy support.
35
+ * Post status.
36
+ * Custom HTML or text before and/or after recent posts.
37
+ * **Shortcode feature**.
38
+ * Crop image on the fly.
39
+ * Enable Read more.
40
+ * Custom CSS.
41
+ * Multiple widgets.
42
+ * Available filter for developer.
43
+
44
+ = Links =
45
+
46
+ * Translate to [your language](https://translate.wordpress.org/projects/wp-plugins/recent-posts-widget-extended/).
47
+ * Contribute or submit issues on [Github](https://github.com/gasatrya/recent-posts-widget-extended).
48
+
49
+ == Installation ==
50
+
51
+ **Through Dashboard**
52
+
53
+ 1. Log in to your WordPress admin panel and go to Plugins -> Add New
54
+ 2. Type **recent posts widget extended** in the search box and click on search button.
55
+ 3. Find Recent Posts Widget Extended plugin.
56
+ 4. Then click on Install Now after that activate the plugin.
57
+ 5. Go to the widgets page **Appearance -> Widgets**.
58
+ 6. Find **Recent Posts Extended** widget.
59
+
60
+ **Installing Via FTP**
61
+
62
+ 1. Download the plugin to your hardisk.
63
+ 2. Unzip.
64
+ 3. Upload the **recent-posts-widget-extended** folder into your plugins directory.
65
+ 4. Log in to your WordPress admin panel and click the Plugins menu.
66
+ 5. Then activate the plugin.
67
+ 6. Go to the widgets page **Appearance -> Widgets**.
68
+ 7. Find **Recent Posts Extended** widget.
69
+
70
+ == Frequently Asked Questions ==
71
+
72
+ = Shortcode Explanation =
73
+
74
+ Explanation of shortcode options:
75
+
76
+ Basic shortcode
77
+ `
78
+ [rpwe]
79
+ `
80
+
81
+ Display 10 recent posts
82
+ `
83
+ [rpwe limit="10"]
84
+ `
85
+
86
+ Display 10 recent posts without thumbnail
87
+ `
88
+ [rpwe limit="10" thumb="false"]
89
+ `
90
+
91
+ Open post link in new tab
92
+ `
93
+ [rpwe link_target="true"]
94
+ `
95
+
96
+ Disable default style
97
+ `
98
+ [rpwe styles_default="false"]
99
+ `
100
+
101
+ = Shortcode Arguments =
102
+
103
+ **Here are the full default shortcode arguments**
104
+ `
105
+ limit="5"
106
+ offset=""
107
+ order="DESC"
108
+ orderby="date"
109
+ post_type="post"
110
+ cat=""
111
+ tag=""
112
+ taxonomy=""
113
+ post_type="post"
114
+ post_status="publish"
115
+ ignore_sticky="1"
116
+ taxonomy=""
117
+
118
+ post_title="true"
119
+ link_target="false"
120
+ excerpt="false"
121
+ length="10"
122
+ thumb="true"
123
+ thumb_height="45"
124
+ thumb_width="45"
125
+ thumb_default="https://via.placeholder.com/45x45/f0f0f0/ccc"
126
+ thumb_align="rpwe-alignleft"
127
+ date="true"
128
+ readmore="false"
129
+ readmore_text="Read More &raquo;"
130
+
131
+ styles_default="true"
132
+ css_id=""
133
+ css_class=""
134
+ before=""
135
+ after=""
136
+ `
137
+
138
+ = How to filter the post query? =
139
+ You can use `rpwe_default_query_arguments` to filter it. Example:
140
+ `
141
+ add_filter( 'rpwe_default_query_arguments', 'your_custom_function' );
142
+ function your_custom_function( $args ) {
143
+ $args['posts_per_page'] = 10; // Changing the number of posts to show.
144
+ return $args;
145
+ }
146
+ `
147
+
148
+ = How to filter the post excerpt? =
149
+ Post excerpt now comes with filter to easily dev to change/customize it. `apply_filters( 'rpwe_excerpt', get_the_excerpt() )`
150
+
151
+ = Ordering not working! =
152
+ Did you installed any Post or Post Type Order? Please try to deactivate it and try again the ordering. [(related question)](http://wordpress.org/support/topic/ordering-set-to-descending-not-working)
153
+
154
+ = No image options =
155
+ Your theme needs to support Post Thumbnail, please go to http://codex.wordpress.org/Post_Thumbnails to read more info and how to activate it in your theme.
156
+
157
+ = How to add custom style? =
158
+ First, please uncheck the **Use Default Style** option then place the css code below on the Additional CSS panel on Customizer, then you can customize it to fit your needs
159
+ `
160
+ .rpwe-block ul {
161
+ list-style: none !important;
162
+ margin-left: 0 !important;
163
+ padding-left: 0 !important;
164
+ }
165
+ .rpwe-block li {
166
+ border-bottom: 1px solid #eee;
167
+ margin-bottom: 10px;
168
+ padding-bottom: 10px;
169
+ list-style-type: none;
170
+ }
171
+ .rpwe-block a {
172
+ display: inline !important;
173
+ text-decoration: none;
174
+ }
175
+ .rpwe-block h3 {
176
+ background: none !important;
177
+ clear: none;
178
+ margin-bottom: 0 !important;
179
+ margin-top: 0 !important;
180
+ font-weight: 400;
181
+ font-size: 12px !important;
182
+ line-height: 1.5em;
183
+ }
184
+ .rpwe-thumb {
185
+ border: 1px solid #eee !important;
186
+ box-shadow: none !important;
187
+ margin: 2px 10px 2px 0;
188
+ padding: 3px !important;
189
+ }
190
+ .rpwe-summary {
191
+ font-size: 12px;
192
+ }
193
+ .rpwe-time {
194
+ color: #bbb;
195
+ font-size: 11px;
196
+ }
197
+ .rpwe-alignleft {
198
+ display: inline;
199
+ float: left;
200
+ }
201
+ .rpwe-alignright {
202
+ display: inline;
203
+ float: right;
204
+ }
205
+ .rpwe-aligncenter {
206
+ display: block;
207
+ margin-left: auto;
208
+ margin-right: auto;
209
+ }
210
+ .rpwe-clearfix:before,.rpwe-clearfix:after {
211
+ content: "";
212
+ display: table !important;
213
+ }
214
+ .rpwe-clearfix:after {
215
+ clear: both;
216
+ }
217
+ .rpwe-clearfix {
218
+ zoom: 1;
219
+ }
220
+ `
221
+
222
+ = Why so many !important in the css code? =
223
+ I know it's not good but I have a good reason, the `!important` is to make sure the built-in style compatible with all themes. But if you don't like it, you can turn of the **Use Default Styles** and remove all custom css code in the **Custom CSS** box then create your own style.
224
+
225
+ = Available filters =
226
+ Default arguments
227
+ `
228
+ rpwe_default_args
229
+ `
230
+
231
+ Post excerpt
232
+ `
233
+ rpwe_excerpt
234
+ `
235
+
236
+ Post markup
237
+ `
238
+ rpwe_markup
239
+ `
240
+
241
+ Post query arguments
242
+ `
243
+ rpwe_default_query_arguments
244
+ `
245
+
246
+ == Screenshots ==
247
+
248
+ 1. Classic widget
249
+ 2. Block widget
250
+ 3. Shortcode
251
+
252
+ == Changelog ==
253
+
254
+ **2.0 - Major Changes**
255
+ *Release Date: Sept 22, 2022*
256
+
257
+ This release comes major changes to the codebase, several fixes and enhancements. The reason was to follow the latest WordPress coding standard, more secure. **Classic widget and block widget is now supported!**
258
+
259
+ **Breaking Changes:**
260
+
261
+ - **CSS ID** shortcode attribute for the container was `cssID` or `cssid`, please use `css_id` instead.
262
+ - **CSS ID** widget, please re-added your ID to the input field.
263
+ - `before` and `after` shortcode attribute move to inside the recent posts container.
264
+ - Widget **custom style** location change. If your style is not loaded, please re-save the widget.
265
+ - **Custom CSS** no longer editable, please move your custom CSS to the Additional CSS panel on Customizer.
266
+
267
+ **Enhancements:**
268
+
269
+ - Classic & blocks widget supported!
270
+ - Support **lazy** loading for the thumbnail.
271
+ - No more inline CSS, by default `rpwe-frontend.css` will be loaded if shortcode or widget present.
272
+ - No more `extract()`. [ref](https://developer.wordpress.org/coding-standards/wordpress-coding-standards/php/#dont-extract)
273
+ - **New** show hide the post title.
274
+
275
+ **Bug fixes:**
276
+
277
+ - Default image wasn't working correctly.
278
+ - `true` or `false` shortcode value.
rpwe.php CHANGED
@@ -1,123 +1,78 @@
1
- <?php
2
-
3
- /**
4
- * Plugin Name: Recent Posts Widget Extended
5
- * Plugin URI: https://idenovasi.com/projects/recent-posts-widget-extended/
6
- * Description: Enables advanced widget that gives you total control over the output of your site’s most recent Posts.
7
- * Version: 1.1.0
8
- * Requires at least: 5.8
9
- * Requires PHP: 7.2
10
- * Author: Idenovasi
11
- * Author URI: https://idenovasi.com/
12
- * License: GPL v2 or later
13
- * License URI: https://www.gnu.org/licenses/gpl-2.0.html
14
- * Text Domain: recent-posts-widget-extended
15
- * Domain Path: /languages
16
- */
17
-
18
- // Exit if accessed directly
19
- if (!defined('ABSPATH')) exit;
20
-
21
- class RPW_Extended {
22
-
23
- /**
24
- * PHP5 constructor method.
25
- *
26
- * @since 0.1
27
- */
28
- public function __construct() {
29
-
30
- // Set the constants needed by the plugin.
31
- add_action('plugins_loaded', array(&$this, 'constants'), 1);
32
-
33
- // Internationalize the text strings used.
34
- add_action('plugins_loaded', array(&$this, 'i18n'), 2);
35
-
36
- // Load the functions files.
37
- add_action('plugins_loaded', array(&$this, 'includes'), 3);
38
-
39
- // Load the admin style.
40
- add_action('admin_enqueue_scripts', array(&$this, 'admin_style'));
41
-
42
- // Register widget.
43
- add_action('widgets_init', array(&$this, 'register_widget'));
44
-
45
- // Register new image size.
46
- add_action('init', array(&$this, 'register_image_size'));
47
- }
48
-
49
- /**
50
- * Defines constants used by the plugin.
51
- *
52
- * @since 0.1
53
- */
54
- public function constants() {
55
-
56
- // Set constant path to the plugin directory.
57
- define('RPWE_DIR', trailingslashit(plugin_dir_path(__FILE__)));
58
-
59
- // Set the constant path to the plugin directory URI.
60
- define('RPWE_URI', trailingslashit(plugin_dir_url(__FILE__)));
61
-
62
- // Set the constant path to the includes directory.
63
- define('RPWE_INCLUDES', RPWE_DIR . trailingslashit('includes'));
64
-
65
- // Set the constant path to the includes directory.
66
- define('RPWE_CLASS', RPWE_DIR . trailingslashit('classes'));
67
-
68
- // Set the constant path to the assets directory.
69
- define('RPWE_ASSETS', RPWE_URI . trailingslashit('assets'));
70
- }
71
-
72
- /**
73
- * Loads the translation files.
74
- *
75
- * @since 0.1
76
- */
77
- public function i18n() {
78
- load_plugin_textdomain('recent-posts-widget-extended', false, dirname(plugin_basename(__FILE__)) . '/languages/');
79
- }
80
-
81
- /**
82
- * Loads the initial files needed by the plugin.
83
- *
84
- * @since 0.1
85
- */
86
- public function includes() {
87
- require_once(RPWE_INCLUDES . 'resizer.php');
88
- require_once(RPWE_INCLUDES . 'functions.php');
89
- require_once(RPWE_INCLUDES . 'shortcode.php');
90
- require_once(RPWE_INCLUDES . 'helpers.php');
91
- }
92
-
93
- /**
94
- * Register custom style for the widget settings.
95
- *
96
- * @since 0.8
97
- */
98
- public function admin_style() {
99
- // Loads the widget style.
100
- wp_enqueue_style('rpwe-admin-style', trailingslashit(RPWE_ASSETS) . 'css/rpwe-admin.css', null, null);
101
- }
102
-
103
- /**
104
- * Register the widget.
105
- *
106
- * @since 0.9.1
107
- */
108
- public function register_widget() {
109
- require_once(RPWE_CLASS . 'widget.php');
110
- register_widget('Recent_Posts_Widget_Extended');
111
- }
112
-
113
- /**
114
- * Register new image size.
115
- *
116
- * @since 0.9.4
117
- */
118
- function register_image_size() {
119
- add_image_size('rpwe-thumbnail', 45, 45, true);
120
- }
121
- }
122
-
123
- new RPW_Extended;
1
+ <?php
2
+ /**
3
+ * Plugin Name: Recent Posts Widget Extended
4
+ * Plugin URI: https://github.com/gasatrya/recent-posts-widget-extended
5
+ * Description: Enables advanced widget & shortcode that gives you total control over the output of your site’s most recent Posts.
6
+ * Version: 2.0
7
+ * Requires at least: 5.8
8
+ * Requires PHP: 7.2
9
+ * Author: Ga Satrya
10
+ * Author URI: https://gasatrya.dev/
11
+ * License: GPL v3 or later
12
+ * License URI: https://www.gnu.org/licenses/gpl-3.0.html
13
+ * Text Domain: recent-posts-widget-extended
14
+ * Domain Path: /languages
15
+ *
16
+ * @package Recent Posts Extended
17
+ */
18
+
19
+ // Exit if accessed directly.
20
+ if ( ! defined( 'ABSPATH' ) ) {
21
+ exit;
22
+ }
23
+
24
+ define( 'RPWE_VERSION', '2.0' );
25
+ define( 'RPWE_CLASSES', plugin_dir_path( __FILE__ ) . 'classes' );
26
+ define( 'RPWE_INCLUDES', plugin_dir_path( __FILE__ ) . 'includes' );
27
+ define( 'RPWE_ASSETS', plugin_dir_url( __FILE__ ) . 'assets' );
28
+
29
+ // Loads plugin files.
30
+ require_once RPWE_CLASSES . '/class-image-resizer.php';
31
+ require_once RPWE_INCLUDES . '/defaults.php';
32
+ require_once RPWE_INCLUDES . '/query.php';
33
+ require_once RPWE_INCLUDES . '/functions.php';
34
+ require_once RPWE_INCLUDES . '/shortcode.php';
35
+ require_once RPWE_INCLUDES . '/helpers.php';
36
+
37
+ /**
38
+ * Language
39
+ */
40
+ function rpwe_i18n() {
41
+ load_plugin_textdomain( 'recent-posts-widget-extended', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
42
+ }
43
+ add_action( 'plugins_loaded', 'rpwe_i18n' );
44
+
45
+ /**
46
+ * Widget register.
47
+ */
48
+ function rpwe_widget_register() {
49
+ require_once RPWE_CLASSES . '/class-rpwe-widget.php';
50
+ register_widget( 'RPWE_Widget' );
51
+ }
52
+ add_action( 'widgets_init', 'rpwe_widget_register' );
53
+
54
+ /**
55
+ * Custom admin scripts.
56
+ */
57
+ function rpwe_admin_scripts() {
58
+ wp_enqueue_style( 'rpwe-admin-style', RPWE_ASSETS . '/css/rpwe-admin.css', null, RPWE_VERSION );
59
+ }
60
+ add_action( 'admin_enqueue_scripts', 'rpwe_admin_scripts' );
61
+
62
+ /**
63
+ * Enqueue frontend stylesheet
64
+ */
65
+ function rpwe_frontend_style() {
66
+ wp_register_style( 'rpwe-style', RPWE_ASSETS . '/css/rpwe-frontend.css', array(), RPWE_VERSION );
67
+ }
68
+ add_action( 'wp_enqueue_scripts', 'rpwe_frontend_style' );
69
+
70
+ /**
71
+ * Custom image size.
72
+ *
73
+ * DEPRECATED
74
+ */
75
+ function rpwe_register_image_size() {
76
+ add_image_size( 'rpwe-thumbnail', 45, 45, true );
77
+ }
78
+ add_action( 'init', 'rpwe_register_image_size' );