Skip to content

Commit

Permalink
[create-block] Add ABSPATH check (#55533)
Browse files Browse the repository at this point in the history
* Add ABSPATH check

* User perf plugin syntax
  • Loading branch information
KevinBatdorf authored Oct 22, 2023
1 parent 2a8d5b5 commit 2788a9c
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@
* @package {{namespace}}
*/

if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}

/**
* Registers the block using the metadata loaded from the `block.json` file.
* Behind the scenes, it registers also all assets so they can be enqueued
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@
* @package {{namespace}}
*/

if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}

/**
* Registers the block using the metadata loaded from the `block.json` file.
* Behind the scenes, it registers also all assets so they can be enqueued
Expand Down
4 changes: 4 additions & 0 deletions packages/create-block/lib/templates/es5/$slug.php.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@
* @package {{namespace}}
*/

if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}

/**
* Registers all block assets so that they can be enqueued through the block editor
* in the corresponding context.
Expand Down
4 changes: 4 additions & 0 deletions packages/create-block/lib/templates/plugin/$slug.php.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@
* @package {{namespace}}
*/

if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}

/**
* Registers the block using the metadata loaded from the `block.json` file.
* Behind the scenes, it registers also all assets so they can be enqueued
Expand Down

1 comment on commit 2788a9c

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flaky tests detected in 2788a9c.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/6606243517
📝 Reported issues:

Please sign in to comment.