[pumpio] Update config file style/name
[friendica-addons.git/.git] / ljpost / ljpost.php
index dfc1387..c60af03 100644 (file)
 use Friendica\Content\Text\BBCode;
 use Friendica\Core\Addon;
 use Friendica\Core\L10n;
+use Friendica\Core\Logger;
 use Friendica\Core\PConfig;
 use Friendica\Util\DateTimeFormat;
 use Friendica\Util\Network;
+use Friendica\Util\XML;
 
 function ljpost_install() {
     Addon::registerHook('post_local',           'addon/ljpost/ljpost.php', 'ljpost_post_local');
@@ -168,20 +170,20 @@ function ljpost_send(&$a,&$b) {
        if($x && strlen($x[0]['timezone']))
                $tz = $x[0]['timezone'];
 
-       $lj_username = xmlify(PConfig::get($b['uid'],'ljpost','lj_username'));
-       $lj_password = xmlify(PConfig::get($b['uid'],'ljpost','lj_password'));
-       $lj_journal = xmlify(PConfig::get($b['uid'],'ljpost','lj_journal'));
+       $lj_username = XML::escape(PConfig::get($b['uid'],'ljpost','lj_username'));
+       $lj_password = XML::escape(PConfig::get($b['uid'],'ljpost','lj_password'));
+       $lj_journal = XML::escape(PConfig::get($b['uid'],'ljpost','lj_journal'));
 //     if(! $lj_journal)
 //             $lj_journal = $lj_username;
 
-       $lj_blog = xmlify(PConfig::get($b['uid'],'ljpost','lj_blog'));
+       $lj_blog = XML::escape(PConfig::get($b['uid'],'ljpost','lj_blog'));
        if(! strlen($lj_blog))
-               $lj_blog = xmlify('http://www.livejournal.com/interface/xmlrpc');
+               $lj_blog = XML::escape('http://www.livejournal.com/interface/xmlrpc');
 
        if($lj_username && $lj_password && $lj_blog) {
-               $title = xmlify($b['title']);
+               $title = XML::escape($b['title']);
                $post = BBCode::convert($b['body']);
-               $post = xmlify($post);
+               $post = XML::escape($post);
                $tags = ljpost_get_tags($b['tag']);
 
                $date = DateTimeFormat::convert($b['created'], $tz);
@@ -231,12 +233,12 @@ function ljpost_send(&$a,&$b) {
 
 EOT;
 
-               logger('ljpost: data: ' . $xml, LOGGER_DATA);
+               Logger::log('ljpost: data: ' . $xml, Logger::DATA);
 
                if ($lj_blog !== 'test') {
                        $x = Network::post($lj_blog, $xml, ["Content-Type: text/xml"])->getBody();
                }
-               logger('posted to livejournal: ' . ($x) ? $x : '', LOGGER_DEBUG);
+               Logger::log('posted to livejournal: ' . ($x) ? $x : '', Logger::DEBUG);
        }
 }