Skip to content
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
2 changes: 1 addition & 1 deletion functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ function iawmlf_render_not_authenticated_notice(): void {
// If the archive api is not configured.
if ( ! Settings::is_archive_api_configured() ) {
?>
<div class="notice notice-error">
<div class="notice notice-error is-dismissible">
<p>
<?php echo esc_html( $in_unauthenticated_mode ); ?>
</p>
Expand Down
1 change: 0 additions & 1 deletion src/Dashboard/Report_Page.php
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,6 @@ private function render_list_page(): void {

// Render any notices.
$table->render_notices();
iawmlf_render_not_authenticated_notice();

// Get the current page.
$current_page = isset( $_REQUEST['page'] ) ? \sanitize_text_field( wp_unslash( $_REQUEST['page'] ) ) : self::SLUG; // phpcs:ignore WordPress.Security.NonceVerification.Recommended, Can be linked, so no nonce possible.
Expand Down
11 changes: 9 additions & 2 deletions src/Dashboard/Settings_Page.php
Original file line number Diff line number Diff line change
Expand Up @@ -567,14 +567,16 @@ function () {
array( 'class' => Settings::is_link_processing_enabled() ? 'iawmlf_toggle_setting__fixer' : 'iawmlf_toggle_setting__fixer hidden' )
);

$empty_api_creds = '' === Settings::get_archive_access_key() && '' === Settings::get_archive_secret_key();

add_settings_field(
Settings::ARCHIVE_ORG_ACCESS_KEY,
__( 'Archive.org Access Key', 'internet-archive-wayback-machine-link-fixer' ),
array( $this, 'render_archive_api_access_key' ),
self::PAGE_SLUG,
self::GROUP_IA_SETTINGS,
array(
'class' => Settings::has_valid_archive_api_credentials() ? '' : 'iawmlf_toggle_setting__invalid_api_keys',
'class' => Settings::has_valid_archive_api_credentials() || $empty_api_creds ? '' : 'iawmlf_toggle_setting__invalid_api_keys',
)
);

Expand All @@ -585,7 +587,7 @@ function () {
self::PAGE_SLUG,
self::GROUP_IA_SETTINGS,
array(
'class' => Settings::has_valid_archive_api_credentials() ? '' : 'iawmlf_toggle_setting__invalid_api_keys',
'class' => Settings::has_valid_archive_api_credentials() || $empty_api_creds ? '' : 'iawmlf_toggle_setting__invalid_api_keys',
)
);

Expand Down Expand Up @@ -633,6 +635,11 @@ function () {
* @return string
*/
public function render_invalid_api_keys_message(): string {
// If both keys are empty, do not show any message.
if ( '' === Settings::get_archive_access_key() && '' === Settings::get_archive_secret_key() ) {
return '';
}

if ( ! Settings::has_valid_archive_api_credentials() ) {
return '<div id="invalid_api_creds"><p class="description">' . esc_html__( 'The Archive.org API keys are invalid. Please check your settings.', 'internet-archive-wayback-machine-link-fixer' ) . '</p></div>' .
'<div id="unchecked_api_creds" style="display: none;"><p class="description">' . esc_html__( 'API credentials will be verified when you save the settings.', 'internet-archive-wayback-machine-link-fixer' ) . '</p></div>';
Expand Down
6 changes: 0 additions & 6 deletions templates/admin/dashboard/widget.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,6 @@
?>

<div class="iawmlf_dashboard-wrapper">
<?php if ( ! $iawmlf_api_configured ) : ?>
<div class="iawmlf_dashboard-warning">
<?php esc_html_e( 'You are using Link Fixer in unauthenticated mode, which restricts you to 4000 new snapshots per day. To unlock higher limits, please enter your API credentials to authenticate with Archive.org.', 'internet-archive-wayback-machine-link-fixer' ); ?>
</div>
<?php endif; ?>

<?php if ( $iawmlf_api_configured && ! \Internet_Archive\Wayback_Machine_Link_Fixer\Settings\Settings::has_valid_archive_api_credentials() ) : ?>
<div class="iawmlf_dashboard-warning">
<?php esc_html_e( 'Your Archive.org API credentials are invalid. Please check your settings.', 'internet-archive-wayback-machine-link-fixer' ); ?>
Expand Down
3 changes: 1 addition & 2 deletions templates/admin/wizard/step-1.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
</div>

<div class="iawmlf-wizard__content__intro">
<p><?php esc_html_e( 'To archive more than 4000 links from your site to the Wayback Machine per day, you\'ll need a free archive.org account. Once you have your account, enter the API Access Key and Secret Key below.', 'internet-archive-wayback-machine-link-fixer' ); ?>
<p><?php esc_html_e( 'To archive more than 4000 links from your site to the Wayback Machine per day, you\'ll need a free archive.org account. Once you have your account, enter the API Access Key and Secret Key below. (Optional)', 'internet-archive-wayback-machine-link-fixer' ); ?>
<br /><a href="https://archive.org/account/s3.php" target="_blank"><?php esc_html_e( 'Get your API keys here.', 'internet-archive-wayback-machine-link-fixer' ); ?></a></p>
</div>

Expand All @@ -52,5 +52,4 @@
<input type="<?php echo esc_html( $iawmlf_secret_type ); ?>" name="iawmlf_wizard_archive_secret_key" value="<?php echo esc_attr( $iawmlf_existing_secret_key ); ?>"<?php echo $iawmlf_invalid_keys ? ' class="invalid"' : ''; ?>/>
</div>


<?php echo wp_kses( $footer, \Internet_Archive\Wayback_Machine_Link_Fixer\Util\Esc::wizard_allowed_tags() ); ?>