內海
Strict Standards: Non-static method Title::legalChars() should not be called statically, assuming $this from incompatible context in /var/www/html/mediawiki/includes/Parser.php on line 1982
Strict Standards: Non-static method MagicWord::get() should not be called statically, assuming $this from incompatible context in /var/www/html/mediawiki/includes/Parser.php on line 1952
Strict Standards: Non-static method MagicWord::get() should not be called statically, assuming $this from incompatible context in /var/www/html/mediawiki/includes/Parser.php on line 1952
Strict Standards: Non-static method MagicWord::get() should not be called statically, assuming $this from incompatible context in /var/www/html/mediawiki/includes/Parser.php on line 1952
Strict Standards: Non-static method MagicWord::get() should not be called statically, assuming $this from incompatible context in /var/www/html/mediawiki/includes/Parser.php on line 1952
Strict Standards: Non-static method MagicWord::get() should not be called statically, assuming $this from incompatible context in /var/www/html/mediawiki/includes/Parser.php on line 1952
Strict Standards: Non-static method MagicWord::get() should not be called statically, assuming $this from incompatible context in /var/www/html/mediawiki/includes/Parser.php on line 1952
Strict Standards: Non-static method MagicWord::get() should not be called statically, assuming $this from incompatible context in /var/www/html/mediawiki/includes/Parser.php on line 1952
Strict Standards: Non-static method MagicWord::get() should not be called statically, assuming $this from incompatible context in /var/www/html/mediawiki/includes/Parser.php on line 1952
Strict Standards: Non-static method MagicWord::get() should not be called statically, assuming $this from incompatible context in /var/www/html/mediawiki/includes/Parser.php on line 1952
Strict Standards: Non-static method MagicWord::get() should not be called statically, assuming $this from incompatible context in /var/www/html/mediawiki/includes/Parser.php on line 1952
Strict Standards: Non-static method MagicWord::get() should not be called statically, assuming $this from incompatible context in /var/www/html/mediawiki/includes/Parser.php on line 1952
Strict Standards: Non-static method MagicWord::get() should not be called statically, assuming $this from incompatible context in /var/www/html/mediawiki/includes/Parser.php on line 1952
Strict Standards: Non-static method MagicWord::get() should not be called statically, assuming $this from incompatible context in /var/www/html/mediawiki/includes/Parser.php on line 1952
Strict Standards: Non-static method MagicWord::get() should not be called statically, assuming $this from incompatible context in /var/www/html/mediawiki/includes/Parser.php on line 1952
Strict Standards: Non-static method MagicWord::get() should not be called statically, assuming $this from incompatible context in /var/www/html/mediawiki/includes/Parser.php on line 1952
Strict Standards: Non-static method MagicWord::get() should not be called statically, assuming $this from incompatible context in /var/www/html/mediawiki/includes/Parser.php on line 1952
Strict Standards: Non-static method MagicWord::get() should not be called statically, assuming $this from incompatible context in /var/www/html/mediawiki/includes/Parser.php on line 1952
Strict Standards: Non-static method MagicWord::get() should not be called statically, assuming $this from incompatible context in /var/www/html/mediawiki/includes/Parser.php on line 1952
Strict Standards: Non-static method MagicWord::get() should not be called statically, assuming $this from incompatible context in /var/www/html/mediawiki/includes/Parser.php on line 1952
Strict Standards: Non-static method MagicWord::get() should not be called statically, assuming $this from incompatible context in /var/www/html/mediawiki/includes/Parser.php on line 1952
From PHSea
Here’s how I referenced the extension as a template:
title=My test YouTube dealee
movie_url=http://www.youtube.com/v/yWQhBnpFEpg
embed_source_url=http://www.youtube.com/v/yWQhBnpFEpg
wrap = yes
width=500
height=400
Here’s the css:
- youtube {
margin: 0px 0px 40px 0px; float:left; width:300px; height:200px; position:relative; border:0px solid #333333; }
Here’s the php script called youtub_extension.php:
* title=My test YouTube dealee * movie_url=http://www.youtube.com/v/yWQhBnpFEpg * embed_source_url=http://www.youtube.com/v/yWQhBnpFEpg * wrap = yes * width=500 * height=400 *
- /
$wgExtensionFunctions[] = ‘registerYouTubeExtension’; $wgExtensionCredits[’parserhook’][] = array( ‘name’ => ‘YouTube’, ‘author’ => ‘Patrick Ragsdale’, ‘url’ => ‘http://www.scriptalias.com’, );
function registerYouTubeExtension() {
global $wgParser; $wgParser->setHook(’YouTube’, ‘renderYouTube’);
}
/**
- We can provide values based on parameters listed between the
- and tags
-
- /
function renderYouTube($YouTube) {
global $wgTitle;
$YouTubearea = new YouTubearea(); getYouTubeOptions($YouTubearea->title,$YouTube,’title’); getYouTubeOptions($YouTubearea->movie_url,$YouTube,’movie_url’); getYouTubeOptions($YouTubearea->embed_source_url,$YouTube,’embed_source_url’); getYouTubeOptions($YouTubearea->wrap,$YouTube,’wrap’); getYouTubeOptions($YouTubearea->width,$YouTube,’width’); getYouTubeOptions($YouTubearea->height,$YouTube,’height’); $YouTubehtml = $YouTubearea->render();
$YouTubehtml=str_replace(”內海”,$wgTitle->getText(),$YouTubehtml); if($YouTubehtml) { return $YouTubehtml; } else { return “ Input box ‘{$YouTube->type}’ not defined.“; } }
/**
- This function will collect the values and define them in the
- function renderTest
-
- /
function getYouTubeOptions(&$value,&$YouTube,$name,$isNumber=false) {
if(preg_match(”/^\s*$name\s*=\s*(.*)/mi”,$YouTube,$matches)) {
if($isNumber) { $value=intval($matches[1]); } else { $value=htmlspecialchars($matches[1]); } } }
/**
- The class is define here. We set it above on line 42
- and requested an instance of it on line 46
-
- /
class YouTubearea {
function render() { if ($this->wrap == “yes”) { $csstop =” “; $cssbottom = “
“; $width = “300″; $height = “200″; } else { $csstop =”"; $cssbottom = “”; $width = $this->width; $height = $this->height; }
$YouTube=<<title