@@ 81-83 (lines=3) @@ | ||
78 | } |
|
79 | ||
80 | // Keep the file name if there was one. |
|
81 | if ( ! empty( $parsed_url['fragment'] ) ) { |
|
82 | $gist_info['file'] = preg_replace( '/(?:file-)(.+)/', '$1', $parsed_url['fragment'] ); |
|
83 | } |
|
84 | ||
85 | // Keep the unique identifier without any leading or trailing slashes. |
|
86 | if ( ! empty( $parsed_url['path'] ) ) { |
|
@@ 86-90 (lines=5) @@ | ||
83 | } |
|
84 | ||
85 | // Keep the unique identifier without any leading or trailing slashes. |
|
86 | if ( ! empty( $parsed_url['path'] ) ) { |
|
87 | $gist_info['id'] = preg_replace( '/^\/([^\.]+)\./', '$1', $parsed_url['path'] ); |
|
88 | // Overwrite $gist with our identifier to clean it up below. |
|
89 | $gist = $gist_info['id']; |
|
90 | } |
|
91 | } |
|
92 | ||
93 | // Not a URL nor an ID? Look for "username/id", "/username/id", or "id", and only keep the ID. |