mirror of
https://github.com/gnosygnu/xowa.git
synced 2025-06-04 00:14:14 +00:00
Xomw: Add wfUrlencode
This commit is contained in:
parent
4781529d12
commit
2b2f93b766
@ -60,19 +60,6 @@ public class Gfo_url_encoder_ {
|
|||||||
return new Gfo_url_encoder_mkr().Init(Byte_ascii.Percent).Init_common(Bool_.N)
|
return new Gfo_url_encoder_mkr().Init(Byte_ascii.Percent).Init_common(Bool_.N)
|
||||||
.Init__diff__one(Byte_ascii.Space, Byte_ascii.Plus);
|
.Init__diff__one(Byte_ascii.Space, Byte_ascii.Plus);
|
||||||
}
|
}
|
||||||
public static Gfo_url_encoder_mkr New__php_urlencode() {
|
|
||||||
// REF: http://php.net/manual/en/function.urlencode.php;
|
|
||||||
// "Returns a String in which all non-alphanumeric characters except -_. have been replaced with a percent (%) sign followed by two hex digits and spaces encoded as plus (+) signs"
|
|
||||||
return new Gfo_url_encoder_mkr().Init(Byte_ascii.Percent).Init_common(Bool_.Y)
|
|
||||||
.Init__diff__one(Byte_ascii.Space, Byte_ascii.Plus);
|
|
||||||
}
|
|
||||||
public static Gfo_url_encoder_mkr New__php_rawurlencode() {
|
|
||||||
// REF: http://php.net/manual/en/function.rawurlencode.php
|
|
||||||
// "Returns a String in which all non-alphanumeric characters except -_.~ have been replaced with a percent (%) sign followed by two hex digits. "
|
|
||||||
return new Gfo_url_encoder_mkr().Init(Byte_ascii.Percent).Init_common(Bool_.Y)
|
|
||||||
.Init__same__many(Byte_ascii.Tilde)
|
|
||||||
.Init__diff__one(Byte_ascii.Space, Byte_ascii.Plus);
|
|
||||||
}
|
|
||||||
private static Gfo_url_encoder_mkr New__http_url_ttl() {
|
private static Gfo_url_encoder_mkr New__http_url_ttl() {
|
||||||
return new Gfo_url_encoder_mkr().Init(Byte_ascii.Percent).Init_common(Bool_.Y);
|
return new Gfo_url_encoder_mkr().Init(Byte_ascii.Percent).Init_common(Bool_.Y);
|
||||||
}
|
}
|
||||||
@ -103,6 +90,31 @@ public class Gfo_url_encoder_ {
|
|||||||
.Init__diff__one(Byte_ascii.Space, Byte_ascii.Underline)
|
.Init__diff__one(Byte_ascii.Space, Byte_ascii.Underline)
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
public static Gfo_url_encoder_mkr New__php_urlencode() {
|
||||||
|
// REF: http://php.net/manual/en/function.urlencode.php;
|
||||||
|
// "Returns a String in which all non-alphanumeric characters except -_. have been replaced with a percent (%) sign followed by two hex digits and spaces encoded as plus (+) signs"
|
||||||
|
return new Gfo_url_encoder_mkr().Init(Byte_ascii.Percent).Init_common(Bool_.Y)
|
||||||
|
.Init__diff__one(Byte_ascii.Space, Byte_ascii.Plus);
|
||||||
|
}
|
||||||
|
public static Gfo_url_encoder_mkr New__wfUrlencode() {
|
||||||
|
// REF: GlobalFunctions.php|wfUrlencode
|
||||||
|
// same as php_urlencode, but do not encode ";:@$!*(),/~"
|
||||||
|
return new Gfo_url_encoder_mkr().Init(Byte_ascii.Percent).Init_common(Bool_.Y)
|
||||||
|
.Init__diff__one(Byte_ascii.Space, Byte_ascii.Plus)
|
||||||
|
.Init__same__many
|
||||||
|
( Byte_ascii.Semic, Byte_ascii.At, Byte_ascii.Dollar, Byte_ascii.Bang, Byte_ascii.Star
|
||||||
|
, Byte_ascii.Paren_bgn, Byte_ascii.Paren_end, Byte_ascii.Comma, Byte_ascii.Slash
|
||||||
|
, Byte_ascii.Tilde
|
||||||
|
, Byte_ascii.Colon // NOTE: MW doesn't unescape colon if IIS. However, all of WMF servers run on non-IIS boxes, so include this;
|
||||||
|
);
|
||||||
|
}
|
||||||
|
public static Gfo_url_encoder_mkr New__php_rawurlencode() {
|
||||||
|
// REF: http://php.net/manual/en/function.rawurlencode.php
|
||||||
|
// "Returns a String in which all non-alphanumeric characters except -_.~ have been replaced with a percent (%) sign followed by two hex digits. "
|
||||||
|
return new Gfo_url_encoder_mkr().Init(Byte_ascii.Percent).Init_common(Bool_.Y)
|
||||||
|
.Init__same__many(Byte_ascii.Tilde)
|
||||||
|
.Init__diff__one(Byte_ascii.Space, Byte_ascii.Plus);
|
||||||
|
}
|
||||||
public static final Gfo_url_encoder
|
public static final Gfo_url_encoder
|
||||||
Id = Gfo_url_encoder_.New__html_id().Make()
|
Id = Gfo_url_encoder_.New__html_id().Make()
|
||||||
, Href = Gfo_url_encoder_.New__html_href_mw(Bool_.Y).Make()
|
, Href = Gfo_url_encoder_.New__html_href_mw(Bool_.Y).Make()
|
||||||
@ -116,5 +128,6 @@ public class Gfo_url_encoder_ {
|
|||||||
, Mw_ttl = Gfo_url_encoder_.New__mw_ttl().Make()
|
, Mw_ttl = Gfo_url_encoder_.New__mw_ttl().Make()
|
||||||
, Php_urlencode = Gfo_url_encoder_.New__php_urlencode().Make()
|
, Php_urlencode = Gfo_url_encoder_.New__php_urlencode().Make()
|
||||||
, Php_rawurlencode = Gfo_url_encoder_.New__php_rawurlencode().Make()
|
, Php_rawurlencode = Gfo_url_encoder_.New__php_rawurlencode().Make()
|
||||||
|
, Mw_wfUrlencode = Gfo_url_encoder_.New__wfUrlencode().Make()
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -50,8 +50,8 @@ public class XomwTitle {
|
|||||||
/** @var String Text form (spaces not underscores) of the main part */
|
/** @var String Text form (spaces not underscores) of the main part */
|
||||||
private byte[] mTextform = Bry_.Empty;
|
private byte[] mTextform = Bry_.Empty;
|
||||||
|
|
||||||
// /** @var String URL-encoded form of the main part */
|
/** @var String URL-encoded form of the main part */
|
||||||
// public $mUrlform = Bry_.Empty;
|
private byte[] mUrlform = Bry_.Empty;
|
||||||
|
|
||||||
/** @var String Main part with underscores */
|
/** @var String Main part with underscores */
|
||||||
// XO: EX: "Help_talk:A_b" . "A_b"
|
// XO: EX: "Help_talk:A_b" . "A_b"
|
||||||
@ -878,14 +878,14 @@ public class XomwTitle {
|
|||||||
return this.mTextform;
|
return this.mTextform;
|
||||||
}
|
}
|
||||||
|
|
||||||
// /**
|
/**
|
||||||
// * Get the URL-encoded form of the main part
|
* Get the URL-encoded form of the main part
|
||||||
// *
|
*
|
||||||
// * @return String Main part of the title, URL-encoded
|
* @return String Main part of the title, URL-encoded
|
||||||
// */
|
*/
|
||||||
// public function getPartialURL() {
|
public byte[] getPartialURL() {
|
||||||
// return this.mUrlform;
|
return this.mUrlform;
|
||||||
// }
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the main part with underscores
|
* Get the main part with underscores
|
||||||
@ -3376,7 +3376,7 @@ public class XomwTitle {
|
|||||||
this.mUserCaseDBKey = parts.user_case_dbkey;
|
this.mUserCaseDBKey = parts.user_case_dbkey;
|
||||||
|
|
||||||
this.mDbkeyform = parts.dbkey;
|
this.mDbkeyform = parts.dbkey;
|
||||||
// this.mUrlform = wfUrlencode(this.mDbkeyform);
|
this.mUrlform = XomwGlobalFunctions.wfUrlencode(this.mDbkeyform);
|
||||||
this.mTextform = XophpString.strtr(this.mDbkeyform, Byte_ascii.Underline, Byte_ascii.Space);
|
this.mTextform = XophpString.strtr(this.mDbkeyform, Byte_ascii.Underline, Byte_ascii.Space);
|
||||||
|
|
||||||
// We already know that some pages won't be in the database!
|
// We already know that some pages won't be in the database!
|
||||||
@ -4828,12 +4828,12 @@ public class XomwTitle {
|
|||||||
// 'mDefaultNamespace',
|
// 'mDefaultNamespace',
|
||||||
// ];
|
// ];
|
||||||
// }
|
// }
|
||||||
//
|
|
||||||
// public function __wakeup() {
|
// public function __wakeup() {
|
||||||
// this.mArticleID = (this.mNamespace >= 0) ? -1 : 0;
|
// this.mArticleID = (this.mNamespace >= 0) ? -1 : 0;
|
||||||
// this.mUrlform = wfUrlencode(this.mDbkeyform);
|
// this.mUrlform = wfUrlencode(this.mDbkeyform);
|
||||||
// this.mTextform = strtr(this.mDbkeyform, '_', ' ');
|
// this.mTextform = strtr(this.mDbkeyform, '_', ' ');
|
||||||
// }
|
// }
|
||||||
private static final byte[] Bry__wgArticlePath__wiki = Bry_.new_a7("/wiki/");
|
private static final byte[] Bry__wgArticlePath__wiki = Bry_.new_a7("/wiki/");
|
||||||
|
|
||||||
// REF.MW: DefaultSettings.php
|
// REF.MW: DefaultSettings.php
|
||||||
|
Loading…
Reference in New Issue
Block a user