• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

equalizedigital / accessibility-checker / 14783707399

01 May 2025 09:17PM UTC coverage: 29.045% (+3.4%) from 25.605%
14783707399

push

github

web-flow
Merge pull request #930 from equalizedigital/steve/pro-60-remove-legacy-php-scan-code

Remove Legacy PHP Scan Code

1 of 81 new or added lines in 6 files covered. (1.23%)

37 existing lines in 4 files now uncovered.

1542 of 5309 relevant lines covered (29.05%)

1.53 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/admin/class-post-save.php
1
<?php
2
/**
3
 * Class for handling the post save actions.
4
 *
5
 * @since 1.23.0
6
 *
7
 * @package Accessibility_Checker
8
 */
9

10
namespace EDAC\Admin;
11

12
use EDAC\Admin\Purge_Post_Data;
13

14
/**
15
 * Class Post_Save
16
 *
17
 * Handles actions and filters related to saving posts in the accessibility checker.
18
 *
19
 * @package EDAC\Admin
20
 * @since 1.23.0
21
 */
22
class Post_Save {
23

24
        /**
25
         * Post on save
26
         *
27
         * @param int    $post_ID The ID of the post being saved.
28
         * @param object $post    The post object being saved.
29
         * @param bool   $update  Whether this is an update or not.
30
         *
31
         * @modified 1.10.0 to add a return when post_status is trash.
32
         * @modified 1.23.0 moved to new class and then swapped to void return as no longer reading the return values anywhere.
33
         *
34
         * @return void The post ID.
35
         */
36
        public static function delete_issue_data_on_post_trashing( $post_ID, $post, $update ) {
37
                // check post type.
NEW
38
                $post_types = get_option( 'edac_post_types' );
×
NEW
39
                if ( is_array( $post_types ) && ! in_array( $post->post_type, $post_types, true ) ) {
×
NEW
40
                        return;
×
41
                }
42

43
                // prevents first past of save_post due to meta boxes on post editor in gutenberg.
NEW
44
                if ( empty( $_POST ) ) {
×
NEW
45
                        return;
×
46
                }
47

48
                // ignore revisions.
NEW
49
                if ( wp_is_post_revision( $post_ID ) ) {
×
NEW
50
                        return;
×
51
                }
52

53
                // ignore autosaves.
NEW
54
                if ( wp_is_post_autosave( $post_ID ) ) {
×
NEW
55
                        return;
×
56
                }
57

58
                // check if update.
NEW
59
                if ( ! $update ) {
×
NEW
60
                        return;
×
61
                }
62

63
                // handle the case when the custom post is quick edited.
NEW
64
                if ( isset( $_POST['_inline_edit'] ) ) {
×
NEW
65
                        $inline_edit = sanitize_text_field( $_POST['_inline_edit'] );
×
NEW
66
                        if ( wp_verify_nonce( $inline_edit, 'inlineeditnonce' ) ) {
×
NEW
67
                                return;
×
68
                        }
69
                }
70

71
                // Post in, or going to, trash.
NEW
72
                if ( 'trash' === $post->post_status ) {
×
73
                        // Gutenberg does not fire the `wp_trash_post` action when moving posts to the
74
                        // trash. Instead, it uses `rest_delete_{$post_type}` which passes a different shape
75
                        // Instead of hooking in there for every post type supported the data gets purged
76
                        // here instead which produces the same result.
NEW
77
                        Purge_Post_Data::delete_post( $post_ID );
×
78
                }
79
        }
80
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc