PluginProbe
Block Animations, Motion & Scroll Effects – Ghost Kit / 3.7.2
Block Animations, Motion & Scroll Effects – Ghost Kit v3.7.2
3.7.2 3.7.1 3.7.0 3.6.1 trunk 1.6.3 2.25.0 3.3.0 3.3.1 3.3.2 3.3.3 3.4.0 3.4.1 3.4.2 3.4.3 3.4.4 3.4.5 3.4.6 3.5.0 3.5.1 3.6.0
← All changes | class-ghost-kit.php +72 -7 3.4.63.7.2 View file →
@@ -1,9 +1,9 @@
1 1 <?php
2 2 /**
3 3 * Plugin Name: Ghost Kit
4 - * Description: Page Builder Blocks and Extensions for Gutenberg
5 - * Version: 3.4.6
4 + * Description: Animate WordPress blocks with reveal, scroll, mouse and loop effects.
5 + * Version: 3.7.2
6 6 * Plugin URI: https://www.ghostkit.io/?utm_source=wordpress.org&utm_medium=readme&utm_campaign=byline
7 7 * Author: Ghost Kit Team
8 8 * Author URI: https://www.ghostkit.io/?utm_source=wordpress.org&utm_medium=readme&utm_campaign=byline
9 9 * License: GPLv2 or later
@@ -16,10 +16,45 @@
16 16 if ( ! defined( 'ABSPATH' ) ) {
17 17 exit;
18 18 }
19 19
20 +/*
21 + * Ghost Kit Pro carries its own copy of this core, so only one of the two may run.
22 + * Which copy PHP reaches first depends on the order WordPress includes plugins in,
23 + * and that order is not ours to pick: network-activated plugins come before
24 + * site-activated ones, and a third party can reorder `active_plugins`. So the
25 + * standalone plugin steps aside on its own whenever the Pro plugin is active,
26 + * before it defines anything at all.
27 + *
28 + * Only the activated plugin steps aside. The copy inside the Pro plugin, and any
29 + * copy embedded in a theme or another plugin, is not in the list below and keeps
30 + * loading as before.
31 + */
32 +$gkt_active_plugins = (array) get_option( 'active_plugins', array() );
33 +
34 +if ( is_multisite() ) {
35 + $gkt_active_plugins = array_merge(
36 + $gkt_active_plugins,
37 + array_keys( (array) get_site_option( 'active_sitewide_plugins', array() ) )
38 + );
39 +}
40 +
41 +if (
42 + in_array( plugin_basename( __FILE__ ), $gkt_active_plugins, true ) &&
43 + in_array( 'ghostkit-pro/class-ghost-kit-pro.php', $gkt_active_plugins, true ) &&
44 + // `active_plugins` goes on naming a plugin whose directory was removed by hand
45 + // and WordPress simply skips it, so stepping aside for one of those would leave
46 + // the site with neither plugin.
47 + file_exists( WP_PLUGIN_DIR . '/ghostkit-pro/class-ghost-kit-pro.php' )
48 +) {
49 + unset( $gkt_active_plugins );
50 + return;
51 +}
52 +
53 +unset( $gkt_active_plugins );
54 +
20 55 if ( ! defined( 'GHOSTKIT_VERSION' ) ) {
21 - define( 'GHOSTKIT_VERSION', '3.4.6' );
56 + define( 'GHOSTKIT_VERSION', '3.7.2' );
22 57 }
23 58
24 59 if ( ! class_exists( 'GhostKit' ) ) :
25 60 /**
@@ -107,8 +142,9 @@
107 142 require_once $this->plugin_path . 'gutenberg/index.php';
108 143
109 144 require_once $this->plugin_path . 'classes/class-rest.php';
110 145 require_once $this->plugin_path . 'classes/class-parse-blocks.php';
146 + require_once $this->plugin_path . 'classes/class-assets-detector.php';
111 147 require_once $this->plugin_path . 'classes/class-assets.php';
112 148 require_once $this->plugin_path . 'classes/class-reusable-widget.php';
113 149 require_once $this->plugin_path . 'classes/class-icons.php';
114 150 require_once $this->plugin_path . 'classes/class-shapes.php';
@@ -114,11 +150,8 @@
114 150 require_once $this->plugin_path . 'classes/class-shapes.php';
115 151 require_once $this->plugin_path . 'classes/class-typography.php';
116 152 require_once $this->plugin_path . 'classes/class-fonts.php';
117 153 require_once $this->plugin_path . 'classes/class-templates.php';
118 - require_once $this->plugin_path . 'classes/class-scss-replace-modules.php';
119 - require_once $this->plugin_path . 'classes/class-scss-compiler.php';
120 - require_once $this->plugin_path . 'classes/class-breakpoints-background.php';
121 154 require_once $this->plugin_path . 'classes/class-breakpoints.php';
122 155 require_once $this->plugin_path . 'classes/class-ask-review.php';
123 156 require_once $this->plugin_path . 'classes/class-deactivate-duplicate-plugin.php';
124 157
@@ -249,8 +282,26 @@
249 282 $css_deps[] = 'gist-simple';
250 283 $js_deps[] = 'gist-simple';
251 284 }
252 285
286 + // In block metadata, many Ghost Kit blocks declare `style: ["ghostkit", ...]`.
287 + // Because of this, WordPress auto-enqueues the `ghostkit` style handle for those blocks
288 + // in every context where blocks are rendered, including the editor.
289 + //
290 + // `ghostkit` is our frontend stylesheet (`build/gutenberg/style.css`), while editor UI
291 + // is styled by `ghostkit-editor` (`build/gutenberg/editor.css`). Loading both in editor
292 + // causes conflicts (for example, frontend Display extension rules can hide editor blocks).
293 + //
294 + // To keep block dependency chains intact without editing all block.json files, we override
295 + // only the `ghostkit` handle in admin and make it an alias that depends on `ghostkit-editor`.
296 + // Result:
297 + // - frontend keeps using real `ghostkit` styles;
298 + // - editor resolves `ghostkit` dependencies to editor styles, avoiding CSS conflicts.
299 + if ( wp_style_is( 'ghostkit', 'registered' ) ) {
300 + wp_deregister_style( 'ghostkit' );
301 + }
302 + wp_register_style( 'ghostkit', false, array( 'ghostkit-editor' ), GHOSTKIT_VERSION );
303 +
253 304 // Ghost Kit.
254 305 GhostKit_Assets::enqueue_style(
255 306 'ghostkit-editor',
256 307 'build/gutenberg/editor',
@@ -257,9 +308,23 @@
257 308 $css_deps,
258 309 filemtime( plugin_dir_path( __FILE__ ) . 'build/gutenberg/editor.css' )
259 310 );
260 311 wp_style_add_data( 'ghostkit-editor', 'rtl', 'replace' );
261 - wp_style_add_data( 'ghostkit-editor', 'suffix', '.min' );
312 +
313 + // Since WordPress 7.1 the post editor canvas is always iframed, and core collects
314 + // the iframe assets by running `enqueue_block_assets` a second time with
315 + // `should_load_block_editor_scripts_and_styles` forced to false.
316 + // The editor bundles belong to the editor chrome only - loading them in the canvas
317 + // would boot a second copy of the block editor inside the iframe. The vendor
318 + // libraries, on the other hand, are needed inside the canvas to render block previews
319 + // (for example the `lottie-player` custom element, which is registered per window).
320 + if ( ! wp_should_load_block_editor_scripts_and_styles() ) {
321 + foreach ( $js_deps as $dep ) {
322 + wp_enqueue_script( $dep );
323 + }
324 +
325 + return;
326 + }
262 327
263 328 GhostKit_Assets::enqueue_script(
264 329 'ghostkit-editor',
265 330 'build/gutenberg/index',