From bad4e42ae55e76cb318fae3824c884b1a5251d09 Mon Sep 17 00:00:00 2001 From: Jeremy Herve Date: Mon, 24 Oct 2016 11:12:44 +0000 Subject: [PATCH 1/2] Module loading: load functions on init. This way we make sure everything is loaded in time, and not before the Jetpack plugin when it is installed. --- wp-markdown-editor.php | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/wp-markdown-editor.php b/wp-markdown-editor.php index 200d870..6bac6ba 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( $his, '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(); From 4d686af821fd72682b71d44e73fe319a66f2719e Mon Sep 17 00:00:00 2001 From: Jeremy Herve Date: Mon, 24 Oct 2016 12:42:13 +0000 Subject: [PATCH 2/2] Fix typo. --- wp-markdown-editor.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wp-markdown-editor.php b/wp-markdown-editor.php index 6bac6ba..4b27c02 100644 --- a/wp-markdown-editor.php +++ b/wp-markdown-editor.php @@ -36,7 +36,7 @@ private function __construct() add_filter('quicktags_settings', array($this, 'quicktags_settings'), $editorId = 'content'); // Load Jetpack Markdown module - add_action( 'init', array( $his, 'load_jetpack_markdown_module' ) ); + add_action( 'init', array( $this, 'load_jetpack_markdown_module' ) ); } public static function getInstance()