Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * The wiki plugin replaces certain functions using a filter.
- * This function removes/replaces those filters with the original code.
- *
- * @uses $wiki
- */
- function restore_original_functions() {
- global $wiki;
- if ( has_filter( 'comments_open', array($wiki, 'comments_open') ) ) {
- add_filter( 'comments_open', 'comments_open_restored', 15, 1 );
- }
- }
- /**
- * Restores the original comments_open() which is overridden in the wiki plugin.
- * Function below is the original in Wordpress version 1.5.0 with a change to the last line.
- * Original last line: return apply_filters( 'comments_open', $open, $post_id );
- *
- * @uses $post
- *
- * @param int $post_id An optional post ID to check instead of the current post.
- * @return bool True if the comments are open
- */
- function comments_open_restored( $post_id = null ) {
- $_post = get_post($post_id);
- $open = ( 'open' == $_post->comment_status );
- return apply_filters( 'comments_open_restored', $open, $post_id );
- }
- /**
- * Replacement for the $wiki->tabs() function used by the wiki plugin.
- * Takes the tabs value produced by $wiki->tabs() and strips out the
- * 'discussion', 'advanced', and 'create new' items.
- *
- * @uses $post, $incsub_tab_check, $wp_query, $wiki;
- *
- * @return string HTML code to display post/wiki tabs
- */
- function tabs() {
- global $post, $incsub_tab_check, $wp_query, $wiki;
- $wtabs = $wiki->tabs();
- $array = explode('</li>', $wtabs);
- unset($array[1]); // discussion tab
- unset($array[4]); // advanced
- unset($array[5]); // create new
- $array = array_values($array);
- $newtabs = implode('</li>', $array);
- return $newtabs;
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement