X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=altpager%2Faltpager.php;h=78bab432b3a96defe6bdfa135482f72d3676e39a;hb=b6a72006542bd47f802ddf989176be701ad77595;hp=65f9c0d835e1ccc90be2ca1b2598bdc83dc22c24;hpb=c460ff6348fc2f3944f8eb4e7af1d74cba06c236;p=friendica-addons.git diff --git a/altpager/altpager.php b/altpager/altpager.php index 65f9c0d8..78bab432 100755 --- a/altpager/altpager.php +++ b/altpager/altpager.php @@ -4,8 +4,7 @@ * Description: Change pagination from using explicit page numbers to simple "newer" and "older" page links. This will speed up page load times. * Version: 1.0 * Author: Mike Macgirvin - * - * + * Status: Unsupported */ @@ -61,6 +60,10 @@ function altpager_settings(&$a,&$s) { if(! local_user()) return; + $global = get_config("alt_pager", "global"); + if($global == 1) + return; + /* Add our stylesheet to the page so we can make our settings look nice */ $a->page['htmlhead'] .= '' . "\r\n"; @@ -84,6 +87,22 @@ function altpager_settings(&$a,&$s) { /* provide a submit button */ - $s .= '
'; + $s .= '
'; + +} + +function altpager_plugin_admin(&$a, &$o){ + $t = get_markup_template( "admin.tpl", "addon/altpager/" ); + $o = replace_macros($t, array( + '$submit' => t('Save Settings'), + '$global' => array('altpagerchoice', t('Global'), 1, t('Force global use of the alternate pager'), get_config('alt_pager', 'global') == 1), + '$individual' => array('altpagerchoice', t('Individual'), 2, t('Each user chooses whether to use the alternate pager'), get_config('alt_pager', 'global') == 0) + )); +} +function altpager_plugin_admin_post(&$a){ + $choice = ((x($_POST,'altpagerchoice')) ? notags(trim($_POST['altpagerchoice'])) : ''); + set_config('alt_pager','global',($choice == 1 ? 1 : 0)); + info( t('Settings updated.'). EOL ); } +