forked from friendica/friendica-addons
[various] Improve formatting
This commit is contained in:
parent
5d8129600d
commit
0f6ea75bb7
|
@ -13,12 +13,10 @@ use Friendica\Core\Renderer;
|
||||||
use Friendica\Core\Session;
|
use Friendica\Core\Session;
|
||||||
use Friendica\DI;
|
use Friendica\DI;
|
||||||
|
|
||||||
function group_text_install() {
|
function group_text_install()
|
||||||
|
{
|
||||||
Hook::register('addon_settings', 'addon/group_text/group_text.php', 'group_text_settings');
|
Hook::register('addon_settings', 'addon/group_text/group_text.php', 'group_text_settings');
|
||||||
Hook::register('addon_settings_post', 'addon/group_text/group_text.php', 'group_text_settings_post');
|
Hook::register('addon_settings_post', 'addon/group_text/group_text.php', 'group_text_settings_post');
|
||||||
|
|
||||||
Logger::notice("installed group_text");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -30,29 +28,30 @@ function group_text_install() {
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function group_text_settings_post(App $a, $post) {
|
function group_text_settings_post(App $a, array $post)
|
||||||
if(! Session::getLocalUser() || empty($_POST['group_text-submit']))
|
{
|
||||||
|
if (!Session::getLocalUser() || empty($post['group_text-submit'])) {
|
||||||
return;
|
return;
|
||||||
DI::pConfig()->set(Session::getLocalUser(),'system','groupedit_image_limit',intval($_POST['group_text']));
|
}
|
||||||
|
|
||||||
|
DI::pConfig()->set(Session::getLocalUser(), 'system', 'groupedit_image_limit', intval($post['group_text']));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Called from the Addon Setting form.
|
* Called from the Addon Setting form.
|
||||||
* Add our own settings info to the page.
|
* Add our own settings info to the page.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function group_text_settings(App &$a, array &$data)
|
function group_text_settings(App &$a, array &$data)
|
||||||
{
|
{
|
||||||
if (!Session::getLocalUser()) {
|
if (!Session::getLocalUser()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$enabled = DI::pConfig()->get(Session::getLocalUser(),'system','groupedit_image_limit');
|
$enabled = DI::pConfig()->get(Session::getLocalUser(), 'system', 'groupedit_image_limit');
|
||||||
|
|
||||||
$t = Renderer::getMarkupTemplate('settings.tpl', 'addon/group_text/');
|
$t = Renderer::getMarkupTemplate('settings.tpl', 'addon/group_text/');
|
||||||
$html = Renderer::replaceMacros($t, [
|
$html = Renderer::replaceMacros($t, [
|
||||||
|
|
|
@ -108,7 +108,7 @@ function libertree_post_local(App $a, array &$b)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((!Session::getLocalUser()) || (Session::getLocalUser() != $b['uid'])) {
|
if (!Session::getLocalUser() || (Session::getLocalUser() != $b['uid'])) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -54,7 +54,7 @@ function ljpost_settings(App &$a, array &$data)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$enabled = DI::pConfig()->get(Session::getLocalUser(), 'ljpost', 'post', false);
|
$enabled = DI::pConfig()->get(Session::getLocalUser(), 'ljpost', 'post', false);
|
||||||
$ij_username = DI::pConfig()->get(Session::getLocalUser(), 'ljpost', 'ij_username');
|
$ij_username = DI::pConfig()->get(Session::getLocalUser(), 'ljpost', 'ij_username');
|
||||||
$def_enabled = DI::pConfig()->get(Session::getLocalUser(), 'ljpost', 'post_by_default');
|
$def_enabled = DI::pConfig()->get(Session::getLocalUser(), 'ljpost', 'post_by_default');
|
||||||
|
|
||||||
|
@ -92,7 +92,7 @@ function ljpost_post_local(App $a, array &$b)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((!Session::getLocalUser()) || (Session::getLocalUser() != $b['uid'])) {
|
if (!Session::getLocalUser() || (Session::getLocalUser() != $b['uid'])) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -139,9 +139,9 @@ function pumpio_registerclient(App $a, $host)
|
||||||
function pumpio_connect(App $a)
|
function pumpio_connect(App $a)
|
||||||
{
|
{
|
||||||
// Define the needed keys
|
// Define the needed keys
|
||||||
$consumer_key = DI::pConfig()->get(Session::getLocalUser(), 'pumpio', 'consumer_key');
|
$consumer_key = DI::pConfig()->get(Session::getLocalUser(), 'pumpio', 'consumer_key');
|
||||||
$consumer_secret = DI::pConfig()->get(Session::getLocalUser(), 'pumpio', 'consumer_secret');
|
$consumer_secret = DI::pConfig()->get(Session::getLocalUser(), 'pumpio', 'consumer_secret');
|
||||||
$hostname = DI::pConfig()->get(Session::getLocalUser(), 'pumpio', 'host');
|
$hostname = DI::pConfig()->get(Session::getLocalUser(), 'pumpio', 'host');
|
||||||
|
|
||||||
if ((($consumer_key == '') || ($consumer_secret == '')) && ($hostname != '')) {
|
if ((($consumer_key == '') || ($consumer_secret == '')) && ($hostname != '')) {
|
||||||
Logger::notice('pumpio_connect: register client');
|
Logger::notice('pumpio_connect: register client');
|
||||||
|
@ -149,7 +149,7 @@ function pumpio_connect(App $a)
|
||||||
DI::pConfig()->set(Session::getLocalUser(), 'pumpio', 'consumer_key', $clientdata->client_id);
|
DI::pConfig()->set(Session::getLocalUser(), 'pumpio', 'consumer_key', $clientdata->client_id);
|
||||||
DI::pConfig()->set(Session::getLocalUser(), 'pumpio', 'consumer_secret', $clientdata->client_secret);
|
DI::pConfig()->set(Session::getLocalUser(), 'pumpio', 'consumer_secret', $clientdata->client_secret);
|
||||||
|
|
||||||
$consumer_key = DI::pConfig()->get(Session::getLocalUser(), 'pumpio', 'consumer_key');
|
$consumer_key = DI::pConfig()->get(Session::getLocalUser(), 'pumpio', 'consumer_key');
|
||||||
$consumer_secret = DI::pConfig()->get(Session::getLocalUser(), 'pumpio', 'consumer_secret');
|
$consumer_secret = DI::pConfig()->get(Session::getLocalUser(), 'pumpio', 'consumer_secret');
|
||||||
|
|
||||||
Logger::info('pumpio_connect: ckey: ' . $consumer_key . ' csecrect: ' . $consumer_secret);
|
Logger::info('pumpio_connect: ckey: ' . $consumer_key . ' csecrect: ' . $consumer_secret);
|
||||||
|
@ -463,13 +463,13 @@ function pumpio_send(App $a, array &$b)
|
||||||
// Support for native shares
|
// Support for native shares
|
||||||
// http://<hostname>/api/<type>/shares?id=<the-object-id>
|
// http://<hostname>/api/<type>/shares?id=<the-object-id>
|
||||||
|
|
||||||
$oauth_token = DI::pConfig()->get($b['uid'], 'pumpio', 'oauth_token');
|
$oauth_token = DI::pConfig()->get($b['uid'], 'pumpio', 'oauth_token');
|
||||||
$oauth_token_secret = DI::pConfig()->get($b['uid'], 'pumpio', 'oauth_token_secret');
|
$oauth_token_secret = DI::pConfig()->get($b['uid'], 'pumpio', 'oauth_token_secret');
|
||||||
$consumer_key = DI::pConfig()->get($b['uid'], 'pumpio', 'consumer_key');
|
$consumer_key = DI::pConfig()->get($b['uid'], 'pumpio', 'consumer_key');
|
||||||
$consumer_secret = DI::pConfig()->get($b['uid'], 'pumpio', 'consumer_secret');
|
$consumer_secret = DI::pConfig()->get($b['uid'], 'pumpio', 'consumer_secret');
|
||||||
|
|
||||||
$host = DI::pConfig()->get($b['uid'], 'pumpio', 'host');
|
$host = DI::pConfig()->get($b['uid'], 'pumpio', 'host');
|
||||||
$user = DI::pConfig()->get($b['uid'], 'pumpio', 'user');
|
$user = DI::pConfig()->get($b['uid'], 'pumpio', 'user');
|
||||||
$public = DI::pConfig()->get($b['uid'], 'pumpio', 'public');
|
$public = DI::pConfig()->get($b['uid'], 'pumpio', 'public');
|
||||||
|
|
||||||
if ($oauth_token && $oauth_token_secret) {
|
if ($oauth_token && $oauth_token_secret) {
|
||||||
|
@ -700,10 +700,10 @@ function pumpio_cron(App $a, $b)
|
||||||
|
|
||||||
function pumpio_fetchtimeline(App $a, int $uid)
|
function pumpio_fetchtimeline(App $a, int $uid)
|
||||||
{
|
{
|
||||||
$ckey = DI::pConfig()->get($uid, 'pumpio', 'consumer_key');
|
$ckey = DI::pConfig()->get($uid, 'pumpio', 'consumer_key');
|
||||||
$csecret = DI::pConfig()->get($uid, 'pumpio', 'consumer_secret');
|
$csecret = DI::pConfig()->get($uid, 'pumpio', 'consumer_secret');
|
||||||
$otoken = DI::pConfig()->get($uid, 'pumpio', 'oauth_token');
|
$otoken = DI::pConfig()->get($uid, 'pumpio', 'oauth_token');
|
||||||
$osecret = DI::pConfig()->get($uid, 'pumpio', 'oauth_token_secret');
|
$osecret = DI::pConfig()->get($uid, 'pumpio', 'oauth_token_secret');
|
||||||
$lastdate = DI::pConfig()->get($uid, 'pumpio', 'lastdate');
|
$lastdate = DI::pConfig()->get($uid, 'pumpio', 'lastdate');
|
||||||
$hostname = DI::pConfig()->get($uid, 'pumpio', 'host');
|
$hostname = DI::pConfig()->get($uid, 'pumpio', 'host');
|
||||||
$username = DI::pConfig()->get($uid, 'pumpio', 'user');
|
$username = DI::pConfig()->get($uid, 'pumpio', 'user');
|
||||||
|
@ -1125,7 +1125,6 @@ function pumpio_dopost(App $a, $client, int $uid, array $self, $post, string $ow
|
||||||
$reply->generator->displayName = 'pumpio';
|
$reply->generator->displayName = 'pumpio';
|
||||||
$reply->published = $post->object->inReplyTo->published;
|
$reply->published = $post->object->inReplyTo->published;
|
||||||
$reply->received = $post->object->inReplyTo->updated;
|
$reply->received = $post->object->inReplyTo->updated;
|
||||||
$reply->url = $post->object->inReplyTo->url;
|
|
||||||
pumpio_dopost($a, $client, $uid, $self, $reply, $own_id, false);
|
pumpio_dopost($a, $client, $uid, $self, $reply, $own_id, false);
|
||||||
|
|
||||||
$postarray['thr-parent'] = $post->object->inReplyTo->id;
|
$postarray['thr-parent'] = $post->object->inReplyTo->id;
|
||||||
|
@ -1219,7 +1218,7 @@ function pumpio_dopost(App $a, $client, int $uid, array $self, $post, string $ow
|
||||||
|
|
||||||
function pumpio_fetchinbox(App $a, int $uid)
|
function pumpio_fetchinbox(App $a, int $uid)
|
||||||
{
|
{
|
||||||
$ckey= DI::pConfig()->get($uid, 'pumpio', 'consumer_key');
|
$ckey = DI::pConfig()->get($uid, 'pumpio', 'consumer_key');
|
||||||
$csecret = DI::pConfig()->get($uid, 'pumpio', 'consumer_secret');
|
$csecret = DI::pConfig()->get($uid, 'pumpio', 'consumer_secret');
|
||||||
$otoken = DI::pConfig()->get($uid, 'pumpio', 'oauth_token');
|
$otoken = DI::pConfig()->get($uid, 'pumpio', 'oauth_token');
|
||||||
$osecret = DI::pConfig()->get($uid, 'pumpio', 'oauth_token_secret');
|
$osecret = DI::pConfig()->get($uid, 'pumpio', 'oauth_token_secret');
|
||||||
|
@ -1285,7 +1284,7 @@ function pumpio_fetchinbox(App $a, int $uid)
|
||||||
|
|
||||||
function pumpio_getallusers(App &$a, int $uid)
|
function pumpio_getallusers(App &$a, int $uid)
|
||||||
{
|
{
|
||||||
$ckey= DI::pConfig()->get($uid, 'pumpio', 'consumer_key');
|
$ckey = DI::pConfig()->get($uid, 'pumpio', 'consumer_key');
|
||||||
$csecret = DI::pConfig()->get($uid, 'pumpio', 'consumer_secret');
|
$csecret = DI::pConfig()->get($uid, 'pumpio', 'consumer_secret');
|
||||||
$otoken = DI::pConfig()->get($uid, 'pumpio', 'oauth_token');
|
$otoken = DI::pConfig()->get($uid, 'pumpio', 'oauth_token');
|
||||||
$osecret = DI::pConfig()->get($uid, 'pumpio', 'oauth_token_secret');
|
$osecret = DI::pConfig()->get($uid, 'pumpio', 'oauth_token_secret');
|
||||||
|
|
|
@ -73,19 +73,19 @@ function windowsphonepush_module() {}
|
||||||
* We will make sure we've got a valid user account
|
* We will make sure we've got a valid user account
|
||||||
* and if so set our configuration setting for this person.
|
* and if so set our configuration setting for this person.
|
||||||
*/
|
*/
|
||||||
function windowsphonepush_settings_post(App $a, $post)
|
function windowsphonepush_settings_post(App $a, array $post)
|
||||||
{
|
{
|
||||||
if (!Session::getLocalUser() || empty($_POST['windowsphonepush-submit'])) {
|
if (!Session::getLocalUser() || empty($post['windowsphonepush-submit'])) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$enable = intval($_POST['windowsphonepush']);
|
$enable = intval($post['windowsphonepush']);
|
||||||
DI::pConfig()->set(Session::getLocalUser(), 'windowsphonepush', 'enable', $enable);
|
DI::pConfig()->set(Session::getLocalUser(), 'windowsphonepush', 'enable', $enable);
|
||||||
|
|
||||||
if ($enable) {
|
if ($enable) {
|
||||||
DI::pConfig()->set(Session::getLocalUser(), 'windowsphonepush', 'counterunseen', 0);
|
DI::pConfig()->set(Session::getLocalUser(), 'windowsphonepush', 'counterunseen', 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
DI::pConfig()->set(Session::getLocalUser(), 'windowsphonepush', 'senditemtext', intval($_POST['windowsphonepush-senditemtext']));
|
DI::pConfig()->set(Session::getLocalUser(), 'windowsphonepush', 'senditemtext', intval($post['windowsphonepush-senditemtext']));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Called from the Addon Setting form.
|
/* Called from the Addon Setting form.
|
||||||
|
@ -97,9 +97,9 @@ function windowsphonepush_settings(App &$a, array &$data)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$enabled = DI::pConfig()->get(Session::getLocalUser(), 'windowsphonepush', 'enable');
|
$enabled = DI::pConfig()->get(Session::getLocalUser(), 'windowsphonepush', 'enable');
|
||||||
$senditemtext = DI::pConfig()->get(Session::getLocalUser(), 'windowsphonepush', 'senditemtext');
|
$senditemtext = DI::pConfig()->get(Session::getLocalUser(), 'windowsphonepush', 'senditemtext');
|
||||||
$device_url = DI::pConfig()->get(Session::getLocalUser(), 'windowsphonepush', 'device_url');
|
$device_url = DI::pConfig()->get(Session::getLocalUser(), 'windowsphonepush', 'device_url');
|
||||||
|
|
||||||
$t = Renderer::getMarkupTemplate('settings.tpl', 'addon/windowsphonepush/');
|
$t = Renderer::getMarkupTemplate('settings.tpl', 'addon/windowsphonepush/');
|
||||||
$html = Renderer::replaceMacros($t, [
|
$html = Renderer::replaceMacros($t, [
|
||||||
|
@ -334,12 +334,12 @@ function windowsphonepush_showsettings()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$enable = DI::pConfig()->get(Session::getLocalUser(), 'windowsphonepush', 'enable');
|
$enable = DI::pConfig()->get(Session::getLocalUser(), 'windowsphonepush', 'enable');
|
||||||
$device_url = DI::pConfig()->get(Session::getLocalUser(), 'windowsphonepush', 'device_url');
|
$device_url = DI::pConfig()->get(Session::getLocalUser(), 'windowsphonepush', 'device_url');
|
||||||
$senditemtext = DI::pConfig()->get(Session::getLocalUser(), 'windowsphonepush', 'senditemtext');
|
$senditemtext = DI::pConfig()->get(Session::getLocalUser(), 'windowsphonepush', 'senditemtext');
|
||||||
$lastpushid = DI::pConfig()->get(Session::getLocalUser(), 'windowsphonepush', 'lastpushid');
|
$lastpushid = DI::pConfig()->get(Session::getLocalUser(), 'windowsphonepush', 'lastpushid');
|
||||||
$counterunseen = DI::pConfig()->get(Session::getLocalUser(), 'windowsphonepush', 'counterunseen');
|
$counterunseen = DI::pConfig()->get(Session::getLocalUser(), 'windowsphonepush', 'counterunseen');
|
||||||
$addonversion = "2.0";
|
$addonversion = "2.0";
|
||||||
|
|
||||||
if (!$device_url) {
|
if (!$device_url) {
|
||||||
$device_url = "";
|
$device_url = "";
|
||||||
|
|
Loading…
Reference in a new issue