mirror of
https://git.friendi.ca/friendica/friendica-addons.git
synced 2025-07-07 08:58:49 +00:00
Move PConfig::get() to DI::pConfig()->get()
This commit is contained in:
parent
2a35176588
commit
ea3a9052d8
42 changed files with 414 additions and 412 deletions
|
@ -97,8 +97,8 @@ function statusnet_uninstall()
|
|||
|
||||
function statusnet_check_item_notification(App $a, &$notification_data)
|
||||
{
|
||||
if (PConfig::get($notification_data["uid"], 'statusnet', 'post')) {
|
||||
$notification_data["profiles"][] = PConfig::get($notification_data["uid"], 'statusnet', 'own_url');
|
||||
if (DI::pConfig()->get($notification_data["uid"], 'statusnet', 'post')) {
|
||||
$notification_data["profiles"][] = DI::pConfig()->get($notification_data["uid"], 'statusnet', 'own_url');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -108,13 +108,13 @@ function statusnet_jot_nets(App $a, array &$jotnets_fields)
|
|||
return;
|
||||
}
|
||||
|
||||
if (PConfig::get(local_user(), 'statusnet', 'post')) {
|
||||
if (DI::pConfig()->get(local_user(), 'statusnet', 'post')) {
|
||||
$jotnets_fields[] = [
|
||||
'type' => 'checkbox',
|
||||
'field' => [
|
||||
'statusnet_enable',
|
||||
L10n::t('Post to GNU Social'),
|
||||
PConfig::get(local_user(), 'statusnet', 'post_by_default')
|
||||
DI::pConfig()->get(local_user(), 'statusnet', 'post_by_default')
|
||||
]
|
||||
];
|
||||
}
|
||||
|
@ -200,9 +200,9 @@ function statusnet_settings_post(App $a, $post)
|
|||
} else {
|
||||
if (isset($_POST['statusnet-pin'])) {
|
||||
// if the user supplied us with a PIN from GNU Social, let the magic of OAuth happen
|
||||
$api = PConfig::get(local_user(), 'statusnet', 'baseapi');
|
||||
$ckey = PConfig::get(local_user(), 'statusnet', 'consumerkey');
|
||||
$csecret = PConfig::get(local_user(), 'statusnet', 'consumersecret');
|
||||
$api = DI::pConfig()->get(local_user(), 'statusnet', 'baseapi');
|
||||
$ckey = DI::pConfig()->get(local_user(), 'statusnet', 'consumerkey');
|
||||
$csecret = DI::pConfig()->get(local_user(), 'statusnet', 'consumersecret');
|
||||
// the token and secret for which the PIN was generated were hidden in the settings
|
||||
// form as token and token2, we need a new connection to GNU Social using these token
|
||||
// and secret to request a Access Token with the PIN
|
||||
|
@ -246,23 +246,23 @@ function statusnet_settings(App $a, &$s)
|
|||
* allow the user to cancel the connection process at this step
|
||||
* 3) Checkbox for "Send public notices (respect size limitation)
|
||||
*/
|
||||
$api = PConfig::get(local_user(), 'statusnet', 'baseapi');
|
||||
$ckey = PConfig::get(local_user(), 'statusnet', 'consumerkey');
|
||||
$csecret = PConfig::get(local_user(), 'statusnet', 'consumersecret');
|
||||
$otoken = PConfig::get(local_user(), 'statusnet', 'oauthtoken');
|
||||
$osecret = PConfig::get(local_user(), 'statusnet', 'oauthsecret');
|
||||
$enabled = PConfig::get(local_user(), 'statusnet', 'post');
|
||||
$api = DI::pConfig()->get(local_user(), 'statusnet', 'baseapi');
|
||||
$ckey = DI::pConfig()->get(local_user(), 'statusnet', 'consumerkey');
|
||||
$csecret = DI::pConfig()->get(local_user(), 'statusnet', 'consumersecret');
|
||||
$otoken = DI::pConfig()->get(local_user(), 'statusnet', 'oauthtoken');
|
||||
$osecret = DI::pConfig()->get(local_user(), 'statusnet', 'oauthsecret');
|
||||
$enabled = DI::pConfig()->get(local_user(), 'statusnet', 'post');
|
||||
$checked = (($enabled) ? ' checked="checked" ' : '');
|
||||
$defenabled = PConfig::get(local_user(), 'statusnet', 'post_by_default');
|
||||
$defenabled = DI::pConfig()->get(local_user(), 'statusnet', 'post_by_default');
|
||||
$defchecked = (($defenabled) ? ' checked="checked" ' : '');
|
||||
$mirrorenabled = PConfig::get(local_user(), 'statusnet', 'mirror_posts');
|
||||
$mirrorenabled = DI::pConfig()->get(local_user(), 'statusnet', 'mirror_posts');
|
||||
$mirrorchecked = (($mirrorenabled) ? ' checked="checked" ' : '');
|
||||
$import = PConfig::get(local_user(), 'statusnet', 'import');
|
||||
$import = DI::pConfig()->get(local_user(), 'statusnet', 'import');
|
||||
$importselected = ["", "", ""];
|
||||
$importselected[$import] = ' selected="selected"';
|
||||
//$importenabled = PConfig::get(local_user(),'statusnet','import');
|
||||
//$importenabled = DI::pConfig()->get(local_user(),'statusnet','import');
|
||||
//$importchecked = (($importenabled) ? ' checked="checked" ' : '');
|
||||
$create_userenabled = PConfig::get(local_user(), 'statusnet', 'create_user');
|
||||
$create_userenabled = DI::pConfig()->get(local_user(), 'statusnet', 'create_user');
|
||||
$create_userchecked = (($create_userenabled) ? ' checked="checked" ' : '');
|
||||
|
||||
$css = (($enabled) ? '' : '-disabled');
|
||||
|
@ -423,7 +423,7 @@ function statusnet_hook_fork(App $a, array &$b)
|
|||
return;
|
||||
}
|
||||
|
||||
if (PConfig::get($post['uid'], 'statusnet', 'import')) {
|
||||
if (DI::pConfig()->get($post['uid'], 'statusnet', 'import')) {
|
||||
// Don't fork if it isn't a reply to a GNU Social post
|
||||
if (($post['parent'] != $post['id']) && !Item::exists(['id' => $post['parent'], 'network' => Protocol::STATUSNET])) {
|
||||
Logger::log('No GNU Social parent found for item ' . $post['id']);
|
||||
|
@ -449,11 +449,11 @@ function statusnet_post_local(App $a, &$b)
|
|||
return;
|
||||
}
|
||||
|
||||
$statusnet_post = PConfig::get(local_user(), 'statusnet', 'post');
|
||||
$statusnet_post = DI::pConfig()->get(local_user(), 'statusnet', 'post');
|
||||
$statusnet_enable = (($statusnet_post && !empty($_REQUEST['statusnet_enable'])) ? intval($_REQUEST['statusnet_enable']) : 0);
|
||||
|
||||
// if API is used, default to the chosen settings
|
||||
if ($b['api_source'] && intval(PConfig::get(local_user(), 'statusnet', 'post_by_default'))) {
|
||||
if ($b['api_source'] && intval(DI::pConfig()->get(local_user(), 'statusnet', 'post_by_default'))) {
|
||||
$statusnet_enable = 1;
|
||||
}
|
||||
|
||||
|
@ -470,11 +470,11 @@ function statusnet_post_local(App $a, &$b)
|
|||
|
||||
function statusnet_action(App $a, $uid, $pid, $action)
|
||||
{
|
||||
$api = PConfig::get($uid, 'statusnet', 'baseapi');
|
||||
$ckey = PConfig::get($uid, 'statusnet', 'consumerkey');
|
||||
$csecret = PConfig::get($uid, 'statusnet', 'consumersecret');
|
||||
$otoken = PConfig::get($uid, 'statusnet', 'oauthtoken');
|
||||
$osecret = PConfig::get($uid, 'statusnet', 'oauthsecret');
|
||||
$api = DI::pConfig()->get($uid, 'statusnet', 'baseapi');
|
||||
$ckey = DI::pConfig()->get($uid, 'statusnet', 'consumerkey');
|
||||
$csecret = DI::pConfig()->get($uid, 'statusnet', 'consumersecret');
|
||||
$otoken = DI::pConfig()->get($uid, 'statusnet', 'oauthtoken');
|
||||
$osecret = DI::pConfig()->get($uid, 'statusnet', 'oauthsecret');
|
||||
|
||||
$connection = new StatusNetOAuth($api, $ckey, $csecret, $otoken, $osecret);
|
||||
|
||||
|
@ -499,12 +499,12 @@ function statusnet_post_hook(App $a, &$b)
|
|||
/**
|
||||
* Post to GNU Social
|
||||
*/
|
||||
if (!PConfig::get($b["uid"], 'statusnet', 'import')) {
|
||||
if (!DI::pConfig()->get($b["uid"], 'statusnet', 'import')) {
|
||||
if ($b['deleted'] || $b['private'] || ($b['created'] !== $b['edited']))
|
||||
return;
|
||||
}
|
||||
|
||||
$api = PConfig::get($b["uid"], 'statusnet', 'baseapi');
|
||||
$api = DI::pConfig()->get($b["uid"], 'statusnet', 'baseapi');
|
||||
$hostname = preg_replace("=https?://([\w\.]*)/.*=ism", "$1", $api);
|
||||
|
||||
if ($b['parent'] != $b['id']) {
|
||||
|
@ -582,11 +582,11 @@ function statusnet_post_hook(App $a, &$b)
|
|||
|
||||
DI::pConfig()->load($b['uid'], 'statusnet');
|
||||
|
||||
$api = PConfig::get($b['uid'], 'statusnet', 'baseapi');
|
||||
$ckey = PConfig::get($b['uid'], 'statusnet', 'consumerkey');
|
||||
$csecret = PConfig::get($b['uid'], 'statusnet', 'consumersecret');
|
||||
$otoken = PConfig::get($b['uid'], 'statusnet', 'oauthtoken');
|
||||
$osecret = PConfig::get($b['uid'], 'statusnet', 'oauthsecret');
|
||||
$api = DI::pConfig()->get($b['uid'], 'statusnet', 'baseapi');
|
||||
$ckey = DI::pConfig()->get($b['uid'], 'statusnet', 'consumerkey');
|
||||
$csecret = DI::pConfig()->get($b['uid'], 'statusnet', 'consumersecret');
|
||||
$otoken = DI::pConfig()->get($b['uid'], 'statusnet', 'oauthtoken');
|
||||
$osecret = DI::pConfig()->get($b['uid'], 'statusnet', 'oauthsecret');
|
||||
|
||||
if ($ckey && $csecret && $otoken && $osecret) {
|
||||
// If it's a repeated message from GNU Social then do a native retweet and exit
|
||||
|
@ -730,7 +730,7 @@ function statusnet_prepare_body(App $a, &$b)
|
|||
}
|
||||
|
||||
if ($b["preview"]) {
|
||||
$max_char = PConfig::get(local_user(), 'statusnet', 'max_char');
|
||||
$max_char = DI::pConfig()->get(local_user(), 'statusnet', 'max_char');
|
||||
if (intval($max_char) == 0) {
|
||||
$max_char = 140;
|
||||
}
|
||||
|
@ -822,18 +822,18 @@ function statusnet_cron(App $a, $b)
|
|||
|
||||
function statusnet_fetchtimeline(App $a, $uid)
|
||||
{
|
||||
$ckey = PConfig::get($uid, 'statusnet', 'consumerkey');
|
||||
$csecret = PConfig::get($uid, 'statusnet', 'consumersecret');
|
||||
$api = PConfig::get($uid, 'statusnet', 'baseapi');
|
||||
$otoken = PConfig::get($uid, 'statusnet', 'oauthtoken');
|
||||
$osecret = PConfig::get($uid, 'statusnet', 'oauthsecret');
|
||||
$lastid = PConfig::get($uid, 'statusnet', 'lastid');
|
||||
$ckey = DI::pConfig()->get($uid, 'statusnet', 'consumerkey');
|
||||
$csecret = DI::pConfig()->get($uid, 'statusnet', 'consumersecret');
|
||||
$api = DI::pConfig()->get($uid, 'statusnet', 'baseapi');
|
||||
$otoken = DI::pConfig()->get($uid, 'statusnet', 'oauthtoken');
|
||||
$osecret = DI::pConfig()->get($uid, 'statusnet', 'oauthsecret');
|
||||
$lastid = DI::pConfig()->get($uid, 'statusnet', 'lastid');
|
||||
|
||||
require_once 'mod/item.php';
|
||||
// get the application name for the SN app
|
||||
// 1st try personal config, then system config and fallback to the
|
||||
// hostname of the node if neither one is set.
|
||||
$application_name = PConfig::get($uid, 'statusnet', 'application_name');
|
||||
$application_name = DI::pConfig()->get($uid, 'statusnet', 'application_name');
|
||||
if ($application_name == "") {
|
||||
$application_name = Config::get('statusnet', 'application_name');
|
||||
}
|
||||
|
@ -1056,11 +1056,11 @@ function statusnet_fetch_contact($uid, $contact, $create_user)
|
|||
|
||||
function statusnet_fetchuser(App $a, $uid, $screen_name = "", $user_id = "")
|
||||
{
|
||||
$ckey = PConfig::get($uid, 'statusnet', 'consumerkey');
|
||||
$csecret = PConfig::get($uid, 'statusnet', 'consumersecret');
|
||||
$api = PConfig::get($uid, 'statusnet', 'baseapi');
|
||||
$otoken = PConfig::get($uid, 'statusnet', 'oauthtoken');
|
||||
$osecret = PConfig::get($uid, 'statusnet', 'oauthsecret');
|
||||
$ckey = DI::pConfig()->get($uid, 'statusnet', 'consumerkey');
|
||||
$csecret = DI::pConfig()->get($uid, 'statusnet', 'consumersecret');
|
||||
$api = DI::pConfig()->get($uid, 'statusnet', 'baseapi');
|
||||
$otoken = DI::pConfig()->get($uid, 'statusnet', 'oauthtoken');
|
||||
$osecret = DI::pConfig()->get($uid, 'statusnet', 'oauthsecret');
|
||||
|
||||
require_once __DIR__ . DIRECTORY_SEPARATOR . 'library' . DIRECTORY_SEPARATOR . 'codebirdsn.php';
|
||||
|
||||
|
@ -1103,7 +1103,7 @@ function statusnet_createpost(App $a, $uid, $post, $self, $create_user, $only_ex
|
|||
{
|
||||
Logger::log("statusnet_createpost: start", Logger::DEBUG);
|
||||
|
||||
$api = PConfig::get($uid, 'statusnet', 'baseapi');
|
||||
$api = DI::pConfig()->get($uid, 'statusnet', 'baseapi');
|
||||
$hostname = preg_replace("=https?://([\w\.]*)/.*=ism", "$1", $api);
|
||||
|
||||
$postarray = [];
|
||||
|
@ -1149,7 +1149,7 @@ function statusnet_createpost(App $a, $uid, $post, $self, $create_user, $only_ex
|
|||
}
|
||||
|
||||
// Is it me?
|
||||
$own_url = PConfig::get($uid, 'statusnet', 'own_url');
|
||||
$own_url = DI::pConfig()->get($uid, 'statusnet', 'own_url');
|
||||
|
||||
if ($content->user->id == $own_url) {
|
||||
$r = q("SELECT * FROM `contact` WHERE `self` = 1 AND `uid` = %d LIMIT 1",
|
||||
|
@ -1193,7 +1193,7 @@ function statusnet_createpost(App $a, $uid, $post, $self, $create_user, $only_ex
|
|||
$postarray['author-avatar'] = $content->user->profile_image_url;
|
||||
|
||||
// To-Do: Maybe unreliable? Can the api be entered without trailing "/"?
|
||||
$hostname = str_replace("/api/", "/notice/", PConfig::get($uid, 'statusnet', 'baseapi'));
|
||||
$hostname = str_replace("/api/", "/notice/", DI::pConfig()->get($uid, 'statusnet', 'baseapi'));
|
||||
|
||||
$postarray['plink'] = $hostname . $content->id;
|
||||
$postarray['app'] = strip_tags($content->source);
|
||||
|
@ -1237,12 +1237,12 @@ function statusnet_fetchhometimeline(App $a, $uid, $mode = 1)
|
|||
{
|
||||
$conversations = [];
|
||||
|
||||
$ckey = PConfig::get($uid, 'statusnet', 'consumerkey');
|
||||
$csecret = PConfig::get($uid, 'statusnet', 'consumersecret');
|
||||
$api = PConfig::get($uid, 'statusnet', 'baseapi');
|
||||
$otoken = PConfig::get($uid, 'statusnet', 'oauthtoken');
|
||||
$osecret = PConfig::get($uid, 'statusnet', 'oauthsecret');
|
||||
$create_user = PConfig::get($uid, 'statusnet', 'create_user');
|
||||
$ckey = DI::pConfig()->get($uid, 'statusnet', 'consumerkey');
|
||||
$csecret = DI::pConfig()->get($uid, 'statusnet', 'consumersecret');
|
||||
$api = DI::pConfig()->get($uid, 'statusnet', 'baseapi');
|
||||
$otoken = DI::pConfig()->get($uid, 'statusnet', 'oauthtoken');
|
||||
$osecret = DI::pConfig()->get($uid, 'statusnet', 'oauthsecret');
|
||||
$create_user = DI::pConfig()->get($uid, 'statusnet', 'create_user');
|
||||
|
||||
// "create_user" is deactivated, since currently you cannot add users manually by now
|
||||
$create_user = true;
|
||||
|
@ -1290,7 +1290,7 @@ function statusnet_fetchhometimeline(App $a, $uid, $mode = 1)
|
|||
|
||||
if ($mode == 1) {
|
||||
// Fetching timeline
|
||||
$lastid = PConfig::get($uid, 'statusnet', 'lasthometimelineid');
|
||||
$lastid = DI::pConfig()->get($uid, 'statusnet', 'lasthometimelineid');
|
||||
//$lastid = 1;
|
||||
|
||||
$first_time = ($lastid == "");
|
||||
|
@ -1354,7 +1354,7 @@ function statusnet_fetchhometimeline(App $a, $uid, $mode = 1)
|
|||
}
|
||||
|
||||
// Fetching mentions
|
||||
$lastid = PConfig::get($uid, 'statusnet', 'lastmentionid');
|
||||
$lastid = DI::pConfig()->get($uid, 'statusnet', 'lastmentionid');
|
||||
$first_time = ($lastid == "");
|
||||
|
||||
if ($lastid != "") {
|
||||
|
@ -1406,12 +1406,12 @@ function statusnet_fetchhometimeline(App $a, $uid, $mode = 1)
|
|||
|
||||
function statusnet_complete_conversation(App $a, $uid, $self, $create_user, $nick, $conversation)
|
||||
{
|
||||
$ckey = PConfig::get($uid, 'statusnet', 'consumerkey');
|
||||
$csecret = PConfig::get($uid, 'statusnet', 'consumersecret');
|
||||
$api = PConfig::get($uid, 'statusnet', 'baseapi');
|
||||
$otoken = PConfig::get($uid, 'statusnet', 'oauthtoken');
|
||||
$osecret = PConfig::get($uid, 'statusnet', 'oauthsecret');
|
||||
$own_url = PConfig::get($uid, 'statusnet', 'own_url');
|
||||
$ckey = DI::pConfig()->get($uid, 'statusnet', 'consumerkey');
|
||||
$csecret = DI::pConfig()->get($uid, 'statusnet', 'consumersecret');
|
||||
$api = DI::pConfig()->get($uid, 'statusnet', 'baseapi');
|
||||
$otoken = DI::pConfig()->get($uid, 'statusnet', 'oauthtoken');
|
||||
$osecret = DI::pConfig()->get($uid, 'statusnet', 'oauthsecret');
|
||||
$own_url = DI::pConfig()->get($uid, 'statusnet', 'own_url');
|
||||
|
||||
$connection = new StatusNetOAuth($api, $ckey, $csecret, $otoken, $osecret);
|
||||
|
||||
|
@ -1547,12 +1547,12 @@ function statusnet_convertmsg(App $a, $body, $no_tags = false)
|
|||
|
||||
function statusnet_fetch_own_contact(App $a, $uid)
|
||||
{
|
||||
$ckey = PConfig::get($uid, 'statusnet', 'consumerkey');
|
||||
$csecret = PConfig::get($uid, 'statusnet', 'consumersecret');
|
||||
$api = PConfig::get($uid, 'statusnet', 'baseapi');
|
||||
$otoken = PConfig::get($uid, 'statusnet', 'oauthtoken');
|
||||
$osecret = PConfig::get($uid, 'statusnet', 'oauthsecret');
|
||||
$own_url = PConfig::get($uid, 'statusnet', 'own_url');
|
||||
$ckey = DI::pConfig()->get($uid, 'statusnet', 'consumerkey');
|
||||
$csecret = DI::pConfig()->get($uid, 'statusnet', 'consumersecret');
|
||||
$api = DI::pConfig()->get($uid, 'statusnet', 'baseapi');
|
||||
$otoken = DI::pConfig()->get($uid, 'statusnet', 'oauthtoken');
|
||||
$osecret = DI::pConfig()->get($uid, 'statusnet', 'oauthsecret');
|
||||
$own_url = DI::pConfig()->get($uid, 'statusnet', 'own_url');
|
||||
|
||||
$contact_id = 0;
|
||||
|
||||
|
@ -1613,11 +1613,11 @@ function statusnet_is_retweet(App $a, $uid, $body)
|
|||
$link = $matches[1];
|
||||
}
|
||||
|
||||
$ckey = PConfig::get($uid, 'statusnet', 'consumerkey');
|
||||
$csecret = PConfig::get($uid, 'statusnet', 'consumersecret');
|
||||
$api = PConfig::get($uid, 'statusnet', 'baseapi');
|
||||
$otoken = PConfig::get($uid, 'statusnet', 'oauthtoken');
|
||||
$osecret = PConfig::get($uid, 'statusnet', 'oauthsecret');
|
||||
$ckey = DI::pConfig()->get($uid, 'statusnet', 'consumerkey');
|
||||
$csecret = DI::pConfig()->get($uid, 'statusnet', 'consumersecret');
|
||||
$api = DI::pConfig()->get($uid, 'statusnet', 'baseapi');
|
||||
$otoken = DI::pConfig()->get($uid, 'statusnet', 'oauthtoken');
|
||||
$osecret = DI::pConfig()->get($uid, 'statusnet', 'oauthsecret');
|
||||
$hostname = preg_replace("=https?://([\w\.]*)/.*=ism", "$1", $api);
|
||||
|
||||
$id = preg_replace("=https?://" . $hostname . "/notice/(.*)=ism", "$1", $link);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue