PluginProbe
wpForo Forum / 3.2.0
wpForo Forum v3.2.0
3.2.1 3.2.0 3.1.7 3.1.6 3.1.5 3.1.4 3.1.2 3.1.1 3.1.0 3.0.9 3.0.8 3.0.7 trunk 1.0.0 1.0.1 1.0.2 1.1.0 1.1.1 1.1.2 1.2.0 1.3.0 1.3.1 1.4.0 1.4.1 1.4.10 All 141 releases
← All changes | blocks/recent-posts/render.php +10 -0 3.0.7 → 3.2.0 View file →
@@ -24,9 +24,19 @@
24 24 'refresh_interval' => 0,
25 25 'excerpt_length' => 55,
26 26 ];
27 27
28 +$allowed_orderby = [ 'created', 'modified' ];
29 +$allowed_order = [ 'DESC', 'ASC', 'RAND' ];
30 +
28 31 $instance = wp_parse_args( $attributes, $default_instance );
32 +
33 +if( ! is_string( $instance['orderby'] ) || ! in_array( $instance['orderby'], $allowed_orderby, true ) ) {
34 + $instance['orderby'] = $default_instance['orderby'];
35 +}
36 +if( ! is_string( $instance['order'] ) || ! in_array( $instance['order'], $allowed_order, true ) ) {
37 + $instance['order'] = $default_instance['order'];
38 +}
29 39
30 40 // wpForo Recent Posts widget logic
31 41 wp_enqueue_script( 'wpforo-widgets-js' );
32 42