diff --git a/README.md b/README.md index ebf6d923..adf81c88 100644 --- a/README.md +++ b/README.md @@ -38,9 +38,9 @@ https://youtu.be/it1noNCTXa4 ## Requirement -* PHP version > 5.3 +* PHP version > 5.3.6 * WordPress version > 4.0 -* Tested up to 5.0.2 +* Tested up to 5.0.3 ## Download diff --git a/README.txt b/README.txt index 034945e2..4eeae315 100644 --- a/README.txt +++ b/README.txt @@ -2,9 +2,9 @@ Contributors: terrylin Tags: markdown, markdown editor, katex, mermaid, flow chart, github Requires at least: 4.0 -Tested up to: 5.0.2 -Stable tag: 1.4.2 -Requires PHP: 5.3 +Tested up to: 5.0.3 +Stable tag: 1.4.3 +Requires PHP: 5.3.6 License: GPLv3 or later License URI: https://www.gnu.org/licenses/gpl.html @@ -161,6 +161,11 @@ GNU General Public License for more details. * Fix bug: HTML-to-Markdown helper. += 1.4.3 + +* Bug fix - issue #3 - Thank to wojciehm@github for reporting this issue. +* Display a notice if user's PHP version does not meet the minimum requirement. + == Known Issues == * #1 - Sequence Diagram: this feature is only available in WordPress version > 4.5, because it uses underscore.js, and it has confict issues with WordPress' plupload uploader in early version. You can use Mermaid instead of it. We have already hidden this option in setting while an user uses that version < 4.5 diff --git a/githuber-md.php b/githuber-md.php index 34caa3e7..97c75207 100644 --- a/githuber-md.php +++ b/githuber-md.php @@ -7,14 +7,14 @@ * * @package Githuber * @since 1.0.0 - * @version 1.4.2 + * @version 1.4.3 */ /** * Plugin Name: WP Githuber MD * Plugin URI: https://github.com/terrylinooo/githuber-md * Description: An all-in-one Markdown plugin for your WordPress sites. - * Version: 1.4.2 + * Version: 1.4.3 * Author: Terry Lin * Author URI: https://terryl.in/ * License: GPL 3.0 @@ -64,7 +64,7 @@ define( 'GITHUBER_PLUGIN_URL', plugin_dir_url( __FILE__ ) ); define( 'GITHUBER_PLUGIN_PATH', __FILE__ ); define( 'GITHUBER_PLUGIN_LANGUAGE_PACK', dirname( plugin_basename( __FILE__ ) ) . '/languages' ); -define( 'GITHUBER_PLUGIN_VERSION', '1.4.2' ); +define( 'GITHUBER_PLUGIN_VERSION', '1.4.3' ); define( 'GITHUBER_PLUGIN_TEXT_DOMAIN', 'wp-githuber-md' ); /** @@ -80,8 +80,20 @@ // Composer autoloader. require_once GITHUBER_PLUGIN_DIR . 'vendor/autoload.php'; -// Load main launcher class of WP Githuber MD plugin. -$gitbuber = new Githuber(); +if ( version_compare( phpversion(), '5.3.6', '>=' ) ) { -// Let's go! -$gitbuber->init(); + // Load main launcher class of WP Githuber MD plugin. + $gitbuber = new Githuber(); + // Let's go! + $gitbuber->init(); + +} else { + /** + * Prompt a warning message while PHP version does not meet the minimum requirement. + * And, nothing to do. + */ + function githuber_md_warning() { + echo githuber_load_view( 'message/php-version-warning' ); + } + add_action( 'admin_notices', 'githuber_md_warning' ); +} diff --git a/src/Models/Markdown.php b/src/Models/Markdown.php index 5711983d..6c3a5ee9 100644 --- a/src/Models/Markdown.php +++ b/src/Models/Markdown.php @@ -7,7 +7,7 @@ * * @package Githuber * @since 1.0.0 - * @version 1.0.0 + * @version 1.4.3 */ namespace Githuber\Model; diff --git a/src/Modules/MarkdownParser.php b/src/Modules/MarkdownParser.php index 4ea739da..5a7f9181 100644 --- a/src/Modules/MarkdownParser.php +++ b/src/Modules/MarkdownParser.php @@ -8,65 +8,38 @@ * * @package Githuber * @since 1.0.0 - * @version 1.4.3 + * @version 1.0.0 */ namespace Githuber\Module; +use ParsedownExtra; -if ( version_compare( phpversion(), '5.3.6', '>=' ) ) { +class MarkdownParser extends ParsedownExtra { - class MarkdownParser extends \ParsedownExtra { - /** - * Constructer. - */ - public function __construct() { - parent::__construct(); - } - - /** - * Remove bare

elements.

s with attributes will be preserved. - * - * @param string $text HTML content. - * @return string

-less content. - */ - public function remove_bare_p_tags( $text ) { - return preg_replace( "#

(.*?)

(\n|$)#ums", '$1$2', $text ); - } - - /** - * Teansform Markdown to HTML. - * - * @param string $text Markdown content. - */ - public function transform( $text ) { - $parsed_content = $this->text( $text ); - return $parsed_content; - } + /** + * Constructer. + */ + public function __construct() { + parent::__construct(); } -} else { - - class MarkdownParser extends \Parsedown { + /** + * Remove bare

elements.

s with attributes will be preserved. + * + * @param string $text HTML content. + * @return string

-less content. + */ + public function remove_bare_p_tags( $text ) { + return preg_replace( "#

(.*?)

(\n|$)#ums", '$1$2', $text ); + } - /** - * Remove bare

elements.

s with attributes will be preserved. - * - * @param string $text HTML content. - * @return string

-less content. - */ - public function remove_bare_p_tags( $text ) { - return preg_replace( "#

(.*?)

(\n|$)#ums", '$1$2', $text ); - } - - /** - * Teansform Markdown to HTML. - * - * @param string $text Markdown content. - */ - public function transform( $text ) { - $parsed_content = $this->text( $text ); - return $parsed_content; - } + /** + * Teansform Markdown to HTML. + * + * @param string $text Markdown content. + */ + public function transform( $text ) { + $parsed_content = $this->text( $text ); + return $parsed_content; } } - diff --git a/src/Views/message/php-version-warning.php b/src/Views/message/php-version-warning.php new file mode 100644 index 00000000..6621a7b7 --- /dev/null +++ b/src/Views/message/php-version-warning.php @@ -0,0 +1,21 @@ + + +
+

+ 5.3.6, and yours is %1s.', 'wp-githuber-md' ), $php_version ) ?>
+ +

+
\ No newline at end of file