Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hotfix/basic auth fix #457

Merged
merged 6 commits into from
Jan 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions accessibility-checker.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* Plugin Name: Accessibility Checker
* Plugin URI: https://a11ychecker.com
* Description: Audit and check your website for accessibility before you hit publish. In-post accessibility scanner and guidance.
* Version: 1.7.1
* Version: 1.7.1-beta.7
* Author: Equalize Digital
* Author URI: https://equalizedigital.com
* License: GPL-2.0+
Expand Down Expand Up @@ -45,7 +45,7 @@

// Current plugin version.
if ( ! defined( 'EDAC_VERSION' ) ) {
define( 'EDAC_VERSION', '1.7.1' );
define( 'EDAC_VERSION', '1.7.1-beta.7' );
}

// Current database version.
Expand Down Expand Up @@ -834,8 +834,9 @@ function edac_summary_ajax() {
$html['content'] = '';

// password check.
$is_pasword_protected = (bool) get_option( 'edac_password_protected', false );
if ( $is_pasword_protected ) {
if (
(bool) get_option( 'edac_password_protected', false )
) {
$admin_notices = new \EDAC\Admin_Notices();
$notice_text = $admin_notices->edac_password_protected_notice_text();
$html['password_protected'] = $notice_text;
Expand Down
9 changes: 5 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,16 @@
"prefer-stable": true,
"repositories": [
{
"type": "vcs",
"url": "https://github.com/equalizedigital/accessibility-checker-wp-env"
"type": "vcs",
"url": "https://github.com/equalizedigital/accessibility-checker-wp-env"
}
],
],
"require-dev": {
"automattic/vipwpcs": "^3",
"dealerdirect/phpcodesniffer-composer-installer": "^0.7.2",
"phpcompatibility/php-compatibility": "*",
"php-parallel-lint/php-parallel-lint": "^1.3"
"php-parallel-lint/php-parallel-lint": "^1.3",
"equalizedigital/accessibility-checker-wp-env": "*"
},
"require": {
"cbschuld/browser.php": "^1.9",
Expand Down
144 changes: 114 additions & 30 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 9 additions & 16 deletions includes/enqueue-scripts.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,6 @@ function edac_admin_enqueue_scripts() {
$active = false;
}

$headers = array(
'Content-Type' => 'application/json',
'X-WP-Nonce' => wp_create_nonce( 'wp_rest' ),
'Authorization' => 'None',

);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We no longer need to pass auth.


$pro = edac_check_plugin_active( 'accessibility-checker-pro/accessibility-checker-pro.php' ) && EDAC_KEY_VALID;

Expand All @@ -81,16 +75,15 @@ function edac_admin_enqueue_scripts() {
'edac-editor-app',
'edac_editor_app',
array(
'postID' => $post_id,
'edacUrl' => esc_url_raw( get_site_url() ),
'edacHeaders' => $headers,
'edacApiUrl' => esc_url_raw( rest_url() . 'accessibility-checker/v1' ),
'baseurl' => plugin_dir_url( __DIR__ ),
'active' => $active,
'pro' => $pro,
'hasAuth' => (bool) get_option( 'edac_password_protected', false ),
'debug' => $debug,
'scanUrl' => get_preview_post_link(
'postID' => $post_id,
'edacUrl' => esc_url_raw( get_site_url() ),
'edacApiUrl' => esc_url_raw( rest_url() . 'accessibility-checker/v1' ),
'baseurl' => plugin_dir_url( __DIR__ ),
'active' => $active,
'pro' => $pro,
'authOk' => false === (bool) get_option( 'edac_password_protected', false ),
'debug' => $debug,
'scanUrl' => get_preview_post_link(
$post_id,
array( 'edac_pageScanner' => 1 )
),
Expand Down
3 changes: 0 additions & 3 deletions includes/options-page.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,6 @@ function edac_display_welcome_page() {
*/
function edac_display_options_page() {
include_once plugin_dir_path( __DIR__ ) . 'partials/settings-page.php';

// force edac_auth_type to reset in case user updates auth options.
delete_transient( 'edac_auth_type' );
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unnecessary.


/**
Expand Down
10 changes: 4 additions & 6 deletions includes/validate.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,10 @@ function edac_validate( $post_ID, $post, $action ) {
do_action( 'edac_after_get_content', $post_ID, $content, $action );

if ( ! $content['html'] ) {
delete_transient( 'edac_auth_type' );
add_option( 'edac_password_protected', true );
update_option( 'edac_password_protected', true );
return;
} else {
delete_option( 'edac_password_protected' );
update_option( 'edac_password_protected', false );
}

// set record check flag on previous error records.
Expand Down Expand Up @@ -357,9 +356,8 @@ function edac_get_content( $post ) {
// will not be followed, so $content['html] will be false.
$merged_context_opts = array_merge( $default_context_opts, $context_opts );
$context = stream_context_create( $merged_context_opts );

$dom = file_get_html( $url, false, $context );
$content['html'] = edac_remove_elements(
$dom = file_get_html( $url, false, $context );
$content['html'] = edac_remove_elements(
$dom,
array(
'#wpadminbar', // wp admin bar.
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading