Version Description
- Fix Gutenberg block assets (js, css) loading on front end.
- Add option to disable Insert Pages Gutenberg block.
Download this release
Release Info
Developer | figureone |
Plugin | Insert Pages |
Version | 3.5.1 |
Comparing to | |
See all releases |
Code changes from version 3.5.0 to 3.5.1
- insert-pages.php +27 -19
- options.php +28 -1
- readme.txt +4 -0
insert-pages.php
CHANGED
@@ -7,7 +7,7 @@
|
|
7 |
* Text Domain: insert-pages
|
8 |
* Domain Path: /languages
|
9 |
* License: GPL2
|
10 |
-
* Version: 3.5.
|
11 |
*
|
12 |
* @package insert-pages
|
13 |
*/
|
@@ -84,11 +84,13 @@ if ( ! class_exists( 'InsertPagesPlugin' ) ) {
|
|
84 |
* @return void
|
85 |
*/
|
86 |
public function insert_pages_init() {
|
|
|
|
|
87 |
// Register the [insert] shortcode.
|
88 |
add_shortcode( 'insert', array( $this, 'insert_pages_handle_shortcode_insert' ) );
|
89 |
|
90 |
// Register the gutenberg block so we can populate it via server side rendering.
|
91 |
-
if ( function_exists( 'register_block_type' ) ) {
|
92 |
register_block_type(
|
93 |
'insert-pages/block',
|
94 |
array(
|
@@ -171,25 +173,31 @@ if ( ! class_exists( 'InsertPagesPlugin' ) ) {
|
|
171 |
|
172 |
|
173 |
/**
|
174 |
-
*
|
|
|
|
|
|
|
175 |
*
|
176 |
* @return void
|
177 |
*/
|
178 |
-
public function
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
|
|
|
|
|
|
193 |
}
|
194 |
|
195 |
|
@@ -1410,5 +1418,5 @@ if ( isset( $insert_pages_plugin ) ) {
|
|
1410 |
add_action( 'widgets_init', array( $insert_pages_plugin, 'insert_pages_widgets_init' ) );
|
1411 |
|
1412 |
// Register Gutenberg block.
|
1413 |
-
add_action( '
|
1414 |
}
|
7 |
* Text Domain: insert-pages
|
8 |
* Domain Path: /languages
|
9 |
* License: GPL2
|
10 |
+
* Version: 3.5.1
|
11 |
*
|
12 |
* @package insert-pages
|
13 |
*/
|
84 |
* @return void
|
85 |
*/
|
86 |
public function insert_pages_init() {
|
87 |
+
$options = get_option( 'wpip_settings' );
|
88 |
+
|
89 |
// Register the [insert] shortcode.
|
90 |
add_shortcode( 'insert', array( $this, 'insert_pages_handle_shortcode_insert' ) );
|
91 |
|
92 |
// Register the gutenberg block so we can populate it via server side rendering.
|
93 |
+
if ( function_exists( 'register_block_type' ) && isset( $options['wpip_gutenberg_block'] ) && 'enabled' === $options['wpip_gutenberg_block'] ) {
|
94 |
register_block_type(
|
95 |
'insert-pages/block',
|
96 |
array(
|
173 |
|
174 |
|
175 |
/**
|
176 |
+
* Load gutenberg block resources only when editing (only if Gutenberg block
|
177 |
+
* setting is enabled in Insert Pages settings).
|
178 |
+
*
|
179 |
+
* Action hook: enqueue_block_editor_assets
|
180 |
*
|
181 |
* @return void
|
182 |
*/
|
183 |
+
public function insert_pages_enqueue_block_editor_assets() {
|
184 |
+
$options = get_option( 'wpip_settings' );
|
185 |
+
if ( isset( $options['wpip_gutenberg_block'] ) && 'enabled' === $options['wpip_gutenberg_block'] ) {
|
186 |
+
// Load the gutenberg block.
|
187 |
+
wp_enqueue_script(
|
188 |
+
'insert-pages-gutenberg-block',
|
189 |
+
plugins_url( 'lib/gutenberg-block/dist/block.js', __FILE__ ),
|
190 |
+
array( 'wp-i18n', 'wp-blocks', 'wp-editor', 'wp-components', 'wp-compose' ),
|
191 |
+
'20190613',
|
192 |
+
false
|
193 |
+
);
|
194 |
+
wp_enqueue_style(
|
195 |
+
'insert-pages-gutenberg-block',
|
196 |
+
plugins_url( 'lib/gutenberg-block/dist/block.css', __FILE__ ),
|
197 |
+
array(),
|
198 |
+
'20190613'
|
199 |
+
);
|
200 |
+
}
|
201 |
}
|
202 |
|
203 |
|
1418 |
add_action( 'widgets_init', array( $insert_pages_plugin, 'insert_pages_widgets_init' ) );
|
1419 |
|
1420 |
// Register Gutenberg block.
|
1421 |
+
add_action( 'enqueue_block_editor_assets', array( $insert_pages_plugin, 'insert_pages_enqueue_block_editor_assets' ) );
|
1422 |
}
|
options.php
CHANGED
@@ -56,6 +56,13 @@ function wpip_settings_init() {
|
|
56 |
'wpipSettings',
|
57 |
'wpip_section'
|
58 |
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
59 |
}
|
60 |
add_action( 'admin_init', 'wpip_settings_init' );
|
61 |
|
@@ -93,6 +100,10 @@ function wpip_set_defaults() {
|
|
93 |
$options['wpip_tinymce_filter'] = 'normal';
|
94 |
}
|
95 |
|
|
|
|
|
|
|
|
|
96 |
update_option( 'wpip_settings', $options );
|
97 |
|
98 |
return $options;
|
@@ -188,7 +199,23 @@ function wpip_tinymce_filter_render() {
|
|
188 |
}
|
189 |
?>
|
190 |
<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 />
|
191 |
-
<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="
|
192 |
<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>
|
193 |
<?php
|
194 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
56 |
'wpipSettings',
|
57 |
'wpip_section'
|
58 |
);
|
59 |
+
add_settings_field(
|
60 |
+
'wpip_gutenberg_block',
|
61 |
+
__( 'Gutenberg block', 'insert-pages' ),
|
62 |
+
'wpip_gutenberg_block_render',
|
63 |
+
'wpipSettings',
|
64 |
+
'wpip_section'
|
65 |
+
);
|
66 |
}
|
67 |
add_action( 'admin_init', 'wpip_settings_init' );
|
68 |
|
100 |
$options['wpip_tinymce_filter'] = 'normal';
|
101 |
}
|
102 |
|
103 |
+
if ( ! array_key_exists( 'wpip_gutenberg_block', $options ) ) {
|
104 |
+
$options['wpip_gutenberg_block'] = 'enabled';
|
105 |
+
}
|
106 |
+
|
107 |
update_option( 'wpip_settings', $options );
|
108 |
|
109 |
return $options;
|
199 |
}
|
200 |
?>
|
201 |
<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 />
|
202 |
+
<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_compatibility">Use compatibility method (works with <a href="https://wordpress.org/plugins/siteorigin-panels/" target="_blank">Page Builder by SiteOrigin</a>).</label><br />
|
203 |
<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>
|
204 |
<?php
|
205 |
}
|
206 |
+
|
207 |
+
/**
|
208 |
+
* Print 'Gutenberg block' setting.
|
209 |
+
*
|
210 |
+
* @return void
|
211 |
+
*/
|
212 |
+
function wpip_gutenberg_block_render() {
|
213 |
+
$options = get_option( 'wpip_settings' );
|
214 |
+
if ( false === $options || ! is_array( $options ) || ! array_key_exists( 'wpip_gutenberg_block', $options ) ) {
|
215 |
+
$options = wpip_set_defaults();
|
216 |
+
}
|
217 |
+
?>
|
218 |
+
<input type='radio' name='wpip_settings[wpip_gutenberg_block]' <?php checked( $options['wpip_gutenberg_block'], 'enabled' ); ?> id="wpip_gutenberg_block_enabled" value='enabled'><label for="wpip_gutenberg_block_enabled">Enable Insert Pages Gutenberg block.</label><br />
|
219 |
+
<input type='radio' name='wpip_settings[wpip_gutenberg_block]' <?php checked( $options['wpip_gutenberg_block'], 'disabled' ); ?> id="wpip_gutenberg_block_disabled" value='disabled'><label for="wpip_gutenberg_block_disabled">Disable Insert Pages Gutenberg block.</label>
|
220 |
+
<?php
|
221 |
+
}
|
readme.txt
CHANGED
@@ -86,6 +86,10 @@ Just one! The plugin prevents you from embedding a page in itself, but you can t
|
|
86 |
|
87 |
== Changelog ==
|
88 |
|
|
|
|
|
|
|
|
|
89 |
= 3.5.0 =
|
90 |
* Add Gutenberg block.
|
91 |
* Fix for [WSOD](https://wordpress.org/support/topic/app-v3-4-7-not-compatible-with-wp-v4-9-6) in WordPress versions before 5.0 (unintentionally included Gutenberg block in last release).
|
86 |
|
87 |
== Changelog ==
|
88 |
|
89 |
+
= 3.5.1 =
|
90 |
+
* Fix Gutenberg block assets (js, css) loading on front end.
|
91 |
+
* Add option to disable Insert Pages Gutenberg block.
|
92 |
+
|
93 |
= 3.5.0 =
|
94 |
* Add Gutenberg block.
|
95 |
* Fix for [WSOD](https://wordpress.org/support/topic/app-v3-4-7-not-compatible-with-wp-v4-9-6) in WordPress versions before 5.0 (unintentionally included Gutenberg block in last release).
|