You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 551fe3e
Browse filesBrowse the repository at this point in the historyBrowse files
return$decoded_body->message . PHP_EOL . $decoded_body->documentation_url . PHP_EOL . 'In order to pass the token to WP-CLI, you need to use the GITHUB_TOKEN environment variable.';
1142
1155
}
1156
+
1157
+
/**
1158
+
* Check if a URL is a GitHub Gist page URL (not the raw URL).
1159
+
*
1160
+
* @param string $url The URL to check.
1161
+
* @return string|null The gist ID if it's a gist URL, null otherwise.
1162
+
*/
1163
+
protectedfunctionget_gist_id_from_url( $url ) {
1164
+
// Match gist.github.com URLs but not gist.githubusercontent.com (raw URLs)
1165
+
if ( preg_match( '#^https?://gist\.github\.com/[^/]+/([a-f0-9]+)/?$#i', $url, $matches ) ) {
1166
+
return$matches[1];
1167
+
}
1168
+
returnnull;
1169
+
}
1170
+
1171
+
/**
1172
+
* Convert a GitHub Gist page URL to a raw PHP file URL.
1173
+
*
1174
+
* @param string $gist_id The gist ID.
1175
+
* @return string|WP_Error The raw URL of the first PHP file in the gist, or WP_Error on failure.
0 commit comments