get_imgur_id_from_url( $parsed_url ); if ( false === $attributes['data-imgur-id'] ) { return $return; } $return = AMP_HTML_Utils::build_tag( 'amp-imgur', $attributes ); } return $return; } /** * Get Imgur ID from URL. * * @param array $parsed_url Parsed URL. * @return bool|string ID / false. */ protected function get_imgur_id_from_url( $parsed_url ) { if ( ! preg_match( '#^(?:/(a|gallery))?/([A-Za-z0-9]+)#', $parsed_url['path'], $matches ) ) { return false; } return ! empty( $matches[1] ) ? "a/{$matches[2]}" : $matches[2]; } }