X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=twitter%2Ftwitter.php;h=18625f8b8ff634ec684bca80f4433b4f1d3ae838;hb=2ca621a92a40fba62f8e9acf7eba3a47a5d2ed7b;hp=99bed6e273008237d85ca2db1ab02589f0a096ef;hpb=c2970ad6d521326dcaac4371961b7d5112b4ba82;p=friendica-addons.git diff --git a/twitter/twitter.php b/twitter/twitter.php index 99bed6e2..18625f8b 100644 --- a/twitter/twitter.php +++ b/twitter/twitter.php @@ -64,6 +64,7 @@ use Abraham\TwitterOAuth\TwitterOAuth; use Abraham\TwitterOAuth\TwitterOAuthException; +use Codebird\Codebird; use Friendica\App; use Friendica\Content\OEmbed; use Friendica\Content\Text\BBCode; @@ -77,17 +78,17 @@ use Friendica\Core\Protocol; use Friendica\Core\Renderer; use Friendica\Core\Worker; use Friendica\Database\DBA; +use Friendica\DI; use Friendica\Model\Contact; use Friendica\Model\Conversation; -use Friendica\Model\GContact; use Friendica\Model\Group; use Friendica\Model\Item; use Friendica\Model\ItemContent; -use Friendica\Model\Queue; use Friendica\Model\User; -use Friendica\Object\Image; -use Friendica\Util\Config\ConfigFileLoader; +use Friendica\Protocol\Activity; +use Friendica\Util\ConfigFileLoader; use Friendica\Util\DateTimeFormat; +use Friendica\Util\Images; use Friendica\Util\Network; use Friendica\Util\Strings; @@ -106,12 +107,11 @@ function twitter_install() Hook::register('notifier_normal' , __FILE__, 'twitter_post_hook'); Hook::register('jot_networks' , __FILE__, 'twitter_jot_nets'); Hook::register('cron' , __FILE__, 'twitter_cron'); - Hook::register('queue_predeliver' , __FILE__, 'twitter_queue_hook'); Hook::register('follow' , __FILE__, 'twitter_follow'); Hook::register('expire' , __FILE__, 'twitter_expire'); Hook::register('prepare_body' , __FILE__, 'twitter_prepare_body'); Hook::register('check_item_notification', __FILE__, 'twitter_check_item_notification'); - Logger::log("installed twitter"); + Logger::info("installed twitter"); } function twitter_uninstall() @@ -124,7 +124,6 @@ function twitter_uninstall() Hook::unregister('notifier_normal' , __FILE__, 'twitter_post_hook'); Hook::unregister('jot_networks' , __FILE__, 'twitter_jot_nets'); Hook::unregister('cron' , __FILE__, 'twitter_cron'); - Hook::unregister('queue_predeliver' , __FILE__, 'twitter_queue_hook'); Hook::unregister('follow' , __FILE__, 'twitter_follow'); Hook::unregister('expire' , __FILE__, 'twitter_expire'); Hook::unregister('prepare_body' , __FILE__, 'twitter_prepare_body'); @@ -157,7 +156,7 @@ function twitter_check_item_notification(App $a, array &$notification_data) function twitter_follow(App $a, array &$contact) { - Logger::log("twitter_follow: Check if contact is twitter contact. " . $contact["url"], Logger::DEBUG); + Logger::info('Check if contact is twitter contact', ['url' => $contact["url"]]); if (!strstr($contact["url"], "://twitter.com") && !strstr($contact["url"], "@twitter.com")) { return; @@ -242,7 +241,7 @@ function twitter_settings_post(App $a) } else { if (isset($_POST['twitter-pin'])) { // if the user supplied us with a PIN from Twitter, let the magic of OAuth happen - Logger::log('got a Twitter PIN'); + Logger::notice('got a Twitter PIN'); $ckey = Config::get('twitter', 'consumerkey'); $csecret = Config::get('twitter', 'consumersecret'); // the token and secret for which the PIN was generated were hidden in the settings @@ -265,7 +264,7 @@ function twitter_settings_post(App $a) info($e->getMessage()); } // reload the Addon Settings page, if we don't do it see Bug #42 - $a->internalRedirect('settings/connectors'); + DI::baseUrl()->redirect('settings/connectors'); } else { // if no PIN is supplied in the POST variables, the user has changed the setting // to post a tweet for every new __public__ posting to the wall @@ -289,7 +288,7 @@ function twitter_settings(App $a, &$s) if (!local_user()) { return; } - $a->page['htmlhead'] .= '' . "\r\n"; + DI::page()['htmlhead'] .= '' . "\r\n"; /* * * * 1) Check that we have global consumer key & secret * 2) If no OAuthtoken & stuff is present, generate button to get some @@ -355,7 +354,10 @@ function twitter_settings(App $a, &$s) $field_checkbox = Renderer::getMarkupTemplate('field_checkbox.tpl'); - $s .= '
' . L10n::t('Currently connected to: ') . '' . $details->screen_name . '
@@ -364,6 +366,12 @@ function twitter_settings(App $a, &$s) ' . $details->description . 'Invalid Twitter info
+