mirror of
https://git.friendi.ca/friendica/friendica-addons.git
synced 2025-07-09 18:08:49 +00:00
8374: Addressing review comments
This commit is contained in:
parent
58030804cb
commit
c12e1256e4
4 changed files with 66 additions and 56 deletions
|
@ -15,21 +15,13 @@ use Friendica\Core\Renderer;
|
|||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
|
||||
function showmore_dyn_install() {
|
||||
Hook::register('page_end', 'addon/showmore_dyn.php/showmore_dyn.php', 'showmore_dyn_script');
|
||||
Hook::register('head' , __FILE__, 'showmore_dyn_head');
|
||||
Hook::register('footer', __FILE__, 'showmore_dyn_footer');
|
||||
Hook::register('addon_settings', 'addon/showmore_dyn/showmore_dyn.php', 'showmore_dyn_settings');
|
||||
Hook::register('addon_settings_post', 'addon/showmore_dyn/showmore_dyn.php', 'showmore_dyn_settings_post');
|
||||
}
|
||||
|
||||
function showmore_dyn_uninstall()
|
||||
function showmore_dyn_install()
|
||||
{
|
||||
Hook::unregister('page_end', 'addon/jappixmini/jappixmini.php', 'jappixmini_script');
|
||||
Hook::unregister('head' , __FILE__, 'showmore_dyn_head');
|
||||
Hook::unregister('footer', __FILE__, 'showmore_dyn_footer');
|
||||
Hook::unregister('addon_settings', 'addon/showmore_dyn/showmore_dyn.php', 'showmore_dyn_settings');
|
||||
Hook::unregister('addon_settings_post', 'addon/showmore_dyn/showmore_dyn.php', 'showmore_dyn_settings_post');
|
||||
Hook::register('page_end', __FILE__, 'showmore_dyn_script');
|
||||
Hook::register('head', __FILE__, 'showmore_dyn_head');
|
||||
Hook::register('footer', __FILE__, 'showmore_dyn_footer');
|
||||
Hook::register('addon_settings', __FILE__, 'showmore_dyn_settings');
|
||||
Hook::register('addon_settings_post', __FILE__, 'showmore_dyn_settings_post');
|
||||
}
|
||||
|
||||
function showmore_dyn_head(App $a, &$b)
|
||||
|
@ -42,35 +34,47 @@ function showmore_dyn_footer(App $a, &$b)
|
|||
DI::page()->registerFooterScript(__DIR__ . '/showmore_dyn.js');
|
||||
}
|
||||
|
||||
function showmore_dyn_settings_post(){
|
||||
if(! local_user())
|
||||
return;
|
||||
if (isset($_POST['showmore_dyn-submit'])){
|
||||
function showmore_dyn_settings_post()
|
||||
{
|
||||
if(!local_user()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (isset($_POST['showmore_dyn-submit'])) {
|
||||
$limitHeight = $_POST['showmore_dyn_height'];
|
||||
DI::pConfig()->set(local_user(), 'showmore_dyn', 'limitHeight', $limitHeight);
|
||||
}
|
||||
if ($limitHeight && is_numeric($limitHeight)) {
|
||||
DI::pConfig()->set(local_user(), 'showmore_dyn', 'limitHeight', $limitHeight);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function showmore_dyn_settings(&$a,&$o) {
|
||||
if(! local_user())
|
||||
return;
|
||||
function showmore_dyn_settings(&$a, &$o)
|
||||
{
|
||||
if(!local_user()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$limitHeight = DI::pConfig()->get(local_user(), 'showmore_dyn', 'limitHeight', 250);
|
||||
DI::pConfig()->set(local_user(), 'showmore_dyn', 'limitHeight', $limitHeight);
|
||||
|
||||
$limitHeight = DI::pConfig()->get(local_user(), 'showmore_dyn', 'limitHeight' );
|
||||
if ($limitHeight=='') { $limitHeight = 250; DI::pConfig()->set(local_user(), 'showmore_dyn', 'limitHeight', $limitHeight); }
|
||||
|
||||
$t = Renderer::getMarkupTemplate("settings.tpl", "addon/showmore_dyn/");
|
||||
$o .= Renderer::replaceMacros($t, [
|
||||
'$submit' => DI::l10n()->t('Save Settings'),
|
||||
'$title' => "Showmore Dynamic",
|
||||
'$label' => DI::l10n()->t('Limit Height'),
|
||||
'$limitHeight' => $limitHeight,
|
||||
]);
|
||||
$t = Renderer::getMarkupTemplate('settings.tpl', 'addon/showmore_dyn/');
|
||||
$o .= Renderer::replaceMacros($t, [
|
||||
'$submit' => DI::l10n()->t('Save Settings'),
|
||||
'$title' => 'Showmore Dynamic',
|
||||
'$label' => DI::l10n()->t('Limit Height'),
|
||||
'$limitHeight' => $limitHeight,
|
||||
]);
|
||||
|
||||
}
|
||||
|
||||
function showmore_dyn_script() {
|
||||
$limitHeight = DI::pConfig()->get(local_user(), 'showmore_dyn', 'limitHeight' );
|
||||
function showmore_dyn_script()
|
||||
{
|
||||
$limitHeight = DI::pConfig()->get(local_user(), 'showmore_dyn', 'limitHeight', 250);
|
||||
$showmore_dyn_showmore_linktext = DI::l10n()->t('Show more ...');
|
||||
DI::page()['htmlhead'] .= '<script>var postLimitHeight = ' . intval($limitHeight) . '; var showmore_dyn_showmore_linktext = "' . $showmore_dyn_showmore_linktext . '"</script>';
|
||||
DI::page()['htmlhead'] .= <<<EOT
|
||||
<script>
|
||||
var postLimitHeight = $limitHeight;
|
||||
var showmore_dyn_showmore_linktext = "$showmore_dyn_showmore_linktext";
|
||||
</script>
|
||||
EOT;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue