Find Jobs
Hire Freelancers

564822 MediaWiki EmbedVideo Simplification

N/A

En cours
Publié il y a environ 12 ans

N/A

Payé lors de la livraison
Currently I have EmbedVideo extension of Mediawiki. [login to view URL] The extension requires to type {{#ev:youtube|dMH0bHeiRNg}} to embed a video. I want to simplify this. There are various ways to simplify this. I don't need these all. I just want at least one of these ways implemented. 1. Simplify copying and pasting the url of the video page will embed the vidio. For example, [login to view URL] 2. Writing ev1|dMH0bHeiRNg will embed the embed. ev1 stands for youtube, and ev2 for other, ev3 or other video services. Either 1 or 2 is OK, or maybe you can think of another way to simplify. There is a similar plugin for bbpress. So I attach the code of the plugin. ==================================================== There is a bbpress plugin bbvideo [login to view URL] This plugin allows users to embed videos from numerous sources including Youtube just by copying and pasting the address of page. For example, copying and pasting [login to view URL] will show visitors the embedded video. An example website with this plugin is [login to view URL] ========================================================= [[[login to view URL]]] <?php /* Plugin Name: BBVideo Plugin URI: [login to view URL] Description: <strong>English:</strong> Converts Video-Links in your forum posts to embedded Video-Players.<br /><strong>Deutsch:</strong> Wandelt Video-Links in den Forenbeiträgen in Video-Player um.<br /><em>Supports: Youtube, Dailymotion, MyVideo Google Video and many <a href="[login to view URL]" target="_blank">more ...</a></em> Author: Naden Badalgogtapeh Author URI: [login to view URL] Version: 0.24 */ /** * class BBPressBBVideo */ class BBPressPluginBBVideo { /** * list of supported video providers */ var $provider; /** * plugin version */ var $version; /** * plugin options */ var $options; /** * plugin id for filter hooks */ var $wp_filter_id; /** * global index for embedding */ var $index; /** * public constructor */ function BBPressPluginBBVideo() { $this->version = '0.24'; $this->wp_filter_id = 'bbvideo'; $this->index = 0; $this->options = bb_get_option( 'bbvideo_options' ); if( is_null( $this->options ) ) { $this->SaveOptions( array( 'embed' => 1 ), false ); } if( !array_key_exists( 'download', $this->options ) ) { $this->options[ 'download' ] = 1; $this->SaveOptions( $this->options, false ); } $this->provider = array(); // include list of video providers if( @include_once( dirname( __FILE__ ) . '/[login to view URL]' ) ) { // content filter only on topics if( is_topic() ) { // header stuff add_action( 'bb_head', array( &$this, 'AddHeader' ) ); // add content filter add_filter( 'post_text', array( &$this, 'ContentFilter' ), 9 ); } else { /// add admin panel add_action( 'bb_admin_menu_generator', array( &$this, 'AddAdminPage' ) ); } } } function SaveOptions( $options, $verbose = true ) { foreach( $options as $key => $value ) { $this->options[ $key ] = $value; } bb_update_option( 'bbvideo_options', $this->options ); if( $verbose ) { print( __( '<div class="updated">Settings Saved</div>' ) ); } } function AdminPage() { global $bbdb, $bb, $bb_table_prefix; @include_once( dirname( __FILE__ ) . '/[login to view URL]' ); } function AddHeader() { if( $this->options[ 'embed' ] == 1 ) { $code = <<<DATA <!-- bbVideo Plugin v{$this->version} - [login to view URL] --> <script type="text/javascript"> function bbvideo_embed( sender ) { var area = [login to view URL]( [login to view URL] + 'embed' ); if( area ) { if( [login to view URL] == 'normal' || [login to view URL] == 'block' ) { [login to view URL] = [login to view URL]( /-/, '+' ); [login to view URL] = 'none'; } else { [login to view URL] = [login to view URL]( /\+/, '-' ); [login to view URL] = 'block'; } } return( false ); } </script> <!-- // bbVideo Plugin --> DATA; print( $code ); unset( $code ); } } function AddAdminPage() { global $bb_menu; $bb_menu[ 60 ] = array( __( 'bbVideo' ), 'use_keys', 'BBPressPluginBBVideoAdminPage' ); } function DisplayProvider( $mask = '<small><a href="[login to view URL]">%s</a></small>', $pre = '<p>', $post = '</p>' ) { printf( $pre . $mask . $post, implode( ', ', array_keys( $this->provider ) ) ); } function GetTitle( $s ) { $magic = 0; for( $k=0; $k<strlen( $s ); $k++ ) { $magic += ord( $s[ $k ] ); } $titles = array( 'video plugin', 'video plugins', 'video widget', 'video player', 'flash video', 'flash videos' ); return( @ucwords( $titles[ $magic % count( $titles ) ] ) ); } function ContentFilter( $buffer ) { /// detect all links in the current topic @preg_match_all( '|http([s]?)\://(.*)|i', $buffer, $links, PREG_PATTERN_ORDER ); $count = count( $links[ 0 ] ); foreach( $links[ 0 ] as $link ) { foreach( $this->provider as $k => $provider ) { @preg_match( '|' . $provider[ 'pattern' ] . '|i', $link, $matches ); if( count( $matches ) > 0 ) { /// build embed-code $code = str_replace( array( '[ID]', '[HEIGHT]', '[WIDTH]' ), array( $matches[ $provider[ 'index' ] ], $provider[ 'height' ], $provider[ 'width' ] ), $provider[ 'code' ] ); $url = sprintf( '<a href="[login to view URL]" style="color:#aaa;text-decoration:underline;">%s</a>', $this->GetTitle( get_topic_title() ) ); if( $this->options[ 'download' ] == 1 ) { $download = sprintf( '<a style="color: #000;" href="[login to view URL]" target="_blank">Video Download</a>', urlencode( $link ) ); } if( $this->options[ 'embed' ] == 1 ) { $post_title = str_replace( "'", '', get_topic_title() ); $post_link = get_topic_link(); if( $bb->mod_rewrite ) { list( $post_link, ) = explode( '?', get_topic_link() ); } if( isset( $download ) ) { $download = ' | ' . $download; } $code = <<<DATA <!-- bbVideo Plugin v{$this->version} - [login to view URL] --> <div style="width:{$provider[ 'width' ]}px;">{$code}<div> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr><td><a href="" id="bbvideo{$this->index}" onclick="javascript:return(bbvideo_embed(this));" style="color: #000;">[+] Embed the video</a>{$download}</td><td align="right" style="color:#aaa;font-size:80%;">Get the {$url}</td></tr></table> <div id="bbvideo{$this->index}embed" style="display:none;"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr><td width="80">Text-Link:</td><td><input type="text" value="{$post_link}" onclick="javascript:[login to view URL]();[login to view URL]();" style="width:100%;" /></td></tr> <tr><td width="80">HTML-Link:</td><td><input type="text" value='<a href="{$post_link}">{$post_title}</a>' onclick="javascript:[login to view URL]();[login to view URL]();" style="width:100%;" /></td></tr> <tr><td width="80">BB-Code:</td><td><input type="text" value="[url={$post_link}]{$post_title}[/url]" onclick="javascript:[login to view URL]();[login to view URL]();" style="width:100%;" /></td></tr> <tr><td width="80">Embed:</td><td><input type="text" value='<div style="width:{$provider[ 'width' ]}px;">{$code}<div align="right" style="color:#aaa;font-size:80%;">Get the {$url}</div></div>' onclick="javascript:[login to view URL]();[login to view URL]();" style="width:100%;" /></td></tr> </table> </div></div></div> <!-- // bbVideo Plugin --> DATA; } else { if( isset( $download ) ) { $download = '<td>' . $download . '</td>'; } $code = <<<DATA <div style="width:{$provider[ 'width' ]}px;">{$code} <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr>{$download}<td align="right" style="color:#aaa;font-size:80%;">Get the {$url}</td></tr> </table> </div> DATA; } /// replace link w/ embed-code $buffer = str_replace( $link, $code, $buffer ); unset( $code ); break; } } $this->index ++; reset( $this->provider ); } return( $buffer ); } } // end class BBPressPluginBBVideo /** * dirty hack, because it seems to be impossible to call an class method over uri */ function BBPressPluginBBVideoAdminPage( ) { global $BBPressPluginBBVideo; $BBPressPluginBBVideo->AdminPage(); } /// end func /// init plugin if( !isset( $BBPressPluginBBVideo ) || is_null( $BBPressPluginBBVideo ) ) { $BBPressPluginBBVideo = new BBPressPluginBBVideo(); } ?> ============================================= [[[login to view URL]]] <?php /* BBVideo Plugin v0.24 admin template [login to view URL] */ if( isset( $_POST[ 'cmd' ] ) ) { $this->SaveOptions( array( 'embed' => intval( $_POST[ 'embed' ] ), 'download' => intval( $_POST[ 'download' ] ) ) ); } ?> <h2>bbVideo v<?php print( $this->version ); ?> - <?php _e( 'Settings' ) ?></h2> <div> <strong><a href="[login to view URL]">Plugin Homepage</a></strong> </div> <form method="post" action=""> <p> <h4>Embed:</h4> <label for="embed">Zeige Embed Optionen unter den Videos. / Show embed field below the videos.</label> <p> <input type="radio" name="embed" value="1" <?php print( $this->options[ 'embed' ] == 1 ? ' checked="checked"' : '' ); ?>/> Ja <input type="radio" name="embed" value="0" <?php print( $this->options[ 'embed' ] == 0 ? ' checked="checked"' : '' ); ?>/> Nein </p> </p> <p> <h4>Download:</h4> <label for="download">Zeige Download-Link unter den Videos. / Show download link field below the videos.</label> <p> <input type="radio" name="download" value="1" <?php print( $this->options[ 'download' ] == 1 ? ' checked="checked"' : '' ); ?>/> Ja <input type="radio" name="download" value="0" <?php print( $this->options[ 'download' ] == 0 ? ' checked="checked"' : '' ); ?>/> Nein </p> </p> <p class="submit"><input type="submit" name="cmd" value="speichern / save" /></p> </form> <p> <h4>Supported Video-Portals (<?php print( count( $this->provider ) ); ?>):</h4> <ul> <?php foreach( $this->provider as $k => $provider ) { printf( '<li><a href="%s" target="_blank">%s</a></li>', $provider[ 'page_url' ], ucfirst( $k ) ); } ?> </ul> </p> <div align="center"> <strong><a href="[login to view URL]">Plugin Homepage</a></strong> </div> ============================================ [[[login to view URL]]] <?php /* BBVideo Plugin v0.24 definition file [login to view URL] */ /* Support for: + myvideo + funnyordie + collegehumor + redtube + dailymotion + sevenload + glumbert + youtube + googlevideo + liveleak + metacafe + clipfish + gametrailers + vimeo */ $this->provider = array( 'youtube' => array( 'width' => '425', 'height' => '350', 'pattern' => 'youtube\.(.*)/watch\?v=([a-zA-Z0-9_-]*)', 'index' => 2, 'code' => '<object width="[WIDTH]" height="[HEIGHT]"><param name="movie" value="[login to view URL][ID]&rel=1"></param><param name="wmode" value="transparent"></param><embed src="[login to view URL][ID]&rel=1" type="application/x-shockwave-flash" wmode="transparent" width="[WIDTH]" height="[HEIGHT]"></embed></object>', 'page_url' => '[login to view URL]' ), 'myvideo' => array( 'width' => '425', 'height' => '350', 'pattern' => 'myvideo\.de/watch/([a-zA-Z0-9_-]*)', 'index' => 1, 'code' => '<object width="[WIDTH]" height="[HEIGHT]" type="application/x-shockwave-flash" data="[login to view URL][ID]"><param name="movie" value="[login to view URL][ID]"></param><param name="AllowFullscreen" value="true" /></object>', 'page_url' => '[login to view URL]' ), 'funnyordie' => array( 'width' => '425', 'height' => '350', 'pattern' => 'funnyordie\.com/videos/([0-9a-fA-F]*)', 'index' => 1, 'code' => '<embed type="application/x-shockwave-flash" src="[login to view URL]" scale="noScale" salign="TL" flashvars="&ratename=IMMORTAL&rating=5.0&ratedby=12&canrate=no&VID=7417&file=[login to view URL][ID].flv&autoStart=false&key=[ID]" allowfullscreen="true" height="[HEIGHT]" width="[WIDTH]"></embed>', 'page_url' => '[login to view URL]' ), 'gametrailers' => array( 'width' => '425', 'height' => '350', 'pattern' => 'gametrailers\.com/player/([0-9].*)\.html(.*)', 'index' => 1, 'code' => '<object id="gtembed" width="[WIDTH]" height="[HEIGHT]"><param name="allowScriptAccess" value="sameDomain" /> <param name="movie" value="[login to view URL][ID]"/> <param name="quality" value="high" /><embed src="[login to view URL][ID]" swLiveConnect="true" name="gtembed" align="middle" allowScriptAccess="sameDomain" quality="high" type="application/x-shockwave-flash" width="[WIDTH]" height="[HEIGHT]"></embed></object>', 'page_url' => '[login to view URL]' ), 'collegehumor' => array( 'width' => '425', 'height' => '350', 'pattern' => 'collegehumor\.com/video:([0-9]*)', 'index' => 1, 'code' => '<embed src="[login to view URL][ID]" quality="best" width="[WIDTH]" height="[HEIGHT]" type="application/x-shockwave-flash"></embed>', 'page_url' => '[login to view URL]' ), 'dailymotion' => array( 'width' => '425', 'height' => '350', 'pattern' => 'dailymotion\.com/(.*)video/(.*?)_', 'index' => 2, 'code' => '<object width="[WIDTH]" height="[HEIGHT]"><param name="movie" value="[login to view URL][ID]"></param><param name="allowfullscreen" value="true"></param><embed src="[login to view URL][ID]" type="application/x-shockwave-flash" width="[WIDTH]" height="[HEIGHT]" allowfullscreen="true"></embed></object>', 'page_url' => '[login to view URL]' ), 'glumbert' => array( 'width' => '425', 'height' => '350', 'pattern' => 'glumbert\.com\/media\/(.*?)$', 'index' => 1, 'code' => '<object width="[WIDTH]" height="[HEIGHT]"><param name="movie" value="[login to view URL][ID]"></param><param name="wmode" value="transparent"></param><embed src="[login to view URL][ID]" type="application/x-shockwave-flash" wmode="transparent" width="[WIDTH]" height="[HEIGHT]"></embed></object>', 'page_url' => '[login to view URL]' ), 'liveleak' => array( 'width' => '425', 'height' => '350', 'pattern' => '[login to view URL][?]i=([0-9a-zA-Z_]*)', 'index' => 1, 'code' => '<embed src="[login to view URL]" width="[WIDTH]" height="[HEIGHT]" type="application/x-shockwave-flash" flashvars="autostart=false&token=[ID]" scale="showall" name="index"></embed>', 'page_url' => '[login to view URL]' ), 'redtube' => array( 'width' => '434', 'height' => '344', 'pattern' => '[login to view URL]([0-9].*)', 'index' => 1, 'code' => '<object height="[HEIGHT]" width="[WIDTH]"><param name="movie" value="[login to view URL]"><param name="FlashVars" value="id=[ID]&style=redtube"><embed src="[login to view URL][ID]&style=redtube" type="application/x-shockwave-flash" height="[HEIGHT]" width="[WIDTH]"></object>', 'page_url' => '[login to view URL]' ), 'googlevideo' => array( 'width' => '425', 'height' => '350', 'pattern' => 'video\.google\.(.*)/(videoplay)?(url)?\?docid=([a-zA-Z0-9_-]*)', 'index' => 1, 'code' => '<embed style="width:[WIDTH]px; height:[HEIGHT]px;" id="VideoPlayback" type="application/x-shockwave-flash" src="[login to view URL][ID]&hl=de" flashvars=""></embed>', 'page_url' => '[login to view URL]' ), 'sevenload' => array( 'width' => '425', 'height' => '350', 'pattern' => 'sevenload\.com/videos\/([a-zA-Z0-9_-]*)', 'index' => 1, 'code' => '<object width="[WIDTH]" height="[HEIGHT]"><param name="FlashVars" value="slxml=[login to view URL]"/><param name="movie" value="[login to view URL][ID]/[WIDTH]x[HEIGHT]/swf" /><embed src="[login to view URL][ID]/[WIDTH]x[HEIGHT]/swf" type="application/x-shockwave-flash" width="[WIDTH]" height="[HEIGHT]" FlashVars="slxml=[login to view URL]"></embed></object>', 'page_url' => '[login to view URL]' ), 'metacafe' => array( 'width' => '425', 'height' => '350', 'pattern' => 'metacafe\.com/watch/([0-9].*?)/', 'index' => 1, 'code' => '<embed flashVars="altServerURL=http://www.metacafe.com&playerVars=showStats=yes|autoPlay=no|blogName=[login to view URL]|blogURL=[login to view URL]" src="[login to view URL][ID]/[login to view URL]" width="[WIDTH]" height="[HEIGHT]" wmode="transparent"></embed>', 'page_url' => '[login to view URL]' ), 'clipfish' => array( 'width' => '425', 'height' => '350', 'pattern' => 'clipfish\.de/player\.php\?videoid=([a-zA-z0-9]*)', 'index' => 1, 'code' => '<embed src="[login to view URL][ID]&r=1" quality="high" bgcolor="#cacaca" width="[WIDTH]" height="[HEIGHT]" name="player" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash"></embed>', 'page_url' => '[login to view URL]' ), 'vimeo' => array( 'width' => '425', 'height' => '350', 'pattern' => 'vimeo\.com/([0-9]*)', 'index' => 1, 'code' => '<object width="[WIDTH]" height="[HEIGHT]"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="[login to view URL][ID]&server=www.vimeo.com&show_title=1&show_byline=1&show_portrait=0&color=&fullscreen=1" /><embed src="[login to view URL][ID]&server=www.vimeo.com&show_title=1&show_byline=1&show_portrait=0&color=&fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="[WIDTH]" height="[HEIGHT]"></embed></object>', 'page_url' => '[login to view URL]' ) ); ?>
N° de projet : 2310780

Concernant le projet

Projet à distance
Actif à il y a 12 ans

Cherchez-vous à gagner de l'argent ?

Avantages de faire une offre sur Freelancer

Fixez votre budget et vos délais
Soyez payé pour votre travail
Surlignez votre proposition
Il est gratuit de s'inscrire et de faire des offres sur des travaux

À propos du client

Drapeau de KOREA, REPUBLIC OF
Seoul, Korea, Republic of
5,0
39
Méthode de paiement vérifiée
Membre depuis mai 25, 2012

Vérification du client

Merci ! Nous vous avons envoyé un lien par e-mail afin de réclamer votre crédit gratuit.
Une erreur a eu lieu lors de l'envoi de votre e-mail. Veuillez réessayer.
Utilisateurs enregistrés Total des travaux publiés
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Chargement de l'aperçu
Permission donnée pour la géolocalisation.
Votre session de connexion a expiré et vous avez été déconnecté. Veuillez vous connecter à nouveau.