Skip to content

Commit

Permalink
Add responsive-size option. Up version to 2.2.
Browse files Browse the repository at this point in the history
  • Loading branch information
zerocrates committed Nov 12, 2013
1 parent bd0ee03 commit daf6c83
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 8 deletions.
10 changes: 8 additions & 2 deletions Html5MediaPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,14 @@ public function hookUpgrade($args)
if (version_compare($oldVersion, '1.1', '<')) {
$this->hookInstall();
}
$settings = unserialize(get_option('html5_media_settings'));
if (version_compare($oldVersion, '2.1', '<')) {
$settings = unserialize(get_option('html5_media_settings'));
$settings['audio']['options']['width'] = 400;
set_option('html5_media_settings', serialize($settings));
}
if (version_compare($oldVersion, '2.2', '<')) {
$settings['video']['options']['responsive'] = false;
}
set_option('html5_media_settings', serialize($settings));
}

public function hookInitialize()
Expand Down Expand Up @@ -120,6 +123,7 @@ public function hookConfig()
$video = $_POST['video'];
$settings['video']['options']['width'] = (int) $video['options']['width'];
$settings['video']['options']['height'] = (int) $video['options']['height'];
$settings['video']['options']['responsive'] = (bool) $video['options']['responsive'];
$settings['video']['types'] = explode(',', $video['types']);
$settings['video']['extensions'] = explode(',', $video['extensions']);

Expand Down Expand Up @@ -181,6 +185,8 @@ private static function _media($type, $file, $options)
$mediaOptions .= ' controls';
if ($options['loop'])
$mediaOptions .= ' loop';
if ($options['responsive'])
$mediaOptions .= ' style="width:100%;height:100%"';

$filename = html_escape($file->getWebPath('original'));

Expand Down
11 changes: 11 additions & 0 deletions config-form.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,17 @@
<?php echo $view->formText('video[options][height]', $video['options']['height']); ?>
</div>
</div>
<div class="field">
<div class="two columns alpha">
<?php echo $view->formLabel('video[options][responsive]', __('Responsive Sizing')); ?>
</div>
<div class="inputs five columns omega">
<p class="explanation">
<?php echo __('Check the box below to allow the video player to automatically match its size to its container.'); ?>
</p>
<?php echo $view->formCheckbox('video[options][responsive]', null, array('checked' => $video['options']['responsive'])); ?>
</div>
</div>
<div class="field">
<div class="two columns alpha">
<?php echo $view->formLabel('video[types]', __('MIME Types')); ?>
Expand Down
20 changes: 15 additions & 5 deletions languages/template.pot
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,33 @@ msgstr ""
msgid "Video Settings"
msgstr ""

#: config-form.php:22 config-form.php:41 config-form.php:67
#: config-form.php:22
msgid "Responsive Sizing"
msgstr ""

#: config-form.php:26
msgid ""
"Check the box below to allow the video player to automatically match its "
"size to its container."
msgstr ""

#: config-form.php:33 config-form.php:60 config-form.php:86
msgid "MIME Types"
msgstr ""

#: config-form.php:30 config-form.php:49 config-form.php:75
#: config-form.php:41 config-form.php:68 config-form.php:94
msgid "Extensions"
msgstr ""

#: config-form.php:38
#: config-form.php:49
msgid "Audio Settings"
msgstr ""

#: config-form.php:57
#: config-form.php:76
msgid "Text Settings"
msgstr ""

#: config-form.php:60
#: config-form.php:79
msgid ""
"Text files are data like subtitles and chapter names. HTML5 Media wil "
"include them as tracks of audio or video files with the same original "
Expand Down
2 changes: 1 addition & 1 deletion plugin.ini
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ link="https://github.com/zerocrates/Html5Media#readme"
support_link="https://github.com/zerocrates/Html5Media/issues"
omeka_minimum_version="2.0"
omeka_target_version="2.0"
version="2.1"
version="2.2"

0 comments on commit daf6c83

Please sign in to comment.