<?php
-//This core jsScriptLoader class provides the script loader functionality
-//check if we are being invoked in mediaWiki context or stand alone usage:
+/**
+ * This core jsScriptLoader class provides the script loader functionality
+ * @file
+ */
+// check if we are being invoked in MediaWiki context or stand alone usage:
if ( !defined( 'MEDIAWIKI' ) ){
- //load noMediaWiki helper:
- require_once( realpath( dirname(__FILE__) ) . '/php/noMediaWikiConfig.php' );
+ // load noMediaWiki helper:
+ require_once( realpath( dirname( __FILE__ ) ) . '/php/noMediaWikiConfig.php' );
- //run the main action:
+ // run the main action:
$myScriptLoader = new jsScriptLoader();
- //preset request values via normal $_GET operation:
+ // preset request values via normal $_GET operation:
$myScriptLoader->doScriptLoader();
-}else{
- $wgExtensionMessagesFiles['mwEmbed'] = realpath( dirname(__FILE__) ) .'/php/mwEmbed.i18n.php';
+} else {
+ $wgExtensionMessagesFiles['mwEmbed'] = realpath( dirname( __FILE__ ) ) . '/php/mwEmbed.i18n.php';
}
-//setup page output hook
-class jsScriptLoader{
+// setup page output hook
+class jsScriptLoader {
var $jsFileList = array();
var $jsout = '';
var $rKey = ''; // the request key
- var $error_msg ='';
+ var $error_msg = '';
var $debug = false;
- var $jsvarurl =false; // if we should include generated js (special class '-')
- var $doProcReqFlag =true;
+ var $jsvarurl = false; // if we should include generated js (special class '-')
+ var $doProcReqFlag = true;
function doScriptLoader(){
- global $wgJSAutoloadClasses,$wgJSAutoloadLocalClasses, $wgEnableScriptLoaderJsFile, $IP,
+ global $wgJSAutoloadClasses, $wgJSAutoloadLocalClasses, $wgEnableScriptLoaderJsFile, $IP,
$wgEnableScriptMinify, $wgUseFileCache;
- //process the request
+ // process the request
$this->procRequestVars();
- //if cache is on and file is present grab it from there:
+ // if cache is on and file is present grab it from there:
if( $wgUseFileCache && !$this->debug ) {
- //setup file cache obj:
+ // setup file cache obj:
$this->sFileCache = new simpleFileCache( $this->rKey );
if( $this->sFileCache->isFileCached() ){
- //just output headers so we can use php "efficient" readfile
+ // just output headers so we can use php "efficient" readfile
$this->outputJsHeaders();
$this->sFileCache->outputFromFileCache();
die();
}
}
- //setup script loader header info
- $this->jsout .= 'var mwSlScript = "'. $_SERVER['SCRIPT_NAME'] . '";' . "\n";
- $this->jsout .= 'var mwSlGenISODate = "'. date('c') . '";' ."\n";
+ // setup script loader header info
+ $this->jsout .= 'var mwSlScript = "' . $_SERVER['SCRIPT_NAME'] . '";' . "\n";
+ $this->jsout .= 'var mwSlGenISODate = "' . date( 'c' ) . '";' ."\n";
$this->jsout .= 'var mwSlURID = "' . $this->urid . '";' ."\n";
- //Build the Output:
- //swap in the appropriate language per js_file
- foreach($this->jsFileList as $classKey => $file_name){
- //special case: - title classes:
- if( substr( $classKey, 0, 3) == 'WT:' ){
- //get just the tile part:
- $title_block = substr( $classKey, 3);
- if($title_block[0] == '-' && strpos($title_block, '|') !== false){
- //special case of "-" title with skin
- $parts = explode('|', $title_block);
- $title = array_shift($parts);
- foreach($parts as $tparam){
- list($key, $val)= explode('=', $tparam);
- if( $key=='useskin' ){
- $skin= $val;
+ // Build the output:
+ // swap in the appropriate language per js_file
+ foreach( $this->jsFileList as $classKey => $file_name ){
+ // special case: - title classes:
+ if( substr( $classKey, 0, 3 ) == 'WT:' ){
+ // get just the tile part:
+ $title_block = substr( $classKey, 3 );
+ if( $title_block[0] == '-' && strpos( $title_block, '|' ) !== false ){
+ // special case of "-" title with skin
+ $parts = explode( '|', $title_block );
+ $title = array_shift( $parts );
+ foreach( $parts as $tparam ){
+ list( $key, $val ) = explode( '=', $tparam );
+ if( $key == 'useskin' ){
+ $skin = $val;
}
}
- //make sure the skin name is valid
+ // make sure the skin name is valid
$skinNames = Skin::getSkinNames();
- //get the lower case skin name (array keys)
- $skinNames = array_keys($skinNames);
- if( in_array(strtolower($skin), $skinNames )){
+ // get the lower case skin name (array keys)
+ $skinNames = array_keys( $skinNames );
+ if( in_array( strtolower( $skin ), $skinNames ) ){
$this->jsout .= Skin::generateUserJs( $skin ) . "\n";
- //success continue:
+ // success continue:
continue;
}
- }else{
- //its a wikiTitle append the output of the wikitext:
- $t = Title::newFromText ( $title_block );
- $a = new Article( $t );
- //only get content if the page is not empty:
- if($a->getID() !== 0 ){
- $this->jsout .= $a->getContent() . "\n";
+ } else {
+ // it's a wikiTitle append the output of the wikitext:
+ $t = Title::newFromText( $title_block );
+ $a = new Article( $t );
+ // only get content if the page is not empty:
+ if( $a->getID() !== 0 ){
+ $this->jsout .= $a->getContent() . "\n";
}
continue;
}
}
- if( trim( $file_name ) != ''){
- //if in debug add a comment with the file name:
- if($this->debug)
+ if( trim( $file_name ) != '' ){
+ // if in debug add a comment with the file name:
+ if( $this->debug )
$this->jsout .= "\n/**
* File: $file_name
*/\n";
- $this->jsout .= ( $this->doProccessJsFile( $file_name ) ). "\n";
+ $this->jsout .= ( $this->doProccessJsFile( $file_name ) ) . "\n";
}
}
- //check if we should minify :
- if( $wgEnableScriptMinify && !$this->debug){
- //do the minification and output
+ // check if we should minify :
+ if( $wgEnableScriptMinify && !$this->debug ){
+ // do the minification and output
$this->jsout = JSMin::minify( $this->jsout);
}
- //save to the file cache:
- if( $wgUseFileCache && !$this->debug) {
- $status = $this->sFileCache->saveToFileCache($this->jsout);
- if($status!==true)
- $this->error_msg.= $status;
+ // save to the file cache:
+ if( $wgUseFileCache && !$this->debug ) {
+ $status = $this->sFileCache->saveToFileCache( $this->jsout );
+ if( $status !== true )
+ $this->error_msg.= $status;
}
- //check for error msg:
+ // check for error msg:
if( $this->error_msg != ''){
- echo 'alert(\'Error With ScriptLoader.php ::' . str_replace("\n", '\'+"\n"+'."\n'", $this->error_msg ). '\');';
- echo trim($this->jsout);
- }else{
- //all good lets output cache forever headers:
- $this->outputJsWithHeaders();
+ echo 'alert(\'Error With ScriptLoader.php ::' . str_replace( "\n", '\'+"\n"+'."\n'", $this->error_msg ) . '\');';
+ echo trim( $this->jsout );
+ } else {
+ // all good lets output cache forever headers:
+ $this->outputJsWithHeaders();
}
}
+
function outputJsHeaders(){
- global $wgJsMimeType;
- //output js mime type:
- header( 'Content-type: '.$wgJsMimeType);
- header( "Pragma: public" );
- //cache forever:
- //(the point is we never have to re validate since we should always change the request url based on the svn or article version)
+ global $wgJsMimeType;
+ // output js mime type:
+ header( 'Content-type: ' . $wgJsMimeType );
+ header( 'Pragma: public' );
+ // cache forever:
+ // (the point is we never have to revalidate since we should always change the request url based on the svn or article version)
$one_year = 60*60*24*365;
- header("Expires: " . gmdate( "D, d M Y H:i:s", time() + $one_year ) . " GM");
+ header( "Expires: " . gmdate( "D, d M Y H:i:s", time() + $one_year ) . " GM" );
}
+
function outputJsWithHeaders(){
- global $wgUseGzip;
- $this->outputJsHeaders();
- if( $wgUseGzip ) {
- if( wfClientAcceptsGzip() ) {
+ global $wgUseGzip;
+ $this->outputJsHeaders();
+ if( $wgUseGzip ) {
+ if( wfClientAcceptsGzip() ) {
header( 'Content-Encoding: gzip' );
echo gzencode( $this->jsout );
- }else{
- echo $this->jsout;
- }
- }else{
- echo $this->jsout;
+ } else {
+ echo $this->jsout;
+ }
+ } else {
+ echo $this->jsout;
}
}
- /*
+
+ /**
* updates the proc Request
*/
function procRequestVars(){
global $wgContLanguageCode, $wgEnableScriptMinify, $wgJSAutoloadClasses, $wgJSAutoloadLocalClasses, $wgStyleVersion;
- //set debug flag:
- if( (isset($_GET['debug']) && $_GET['debug']=='true') || (isset($wgEnableScriptDebug) && $wgEnableScriptDebug==true )){
- $this->debug = true;
+ // set debug flag:
+ if( ( isset( $_GET['debug'] ) && $_GET['debug'] == 'true' ) || ( isset( $wgEnableScriptDebug ) && $wgEnableScriptDebug == true ) ){
+ $this->debug = true;
}
- //set the urid: (be sure to escape it as it goes into our js output)
+ // set the urid: (be sure to escape it as it goes into our js output)
if( isset( $_GET['urid'] ) && $_GET['urid'] !=''){
$this->urid = htmlspecialchars( $_GET['urid'] );
- }else{
- //just give it the current style sheet id:
- //@@todo read the svn version number
- $this->urid = $wgStyleVersion;
+ } else {
+ // just give it the current style sheet id:
+ // @@todo read the svn version number
+ $this->urid = $wgStyleVersion;
}
$reqClassList = false;
- if( isset($_GET['class']) && $_GET['class']!=''){
+ if( isset( $_GET['class'] ) && $_GET['class'] != '' ){
$reqClassList = explode( ',', $_GET['class'] );
}
- //check for the requested classes
+
+ // check for the requested classes
if( $reqClassList ){
- //clean the class list and populate jsFileList
+ // clean the class list and populate jsFileList
foreach( $reqClassList as $reqClass ){
- if(trim($reqClass) != ''){
- //check for special case '-' class for user generated js
- if( substr( $reqClass, 0, 3) == 'WT:' ){
- $this->jsFileList[ $reqClass ] = true;
+ if( trim( $reqClass ) != '' ){
+ // check for special case '-' class for user generated js
+ if( substr( $reqClass, 0, 3 ) == 'WT:' ){
+ $this->jsFileList[$reqClass] = true;
$this->rKey .= $reqClass;
$this->jsvarurl = true;
continue;
}
- $reqClass = ereg_replace("[^A-Za-z0-9_\-\.]", "", $reqClass );
+ $reqClass = ereg_replace("[^A-Za-z0-9_\-\.]", '', $reqClass );
if( isset( $wgJSAutoloadLocalClasses[$reqClass] ) ){
- $this->jsFileList[ $reqClass ] = $wgJSAutoloadLocalClasses[ $reqClass ];
- $this->rKey.=$reqClass;
- }else if( isset($wgJSAutoloadClasses[$reqClass])) {
- $this->jsFileList[ $reqClass ] = $wgJSAutoloadClasses[ $reqClass ];
- $this->rKey.=$reqClass;
- }else{
- $this->error_msg.= 'Requested class: ' . $reqClass . ' not found'."\n";
+ $this->jsFileList[$reqClass] = $wgJSAutoloadLocalClasses[$reqClass];
+ $this->rKey.= $reqClass;
+ } else if( isset( $wgJSAutoloadClasses[$reqClass] ) ) {
+ $this->jsFileList[$reqClass] = $wgJSAutoloadClasses[$reqClass];
+ $this->rKey.= $reqClass;
+ } else {
+ $this->error_msg.= 'Requested class: ' . $reqClass . ' not found' . "\n";
}
}
}
}
- //check for requested files if enabled:
+ // check for requested files if enabled:
if( $wgEnableScriptLoaderJsFile ){
- if( isset($_GET['files'])){
- $reqFileList = explode(',', isset($_GET['files']));
- //clean the file list and populate jsFileList
- foreach($reqFileList as $reqFile){
- //no jumping dirs:
- $reqFile = str_replace('../','',$reqFile);
- //only allow alphanumeric underscores periods and ending with .js
- $reqFile = ereg_replace("[^A-Za-z0-9_\-\/\.]", "", $reqFile );
- if( substr($reqFile, -3) == '.js' ){
- //don't add it twice:
- if( !in_array($reqFile, $jsFileList )) {
+ if( isset( $_GET['files'] ) ){
+ $reqFileList = explode( ',', isset( $_GET['files'] ) );
+ // clean the file list and populate jsFileList
+ foreach( $reqFileList as $reqFile ){
+ // no jumping dirs:
+ $reqFile = str_replace( '../', '', $reqFile );
+ // only allow alphanumeric underscores periods and ending with .js
+ $reqFile = ereg_replace( "[^A-Za-z0-9_\-\/\.]", '', $reqFile );
+ if( substr( $reqFile, -3 ) == '.js' ){
+ // don't add it twice:
+ if( !in_array( $reqFile, $jsFileList ) ) {
$this->jsFileList[] = $IP . $reqFile;
- $this->rKey.=$reqFile;
+ $this->rKey.= $reqFile;
}
- }else{
- $this->error_msg.= 'Not valid requsted javascript file' . "\n";
+ } else {
+ $this->error_msg.= 'Not valid requsted JavaScript file' . "\n";
}
}
}
}
- //add the language code to the rKey:
+ // add the language code to the rKey:
$this->rKey .= '_' . $wgContLanguageCode;
- //add the unique rid to the rKey
+ // add the unique rid to the rKey
$this->rKey .= $this->urid;
- //add a min flag:
- if($wgEnableScriptMinify){
- $this->rKey.='_min';
+ // add a min flag:
+ if( $wgEnableScriptMinify ){
+ $this->rKey.= '_min';
}
}
+
function doProccessJsFile( $file_name ){
global $IP, $wgEnableScriptLocalization, $IP;
- //load the file:
- $str = @file_get_contents("{$IP}/{$file_name}");
+ // load the file:
+ $str = @file_get_contents( "{$IP}/{$file_name}" );
- if($str===false){
- //@@todo check php error level (don't want to expose paths if errors are hidden)
+ if( $str === false ){
+ // @@todo check php error level (don't want to expose paths if errors are hidden)
$this->error_msg.= 'Requested File: ' . htmlspecialchars( $file_name ) . ' could not be read' . "\n";
return '';
}
$this->cur_file = $file_name;
- //strip out js_log debug lines not much luck with this regExp yet:
+ // strip out js_log debug lines not much luck with this regExp yet:
//if( !$this->debug )
// $str = preg_replace('/\n\s*js_log\s*\([^\)]([^;]|\n])*;/', "\n", $str);
// do language swap
- if($wgEnableScriptLocalization)
- $str = preg_replace_callback('/loadGM\s*\(\s*{(.*)}\s*\)\s*/siU', //@@todo fix: will break down if someone does }) in their msg text
- array($this, 'languageMsgReplace'),
- $str);
+ if( $wgEnableScriptLocalization )
+ $str = preg_replace_callback(
+ '/loadGM\s*\(\s*{(.*)}\s*\)\s*/siU', // @@todo fix: will break down if someone does }) in their msg text
+ array( $this, 'languageMsgReplace' ),
+ $str
+ );
return $str;
}
- function languageMsgReplace($jvar){
- if(!isset($jvar[1]))
- return ;
+
+ function languageMsgReplace( $jvar ){
+ if( !isset( $jvar[1] ) )
+ return;
$jmsg = json_decode( '{' . $jvar[1] . '}', true );
- //do the language lookup:
- if($jmsg){
- foreach($jmsg as $msgKey => $default_en_value){
+ // do the language lookup:
+ if( $jmsg ){
+ foreach( $jmsg as $msgKey => $default_en_value ){
$jmsg[$msgKey] = wfMsgNoTrans( $msgKey );
}
//return the updated loadGM json with fixed new lines:
return 'loadGM( ' . json_encode( $jmsg ) . ')';
- }else{
+ } else {
$this->error_msg.= "Could not parse JSON language msg in File:\n" .
- $this->cur_file ."\n";
+ $this->cur_file . "\n";
}
- //could not parse json (throw error?)
+ // could not parse json (throw error?)
return $jvar[0];
}
}
+
//a simple version of HTMLFileCache (@@todo abstract shared pieces)
-class simpleFileCache{
+class simpleFileCache {
var $mFileCache;
- var $filename= null;
- var $rKey= null;
+ var $filename = null;
+ var $rKey = null;
+
public function __construct( &$rKey ) {
$this->rKey = $rKey;
$this->filename = $this->fileCacheName(); // init name
}
+
public function fileCacheName() {
- global $wgUseGzip;
+ global $wgUseGzip;
if( !$this->mFileCache ) {
global $wgFileCacheDirectory;
}
return $this->mFileCache;
}
+
public function isFileCached() {
return file_exists( $this->filename );
}
+
public function outputFromFileCache(){
global $wgUseGzip;
if( $wgUseGzip ) {
/* Send uncompressed (check if fileCache is in compressed state (ends with .gz)
* (unlikely to execute this since $wgUseGzip would have created a new file above.. but just in case:
*/
- if(substr($this->filename, -3)=='.gz'){
- readgzfile( $this->filename );
- }else{
- readfile( $this->filename );
- }
+ if( substr( $this->filename, -3 ) == '.gz' ){
+ readgzfile( $this->filename );
+ } else {
+ readfile( $this->filename );
+ }
}
- }else{
- //just output the file
- readfile( $this->filename );
+ } else {
+ // just output the file
+ readfile( $this->filename );
}
//return true
return true;
}
- public function saveToFileCache(& $text ) {
+
+ public function saveToFileCache( &$text ) {
global $wgUseFileCache, $wgUseGzip;
if( !$wgUseFileCache ) {
return 'Error: Called saveToFileCache with $wgUseFileCache off';
}
- if( strcmp($text,'') == 0 ) return 'saveToFileCache: empty output file';
+ if( strcmp( $text, '' ) == 0 ) return 'saveToFileCache: empty output file';
- //check the directories if we could not create them error out:
- $status = $this->checkCacheDirs();
+ // check the directories if we could not create them error out:
+ $status = $this->checkCacheDirs();
- if($wgUseGzip){
- $outputText = gzencode( trim($text) );
- }else{
- $outputText = trim($text);
- }
+ if( $wgUseGzip ){
+ $outputText = gzencode( trim( $text ) );
+ } else {
+ $outputText = trim( $text );
+ }
- if($status !== true)
- return $status;
+ if( $status !== true )
+ return $status;
$f = fopen( $this->filename, 'w' );
- if($f) {
+ if( $f ) {
fwrite( $f, $outputText );
fclose( $f );
- }else{
- return 'Could not open file for writing. Check your cache directory permissions?';
+ } else {
+ return 'Could not open file for writing. Check your cache directory permissions?';
}
return true;
}
+
protected function checkCacheDirs() {
- $mydir2 = substr($this->filename,0,strrpos($this->filename,'/')); # subdirectory level 2
- $mydir1 = substr($mydir2,0,strrpos($mydir2,'/')); # subdirectory level 1
+ $mydir2 = substr( $this->filename, 0, strrpos( $this->filename, '/' ) ); # subdirectory level 2
+ $mydir1 = substr( $mydir2, 0, strrpos( $mydir2, '/' ) ); # subdirectory level 1
- if( wfMkdirParents( $mydir1 ) === false || wfMkdirParents( $mydir2 ) === false){
- return 'Could not create cache directory. Check your cache directory permissions?';
- }else{
- return true;
+ if( wfMkdirParents( $mydir1 ) === false || wfMkdirParents( $mydir2 ) === false ){
+ return 'Could not create cache directory. Check your cache directory permissions?';
+ } else {
+ return true;
}
}
-}
-?>
\ No newline at end of file
+}
\ No newline at end of file
all file checks and conditions should be checked prior to loading this page.
this page serves as a wrapper for the cortado java applet
-@@this may be depreciated in favor of a central hosted java applet
+@@this may be deprecated in favor of a central hosted java applet
*/
cortado_iframe();
function cortado_iframe() {
- if(!function_exists('filter_input')){
- die('your version of php lacks <b>filter_input()</b> function</br>');
+ if( !function_exists( 'filter_input' ) ){
+ die( 'your version of PHP lacks <b>filter_input()</b> function<br />' );
}
- //load the http GETS:
+
+ // load the http GETS:
// set the parent domain if provided
$parent_domain = isset( $_GET['parent_domain'] ) ? $_GET['parent_domain'] : false;
- //default to null media in not provided:
+ // default to null media in not provided:
$media_url = isset( $_GET['media_url'] ) ? $_GET['media_url'] : false;
- if( strval($media_url) === ''){
- error_out('not valid or missing media url');
+ if( strval( $media_url ) === '' ){
+ error_out( 'invalid or missing media URL' );
}
- //default duration to 30 seconds if not provided. (ideally cortado would read this from the video file)
- //$duration = (isset($_GET['duration']))?$_GET['duration']:0;
- $duration = filter_input(INPUT_GET, 'duration', FILTER_SANITIZE_NUMBER_INT);
- if( is_null($duration) || $duration===false){
- $duration=0;
+
+ // default duration to 30 seconds if not provided. (ideally cortado would read this from the video file)
+ //$duration = ( isset( $_GET['duration'] ) ) ? $_GET['duration'] : 0;
+ $duration = filter_input( INPUT_GET, 'duration', FILTER_SANITIZE_NUMBER_INT );
+ if( is_null( $duration ) || $duration === false ){
+ $duration = 0;
}
- //id (set to random if none provided)
- //$id = (isset($_GET['id']))?$_GET['id']:'vid_'.rand('10000000');
- $id = isset($_GET['id']) ? $_GET['id'] : false;
- if( is_null($id) || $id===false){
- $id = 'vid_'.rand(0,10000000);
+ // id (set to random if none provided)
+ //$id = ( isset( $_GET['id'] ) ) ? $_GET['id'] : 'vid_' . rand( '10000000' );
+ $id = isset( $_GET['id'] ) ? $_GET['id'] : false;
+ if( is_null( $id ) || $id === false ){
+ $id = 'vid_' . rand( 0, 10000000 );
}
- $width = filter_input(INPUT_GET, 'width', FILTER_SANITIZE_NUMBER_INT);
- if( is_null($width) || $width===false){
- $width=320;
+ $width = filter_input( INPUT_GET, 'width', FILTER_SANITIZE_NUMBER_INT );
+ if( is_null( $width ) || $width === false ){
+ $width = 320;
}
- $height = filter_input(INPUT_GET, 'height', FILTER_SANITIZE_NUMBER_INT);
- //default to video:
- $stream_type = (isset($_GET['stream_type']))?$_GET['stream_type']:'video';
- if($stream_type=='video'){
- $audio=$video='true';
- if(is_null($height) || $height===false)
+ $height = filter_input( INPUT_GET, 'height', FILTER_SANITIZE_NUMBER_INT );
+ // default to video:
+ $stream_type = ( isset( $_GET['stream_type'] ) ) ? $_GET['stream_type'] : 'video';
+ if( $stream_type == 'video' ){
+ $audio = $video = 'true';
+ if( is_null( $height ) || $height === false )
$height = 240;
- } else { // if($stream_type=='audio')
- $audio='true';
- $video='false';
- if(is_null($height) || $height===false)
+ } else { // if( $stream_type == 'audio' )
+ $audio = 'true';
+ $video = 'false';
+ if( is_null( $height ) || $height === false )
$height = 20;
}
- //everything good output page:
+ // everything good output page:
output_page(array(
'id' => $id,
'media_url' => $media_url,
return strtr( $string, $pairs );
}
-function error_out($error=''){
- output_page(array('error' => $error));
+function error_out( $error = '' ){
+ output_page( array( 'error' => $error ) );
exit();
}
-function output_page($params){
+
+function output_page( $params ){
extract( $params );
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>cortado_embed</title>
<script type="text/javascript">
- <? //set the parent domain:
+ <?php //set the parent domain:
if( $parent_domain ){?>
- try{
- document.domain = '<?php echo htmlspecialchars( $parent_domain )?>';
- }catch (e){
+ try {
+ document.domain = '<?php echo htmlspecialchars( $parent_domain ) ?>';
+ } catch ( e ) {
if( window.console )
- console.log('could not set domain to <?php echo htmlspecialchars( $parent_domain )?>');
+ console.log('could not set domain to <?php echo htmlspecialchars( $parent_domain ) ?>');
+ }
+ <?php
+ } ?>
+ var jPlayer = null;
+ function setGlobalJplayer(){
+ jPlayer = document.getElementById('<?php echo htmlspecialchars( $id ) ?>');
}
- <?
- } ?>
- var jPlayer = null;
- function setGlobalJplayer(){
- jPlayer = document.getElementById('<?php echo htmlspecialchars( $id ) ?>');
- }
</script>
<style type="text/css">
<!--
</style></head>
<body onload="setGlobalJplayer()" >
<?php
- $appid = ( preg_match("/MSIE/i", getenv("HTTP_USER_AGENT")) ) ? '' : 'classid="java:com.fluendo.player.Cortado.class"';
- if (empty($error)){ ?>
+ $appid = ( preg_match( "/MSIE/i", getenv( "HTTP_USER_AGENT" ) ) ) ? '' : 'classid="java:com.fluendo.player.Cortado.class"';
+ if( empty( $error ) ){ ?>
<div id="jPlayer"></div>
<OBJECT id="<?php echo htmlspecialchars( $id ) ?>"
code="com.fluendo.player.Cortado.class"
<?php echo $appid ?>
archive="binPlayers/cortado/cortado-wmf-r46643.jar"
- width="<?php echo htmlspecialchars( $width )?>"
- height="<?php echo htmlspecialchars( $height )?>" >
- <param name="url" value="<?php echo htmlspecialchars( $media_url )?>" />
+ width="<?php echo htmlspecialchars( $width ) ?>"
+ height="<?php echo htmlspecialchars( $height ) ?>" >
+ <param name="url" value="<?php echo htmlspecialchars( $media_url ) ?>" />
<param name="local" value="false"/>
<param name="keepaspect" value="true" />
- <param name="video" value="<?php echo htmlspecialchars( $video )?>" />
- <param name="audio" value="<?php echo htmlspecialchars( $audio )?>" />
+ <param name="video" value="<?php echo htmlspecialchars( $video ) ?>" />
+ <param name="audio" value="<?php echo htmlspecialchars( $audio ) ?>" />
<param name="seekable" value="false" />
- <? if($duration!=0){
- ?>
- <param name="duration" value="<?php echo htmlspecialchars( $duration )?>" />
- <?
- } ?>
+ <?php if( $duration != 0 ){ ?>
+ <param name="duration" value="<?php echo htmlspecialchars( $duration ) ?>" />
+ <?php } ?>
<param name="showStatus" value="hide" />
<param name="autoPlay" value="true" />
<param name="BufferSize" value="8192" />
<param name="BufferHigh" value="30" />
<param name="BufferLow" value="5" />
</OBJECT>
- <? }else{ ?>
- <b>Error:</b> <?php echo htmlspecialchars( $error )?>
- <?
+ <?php } else { ?>
+ <b>Error:</b> <?php echo htmlspecialchars( $error ) ?>
+ <?php
}
?>
</body>
</html>
-<?
+<?php
}
/*
javascript envoked version:
doPlayer();
</script>
*
-*/
-?>
+*/
\ No newline at end of file
<?php
-if ( !defined( 'MEDIAWIKI' ) ) die(1);
+if ( !defined( 'MEDIAWIKI' ) ) die( 1 );
global $wgJSAutoloadLocalClasses, $wgMwEmbedDirectory;
- //the basis of the loader calls:
- $wgJSAutoloadLocalClasses['mv_embed'] = $wgMwEmbedDirectory . 'mv_embed.js';
-
- //core:
- $wgJSAutoloadLocalClasses['window.jQuery'] = $wgMwEmbedDirectory . 'jquery/jquery-1.3.2.js';
-
- $wgJSAutoloadLocalClasses['j.secureEvalJSON'] = $wgMwEmbedDirectory . 'jquery/plugins/jquery.json-1.3.js';
-
- $wgJSAutoloadLocalClasses['j.cookie'] = $wgMwEmbedDirectory . 'jquery/plugins/jquery.cookie.js';
-
- $wgJSAutoloadLocalClasses['j.contextMenu'] = $wgMwEmbedDirectory . 'jquery/plugins/jquery.contextMenu.js';
- $wgJSAutoloadLocalClasses['j.fn.pngFix'] = $wgMwEmbedDirectory . 'jquery/plugins/jquery.pngFix.js';
-
- $wgJSAutoloadLocalClasses['j.fn.autocomplete'] = $wgMwEmbedDirectory . 'jquery/plugins/jquery.autocomplete.js';
- $wgJSAutoloadLocalClasses['j.fn.hoverIntent'] = $wgMwEmbedDirectory . 'jquery/plugins/jquery.hoverIntent.js';
- $wgJSAutoloadLocalClasses['Date.fromString'] = $wgMwEmbedDirectory . 'jquery/plugins/date.js';
- $wgJSAutoloadLocalClasses['j.fn.datePicker'] = $wgMwEmbedDirectory . 'jquery/plugins/jquery.datePicker.js';
-
- //jcrop
- $wgJSAutoloadLocalClasses['j.Jcrop'] = $wgMwEmbedDirectory . 'libClipEdit/Jcrop/js/jquery.Jcrop.js';
-
- //color picker
- $wgJSAutoloadLocalClasses['j.fn.ColorPicker'] = $wgMwEmbedDirectory . 'libClipEdit/colorpicker/js/colorpicker.js';
-
- //jquery.ui
- $wgJSAutoloadLocalClasses['j.ui'] = $wgMwEmbedDirectory . 'jquery/jquery.ui-1.7.1/ui/ui.core.js';
-
- $wgJSAutoloadLocalClasses['j.effects.blind'] = $wgMwEmbedDirectory . 'jquery/jquery.ui-1.7.1/ui/effects.blind.js';
- $wgJSAutoloadLocalClasses['j.effects.drop'] = $wgMwEmbedDirectory . 'jquery/jquery.ui-1.7.1/ui/effects.drop.js';
- $wgJSAutoloadLocalClasses['j.effects.pulsate'] = $wgMwEmbedDirectory . 'jquery/jquery.ui-1.7.1/ui/effects.pulsate.js';
- $wgJSAutoloadLocalClasses['j.effects.transfer'] = $wgMwEmbedDirectory . 'jquery/jquery.ui-1.7.1/ui/effects.transfer.js';
- $wgJSAutoloadLocalClasses['j.ui.droppable'] = $wgMwEmbedDirectory . 'jquery/jquery.ui-1.7.1/ui/ui.droppable.js';
- $wgJSAutoloadLocalClasses['j.ui.slider'] = $wgMwEmbedDirectory . 'jquery/jquery.ui-1.7.1/ui/ui.slider.js';
- $wgJSAutoloadLocalClasses['j.effects.bounce'] = $wgMwEmbedDirectory . 'jquery/jquery.ui-1.7.1/ui/effects.bounce.js';
- $wgJSAutoloadLocalClasses['j.effects.explode'] = $wgMwEmbedDirectory . 'jquery/jquery.ui-1.7.1/ui/effects.explode.js';
- $wgJSAutoloadLocalClasses['j.effects.scale'] = $wgMwEmbedDirectory . 'jquery/jquery.ui-1.7.1/ui/effects.scale.js';
- $wgJSAutoloadLocalClasses['j.ui.datepicker'] = $wgMwEmbedDirectory . 'jquery/jquery.ui-1.7.1/ui/ui.datepicker.js';
- $wgJSAutoloadLocalClasses['j.ui.progressbar'] = $wgMwEmbedDirectory . 'jquery/jquery.ui-1.7.1/ui/ui.progressbar.js';
- $wgJSAutoloadLocalClasses['j.ui.sortable'] = $wgMwEmbedDirectory . 'jquery/jquery.ui-1.7.1/ui/ui.sortable.js';
- $wgJSAutoloadLocalClasses['j.effects.clip'] = $wgMwEmbedDirectory . 'jquery/jquery.ui-1.7.1/ui/effects.clip.js';
- $wgJSAutoloadLocalClasses['j.effects.fold'] = $wgMwEmbedDirectory . 'jquery/jquery.ui-1.7.1/ui/effects.fold.js';
- $wgJSAutoloadLocalClasses['j.effects.shake'] = $wgMwEmbedDirectory . 'jquery/jquery.ui-1.7.1/ui/effects.shake.js';
- $wgJSAutoloadLocalClasses['j.ui.dialog'] = $wgMwEmbedDirectory . 'jquery/jquery.ui-1.7.1/ui/ui.dialog.js';
- $wgJSAutoloadLocalClasses['j.ui.resizable'] = $wgMwEmbedDirectory . 'jquery/jquery.ui-1.7.1/ui/ui.resizable.js';
- $wgJSAutoloadLocalClasses['j.ui.tabs'] = $wgMwEmbedDirectory . 'jquery/jquery.ui-1.7.1/ui/ui.tabs.js';
- $wgJSAutoloadLocalClasses['j.effects.core'] = $wgMwEmbedDirectory . 'jquery/jquery.ui-1.7.1/ui/effects.core.js';
- $wgJSAutoloadLocalClasses['j.effects.highlight']= $wgMwEmbedDirectory . 'jquery/jquery.ui-1.7.1/ui/effects.highlight.js';
- $wgJSAutoloadLocalClasses['j.effects.slide'] = $wgMwEmbedDirectory . 'jquery/jquery.ui-1.7.1/ui/effects.slide.js';
- $wgJSAutoloadLocalClasses['j.ui.accordion'] = $wgMwEmbedDirectory . 'jquery/jquery.ui-1.7.1/ui/ui.accordion.js';
- $wgJSAutoloadLocalClasses['j.ui.draggable'] = $wgMwEmbedDirectory . 'jquery/jquery.ui-1.7.1/ui/ui.draggable.js';
- $wgJSAutoloadLocalClasses['j.ui.selectable'] = $wgMwEmbedDirectory . 'jquery/jquery.ui-1.7.1/ui/ui.selectable.js';
-
- //libAddMedia:
- $wgJSAutoloadLocalClasses['mvFirefogg'] = $wgMwEmbedDirectory . 'libAddMedia/mvFirefogg.js';
- $wgJSAutoloadLocalClasses['mvAdvFirefogg'] = $wgMwEmbedDirectory . 'libAddMedia/mvAdvFirefogg.js';
- $wgJSAutoloadLocalClasses['mvBaseUploadInterface'] = $wgMwEmbedDirectory . 'libAddMedia/mvBaseUploadInterface.js';
- $wgJSAutoloadLocalClasses['remoteSearchDriver'] = $wgMwEmbedDirectory . 'libAddMedia/remoteSearchDriver.js';
- $wgJSAutoloadLocalClasses['seqRemoteSearchDriver'] = $wgMwEmbedDirectory . 'libAddMedia/seqRemoteSearchDriver.js';
- $wgJSAutoloadLocalClasses['baseRemoteSearch'] = $wgMwEmbedDirectory . 'libAddMedia/searchLibs/baseRemoteSearch.js';
- $wgJSAutoloadLocalClasses['mediaWikiSearch'] = $wgMwEmbedDirectory . 'libAddMedia/searchLibs/mediaWikiSearch.js';
- $wgJSAutoloadLocalClasses['metavidSearch'] = $wgMwEmbedDirectory . 'libAddMedia/searchLibs/metavidSearch.js';
- $wgJSAutoloadLocalClasses['archiveOrgSearch'] = $wgMwEmbedDirectory . 'libAddMedia/searchLibs/archiveOrgSearch.js';
- $wgJSAutoloadLocalClasses['baseRemoteSearch'] = $wgMwEmbedDirectory . 'libAddMedia/searchLibs/baseRemoteSearch.js';
-
- //libClipEdit:
- $wgJSAutoloadLocalClasses['mvClipEdit'] = $wgMwEmbedDirectory . 'libClipEdit/mvClipEdit.js';
-
- //libEmbedObj:
- $wgJSAutoloadLocalClasses['embedVideo'] = $wgMwEmbedDirectory . 'libEmbedVideo/embedVideo.js';
- $wgJSAutoloadLocalClasses['flashEmbed'] = $wgMwEmbedDirectory . 'libEmbedVideo/flashEmbed.js';
- $wgJSAutoloadLocalClasses['genericEmbed'] = $wgMwEmbedDirectory . 'libEmbedVideo/genericEmbed.js';
- $wgJSAutoloadLocalClasses['htmlEmbed'] = $wgMwEmbedDirectory . 'libEmbedVideo/htmlEmbed.js';
- $wgJSAutoloadLocalClasses['javaEmbed'] = $wgMwEmbedDirectory . 'libEmbedVideo/javaEmbed.js';
- $wgJSAutoloadLocalClasses['nativeEmbed'] = $wgMwEmbedDirectory . 'libEmbedVideo/nativeEmbed.js';
- $wgJSAutoloadLocalClasses['quicktimeEmbed'] = $wgMwEmbedDirectory . 'libEmbedVideo/quicktimeEmbed.js';
- $wgJSAutoloadLocalClasses['vlcEmbed'] = $wgMwEmbedDirectory . 'libEmbedVideo/vlcEmbed.js';
-
- //libSequencer:
- $wgJSAutoloadLocalClasses['mvPlayList'] = $wgMwEmbedDirectory . 'libSequencer/mvPlayList.js';
- $wgJSAutoloadLocalClasses['mvSequencer'] = $wgMwEmbedDirectory . 'libSequencer/mvSequencer.js';
- $wgJSAutoloadLocalClasses['mvSequencer'] = $wgMwEmbedDirectory . 'libSequencer/mvSequencer.js';
-
- //libTimedText:
- $wgJSAutoloadLocalClasses['mvTimedEffectsEdit'] = $wgMwEmbedDirectory . 'libTimedText/mvTimedEffectsEdit.js';
-?>
\ No newline at end of file
+// the basis of the loader calls:
+$wgJSAutoloadLocalClasses['mv_embed'] = $wgMwEmbedDirectory . 'mv_embed.js';
+
+// core:
+$wgJSAutoloadLocalClasses['window.jQuery'] = $wgMwEmbedDirectory . 'jquery/jquery-1.3.2.js';
+
+$wgJSAutoloadLocalClasses['j.secureEvalJSON'] = $wgMwEmbedDirectory . 'jquery/plugins/jquery.json-1.3.js';
+
+$wgJSAutoloadLocalClasses['j.cookie'] = $wgMwEmbedDirectory . 'jquery/plugins/jquery.cookie.js';
+
+$wgJSAutoloadLocalClasses['j.contextMenu'] = $wgMwEmbedDirectory . 'jquery/plugins/jquery.contextMenu.js';
+$wgJSAutoloadLocalClasses['j.fn.pngFix'] = $wgMwEmbedDirectory . 'jquery/plugins/jquery.pngFix.js';
+
+$wgJSAutoloadLocalClasses['j.fn.autocomplete'] = $wgMwEmbedDirectory . 'jquery/plugins/jquery.autocomplete.js';
+$wgJSAutoloadLocalClasses['j.fn.hoverIntent'] = $wgMwEmbedDirectory . 'jquery/plugins/jquery.hoverIntent.js';
+$wgJSAutoloadLocalClasses['Date.fromString'] = $wgMwEmbedDirectory . 'jquery/plugins/date.js';
+$wgJSAutoloadLocalClasses['j.fn.datePicker'] = $wgMwEmbedDirectory . 'jquery/plugins/jquery.datePicker.js';
+
+// jcrop
+$wgJSAutoloadLocalClasses['j.Jcrop'] = $wgMwEmbedDirectory . 'libClipEdit/Jcrop/js/jquery.Jcrop.js';
+
+// color picker
+$wgJSAutoloadLocalClasses['j.fn.ColorPicker'] = $wgMwEmbedDirectory . 'libClipEdit/colorpicker/js/colorpicker.js';
+
+// jquery.ui
+$wgJSAutoloadLocalClasses['j.ui'] = $wgMwEmbedDirectory . 'jquery/jquery.ui-1.7.1/ui/ui.core.js';
+
+$wgJSAutoloadLocalClasses['j.effects.blind'] = $wgMwEmbedDirectory . 'jquery/jquery.ui-1.7.1/ui/effects.blind.js';
+$wgJSAutoloadLocalClasses['j.effects.drop'] = $wgMwEmbedDirectory . 'jquery/jquery.ui-1.7.1/ui/effects.drop.js';
+$wgJSAutoloadLocalClasses['j.effects.pulsate'] = $wgMwEmbedDirectory . 'jquery/jquery.ui-1.7.1/ui/effects.pulsate.js';
+$wgJSAutoloadLocalClasses['j.effects.transfer'] = $wgMwEmbedDirectory . 'jquery/jquery.ui-1.7.1/ui/effects.transfer.js';
+$wgJSAutoloadLocalClasses['j.ui.droppable'] = $wgMwEmbedDirectory . 'jquery/jquery.ui-1.7.1/ui/ui.droppable.js';
+$wgJSAutoloadLocalClasses['j.ui.slider'] = $wgMwEmbedDirectory . 'jquery/jquery.ui-1.7.1/ui/ui.slider.js';
+$wgJSAutoloadLocalClasses['j.effects.bounce'] = $wgMwEmbedDirectory . 'jquery/jquery.ui-1.7.1/ui/effects.bounce.js';
+$wgJSAutoloadLocalClasses['j.effects.explode'] = $wgMwEmbedDirectory . 'jquery/jquery.ui-1.7.1/ui/effects.explode.js';
+$wgJSAutoloadLocalClasses['j.effects.scale'] = $wgMwEmbedDirectory . 'jquery/jquery.ui-1.7.1/ui/effects.scale.js';
+$wgJSAutoloadLocalClasses['j.ui.datepicker'] = $wgMwEmbedDirectory . 'jquery/jquery.ui-1.7.1/ui/ui.datepicker.js';
+$wgJSAutoloadLocalClasses['j.ui.progressbar'] = $wgMwEmbedDirectory . 'jquery/jquery.ui-1.7.1/ui/ui.progressbar.js';
+$wgJSAutoloadLocalClasses['j.ui.sortable'] = $wgMwEmbedDirectory . 'jquery/jquery.ui-1.7.1/ui/ui.sortable.js';
+$wgJSAutoloadLocalClasses['j.effects.clip'] = $wgMwEmbedDirectory . 'jquery/jquery.ui-1.7.1/ui/effects.clip.js';
+$wgJSAutoloadLocalClasses['j.effects.fold'] = $wgMwEmbedDirectory . 'jquery/jquery.ui-1.7.1/ui/effects.fold.js';
+$wgJSAutoloadLocalClasses['j.effects.shake'] = $wgMwEmbedDirectory . 'jquery/jquery.ui-1.7.1/ui/effects.shake.js';
+$wgJSAutoloadLocalClasses['j.ui.dialog'] = $wgMwEmbedDirectory . 'jquery/jquery.ui-1.7.1/ui/ui.dialog.js';
+$wgJSAutoloadLocalClasses['j.ui.resizable'] = $wgMwEmbedDirectory . 'jquery/jquery.ui-1.7.1/ui/ui.resizable.js';
+$wgJSAutoloadLocalClasses['j.ui.tabs'] = $wgMwEmbedDirectory . 'jquery/jquery.ui-1.7.1/ui/ui.tabs.js';
+$wgJSAutoloadLocalClasses['j.effects.core'] = $wgMwEmbedDirectory . 'jquery/jquery.ui-1.7.1/ui/effects.core.js';
+$wgJSAutoloadLocalClasses['j.effects.highlight']= $wgMwEmbedDirectory . 'jquery/jquery.ui-1.7.1/ui/effects.highlight.js';
+$wgJSAutoloadLocalClasses['j.effects.slide'] = $wgMwEmbedDirectory . 'jquery/jquery.ui-1.7.1/ui/effects.slide.js';
+$wgJSAutoloadLocalClasses['j.ui.accordion'] = $wgMwEmbedDirectory . 'jquery/jquery.ui-1.7.1/ui/ui.accordion.js';
+$wgJSAutoloadLocalClasses['j.ui.draggable'] = $wgMwEmbedDirectory . 'jquery/jquery.ui-1.7.1/ui/ui.draggable.js';
+$wgJSAutoloadLocalClasses['j.ui.selectable'] = $wgMwEmbedDirectory . 'jquery/jquery.ui-1.7.1/ui/ui.selectable.js';
+
+// libAddMedia:
+$wgJSAutoloadLocalClasses['mvFirefogg'] = $wgMwEmbedDirectory . 'libAddMedia/mvFirefogg.js';
+$wgJSAutoloadLocalClasses['mvAdvFirefogg'] = $wgMwEmbedDirectory . 'libAddMedia/mvAdvFirefogg.js';
+$wgJSAutoloadLocalClasses['mvBaseUploadInterface'] = $wgMwEmbedDirectory . 'libAddMedia/mvBaseUploadInterface.js';
+$wgJSAutoloadLocalClasses['remoteSearchDriver'] = $wgMwEmbedDirectory . 'libAddMedia/remoteSearchDriver.js';
+$wgJSAutoloadLocalClasses['seqRemoteSearchDriver'] = $wgMwEmbedDirectory . 'libAddMedia/seqRemoteSearchDriver.js';
+$wgJSAutoloadLocalClasses['baseRemoteSearch'] = $wgMwEmbedDirectory . 'libAddMedia/searchLibs/baseRemoteSearch.js';
+$wgJSAutoloadLocalClasses['mediaWikiSearch'] = $wgMwEmbedDirectory . 'libAddMedia/searchLibs/mediaWikiSearch.js';
+$wgJSAutoloadLocalClasses['metavidSearch'] = $wgMwEmbedDirectory . 'libAddMedia/searchLibs/metavidSearch.js';
+$wgJSAutoloadLocalClasses['archiveOrgSearch'] = $wgMwEmbedDirectory . 'libAddMedia/searchLibs/archiveOrgSearch.js';
+$wgJSAutoloadLocalClasses['baseRemoteSearch'] = $wgMwEmbedDirectory . 'libAddMedia/searchLibs/baseRemoteSearch.js';
+
+// libClipEdit:
+$wgJSAutoloadLocalClasses['mvClipEdit'] = $wgMwEmbedDirectory . 'libClipEdit/mvClipEdit.js';
+
+// libEmbedObj:
+$wgJSAutoloadLocalClasses['embedVideo'] = $wgMwEmbedDirectory . 'libEmbedVideo/embedVideo.js';
+$wgJSAutoloadLocalClasses['flashEmbed'] = $wgMwEmbedDirectory . 'libEmbedVideo/flashEmbed.js';
+$wgJSAutoloadLocalClasses['genericEmbed'] = $wgMwEmbedDirectory . 'libEmbedVideo/genericEmbed.js';
+$wgJSAutoloadLocalClasses['htmlEmbed'] = $wgMwEmbedDirectory . 'libEmbedVideo/htmlEmbed.js';
+$wgJSAutoloadLocalClasses['javaEmbed'] = $wgMwEmbedDirectory . 'libEmbedVideo/javaEmbed.js';
+$wgJSAutoloadLocalClasses['nativeEmbed'] = $wgMwEmbedDirectory . 'libEmbedVideo/nativeEmbed.js';
+$wgJSAutoloadLocalClasses['quicktimeEmbed'] = $wgMwEmbedDirectory . 'libEmbedVideo/quicktimeEmbed.js';
+$wgJSAutoloadLocalClasses['vlcEmbed'] = $wgMwEmbedDirectory . 'libEmbedVideo/vlcEmbed.js';
+
+// libSequencer:
+$wgJSAutoloadLocalClasses['mvPlayList'] = $wgMwEmbedDirectory . 'libSequencer/mvPlayList.js';
+$wgJSAutoloadLocalClasses['mvSequencer'] = $wgMwEmbedDirectory . 'libSequencer/mvSequencer.js';
+$wgJSAutoloadLocalClasses['mvSequencer'] = $wgMwEmbedDirectory . 'libSequencer/mvSequencer.js';
+
+// libTimedText:
+$wgJSAutoloadLocalClasses['mvTimedEffectsEdit'] = $wgMwEmbedDirectory . 'libTimedText/mvTimedEffectsEdit.js';
\ No newline at end of file
-<?
-/* localization file for mwEmbed
+<?php
+/**
+ * Localization file for mwEmbed
* updates can be merged from javascript by running maintenance/mergeJavascriptMsg.php
- * this file follows the "extension" conventions for language msgs in mediaWiki But should be "usable" stand-alone with the script-loader
+ * this file follows the "extension" conventions for language msgs in MediaWiki but should be "usable" stand-alone with the script-loader
*
* the following English language portion is automatically merged via the maintenance script.
-*/
+ */
#<JAVASCRIPT EN REPLACE>
$messages['en'] = array(
'size-kilobytes' => '$1 K',
'size-bytes' => '$1 B',
);
-#</JAVASCRIPT EN REPLACE>
-
-?>
\ No newline at end of file
+#</JAVASCRIPT EN REPLACE>
\ No newline at end of file
-<?
-//merges in javascript with mwEmbed.i18n.php
+<?php
+/**
+ * Merges in JavaScript with mwEmbed.i18n.php
+ *
+ * @file
+ * @ingroup Maintenance
+ */
# Abort if called from a web server
if ( isset( $_SERVER ) && array_key_exists( 'REQUEST_METHOD', $_SERVER ) ) {
print "This script must be run from the command line\n";
exit();
}
-define('MEDIAWIKI',true);
-//get the scriptLoader globals:
+define( 'MEDIAWIKI', true );
+// get the scriptLoader globals:
require_once('../../jsScriptLoader.php');
$mwSTART_MSG_KEY = '#<JAVASCRIPT EN REPLACE>';
$mwEND_MSG_KEY = '#</JAVASCRIPT EN REPLACE>';
$mwLangFilePath = '../languages/mwEmbed.i18n.php';
-//get options (like override JS or override php
+// get options (like override JS or override PHP)
+// read in mwEmbed.i18n.php
+$rawLangFile = file_get_contents( $mwLangFilePath );
-//read in mwEmbed.i18n.php
-$rawLangFile = file_get_contents($mwLangFilePath);
-
-$startInx = strpos($rawLangFile, $mwSTART_MSG_KEY) + strlen($mwSTART_MSG_KEY);
-$endInx = strpos($rawLangFile, $mwEND_MSG_KEY);
+$startInx = strpos( $rawLangFile, $mwSTART_MSG_KEY) + strlen( $mwSTART_MSG_KEY );
+$endInx = strpos( $rawLangFile, $mwEND_MSG_KEY );
if( $startInx === false || $endInx === false ){
print "Could not find $mwSTART_MSG_KEY or $mwEND_MSG_KEY in mwEmbed.i18n.php \n";
exit();
}
-$preFile = substr( $rawLangFile, 0, $startInx);
-$msgSet = substr( $rawLangFile, $startInx, $endInx-$startInx);
-$postFile = substr($rawLangFile, $endInx);
-
-//build replacement from all javascript in mwEmbed
+$preFile = substr( $rawLangFile, 0, $startInx );
+$msgSet = substr( $rawLangFile, $startInx, $endInx-$startInx );
+$postFile = substr( $rawLangFile, $endInx );
+// build replacement from all javascript in mwEmbed
$path = realpath('../../');
$curFileName = '';
-//@@todo existing msgSet should be parsed (or we just "include" the file first)
+// @@todo existing msgSet should be parsed (or we just "include" the file first)
$msgSet = '$messages[\'en\'] = array(';
-$objects = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path), RecursiveIteratorIterator::SELF_FIRST);
-foreach($objects as $fname => $object){
- if(substr($fname, -3) == '.js'){
+$objects = new RecursiveIteratorIterator( new RecursiveDirectoryIterator( $path ), RecursiveIteratorIterator::SELF_FIRST );
+foreach( $objects as $fname => $object){
+ if( substr( $fname, -3 ) == '.js' ){
$jsFileText = file_get_contents( $fname );
- $mwPos = strpos($fname, 'mwEmbed') + 7;
+ $mwPos = strpos( $fname, 'mwEmbed' ) + 7;
$curFileName = substr( $fname, $mwPos );
- if( preg_match('/loadGM\s*\(\s*{(.*)}\s*\)\s*/siU', //@@todo fix: will break down if someone does }) in their msg text
+ if( preg_match( '/loadGM\s*\(\s*{(.*)}\s*\)\s*/siU', //@@todo fix: will break down if someone does }) in their msg text
$jsFileText,
- $matches) ){
- $msgSet .= doJsonMerge($matches[1]);
- }
- }
+ $matches ) ){
+ $msgSet .= doJsonMerge( $matches[1] );
+ }
+ }
}
-//close up the msgSet:
-$msgSet.=");\n";
+// close up the msgSet:
+$msgSet.= ");\n";
-function doJsonMerge($json_txt){
+function doJsonMerge( $json_txt ){
global $curFileName;
$out = "\n\t/*
\t* js file: {$curFileName}
\t*/\n";
$jmsg = json_decode( '{' . $json_txt . '}', true );
- if( count($jmsg) != 0 ){
- foreach($jmsg as $k=>$v){
- $out.="\t'{$k}' => '".str_replace('\'', '\\\'', $v) ."',\n";
+ if( count( $jmsg ) != 0 ){
+ foreach( $jmsg as $k => $v ){
+ $out.="\t'{$k}' => '" . str_replace( '\'', '\\\'', $v ) . "',\n";
}
return $out;
- }else{
+ } else {
print "could not get any json vars\n";
return '';
}
}
-//rebuild and output to file
-if( file_put_contents($mwLangFilePath, trim($preFile) . "\n" . trim($msgSet) . "\n" . trim($postFile))){
+// rebuild and output to file
+if( file_put_contents( $mwLangFilePath, trim( $preFile ) . "\n" . trim( $msgSet ) . "\n" . trim( $postFile ) ) ){
print "updated $mwLangFilePath file\n";
exit();
-}
-
-?>
\ No newline at end of file
+}
\ No newline at end of file
*/
class JSMin {
- const ORD_LF = 10;
- const ORD_SPACE = 32;
-
- protected $a = '';
- protected $b = '';
- protected $input = '';
- protected $inputIndex = 0;
- protected $inputLength = 0;
- protected $lookAhead = null;
- protected $output = '';
-
- // -- Public Static Methods --------------------------------------------------
-
- public static function minify($js) {
- $jsmin = new JSMin($js);
- return $jsmin->min();
- }
-
- // -- Public Instance Methods ------------------------------------------------
-
- public function __construct($input) {
- $this->input = str_replace("\r\n", "\n", $input);
- $this->inputLength = strlen($this->input);
- }
-
- // -- Protected Instance Methods ---------------------------------------------
-
- protected function action($d) {
- switch($d) {
- case 1:
- $this->output .= $this->a;
-
- case 2:
- $this->a = $this->b;
-
- if ($this->a === "'" || $this->a === '"') {
- for (;;) {
- $this->output .= $this->a;
- $this->a = $this->get();
-
- if ($this->a === $this->b) {
- break;
- }
-
- if (ord($this->a) <= self::ORD_LF) {
- throw new JSMinException('Unterminated string literal.');
- }
-
- if ($this->a === '\\') {
- $this->output .= $this->a;
- $this->a = $this->get();
- }
- }
- }
-
- case 3:
- $this->b = $this->next();
-
- if ($this->b === '/' && (
- $this->a === '(' || $this->a === ',' || $this->a === '=' ||
- $this->a === ':' || $this->a === '[' || $this->a === '!' ||
- $this->a === '&' || $this->a === '|' || $this->a === '?')) {
-
- $this->output .= $this->a . $this->b;
-
- for (;;) {
- $this->a = $this->get();
-
- if ($this->a === '/') {
- break;
- } elseif ($this->a === '\\') {
- $this->output .= $this->a;
- $this->a = $this->get();
- } elseif (ord($this->a) <= self::ORD_LF) {
- throw new JSMinException('Unterminated regular expression '.
- 'literal.');
- }
-
- $this->output .= $this->a;
- }
-
- $this->b = $this->next();
- }
- }
- }
-
- protected function get() {
- $c = $this->lookAhead;
- $this->lookAhead = null;
-
- if ($c === null) {
- if ($this->inputIndex < $this->inputLength) {
- $c = $this->input[$this->inputIndex];
- $this->inputIndex += 1;
- } else {
- $c = null;
- }
- }
-
- if ($c === "\r") {
- return "\n";
- }
-
- if ($c === null || $c === "\n" || ord($c) >= self::ORD_SPACE) {
- return $c;
- }
-
- return ' ';
- }
-
- protected function isAlphaNum($c) {
- return ord($c) > 126 || $c === '\\' || preg_match('/^[\w\$]$/', $c) === 1;
- }
-
- protected function min() {
- $this->a = "\n";
- $this->action(3);
-
- while ($this->a !== null) {
- switch ($this->a) {
- case ' ':
- if ($this->isAlphaNum($this->b)) {
- $this->action(1);
- } else {
- $this->action(2);
- }
- break;
-
- case "\n":
- switch ($this->b) {
- case '{':
- case '[':
- case '(':
- case '+':
- case '-':
- $this->action(1);
- break;
-
- case ' ':
- $this->action(3);
- break;
-
- default:
- if ($this->isAlphaNum($this->b)) {
- $this->action(1);
- }
- else {
- $this->action(2);
- }
- }
- break;
-
- default:
- switch ($this->b) {
- case ' ':
- if ($this->isAlphaNum($this->a)) {
- $this->action(1);
- break;
- }
-
- $this->action(3);
- break;
-
- case "\n":
- switch ($this->a) {
- case '}':
- case ']':
- case ')':
- case '+':
- case '-':
- case '"':
- case "'":
- $this->action(1);
- break;
-
- default:
- if ($this->isAlphaNum($this->a)) {
- $this->action(1);
- }
- else {
- $this->action(3);
- }
- }
- break;
-
- default:
- $this->action(1);
- break;
- }
- }
- }
-
- return $this->output;
- }
-
- protected function next() {
- $c = $this->get();
-
- if ($c === '/') {
- switch($this->peek()) {
- case '/':
- for (;;) {
- $c = $this->get();
-
- if (ord($c) <= self::ORD_LF) {
- return $c;
- }
- }
-
- case '*':
- $this->get();
-
- for (;;) {
- switch($this->get()) {
- case '*':
- if ($this->peek() === '/') {
- $this->get();
- return ' ';
- }
- break;
-
- case null:
- throw new JSMinException('Unterminated comment.');
- }
- }
-
- default:
- return $c;
- }
- }
-
- return $c;
- }
-
- protected function peek() {
- $this->lookAhead = $this->get();
- return $this->lookAhead;
- }
+ const ORD_LF = 10;
+ const ORD_SPACE = 32;
+
+ protected $a = '';
+ protected $b = '';
+ protected $input = '';
+ protected $inputIndex = 0;
+ protected $inputLength = 0;
+ protected $lookAhead = null;
+ protected $output = '';
+
+ // -- Public Static Methods --------------------------------------------------
+
+ public static function minify( $js ) {
+ $jsmin = new JSMin( $js );
+ return $jsmin->min();
+ }
+
+ // -- Public Instance Methods ------------------------------------------------
+
+ public function __construct( $input ) {
+ $this->input = str_replace( "\r\n", "\n", $input );
+ $this->inputLength = strlen( $this->input );
+ }
+
+ // -- Protected Instance Methods ---------------------------------------------
+
+ protected function action( $d ) {
+ switch( $d ) {
+ case 1:
+ $this->output .= $this->a;
+
+ case 2:
+ $this->a = $this->b;
+
+ if( $this->a === "'" || $this->a === '"' ) {
+ for (;;) {
+ $this->output .= $this->a;
+ $this->a = $this->get();
+
+ if( $this->a === $this->b ) {
+ break;
+ }
+
+ if( ord( $this->a ) <= self::ORD_LF ) {
+ throw new JSMinException( 'Unterminated string literal.' );
+ }
+
+ if( $this->a === '\\' ) {
+ $this->output .= $this->a;
+ $this->a = $this->get();
+ }
+ }
+ }
+
+ case 3:
+ $this->b = $this->next();
+
+ if( $this->b === '/' && (
+ $this->a === '(' || $this->a === ',' || $this->a === '=' ||
+ $this->a === ':' || $this->a === '[' || $this->a === '!' ||
+ $this->a === '&' || $this->a === '|' || $this->a === '?' ) ) {
+
+ $this->output .= $this->a . $this->b;
+
+ for (;;) {
+ $this->a = $this->get();
+
+ if( $this->a === '/' ) {
+ break;
+ } elseif( $this->a === '\\' ) {
+ $this->output .= $this->a;
+ $this->a = $this->get();
+ } elseif( ord( $this->a ) <= self::ORD_LF ) {
+ throw new JSMinException( 'Unterminated regular expression literal.' );
+ }
+
+ $this->output .= $this->a;
+ }
+
+ $this->b = $this->next();
+ }
+ }
+ }
+
+ protected function get() {
+ $c = $this->lookAhead;
+ $this->lookAhead = null;
+
+ if( $c === null ) {
+ if( $this->inputIndex < $this->inputLength ) {
+ $c = $this->input[$this->inputIndex];
+ $this->inputIndex += 1;
+ } else {
+ $c = null;
+ }
+ }
+
+ if( $c === "\r" ) {
+ return "\n";
+ }
+
+ if( $c === null || $c === "\n" || ord( $c ) >= self::ORD_SPACE ) {
+ return $c;
+ }
+
+ return ' ';
+ }
+
+ protected function isAlphaNum( $c ) {
+ return ord( $c ) > 126 || $c === '\\' || preg_match( '/^[\w\$]$/', $c ) === 1;
+ }
+
+ protected function min() {
+ $this->a = "\n";
+ $this->action( 3 );
+
+ while( $this->a !== null ) {
+ switch( $this->a ) {
+ case ' ':
+ if( $this->isAlphaNum( $this->b ) ) {
+ $this->action( 1 );
+ } else {
+ $this->action( 2 );
+ }
+ break;
+
+ case "\n":
+ switch( $this->b ) {
+ case '{':
+ case '[':
+ case '(':
+ case '+':
+ case '-':
+ $this->action( 1 );
+ break;
+
+ case ' ':
+ $this->action( 3 );
+ break;
+
+ default:
+ if( $this->isAlphaNum( $this->b ) ) {
+ $this->action( 1 );
+ } else {
+ $this->action( 2 );
+ }
+ }
+ break;
+
+ default:
+ switch( $this->b ) {
+ case ' ':
+ if( $this->isAlphaNum( $this->a ) ) {
+ $this->action( 1 );
+ break;
+ }
+
+ $this->action( 3 );
+ break;
+
+ case "\n":
+ switch( $this->a ) {
+ case '}':
+ case ']':
+ case ')':
+ case '+':
+ case '-':
+ case '"':
+ case "'":
+ $this->action( 1 );
+ break;
+
+ default:
+ if( $this->isAlphaNum( $this->a ) ) {
+ $this->action( 1 );
+ } else {
+ $this->action( 3 );
+ }
+ }
+ break;
+
+ default:
+ $this->action( 1 );
+ break;
+ }
+ }
+ }
+
+ return $this->output;
+ }
+
+ protected function next() {
+ $c = $this->get();
+
+ if( $c === '/' ) {
+ switch( $this->peek() ) {
+ case '/':
+ for (;;) {
+ $c = $this->get();
+
+ if( ord( $c ) <= self::ORD_LF ) {
+ return $c;
+ }
+ }
+
+ case '*':
+ $this->get();
+
+ for (;;) {
+ switch( $this->get() ) {
+ case '*':
+ if( $this->peek() === '/' ) {
+ $this->get();
+ return ' ';
+ }
+ break;
+
+ case null:
+ throw new JSMinException( 'Unterminated comment.' );
+ }
+ }
+
+ default:
+ return $c;
+ }
+ }
+
+ return $c;
+ }
+
+ protected function peek() {
+ $this->lookAhead = $this->get();
+ return $this->lookAhead;
+ }
}
// -- Exceptions ---------------------------------------------------------------
-class JSMinException extends Exception {}
-?>
\ No newline at end of file
+class JSMinException extends Exception {}
\ No newline at end of file
mv_embed_iframe();
function mv_embed_iframe() {
- if(!function_exists('filter_input')){
- die('your version of php lacks <b>filter_input()</b> function</br>');
- }
- //default to null media in not provided:
- $stream_name = ( isset($_GET['sn']) )? $_GET['sn'] : die('no stream name provided');
- $time = ( isset($_GET['t']) )? $_GET['t']: '';
- $width = ( isset($_GET['width']) )? intval( $_GET['width'] ) : '400';
- $height = ( isset($_GET['height']) )? intval( $_GET['height'] ) : '300'; //
-
+ if( !function_exists( 'filter_input' ) ){
+ die( 'your version of PHP lacks <b>filter_input()</b> function<br />' );
+ }
+ // default to null media in not provided:
+ $stream_name = ( isset( $_GET['sn'] ) )? $_GET['sn'] : die('no stream name provided');
+ $time = ( isset( $_GET['t'] ) )? $_GET['t']: '';
+ $width = ( isset( $_GET['width'] ) )? intval( $_GET['width'] ) : '400';
+ $height = ( isset( $_GET['height'] ) )? intval( $_GET['height'] ) : '300'; //
+
$roe_url = 'http://metavid.org/wiki/Special:MvExportStream?feed_format=roe&stream_name=' . htmlspecialchars( $stream_name ) .
'&t=' . htmlspecialchars( $time );
- //everything good output page:
+ //everything good output page:
output_page(array(
'roe_url' => $roe_url,
'width' => $width,
'height' => $height,
));
}
-function output_page($params){
+function output_page( $params ){
extract( $params );
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script type="text/javascript" src="mv_embed.js"></script>
</head>
<body>
- <video roe="<?php echo $roe_url ?>" width="<?php echo htmlspecialchars( $width )?>"
- height="<?php echo htmlspecialchars( $height )?>"></video>
+ <video roe="<?php echo $roe_url ?>" width="<?php echo htmlspecialchars( $width ) ?>"
+ height="<?php echo htmlspecialchars( $height ) ?>"></video>
</body>
</html>
-<?
+<?php
}
/**
"\xe2\x80\x8d" => "\\u200d", // ZERO WIDTH JOINER
);
return strtr( $string, $pairs );
-}
-?>
+}
\ No newline at end of file