]> git.mxchange.org Git - friendica-addons.git/commitdiff
Replace htmlt2* with HTML class methods
authorHypolite Petovan <mrpetovan@gmail.com>
Wed, 7 Mar 2018 21:48:34 +0000 (16:48 -0500)
committerHypolite Petovan <mrpetovan@gmail.com>
Wed, 7 Mar 2018 21:48:34 +0000 (16:48 -0500)
- Remove references to include/html2*.php

pumpio/pumpio.php
statusnet/statusnet.php
windowsphonepush/windowsphonepush.php
wppost/wppost.php

index a1ca2ade7dec6f125c2b76ade46fb17ddf8f7468..8426c535e358562bab0ff723d1038058c2926afb 100644 (file)
@@ -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 != "")
index c54ff55f6c923ce65d4b4e3051bf2d770144884c..ad2da3224d6a4ef8018fb12a644201fcabce3fdd 100644 (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 '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"];
index 206b0883e4b03241db96b7909d50ea28372a853e..3aaf1d3092e90434cf12eb25cd10bde10da3a8ae 100644 (file)
@@ -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 {
index 8d14b17016ec1deee552e7ee5acfe0ab6131ff42..a2c1129362a2b629a91567ffa2dc957cd2d4bab5 100644 (file)
@@ -5,7 +5,9 @@
  * Version: 1.1
  * Author: Mike Macgirvin <http://macgirvin.com/profile/mike>
  */
+
 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)) {