Skip to content

Commit 720871d

Browse files
authored
allows you to pick posts that should be ingored, these will not be ch… (#313)
* allows you to pick posts that should be ingored, these will not be checked or even attempt to replace links * Fix simple liniting issues * House Keeping * House Keeping * House Keeping
1 parent 5c1b9a6 commit 720871d

20 files changed

Lines changed: 1442 additions & 89 deletions

README.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,12 @@ Specify links to exclude from being checked. This is useful for links known to b
100100
* `https://example.com/*` - Excludes all links starting with `https://example.com/`
101101
* `https://x.com*` - Excludes all links containing `x/twitter` in the domain name
102102

103+
#### Post Exclusions
104+
105+
![Post Exclusions](./_docs/settings--fixer-post-exclusions.png)
106+
107+
Search for specific posts to exclude from link checking. Outbound links within excluded posts will not be scanned, checked, or replaced on the frontend. Excluded posts are also skipped during batch scanning of existing content. In the post list table, excluded posts display an "Excluded post" label in the Links column. Posts can also be excluded programmatically using the `iawmlf_link_fixer_excluded_posts` filter.
108+
103109
#### Check Frequency
104110

105111
![Check Frequency](./_docs/settings--check-frequency.png)
@@ -625,6 +631,18 @@ add_filter( 'iawmlf_link_exclusions', function( array $exclusions ): array {
625631
});
626632
```
627633

634+
#### `iawmlf_link_fixer_excluded_posts`
635+
636+
This filter allows you to programmatically add post IDs to the link fixer exclusion list. Excluded posts will not have their links scanned or archived.
637+
638+
```php
639+
add_filter( 'iawmlf_link_fixer_excluded_posts', function( array $post_ids ): array {
640+
$post_ids[] = 123;
641+
$post_ids[] = 456;
642+
return $post_ids;
643+
});
644+
```
645+
628646
#### `iawmlf_is_production_environment`
629647

630648
This filter allows you to override the production environment detection. By default, the plugin uses WordPress's `wp_get_environment_type()` function to determine if the site is running in a production environment. You can use this filter to customize this behavior for your specific setup.
@@ -1051,6 +1069,47 @@ add_filter( 'iawmlf_reporting_page_capability', function( string $capability ):
10511069
});
10521070
```
10531071

1072+
#### Action Hooks
1073+
1074+
#### `iawmlf_link_details_after_link_info`
1075+
1076+
This action allows developers to extend the link details admin page by adding additional HTML after the link information section.
1077+
1078+
```php
1079+
add_action( 'iawmlf_link_details_after_link_info', function( Link $link ): void {
1080+
printf( '<p>Custom info: %s</p>', esc_html( $link->get_href() ) );
1081+
});
1082+
```
1083+
1084+
> The `$link` parameter is an instance of `Internet_Archive\Wayback_Machine_Link_Fixer\Link\Link`.
1085+
1086+
#### `iawmlf_before_saving_link_details`
1087+
1088+
This filter runs before the link is persisted to the database when the link details form is submitted. It allows developers to modify the link object or perform custom form handling before the changes are saved.
1089+
1090+
```php
1091+
add_filter( 'iawmlf_before_saving_link_details', function( Link $link ): Link {
1092+
// Perform custom modifications before the link is saved.
1093+
return $link;
1094+
});
1095+
```
1096+
1097+
> This filter runs **before** the link is persisted. Any changes made to the `$link` object here will be included in the save.
1098+
1099+
#### `iawmlf_link_details_updated_redirect_param`
1100+
1101+
This filter controls the "updated" flag used in the redirect after saving link details. Returning a falsy value will suppress the default success notice on the link details page.
1102+
1103+
```php
1104+
add_filter( 'iawmlf_link_details_updated_redirect_param', function( string $updated, Link $link ): string {
1105+
// Suppress the success notice for a specific link.
1106+
if ( strpos( $link->get_href(), 'example.com' ) !== false ) {
1107+
return '';
1108+
}
1109+
return $updated;
1110+
}, 10, 2 );
1111+
```
1112+
10541113
### Internet Archive / Wayback Link Fixer Instances.
10551114

10561115
Both the Link Checker and Snapshot clients are all extended from the following interfaces:
23 KB
Loading

assets/css/src/admin/_report_list.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,4 +60,8 @@
6060

6161
#iawmlf_help_info_bulk_actions {
6262
cursor: pointer;
63+
}
64+
65+
.iawmlf-submit-wrapper {
66+
text-align: right;
6367
}

assets/css/src/admin/_settings.scss

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,3 +129,111 @@
129129
margin: 0;
130130
}
131131
}
132+
133+
// Exclusion list component (post exclusions).
134+
.iawmlf-exclusion-list {
135+
padding: 5px;
136+
border: 1px solid #cfcfcf;
137+
margin: 5px 0;
138+
139+
&__search {
140+
margin-bottom: 10px;
141+
background-color: #cfcfcf;
142+
padding: 10px;
143+
144+
input {
145+
max-width: 100%;
146+
width: -webkit-fill-available;
147+
}
148+
}
149+
150+
&__empty {
151+
text-align: center;
152+
color: #cfcfcf;
153+
}
154+
155+
&__item {
156+
display: flex;
157+
align-items: center;
158+
padding: 6px 8px;
159+
border-bottom: 1px solid #f0f0f0;
160+
161+
&:last-child {
162+
border-bottom: none;
163+
}
164+
}
165+
166+
&__item-title {
167+
flex: 1;
168+
font-size: 13px;
169+
display: -webkit-box;
170+
-webkit-line-clamp: 1;
171+
-webkit-box-orient: vertical;
172+
overflow: hidden;
173+
174+
small {
175+
color: #999;
176+
}
177+
}
178+
179+
&__remove {
180+
margin-left: 10px;
181+
flex-shrink: 0;
182+
}
183+
}
184+
185+
// Post search dropdown (AJAX autocomplete).
186+
.iawmlf-post-search {
187+
position: relative;
188+
189+
&__dropdown {
190+
position: absolute;
191+
top: 100%;
192+
left: 0;
193+
right: 0;
194+
background: #fff;
195+
border: 1px solid #c3c4c7;
196+
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
197+
max-height: 150px;
198+
overflow-y: auto;
199+
z-index: 100;
200+
}
201+
202+
&__item {
203+
padding: 6px 8px;
204+
cursor: pointer;
205+
border-bottom: 1px solid #f0f0f0;
206+
207+
&:last-child {
208+
border-bottom: none;
209+
}
210+
211+
&:hover,
212+
&--active {
213+
background-color: #f0f0f1;
214+
}
215+
216+
mark {
217+
background-color: #fcf4a3;
218+
padding: 0;
219+
}
220+
}
221+
222+
&__item-title {
223+
font-size: 13px;
224+
font-weight: 600;
225+
}
226+
227+
&__item-meta {
228+
font-size: 11px;
229+
color: #999;
230+
}
231+
232+
&__loading,
233+
&__no-results {
234+
padding: 8px;
235+
text-align: center;
236+
color: #999;
237+
font-size: 13px;
238+
}
239+
}

0 commit comments

Comments
 (0)