_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->display_name) . '
'; } 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); } if ($options['show_approved_credit']) { $user = get_userdata($transcript['user_id']); if (!empty($user)) { $content .= apply_filters('the_approved_credit', $user, ''); } } return $content; } /** * Handle the_language_name filter. * @param string $language The name of the language. * @return string The processed language name. */ function the_language_name($language, $content = "") { return array($language, '

' . sprintf(apply_filters('the_transcript_format_string'), $language) . '

'); } /** * Handle showing the header above a bundle of live transcripts. */ function the_transcript_language_name($language_format, $code, $content) { if (is_null($language_format)) { $language_format = apply_filters('the_transcript_format_string', ''); } $language_options = new WDTSLanguageOptions(); return array($language_format, $code, '

' . sprintf($language_format, $language_options->get_language_name($code)) . '

'); } /** * The format string used to display ither a single or multiple language transcript header. */ function the_transcript_format_string($content) { return __('Transcript: %s', 'what-did-they-say'); } /** * The script.aculo.us effects to use when fancy effects are enabled. */ function the_transcript_transition_effect($is_opening = true, $content) { if ($is_opening) { return array(true, "function(t) { new Effect.BlindDown(t, { duration: 0.25 }); }"); } else { return array(false, "function(t) { new Effect.BlindUp(t, { duration: 0.25 }); }"); } } /** * Handle the_matching_transcript_excerpts. */ function the_matching_transcript_excerpts($transcripts, $search_string = '', $content = "") { $options = get_option('what-did-they-say-options'); ob_start(); if ($options['search_integration']) { if (!empty($search_string)) { $language_options = new WDTSLanguageOptions(); $options = get_option('what-did-they-say-options'); foreach ($transcripts as $transcript) { if (($pos = strpos($transcript['transcript'], $search_string)) !== false) { $l = strlen($transcript['transcript']) - 1; echo '
'; echo '

' . sprintf(__("%s transcript excerpt:", 'what-did-they-say'), $language_options->get_language_name($transcript['language'])) . '

'; echo '

'; $start_ellipsis = $end_ellipsis = true; foreach (array( 'start' => -1, 'end' => 1 ) as $variable => $direction) { ${$variable} = $pos + ($options['excerpt_distance'] * $direction); if ($variable == "end") { ${$variable} += strlen($search_string); } if (${$variable} < 0) { ${$variable} = 0; $start_ellipsis = false; } if (${$variable} > $l) { ${$variable} = $l; $end_ellipsis = false; } } $output = ""; if ($start_ellipsis) { $output .= "..."; } $output .= str_replace($search_string, "" . $search_string . "", trim(substr($transcript['transcript'], $start, $end - $start))); if ($end_ellipsis) { $output .= "..."; } echo $output; echo '

'; echo '
'; } } } } return array($transcripts, $search_string, ob_get_clean()); } /** * Filter for dialog short code. */ function filter_shortcode_dialog($name, $direction, $speech, $content) { $content = '
' . $name . ''; if (!empty($direction)) { $content .= ' ' . $direction . ''; } $content .= ' ' . $speech . '
'; return array($name, $direction, $speech, $content); } /** * Filter for scene heading short code. */ function filter_shortcode_scene_heading($description, $content) { return array($description, '
' . $description . '
'); } /** * Filter for scene action short code. */ function filter_shortcode_scene_action($description, $content) { return array($description, '
' . $description . '
', ); } } ?>