From 3bfab4286a0a2ae8b35ee9c9b69ba8c5e9a81afe Mon Sep 17 00:00:00 2001 From: Joe Fusco Date: Fri, 27 Jun 2025 12:10:07 -0400 Subject: [PATCH 1/6] Rename webhooks plugin --- examples/next/webhooks-isr/.wp-env.json | 2 +- examples/next/webhooks-isr/README.md | 2 +- plugins/README.md | 2 +- .../deactivation.php | 20 ------ .../phpstan/constants.php | 10 --- .../.distignore | 0 .../.editorconfig | 0 .../.env.dist | 2 +- .../.gitattributes | 0 .../.gitignore | 0 .../.phpcs.xml.dist | 0 .../README.md | 2 +- .../ControlStructures/ElseKeywordSniff.php | 0 .../access-functions.php | 2 +- .../activation.php | 4 +- .../assets/css/admin.css | 0 .../assets/js/admin.js | 0 .../bin/_lib.sh | 0 .../bin/build-docker.sh | 0 .../bin/install-plugins.sh | 0 .../bin/install-test-env.sh | 4 +- .../bin/run-codeception.sh | 0 .../composer.json | 8 +-- .../composer.lock | 0 plugins/wpgraphql-webhooks/deactivation.php | 20 ++++++ .../docker-compose.yml | 8 +-- .../docs/index.md | 0 .../docs/reference.md | 0 .../docs/screenshots/create_webhook-ui.png | Bin .../phpcs/WebhooksStandard/ruleset.xml | 0 .../phpstan.neon.dist | 4 +- .../Rules/ClassConstantVarAnnotationRule.php | 0 .../phpstan/class-wp-post-type.stub | 0 .../phpstan/class-wp-taxonomy.stub | 0 .../wpgraphql-webhooks/phpstan/constants.php | 10 +++ .../psalm.xml | 2 +- .../readme.txt | 0 .../src/Admin/WebhooksAdmin.php | 8 +-- .../src/Admin/WebhooksListTable.php | 2 +- .../views/partials/webhook-header-row.php | 6 +- .../src/Admin/views/webhook-form.php | 0 .../src/Admin/views/webhooks-list.php | 4 +- .../src/Autoloader.php | 4 +- .../src/Entity/Webhook.php | 0 .../src/Events/Interfaces/EventManager.php | 0 .../src/Events/SmartCacheEventMapper.php | 0 .../src/Events/SmartCacheWebhookManager.php | 0 .../src/Events/WebhookEventManager.php | 0 .../src/Fields/RootQuery.php | 6 +- .../src/Handlers/Interfaces/Handler.php | 0 .../src/Handlers/WebhookHandler.php | 0 .../src/Mutation/CreateWebhook.php | 22 +++---- .../src/Mutation/DeleteWebhook.php | 16 ++--- .../src/Mutation/UpdateWebhook.php | 30 ++++----- .../src/Plugin.php | 8 +-- .../src/PostTypes/WebhookPostType.php | 24 ++++---- .../Interfaces/WebhookRepositoryInterface.php | 0 .../src/Repository/WebhookRepository.php | 2 +- .../src/Rest/WebhookTestEndpoint.php | 6 +- .../Services/Interfaces/ServiceLocator.php | 0 .../src/Services/PluginServiceLocator.php | 0 .../src/Type/Webhook.php | 16 ++--- .../src/TypeRegistry.php | 0 .../tests/acceptance.suite.dist.yml | 4 +- .../tests/acceptance/.gitkeep | 0 .../tests/bootstrap.php | 0 .../tests/functional.suite.dist.yml | 4 +- .../tests/functional/.gitkeep | 0 .../tests/unit.suite.dist.yml | 0 .../tests/unit/.gitkeep | 0 .../tests/wpunit.suite.dist.yml | 0 .../wpgraphql-webhooks.php} | 58 +++++++++--------- 72 files changed, 161 insertions(+), 161 deletions(-) delete mode 100644 plugins/wp-graphql-headless-webhooks/deactivation.php delete mode 100644 plugins/wp-graphql-headless-webhooks/phpstan/constants.php rename plugins/{wp-graphql-headless-webhooks => wpgraphql-webhooks}/.distignore (100%) rename plugins/{wp-graphql-headless-webhooks => wpgraphql-webhooks}/.editorconfig (100%) rename plugins/{wp-graphql-headless-webhooks => wpgraphql-webhooks}/.env.dist (94%) rename plugins/{wp-graphql-headless-webhooks => wpgraphql-webhooks}/.gitattributes (100%) rename plugins/{wp-graphql-headless-webhooks => wpgraphql-webhooks}/.gitignore (100%) rename plugins/{wp-graphql-headless-webhooks => wpgraphql-webhooks}/.phpcs.xml.dist (100%) rename plugins/{wp-graphql-headless-webhooks => wpgraphql-webhooks}/README.md (97%) rename plugins/{wp-graphql-headless-webhooks => wpgraphql-webhooks}/Sniffs/ControlStructures/ElseKeywordSniff.php (100%) rename plugins/{wp-graphql-headless-webhooks => wpgraphql-webhooks}/access-functions.php (98%) rename plugins/{wp-graphql-headless-webhooks => wpgraphql-webhooks}/activation.php (65%) rename plugins/{wp-graphql-headless-webhooks => wpgraphql-webhooks}/assets/css/admin.css (100%) rename plugins/{wp-graphql-headless-webhooks => wpgraphql-webhooks}/assets/js/admin.js (100%) rename plugins/{wp-graphql-headless-webhooks => wpgraphql-webhooks}/bin/_lib.sh (100%) rename plugins/{wp-graphql-headless-webhooks => wpgraphql-webhooks}/bin/build-docker.sh (100%) rename plugins/{wp-graphql-headless-webhooks => wpgraphql-webhooks}/bin/install-plugins.sh (100%) rename plugins/{wp-graphql-headless-webhooks => wpgraphql-webhooks}/bin/install-test-env.sh (97%) rename plugins/{wp-graphql-headless-webhooks => wpgraphql-webhooks}/bin/run-codeception.sh (100%) rename plugins/{wp-graphql-headless-webhooks => wpgraphql-webhooks}/composer.json (94%) rename plugins/{wp-graphql-headless-webhooks => wpgraphql-webhooks}/composer.lock (100%) create mode 100644 plugins/wpgraphql-webhooks/deactivation.php rename plugins/{wp-graphql-headless-webhooks => wpgraphql-webhooks}/docker-compose.yml (69%) rename plugins/{wp-graphql-headless-webhooks => wpgraphql-webhooks}/docs/index.md (100%) rename plugins/{wp-graphql-headless-webhooks => wpgraphql-webhooks}/docs/reference.md (100%) rename plugins/{wp-graphql-headless-webhooks => wpgraphql-webhooks}/docs/screenshots/create_webhook-ui.png (100%) rename plugins/{wp-graphql-headless-webhooks => wpgraphql-webhooks}/phpcs/WebhooksStandard/ruleset.xml (100%) rename plugins/{wp-graphql-headless-webhooks => wpgraphql-webhooks}/phpstan.neon.dist (93%) rename plugins/{wp-graphql-headless-webhooks => wpgraphql-webhooks}/phpstan/Rules/ClassConstantVarAnnotationRule.php (100%) rename plugins/{wp-graphql-headless-webhooks => wpgraphql-webhooks}/phpstan/class-wp-post-type.stub (100%) rename plugins/{wp-graphql-headless-webhooks => wpgraphql-webhooks}/phpstan/class-wp-taxonomy.stub (100%) create mode 100644 plugins/wpgraphql-webhooks/phpstan/constants.php rename plugins/{wp-graphql-headless-webhooks => wpgraphql-webhooks}/psalm.xml (93%) rename plugins/{wp-graphql-headless-webhooks => wpgraphql-webhooks}/readme.txt (100%) rename plugins/{wp-graphql-headless-webhooks => wpgraphql-webhooks}/src/Admin/WebhooksAdmin.php (98%) rename plugins/{wp-graphql-headless-webhooks => wpgraphql-webhooks}/src/Admin/WebhooksListTable.php (99%) rename plugins/{wp-graphql-headless-webhooks => wpgraphql-webhooks}/src/Admin/views/partials/webhook-header-row.php (73%) rename plugins/{wp-graphql-headless-webhooks => wpgraphql-webhooks}/src/Admin/views/webhook-form.php (100%) rename plugins/{wp-graphql-headless-webhooks => wpgraphql-webhooks}/src/Admin/views/webhooks-list.php (92%) rename plugins/{wp-graphql-headless-webhooks => wpgraphql-webhooks}/src/Autoloader.php (87%) rename plugins/{wp-graphql-headless-webhooks => wpgraphql-webhooks}/src/Entity/Webhook.php (100%) rename plugins/{wp-graphql-headless-webhooks => wpgraphql-webhooks}/src/Events/Interfaces/EventManager.php (100%) rename plugins/{wp-graphql-headless-webhooks => wpgraphql-webhooks}/src/Events/SmartCacheEventMapper.php (100%) rename plugins/{wp-graphql-headless-webhooks => wpgraphql-webhooks}/src/Events/SmartCacheWebhookManager.php (100%) rename plugins/{wp-graphql-headless-webhooks => wpgraphql-webhooks}/src/Events/WebhookEventManager.php (100%) rename plugins/{wp-graphql-headless-webhooks => wpgraphql-webhooks}/src/Fields/RootQuery.php (90%) rename plugins/{wp-graphql-headless-webhooks => wpgraphql-webhooks}/src/Handlers/Interfaces/Handler.php (100%) rename plugins/{wp-graphql-headless-webhooks => wpgraphql-webhooks}/src/Handlers/WebhookHandler.php (100%) rename plugins/{wp-graphql-headless-webhooks => wpgraphql-webhooks}/src/Mutation/CreateWebhook.php (81%) rename plugins/{wp-graphql-headless-webhooks => wpgraphql-webhooks}/src/Mutation/DeleteWebhook.php (76%) rename plugins/{wp-graphql-headless-webhooks => wpgraphql-webhooks}/src/Mutation/UpdateWebhook.php (86%) rename plugins/{wp-graphql-headless-webhooks => wpgraphql-webhooks}/src/Plugin.php (93%) rename plugins/{wp-graphql-headless-webhooks => wpgraphql-webhooks}/src/PostTypes/WebhookPostType.php (63%) rename plugins/{wp-graphql-headless-webhooks => wpgraphql-webhooks}/src/Repository/Interfaces/WebhookRepositoryInterface.php (100%) rename plugins/{wp-graphql-headless-webhooks => wpgraphql-webhooks}/src/Repository/WebhookRepository.php (99%) rename plugins/{wp-graphql-headless-webhooks => wpgraphql-webhooks}/src/Rest/WebhookTestEndpoint.php (96%) rename plugins/{wp-graphql-headless-webhooks => wpgraphql-webhooks}/src/Services/Interfaces/ServiceLocator.php (100%) rename plugins/{wp-graphql-headless-webhooks => wpgraphql-webhooks}/src/Services/PluginServiceLocator.php (100%) rename plugins/{wp-graphql-headless-webhooks => wpgraphql-webhooks}/src/Type/Webhook.php (77%) rename plugins/{wp-graphql-headless-webhooks => wpgraphql-webhooks}/src/TypeRegistry.php (100%) rename plugins/{wp-graphql-headless-webhooks => wpgraphql-webhooks}/tests/acceptance.suite.dist.yml (82%) rename plugins/{wp-graphql-headless-webhooks => wpgraphql-webhooks}/tests/acceptance/.gitkeep (100%) rename plugins/{wp-graphql-headless-webhooks => wpgraphql-webhooks}/tests/bootstrap.php (100%) rename plugins/{wp-graphql-headless-webhooks => wpgraphql-webhooks}/tests/functional.suite.dist.yml (77%) rename plugins/{wp-graphql-headless-webhooks => wpgraphql-webhooks}/tests/functional/.gitkeep (100%) rename plugins/{wp-graphql-headless-webhooks => wpgraphql-webhooks}/tests/unit.suite.dist.yml (100%) rename plugins/{wp-graphql-headless-webhooks => wpgraphql-webhooks}/tests/unit/.gitkeep (100%) rename plugins/{wp-graphql-headless-webhooks => wpgraphql-webhooks}/tests/wpunit.suite.dist.yml (100%) rename plugins/{wp-graphql-headless-webhooks/wp-graphql-headless-webhooks.php => wpgraphql-webhooks/wpgraphql-webhooks.php} (56%) diff --git a/examples/next/webhooks-isr/.wp-env.json b/examples/next/webhooks-isr/.wp-env.json index b18d87b2..504e27c9 100644 --- a/examples/next/webhooks-isr/.wp-env.json +++ b/examples/next/webhooks-isr/.wp-env.json @@ -4,7 +4,7 @@ "https://github.com/wp-graphql/wp-graphql/releases/latest/download/wp-graphql.zip", "https://github.com/wp-graphql/wp-graphql-smart-cache/releases/download/v2.0.0/wpgraphql-smart-cache.zip", "https://downloads.wordpress.org/plugin/code-snippets.3.6.8.zip", - "../../../plugins/wp-graphql-headless-webhooks" + "../../../plugins/wpgraphql-webhooks" ], "config": { "WP_DEBUG": true, diff --git a/examples/next/webhooks-isr/README.md b/examples/next/webhooks-isr/README.md index aa1dfae7..beb6b707 100644 --- a/examples/next/webhooks-isr/README.md +++ b/examples/next/webhooks-isr/README.md @@ -20,7 +20,7 @@ This integration enables seamless communication between a WordPress backend and ## Prerequisites -* WordPress site with the wpgraphql-headless-webhooks plugin installed. +* WordPress site with the wpgraphql-webhooks plugin installed. * Next.js project (Node.js v18+ recommended). * Environment variables configured for WordPress URL and webhook secret. diff --git a/plugins/README.md b/plugins/README.md index 6274daa5..d672271e 100644 --- a/plugins/README.md +++ b/plugins/README.md @@ -7,7 +7,7 @@ WordPress plugins for the Headless WordPress Toolkit. Each plugin is paired with | Plugin | Description | |--------|-------------| | [`hwp-previews`](./hwp-previews/README.md) | Headless Previews solution for WordPress: fully configurable preview URLs via the settings page which is framework agnostic. | -| [`wp-graphql-headless-webhooks`](./wp-graphql-headless-webhooks/README.md) | A WordPress plugin that extends [WPGraphQL](https://www.wpgraphql.com/) to support webhook subscriptions and dispatching for headless WordPress environments. This allows external applications to listen and respond to WordPress content changes through GraphQL-driven webhook events. | +| [`wpgraphql-webhooks`](./wpgraphql-webhooks/README.md) | A WordPress plugin that extends [WPGraphQL](https://www.wpgraphql.com/) to support webhook subscriptions and dispatching for headless WordPress environments. This allows external applications to listen and respond to WordPress content changes through GraphQL-driven webhook events. | ## Contributing diff --git a/plugins/wp-graphql-headless-webhooks/deactivation.php b/plugins/wp-graphql-headless-webhooks/deactivation.php deleted file mode 100644 index 09f768d4..00000000 --- a/plugins/wp-graphql-headless-webhooks/deactivation.php +++ /dev/null @@ -1,20 +0,0 @@ - - + diff --git a/plugins/wp-graphql-headless-webhooks/readme.txt b/plugins/wpgraphql-webhooks/readme.txt similarity index 100% rename from plugins/wp-graphql-headless-webhooks/readme.txt rename to plugins/wpgraphql-webhooks/readme.txt diff --git a/plugins/wp-graphql-headless-webhooks/src/Admin/WebhooksAdmin.php b/plugins/wpgraphql-webhooks/src/Admin/WebhooksAdmin.php similarity index 98% rename from plugins/wp-graphql-headless-webhooks/src/Admin/WebhooksAdmin.php rename to plugins/wpgraphql-webhooks/src/Admin/WebhooksAdmin.php index 77a0e162..4b3f4663 100644 --- a/plugins/wp-graphql-headless-webhooks/src/Admin/WebhooksAdmin.php +++ b/plugins/wpgraphql-webhooks/src/Admin/WebhooksAdmin.php @@ -100,16 +100,16 @@ public function enqueue_assets( string $hook ): void { wp_enqueue_style( 'graphql-webhooks-admin', - WPGRAPHQL_HEADLESS_WEBHOOKS_PLUGIN_URL . 'assets/css/admin.css', + WPGRAPHQL_WEBHOOKS_PLUGIN_URL . 'assets/css/admin.css', [], - WPGRAPHQL_HEADLESS_WEBHOOKS_VERSION + WPGRAPHQL_WEBHOOKS_VERSION ); wp_enqueue_script( 'graphql-webhooks-admin', - WPGRAPHQL_HEADLESS_WEBHOOKS_PLUGIN_URL . 'assets/js/admin.js', + WPGRAPHQL_WEBHOOKS_PLUGIN_URL . 'assets/js/admin.js', [ 'jquery' ], - WPGRAPHQL_HEADLESS_WEBHOOKS_VERSION, + WPGRAPHQL_WEBHOOKS_VERSION, true ); diff --git a/plugins/wp-graphql-headless-webhooks/src/Admin/WebhooksListTable.php b/plugins/wpgraphql-webhooks/src/Admin/WebhooksListTable.php similarity index 99% rename from plugins/wp-graphql-headless-webhooks/src/Admin/WebhooksListTable.php rename to plugins/wpgraphql-webhooks/src/Admin/WebhooksListTable.php index ec92182e..7af908c3 100644 --- a/plugins/wp-graphql-headless-webhooks/src/Admin/WebhooksListTable.php +++ b/plugins/wpgraphql-webhooks/src/Admin/WebhooksListTable.php @@ -98,7 +98,7 @@ public function process_bulk_action() { // Check permissions if ( ! current_user_can( 'manage_options' ) ) { - wp_die( __( 'You do not have sufficient permissions to access this page.', 'wp-graphql-headless-webhooks' ) ); + wp_die( __( 'You do not have sufficient permissions to access this page.', 'wpgraphql-webhooks' ) ); } // Get selected webhooks diff --git a/plugins/wp-graphql-headless-webhooks/src/Admin/views/partials/webhook-header-row.php b/plugins/wpgraphql-webhooks/src/Admin/views/partials/webhook-header-row.php similarity index 73% rename from plugins/wp-graphql-headless-webhooks/src/Admin/views/partials/webhook-header-row.php rename to plugins/wpgraphql-webhooks/src/Admin/views/partials/webhook-header-row.php index 01fc8618..1e60ccc6 100644 --- a/plugins/wp-graphql-headless-webhooks/src/Admin/views/partials/webhook-header-row.php +++ b/plugins/wpgraphql-webhooks/src/Admin/views/partials/webhook-header-row.php @@ -20,14 +20,14 @@ diff --git a/plugins/wp-graphql-headless-webhooks/src/Admin/views/webhook-form.php b/plugins/wpgraphql-webhooks/src/Admin/views/webhook-form.php similarity index 100% rename from plugins/wp-graphql-headless-webhooks/src/Admin/views/webhook-form.php rename to plugins/wpgraphql-webhooks/src/Admin/views/webhook-form.php diff --git a/plugins/wp-graphql-headless-webhooks/src/Admin/views/webhooks-list.php b/plugins/wpgraphql-webhooks/src/Admin/views/webhooks-list.php similarity index 92% rename from plugins/wp-graphql-headless-webhooks/src/Admin/views/webhooks-list.php rename to plugins/wpgraphql-webhooks/src/Admin/views/webhooks-list.php index 9af6f985..8fdde115 100644 --- a/plugins/wp-graphql-headless-webhooks/src/Admin/views/webhooks-list.php +++ b/plugins/wpgraphql-webhooks/src/Admin/views/webhooks-list.php @@ -13,9 +13,9 @@ ?>
-

+

- +
diff --git a/plugins/wp-graphql-headless-webhooks/src/Autoloader.php b/plugins/wpgraphql-webhooks/src/Autoloader.php similarity index 87% rename from plugins/wp-graphql-headless-webhooks/src/Autoloader.php rename to plugins/wpgraphql-webhooks/src/Autoloader.php index 57c42cbf..91ee0dce 100644 --- a/plugins/wp-graphql-headless-webhooks/src/Autoloader.php +++ b/plugins/wpgraphql-webhooks/src/Autoloader.php @@ -28,7 +28,7 @@ class Autoloader { */ public static function autoload(): bool { // If we're not *supposed* to autoload anything, then return true. - if ( defined( 'WPGRAPHQL_HEADLESS_WEBHOOKS_AUTOLOAD' ) && false === WPGRAPHQL_HEADLESS_WEBHOOKS_AUTOLOAD ) { + if ( defined( 'WPGRAPHQL_WEBHOOKS_AUTOLOAD' ) && false === WPGRAPHQL_WEBHOOKS_AUTOLOAD ) { return true; } @@ -60,7 +60,7 @@ protected static function require_autoloader( string $autoloader_file ): bool { * Displays a notice if the autoloader is missing. */ protected static function missing_autoloader_notice(): void { - $error_message = 'Headless Webhooks for WPGraphQL: The Composer autoloader was not found. If you installed the plugin from the GitHub source, make sure to run `composer install`.'; + $error_message = 'Webhooks for WPGraphQL: The Composer autoloader was not found. If you installed the plugin from the GitHub source, make sure to run `composer install`.'; if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { error_log( esc_html( $error_message ) ); // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log -- This is a development notice. diff --git a/plugins/wp-graphql-headless-webhooks/src/Entity/Webhook.php b/plugins/wpgraphql-webhooks/src/Entity/Webhook.php similarity index 100% rename from plugins/wp-graphql-headless-webhooks/src/Entity/Webhook.php rename to plugins/wpgraphql-webhooks/src/Entity/Webhook.php diff --git a/plugins/wp-graphql-headless-webhooks/src/Events/Interfaces/EventManager.php b/plugins/wpgraphql-webhooks/src/Events/Interfaces/EventManager.php similarity index 100% rename from plugins/wp-graphql-headless-webhooks/src/Events/Interfaces/EventManager.php rename to plugins/wpgraphql-webhooks/src/Events/Interfaces/EventManager.php diff --git a/plugins/wp-graphql-headless-webhooks/src/Events/SmartCacheEventMapper.php b/plugins/wpgraphql-webhooks/src/Events/SmartCacheEventMapper.php similarity index 100% rename from plugins/wp-graphql-headless-webhooks/src/Events/SmartCacheEventMapper.php rename to plugins/wpgraphql-webhooks/src/Events/SmartCacheEventMapper.php diff --git a/plugins/wp-graphql-headless-webhooks/src/Events/SmartCacheWebhookManager.php b/plugins/wpgraphql-webhooks/src/Events/SmartCacheWebhookManager.php similarity index 100% rename from plugins/wp-graphql-headless-webhooks/src/Events/SmartCacheWebhookManager.php rename to plugins/wpgraphql-webhooks/src/Events/SmartCacheWebhookManager.php diff --git a/plugins/wp-graphql-headless-webhooks/src/Events/WebhookEventManager.php b/plugins/wpgraphql-webhooks/src/Events/WebhookEventManager.php similarity index 100% rename from plugins/wp-graphql-headless-webhooks/src/Events/WebhookEventManager.php rename to plugins/wpgraphql-webhooks/src/Events/WebhookEventManager.php diff --git a/plugins/wp-graphql-headless-webhooks/src/Fields/RootQuery.php b/plugins/wpgraphql-webhooks/src/Fields/RootQuery.php similarity index 90% rename from plugins/wp-graphql-headless-webhooks/src/Fields/RootQuery.php rename to plugins/wpgraphql-webhooks/src/Fields/RootQuery.php index 1ad1c13d..6b515b34 100644 --- a/plugins/wp-graphql-headless-webhooks/src/Fields/RootQuery.php +++ b/plugins/wpgraphql-webhooks/src/Fields/RootQuery.php @@ -25,7 +25,7 @@ public static function register(): void { // Register the "webhooks" field (list of webhooks) register_graphql_field( 'RootQuery', 'webhooks', [ 'type' => [ 'list_of' => 'Webhook' ], - 'description' => __( 'List all registered webhooks.', 'wp-graphql-headless-webhooks' ), + 'description' => __( 'List all registered webhooks.', 'wpgraphql-webhooks' ), 'resolve' => function() { $query = new \WP_Query([ 'post_type' => 'graphql_webhook', @@ -40,11 +40,11 @@ public static function register(): void { // Register the "webhook" field (fetch single webhook by ID) register_graphql_field( 'RootQuery', 'webhook', [ 'type' => 'Webhook', - 'description' => __( 'Fetch a webhook by ID.', 'wp-graphql-headless-webhooks' ), + 'description' => __( 'Fetch a webhook by ID.', 'wpgraphql-webhooks' ), 'args' => [ 'id' => [ 'type' => Type::nonNull( Type::id() ), - 'description' => __( 'The global ID of the webhook to retrieve.', 'wp-graphql-headless-webhooks' ), + 'description' => __( 'The global ID of the webhook to retrieve.', 'wpgraphql-webhooks' ), ], ], 'resolve' => function( $root, $args ) { diff --git a/plugins/wp-graphql-headless-webhooks/src/Handlers/Interfaces/Handler.php b/plugins/wpgraphql-webhooks/src/Handlers/Interfaces/Handler.php similarity index 100% rename from plugins/wp-graphql-headless-webhooks/src/Handlers/Interfaces/Handler.php rename to plugins/wpgraphql-webhooks/src/Handlers/Interfaces/Handler.php diff --git a/plugins/wp-graphql-headless-webhooks/src/Handlers/WebhookHandler.php b/plugins/wpgraphql-webhooks/src/Handlers/WebhookHandler.php similarity index 100% rename from plugins/wp-graphql-headless-webhooks/src/Handlers/WebhookHandler.php rename to plugins/wpgraphql-webhooks/src/Handlers/WebhookHandler.php diff --git a/plugins/wp-graphql-headless-webhooks/src/Mutation/CreateWebhook.php b/plugins/wpgraphql-webhooks/src/Mutation/CreateWebhook.php similarity index 81% rename from plugins/wp-graphql-headless-webhooks/src/Mutation/CreateWebhook.php rename to plugins/wpgraphql-webhooks/src/Mutation/CreateWebhook.php index cb0d4402..a6c8464a 100644 --- a/plugins/wp-graphql-headless-webhooks/src/Mutation/CreateWebhook.php +++ b/plugins/wpgraphql-webhooks/src/Mutation/CreateWebhook.php @@ -26,42 +26,42 @@ public static function register(): void { 'inputFields' => [ 'title' => [ 'type' => 'String', - 'description' => __( 'The title of the webhook', 'wp-graphql-headless-webhooks' ), + 'description' => __( 'The title of the webhook', 'wpgraphql-webhooks' ), ], 'content' => [ 'type' => 'String', - 'description' => __( 'The content/description of the webhook', 'wp-graphql-headless-webhooks' ), + 'description' => __( 'The content/description of the webhook', 'wpgraphql-webhooks' ), ], 'eventTrigger' => [ 'type' => 'String', - 'description' => __( 'The event hook name that triggers this webhook', 'wp-graphql-headless-webhooks' ), + 'description' => __( 'The event hook name that triggers this webhook', 'wpgraphql-webhooks' ), ], 'enabled' => [ 'type' => 'Boolean', - 'description' => __( 'Whether the webhook is enabled', 'wp-graphql-headless-webhooks' ), + 'description' => __( 'Whether the webhook is enabled', 'wpgraphql-webhooks' ), ], 'security' => [ 'type' => 'String', - 'description' => __( 'Security information for the webhook', 'wp-graphql-headless-webhooks' ), + 'description' => __( 'Security information for the webhook', 'wpgraphql-webhooks' ), ], 'handlerClass' => [ 'type' => 'String', - 'description' => __( 'The handler class used for dispatching', 'wp-graphql-headless-webhooks' ), + 'description' => __( 'The handler class used for dispatching', 'wpgraphql-webhooks' ), ], 'handlerConfig' => [ 'type' => 'String', - 'description' => __( 'Configuration for the handler, JSON encoded', 'wp-graphql-headless-webhooks' ), + 'description' => __( 'Configuration for the handler, JSON encoded', 'wpgraphql-webhooks' ), ], 'status' => [ 'type' => 'String', - 'description' => __( 'Post status, e.g. PUBLISH or DRAFT', 'wp-graphql-headless-webhooks' ), + 'description' => __( 'Post status, e.g. PUBLISH or DRAFT', 'wpgraphql-webhooks' ), 'defaultValue' => 'publish', ], ], 'outputFields' => [ 'webhook' => [ 'type' => 'Webhook', - 'description' => __( 'The created webhook', 'wp-graphql-headless-webhooks' ), + 'description' => __( 'The created webhook', 'wpgraphql-webhooks' ), 'resolve' => function ($payload) { return get_post( $payload['webhookId'] ); }, @@ -70,7 +70,7 @@ public static function register(): void { 'mutateAndGetPayload' => function ($input, $context, $info) { // Check user capabilities if ( ! current_user_can( 'manage_options' ) ) { - throw new UserError( __( 'You do not have permission to create webhooks.', 'wp-graphql-headless-webhooks' ) ); + throw new UserError( __( 'You do not have permission to create webhooks.', 'wpgraphql-webhooks' ) ); } // Prepare post data @@ -83,7 +83,7 @@ public static function register(): void { $post_id = wp_insert_post( $post_data ); if ( is_wp_error( $post_id ) ) { - throw new UserError( __( 'Failed to create webhook.', 'wp-graphql-headless-webhooks' ) ); + throw new UserError( __( 'Failed to create webhook.', 'wpgraphql-webhooks' ) ); } if ( isset( $input['eventTrigger'] ) ) { update_post_meta( $post_id, '_event_trigger', sanitize_text_field( $input['eventTrigger'] ) ); diff --git a/plugins/wp-graphql-headless-webhooks/src/Mutation/DeleteWebhook.php b/plugins/wpgraphql-webhooks/src/Mutation/DeleteWebhook.php similarity index 76% rename from plugins/wp-graphql-headless-webhooks/src/Mutation/DeleteWebhook.php rename to plugins/wpgraphql-webhooks/src/Mutation/DeleteWebhook.php index bb222f6e..8e700885 100644 --- a/plugins/wp-graphql-headless-webhooks/src/Mutation/DeleteWebhook.php +++ b/plugins/wpgraphql-webhooks/src/Mutation/DeleteWebhook.php @@ -26,20 +26,20 @@ public static function register(): void { 'inputFields' => [ 'id' => [ 'type' => 'ID', - 'description' => __( 'The ID of the webhook to delete', 'wp-graphql-headless-webhooks' ), + 'description' => __( 'The ID of the webhook to delete', 'wpgraphql-webhooks' ), ], ], 'outputFields' => [ 'deletedWebhookId' => [ 'type' => 'ID', - 'description' => __( 'The ID of the deleted webhook', 'wp-graphql-headless-webhooks' ), + 'description' => __( 'The ID of the deleted webhook', 'wpgraphql-webhooks' ), 'resolve' => function ($payload) { return $payload['deletedWebhookId'] ?? null; }, ], 'success' => [ 'type' => 'Boolean', - 'description' => __( 'Whether the webhook was successfully deleted', 'wp-graphql-headless-webhooks' ), + 'description' => __( 'Whether the webhook was successfully deleted', 'wpgraphql-webhooks' ), 'resolve' => function ($payload) { return $payload['success'] ?? false; }, @@ -48,27 +48,27 @@ public static function register(): void { 'mutateAndGetPayload' => function ($input, $context, $info) { // Capability check if ( ! current_user_can( 'manage_options' ) ) { - throw new UserError( __( 'You do not have permission to delete webhooks.', 'wp-graphql-headless-webhooks' ) ); + throw new UserError( __( 'You do not have permission to delete webhooks.', 'wpgraphql-webhooks' ) ); } if ( empty( $input['id'] ) ) { - throw new UserError( __( 'The ID of the webhook to delete is required.', 'wp-graphql-headless-webhooks' ) ); + throw new UserError( __( 'The ID of the webhook to delete is required.', 'wpgraphql-webhooks' ) ); } $post_id = is_numeric( $input['id'] ) ? (int) $input['id'] : 0; if ( $post_id <= 0 ) { - throw new UserError( __( 'Invalid webhook ID.', 'wp-graphql-headless-webhooks' ) ); + throw new UserError( __( 'Invalid webhook ID.', 'wpgraphql-webhooks' ) ); } $post = get_post( $post_id ); if ( ! $post || $post->post_type !== 'graphql_webhook' ) { - throw new UserError( __( 'Webhook not found.', 'wp-graphql-headless-webhooks' ) ); + throw new UserError( __( 'Webhook not found.', 'wpgraphql-webhooks' ) ); } // Delete the post (force delete to bypass trash) $deleted = wp_delete_post( $post_id, true ); if ( ! $deleted ) { - throw new UserError( __( 'Failed to delete webhook.', 'wp-graphql-headless-webhooks' ) ); + throw new UserError( __( 'Failed to delete webhook.', 'wpgraphql-webhooks' ) ); } return [ diff --git a/plugins/wp-graphql-headless-webhooks/src/Mutation/UpdateWebhook.php b/plugins/wpgraphql-webhooks/src/Mutation/UpdateWebhook.php similarity index 86% rename from plugins/wp-graphql-headless-webhooks/src/Mutation/UpdateWebhook.php rename to plugins/wpgraphql-webhooks/src/Mutation/UpdateWebhook.php index 74520ba2..9c9b0ef5 100644 --- a/plugins/wp-graphql-headless-webhooks/src/Mutation/UpdateWebhook.php +++ b/plugins/wpgraphql-webhooks/src/Mutation/UpdateWebhook.php @@ -26,45 +26,45 @@ public static function register(): void { 'inputFields' => [ 'id' => [ 'type' => 'ID', - 'description' => __('The ID of the webhook to update', 'wp-graphql-headless-webhooks'), + 'description' => __('The ID of the webhook to update', 'wpgraphql-webhooks'), ], 'title' => [ 'type' => 'String', - 'description' => __('The new title of the webhook', 'wp-graphql-headless-webhooks'), + 'description' => __('The new title of the webhook', 'wpgraphql-webhooks'), ], 'content' => [ 'type' => 'String', - 'description' => __('The new content/description of the webhook', 'wp-graphql-headless-webhooks'), + 'description' => __('The new content/description of the webhook', 'wpgraphql-webhooks'), ], 'eventTrigger' => [ 'type' => 'String', - 'description' => __('The new event hook name that triggers this webhook', 'wp-graphql-headless-webhooks'), + 'description' => __('The new event hook name that triggers this webhook', 'wpgraphql-webhooks'), ], 'enabled' => [ 'type' => 'Boolean', - 'description' => __('Whether the webhook is enabled', 'wp-graphql-headless-webhooks'), + 'description' => __('Whether the webhook is enabled', 'wpgraphql-webhooks'), ], 'security' => [ 'type' => 'String', - 'description' => __('Security information for the webhook', 'wp-graphql-headless-webhooks'), + 'description' => __('Security information for the webhook', 'wpgraphql-webhooks'), ], 'handlerClass' => [ 'type' => 'String', - 'description' => __('The handler class used for dispatching', 'wp-graphql-headless-webhooks'), + 'description' => __('The handler class used for dispatching', 'wpgraphql-webhooks'), ], 'handlerConfig' => [ 'type' => 'String', - 'description' => __('Configuration for the handler, JSON encoded', 'wp-graphql-headless-webhooks'), + 'description' => __('Configuration for the handler, JSON encoded', 'wpgraphql-webhooks'), ], 'status' => [ 'type' => 'String', - 'description' => __('Post status, e.g. PUBLISH or DRAFT', 'wp-graphql-headless-webhooks'), + 'description' => __('Post status, e.g. PUBLISH or DRAFT', 'wpgraphql-webhooks'), ], ], 'outputFields' => [ 'webhook' => [ 'type' => 'Webhook', - 'description' => __('The updated webhook', 'wp-graphql-headless-webhooks'), + 'description' => __('The updated webhook', 'wpgraphql-webhooks'), 'resolve' => function ($payload) { return get_post($payload['webhookId']); }, @@ -72,22 +72,22 @@ public static function register(): void { ], 'mutateAndGetPayload' => function ($input, $context, $info) { if (!current_user_can('manage_options')) { - throw new UserError(__('You do not have permission to update webhooks.', 'wp-graphql-headless-webhooks')); + throw new UserError(__('You do not have permission to update webhooks.', 'wpgraphql-webhooks')); } if (empty($input['id'])) { - throw new UserError(__('The ID of the webhook to update is required.', 'wp-graphql-headless-webhooks')); + throw new UserError(__('The ID of the webhook to update is required.', 'wpgraphql-webhooks')); } $post_id = is_numeric($input['id']) ? (int) $input['id'] : 0; if ($post_id <= 0) { - throw new UserError(__('Invalid webhook ID.', 'wp-graphql-headless-webhooks')); + throw new UserError(__('Invalid webhook ID.', 'wpgraphql-webhooks')); } $post = get_post($post_id); if (!$post || $post->post_type !== 'graphql_webhook') { - throw new UserError(__('Webhook not found.', 'wp-graphql-headless-webhooks')); + throw new UserError(__('Webhook not found.', 'wpgraphql-webhooks')); } $post_data = ['ID' => $post_id]; @@ -102,7 +102,7 @@ public static function register(): void { } $updated_post_id = wp_update_post($post_data, true); if (is_wp_error($updated_post_id)) { - throw new UserError(__('Failed to update webhook.', 'wp-graphql-headless-webhooks')); + throw new UserError(__('Failed to update webhook.', 'wpgraphql-webhooks')); } if (isset($input['eventTrigger'])) { diff --git a/plugins/wp-graphql-headless-webhooks/src/Plugin.php b/plugins/wpgraphql-webhooks/src/Plugin.php similarity index 93% rename from plugins/wp-graphql-headless-webhooks/src/Plugin.php rename to plugins/wpgraphql-webhooks/src/Plugin.php index 51d49a1a..e8774da1 100644 --- a/plugins/wp-graphql-headless-webhooks/src/Plugin.php +++ b/plugins/wpgraphql-webhooks/src/Plugin.php @@ -116,11 +116,11 @@ private function setup(): void { */ private function includes(): void { if ( - defined( 'WPGRAPHQL_HEADLESS_WEBHOOKS_AUTOLOAD' ) - && false !== WPGRAPHQL_HEADLESS_WEBHOOKS_AUTOLOAD - && defined( 'WPGRAPHQL_HEADLESS_WEBHOOKS_PLUGIN_DIR' ) + defined( 'WPGRAPHQL_WEBHOOKS_AUTOLOAD' ) + && false !== WPGRAPHQL_WEBHOOKS_AUTOLOAD + && defined( 'WPGRAPHQL_WEBHOOKS_PLUGIN_DIR' ) ) { - require_once WPGRAPHQL_HEADLESS_WEBHOOKS_PLUGIN_DIR . 'vendor/autoload.php'; + require_once WPGRAPHQL_WEBHOOKS_PLUGIN_DIR . 'vendor/autoload.php'; } } diff --git a/plugins/wp-graphql-headless-webhooks/src/PostTypes/WebhookPostType.php b/plugins/wpgraphql-webhooks/src/PostTypes/WebhookPostType.php similarity index 63% rename from plugins/wp-graphql-headless-webhooks/src/PostTypes/WebhookPostType.php rename to plugins/wpgraphql-webhooks/src/PostTypes/WebhookPostType.php index 23f0c7b3..bd9fdb74 100644 --- a/plugins/wp-graphql-headless-webhooks/src/PostTypes/WebhookPostType.php +++ b/plugins/wpgraphql-webhooks/src/PostTypes/WebhookPostType.php @@ -24,18 +24,18 @@ public static function init(): void { */ public static function register_webhook_cpt(): void { $labels = [ - 'name' => __( 'Webhooks', 'wp-graphql-headless-webhooks' ), - 'singular_name' => __( 'Webhook', 'wp-graphql-headless-webhooks' ), - 'add_new' => __( 'Add New', 'wp-graphql-headless-webhooks' ), - 'add_new_item' => __( 'Add New Webhook', 'wp-graphql-headless-webhooks' ), - 'edit_item' => __( 'Edit Webhook', 'wp-graphql-headless-webhooks' ), - 'new_item' => __( 'New Webhook', 'wp-graphql-headless-webhooks' ), - 'view_item' => __( 'View Webhook', 'wp-graphql-headless-webhooks' ), - 'search_items' => __( 'Search Webhooks', 'wp-graphql-headless-webhooks' ), - 'not_found' => __( 'No Webhooks found', 'wp-graphql-headless-webhooks' ), - 'not_found_in_trash' => __( 'No Webhooks found in Trash', 'wp-graphql-headless-webhooks' ), - 'parent_item_colon' => __( 'Parent Webhook:', 'wp-graphql-headless-webhooks' ), - 'menu_name' => __( 'Webhooks', 'wp-graphql-headless-webhooks' ), + 'name' => __( 'Webhooks', 'wpgraphql-webhooks' ), + 'singular_name' => __( 'Webhook', 'wpgraphql-webhooks' ), + 'add_new' => __( 'Add New', 'wpgraphql-webhooks' ), + 'add_new_item' => __( 'Add New Webhook', 'wpgraphql-webhooks' ), + 'edit_item' => __( 'Edit Webhook', 'wpgraphql-webhooks' ), + 'new_item' => __( 'New Webhook', 'wpgraphql-webhooks' ), + 'view_item' => __( 'View Webhook', 'wpgraphql-webhooks' ), + 'search_items' => __( 'Search Webhooks', 'wpgraphql-webhooks' ), + 'not_found' => __( 'No Webhooks found', 'wpgraphql-webhooks' ), + 'not_found_in_trash' => __( 'No Webhooks found in Trash', 'wpgraphql-webhooks' ), + 'parent_item_colon' => __( 'Parent Webhook:', 'wpgraphql-webhooks' ), + 'menu_name' => __( 'Webhooks', 'wpgraphql-webhooks' ), ]; $args = [ 'labels' => $labels, diff --git a/plugins/wp-graphql-headless-webhooks/src/Repository/Interfaces/WebhookRepositoryInterface.php b/plugins/wpgraphql-webhooks/src/Repository/Interfaces/WebhookRepositoryInterface.php similarity index 100% rename from plugins/wp-graphql-headless-webhooks/src/Repository/Interfaces/WebhookRepositoryInterface.php rename to plugins/wpgraphql-webhooks/src/Repository/Interfaces/WebhookRepositoryInterface.php diff --git a/plugins/wp-graphql-headless-webhooks/src/Repository/WebhookRepository.php b/plugins/wpgraphql-webhooks/src/Repository/WebhookRepository.php similarity index 99% rename from plugins/wp-graphql-headless-webhooks/src/Repository/WebhookRepository.php rename to plugins/wpgraphql-webhooks/src/Repository/WebhookRepository.php index 3ac45bef..ffcc3f51 100644 --- a/plugins/wp-graphql-headless-webhooks/src/Repository/WebhookRepository.php +++ b/plugins/wpgraphql-webhooks/src/Repository/WebhookRepository.php @@ -145,7 +145,7 @@ public function create( Webhook $webhook ) { public function update( int $id, Webhook $webhook ) { $post = get_post( $id ); if ( ! $post || $post->post_type !== 'graphql_webhook' ) { - return new WP_Error( 'invalid_webhook', __( 'Webhook not found.', 'wp-graphql-headless-webhooks' ) ); + return new WP_Error( 'invalid_webhook', __( 'Webhook not found.', 'wpgraphql-webhooks' ) ); } // Validate using the Webhook entity diff --git a/plugins/wp-graphql-headless-webhooks/src/Rest/WebhookTestEndpoint.php b/plugins/wpgraphql-webhooks/src/Rest/WebhookTestEndpoint.php similarity index 96% rename from plugins/wp-graphql-headless-webhooks/src/Rest/WebhookTestEndpoint.php rename to plugins/wpgraphql-webhooks/src/Rest/WebhookTestEndpoint.php index 4fc4481a..8ee5eba9 100644 --- a/plugins/wp-graphql-headless-webhooks/src/Rest/WebhookTestEndpoint.php +++ b/plugins/wpgraphql-webhooks/src/Rest/WebhookTestEndpoint.php @@ -79,7 +79,7 @@ public function test_webhook( WP_REST_Request $request ): WP_REST_Response|WP_Er if ( ! $webhook ) { return new WP_Error( 'webhook_not_found', - __( 'Webhook not found.', 'wp-graphql-headless-webhooks' ), + __( 'Webhook not found.', 'wpgraphql-webhooks' ), [ 'status' => 404 ] ); } @@ -133,7 +133,7 @@ public function test_webhook( WP_REST_Request $request ): WP_REST_Response|WP_Er return new WP_REST_Response( [ 'success' => true, - 'message' => __( 'Test webhook dispatched successfully.', 'wp-graphql-headless-webhooks' ), + 'message' => __( 'Test webhook dispatched successfully.', 'wpgraphql-webhooks' ), 'details' => [ 'webhook_id' => $webhook_id, 'webhook_name' => $webhook->name, @@ -156,7 +156,7 @@ public function test_webhook( WP_REST_Request $request ): WP_REST_Response|WP_Er 'webhook_test_failed', sprintf( /* translators: %s: error message */ - __( 'Failed to dispatch test webhook: %s', 'wp-graphql-headless-webhooks' ), + __( 'Failed to dispatch test webhook: %s', 'wpgraphql-webhooks' ), $e->getMessage() ), [ 'status' => 500 ] diff --git a/plugins/wp-graphql-headless-webhooks/src/Services/Interfaces/ServiceLocator.php b/plugins/wpgraphql-webhooks/src/Services/Interfaces/ServiceLocator.php similarity index 100% rename from plugins/wp-graphql-headless-webhooks/src/Services/Interfaces/ServiceLocator.php rename to plugins/wpgraphql-webhooks/src/Services/Interfaces/ServiceLocator.php diff --git a/plugins/wp-graphql-headless-webhooks/src/Services/PluginServiceLocator.php b/plugins/wpgraphql-webhooks/src/Services/PluginServiceLocator.php similarity index 100% rename from plugins/wp-graphql-headless-webhooks/src/Services/PluginServiceLocator.php rename to plugins/wpgraphql-webhooks/src/Services/PluginServiceLocator.php diff --git a/plugins/wp-graphql-headless-webhooks/src/Type/Webhook.php b/plugins/wpgraphql-webhooks/src/Type/Webhook.php similarity index 77% rename from plugins/wp-graphql-headless-webhooks/src/Type/Webhook.php rename to plugins/wpgraphql-webhooks/src/Type/Webhook.php index 3f129c4e..a11f322e 100644 --- a/plugins/wp-graphql-headless-webhooks/src/Type/Webhook.php +++ b/plugins/wpgraphql-webhooks/src/Type/Webhook.php @@ -21,53 +21,53 @@ class Webhook { */ public static function register(): void { register_graphql_object_type( 'Webhook', [ - 'description' => __( 'A Webhook configuration object.', 'wp-graphql-headless-webhooks' ), + 'description' => __( 'A Webhook configuration object.', 'wpgraphql-webhooks' ), 'fields' => [ 'id' => [ 'type' => 'ID', - 'description' => __( 'The global ID of the webhook.', 'wp-graphql-headless-webhooks' ), + 'description' => __( 'The global ID of the webhook.', 'wpgraphql-webhooks' ), 'resolve' => function ($webhook) { return (string) $webhook->ID; }, ], 'eventTrigger' => [ 'type' => 'String', - 'description' => __( 'The event hook name that triggers this webhook.', 'wp-graphql-headless-webhooks' ), + 'description' => __( 'The event hook name that triggers this webhook.', 'wpgraphql-webhooks' ), 'resolve' => function ($webhook) { return get_post_meta( $webhook->ID, '_event_trigger', true ); }, ], 'title' => [ 'type' => 'String', - 'description' => __( 'The title of the webhook.', 'wp-graphql-headless-webhooks' ), + 'description' => __( 'The title of the webhook.', 'wpgraphql-webhooks' ), 'resolve' => function ($webhook) { return get_the_title( $webhook ); }, ], 'enabled' => [ 'type' => 'Boolean', - 'description' => __( 'Whether the webhook is enabled.', 'wp-graphql-headless-webhooks' ), + 'description' => __( 'Whether the webhook is enabled.', 'wpgraphql-webhooks' ), 'resolve' => function ($webhook) { return (bool) get_post_meta( $webhook->ID, '_enabled', true ); }, ], 'security' => [ 'type' => 'String', - 'description' => __( 'Security information for the webhook.', 'wp-graphql-headless-webhooks' ), + 'description' => __( 'Security information for the webhook.', 'wpgraphql-webhooks' ), 'resolve' => function ($webhook) { return get_post_meta( $webhook->ID, '_security', true ); }, ], 'handlerClass' => [ 'type' => 'String', - 'description' => __( 'The handler class used for dispatching.', 'wp-graphql-headless-webhooks' ), + 'description' => __( 'The handler class used for dispatching.', 'wpgraphql-webhooks' ), 'resolve' => function ($webhook) { return get_post_meta( $webhook->ID, '_handler_class', true ); }, ], 'handlerConfig' => [ 'type' => 'String', - 'description' => __( 'Configuration for the handler.', 'wp-graphql-headless-webhooks' ), + 'description' => __( 'Configuration for the handler.', 'wpgraphql-webhooks' ), 'resolve' => function ($webhook) { return get_post_meta( $webhook->ID, '_handler_config', true ); }, diff --git a/plugins/wp-graphql-headless-webhooks/src/TypeRegistry.php b/plugins/wpgraphql-webhooks/src/TypeRegistry.php similarity index 100% rename from plugins/wp-graphql-headless-webhooks/src/TypeRegistry.php rename to plugins/wpgraphql-webhooks/src/TypeRegistry.php diff --git a/plugins/wp-graphql-headless-webhooks/tests/acceptance.suite.dist.yml b/plugins/wpgraphql-webhooks/tests/acceptance.suite.dist.yml similarity index 82% rename from plugins/wp-graphql-headless-webhooks/tests/acceptance.suite.dist.yml rename to plugins/wpgraphql-webhooks/tests/acceptance.suite.dist.yml index 2b41ca99..0628cd3d 100644 --- a/plugins/wp-graphql-headless-webhooks/tests/acceptance.suite.dist.yml +++ b/plugins/wpgraphql-webhooks/tests/acceptance.suite.dist.yml @@ -19,7 +19,7 @@ modules: loadOnly: true plugins: - wp-graphql/wp-graphql.php - - wp-graphql-headless-webhooks/wp-graphql-headless-webhooks.php + - wpgraphql-webhooks/wpgraphql-webhooks.php activatePlugins: - wp-graphql/wp-graphql.php - - wp-graphql-headless-webhooks/wp-graphql-headless-webhooks.php \ No newline at end of file + - wpgraphql-webhooks/wpgraphql-webhooks.php \ No newline at end of file diff --git a/plugins/wp-graphql-headless-webhooks/tests/acceptance/.gitkeep b/plugins/wpgraphql-webhooks/tests/acceptance/.gitkeep similarity index 100% rename from plugins/wp-graphql-headless-webhooks/tests/acceptance/.gitkeep rename to plugins/wpgraphql-webhooks/tests/acceptance/.gitkeep diff --git a/plugins/wp-graphql-headless-webhooks/tests/bootstrap.php b/plugins/wpgraphql-webhooks/tests/bootstrap.php similarity index 100% rename from plugins/wp-graphql-headless-webhooks/tests/bootstrap.php rename to plugins/wpgraphql-webhooks/tests/bootstrap.php diff --git a/plugins/wp-graphql-headless-webhooks/tests/functional.suite.dist.yml b/plugins/wpgraphql-webhooks/tests/functional.suite.dist.yml similarity index 77% rename from plugins/wp-graphql-headless-webhooks/tests/functional.suite.dist.yml rename to plugins/wpgraphql-webhooks/tests/functional.suite.dist.yml index 99b293cb..346a4ace 100644 --- a/plugins/wp-graphql-headless-webhooks/tests/functional.suite.dist.yml +++ b/plugins/wpgraphql-webhooks/tests/functional.suite.dist.yml @@ -16,7 +16,7 @@ modules: loadOnly: true plugins: - wp-graphql/wp-graphql.php - - wp-graphql-headless-webhooks/wp-graphql-headless-webhooks.php + - wpgraphql-webhooks/wpgraphql-webhooks.php activatePlugins: - wp-graphql/wp-graphql.php - - wp-graphql-headless-webhooks/wp-graphql-headless-webhooks.php \ No newline at end of file + - wpgraphql-webhooks/wpgraphql-webhooks.php \ No newline at end of file diff --git a/plugins/wp-graphql-headless-webhooks/tests/functional/.gitkeep b/plugins/wpgraphql-webhooks/tests/functional/.gitkeep similarity index 100% rename from plugins/wp-graphql-headless-webhooks/tests/functional/.gitkeep rename to plugins/wpgraphql-webhooks/tests/functional/.gitkeep diff --git a/plugins/wp-graphql-headless-webhooks/tests/unit.suite.dist.yml b/plugins/wpgraphql-webhooks/tests/unit.suite.dist.yml similarity index 100% rename from plugins/wp-graphql-headless-webhooks/tests/unit.suite.dist.yml rename to plugins/wpgraphql-webhooks/tests/unit.suite.dist.yml diff --git a/plugins/wp-graphql-headless-webhooks/tests/unit/.gitkeep b/plugins/wpgraphql-webhooks/tests/unit/.gitkeep similarity index 100% rename from plugins/wp-graphql-headless-webhooks/tests/unit/.gitkeep rename to plugins/wpgraphql-webhooks/tests/unit/.gitkeep diff --git a/plugins/wp-graphql-headless-webhooks/tests/wpunit.suite.dist.yml b/plugins/wpgraphql-webhooks/tests/wpunit.suite.dist.yml similarity index 100% rename from plugins/wp-graphql-headless-webhooks/tests/wpunit.suite.dist.yml rename to plugins/wpgraphql-webhooks/tests/wpunit.suite.dist.yml diff --git a/plugins/wp-graphql-headless-webhooks/wp-graphql-headless-webhooks.php b/plugins/wpgraphql-webhooks/wpgraphql-webhooks.php similarity index 56% rename from plugins/wp-graphql-headless-webhooks/wp-graphql-headless-webhooks.php rename to plugins/wpgraphql-webhooks/wpgraphql-webhooks.php index 63837c99..2d257a3e 100644 --- a/plugins/wp-graphql-headless-webhooks/wp-graphql-headless-webhooks.php +++ b/plugins/wpgraphql-webhooks/wpgraphql-webhooks.php @@ -1,6 +1,6 @@ */ -function graphql_headless_webhooks_dependencies_not_ready(): array { +function wpgraphql_webhooks_dependencies_not_ready(): array { $deps = []; if ( ! class_exists( '\WPGraphQL' ) ) { @@ -102,15 +102,15 @@ function graphql_headless_webhooks_dependencies_not_ready(): array { /** * Initializes plugin. */ -function graphql_headless_webhooks_init(): void { - graphql_headless_webhooks_constants(); - $not_ready = graphql_headless_webhooks_dependencies_not_ready(); +function wpgraphql_webhooks_init(): void { + wpgraphql_webhooks_constants(); + $not_ready = wpgraphql_webhooks_dependencies_not_ready(); - if ( $not_ready === [] && defined( 'WPGRAPHQL_HEADLESS_WEBHOOKS_PLUGIN_DIR' ) ) { + if ( $not_ready === [] && defined( 'WPGRAPHQL_WEBHOOKS_PLUGIN_DIR' ) ) { // Load text domain at the init hook - add_action( 'init', 'WPGraphQL\Webhooks\graphql_headless_webhooks_load_textdomain' ); + add_action( 'init', 'WPGraphQL\Webhooks\wpgraphql_webhooks_load_textdomain' ); - require_once WPGRAPHQL_HEADLESS_WEBHOOKS_PLUGIN_DIR . 'src/Plugin.php'; + require_once WPGRAPHQL_WEBHOOKS_PLUGIN_DIR . 'src/Plugin.php'; $plugin = new \WPGraphQL\Webhooks\Plugin(); $plugin::instance(); return; @@ -127,7 +127,7 @@ static function () use ($dep) { // Using plain string to avoid early text domain loading printf( /* translators: dependency not ready error message */ - '%1$s must be active for WPGraphQL Headless Webhooks to work.', + '%1$s must be active for WPGraphQL Webhooks to work.', esc_html( $dep ) ); ?> @@ -143,16 +143,16 @@ static function () use ($dep) { /** * Load plugin text domain. */ -function graphql_headless_webhooks_load_textdomain(): void { +function wpgraphql_webhooks_load_textdomain(): void { load_plugin_textdomain( - 'wp-graphql-headless-webhooks', + 'wpgraphql-webhooks', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' ); } // Load the text domain during init, not earlier -add_action( 'init', 'WPGraphQL\Webhooks\graphql_headless_webhooks_load_textdomain', 1 ); +add_action( 'init', 'WPGraphQL\Webhooks\wpgraphql_webhooks_load_textdomain', 1 ); /** @psalm-suppress HookNotFound */ -add_action( 'plugins_loaded', 'WPGraphQL\Webhooks\graphql_headless_webhooks_init' ); \ No newline at end of file +add_action( 'plugins_loaded', 'WPGraphQL\Webhooks\wpgraphql_webhooks_init' ); \ No newline at end of file From b4a0a661fdedd4982b1f3c8384a1b003c1308b4c Mon Sep 17 00:00:00 2001 From: Joe Fusco Date: Fri, 27 Jun 2025 12:22:44 -0400 Subject: [PATCH 2/6] Only check plugins --- .github/workflows/code-quality.yml | 5 +++++ .github/workflows/codeception.yml | 5 +++++ .github/workflows/plugin-artifact-for-pr.yml | 3 ++- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/.github/workflows/code-quality.yml b/.github/workflows/code-quality.yml index 2e0f07bc..d9a2f0ee 100644 --- a/.github/workflows/code-quality.yml +++ b/.github/workflows/code-quality.yml @@ -46,6 +46,11 @@ jobs: CHECKED_PLUGINS=() for file in $CHANGED_FILES; do + # Skip if this is not a file within a plugin subdirectory + if [[ ! "$file" =~ ^plugins/[^/]+/.+ ]]; then + continue + fi + plugin=$(echo $file | cut -d/ -f2) # Skip if we already checked this plugin diff --git a/.github/workflows/codeception.yml b/.github/workflows/codeception.yml index dce9983f..038bef49 100644 --- a/.github/workflows/codeception.yml +++ b/.github/workflows/codeception.yml @@ -59,6 +59,11 @@ jobs: CHECKED_PLUGINS=() for file in $CHANGED_FILES; do + # Skip if this is not a file within a plugin subdirectory + if [[ ! "$file" =~ ^plugins/[^/]+/.+ ]]; then + continue + fi + plugin=$(echo $file | cut -d/ -f2) # Skip if we already checked this plugin diff --git a/.github/workflows/plugin-artifact-for-pr.yml b/.github/workflows/plugin-artifact-for-pr.yml index a9305b01..d90ff911 100644 --- a/.github/workflows/plugin-artifact-for-pr.yml +++ b/.github/workflows/plugin-artifact-for-pr.yml @@ -21,7 +21,8 @@ jobs: id: plugin run: | git fetch --prune --unshallow - plugin=$(git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.sha }} | grep '^plugins/' | head -1 | cut -d/ -f2) + # Get only files within plugin subdirectories + plugin=$(git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.sha }} | grep '^plugins/[^/]\+/' | head -1 | cut -d/ -f2) echo "slug=$plugin" >> $GITHUB_OUTPUT - name: Create plugin artifact From 32b7583a3461cdce889d0e809611364a6e4d9188 Mon Sep 17 00:00:00 2001 From: Joe Fusco Date: Fri, 27 Jun 2025 12:24:59 -0400 Subject: [PATCH 3/6] Resolve webhooks plugin linting errors --- plugins/wpgraphql-webhooks/.gitattributes | 4 +-- plugins/wpgraphql-webhooks/.phpcs.xml.dist | 2 +- .../src/Admin/WebhooksAdmin.php | 26 +++++++++---------- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/plugins/wpgraphql-webhooks/.gitattributes b/plugins/wpgraphql-webhooks/.gitattributes index 3837da1e..edd3a0ee 100644 --- a/plugins/wpgraphql-webhooks/.gitattributes +++ b/plugins/wpgraphql-webhooks/.gitattributes @@ -6,7 +6,7 @@ /docs export-ignore /phpstan export-ignore /tests export-ignore -/wp-graphql-headless-webhooks export-ignore +/wpgraphql-webhooks export-ignore /.coveralls export-ignore /.distignore export-ignore @@ -18,4 +18,4 @@ /composer.lock export-ignore /phpstan.neon.dist export-ignore /phpunit.xml.dist export-ignore -/wp-graphql-headless-webhooks.php export-ignore \ No newline at end of file +/wpgraphql-webhooks.php export-ignore \ No newline at end of file diff --git a/plugins/wpgraphql-webhooks/.phpcs.xml.dist b/plugins/wpgraphql-webhooks/.phpcs.xml.dist index 734387be..201fe552 100644 --- a/plugins/wpgraphql-webhooks/.phpcs.xml.dist +++ b/plugins/wpgraphql-webhooks/.phpcs.xml.dist @@ -4,7 +4,7 @@ ./access-functions.php - ./wp-graphql-headless-webhooks.php + ./wpgraphql-webhooks.php ./activation.php ./deactivation.php ./src/ diff --git a/plugins/wpgraphql-webhooks/src/Admin/WebhooksAdmin.php b/plugins/wpgraphql-webhooks/src/Admin/WebhooksAdmin.php index 4b3f4663..c6ef119b 100644 --- a/plugins/wpgraphql-webhooks/src/Admin/WebhooksAdmin.php +++ b/plugins/wpgraphql-webhooks/src/Admin/WebhooksAdmin.php @@ -64,8 +64,8 @@ public function add_admin_menu(): void { // Add submenu under GraphQL menu using the correct parent slug add_submenu_page( 'graphiql-ide', - __( 'GraphQL Webhooks', 'wp-graphql-headless-webhooks' ), - __( 'Webhooks', 'wp-graphql-headless-webhooks' ), + __( 'GraphQL Webhooks', 'wpgraphql-webhooks' ), + __( 'Webhooks', 'wpgraphql-webhooks' ), 'manage_options', self::ADMIN_PAGE_SLUG, [ $this, 'render_admin_page' ] @@ -120,7 +120,7 @@ public function enqueue_assets( string $hook ): void { 'ajaxUrl' => admin_url( 'admin-ajax.php' ), 'restUrl' => rest_url( 'graphql-webhooks/v1/' ), 'nonce' => wp_create_nonce( 'wp_rest' ), - 'confirmDelete' => __( 'Are you sure you want to delete this webhook?', 'wp-graphql-headless-webhooks' ), + 'confirmDelete' => __( 'Are you sure you want to delete this webhook?', 'wpgraphql-webhooks' ), 'headerTemplate' => $this->get_header_row_template(), ] ); @@ -145,7 +145,7 @@ private function get_header_row_template(): string { */ private function verify_admin_permission(): bool { if ( ! current_user_can( 'manage_options' ) ) { - wp_die( __( 'You do not have sufficient permissions to access this page.', 'wp-graphql-headless-webhooks' ) ); + wp_die( __( 'You do not have sufficient permissions to access this page.', 'wpgraphql-webhooks' ) ); return false; } return true; @@ -160,7 +160,7 @@ private function verify_admin_permission(): bool { */ private function verify_nonce( string $nonce_name, string $action ): bool { if ( ! isset( $_REQUEST[ $nonce_name ] ) || ! wp_verify_nonce( $_REQUEST[ $nonce_name ], $action ) ) { - wp_die( __( 'Security check failed.', 'wp-graphql-headless-webhooks' ) ); + wp_die( __( 'Security check failed.', 'wpgraphql-webhooks' ) ); return false; } return true; @@ -247,7 +247,7 @@ private function handle_webhook_delete(): void { // Verify nonce if ( ! wp_verify_nonce( $nonce, 'delete-webhook-' . $webhook_id ) ) { - wp_die( __( 'Security check failed.', 'wp-graphql-headless-webhooks' ) ); + wp_die( __( 'Security check failed.', 'wpgraphql-webhooks' ) ); } // Delete webhook @@ -361,14 +361,14 @@ private function sanitize_headers( array $headers ): array { public function ajax_test_webhook(): void { if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'wp_rest' ) ) { wp_send_json_error( [ - 'message' => __( 'Invalid security token.', 'wp-graphql-headless-webhooks' ), + 'message' => __( 'Invalid security token.', 'wpgraphql-webhooks' ), 'error_code' => 'invalid_nonce' ] ); } if ( ! current_user_can( 'manage_options' ) ) { wp_send_json_error( [ - 'message' => __( 'You do not have permission to test webhooks.', 'wp-graphql-headless-webhooks' ), + 'message' => __( 'You do not have permission to test webhooks.', 'wpgraphql-webhooks' ), 'error_code' => 'insufficient_permissions' ] ); } @@ -376,7 +376,7 @@ public function ajax_test_webhook(): void { $webhook_id = isset( $_POST['webhook_id'] ) ? intval( $_POST['webhook_id'] ) : 0; if ( ! $webhook_id ) { wp_send_json_error( [ - 'message' => __( 'Invalid webhook ID.', 'wp-graphql-headless-webhooks' ), + 'message' => __( 'Invalid webhook ID.', 'wpgraphql-webhooks' ), 'error_code' => 'invalid_webhook_id' ] ); } @@ -384,7 +384,7 @@ public function ajax_test_webhook(): void { $webhook = $this->repository->get( $webhook_id ); if ( ! $webhook ) { wp_send_json_error( [ - 'message' => __( 'Webhook not found.', 'wp-graphql-headless-webhooks' ), + 'message' => __( 'Webhook not found.', 'wpgraphql-webhooks' ), 'error_code' => 'webhook_not_found' ] ); } @@ -430,7 +430,7 @@ public function ajax_test_webhook(): void { if ( is_wp_error( $response ) ) { wp_send_json_error( [ 'message' => sprintf( - __( 'Failed to send test webhook: %s', 'wp-graphql-headless-webhooks' ), + __( 'Failed to send test webhook: %s', 'wpgraphql-webhooks' ), $response->get_error_message() ), 'error_code' => $response->get_error_code(), @@ -446,8 +446,8 @@ public function ajax_test_webhook(): void { $response_data = [ 'success' => $is_success, 'message' => $is_success - ? sprintf( __( 'Test webhook sent successfully to %s', 'wp-graphql-headless-webhooks' ), $webhook->url ) - : sprintf( __( 'Webhook returned HTTP %d', 'wp-graphql-headless-webhooks' ), $response_code ), + ? sprintf( __( 'Test webhook sent successfully to %s', 'wpgraphql-webhooks' ), $webhook->url ) + : sprintf( __( 'Webhook returned HTTP %d', 'wpgraphql-webhooks' ), $response_code ), 'webhook_id' => $webhook->id, 'webhook_name' => $webhook->name, 'target_url' => $webhook->url, From 20bc39861f32fb7742f8c5054311cf0502dcee0c Mon Sep 17 00:00:00 2001 From: Joe Fusco Date: Fri, 27 Jun 2025 12:30:29 -0400 Subject: [PATCH 4/6] Handle plugin rename --- .github/workflows/plugin-artifact-for-pr.yml | 38 ++++++++++++++++++-- 1 file changed, 35 insertions(+), 3 deletions(-) diff --git a/.github/workflows/plugin-artifact-for-pr.yml b/.github/workflows/plugin-artifact-for-pr.yml index d90ff911..c43bbd9e 100644 --- a/.github/workflows/plugin-artifact-for-pr.yml +++ b/.github/workflows/plugin-artifact-for-pr.yml @@ -21,9 +21,41 @@ jobs: id: plugin run: | git fetch --prune --unshallow - # Get only files within plugin subdirectories - plugin=$(git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.sha }} | grep '^plugins/[^/]\+/' | head -1 | cut -d/ -f2) - echo "slug=$plugin" >> $GITHUB_OUTPUT + + # Get changed files in plugins subdirectories + CHANGED_FILES=$(git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.sha }} | grep '^plugins/[^/]\+/' || true) + + if [ -z "$CHANGED_FILES" ]; then + echo "No plugin files changed" + exit 1 + fi + + # Extract plugin names from both old and new paths + PLUGINS=() + for file in $CHANGED_FILES; do + plugin=$(echo $file | cut -d/ -f2) + PLUGINS+=("$plugin") + done + + # Get unique plugin names + UNIQUE_PLUGINS=($(printf '%s\n' "${PLUGINS[@]}" | sort -u)) + + # Find the first plugin that actually exists + PLUGIN_SLUG="" + for plugin in "${UNIQUE_PLUGINS[@]}"; do + if [ -d "plugins/$plugin" ]; then + PLUGIN_SLUG="$plugin" + echo "Found existing plugin directory: $PLUGIN_SLUG" + break + fi + done + + if [ -z "$PLUGIN_SLUG" ]; then + echo "No valid plugin directory found" + exit 1 + fi + + echo "slug=$PLUGIN_SLUG" >> $GITHUB_OUTPUT - name: Create plugin artifact uses: ./.github/actions/create-plugin-artifact From 86e9ee84b5b6c9723cef6252fd4240f57aaf7a6c Mon Sep 17 00:00:00 2001 From: Joe Fusco Date: Tue, 1 Jul 2025 09:22:43 -0400 Subject: [PATCH 5/6] Match prefixes with updated plugin name --- plugins/wpgraphql-webhooks/.phpcs.xml.dist | 4 ++-- plugins/wpgraphql-webhooks/deactivation.php | 2 +- .../src/Events/SmartCacheWebhookManager.php | 4 ++-- plugins/wpgraphql-webhooks/src/Events/WebhookEventManager.php | 4 ++-- plugins/wpgraphql-webhooks/src/Handlers/WebhookHandler.php | 2 +- plugins/wpgraphql-webhooks/src/Plugin.php | 4 ++-- plugins/wpgraphql-webhooks/src/Rest/WebhookTestEndpoint.php | 2 +- plugins/wpgraphql-webhooks/src/TypeRegistry.php | 4 ++-- 8 files changed, 13 insertions(+), 13 deletions(-) diff --git a/plugins/wpgraphql-webhooks/.phpcs.xml.dist b/plugins/wpgraphql-webhooks/.phpcs.xml.dist index 201fe552..e1068b77 100644 --- a/plugins/wpgraphql-webhooks/.phpcs.xml.dist +++ b/plugins/wpgraphql-webhooks/.phpcs.xml.dist @@ -132,9 +132,9 @@ - + - + diff --git a/plugins/wpgraphql-webhooks/deactivation.php b/plugins/wpgraphql-webhooks/deactivation.php index 067fa10f..615f4d67 100644 --- a/plugins/wpgraphql-webhooks/deactivation.php +++ b/plugins/wpgraphql-webhooks/deactivation.php @@ -15,6 +15,6 @@ function wpgraphql_webhooks_deactivation_callback(): callable { return static function (): void { // Fire an action when WPGraphQL Webhook is de-activating. - do_action( 'graphql_webhooks_deactivate' ); + do_action( 'wpgraphql_webhooks_deactivate' ); }; } diff --git a/plugins/wpgraphql-webhooks/src/Events/SmartCacheWebhookManager.php b/plugins/wpgraphql-webhooks/src/Events/SmartCacheWebhookManager.php index 7db05313..40f83901 100644 --- a/plugins/wpgraphql-webhooks/src/Events/SmartCacheWebhookManager.php +++ b/plugins/wpgraphql-webhooks/src/Events/SmartCacheWebhookManager.php @@ -118,7 +118,7 @@ private function trigger_webhooks( string $event, array $payload ): void { error_log( "[Webhook] Triggering webhooks for event: $event with payload: " . var_export( $payload, true ) ); - do_action( 'graphql_webhooks_before_trigger', $event, $payload ); + do_action( 'wpgraphql_webhooks_before_trigger', $event, $payload ); $webhooks = $this->repository->get_all(); error_log( "[Webhook] Found " . count( $webhooks ) . " webhooks for event: $event" ); @@ -133,7 +133,7 @@ private function trigger_webhooks( string $event, array $payload ): void { error_log( "[Webhook] Triggered $triggered_count webhooks for event: $event" ); - do_action( 'graphql_webhooks_after_trigger', $event, $payload ); + do_action( 'wpgraphql_webhooks_after_trigger', $event, $payload ); } /** diff --git a/plugins/wpgraphql-webhooks/src/Events/WebhookEventManager.php b/plugins/wpgraphql-webhooks/src/Events/WebhookEventManager.php index 207696a9..33e24e9a 100644 --- a/plugins/wpgraphql-webhooks/src/Events/WebhookEventManager.php +++ b/plugins/wpgraphql-webhooks/src/Events/WebhookEventManager.php @@ -65,14 +65,14 @@ private function trigger_webhooks( string $event, array $payload ): void { return; } - do_action( 'graphql_webhooks_before_trigger', $event, $payload ); + do_action( 'wpgraphql_webhooks_before_trigger', $event, $payload ); foreach ( $this->repository->get_all() as $webhook ) { if ( $webhook->event === $event ) { $this->handler->handle( $webhook, $payload ); } } - do_action( 'graphql_webhooks_after_trigger', $event, $payload ); + do_action( 'wpgraphql_webhooks_after_trigger', $event, $payload ); } /** Event Handlers **/ diff --git a/plugins/wpgraphql-webhooks/src/Handlers/WebhookHandler.php b/plugins/wpgraphql-webhooks/src/Handlers/WebhookHandler.php index eecd7d12..8654d13c 100644 --- a/plugins/wpgraphql-webhooks/src/Handlers/WebhookHandler.php +++ b/plugins/wpgraphql-webhooks/src/Handlers/WebhookHandler.php @@ -104,6 +104,6 @@ public function handle( Webhook $webhook, array $payload ): void { } // Trigger action after webhook is sent - do_action( 'graphql_webhooks_sent', $webhook, $payload, $response ); + do_action( 'wpgraphql_webhooks_sent', $webhook, $payload, $response ); } } \ No newline at end of file diff --git a/plugins/wpgraphql-webhooks/src/Plugin.php b/plugins/wpgraphql-webhooks/src/Plugin.php index e8774da1..f9057edb 100644 --- a/plugins/wpgraphql-webhooks/src/Plugin.php +++ b/plugins/wpgraphql-webhooks/src/Plugin.php @@ -56,13 +56,13 @@ public static function instance(): self { * * @param self $instance */ - do_action( 'graphql_webhooks_init', self::$instance ); + do_action( 'wpgraphql_webhooks_init', self::$instance ); return self::$instance; } private function setup(): void { - Helper::set_hook_prefix( 'graphql_webhooks' ); + Helper::set_hook_prefix( 'wpgraphql_webhooks' ); WebhookPostType::init(); $this->services = new PluginServiceLocator(); diff --git a/plugins/wpgraphql-webhooks/src/Rest/WebhookTestEndpoint.php b/plugins/wpgraphql-webhooks/src/Rest/WebhookTestEndpoint.php index 8ee5eba9..025f159b 100644 --- a/plugins/wpgraphql-webhooks/src/Rest/WebhookTestEndpoint.php +++ b/plugins/wpgraphql-webhooks/src/Rest/WebhookTestEndpoint.php @@ -119,7 +119,7 @@ public function test_webhook( WP_REST_Request $request ): WP_REST_Response|WP_Er $start_time = microtime( true ); try { - do_action( 'graphql_webhooks_test_event', $webhook, $test_payload ); + do_action( 'wpgraphql_webhooks_test_event', $webhook, $test_payload ); $end_time = microtime( true ); $duration = round( ( $end_time - $start_time ) * 1000, 2 ); // Convert to milliseconds diff --git a/plugins/wpgraphql-webhooks/src/TypeRegistry.php b/plugins/wpgraphql-webhooks/src/TypeRegistry.php index 275508ef..b33ba51e 100644 --- a/plugins/wpgraphql-webhooks/src/TypeRegistry.php +++ b/plugins/wpgraphql-webhooks/src/TypeRegistry.php @@ -27,7 +27,7 @@ class TypeRegistry { * @return void */ public static function init(): void { - do_action( 'graphql_webhooks_before_register_types' ); + do_action( 'wpgraphql_webhooks_before_register_types' ); $classes_to_register = array_merge( self::objects(), @@ -37,7 +37,7 @@ public static function init(): void { self::register_types( $classes_to_register ); - do_action( 'graphql_webhooks_after_register_types' ); + do_action( 'wpgraphql_webhooks_after_register_types' ); } /** From 9e93b7308dbc73139f9db06a1600141b9c274590 Mon Sep 17 00:00:00 2001 From: Joe Fusco Date: Tue, 1 Jul 2025 10:08:50 -0400 Subject: [PATCH 6/6] Fix missing build files --- plugins/wpgraphql-webhooks/.gitattributes | 3 +-- plugins/wpgraphql-webhooks/composer.json | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/plugins/wpgraphql-webhooks/.gitattributes b/plugins/wpgraphql-webhooks/.gitattributes index edd3a0ee..f9de9bfc 100644 --- a/plugins/wpgraphql-webhooks/.gitattributes +++ b/plugins/wpgraphql-webhooks/.gitattributes @@ -6,7 +6,6 @@ /docs export-ignore /phpstan export-ignore /tests export-ignore -/wpgraphql-webhooks export-ignore /.coveralls export-ignore /.distignore export-ignore @@ -18,4 +17,4 @@ /composer.lock export-ignore /phpstan.neon.dist export-ignore /phpunit.xml.dist export-ignore -/wpgraphql-webhooks.php export-ignore \ No newline at end of file +/psalm.xml export-ignore diff --git a/plugins/wpgraphql-webhooks/composer.json b/plugins/wpgraphql-webhooks/composer.json index e17e1c5d..e052b5e8 100644 --- a/plugins/wpgraphql-webhooks/composer.json +++ b/plugins/wpgraphql-webhooks/composer.json @@ -102,9 +102,9 @@ "/.*", "/assets", "/bin", - "/wpgraphql-webhooks", "/composer.lock", "/phpstan.neon.dist", + "/psalm.xml", "/README.md" ] },