From 35513bfc618dda46ed66558522d9d55ced11e4e7 Mon Sep 17 00:00:00 2001 From: John Bintz Date: Sun, 25 Oct 2009 21:28:52 -0400 Subject: [PATCH] add comicpress style and allow showing of approved transcript credits --- classes/WDTSDisplayFilters.inc | 21 +++++++- classes/WhatDidTheySayAdmin.inc | 4 +- classes/partials/_default-styles.inc | 8 +++ classes/partials/_show-sample-transcript.inc | 2 +- classes/partials/meta-box.inc | 5 +- css/wdts-defaults.css | 6 +++ js/edit-transcripts.js | 2 +- transcript-filters/comicpress/ComicPress.css | 50 +++++++++++++++++++ .../comicpress/ComicPressTranscriptBasic.inc | 40 +++++++++++++++ what-did-they-say.php | 11 ++-- 10 files changed, 137 insertions(+), 12 deletions(-) create mode 100644 transcript-filters/comicpress/ComicPress.css create mode 100644 transcript-filters/comicpress/ComicPressTranscriptBasic.inc diff --git a/classes/WDTSDisplayFilters.inc b/classes/WDTSDisplayFilters.inc index 250866d..f04ad59 100644 --- a/classes/WDTSDisplayFilters.inc +++ b/classes/WDTSDisplayFilters.inc @@ -19,10 +19,27 @@ class WDTSDisplayFilters { * @return string The processed transcription text. */ function the_media_transcript($transcript, $content = "") { - $content = do_shortcode($transcript); + $content = $this->_process_transcript_content($transcript); + return array($transcript, '
' . $content . '
'); + } + + function the_approved_credit($user, $content = '') { + return '
' . sprintf(__('Written by %1$s %2$s', 'what-did-they-say'), get_avatar($user->ID, 20), $user->user_nicename) . '
'; + } + + function _process_transcript_content($transcript) { + $content = do_shortcode($transcript['transcript']); $options = get_option('what-did-they-say-options'); if ($options['use_nl2br']) { $content = nl2br($content); } - return array($transcript, '
' . $content . '
'); + + if ($options['show_approved_credit']) { + $user = get_userdata($transcript['user_id']); + if (!empty($user)) { + $content .= apply_filters('the_approved_credit', $user, ''); + } + } + + return $content; } /** diff --git a/classes/WhatDidTheySayAdmin.inc b/classes/WhatDidTheySayAdmin.inc index 1b88764..8c43336 100644 --- a/classes/WhatDidTheySayAdmin.inc +++ b/classes/WhatDidTheySayAdmin.inc @@ -19,6 +19,7 @@ class WhatDidTheySayAdmin { 'search_integration' => true, 'excerpt_distance' => 30, 'use_nl2br' => false, + 'show_approved_credit' => true, 'high_insertion_level' => false, 'hide_transcript' => array( 'home' => true, @@ -140,6 +141,7 @@ class WhatDidTheySayAdmin { foreach (array( array('the_media_transcript', 2), array('the_language_name', 2), + array('the_approved_credit', 2), array('the_matching_transcript_excerpts', 3), array('the_transcript_language_name', 3), array('the_transcript_format_string', 1), @@ -806,7 +808,7 @@ class WhatDidTheySayAdmin { if (current_user_can('edit_themes')) { $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; foreach (array_keys($options['hide_transcript']) as $type) { $options['hide_transcript'][$type] = isset($info['hide_transcript'][$type]); diff --git a/classes/partials/_default-styles.inc b/classes/partials/_default-styles.inc index 4710bf8..e3bebb3 100644 --- a/classes/partials/_default-styles.inc +++ b/classes/partials/_default-styles.inc @@ -36,6 +36,14 @@ nl2br())', 'what-did-they-say') ?> + +