Completed
Pull Request — master (#801)
by Jared
13:18
created
lib/timber-post-getter.php 1 patch
Braces   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 			$query = false;
38 38
 		}
39 39
 
40
-		if (is_object($query) && !is_a($query, 'WP_Query') ){
40
+		if (is_object($query) && !is_a($query, 'WP_Query') ) {
41 41
 			// The only object other than a query is a type of post object
42 42
 			$query = array( $query );
43 43
 		}
@@ -52,11 +52,11 @@  discard block
 block discarded – undo
52 52
 		}
53 53
 	}
54 54
 
55
-	static function get_pids($query){
55
+	static function get_pids($query) {
56 56
 		$posts = self::get_posts($query);
57 57
 		$pids = array();
58
-		foreach($posts as $post){
59
-			if (isset($post->ID)){
58
+		foreach($posts as $post) {
59
+			if (isset($post->ID)) {
60 60
 				$pids[] = $post->ID;
61 61
 			}
62 62
 		}
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 	 * @param string|array $arg
90 90
 	 * @return bool
91 91
 	 */
92
-	static function is_post_class_or_class_map($arg){
92
+	static function is_post_class_or_class_map($arg) {
93 93
 		if (is_string($arg) && class_exists($arg)) {
94 94
 			return true;
95 95
 		}
Please login to merge, or discard this patch.
lib/timber-post.php 1 patch
Braces   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -188,13 +188,13 @@  discard block
 block discarded – undo
188 188
 			&& get_class($wp_query->queried_object) == 'WP_Post'
189 189
 			) {
190 190
 			$pid = $wp_query->queried_object_id;
191
-		} else if ( $pid === null && $wp_query->is_home && isset($wp_query->queried_object_id) && $wp_query->queried_object_id )  {
191
+		} else if ( $pid === null && $wp_query->is_home && isset($wp_query->queried_object_id) && $wp_query->queried_object_id ) {
192 192
 			//hack for static page as home page
193 193
 			$pid = $wp_query->queried_object_id;
194 194
 		} else if ( $pid === null ) {
195 195
 			$gtid = false;
196 196
 			$maybe_post = get_post();
197
-			if ( isset($maybe_post->ID) ){
197
+			if ( isset($maybe_post->ID) ) {
198 198
 				$gtid = true;
199 199
 			}
200 200
 			if ( $gtid ) {
@@ -1028,7 +1028,7 @@  discard block
 block discarded – undo
1028 1028
 		$post = $this;
1029 1029
 		$class_array = get_post_class($class, $this->ID);
1030 1030
 		$post = $old_global_post;
1031
-		if ( is_array($class_array) ){
1031
+		if ( is_array($class_array) ) {
1032 1032
 			return implode(' ', $class_array);
1033 1033
 		}
1034 1034
 		return $class_array;
@@ -1248,7 +1248,7 @@  discard block
 block discarded – undo
1248 1248
 	/**
1249 1249
 	 * @return string
1250 1250
 	 */
1251
-	public function name(){
1251
+	public function name() {
1252 1252
 		return $this->title();
1253 1253
 	}
1254 1254
 
Please login to merge, or discard this patch.
lib/timber-posts-collection.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,14 +1,15 @@
 block discarded – undo
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 ) {
Please login to merge, or discard this patch.
lib/timber-query-iterator.php 1 patch
Braces   +9 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,7 +1,8 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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',
Please login to merge, or discard this patch.
lib/timber-term.php 1 patch
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -116,7 +116,7 @@
 block discarded – undo
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) ) {
Please login to merge, or discard this patch.
lib/timber-url-helper.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -267,8 +267,9 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
lib/timber-term-getter.php 1 patch
Braces   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -8,36 +8,36 @@  discard block
 block discarded – undo
8 8
      * @param string $TermClass
9 9
      * @return mixed
10 10
      */
11
-    public static function get_terms($args = null, $maybe_args = array(), $TermClass = 'TimberTerm'){
12
-        if (is_string($maybe_args) && !strstr($maybe_args, '=')){
11
+    public static function get_terms($args = null, $maybe_args = array(), $TermClass = 'TimberTerm') {
12
+        if (is_string($maybe_args) && !strstr($maybe_args, '=')) {
13 13
             //the user is sending the $TermClass in the second argument
14 14
             $TermClass = $maybe_args;
15 15
         }
16
-        if (is_string($maybe_args) && strstr($maybe_args, '=')){
16
+        if (is_string($maybe_args) && strstr($maybe_args, '=')) {
17 17
             parse_str($maybe_args, $maybe_args);
18 18
         }
19
-        if (is_string($args) && strstr($args, '=')){
19
+        if (is_string($args) && strstr($args, '=')) {
20 20
             //a string and a query string!
21 21
             $parsed = self::get_term_query_from_query_string($args);
22
-            if (is_array($maybe_args)){
22
+            if (is_array($maybe_args)) {
23 23
                 $parsed->args = array_merge($parsed->args, $maybe_args);
24 24
             }
25 25
             return self::handle_term_query($parsed->taxonomies, $parsed->args, $TermClass);
26
-        } else if (is_string($args)){
26
+        } else if (is_string($args)) {
27 27
             //its just a string with a single taxonomy
28 28
             $parsed = self::get_term_query_from_string($args);
29
-            if (is_array($maybe_args)){
29
+            if (is_array($maybe_args)) {
30 30
                 $parsed->args = array_merge($parsed->args, $maybe_args);
31 31
             }
32 32
             return self::handle_term_query($parsed->taxonomies, $parsed->args, $TermClass);
33
-        } else if (is_array($args) && TimberHelper::is_array_assoc($args)){
33
+        } else if (is_array($args) && TimberHelper::is_array_assoc($args)) {
34 34
             //its an associative array, like a good ole query
35 35
             $parsed = self::get_term_query_from_assoc_array($args);
36 36
             return self::handle_term_query($parsed->taxonomies, $parsed->args, $TermClass);
37
-        } else if (is_array($args)){
37
+        } else if (is_array($args)) {
38 38
             //its just an array of strings or IDs (hopefully)
39 39
             $parsed = self::get_term_query_from_array($args);
40
-            if (is_array($maybe_args)){
40
+            if (is_array($maybe_args)) {
41 41
                 $parsed->args = array_merge($parsed->args, $maybe_args);
42 42
             }
43 43
             return self::handle_term_query($parsed->taxonomies, $parsed->args, $TermClass);
@@ -53,18 +53,18 @@  discard block
 block discarded – undo
53 53
      * @param string $TermClass
54 54
      * @return mixed
55 55
      */
56
-    public static function handle_term_query($taxonomies, $args, $TermClass){
57
-        if (!isset($args['hide_empty'])){
56
+    public static function handle_term_query($taxonomies, $args, $TermClass) {
57
+        if (!isset($args['hide_empty'])) {
58 58
             $args['hide_empty'] = false;
59 59
         }
60
-        if (isset($args['term_id']) && is_int($args['term_id'])){
60
+        if (isset($args['term_id']) && is_int($args['term_id'])) {
61 61
             $args['term_id'] = array($args['term_id']);
62 62
         }
63
-        if (isset($args['term_id'])){
63
+        if (isset($args['term_id'])) {
64 64
             $args['include'] = $args['term_id'];
65 65
         }
66 66
         $terms = get_terms($taxonomies, $args);
67
-        foreach($terms as &$term){
67
+        foreach($terms as &$term) {
68 68
             $term = new $TermClass($term->term_id, $term->taxonomy);
69 69
         }
70 70
         return $terms;
Please login to merge, or discard this patch.