';
/* Split the content to get individual chat rows. */
$chat_rows = preg_split( "/(\r?\n)+|(
\s*)+/", $content );
/* Loop through each row and format the output. */
foreach ( $chat_rows as $chat_row ) {
/* If a speaker is found, create a new chat row with speaker and text. */
if ( strpos( $chat_row, $separator ) ) {
/* Split the chat row into author/text. */
$chat_row_split = explode( ':', trim( $chat_row ), 2 );
/* Get the chat author and strip tags. */
$chat_author = strip_tags( trim( $chat_row_split[0] ) );
/* Get the chat text. */
$chat_text = trim( $chat_row_split[1] );
/* Get the chat row ID (based on chat author) to give a specific class to each row for styling. */
$speaker_id = framework_format_chat_row_id( $chat_author );
/* Open the chat row. */
$chat_output .= "\n\t\t\t\t" . '
element. */ function framework_post_format_quote( $content ) { if ( has_post_format( 'quote' ) ) { preg_match( '//', $content, $matches ); if ( empty( $matches ) ) $content = " {$content}"; } return $content; } /* This function automatically retrieves the video from the post editor. */ function framework_get_the_video() { global $wp_embed; /* If this is not a 'video' post, return. */ if ( !has_post_format( 'video' ) ) return false; /* Get the post content. */ $content = get_the_content(); /* Set the default $embed variable to false. */ $embed = false; /* Use WP's built in WP_Embed class methods to handle the dirty work. */ add_filter( 'framework_video_shortcode_embed', array( $wp_embed, 'run_shortcode' ) ); add_filter( 'framework_video_auto_embed', array( $wp_embed, 'autoembed' ) ); /* We don't want to return a link when an embed doesn't work. Filter this to return false. */ add_filter( 'embed_maybe_make_link', '__return_false' ); /* Check for matches against the [embed] shortcode. */ preg_match_all( '|\[embed.*?](.*?)\[/embed\]|i', $content, $matches, PREG_SET_ORDER ); /* If matches were found, loop through them to see if we can hit the jackpot. */ if ( is_array( $matches ) ) { foreach ( $matches as $value ) { /* Apply filters (let WP handle this) to get an embedded video. */ $embed = apply_filters( 'framework_video_shortcode_embed', '[embed]' . $value[1]. '[/embed]' ); /* If no embed, continue looping through the array of matches. */ if ( empty( $embed ) ) continue; } } /* If no embed at this point and the user has 'auto embeds' turned on, let's check for URLs in the post. */ if ( empty( $embed ) && get_option( 'embed_autourls' ) ) { preg_match_all( '|^\s*(https?://[^\s"]+)\s*$|im', $content, $matches, PREG_SET_ORDER ); /* If URL matches are found, loop through them to see if we can get an embed. */ if ( is_array( $matches ) ) { foreach ( $matches as $value ) { /* Let WP work its magic with the 'autoembed' method. */ $embed = apply_filters( 'framework_video_auto_embed', $value[0] ); /* If no embed, continue looping through the array of matches. */ if ( empty( $embed ) ) continue; } } } /* Remove the maybe make link filter. */ remove_filter( 'embed_maybe_make_link', '__return_false' ); /* Return the embed. */ return $embed; } ?>