Completed
Pull Request — master (#793)
by Jared
03:28 queued 29s
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-getter.php 1 patch
Braces   +16 added lines, -17 removed lines patch added patch discarded remove patch
@@ -1,7 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-class TimberTermGetter
4
-{
3
+class TimberTermGetter {
5 4
 
6 5
     /**
7 6
      * @param string|array $args
@@ -9,36 +8,36 @@  discard block
 block discarded – undo
9 8
      * @param string $TermClass
10 9
      * @return mixed
11 10
      */
12
-    public static function get_terms($args = null, $maybe_args = array(), $TermClass = 'TimberTerm'){
13
-        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, '=')) {
14 13
             //the user is sending the $TermClass in the second argument
15 14
             $TermClass = $maybe_args;
16 15
         }
17
-        if (is_string($maybe_args) && strstr($maybe_args, '=')){
16
+        if (is_string($maybe_args) && strstr($maybe_args, '=')) {
18 17
             parse_str($maybe_args, $maybe_args);
19 18
         }
20
-        if (is_string($args) && strstr($args, '=')){
19
+        if (is_string($args) && strstr($args, '=')) {
21 20
             //a string and a query string!
22 21
             $parsed = TimberTermGetter::get_term_query_from_query_string($args);
23
-            if (is_array($maybe_args)){
22
+            if (is_array($maybe_args)) {
24 23
                 $parsed->args = array_merge($parsed->args, $maybe_args);
25 24
             }
26 25
             return self::handle_term_query($parsed->taxonomies, $parsed->args, $TermClass);
27
-        } else if (is_string($args)){
26
+        } else if (is_string($args)) {
28 27
             //its just a string with a single taxonomy
29 28
             $parsed = TimberTermGetter::get_term_query_from_string($args);
30
-            if (is_array($maybe_args)){
29
+            if (is_array($maybe_args)) {
31 30
                 $parsed->args = array_merge($parsed->args, $maybe_args);
32 31
             }
33 32
             return self::handle_term_query($parsed->taxonomies, $parsed->args, $TermClass);
34
-        } else if (is_array($args) && TimberHelper::is_array_assoc($args)){
33
+        } else if (is_array($args) && TimberHelper::is_array_assoc($args)) {
35 34
             //its an associative array, like a good ole query
36 35
             $parsed = TimberTermGetter::get_term_query_from_assoc_array($args);
37 36
             return self::handle_term_query($parsed->taxonomies, $parsed->args, $TermClass);
38
-        } else if (is_array($args)){
37
+        } else if (is_array($args)) {
39 38
             //its just an array of strings or IDs (hopefully)
40 39
             $parsed = TimberTermGetter::get_term_query_from_array($args);
41
-            if (is_array($maybe_args)){
40
+            if (is_array($maybe_args)) {
42 41
                 $parsed->args = array_merge($parsed->args, $maybe_args);
43 42
             }
44 43
             return self::handle_term_query($parsed->taxonomies, $parsed->args, $TermClass);
@@ -54,18 +53,18 @@  discard block
 block discarded – undo
54 53
      * @param string $TermClass
55 54
      * @return mixed
56 55
      */
57
-    public static function handle_term_query($taxonomies, $args, $TermClass){
58
-        if (!isset($args['hide_empty'])){
56
+    public static function handle_term_query($taxonomies, $args, $TermClass) {
57
+        if (!isset($args['hide_empty'])) {
59 58
             $args['hide_empty'] = false;
60 59
         }
61
-        if (isset($args['term_id']) && is_int($args['term_id'])){
60
+        if (isset($args['term_id']) && is_int($args['term_id'])) {
62 61
             $args['term_id'] = array($args['term_id']);
63 62
         }
64
-        if (isset($args['term_id'])){
63
+        if (isset($args['term_id'])) {
65 64
             $args['include'] = $args['term_id'];
66 65
         }
67 66
         $terms = get_terms($taxonomies, $args);
68
-        foreach($terms as &$term){
67
+        foreach($terms as &$term) {
69 68
             $term = new $TermClass($term->term_id, $term->taxonomy);
70 69
         }
71 70
         return $terms;
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.