]> git.mxchange.org Git - friendica-addons.git/commitdiff
Replaced argv/argc with replacement functions
authorMichael <heluecht@pirati.ca>
Sun, 25 Jul 2021 12:29:43 +0000 (12:29 +0000)
committerMichael <heluecht@pirati.ca>
Sun, 25 Jul 2021 12:29:43 +0000 (12:29 +0000)
advancedcontentfilter/advancedcontentfilter.php
buffer/buffer.php
catavatar/catavatar.php
forumdirectory/forumdirectory.php
ifttt/ifttt.php
pumpio/pumpio.php
tumblr/tumblr.php
windowsphonepush/windowsphonepush.php
xmpp/xmpp.php

index 636e0fce2c02fa0b0e8ce227cedf6fbadcdd7d82..d7af3eee22052cca9fc46f9b32f86a4ce9915753 100644 (file)
@@ -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/';
index be8e749569870220bdfdee5e473342a61b2a43fd..deaccfd07eef23778d6256a1b2ab74a1fbaa2b97 100644 (file)
@@ -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 {
index 6ba214991cb52ea07d9287778802b2b6b7f3d1fb..144148e7eef6342a29765889717c920ef60f029a 100644 (file)
@@ -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
index 530239fd276e6ab66b95f53c8d341b6bbebaf146..bf15ab62c80d8c2b152bd6aad3b92665379843ec 100644 (file)
@@ -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';
index a0cc1ae806af1ad818d948cf263c867f338d8fc3..67ffdd8587bf5fd716ec357b6c3ca8c5d79f9650 100644 (file)
@@ -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)) {
index be2c5587b50e4fc1a291c39205234b6600cd9a91..a74aa4fa083bc7804a6b48469dc2336248b95bea 100644 (file)
@@ -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 {
index 4be767f9ee1296cd2205daeb30db2cb3a11e55b1..83c0419f367d6999edbfc9d66fb0ac65df426a4b 100644 (file)
@@ -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 {
index 12bc5c9940b8d1f8f2da72e2f1bac366018d7606..c5ff6965e5bdb880fd3bed71da57d6c73c43a560 100644 (file)
@@ -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":
index 81adec8486b0848f74b7a3fa208c998e6d55ddcc..392dbe0e983ab46e8baefd6cbfe2786e3c5938f1 100644 (file)
@@ -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 = "";