@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | $this->init($cid); |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | - function __toString(){ |
|
| 47 | + function __toString() { |
|
| 48 | 48 | return $this->content(); |
| 49 | 49 | } |
| 50 | 50 | |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | */ |
| 55 | 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 |
||
| 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'; |
@@ -114,21 +114,21 @@ discard block |
||
| 114 | 114 | * @return bool|mixed|string |
| 115 | 115 | */ |
| 116 | 116 | public function avatar($size = 92, $default = '') { |
| 117 | - if (!get_option('show_avatars')) { |
|
| 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; |
@@ -179,9 +179,9 @@ discard block |
||
| 179 | 179 | * ``` |
| 180 | 180 | * @return string |
| 181 | 181 | */ |
| 182 | - public function date( $date_format = '' ) { |
|
| 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 | |
@@ -204,9 +204,9 @@ discard block |
||
| 204 | 204 | * ``` |
| 205 | 205 | * @return string |
| 206 | 206 | */ |
| 207 | - public function time( $time_format = '' ) { |
|
| 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 | |
@@ -232,14 +232,14 @@ discard block |
||
| 232 | 232 | * @return mixed |
| 233 | 233 | */ |
| 234 | 234 | protected function get_meta_fields($comment_id = null) { |
| 235 | - if ($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 | 241 | foreach ($comment_metas as &$cm) { |
| 242 | - if (is_array($cm) && count($cm) == 1) { |
|
| 242 | + if ( is_array($cm) && count($cm) == 1 ) { |
|
| 243 | 243 | $cm = $cm[0]; |
| 244 | 244 | } |
| 245 | 245 | } |
@@ -254,7 +254,7 @@ discard block |
||
| 254 | 254 | */ |
| 255 | 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,9 +269,9 @@ discard block |
||
| 269 | 269 | * @param int $post_id |
| 270 | 270 | * @return string |
| 271 | 271 | */ |
| 272 | - public function reply_link( $reply_text = 'Reply' ) { |
|
| 272 | + public function reply_link($reply_text = 'Reply') { |
|
| 273 | 273 | if ( is_singular() && comments_open() && get_option('thread_comments') ) { |
| 274 | - wp_enqueue_script( 'comment-reply' ); |
|
| 274 | + wp_enqueue_script('comment-reply'); |
|
| 275 | 275 | } |
| 276 | 276 | |
| 277 | 277 | // Get the comments depth option from the admin panel |
@@ -286,7 +286,7 @@ discard block |
||
| 286 | 286 | 'max_depth' => $max_depth, |
| 287 | 287 | ); |
| 288 | 288 | |
| 289 | - return get_comment_reply_link( $args, $this->ID, $this->post_id ); |
|
| 289 | + return get_comment_reply_link($args, $this->ID, $this->post_id); |
|
| 290 | 290 | } |
| 291 | 291 | |
| 292 | 292 | /* AVATAR Stuff |
@@ -297,9 +297,9 @@ discard block |
||
| 297 | 297 | * @return string |
| 298 | 298 | */ |
| 299 | 299 | protected function avatar_email() { |
| 300 | - $id = (int)$this->user_id; |
|
| 300 | + $id = (int) $this->user_id; |
|
| 301 | 301 | $user = get_userdata($id); |
| 302 | - if ($user) { |
|
| 302 | + if ( $user ) { |
|
| 303 | 303 | $email = $user->user_email; |
| 304 | 304 | } else { |
| 305 | 305 | $email = $this->comment_author_email; |
@@ -313,10 +313,10 @@ discard block |
||
| 313 | 313 | * @return string |
| 314 | 314 | */ |
| 315 | 315 | protected function avatar_host($email_hash) { |
| 316 | - if (is_ssl()) { |
|
| 316 | + if ( is_ssl() ) { |
|
| 317 | 317 | $host = 'https://secure.gravatar.com'; |
| 318 | 318 | } else { |
| 319 | - if (!empty($email_hash)) { |
|
| 319 | + if ( !empty($email_hash) ) { |
|
| 320 | 320 | $host = sprintf("http://%d.gravatar.com", (hexdec($email_hash[0]) % 2)); |
| 321 | 321 | } else { |
| 322 | 322 | $host = 'http://0.gravatar.com'; |
@@ -335,28 +335,28 @@ discard block |
||
| 335 | 335 | * @return string |
| 336 | 336 | */ |
| 337 | 337 | protected function avatar_default($default, $email, $size, $host) { |
| 338 | - if (substr($default, 0, 1) == '/') { |
|
| 338 | + if ( substr($default, 0, 1) == '/' ) { |
|
| 339 | 339 | $default = home_url() . $default; |
| 340 | 340 | } |
| 341 | 341 | |
| 342 | - if (empty($default)) { |
|
| 342 | + if ( empty($default) ) { |
|
| 343 | 343 | $avatar_default = get_option('avatar_default'); |
| 344 | - if (empty($avatar_default)) { |
|
| 344 | + if ( empty($avatar_default) ) { |
|
| 345 | 345 | $default = 'mystery'; |
| 346 | 346 | } else { |
| 347 | 347 | $default = $avatar_default; |
| 348 | 348 | } |
| 349 | 349 | } |
| 350 | - if ('mystery' == $default) { |
|
| 350 | + if ( 'mystery' == $default ) { |
|
| 351 | 351 | $default = $host . '/avatar/ad516503a11cd5ca435acc9bb6523536?s=' . $size; |
| 352 | 352 | // ad516503a11cd5ca435acc9bb6523536 == md5('[email protected]') |
| 353 | - } else if ('blank' == $default) { |
|
| 353 | + } else if ( 'blank' == $default ) { |
|
| 354 | 354 | $default = $email ? 'blank' : includes_url('images/blank.gif'); |
| 355 | - } else if (!empty($email) && 'gravatar_default' == $default) { |
|
| 355 | + } else if ( !empty($email) && 'gravatar_default' == $default ) { |
|
| 356 | 356 | $default = ''; |
| 357 | - } else if ('gravatar_default' == $default) { |
|
| 357 | + } else if ( 'gravatar_default' == $default ) { |
|
| 358 | 358 | $default = $host . '/avatar/?s=' . $size; |
| 359 | - } else if (empty($email) && !strstr($default, 'http://')) { |
|
| 359 | + } else if ( empty($email) && !strstr($default, 'http://') ) { |
|
| 360 | 360 | $default = $host . '/avatar/?d=' . $default . '&s=' . $size; |
| 361 | 361 | } |
| 362 | 362 | return $default; |
@@ -373,7 +373,7 @@ discard block |
||
| 373 | 373 | protected function avatar_out($default, $host, $email_hash, $size) { |
| 374 | 374 | $out = $host . '/avatar/' . $email_hash . '?s=' . $size . '&d=' . urlencode($default); |
| 375 | 375 | $rating = get_option('avatar_rating'); |
| 376 | - if (!empty($rating)) { |
|
| 376 | + if ( !empty($rating) ) { |
|
| 377 | 377 | $out .= '&r=' . $rating; |
| 378 | 378 | } |
| 379 | 379 | return str_replace('&', '&', esc_url($out)); |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | * @param mixed $pid |
| 169 | 169 | */ |
| 170 | 170 | public function __construct($pid = null) { |
| 171 | - $pid = $this->determine_id( $pid ); |
|
| 171 | + $pid = $this->determine_id($pid); |
|
| 172 | 172 | $this->init($pid); |
| 173 | 173 | } |
| 174 | 174 | |
@@ -188,13 +188,13 @@ discard block |
||
| 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 ) { |
@@ -260,7 +260,7 @@ discard block |
||
| 260 | 260 | * @param string $field |
| 261 | 261 | * @param mixed $value |
| 262 | 262 | */ |
| 263 | - public function update( $field, $value ) { |
|
| 263 | + public function update($field, $value) { |
|
| 264 | 264 | if ( isset($this->ID) ) { |
| 265 | 265 | update_post_meta($this->ID, $field, $value); |
| 266 | 266 | $this->$field = $value; |
@@ -275,7 +275,7 @@ discard block |
||
| 275 | 275 | * @param mixed $pid |
| 276 | 276 | * @return WP_Post on success |
| 277 | 277 | */ |
| 278 | - protected function prepare_post_info( $pid = 0 ) { |
|
| 278 | + protected function prepare_post_info($pid = 0) { |
|
| 279 | 279 | if ( is_string($pid) || is_numeric($pid) || (is_object($pid) && !isset($pid->post_title)) || $pid === 0 ) { |
| 280 | 280 | $pid = self::check_post_id($pid); |
| 281 | 281 | $post = get_post($pid); |
@@ -297,7 +297,7 @@ discard block |
||
| 297 | 297 | * @internal |
| 298 | 298 | * @return integer ID number of a post |
| 299 | 299 | */ |
| 300 | - protected function check_post_id( $pid ) { |
|
| 300 | + protected function check_post_id($pid) { |
|
| 301 | 301 | if ( is_numeric($pid) && $pid === 0 ) { |
| 302 | 302 | $pid = get_the_ID(); |
| 303 | 303 | return $pid; |
@@ -323,7 +323,7 @@ discard block |
||
| 323 | 323 | global $wpdb; |
| 324 | 324 | $query = $wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_name = %s LIMIT 1", $post_name); |
| 325 | 325 | $result = $wpdb->get_row($query); |
| 326 | - if (!$result) { |
|
| 326 | + if ( !$result ) { |
|
| 327 | 327 | return null; |
| 328 | 328 | } |
| 329 | 329 | return $result->ID; |
@@ -362,7 +362,7 @@ discard block |
||
| 362 | 362 | $text = TimberHelper::trim_words($text, $len, false); |
| 363 | 363 | $trimmed = true; |
| 364 | 364 | } |
| 365 | - $text = do_shortcode( $text ); |
|
| 365 | + $text = do_shortcode($text); |
|
| 366 | 366 | } |
| 367 | 367 | if ( !strlen($text) ) { |
| 368 | 368 | $text = TimberHelper::trim_words($this->get_content(), $len, false); |
@@ -394,7 +394,7 @@ discard block |
||
| 394 | 394 | } elseif ( $readmore ) { |
| 395 | 395 | $text .= ' <a href="' . $this->get_permalink() . '" class="read-more">' . trim($readmore) . '</a>'; |
| 396 | 396 | } |
| 397 | - if ( !$strip && $last_p_tag && ( strpos($text, '<p>') || strpos($text, '<p ') ) ) { |
|
| 397 | + if ( !$strip && $last_p_tag && (strpos($text, '<p>') || strpos($text, '<p ')) ) { |
|
| 398 | 398 | $text .= '</p>'; |
| 399 | 399 | } |
| 400 | 400 | } |
@@ -406,7 +406,7 @@ discard block |
||
| 406 | 406 | * @internal |
| 407 | 407 | * @param bool|int $pid a post ID number |
| 408 | 408 | */ |
| 409 | - function import_custom( $pid = false ) { |
|
| 409 | + function import_custom($pid = false) { |
|
| 410 | 410 | if ( !$pid ) { |
| 411 | 411 | $pid = $this->ID; |
| 412 | 412 | } |
@@ -421,13 +421,13 @@ discard block |
||
| 421 | 421 | * @param int $pid |
| 422 | 422 | * @return array |
| 423 | 423 | */ |
| 424 | - protected function get_post_custom( $pid ) { |
|
| 424 | + protected function get_post_custom($pid) { |
|
| 425 | 425 | apply_filters('timber_post_get_meta_pre', array(), $pid, $this); |
| 426 | 426 | $customs = get_post_custom($pid); |
| 427 | 427 | if ( !is_array($customs) || empty($customs) ) { |
| 428 | 428 | return array(); |
| 429 | 429 | } |
| 430 | - foreach ( $customs as $key => $value ) { |
|
| 430 | + foreach ($customs as $key => $value) { |
|
| 431 | 431 | if ( is_array($value) && count($value) == 1 && isset($value[0]) ) { |
| 432 | 432 | $value = $value[0]; |
| 433 | 433 | } |
@@ -481,7 +481,7 @@ discard block |
||
| 481 | 481 | * @param bool $taxonomy |
| 482 | 482 | * @return TimberPost|boolean |
| 483 | 483 | */ |
| 484 | - function get_next( $taxonomy = false ) { |
|
| 484 | + function get_next($taxonomy = false) { |
|
| 485 | 485 | if ( !isset($this->_next) || !isset($this->_next[$taxonomy]) ) { |
| 486 | 486 | global $post; |
| 487 | 487 | $this->_next = array(); |
@@ -512,7 +512,7 @@ discard block |
||
| 512 | 512 | $post = $this; |
| 513 | 513 | $ret = array(); |
| 514 | 514 | if ( $multipage ) { |
| 515 | - for ( $i = 1; $i <= $numpages; $i++ ) { |
|
| 515 | + for ($i = 1; $i <= $numpages; $i++) { |
|
| 516 | 516 | $link = self::get_wp_link_page($i); |
| 517 | 517 | $data = array('name' => $i, 'title' => $i, 'text' => $i, 'link' => $link); |
| 518 | 518 | if ( $i == $page ) { |
@@ -564,7 +564,7 @@ discard block |
||
| 564 | 564 | * @param bool $taxonomy |
| 565 | 565 | * @return TimberPost|boolean |
| 566 | 566 | */ |
| 567 | - function get_prev( $taxonomy = false ) { |
|
| 567 | + function get_prev($taxonomy = false) { |
|
| 568 | 568 | if ( isset($this->_prev) && isset($this->_prev[$taxonomy]) ) { |
| 569 | 569 | return $this->_prev[$taxonomy]; |
| 570 | 570 | } |
@@ -631,7 +631,7 @@ discard block |
||
| 631 | 631 | $post->slug = $post->post_name; |
| 632 | 632 | $customs = $this->get_post_custom($post->ID); |
| 633 | 633 | $post->custom = $customs; |
| 634 | - $post = (object) array_merge((array)$customs, (array)$post); |
|
| 634 | + $post = (object) array_merge((array) $customs, (array) $post); |
|
| 635 | 635 | return $post; |
| 636 | 636 | } |
| 637 | 637 | |
@@ -642,7 +642,7 @@ discard block |
||
| 642 | 642 | * @param string $use |
| 643 | 643 | * @return string |
| 644 | 644 | */ |
| 645 | - function get_display_date( $use = 'post_date' ) { |
|
| 645 | + function get_display_date($use = 'post_date') { |
|
| 646 | 646 | return date(get_option('date_format'), strtotime($this->$use)); |
| 647 | 647 | } |
| 648 | 648 | |
@@ -652,9 +652,9 @@ discard block |
||
| 652 | 652 | * @param string $date_format |
| 653 | 653 | * @return string |
| 654 | 654 | */ |
| 655 | - function get_date( $date_format = '' ) { |
|
| 655 | + function get_date($date_format = '') { |
|
| 656 | 656 | $df = $date_format ? $date_format : get_option('date_format'); |
| 657 | - $the_date = (string)mysql2date($df, $this->post_date); |
|
| 657 | + $the_date = (string) mysql2date($df, $this->post_date); |
|
| 658 | 658 | return apply_filters('get_the_date', $the_date, $df); |
| 659 | 659 | } |
| 660 | 660 | |
@@ -663,7 +663,7 @@ discard block |
||
| 663 | 663 | * @param string $date_format |
| 664 | 664 | * @return string |
| 665 | 665 | */ |
| 666 | - function get_modified_date( $date_format = '' ) { |
|
| 666 | + function get_modified_date($date_format = '') { |
|
| 667 | 667 | $df = $date_format ? $date_format : get_option('date_format'); |
| 668 | 668 | $the_time = $this->get_modified_time($df); |
| 669 | 669 | return apply_filters('get_the_modified_date', $the_time, $date_format); |
@@ -674,7 +674,7 @@ discard block |
||
| 674 | 674 | * @param string $time_format |
| 675 | 675 | * @return string |
| 676 | 676 | */ |
| 677 | - function get_modified_time( $time_format = '' ) { |
|
| 677 | + function get_modified_time($time_format = '') { |
|
| 678 | 678 | $tf = $time_format ? $time_format : get_option('time_format'); |
| 679 | 679 | $the_time = get_post_modified_time($tf, false, $this->ID, true); |
| 680 | 680 | return apply_filters('get_the_modified_time', $the_time, $time_format); |
@@ -687,7 +687,7 @@ discard block |
||
| 687 | 687 | * @param bool|string $childPostClass |
| 688 | 688 | * @return array |
| 689 | 689 | */ |
| 690 | - function get_children( $post_type = 'any', $childPostClass = false ) { |
|
| 690 | + function get_children($post_type = 'any', $childPostClass = false) { |
|
| 691 | 691 | if ( $childPostClass === false ) { |
| 692 | 692 | $childPostClass = $this->PostClass; |
| 693 | 693 | } |
@@ -695,7 +695,7 @@ discard block |
||
| 695 | 695 | $post_type = $this->post_type; |
| 696 | 696 | } |
| 697 | 697 | $children = get_children('post_parent=' . $this->ID . '&post_type=' . $post_type . '&numberposts=-1&orderby=menu_order title&order=ASC'); |
| 698 | - foreach ( $children as &$child ) { |
|
| 698 | + foreach ($children as &$child) { |
|
| 699 | 699 | $child = new $childPostClass($child->ID); |
| 700 | 700 | } |
| 701 | 701 | $children = array_values($children); |
@@ -731,16 +731,16 @@ discard block |
||
| 731 | 731 | $timber_comments = array(); |
| 732 | 732 | |
| 733 | 733 | if ( '' == get_query_var('cpage') && get_option('page_comments') ) { |
| 734 | - set_query_var( 'cpage', 'newest' == get_option('default_comments_page') ? get_comment_pages_count() : 1 ); |
|
| 734 | + set_query_var('cpage', 'newest' == get_option('default_comments_page') ? get_comment_pages_count() : 1); |
|
| 735 | 735 | $overridden_cpage = true; |
| 736 | 736 | } |
| 737 | 737 | |
| 738 | - foreach( $comments as $key => &$comment ) { |
|
| 738 | + foreach ($comments as $key => &$comment) { |
|
| 739 | 739 | $timber_comment = new $CommentClass($comment); |
| 740 | 740 | $timber_comments[$timber_comment->id] = $timber_comment; |
| 741 | 741 | } |
| 742 | 742 | |
| 743 | - foreach( $timber_comments as $key => $comment ) { |
|
| 743 | + foreach ($timber_comments as $key => $comment) { |
|
| 744 | 744 | if ( $comment->is_child() ) { |
| 745 | 745 | unset($timber_comments[$comment->id]); |
| 746 | 746 | |
@@ -784,7 +784,7 @@ discard block |
||
| 784 | 784 | * @param string $TermClass |
| 785 | 785 | * @return array |
| 786 | 786 | */ |
| 787 | - function get_terms( $tax = '', $merge = true, $TermClass = '' ) { |
|
| 787 | + function get_terms($tax = '', $merge = true, $TermClass = '') { |
|
| 788 | 788 | |
| 789 | 789 | $TermClass = $TermClass ?: $this->TermClass; |
| 790 | 790 | |
@@ -795,7 +795,7 @@ discard block |
||
| 795 | 795 | $taxonomies = $tax; |
| 796 | 796 | } |
| 797 | 797 | if ( is_string($tax) ) { |
| 798 | - if ( in_array($tax, array('all','any','')) ) { |
|
| 798 | + if ( in_array($tax, array('all', 'any', '')) ) { |
|
| 799 | 799 | $taxonomies = get_object_taxonomies($this->post_type); |
| 800 | 800 | } else { |
| 801 | 801 | $taxonomies = array($tax); |
@@ -804,8 +804,8 @@ discard block |
||
| 804 | 804 | |
| 805 | 805 | $term_class_objects = array(); |
| 806 | 806 | |
| 807 | - foreach ( $taxonomies as $taxonomy ) { |
|
| 808 | - if ( in_array($taxonomy, array('tag','tags')) ) { |
|
| 807 | + foreach ($taxonomies as $taxonomy) { |
|
| 808 | + if ( in_array($taxonomy, array('tag', 'tags')) ) { |
|
| 809 | 809 | $taxonomy = 'post_tag'; |
| 810 | 810 | } |
| 811 | 811 | if ( $taxonomy == 'categories' ) { |
@@ -843,11 +843,11 @@ discard block |
||
| 843 | 843 | * @param string $taxonomy |
| 844 | 844 | * @return bool |
| 845 | 845 | */ |
| 846 | - function has_term( $term_name_or_id, $taxonomy = 'all' ) { |
|
| 846 | + function has_term($term_name_or_id, $taxonomy = 'all') { |
|
| 847 | 847 | if ( $taxonomy == 'all' || $taxonomy == 'any' ) { |
| 848 | 848 | $taxes = get_object_taxonomies($this->post_type, 'names'); |
| 849 | 849 | $ret = false; |
| 850 | - foreach ( $taxes as $tax ) { |
|
| 850 | + foreach ($taxes as $tax) { |
|
| 851 | 851 | if ( has_term($term_name_or_id, $tax, $this->ID) ) { |
| 852 | 852 | $ret = true; |
| 853 | 853 | break; |
@@ -862,7 +862,7 @@ discard block |
||
| 862 | 862 | * @param string $field |
| 863 | 863 | * @return TimberImage |
| 864 | 864 | */ |
| 865 | - function get_image( $field ) { |
|
| 865 | + function get_image($field) { |
|
| 866 | 866 | return new $this->ImageClass($this->$field); |
| 867 | 867 | } |
| 868 | 868 | |
@@ -912,7 +912,7 @@ discard block |
||
| 912 | 912 | * @param int $page |
| 913 | 913 | * @return string |
| 914 | 914 | */ |
| 915 | - function get_content( $len = 0, $page = 0 ) { |
|
| 915 | + function get_content($len = 0, $page = 0) { |
|
| 916 | 916 | if ( $len == 0 && $page == 0 && $this->_content ) { |
| 917 | 917 | return $this->_content; |
| 918 | 918 | } |
@@ -973,7 +973,7 @@ discard block |
||
| 973 | 973 | * @param string $field_name |
| 974 | 974 | * @return mixed |
| 975 | 975 | */ |
| 976 | - public function get_field( $field_name ) { |
|
| 976 | + public function get_field($field_name) { |
|
| 977 | 977 | $value = apply_filters('timber_post_get_meta_field_pre', null, $this->ID, $field_name, $this); |
| 978 | 978 | if ( $value === null ) { |
| 979 | 979 | $value = get_post_meta($this->ID, $field_name); |
@@ -991,7 +991,7 @@ discard block |
||
| 991 | 991 | /** |
| 992 | 992 | * @param string $field_name |
| 993 | 993 | */ |
| 994 | - function import_field( $field_name ) { |
|
| 994 | + function import_field($field_name) { |
|
| 995 | 995 | $this->$field_name = $this->get_field($field_name); |
| 996 | 996 | } |
| 997 | 997 | |
@@ -1022,13 +1022,13 @@ discard block |
||
| 1022 | 1022 | * ``` |
| 1023 | 1023 | * @return string a space-seperated list of classes |
| 1024 | 1024 | */ |
| 1025 | - public function post_class( $class='' ) { |
|
| 1025 | + public function post_class($class = '') { |
|
| 1026 | 1026 | global $post; |
| 1027 | 1027 | $old_global_post = $post; |
| 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; |
@@ -1130,8 +1130,8 @@ discard block |
||
| 1130 | 1130 | * @param string|bool $childPostClass _optional_ a custom post class (ex: 'MyTimberPost') to return the objects as. By default (false) it will use TimberPost::$post_class value. |
| 1131 | 1131 | * @return array |
| 1132 | 1132 | */ |
| 1133 | - public function children( $post_type = 'any', $childPostClass = false ) { |
|
| 1134 | - return $this->get_children( $post_type, $childPostClass ); |
|
| 1133 | + public function children($post_type = 'any', $childPostClass = false) { |
|
| 1134 | + return $this->get_children($post_type, $childPostClass); |
|
| 1135 | 1135 | } |
| 1136 | 1136 | |
| 1137 | 1137 | /** |
@@ -1155,7 +1155,7 @@ discard block |
||
| 1155 | 1155 | * ``` |
| 1156 | 1156 | * @return bool|array |
| 1157 | 1157 | */ |
| 1158 | - public function comments( $count = 0, $order = 'wp', $type = 'comment', $status = 'approve', $CommentClass = 'TimberComment' ) { |
|
| 1158 | + public function comments($count = 0, $order = 'wp', $type = 'comment', $status = 'approve', $CommentClass = 'TimberComment') { |
|
| 1159 | 1159 | return $this->get_comments($count, $order, $type, $status, $CommentClass); |
| 1160 | 1160 | } |
| 1161 | 1161 | |
@@ -1172,7 +1172,7 @@ discard block |
||
| 1172 | 1172 | * @param int $page |
| 1173 | 1173 | * @return string |
| 1174 | 1174 | */ |
| 1175 | - public function content( $page = 0 ) { |
|
| 1175 | + public function content($page = 0) { |
|
| 1176 | 1176 | return $this->get_content(0, $page); |
| 1177 | 1177 | } |
| 1178 | 1178 | |
@@ -1201,7 +1201,7 @@ discard block |
||
| 1201 | 1201 | * @param string $date_format |
| 1202 | 1202 | * @return string |
| 1203 | 1203 | */ |
| 1204 | - public function date( $date_format = '' ) { |
|
| 1204 | + public function date($date_format = '') { |
|
| 1205 | 1205 | return $this->get_date($date_format); |
| 1206 | 1206 | } |
| 1207 | 1207 | |
@@ -1223,9 +1223,9 @@ discard block |
||
| 1223 | 1223 | * @param string $time_format |
| 1224 | 1224 | * @return string |
| 1225 | 1225 | */ |
| 1226 | - public function time( $time_format = '' ) { |
|
| 1226 | + public function time($time_format = '') { |
|
| 1227 | 1227 | $tf = $time_format ? $time_format : get_option('time_format'); |
| 1228 | - $the_time = (string)mysql2date($tf, $this->post_date); |
|
| 1228 | + $the_time = (string) mysql2date($tf, $this->post_date); |
|
| 1229 | 1229 | return apply_filters('get_the_time', $the_time, $tf); |
| 1230 | 1230 | } |
| 1231 | 1231 | |
@@ -1261,7 +1261,7 @@ discard block |
||
| 1261 | 1261 | * @param string $field_name |
| 1262 | 1262 | * @return mixed |
| 1263 | 1263 | */ |
| 1264 | - public function meta( $field_name = null ) { |
|
| 1264 | + public function meta($field_name = null) { |
|
| 1265 | 1265 | if ( $field_name === null ) { |
| 1266 | 1266 | //on the off-chance the field is actually named meta |
| 1267 | 1267 | $field_name = 'meta'; |
@@ -1272,7 +1272,7 @@ discard block |
||
| 1272 | 1272 | /** |
| 1273 | 1273 | * @return string |
| 1274 | 1274 | */ |
| 1275 | - public function name(){ |
|
| 1275 | + public function name() { |
|
| 1276 | 1276 | return $this->title(); |
| 1277 | 1277 | } |
| 1278 | 1278 | |
@@ -1280,7 +1280,7 @@ discard block |
||
| 1280 | 1280 | * @param string $date_format |
| 1281 | 1281 | * @return string |
| 1282 | 1282 | */ |
| 1283 | - public function modified_date( $date_format = '' ) { |
|
| 1283 | + public function modified_date($date_format = '') { |
|
| 1284 | 1284 | return $this->get_modified_date($date_format); |
| 1285 | 1285 | } |
| 1286 | 1286 | |
@@ -1288,7 +1288,7 @@ discard block |
||
| 1288 | 1288 | * @param string $time_format |
| 1289 | 1289 | * @return string |
| 1290 | 1290 | */ |
| 1291 | - public function modified_time( $time_format = '' ) { |
|
| 1291 | + public function modified_time($time_format = '') { |
|
| 1292 | 1292 | return $this->get_modified_time($time_format); |
| 1293 | 1293 | } |
| 1294 | 1294 | |
@@ -1297,7 +1297,7 @@ discard block |
||
| 1297 | 1297 | * @param bool $in_same_cat |
| 1298 | 1298 | * @return mixed |
| 1299 | 1299 | */ |
| 1300 | - public function next( $in_same_cat = false ) { |
|
| 1300 | + public function next($in_same_cat = false) { |
|
| 1301 | 1301 | return $this->get_next($in_same_cat); |
| 1302 | 1302 | } |
| 1303 | 1303 | |
@@ -1355,7 +1355,7 @@ discard block |
||
| 1355 | 1355 | * @param bool $in_same_cat |
| 1356 | 1356 | * @return mixed |
| 1357 | 1357 | */ |
| 1358 | - public function prev( $in_same_cat = false ) { |
|
| 1358 | + public function prev($in_same_cat = false) { |
|
| 1359 | 1359 | return $this->get_prev($in_same_cat); |
| 1360 | 1360 | } |
| 1361 | 1361 | |
@@ -1367,7 +1367,7 @@ discard block |
||
| 1367 | 1367 | * @param bool $merge Should the resulting array be one big one (true)? Or should it be an array of sub-arrays for each taxonomy (false)? |
| 1368 | 1368 | * @return array |
| 1369 | 1369 | */ |
| 1370 | - public function terms( $tax = '', $merge = true ) { |
|
| 1370 | + public function terms($tax = '', $merge = true) { |
|
| 1371 | 1371 | return $this->get_terms($tax, $merge); |
| 1372 | 1372 | } |
| 1373 | 1373 | |