From 6c79e0c077971029343b2dff30017571ea118438 Mon Sep 17 00:00:00 2001 From: Klaus Weidenbach Date: Thu, 2 Mar 2017 23:25:04 +0100 Subject: :arrow_up: :hammer: Upgrade Markdownify library. The current version 2.0.0 (alpha) throws deprecated warning with PHP7.1 and PHPUnit. Upgrade the HTML to Markdown converter for PHP to the current Markdownify 2.2.1. Used composer to manage this library. --- include/markdown.php | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'include/markdown.php') diff --git a/include/markdown.php b/include/markdown.php index 43d973808..7e1f1c42c 100644 --- a/include/markdown.php +++ b/include/markdown.php @@ -5,12 +5,12 @@ */ use Michelf\MarkdownExtra; +use Markdownify\Converter; require_once("include/oembed.php"); require_once("include/event.php"); require_once("include/html2bbcode.php"); require_once("include/bbcode.php"); -require_once("library/markdownify/markdownify.php"); function get_bb_tag_pos($s, $name, $occurance = 1) { @@ -367,7 +367,6 @@ function bb2diaspora_itemwallwall(&$item,$uplink = false) { function bb2diaspora_itembody($item, $force_update = false, $have_channel = false, $uplink = false) { - if(! get_iconfig($item,'diaspora','fields')) { $force_update = true; } @@ -454,7 +453,7 @@ function bb2diaspora_itembody($item, $force_update = false, $have_channel = fals return html_entity_decode($body); } -function bb2diaspora($Text,$preserve_nl = false, $fordiaspora = true) { +function bb2diaspora($Text, $preserve_nl = false, $fordiaspora = true) { // Re-enabling the converter again. // The bbcode parser now handles youtube-links (and the other stuff) correctly. @@ -496,11 +495,10 @@ function bb2diaspora($Text,$preserve_nl = false, $fordiaspora = true) { $Text = str_replace(array('<','>','&'),array('&_lt_;','&_gt_;','&_amp_;'),$Text); // Now convert HTML to Markdown - $md = new Markdownify(false, false, false); + $md = new Converter(Converter::LINK_AFTER_CONTENT, false, false); $Text = $md->parseString($Text); - // It also adds backslashes to our attempt at getting around the html entity preservation for some weird reason. $Text = str_replace(array('&\\_lt\\_;','&\\_gt\\_;','&\\_amp\\_;'),array('<','>','&'),$Text); @@ -522,7 +520,7 @@ function bb2diaspora($Text,$preserve_nl = false, $fordiaspora = true) { $Text = trim($Text); - call_hooks('bb2diaspora',$Text); + call_hooks('bb2diaspora', $Text); return $Text; } -- cgit v1.2.3