* cons.
* 'forcearticlepath': Use the article path always, even with a querystring.
* Has compatibility issues on some setups, so avoid wherever possible.
+ * 'http': Force a full URL with http:// as the scheme.
+ * 'https': Force a full URL with https:// as the scheme.
* @return string HTML <a> attribute
*/
public static function link(
$query['action'] = 'edit';
$query['redlink'] = '1';
}
- $ret = $target->getLinkURL( $query );
+
+ if ( in_array( 'http', $options ) ) {
+ $proto = PROTO_HTTP;
+ } elseif ( in_array( 'https', $options ) ) {
+ $proto = PROTO_HTTPS;
+ } else {
+ $proto = PROTO_RELATIVE;
+ }
+
+ $ret = $target->getLinkURL( $query, false, $proto );
wfProfileOut( __METHOD__ );
return $ret;
}
* @param $title Title to link
* @param $query Array query string parameters
* @param $text String text of the link (input is not escaped)
+ * @param $options Options array to pass to Linker
*/
- public function addReturnTo( $title, $query = array(), $text = null ) {
- $this->addLink( array( 'rel' => 'next', 'href' => $title->getFullURL() ) );
+ public function addReturnTo( $title, $query = array(), $text = null, $options = array() ) {
+ if( in_array( 'http', $options ) ) {
+ $proto = PROTO_HTTP;
+ } elseif( in_array( 'https', $options ) ) {
+ $proto = PROTO_HTTPS;
+ } else {
+ $proto = PROTO_RELATIVE;
+ }
+
+ $this->addLink( array( 'rel' => 'next', 'href' => $title->getFullURL( '', false, $proto ) ) );
$link = $this->msg( 'returnto' )->rawParams(
- Linker::link( $title, $text, array(), $query ) )->escaped();
+ Linker::link( $title, $text, array(), $query, $options ) )->escaped();
$this->addHTML( "<p id=\"mw-returnto\">{$link}</p>\n" );
}
*
* See getLocalURL for the arguments.
*
+ * @param $proto Protocol to use; setting this will cause a full URL to be used
* @see self::getLocalURL
* @return String the URL
*/
- public function getLinkURL( $query = '', $query2 = false ) {
+ public function getLinkURL( $query = '', $query2 = false, $proto = PROTO_RELATIVE ) {
wfProfileIn( __METHOD__ );
- if ( $this->isExternal() ) {
- $ret = $this->getFullURL( $query, $query2 );
+ if ( $this->isExternal() || $proto != PROTO_RELATIVE ) {
+ $ret = $this->getFullURL( $query, $query2, $proto );
} elseif ( $this->getPrefixedText() === '' && $this->getFragment() !== '' ) {
$ret = $this->getFragmentForURL();
} else {