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
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
**Tags:** \
**Requires at least:** 6.4 \
**Tested up to:** 6.5 \
**Requires PHP:** 8.0 \
**Stable tag:** 1.0.0 \
**Requires PHP:** 7.4 \
**Stable tag:** 1.2.0 \
**License:** GPLv3 or later \
**License URI:** http://www.gnu.org/licenses/gpl-3.0.html

Expand All @@ -14,7 +14,7 @@

## Description

Welcome to **Wayback Link Fixer**, a powerful tool designed to enhance your WordPress site by automatically scanning posts for links, retrieving the latest snapshots from the Wayback Machine, and seamlessly replacing broken links with archived versions. This innovative solution ensures that your posts remain resilient against `BITROT` , preserving the integrity of linked content over time.
Welcome to **Wayback Link Fixer**, a powerful tool designed to enhance your WordPress site by automatically scanning posts for links, retrieving the latest snapshots from the Wayback Machine, and seamlessly replacing broken links with archived versions. This innovative solution ensures that your posts remain resilient against `LINKROT` , preserving the integrity of linked content over time.

## Installation

Expand Down
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@
},
"require-dev": {
"a8cteam51/team51-configs": "dev-trunk",
"wp-cli/i18n-command": "^2.4",
"wp-cli/i18n-command": "^2.6",
"squizlabs/php_codesniffer": "3.*",
"dealerdirect/phpcodesniffer-composer-installer": "*",
"roave/security-advisories": "dev-latest",
"php-stubs/wordpress-stubs": "6.6.*",
"php-stubs/wordpress-stubs": "6.8.*",
"phpunit/phpunit": "^8.5 || ^9.4",
"roots/wordpress": "6.6.*",
"wp-phpunit/wp-phpunit": "6.6.*",
"roots/wordpress": "6.8.*",
"wp-phpunit/wp-phpunit": "6.8.*",
"yoast/phpunit-polyfills": "*",
"vlucas/phpdotenv": "<=5.5.0",
"wp-coding-standards/wpcs": "^3",
Expand Down
72 changes: 38 additions & 34 deletions composer.lock

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

27 changes: 27 additions & 0 deletions functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,33 @@ function wpcomsp_wayback_link_fixer_is_archive_link( string $url ): bool {
return false;
}

/**
* Checks if a link is from the current site.
*
* @since 1.3.0
*
* @param string $url The URL to check.
*
* @return boolean
*/
function wpcomsp_wayback_link_fixer_is_current_site_link( string $url ): bool {
// Get the site urls with all protocols.
$site_urls = array(
get_site_url( null, '', 'https' ),
get_site_url( null, '', 'http' ),
);
// Normalize the URL.
$normalized_url = wpcomsp_wayback_link_fixer_normalize_url( $url );

// Check if the URL starts with any of the site URLs.
foreach ( $site_urls as $site_url ) {
if ( 0 === strpos( $normalized_url, $site_url ) ) {
return true;
}
}
return false;
}

/**
* Normalize a URL.
*
Expand Down
Loading