https://www.mediawiki.org/wiki/Special:Code/MediaWiki/113785

Revision: 113785
Author:   saper
Date:     2012-03-13 23:20:25 +0000 (Tue, 13 Mar 2012)
Log Message:
-----------
Followup-To: r113740 $wgScriptPath/extensions/ => $wgExtensionAssetsPath

Per code review

Modified Paths:
--------------
    trunk/extensions/Collection/Collection.body.php
    trunk/extensions/Collection/Collection.hooks.php
    trunk/extensions/Collection/Collection.php
    trunk/extensions/Collection/Collection.templates.php

Modified: trunk/extensions/Collection/Collection.body.php
===================================================================
--- trunk/extensions/Collection/Collection.body.php     2012-03-13 23:13:35 UTC 
(rev 113784)
+++ trunk/extensions/Collection/Collection.body.php     2012-03-13 23:20:25 UTC 
(rev 113785)
@@ -1255,4 +1255,16 @@
                return $json_response;
        }
 
+       /**
+        * @return string URL prefix to images
+        */
+       static function getMediaPath() {
+               if ( isset ( $GLOBALS['wgExtensionAssetsPath'] ) ) {
+                       return $GLOBALS['wgExtensionAssetsPath'] . 
'/Collection/images/';
+               } else {
+                       return $GLOBALS['wgScriptPath'] . 
'/extensions/Collection/images/';
+               }
+
+       }
+
 }

Modified: trunk/extensions/Collection/Collection.hooks.php
===================================================================
--- trunk/extensions/Collection/Collection.hooks.php    2012-03-13 23:13:35 UTC 
(rev 113784)
+++ trunk/extensions/Collection/Collection.hooks.php    2012-03-13 23:20:25 UTC 
(rev 113785)
@@ -234,10 +234,9 @@
        static function renderBookCreatorBox( $title, $mode = '' ) {
                global $wgCollectionStyleVersion;
                global $wgOut;
-               global $wgScriptPath;
                global $wgRequest;
 
-               $imagePath = "$wgScriptPath/extensions/Collection/images";
+               $imagePath = SpecialCollection::getMediaPath();
                $ptext = $title->getPrefixedText();
                $oldid = $wgRequest->getVal( 'oldid', 0 );
                if ( $oldid == $title->getLatestRevID() ) {
@@ -318,10 +317,8 @@
        }
 
        static function getBookCreatorBoxContent( $title, $ajaxHint = null, 
$oldid = null ) {
-               global $wgScriptPath;
+               $imagePath = SpecialCollection::getMediaPath();
 
-               $imagePath = "$wgScriptPath/extensions/Collection/images";
-
                return self::getBookCreatorBoxAddRemoveLink( $imagePath, 
$ajaxHint, $title, $oldid )
                        . self::getBookCreatorBoxShowBookLink( $imagePath, 
$ajaxHint )
                        . self::getBookCreatorBoxSuggestLink( $imagePath, 
$ajaxHint );

Modified: trunk/extensions/Collection/Collection.php
===================================================================
--- trunk/extensions/Collection/Collection.php  2012-03-13 23:13:35 UTC (rev 
113784)
+++ trunk/extensions/Collection/Collection.php  2012-03-13 23:20:25 UTC (rev 
113785)
@@ -370,10 +370,8 @@
 $wgAjaxExportList[] = 'wfAjaxCollectionClear';
 
 function wfAjaxCollectionGetPopupData( $title ) {
-       global $wgScriptPath;
-
        $result = array();
-       $imagePath = "$wgScriptPath/extensions/Collection/images";
+       $imagePath = SpecialCollection::getMediaPath();
        $t = Title::newFromText( $title );
        if ( $t && $t->isRedirect() ) {
                $a = new Article( $t, 0 );

Modified: trunk/extensions/Collection/Collection.templates.php
===================================================================
--- trunk/extensions/Collection/Collection.templates.php        2012-03-13 
23:13:35 UTC (rev 113784)
+++ trunk/extensions/Collection/Collection.templates.php        2012-03-13 
23:20:25 UTC (rev 113785)
@@ -12,7 +12,7 @@
  */
 class CollectionPageTemplate extends QuickTemplate {
        function execute() {
-               $mediapath = $GLOBALS['wgExtensionAssetsPath'] . 
'/Collection/images/';
+               $mediapath = SpecialCollection::getMediaPath();
 ?>
 
 <div class="collection-column collection-column-left">
@@ -202,7 +202,7 @@
  */
 class CollectionListTemplate extends QuickTemplate {
        function execute() {
-               $mediapath = $GLOBALS['wgScriptPath'] . 
'/extensions/Collection/images/';
+               $mediapath = SpecialCollection::getMediaPath();
 ?>
 
 <div class="collection-create-chapter-links">
@@ -453,9 +453,9 @@
 
        // needed for Ajax functions
        function getProposalList () {
-               global $wgScript, $wgScriptPath;
+               global $wgScript;
 
-               $mediapath = $wgScriptPath . '/extensions/Collection/images/';
+               $mediapath = SpecialCollection::getMediaPath();
                $baseUrl = $wgScript . "/";
 
                $prop = $this->data['proposals'];
@@ -492,7 +492,7 @@
 
        // needed for Ajax functions
        function getMemberList() {
-               $mediapath = $GLOBALS['wgScriptPath'] . 
'/extensions/Collection/images/';
+               $mediapath = SpecialCollection::getMediaPath();
                $coll = $this->data['collection'];
                $out = '';
 


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to