PluginProbe
aBlocks – Gutenberg Blocks, User Dashboard Builder, Popup Builder, Form Builder & Animation Builder / 2.10.0
aBlocks – Gutenberg Blocks, User Dashboard Builder, Popup Builder, Form Builder & Animation Builder v2.10.0
2.14.0 2.13.0 2.13.1 2.12.0 2.11.1 2.11.0 2.10.0 2.9.0 2.7.4 2.7.5 2.7.6 2.7.7 2.8.0 2.8.1 2.9.1 trunk 1.0 1.0-beta1 1.0-beta2 1.0-beta3 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 All 81 releases
ablocks / includes / blocks / form-builder / block-attr-sanitizer / sanitizer.php

sanitizer.php in aBlocks – Gutenberg Blocks, User Dashboard Builder, Popup Builder, Form Builder & Animation Builder 2.10.0, at includes/blocks/form-builder/block-attr-sanitizer/sanitizer.php

42 lines 1.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace ABlocks\Blocks\FormBuilder\BlockAttrSanitizer;
3
4 use ABlocks\Blocks\FormBuilder\BlockAttrSanitizer\interfaces\{
5 SanitizerInterface,
6 SanitizerBaseInterface
7 };
8 use ABlocks\Blocks\FormBuilder\BlockAttrSanitizer\Exceptions\BlockNotFoundException;
9 use ABlocks\Blocks\FormBuilder\BlockAttrSanitizer\Sanitizers\FormBuilder\RegistrationFormSanitizer;
10 use WP_Post;
11
12 if ( ! defined( 'ABSPATH' ) ) {
13 exit;
14 }
15
16 class Sanitizer implements SanitizerBaseInterface {
17
18 protected array $sanitizers = [
19 RegistrationFormSanitizer::class
20 ];
21
22 public function sanitize( int $post_id, WP_Post $post, bool $update ): void {
23 try {
24 foreach ( $this->sanitizers as $sanitizer ) {
25 $instance = ( new $sanitizer( $post ) );
26 if (
27 class_exists( $sanitizer ) &&
28 $instance instanceof SanitizerInterface
29 ) {
30 $instance->sanitize();
31 }
32 }
33 } catch ( BlockNotFoundException $e ) {
34 $instance->log( $e->getMessage() );
35 }
36 }
37 public static function init() : void {
38 $instance = new self();
39 add_action( 'save_post', [ $instance, 'sanitize' ], 10, 3 );
40 }
41 }
42