' . $match[2] . ': ' . $match[3] . '

'; } function wp_parsedownload_callback($match) { global $wp_parseupdate_default; if ($match[2] == '') $match[2] = $wp_parseupdate_default; return '

' . $match[2] . '

'; } function wp_imagemethod_callback($match) { $img = ''; $img = preg_replace('//', '', $img); preg_match('/src="(.*)"/', $img, $src_match); $src = $src_match[1]; switch($match[2]) { case 'overflow': return '' . $img . ''; break; case 'overflow-right': return '' . $img . ''; break; case 'overflow-center': return '' . $img . ''; break; case 'float-right': return '' . $img . ''; break; case 'float-left': return '' . $img . ''; break; } return $img; } function wp_mjp_formatting($content) { // update boxes $content = preg_replace_callback('/

(.*?)<\/update><\/p>/', 'wp_parseupdate_callback', $content); // download boxes $content = preg_replace_callback('/

(.*?)<\/download><\/p>/', 'wp_parsedownload_callback', $content); // single images $content = preg_replace_callback('//', 'wp_imagemethod_callback', $content); // left/right columns, clearing $content = preg_replace(array('/

<(left|right)><\/p>(.*?)

<\/\1><\/p>/s', '//'), array('

$2
', '
'), $content); return $content; } add_filter('the_content', 'wp_mjp_formatting'); ?>