@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | * @param mixed $pid |
| 163 | 163 | */ |
| 164 | 164 | public function __construct($pid = null) { |
| 165 | - $pid = $this->determine_id( $pid ); |
|
| 165 | + $pid = $this->determine_id($pid); |
|
| 166 | 166 | $this->init($pid); |
| 167 | 167 | } |
| 168 | 168 | |
@@ -182,13 +182,13 @@ discard block |
||
| 182 | 182 | && get_class($wp_query->queried_object) == 'WP_Post' |
| 183 | 183 | ) { |
| 184 | 184 | $pid = $wp_query->queried_object_id; |
| 185 | - } else if ( $pid === null && $wp_query->is_home && isset($wp_query->queried_object_id) && $wp_query->queried_object_id ) { |
|
| 185 | + } else if ( $pid === null && $wp_query->is_home && isset($wp_query->queried_object_id) && $wp_query->queried_object_id ) { |
|
| 186 | 186 | //hack for static page as home page |
| 187 | 187 | $pid = $wp_query->queried_object_id; |
| 188 | 188 | } else if ( $pid === null ) { |
| 189 | 189 | $gtid = false; |
| 190 | 190 | $maybe_post = get_post(); |
| 191 | - if ( isset($maybe_post->ID) ){ |
|
| 191 | + if ( isset($maybe_post->ID) ) { |
|
| 192 | 192 | $gtid = true; |
| 193 | 193 | } |
| 194 | 194 | if ( $gtid ) { |
@@ -252,7 +252,7 @@ discard block |
||
| 252 | 252 | * @param string $field |
| 253 | 253 | * @param mixed $value |
| 254 | 254 | */ |
| 255 | - public function update( $field, $value ) { |
|
| 255 | + public function update($field, $value) { |
|
| 256 | 256 | if ( isset($this->ID) ) { |
| 257 | 257 | update_post_meta($this->ID, $field, $value); |
| 258 | 258 | $this->$field = $value; |
@@ -267,7 +267,7 @@ discard block |
||
| 267 | 267 | * @param mixed $pid |
| 268 | 268 | * @return WP_Post on success |
| 269 | 269 | */ |
| 270 | - protected function prepare_post_info( $pid = 0 ) { |
|
| 270 | + protected function prepare_post_info($pid = 0) { |
|
| 271 | 271 | if ( is_string($pid) || is_numeric($pid) || (is_object($pid) && !isset($pid->post_title)) || $pid === 0 ) { |
| 272 | 272 | $pid = self::check_post_id($pid); |
| 273 | 273 | $post = get_post($pid); |
@@ -286,7 +286,7 @@ discard block |
||
| 286 | 286 | * @internal |
| 287 | 287 | * @return integer ID number of a post |
| 288 | 288 | */ |
| 289 | - protected function check_post_id( $pid ) { |
|
| 289 | + protected function check_post_id($pid) { |
|
| 290 | 290 | if ( is_numeric($pid) && $pid === 0 ) { |
| 291 | 291 | $pid = get_the_ID(); |
| 292 | 292 | return $pid; |
@@ -312,7 +312,7 @@ discard block |
||
| 312 | 312 | global $wpdb; |
| 313 | 313 | $query = $wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_name = %s LIMIT 1", $post_name); |
| 314 | 314 | $result = $wpdb->get_row($query); |
| 315 | - if (!$result) { |
|
| 315 | + if ( !$result ) { |
|
| 316 | 316 | return null; |
| 317 | 317 | } |
| 318 | 318 | return $result->ID; |
@@ -351,7 +351,7 @@ discard block |
||
| 351 | 351 | $text = TimberHelper::trim_words($text, $len, false); |
| 352 | 352 | $trimmed = true; |
| 353 | 353 | } |
| 354 | - $text = do_shortcode( $text ); |
|
| 354 | + $text = do_shortcode($text); |
|
| 355 | 355 | } |
| 356 | 356 | if ( !strlen($text) ) { |
| 357 | 357 | $text = TimberHelper::trim_words($this->get_content(), $len, false); |
@@ -380,11 +380,11 @@ discard block |
||
| 380 | 380 | } |
| 381 | 381 | $read_more_class = apply_filters('timber/post/get_preview/read_more_class', "read-more"); |
| 382 | 382 | if ( $readmore && isset($readmore_matches) && !empty($readmore_matches[1]) ) { |
| 383 | - $text .= ' <a href="' . $this->get_permalink() . '" class="'.$read_more_class .'">' . trim($readmore_matches[1]) . '</a>'; |
|
| 383 | + $text .= ' <a href="' . $this->get_permalink() . '" class="' . $read_more_class . '">' . trim($readmore_matches[1]) . '</a>'; |
|
| 384 | 384 | } elseif ( $readmore ) { |
| 385 | - $text .= ' <a href="' . $this->get_permalink() . '" class="'.$read_more_class .'">' . trim($readmore) . '</a>'; |
|
| 385 | + $text .= ' <a href="' . $this->get_permalink() . '" class="' . $read_more_class . '">' . trim($readmore) . '</a>'; |
|
| 386 | 386 | } |
| 387 | - if ( !$strip && $last_p_tag && ( strpos($text, '<p>') || strpos($text, '<p ') ) ) { |
|
| 387 | + if ( !$strip && $last_p_tag && (strpos($text, '<p>') || strpos($text, '<p ')) ) { |
|
| 388 | 388 | $text .= '</p>'; |
| 389 | 389 | } |
| 390 | 390 | } |
@@ -396,7 +396,7 @@ discard block |
||
| 396 | 396 | * @internal |
| 397 | 397 | * @param bool|int $pid a post ID number |
| 398 | 398 | */ |
| 399 | - function import_custom( $pid = false ) { |
|
| 399 | + function import_custom($pid = false) { |
|
| 400 | 400 | if ( !$pid ) { |
| 401 | 401 | $pid = $this->ID; |
| 402 | 402 | } |
@@ -411,13 +411,13 @@ discard block |
||
| 411 | 411 | * @param int $pid |
| 412 | 412 | * @return array |
| 413 | 413 | */ |
| 414 | - protected function get_post_custom( $pid ) { |
|
| 414 | + protected function get_post_custom($pid) { |
|
| 415 | 415 | apply_filters('timber_post_get_meta_pre', array(), $pid, $this); |
| 416 | 416 | $customs = get_post_custom($pid); |
| 417 | 417 | if ( !is_array($customs) || empty($customs) ) { |
| 418 | 418 | return array(); |
| 419 | 419 | } |
| 420 | - foreach ( $customs as $key => $value ) { |
|
| 420 | + foreach ($customs as $key => $value) { |
|
| 421 | 421 | if ( is_array($value) && count($value) == 1 && isset($value[0]) ) { |
| 422 | 422 | $value = $value[0]; |
| 423 | 423 | } |
@@ -471,7 +471,7 @@ discard block |
||
| 471 | 471 | * @param bool $taxonomy |
| 472 | 472 | * @return TimberPost|boolean |
| 473 | 473 | */ |
| 474 | - function get_next( $taxonomy = false ) { |
|
| 474 | + function get_next($taxonomy = false) { |
|
| 475 | 475 | if ( !isset($this->_next) || !isset($this->_next[$taxonomy]) ) { |
| 476 | 476 | global $post; |
| 477 | 477 | $this->_next = array(); |
@@ -502,7 +502,7 @@ discard block |
||
| 502 | 502 | $post = $this; |
| 503 | 503 | $ret = array(); |
| 504 | 504 | if ( $multipage ) { |
| 505 | - for ( $i = 1; $i <= $numpages; $i++ ) { |
|
| 505 | + for ($i = 1; $i <= $numpages; $i++) { |
|
| 506 | 506 | $link = self::get_wp_link_page($i); |
| 507 | 507 | $data = array('name' => $i, 'title' => $i, 'text' => $i, 'link' => $link); |
| 508 | 508 | if ( $i == $page ) { |
@@ -554,7 +554,7 @@ discard block |
||
| 554 | 554 | * @param bool $taxonomy |
| 555 | 555 | * @return TimberPost|boolean |
| 556 | 556 | */ |
| 557 | - function get_prev( $taxonomy = false ) { |
|
| 557 | + function get_prev($taxonomy = false) { |
|
| 558 | 558 | if ( isset($this->_prev) && isset($this->_prev[$taxonomy]) ) { |
| 559 | 559 | return $this->_prev[$taxonomy]; |
| 560 | 560 | } |
@@ -621,7 +621,7 @@ discard block |
||
| 621 | 621 | $post->slug = $post->post_name; |
| 622 | 622 | $customs = $this->get_post_custom($post->ID); |
| 623 | 623 | $post->custom = $customs; |
| 624 | - $post = (object) array_merge((array)$customs, (array)$post); |
|
| 624 | + $post = (object) array_merge((array) $customs, (array) $post); |
|
| 625 | 625 | return $post; |
| 626 | 626 | } |
| 627 | 627 | |
@@ -631,9 +631,9 @@ discard block |
||
| 631 | 631 | * @param string $date_format |
| 632 | 632 | * @return string |
| 633 | 633 | */ |
| 634 | - function get_date( $date_format = '' ) { |
|
| 634 | + function get_date($date_format = '') { |
|
| 635 | 635 | $df = $date_format ? $date_format : get_option('date_format'); |
| 636 | - $the_date = (string)mysql2date($df, $this->post_date); |
|
| 636 | + $the_date = (string) mysql2date($df, $this->post_date); |
|
| 637 | 637 | return apply_filters('get_the_date', $the_date, $df); |
| 638 | 638 | } |
| 639 | 639 | |
@@ -642,7 +642,7 @@ discard block |
||
| 642 | 642 | * @param string $date_format |
| 643 | 643 | * @return string |
| 644 | 644 | */ |
| 645 | - function get_modified_date( $date_format = '' ) { |
|
| 645 | + function get_modified_date($date_format = '') { |
|
| 646 | 646 | $df = $date_format ? $date_format : get_option('date_format'); |
| 647 | 647 | $the_time = $this->get_modified_time($df); |
| 648 | 648 | return apply_filters('get_the_modified_date', $the_time, $date_format); |
@@ -653,7 +653,7 @@ discard block |
||
| 653 | 653 | * @param string $time_format |
| 654 | 654 | * @return string |
| 655 | 655 | */ |
| 656 | - function get_modified_time( $time_format = '' ) { |
|
| 656 | + function get_modified_time($time_format = '') { |
|
| 657 | 657 | $tf = $time_format ? $time_format : get_option('time_format'); |
| 658 | 658 | $the_time = get_post_modified_time($tf, false, $this->ID, true); |
| 659 | 659 | return apply_filters('get_the_modified_time', $the_time, $time_format); |
@@ -666,7 +666,7 @@ discard block |
||
| 666 | 666 | * @param bool|string $childPostClass |
| 667 | 667 | * @return array |
| 668 | 668 | */ |
| 669 | - function get_children( $post_type = 'any', $childPostClass = false ) { |
|
| 669 | + function get_children($post_type = 'any', $childPostClass = false) { |
|
| 670 | 670 | if ( $childPostClass === false ) { |
| 671 | 671 | $childPostClass = $this->PostClass; |
| 672 | 672 | } |
@@ -674,7 +674,7 @@ discard block |
||
| 674 | 674 | $post_type = $this->post_type; |
| 675 | 675 | } |
| 676 | 676 | $children = get_children('post_parent=' . $this->ID . '&post_type=' . $post_type . '&numberposts=-1&orderby=menu_order title&order=ASC'); |
| 677 | - foreach ( $children as &$child ) { |
|
| 677 | + foreach ($children as &$child) { |
|
| 678 | 678 | $child = new $childPostClass($child->ID); |
| 679 | 679 | } |
| 680 | 680 | $children = array_values($children); |
@@ -711,42 +711,42 @@ discard block |
||
| 711 | 711 | } |
| 712 | 712 | |
| 713 | 713 | if ( $user_ID ) { |
| 714 | - $args['include_unapproved'] = array( $user_ID ); |
|
| 715 | - } elseif ( ! empty( $comment_author_email ) ) { |
|
| 716 | - $args['include_unapproved'] = array( $comment_author_email ); |
|
| 714 | + $args['include_unapproved'] = array($user_ID); |
|
| 715 | + } elseif ( !empty($comment_author_email) ) { |
|
| 716 | + $args['include_unapproved'] = array($comment_author_email); |
|
| 717 | 717 | } |
| 718 | 718 | |
| 719 | 719 | $comments = get_comments($args); |
| 720 | 720 | $timber_comments = array(); |
| 721 | 721 | |
| 722 | 722 | if ( '' == get_query_var('cpage') && get_option('page_comments') ) { |
| 723 | - set_query_var( 'cpage', 'newest' == get_option('default_comments_page') ? get_comment_pages_count() : 1 ); |
|
| 723 | + set_query_var('cpage', 'newest' == get_option('default_comments_page') ? get_comment_pages_count() : 1); |
|
| 724 | 724 | $overridden_cpage = true; |
| 725 | 725 | } |
| 726 | 726 | |
| 727 | - foreach($comments as $key => &$comment) { |
|
| 727 | + foreach ($comments as $key => &$comment) { |
|
| 728 | 728 | $timber_comment = new $CommentClass($comment); |
| 729 | 729 | $timber_comments[$timber_comment->id] = $timber_comment; |
| 730 | 730 | } |
| 731 | 731 | |
| 732 | 732 | // Build a flattened (depth=1) comment tree |
| 733 | 733 | $comments_tree = array(); |
| 734 | - foreach( $timber_comments as $key => $comment ) { |
|
| 735 | - if ( ! $comment->is_child() ) { |
|
| 734 | + foreach ($timber_comments as $key => $comment) { |
|
| 735 | + if ( !$comment->is_child() ) { |
|
| 736 | 736 | continue; |
| 737 | 737 | } |
| 738 | 738 | |
| 739 | 739 | $tree_element = $comment; |
| 740 | 740 | do { |
| 741 | 741 | $tree_element = $timber_comments[$tree_element->comment_parent]; |
| 742 | - } while( $tree_element->is_child() ); |
|
| 742 | + } while ($tree_element->is_child()); |
|
| 743 | 743 | |
| 744 | 744 | $comments_tree[$tree_element->id][] = $comment->id; |
| 745 | 745 | } |
| 746 | 746 | |
| 747 | 747 | // Add child comments to the relative "super parents" |
| 748 | - foreach($comments_tree as $comment_parent => $comment_children) { |
|
| 749 | - foreach($comment_children as $comment_child) { |
|
| 748 | + foreach ($comments_tree as $comment_parent => $comment_children) { |
|
| 749 | + foreach ($comment_children as $comment_child) { |
|
| 750 | 750 | $timber_comments[$comment_parent]->children[] = $timber_comments[$comment_child]; |
| 751 | 751 | unset($timber_comments[$comment_child]); |
| 752 | 752 | } |
@@ -786,7 +786,7 @@ discard block |
||
| 786 | 786 | * @param string $TermClass |
| 787 | 787 | * @return array |
| 788 | 788 | */ |
| 789 | - function get_terms( $tax = '', $merge = true, $TermClass = '' ) { |
|
| 789 | + function get_terms($tax = '', $merge = true, $TermClass = '') { |
|
| 790 | 790 | |
| 791 | 791 | $TermClass = $TermClass ?: $this->TermClass; |
| 792 | 792 | |
@@ -797,7 +797,7 @@ discard block |
||
| 797 | 797 | $taxonomies = $tax; |
| 798 | 798 | } |
| 799 | 799 | if ( is_string($tax) ) { |
| 800 | - if ( in_array($tax, array('all','any','')) ) { |
|
| 800 | + if ( in_array($tax, array('all', 'any', '')) ) { |
|
| 801 | 801 | $taxonomies = get_object_taxonomies($this->post_type); |
| 802 | 802 | } else { |
| 803 | 803 | $taxonomies = array($tax); |
@@ -806,8 +806,8 @@ discard block |
||
| 806 | 806 | |
| 807 | 807 | $term_class_objects = array(); |
| 808 | 808 | |
| 809 | - foreach ( $taxonomies as $taxonomy ) { |
|
| 810 | - if ( in_array($taxonomy, array('tag','tags')) ) { |
|
| 809 | + foreach ($taxonomies as $taxonomy) { |
|
| 810 | + if ( in_array($taxonomy, array('tag', 'tags')) ) { |
|
| 811 | 811 | $taxonomy = 'post_tag'; |
| 812 | 812 | } |
| 813 | 813 | if ( $taxonomy == 'categories' ) { |
@@ -844,11 +844,11 @@ discard block |
||
| 844 | 844 | * @param string $taxonomy |
| 845 | 845 | * @return bool |
| 846 | 846 | */ |
| 847 | - function has_term( $term_name_or_id, $taxonomy = 'all' ) { |
|
| 847 | + function has_term($term_name_or_id, $taxonomy = 'all') { |
|
| 848 | 848 | if ( $taxonomy == 'all' || $taxonomy == 'any' ) { |
| 849 | 849 | $taxes = get_object_taxonomies($this->post_type, 'names'); |
| 850 | 850 | $ret = false; |
| 851 | - foreach ( $taxes as $tax ) { |
|
| 851 | + foreach ($taxes as $tax) { |
|
| 852 | 852 | if ( has_term($term_name_or_id, $tax, $this->ID) ) { |
| 853 | 853 | $ret = true; |
| 854 | 854 | break; |
@@ -863,7 +863,7 @@ discard block |
||
| 863 | 863 | * @param string $field |
| 864 | 864 | * @return TimberImage |
| 865 | 865 | */ |
| 866 | - function get_image( $field ) { |
|
| 866 | + function get_image($field) { |
|
| 867 | 867 | return new $this->ImageClass($this->$field); |
| 868 | 868 | } |
| 869 | 869 | |
@@ -913,7 +913,7 @@ discard block |
||
| 913 | 913 | * @param int $page |
| 914 | 914 | * @return string |
| 915 | 915 | */ |
| 916 | - function get_content( $len = 0, $page = 0 ) { |
|
| 916 | + function get_content($len = 0, $page = 0) { |
|
| 917 | 917 | if ( $len == 0 && $page == 0 && $this->_content ) { |
| 918 | 918 | return $this->_content; |
| 919 | 919 | } |
@@ -970,7 +970,7 @@ discard block |
||
| 970 | 970 | * @param string $field_name |
| 971 | 971 | * @return mixed |
| 972 | 972 | */ |
| 973 | - public function get_field( $field_name ) { |
|
| 973 | + public function get_field($field_name) { |
|
| 974 | 974 | $value = apply_filters('timber_post_get_meta_field_pre', null, $this->ID, $field_name, $this); |
| 975 | 975 | if ( $value === null ) { |
| 976 | 976 | $value = get_post_meta($this->ID, $field_name); |
@@ -988,7 +988,7 @@ discard block |
||
| 988 | 988 | /** |
| 989 | 989 | * @param string $field_name |
| 990 | 990 | */ |
| 991 | - function import_field( $field_name ) { |
|
| 991 | + function import_field($field_name) { |
|
| 992 | 992 | $this->$field_name = $this->get_field($field_name); |
| 993 | 993 | } |
| 994 | 994 | |
@@ -1019,13 +1019,13 @@ discard block |
||
| 1019 | 1019 | * ``` |
| 1020 | 1020 | * @return string a space-seperated list of classes |
| 1021 | 1021 | */ |
| 1022 | - public function post_class( $class='' ) { |
|
| 1022 | + public function post_class($class = '') { |
|
| 1023 | 1023 | global $post; |
| 1024 | 1024 | $old_global_post = $post; |
| 1025 | 1025 | $post = $this; |
| 1026 | 1026 | $class_array = get_post_class($class, $this->ID); |
| 1027 | 1027 | $post = $old_global_post; |
| 1028 | - if ( is_array($class_array) ){ |
|
| 1028 | + if ( is_array($class_array) ) { |
|
| 1029 | 1029 | return implode(' ', $class_array); |
| 1030 | 1030 | } |
| 1031 | 1031 | return $class_array; |
@@ -1127,8 +1127,8 @@ discard block |
||
| 1127 | 1127 | * @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. |
| 1128 | 1128 | * @return array |
| 1129 | 1129 | */ |
| 1130 | - public function children( $post_type = 'any', $childPostClass = false ) { |
|
| 1131 | - return $this->get_children( $post_type, $childPostClass ); |
|
| 1130 | + public function children($post_type = 'any', $childPostClass = false) { |
|
| 1131 | + return $this->get_children($post_type, $childPostClass); |
|
| 1132 | 1132 | } |
| 1133 | 1133 | |
| 1134 | 1134 | /** |
@@ -1152,7 +1152,7 @@ discard block |
||
| 1152 | 1152 | * ``` |
| 1153 | 1153 | * @return bool|array |
| 1154 | 1154 | */ |
| 1155 | - public function comments( $count = 0, $order = 'wp', $type = 'comment', $status = 'approve', $CommentClass = 'TimberComment' ) { |
|
| 1155 | + public function comments($count = 0, $order = 'wp', $type = 'comment', $status = 'approve', $CommentClass = 'TimberComment') { |
|
| 1156 | 1156 | return $this->get_comments($count, $order, $type, $status, $CommentClass); |
| 1157 | 1157 | } |
| 1158 | 1158 | |
@@ -1169,7 +1169,7 @@ discard block |
||
| 1169 | 1169 | * @param int $page |
| 1170 | 1170 | * @return string |
| 1171 | 1171 | */ |
| 1172 | - public function content( $page = 0 ) { |
|
| 1172 | + public function content($page = 0) { |
|
| 1173 | 1173 | return $this->get_content(0, $page); |
| 1174 | 1174 | } |
| 1175 | 1175 | |
@@ -1198,7 +1198,7 @@ discard block |
||
| 1198 | 1198 | * @param string $date_format |
| 1199 | 1199 | * @return string |
| 1200 | 1200 | */ |
| 1201 | - public function date( $date_format = '' ) { |
|
| 1201 | + public function date($date_format = '') { |
|
| 1202 | 1202 | return $this->get_date($date_format); |
| 1203 | 1203 | } |
| 1204 | 1204 | |
@@ -1220,9 +1220,9 @@ discard block |
||
| 1220 | 1220 | * @param string $time_format |
| 1221 | 1221 | * @return string |
| 1222 | 1222 | */ |
| 1223 | - public function time( $time_format = '' ) { |
|
| 1223 | + public function time($time_format = '') { |
|
| 1224 | 1224 | $tf = $time_format ? $time_format : get_option('time_format'); |
| 1225 | - $the_time = (string)mysql2date($tf, $this->post_date); |
|
| 1225 | + $the_time = (string) mysql2date($tf, $this->post_date); |
|
| 1226 | 1226 | return apply_filters('get_the_time', $the_time, $tf); |
| 1227 | 1227 | } |
| 1228 | 1228 | |
@@ -1258,7 +1258,7 @@ discard block |
||
| 1258 | 1258 | * @param string $field_name |
| 1259 | 1259 | * @return mixed |
| 1260 | 1260 | */ |
| 1261 | - public function meta( $field_name = null ) { |
|
| 1261 | + public function meta($field_name = null) { |
|
| 1262 | 1262 | if ( $field_name === null ) { |
| 1263 | 1263 | //on the off-chance the field is actually named meta |
| 1264 | 1264 | $field_name = 'meta'; |
@@ -1269,7 +1269,7 @@ discard block |
||
| 1269 | 1269 | /** |
| 1270 | 1270 | * @return string |
| 1271 | 1271 | */ |
| 1272 | - public function name(){ |
|
| 1272 | + public function name() { |
|
| 1273 | 1273 | return $this->title(); |
| 1274 | 1274 | } |
| 1275 | 1275 | |
@@ -1277,7 +1277,7 @@ discard block |
||
| 1277 | 1277 | * @param string $date_format |
| 1278 | 1278 | * @return string |
| 1279 | 1279 | */ |
| 1280 | - public function modified_date( $date_format = '' ) { |
|
| 1280 | + public function modified_date($date_format = '') { |
|
| 1281 | 1281 | return $this->get_modified_date($date_format); |
| 1282 | 1282 | } |
| 1283 | 1283 | |
@@ -1285,7 +1285,7 @@ discard block |
||
| 1285 | 1285 | * @param string $time_format |
| 1286 | 1286 | * @return string |
| 1287 | 1287 | */ |
| 1288 | - public function modified_time( $time_format = '' ) { |
|
| 1288 | + public function modified_time($time_format = '') { |
|
| 1289 | 1289 | return $this->get_modified_time($time_format); |
| 1290 | 1290 | } |
| 1291 | 1291 | |
@@ -1294,7 +1294,7 @@ discard block |
||
| 1294 | 1294 | * @param bool $in_same_cat |
| 1295 | 1295 | * @return mixed |
| 1296 | 1296 | */ |
| 1297 | - public function next( $in_same_cat = false ) { |
|
| 1297 | + public function next($in_same_cat = false) { |
|
| 1298 | 1298 | return $this->get_next($in_same_cat); |
| 1299 | 1299 | } |
| 1300 | 1300 | |
@@ -1352,7 +1352,7 @@ discard block |
||
| 1352 | 1352 | * @param bool $in_same_cat |
| 1353 | 1353 | * @return mixed |
| 1354 | 1354 | */ |
| 1355 | - public function prev( $in_same_cat = false ) { |
|
| 1355 | + public function prev($in_same_cat = false) { |
|
| 1356 | 1356 | return $this->get_prev($in_same_cat); |
| 1357 | 1357 | } |
| 1358 | 1358 | |
@@ -1364,7 +1364,7 @@ discard block |
||
| 1364 | 1364 | * @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)? |
| 1365 | 1365 | * @return array |
| 1366 | 1366 | */ |
| 1367 | - public function terms( $tax = '', $merge = true ) { |
|
| 1367 | + public function terms($tax = '', $merge = true) { |
|
| 1368 | 1368 | return $this->get_terms($tax, $merge); |
| 1369 | 1369 | } |
| 1370 | 1370 | |
@@ -45,16 +45,16 @@ discard block |
||
| 45 | 45 | if ( is_admin() || $_SERVER['PHP_SELF'] == '/wp-login.php' ) { |
| 46 | 46 | return; |
| 47 | 47 | } |
| 48 | - if ( version_compare( phpversion(), '5.3.0', '<' ) && !is_admin() ) { |
|
| 49 | - trigger_error( 'Timber requires PHP 5.3.0 or greater. You have '.phpversion(), E_USER_ERROR ); |
|
| 48 | + if ( version_compare(phpversion(), '5.3.0', '<') && !is_admin() ) { |
|
| 49 | + trigger_error('Timber requires PHP 5.3.0 or greater. You have ' . phpversion(), E_USER_ERROR); |
|
| 50 | 50 | } |
| 51 | - if ( !class_exists( 'Twig_Autoloader' ) ) { |
|
| 52 | - trigger_error( 'You have not run "composer install" to download required dependencies for Timber, you can read more on https://github.com/jarednova/timber#installation', E_USER_ERROR ); |
|
| 51 | + if ( !class_exists('Twig_Autoloader') ) { |
|
| 52 | + trigger_error('You have not run "composer install" to download required dependencies for Timber, you can read more on https://github.com/jarednova/timber#installation', E_USER_ERROR); |
|
| 53 | 53 | } |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | function init_constants() { |
| 57 | - defined( "TIMBER_LOC" ) or define( "TIMBER_LOC", realpath( dirname(__DIR__) ) ); |
|
| 57 | + defined("TIMBER_LOC") or define("TIMBER_LOC", realpath(dirname(__DIR__))); |
|
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | /** |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | */ |
| 63 | 63 | protected function init() { |
| 64 | 64 | TimberTwig::init(); |
| 65 | - TimberRoutes::init( $this ); |
|
| 65 | + TimberRoutes::init($this); |
|
| 66 | 66 | TimberImageHelper::init(); |
| 67 | 67 | TimberAdmin::init(); |
| 68 | 68 | TimberIntegrations::init(); |
@@ -78,8 +78,8 @@ discard block |
||
| 78 | 78 | * @param string $PostClass |
| 79 | 79 | * @return array|bool|null |
| 80 | 80 | */ |
| 81 | - public static function get_post( $query = false, $PostClass = 'TimberPost' ) { |
|
| 82 | - return TimberPostGetter::get_post( $query, $PostClass ); |
|
| 81 | + public static function get_post($query = false, $PostClass = 'TimberPost') { |
|
| 82 | + return TimberPostGetter::get_post($query, $PostClass); |
|
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | /** |
@@ -89,8 +89,8 @@ discard block |
||
| 89 | 89 | * @param string $PostClass |
| 90 | 90 | * @return array|bool|null |
| 91 | 91 | */ |
| 92 | - public static function get_posts( $query = false, $PostClass = 'TimberPost', $return_collection = false ) { |
|
| 93 | - return TimberPostGetter::get_posts( $query, $PostClass, $return_collection ); |
|
| 92 | + public static function get_posts($query = false, $PostClass = 'TimberPost', $return_collection = false) { |
|
| 93 | + return TimberPostGetter::get_posts($query, $PostClass, $return_collection); |
|
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | /** |
@@ -100,8 +100,8 @@ discard block |
||
| 100 | 100 | * @param string $PostClass |
| 101 | 101 | * @return array|bool|null |
| 102 | 102 | */ |
| 103 | - public static function query_post( $query = false, $PostClass = 'TimberPost' ) { |
|
| 104 | - return TimberPostGetter::query_post( $query, $PostClass ); |
|
| 103 | + public static function query_post($query = false, $PostClass = 'TimberPost') { |
|
| 104 | + return TimberPostGetter::query_post($query, $PostClass); |
|
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | /** |
@@ -111,8 +111,8 @@ discard block |
||
| 111 | 111 | * @param string $PostClass |
| 112 | 112 | * @return array|bool|null |
| 113 | 113 | */ |
| 114 | - public static function query_posts( $query = false, $PostClass = 'TimberPost' ) { |
|
| 115 | - return TimberPostGetter::query_posts( $query, $PostClass ); |
|
| 114 | + public static function query_posts($query = false, $PostClass = 'TimberPost') { |
|
| 115 | + return TimberPostGetter::query_posts($query, $PostClass); |
|
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | /** |
@@ -136,8 +136,8 @@ discard block |
||
| 136 | 136 | * @param string $TermClass |
| 137 | 137 | * @return mixed |
| 138 | 138 | */ |
| 139 | - public static function get_terms( $args = null, $maybe_args = array(), $TermClass = 'TimberTerm' ) { |
|
| 140 | - return TimberTermGetter::get_terms( $args, $maybe_args, $TermClass ); |
|
| 139 | + public static function get_terms($args = null, $maybe_args = array(), $TermClass = 'TimberTerm') { |
|
| 140 | + return TimberTermGetter::get_terms($args, $maybe_args, $TermClass); |
|
| 141 | 141 | } |
| 142 | 142 | |
| 143 | 143 | /* Site Retrieval |
@@ -149,14 +149,14 @@ discard block |
||
| 149 | 149 | * @param array|bool $blog_ids |
| 150 | 150 | * @return array |
| 151 | 151 | */ |
| 152 | - public static function get_sites( $blog_ids = false ) { |
|
| 153 | - if ( !is_array( $blog_ids ) ) { |
|
| 152 | + public static function get_sites($blog_ids = false) { |
|
| 153 | + if ( !is_array($blog_ids) ) { |
|
| 154 | 154 | global $wpdb; |
| 155 | - $blog_ids = $wpdb->get_col( "SELECT blog_id FROM $wpdb->blogs ORDER BY blog_id ASC" ); |
|
| 155 | + $blog_ids = $wpdb->get_col("SELECT blog_id FROM $wpdb->blogs ORDER BY blog_id ASC"); |
|
| 156 | 156 | } |
| 157 | 157 | $return = array(); |
| 158 | - foreach ( $blog_ids as $blog_id ) { |
|
| 159 | - $return[] = new TimberSite( $blog_id ); |
|
| 158 | + foreach ($blog_ids as $blog_id) { |
|
| 159 | + $return[] = new TimberSite($blog_id); |
|
| 160 | 160 | } |
| 161 | 161 | return $return; |
| 162 | 162 | } |
@@ -174,17 +174,17 @@ discard block |
||
| 174 | 174 | $data = array(); |
| 175 | 175 | $data['http_host'] = 'http://' . TimberURLHelper::get_host(); |
| 176 | 176 | $data['wp_title'] = TimberHelper::get_wp_title(); |
| 177 | - $data['wp_head'] = TimberHelper::function_wrapper( 'wp_head' ); |
|
| 178 | - $data['wp_footer'] = TimberHelper::function_wrapper( 'wp_footer' ); |
|
| 179 | - $data['body_class'] = implode( ' ', get_body_class() ); |
|
| 177 | + $data['wp_head'] = TimberHelper::function_wrapper('wp_head'); |
|
| 178 | + $data['wp_footer'] = TimberHelper::function_wrapper('wp_footer'); |
|
| 179 | + $data['body_class'] = implode(' ', get_body_class()); |
|
| 180 | 180 | |
| 181 | 181 | $data['site'] = new TimberSite(); |
| 182 | 182 | $data['theme'] = $data['site']->theme; |
| 183 | 183 | |
| 184 | 184 | $data['posts'] = Timber::query_posts(); |
| 185 | 185 | |
| 186 | - $data = apply_filters( 'timber_context', $data ); |
|
| 187 | - $data = apply_filters( 'timber/context', $data ); |
|
| 186 | + $data = apply_filters('timber_context', $data); |
|
| 187 | + $data = apply_filters('timber/context', $data); |
|
| 188 | 188 | return $data; |
| 189 | 189 | } |
| 190 | 190 | |
@@ -198,27 +198,27 @@ discard block |
||
| 198 | 198 | * @param bool $via_render |
| 199 | 199 | * @return bool|string |
| 200 | 200 | */ |
| 201 | - public static function compile( $filenames, $data = array(), $expires = false, $cache_mode = TimberLoader::CACHE_USE_DEFAULT, $via_render = false ) { |
|
| 201 | + public static function compile($filenames, $data = array(), $expires = false, $cache_mode = TimberLoader::CACHE_USE_DEFAULT, $via_render = false) { |
|
| 202 | 202 | $caller = self::get_calling_script_dir(); |
| 203 | 203 | $caller_file = self::get_calling_script_file(); |
| 204 | - $caller_file = apply_filters( 'timber_calling_php_file', $caller_file ); |
|
| 205 | - $loader = new TimberLoader( $caller ); |
|
| 206 | - $file = $loader->choose_template( $filenames ); |
|
| 204 | + $caller_file = apply_filters('timber_calling_php_file', $caller_file); |
|
| 205 | + $loader = new TimberLoader($caller); |
|
| 206 | + $file = $loader->choose_template($filenames); |
|
| 207 | 207 | $output = ''; |
| 208 | - if ( is_null( $data ) ) { |
|
| 208 | + if ( is_null($data) ) { |
|
| 209 | 209 | $data = array(); |
| 210 | 210 | } |
| 211 | - if ( strlen( $file ) ) { |
|
| 211 | + if ( strlen($file) ) { |
|
| 212 | 212 | if ( $via_render ) { |
| 213 | - $file = apply_filters( 'timber_render_file', $file ); |
|
| 214 | - $data = apply_filters( 'timber_render_data', $data ); |
|
| 213 | + $file = apply_filters('timber_render_file', $file); |
|
| 214 | + $data = apply_filters('timber_render_data', $data); |
|
| 215 | 215 | } else { |
| 216 | - $file = apply_filters( 'timber_compile_file', $file ); |
|
| 217 | - $data = apply_filters( 'timber_compile_data', $data ); |
|
| 216 | + $file = apply_filters('timber_compile_file', $file); |
|
| 217 | + $data = apply_filters('timber_compile_data', $data); |
|
| 218 | 218 | } |
| 219 | - $output = $loader->render( $file, $data, $expires, $cache_mode ); |
|
| 219 | + $output = $loader->render($file, $data, $expires, $cache_mode); |
|
| 220 | 220 | } |
| 221 | - do_action( 'timber_compile_done' ); |
|
| 221 | + do_action('timber_compile_done'); |
|
| 222 | 222 | return $output; |
| 223 | 223 | } |
| 224 | 224 | |
@@ -229,14 +229,14 @@ discard block |
||
| 229 | 229 | * @param array $data an array with data in it. |
| 230 | 230 | * @return bool|string |
| 231 | 231 | */ |
| 232 | - public static function compile_string( $string, $data = array() ) { |
|
| 232 | + public static function compile_string($string, $data = array()) { |
|
| 233 | 233 | $dummy_loader = new TimberLoader(); |
| 234 | 234 | $dummy_loader->get_twig(); |
| 235 | 235 | $loader = new Twig_Loader_String(); |
| 236 | - $twig = new Twig_Environment( $loader ); |
|
| 237 | - $twig = apply_filters( 'timber/twig/filters', $twig ); |
|
| 238 | - $twig = apply_filters( 'twig_apply_filters', $twig ); |
|
| 239 | - return $twig->render( $string, $data ); |
|
| 236 | + $twig = new Twig_Environment($loader); |
|
| 237 | + $twig = apply_filters('timber/twig/filters', $twig); |
|
| 238 | + $twig = apply_filters('twig_apply_filters', $twig); |
|
| 239 | + return $twig->render($string, $data); |
|
| 240 | 240 | } |
| 241 | 241 | |
| 242 | 242 | /** |
@@ -248,15 +248,15 @@ discard block |
||
| 248 | 248 | * @param string $cache_mode |
| 249 | 249 | * @return bool|string |
| 250 | 250 | */ |
| 251 | - public static function fetch( $filenames, $data = array(), $expires = false, $cache_mode = TimberLoader::CACHE_USE_DEFAULT ) { |
|
| 251 | + public static function fetch($filenames, $data = array(), $expires = false, $cache_mode = TimberLoader::CACHE_USE_DEFAULT) { |
|
| 252 | 252 | if ( $expires === true ) { |
| 253 | 253 | //if this is reading as true; the user probably is using the old $echo param |
| 254 | 254 | //so we should move all vars up by a spot |
| 255 | 255 | $expires = $cache_mode; |
| 256 | 256 | $cache_mode = TimberLoader::CACHE_USE_DEFAULT; |
| 257 | 257 | } |
| 258 | - $output = self::compile( $filenames, $data, $expires, $cache_mode, true ); |
|
| 259 | - $output = apply_filters( 'timber_compile_result', $output ); |
|
| 258 | + $output = self::compile($filenames, $data, $expires, $cache_mode, true); |
|
| 259 | + $output = apply_filters('timber_compile_result', $output); |
|
| 260 | 260 | return $output; |
| 261 | 261 | } |
| 262 | 262 | |
@@ -269,8 +269,8 @@ discard block |
||
| 269 | 269 | * @param string $cache_mode |
| 270 | 270 | * @return bool|string |
| 271 | 271 | */ |
| 272 | - public static function render( $filenames, $data = array(), $expires = false, $cache_mode = TimberLoader::CACHE_USE_DEFAULT ) { |
|
| 273 | - $output = static::fetch( $filenames, $data, $expires, $cache_mode ); |
|
| 272 | + public static function render($filenames, $data = array(), $expires = false, $cache_mode = TimberLoader::CACHE_USE_DEFAULT) { |
|
| 273 | + $output = static::fetch($filenames, $data, $expires, $cache_mode); |
|
| 274 | 274 | echo $output; |
| 275 | 275 | return $output; |
| 276 | 276 | } |
@@ -282,8 +282,8 @@ discard block |
||
| 282 | 282 | * @param array $data an array with data in it. |
| 283 | 283 | * @return bool|string |
| 284 | 284 | */ |
| 285 | - public static function render_string( $string, $data = array() ) { |
|
| 286 | - $compiled = self::compile_string( $string, $data ); |
|
| 285 | + public static function render_string($string, $data = array()) { |
|
| 286 | + $compiled = self::compile_string($string, $data); |
|
| 287 | 287 | echo $compiled; |
| 288 | 288 | return $compiled; |
| 289 | 289 | } |
@@ -299,14 +299,14 @@ discard block |
||
| 299 | 299 | * @param array $data |
| 300 | 300 | * @return bool|string |
| 301 | 301 | */ |
| 302 | - public static function get_sidebar( $sidebar = '', $data = array() ) { |
|
| 302 | + public static function get_sidebar($sidebar = '', $data = array()) { |
|
| 303 | 303 | if ( $sidebar == '' ) { |
| 304 | 304 | $sidebar = 'sidebar.php'; |
| 305 | 305 | } |
| 306 | - if ( strstr( strtolower( $sidebar ), '.php' ) ) { |
|
| 307 | - return self::get_sidebar_from_php( $sidebar, $data ); |
|
| 306 | + if ( strstr(strtolower($sidebar), '.php') ) { |
|
| 307 | + return self::get_sidebar_from_php($sidebar, $data); |
|
| 308 | 308 | } |
| 309 | - return self::compile( $sidebar, $data ); |
|
| 309 | + return self::compile($sidebar, $data); |
|
| 310 | 310 | } |
| 311 | 311 | |
| 312 | 312 | /** |
@@ -316,21 +316,21 @@ discard block |
||
| 316 | 316 | * @param array $data |
| 317 | 317 | * @return string |
| 318 | 318 | */ |
| 319 | - public static function get_sidebar_from_php( $sidebar = '', $data ) { |
|
| 319 | + public static function get_sidebar_from_php($sidebar = '', $data) { |
|
| 320 | 320 | $caller = self::get_calling_script_dir(); |
| 321 | 321 | $loader = new TimberLoader(); |
| 322 | - $uris = $loader->get_locations( $caller ); |
|
| 322 | + $uris = $loader->get_locations($caller); |
|
| 323 | 323 | ob_start(); |
| 324 | 324 | $found = false; |
| 325 | - foreach ( $uris as $uri ) { |
|
| 326 | - if ( file_exists( trailingslashit( $uri ) . $sidebar ) ) { |
|
| 327 | - include trailingslashit( $uri ) . $sidebar; |
|
| 325 | + foreach ($uris as $uri) { |
|
| 326 | + if ( file_exists(trailingslashit($uri) . $sidebar) ) { |
|
| 327 | + include trailingslashit($uri) . $sidebar; |
|
| 328 | 328 | $found = true; |
| 329 | 329 | break; |
| 330 | 330 | } |
| 331 | 331 | } |
| 332 | 332 | if ( !$found ) { |
| 333 | - TimberHelper::error_log( 'error loading your sidebar, check to make sure the file exists' ); |
|
| 333 | + TimberHelper::error_log('error loading your sidebar, check to make sure the file exists'); |
|
| 334 | 334 | } |
| 335 | 335 | $ret = ob_get_contents(); |
| 336 | 336 | ob_end_clean(); |
@@ -346,8 +346,8 @@ discard block |
||
| 346 | 346 | * @param int $widget_id |
| 347 | 347 | * @return TimberFunctionWrapper |
| 348 | 348 | */ |
| 349 | - public static function get_widgets( $widget_id ) { |
|
| 350 | - return TimberHelper::function_wrapper( 'dynamic_sidebar', array( $widget_id ), true ); |
|
| 349 | + public static function get_widgets($widget_id) { |
|
| 350 | + return TimberHelper::function_wrapper('dynamic_sidebar', array($widget_id), true); |
|
| 351 | 351 | } |
| 352 | 352 | |
| 353 | 353 | |
@@ -362,8 +362,8 @@ discard block |
||
| 362 | 362 | * @param array $args |
| 363 | 363 | * @deprecated since 0.20.0 |
| 364 | 364 | */ |
| 365 | - public static function add_route( $route, $callback, $args = array() ) { |
|
| 366 | - Routes::map( $route, $callback, $args ); |
|
| 365 | + public static function add_route($route, $callback, $args = array()) { |
|
| 366 | + Routes::map($route, $callback, $args); |
|
| 367 | 367 | } |
| 368 | 368 | |
| 369 | 369 | /** |
@@ -371,8 +371,8 @@ discard block |
||
| 371 | 371 | * |
| 372 | 372 | * @deprecated since 0.20.0 |
| 373 | 373 | */ |
| 374 | - public static function load_template( $template, $query = false, $status_code = 200, $tparams = false ) { |
|
| 375 | - return Routes::load( $template, $tparams, $query, $status_code ); |
|
| 374 | + public static function load_template($template, $query = false, $status_code = 200, $tparams = false) { |
|
| 375 | + return Routes::load($template, $tparams, $query, $status_code); |
|
| 376 | 376 | } |
| 377 | 377 | |
| 378 | 378 | /** |
@@ -380,8 +380,8 @@ discard block |
||
| 380 | 380 | * |
| 381 | 381 | * @deprecated since 0.20.2 |
| 382 | 382 | */ |
| 383 | - public static function load_view( $template, $query = false, $status_code = 200, $tparams = false ) { |
|
| 384 | - return Routes::load( $template, $tparams, $query, $status_code ); |
|
| 383 | + public static function load_view($template, $query = false, $status_code = 200, $tparams = false) { |
|
| 384 | + return Routes::load($template, $tparams, $query, $status_code); |
|
| 385 | 385 | } |
| 386 | 386 | |
| 387 | 387 | |
@@ -394,43 +394,43 @@ discard block |
||
| 394 | 394 | * @param array $prefs |
| 395 | 395 | * @return array mixed |
| 396 | 396 | */ |
| 397 | - public static function get_pagination( $prefs = array() ) { |
|
| 397 | + public static function get_pagination($prefs = array()) { |
|
| 398 | 398 | global $wp_query; |
| 399 | 399 | global $paged; |
| 400 | 400 | global $wp_rewrite; |
| 401 | 401 | $args = array(); |
| 402 | - $args['total'] = ceil( $wp_query->found_posts / $wp_query->query_vars['posts_per_page'] ); |
|
| 402 | + $args['total'] = ceil($wp_query->found_posts / $wp_query->query_vars['posts_per_page']); |
|
| 403 | 403 | if ( $wp_rewrite->using_permalinks() ) { |
| 404 | - $url = explode( '?', get_pagenum_link( 0 ) ); |
|
| 405 | - if ( isset( $url[1] ) ) { |
|
| 406 | - parse_str( $url[1], $query ); |
|
| 404 | + $url = explode('?', get_pagenum_link(0)); |
|
| 405 | + if ( isset($url[1]) ) { |
|
| 406 | + parse_str($url[1], $query); |
|
| 407 | 407 | $args['add_args'] = $query; |
| 408 | 408 | } |
| 409 | 409 | $args['format'] = 'page/%#%'; |
| 410 | - $args['base'] = trailingslashit( $url[0] ).'%_%'; |
|
| 410 | + $args['base'] = trailingslashit($url[0]) . '%_%'; |
|
| 411 | 411 | } else { |
| 412 | 412 | $big = 999999999; |
| 413 | - $args['base'] = str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ); |
|
| 413 | + $args['base'] = str_replace($big, '%#%', esc_url(get_pagenum_link($big))); |
|
| 414 | 414 | } |
| 415 | 415 | $args['type'] = 'array'; |
| 416 | - $args['current'] = max( 1, get_query_var( 'paged' ) ); |
|
| 417 | - $args['mid_size'] = max( 9 - $args['current'], 3 ); |
|
| 418 | - if ( is_int( $prefs ) ) { |
|
| 416 | + $args['current'] = max(1, get_query_var('paged')); |
|
| 417 | + $args['mid_size'] = max(9 - $args['current'], 3); |
|
| 418 | + if ( is_int($prefs) ) { |
|
| 419 | 419 | $args['mid_size'] = $prefs - 2; |
| 420 | 420 | } else { |
| 421 | - $args = array_merge( $args, $prefs ); |
|
| 421 | + $args = array_merge($args, $prefs); |
|
| 422 | 422 | } |
| 423 | 423 | $data = array(); |
| 424 | 424 | $data['current'] = $args['current']; |
| 425 | 425 | $data['total'] = $args['total']; |
| 426 | - $data['pages'] = TimberHelper::paginate_links( $args ); |
|
| 427 | - $next = get_next_posts_page_link( $args['total'] ); |
|
| 426 | + $data['pages'] = TimberHelper::paginate_links($args); |
|
| 427 | + $next = get_next_posts_page_link($args['total']); |
|
| 428 | 428 | if ( $next ) { |
| 429 | - $data['next'] = array( 'link' => untrailingslashit( $next ), 'class' => 'page-numbers next' ); |
|
| 429 | + $data['next'] = array('link' => untrailingslashit($next), 'class' => 'page-numbers next'); |
|
| 430 | 430 | } |
| 431 | - $prev = previous_posts( false ); |
|
| 431 | + $prev = previous_posts(false); |
|
| 432 | 432 | if ( $prev ) { |
| 433 | - $data['prev'] = array( 'link' => untrailingslashit( $prev ), 'class' => 'page-numbers prev' ); |
|
| 433 | + $data['prev'] = array('link' => untrailingslashit($prev), 'class' => 'page-numbers prev'); |
|
| 434 | 434 | } |
| 435 | 435 | if ( $paged < 2 ) { |
| 436 | 436 | $data['prev'] = ''; |
@@ -446,10 +446,10 @@ discard block |
||
| 446 | 446 | * |
| 447 | 447 | * @return string |
| 448 | 448 | */ |
| 449 | - public static function get_calling_script_dir( $offset = 0 ) { |
|
| 450 | - $caller = self::get_calling_script_file( $offset ); |
|
| 451 | - if ( !is_null( $caller ) ) { |
|
| 452 | - $pathinfo = pathinfo( $caller ); |
|
| 449 | + public static function get_calling_script_dir($offset = 0) { |
|
| 450 | + $caller = self::get_calling_script_file($offset); |
|
| 451 | + if ( !is_null($caller) ) { |
|
| 452 | + $pathinfo = pathinfo($caller); |
|
| 453 | 453 | $dir = $pathinfo['dirname']; |
| 454 | 454 | return $dir; |
| 455 | 455 | } |
@@ -462,11 +462,11 @@ discard block |
||
| 462 | 462 | * @return string|null |
| 463 | 463 | * @deprecated since 0.20.0 |
| 464 | 464 | */ |
| 465 | - public static function get_calling_script_file( $offset = 0 ) { |
|
| 465 | + public static function get_calling_script_file($offset = 0) { |
|
| 466 | 466 | $caller = null; |
| 467 | 467 | $backtrace = debug_backtrace(); |
| 468 | 468 | $i = 0; |
| 469 | - foreach ( $backtrace as $trace ) { |
|
| 469 | + foreach ($backtrace as $trace) { |
|
| 470 | 470 | if ( array_key_exists('file', $trace) && $trace['file'] != __FILE__ ) { |
| 471 | 471 | $caller = $trace['file']; |
| 472 | 472 | break; |