1
0
mirror of https://github.com/gnosygnu/xowa.git synced 2026-03-02 03:49:30 +00:00

Embeddable: Create core dbs in proper subdirectory

This commit is contained in:
gnosygnu
2017-10-23 20:50:50 -04:00
parent 1336d44f34
commit 66877212bf
4537 changed files with 311750 additions and 0 deletions

View File

@@ -13,3 +13,29 @@ The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.xowa.mediawiki; import gplx.*; import gplx.xowa.*;
import gplx.core.net.*;
public class XophpUrl {
public static final int
PHP_URL_SCHEME = 0
, PHP_URL_HOST = 3
, PHP_URL_PATH = 5
;
public static String parse_url(String url, int type) {
Gfo_url_parser parser = new Gfo_url_parser();
Gfo_url url_itm = parser.Parse(Bry_.new_u8(url));
switch (type) {
case PHP_URL_SCHEME: return String_.new_u8(url_itm.Protocol_bry());
case PHP_URL_HOST: return String_.new_u8(url_itm.Segs__get_at_1st());
case PHP_URL_PATH:
Bry_bfr bfr = Bry_bfr_.New();
byte[][] segs = url_itm.Segs();
int len = segs.length;
for (int i = 1; i < len; i++) {
bfr.Add_byte_slash().Add(segs[i]);
}
return bfr.To_str_and_clear();
default: throw Err_.new_unhandled_default(type);
}
}
}