Skip to content

Instantly share code, notes, and snippets.

@danlangford
Forked from dwelch2344/quicktime-movieplayer.php
Last active August 29, 2015 14:07
Show Gist options
  • Save danlangford/4e0bc1216fac240371e6 to your computer and use it in GitHub Desktop.
Save danlangford/4e0bc1216fac240371e6 to your computer and use it in GitHub Desktop.
<?php
/*
Plugin Name: QuickTime Movie Player
Plugin URI: http://davidwelch.co/fixme
Description: Plays .mov files
Version: 0.1 BETA
Author: David Welch
Author URI: http://davidwelch.co
*/
/*
Movie Player
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
add_shortcode("mov", "mov_player_handler");
function mov_player_handler($attr, $content) {
$parsed = shortcode_atts(array(
'url' => '',
'width' => '940',
'height' => '600',
'scale' => '1'
), $attr);
$result = mov_player_function($parsed);
return $result;
}
function mov_player_function($attr) {
extract($attr);
$height2 = ($height + 120) . "px";
$height .= 'px';
$width .= 'px';
$scale= 'tofit';
$result = <<<EOD
<object codebase="http://www.apple.com/qtactivex/qtplugin.cab"
style="width: $width; height: $height;"
>
<param name="src" value="$url" />
<param name="controller" value="true" />
<param name="cache" value="False" />
<param name="autoplay" value="false" />
<param name="kioskmode" value="False" />
<param name="scale" value="$scale" />
<param name="width" value="$width"/>
<param name="height" value="$height"/>
<embed src="$url"
pluginspage="http://www.apple.com/quicktime/download/"
scale="$scale"
kioskmode="False"
qtsrc="$url"
cache="False"
style="width: $width; height: $height2;"
height="$height"
width="$width2"
controller="true"
type="video/quicktime"
autoplay="false" />
</object>
EOD;
return $result;
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment