@@ -1,14 +1,15 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | // Exit if accessed directly |
4 | -if ( !defined( 'ABSPATH' ) ) |
|
4 | +if ( !defined( 'ABSPATH' ) ) { |
|
5 | 5 | exit; |
6 | +} |
|
6 | 7 | |
7 | 8 | class TimberPostsCollection extends ArrayObject { |
8 | 9 | |
9 | 10 | public function __construct( $posts = array(), $post_class = 'TimberPost' ) { |
10 | 11 | $returned_posts = array(); |
11 | - if ( is_null( $posts ) ){ |
|
12 | + if ( is_null( $posts ) ) { |
|
12 | 13 | $posts = array(); |
13 | 14 | } |
14 | 15 | foreach ( $posts as $post_object ) { |
@@ -1,7 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | // Exit if accessed directly |
3 | -if ( !defined( 'ABSPATH' ) ) |
|
3 | +if ( !defined( 'ABSPATH' ) ) { |
|
4 | 4 | exit; |
5 | +} |
|
5 | 6 | |
6 | 7 | class TimberQueryIterator implements Iterator { |
7 | 8 | |
@@ -15,8 +16,9 @@ discard block |
||
15 | 16 | |
16 | 17 | public function __construct( $query = false, $posts_class = 'TimberPost' ) { |
17 | 18 | add_action( 'pre_get_posts', array($this, 'fix_number_posts_wp_quirk' )); |
18 | - if ( $posts_class ) |
|
19 | - $this->_posts_class = $posts_class; |
|
19 | + if ( $posts_class ) { |
|
20 | + $this->_posts_class = $posts_class; |
|
21 | + } |
|
20 | 22 | |
21 | 23 | if ( is_a( $query, 'WP_Query' ) ) { |
22 | 24 | // We got a full-fledged WP Query, look no further! |
@@ -55,7 +57,7 @@ discard block |
||
55 | 57 | } |
56 | 58 | |
57 | 59 | public function get_posts( $return_collection = false ) { |
58 | - if (isset($this->_query->posts)){ |
|
60 | + if (isset($this->_query->posts)) { |
|
59 | 61 | $posts = new TimberPostsCollection( $this->_query->posts, $this->_posts_class ); |
60 | 62 | return ( $return_collection ) ? $posts : $posts->get_posts(); |
61 | 63 | } |
@@ -65,8 +67,9 @@ discard block |
||
65 | 67 | // GET POSTS |
66 | 68 | // |
67 | 69 | public static function get_query_from_array_of_ids( $query = array() ) { |
68 | - if ( !is_array( $query ) || !count( $query ) ) |
|
69 | - return null; |
|
70 | + if ( !is_array( $query ) || !count( $query ) ) { |
|
71 | + return null; |
|
72 | + } |
|
70 | 73 | |
71 | 74 | return new WP_Query( array( |
72 | 75 | 'post_type'=> 'any', |
@@ -116,7 +116,7 @@ |
||
116 | 116 | //echo 'bad call using '.$tid; |
117 | 117 | //TimberHelper::error_log(debug_backtrace()); |
118 | 118 | } |
119 | - if ( isset($term->ID) ){ |
|
119 | + if ( isset($term->ID) ) { |
|
120 | 120 | $term->id = $term->ID; |
121 | 121 | $this->import($term); |
122 | 122 | if ( isset($term->term_id) ) { |
@@ -267,8 +267,9 @@ |
||
267 | 267 | * @return string |
268 | 268 | */ |
269 | 269 | public static function remove_trailing_slash( $link ) { |
270 | - if ( $link != "/" ) |
|
271 | - $link = untrailingslashit( $link ); |
|
270 | + if ( $link != "/" ) { |
|
271 | + $link = untrailingslashit( $link ); |
|
272 | + } |
|
272 | 273 | return $link; |
273 | 274 | } |
274 | 275 |
@@ -28,7 +28,9 @@ |
||
28 | 28 | $this->_class = $function[0]; |
29 | 29 | } |
30 | 30 | |
31 | - if( is_string( $function[1] ) ) $this->_function = $function[1]; |
|
31 | + if( is_string( $function[1] ) ) { |
|
32 | + $this->_function = $function[1]; |
|
33 | + } |
|
32 | 34 | } else { |
33 | 35 | $this->_function = $function; |
34 | 36 | } |