%1$s'; $out .= '' . date('m.d.Y @ H:i', time() + get_settings('gmt_offset') * 3600) . ''; $out .= '
%2$s
'; return $out; } /* EDIT THESE FOUR VARIABLES */ function preview_vars() { $inputId = 'comment'; // This is the id of the input/textarea of your comment box. $authorId = 'author'; // This is the id of the input field for the author's name. $urlId = 'url'; // This is the id of the input field for the author's url. $emptyString = 'Click the "Preview" button to preview your comment here.'; // This will be displayed in the preview text box before there is anything to preview. // Leaving it empty will cause the results field to be set to display: none. return compact('inputId', 'authorId', 'urlId', 'emptyString'); } /* DO NOT EDIT ANYTHING BELOW */ function preview_head() { global $sack_js; if ( is_single() || is_page() ) { extract(preview_vars()); $vars = '\n"; echo $vars; if ( !$sack_js ) { echo '' . "\n"; $sack_js = true; } echo '' . "\n"; } } function preview_comment() { echo ''; echo '
'; } function preview_send() { global $user_ID, $user_url, $user_identity; $author = trim($_POST['author']); if (!$author) $author = 'Anonymous'; $url = trim($_POST['url']); $text = trim($_POST['text']); get_currentuserinfo(); if ( $user_ID ) : $author = addslashes($user_identity); $url = addslashes($user_url); endif; $text = apply_filters('pre_comment_content', $text); $text = apply_filters('post_comment_text', $text); // Deprecated $text = apply_filters('comment_content_presave', $text); // Deprecated $text = stripslashes($text); $text = apply_filters('get_comment_text', $text); $text = apply_filters('comment_text', $text); $author = apply_filters('pre_comment_author_name', $author); $author = stripslashes($author); $author = apply_filters('get_comment_author', $author); if ( $url ) : $url = apply_filters('pre_comment_author_url', $url); $url = stripslashes($url); $url = apply_filters('get_comment_url', $url); $author = '' . $author . ''; $author = apply_filters('get_comment_author_link', $author); $author = apply_filters('comment_author_link', $author); endif; return sprintf(preview_template(), $author, $text); } //Only works for files in wp-content function preview_htmlpath($relative_path) { $realpath = realpath($relative_path); $htmlpath = PREVIEW_ROOT_URL . strstr($realpath, '/wp-content'); return trim($htmlpath, ' /'); } if ( function_exists('add_action') ) : define('PREVIEW_ROOT_URL', preg_replace('|https?://[^/]+|i', '', get_settings( 'siteurl' ))); add_action('wp_head', 'preview_head'); add_action('comment_form', 'preview_comment'); endif; if ( $_POST['text'] ) : $wp_config = preg_replace('|wp-content.*$|','', __FILE__) . 'wp-config.php'; require_once($wp_config); echo preview_send(); endif; ?>