Skip to content

Commit

Permalink
Removes calls to add_option and replaces it with update_option where …
Browse files Browse the repository at this point in the history
…appropriate
  • Loading branch information
aristath committed Dec 11, 2023
1 parent 4de277c commit 9a9fd8e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 22 deletions.
21 changes: 5 additions & 16 deletions accessibility-checker.php
Original file line number Diff line number Diff line change
Expand Up @@ -253,11 +253,7 @@ function edac_update_database() {
// Update database version option.
$option_name = 'edac_db_version';
$new_value = EDAC_DB_VERSION;
if ( get_option( $option_name ) !== false ) {
update_option( $option_name, $new_value );
} else {
add_option( $option_name, $new_value );
}
update_option( $option_name, $new_value );
}

/**
Expand Down Expand Up @@ -1069,19 +1065,12 @@ function edac_anww_update_post_meta() {

$option_name = 'edac_anww_update_post_meta';

if ( get_option( $option_name ) === false && EDAC_ANWW_ACTIVE === true ) {

add_option( $option_name, true );

edac_update_post_meta( 'link_blank' );

} elseif ( get_option( $option_name ) === true && EDAC_ANWW_ACTIVE === false ) {

if ( get_option( $option_name ) === false && EDAC_ANWW_ACTIVE ) {
update_option( $option_name, true );
} elseif ( get_option( $option_name ) === true && ! EDAC_ANWW_ACTIVE ) {
delete_option( $option_name );

edac_update_post_meta( 'link_blank' );

}
edac_update_post_meta( 'link_blank' );
}

/**
Expand Down
6 changes: 3 additions & 3 deletions includes/activation.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
*/
function edac_activation() {
// set options.
add_option( 'edac_activation_date', gmdate( 'Y-m-d H:i:s' ) );
add_option( 'edac_post_types', array( 'post', 'page' ) );
add_option( 'edac_simplified_summary_position', 'after' );
update_option( 'edac_activation_date', gmdate( 'Y-m-d H:i:s' ) );
update_option( 'edac_post_types', array( 'post', 'page' ) );
update_option( 'edac_simplified_summary_position', 'after' );

// Sanitize the input.
// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Nonce is not required.
Expand Down
5 changes: 2 additions & 3 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'] ) {
add_option( 'edac_password_protected', true );
update_option( 'edac_password_protected', true );
return;
} else {
delete_option( 'edac_password_protected' );
}
delete_option( 'edac_password_protected' );

// set record check flag on previous error records.
edac_remove_corrected_posts( $post_ID, $post->post_type, $pre = 1, 'php' );
Expand Down

0 comments on commit 9a9fd8e

Please sign in to comment.