├── .editorconfig ├── .eslintrc ├── .github ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── ISSUE_TEMPLATE │ ├── Bug_report.md │ ├── Feature_request.md │ └── config.yml ├── PULL_REQUEST_TEMPLATE.md ├── SECURITY.md ├── prompts │ └── test-markup.prompt.md └── workflows │ ├── code-coverage-and-coveralls.yml │ ├── cs.yml │ ├── deploy-on-release-to-dot-org.yml │ ├── jest-test-axe-custom-rules.yml │ ├── lint-js.yml │ ├── lint-php.yml │ ├── phpunit.yml │ ├── security.yml │ └── wp-version-checker.yml ├── .gitignore ├── .husky └── pre-commit ├── .phpcs.xml.dist ├── .travis.yml ├── LICENSE.txt ├── README.md ├── accessibility-checker.php ├── admin ├── AdminPage │ ├── FixesPage.php │ ├── FixesSettingType │ │ ├── Checkbox.php │ │ └── Text.php │ └── PageInterface.php ├── class-accessibility-statement.php ├── class-admin-notices.php ├── class-admin.php ├── class-ajax.php ├── class-enqueue-admin.php ├── class-frontend-highlight.php ├── class-helpers.php ├── class-insert-rule-data.php ├── class-issues-query.php ├── class-meta-boxes.php ├── class-post-save.php ├── class-purge-post-data.php ├── class-scans-stats.php ├── class-settings.php ├── class-update-database.php ├── class-welcome-page.php ├── class-widgets.php ├── opt-in │ └── class-email-opt-in.php └── site-health │ ├── class-audit-history.php │ ├── class-free.php │ ├── class-information.php │ └── class-pro.php ├── assets ├── fonts │ ├── anww.eot │ ├── anww.svg │ ├── anww.ttf │ └── anww.woff └── images │ ├── Accessibility Checker logo transparent bg.svg │ ├── contrast icon blue.png │ ├── contrast icon navy.png │ ├── contrast icon red.png │ ├── edac-emblem.png │ ├── edac-logo.png │ ├── highlight-icon-error.svg │ ├── highlight-icon-ignored.svg │ ├── highlight-icon-warning.svg │ ├── ignore icon blue.png │ ├── ignore icon navy.png │ ├── ignore-icon.svg │ ├── readability icon blue.png │ ├── readability icon navy.png │ ├── readability icon white.png │ └── warning icon yellow.png ├── changelog.txt ├── composer.json ├── composer.lock ├── includes ├── activation.php ├── classes │ ├── Fixes │ │ ├── Fix │ │ │ ├── AddFileSizeAndTypeToLinkedFilesFix.php │ │ │ ├── AddLabelToUnlabelledFormFieldsFix.php │ │ │ ├── AddMissingOrEmptyPageTitleFix.php │ │ │ ├── AddNewWindowWarningFix.php │ │ │ ├── BlockPDFUploadsFix.php │ │ │ ├── CommentSearchLabelFix.php │ │ │ ├── FocusOutlineFix.php │ │ │ ├── HTMLLangAndDirFix.php │ │ │ ├── LinkUnderline.php │ │ │ ├── MetaViewportScalableFix.php │ │ │ ├── PreventLinksOpeningNewWindowFix.php │ │ │ ├── ReadMoreAddTitleFix.php │ │ │ ├── RemoveTitleIfPrefferedAccessibleNameFix.php │ │ │ ├── SkipLinkFix.php │ │ │ └── TabindexFix.php │ │ ├── FixInterface.php │ │ └── FixesManager.php │ ├── WPCLI │ │ ├── BootstrapCLI.php │ │ └── Command │ │ │ ├── CLICommandInterface.php │ │ │ ├── DeleteStats.php │ │ │ ├── GetSiteStats.php │ │ │ └── GetStats.php │ ├── class-accessibility-statement.php │ ├── class-enqueue-frontend.php │ ├── class-lazyload-filter.php │ ├── class-plugin.php │ ├── class-rest-api.php │ ├── class-simplified-summary.php │ └── class-summary-generator.php ├── deactivation.php ├── deprecated │ ├── class-issues-query.php │ ├── class-scans-stats.php │ └── deprecated.php ├── helper-functions.php ├── options-page.php └── rules.php ├── languages ├── accessibility-checker-ar.mo ├── accessibility-checker-ar.po ├── accessibility-checker-bg_BG.mo ├── accessibility-checker-bg_BG.po ├── accessibility-checker-cs_CZ.mo ├── accessibility-checker-cs_CZ.po ├── accessibility-checker-da_DK.mo ├── accessibility-checker-da_DK.po ├── accessibility-checker-de_DE.mo ├── accessibility-checker-de_DE.po ├── accessibility-checker-el.mo ├── accessibility-checker-el.po ├── accessibility-checker-es_ES.mo ├── accessibility-checker-es_ES.po ├── accessibility-checker-et.mo ├── accessibility-checker-et.po ├── accessibility-checker-fi.mo ├── accessibility-checker-fi.po ├── accessibility-checker-fr_FR.mo ├── accessibility-checker-fr_FR.po ├── accessibility-checker-he_IL.mo ├── accessibility-checker-he_IL.po ├── accessibility-checker-hu_HU.mo ├── accessibility-checker-hu_HU.po ├── accessibility-checker-id_ID.mo ├── accessibility-checker-id_ID.po ├── accessibility-checker-it_IT.mo ├── accessibility-checker-it_IT.po ├── accessibility-checker-ja.mo ├── accessibility-checker-ja.po ├── accessibility-checker-ko_KR.mo ├── accessibility-checker-ko_KR.po ├── accessibility-checker-lt_LT.mo ├── accessibility-checker-lt_LT.po ├── accessibility-checker-lv.mo ├── accessibility-checker-lv.po ├── accessibility-checker-nb_NO.mo ├── accessibility-checker-nb_NO.po ├── accessibility-checker-nl_NL.mo ├── accessibility-checker-nl_NL.po ├── accessibility-checker-pl_PL.mo ├── accessibility-checker-pl_PL.po ├── accessibility-checker-pt_BR.mo ├── accessibility-checker-pt_BR.po ├── accessibility-checker-pt_PT.mo ├── accessibility-checker-pt_PT.po ├── accessibility-checker-ro_RO.mo ├── accessibility-checker-ro_RO.po ├── accessibility-checker-ru_RU.mo ├── accessibility-checker-ru_RU.po ├── accessibility-checker-sk_SK.mo ├── accessibility-checker-sk_SK.po ├── accessibility-checker-sl_SI.mo ├── accessibility-checker-sl_SI.po ├── accessibility-checker-sv_SE.mo ├── accessibility-checker-sv_SE.po ├── accessibility-checker-th.mo ├── accessibility-checker-th.po ├── accessibility-checker-tr_TR.mo ├── accessibility-checker-tr_TR.po ├── accessibility-checker-uk.mo ├── accessibility-checker-uk.po ├── accessibility-checker-vi.mo ├── accessibility-checker-vi.po ├── accessibility-checker-zh_CN.mo ├── accessibility-checker-zh_CN.po └── accessibility-checker.pot ├── package-lock.json ├── package.json ├── partials ├── admin-page │ └── fixes-page.php ├── custom-meta-box.php ├── pro-callout.php ├── settings-page.php └── welcome-page.php ├── patches └── @wordpress+env+8.8.0.patch ├── phpcs.xml ├── phpstan.neon ├── phpunit.dev.xml ├── phpunit.xml.dist ├── readme.txt ├── run-composer.sh ├── scripts ├── dist.sh ├── hard-reset.sh ├── prep_release.sh └── prepare.sh ├── src ├── admin │ ├── fixes-page │ │ ├── conditional-disable-settings.js │ │ ├── conditional-required-settings.js │ │ └── pro-callout.js │ ├── images │ │ ├── checkmark icon green.png │ │ ├── contrast icon white.png │ │ ├── error icon red.png │ │ ├── error icon white.png │ │ ├── ignore icon white.png │ │ ├── list-check.png │ │ ├── warning icon navy.png │ │ ├── warning icon white.png │ │ ├── welcome-screenshot-medium.png │ │ ├── welcome-screenshot-small.png │ │ └── welcome-screenshot-standard.png │ ├── index.js │ ├── sass │ │ └── accessibility-checker-admin.scss │ └── summary │ │ └── summary-tab-input-event-handlers.js ├── common │ ├── helpers.js │ ├── sass │ │ ├── _fix-settings.scss │ │ ├── _helpers.scss │ │ └── _variables.scss │ └── saveFixSettingsRest.js ├── editorApp │ ├── checkPage.js │ ├── helpers.js │ ├── index.js │ └── settings.js ├── emailOptIn │ ├── index.js │ ├── modal.js │ └── sass │ │ └── email-opt-in.scss ├── frontendFixes │ ├── Fixes │ │ ├── langAndDirFix.js │ │ ├── metaViewportScalableFix.js │ │ ├── newWindowWarning.js │ │ ├── preventLinksOpeningNewWindowFix.js │ │ ├── removeTitleIfPrefferedAccessibleNameFix.js │ │ ├── skipLinkFix.js │ │ ├── tabindexFix.js │ │ └── underlineFix.js │ └── index.js ├── frontendHighlighterApp │ ├── fixesModal.js │ ├── images │ │ ├── edac-emblem.png │ │ ├── highlight-icon-error.svg │ │ ├── highlight-icon-ignored.svg │ │ ├── highlight-icon-warning.svg │ │ └── ignore-icon.svg │ ├── index.js │ └── sass │ │ └── app.scss └── pageScanner │ ├── checks │ ├── always-fail.js │ ├── anchor-exists.js │ ├── aria-describedby-not-found.js │ ├── aria-hidden-valid-usage.js │ ├── aria-label-not-found.js │ ├── aria-owns-not-found.js │ ├── button-is-empty.js │ ├── element-is-u-tag.js │ ├── element-with-underline.js │ ├── has-ambiguous-text.js │ ├── has-subheadings-if-long-content.js │ ├── has-text-docoration.js │ ├── has-transcript.js │ ├── heading-is-empty.js │ ├── image-input-has-alt.js │ ├── img-alt-empty-check.js │ ├── img-alt-invalid-check.js │ ├── img-alt-long-check.js │ ├── img-alt-missing-check.js │ ├── img-alt-redundant-check.js │ ├── img-animated-check.js │ ├── is-video-detected.js │ ├── link-has-valid-href-or-role.js │ ├── link-is-empty.js │ ├── link-points-to-html.js │ ├── link-target-blank-without-informing.js │ ├── linked-image-alt-not-empty.js │ ├── linked-image-alt-present.js │ ├── longdesc-valid.js │ ├── paragraph-not-empty.js │ ├── paragraph-styled-as-header.js │ ├── slider-detected.js │ ├── table-has-headers.js │ ├── table-header-is-empty.js │ ├── text-is-justified.js │ └── text-size-too-small.js │ ├── config │ ├── exclusions.js │ └── rules.js │ ├── helpers │ ├── density.js │ ├── helpers.js │ └── linkedImageUtils.js │ ├── index.js │ ├── rules │ ├── aria-broken-reference.js │ ├── aria-hidden-validation.js │ ├── broken-anchor-link.js │ ├── color-contrast-failure.js │ ├── custom-rule-1.js │ ├── empty-button.js │ ├── empty-heading-tag.js │ ├── empty-link.js │ ├── empty-paragraph.js │ ├── empty-table-header.js │ ├── extended │ │ └── label.js │ ├── img-alt-empty.js │ ├── img-alt-invalid.js │ ├── img-alt-long.js │ ├── img-alt-missing.js │ ├── img-alt-redundant.js │ ├── img-animated.js │ ├── img-linked-alt-empty.js │ ├── img-linked-alt-missing.js │ ├── link-ambiguous-text.js │ ├── link-improper.js │ ├── link-ms-office-file.js │ ├── link-non-html-file.js │ ├── link-pdf.js │ ├── link_target_blank.js │ ├── long-description-invalid.js │ ├── missing-headings.js │ ├── missing-transcript.js │ ├── possible-heading.js │ ├── slider-present.js │ ├── table-header-missing.js │ ├── text-justified.js │ ├── text-small.js │ ├── underlined-text.js │ └── video-present.js │ └── utils │ └── aria-utils.js ├── tests ├── assets │ ├── animated.gif │ ├── animated.webp │ ├── static.gif │ └── static.webp ├── bin │ └── install-wp-tests.sh ├── bootstrap-dev.php ├── bootstrap.php ├── jest │ ├── babel.config.js │ ├── helpers │ │ └── NormalizedMap.test.js │ ├── jest.config.js │ ├── mock-assets │ │ ├── A-image.gif │ │ ├── A-image.webp │ │ ├── S-1x1.gif │ │ ├── S-animated-in-name.gif │ │ ├── S-animated-in-name.webp │ │ ├── S-image.gif │ │ ├── S-image.jpg │ │ └── S-image.webp │ ├── pageScanner │ │ └── context.test.js │ └── rules │ │ ├── ariaHiddenValid.test.js │ │ ├── brokenAriaReference.test.js │ │ ├── duplicateFormLabel.test.js │ │ ├── emptyButton.test.js │ │ ├── emptyHeading.test.js │ │ ├── emptyLink.test.js │ │ ├── emptyTableHeader.test.js │ │ ├── iframeMissingTitle.test.js │ │ ├── imageMapMissingAltText.test.js │ │ ├── imgAltEmpty.test.js │ │ ├── imgAltInvalid.test.js │ │ ├── imgAltLong.test.js │ │ ├── imgAltMissing.test.js │ │ ├── imgAltRedundant.test.js │ │ ├── imgAnimatedGif.test.js │ │ ├── imgLinkedAltEmpty.test.js │ │ ├── imgLinkedAltMissing.test.js │ │ ├── linkImproper.test.js │ │ ├── linkNonHTMLFile.test.js │ │ ├── longDescriptionInvalid.test.js │ │ ├── missingHeadings.test.js │ │ ├── missingTranscript.test.js │ │ ├── sliderPresent.test.js │ │ ├── tableMissingHeader.test.js │ │ └── videoElementPresent.test.js └── phpunit │ ├── Admin │ ├── AdminNoticesTest.php │ ├── EnqueueAdminTest.php │ ├── HelpersTest.php │ ├── InsertRuleDataTest.php │ ├── MetaBoxesTest.php │ ├── OptIn │ │ └── EmailOptInTest.php │ └── PurgePostDataTest.php │ ├── RegisterRulesTest.php │ ├── TestHelpers │ ├── DatabaseHelpers.php │ └── Mocks │ │ └── Mock_WP_CLI.php │ ├── helper-functions │ ├── CompareStringsTest.php │ └── OrdinalTest.php │ └── includes │ └── classes │ ├── AccessibilityStatementTest.php │ ├── Fixes │ └── FixesManagerTest.php │ ├── SimplifiedSummaryTest.php │ ├── SummaryGeneratorTest.php │ └── WPCLI │ ├── BootstrapCLITest.php │ └── Commands │ ├── DeleteStatsTest.php │ ├── GetSiteStatsTest.php │ └── GetStatsTest.php ├── uninstall.php ├── update-composer-config.php └── webpack.config.js /.editorconfig: -------------------------------------------------------------------------------- 1 | # This file is for unifying the coding style for different editors and IDEs 2 | # editorconfig.org 3 | 4 | # WordPress Coding Standards 5 | # https://make.wordpress.org/core/handbook/coding-standards/ 6 | 7 | root = true 8 | 9 | [*] 10 | charset = utf-8 11 | end_of_line = lf 12 | insert_final_newline = true 13 | trim_trailing_whitespace = true 14 | indent_style = tab 15 | 16 | [*.{yml,yaml}] 17 | indent_style = space 18 | indent_size = 2 19 | 20 | [*.{gradle,java,kt}] 21 | indent_style = space 22 | 23 | [packages/react-native-*/**.xml] 24 | indent_style = space 25 | 26 | -------------------------------------------------------------------------------- /.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "extends": [ "plugin:@wordpress/eslint-plugin/esnext" ], 3 | "env": { 4 | "browser": true, 5 | "node": false, 6 | "jest": true, 7 | }, 8 | "globals": { 9 | "wp": true, 10 | "jQuery": true, 11 | "edac_script_vars": true, 12 | "ajaxurl": true 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/Bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | 5 | --- 6 | 7 | 10 | 11 | * [ ] I've read and understood the [contribution guidelines](https://github.com/equalizedigital/accessibility-checker/blob/develop/.github/CONTRIBUTING.md). 12 | * [ ] I've searched for any related issues and avoided creating a duplicate issue. 13 | 14 | ### Please give us a description of what happened. 15 | 16 | 17 | 18 | 19 | ### Please describe what you expected to happen and why. 20 | 21 | 22 | 23 | 24 | ### How can we reproduce this behavior? 25 | 1. 26 | 2. 27 | 3. 28 | 29 | ### Technical info 30 | * WordPress version: 31 | * Accessibility Checker version: 32 | 33 | * If relevant, which editor is affected (or editors): 34 | - [ ] Classic Editor 35 | - [ ] Gutenberg 36 | - [ ] Classic Editor plugin 37 | - [ ] Page Builder (please specify): 38 | 39 | 40 | * Which browser is affected (or browsers): 41 | - [ ] Internet Explorer 42 | - [ ] Edge 43 | - [ ] Chrome 44 | - [ ] Firefox 45 | - [ ] Safari 46 | - [ ] Brave 47 | 48 | * Relevant plugins in case of a bug: 49 | 50 | * Tested with theme: 51 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/Feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | 5 | --- 6 | 7 | 8 | 9 | ## Is your feature request related to a problem? Please describe. 10 | 11 | ## Describe the solution you'd like 12 | 13 | ## Why do you think this feature is something we should consider for this plugin? 14 | 15 | ## Additional context 16 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: false 2 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | ## Checklist 4 | 5 | - [ ] PR is linked to the main issue in the repo 6 | - [ ] Tests are added that cover changes 7 | -------------------------------------------------------------------------------- /.github/SECURITY.md: -------------------------------------------------------------------------------- 1 | # Security Policy 2 | 3 | ## Reporting a Vulnerability 4 | 5 | You can report any security bugs found in the source code of this plugin through the [Patchstack Vulnerability Disclosure Program](https://patchstack.com/database/vdp/accessibility-checker). The Patchstack team will assist you with verification, CVE assignment and take care of notifying the developers of this plugin. 6 | 7 | ## Responding to Vulnerability Reports 8 | 9 | Equalize Digital takes security bugs seriously. We appreciate your efforts to responsibly disclose your findings, and will make every effort to acknowledge your contributions. Patchstack will work with you and us to deal with the security issue as best as possible. 10 | 11 | ## Disclosing a Vulnerability 12 | 13 | Once an issue is reported, Equalize Digital uses the following disclosure process: 14 | 15 | - When a report is received, we confirm the issue and determine its severity together with Patchstack. 16 | - If we know of specific third-party services or software that require mitigation before publication, those projects will be notified. 17 | - An advisory is prepared (but not published) which details the problem and steps for mitigation. 18 | - Patch releases are published and the advisory is published. 19 | - Release notes and our `changelog.txt` will include a `Security` section with a link to the advisory. 20 | 21 | We credit reporters for identifying vulnerabilities, although we will keep your name confidential if you request it. 22 | -------------------------------------------------------------------------------- /.github/prompts/test-markup.prompt.md: -------------------------------------------------------------------------------- 1 | I have a set of accessibility test cases. Can you generate WordPress block editor markup that I can paste into the editor which matches all these test cases? 2 | 3 | Please follow these guidelines: 4 | 5 | 1. **Separate the test cases into two sections**: 6 | - One for tests expected to **pass** 7 | - One for tests expected to **fail** 8 | 9 | 2. **Use proper HTML hierarchy**: 10 | - Add an `
<title>
' ),
81 | 'upsell' => isset( $this->is_pro ) && $this->is_pro ? false : true,
82 | 'fix_slug' => $this->get_slug(),
83 | 'group_name' => $this->get_nicename(),
84 | 'help_id' => 8490,
85 | ];
86 |
87 | return $fields;
88 | }
89 |
90 | /**
91 | * Run the fix for adding a missing or empty page title.
92 | *
93 | * @return void
94 | */
95 | public function run() {
96 | // Intentionally left empty.
97 | }
98 | }
99 |
--------------------------------------------------------------------------------
/includes/classes/Fixes/Fix/BlockPDFUploadsFix.php:
--------------------------------------------------------------------------------
1 | esc_html__( 'Block PDF Uploads', 'accessibility-checker' ),
69 | 'type' => 'checkbox',
70 | 'labelledby' => 'block_pdf_uploads',
71 | // translators: %1$s: a code tag with the capability name.
72 | 'description' => sprintf( __( 'Restrict PDF uploads for users without the %1$s capability (allowed for admins by default).', 'accessibility-checker' ), 'edac_upload_pdf
' ),
73 | 'upsell' => isset( $this->is_pro ) && $this->is_pro ? false : true,
74 | 'fix_slug' => $this->get_slug(),
75 | 'help_id' => 8486,
76 | ];
77 |
78 | return $fields;
79 | }
80 |
81 | /**
82 | * Run the fix.
83 | */
84 | public function run() {
85 | // Intentionally empty - this run method should be implemented in an extension class.
86 | }
87 | }
88 |
--------------------------------------------------------------------------------
/includes/classes/Fixes/FixInterface.php:
--------------------------------------------------------------------------------
1 | %2$s',
49 | esc_attr__( 'Accessibility Checker (opens in a new window)', 'accessibility-checker' ),
50 | esc_html__( 'Accessibility Checker', 'accessibility-checker' )
51 | )
52 | );
53 | }
54 |
55 | if ( $include_statement_link && $policy_page ) {
56 | $statement .= ( ! empty( $statement ) ? ' ' : '' ) . sprintf(
57 | // translators: %1$s is a link to the accessibility policy page, with text "Accessibility Policy".
58 | esc_html__( 'Read our %s', 'accessibility-checker' ),
59 | '' . esc_html__( 'Accessibility Policy', 'accessibility-checker' ) . '.'
60 | );
61 | }
62 |
63 | return $statement;
64 | }
65 |
66 | /**
67 | * Output accessibility statement
68 | *
69 | * @return void
70 | */
71 | public function output_accessibility_statement() {
72 | $statement = $this->get_accessibility_statement();
73 | if ( ! empty( $statement ) ) {
74 | echo '' . wp_kses_post( $statement ) . '
'; 75 | } 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /includes/classes/class-lazyload-filter.php: -------------------------------------------------------------------------------- 1 | init(); 28 | } else { 29 | $this->init(); 30 | } 31 | 32 | // The REST api must load if admin or not. 33 | $rest_api = new REST_Api(); 34 | $rest_api->init_hooks(); 35 | 36 | $this->register_fixes_manager(); 37 | 38 | // When WP CLI is enabled, load the CLI commands. 39 | if ( defined( 'WP_CLI' ) && WP_CLI ) { 40 | $cli = new BootstrapCLI(); 41 | $cli->register(); 42 | } 43 | } 44 | 45 | /** 46 | * Initialize. 47 | * 48 | * @return void 49 | */ 50 | private function init() { 51 | 52 | add_action( 'wp_enqueue_scripts', [ 'EDAC\Inc\Enqueue_Frontend', 'enqueue' ] ); 53 | 54 | $accessibility_statement = new Accessibility_Statement(); 55 | $accessibility_statement->init_hooks(); 56 | 57 | $simplified_summary = new Simplified_Summary(); 58 | $simplified_summary->init_hooks(); 59 | 60 | $lazyload_filter = new Lazyload_Filter(); 61 | $lazyload_filter->init_hooks(); 62 | } 63 | 64 | /** 65 | * Register the FixesManager. 66 | * 67 | * @return void 68 | */ 69 | public function register_fixes_manager() { 70 | add_action( 'plugins_loaded', [ $this, 'init_fixes_manager' ], 20 ); 71 | } 72 | 73 | /** 74 | * Init the FixesManager. 75 | * 76 | * This is done on the plugins_loaded hook with a priority of 20 to ensure that fixes that 77 | * rely on running early, like on init or before init, can be hooked in and ready to go. 78 | * Fixes should be registered to the manager using the the plugins_loaded hook with a 79 | * priority of less than 20. 80 | * 81 | * @return void 82 | */ 83 | public function init_fixes_manager() { 84 | $fixes_manager = FixesManager::get_instance(); 85 | $fixes_manager->register_fixes(); 86 | add_action( 'rest_api_init', [ $fixes_manager, 'register_rest_routes' ] ); 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /includes/classes/class-simplified-summary.php: -------------------------------------------------------------------------------- 1 | simplified_summary_markup( get_the_ID() ); 40 | $simplified_summary_position = get_option( 'edac_simplified_summary_position', $default = false ); 41 | 42 | if ( $simplified_summary ) { 43 | if ( 'before' === $simplified_summary_position ) { 44 | return $simplified_summary . $content; 45 | } 46 | if ( 'after' === $simplified_summary_position ) { 47 | return $content . $simplified_summary; 48 | } 49 | } 50 | return $content; 51 | } 52 | 53 | /** 54 | * Simplified summary markup 55 | * 56 | * @param int $post Post ID. 57 | * @return string 58 | */ 59 | public function simplified_summary_markup( $post ) { 60 | $simplified_summary = get_post_meta( $post, '_edac_simplified_summary', true ) 61 | ? get_post_meta( $post, '_edac_simplified_summary', true ) 62 | : ''; 63 | 64 | /** 65 | * Filter the heading that gets output before the simplified summary inside an' . wp_kses_post( $simplified_summary ) . '
Short content.
', 19 | shouldPass: true, 20 | }, 21 | { 22 | name: 'Passes with long content and h2 heading', 23 | html: `random string
', 41 | 'string2' => 'RanDom StrIng
', 42 | 'expected' => true, 43 | ], 44 | 'with different html tags' => [ 45 | 'string1' => 'random string
', 46 | 'string2' => 'This is a simplified summary.
', $output ); 53 | $this->assertStringContainsString( '