| @@ -23,8 +23,13 @@ | ||
| 23 | 23 | */ |
| 24 | 24 | public function init() { |
| 25 | 25 | add_action( 'admin_menu', [ $this, 'register_page' ], 999 ); |
| 26 | 26 | add_action( 'admin_enqueue_scripts', [ $this, 'enqueue_scripts' ] ); |
| 27 | + // These are here to listen for incoming webhooks from the Upgrader service when user chooses to install Pro. | |
| 28 | + add_action( 'wp_ajax_content_control_connect_verify_connection', [ $this, 'process_verify_connection' ] ); | |
| 29 | + add_action( 'wp_ajax_nopriv_content_control_connect_verify_connection', [ $this, 'process_verify_connection' ] ); | |
| 30 | + add_action( 'wp_ajax_content_control_connect_webhook', [ $this, 'process_webhook' ] ); | |
| 31 | + add_action( 'wp_ajax_nopriv_content_control_connect_webhook', [ $this, 'process_webhook' ] ); | |
| 27 | 32 | } |
| 28 | 33 | |
| 29 | 34 | /** |
| 30 | 35 | * Register admin options pages. |
| @@ -68,6 +73,24 @@ | ||
| 68 | 73 | wp_enqueue_editor(); |
| 69 | 74 | wp_tinymce_inline_scripts(); |
| 70 | 75 | |
| 71 | 76 | wp_enqueue_script( 'content-control-settings-page' ); |
| 77 | + } | |
| 78 | + | |
| 79 | + /** | |
| 80 | + * Verify the connection. | |
| 81 | + * | |
| 82 | + * @return void | |
| 83 | + */ | |
| 84 | + public function process_verify_connection() { | |
| 85 | + $this->container->get( 'connect' )->process_verify_connection(); | |
| 86 | + } | |
| 87 | + | |
| 88 | + /** | |
| 89 | + * Listen for incoming secure webhooks from the API server. | |
| 90 | + * | |
| 91 | + * @return void | |
| 92 | + */ | |
| 93 | + public function process_webhook() { | |
| 94 | + $this->container->get( 'connect' )->process_webhook(); | |
| 72 | 95 | } |
| 73 | 96 | } |