Extension:WimaAdvertising

From mediawiki.org
This page is a translated version of the page Extension:WimaAdvertising and the translation is 10% complete.
MediaWiki 拡張機能マニュアル
WimaAdvertising
リリースの状態: 安定
実装 外装 , 自分のウィキ , フック
説明 Ads banners defined in LocalSettings.php
作者 WikiMANNia (WikiForMenトーク)
最新バージョン 2.7.0 (2024-04-20)
MediaWiki 1.35+
PHP 7.3.19+
ライセンス GNU 一般公衆利用許諾書 2.0 以降
ダウンロード
http://39.wikimannia.org
  • $wmWimaAdvertising
  • $wmWimaAdvertisingAnonOnly
  • $wmBannerTopCode
  • $wmBannerTopStyle
  • $wmBannerTopType
  • $wmBannerBottomCode
  • $wmBannerBottomStyle
  • $wmBannerBottomType
  • $wmSidebarAd1Code
  • $wmSidebarAd1Type
  • $wmSidebarAd2Code
  • $wmSidebarAd2Type

The WimaAdvertising extension offers four additional advertising blocks to the Cologne Blue , Modern , Monaco , MonoBook , Timeless , Vector skins. The banners are placed in the top and bottom of the wiki and two of them in the sidebar . Google Adsense is supported.

使用

One ad block is located at the top of the "MediaWiki:Sitenotice", a second one below the article text and above the category bar and two more ad blocks in the サイドバー . By entering * AD1 and * AD2 in the MediaWiki:Sidebar , these can be placed individually. If Sitenotice is defined, the TopBanner will be displayed randomly alternating with the Sitenotice message.

インストール

  • ダウンロードして、ファイルをextensions/フォルダー内のWimaAdvertisingという名前のディレクトリ内に配置します。
  • 以下のコードを LocalSettings.php ファイルの末尾に追加します:
    wfLoadExtension( 'WimaAdvertising' );
    
  • Yes 完了 – ウィキの「Special:Version」に移動して、拡張機能が正しくインストールされたことを確認します。

General configuration

Enable advertising. Default is false.

$wmWimaAdvertising = true;

Disable advertising for logged-in users. Default is false.

$wmWimaAdvertisingAnonOnly = true;

Wima web slots

BannerType

Set the type of the banner

  • Possible values: 'advertising', 'blank', 'eventnote', 'hint'
  • Default value: 'advertising'

If set to blank the Portlet will not be labelled.

$wmBannerTopType = "advertising";
$wmBannerBottomType = "blank";
$wmSidebarAd1Type = "eventnote";
$wmSidebarAd2Type = "hint";
The labels above the advertising blocks will be translated into: de, en, es, fr, it, nl, pt, ru

BannerCode

Set a html snippet of the banner.

$wmBannerTopCode = '<a title="Uhren-Wiki" href="https://www.uhren-wiki.net"><img src="https://wikimannia.org/skins/werbung/Werbung - Oben.jpg" width="728" height="92" alt="Werbung" /></a>';
$wmBannerBottomCode = '
Your banner code here.
';
$wmSidebarAd1Code = '<a title="Schwarzbuch Wikipedia" href="https://de.wikimannia.org/Schwarzbuch_Wikipedia"><img src="https://wikimannia.org/werbung/images/130px-Schwarzbuch_Wikipedia.jpg" alt="Schwarzbuch_Wikipedia.jpg" /></a> <p><b>Schwarzbuch Wikipedia</b></p><p class="small">Mobbing, Diffamierung und Falschinformation in der Online-Enzyklopädie, und was jetzt dagegen getan werden muss.</p><p>Im Februar 2020 im <i>Zeitgeist-Verlag</i> erschienen.</p>';
$wmSidebarAd2Code = 'Your banner code here.';

You can also do Google AdSense:

$wmSidebarAd2Code = '<script type="text/javascript"><!--
google_ad_client = "pub-9471398824076666";
/* ID 007 */
google_ad_slot = "3512091103";
google_ad_width = 145;
google_ad_height = 260;
google_language = "en";
google_encoding = "utf8";
// -->
</script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>';

