Version Description
- Revert TinyMCE filter hook to 3.1.9 method due to continued Divi theme compatibility issues.
- Add configurable option to load TinyMCE filter in a different location to support SiteOrigin PageBuilder users.
- Fix missing JS on front-end ACF forms with WYSIWYG editors.
Download this release
Release Info
Developer | figureone |
Plugin | Insert Pages |
Version | 3.2.2 |
Comparing to | |
See all releases |
Code changes from version 3.2.1 to 3.2.2
- insert-pages.php +26 -14
- options.php +23 -0
- readme.txt +5 -0
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.
|
13 |
*/
|
14 |
|
15 |
/* Copyright 2011 Paul Ryan (email: prar@hawaii.edu)
|
@@ -61,7 +61,7 @@ if ( !class_exists( 'InsertPagesPlugin' ) ) {
|
|
61 |
function insertPages_admin_init() {
|
62 |
// Get options set in WordPress dashboard (Settings > Insert Pages).
|
63 |
$options = get_option( 'wpip_settings' );
|
64 |
-
if ( $options === FALSE || ! is_array( $options ) || ! array_key_exists( 'wpip_format', $options ) || ! array_key_exists( 'wpip_wrapper', $options ) || ! array_key_exists( 'wpip_insert_method', $options ) ) {
|
65 |
$options = wpip_set_defaults();
|
66 |
}
|
67 |
|
@@ -80,7 +80,7 @@ if ( !class_exists( 'InsertPagesPlugin' ) ) {
|
|
80 |
'save' => __( 'Insert Page', 'insert-pages' ),
|
81 |
'noTitle' => __( '(no title)', 'insert-pages' ),
|
82 |
'noMatchesFound' => __( 'No matches found.', 'insert-pages' ),
|
83 |
-
'l10n_print_after' => 'try{convertEntities(
|
84 |
'format' => $options['wpip_format'],
|
85 |
)
|
86 |
);
|
@@ -93,12 +93,14 @@ if ( !class_exists( 'InsertPagesPlugin' ) ) {
|
|
93 |
'20151230'
|
94 |
);
|
95 |
|
96 |
-
// Register TinyMCE plugin for the toolbar button
|
97 |
-
//
|
98 |
-
//
|
99 |
// Ref: https://wordpress.org/support/topic/button-in-the-toolbar-of-tinymce-disappear-conflict-page-builder/
|
100 |
-
|
101 |
-
|
|
|
|
|
102 |
|
103 |
load_plugin_textdomain(
|
104 |
'insert-pages',
|
@@ -136,7 +138,7 @@ if ( !class_exists( 'InsertPagesPlugin' ) ) {
|
|
136 |
|
137 |
// Get options set in WordPress dashboard (Settings > Insert Pages).
|
138 |
$options = get_option( 'wpip_settings' );
|
139 |
-
if ( $options === FALSE || ! is_array( $options ) || ! array_key_exists( 'wpip_format', $options ) || ! array_key_exists( 'wpip_wrapper', $options ) || ! array_key_exists( 'wpip_insert_method', $options ) ) {
|
140 |
$options = wpip_set_defaults();
|
141 |
}
|
142 |
|
@@ -795,8 +797,17 @@ if ( class_exists( 'InsertPagesPlugin' ) ) {
|
|
795 |
|
796 |
// Actions and Filters handled by InsertPagesPlugin class
|
797 |
if ( isset( $insertPages_plugin ) ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
798 |
// Register shortcode [insert ...].
|
799 |
add_action( 'init', array( $insertPages_plugin, 'insertPages_init' ), 1 );
|
|
|
|
|
|
|
800 |
|
801 |
// Add TinyMCE button for shortcode.
|
802 |
add_action( 'admin_head', array( $insertPages_plugin, 'insertPages_admin_init' ), 1 );
|
@@ -813,12 +824,13 @@ if ( isset( $insertPages_plugin ) ) {
|
|
813 |
// Use internal filter to wrap inserted content in a div or span.
|
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 |
-
//
|
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 |
-
|
821 |
-
|
|
|
|
|
822 |
|
823 |
// Register Insert Pages shortcode widget.
|
824 |
require_once( dirname( __FILE__ ) . '/widget.php' );
|
9 |
Text Domain: insert-pages
|
10 |
Domain Path: /languages
|
11 |
License: GPL2
|
12 |
+
Version: 3.2.2
|
13 |
*/
|
14 |
|
15 |
/* Copyright 2011 Paul Ryan (email: prar@hawaii.edu)
|
61 |
function insertPages_admin_init() {
|
62 |
// Get options set in WordPress dashboard (Settings > Insert Pages).
|
63 |
$options = get_option( 'wpip_settings' );
|
64 |
+
if ( $options === FALSE || ! is_array( $options ) || ! array_key_exists( 'wpip_format', $options ) || ! array_key_exists( 'wpip_wrapper', $options ) || ! array_key_exists( 'wpip_insert_method', $options ) || ! array_key_exists( 'wpip_tinymce_filter', $options ) ) {
|
65 |
$options = wpip_set_defaults();
|
66 |
}
|
67 |
|
80 |
'save' => __( 'Insert Page', 'insert-pages' ),
|
81 |
'noTitle' => __( '(no title)', 'insert-pages' ),
|
82 |
'noMatchesFound' => __( 'No matches found.', 'insert-pages' ),
|
83 |
+
'l10n_print_after' => 'try{convertEntities(wpInsertPagesL10n);}catch(e){};',
|
84 |
'format' => $options['wpip_format'],
|
85 |
)
|
86 |
);
|
93 |
'20151230'
|
94 |
);
|
95 |
|
96 |
+
// Register TinyMCE plugin for the toolbar button if in normal mode
|
97 |
+
// (register TinyMCE plugin filters below before plugins_loaded
|
98 |
+
// if in compatibility mode, 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 |
+
if ( $options['wpip_tinymce_filter'] === 'normal' ) {
|
101 |
+
add_filter( 'mce_external_plugins', array( $this, 'insertPages_handleFilter_mceExternalPlugins' ) );
|
102 |
+
add_filter( 'mce_buttons', array( $this, 'insertPages_handleFilter_mceButtons' ) );
|
103 |
+
}
|
104 |
|
105 |
load_plugin_textdomain(
|
106 |
'insert-pages',
|
138 |
|
139 |
// Get options set in WordPress dashboard (Settings > Insert Pages).
|
140 |
$options = get_option( 'wpip_settings' );
|
141 |
+
if ( $options === FALSE || ! is_array( $options ) || ! array_key_exists( 'wpip_format', $options ) || ! array_key_exists( 'wpip_wrapper', $options ) || ! array_key_exists( 'wpip_insert_method', $options ) || ! array_key_exists( 'wpip_tinymce_filter', $options ) ) {
|
142 |
$options = wpip_set_defaults();
|
143 |
}
|
144 |
|
797 |
|
798 |
// Actions and Filters handled by InsertPagesPlugin class
|
799 |
if ( isset( $insertPages_plugin ) ) {
|
800 |
+
// Get options set in WordPress dashboard (Settings > Insert Pages).
|
801 |
+
$options = get_option( 'wpip_settings' );
|
802 |
+
if ( $options === FALSE || ! is_array( $options ) || ! array_key_exists( 'wpip_format', $options ) || ! array_key_exists( 'wpip_wrapper', $options ) || ! array_key_exists( 'wpip_insert_method', $options ) || ! array_key_exists( 'wpip_tinymce_filter', $options ) ) {
|
803 |
+
$options = wpip_set_defaults();
|
804 |
+
}
|
805 |
+
|
806 |
// Register shortcode [insert ...].
|
807 |
add_action( 'init', array( $insertPages_plugin, 'insertPages_init' ), 1 );
|
808 |
+
// Register shortcode [insert ...] when TinyMCE is included in a frontend ACF form.
|
809 |
+
add_action( 'acf_head-input', array( $insertPages_plugin, 'insertPages_init' ), 1 ); // ACF 3
|
810 |
+
add_action( 'acf/input/admin_head', array( $insertPages_plugin, 'insertPages_init' ), 1 ); // ACF 4
|
811 |
|
812 |
// Add TinyMCE button for shortcode.
|
813 |
add_action( 'admin_head', array( $insertPages_plugin, 'insertPages_admin_init' ), 1 );
|
824 |
// Use internal filter to wrap inserted content in a div or span.
|
825 |
add_filter( 'insert_pages_wrap_content', array( $insertPages_plugin, 'insertPages_wrap_content' ), 10, 3 );
|
826 |
|
827 |
+
// Register TinyMCE plugin for the toolbar button if in compatibility mode.
|
828 |
+
// (to work around a SiteOrigin PageBuilder bug).
|
|
|
829 |
// Ref: https://wordpress.org/support/topic/button-in-the-toolbar-of-tinymce-disappear-conflict-page-builder/
|
830 |
+
if ( $options['wpip_tinymce_filter'] === 'compatibility' ) {
|
831 |
+
add_filter( 'mce_external_plugins', array( $insertPages_plugin, 'insertPages_handleFilter_mceExternalPlugins' ) );
|
832 |
+
add_filter( 'mce_buttons', array( $insertPages_plugin, 'insertPages_handleFilter_mceButtons' ) );
|
833 |
+
}
|
834 |
|
835 |
// Register Insert Pages shortcode widget.
|
836 |
require_once( dirname( __FILE__ ) . '/widget.php' );
|
options.php
CHANGED
@@ -35,6 +35,13 @@ function wpip_settings_init() {
|
|
35 |
'wpipSettings',
|
36 |
'wpip_section'
|
37 |
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
}
|
39 |
add_action( 'admin_init', 'wpip_settings_init' );
|
40 |
|
@@ -57,6 +64,10 @@ function wpip_set_defaults() {
|
|
57 |
$options['wpip_insert_method'] = 'legacy';
|
58 |
}
|
59 |
|
|
|
|
|
|
|
|
|
60 |
update_option( 'wpip_settings', $options );
|
61 |
|
62 |
return $options;
|
@@ -118,3 +129,15 @@ function wpip_insert_method_render() {
|
|
118 |
<small><em>The legacy method uses <a href="https://codex.wordpress.org/Function_Reference/query_posts" target="_blank">query_posts()</a>, which the Codex cautions against using. However, to recreate the exact state that many page builder plugins are expecting, the Main Loop has to be replaced with the inserted page while it is being rendered. The normal method, on the other hand, just uses <a href="https://developer.wordpress.org/reference/functions/get_post/" target="_blank">get_post()</a>.</em></small>
|
119 |
<?php
|
120 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
'wpipSettings',
|
36 |
'wpip_section'
|
37 |
);
|
38 |
+
add_settings_field(
|
39 |
+
'wpip_tinymce_filter',
|
40 |
+
__( 'TinyMCE filter', 'insert-pages' ),
|
41 |
+
'wpip_tinymce_filter_render',
|
42 |
+
'wpipSettings',
|
43 |
+
'wpip_section'
|
44 |
+
);
|
45 |
}
|
46 |
add_action( 'admin_init', 'wpip_settings_init' );
|
47 |
|
64 |
$options['wpip_insert_method'] = 'legacy';
|
65 |
}
|
66 |
|
67 |
+
if ( ! array_key_exists( 'wpip_tinymce_filter', $options ) ) {
|
68 |
+
$options['wpip_tinymce_filter'] = 'normal';
|
69 |
+
}
|
70 |
+
|
71 |
update_option( 'wpip_settings', $options );
|
72 |
|
73 |
return $options;
|
129 |
<small><em>The legacy method uses <a href="https://codex.wordpress.org/Function_Reference/query_posts" target="_blank">query_posts()</a>, which the Codex cautions against using. However, to recreate the exact state that many page builder plugins are expecting, the Main Loop has to be replaced with the inserted page while it is being rendered. The normal method, on the other hand, just uses <a href="https://developer.wordpress.org/reference/functions/get_post/" target="_blank">get_post()</a>.</em></small>
|
130 |
<?php
|
131 |
}
|
132 |
+
|
133 |
+
function wpip_tinymce_filter_render() {
|
134 |
+
$options = get_option( 'wpip_settings' );
|
135 |
+
if ( $options === FALSE || ! is_array( $options ) || ! array_key_exists( 'wpip_tinymce_filter', $options ) ) {
|
136 |
+
$options = wpip_set_defaults();
|
137 |
+
}
|
138 |
+
?>
|
139 |
+
<input type='radio' name='wpip_settings[wpip_tinymce_filter]' <?php checked( $options['wpip_tinymce_filter'], 'normal' ); ?> id="wpip_tinymce_filter_normal" value='normal'><label for="wpip_tinymce_filter_normal">Use normal method (compatible with Divi theme and most situations). </label><br />
|
140 |
+
<input type='radio' name='wpip_settings[wpip_tinymce_filter]' <?php checked( $options['wpip_tinymce_filter'], 'compatibility' ); ?> id="wpip_tinymce_filter_compatibility" value='compatibility'><label for="wpip_tinymce_filter_normal">Use compatibility method (works with <a href="https://wordpress.org/plugins/siteorigin-panels/" target="_blank">Page Builder by SiteOrigin</a>).</label><br />
|
141 |
+
<small><em>The normal method adds the TinyMCE plugin filters in the <a href="https://developer.wordpress.org/reference/hooks/admin_head/" target="_blank">admin_head</a> hook. For users using SiteOrigin PageBuilder with the so-widgets-bundle enabled and using Contact Form, Editor, Google Maps, Hero Image, or Testimonials widgets, a bug in that plugin prevents other plugins from registering TinyMCE plugins. Use compatibility mode here to use a workaround.</em></small>
|
142 |
+
<?php
|
143 |
+
}
|
readme.txt
CHANGED
@@ -86,6 +86,11 @@ Just one! The plugin prevents you from embedding a page in itself, but you can t
|
|
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 |
|
86 |
|
87 |
== Changelog ==
|
88 |
|
89 |
+
= 3.2.2 =
|
90 |
+
* Revert TinyMCE filter hook to 3.1.9 method due to continued Divi theme compatibility issues.
|
91 |
+
* Add configurable option to load TinyMCE filter in a different location to support SiteOrigin PageBuilder users.
|
92 |
+
* Fix missing JS on front-end ACF forms with WYSIWYG editors.
|
93 |
+
|
94 |
= 3.2.1 =
|
95 |
* 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.
|
96 |
|