Created
August 29, 2013 11:52
-
-
Save stevelacey/6377099 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Post extends \WPUF_Add_Post { | |
function __construct() { | |
remove_shortcode('wpuf_addpost'); | |
add_shortcode('wpuf_addpost', array($this, 'shortcode')); | |
} | |
function post_form($post_type) { | |
$reflection = new \ReflectionMethod('WPUF_Add_Post', 'post_form'); | |
$file = file($reflection->getFileName()); | |
$content = implode( | |
'', | |
array_slice( | |
$file, | |
$reflection->getStartLine(), | |
$reflection->getEndLine() - $reflection->getStartLine() - 1 | |
) | |
); | |
$content = preg_replace( | |
'#wp_dropdown_categories\( \'#', | |
'wp_dropdown_categories( \'selected=' . get_user_option('default_category'). '&', | |
$content | |
); | |
$content = str_replace('$this', '$that', $content); | |
$post_form = create_function('$that, $post_type', $content); | |
return $post_form($this, $post_type); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment