@@ -273,8 +273,8 @@ discard block |
||
273 | 273 | protected function get_post_preview_object() { |
274 | 274 | global $wp_query; |
275 | 275 | if ( $this->is_previewing() ) { |
276 | - $revision_id = $this->get_post_preview_id( $wp_query ); |
|
277 | - return new $this->PostClass( $revision_id ); |
|
276 | + $revision_id = $this->get_post_preview_id($wp_query); |
|
277 | + return new $this->PostClass($revision_id); |
|
278 | 278 | } |
279 | 279 | } |
280 | 280 | |
@@ -566,8 +566,8 @@ discard block |
||
566 | 566 | $post_meta = apply_filters('timber_post_get_meta_pre', $post_meta, $pid, $this); |
567 | 567 | |
568 | 568 | // Load all meta data when it wasn’t filtered before. |
569 | - if ( false !== $post_meta && empty( $post_meta ) ) { |
|
570 | - $post_meta = get_post_meta( $pid ); |
|
569 | + if ( false !== $post_meta && empty($post_meta) ) { |
|
570 | + $post_meta = get_post_meta($pid); |
|
571 | 571 | } |
572 | 572 | |
573 | 573 | if ( !is_array($post_meta) ) { |
@@ -705,7 +705,7 @@ discard block |
||
705 | 705 | */ |
706 | 706 | public function terms( $args = array(), $merge = true, $term_class = '' ) { |
707 | 707 | // Ensure backwards compatibility. |
708 | - if ( ! is_array( $args ) || isset( $args[0] ) ) { |
|
708 | + if ( !is_array($args) || isset($args[0]) ) { |
|
709 | 709 | $args = array( |
710 | 710 | 'query' => array( |
711 | 711 | 'taxonomy' => $args, |
@@ -714,19 +714,19 @@ discard block |
||
714 | 714 | 'term_class' => $term_class, |
715 | 715 | ); |
716 | 716 | |
717 | - if ( empty( $args['term_class']) ) { |
|
717 | + if ( empty($args['term_class']) ) { |
|
718 | 718 | $args['term_class'] = $this->TermClass; |
719 | 719 | } |
720 | 720 | } |
721 | 721 | |
722 | 722 | // Defaults. |
723 | - $args = wp_parse_args( $args, array( |
|
723 | + $args = wp_parse_args($args, array( |
|
724 | 724 | 'query' => array( |
725 | 725 | 'taxonomy' => 'all', |
726 | 726 | ), |
727 | 727 | 'merge' => true, |
728 | 728 | 'term_class' => $this->TermClass, |
729 | - ) ); |
|
729 | + )); |
|
730 | 730 | |
731 | 731 | $tax = $args['query']['taxonomy']; |
732 | 732 | $merge = $args['merge']; |
@@ -740,10 +740,10 @@ discard block |
||
740 | 740 | } |
741 | 741 | |
742 | 742 | // Build an array of taxonomies. |
743 | - if ( is_array( $tax ) ) { |
|
743 | + if ( is_array($tax) ) { |
|
744 | 744 | $taxonomies = $tax; |
745 | - } elseif ( is_string( $tax ) ) { |
|
746 | - if ( in_array( $tax, array( 'all', 'any', '' ) ) ) { |
|
745 | + } elseif ( is_string($tax) ) { |
|
746 | + if ( in_array($tax, array('all', 'any', '')) ) { |
|
747 | 747 | $taxonomies = get_object_taxonomies($this->post_type); |
748 | 748 | } else { |
749 | 749 | $taxonomies = array($tax); |
@@ -751,45 +751,45 @@ discard block |
||
751 | 751 | } |
752 | 752 | |
753 | 753 | // @todo Remove in 2.x |
754 | - $taxonomies = array_map( function( $taxonomy ) { |
|
755 | - if ( in_array( $taxonomy, array( 'tag', 'tags' ), true ) ) { |
|
754 | + $taxonomies = array_map(function( $taxonomy ) { |
|
755 | + if ( in_array($taxonomy, array('tag', 'tags'), true) ) { |
|
756 | 756 | $taxonomy = 'post_tag'; |
757 | 757 | } elseif ( 'categories' === $taxonomy ) { |
758 | 758 | $taxonomy = 'category'; |
759 | 759 | } |
760 | 760 | |
761 | 761 | return $taxonomy; |
762 | - }, $taxonomies ); |
|
762 | + }, $taxonomies); |
|
763 | 763 | |
764 | - $terms = wp_get_post_terms( $this->ID, $taxonomies, $args['query'] ); |
|
764 | + $terms = wp_get_post_terms($this->ID, $taxonomies, $args['query']); |
|
765 | 765 | |
766 | - if ( is_wp_error( $terms ) ) { |
|
766 | + if ( is_wp_error($terms) ) { |
|
767 | 767 | /** |
768 | 768 | * @var $terms \WP_Error |
769 | 769 | */ |
770 | - Helper::error_log( "Error retrieving terms for taxonomies on a post in timber-post.php" ); |
|
771 | - Helper::error_log( 'tax = ' . print_r( $tax, true ) ); |
|
772 | - Helper::error_log( 'WP_Error: ' . $terms->get_error_message() ); |
|
770 | + Helper::error_log("Error retrieving terms for taxonomies on a post in timber-post.php"); |
|
771 | + Helper::error_log('tax = '.print_r($tax, true)); |
|
772 | + Helper::error_log('WP_Error: '.$terms->get_error_message()); |
|
773 | 773 | |
774 | 774 | return $terms; |
775 | 775 | } |
776 | 776 | |
777 | 777 | // Map over array of WordPress terms and transform them into instances of the chosen term class. |
778 | - $terms = array_map( function( $term ) use ( $term_class ) { |
|
779 | - return call_user_func( array( $term_class, 'from' ), $term->term_id, $term->taxonomy ); |
|
780 | - }, $terms ); |
|
778 | + $terms = array_map(function( $term ) use ($term_class) { |
|
779 | + return call_user_func(array($term_class, 'from'), $term->term_id, $term->taxonomy); |
|
780 | + }, $terms); |
|
781 | 781 | |
782 | - if ( ! $merge ) { |
|
782 | + if ( !$merge ) { |
|
783 | 783 | $terms_sorted = array(); |
784 | 784 | |
785 | 785 | // Initialize sub-arrays. |
786 | 786 | foreach ( $taxonomies as $taxonomy ) { |
787 | - $terms_sorted[ $taxonomy ] = array(); |
|
787 | + $terms_sorted[$taxonomy] = array(); |
|
788 | 788 | } |
789 | 789 | |
790 | 790 | // Fill terms into arrays. |
791 | 791 | foreach ( $terms as $term ) { |
792 | - $terms_sorted[ $term->taxonomy ][] = $term; |
|
792 | + $terms_sorted[$term->taxonomy][] = $term; |
|
793 | 793 | } |
794 | 794 | |
795 | 795 | return $terms_sorted; |
@@ -1181,12 +1181,12 @@ discard block |
||
1181 | 1181 | * |
1182 | 1182 | */ |
1183 | 1183 | protected function get_revised_data_from_method( $method, $args = false ) { |
1184 | - if ( ! is_array($args) ) { |
|
1184 | + if ( !is_array($args) ) { |
|
1185 | 1185 | $args = array($args); |
1186 | 1186 | } |
1187 | 1187 | $rev = $this->get_post_preview_object(); |
1188 | 1188 | if ( $rev && $this->ID == $rev->post_parent && $this->ID != $rev->ID ) { |
1189 | - return call_user_func_array( array($rev, $method), $args ); |
|
1189 | + return call_user_func_array(array($rev, $method), $args); |
|
1190 | 1190 | } |
1191 | 1191 | } |
1192 | 1192 | |
@@ -1204,7 +1204,7 @@ discard block |
||
1204 | 1204 | * @return string |
1205 | 1205 | */ |
1206 | 1206 | public function content( $page = 0, $len = -1 ) { |
1207 | - if ( $rd = $this->get_revised_data_from_method('content', array($page, $len) ) ) { |
|
1207 | + if ( $rd = $this->get_revised_data_from_method('content', array($page, $len)) ) { |
|
1208 | 1208 | return $rd; |
1209 | 1209 | } |
1210 | 1210 | if ( $form = $this->maybe_show_password_form() ) { |
@@ -1224,7 +1224,7 @@ discard block |
||
1224 | 1224 | $content = $contents[$page]; |
1225 | 1225 | } |
1226 | 1226 | } |
1227 | - $content = $this->content_handle_no_teaser_block( $content ); |
|
1227 | + $content = $this->content_handle_no_teaser_block($content); |
|
1228 | 1228 | $content = apply_filters('the_content', ($content)); |
1229 | 1229 | if ( $len == -1 && $page == 0 ) { |
1230 | 1230 | $this->___content = $content; |
@@ -1241,7 +1241,7 @@ discard block |
||
1241 | 1241 | * @return string |
1242 | 1242 | */ |
1243 | 1243 | protected function content_handle_no_teaser_block( $content ) { |
1244 | - if ( (strpos($content, 'noTeaser:true') !== false || strpos($content, '"noTeaser":true') !== false) && strpos($content, '<!-- /wp:more -->') !== false) { |
|
1244 | + if ( (strpos($content, 'noTeaser:true') !== false || strpos($content, '"noTeaser":true') !== false) && strpos($content, '<!-- /wp:more -->') !== false ) { |
|
1245 | 1245 | $arr = explode('<!-- /wp:more -->', $content); |
1246 | 1246 | return trim($arr[1]); |
1247 | 1247 | } |