Index: branches/REL1_18/extensions/OggHandler/OggPlayer.js |
— | — | @@ -51,6 +51,11 @@ |
52 | 52 | * Parameters are: id, videoUrl, width, height, length, linkUrl, isVideo |
53 | 53 | */ |
54 | 54 | 'init': function ( player, params ) { |
| 55 | + // Expand params.videoUrl if protocol-relative |
| 56 | + if ( params.videoUrl.substr( 0, 2 ) == '//' ) { |
| 57 | + // window.location.protocol is something like 'http:' |
| 58 | + params.videoUrl = window.location.protocol + params.videoUrl; |
| 59 | + } |
55 | 60 | elt = document.getElementById( params.id ); |
56 | 61 | |
57 | 62 | // Save still image HTML |
Index: branches/REL1_18/extensions/OggHandler/OggHandler_body.php |
— | — | @@ -443,12 +443,12 @@ |
444 | 444 | } |
445 | 445 | |
446 | 446 | static function getMyScriptPath() { |
447 | | - global $wgScriptPath; |
448 | | - return "$wgScriptPath/extensions/OggHandler"; |
| 447 | + global $wgExtensionAssetsPath; |
| 448 | + return "$wgExtensionAssetsPath/OggHandler"; |
449 | 449 | } |
450 | 450 | |
451 | 451 | function setHeaders( $out ) { |
452 | | - global $wgOggScriptVersion, $wgCortadoJarFile, $wgServer; |
| 452 | + global $wgOggScriptVersion, $wgCortadoJarFile; |
453 | 453 | |
454 | 454 | if ( $out->hasHeadItem( 'OggHandlerScript' ) && $out->hasHeadItem( 'OggHandlerInlineScript' ) && |
455 | 455 | $out->hasHeadItem( 'OggHandlerInlineCSS' ) ) { |
— | — | @@ -466,8 +466,9 @@ |
467 | 467 | $cortadoUrl = $wgCortadoJarFile; |
468 | 468 | $scriptPath = self::getMyScriptPath(); |
469 | 469 | if( substr( $cortadoUrl, 0, 1 ) != '/' |
470 | | - && substr( $cortadoUrl, 0, 4 ) != 'http' ) { |
471 | | - $cortadoUrl = "$wgServer$scriptPath/$cortadoUrl"; |
| 470 | + && substr( $cortadoUrl, 0, 4 ) != 'http' ) |
| 471 | + { |
| 472 | + $cortadoUrl = wfExpandUrl( "$scriptPath/$cortadoUrl", PROTO_CURRENT ); |
472 | 473 | } |
473 | 474 | $encCortadoUrl = Xml::encodeJsVar( $cortadoUrl ); |
474 | 475 | $encExtPathUrl = Xml::encodeJsVar( $scriptPath ); |
— | — | @@ -540,12 +541,7 @@ |
541 | 542 | |
542 | 543 | OggTransformOutput::$serial++; |
543 | 544 | |
544 | | - if ( substr( $this->videoUrl, 0, 4 ) != 'http' ) { |
545 | | - global $wgServer; |
546 | | - $url = $wgServer . $this->videoUrl; |
547 | | - } else { |
548 | | - $url = $this->videoUrl; |
549 | | - } |
| 545 | + $url = wfExpandUrl( $this->videoUrl, PROTO_RELATIVE ); |
550 | 546 | // Normalize values |
551 | 547 | $length = floatval( $this->length ); |
552 | 548 | $width = intval( $this->width ); |
Index: branches/REL1_18/extensions/FlaggedRevs/presentation/FlaggedRevsUI.hooks.php |
— | — | @@ -101,7 +101,15 @@ |
102 | 102 | public static function onBeforePageDisplay( &$out, &$skin ) { |
103 | 103 | if ( $out->getTitle()->getNamespace() != NS_SPECIAL ) { |
104 | 104 | $view = FlaggedPageView::singleton(); |
| 105 | + $view->addStabilizationLink(); // link on protect form |
105 | 106 | $view->displayTag(); // show notice bar/icon in subtitle |
| 107 | + if ( $out->isArticleRelated() ) { |
| 108 | + // Only use this hook if we want to prepend the form. |
| 109 | + // We prepend the form for diffs, so only handle that case here. |
| 110 | + if ( $view->diffRevsAreSet() ) { |
| 111 | + $view->addReviewForm( $out ); // form to be prepended |
| 112 | + } |
| 113 | + } |
106 | 114 | $view->setRobotPolicy(); // set indexing policy |
107 | 115 | self::injectStyleAndJS(); // full CSS/JS |
108 | 116 | } else { |
— | — | @@ -323,9 +331,11 @@ |
324 | 332 | && FlaggedPageView::globalArticleInstance() != null ) |
325 | 333 | { |
326 | 334 | $view = FlaggedPageView::singleton(); |
327 | | - $view->addReviewNotes( $data ); |
328 | | - $view->addReviewForm( $data ); |
329 | | - $view->addStabilizationLink( $data ); |
| 335 | + // Only use this hook if we want to append the form. |
| 336 | + // We *prepend* the form for diffs, so skip that case here. |
| 337 | + if ( !$view->diffRevsAreSet() ) { |
| 338 | + $view->addReviewForm( $data ); // form to be appended |
| 339 | + } |
330 | 340 | } |
331 | 341 | return true; |
332 | 342 | } |
Index: branches/REL1_18/extensions/FlaggedRevs/presentation/FlaggedPageView.php |
— | — | @@ -12,7 +12,6 @@ |
13 | 13 | protected $isDiffFromStable = false; |
14 | 14 | protected $isMultiPageDiff = false; |
15 | 15 | protected $reviewNotice = ''; |
16 | | - protected $reviewNotes = ''; |
17 | 16 | protected $diffNoticeBox = ''; |
18 | 17 | protected $reviewFormRev = false; |
19 | 18 | |
— | — | @@ -44,20 +43,20 @@ |
45 | 44 | * Load the global FlaggedPage instance |
46 | 45 | */ |
47 | 46 | protected function load() { |
48 | | - global $wgOut; |
49 | 47 | if ( !$this->loaded ) { |
50 | 48 | $this->loaded = true; |
51 | 49 | $this->article = self::globalArticleInstance(); |
52 | 50 | if ( $this->article == null ) { |
53 | 51 | throw new MWException( 'FlaggedPageView has no context article!' ); |
54 | 52 | } |
55 | | - $this->out = $wgOut; |
| 53 | + $this->out = RequestContext::getMain()->getOutput(); |
56 | 54 | } |
57 | 55 | } |
58 | 56 | |
59 | 57 | /** |
60 | 58 | * Get the FlaggedPage instance associated with $wgTitle, |
61 | 59 | * or false if there isn't such a title |
| 60 | + * @return FlaggedPage|null |
62 | 61 | */ |
63 | 62 | public static function globalArticleInstance() { |
64 | 63 | $title = RequestContext::getMain()->getTitle(); |
— | — | @@ -67,6 +66,14 @@ |
68 | 67 | return null; |
69 | 68 | } |
70 | 69 | |
| 70 | + /* |
| 71 | + * Check if the old and new diff revs are set for this page view |
| 72 | + * @return bool |
| 73 | + */ |
| 74 | + public function diffRevsAreSet() { |
| 75 | + return (bool)$this->diffRevs; |
| 76 | + } |
| 77 | + |
71 | 78 | /** |
72 | 79 | * Is this web response for a request to view a page where both: |
73 | 80 | * (a) no specific page version was requested via URL params |
— | — | @@ -1044,10 +1051,12 @@ |
1045 | 1052 | } |
1046 | 1053 | |
1047 | 1054 | /** |
1048 | | - * Add review form to pages when necessary |
1049 | | - * on a regular page view (action=view) |
| 1055 | + * Add review form to pages when necessary on a regular page view (action=view). |
| 1056 | + * If $output is an OutputPage then this prepends the form onto it. |
| 1057 | + * If $output is a string then this appends the review form to it. |
| 1058 | + * @param mixed string|OutputPage |
1050 | 1059 | */ |
1051 | | - public function addReviewForm( &$data ) { |
| 1060 | + public function addReviewForm( &$output ) { |
1052 | 1061 | global $wgRequest, $wgUser; |
1053 | 1062 | $this->load(); |
1054 | 1063 | if ( $this->out->isPrintable() ) { |
— | — | @@ -1099,11 +1108,11 @@ |
1100 | 1109 | |
1101 | 1110 | list( $html, $status ) = $form->getHtml(); |
1102 | 1111 | # Diff action: place the form at the top of the page |
1103 | | - if ( $this->diffRevs ) { |
1104 | | - $this->out->prependHTML( $html ); |
| 1112 | + if ( $output instanceof OutputPage ) { |
| 1113 | + $output->prependHTML( $html ); |
1105 | 1114 | # View action: place the form at the bottom of the page |
1106 | 1115 | } else { |
1107 | | - $data .= $html; |
| 1116 | + $output .= $html; |
1108 | 1117 | } |
1109 | 1118 | } |
1110 | 1119 | return true; |
— | — | @@ -1112,7 +1121,7 @@ |
1113 | 1122 | /** |
1114 | 1123 | * Add link to stable version setting to protection form |
1115 | 1124 | */ |
1116 | | - public function addStabilizationLink( &$data ) { |
| 1125 | + public function addStabilizationLink() { |
1117 | 1126 | global $wgRequest; |
1118 | 1127 | $this->load(); |
1119 | 1128 | if ( FlaggedRevs::useProtectionLevels() ) { |
— | — | @@ -1876,16 +1885,4 @@ |
1877 | 1886 | } |
1878 | 1887 | return $editPage->fr_baseRevId; |
1879 | 1888 | } |
1880 | | - |
1881 | | - /** |
1882 | | - * Adds brief review notes to a page. |
1883 | | - * @param OutputPage $out |
1884 | | - */ |
1885 | | - public function addReviewNotes( &$data ) { |
1886 | | - $this->load(); |
1887 | | - if ( $this->reviewNotes ) { |
1888 | | - $data .= $this->reviewNotes; |
1889 | | - } |
1890 | | - return true; |
1891 | | - } |
1892 | 1889 | } |