*
*/
+use Friendica\App;
use Friendica\Content\Text;
use Friendica\Core\Addon;
use Friendica\Core\Config;
@@ -50,7 +51,7 @@ function pageheader_addon_settings(&$a,&$s) {
$words = '';
$t = Text::getMarkupTemplate("settings.tpl", "addon/pageheader/");
- $s .= Text::replaceMacros($t, [
+ $s .= App::replaceMacros($t, [
'$title' => L10n::t('"pageheader" Settings'),
'$phwords' => ['pageheader-words', L10n::t('Message'), $words, L10n::t('Message to display on every page on this server (or put a pageheader.html file in your docroot)')],
'$submit' => L10n::t('Save Settings')
diff --git a/piwik/piwik.php b/piwik/piwik.php
index fa882bc3..754c86e7 100644
--- a/piwik/piwik.php
+++ b/piwik/piwik.php
@@ -30,6 +30,7 @@
* about http/https but beware to put the trailing / at the end of your
* setting.
*/
+use Friendica\App;
use Friendica\Content\Text;
use Friendica\Core\Addon;
use Friendica\Core\Config;
@@ -39,14 +40,14 @@ function piwik_install() {
Addon::registerHook('load_config', 'addon/piwik/piwik.php', 'piwik_load_config');
Addon::registerHook('page_end', 'addon/piwik/piwik.php', 'piwik_analytics');
- Text::logger("installed piwik addon");
+ App::logger("installed piwik addon");
}
function piwik_uninstall() {
Addon::unregisterHook('load_config', 'addon/piwik/piwik.php', 'piwik_load_config');
Addon::unregisterHook('page_end', 'addon/piwik/piwik.php', 'piwik_analytics');
- Text::logger("uninstalled piwik addon");
+ App::logger("uninstalled piwik addon");
}
function piwik_load_config(\Friendica\App $a)
@@ -97,7 +98,7 @@ function piwik_analytics($a,&$b) {
}
function piwik_addon_admin (&$a, &$o) {
$t = Text::getMarkupTemplate( "admin.tpl", "addon/piwik/" );
- $o = Text::replaceMacros( $t, [
+ $o = App::replaceMacros( $t, [
'$submit' => L10n::t('Save Settings'),
'$piwikbaseurl' => ['baseurl', L10n::t('Piwik Base URL'), Config::get('piwik','baseurl' ), L10n::t('Absolute path to your Piwik installation. (without protocol (http/s), with trailing slash)')],
'$siteid' => ['siteid', L10n::t('Site ID'), Config::get('piwik','siteid' ), ''],
diff --git a/planets/planets.php b/planets/planets.php
index 494fe201..56b2ce2d 100644
--- a/planets/planets.php
+++ b/planets/planets.php
@@ -33,7 +33,7 @@ function planets_install() {
Addon::registerHook('addon_settings', 'addon/planets/planets.php', 'planets_settings');
Addon::registerHook('addon_settings_post', 'addon/planets/planets.php', 'planets_settings_post');
- Text::logger("installed planets");
+ App::logger("installed planets");
}
@@ -52,7 +52,7 @@ function planets_uninstall() {
Addon::unregisterHook('addon_settings_post', 'addon/planets/planets.php', 'planets_settings_post');
- Text::logger("removed planets");
+ App::logger("removed planets");
}
@@ -68,7 +68,7 @@ function planets_post_hook($a, &$item) {
*
*/
- Text::logger('planets invoked');
+ App::logger('planets invoked');
if(! local_user()) /* non-zero if this is a logged in user of this system */
return;
diff --git a/public_server/public_server.php b/public_server/public_server.php
index b33596fa..be5c1ce9 100644
--- a/public_server/public_server.php
+++ b/public_server/public_server.php
@@ -54,7 +54,7 @@ function public_server_register_account($a, $b)
function public_server_cron($a, $b)
{
- Text::logger("public_server: cron start");
+ App::logger("public_server: cron start");
require_once('include/enotify.php');
$r = q("SELECT * FROM `user` WHERE `account_expires_on` < UTC_TIMESTAMP() + INTERVAL 5 DAY AND
@@ -117,7 +117,7 @@ function public_server_cron($a, $b)
}
}
- Text::logger("public_server: cron end");
+ App::logger("public_server: cron end");
}
function public_server_enotify(&$a, &$b)
@@ -165,7 +165,7 @@ function public_server_addon_admin(&$a, &$o)
{
$token = BaseModule::getFormSecurityToken("publicserver");
$t = Text::getMarkupTemplate("admin.tpl", "addon/public_server");
- $o = Text::replaceMacros($t, [
+ $o = App::replaceMacros($t, [
'$submit' => L10n::t('Save Settings'),
'$form_security_token' => $token,
'$infotext' => L10n::t('Set any of these options to 0 to deactivate it.'),
diff --git a/pumpio/pumpio.php b/pumpio/pumpio.php
index 1bfa3073..8a959914 100644
--- a/pumpio/pumpio.php
+++ b/pumpio/pumpio.php
@@ -115,7 +115,7 @@ function pumpio_registerclient(App $a, $host)
$params["logo_url"] = $a->getBaseURL()."/images/friendica-256.png";
$params["redirect_uris"] = $a->getBaseURL()."/pumpio/connect";
- Text::logger("pumpio_registerclient: ".$url." parameters ".print_r($params, true), LOGGER_DEBUG);
+ App::logger("pumpio_registerclient: ".$url." parameters ".print_r($params, true), LOGGER_DEBUG);
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_HEADER, false);
@@ -129,10 +129,10 @@ function pumpio_registerclient(App $a, $host)
if ($curl_info["http_code"] == "200") {
$values = json_decode($s);
- Text::logger("pumpio_registerclient: success ".print_r($values, true), LOGGER_DEBUG);
+ App::logger("pumpio_registerclient: success ".print_r($values, true), LOGGER_DEBUG);
return $values;
}
- Text::logger("pumpio_registerclient: failed: ".print_r($curl_info, true), LOGGER_DEBUG);
+ App::logger("pumpio_registerclient: failed: ".print_r($curl_info, true), LOGGER_DEBUG);
return false;
}
@@ -145,7 +145,7 @@ function pumpio_connect(App $a)
$hostname = PConfig::get(local_user(), 'pumpio', 'host');
if ((($consumer_key == "") || ($consumer_secret == "")) && ($hostname != "")) {
- Text::logger("pumpio_connect: register client");
+ App::logger("pumpio_connect: register client");
$clientdata = pumpio_registerclient($a, $hostname);
PConfig::set(local_user(), 'pumpio', 'consumer_key', $clientdata->client_id);
PConfig::set(local_user(), 'pumpio', 'consumer_secret', $clientdata->client_secret);
@@ -153,11 +153,11 @@ function pumpio_connect(App $a)
$consumer_key = PConfig::get(local_user(), 'pumpio', 'consumer_key');
$consumer_secret = PConfig::get(local_user(), 'pumpio', 'consumer_secret');
- Text::logger("pumpio_connect: ckey: ".$consumer_key." csecrect: ".$consumer_secret, LOGGER_DEBUG);
+ App::logger("pumpio_connect: ckey: ".$consumer_key." csecrect: ".$consumer_secret, LOGGER_DEBUG);
}
if (($consumer_key == "") || ($consumer_secret == "")) {
- Text::logger("pumpio_connect: ".sprintf("Unable to register the client at the pump.io server '%s'.", $hostname));
+ App::logger("pumpio_connect: ".sprintf("Unable to register the client at the pump.io server '%s'.", $hostname));
$o .= L10n::t("Unable to register the client at the pump.io server '%s'.", $hostname);
return $o;
@@ -187,7 +187,7 @@ function pumpio_connect(App $a)
if (($success = $client->Initialize())) {
if (($success = $client->Process())) {
if (strlen($client->access_token)) {
- Text::logger("pumpio_connect: otoken: ".$client->access_token." osecrect: ".$client->access_token_secret, LOGGER_DEBUG);
+ App::logger("pumpio_connect: otoken: ".$client->access_token." osecrect: ".$client->access_token_secret, LOGGER_DEBUG);
PConfig::set(local_user(), "pumpio", "oauth_token", $client->access_token);
PConfig::set(local_user(), "pumpio", "oauth_token_secret", $client->access_token_secret);
}
@@ -199,11 +199,11 @@ function pumpio_connect(App $a)
}
if ($success) {
- Text::logger("pumpio_connect: authenticated");
+ App::logger("pumpio_connect: authenticated");
$o = L10n::t("You are now authenticated to pumpio.");
$o .= '
'.L10n::t("return to the connector page").'';
} else {
- Text::logger("pumpio_connect: could not connect");
+ App::logger("pumpio_connect: could not connect");
$o = 'Could not connect to pumpio. Refresh the page or try again later.';
}
@@ -410,7 +410,7 @@ function pumpio_send(App $a, array &$b)
return;
}
- Text::logger("pumpio_send: parameter ".print_r($b, true), LOGGER_DATA);
+ App::logger("pumpio_send: parameter ".print_r($b, true), LOGGER_DATA);
if ($b['parent'] != $b['id']) {
// Looking if its a reply to a pumpio post
@@ -418,7 +418,7 @@ function pumpio_send(App $a, array &$b)
$orig_post = Item::selectFirst([], $condition);
if (!DBA::isResult($orig_post)) {
- Text::logger("pumpio_send: no pumpio post ".$b["parent"]);
+ App::logger("pumpio_send: no pumpio post ".$b["parent"]);
return;
} else {
$iscomment = true;
@@ -428,7 +428,7 @@ function pumpio_send(App $a, array &$b)
$receiver = pumpio_getreceiver($a, $b);
- Text::logger("pumpio_send: receiver ".print_r($receiver, true));
+ App::logger("pumpio_send: receiver ".print_r($receiver, true));
if (!count($receiver) && ($b['private'] || !strstr($b['postopts'], 'pumpio'))) {
return;
@@ -560,13 +560,13 @@ function pumpio_send(App $a, array &$b)
}
$post_id = $user->object->id;
- Text::logger('pumpio_send '.$username.': success '.$post_id);
+ App::logger('pumpio_send '.$username.': success '.$post_id);
if ($post_id && $iscomment) {
- Text::logger('pumpio_send '.$username.': Update extid '.$post_id." for post id ".$b['id']);
+ App::logger('pumpio_send '.$username.': Update extid '.$post_id." for post id ".$b['id']);
Item::update(['extid' => $post_id], ['id' => $b['id']]);
}
} else {
- Text::logger('pumpio_send '.$username.': '.$url.' general error: ' . print_r($user, true));
+ App::logger('pumpio_send '.$username.': '.$url.' general error: ' . print_r($user, true));
$r = q("SELECT `id` FROM `contact` WHERE `uid` = %d AND `self`", $b['uid']);
if (DBA::isResult($r)) {
@@ -641,9 +641,9 @@ function pumpio_action(App $a, $uid, $uri, $action, $content = "")
}
if ($success) {
- Text::logger('pumpio_action '.$username.' '.$action.': success '.$uri);
+ App::logger('pumpio_action '.$username.' '.$action.': success '.$uri);
} else {
- Text::logger('pumpio_action '.$username.' '.$action.': general error: '.$uri.' '.print_r($user, true));
+ App::logger('pumpio_action '.$username.' '.$action.': general error: '.$uri.' '.print_r($user, true));
$r = q("SELECT `id` FROM `contact` WHERE `uid` = %d AND `self`", $uid);
if (DBA::isResult($r)) {
@@ -672,16 +672,16 @@ function pumpio_sync(App $a)
if ($last) {
$next = $last + ($poll_interval * 60);
if ($next > time()) {
- Text::logger('pumpio: poll intervall not reached');
+ App::logger('pumpio: poll intervall not reached');
return;
}
}
- Text::logger('pumpio: cron_start');
+ App::logger('pumpio: cron_start');
$r = q("SELECT * FROM `pconfig` WHERE `cat` = 'pumpio' AND `k` = 'mirror' AND `v` = '1' ORDER BY RAND() ");
if (DBA::isResult($r)) {
foreach ($r as $rr) {
- Text::logger('pumpio: mirroring user '.$rr['uid']);
+ App::logger('pumpio: mirroring user '.$rr['uid']);
pumpio_fetchtimeline($a, $rr['uid']);
}
}
@@ -699,12 +699,12 @@ function pumpio_sync(App $a)
if ($abandon_days != 0) {
$user = q("SELECT `login_date` FROM `user` WHERE uid=%d AND `login_date` >= '%s'", $rr['uid'], $abandon_limit);
if (!DBA::isResult($user)) {
- Text::logger('abandoned account: timeline from user '.$rr['uid'].' will not be imported');
+ App::logger('abandoned account: timeline from user '.$rr['uid'].' will not be imported');
continue;
}
}
- Text::logger('pumpio: importing timeline from user '.$rr['uid']);
+ App::logger('pumpio: importing timeline from user '.$rr['uid']);
pumpio_fetchinbox($a, $rr['uid']);
// check for new contacts once a day
@@ -722,7 +722,7 @@ function pumpio_sync(App $a)
}
}
- Text::logger('pumpio: cron_end');
+ App::logger('pumpio: cron_end');
Config::set('pumpio', 'last_poll', time());
}
@@ -767,7 +767,7 @@ function pumpio_fetchtimeline(App $a, $uid)
$url = 'https://'.$hostname.'/api/user/'.$username.'/feed/major';
- Text::logger('pumpio: fetching for user '.$uid.' '.$url.' C:'.$client->client_id.' CS:'.$client->client_secret.' T:'.$client->access_token.' TS:'.$client->access_token_secret);
+ App::logger('pumpio: fetching for user '.$uid.' '.$url.' C:'.$client->client_id.' CS:'.$client->client_secret.' T:'.$client->access_token.' TS:'.$client->access_token_secret);
$useraddr = $username.'@'.$hostname;
@@ -779,7 +779,7 @@ function pumpio_fetchtimeline(App $a, $uid)
}
if (!$success) {
- Text::logger('pumpio: error fetching posts for user '.$uid." ".$useraddr." ".print_r($user, true));
+ App::logger('pumpio: error fetching posts for user '.$uid." ".$useraddr." ".print_r($user, true));
return;
}
@@ -848,12 +848,12 @@ function pumpio_fetchtimeline(App $a, $uid)
}
}
- Text::logger('pumpio: posting for user '.$uid);
+ App::logger('pumpio: posting for user '.$uid);
require_once('mod/item.php');
item_post($a);
- Text::logger('pumpio: posting done - user '.$uid);
+ App::logger('pumpio: posting done - user '.$uid);
}
}
}
@@ -897,9 +897,9 @@ function pumpio_dounlike(App $a, $uid, $self, $post, $own_id)
Item::delete(['verb' => ACTIVITY_LIKE, 'uid' => $uid, 'contact-id' => $contactid, 'thr-parent' => $orig_post['uri']]);
if (DBA::isResult($r)) {
- Text::logger("pumpio_dounlike: unliked existing like. User ".$own_id." ".$uid." Contact: ".$contactid." Url ".$orig_post['uri']);
+ App::logger("pumpio_dounlike: unliked existing like. User ".$own_id." ".$uid." Contact: ".$contactid." Url ".$orig_post['uri']);
} else {
- Text::logger("pumpio_dounlike: not found. User ".$own_id." ".$uid." Contact: ".$contactid." Url ".$orig_post['uri']);
+ App::logger("pumpio_dounlike: not found. User ".$own_id." ".$uid." Contact: ".$contactid." Url ".$orig_post['uri']);
}
}
@@ -908,7 +908,7 @@ function pumpio_dolike(App $a, $uid, $self, $post, $own_id, $threadcompletion =
require_once('include/items.php');
if (empty($post->object->id)) {
- Text::logger('Got empty like: '.print_r($post, true), LOGGER_DEBUG);
+ App::logger('Got empty like: '.print_r($post, true), LOGGER_DEBUG);
return;
}
@@ -951,7 +951,7 @@ function pumpio_dolike(App $a, $uid, $self, $post, $own_id, $threadcompletion =
$condition = ['verb' => ACTIVITY_LIKE, 'uid' => $uid, 'contact-id' => $contactid, 'thr-parent' => $orig_post['uri']];
if (Item::exists($condition)) {
- Text::logger("pumpio_dolike: found existing like. User ".$own_id." ".$uid." Contact: ".$contactid." Url ".$orig_post['uri']);
+ App::logger("pumpio_dolike: found existing like. User ".$own_id." ".$uid." Contact: ".$contactid." Url ".$orig_post['uri']);
return;
}
@@ -985,7 +985,7 @@ function pumpio_dolike(App $a, $uid, $self, $post, $own_id, $threadcompletion =
$ret = Item::insert($likedata);
- Text::logger("pumpio_dolike: ".$ret." User ".$own_id." ".$uid." Contact: ".$contactid." Url ".$orig_post['uri']);
+ App::logger("pumpio_dolike: ".$ret." User ".$own_id." ".$uid." Contact: ".$contactid." Url ".$orig_post['uri']);
}
function pumpio_get_contact($uid, $contact, $no_insert = false)
@@ -1433,7 +1433,7 @@ function pumpio_queue_hook(App $a, array &$b)
continue;
}
- Text::logger('pumpio_queue: run');
+ App::logger('pumpio_queue: run');
$r = q("SELECT `user`.* FROM `user` LEFT JOIN `contact` ON `contact`.`uid` = `user`.`uid`
WHERE `contact`.`self` = 1 AND `contact`.`id` = %d LIMIT 1",
@@ -1445,7 +1445,7 @@ function pumpio_queue_hook(App $a, array &$b)
$userdata = $r[0];
- //Text::logger('pumpio_queue: fetching userdata '.print_r($userdata, true));
+ //App::logger('pumpio_queue: fetching userdata '.print_r($userdata, true));
$oauth_token = PConfig::get($userdata['uid'], "pumpio", "oauth_token");
$oauth_token_secret = PConfig::get($userdata['uid'], "pumpio", "oauth_token_secret");
@@ -1461,7 +1461,7 @@ function pumpio_queue_hook(App $a, array &$b)
$consumer_key && $consumer_secret) {
$username = $user.'@'.$host;
- Text::logger('pumpio_queue: able to post for user '.$username);
+ App::logger('pumpio_queue: able to post for user '.$username);
$z = unserialize($x['content']);
@@ -1482,21 +1482,21 @@ function pumpio_queue_hook(App $a, array &$b)
if ($success) {
$post_id = $user->object->id;
- Text::logger('pumpio_queue: send '.$username.': success '.$post_id);
+ App::logger('pumpio_queue: send '.$username.': success '.$post_id);
if ($post_id && $iscomment) {
- Text::logger('pumpio_send '.$username.': Update extid '.$post_id." for post id ".$z['item']);
+ App::logger('pumpio_send '.$username.': Update extid '.$post_id." for post id ".$z['item']);
Item::update(['extid' => $post_id], ['id' => $z['item']]);
}
Queue::removeItem($x['id']);
} else {
- Text::logger('pumpio_queue: send '.$username.': '.$z['url'].' general error: ' . print_r($user, true));
+ App::logger('pumpio_queue: send '.$username.': '.$z['url'].' general error: ' . print_r($user, true));
}
} else {
- Text::logger("pumpio_queue: Error getting tokens for user ".$userdata['uid']);
+ App::logger("pumpio_queue: Error getting tokens for user ".$userdata['uid']);
}
if (!$success) {
- Text::logger('pumpio_queue: delayed');
+ App::logger('pumpio_queue: delayed');
Queue::updateTime($x['id']);
}
}
@@ -1596,7 +1596,7 @@ function pumpio_fetchallcomments(App $a, $uid, $id)
$hostname = PConfig::get($uid, 'pumpio', 'host');
$username = PConfig::get($uid, "pumpio", "user");
- Text::logger("pumpio_fetchallcomments: completing comment for user ".$uid." post id ".$id);
+ App::logger("pumpio_fetchallcomments: completing comment for user ".$uid." post id ".$id);
$own_id = "https://".$hostname."/".$username;
@@ -1622,7 +1622,7 @@ function pumpio_fetchallcomments(App $a, $uid, $id)
$client->access_token = $otoken;
$client->access_token_secret = $osecret;
- Text::logger("pumpio_fetchallcomments: fetching comment for user ".$uid." url ".$url);
+ App::logger("pumpio_fetchallcomments: fetching comment for user ".$uid." url ".$url);
if (pumpio_reachable($url)) {
$success = $client->CallAPI($url, 'GET', [], ['FailOnAccessError'=>true], $item);
@@ -1685,7 +1685,7 @@ function pumpio_fetchallcomments(App $a, $uid, $id)
$post->object = $item;
- Text::logger("pumpio_fetchallcomments: posting comment ".$post->object->id." ".print_r($post, true));
+ App::logger("pumpio_fetchallcomments: posting comment ".$post->object->id." ".print_r($post, true));
pumpio_dopost($a, $client, $uid, $self, $post, $own_id, false);
}
}
diff --git a/pumpio/pumpio_sync.php b/pumpio/pumpio_sync.php
index eeef683d..590529cc 100644
--- a/pumpio/pumpio_sync.php
+++ b/pumpio/pumpio_sync.php
@@ -10,7 +10,7 @@ function pumpio_sync_run(&$argv, &$argc) {
if (function_exists('sys_getloadavg')) {
$load = sys_getloadavg();
if (intval($load[0]) > Config::get('system', 'maxloadavg', 50)) {
- Text::logger('system: load ' . $load[0] . ' too high. Pumpio sync deferred to next scheduled run.');
+ App::logger('system: load ' . $load[0] . ' too high. Pumpio sync deferred to next scheduled run.');
return;
}
}
diff --git a/randplace/randplace.php b/randplace/randplace.php
index 459e74a0..a1b343df 100644
--- a/randplace/randplace.php
+++ b/randplace/randplace.php
@@ -45,7 +45,7 @@ function randplace_install() {
Addon::registerHook('addon_settings', 'addon/randplace/randplace.php', 'randplace_settings');
Addon::registerHook('addon_settings_post', 'addon/randplace/randplace.php', 'randplace_settings_post');
- Text::logger("installed randplace");
+ App::logger("installed randplace");
}
@@ -64,7 +64,7 @@ function randplace_uninstall() {
Addon::unregisterHook('addon_settings_post', 'addon/randplace/randplace.php', 'randplace_settings_post');
- Text::logger("removed randplace");
+ App::logger("removed randplace");
}
@@ -80,7 +80,7 @@ function randplace_post_hook($a, &$item) {
*
*/
- Text::logger('randplace invoked');
+ App::logger('randplace invoked');
if(! local_user()) /* non-zero if this is a logged in user of this system */
return;
diff --git a/remote_permissions/remote_permissions.php b/remote_permissions/remote_permissions.php
index 09bd1dfc..6043ad4b 100644
--- a/remote_permissions/remote_permissions.php
+++ b/remote_permissions/remote_permissions.php
@@ -7,6 +7,7 @@
* Status: Unsupported
*/
+use Friendica\App;
use Friendica\Content\Text;
use Friendica\Core\Addon;
use Friendica\Core\Config;
@@ -47,7 +48,7 @@ function remote_permissions_settings(&$a,&$o) {
// $t = file_get_contents("addon/remote_permissions/settings.tpl" );
$t = Text::getMarkupTemplate("settings.tpl", "addon/remote_permissions/" );
- $o .= Text::replaceMacros($t, [
+ $o .= App::replaceMacros($t, [
'$remote_perms_title' => L10n::t('Remote Permissions Settings'),
'$remote_perms_label' => L10n::t('Allow recipients of your private posts to see the other recipients of the posts'),
'$checked' => (($remote_perms == 1) ? 'checked="checked"' : ''),
@@ -198,7 +199,7 @@ function remote_permissions_content($a, $item_copy) {
function remote_permissions_addon_admin(&$a, &$o){
$t = Text::getMarkupTemplate( "admin.tpl", "addon/remote_permissions/" );
- $o = Text::replaceMacros($t, [
+ $o = App::replaceMacros($t, [
'$submit' => L10n::t('Save Settings'),
'$global' => ['remotepermschoice', L10n::t('Global'), 1, L10n::t('The posts of every user on this server show the post recipients'), Config::get('remote_perms', 'global') == 1],
'$individual' => ['remotepermschoice', L10n::t('Individual'), 2, L10n::t('Each user chooses whether his/her posts show the post recipients'), Config::get('remote_perms', 'global') == 0]
diff --git a/securemail/securemail.php b/securemail/securemail.php
index e2abc811..9edb8017 100644
--- a/securemail/securemail.php
+++ b/securemail/securemail.php
@@ -32,7 +32,7 @@ function securemail_install() {
Addon::registerHook('emailer_send_prepare', 'addon/securemail/securemail.php', 'securemail_emailer_send_prepare');
- Text::logger('installed securemail');
+ App::logger('installed securemail');
}
function securemail_uninstall() {
@@ -41,7 +41,7 @@ function securemail_uninstall() {
Addon::unregisterHook('emailer_send_prepare', 'addon/securemail/securemail.php', 'securemail_emailer_send_prepare');
- Text::logger('removed securemail');
+ App::logger('removed securemail');
}
/**
@@ -64,7 +64,7 @@ function securemail_settings(App &$a, &$s){
$t = Text::getMarkupTemplate('admin.tpl', 'addon/securemail/');
- $s .= Text::replaceMacros($t, [
+ $s .= App::replaceMacros($t, [
'$title' => L10n::t('"Secure Mail" Settings'),
'$submit' => L10n::t('Save Settings'),
'$test' => L10n::t('Save and send test'), //NOTE: update also in 'post'
diff --git a/smileybutton/smileybutton.php b/smileybutton/smileybutton.php
index 3f5ccb59..752016c2 100644
--- a/smileybutton/smileybutton.php
+++ b/smileybutton/smileybutton.php
@@ -12,7 +12,7 @@ function smileybutton_install() {
//Register hooks
Addon::registerHook('jot_tool', 'addon/smileybutton/smileybutton.php', 'show_button');
- Text::logger("installed smileybutton");
+ App::logger("installed smileybutton");
}
@@ -20,7 +20,7 @@ function smileybutton_uninstall() {
//Delet registered hooks
Addon::unregisterHook('jot_tool', 'addon/smileybutton/smileybutton.php', 'show_button');
- Text::logger("removed smileybutton");
+ App::logger("removed smileybutton");
}
diff --git a/statusnet/statusnet.php b/statusnet/statusnet.php
index b4f49985..b83914ca 100644
--- a/statusnet/statusnet.php
+++ b/statusnet/statusnet.php
@@ -71,7 +71,7 @@ function statusnet_install()
Addon::registerHook('cron', 'addon/statusnet/statusnet.php', 'statusnet_cron');
Addon::registerHook('prepare_body', 'addon/statusnet/statusnet.php', 'statusnet_prepare_body');
Addon::registerHook('check_item_notification', 'addon/statusnet/statusnet.php', 'statusnet_check_item_notification');
- Text::logger("installed GNU Social");
+ App::logger("installed GNU Social");
}
function statusnet_uninstall()
@@ -430,7 +430,7 @@ function statusnet_action(App $a, $uid, $pid, $action)
$connection = new StatusNetOAuth($api, $ckey, $csecret, $otoken, $osecret);
- Text::logger("statusnet_action '" . $action . "' ID: " . $pid, LOGGER_DATA);
+ App::logger("statusnet_action '" . $action . "' ID: " . $pid, LOGGER_DATA);
switch ($action) {
case "delete":
@@ -443,7 +443,7 @@ function statusnet_action(App $a, $uid, $pid, $action)
$result = $connection->post("favorites/destroy/" . $pid);
break;
}
- Text::logger("statusnet_action '" . $action . "' send, result: " . print_r($result, true), LOGGER_DEBUG);
+ App::logger("statusnet_action '" . $action . "' send, result: " . print_r($result, true), LOGGER_DEBUG);
}
function statusnet_post_hook(App $a, &$b)
@@ -460,19 +460,19 @@ function statusnet_post_hook(App $a, &$b)
$hostname = preg_replace("=https?://([\w\.]*)/.*=ism", "$1", $api);
if ($b['parent'] != $b['id']) {
- Text::logger("statusnet_post_hook: parameter " . print_r($b, true), LOGGER_DATA);
+ App::logger("statusnet_post_hook: parameter " . print_r($b, true), LOGGER_DATA);
// Looking if its a reply to a GNU Social post
$hostlength = strlen($hostname) + 2;
if ((substr($b["parent-uri"], 0, $hostlength) != $hostname . "::") && (substr($b["extid"], 0, $hostlength) != $hostname . "::") && (substr($b["thr-parent"], 0, $hostlength) != $hostname . "::")) {
- Text::logger("statusnet_post_hook: no GNU Social post " . $b["parent"]);
+ App::logger("statusnet_post_hook: no GNU Social post " . $b["parent"]);
return;
}
$condition = ['uri' => $b["thr-parent"], 'uid' => $b["uid"]];
$orig_post = Item::selectFirst(['author-link', 'uri'], $condition);
if (!DBA::isResult($orig_post)) {
- Text::logger("statusnet_post_hook: no parent found " . $b["thr-parent"]);
+ App::logger("statusnet_post_hook: no parent found " . $b["thr-parent"]);
return;
} else {
$iscomment = true;
@@ -483,12 +483,12 @@ function statusnet_post_hook(App $a, &$b)
$nickname = "@[url=" . $orig_post["author-link"] . "]" . $nick . "[/url]";
$nicknameplain = "@" . $nick;
- Text::logger("statusnet_post_hook: comparing " . $nickname . " and " . $nicknameplain . " with " . $b["body"], LOGGER_DEBUG);
+ App::logger("statusnet_post_hook: comparing " . $nickname . " and " . $nicknameplain . " with " . $b["body"], LOGGER_DEBUG);
if ((strpos($b["body"], $nickname) === false) && (strpos($b["body"], $nicknameplain) === false)) {
$b["body"] = $nickname . " " . $b["body"];
}
- Text::logger("statusnet_post_hook: parent found " . print_r($orig_post, true), LOGGER_DEBUG);
+ App::logger("statusnet_post_hook: parent found " . print_r($orig_post, true), LOGGER_DEBUG);
} else {
$iscomment = false;
@@ -509,7 +509,7 @@ function statusnet_post_hook(App $a, &$b)
}
if ($b['verb'] == ACTIVITY_LIKE) {
- Text::logger("statusnet_post_hook: parameter 2 " . substr($b["thr-parent"], $hostlength), LOGGER_DEBUG);
+ App::logger("statusnet_post_hook: parameter 2 " . substr($b["thr-parent"], $hostlength), LOGGER_DEBUG);
if ($b['deleted'])
statusnet_action($a, $b["uid"], substr($b["thr-parent"], $hostlength), "unlike");
else
@@ -530,7 +530,7 @@ function statusnet_post_hook(App $a, &$b)
return;
}
- Text::logger('GNU Socialpost invoked');
+ App::logger('GNU Socialpost invoked');
PConfig::load($b['uid'], 'statusnet');
@@ -579,7 +579,7 @@ function statusnet_post_hook(App $a, &$b)
if (strlen($msg)) {
if ($iscomment) {
$postdata["in_reply_to_status_id"] = substr($orig_post["uri"], $hostlength);
- Text::logger('statusnet_post send reply ' . print_r($postdata, true), LOGGER_DEBUG);
+ App::logger('statusnet_post send reply ' . print_r($postdata, true), LOGGER_DEBUG);
}
// New code that is able to post pictures
@@ -590,7 +590,7 @@ function statusnet_post_hook(App $a, &$b)
$cb->setToken($otoken, $osecret);
$result = $cb->statuses_update($postdata);
//$result = $dent->post('statuses/update', $postdata);
- Text::logger('statusnet_post send, result: ' . print_r($result, true) .
+ App::logger('statusnet_post send, result: ' . print_r($result, true) .
"\nmessage: " . $msg . "\nOriginal post: " . print_r($b, true) . "\nPost Data: " . print_r($postdata, true), LOGGER_DEBUG);
if (!empty($result->source)) {
@@ -598,9 +598,9 @@ function statusnet_post_hook(App $a, &$b)
}
if (!empty($result->error)) {
- Text::logger('Send to GNU Social failed: "' . $result->error . '"');
+ App::logger('Send to GNU Social failed: "' . $result->error . '"');
} elseif ($iscomment) {
- Text::logger('statusnet_post: Update extid ' . $result->id . " for post id " . $b['id']);
+ App::logger('statusnet_post: Update extid ' . $result->id . " for post id " . $b['id']);
Item::update(['extid' => $hostname . "::" . $result->id, 'body' => $result->text], ['id' => $b['id']]);
}
}
@@ -669,7 +669,7 @@ function statusnet_addon_admin(App $a, &$o)
];
$t = Text::getMarkupTemplate("admin.tpl", "addon/statusnet/");
- $o = Text::replaceMacros($t, [
+ $o = App::replaceMacros($t, [
'$submit' => L10n::t('Save Settings'),
'$sites' => $sitesform,
]);
@@ -730,16 +730,16 @@ function statusnet_cron(App $a, $b)
if ($last) {
$next = $last + ($poll_interval * 60);
if ($next > time()) {
- Text::logger('statusnet: poll intervall not reached');
+ App::logger('statusnet: poll intervall not reached');
return;
}
}
- Text::logger('statusnet: cron_start');
+ App::logger('statusnet: cron_start');
$r = q("SELECT * FROM `pconfig` WHERE `cat` = 'statusnet' AND `k` = 'mirror_posts' AND `v` = '1' ORDER BY RAND() ");
if (DBA::isResult($r)) {
foreach ($r as $rr) {
- Text::logger('statusnet: fetching for user ' . $rr['uid']);
+ App::logger('statusnet: fetching for user ' . $rr['uid']);
statusnet_fetchtimeline($a, $rr['uid']);
}
}
@@ -757,17 +757,17 @@ function statusnet_cron(App $a, $b)
if ($abandon_days != 0) {
$user = q("SELECT `login_date` FROM `user` WHERE uid=%d AND `login_date` >= '%s'", $rr['uid'], $abandon_limit);
if (!DBA::isResult($user)) {
- Text::logger('abandoned account: timeline from user ' . $rr['uid'] . ' will not be imported');
+ App::logger('abandoned account: timeline from user ' . $rr['uid'] . ' will not be imported');
continue;
}
}
- Text::logger('statusnet: importing timeline from user ' . $rr['uid']);
+ App::logger('statusnet: importing timeline from user ' . $rr['uid']);
statusnet_fetchhometimeline($a, $rr["uid"], $rr["v"]);
}
}
- Text::logger('statusnet: cron_end');
+ App::logger('statusnet: cron_end');
Config::set('statusnet', 'last_poll', time());
}
@@ -872,7 +872,7 @@ function statusnet_fetchtimeline(App $a, $uid)
//print_r($_REQUEST);
if ($_REQUEST["body"] != "") {
- Text::logger('statusnet: posting for user ' . $uid);
+ App::logger('statusnet: posting for user ' . $uid);
item_post($a);
}
@@ -913,7 +913,7 @@ function statusnet_fetch_contact($uid, $contact, $create_user)
}
if (DBA::isResult($r) && ($r[0]["readonly"] || $r[0]["blocked"])) {
- Text::logger("statusnet_fetch_contact: Contact '" . $r[0]["nick"] . "' is blocked or readonly.", LOGGER_DEBUG);
+ App::logger("statusnet_fetch_contact: Contact '" . $r[0]["nick"] . "' is blocked or readonly.", LOGGER_DEBUG);
return -1;
}
@@ -975,7 +975,7 @@ function statusnet_fetch_contact($uid, $contact, $create_user)
// check that we have all the photos, this has been known to fail on occasion
if ((!$r[0]['photo']) || (!$r[0]['thumb']) || (!$r[0]['micro']) || ($update_photo)) {
- Text::logger("statusnet_fetch_contact: Updating contact " . $contact->screen_name, LOGGER_DEBUG);
+ App::logger("statusnet_fetch_contact: Updating contact " . $contact->screen_name, LOGGER_DEBUG);
$photos = Photo::importProfilePhoto($contact->profile_image_url, $uid, $r[0]['id']);
@@ -1061,7 +1061,7 @@ function statusnet_fetchuser(App $a, $uid, $screen_name = "", $user_id = "")
function statusnet_createpost(App $a, $uid, $post, $self, $create_user, $only_existing_contact)
{
- Text::logger("statusnet_createpost: start", LOGGER_DEBUG);
+ App::logger("statusnet_createpost: start", LOGGER_DEBUG);
$api = PConfig::get($uid, 'statusnet', 'baseapi');
$hostname = preg_replace("=https?://([\w\.]*)/.*=ism", "$1", $api);
@@ -1188,7 +1188,7 @@ function statusnet_createpost(App $a, $uid, $post, $self, $create_user, $only_ex
$postarray["coord"] = $content->coordinates->coordinates[1] . " " . $content->coordinates->coordinates[0];
}
- Text::logger("statusnet_createpost: end", LOGGER_DEBUG);
+ App::logger("statusnet_createpost: end", LOGGER_DEBUG);
return $postarray;
}
@@ -1207,7 +1207,7 @@ function statusnet_fetchhometimeline(App $a, $uid, $mode = 1)
// "create_user" is deactivated, since currently you cannot add users manually by now
$create_user = true;
- Text::logger("statusnet_fetchhometimeline: Fetching for user " . $uid, LOGGER_DEBUG);
+ App::logger("statusnet_fetchhometimeline: Fetching for user " . $uid, LOGGER_DEBUG);
require_once 'include/items.php';
@@ -1222,7 +1222,7 @@ function statusnet_fetchhometimeline(App $a, $uid, $mode = 1)
if (DBA::isResult($r)) {
$nick = $r[0]["nick"];
} else {
- Text::logger("statusnet_fetchhometimeline: Own GNU Social contact not found for user " . $uid, LOGGER_DEBUG);
+ App::logger("statusnet_fetchhometimeline: Own GNU Social contact not found for user " . $uid, LOGGER_DEBUG);
return;
}
@@ -1232,14 +1232,14 @@ function statusnet_fetchhometimeline(App $a, $uid, $mode = 1)
if (DBA::isResult($r)) {
$self = $r[0];
} else {
- Text::logger("statusnet_fetchhometimeline: Own contact not found for user " . $uid, LOGGER_DEBUG);
+ App::logger("statusnet_fetchhometimeline: Own contact not found for user " . $uid, LOGGER_DEBUG);
return;
}
$u = q("SELECT * FROM user WHERE uid = %d LIMIT 1",
intval($uid));
if (!DBA::isResult($u)) {
- Text::logger("statusnet_fetchhometimeline: Own user not found for user " . $uid, LOGGER_DEBUG);
+ App::logger("statusnet_fetchhometimeline: Own user not found for user " . $uid, LOGGER_DEBUG);
return;
}
@@ -1270,13 +1270,13 @@ function statusnet_fetchhometimeline(App $a, $uid, $mode = 1)
$errormsg = "Unknown error";
}
- Text::logger("statusnet_fetchhometimeline: Error fetching home timeline: " . $errormsg, LOGGER_DEBUG);
+ App::logger("statusnet_fetchhometimeline: Error fetching home timeline: " . $errormsg, LOGGER_DEBUG);
return;
}
$posts = array_reverse($items);
- Text::logger("statusnet_fetchhometimeline: Fetching timeline for user " . $uid . " " . sizeof($posts) . " items", LOGGER_DEBUG);
+ App::logger("statusnet_fetchhometimeline: Fetching timeline for user " . $uid . " " . sizeof($posts) . " items", LOGGER_DEBUG);
if (count($posts)) {
foreach ($posts as $post) {
@@ -1304,7 +1304,7 @@ function statusnet_fetchhometimeline(App $a, $uid, $mode = 1)
$item = Item::insert($postarray);
$postarray["id"] = $item;
- Text::logger('statusnet_fetchhometimeline: User ' . $self["nick"] . ' posted home timeline item ' . $item);
+ App::logger('statusnet_fetchhometimeline: User ' . $self["nick"] . ' posted home timeline item ' . $item);
}
}
}
@@ -1322,13 +1322,13 @@ function statusnet_fetchhometimeline(App $a, $uid, $mode = 1)
$items = $connection->get('statuses/mentions_timeline', $parameters);
if (!is_array($items)) {
- Text::logger("statusnet_fetchhometimeline: Error fetching mentions: " . print_r($items, true), LOGGER_DEBUG);
+ App::logger("statusnet_fetchhometimeline: Error fetching mentions: " . print_r($items, true), LOGGER_DEBUG);
return;
}
$posts = array_reverse($items);
- Text::logger("statusnet_fetchhometimeline: Fetching mentions for user " . $uid . " " . sizeof($posts) . " items", LOGGER_DEBUG);
+ App::logger("statusnet_fetchhometimeline: Fetching mentions for user " . $uid . " " . sizeof($posts) . " items", LOGGER_DEBUG);
if (count($posts)) {
foreach ($posts as $post) {
@@ -1354,7 +1354,7 @@ function statusnet_fetchhometimeline(App $a, $uid, $mode = 1)
$item = Item::insert($postarray);
- Text::logger('statusnet_fetchhometimeline: User ' . $self["nick"] . ' posted mention timeline item ' . $item);
+ App::logger('statusnet_fetchhometimeline: User ' . $self["nick"] . ' posted mention timeline item ' . $item);
}
}
}
@@ -1389,7 +1389,7 @@ function statusnet_complete_conversation(App $a, $uid, $self, $create_user, $nic
$item = Item::insert($postarray);
$postarray["id"] = $item;
- Text::logger('statusnet_complete_conversation: User ' . $self["nick"] . ' posted home timeline item ' . $item);
+ App::logger('statusnet_complete_conversation: User ' . $self["nick"] . ' posted home timeline item ' . $item);
}
}
}
@@ -1412,15 +1412,15 @@ function statusnet_convertmsg(App $a, $body, $no_tags = false)
foreach ($matches AS $match) {
$search = "[url=" . $match[1] . "]" . $match[2] . "[/url]";
- Text::logger("statusnet_convertmsg: expanding url " . $match[1], LOGGER_DEBUG);
+ App::logger("statusnet_convertmsg: expanding url " . $match[1], LOGGER_DEBUG);
$expanded_url = Network::finalUrl($match[1]);
- Text::logger("statusnet_convertmsg: fetching data for " . $expanded_url, LOGGER_DEBUG);
+ App::logger("statusnet_convertmsg: fetching data for " . $expanded_url, LOGGER_DEBUG);
$oembed_data = OEmbed::fetchURL($expanded_url, true);
- Text::logger("statusnet_convertmsg: fetching data: done", LOGGER_DEBUG);
+ App::logger("statusnet_convertmsg: fetching data: done", LOGGER_DEBUG);
if ($type == "") {
$type = $oembed_data->type;
@@ -1582,13 +1582,13 @@ function statusnet_is_retweet(App $a, $uid, $body)
return false;
}
- Text::logger('statusnet_is_retweet: Retweeting id ' . $id . ' for user ' . $uid, LOGGER_DEBUG);
+ App::logger('statusnet_is_retweet: Retweeting id ' . $id . ' for user ' . $uid, LOGGER_DEBUG);
$connection = new StatusNetOAuth($api, $ckey, $csecret, $otoken, $osecret);
$result = $connection->post('statuses/retweet/' . $id);
- Text::logger('statusnet_is_retweet: result ' . print_r($result, true), LOGGER_DEBUG);
+ App::logger('statusnet_is_retweet: result ' . print_r($result, true), LOGGER_DEBUG);
return isset($result->id);
}
diff --git a/tumblr/tumblr.php b/tumblr/tumblr.php
index fe4a1d8b..ff1701da 100644
--- a/tumblr/tumblr.php
+++ b/tumblr/tumblr.php
@@ -72,7 +72,7 @@ function tumblr_addon_admin(App $a, &$o)
{
$t = Text::getMarkupTemplate( "admin.tpl", "addon/tumblr/" );
- $o = Text::replaceMacros($t, [
+ $o = App::replaceMacros($t, [
'$submit' => L10n::t('Save Settings'),
// name, label, value, help, [extra values]
'$consumer_key' => ['consumer_key', L10n::t('Consumer Key'), Config::get('tumblr', 'consumer_key' ), ''],
@@ -459,11 +459,11 @@ function tumblr_send(App $a, array &$b) {
//print_r($params);
if ($ret_code == 201) {
- Text::logger('tumblr_send: success');
+ App::logger('tumblr_send: success');
} elseif ($ret_code == 403) {
- Text::logger('tumblr_send: authentication failure');
+ App::logger('tumblr_send: authentication failure');
} else {
- Text::logger('tumblr_send: general error: ' . print_r($x,true));
+ App::logger('tumblr_send: general error: ' . print_r($x,true));
}
}
}
diff --git a/twitter/twitter.php b/twitter/twitter.php
index 80b13468..7a408bde 100644
--- a/twitter/twitter.php
+++ b/twitter/twitter.php
@@ -109,7 +109,7 @@ function twitter_install()
Addon::registerHook('expire' , __FILE__, 'twitter_expire');
Addon::registerHook('prepare_body' , __FILE__, 'twitter_prepare_body');
Addon::registerHook('check_item_notification', __FILE__, 'twitter_check_item_notification');
- Text::logger("installed twitter");
+ App::logger("installed twitter");
}
function twitter_uninstall()
@@ -154,7 +154,7 @@ function twitter_check_item_notification(App $a, array &$notification_data)
function twitter_follow(App $a, array &$contact)
{
- Text::logger("twitter_follow: Check if contact is twitter contact. " . $contact["url"], LOGGER_DEBUG);
+ App::logger("twitter_follow: Check if contact is twitter contact. " . $contact["url"], LOGGER_DEBUG);
if (!strstr($contact["url"], "://twitter.com") && !strstr($contact["url"], "@twitter.com")) {
return;
@@ -235,7 +235,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
- Text::logger('got a Twitter PIN');
+ App::logger('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
@@ -359,22 +359,22 @@ function twitter_settings(App $a, &$s)
';
$s .= '';
- $s .= Text::replaceMacros($field_checkbox, [
+ $s .= App::replaceMacros($field_checkbox, [
'$field' => ['twitter-enable', L10n::t('Allow posting to Twitter'), $enabled, L10n::t('If enabled all your public postings can be posted to the associated Twitter account. You can choose to do so by default (here) or for every posting separately in the posting options when writing the entry.')]
]);
if ($a->user['hidewall']) {
$s .= '' . L10n::t('Note: Due to your privacy settings (Hide your profile details from unknown viewers?) the link potentially included in public postings relayed to Twitter will lead the visitor to a blank page informing the visitor that the access to your profile has been restricted.') . '
';
}
- $s .= Text::replaceMacros($field_checkbox, [
+ $s .= App::replaceMacros($field_checkbox, [
'$field' => ['twitter-default', L10n::t('Send public postings to Twitter by default'), $defenabled, '']
]);
- $s .= Text::replaceMacros($field_checkbox, [
+ $s .= App::replaceMacros($field_checkbox, [
'$field' => ['twitter-mirror', L10n::t('Mirror all posts from twitter that are no replies'), $mirrorenabled, '']
]);
- $s .= Text::replaceMacros($field_checkbox, [
+ $s .= App::replaceMacros($field_checkbox, [
'$field' => ['twitter-import', L10n::t('Import the remote timeline'), $importenabled, '']
]);
- $s .= Text::replaceMacros($field_checkbox, [
+ $s .= App::replaceMacros($field_checkbox, [
'$field' => ['twitter-create_user', L10n::t('Automatically create contacts'), $create_userenabled, L10n::t('This will automatically create a contact in Friendica as soon as you receive a message from an existing contact via the Twitter network. If you do not enable this, you need to manually add those Twitter contacts in Friendica from whom you would like to see posts here. However if enabled, you cannot merely remove a twitter contact from the Friendica contact list, as it will recreate this contact when they post again.')]
]);
$s .= '';
@@ -427,7 +427,7 @@ function twitter_action(App $a, $uid, $pid, $action)
$post = ['id' => $pid];
- Text::logger("twitter_action '" . $action . "' ID: " . $pid . " data: " . print_r($post, true), LOGGER_DATA);
+ App::logger("twitter_action '" . $action . "' ID: " . $pid . " data: " . print_r($post, true), LOGGER_DATA);
switch ($action) {
case "delete":
@@ -441,10 +441,10 @@ function twitter_action(App $a, $uid, $pid, $action)
$result = $connection->post('favorites/destroy', $post);
break;
default:
- Text::logger('Unhandled action ' . $action, LOGGER_DEBUG);
+ App::logger('Unhandled action ' . $action, LOGGER_DEBUG);
$result = [];
}
- Text::logger("twitter_action '" . $action . "' send, result: " . print_r($result, true), LOGGER_DEBUG);
+ App::logger("twitter_action '" . $action . "' send, result: " . print_r($result, true), LOGGER_DEBUG);
}
function twitter_post_hook(App $a, array &$b)
@@ -456,21 +456,21 @@ function twitter_post_hook(App $a, array &$b)
}
if ($b['parent'] != $b['id']) {
- Text::logger("twitter_post_hook: parameter " . print_r($b, true), LOGGER_DATA);
+ App::logger("twitter_post_hook: parameter " . print_r($b, true), LOGGER_DATA);
// Looking if its a reply to a twitter post
if ((substr($b["parent-uri"], 0, 9) != "twitter::")
&& (substr($b["extid"], 0, 9) != "twitter::")
&& (substr($b["thr-parent"], 0, 9) != "twitter::"))
{
- Text::logger("twitter_post_hook: no twitter post " . $b["parent"]);
+ App::logger("twitter_post_hook: no twitter post " . $b["parent"]);
return;
}
$condition = ['uri' => $b["thr-parent"], 'uid' => $b["uid"]];
$orig_post = Item::selectFirst([], $condition);
if (!DBA::isResult($orig_post)) {
- Text::logger("twitter_post_hook: no parent found " . $b["thr-parent"]);
+ App::logger("twitter_post_hook: no parent found " . $b["thr-parent"]);
return;
} else {
$iscomment = true;
@@ -481,12 +481,12 @@ function twitter_post_hook(App $a, array &$b)
$nickname = "@[url=" . $orig_post["author-link"] . "]" . $nicknameplain . "[/url]";
$nicknameplain = "@" . $nicknameplain;
- Text::logger("twitter_post_hook: comparing " . $nickname . " and " . $nicknameplain . " with " . $b["body"], LOGGER_DEBUG);
+ App::logger("twitter_post_hook: comparing " . $nickname . " and " . $nicknameplain . " with " . $b["body"], LOGGER_DEBUG);
if ((strpos($b["body"], $nickname) === false) && (strpos($b["body"], $nicknameplain) === false)) {
$b["body"] = $nickname . " " . $b["body"];
}
- Text::logger("twitter_post_hook: parent found " . print_r($orig_post, true), LOGGER_DATA);
+ App::logger("twitter_post_hook: parent found " . print_r($orig_post, true), LOGGER_DATA);
} else {
$iscomment = false;
@@ -507,7 +507,7 @@ function twitter_post_hook(App $a, array &$b)
}
if ($b['verb'] == ACTIVITY_LIKE) {
- Text::logger("twitter_post_hook: parameter 2 " . substr($b["thr-parent"], 9), LOGGER_DEBUG);
+ App::logger("twitter_post_hook: parameter 2 " . substr($b["thr-parent"], 9), LOGGER_DEBUG);
if ($b['deleted']) {
twitter_action($a, $b["uid"], substr($b["thr-parent"], 9), "unlike");
} else {
@@ -530,7 +530,7 @@ function twitter_post_hook(App $a, array &$b)
return;
}
- Text::logger('twitter post invoked');
+ App::logger('twitter post invoked');
PConfig::load($b['uid'], 'twitter');
@@ -540,7 +540,7 @@ function twitter_post_hook(App $a, array &$b)
$osecret = PConfig::get($b['uid'], 'twitter', 'oauthsecret');
if ($ckey && $csecret && $otoken && $osecret) {
- Text::logger('twitter: we have customer key and oauth stuff, going to send.', LOGGER_DEBUG);
+ App::logger('twitter: we have customer key and oauth stuff, going to send.', LOGGER_DEBUG);
// If it's a repeated message from twitter then do a native retweet and exit
if (twitter_is_retweet($a, $b['uid'], $b['body'])) {
@@ -608,7 +608,7 @@ function twitter_post_hook(App $a, array &$b)
throw new Exception('Failed upload of ' . $image);
}
} catch (Exception $e) {
- Text::logger('Exception when trying to send to Twitter: ' . $e->getMessage());
+ App::logger('Exception when trying to send to Twitter: ' . $e->getMessage());
// Workaround: Remove the picture link so that the post can be reposted without it
// When there is another url already added, a second url would be superfluous.
@@ -628,14 +628,14 @@ function twitter_post_hook(App $a, array &$b)
$url = 'statuses/update';
$result = $connection->post($url, $post);
- Text::logger('twitter_post send, result: ' . print_r($result, true), LOGGER_DEBUG);
+ App::logger('twitter_post send, result: ' . print_r($result, true), LOGGER_DEBUG);
if (!empty($result->source)) {
Config::set("twitter", "application_name", strip_tags($result->source));
}
if (!empty($result->errors)) {
- Text::logger('Send to Twitter failed: "' . print_r($result->errors, true) . '"');
+ App::logger('Send to Twitter failed: "' . print_r($result->errors, true) . '"');
$r = q("SELECT `id` FROM `contact` WHERE `uid` = %d AND `self`", intval($b['uid']));
if (DBA::isResult($r)) {
@@ -647,7 +647,7 @@ function twitter_post_hook(App $a, array &$b)
Queue::add($a->contact, Protocol::TWITTER, $s);
notice(L10n::t('Twitter post failed. Queued for retry.') . EOL);
} elseif ($iscomment) {
- Text::logger('twitter_post: Update extid ' . $result->id_str . " for post id " . $b['id']);
+ App::logger('twitter_post: Update extid ' . $result->id_str . " for post id " . $b['id']);
Item::update(['extid' => "twitter::" . $result->id_str], ['id' => $b['id']]);
}
}
@@ -666,7 +666,7 @@ function twitter_addon_admin(App $a, &$o)
{
$t = Text::getMarkupTemplate("admin.tpl", "addon/twitter/");
- $o = Text::replaceMacros($t, [
+ $o = App::replaceMacros($t, [
'$submit' => L10n::t('Save Settings'),
// name, label, value, help, [extra values]
'$consumerkey' => ['consumerkey', L10n::t('Consumer key'), Config::get('twitter', 'consumerkey'), ''],
@@ -686,16 +686,16 @@ function twitter_cron(App $a)
if ($last) {
$next = $last + ($poll_interval * 60);
if ($next > time()) {
- Text::logger('twitter: poll intervall not reached');
+ App::logger('twitter: poll intervall not reached');
return;
}
}
- Text::logger('twitter: cron_start');
+ App::logger('twitter: cron_start');
$r = q("SELECT * FROM `pconfig` WHERE `cat` = 'twitter' AND `k` = 'mirror_posts' AND `v` = '1'");
if (DBA::isResult($r)) {
foreach ($r as $rr) {
- Text::logger('twitter: fetching for user ' . $rr['uid']);
+ App::logger('twitter: fetching for user ' . $rr['uid']);
Worker::add(PRIORITY_MEDIUM, "addon/twitter/twitter_sync.php", 1, (int) $rr['uid']);
}
}
@@ -713,12 +713,12 @@ function twitter_cron(App $a)
if ($abandon_days != 0) {
$user = q("SELECT `login_date` FROM `user` WHERE uid=%d AND `login_date` >= '%s'", $rr['uid'], $abandon_limit);
if (!DBA::isResult($user)) {
- Text::logger('abandoned account: timeline from user ' . $rr['uid'] . ' will not be imported');
+ App::logger('abandoned account: timeline from user ' . $rr['uid'] . ' will not be imported');
continue;
}
}
- Text::logger('twitter: importing timeline from user ' . $rr['uid']);
+ App::logger('twitter: importing timeline from user ' . $rr['uid']);
Worker::add(PRIORITY_MEDIUM, "addon/twitter/twitter_sync.php", 2, (int) $rr['uid']);
/*
// To-Do
@@ -737,7 +737,7 @@ function twitter_cron(App $a)
}
}
- Text::logger('twitter: cron_end');
+ App::logger('twitter: cron_end');
Config::set('twitter', 'last_poll', time());
}
@@ -758,17 +758,17 @@ function twitter_expire(App $a)
require_once "include/items.php";
- Text::logger('twitter_expire: expire_start');
+ App::logger('twitter_expire: expire_start');
$r = q("SELECT * FROM `pconfig` WHERE `cat` = 'twitter' AND `k` = 'import' AND `v` = '1' ORDER BY RAND()");
if (DBA::isResult($r)) {
foreach ($r as $rr) {
- Text::logger('twitter_expire: user ' . $rr['uid']);
+ App::logger('twitter_expire: user ' . $rr['uid']);
Item::expire($rr['uid'], $days, Protocol::TWITTER, true);
}
}
- Text::logger('twitter_expire: expire_end');
+ App::logger('twitter_expire: expire_end');
}
function twitter_prepare_body(App $a, array &$b)
@@ -903,18 +903,18 @@ function twitter_fetchtimeline(App $a, $uid)
try {
$items = $connection->get('statuses/user_timeline', $parameters);
} catch (TwitterOAuthException $e) {
- Text::logger('Error fetching timeline for user ' . $uid . ': ' . $e->getMessage());
+ App::logger('Error fetching timeline for user ' . $uid . ': ' . $e->getMessage());
return;
}
if (!is_array($items)) {
- Text::logger('No items for user ' . $uid, LOGGER_INFO);
+ App::logger('No items for user ' . $uid, LOGGER_INFO);
return;
}
$posts = array_reverse($items);
- Text::logger('Starting from ID ' . $lastid . ' for user ' . $uid, LOGGER_DEBUG);
+ App::logger('Starting from ID ' . $lastid . ' for user ' . $uid, LOGGER_DEBUG);
if (count($posts)) {
foreach ($posts as $post) {
@@ -931,7 +931,7 @@ function twitter_fetchtimeline(App $a, $uid)
$_SESSION["authenticated"] = true;
$_SESSION["uid"] = $uid;
- Text::logger('Preparing Twitter ID ' . $post->id_str . ' for user ' . $uid, LOGGER_DEBUG);
+ App::logger('Preparing Twitter ID ' . $post->id_str . ' for user ' . $uid, LOGGER_DEBUG);
$_REQUEST = twitter_do_mirrorpost($a, $uid, $post);
@@ -939,14 +939,14 @@ function twitter_fetchtimeline(App $a, $uid)
continue;
}
- Text::logger('Posting Twitter ID ' . $post->id_str . ' for user ' . $uid);
+ App::logger('Posting Twitter ID ' . $post->id_str . ' for user ' . $uid);
item_post($a);
}
}
}
PConfig::set($uid, 'twitter', 'lastid', $lastid);
- Text::logger('Last ID for user ' . $uid . ' is now ' . $lastid, LOGGER_DEBUG);
+ App::logger('Last ID for user ' . $uid . ' is now ' . $lastid, LOGGER_DEBUG);
}
function twitter_queue_hook(App $a)
@@ -963,7 +963,7 @@ function twitter_queue_hook(App $a)
continue;
}
- Text::logger('twitter_queue: run');
+ App::logger('twitter_queue: run');
$r = q("SELECT `user`.* FROM `user` LEFT JOIN `contact` on `contact`.`uid` = `user`.`uid`
WHERE `contact`.`self` = 1 AND `contact`.`id` = %d LIMIT 1",
@@ -983,27 +983,27 @@ function twitter_queue_hook(App $a)
$success = false;
if ($ckey && $csecret && $otoken && $osecret) {
- Text::logger('twitter_queue: able to post');
+ App::logger('twitter_queue: able to post');
$z = unserialize($x['content']);
$connection = new TwitterOAuth($ckey, $csecret, $otoken, $osecret);
$result = $connection->post($z['url'], $z['post']);
- Text::logger('twitter_queue: post result: ' . print_r($result, true), LOGGER_DEBUG);
+ App::logger('twitter_queue: post result: ' . print_r($result, true), LOGGER_DEBUG);
if ($result->errors) {
- Text::logger('twitter_queue: Send to Twitter failed: "' . print_r($result->errors, true) . '"');
+ App::logger('twitter_queue: Send to Twitter failed: "' . print_r($result->errors, true) . '"');
} else {
$success = true;
Queue::removeItem($x['id']);
}
} else {
- Text::logger("twitter_queue: Error getting tokens for user " . $user['uid']);
+ App::logger("twitter_queue: Error getting tokens for user " . $user['uid']);
}
if (!$success) {
- Text::logger('twitter_queue: delayed');
+ App::logger('twitter_queue: delayed');
Queue::updateTime($x['id']);
}
}
@@ -1077,7 +1077,7 @@ function twitter_fetch_contact($uid, $data, $create_user)
Contact::updateAvatar($avatar, $uid, $contact_id);
} else {
if ($contact["readonly"] || $contact["blocked"]) {
- Text::logger("twitter_fetch_contact: Contact '" . $contact["nick"] . "' is blocked or readonly.", LOGGER_DEBUG);
+ App::logger("twitter_fetch_contact: Contact '" . $contact["nick"] . "' is blocked or readonly.", LOGGER_DEBUG);
return -1;
}
@@ -1088,7 +1088,7 @@ function twitter_fetch_contact($uid, $data, $create_user)
// check that we have all the photos, this has been known to fail on occasion
if (empty($contact['photo']) || empty($contact['thumb']) || empty($contact['micro']) || $update_photo) {
- Text::logger("twitter_fetch_contact: Updating contact " . $data->screen_name, LOGGER_DEBUG);
+ App::logger("twitter_fetch_contact: Updating contact " . $data->screen_name, LOGGER_DEBUG);
Contact::updateAvatar($avatar, $uid, $contact['id']);
@@ -1133,7 +1133,7 @@ function twitter_fetchuser(App $a, $uid, $screen_name = "", $user_id = "")
try {
$user = $connection->get('users/show', $parameters);
} catch (TwitterOAuthException $e) {
- Text::logger('twitter_fetchuser: Error fetching user ' . $uid . ': ' . $e->getMessage());
+ App::logger('twitter_fetchuser: Error fetching user ' . $uid . ': ' . $e->getMessage());
return;
}
@@ -1387,7 +1387,7 @@ function twitter_createpost(App $a, $uid, $post, array $self, $create_user, $onl
// Don't import our own comments
if (Item::exists(['extid' => $postarray['uri'], 'uid' => $uid])) {
- Text::logger("Item with extid " . $postarray['uri'] . " found.", LOGGER_DEBUG);
+ App::logger("Item with extid " . $postarray['uri'] . " found.", LOGGER_DEBUG);
return [];
}
@@ -1427,7 +1427,7 @@ function twitter_createpost(App $a, $uid, $post, array $self, $create_user, $onl
$postarray['owner-link'] = $r[0]["url"];
$postarray['owner-avatar'] = $r[0]["photo"];
} else {
- Text::logger("No self contact for user " . $uid, LOGGER_DEBUG);
+ App::logger("No self contact for user " . $uid, LOGGER_DEBUG);
return [];
}
}
@@ -1449,7 +1449,7 @@ function twitter_createpost(App $a, $uid, $post, array $self, $create_user, $onl
if (($contactid == 0) && !$only_existing_contact) {
$contactid = $self['id'];
} elseif ($contactid <= 0) {
- Text::logger("Contact ID is zero or less than zero.", LOGGER_DEBUG);
+ App::logger("Contact ID is zero or less than zero.", LOGGER_DEBUG);
return [];
}
@@ -1546,7 +1546,7 @@ function twitter_createpost(App $a, $uid, $post, array $self, $create_user, $onl
function twitter_fetchparentposts(App $a, $uid, $post, TwitterOAuth $connection, array $self)
{
- Text::logger("twitter_fetchparentposts: Fetching for user " . $uid . " and post " . $post->id_str, LOGGER_DEBUG);
+ App::logger("twitter_fetchparentposts: Fetching for user " . $uid . " and post " . $post->id_str, LOGGER_DEBUG);
$posts = [];
@@ -1556,17 +1556,17 @@ function twitter_fetchparentposts(App $a, $uid, $post, TwitterOAuth $connection,
try {
$post = $connection->get('statuses/show', $parameters);
} catch (TwitterOAuthException $e) {
- Text::logger('twitter_fetchparentposts: Error fetching for user ' . $uid . ' and post ' . $post->id_str . ': ' . $e->getMessage());
+ App::logger('twitter_fetchparentposts: Error fetching for user ' . $uid . ' and post ' . $post->id_str . ': ' . $e->getMessage());
break;
}
if (empty($post)) {
- Text::logger("twitter_fetchparentposts: Can't fetch post " . $parameters->id, LOGGER_DEBUG);
+ App::logger("twitter_fetchparentposts: Can't fetch post " . $parameters->id, LOGGER_DEBUG);
break;
}
if (empty($post->id_str)) {
- Text::logger("twitter_fetchparentposts: This is not a post " . json_encode($post), LOGGER_DEBUG);
+ App::logger("twitter_fetchparentposts: This is not a post " . json_encode($post), LOGGER_DEBUG);
break;
}
@@ -1577,7 +1577,7 @@ function twitter_fetchparentposts(App $a, $uid, $post, TwitterOAuth $connection,
$posts[] = $post;
}
- Text::logger("twitter_fetchparentposts: Fetching " . count($posts) . " parents", LOGGER_DEBUG);
+ App::logger("twitter_fetchparentposts: Fetching " . count($posts) . " parents", LOGGER_DEBUG);
$posts = array_reverse($posts);
@@ -1593,7 +1593,7 @@ function twitter_fetchparentposts(App $a, $uid, $post, TwitterOAuth $connection,
$postarray["id"] = $item;
- Text::logger('twitter_fetchparentpost: User ' . $self["nick"] . ' posted parent timeline item ' . $item);
+ App::logger('twitter_fetchparentpost: User ' . $self["nick"] . ' posted parent timeline item ' . $item);
}
}
}
@@ -1607,7 +1607,7 @@ function twitter_fetchhometimeline(App $a, $uid)
$create_user = PConfig::get($uid, 'twitter', 'create_user');
$mirror_posts = PConfig::get($uid, 'twitter', 'mirror_posts');
- Text::logger("Fetching timeline for user " . $uid, LOGGER_DEBUG);
+ App::logger("Fetching timeline for user " . $uid, LOGGER_DEBUG);
$application_name = Config::get('twitter', 'application_name');
@@ -1622,7 +1622,7 @@ function twitter_fetchhometimeline(App $a, $uid)
try {
$own_contact = twitter_fetch_own_contact($a, $uid);
} catch (TwitterOAuthException $e) {
- Text::logger('Error fetching own contact for user ' . $uid . ': ' . $e->getMessage());
+ App::logger('Error fetching own contact for user ' . $uid . ': ' . $e->getMessage());
return;
}
@@ -1633,13 +1633,13 @@ function twitter_fetchhometimeline(App $a, $uid)
if (DBA::isResult($r)) {
$own_id = $r[0]["nick"];
} else {
- Text::logger("Own twitter contact not found for user " . $uid);
+ App::logger("Own twitter contact not found for user " . $uid);
return;
}
$self = User::getOwnerDataById($uid);
if ($self === false) {
- Text::logger("Own contact not found for user " . $uid);
+ App::logger("Own contact not found for user " . $uid);
return;
}
@@ -1657,23 +1657,23 @@ function twitter_fetchhometimeline(App $a, $uid)
try {
$items = $connection->get('statuses/home_timeline', $parameters);
} catch (TwitterOAuthException $e) {
- Text::logger('Error fetching home timeline for user ' . $uid . ': ' . $e->getMessage());
+ App::logger('Error fetching home timeline for user ' . $uid . ': ' . $e->getMessage());
return;
}
if (!is_array($items)) {
- Text::logger('No array while fetching home timeline for user ' . $uid . ': ' . print_r($items, true));
+ App::logger('No array while fetching home timeline for user ' . $uid . ': ' . print_r($items, true));
return;
}
if (empty($items)) {
- Text::logger('No new timeline content for user ' . $uid, LOGGER_INFO);
+ App::logger('No new timeline content for user ' . $uid, LOGGER_INFO);
return;
}
$posts = array_reverse($items);
- Text::logger('Fetching timeline from ID ' . $lastid . ' for user ' . $uid . ' ' . sizeof($posts) . ' items', LOGGER_DEBUG);
+ App::logger('Fetching timeline from ID ' . $lastid . ' for user ' . $uid . ' ' . sizeof($posts) . ' items', LOGGER_DEBUG);
if (count($posts)) {
foreach ($posts as $post) {
@@ -1687,12 +1687,12 @@ function twitter_fetchhometimeline(App $a, $uid)
}
if (stristr($post->source, $application_name) && $post->user->screen_name == $own_id) {
- Text::logger("Skip previously sent post", LOGGER_DEBUG);
+ App::logger("Skip previously sent post", LOGGER_DEBUG);
continue;
}
if ($mirror_posts && $post->user->screen_name == $own_id && $post->in_reply_to_status_id_str == "") {
- Text::logger("Skip post that will be mirrored", LOGGER_DEBUG);
+ App::logger("Skip post that will be mirrored", LOGGER_DEBUG);
continue;
}
@@ -1700,12 +1700,12 @@ function twitter_fetchhometimeline(App $a, $uid)
twitter_fetchparentposts($a, $uid, $post, $connection, $self);
}
- Text::logger('Preparing post ' . $post->id_str . ' for user ' . $uid, LOGGER_DEBUG);
+ App::logger('Preparing post ' . $post->id_str . ' for user ' . $uid, LOGGER_DEBUG);
$postarray = twitter_createpost($a, $uid, $post, $self, $create_user, true, false);
if (empty($postarray['body']) || trim($postarray['body']) == "") {
- Text::logger('Empty body for post ' . $post->id_str . ' and user ' . $uid, LOGGER_DEBUG);
+ App::logger('Empty body for post ' . $post->id_str . ' and user ' . $uid, LOGGER_DEBUG);
continue;
}
@@ -1721,12 +1721,12 @@ function twitter_fetchhometimeline(App $a, $uid)
$item = Item::insert($postarray, false, $notify);
$postarray["id"] = $item;
- Text::logger('User ' . $uid . ' posted home timeline item ' . $item);
+ App::logger('User ' . $uid . ' posted home timeline item ' . $item);
}
}
PConfig::set($uid, 'twitter', 'lasthometimelineid', $lastid);
- Text::logger('Last timeline ID for user ' . $uid . ' is now ' . $lastid, LOGGER_DEBUG);
+ App::logger('Last timeline ID for user ' . $uid . ' is now ' . $lastid, LOGGER_DEBUG);
// Fetching mentions
$lastid = PConfig::get($uid, 'twitter', 'lastmentionid');
@@ -1740,18 +1740,18 @@ function twitter_fetchhometimeline(App $a, $uid)
try {
$items = $connection->get('statuses/mentions_timeline', $parameters);
} catch (TwitterOAuthException $e) {
- Text::logger('Error fetching mentions: ' . $e->getMessage());
+ App::logger('Error fetching mentions: ' . $e->getMessage());
return;
}
if (!is_array($items)) {
- Text::logger("Error fetching mentions: " . print_r($items, true), LOGGER_DEBUG);
+ App::logger("Error fetching mentions: " . print_r($items, true), LOGGER_DEBUG);
return;
}
$posts = array_reverse($items);
- Text::logger("Fetching mentions for user " . $uid . " " . sizeof($posts) . " items", LOGGER_DEBUG);
+ App::logger("Fetching mentions for user " . $uid . " " . sizeof($posts) . " items", LOGGER_DEBUG);
if (count($posts)) {
foreach ($posts as $post) {
@@ -1775,13 +1775,13 @@ function twitter_fetchhometimeline(App $a, $uid)
$item = Item::insert($postarray);
- Text::logger('User ' . $uid . ' posted mention timeline item ' . $item);
+ App::logger('User ' . $uid . ' posted mention timeline item ' . $item);
}
}
PConfig::set($uid, 'twitter', 'lastmentionid', $lastid);
- Text::logger('Last mentions ID for user ' . $uid . ' is now ' . $lastid, LOGGER_DEBUG);
+ App::logger('Last mentions ID for user ' . $uid . ' is now ' . $lastid, LOGGER_DEBUG);
}
function twitter_fetch_own_contact(App $a, $uid)
@@ -1856,7 +1856,7 @@ function twitter_is_retweet(App $a, $uid, $body)
return false;
}
- Text::logger('twitter_is_retweet: Retweeting id ' . $id . ' for user ' . $uid, LOGGER_DEBUG);
+ App::logger('twitter_is_retweet: Retweeting id ' . $id . ' for user ' . $uid, LOGGER_DEBUG);
$ckey = Config::get('twitter', 'consumerkey');
$csecret = Config::get('twitter', 'consumersecret');
@@ -1866,7 +1866,7 @@ function twitter_is_retweet(App $a, $uid, $body)
$connection = new TwitterOAuth($ckey, $csecret, $otoken, $osecret);
$result = $connection->post('statuses/retweet/' . $id);
- Text::logger('twitter_is_retweet: result ' . print_r($result, true), LOGGER_DEBUG);
+ App::logger('twitter_is_retweet: result ' . print_r($result, true), LOGGER_DEBUG);
return !isset($result->errors);
}
diff --git a/twitter/twitter_sync.php b/twitter/twitter_sync.php
index 78e730ca..aaf7ab21 100644
--- a/twitter/twitter_sync.php
+++ b/twitter/twitter_sync.php
@@ -12,7 +12,7 @@ function twitter_sync_run($argv, $argc)
if (function_exists('sys_getloadavg')) {
$load = sys_getloadavg();
if (intval($load[0]) > Config::get('system', 'maxloadavg', 50)) {
- Text::logger('system: load ' . $load[0] . ' too high. Twitter sync deferred to next scheduled run.');
+ App::logger('system: load ' . $load[0] . ' too high. Twitter sync deferred to next scheduled run.');
return;
}
}
diff --git a/webrtc/webrtc.php b/webrtc/webrtc.php
index 31eb2114..d3d5def1 100644
--- a/webrtc/webrtc.php
+++ b/webrtc/webrtc.php
@@ -6,6 +6,7 @@
* Author: Stephen Mahood
* Author: Tobias Diekershoff
*/
+use Friendica\App;
use Friendica\Content\Text;
use Friendica\Core\Addon;
use Friendica\Core\Config;
@@ -26,7 +27,7 @@ function webrtc_app_menu($a,&$b) {
function webrtc_addon_admin (&$a, &$o) {
$t = Text::getMarkupTemplate( "admin.tpl", "addon/webrtc/" );
- $o = Text::replaceMacros( $t, [
+ $o = App::replaceMacros( $t, [
'$submit' => L10n::t('Save Settings'),
'$webrtcurl' => ['webrtcurl', L10n::t('WebRTC Base URL'), Config::get('webrtc','webrtcurl' ), L10n::t('Page your users will create a WebRTC chat room on. For example you could use https://live.mayfirst.org .')],
]);
diff --git a/widgets/widget_like.php b/widgets/widget_like.php
index f194b8ad..aa491af4 100644
--- a/widgets/widget_like.php
+++ b/widgets/widget_like.php
@@ -1,5 +1,6 @@
$likes,
'$strlike' => L10n::tt("%d person likes this", "%d people like this", $likes),
diff --git a/widgets/widgets.php b/widgets/widgets.php
index 2792a2dd..7310cc30 100644
--- a/widgets/widgets.php
+++ b/widgets/widgets.php
@@ -7,6 +7,7 @@
* Status: Unsupported
*/
+use Friendica\App;
use Friendica\Content\Text;
use Friendica\Core\Addon;
use Friendica\Core\L10n;
@@ -16,7 +17,7 @@ use Friendica\Database\DBA;
function widgets_install() {
Addon::registerHook('addon_settings', 'addon/widgets/widgets.php', 'widgets_settings');
Addon::registerHook('addon_settings_post', 'addon/widgets/widgets.php', 'widgets_settings_post');
- Text::logger("installed widgets");
+ App::logger("installed widgets");
}
function widgets_uninstall() {
@@ -59,7 +60,7 @@ function widgets_settings(&$a,&$o) {
# $t = file_get_contents( dirname(__file__). "/settings.tpl" );
$t = Text::getMarkupTemplate("settings.tpl", "addon/widgets/");
- $o .= Text::replaceMacros($t, [
+ $o .= App::replaceMacros($t, [
'$submit' => L10n::t('Generate new key'),
'$baseurl' => $a->getBaseURL(),
'$title' => "Widgets",
@@ -142,7 +143,7 @@ function widgets_content(&$a) {
$widget_size = call_user_func($a->argv[1].'_widget_size');
$script = file_get_contents(dirname(__file__)."/widgets.js");
- $o .= Text::replaceMacros($script, [
+ $o .= App::replaceMacros($script, [
'$entrypoint' => $a->getBaseURL()."/widgets/".$a->argv[1]."/cb/",
'$key' => $conf['key'],
'$widget_id' => 'f9a_'.$a->argv[1]."_"._randomAlphaNum(6),
diff --git a/windowsphonepush/windowsphonepush.php b/windowsphonepush/windowsphonepush.php
index 4e115b63..09bae7ea 100644
--- a/windowsphonepush/windowsphonepush.php
+++ b/windowsphonepush/windowsphonepush.php
@@ -54,7 +54,7 @@ function windowsphonepush_install()
Addon::registerHook('addon_settings', 'addon/windowsphonepush/windowsphonepush.php', 'windowsphonepush_settings');
Addon::registerHook('addon_settings_post', 'addon/windowsphonepush/windowsphonepush.php', 'windowsphonepush_settings_post');
- Text::logger("installed windowsphonepush");
+ App::logger("installed windowsphonepush");
}
function windowsphonepush_uninstall()
@@ -66,7 +66,7 @@ function windowsphonepush_uninstall()
Addon::unregisterHook('addon_settings', 'addon/windowsphonepush/windowsphonepush.php', 'windowsphonepush_settings');
Addon::unregisterHook('addon_settings_post', 'addon/windowsphonepush/windowsphonepush.php', 'windowsphonepush_settings_post');
- Text::logger("removed windowsphonepush");
+ App::logger("removed windowsphonepush");
}
/* declare the windowsphonepush function so that /windowsphonepush url requests will land here */
@@ -161,7 +161,7 @@ function windowsphonepush_cron()
// by app if user has switched the server setting in app - sending blank not possible as this would return an update error)
if (( $device_url == "" ) || ( $device_url == "NA" )) {
// no Device-URL for the user availabe, but addon is enabled --> write info to Logger
- Text::logger("WARN: windowsphonepush is enable for user " . $rr['uid'] . ", but no Device-URL is specified for the user.");
+ App::logger("WARN: windowsphonepush is enable for user " . $rr['uid'] . ", but no Device-URL is specified for the user.");
} else {
// retrieve the number of unseen items and the id of the latest one (if there are more than
// one new entries since last poller run, only the latest one will be pushed)
@@ -178,11 +178,11 @@ function windowsphonepush_cron()
break;
case "QueueFull":
// maximum of 30 messages reached, server rejects any further push notification until device reconnects
- Text::logger("INFO: Device-URL '" . $device_url . "' returns a QueueFull.");
+ App::logger("INFO: Device-URL '" . $device_url . "' returns a QueueFull.");
break;
case "Suppressed":
// notification received and dropped as something in app was not enabled
- Text::logger("WARN. Device-URL '" . $device_url . "' returns a Suppressed. Unexpected error in Mobile App?");
+ App::logger("WARN. Device-URL '" . $device_url . "' returns a Suppressed. Unexpected error in Mobile App?");
break;
case "Dropped":
// mostly combines with Expired, in that case Device-URL will be deleted from pconfig (function send_push)
@@ -190,7 +190,7 @@ function windowsphonepush_cron()
default:
// error, mostly called by "" which means that the url (not "" which has been checked)
// didn't not received Microsoft Notification Server -> wrong url
- Text::logger("ERROR: specified Device-URL '" . $device_url . "' didn't produced any response.");
+ App::logger("ERROR: specified Device-URL '" . $device_url . "' didn't produced any response.");
}
// additionally user receives the text of the newest item (function checks against last successfully pushed item)
@@ -307,7 +307,7 @@ function send_push($device_url, $headers, $msg)
$subscriptionStatus = get_header_value($output, 'X-SubscriptionStatus');
if ($subscriptionStatus == "Expired") {
PConfig::set(local_user(), 'windowsphonepush', 'device_url', "");
- Text::logger("ERROR: the stored Device-URL " . $device_url . "returned an 'Expired' error, it has been deleted now.");
+ App::logger("ERROR: the stored Device-URL " . $device_url . "returned an 'Expired' error, it has been deleted now.");
}
// the notification status shall be returned to windowsphonepush_cron (will
@@ -408,7 +408,7 @@ function windowsphonepush_updatesettings()
// check if sent url is empty - don't save and send return code to app
$device_url = $_POST['deviceurl'];
if ($device_url == "") {
- Text::logger("ERROR: no valid Device-URL specified - client transferred '" . $device_url . "'");
+ App::logger("ERROR: no valid Device-URL specified - client transferred '" . $device_url . "'");
return "No valid Device-URL specified";
}
@@ -423,13 +423,13 @@ function windowsphonepush_updatesettings()
if (count($r)) {
foreach ($r as $rr) {
PConfig::set($rr['uid'], 'windowsphonepush', 'device_url', '');
- Text::logger("WARN: the sent URL was already registered with user '" . $rr['uid'] . "'. Deleted for this user as we expect to be correct now for user '" . local_user() . "'.");
+ App::logger("WARN: the sent URL was already registered with user '" . $rr['uid'] . "'. Deleted for this user as we expect to be correct now for user '" . local_user() . "'.");
}
}
PConfig::set(local_user(), 'windowsphonepush', 'device_url', $device_url);
// output the successfull update of the device URL to the logger for error analysis if necessary
- Text::logger("INFO: Device-URL for user '" . local_user() . "' has been updated with '" . $device_url . "'");
+ App::logger("INFO: Device-URL for user '" . local_user() . "' has been updated with '" . $device_url . "'");
return "Device-URL updated successfully!";
}
@@ -456,7 +456,7 @@ function windowsphonepush_updatecounterunseen()
function windowsphonepush_login(App $a)
{
if (!isset($_SERVER['PHP_AUTH_USER'])) {
- Text::logger('API_login: ' . print_r($_SERVER, true), LOGGER_DEBUG);
+ App::logger('API_login: ' . print_r($_SERVER, true), LOGGER_DEBUG);
header('WWW-Authenticate: Basic realm="Friendica"');
header('HTTP/1.0 401 Unauthorized');
die('This api requires login');
@@ -467,7 +467,7 @@ function windowsphonepush_login(App $a)
if ($user_id) {
$record = DBA::selectFirst('user', [], ['uid' => $user_id]);
} else {
- Text::logger('API_login failure: ' . print_r($_SERVER, true), LOGGER_DEBUG);
+ App::logger('API_login failure: ' . print_r($_SERVER, true), LOGGER_DEBUG);
header('WWW-Authenticate: Basic realm="Friendica"');
header('HTTP/1.0 401 Unauthorized');
die('This api requires login');
diff --git a/wppost/wppost.php b/wppost/wppost.php
index 9c6becc5..b0edfe19 100644
--- a/wppost/wppost.php
+++ b/wppost/wppost.php
@@ -313,11 +313,11 @@ function wppost_send(&$a,&$b) {
EOT;
- Text::logger('wppost: data: ' . $xml, LOGGER_DATA);
+ App::logger('wppost: data: ' . $xml, LOGGER_DATA);
if ($wp_blog !== 'test') {
$x = Network::post($wp_blog, $xml)->getBody();
}
- Text::logger('posted to wordpress: ' . (($x) ? $x : ''), LOGGER_DEBUG);
+ App::logger('posted to wordpress: ' . (($x) ? $x : ''), LOGGER_DEBUG);
}
}
diff --git a/xmpp/xmpp.php b/xmpp/xmpp.php
index 96b1805c..48f20875 100644
--- a/xmpp/xmpp.php
+++ b/xmpp/xmpp.php
@@ -107,7 +107,7 @@ function xmpp_addon_admin(App $a, &$o)
{
$t = Text::getMarkupTemplate('admin.tpl', 'addon/xmpp/');
- $o = Text::replaceMacros($t, [
+ $o = App::replaceMacros($t, [
'$submit' => L10n::t('Save Settings'),
'$bosh_proxy' => ['bosh_proxy', L10n::t('Jabber BOSH host'), Config::get('xmpp', 'bosh_proxy'), ''],
'$central_userbase' => ['central_userbase', L10n::t('Use central userbase'), Config::get('xmpp', 'central_userbase'), L10n::t('If enabled, users will automatically login to an ejabberd server that has to be installed on this machine with synchronized credentials via the "auth_ejabberd.php" script.')],