Skip to content

Instantly share code, notes, and snippets.

@dwelch2344
Created October 13, 2014 18:45
Show Gist options
  • Save dwelch2344/76f955323f09d0ff4f45 to your computer and use it in GitHub Desktop.
Save dwelch2344/76f955323f09d0ff4f45 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 = "
<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>";
return $result;
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment