aboutsummaryrefslogtreecommitdiffstats
path: root/include/markdown.php
diff options
context:
space:
mode:
authorKlaus Weidenbach <Klaus.Weidenbach@gmx.net>2017-03-02 23:25:04 +0100
committerKlaus Weidenbach <Klaus.Weidenbach@gmx.net>2017-03-05 01:14:15 +0100
commit6c79e0c077971029343b2dff30017571ea118438 (patch)
tree26809ee07eeee05240878bd08cfb4fdcf4bb450a /include/markdown.php
parent8e1716065ee01959fc799fa14ba627392a876afa (diff)
downloadvolse-hubzilla-6c79e0c077971029343b2dff30017571ea118438.tar.gz
volse-hubzilla-6c79e0c077971029343b2dff30017571ea118438.tar.bz2
volse-hubzilla-6c79e0c077971029343b2dff30017571ea118438.zip
: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.
Diffstat (limited to 'include/markdown.php')
-rw-r--r--include/markdown.php10
1 files changed, 4 insertions, 6 deletions
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('&lt;','&gt;','&amp;'),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('&lt;','&gt;','&amp;'),$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;
}