Making WordPress.org


Ignore:
Timestamp:
06/17/2014 12:00:42 AM (10 years ago)
Author:
coffee2code
Message:

Handbook plugin: misc fixes and tweaks. Fixes #250

  • Fix to set object post_type variable when post_type is 'handbook'
  • Fix to use get_post_type() instead of referencing no-long-existing object variable
  • Don't append suffix for 'page' post_type (for ToC and widgets)
  • Honor before_widget and after_widget config for widget
  • More succinct and thorough array typecasting
  • Internationalize strings
  • Minor spacing and code formatting tweaks
File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/handbook/inc/table-of-contents.php

    r705 r706  
    1111
    1212    function __construct( $post_types ) {
    13         $this->post_types = $post_types;
     13        $this->post_types = (array) $post_types;
    1414        add_action( 'template_redirect', array( $this, 'load_filters' ) );
    1515    }
     
    2323
    2424    function append_suffix( $t ) {
    25         if ( 'handbook' == $t )
     25        if ( in_array( $t, array( 'handbook', 'page' ) ) ) {
    2626            return $t;
     27        }
    2728
    2829        return $t . '-handbook';
     
    4243            $pages_header = 'h3';
    4344
    44         if ( $pages = wp_list_pages( array( 'child_of' => get_the_ID(), 'echo' => false, 'title_li' => false, 'post_type' => $this->post_type ) ) )
     45        if ( $pages = wp_list_pages( array( 'child_of' => get_the_ID(), 'echo' => false, 'title_li' => false, 'post_type' => get_post_type() ) ) )
    4546            $toc .= "<$pages_header>Pages</$pages_header><ul class=\"items\">$pages</ul>";
    4647
     
    4849            $toc .= $this->styles;
    4950            $toc .= '<div class="table-of-contents">';
    50             $toc .= "<$contents_header>Contents</$contents_header><ul class=\"items\">";
     51            $toc .= "<$contents_header>" . __( 'Topics', 'wporg' ) . "</$contents_header><ul class=\"items\">";
    5152            $last_item = false;
    5253            foreach ( $items as $item ) {
     
    7980
    8081            if ( ! $first ) {
    81                 $replacement .= '<p class="toc-jump"><a href="#top">Top &uarr;</a></p>';
     82                $replacement .= '<p class="toc-jump"><a href="#top">' . __( 'Top &uarr;', 'wporg' ) . '</a></p>';
    8283            } else {
    8384                $first = false;
Note: See TracChangeset for help on using the changeset viewer.