BannerStyle

Set the CSS style specifications for the banner.

$wmBannerTopStyle = 'text-align:center;border:1px solid blue;';
$wmBannerBottomStyle = 'text-align:center;border:1px dotted red;';
$wmSidebarAd1Style = '';
$wmSidebarAd2Style = '';

Google Adsense

Enable advertising. Default is false.

$wmGoogleAdSense = true;

Disable advertising for logged-in users. Default is false.

$wmGoogleAdSenseAnonOnly = true;

The type of the banner here is fix 'advertising'.

Mandatory parameters

// Replace this with your own publisher ID (google_ad_client / data-ad-client)
$wmGoogleAdSenseClient = 'none'; // Client ID for your AdSense script (example: ca-pub-1234546403419693)

(You can get your publisher ID and ad unit ID from the "Get code" page: Get and copy the ad code.)

Optional parameters

Add any of the optional settings below – if your settings deviate from the defaults:

// This can be anything you like. Default is 'none'.
$wmGoogleAdSenseID = 'none';

// Source URL of the AdSense script. No need to change - it can't deviate from the defaults.
$wmGoogleAdSenseSrc = '//pagead2.googlesyndication.com/pagead/show_ads.js';

// Text coding. Default is 'utf8'.
$wmGoogleAdSenseEncoding = "utf8";

// Advertising language. Default is $wgLanguageCode.
$wmGoogleAdSenseLanguage = "en";

Ad units

Define up to four ad units:

$wmGoogleAdSense_AD1= [ 'slotid 1', 145, 260 ];
$wmGoogleAdSense_AD2= [ 'slotid 2', 145, 260 ];
$wmGoogleAdSense_Top= [ 'slotid 3', 145, 260 ];
$wmGoogleAdSense_Bottom = [ 'slotid 4', 145, 260 ];

Replace the first value with your AdSense ad unit ID (google_ad_slot / data-ad-slot) for each ad unit. The Slot ID for your AdSense script is for example 1234580893.

Also specify in the second and third value the width and the height of the AdSense unit, specified in your AdSense account (google_ad_width / data-ad-width, google_ad_height / data-ad-height). Values such as 'auto', '100%', '60%' etc. are accepted.

This example is doing the same as the example above in chapter BannerCode:

$wmWimaAdvertising = false;
$wmGoogleAdSense = true;
$wmGoogleAdSenseClient = 'pub-9471398824076666';
$wmGoogleAdSenseID = 'ID 007';
$wmGoogleAdSense_AD1 = [ '3512091103', 145, 260 ];
$wmGoogleAdSenseSrc = 'https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js';

Hacks for the use with older versions

If your are using version MediaWiki 1.35 or 1.36 you will find advise and documentation outlined in this version of the documenation.

See also

Remarks

  • Branch REL1_25 for MediaWiki 1.23 up to 1.35.
  • Branch REL1_35 for MediaWiki 1.35+.
  • Version 2.1 has added support for Skin vector-2022.
  • Version 2.2 has added support for Skin Timeless.
  • Version 2.3 has added Hook SkinAfterPortlet for supporting MediaWiki 1.35+.
  • Version 2.4 has some Refactoring:
    Changed “configuration schema”, replaced manifest version 1 with version 2 and changed the prefix of the configuration variables from default to wm.
    Replaced class “WimaAdvertisingHooks” (extends “Hooks”) with class implements interfaces.
  • Version 2.4.1 contains a dirty hack for skin Timeless.
  • Version 2.5 places JavaScript for GoogleAdSense in ‎<head> section.
  • The extension was tested with the following MediaWiki versions: 1.35.14, 1.39.7, 1.40.2, 1.41.1
  • Version 2.6 has added support for Skin Monaco.
    Note: To make the Ads in the Sidebar work is the use of a Fork of Skin Monaco needed!

Version 3.0

  • The version 3.0 (alpha) has a new approach, with click-away ads that are fixed and do not disappear when scrolling, and are (largely) independent of the skin.
  • At the moment only tested with MediaWiki version 1.39.1.
  • Download on GitHub (alpha Version)