add comicpress style and allow showing of approved transcript credits
This commit is contained in:
parent
d7877a46af
commit
35513bfc61
@ -19,10 +19,27 @@ class WDTSDisplayFilters {
|
|||||||
* @return string The processed transcription text.
|
* @return string The processed transcription text.
|
||||||
*/
|
*/
|
||||||
function the_media_transcript($transcript, $content = "") {
|
function the_media_transcript($transcript, $content = "") {
|
||||||
$content = do_shortcode($transcript);
|
$content = $this->_process_transcript_content($transcript);
|
||||||
|
return array($transcript, '<div class="wdts-transcript">' . $content . '</div>');
|
||||||
|
}
|
||||||
|
|
||||||
|
function the_approved_credit($user, $content = '') {
|
||||||
|
return '<div class="wdts-approved-credit">' . sprintf(__('Written by %1$s <strong>%2$s</strong>', 'what-did-they-say'), get_avatar($user->ID, 20), $user->user_nicename) . '</div>';
|
||||||
|
}
|
||||||
|
|
||||||
|
function _process_transcript_content($transcript) {
|
||||||
|
$content = do_shortcode($transcript['transcript']);
|
||||||
$options = get_option('what-did-they-say-options');
|
$options = get_option('what-did-they-say-options');
|
||||||
if ($options['use_nl2br']) { $content = nl2br($content); }
|
if ($options['use_nl2br']) { $content = nl2br($content); }
|
||||||
return array($transcript, '<div class="wdts-transcript">' . $content . '</div>');
|
|
||||||
|
if ($options['show_approved_credit']) {
|
||||||
|
$user = get_userdata($transcript['user_id']);
|
||||||
|
if (!empty($user)) {
|
||||||
|
$content .= apply_filters('the_approved_credit', $user, '');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $content;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -19,6 +19,7 @@ class WhatDidTheySayAdmin {
|
|||||||
'search_integration' => true,
|
'search_integration' => true,
|
||||||
'excerpt_distance' => 30,
|
'excerpt_distance' => 30,
|
||||||
'use_nl2br' => false,
|
'use_nl2br' => false,
|
||||||
|
'show_approved_credit' => true,
|
||||||
'high_insertion_level' => false,
|
'high_insertion_level' => false,
|
||||||
'hide_transcript' => array(
|
'hide_transcript' => array(
|
||||||
'home' => true,
|
'home' => true,
|
||||||
@ -140,6 +141,7 @@ class WhatDidTheySayAdmin {
|
|||||||
foreach (array(
|
foreach (array(
|
||||||
array('the_media_transcript', 2),
|
array('the_media_transcript', 2),
|
||||||
array('the_language_name', 2),
|
array('the_language_name', 2),
|
||||||
|
array('the_approved_credit', 2),
|
||||||
array('the_matching_transcript_excerpts', 3),
|
array('the_matching_transcript_excerpts', 3),
|
||||||
array('the_transcript_language_name', 3),
|
array('the_transcript_language_name', 3),
|
||||||
array('the_transcript_format_string', 1),
|
array('the_transcript_format_string', 1),
|
||||||
@ -806,7 +808,7 @@ class WhatDidTheySayAdmin {
|
|||||||
if (current_user_can('edit_themes')) {
|
if (current_user_can('edit_themes')) {
|
||||||
$options = get_option('what-did-they-say-options');
|
$options = get_option('what-did-they-say-options');
|
||||||
|
|
||||||
foreach (array('load_default_styles', 'use_nl2br', 'transcript_effects', 'allow_html') as $field) { $options[$field] = isset($info[$field]); }
|
foreach (array('load_default_styles', 'use_nl2br', 'transcript_effects', 'allow_html', 'show_approved_credit') as $field) { $options[$field] = isset($info[$field]); }
|
||||||
$options['excerpt_distance'] = !empty($info['excerpt_distance']) ? $info['excerpt_distance'] : 30;
|
$options['excerpt_distance'] = !empty($info['excerpt_distance']) ? $info['excerpt_distance'] : 30;
|
||||||
foreach (array_keys($options['hide_transcript']) as $type) {
|
foreach (array_keys($options['hide_transcript']) as $type) {
|
||||||
$options['hide_transcript'][$type] = isset($info['hide_transcript'][$type]);
|
$options['hide_transcript'][$type] = isset($info['hide_transcript'][$type]);
|
||||||
|
@ -36,6 +36,14 @@
|
|||||||
<?php _e('Turn transcript line breaks into HTML new lines (uses <a href="http://us2.php.net/nl2br" target="external">nl2br()</a>)', 'what-did-they-say') ?>
|
<?php _e('Turn transcript line breaks into HTML new lines (uses <a href="http://us2.php.net/nl2br" target="external">nl2br()</a>)', 'what-did-they-say') ?>
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
|
<label>
|
||||||
|
<input type="checkbox"
|
||||||
|
name="wdts[show_approved_credit]"
|
||||||
|
value="yes"
|
||||||
|
<?php echo ($options['show_approved_credit'] ? 'checked="checked"' : '') ?> />
|
||||||
|
<?php _e('Give credit to the transcriber on approved transcripts.', 'what-did-they-say') ?>
|
||||||
|
</label>
|
||||||
|
|
||||||
<label>
|
<label>
|
||||||
<input type="checkbox"
|
<input type="checkbox"
|
||||||
name="wdts[allow_html]"
|
name="wdts[allow_html]"
|
||||||
|
@ -5,6 +5,6 @@
|
|||||||
<?php } ?>
|
<?php } ?>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<?php echo end(apply_filters('the_media_transcript', implode("\n", $sample_transcript), '')) ?>
|
<?php echo end(apply_filters('the_media_transcript', array('transcript' => implode("\n", $sample_transcript), 'user_id' => 1), '')) ?>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
@ -52,7 +52,10 @@
|
|||||||
<textarea name="wdts[transcripts][<?php echo $code ?>][transcript]" style="width: 99%; height: 200px"><?php echo $approved_transcript_text ?></textarea>
|
<textarea name="wdts[transcripts][<?php echo $code ?>][transcript]" style="width: 99%; height: 200px"><?php echo $approved_transcript_text ?></textarea>
|
||||||
<?php _e('User to credit: ', 'what-did-they-say') ?>
|
<?php _e('User to credit: ', 'what-did-they-say') ?>
|
||||||
<select name="wdts[transcripts][<?php echo $code ?>][user_id]">
|
<select name="wdts[transcripts][<?php echo $code ?>][user_id]">
|
||||||
|
<?php foreach ($users as $user) { ?>
|
||||||
|
<option value="<?php echo $user->ID ?>"
|
||||||
|
<?php echo ($user->ID == $transcript['user_id']) ? 'selected="selected"' : '' ?>><?php echo $user->user_login ?></option>
|
||||||
|
<?php } ?>
|
||||||
</select>
|
</select>
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
@ -39,3 +39,9 @@ div.wdts-transcript div.wdts-dialog span.wdts-speech {
|
|||||||
.wdts-transcript-opener {
|
.wdts-transcript-opener {
|
||||||
margin: 0.5em 0;
|
margin: 0.5em 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.wdts-approved-credit {
|
||||||
|
padding-top: 3px;
|
||||||
|
margin-top: 3px;
|
||||||
|
border-top: dotted #666 1px
|
||||||
|
}
|
@ -119,7 +119,7 @@ WhatDidTheySay.setup_transcript_editor = function(container) {
|
|||||||
'wdts[post_id]': post_id
|
'wdts[post_id]': post_id
|
||||||
};
|
};
|
||||||
|
|
||||||
container.select('textarea').each(function(t) {
|
container.select('textarea, select').each(function(t) {
|
||||||
parameters[t.name] = t.value;
|
parameters[t.name] = t.value;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
50
transcript-filters/comicpress/ComicPress.css
Normal file
50
transcript-filters/comicpress/ComicPress.css
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
div.wdts-transcript {
|
||||||
|
border: solid #555555 1px;
|
||||||
|
padding: 0 5px;
|
||||||
|
margin: 15px 0;
|
||||||
|
background-color: #FFFFFF;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.wdts-transcript div, div.wdts-transcript span {
|
||||||
|
font-size: 11px
|
||||||
|
}
|
||||||
|
|
||||||
|
div.wdts-transcript-inner {
|
||||||
|
border-left: dotted #333 4px;
|
||||||
|
border-right: dotted #333 4px;
|
||||||
|
padding: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.wdts-transcript div.wdts-scene-heading {
|
||||||
|
text-transform: uppercase;
|
||||||
|
text-align: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.wdts-transcript div.wdts-dialog {
|
||||||
|
text-align: inherit
|
||||||
|
}
|
||||||
|
|
||||||
|
div.wdts-transcript div.wdts-dialog span {
|
||||||
|
display: inline
|
||||||
|
}
|
||||||
|
|
||||||
|
div.wdts-transcript div.wdts-dialog span.wdts-name {
|
||||||
|
text-transform: inherit;
|
||||||
|
font-weight: bold
|
||||||
|
}
|
||||||
|
|
||||||
|
div.wdts-transcript div.wdts-dialog span.wdts-speech {
|
||||||
|
margin: 0
|
||||||
|
}
|
||||||
|
|
||||||
|
div.wdts-transcript div.wdts-dialog span.wdts-direction {
|
||||||
|
font-style: italic
|
||||||
|
}
|
||||||
|
|
||||||
|
.wdts-transcript-opener {
|
||||||
|
margin: 0.5em 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.wdts-transcript-opener a {
|
||||||
|
font-family: georgia, 'times new roman';
|
||||||
|
}
|
40
transcript-filters/comicpress/ComicPressTranscriptBasic.inc
Normal file
40
transcript-filters/comicpress/ComicPressTranscriptBasic.inc
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
class ComicPressTranscriptBasic extends WDTSDisplayFilters {
|
||||||
|
/**
|
||||||
|
* Filter for dialog short code.
|
||||||
|
*/
|
||||||
|
function filter_shortcode_dialog($name, $direction, $speech, $content) {
|
||||||
|
$content = '<div class="wdts-dialog"><span class="wdts-name">' . $name . '</span>';
|
||||||
|
if (!empty($direction)) {
|
||||||
|
$content .= ' <span class="wdts-direction">' . $direction . '</span>';
|
||||||
|
}
|
||||||
|
$content .= ': <span class="wdts-speech">' . $speech . '</span></div>';
|
||||||
|
|
||||||
|
return array($name, $direction, $speech, $content);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle the_media_transcript filter.
|
||||||
|
* @param string $transcript The transcription text.
|
||||||
|
* @return string The processed transcription text.
|
||||||
|
*/
|
||||||
|
function the_media_transcript($transcript, $content = '') {
|
||||||
|
$content = $this->_process_transcript_content($transcript);
|
||||||
|
return array($transcript, '<div class="wdts-transcript"><div class="wdts-transcript-inner">' . $content . '</div></div>');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Build the opener/closer for transcripts.
|
||||||
|
*/
|
||||||
|
function the_transcript_opener($content = '') {
|
||||||
|
ob_start(); ?>
|
||||||
|
<div class="wdts-transcript-opener" style="display:none">
|
||||||
|
<a href="#" class="wdts-opener">↓ <?php _e('Transcript') ?></a>
|
||||||
|
<a href="#" class="wdts-closer">↑ <?php _e('Transcript') ?></a>
|
||||||
|
</div>
|
||||||
|
<?php return ob_get_clean();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
@ -136,10 +136,9 @@ function transcripts_display($language_format = null, $show_transcripts_string =
|
|||||||
|
|
||||||
if (!empty($post_transcripts)) {
|
if (!empty($post_transcripts)) {
|
||||||
foreach ($post_transcripts as $transcript) {
|
foreach ($post_transcripts as $transcript) {
|
||||||
extract($transcript, EXTR_PREFIX_ALL, "transcript");
|
$transcript_text = trim($transcript['transcript']);
|
||||||
$transcript_transcript = trim($transcript_transcript);
|
if (!empty($transcript_text)) {
|
||||||
if (!empty($transcript_transcript)) {
|
$transcripts[$transcript_language] = $transcript;
|
||||||
$transcripts[$transcript_language] = $transcript_transcript;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -164,11 +163,11 @@ function transcripts_display($language_format = null, $show_transcripts_string =
|
|||||||
$output[] = '<div class="wdts-transcript-bundle' . ($do_hide ? ' wdts-hide-transcript' : '') . '">';
|
$output[] = '<div class="wdts-transcript-bundle' . ($do_hide ? ' wdts-hide-transcript' : '') . '">';
|
||||||
|
|
||||||
foreach ($transcripts as $code => $transcript) {
|
foreach ($transcripts as $code => $transcript) {
|
||||||
$transcript = end(apply_filters('the_media_transcript', $transcript));
|
$transcript_text = end(apply_filters('the_media_transcript', $transcript, ''));
|
||||||
|
|
||||||
$output[] = end(apply_filters('the_transcript_language_name', $language_format, $code, ''));
|
$output[] = end(apply_filters('the_transcript_language_name', $language_format, $code, ''));
|
||||||
|
|
||||||
$output[] = '<div class="transcript-holder ' . $code . '">' . $transcript . '</div>';
|
$output[] = '<div class="transcript-holder ' . $code . '">' . $transcript_text . '</div>';
|
||||||
}
|
}
|
||||||
$output[] = '</div>';
|
$output[] = '</div>';
|
||||||
$output[] = '</div>';
|
$output[] = '</div>';
|
||||||
|
Loading…
Reference in New Issue
Block a user