PluginProbe
Hostinger Tools / 3.0.78
Hostinger Tools v3.0.78
3.0.78 3.0.77 3.0.76 3.0.75 3.0.74 3.0.73 3.0.72 3.0.71 3.0.70 3.0.69 3.0.68 3.0.67 3.0.66 1.8.1 1.8.2 1.8.3 1.9.1 1.9.4 1.9.5 1.9.6 1.9.7 1.9.8 1.9.9 2.0.0 2.0.1 All 109 releases
hostinger / includes / Mcp / Handlers / WebsitePageUpdated.php

WebsitePageUpdated.php in Hostinger Tools 3.0.78, at includes/Mcp/Handlers/WebsitePageUpdated.php

36 lines 857 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Hostinger\Mcp\Handlers;
4
5 defined( 'ABSPATH' ) || exit;
6
7 class WebsitePageUpdated extends EventHandler {
8
9 const ALLOWED_POST_TYPES = array( 'post', 'product', 'page' );
10
11 public function send( array $args = array() ): void {
12 if ( ! $this->can_send( $args ) ) {
13 return;
14 }
15
16 $post = get_post( $args['post_id'] );
17 $args['url'] = get_permalink( $post );
18 $this->send_to_proxy( $args );
19 }
20
21 public function can_send( array $args = array() ): bool {
22 $post_id = $args['post_id'] ?? false;
23
24 if ( ! $post_id ) {
25 return false;
26 }
27
28 $post = get_post( $post_id );
29 if ( ! $post ) {
30 return false;
31 }
32
33 return parent::can_send( $args ) && in_array( $post->post_type, self::ALLOWED_POST_TYPES, true );
34 }
35 }
36