steam.inc.php

サマリSteam埋め込みウィジェットを表示
リビジョン1.01
対応バージョン1.5.3
投稿者M.Taniguchi
投稿日2020-04-25 (土) 17:23:39

概要

Steam埋め込みウィジェットを表示するプラグイン。

使い方

#steam(製品ID[,紹介文])

使用例

#steam(123456,最高のFPS!)

コード

steam.inc.php
(下記のコードをコピーして、plugin ディレクトリに steam.inc.php というファイル名で保存してください)

<?php
/*
PukiWiki - Yet another WikiWikiWeb clone.
steam.inc.php, v1.01 2020 M.Taniguchi
License: GPL v3 or (at your option) any later version

Steam埋め込みウィジェットを表示するプラグイン。

【使い方】
#readingtime(製品ID[,紹介文])

製品ID … Steam内対象ソフトのストアページURL「//store.steampowered.com/app/123456/Hoge/」における「123456」部分の数字
紹介文 … 任意の文字列。省略すると各ソフト既定の紹介文が表示される

【使用例】
#readingtime(123456,最高のFPS!)
*/

define('PLUGIN_STEAM_WIDGET_ATTRIBUTES', 'frameborder="0" width="646" height="190"');	// ウィジェットiframe要素の属性(公式ウィジェット仕様に合わせておくこと)
define('PLUGIN_STEAM_INTRO_MAXLEN', 375);	// 紹介文の最大文字数(公式ウィジェット仕様に合わせておくこと)

function plugin_steam_convert() {
	list($code, $intro) = func_get_args();

	if (!isset($code)) return '#steam(code[,introduction])';

	if (isset($intro)) $intro = '?t=' . urlencode(mb_strimwidth($intro, 0, PLUGIN_STEAM_INTRO_MAXLEN));

	$widgetTag = '<iframe src="https:'.'//store.steampowered.com/widget/' . htmlspecialchars($code) . '/' . $intro . '" ' . PLUGIN_STEAM_WIDGET_ATTRIBUTES . ' style="max-width:100%;max-height:auto"></iframe>';

	return '<div class="_p_steam">' . $widgetTag . '</div>';
}

ライセンス

GPL v3


トップ   編集 凍結 差分 履歴 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS
Last-modified: 2023-11-21 (火) 23:42:13
Site admin: PukiWiki Development Team

PukiWiki 1.5.4+ © 2001-2022 PukiWiki Development Team. Powered by PHP 8.2.12. HTML convert time: 0.984 sec.

SourceForge