Sumit has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/226520

Change subject: WikidataPageBanner prefix all globals with WPB
......................................................................

WikidataPageBanner prefix all globals with WPB

Bug: T106586
Change-Id: Id1d03ebc5ce4ae63f70f267cce7368b8c80ad8fa
---
M WikidataPageBanner.php
M includes/WikidataPageBanner.hooks.php
2 files changed, 18 insertions(+), 18 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikidataPageBanner 
refs/changes/20/226520/1

diff --git a/WikidataPageBanner.php b/WikidataPageBanner.php
index b3566c0..9599f15 100644
--- a/WikidataPageBanner.php
+++ b/WikidataPageBanner.php
@@ -26,13 +26,13 @@
  * $wgPBImage - default pagebanner image file, use only filename, do not 
prefix 'File:',
  * e.g. $wgPBImage = 'Foo.jpg'
  */
-$wgPBImage = "";
-/** $wgBannerNamespace - Namespaces on which to display banner */
-$wgBannerNamespaces = array( NS_MAIN );
-/** $wgStandardSizes - Array of standard predefined screen widths in 
increasing order */
-$wgStandardSizes = array( 320, 640, 1280, 2560 );
+$wgWPBImage = "";
+/** $wgPBNamespace - Namespaces on which to display banner */
+$wgWPBNamespaces = array( NS_MAIN );
+/** $wgPBStandardSizes - Array of standard predefined screen widths in 
increasing order */
+$wgWPBStandardSizes = array( 320, 640, 1280, 2560 );
 /** $wgBannerProperty - Banner property on wikidata which holds commons media 
file */
-$wgBannerProperty = "";
+$wgWPBBannerProperty = "";
 
 /* Setup */
 // autoloader
diff --git a/includes/WikidataPageBanner.hooks.php 
b/includes/WikidataPageBanner.hooks.php
index 3f5886c..3d89309 100644
--- a/includes/WikidataPageBanner.hooks.php
+++ b/includes/WikidataPageBanner.hooks.php
@@ -9,7 +9,7 @@
         * @return  bool
         */
        public static function addBanner( $out, $skin ) {
-               global $wgPBImage, $wgBannerNamespaces;
+               global $wgWPBImage, $wgWPBNamespaces;
                $title = $out->getTitle();
                // if banner-options are set, add banner anyway
                if ( $out->getProperty( 'wpb-banner-options' ) !== null ) {
@@ -41,13 +41,13 @@
                elseif ( $title->isKnown() && $out->isArticle() ) {
                        $ns = $title->getNamespace();
                        // banner only on specified namespaces, and not Main 
Page of wiki
-                       if ( in_array( $ns, $wgBannerNamespaces )
+                       if ( in_array( $ns, $wgWPBNamespaces )
                                && !$title->isMainPage() ) {
                                // first try to obtain bannername from Wikidata
                                $bannername = static::getWikidataBanner( $title 
);
                                if ( $bannername === null ) {
                                        // if Wikidata banner not found, set 
bannername to default banner
-                                       $bannername = $wgPBImage;
+                                       $bannername = $wgWPBImage;
                                }
                                // add title to template parameters
                                $paramsForBannerTemplate = array( 'title' => 
$title );
@@ -103,7 +103,7 @@
         * @return output
         */
        public static function addCustomBanner( $parser, $bannername ) {
-               global $wgBannerNamespaces;
+               global $wgWPBNamespaces;
                // @var array to get arguments passed to {{PAGEBANNER}} function
                $argumentsFromParserFunction = array();
                // @var array to hold parameters to be passed to banner template
@@ -116,7 +116,7 @@
                $banner = '';
                $title = $parser->getTitle();
                $ns = $title->getNamespace();
-               if ( in_array( $ns, $wgBannerNamespaces ) && 
!$title->isMainPage() ) {
+               if ( in_array( $ns, $wgWPBNamespaces ) && !$title->isMainPage() 
) {
                        // set title and tooltip attribute to default title
                        $paramsForBannerTemplate['tooltip'] = $title->getText();
                        $paramsForBannerTemplate['title'] = $title->getText();
@@ -181,7 +181,7 @@
         * @return string|null Html code of the banner or null if invalid 
bannername
         */
        public static function getBannerHtml( $bannername, $options = array() ) 
{
-               global $wgStandardSizes, $wgArticlePath;
+               global $wgWPBStandardSizes, $wgArticlePath;
                $urls = static::getStandardSizeUrls( $bannername );
                $banner = null;
                /** @var String srcset attribute for <img> element of banner 
image */
@@ -191,7 +191,7 @@
                        // @var int index variable
                        $i = 0;
                        foreach ( $urls as $url ) {
-                               $size = $wgStandardSizes[$i];
+                               $size = $wgWPBStandardSizes[$i];
                                // add url with width and a comma if not adding 
the last url
                                if ( $i < count( $urls ) ) {
                                        $srcset[] = "$url {$size}w";
@@ -229,15 +229,15 @@
 
        /**
         * WikidataPageBanner::getStandardSizeUrls
-        * returns an array of urls of standard image sizes defined by 
$wgStandardSizes
+        * returns an array of urls of standard image sizes defined by 
$wgWPBStandardSizes
         *
         * @param  String $filename Name of Image file
         * @return array
         */
        public static function getStandardSizeUrls( $filename ) {
-               global $wgStandardSizes;
+               global $wgWPBStandardSizes;
                $urlSet = array();
-               foreach ( $wgStandardSizes as $size ) {
+               foreach ( $wgWPBStandardSizes as $size ) {
                        $url = static::getImageUrl( $filename, $size );
                        // prevent duplication in urlSet
                        if ( $url !== null && !in_array( $url, $urlSet, true ) 
) {
@@ -255,7 +255,7 @@
         * or null if none found
         */
        public static function getWikidataBanner( $title ) {
-               global $wgBannerProperty;
+               global $wgWPBBannerProperty;
                $banner = null;
                // Ensure Wikibase client is installed
                if ( class_exists( 'Wikibase\Client\WikibaseClient' ) ) {
@@ -272,7 +272,7 @@
                                $item = $entityLookup->getEntity( $itemId );
                                $statements = 
$item->getStatements()->getByPropertyId(
                                                new 
Wikibase\DataModel\Entity\PropertyId(
-                                                       $wgBannerProperty
+                                                       $wgWPBBannerProperty
                                                )
                                        )->getBestStatements();
                                if ( !$statements->isEmpty() ) {

-- 
To view, visit https://gerrit.wikimedia.org/r/226520
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id1d03ebc5ce4ae63f70f267cce7368b8c80ad8fa
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/WikidataPageBanner
Gerrit-Branch: master
Gerrit-Owner: Sumit <asthana.sumi...@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to