mirror of
https://git.friendi.ca/friendica/friendica-addons.git
synced 2024-11-23 13:03:47 +00:00
Changes:
- if a <addon>_module() function is empty, it is more a statement and not a real function
This commit is contained in:
parent
e895b55f6d
commit
3ab46781b1
21 changed files with 259 additions and 198 deletions
|
@ -180,6 +180,11 @@ function advancedcontentfilter_addon_settings(App $a, array &$data)
|
|||
* Module
|
||||
*/
|
||||
|
||||
/**
|
||||
* 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 advancedcontentfilter_module() {}
|
||||
|
||||
function advancedcontentfilter_init(App $a)
|
||||
|
|
|
@ -136,9 +136,12 @@ function birdavatar_lookup(App $a, array &$b)
|
|||
$b['success'] = true;
|
||||
}
|
||||
|
||||
function birdavatar_module()
|
||||
{
|
||||
}
|
||||
/**
|
||||
* 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 birdavatar_module() {}
|
||||
|
||||
/**
|
||||
* Returns image for user id
|
||||
|
|
|
@ -186,9 +186,12 @@ function blockem_item_photo_menu(App $a, array &$b)
|
|||
}
|
||||
}
|
||||
|
||||
function blockem_module()
|
||||
{
|
||||
}
|
||||
/**
|
||||
* 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 blockem_module() {}
|
||||
|
||||
function blockem_init(App $a)
|
||||
{
|
||||
|
|
|
@ -19,10 +19,12 @@ function calc_app_menu(App $a, array &$b)
|
|||
$b['app_menu'][] = '<div class="app-title"><a href="calc">Calculator</a></div>';
|
||||
}
|
||||
|
||||
|
||||
function calc_module()
|
||||
{
|
||||
}
|
||||
/**
|
||||
* 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 calc_module() {}
|
||||
|
||||
function calc_init(App $a)
|
||||
{
|
||||
|
|
|
@ -137,6 +137,11 @@ function catavatar_lookup(App $a, array &$b)
|
|||
$b['success'] = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 catavatar_module() {}
|
||||
|
||||
/**
|
||||
|
|
|
@ -21,41 +21,47 @@ function convert_app_menu(App $a, array &$b)
|
|||
|
||||
function convert_module() {}
|
||||
|
||||
function convert_content($app) {
|
||||
|
||||
function convert_content(App $a) {
|
||||
// @TODO UnitConverter uses a deprecated constructor with the class' name
|
||||
// @TODO Let's one day rewrite this to a modern composer package
|
||||
include 'UnitConvertor.php';
|
||||
|
||||
class TP_Converter extends UnitConvertor {
|
||||
function TP_Converter($lang = 'en')
|
||||
class TP_Converter extends UnitConvertor
|
||||
{
|
||||
if ($lang != 'en' ) {
|
||||
$dec_point = '.'; $thousand_sep = "'";
|
||||
public function __construct(string $lang = 'en')
|
||||
{
|
||||
if ($lang == 'en' ) {
|
||||
$dec_point = '.';
|
||||
$thousand_sep = ',';
|
||||
} else {
|
||||
$dec_point = '.'; $thousand_sep = ',';
|
||||
$dec_point = '.';
|
||||
$thousand_sep = "'";
|
||||
}
|
||||
|
||||
$this->UnitConvertor($dec_point , $thousand_sep );
|
||||
parent::UnitConvertor($dec_point, $thousand_sep );
|
||||
}
|
||||
|
||||
} // end func UnitConvertor
|
||||
|
||||
function find_base_unit($from,$to) {
|
||||
private function findBaseUnit($from, $to)
|
||||
{
|
||||
while (list($skey, $sval) = each($this->bases)) {
|
||||
if ($skey == $from || $to == $skey || in_array($to, $sval) || in_array($from, $sval)) {
|
||||
return $skey;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function getTable($value, $from_unit, $to_unit, $precision) {
|
||||
|
||||
if ($base_unit = $this->find_base_unit($from_unit,$to_unit)) {
|
||||
public function getTable($value, $from_unit, $to_unit, $precision): string
|
||||
{
|
||||
$string = '';
|
||||
|
||||
if ($base_unit = $this->findBaseUnit($from_unit, $to_unit)) {
|
||||
// A baseunit was found now lets convert from -> $base_unit
|
||||
|
||||
$cell ['value'] = $this->convert($value, $from_unit, $base_unit, $precision) . ' ' . $base_unit;
|
||||
$cell ['class'] = ($base_unit == $from_unit || $base_unit == $to_unit) ? 'framedred' : '';
|
||||
$cells[] = $cell;
|
||||
|
||||
// We now have the base unit and value now lets produce the table;
|
||||
while (list($key, $val) = each($this->bases[$base_unit])) {
|
||||
$cell ['value'] = $this->convert($value, $from_unit, $val, $precision) . ' ' . $val;
|
||||
|
@ -76,9 +82,9 @@ include 'UnitConvertor.php';
|
|||
}
|
||||
}
|
||||
$string .= "</tr></table>";
|
||||
return $string;
|
||||
}
|
||||
|
||||
return $string;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -170,7 +176,6 @@ $conversions = [
|
|||
]
|
||||
];
|
||||
|
||||
|
||||
while (list($key,$val) = each($conversions)) {
|
||||
$conv->addConversion($val['base'], $val['conv']);
|
||||
$list[$key][] = $val['base'];
|
||||
|
@ -181,7 +186,6 @@ while (list($key,$val) = each($conversions)) {
|
|||
|
||||
$o .= '<h3>Unit Conversions</h3>';
|
||||
|
||||
|
||||
if (isset($_POST['from_unit']) && isset($_POST['value'])) {
|
||||
$_POST['value'] = $_POST['value'] + 0;
|
||||
$o .= ($conv->getTable($_POST['value'], $_POST['from_unit'], $_POST['to_unit'], 5)) . '</p>';
|
||||
|
|
|
@ -25,10 +25,17 @@ function forumdirectory_install()
|
|||
Hook::register('app_menu', 'addon/forumdirectory/forumdirectory.php', 'forumdirectory_app_menu');
|
||||
}
|
||||
|
||||
function forumdirectory_module()
|
||||
{
|
||||
return;
|
||||
}
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
/**
|
||||
* 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 forumdirectory_module() {}
|
||||
|
||||
function forumdirectory_app_menu(App $a, array &$b)
|
||||
{
|
||||
|
|
|
@ -24,15 +24,14 @@ function ifttt_install()
|
|||
Hook::register('connector_settings_post', 'addon/ifttt/ifttt.php', 'ifttt_settings_post');
|
||||
}
|
||||
|
||||
function ifttt_module()
|
||||
{
|
||||
/**
|
||||
* 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 ifttt_module() {}
|
||||
|
||||
}
|
||||
|
||||
function ifttt_content()
|
||||
{
|
||||
|
||||
}
|
||||
function ifttt_content() {}
|
||||
|
||||
function ifttt_settings(App $a, array &$data)
|
||||
{
|
||||
|
|
|
@ -24,9 +24,12 @@ function impressum_install()
|
|||
Logger::notice("installed impressum Addon");
|
||||
}
|
||||
|
||||
function impressum_module()
|
||||
{
|
||||
}
|
||||
/**
|
||||
* 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 impressum_module() {}
|
||||
|
||||
function impressum_content()
|
||||
{
|
||||
|
|
|
@ -20,11 +20,12 @@ function infiniteimprobabilitydrive_app_menu(App $a, array &$b)
|
|||
$b['app_menu'][] = '<div class="app-title"><a href="infiniteimprobabilitydrive">' . DI::l10n()->t('Infinite Improbability Drive') . '</a></div>';
|
||||
}
|
||||
|
||||
|
||||
function infiniteimprobabilitydrive_module()
|
||||
{
|
||||
return;
|
||||
}
|
||||
/**
|
||||
* 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 infiniteimprobabilitydrive_module() {}
|
||||
|
||||
|
||||
function infiniteimprobabilitydrive_content(App $a)
|
||||
|
|
11
irc/irc.php
11
irc/irc.php
|
@ -64,11 +64,12 @@ function irc_app_menu(App $a, array &$b)
|
|||
$b['app_menu'][] = '<div class="app-title"><a href="irc">' . DI::l10n()->t('IRC Chatroom') . '</a></div>';
|
||||
}
|
||||
|
||||
|
||||
function irc_module() {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 irc_module() {}
|
||||
|
||||
function irc_content(App $a)
|
||||
{
|
||||
|
|
|
@ -58,11 +58,11 @@ function mailstream_check_version()
|
|||
}
|
||||
|
||||
/**
|
||||
* This function indicates a module that can be wrapped in the LegacyModule class
|
||||
* 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 mailstream_module()
|
||||
{
|
||||
}
|
||||
function mailstream_module() {}
|
||||
|
||||
/**
|
||||
* Adds an item in "addon features" in the admin menu of the site
|
||||
|
@ -70,7 +70,7 @@ function mailstream_module()
|
|||
* @param App $a App object (unused)
|
||||
* @param string $o HTML form data
|
||||
*/
|
||||
function mailstream_addon_admin(App $a, &$o)
|
||||
function mailstream_addon_admin(App $a, string &$o)
|
||||
{
|
||||
$frommail = DI::config()->get('mailstream', 'frommail');
|
||||
$template = Renderer::getMarkupTemplate('admin.tpl', 'addon/mailstream/');
|
||||
|
|
|
@ -23,9 +23,12 @@ function namethingy_app_menu(App $a, array &$b)
|
|||
}
|
||||
|
||||
|
||||
function namethingy_module()
|
||||
{
|
||||
}
|
||||
/**
|
||||
* 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 namethingy_module() {}
|
||||
|
||||
function namethingy_content(App $a)
|
||||
{
|
||||
|
|
|
@ -15,6 +15,11 @@ use Friendica\Core\Logger;
|
|||
use Friendica\Core\Renderer;
|
||||
use Friendica\DI;
|
||||
|
||||
/**
|
||||
* 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 notifyall_module() {}
|
||||
|
||||
function notifyall_addon_admin(App $a, &$o)
|
||||
|
|
|
@ -50,6 +50,11 @@ function pumpio_install()
|
|||
Hook::register('check_item_notification', 'addon/pumpio/pumpio.php', 'pumpio_check_item_notification');
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 pumpio_module() {}
|
||||
|
||||
function pumpio_content(App $a)
|
||||
|
|
|
@ -130,9 +130,13 @@ function superblock_item_photo_menu(App $a, array &$b)
|
|||
$b['menu'][DI::l10n()->t('Block Completely')] = 'javascript:superblockBlock(\'' . $author . '\'); return false;';
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 superblock_module() {}
|
||||
|
||||
|
||||
function superblock_init(App $a)
|
||||
{
|
||||
if (!local_user()) {
|
||||
|
|
|
@ -20,10 +20,12 @@ function tictac_app_menu(App $a, array &$b)
|
|||
$b['app_menu'][] = '<div class="app-title"><a href="tictac">' . DI::l10n()->t('Three Dimensional Tic-Tac-Toe') . '</a></div>';
|
||||
}
|
||||
|
||||
function tictac_module()
|
||||
{
|
||||
return;
|
||||
}
|
||||
/**
|
||||
* 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 tictac_module() {}
|
||||
|
||||
function tictac_content(App $a) {
|
||||
|
||||
|
|
|
@ -29,9 +29,12 @@ function tumblr_install()
|
|||
Hook::register('connector_settings_post', 'addon/tumblr/tumblr.php', 'tumblr_settings_post');
|
||||
}
|
||||
|
||||
function tumblr_module()
|
||||
{
|
||||
}
|
||||
/**
|
||||
* 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 tumblr_module() {}
|
||||
|
||||
function tumblr_content(App $a)
|
||||
{
|
||||
|
|
|
@ -1740,7 +1740,7 @@ function twitter_media_entities($post, array &$postarray, int $uriId = -1)
|
|||
* @param integer $uriId URI Id used to store tags. 0 = create a new one; -1 = don't store tags for this post.
|
||||
* @return array item array
|
||||
*/
|
||||
function twitter_createpost(App $a, int $uid, $post, array $self, $create_user, bool $only_existing_contact, $noquote, int $uriId = 0): array
|
||||
function twitter_createpost(App $a, int $uid, $post, array $self, $create_user, bool $only_existing_contact, bool $noquote, int $uriId = 0): array
|
||||
{
|
||||
$postarray = [];
|
||||
$postarray['network'] = Protocol::TWITTER;
|
||||
|
|
|
@ -29,15 +29,19 @@ function webrtc_addon_admin (App $a, &$o)
|
|||
'$webrtcurl' => ['webrtcurl', DI::l10n()->t('WebRTC Base URL'), DI::config()->get('webrtc','webrtcurl' ), DI::l10n()->t('Page your users will create a WebRTC chat room on. For example you could use https://live.mayfirst.org .')],
|
||||
]);
|
||||
}
|
||||
|
||||
function webrtc_addon_admin_post (App $a)
|
||||
{
|
||||
$url = trim($_POST['webrtcurl'] ?? '');
|
||||
DI::config()->set('webrtc', 'webrtcurl', $url);
|
||||
}
|
||||
|
||||
function webrtc_module() {
|
||||
return;
|
||||
}
|
||||
/**
|
||||
* 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 webrtc_module() {}
|
||||
|
||||
function webrtc_content(App $a)
|
||||
{
|
||||
|
|
|
@ -60,10 +60,12 @@ function windowsphonepush_install()
|
|||
}
|
||||
|
||||
/* declare the windowsphonepush function so that /windowsphonepush url requests will land here */
|
||||
function windowsphonepush_module()
|
||||
{
|
||||
|
||||
}
|
||||
/**
|
||||
* 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 windowsphonepush_module() {}
|
||||
|
||||
/* Callback from the settings post function.
|
||||
* $post contains the $_POST array.
|
||||
|
|
Loading…
Reference in a new issue