Skip to content

Commit db6ffae

Browse files
committed
Cleaned up code. More links.
1 parent ec4b2f2 commit db6ffae

File tree

3 files changed

+45
-11
lines changed

3 files changed

+45
-11
lines changed

index.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,15 @@
2626
header( 'Cache-Control: max-age=3600', true );
2727
header( 'Pragma: public' );
2828

29-
if ( ( $_GET['error'] ?? false ) ) {
29+
if ( $_GET['error'] ?? false ) {
3030
header( 'X-Robots-Tag: noindex, follow', true );
3131
header( 'Cache-Control: max-age=60', true );
3232
http_response_code( 503 );
3333
require __DIR__ . DIRECTORY_SEPARATOR . '503.html';
3434
exit;
3535
}
3636

37-
function retry(): void {
37+
function retry() {
3838
$retry = (int) ( $_GET['r'] ?? 0 ) + 1;
3939

4040
if ( $retry > 3 ) {
@@ -68,7 +68,7 @@ function retry(): void {
6868

6969
$r = array_values( array_filter( explode( '/', $request ) ) );
7070

71-
function find_endpoint( stdClass $json, array $r ): string {
71+
function find_endpoint( $json, $r ) {
7272

7373
$default = '';
7474
$depth = 0;
@@ -87,7 +87,7 @@ function find_endpoint( stdClass $json, array $r ): string {
8787
if ( false !== strpos( $_endpoint, '$$' ) ) {
8888
// Wildcard replacement.
8989
$_items = array_slice( $r, $depth );
90-
$next = str_replace( '$$', implode( '/', $_items ), $_json );
90+
$next = str_replace( '$$', implode( '/', $_items ), $_json );
9191
} else {
9292
// Prudent replacement.
9393
$next = str_replace( '$', $r[ $depth ], $_json );

links.json

Lines changed: 39 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@
5050
"install-em": "https://kb.theseoframework.com/kb/how-to-install-the-extension-manager/",
5151
"common-update-issues": "https://kb.theseoframework.com/kb/common-plugin-update-issues/",
5252
"pixelcounter": "https://kb.theseoframework.com/kb/what-are-pixel-counters/",
53-
"structureddata": "https://kb.theseoframework.com/kb/structured-data-supported-by-the-seo-framework/"
53+
"structureddata": "https://kb.theseoframework.com/kb/structured-data-supported-by-the-seo-framework/",
54+
"data": "https://kb.theseoframework.com/kb/data-stored-in-your-database/"
5455
},
5556
"_default": "https://kb.theseoframework.com/kb/"
5657
},
@@ -97,6 +98,7 @@
9798
},
9899
"github": {
99100
"_alt": [
101+
"g",
100102
"gh",
101103
"git"
102104
],
@@ -117,8 +119,19 @@
117119
"_default": "https://github.com/lebaux"
118120
},
119121
"tsf": {
122+
"_alt": [
123+
"t"
124+
],
120125
"_deep": {
121-
"$$": "https://github.com/sybrew/the-seo-framework/$$"
126+
"$$": "https://github.com/sybrew/the-seo-framework/$$",
127+
"version": {
128+
"_deep": {
129+
"$$": "https://github.com/sybrew/the-seo-framework/blob/$$"
130+
},
131+
"_alt": [
132+
"v"
133+
]
134+
}
122135
},
123136
"_default": "https://github.com/sybrew/the-seo-framework"
124137
},
@@ -250,7 +263,7 @@
250263
"_deep": {
251264
"premium": "https://premium.theseoframework.com/support/"
252265
},
253-
"_default": "https://theseoframework.com/contact/"
266+
"_default": "https://theseoframework.com/support/contact/"
254267
},
255268
"support": {
256269
"_deep": {
@@ -284,7 +297,7 @@
284297
"public-em"
285298
],
286299
"_deep": {
287-
"private": "https://theseoframework.com/contact/"
300+
"private": "https://theseoframework.com/support/contact/"
288301
},
289302
"_default": "https://github.com/sybrew/The-SEO-Framework-Extension-Manager/issues/new/choose"
290303
},
@@ -298,7 +311,7 @@
298311
"_alt": [
299312
"email"
300313
],
301-
"_default": "https://theseoframework.com/contact/"
314+
"_default": "https://theseoframework.com/support/contact/"
302315
}
303316
},
304317
"_default": "https://theseoframework.com/support/"
@@ -335,5 +348,26 @@
335348
}
336349
},
337350
"_default": "https://twitter.com/TheSEOFramework"
351+
},
352+
"snippets": {
353+
"_alt": [
354+
"snippet"
355+
],
356+
"_deep": {
357+
"install": {
358+
"_alt": [
359+
"install-guide",
360+
"how-to-use"
361+
],
362+
"_default": "https://github.com/sybrew/tsf-snippets/blob/main/README.md#how-to-install-a-snippet"
363+
},
364+
"get": {
365+
"_deep": {
366+
"$$": "https://dl.theseoframework.com/get/snippet/$$"
367+
}
368+
},
369+
"$$": "https://github.com/sybrew/tsf-snippets/tree/main/$$"
370+
},
371+
"_default": "https://github.com/sybrew/tsf-snippets"
338372
}
339373
}

links.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ function make_alt_link( array $basepoints, string $altendpoint, string $altfor,
191191
</head>
192192
<body>
193193
<main>
194-
<h1><a href=https://tsf.fyi/links.php><?php echo $icon; ?>TSF.fyi</a> registered endpoints</h1>
194+
<h1><a href=https://tsf.fyi/links.php><?= $icon ?>TSF.fyi</a> registered endpoints</h1>
195195
<p>
196196
<em><strong>$</strong> = single directory wildcard. <strong>$$</strong> = unlimited directory wildcard.</em><br>
197197
<em>Bolded endpoints are canonical, others are alternatives; either may trickle down for deeper links.</em>
@@ -257,7 +257,7 @@ function make_alt_link( array $basepoints, string $altendpoint, string $altfor,
257257
[
258258
'<a href=https://theseoframework.com/>The SEO Framework</a>',
259259
(int) abs( ( hrtime( true ) - $timer ) / 1e3 ),
260-
bin2hex( random_bytes( 16 ) ),
260+
bin2hex( random_bytes( 16 ) ), // This doesn't do anything useful but show that every request is unique.
261261
]
262262
);
263263
?>

0 commit comments

Comments
 (0)