- Update and testing to the latest version
This commit is contained in:
parent
b3b022dbb6
commit
7413f540f3
|
@ -3,12 +3,12 @@
|
|||
Plugin Name: Extended Table of Contents (with nextpage support)
|
||||
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.
|
||||
Version: 0.9.5
|
||||
Author: Daniel Boldura, Web.Cloud.Apps. UG
|
||||
Version: 1.0.0
|
||||
Author: Daniel Boldura, Web.Cloud.Apps. GmbH
|
||||
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
|
||||
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
|
||||
*/
|
||||
|
||||
define( 'EXTENDED_TOC_VERSION', '0.9.5' );
|
||||
define( 'EXTENDED_TOC_VERSION', '1.0.0' );
|
||||
define( 'EXTENDED_TOC_ID', 'extended_toc' );
|
||||
define( 'EXTENDED_TOC_NAME', 'Extended-ToC' );
|
||||
define( 'TOC_MIN_START', 2 );
|
||||
|
@ -358,10 +358,11 @@ if( !class_exists('ExToC') ) {
|
|||
}
|
||||
|
||||
/** 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
|
||||
$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
|
||||
if( strpos($this->content, '[noextoc]') !== false )
|
||||
|
@ -370,6 +371,7 @@ if( !class_exists('ExToC') ) {
|
|||
// try to find the markup for the ToC
|
||||
$pos = strpos($this->content, '[extoc]');
|
||||
|
||||
// we didn't find any markup...
|
||||
if( $pos === false ) {
|
||||
// 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']) )
|
||||
|
@ -378,8 +380,10 @@ if( !class_exists('ExToC') ) {
|
|||
return $toc_content . $content;
|
||||
}
|
||||
|
||||
if( is_numeric($pos) && $pos >= 0 ) {
|
||||
return substr($content, 0, $pos) . $toc_content . substr($content, $pos);
|
||||
// In this case, the markup was found in the content
|
||||
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
|
||||
|
|
|
@ -3,8 +3,8 @@ Contributors: happybooking
|
|||
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
|
||||
Requires at least: 3.0.1
|
||||
Tested up to: 3.6.1
|
||||
Stable tag: 0.9.5
|
||||
Tested up to: 4.9.1
|
||||
Stable tag: 1.0.0
|
||||
License: GPLv2 or later
|
||||
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
||||
|
||||
|
|
Loading…
Reference in New Issue