From 6622b88dfef12729c4b1423ce598f07e4ac14d53 Mon Sep 17 00:00:00 2001 From: John Bintz Date: Sun, 16 Aug 2009 16:15:01 -0400 Subject: [PATCH] language selector working --- classes/WhatDidTheySayAdmin.php | 22 ++++++++++++++- what-did-they-say.php | 49 +++++++++++++++++++++++++++++++++ 2 files changed, 70 insertions(+), 1 deletion(-) diff --git a/classes/WhatDidTheySayAdmin.php b/classes/WhatDidTheySayAdmin.php index f8b1b75..bbfdc40 100644 --- a/classes/WhatDidTheySayAdmin.php +++ b/classes/WhatDidTheySayAdmin.php @@ -48,6 +48,8 @@ class WhatDidTheySayAdmin { add_filter('the_media_transcript', array(&$this, 'the_media_transcript')); add_filter('the_language_name', array(&$this, 'the_language_name')); + add_filter('wp_footer', array(&$this, 'wp_footer')); + if (isset($_REQUEST['wdts'])) { if (isset($_REQUEST['wdts']['_nonce'])) { if (wp_verify_nonce($_REQUEST['wdts']['_nonce'], 'what-did-they-say')) { @@ -66,7 +68,25 @@ class WhatDidTheySayAdmin { function the_language_name($language) { return '

' . $language . '

'; } - + + function wp_footer() { ?> + + get_transcripts($post->ID) as $code => $transcript) { + $transcript = trim($transcript); + if (!empty($transcript)) { + $transcripts[$code] = $transcript; + } + } + + if (count($transcripts) > 0) { + $default_language = $what_did_they_say->get_default_language(); + + $output = array(); + $output[] = '
'; + + if (count($transcripts) == 1) { + list($code, $transcript) = each($transcripts); + $output[] = apply_filters('the_language_name', get_the_language_name($code)); + $output[] = apply_filters('the_media_transcript', $transcript); + } else { + $output[] = $dropdown_message; + $output[] = ''; + foreach ($transcripts as $code => $transcript) { + $language_name = apply_filters('the_language_name', get_the_language_name($code)); + $transcript = apply_filters('the_media_transcript', $transcript); + + $output[] = '
' . $language_name . $transcript . '
'; + } + } + $output[] = '
'; + + $output = apply_filters('the_media_transcript_select_and_display', implode("\n", $output)); + echo $output; + } +} + ?> \ No newline at end of file