Insert Pages - Version 3.2.1

Version Description

  • Revert TinyMCE filter move for SiteOrigin PageBuilder since it breaks compatibility with Divi theme. Instead, hook into the filter multiple times, and make sure the Insert Pages button is registered each time. Props @trevorp for the report.
Download this release

Release Info

Developer figureone
Plugin Icon wp plugin Insert Pages
Version 3.2.1
Comparing to
See all releases

Code changes from version 3.2.0 to 3.2.1

Files changed (2) hide show
  1. insert-pages.php +17 -3
  2. readme.txt +4 -1
insert-pages.php CHANGED
@@ -9,7 +9,7 @@ Author URI: http://www.linkedin.com/in/paulrryan
9
  Text Domain: insert-pages
10
  Domain Path: /languages
11
  License: GPL2
12
- Version: 3.2.0
13
  */
14
 
15
  /* Copyright 2011 Paul Ryan (email: prar@hawaii.edu)
@@ -93,6 +93,13 @@ if ( !class_exists( 'InsertPagesPlugin' ) ) {
93
  '20151230'
94
  );
95
 
 
 
 
 
 
 
 
96
  load_plugin_textdomain(
97
  'insert-pages',
98
  false,
@@ -483,13 +490,17 @@ if ( !class_exists( 'InsertPagesPlugin' ) ) {
483
 
484
  // Filter hook: Add a button to the TinyMCE toolbar for our insert page tool
485
  function insertPages_handleFilter_mceButtons( $buttons ) {
486
- array_push( $buttons, 'wpInsertPages_button' ); // add a separator and button to toolbar
 
 
487
  return $buttons;
488
  }
489
 
490
  // Filter hook: Load the javascript for our custom toolbar button
491
  function insertPages_handleFilter_mceExternalPlugins( $plugins ) {
492
- $plugins['wpInsertPages'] = plugins_url( '/js/wpinsertpages_plugin.js', __FILE__ );
 
 
493
  return $plugins;
494
  }
495
 
@@ -803,6 +814,9 @@ if ( isset( $insertPages_plugin ) ) {
803
  add_filter( 'insert_pages_wrap_content', array( $insertPages_plugin, 'insertPages_wrap_content' ), 10, 3 );
804
 
805
  // Register TinyMCE plugin for the toolbar button.
 
 
 
806
  add_filter( 'mce_external_plugins', array( $insertPages_plugin, 'insertPages_handleFilter_mceExternalPlugins' ) );
807
  add_filter( 'mce_buttons', array( $insertPages_plugin, 'insertPages_handleFilter_mceButtons' ) );
808
 
9
  Text Domain: insert-pages
10
  Domain Path: /languages
11
  License: GPL2
12
+ Version: 3.2.1
13
  */
14
 
15
  /* Copyright 2011 Paul Ryan (email: prar@hawaii.edu)
93
  '20151230'
94
  );
95
 
96
+ // Register TinyMCE plugin for the toolbar button.
97
+ // Note: Also register TinyMCE plugin filters below before plugins_loaded
98
+ // is done (to work around a SiteOrigin PageBuilder bug).
99
+ // Ref: https://wordpress.org/support/topic/button-in-the-toolbar-of-tinymce-disappear-conflict-page-builder/
100
+ add_filter( 'mce_external_plugins', array( $this, 'insertPages_handleFilter_mceExternalPlugins' ) );
101
+ add_filter( 'mce_buttons', array( $this, 'insertPages_handleFilter_mceButtons' ) );
102
+
103
  load_plugin_textdomain(
104
  'insert-pages',
105
  false,
490
 
491
  // Filter hook: Add a button to the TinyMCE toolbar for our insert page tool
492
  function insertPages_handleFilter_mceButtons( $buttons ) {
493
+ if ( ! in_array( 'wpInsertPages_button', $buttons ) ) {
494
+ array_push( $buttons, 'wpInsertPages_button' );
495
+ }
496
  return $buttons;
497
  }
498
 
499
  // Filter hook: Load the javascript for our custom toolbar button
500
  function insertPages_handleFilter_mceExternalPlugins( $plugins ) {
501
+ if ( ! array_key_exists( 'wpInsertPages', $plugins ) ) {
502
+ $plugins['wpInsertPages'] = plugins_url( '/js/wpinsertpages_plugin.js', __FILE__ );
503
+ }
504
  return $plugins;
505
  }
506
 
814
  add_filter( 'insert_pages_wrap_content', array( $insertPages_plugin, 'insertPages_wrap_content' ), 10, 3 );
815
 
816
  // Register TinyMCE plugin for the toolbar button.
817
+ // Note: Also register TinyMCE plugin filters here before plugins_loaded
818
+ // is done (to work around a SiteOrigin PageBuilder bug).
819
+ // Ref: https://wordpress.org/support/topic/button-in-the-toolbar-of-tinymce-disappear-conflict-page-builder/
820
  add_filter( 'mce_external_plugins', array( $insertPages_plugin, 'insertPages_handleFilter_mceExternalPlugins' ) );
821
  add_filter( 'mce_buttons', array( $insertPages_plugin, 'insertPages_handleFilter_mceButtons' ) );
822
 
readme.txt CHANGED
@@ -2,7 +2,7 @@
2
  Contributors: figureone, the_magician
3
  Tags: insert, pages, shortcode, embed
4
  Requires at least: 3.0.1
5
- Tested up to: 4.6.2
6
  Stable tag: trunk
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -86,6 +86,9 @@ Just one! The plugin prevents you from embedding a page in itself, but you can t
86
 
87
  == Changelog ==
88
 
 
 
 
89
  = 3.2.0 =
90
  * Fix for toolbar button disappearing when the SiteOrigin PageBuilder Widgets Bundle plugin is enabled. Props @JarkkoLaine for figuring that one out! Ref: https://wordpress.org/support/topic/button-in-the-toolbar-of-tinymce-disappear-conflict-page-builder/
91
 
2
  Contributors: figureone, the_magician
3
  Tags: insert, pages, shortcode, embed
4
  Requires at least: 3.0.1
5
+ Tested up to: 4.7.4
6
  Stable tag: trunk
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
86
 
87
  == Changelog ==
88
 
89
+ = 3.2.1 =
90
+ * Revert TinyMCE filter move for SiteOrigin PageBuilder since it breaks compatibility with Divi theme. Instead, hook into the filter multiple times, and make sure the Insert Pages button is registered each time. Props @trevorp for the report.
91
+
92
  = 3.2.0 =
93
  * Fix for toolbar button disappearing when the SiteOrigin PageBuilder Widgets Bundle plugin is enabled. Props @JarkkoLaine for figuring that one out! Ref: https://wordpress.org/support/topic/button-in-the-toolbar-of-tinymce-disappear-conflict-page-builder/
94