Completed
Pull Request — master (#895)
by
unknown
02:49
created
lib/timber-comment.php 1 patch
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 	/**
41 41
 	 * @param int $cid
42 42
 	 */
43
-	function __construct($cid) {
43
+	function __construct( $cid ) {
44 44
 		$this->init($cid);
45 45
 	}
46 46
 
@@ -52,9 +52,9 @@  discard block
 block discarded – undo
52 52
 	 * @internal
53 53
 	 * @param integer $cid
54 54
 	 */
55
-	function init($cid) {
55
+	function init( $cid ) {
56 56
 		$comment_data = $cid;
57
-		if (is_integer($cid)) {
57
+		if ( is_integer($cid) ) {
58 58
 			$comment_data = get_comment($cid);
59 59
 		}
60 60
 		$this->import($comment_data);
@@ -86,11 +86,11 @@  discard block
 block discarded – undo
86 86
 	 * @return TimberUser
87 87
 	 */
88 88
 	public function author() {
89
-		if ($this->user_id) {
89
+		if ( $this->user_id ) {
90 90
 			return new TimberUser($this->user_id);
91 91
 		} else {
92 92
 			$author = new TimberUser(0);
93
-			if (isset($this->comment_author) && $this->comment_author) {
93
+			if ( isset($this->comment_author) && $this->comment_author ) {
94 94
 				$author->name = $this->comment_author;
95 95
 			} else {
96 96
 				$author->name = 'Anonymous';
@@ -113,22 +113,22 @@  discard block
 block discarded – undo
113 113
 	 * @param string $default
114 114
 	 * @return bool|mixed|string
115 115
 	 */
116
-	public function avatar($size = 92, $default = '') {
117
-		if (!get_option('show_avatars')) {
116
+	public function avatar( $size = 92, $default = '' ) {
117
+		if ( !get_option('show_avatars') ) {
118 118
 			return false;
119 119
 		}
120
-		if (!is_numeric($size)) {
120
+		if ( !is_numeric($size) ) {
121 121
 			$size = '92';
122 122
 		}
123 123
 
124 124
 		$email = $this->avatar_email();
125 125
 		$email_hash = '';
126
-		if (!empty($email)) {
126
+		if ( !empty($email) ) {
127 127
 			$email_hash = md5(strtolower(trim($email)));
128 128
 		}
129 129
 		$host = $this->avatar_host($email_hash);
130 130
 		$default = $this->avatar_default($default, $email, $size, $host);
131
-		if (!empty($email)) {
131
+		if ( !empty($email) ) {
132 132
 			$avatar = $this->avatar_out($default, $host, $email_hash, $size);
133 133
 		} else {
134 134
 			$avatar = $default;
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 	 */
182 182
 	public function date( $date_format = '' ) {
183 183
 		$df = $date_format ? $date_format : get_option('date_format');
184
-		$the_date = (string)mysql2date($df, $this->comment_date);
184
+		$the_date = (string) mysql2date($df, $this->comment_date);
185 185
 		return apply_filters('get_comment_date ', $the_date, $df);
186 186
 	}
187 187
 
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
 	 */
207 207
 	public function time( $time_format = '' ) {
208 208
 		$tf = $time_format ? $time_format : get_option('time_format');
209
-		$the_time = (string)mysql2date($tf, $this->comment_date);
209
+		$the_time = (string) mysql2date($tf, $this->comment_date);
210 210
 		return apply_filters('get_comment_time', $the_time, $tf);
211 211
 	}
212 212
 
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
 	 * @param string $field_name
215 215
 	 * @return mixed
216 216
 	 */
217
-	public function meta($field_name) {
217
+	public function meta( $field_name ) {
218 218
 		return $this->get_meta_field($field_name);
219 219
 	}
220 220
 
@@ -231,15 +231,15 @@  discard block
 block discarded – undo
231 231
 	 * @param int $comment_id
232 232
 	 * @return mixed
233 233
 	 */
234
-	protected function get_meta_fields($comment_id = null) {
235
-		if ($comment_id === null) {
234
+	protected function get_meta_fields( $comment_id = null ) {
235
+		if ( $comment_id === null ) {
236 236
 			$comment_id = $this->ID;
237 237
 		}
238 238
 		//Could not find a WP function to fetch all comment meta data, so I made one.
239 239
 		apply_filters('timber_comment_get_meta_pre', array(), $comment_id);
240 240
 		$comment_metas = get_comment_meta($comment_id);
241
-		foreach ($comment_metas as &$cm) {
242
-			if (is_array($cm) && count($cm) == 1) {
241
+		foreach ( $comment_metas as &$cm ) {
242
+			if ( is_array($cm) && count($cm) == 1 ) {
243 243
 				$cm = $cm[0];
244 244
 			}
245 245
 		}
@@ -252,9 +252,9 @@  discard block
 block discarded – undo
252 252
 	 * @param string $field_name
253 253
 	 * @return mixed
254 254
 	 */
255
-	protected function get_meta_field($field_name) {
255
+	protected function get_meta_field( $field_name ) {
256 256
 		$value = apply_filters('timber_comment_get_meta_field_pre', null, $this->ID, $field_name, $this);
257
-		if ($value === null) {
257
+		if ( $value === null ) {
258 258
 			$value = get_comment_meta($this->ID, $field_name, true);
259 259
 		}
260 260
 		$value = apply_filters('timber_comment_get_meta_field', $value, $this->ID, $field_name, $this);
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
 	 */
270 270
 	public function reply_link( $reply_text = 'Reply' ) {
271 271
 		if ( is_singular() && comments_open() && get_option('thread_comments') ) {
272
-			wp_enqueue_script( 'comment-reply' );
272
+			wp_enqueue_script('comment-reply');
273 273
 		}
274 274
 
275 275
 		// Get the comments depth option from the admin panel
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
 			'max_depth' => $max_depth,
285 285
 		);
286 286
 
287
-		return get_comment_reply_link( $args, $this->ID, $this->post_id );
287
+		return get_comment_reply_link($args, $this->ID, $this->post_id);
288 288
 	}
289 289
 
290 290
 	/* AVATAR Stuff
@@ -295,9 +295,9 @@  discard block
 block discarded – undo
295 295
 	 * @return string
296 296
 	 */
297 297
 	protected function avatar_email() {
298
-		$id = (int)$this->user_id;
298
+		$id = (int) $this->user_id;
299 299
 		$user = get_userdata($id);
300
-		if ($user) {
300
+		if ( $user ) {
301 301
 			$email = $user->user_email;
302 302
 		} else {
303 303
 			$email = $this->comment_author_email;
@@ -310,11 +310,11 @@  discard block
 block discarded – undo
310 310
 	 * @param string $email_hash
311 311
 	 * @return string
312 312
 	 */
313
-	protected function avatar_host($email_hash) {
314
-		if (is_ssl()) {
313
+	protected function avatar_host( $email_hash ) {
314
+		if ( is_ssl() ) {
315 315
 			$host = 'https://secure.gravatar.com';
316 316
 		} else {
317
-			if (!empty($email_hash)) {
317
+			if ( !empty($email_hash) ) {
318 318
 				$host = sprintf("http://%d.gravatar.com", (hexdec($email_hash[0]) % 2));
319 319
 			} else {
320 320
 				$host = 'http://0.gravatar.com';
@@ -332,29 +332,29 @@  discard block
 block discarded – undo
332 332
 	 * @param string $host
333 333
 	 * @return string
334 334
 	 */
335
-	protected function avatar_default($default, $email, $size, $host) {
336
-		if (substr($default, 0, 1) == '/') {
335
+	protected function avatar_default( $default, $email, $size, $host ) {
336
+		if ( substr($default, 0, 1) == '/' ) {
337 337
 			$default = home_url() . $default;
338 338
 		}
339 339
 
340
-		if (empty($default)) {
340
+		if ( empty($default) ) {
341 341
 			$avatar_default = get_option('avatar_default');
342
-			if (empty($avatar_default)) {
342
+			if ( empty($avatar_default) ) {
343 343
 				$default = 'mystery';
344 344
 			} else {
345 345
 				$default = $avatar_default;
346 346
 			}
347 347
 		}
348
-		if ('mystery' == $default) {
348
+		if ( 'mystery' == $default ) {
349 349
 			$default = $host . '/avatar/ad516503a11cd5ca435acc9bb6523536?s=' . $size;
350 350
 			// ad516503a11cd5ca435acc9bb6523536 == md5('[email protected]')
351
-		} else if ('blank' == $default) {
351
+		} else if ( 'blank' == $default ) {
352 352
 			$default = $email ? 'blank' : includes_url('images/blank.gif');
353
-		} else if (!empty($email) && 'gravatar_default' == $default) {
353
+		} else if ( !empty($email) && 'gravatar_default' == $default ) {
354 354
 			$default = '';
355
-		} else if ('gravatar_default' == $default) {
355
+		} else if ( 'gravatar_default' == $default ) {
356 356
 			$default = $host . '/avatar/?s=' . $size;
357
-		} else if (empty($email) && !strstr($default, 'http://')) {
357
+		} else if ( empty($email) && !strstr($default, 'http://') ) {
358 358
 			$default = $host . '/avatar/?d=' . $default . '&s=' . $size;
359 359
 		}
360 360
 		return $default;
@@ -368,10 +368,10 @@  discard block
 block discarded – undo
368 368
 	 * @param string $size
369 369
 	 * @return mixed
370 370
 	 */
371
-	protected function avatar_out($default, $host, $email_hash, $size) {
371
+	protected function avatar_out( $default, $host, $email_hash, $size ) {
372 372
 		$out = $host . '/avatar/' . $email_hash . '?s=' . $size . '&d=' . urlencode($default);
373 373
 		$rating = get_option('avatar_rating');
374
-		if (!empty($rating)) {
374
+		if ( !empty($rating) ) {
375 375
 			$out .= '&r=' . $rating;
376 376
 		}
377 377
 		return str_replace('&', '&', esc_url($out));
Please login to merge, or discard this patch.
lib/timber-term-getter.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  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') {
11
+	public static function get_terms( $args = null, $maybe_args = array(), $TermClass = 'TimberTerm' ) {
12 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;
@@ -53,7 +53,7 @@  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) {
56
+	public static function handle_term_query( $taxonomies, $args, $TermClass ) {
57 57
 		if ( !isset($args['hide_empty']) ) {
58 58
 			$args['hide_empty'] = false;
59 59
 		}
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
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;
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 	 * @param string $query_string
75 75
 	 * @return stdClass
76 76
 	 */
77
-	protected static function get_term_query_from_query_string($query_string) {
77
+	protected static function get_term_query_from_query_string( $query_string ) {
78 78
 		$args = array();
79 79
 		parse_str($query_string, $args);
80 80
 		$ret = self::get_term_query_from_assoc_array($args);
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 	 * @param string $taxs
86 86
 	 * @return stdClass
87 87
 	 */
88
-	protected static function get_term_query_from_string($taxs) {
88
+	protected static function get_term_query_from_string( $taxs ) {
89 89
 		$ret = new stdClass();
90 90
 		$ret->args = array();
91 91
 		if ( is_string($taxs) ) {
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 	 * @param array $args
100 100
 	 * @return stdClass
101 101
 	 */
102
-	public static function get_term_query_from_assoc_array($args) {
102
+	public static function get_term_query_from_assoc_array( $args ) {
103 103
 		$ret = new stdClass();
104 104
 		$ret->args = $args;
105 105
 		if ( isset($ret->args['tax']) ) {
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 	 * @param array $args
127 127
 	 * @return stdClass
128 128
 	 */
129
-	public static function get_term_query_from_array($args) {
129
+	public static function get_term_query_from_array( $args ) {
130 130
 		if ( is_array($args) && !empty($args) ) {
131 131
 			//okay its an array with content
132 132
 			if ( is_int($args[0]) ) {
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
 	 * @param integer[] $args
143 143
 	 * @return stdClass
144 144
 	 */
145
-	public static function get_term_query_from_array_of_ids($args) {
145
+	public static function get_term_query_from_array_of_ids( $args ) {
146 146
 		$ret = new stdClass();
147 147
 		$ret->taxonomies = get_taxonomies();
148 148
 		$ret->args['include'] = $args;
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
 	 * @param string[] $args
154 154
 	 * @return stdClass
155 155
 	 */
156
-	public static function get_term_query_from_array_of_strings($args) {
156
+	public static function get_term_query_from_array_of_strings( $args ) {
157 157
 		$ret = new stdClass();
158 158
 		$ret->taxonomies = self::correct_taxonomy_names($args);
159 159
 		$ret->args = array();
@@ -164,11 +164,11 @@  discard block
 block discarded – undo
164 164
 	 * @param string|array $taxs
165 165
 	 * @return array
166 166
 	 */
167
-	private static function correct_taxonomy_names($taxs) {
167
+	private static function correct_taxonomy_names( $taxs ) {
168 168
 		if ( is_string($taxs) ) {
169 169
 			$taxs = array($taxs);
170 170
 		}
171
-		foreach ($taxs as &$tax) {
171
+		foreach ( $taxs as &$tax ) {
172 172
 			if ( $tax == 'tags' || $tax == 'tag' ) {
173 173
 				$tax = 'post_tag';
174 174
 			} else if ( $tax == 'categories' ) {
Please login to merge, or discard this patch.
lib/timber-user.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 	/**
54 54
 	 * @param int|bool $uid
55 55
 	 */
56
-	function __construct($uid = false) {
56
+	function __construct( $uid = false ) {
57 57
 		$this->init($uid);
58 58
 	}
59 59
 
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 	 * @param string $field_name
85 85
 	 * @return null
86 86
 	 */
87
-	function get_meta($field_name) {
87
+	function get_meta( $field_name ) {
88 88
 		return $this->get_meta_field($field_name);
89 89
 	}
90 90
 
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 	 * @param string 	$field
94 94
 	 * @param mixed 	$value
95 95
 	 */
96
-	function __set($field, $value) {
96
+	function __set( $field, $value ) {
97 97
 		if ( $field == 'name' ) {
98 98
 			$this->display_name = $value;
99 99
 		}
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
 	 * @internal
105 105
 	 * @param int|bool $uid The user ID to use
106 106
 	 */
107
-	protected function init($uid = false) {
107
+	protected function init( $uid = false ) {
108 108
 		if ( $uid === false ) {
109 109
 			$uid = get_current_user_id();
110 110
 		}
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 	 * @param string $field_name
138 138
 	 * @return mixed
139 139
 	 */
140
-	function get_meta_field($field_name) {
140
+	function get_meta_field( $field_name ) {
141 141
 		$value = null;
142 142
 		$value = apply_filters('timber_user_get_meta_field_pre', $value, $this->ID, $field_name, $this);
143 143
 		if ( $value === null ) {
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
 				$um = get_user_meta($this->ID);
159 159
 			}
160 160
 			$custom = array();
161
-			foreach ($um as $key => $value) {
161
+			foreach ( $um as $key => $value ) {
162 162
 				if ( is_array($value) && count($value) == 1 ) {
163 163
 					$value = $value[0];
164 164
 				}
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
 	 * @param string $field_name
194 194
 	 * @return mixed
195 195
 	 */
196
-	function meta($field_name) {
196
+	function meta( $field_name ) {
197 197
 		return $this->get_meta_field($field_name);
198 198
 	}
199 199
 
Please login to merge, or discard this patch.
lib/cache/WPObjectCacheAdapter.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -12,16 +12,16 @@
 block discarded – undo
12 12
 	 */
13 13
 	private $timberloader;
14 14
 
15
-	public function __construct(TimberLoader $timberloader, $cache_group = 'timber') {
15
+	public function __construct( TimberLoader $timberloader, $cache_group = 'timber' ) {
16 16
 		$this->cache_group = $cache_group;
17 17
 		$this->timberloader = $timberloader;
18 18
 	}
19 19
 
20
-	public function fetch($key) {
20
+	public function fetch( $key ) {
21 21
 		return $this->timberloader->get_cache($key, $this->cache_group, TimberLoader::CACHE_USE_DEFAULT);
22 22
 	}
23 23
 
24
-	public function save($key, $value, $expire = 0) {
24
+	public function save( $key, $value, $expire = 0 ) {
25 25
 		return $this->timberloader->set_cache($key, $value, $this->cache_group, $expire, TimberLoader::CACHE_USE_DEFAULT);
26 26
 	}
27 27
 
Please login to merge, or discard this patch.
lib/cache/KeyGenerator.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -10,17 +10,17 @@
 block discarded – undo
10 10
 	 * @param mixed $value
11 11
 	 * @return string
12 12
 	 */
13
-	public function generateKey($value) {
14
-		if (is_a($value, 'TimberKeyGeneratorInterface')) {
13
+	public function generateKey( $value ) {
14
+		if ( is_a($value, 'TimberKeyGeneratorInterface') ) {
15 15
 			return $value->_get_cache_key();
16 16
 		}
17 17
 
18
-		if (is_array($value) && isset($value['_cache_key'])) {
18
+		if ( is_array($value) && isset($value['_cache_key']) ) {
19 19
 			return $value['_cache_key'];
20 20
 		}
21 21
 
22 22
 		$key = md5(json_encode($value));
23
-		if (is_object($value)) {
23
+		if ( is_object($value) ) {
24 24
 			$key = get_class($value) . '|' . $key;
25 25
 		}
26 26
 
Please login to merge, or discard this patch.
lib/timber-theme.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 	 * We are currently using the My Theme theme.
63 63
 	 * ```
64 64
 	 */
65
-	function __construct($slug = null) {
65
+	function __construct( $slug = null ) {
66 66
 		$this->init($slug);
67 67
 	}
68 68
 
@@ -70,13 +70,13 @@  discard block
 block discarded – undo
70 70
 	 * @internal
71 71
 	 * @param string $slug
72 72
 	 */
73
-	protected function init($slug = null) {
73
+	protected function init( $slug = null ) {
74 74
 		$data = wp_get_theme($slug);
75 75
 		$this->name = $data->get('Name');
76 76
 		$ss = $data->get_stylesheet();
77 77
 		$this->slug = $ss;
78 78
 
79
-		if ( ! function_exists( 'get_home_path' ) ) {
79
+		if ( !function_exists('get_home_path') ) {
80 80
 			require_once(ABSPATH . 'wp-admin/includes/file.php');
81 81
 		}
82 82
 
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 	 * @return  string the relative path to the theme (ex: `/wp-content/themes/my-timber-theme`)
104 104
 	 */
105 105
 	public function path() {
106
-		return TimberURLHelper::get_rel_url( $this->link() );
106
+		return TimberURLHelper::get_rel_url($this->link());
107 107
 	}
108 108
 
109 109
 	/**
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 	 * @param bool $default
112 112
 	 * @return string
113 113
 	 */
114
-	public function theme_mod($name, $default = false) {
114
+	public function theme_mod( $name, $default = false ) {
115 115
 		return get_theme_mod($name, $default);
116 116
 	}
117 117
 
Please login to merge, or discard this patch.