transcript previewing, thank you iframe
This commit is contained in:
parent
4a8bc1fcb6
commit
c5b70935fc
@ -92,8 +92,18 @@ class WhatDidTheySayAdmin {
|
|||||||
$filters = new WDTSDisplayFilters();
|
$filters = new WDTSDisplayFilters();
|
||||||
$reset_filter_value = true;
|
$reset_filter_value = true;
|
||||||
|
|
||||||
if (is_string($options['filters_to_use'])) {
|
$filter_to_use = false;
|
||||||
$target = $this->get_filters_dir() . '/' . preg_replace('#[^a-z0-9_-]#', '', strtolower($options['filters_to_use']));
|
if (is_string($options['filters_to_use'])) { $filter_to_use = $options['filters_to_use']; }
|
||||||
|
if (current_user_can('submit_transcriptions')) {
|
||||||
|
if (isset($_REQUEST['wdts'])) {
|
||||||
|
if (isset($_REQUEST['wdts']['filter_preview'])) {
|
||||||
|
$filter_to_use = $_REQUEST['wdts']['filter_preview'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($filter_to_use) {
|
||||||
|
$target = $this->get_filters_dir() . '/' . preg_replace('#[^a-z0-9_-]#', '', strtolower($filter_to_use));
|
||||||
if (is_dir($target)) {
|
if (is_dir($target)) {
|
||||||
$this->override_filter_info = array();
|
$this->override_filter_info = array();
|
||||||
foreach (glob($target . '/*') as $file) {
|
foreach (glob($target . '/*') as $file) {
|
||||||
@ -113,6 +123,7 @@ class WhatDidTheySayAdmin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// short codes
|
||||||
foreach (array(
|
foreach (array(
|
||||||
array('the_media_transcript', 2),
|
array('the_media_transcript', 2),
|
||||||
array('the_language_name', 2),
|
array('the_language_name', 2),
|
||||||
@ -132,7 +143,6 @@ class WhatDidTheySayAdmin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// short codes
|
|
||||||
foreach (get_class_methods($this) as $method) {
|
foreach (get_class_methods($this) as $method) {
|
||||||
if (strpos($method, "shortcode_") === 0) {
|
if (strpos($method, "shortcode_") === 0) {
|
||||||
$shortcode_name = str_replace("_", "-", str_replace("shortcode_", "", $method));
|
$shortcode_name = str_replace("_", "-", str_replace("shortcode_", "", $method));
|
||||||
@ -167,7 +177,23 @@ class WhatDidTheySayAdmin {
|
|||||||
include('partials/_editor-script.inc');
|
include('partials/_editor-script.inc');
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isset($_REQUEST['wdts']['filter_preview'])) {
|
||||||
|
$styles_to_include = array(
|
||||||
|
plugin_dir_url(dirname(__FILE__)) . 'css/wdts-defaults.css'
|
||||||
|
);
|
||||||
|
|
||||||
|
if (isset($this->override_filter_info['css'])) {
|
||||||
|
if (($path = realpath($this->override_filter_info['css'])) !== false) {
|
||||||
|
$styles_to_include[] = str_replace(realpath($this->_get_abspath()), '', $path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
include('partials/_sample-transcript.inc');
|
||||||
|
include('partials/_show-sample-transcript.inc');
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
if (isset($_REQUEST['wdts']['_nonce'])) {
|
if (isset($_REQUEST['wdts']['_nonce'])) {
|
||||||
if (wp_verify_nonce($_REQUEST['wdts']['_nonce'], 'what-did-they-say')) {
|
if (wp_verify_nonce($_REQUEST['wdts']['_nonce'], 'what-did-they-say')) {
|
||||||
if (($_REQUEST['wdts']['post_id'] <= 0) && ($_POST['post_ID'] > 0)) {
|
if (($_REQUEST['wdts']['post_id'] <= 0) && ($_POST['post_ID'] > 0)) {
|
||||||
@ -231,7 +257,9 @@ class WhatDidTheySayAdmin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (isset($this->override_filter_info['css'])) {
|
if (isset($this->override_filter_info['css'])) {
|
||||||
wp_enqueue_style('wdts-override', str_replace(realpath($this->_get_abspath()), '', realpath($this->override_filter_info['css'])));
|
if (($path = realpath($this->override_filter_info['css'])) !== false) {
|
||||||
|
wp_enqueue_style('wdts-override', str_replace(realpath($this->_get_abspath()), '', $path));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($options['transcript_effects']) {
|
if ($options['transcript_effects']) {
|
||||||
|
@ -67,7 +67,7 @@
|
|||||||
<?php if (!empty($available_filters)) { ?>
|
<?php if (!empty($available_filters)) { ?>
|
||||||
<label>
|
<label>
|
||||||
<?php _e('Use the selected transcript filter set:', 'what-did-they-say') ?>
|
<?php _e('Use the selected transcript filter set:', 'what-did-they-say') ?>
|
||||||
<select name="wdts[filters_to_use]">
|
<select id="wdts-filters-to-use" name="wdts[filters_to_use]">
|
||||||
<option value="__default__"><?php _e('(default)', 'what-did-they-say') ?></option>
|
<option value="__default__"><?php _e('(default)', 'what-did-they-say') ?></option>
|
||||||
<?php foreach ($available_filters as $filter_name) { ?>
|
<?php foreach ($available_filters as $filter_name) { ?>
|
||||||
<option value="<?php echo $filter_name ?>"<?php echo ($options['filters_to_use'] == $filter_name) ? ' selected="selected"' : '' ?>><?php echo $filter_name ?></option>
|
<option value="<?php echo $filter_name ?>"<?php echo ($options['filters_to_use'] == $filter_name) ? ' selected="selected"' : '' ?>><?php echo $filter_name ?></option>
|
||||||
@ -75,6 +75,8 @@
|
|||||||
</select>
|
</select>
|
||||||
</label>
|
</label>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|
||||||
|
<div id="wdts-sample-transcript-holder"></div>
|
||||||
|
|
||||||
<input class="button" type="submit" value="<?php _e('Change default styles', 'what-did-they-say') ?>" />
|
<input class="button" type="submit" value="<?php _e('Change default styles', 'what-did-they-say') ?>" />
|
||||||
</form>
|
</form>
|
||||||
|
8
classes/partials/_sample-transcript.inc
Normal file
8
classes/partials/_sample-transcript.inc
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
$sample_transcript = array();
|
||||||
|
$sample_transcript[] = __('[scene-heading]Ext. The Old Man\'s House[/scene-heading]', 'what-did-they-say');
|
||||||
|
$sample_transcript[] = __('[scene-action]John is walking down to the car parked in the driveway.[/scene-action]', 'what-did-they-say');
|
||||||
|
$sample_transcript[] = __('[dialog name="John" direction="(towards the house)"]Hey, where are the keys?[/dialog]', 'what-did-they-say');
|
||||||
|
|
||||||
|
?>
|
@ -1,9 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
$sample_transcript = array();
|
include('_sample-transcript.inc');
|
||||||
$sample_transcript[] = __('[scene-heading]Ext. The Old Man\'s House[/scene-heading]', 'what-did-they-say');
|
|
||||||
$sample_transcript[] = __('[scene-action]John is walking down to the car parked in the driveway.[/scene-action]', 'what-did-they-say');
|
|
||||||
$sample_transcript[] = __('[dialog name="John" direction="(towards the house)"]Hey, where are the keys?[/dialog]', 'what-did-they-say');
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<?php if (current_user_can('submit_transcriptions')) { ?>
|
<?php if (current_user_can('submit_transcriptions')) { ?>
|
||||||
|
12
classes/partials/_show-sample-transcript.inc
Normal file
12
classes/partials/_show-sample-transcript.inc
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<?php foreach ($styles_to_include as $style) { ?>
|
||||||
|
<link rel="stylesheet" href="<?php echo $style ?>" type="text/css" />
|
||||||
|
<?php } ?>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="wdts-transcript">
|
||||||
|
<?php echo do_shortcode(implode("\n", $sample_transcript)) ?>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -97,6 +97,19 @@
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
var iframe_url = '<?php echo plugin_dir_url(realpath(dirname(__FILE__) . '/../..')) . 'what-did-they-say.php' ?>';
|
||||||
|
|
||||||
|
var load_sample_transcript = function() {
|
||||||
|
var which = $('wdts-filters-to-use').options[$('wdts-filters-to-use').selectedIndex].value;
|
||||||
|
$('wdts-sample-transcript-holder').innerHTML = '';
|
||||||
|
var iframe = new Element('iframe', { width: "100%", height: "200px", src: iframe_url + '?wdts[filter_preview]=' + which });
|
||||||
|
$('wdts-sample-transcript-holder').insert(iframe);
|
||||||
|
};
|
||||||
|
|
||||||
|
$('wdts-filters-to-use').observe('change', load_sample_transcript);
|
||||||
|
|
||||||
|
Event.observe(window, 'load', load_sample_transcript);
|
||||||
|
|
||||||
<?php if (isset($_POST['wdts']['return_page'])) { ?>
|
<?php if (isset($_POST['wdts']['return_page'])) { ?>
|
||||||
make_active($('<?php echo str_replace('-page-', '-tab-', $_POST['wdts']['return_page']) ?>'));
|
make_active($('<?php echo str_replace('-page-', '-tab-', $_POST['wdts']['return_page']) ?>'));
|
||||||
<?php } else { ?>
|
<?php } else { ?>
|
||||||
|
Loading…
Reference in New Issue
Block a user