REDROOM
PHP 8.2.31
Path:
Logout
Edit File
Size: 1.82 KB
Close
/home/nshryvcy/himaltourism.com/wp-content/plugins/facebook-for-woocommerce/includes/Handlers/WebHook.php
Text
Base64
<?php // phpcs:ignoreFile /** * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved * * This source code is licensed under the license found in the * LICENSE file in the root directory of this source tree. * * @package FacebookCommerce */ namespace WooCommerce\Facebook\Handlers; defined( 'ABSPATH' ) or exit; /** * The WebHook handler. * * @since 2.3.0 */ class WebHook { /** @var string auth page ID */ const WEBHOOK_PAGE_ID = 'wc-facebook-webhook'; /** * Constructs a new WebHook. * * @param \WC_Facebookcommerce $plugin Plugin instance. * * @since 2.3.0 */ public function __construct( \WC_Facebookcommerce $plugin ) { add_action( 'rest_api_init', array( $this, 'init_webhook_endpoint' ) ); } /** * Register WebHook REST API endpoint * * @since 2.3.0 */ public function init_webhook_endpoint() { register_rest_route( 'wc-facebook/v1', 'webhook', array( array( 'methods' => array( 'GET', 'POST' ), 'callback' => array( $this, 'webhook_callback' ), 'permission_callback' => array( $this, 'permission_callback' ), ), ) ); } /** * Endpoint permissions * Woo Connect Bridge is sending the WebHook request using generated key. * * @since 2.3.0 * * @return boolean */ public function permission_callback() { return current_user_can( 'manage_woocommerce' ); } /** * WebHook Listener * * @since 2.3.0 * @see Connection * * @param \WP_REST_Request $request The request. * @return \WP_REST_Response */ public function webhook_callback( \WP_REST_Request $request ) { $request_body = json_decode( $request->get_body() ); if ( empty( $request_body ) ) { return new \WP_REST_Response( null, 204 ); } do_action( 'fbe_webhook', $request_body ); return new \WP_REST_Response( null, 200 ); } }
Save
Close
Exit & Reset
Text mode: syntax highlighting auto-detects file type.
Directory Contents
Dirs: 0 × Files: 2
Delete Selected
Select All
Select None
Sort:
Name
Size
Modified
Enable drag-to-move
Name
Size
Perms
Modified
Actions
Connection.php
40.88 KB
lrw-r--r--
2025-01-05 05:33:50
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
WebHook.php
1.82 KB
lrw-r--r--
2025-01-05 05:33:50
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Zip Selected
If ZipArchive is unavailable, a
.tar
will be created (no compression).