]> git.mxchange.org Git - friendica-addons.git/blob - audon/audon.php
audon/audon.php aktualisiert
[friendica-addons.git] / audon / audon.php
1 <?php
2 /*
3  * Name: Audon Application
4  * Description: add a Audon instance. Based on webRTC Addon
5  * Version: 0.1
6  * Author: Stephen Mahood <https://friends.mayfirst.org/profile/marxistvegan>
7  * Author: Tobias Diekershoff <https://f.diekershoff.de/profile/tobias>
8  * Author: Matthias Ebers <https://loma.ml/profile/feb>
9  */
10
11 use Friendica\Core\Hook;
12 use Friendica\Core\Renderer;
13 use Friendica\DI;
14
15 function audon_install()
16 {
17         Hook::register('app_menu', __FILE__, 'audon_app_menu');
18 }
19
20 function audon_app_menu(array &$b)
21 {
22         $b['app_menu'][] = '<div class="app-title"><a href="audon">' . DI::l10n()->t('Audon Audiochat') . '</a></div>';
23 }
24
25 function audon_addon_admin(string &$o)
26 {
27         $t = Renderer::getMarkupTemplate('admin.tpl', 'addon/audon/');
28         $o = Renderer::replaceMacros($t, [
29                 '$submit'   => DI::l10n()->t('Save Settings'), 
30                 '$audonurl' => [
31                         'audonurl', 
32                         DI::l10n()->t('Audon Base URL'), 
33                         DI::config()->get('audon','audonurl'), 
34                         DI::l10n()->t('Page your users will create an Audon audio chat room on. For example you could use https://audon.space.'), 
35                 ], 
36         ]);
37 }
38
39 function audon_addon_admin_post()
40 {
41         DI::config()->set('audon', 'audonurl', trim($_POST['audonurl'] ?? ''));
42 }
43
44 /**
45  * This is a statement rather than an actual function definition. The simple
46  * existence of this method is checked to figure out if the addon offers a
47  * module.
48  */
49 function audon_module() {}
50
51 function audon_content(): string
52 {
53         $o = '';
54
55         /* landingpage to create chatrooms */
56         $audonurl = DI::config()->get('audon', 'audonurl');
57
58
59         /* embedd the landing page in an iframe */
60         $o .= '<h2>' . DI::l10n()->t('Audio Chat') . '</h2>';
61         $o .= '<p>' . DI::l10n()->t('Audon is an audio conferencing tool. Connect your account to Audon and create a room. Share the generated link to talk to other participants.') . '</p>';
62         if ($audonurl == '') {
63                 $o .= '<p>' . DI::l10n()->t('Please contact your Friendica administrator to remind them to configure the Audon addon.') . '</p>';
64         } else {
65                 $o .= '<iframe src="' . $audonurl . '" width="740px" height="600px"></iframe>';
66         }
67
68         return $o;
69 }