Replace htmlt2* with HTML class methods

- Remove references to include/html2*.php
This commit is contained in:
Hypolite Petovan 2018-03-07 16:48:34 -05:00
parent d352f6fa2a
commit ab0f359602
4 changed files with 14 additions and 19 deletions

View file

@ -7,6 +7,7 @@
*/ */
use Friendica\Content\Text\BBCode; use Friendica\Content\Text\BBCode;
use Friendica\Content\Text\HTML;
use Friendica\Core\Addon; use Friendica\Core\Addon;
use Friendica\Core\Config; use Friendica\Core\Config;
use Friendica\Core\L10n; use Friendica\Core\L10n;
@ -782,8 +783,6 @@ function pumpio_fetchtimeline(&$a, $uid) {
$public = true; $public = true;
if ($public && !stristr($post->generator->displayName, $application_name)) { if ($public && !stristr($post->generator->displayName, $application_name)) {
require_once('include/html2bbcode.php');
$_SESSION["authenticated"] = true; $_SESSION["authenticated"] = true;
$_SESSION["uid"] = $uid; $_SESSION["uid"] = $uid;
@ -798,11 +797,11 @@ function pumpio_fetchtimeline(&$a, $uid) {
} }
if ($post->object->displayName != "") if ($post->object->displayName != "")
$_REQUEST["title"] = html2bbcode($post->object->displayName); $_REQUEST["title"] = HTML::toBBCode($post->object->displayName);
else else
$_REQUEST["title"] = ""; $_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 // To-Do: Picture has to be cached and stored locally
if ($post->object->fullImage->url != "") { 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) { function pumpio_dopost(&$a, $client, $uid, $self, $post, $own_id, $threadcompletion = true) {
require_once('include/items.php'); require_once('include/items.php');
require_once('include/html2bbcode.php');
if (($post->verb == "like") || ($post->verb == "favorite")) if (($post->verb == "like") || ($post->verb == "favorite"))
return pumpio_dolike($a, $uid, $self, $post, $own_id); 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['author-avatar'] = $post->actor->image->url;
$postarray['plink'] = $post->object->url; $postarray['plink'] = $post->object->url;
$postarray['app'] = $post->generator->displayName; $postarray['app'] = $post->generator->displayName;
$postarray['body'] = html2bbcode($post->object->content); $postarray['body'] = HTML::toBBCode($post->object->content);
$postarray['object'] = json_encode($post); $postarray['object'] = json_encode($post);
if ($post->object->fullImage->url != "") if ($post->object->fullImage->url != "")

View file

@ -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 __DIR__ . DIRECTORY_SEPARATOR . 'library' . DIRECTORY_SEPARATOR . 'statusnetoauth.php';
require_once 'include/enotify.php'; require_once 'include/enotify.php';
use Codebird\Codebird;
use CodebirdSN\CodebirdSN; use CodebirdSN\CodebirdSN;
use Friendica\App; use Friendica\App;
use Friendica\Content\OEmbed; use Friendica\Content\OEmbed;
use Friendica\Content\Text\BBCode; use Friendica\Content\Text\BBCode;
use Friendica\Content\Text\HTML;
use Friendica\Content\Text\Plaintext; use Friendica\Content\Text\Plaintext;
use Friendica\Core\Addon; use Friendica\Core\Addon;
use Friendica\Core\Config; use Friendica\Core\Config;
@ -582,7 +582,7 @@ function statusnet_post_hook(App $a, &$b)
// New code that is able to post pictures // New code that is able to post pictures
require_once __DIR__ . DIRECTORY_SEPARATOR . 'library' . DIRECTORY_SEPARATOR . 'codebirdsn.php'; require_once __DIR__ . DIRECTORY_SEPARATOR . 'library' . DIRECTORY_SEPARATOR . 'codebirdsn.php';
$cb = \CodebirdSN\CodebirdSN::getInstance(); $cb = CodebirdSN::getInstance();
$cb->setAPIEndpoint($api); $cb->setAPIEndpoint($api);
$cb->setConsumerKey($ckey, $csecret); $cb->setConsumerKey($ckey, $csecret);
$cb->setToken($otoken, $osecret); $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'; require_once __DIR__ . DIRECTORY_SEPARATOR . 'library' . DIRECTORY_SEPARATOR . 'codebirdsn.php';
$cb = \CodebirdSN\CodebirdSN::getInstance(); $cb = CodebirdSN::getInstance();
$cb->setConsumerKey($ckey, $csecret); $cb->setConsumerKey($ckey, $csecret);
$cb->setToken($otoken, $osecret); $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) function statusnet_createpost(App $a, $uid, $post, $self, $create_user, $only_existing_contact)
{ {
require_once "include/html2bbcode.php";
logger("statusnet_createpost: start", LOGGER_DEBUG); logger("statusnet_createpost: start", LOGGER_DEBUG);
$api = PConfig::get($uid, 'statusnet', 'baseapi'); $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['allow_cid'] = '<' . $self['id'] . '>';
} }
$postarray['body'] = html2bbcode($content->statusnet_html); $postarray['body'] = HTML::toBBCode($content->statusnet_html);
$converted = statusnet_convertmsg($a, $postarray['body'], false); $converted = statusnet_convertmsg($a, $postarray['body'], false);
$postarray['body'] = $converted["body"]; $postarray['body'] = $converted["body"];

View file

@ -28,6 +28,7 @@
use Friendica\App; use Friendica\App;
use Friendica\Content\Text\BBCode; use Friendica\Content\Text\BBCode;
use Friendica\Content\Text\HTML;
use Friendica\Core\Addon; use Friendica\Core\Addon;
use Friendica\Core\L10n; use Friendica\Core\L10n;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
@ -211,10 +212,8 @@ function windowsphonepush_cron()
if (substr($body, 0, 4) == "[url") { if (substr($body, 0, 4) == "[url") {
$body = "URL/Image ..."; $body = "URL/Image ...";
} else { } else {
require_once("include/html2plain.php");
$body = BBCode::convert($body, false, 2, true); $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); $body = ((strlen($body) > 137) ? substr($body, 0, 137) . "..." : $body);
} }
} else { } else {

View file

@ -5,7 +5,9 @@
* Version: 1.1 * Version: 1.1
* Author: Mike Macgirvin <http://macgirvin.com/profile/mike> * Author: Mike Macgirvin <http://macgirvin.com/profile/mike>
*/ */
use Friendica\Content\Text\BBCode; use Friendica\Content\Text\BBCode;
use Friendica\Content\Text\HTML;
use Friendica\Core\Addon; use Friendica\Core\Addon;
use Friendica\Core\L10n; use Friendica\Core\L10n;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
@ -146,7 +148,7 @@ function wppost_settings_post(&$a,&$b) {
PConfig::set(local_user(),'wppost','shortcheck',trim($_POST['wp_shortcheck'])); PConfig::set(local_user(),'wppost','shortcheck',trim($_POST['wp_shortcheck']));
$wp_backlink_text = notags(trim($_POST['wp_backlink_text'])); $wp_backlink_text = notags(trim($_POST['wp_backlink_text']));
$wp_backlink_text = BBCode::convert($wp_backlink_text, false, 8); $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); 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) { if ($wp_username && $wp_password && $wp_blog) {
require_once 'include/html2plain.php';
$wptitle = trim($b['title']); $wptitle = trim($b['title']);
if (intval(PConfig::get($b['uid'], 'wppost', 'shortcheck'))) { 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 // Remove the share element before fetching the first line
$title = trim(preg_replace("/\[share.*?\](.*?)\[\/share\]/ism","\n$1\n",$b['body'])); $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"); $pos = strpos($title, "\n");
$trailer = ""; $trailer = "";
if (($pos == 0) || ($pos > 100)) { if (($pos == 0) || ($pos > 100)) {