diff --git a/wp-markdown-editor.php b/wp-markdown-editor.php index 200d870..4b27c02 100644 --- a/wp-markdown-editor.php +++ b/wp-markdown-editor.php @@ -15,14 +15,6 @@ exit; } -if (!function_exists('jetpack_require_lib')) { - include_once dirname( __FILE__ ) . '/jetpack/require-lib.php'; -} - -if (!class_exists('WPCom_Markdown')) { - include_once dirname( __FILE__ ) . '/jetpack/markdown/easy-markdown.php'; -} - define('PLUGIN_VERSION', '2.0'); define('MINIMUM_WP_VERSION', '3.1'); @@ -44,7 +36,7 @@ private function __construct() add_filter('quicktags_settings', array($this, 'quicktags_settings'), $editorId = 'content'); // Load Jetpack Markdown module - $this->load_jetpack_markdown_module(); + add_action( 'init', array( $this, 'load_jetpack_markdown_module' ) ); } public static function getInstance() @@ -75,6 +67,14 @@ function enqueue_stuffs() function load_jetpack_markdown_module() { + if ( ! function_exists( 'jetpack_require_lib' ) ) { + include_once dirname( __FILE__ ) . '/jetpack/require-lib.php'; + } + + if ( ! class_exists( 'WPCom_Markdown' ) ) { + include_once dirname( __FILE__ ) . '/jetpack/markdown/easy-markdown.php'; + } + // If the module is active, let's make this active for posting, period. // Comments will still be optional. add_filter('pre_option_' . WPCom_Markdown::POST_OPTION, '__return_true'); @@ -188,4 +188,4 @@ function plugin_deactivation() } -WpMarkdownEditor::getInstance(); \ No newline at end of file +WpMarkdownEditor::getInstance();