and $said into the
, line by line. Note the pound (#) sign used above in the conversation. This allows you to add emphasis, in the form of italic text, to what someone says. Putting the # sign at the beginning of the line will put what that person said (not their name) on that particular line in italics. So the output of the above conversation from the plugin would look like this:
Chad:
Why did the chicken cross the road?
The Wife:
I don’t really care.
Chad:
To get to the other side.
Chad:
Really.
The Wife:
Really?
Chad:
Really.
The Wife:
You’re crazy.
That's it. */ /* Configuration Settings */ $default_conv_path = "http://www.super-cooper.com/conversations/"; // the absolute path of your // conversations folder /* --- STOP EDITING --- */ function conv_viewer($conv_text) { global $default_conv_path; $count = preg_match_all('//', $conv_text, $matches); for ($i = 0; $i < $count; $i++) { // Determine if the specified path is absolute, or relative to the root path // If it's neither, assume it's relative to the default path set on line 12 if (strpos(($matches[1][$i]), 'http://') !== false) { $file_path = $matches[1][$i]; } else if (substr(($matches[1][$i]), 0, 1) == '/') { $file_path = $_SERVER['DOCUMENT_ROOT'] . $matches[1][$i]; } else { $file_path = $default_conv_path . $matches[1][$i]; } // Open the file // If the file can't be found, print an error message if ($lines = @file($file_path)) { $conv_list = '
' . "\n"; foreach ($lines as $line_num => $line) { // If the line is blank, insert a space to prevent collapsing if (ltrim($line) == "") { $conv_list .= "\t" . '
 
' . "\n"; // Otherwise insert the line } else { $line = trim($line); // Trim leading/trailing whitespace // If it's an emphasized quote, then account for the # sign so it doesn't // get included in the person's name if (substr($line, 0, 1) == "#") { // Get the person's name from the line string $person = substr ($line, 1, (strpos($line, ",") - 1)); } else { $person = substr($line, 0, strpos($line, ",")); } // Get what the person said from the line string $said = substr($line, (strpos($line, ",") + 1)); // Next, put the person and their quote together // If the quote is emphasized, then apply the emphasis class to the
if (substr($line, 0, 1) == "#") { $conv_list .= '
' . htmlspecialchars($person) . ':
' . htmlspecialchars($said) . '
' . "\n"; } else { $conv_list .= '
' . htmlspecialchars($person) . ':
' . htmlspecialchars($said) . '
' . "\n"; } } } $conv_list .= "
"; } else { $conv_list = '

[The requested file ' . $file_path . ' could not be found]

'; } $conv_text = str_replace(($matches[0][$i]), $conv_list, $conv_text); } return $conv_text; } function fix_bad_p_conv($conv_text) { $text = str_replace('

', '
', $conv_text); $text = str_replace('

', '
', $conv_text); return $conv_text; } add_filter('the_content', 'conv_viewer', 9); add_filter('the_content', 'fix_bad_p_conv'); ?>