2023-06-20 15:47:55 +00:00
< ? php
2023-06-20 15:26:03 +00:00
/*
2023-08-18 14:48:13 +00:00
* Name : Audon Application
2023-08-18 14:51:29 +00:00
* Description : add a Audon instance . Based on webRTC Addon
2023-06-20 15:26:03 +00:00
* Version : 0.1
* Author : Stephen Mahood < https :// friends . mayfirst . org / profile / marxistvegan >
* Author : Tobias Diekershoff < https :// f . diekershoff . de / profile / tobias >
* Author : Matthias Ebers < https :// loma . ml / profile / feb >
*/
use Friendica\Core\Hook ;
use Friendica\Core\Renderer ;
use Friendica\DI ;
function audon_install ()
{
Hook :: register ( 'app_menu' , __FILE__ , 'audon_app_menu' );
}
function audon_app_menu ( array & $b )
{
2023-08-18 14:48:13 +00:00
$b [ 'app_menu' ][] = '<div class="app-title"><a href="audon">' . DI :: l10n () -> t ( 'Audon Audiochat' ) . '</a></div>' ;
2023-06-20 15:26:03 +00:00
}
function audon_addon_admin ( string & $o )
{
$t = Renderer :: getMarkupTemplate ( 'admin.tpl' , 'addon/audon/' );
$o = Renderer :: replaceMacros ( $t , [
2023-08-18 14:17:47 +00:00
'$submit' => DI :: l10n () -> t ( 'Save Settings' ),
2023-06-20 15:26:03 +00:00
'$audonurl' => [
2023-08-18 14:17:47 +00:00
'audonurl' ,
2023-08-18 14:48:13 +00:00
DI :: l10n () -> t ( 'Audon Base URL' ),
2023-08-18 14:17:47 +00:00
DI :: config () -> get ( 'audon' , 'audonurl' ),
2023-08-18 14:48:13 +00:00
DI :: l10n () -> t ( 'Page your users will create an Audon audio chat room on. For example you could use https://audon.space.' ),
2023-08-18 14:17:47 +00:00
],
2023-06-20 15:26:03 +00:00
]);
}
function audon_addon_admin_post ()
{
DI :: config () -> set ( 'audon' , 'audonurl' , trim ( $_POST [ 'audonurl' ] ? ? '' ));
}
/**
* This is a statement rather than an actual function definition . The simple
* existence of this method is checked to figure out if the addon offers a
* module .
*/
function audon_module () {}
function audon_content () : string
{
$o = '' ;
/* landingpage to create chatrooms */
2023-08-18 14:48:13 +00:00
$audonurl = DI :: config () -> get ( 'audon' , 'audonurl' );
2023-06-20 15:26:03 +00:00
/* embedd the landing page in an iframe */
$o .= '<h2>' . DI :: l10n () -> t ( 'Audio Chat' ) . '</h2>' ;
$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>' ;
if ( $audonurl == '' ) {
2023-08-18 14:48:13 +00:00
$o .= '<p>' . DI :: l10n () -> t ( 'Please contact your Friendica administrator to remind them to configure the Audon addon.' ) . '</p>' ;
2023-06-20 15:26:03 +00:00
} else {
$o .= '<iframe src="' . $audonurl . '" width="740px" height="600px"></iframe>' ;
}
return $o ;
}