- Update and testing to the latest version

This commit is contained in:
happybooking 2018-01-06 15:30:11 +00:00
parent b3b022dbb6
commit 7413f540f3
2 changed files with 14 additions and 10 deletions

View File

@ -3,12 +3,12 @@
Plugin Name: Extended Table of Contents (with nextpage support) Plugin Name: Extended Table of Contents (with nextpage support)
Plugin URI: http://http://www.web-cloud-apps.com/produkte/wordpress-extended-toc/ Plugin URI: http://http://www.web-cloud-apps.com/produkte/wordpress-extended-toc/
Description: This plugin automatically generates and inserts a table of contents (ToC) to your pages and posts, based on tags h1-h6. Whenever the plugin discovers more than a certain amount of headings (default: 3) the ToC is inserted at the top of the page. This plugin also can handle posts that are divided into pages by the nextpage-wordpress-tag. Any feedback or suggestions are welcome. Description: This plugin automatically generates and inserts a table of contents (ToC) to your pages and posts, based on tags h1-h6. Whenever the plugin discovers more than a certain amount of headings (default: 3) the ToC is inserted at the top of the page. This plugin also can handle posts that are divided into pages by the nextpage-wordpress-tag. Any feedback or suggestions are welcome.
Version: 0.9.5 Version: 1.0.0
Author: Daniel Boldura, Web.Cloud.Apps. UG Author: Daniel Boldura, Web.Cloud.Apps. GmbH
Author URI: http://www.web-cloud-apps.com Author URI: http://www.web-cloud-apps.com
/* Copyright 2013 Web.Cloud.Apps. UG // Daniel Boldura (email: info at web-cloud-apps.com or daniel at boldura.de) /* Copyright 2013 Web.Cloud.Apps. GmbH // Daniel Boldura (email: info at web-cloud-apps.com or daniel at boldura.de)
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -25,7 +25,7 @@ Author URI: http://www.web-cloud-apps.com
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
define( 'EXTENDED_TOC_VERSION', '0.9.5' ); define( 'EXTENDED_TOC_VERSION', '1.0.0' );
define( 'EXTENDED_TOC_ID', 'extended_toc' ); define( 'EXTENDED_TOC_ID', 'extended_toc' );
define( 'EXTENDED_TOC_NAME', 'Extended-ToC' ); define( 'EXTENDED_TOC_NAME', 'Extended-ToC' );
define( 'TOC_MIN_START', 2 ); define( 'TOC_MIN_START', 2 );
@ -358,10 +358,11 @@ if( !class_exists('ExToC') ) {
} }
/** returns the content for display added by the ToC */ /** returns the content for display added by the ToC */
private function insert_toc_at_markup_position($toc_content) { private function insert_toc_at_markup_position($toc_content)
{
// clean content without markups for returning // clean content without markups for returning
$content = $this->content; $content = $this->content;
$content = preg_replace("/\[extoc\]|\[noextoc\]/", "", $content); $content = preg_replace("/\[noextoc\]/", "", $content); // preg_replace("/\[extoc\]|\[noextoc\]/", "", $content);
// [noextoc] has priority. If this is found, return the original // [noextoc] has priority. If this is found, return the original
if( strpos($this->content, '[noextoc]') !== false ) if( strpos($this->content, '[noextoc]') !== false )
@ -370,6 +371,7 @@ if( !class_exists('ExToC') ) {
// try to find the markup for the ToC // try to find the markup for the ToC
$pos = strpos($this->content, '[extoc]'); $pos = strpos($this->content, '[extoc]');
// we didn't find any markup...
if( $pos === false ) { if( $pos === false ) {
// There was no markup, so insert at top or return original if this type does not need a ToC // There was no markup, so insert at top or return original if this type does not need a ToC
if( !in_array(get_post_type($post), $this->options['auto_insert_post_types']) ) if( !in_array(get_post_type($post), $this->options['auto_insert_post_types']) )
@ -378,8 +380,10 @@ if( !class_exists('ExToC') ) {
return $toc_content . $content; return $toc_content . $content;
} }
if( is_numeric($pos) && $pos >= 0 ) { // In this case, the markup was found in the content
return substr($content, 0, $pos) . $toc_content . substr($content, $pos); if( is_numeric($pos) && $pos >= 0 )
{
return str_replace('[extoc]', $toc_content, $content); // substr($content, 0, $pos) . $toc_content . substr($content, $pos);
} }
// Absolute backup, return the content. This point should actually never be reached // Absolute backup, return the content. This point should actually never be reached

View File

@ -3,8 +3,8 @@ Contributors: happybooking
Donate link: http://www.happybooking.de/wordpress/plugins/extended-toc/donate Donate link: http://www.happybooking.de/wordpress/plugins/extended-toc/donate
Tags: table of contents, indexes, toc, sitemap, cms, options, list, page listing, category listing Tags: table of contents, indexes, toc, sitemap, cms, options, list, page listing, category listing
Requires at least: 3.0.1 Requires at least: 3.0.1
Tested up to: 3.6.1 Tested up to: 4.9.1
Stable tag: 0.9.5 Stable tag: 1.0.0
License: GPLv2 or later License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html License URI: http://www.gnu.org/licenses/gpl-2.0.html