Plugin Directory

Changeset 3188809


Ignore:
Timestamp:
11/14/2024 03:06:19 PM (13 months ago)
Author:
benjaminprojas
Message:

2411

Location:
table-of-contents-plus/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • table-of-contents-plus/trunk/includes/class-toc-plus.php

    r3135199 r3188809  
    99        private $exclude_post_types;
    1010        private $collision_collector;  // keeps a track of used anchors for collision detecting
     11        private $defaults;
    1112
    1213        public function __construct() {
     
    1617
    1718            // get options
    18             $defaults = [  // default options
     19            $this->defaults = [  // default options
    1920                'fragment_prefix'                    => 'i',
    2021                'position'                           => TOC_POSITION_BEFORE_FIRST_HEADING,
     
    6364            ];
    6465
    65             $options       = get_option( 'toc-options', $defaults );
    66             $this->options = wp_parse_args( $options, $defaults );
     66            $options       = get_option( 'toc-options', $this->defaults );
     67            $this->options = wp_parse_args( $options, $this->defaults );
    6768
    6869            add_action( 'plugins_loaded', [ $this, 'plugins_loaded' ] );
     
    7172            add_action( 'admin_menu', [ $this, 'admin_menu' ] );
    7273            add_action( 'widgets_init', [ $this, 'widgets_init' ] );
    73             add_action( 'sidebar_admin_setup', [ $this, 'sidebar_admin_setup' ] );
     74            add_action( 'delete_widget', [ $this, 'sidebar_admin_setup' ], 10, 3 );
    7475            add_action( 'init', [ $this, 'init' ] );
    7576
     
    528529         * Remove widget options on widget deletion
    529530         */
    530         public function sidebar_admin_setup() {
     531        public function sidebar_admin_setup( $widget_id, $sidebar_id, $id_base ) {
     532            // If we aren't trying to delete a TOC widget, return early.
     533            if ( 'toc-widget' !== $id_base ) {
     534                return;
     535            }
     536
    531537            // this action is loaded at the start of the widget screen
    532538            // so only do the following when a form action has been initiated
    533             if ( 'post' === strtolower( $_SERVER['REQUEST_METHOD'] ) ) {
    534                 if ( isset( $_POST['id_base'] ) && 'toc-widget' === $_POST['id_base'] ) {  // phpcs:ignore WordPress.Security.NonceVerification.Missing
    535                     if ( isset( $_POST['delete_widget'] ) && 1 === (int) $_POST['delete_widget'] ) {  // phpcs:ignore WordPress.Security.NonceVerification.Missing
    536                         $this->set_show_toc_in_widget_only( false );
    537                         $this->set_show_toc_in_widget_only_post_types( [ 'page' ] );
    538                     }
    539                 }
    540             }
     539            $this->set_show_toc_in_widget_only( false );
     540            $this->set_show_toc_in_widget_only_post_types( [ 'page' ] );
    541541        }
    542542
     
    607607                return false;
    608608            }
    609             if ( ! wp_verify_nonce( $_POST['toc-admin-options'], plugin_basename( __FILE__ ) ) ) {
     609            if ( ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['toc-admin-options'] ) ), plugin_basename( __FILE__ ) ) ) {
    610610                return false;
    611611            }
     
    620620            // wp-includes/load.php::wp_magic_quotes()
    621621
    622             $custom_background_colour    = $this->hex_value( trim( $_POST['custom_background_colour'] ), TOC_DEFAULT_BACKGROUND_COLOUR );
    623             $custom_border_colour        = $this->hex_value( trim( $_POST['custom_border_colour'] ), TOC_DEFAULT_BORDER_COLOUR );
    624             $custom_title_colour         = $this->hex_value( trim( $_POST['custom_title_colour'] ), TOC_DEFAULT_TITLE_COLOUR );
    625             $custom_links_colour         = $this->hex_value( trim( $_POST['custom_links_colour'] ), TOC_DEFAULT_LINKS_COLOUR );
    626             $custom_links_hover_colour   = $this->hex_value( trim( $_POST['custom_links_hover_colour'] ), TOC_DEFAULT_LINKS_HOVER_COLOUR );
    627             $custom_links_visited_colour = $this->hex_value( trim( $_POST['custom_links_visited_colour'] ), TOC_DEFAULT_LINKS_VISITED_COLOUR );
    628 
    629             $restrict_path = trim( $_POST['restrict_path'] );
     622            $custom_background_colour    = ! empty( $_POST['custom_background_colour'] ) ? $this->hex_value( trim( wp_unslash( $_POST['custom_background_colour'] ) ), TOC_DEFAULT_BACKGROUND_COLOUR ) : TOC_DEFAULT_BACKGROUND_COLOUR; // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
     623            $custom_border_colour        = ! empty( $_POST['custom_border_colour'] ) ? $this->hex_value( trim( wp_unslash( $_POST['custom_border_colour'] ) ), TOC_DEFAULT_BORDER_COLOUR ) : TOC_DEFAULT_BORDER_COLOUR; // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
     624            $custom_title_colour         = ! empty( $_POST['custom_title_colour'] ) ? $this->hex_value( trim( wp_unslash( $_POST['custom_title_colour'] ) ), TOC_DEFAULT_TITLE_COLOUR ) : TOC_DEFAULT_TITLE_COLOUR; // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
     625            $custom_links_colour         = ! empty( $_POST['custom_links_colour'] ) ? $this->hex_value( trim( wp_unslash( $_POST['custom_links_colour'] ) ), TOC_DEFAULT_LINKS_COLOUR ) : TOC_DEFAULT_LINKS_COLOUR; // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
     626            $custom_links_hover_colour   = ! empty( $_POST['custom_links_hover_colour'] ) ? $this->hex_value( trim( wp_unslash( $_POST['custom_links_hover_colour'] ) ), TOC_DEFAULT_LINKS_HOVER_COLOUR ) : TOC_DEFAULT_LINKS_HOVER_COLOUR; // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
     627            $custom_links_visited_colour = ! empty( $_POST['custom_links_visited_colour'] ) ? $this->hex_value( trim( wp_unslash( $_POST['custom_links_visited_colour'] ) ), TOC_DEFAULT_LINKS_VISITED_COLOUR ) : TOC_DEFAULT_LINKS_VISITED_COLOUR; // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
     628
     629            $restrict_path = ! empty( $_POST['restrict_path'] ) ? trim( sanitize_text_field( wp_unslash( $_POST['restrict_path'] ) ) ) : '';
    630630
    631631            if ( $restrict_path ) {
     
    636636            }
    637637
     638            $fragment_prefix               = isset( $_POST['fragment_prefix'] ) ? trim( sanitize_text_field( wp_unslash( $_POST['fragment_prefix'] ) ) ) : $this->defaults['fragment_prefix'];
     639            $position                      = isset( $_POST['position'] ) ? intval( $_POST['position'] ) : $this->defaults['position'];
     640            $start                         = isset( $_POST['start'] ) ? intval( $_POST['start'] ) : $this->defaults['start'];
     641            $show_heading_text             = isset( $_POST['show_heading_text'] ) && (bool) $_POST['show_heading_text'];
     642            $heading_text                  = isset( $_POST['heading_text'] ) ? stripslashes( trim( sanitize_text_field( wp_unslash( $_POST['heading_text'] ) ) ) ) : $this->defaults['heading_text'];
     643            $auto_insert_post_types        = isset( $_POST['auto_insert_post_types'] ) ? array_map( 'sanitize_text_field', array_map( 'wp_unslash', (array) $_POST['auto_insert_post_types'] ) ) : []; // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.ValidatedSanitizedInput.MissingUnslash
     644            $show_heirarchy                = isset( $_POST['show_heirarchy'] ) && (bool) $_POST['show_heirarchy'];
     645            $ordered_list                  = isset( $_POST['ordered_list'] ) && (bool) $_POST['ordered_list'];
     646            $smooth_scroll                 = isset( $_POST['smooth_scroll'] ) && (bool) $_POST['smooth_scroll'];
     647            $smooth_scroll_offset          = isset( $_POST['smooth_scroll_offset'] ) ? intval( $_POST['smooth_scroll_offset'] ) : $this->defaults['smooth_scroll_offset'];
     648            $visibility                    = isset( $_POST['visibility'] ) && (bool) $_POST['visibility'];
     649            $visibility_show               = isset( $_POST['visibility_show'] ) ? stripslashes( trim( sanitize_text_field( wp_unslash( $_POST['visibility_show'] ) ) ) ) : $this->defaults['visibility_show'];
     650            $visibility_hide               = isset( $_POST['visibility_hide'] ) ? stripslashes( trim( sanitize_text_field( wp_unslash( $_POST['visibility_hide'] ) ) ) ) : $this->defaults['visibility_hide'];
     651            $visibility_hide_by_default    = isset( $_POST['visibility_hide_by_default'] ) && (bool) $_POST['visibility_hide_by_default'];
     652            $width                         = isset( $_POST['width'] ) ? trim( sanitize_text_field( wp_unslash( $_POST['width'] ) ) ) : $this->defaults['width'];
     653            $width_custom                  = isset( $_POST['width_custom'] ) ? floatval( $_POST['width_custom'] ) : $this->defaults['width_custom'];
     654            $width_custom_units            = isset( $_POST['width_custom_units'] ) ? trim( sanitize_text_field( wp_unslash( $_POST['width_custom_units'] ) ) ) : $this->defaults['width_custom_units'];
     655            $wrapping                      = isset( $_POST['wrapping'] ) ? intval( $_POST['wrapping'] ) : $this->defaults['wrapping'];
     656            $font_size                     = isset( $_POST['font_size'] ) ? floatval( $_POST['font_size'] ) : $this->defaults['font_size'];
     657            $font_size_units               = isset( $_POST['font_size_units'] ) ? trim( sanitize_text_field( wp_unslash( $_POST['font_size_units'] ) ) ) : $this->defaults['font_size_units'];
     658            $theme                         = isset( $_POST['theme'] ) ? intval( $_POST['theme'] ) : $this->defaults['theme'];
     659            $lowercase                     = isset( $_POST['lowercase'] ) && (bool) $_POST['lowercase'];
     660            $hyphenate                     = isset( $_POST['hyphenate'] ) && (bool) $_POST['hyphenate'];
     661            $bullet_spacing                = isset( $_POST['bullet_spacing'] ) && (bool) $_POST['bullet_spacing'];
     662            $include_homepage              = isset( $_POST['include_homepage'] ) && (bool) $_POST['include_homepage'];
     663            $exclude_css                   = isset( $_POST['exclude_css'] ) && (bool) $_POST['exclude_css'];
     664            $heading_levels                = isset( $_POST['heading_levels'] ) ? array_map( 'intval', (array) $_POST['heading_levels'] ) : [];
     665            $exclude                       = isset( $_POST['exclude'] ) ? stripslashes( trim( sanitize_text_field( wp_unslash( $_POST['exclude'] ) ) ) ) : $this->defaults['exclude'];
     666            $sitemap_show_page_listing     = isset( $_POST['sitemap_show_page_listing'] ) && (bool) $_POST['sitemap_show_page_listing'];
     667            $sitemap_show_category_listing = isset( $_POST['sitemap_show_category_listing'] ) && (bool) $_POST['sitemap_show_category_listing'];
     668            $sitemap_heading_type          = isset( $_POST['sitemap_heading_type'] ) ? intval( $_POST['sitemap_heading_type'] ) : $this->defaults['sitemap_heading_type'];
     669            $sitemap_pages                 = isset( $_POST['sitemap_pages'] ) ? stripslashes( trim( sanitize_text_field( wp_unslash( $_POST['sitemap_pages'] ) ) ) ) : $this->defaults['sitemap_pages'];
     670            $sitemap_categories            = isset( $_POST['sitemap_categories'] ) ? stripslashes( trim( sanitize_text_field( wp_unslash( $_POST['sitemap_categories'] ) ) ) ) : $this->defaults['sitemap_categories'];
     671            $rest_toc_output               = isset( $_POST['rest_toc_output'] ) && (bool) $_POST['rest_toc_output'];
     672
    638673            $this->options = array_merge(
    639674                $this->options,
    640675                [
    641                     'fragment_prefix'               => trim( $_POST['fragment_prefix'] ),
    642                     'position'                      => intval( $_POST['position'] ),
    643                     'start'                         => intval( $_POST['start'] ),
    644                     'show_heading_text'             => ( isset( $_POST['show_heading_text'] ) && $_POST['show_heading_text'] ) ? true : false,
    645                     'heading_text'                  => stripslashes( trim( $_POST['heading_text'] ) ),
    646                     'auto_insert_post_types'        => ( isset( $_POST['auto_insert_post_types'] ) ) ? (array) $_POST['auto_insert_post_types'] : array(),
    647                     'show_heirarchy'                => ( isset( $_POST['show_heirarchy'] ) && $_POST['show_heirarchy'] ) ? true : false,
    648                     'ordered_list'                  => ( isset( $_POST['ordered_list'] ) && $_POST['ordered_list'] ) ? true : false,
    649                     'smooth_scroll'                 => ( isset( $_POST['smooth_scroll'] ) && $_POST['smooth_scroll'] ) ? true : false,
    650                     'smooth_scroll_offset'          => intval( $_POST['smooth_scroll_offset'] ),
    651                     'visibility'                    => ( isset( $_POST['visibility'] ) && $_POST['visibility'] ) ? true : false,
    652                     'visibility_show'               => stripslashes( trim( $_POST['visibility_show'] ) ),
    653                     'visibility_hide'               => stripslashes( trim( $_POST['visibility_hide'] ) ),
    654                     'visibility_hide_by_default'    => ( isset( $_POST['visibility_hide_by_default'] ) && $_POST['visibility_hide_by_default'] ) ? true : false,
    655                     'width'                         => trim( $_POST['width'] ),
    656                     'width_custom'                  => floatval( $_POST['width_custom'] ),
    657                     'width_custom_units'            => trim( $_POST['width_custom_units'] ),
    658                     'wrapping'                      => intval( $_POST['wrapping'] ),
    659                     'font_size'                     => floatval( $_POST['font_size'] ),
    660                     'font_size_units'               => trim( $_POST['font_size_units'] ),
    661                     'theme'                         => intval( $_POST['theme'] ),
     676                    'fragment_prefix'               => $fragment_prefix,
     677                    'position'                      => $position,
     678                    'start'                         => $start,
     679                    'show_heading_text'             => $show_heading_text,
     680                    'heading_text'                  => $heading_text,
     681                    'auto_insert_post_types'        => $auto_insert_post_types,
     682                    'show_heirarchy'                => $show_heirarchy,
     683                    'ordered_list'                  => $ordered_list,
     684                    'smooth_scroll'                 => $smooth_scroll,
     685                    'smooth_scroll_offset'          => $smooth_scroll_offset,
     686                    'visibility'                    => $visibility,
     687                    'visibility_show'               => $visibility_show,
     688                    'visibility_hide'               => $visibility_hide,
     689                    'visibility_hide_by_default'    => $visibility_hide_by_default,
     690                    'width'                         => $width,
     691                    'width_custom'                  => $width_custom,
     692                    'width_custom_units'            => $width_custom_units,
     693                    'wrapping'                      => $wrapping,
     694                    'font_size'                     => $font_size,
     695                    'font_size_units'               => $font_size_units,
     696                    'theme'                         => $theme,
    662697                    'custom_background_colour'      => $custom_background_colour,
    663698                    'custom_border_colour'          => $custom_border_colour,
     
    666701                    'custom_links_hover_colour'     => $custom_links_hover_colour,
    667702                    'custom_links_visited_colour'   => $custom_links_visited_colour,
    668                     'lowercase'                     => ( isset( $_POST['lowercase'] ) && $_POST['lowercase'] ) ? true : false,
    669                     'hyphenate'                     => ( isset( $_POST['hyphenate'] ) && $_POST['hyphenate'] ) ? true : false,
    670                     'bullet_spacing'                => ( isset( $_POST['bullet_spacing'] ) && $_POST['bullet_spacing'] ) ? true : false,
    671                     'include_homepage'              => ( isset( $_POST['include_homepage'] ) && $_POST['include_homepage'] ) ? true : false,
    672                     'exclude_css'                   => ( isset( $_POST['exclude_css'] ) && $_POST['exclude_css'] ) ? true : false,
    673                     'heading_levels'                => ( isset( $_POST['heading_levels'] ) ) ? array_map( 'intval', (array) $_POST['heading_levels'] ) : array(),
    674                     'exclude'                       => stripslashes( trim( $_POST['exclude'] ) ),
     703                    'lowercase'                     => $lowercase,
     704                    'hyphenate'                     => $hyphenate,
     705                    'bullet_spacing'                => $bullet_spacing,
     706                    'include_homepage'              => $include_homepage,
     707                    'exclude_css'                   => $exclude_css,
     708                    'heading_levels'                => $heading_levels,
     709                    'exclude'                       => $exclude,
    675710                    'restrict_path'                 => $restrict_path,
    676                     'sitemap_show_page_listing'     => ( isset( $_POST['sitemap_show_page_listing'] ) && $_POST['sitemap_show_page_listing'] ) ? true : false,
    677                     'sitemap_show_category_listing' => ( isset( $_POST['sitemap_show_category_listing'] ) && $_POST['sitemap_show_category_listing'] ) ? true : false,
    678                     'sitemap_heading_type'          => intval( $_POST['sitemap_heading_type'] ),
    679                     'sitemap_pages'                 => stripslashes( trim( $_POST['sitemap_pages'] ) ),
    680                     'sitemap_categories'            => stripslashes( trim( $_POST['sitemap_categories'] ) ),
    681                     'rest_toc_output'               => ( isset( $_POST['rest_toc_output'] ) && $_POST['rest_toc_output'] ) ? true : false,
     711                    'sitemap_show_page_listing'     => $sitemap_show_page_listing,
     712                    'sitemap_show_category_listing' => $sitemap_show_category_listing,
     713                    'sitemap_heading_type'          => $sitemap_heading_type,
     714                    'sitemap_pages'                 => $sitemap_pages,
     715                    'sitemap_categories'            => $sitemap_categories,
     716                    'rest_toc_output'               => $rest_toc_output,
    682717                ]
    683718            );
     
    691726
    692727        public function admin_options() {
    693             $msg = '';
     728            $page = isset( $_GET['page'] ) ? sanitize_text_field( wp_unslash( $_GET['page'] ) ) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Recommended
     729            $msg  = '';
    694730
    695731            // was there a form submission, if so, do security checks and try to save form
     
    707743<h2>Table of Contents Plus</h2>
    708744            <?php echo wp_kses_post( $msg ); ?>
    709 <form method="post" action="<?php echo esc_url( '?page=' . $_GET['page'] . '&update' ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended ?>">
     745<form method="post" action="<?php echo esc_url( '?page=' . $page . '&update' ); ?>">
    710746            <?php wp_nonce_field( plugin_basename( __FILE__ ), 'toc-admin-options' ); ?>
    711747
     
    10371073                echo ' checked="checked"';
    10381074            }
    1039             echo '><label for="heading_levels' . esc_attr( $i ) . '"> ' . esc_html( __( 'heading ' ) . $i . ' - h' . $i ) . '</label><br>';
     1075            echo '><label for="heading_levels' . esc_attr( $i ) . '"> ' . esc_html( __( 'heading ', 'table-of-contents-plus' ) . $i . ' - h' . $i ) . '</label><br>';
    10401076        }
    10411077        ?>
     
    15671603                ) {
    15681604                    if ( $this->options['restrict_path'] ) {
    1569                         if ( strpos( $_SERVER['REQUEST_URI'], $this->options['restrict_path'] ) === 0 ) {
     1605                        $requestUri = ! empty( $_SERVER['REQUEST_URI'] ) ? $_SERVER['REQUEST_URI'] : ''; // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.ValidatedSanitizedInput.MissingUnslash
     1606                        if ( strpos( $requestUri, $this->options['restrict_path'] ) === 0 ) {
    15701607                            return true;
    15711608                        } else {
  • table-of-contents-plus/trunk/includes/globals.php

    r3135199 r3188809  
    11<?php
    22
    3 define( 'TOC_VERSION', '2408' );
     3define( 'TOC_VERSION', '2411' );
    44define( 'TOC_POSITION_BEFORE_FIRST_HEADING', 1 );
    55define( 'TOC_POSITION_TOP', 2 );
  • table-of-contents-plus/trunk/readme.txt

    r3135199 r3188809  
    11=== Table of Contents Plus ===
    2 Contributors: conjur3r
    3 Tags: table of contents, indexes, toc, sitemap, cms, options, list, page listing, category listing
     2Contributors: aioseo, smub, benjaminprojas
     3Tags: table of contents, indexes, toc, sitemap, cms
    44Requires at least: 3.2
    5 Tested up to: 6.6.1
    6 Stable tag: 2408
     5Tested up to: 6.7
     6Stable tag: 2411
    77License: GPLv2 or later
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    105105
    106106== Changelog ==
     107= 2411 =
     108* Released: 14 November 2024
     109* Security hardening reported by Patchstack
     110* Plugin updates for compatibility with Plugin Check
     111
    107112= 2408 =
    108113* Released: 14 August 2024
     
    252257* Fixed: an issue in 1303 that ignored headings with the opening tag on the first line and the heading text on a new line.  Thanks to [richardsng](http://wordpress.org/support/topic/unable-to-display-the-full-toc) for the quick discovery.
    253258
    254 = 1303 =
    255 * Released: 21 March 2013
    256 * New: option auto insert after the first heading.  Thanks to [@thelawnetwork](http://dublue.com/plugins/toc/comment-page-4/#comment-1782) for requesting it.
    257 * New: allow headings to be excluded from the table of contents.  This is available both globally under the advanced section of Settings > TOC+ and individually with the TOC shortcode.  Check out the help material for examples.  Thanks to the many of you that requested it.
    258 * New: advanced option to lowercase all anchors.  The default is off.
    259 * New: advanced option to use hyphens rather than underscores in anchors.  The default is off.
    260 * New: shortcode to list all posts in alphabetical order grouped by first letter.
    261 * New: added Slovak translation, curtesy Branco Radenovich.
    262 * Add version numbers to CSS/JS files to better support setups that cache these files heavily for timely invalidation.  Thanks to [boxcarpress](http://wordpress.org/support/topic/some-changes-we-made-that-you-might-consider) for the amendments.
    263 * Add CSS class 'contracted' to #toc_container when the table of contents is hidden. Thanks to [Sam](http://wordpress.org/support/topic/hide-link-not-working?replies=6#post-3968019) for suggesting it.
    264 * With smooth scroll enabled, do not use an offset if no admin bar is present and the offset value is default.  This means that public users do not have the offset space at the top.
    265 * New help material for developers under the help tab.
    266 * Added API function: toc_get_index() lets you retrieve a table of contents to be placed within PHP.  Check out the new developer help material for examples.
    267 * Allow anchors to be filterable using toc_url_anchor_target to customise further through code.  Check the new developer help material for an example.  Thanks to [Russell Heimlich](http://dublue.com/plugins/toc/comment-page-4/#comment-1713) for the tip.
    268 * Adjust CSS and JS registration.
    269 * Updated jQuery Smooth Scroll to 1.4.10.
    270 * Fixed: When using the widget, addressed an issue where the index with special characters (such as ' and ") would not link to the correct spot within the content.  Thanks to [esandman](http://wordpress.org/support/topic/problems-with-apostrophes-and-quotation-marks) for raising it.
    271 * Fixed: Saving at Settings > TOC+ resets TOC+ widget options.  Thanks to [Chris](http://dublue.com/plugins/toc/comment-page-4/#comment-1808) for reporting it.
    272 
    273 = 1211 =
    274 * Released: 17 November 2012
    275 * New: allow %PAGE_TITLE% to be used in the TOC title.  Note that this also works in the widget title too.  When used, this variable will be replaced with the current page's title.  Thanks to [Peter](http://dublue.com/plugins/toc/comment-page-3/#comment-4782) for the request.
    276 * New: new option to hide the TOC initially.  Thanks to [Jonas](http://dublue.com/plugins/toc/comment-page-2/#comment-852), [Jonathan](http://dublue.com/plugins/toc/comment-page-2/#comment-2161), and [Doc Germanicus](http://dublue.com/plugins/toc/comment-page-4/#comment-5048) for requesting it.
    277 * New: added ability to customise visited TOC link colour.
    278 * New: option to restrict generation to a URL path match.  For example, you can restrict to wiki pages that fall under http://domain/wiki/ by entering /wiki/ into the field.  The setting can be found in the advanced options.  Thanks to [Tux](http://dublue.com/plugins/toc/comment-page-3/#comment-4466) and [Justine Smithies](http://dublue.com/plugins/toc/comment-page-3/#comment-5000) for suggesting it.
    279 * Make regular expressions less greedy.  That means you can have multiple headings on a single line whereas before you needed to ensure each heading was on their own line.  Thanks to [drdamour](http://wordpress.org/support/topic/widget-isnt-showing-up) for raising and providing a fix.
    280 * Also make regular expressions match across multiple lines.  This means you can have your single heading split across many lines.
    281 * Better accessibility: when using smooth scrolling, allow for focus to follow the target, eg tabbing through will continue from the content block you clicked through to.
    282 * Better performance: as requested by a few, javascript files have been consolidated into one and both javascript and CSS files are now minified.
    283 * 'Auto' is now the default width which means it'll take up the needed amount of space up to 100%.  The previous default was a fixed width of 275px.
    284 * Added the ability to exclude entire branches when using [sitemap_pages] and [sitemap_categories] using the exclude_tree attribute.  Thanks to [Benny Powers](http://dublue.com/plugins/toc/comment-page-3/#comment-3607) for requesting it.
    285 * Wrap index numbers around span tags to enable easier CSS customisation.  The spans are have two classes: toc_number and toc_depth_X where X is between 1 and 6.  Thanks to [Matthias Krok](http://dublue.com/plugins/toc/comment-page-3/#comment-3922) for requesting it.
    286 * Moved the 'preserve theme bullets' option into the advanced section.
    287 * Updated and simplified the translation file.
    288 * Fixed: [sitemap_categories] using the wrong label when none was specified.  Thanks to [brandt-net](http://wordpress.org/support/topic/plugin-table-of-contents-plus-sitemap-setting-categories-label-of-sitemap_categories-not-shown) for raising it.  The labels for both [sitemap_pages] and [sitemap_categories] may be removed in a future update as you can insert the title within your content.
    289 
    290 = 1208 =
    291 * Released: 2 August 2012
    292 * New: advanced option to prevent the output of this plugin's CSS.  This option allows the site owner to incorporate styles in one of their existing style sheets.  Thanks to [Ivan](http://dublue.com/plugins/toc/comment-page-1/#comment-226) and [Swashata](http://dublue.com/plugins/toc/comment-page-3/#comment-3312) for suggesting it.
    293 * Added Simplified Chinese translation thanks to icedream
    294 * Make more translatable by adding a translation POT file in the languages folder.  Translations welcome!
    295 * Adjust multibyte string detection as reported by [johnnyvaughan](http://wordpress.org/support/topic/plugin-table-of-contents-plus-multibyte-string-detetction)
    296 * Support PHP 5.4.x installations.  Thanks to [Josh](http://dublue.com/plugins/toc/comment-page-3/#comment-3477) for raising it.
    297 * Fixed: -2 appearing in links when using the TOC+ widget.  Thanks to [Arturo](http://dublue.com/plugins/toc/comment-page-3/#comment-3337) for raising it.
    298 
    299 = 1207 =
    300 * Released: 23 July 2012
    301 * New: when smooth scrolling is enabled, allow the top offset to be specified to support more than the WordPress admin bar (such as Twitter Bootstrap).  The offset is displayed in the advanced section after you have enabled smooth scrolling.  Thanks to [Nicolaus](http://dublue.com/2012/05/12/another-benefit-to-structure-your-web-pages/#comment-2611) for the suggestion.
    302 * Allow 2 headings to be set as the minimum (used to be 3).  Thanks to [Fran](http://dublue.com/plugins/toc/comment-page-2/#comment-779) for justifying it.
    303 * Run later in the process so other plugins don't alter the anchor links (eg Google Analytics for WordPress).
    304 * Do not show a TOC in RSS feeds.  Thanks to [Swashata](http://dublue.com/plugins/toc/comment-page-3/#comment-2875) for raising it.
    305 * Bump tested version to WordPress 3.5-alpha.
    306 * Added help material about why some headings may not be appearing.
    307 * Added banner image for WordPress repository listing.
    308 * Updated readme.txt with GPLv2 licensing.
    309 
    310 = 1112.1 =
    311 * Released: 9 December 2011
    312 * Forgot to update version number.
    313 
    314 = 1112 =
    315 * Released: 9 December 2011
    316 * New: auto width option added which takes up only the needed amount of horizontal space up to 100%.
    317 * Removed trailing - or _ characters from the anchor to make it more pretty.
    318 * This plugin's long name has changed from "Table of Contents+" to "Table of Contents Plus".  The short name remains as "TOC+".
    319 * Fixed: when using the TOC shortcode within your content, your post or article would display the TOC on the homepage despite having the exclude from homepage option enabled.  If you also used the "more tag", then you may have resulted with an empty TOC box.  These are now addressed.
    320 * Fixed: all anchors ending with "-2" when no headings were repeated.  This was caused by plugins and themes that trigger `the_content` filter.  The counters are now reset everytime `the_content` is run rather than only on initialisation.
    321 
    322 = 1111 =
    323 * Released: 11 November 2011
    324 * New: option to adjust the font size.  Thanks to [DJ](http://dublue.com/plugins/toc/comment-page-1/#comment-323) for the suggestion.  The default remains at 95%.
    325 * New: advanced option to select the heading levels (1 to 6) to be included.  Thanks to those that hinted about wanting to achieve this.
    326 * New: you can now have the TOC appear in the sidebar via the TOC+ widget.  Thanks to [Nick Daugherty](http://dublue.com/plugins/toc/comment-page-1/#comment-172) and [DJ](http://dublue.com/plugins/toc/comment-page-1/#comment-323) for the suggestion.
    327 * The TOC shortcode now supports the *heading_levels* attribute to allow you to limit the headings you want to appear in the table of contents on a per instance basis.  Separate multiple headings with a comma.  For example: include headings 3, 4 and 5 but exclude the others with `[toc heading_levels="3,4,5"]`
    328 * The TOC shortcode also supports the *wrapping* attribute with possible values: "left" or "right".  This lets you wrap text next to the table of contents on a per instance basis.  Thanks to [Phil](http://dublue.com/plugins/toc/comment-page-1/#comment-331) for the suggestion.
    329 * Better internal numbering system to avoid repeated headings.  This means that for non-repeated headings, there is no trailing number in the anchor.
    330 * Consolidated information about shortcodes and their attributes into the help tab.
    331 * Fixed: repeated headings on the same level are no longer broken.  For users with international character sets, please report any strange garbage characters in your headings (eg a character ends up being a question mark, square symbol, or diamond).  Thanks to [Juozas](http://dublue.com/plugins/toc/comment-page-2/#comment-441) for the assistance.
    332 * Fixed: removed PHP notices on a verbosely configured PHP setup.
    333 * Fixed: suppress TOC frame output when heading count was less than the minimum required.
    334 * Note: when removing the last TOC+ widget, please make sure you disable the "Show the table of contents only in the sidebar" option otherwise your table of contents won't appear where you'd expect.  I will look to address this in the future.
    335 
    336 = 1109 =
    337 * Released: 12 September 2011
    338 * Adjusted hide action for a smoother transition.
    339 * Apply custom link and hover colours (when selected) to show/hide link in the title.
    340 * Renamed jquery.cookie.min.js to jquery.c.min.js to overcome false positive with [mod_security](https://www.modsecurity.org/tracker/browse/CORERULES-29).  Mod_security would block requests to this file which would break the ability to save a user's show/hide preference.  In some cases, it has also broken other javascript functionality.  Additionally, a better graceful non disruptive fallback is now in place to prevent possible repeat.  Thanks goes to Shonie for helping debug the issue.
    341 * Moved 'visibility option' into 'heading text'.
    342 * Fixed: restored smooth scroll effect for Internet Explorer since 1108.2 introduced 'pathname' checks.
    343 
    344 = 1108.2 =
    345 * Released: 26 August 2011
    346 * New: visibility option to show/hide the table of contents.  This option is enabled by default so if you don't want it, turn it off in the options.  Thanks to [Wafflecone](http://dublue.com/plugins/toc/#comment-123) and [Mike](http://dublue.com/plugins/toc/comment-page-1/#comment-160) for the suggestion.
    347 * New: transparent presentation option added.
    348 * New: custom presentation option with colour wheel for you to select your own background, border, title and link colours.
    349 * TOC display on homepage has been disabled by default as most configurations would not require it there.  If you want to enable it, you can do so under a new advanced admin option "Include homepage".
    350 * Make smooth scrolling less zealous with anchors and be more compatible with other plugins that may use # to initiate custom javascript actions.
    351 * Minor admin cross browser CSS enhancements like background gradients and indents.
    352 
    353 = 1108.1 =
    354 * Released: 3 August 2011
    355 * Anchor targets (eg anything after #) are now limited to ASCII characters as some mobile user agents do not accept internationalised characters.  This is also a recommendation in the [HTML spec](http://www.w3.org/TR/html4/struct/links.html#h-12.2.1).  A new advanced admin option has been added to specify the default prefix when no characters qualify.
    356 * Make TOC, Pages and Category labels compatible with UTF-8 characters.
    357 * Support ' " \ characters in labels as it was being escaped by WordPress before saving.
    358 
    359 = 1108 =
    360 * Released: 1 August 2011
    361 * New: option to hide the title on top of the table of contents.  Thanks to [Andrew](http://dublue.com/plugins/toc/#comment-82) for the suggestion.
    362 * New: option to preserve existing theme specified bullet images for unordered list elements.
    363 * New: option to set the width of the table of contents.  You can select from a number of common widths, or define your own.
    364 * Allow 3 to be set as the minimum number of headings for auto insertion.  The default stays at 4.
    365 * Now accepts heading 1s (h1) within the body of a post, page or custom post type.
    366 * Now creates new span tags for the target rather than the id of the heading.
    367 * Now uses the heading as the anchor target rather than toc_index.
    368 * Adjusted CSS styles for lists to be a little more consistent across themes (eg list-style, margins & paddings).
    369 * Fixed: typo 'heirarchy' should be 'hierarchy'.  Also thanks to Andrew.
    370 * Fixed: addressed an issue while saving on networked installs using sub directories.  Thanks to [Aubrey](http://dublue.com/plugins/toc/#comment-79).
    371 * Fixed: closing of the last list item when deeply nested.
    372 
    373 = 1107.1 =
    374 * Released: 10 July 2011
    375 * New: added `[toc]` shortcode to generate the table of contents at the preferred position.  Also useful for sites that only require a TOC on a small handful of pages.
    376 * New: smooth scroll effect added to animate to anchor rather than jump.  It's off by default.
    377 * New: appearance options to match your theme a little bit more.
    378 
    379 = 1107 =
    380 * Released: 1 July 2011
    381 * First world release (functional & feature packed)
    382 
    383 
    384259== Upgrade Notice ==
    385260
  • table-of-contents-plus/trunk/toc.php

    r3135199 r3188809  
    22/**
    33 * Plugin Name: Table of Contents Plus
    4  * Plugin URI : https://zedzedzed.github.io/docs/tocplus.html
     4 * Plugin URI : https://aioseo.com
    55 * Description: A powerful yet user friendly plugin that automatically creates a table of contents. Can also output a sitemap listing all pages and categories.
    6  * Author:      Michael Tran
    7  * Author URI:  https://zedzedzed.github.io/docs/tocplus.html
     6 * Author:      All in One SEO Team
     7 * Author URI:  https://aioseo.com
    88 * Text Domain: table-of-contents-plus
    99 * Domain Path: /languages
    10  * Version:     2408
     10 * Version:     2411
    1111 * License:     GPL2
    1212 */
     
    2424
    2525You should have received a copy of the GNU General Public License
    26 along with Table of Contents Plus. If not, see
    27 https://github.com/zedzedzed/table-of-contents-plus/blob/main/LICENSE.md
     26along with Table of Contents Plus.
    2827*/
    2928
Note: See TracChangeset for help on using the changeset viewer.