diff --git a/diaspora/diaspora.php b/diaspora/diaspora.php index 04d3c7ec..49a9cfc4 100644 --- a/diaspora/diaspora.php +++ b/diaspora/diaspora.php @@ -9,7 +9,6 @@ require_once 'addon/diaspora/Diaspora_Connection.php'; -use Friendica\Content\Text\BBCode; use Friendica\Core\Addon; use Friendica\Core\L10n; use Friendica\Core\PConfig; @@ -304,8 +303,10 @@ function diaspora_send(&$a,&$b) { $aspect = PConfig::get($b['uid'],'diaspora','aspect'); if ($handle && $password) { + logger('diaspora_send: all values seem to be okay', LOGGER_DEBUG); + require_once('include/bb2diaspora.php'); $tag_arr = []; $tags = ''; $x = preg_match_all('/\#\[(.*?)\](.*?)\[/',$b['tag'],$matches,PREG_SET_ORDER); @@ -337,7 +338,7 @@ function diaspora_send(&$a,&$b) { } while ($oldbody != $body); // convert to markdown - $body = BBCode::toMarkdown($body); + $body = bb2diaspora($body); // Adding the title if(strlen($title)) diff --git a/libertree/libertree.php b/libertree/libertree.php index 4d159bf0..06851238 100644 --- a/libertree/libertree.php +++ b/libertree/libertree.php @@ -5,8 +5,6 @@ * Version: 1.0 * Author: Tony Baldwin */ - -use Friendica\Content\Text\BBCode; use Friendica\Core\Addon; use Friendica\Core\L10n; use Friendica\Core\PConfig; @@ -186,6 +184,8 @@ function libertree_send(&$a,&$b) { $ltree_source .= " (".$b['app'].")"; if($ltree_url && $ltree_api_token && $ltree_blog && $ltree_source) { + + require_once('include/bb2diaspora.php'); $tag_arr = []; $tags = ''; $x = preg_match_all('/\#\[(.*?)\](.*?)\[/',$b['tag'],$matches,PREG_SET_ORDER); @@ -217,7 +217,7 @@ function libertree_send(&$a,&$b) { } while ($oldbody != $body); // convert to markdown - $body = BBCode::toMarkdown($body, false); + $body = bb2diaspora($body, false); // Adding the title if(strlen($title)) diff --git a/pumpio/pumpio.php b/pumpio/pumpio.php index a1ca2ade..8426c535 100644 --- a/pumpio/pumpio.php +++ b/pumpio/pumpio.php @@ -7,6 +7,7 @@ */ use Friendica\Content\Text\BBCode; +use Friendica\Content\Text\HTML; use Friendica\Core\Addon; use Friendica\Core\Config; use Friendica\Core\L10n; @@ -782,8 +783,6 @@ function pumpio_fetchtimeline(&$a, $uid) { $public = true; if ($public && !stristr($post->generator->displayName, $application_name)) { - require_once('include/html2bbcode.php'); - $_SESSION["authenticated"] = true; $_SESSION["uid"] = $uid; @@ -798,11 +797,11 @@ function pumpio_fetchtimeline(&$a, $uid) { } if ($post->object->displayName != "") - $_REQUEST["title"] = html2bbcode($post->object->displayName); + $_REQUEST["title"] = HTML::toBBCode($post->object->displayName); else $_REQUEST["title"] = ""; - $_REQUEST["body"] = html2bbcode($post->object->content); + $_REQUEST["body"] = HTML::toBBCode($post->object->content); // To-Do: Picture has to be cached and stored locally if ($post->object->fullImage->url != "") { @@ -1062,7 +1061,6 @@ function pumpio_dodelete(&$a, $uid, $self, $post, $own_id) { function pumpio_dopost(&$a, $client, $uid, $self, $post, $own_id, $threadcompletion = true) { require_once('include/items.php'); - require_once('include/html2bbcode.php'); if (($post->verb == "like") || ($post->verb == "favorite")) return pumpio_dolike($a, $uid, $self, $post, $own_id); @@ -1191,7 +1189,7 @@ function pumpio_dopost(&$a, $client, $uid, $self, $post, $own_id, $threadcomplet $postarray['author-avatar'] = $post->actor->image->url; $postarray['plink'] = $post->object->url; $postarray['app'] = $post->generator->displayName; - $postarray['body'] = html2bbcode($post->object->content); + $postarray['body'] = HTML::toBBCode($post->object->content); $postarray['object'] = json_encode($post); if ($post->object->fullImage->url != "") diff --git a/statusnet/statusnet.php b/statusnet/statusnet.php index c54ff55f..ad2da322 100644 --- a/statusnet/statusnet.php +++ b/statusnet/statusnet.php @@ -38,11 +38,11 @@ define('STATUSNET_DEFAULT_POLL_INTERVAL', 5); // given in minutes require_once __DIR__ . DIRECTORY_SEPARATOR . 'library' . DIRECTORY_SEPARATOR . 'statusnetoauth.php'; require_once 'include/enotify.php'; -use Codebird\Codebird; use CodebirdSN\CodebirdSN; use Friendica\App; use Friendica\Content\OEmbed; use Friendica\Content\Text\BBCode; +use Friendica\Content\Text\HTML; use Friendica\Content\Text\Plaintext; use Friendica\Core\Addon; use Friendica\Core\Config; @@ -582,7 +582,7 @@ function statusnet_post_hook(App $a, &$b) // New code that is able to post pictures require_once __DIR__ . DIRECTORY_SEPARATOR . 'library' . DIRECTORY_SEPARATOR . 'codebirdsn.php'; - $cb = \CodebirdSN\CodebirdSN::getInstance(); + $cb = CodebirdSN::getInstance(); $cb->setAPIEndpoint($api); $cb->setConsumerKey($ckey, $csecret); $cb->setToken($otoken, $osecret); @@ -1031,7 +1031,7 @@ function statusnet_fetchuser(App $a, $uid, $screen_name = "", $user_id = "") require_once __DIR__ . DIRECTORY_SEPARATOR . 'library' . DIRECTORY_SEPARATOR . 'codebirdsn.php'; - $cb = \CodebirdSN\CodebirdSN::getInstance(); + $cb = CodebirdSN::getInstance(); $cb->setConsumerKey($ckey, $csecret); $cb->setToken($otoken, $osecret); @@ -1068,8 +1068,6 @@ function statusnet_fetchuser(App $a, $uid, $screen_name = "", $user_id = "") function statusnet_createpost(App $a, $uid, $post, $self, $create_user, $only_existing_contact) { - require_once "include/html2bbcode.php"; - logger("statusnet_createpost: start", LOGGER_DEBUG); $api = PConfig::get($uid, 'statusnet', 'baseapi'); @@ -1186,7 +1184,7 @@ function statusnet_createpost(App $a, $uid, $post, $self, $create_user, $only_ex $postarray['allow_cid'] = '<' . $self['id'] . '>'; } - $postarray['body'] = html2bbcode($content->statusnet_html); + $postarray['body'] = HTML::toBBCode($content->statusnet_html); $converted = statusnet_convertmsg($a, $postarray['body'], false); $postarray['body'] = $converted["body"]; diff --git a/windowsphonepush/windowsphonepush.php b/windowsphonepush/windowsphonepush.php index 206b0883..3aaf1d30 100644 --- a/windowsphonepush/windowsphonepush.php +++ b/windowsphonepush/windowsphonepush.php @@ -28,6 +28,7 @@ use Friendica\App; use Friendica\Content\Text\BBCode; +use Friendica\Content\Text\HTML; use Friendica\Core\Addon; use Friendica\Core\L10n; use Friendica\Core\PConfig; @@ -211,10 +212,8 @@ function windowsphonepush_cron() if (substr($body, 0, 4) == "[url") { $body = "URL/Image ..."; } else { - require_once("include/html2plain.php"); - $body = BBCode::convert($body, false, 2, true); - $body = html2plain($body, 0); + $body = HTML::toPlaintext($body, 0); $body = ((strlen($body) > 137) ? substr($body, 0, 137) . "..." : $body); } } else { diff --git a/wppost/wppost.php b/wppost/wppost.php index 8d14b170..a2c11293 100644 --- a/wppost/wppost.php +++ b/wppost/wppost.php @@ -5,7 +5,9 @@ * Version: 1.1 * Author: Mike Macgirvin */ + use Friendica\Content\Text\BBCode; +use Friendica\Content\Text\HTML; use Friendica\Core\Addon; use Friendica\Core\L10n; use Friendica\Core\PConfig; @@ -146,7 +148,7 @@ function wppost_settings_post(&$a,&$b) { PConfig::set(local_user(),'wppost','shortcheck',trim($_POST['wp_shortcheck'])); $wp_backlink_text = notags(trim($_POST['wp_backlink_text'])); $wp_backlink_text = BBCode::convert($wp_backlink_text, false, 8); - $wp_backlink_text = html2plain($wp_backlink_text, 0, true); + $wp_backlink_text = HTML::toPlaintext($wp_backlink_text, 0, true); PConfig::set(local_user(),'wppost','wp_backlink_text', $wp_backlink_text); } @@ -221,8 +223,6 @@ function wppost_send(&$a,&$b) { } if ($wp_username && $wp_password && $wp_blog) { - require_once 'include/html2plain.php'; - $wptitle = trim($b['title']); if (intval(PConfig::get($b['uid'], 'wppost', 'shortcheck'))) { @@ -265,7 +265,7 @@ function wppost_send(&$a,&$b) { // Remove the share element before fetching the first line $title = trim(preg_replace("/\[share.*?\](.*?)\[\/share\]/ism","\n$1\n",$b['body'])); - $title = html2plain(BBCode::convert($title, false), 0, true)."\n"; + $title = HTML::toPlaintext(BBCode::convert($title, false), 0, true)."\n"; $pos = strpos($title, "\n"); $trailer = ""; if (($pos == 0) || ($pos > 100)) {