| @@ -17,10 +17,10 @@ | ||
| 17 | 17 | * @return string REST URL relative to this plugin's namespace. |
| 18 | 18 | */ |
| 19 | 19 | function get_rest_url_by_path( $path = '' ) { |
| 20 | 20 | // We'll handle the leading slash. |
| 21 | - $path = \ltrim( $path, '/' ); | |
| 22 | - $namespaced_path = \sprintf( '/%s/%s', ACTIVITYPUB_REST_NAMESPACE, $path ); | |
| 21 | + $path = ltrim( $path, '/' ); | |
| 22 | + $namespaced_path = sprintf( '/%s/%s', ACTIVITYPUB_REST_NAMESPACE, $path ); | |
| 23 | 23 | return \get_rest_url( null, $namespaced_path ); |
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | /** |
| @@ -50,28 +50,8 @@ | ||
| 50 | 50 | return \preg_replace( '/^www\./', '', $host ); |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | /** |
| 54 | - * Fold a host to its canonical spelling for comparison. | |
| 55 | - * | |
| 56 | - * Hosts are case-insensitive, IPv6 literals are bracketed in a URI but not in a stored host, | |
| 57 | - * and a trailing dot is the same fully qualified name. Two spellings that differ only in those | |
| 58 | - * ways address the same host, so anything comparing hosts has to fold them first. | |
| 59 | - * | |
| 60 | - * Unlike {@see normalize_host()} this is lossless: it does not strip `www.`, which is a | |
| 61 | - * different host rather than a different spelling of one. | |
| 62 | - * | |
| 63 | - * @since 9.3.0 | |
| 64 | - * | |
| 65 | - * @param string $host The host. | |
| 66 | - * | |
| 67 | - * @return string The folded host. | |
| 68 | - */ | |
| 69 | -function fold_host( $host ) { | |
| 70 | - return \rtrim( \trim( \strtolower( (string) $host ), '[]' ), '.' ); | |
| 71 | -} | |
| 72 | - | |
| 73 | -/** | |
| 74 | 54 | * Check if a URL is from the same domain as the site. |
| 75 | 55 | * |
| 76 | 56 | * @param string $url The URL to check. |
| 77 | 57 | * |
| @@ -109,9 +89,9 @@ | ||
| 109 | 89 | * Early filter to allow plugins to set the upload base URL. |
| 110 | 90 | * |
| 111 | 91 | * @param string|false $maybe_upload_dir The upload base URL or false if not set. |
| 112 | 92 | */ |
| 113 | - $maybe_upload_dir = \apply_filters( 'pre_activitypub_get_upload_baseurl', false ); | |
| 93 | + $maybe_upload_dir = apply_filters( 'pre_activitypub_get_upload_baseurl', false ); | |
| 114 | 94 | if ( false !== $maybe_upload_dir ) { |
| 115 | 95 | return $maybe_upload_dir; |
| 116 | 96 | } |
| 117 | 97 | |
| @@ -121,9 +101,9 @@ | ||
| 121 | 101 | * Filters the upload base URL. |
| 122 | 102 | * |
| 123 | 103 | * @param string $upload_dir The upload base URL. Default \wp_get_upload_dir()['baseurl'] |
| 124 | 104 | */ |
| 125 | - return \apply_filters( 'activitypub_get_upload_baseurl', $upload_dir['baseurl'] ); | |
| 105 | + return apply_filters( 'activitypub_get_upload_baseurl', $upload_dir['baseurl'] ); | |
| 126 | 106 | } |
| 127 | 107 | |
| 128 | 108 | /** |
| 129 | 109 | * Get the authority (scheme + host) from a URL. |
| @@ -132,9 +112,9 @@ | ||
| 132 | 112 | * |
| 133 | 113 | * @return string|false The authority, or false on failure. |
| 134 | 114 | */ |
| 135 | 115 | function get_url_authority( $url ) { |
| 136 | - $parsed = \wp_parse_url( $url ); | |
| 116 | + $parsed = wp_parse_url( $url ); | |
| 137 | 117 | |
| 138 | 118 | if ( ! $parsed || empty( $parsed['scheme'] ) || empty( $parsed['host'] ) ) { |
| 139 | 119 | return false; |
| 140 | 120 | } |
| @@ -175,9 +155,9 @@ | ||
| 175 | 155 | \strpos( $name, '@' ) === 0 |
| 176 | 156 | ) { |
| 177 | 157 | // Expected: user@example.com or acct:user@example (WebFinger). |
| 178 | 158 | $name = \ltrim( $name, '@' ); |
| 179 | - if ( \str_starts_with( $name, 'acct:' ) ) { | |
| 159 | + if ( str_starts_with( $name, 'acct:' ) ) { | |
| 180 | 160 | $name = \substr( $name, 5 ); |
| 181 | 161 | } |
| 182 | 162 | $parts = \explode( '@', $name ); |
| 183 | 163 | $name = $parts[0]; |