mirror of
https://git.friendi.ca/friendica/friendica-addons.git
synced 2025-07-09 18:08:49 +00:00
[various] Rename group to circle
- Drop support for group_text - Add support for circle_text
This commit is contained in:
parent
941b8c5a14
commit
aa0f74832a
45 changed files with 793 additions and 40 deletions
64
circle_text/group_text.php
Normal file
64
circle_text/group_text.php
Normal file
|
@ -0,0 +1,64 @@
|
|||
<?php
|
||||
/**
|
||||
* Name: Circle Text
|
||||
* Description: Disable images in circle edit menu
|
||||
* Version: 1.0
|
||||
* Author: Thomas Willingham <https://kakste.com/profile/beardyunixer>
|
||||
*/
|
||||
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\DI;
|
||||
|
||||
function circle_text_install()
|
||||
{
|
||||
Hook::register('addon_settings', __FILE__, 'circle_text_settings');
|
||||
Hook::register('addon_settings_post', __FILE__, 'circle_text_settings_post');
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Callback from the settings post function.
|
||||
* $post contains the $_POST array.
|
||||
* We will make sure we've got a valid user account
|
||||
* and if so set our configuration setting for this person.
|
||||
*
|
||||
*/
|
||||
|
||||
function circle_text_settings_post(array $post)
|
||||
{
|
||||
if (!DI::userSession()->getLocalUserId() || empty($post['circle_text-submit'])) {
|
||||
return;
|
||||
}
|
||||
|
||||
DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'system', 'circle_edit_image_limit', intval($post['circle_text']));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* Called from the Addon Setting form.
|
||||
* Add our own settings info to the page.
|
||||
*
|
||||
*/
|
||||
|
||||
function circle_text_settings(array &$data)
|
||||
{
|
||||
if (!DI::userSession()->getLocalUserId()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$enabled = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'system', 'circle_edit_image_limit') ??
|
||||
DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'system', 'groupedit_image_limit');
|
||||
|
||||
$t = Renderer::getMarkupTemplate('settings.tpl', 'addon/circle_text/');
|
||||
$html = Renderer::replaceMacros($t, [
|
||||
'$enabled' => ['circle_text', DI::l10n()->t('Use a text only (non-image) circle selector in the "circle edit" menu'), $enabled],
|
||||
]);
|
||||
|
||||
$data = [
|
||||
'addon' => 'circle_text',
|
||||
'title' => DI::l10n()->t('Circle Text'),
|
||||
'html' => $html,
|
||||
];
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue