mirror of
https://git.friendi.ca/friendica/friendica-addons.git
synced 2024-11-25 00:03:45 +00:00
Replaced argv/argc with replacement functions
This commit is contained in:
parent
42454b3cf7
commit
f878d2e463
9 changed files with 25 additions and 25 deletions
|
@ -181,7 +181,7 @@ function advancedcontentfilter_module() {}
|
|||
|
||||
function advancedcontentfilter_init(App $a)
|
||||
{
|
||||
if ($a->argc > 1 && $a->argv[1] == 'api') {
|
||||
if (DI::args()->getArgc() > 1 && DI::args()->getArgv()[1] == 'api') {
|
||||
$slim = new \Slim\App();
|
||||
|
||||
require __DIR__ . '/src/middlewares.php';
|
||||
|
@ -196,10 +196,10 @@ function advancedcontentfilter_init(App $a)
|
|||
function advancedcontentfilter_content(App $a)
|
||||
{
|
||||
if (!local_user()) {
|
||||
return Login::form('/' . implode('/', $a->argv));
|
||||
return Login::form('/' . implode('/', DI::args()->getArgv()));
|
||||
}
|
||||
|
||||
if ($a->argc > 1 && $a->argv[1] == 'help') {
|
||||
if (DI::args()->getArgc() > 1 && DI::args()->getArgv()[1] == 'help') {
|
||||
$lang = $a->user['language'];
|
||||
|
||||
$default_dir = 'addon/advancedcontentfilter/doc/';
|
||||
|
|
|
@ -43,14 +43,14 @@ function buffer_content(App $a)
|
|||
require_once "mod/settings.php";
|
||||
settings_init($a);
|
||||
|
||||
if (isset($a->argv[1])) {
|
||||
switch ($a->argv[1]) {
|
||||
if (isset(DI::args()->getArgv()[1])) {
|
||||
switch (DI::args()->getArgv()[1]) {
|
||||
case "connect":
|
||||
$o = buffer_connect($a);
|
||||
break;
|
||||
|
||||
default:
|
||||
$o = print_r($a->argv, true);
|
||||
$o = print_r(DI::args()->getArgv(), true);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -142,12 +142,12 @@ function catavatar_module() {}
|
|||
*/
|
||||
function catavatar_content(App $a)
|
||||
{
|
||||
if ($a->argc < 2 || $a->argc > 3) {
|
||||
if (DI::args()->getArgc() < 2 || DI::args()->getArgc() > 3) {
|
||||
throw new NotFoundException(); // this should be catched on index and show default "not found" page.
|
||||
}
|
||||
|
||||
if (is_numeric($a->argv[1])) {
|
||||
$uid = intval($a->argv[1]);
|
||||
if (is_numeric(DI::args()->getArgv()[1])) {
|
||||
$uid = intval(DI::args()->getArgv()[1]);
|
||||
$condition = ['uid' => $uid,
|
||||
'account_expired' => false, 'account_removed' => false];
|
||||
$user = DBA::selectFirst('user', ['email'], $condition);
|
||||
|
@ -157,15 +157,15 @@ function catavatar_content(App $a)
|
|||
}
|
||||
|
||||
$seed = DI::pConfig()->get($uid, "catavatar", "seed", md5(trim(strtolower($user['email']))));
|
||||
} elseif (!empty($a->argv[1])) {
|
||||
$seed = $a->argv[1];
|
||||
} elseif (!empty(DI::args()->getArgv()[1])) {
|
||||
$seed = DI::args()->getArgv()[1];
|
||||
} else {
|
||||
throw new NotFoundException();
|
||||
}
|
||||
|
||||
$size = 0;
|
||||
if ($a->argc == 3) {
|
||||
$size = intval($a->argv[2]);
|
||||
if (DI::args()->getArgc() == 3) {
|
||||
$size = intval(DI::args()->getArgv()[2]);
|
||||
}
|
||||
|
||||
// ...Or start generation
|
||||
|
|
|
@ -111,7 +111,7 @@ function forumdirectory_content(App $a)
|
|||
);
|
||||
|
||||
if (DBA::isResult($r)) {
|
||||
if (in_array('small', $a->argv)) {
|
||||
if (in_array('small', DI::args()->getArgv())) {
|
||||
$photo = 'thumb';
|
||||
} else {
|
||||
$photo = 'photo';
|
||||
|
|
|
@ -88,11 +88,11 @@ function ifttt_settings_post()
|
|||
|
||||
function ifttt_post(App $a)
|
||||
{
|
||||
if ($a->argc != 2) {
|
||||
if (DI::args()->getArgc() != 2) {
|
||||
return;
|
||||
}
|
||||
|
||||
$nickname = $a->argv[1];
|
||||
$nickname = DI::args()->getArgv()[1];
|
||||
|
||||
$user = DBA::selectFirst('user', ['uid'], ['nickname' => $nickname]);
|
||||
if (!DBA::isResult($user)) {
|
||||
|
|
|
@ -58,13 +58,13 @@ function pumpio_content(App $a)
|
|||
require_once("mod/settings.php");
|
||||
settings_init($a);
|
||||
|
||||
if (isset($a->argv[1])) {
|
||||
switch ($a->argv[1]) {
|
||||
if (isset(DI::args()->getArgv()[1])) {
|
||||
switch (DI::args()->getArgv()[1]) {
|
||||
case "connect":
|
||||
$o = pumpio_connect($a);
|
||||
break;
|
||||
default:
|
||||
$o = print_r($a->argv, true);
|
||||
$o = print_r(DI::args()->getArgv(), true);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -41,8 +41,8 @@ function tumblr_content(App $a)
|
|||
return '';
|
||||
}
|
||||
|
||||
if (isset($a->argv[1])) {
|
||||
switch ($a->argv[1]) {
|
||||
if (isset(DI::args()->getArgv()[1])) {
|
||||
switch (DI::args()->getArgv()[1]) {
|
||||
case "connect":
|
||||
$o = tumblr_connect($a);
|
||||
break;
|
||||
|
@ -52,7 +52,7 @@ function tumblr_content(App $a)
|
|||
break;
|
||||
|
||||
default:
|
||||
$o = print_r($a->argv, true);
|
||||
$o = print_r(DI::args()->getArgv(), true);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -317,8 +317,8 @@ function windowsphonepush_content(App $a)
|
|||
// Login with the specified Network credentials (like in api.php)
|
||||
windowsphonepush_login($a);
|
||||
|
||||
$path = $a->argv[0];
|
||||
$path2 = $a->argv[1];
|
||||
$path = DI::args()->getArgv()[0];
|
||||
$path2 = DI::args()->getArgv()[1];
|
||||
if ($path == "windowsphonepush") {
|
||||
switch ($path2) {
|
||||
case "show_settings":
|
||||
|
|
|
@ -170,7 +170,7 @@ function xmpp_converse(App $a)
|
|||
return;
|
||||
}
|
||||
|
||||
if (in_array($a->argv[0], ["delegation", "logout"])) {
|
||||
if (in_array(DI::args()->getArgv()[0], ["delegation", "logout"])) {
|
||||
$additional_commands = "converse.user.logout();\n";
|
||||
} else {
|
||||
$additional_commands = "";
|
||||
|
|
Loading…
Reference in a new issue