diff options
author | Mario <mario@mariovavti.com> | 2022-05-24 09:31:30 +0000 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2022-05-24 09:31:30 +0000 |
commit | 3058cbfbb242dbe12a131cc212cc15a46f1f29dc (patch) | |
tree | a2739c0988205dc2c6ed229d778811503aa2d890 /Zotlabs/Widget/Categories.php | |
parent | ae780c977b868c2b3588c8699dde959e542fe3b8 (diff) | |
download | volse-hubzilla-3058cbfbb242dbe12a131cc212cc15a46f1f29dc.tar.gz volse-hubzilla-3058cbfbb242dbe12a131cc212cc15a46f1f29dc.tar.bz2 volse-hubzilla-3058cbfbb242dbe12a131cc212cc15a46f1f29dc.zip |
categories widgets cleanup
Diffstat (limited to 'Zotlabs/Widget/Categories.php')
-rw-r--r-- | Zotlabs/Widget/Categories.php | 32 |
1 files changed, 9 insertions, 23 deletions
diff --git a/Zotlabs/Widget/Categories.php b/Zotlabs/Widget/Categories.php index 0c6996d55..0a1c80061 100644 --- a/Zotlabs/Widget/Categories.php +++ b/Zotlabs/Widget/Categories.php @@ -17,36 +17,22 @@ class Categories { function widget($arr) { - $cards = ((array_key_exists('cards',$arr) && $arr['cards']) ? true : false); - - if(($cards) && (! Apps::system_app_installed(App::$profile['profile_uid'], 'Cards'))) - return ''; - - $articles = ((array_key_exists('articles',$arr) && $arr['articles']) ? true : false); - - if(($articles) && (! Apps::system_app_installed(App::$profile['profile_uid'],'Articles'))) - return ''; - $files = ((array_key_exists('files',$arr) && $arr['files']) ? true : false); - if((! App::$profile['profile_uid']) - || (! perm_is_allowed(App::$profile['profile_uid'],get_observer_hash(),(($cards || $articles) ? 'view_pages' : 'view_stream')))) { + if(!App::$profile['profile_uid'] || !perm_is_allowed(App::$profile['profile_uid'], get_observer_hash(), 'view_stream')) { return ''; } - $cat = ((x($_REQUEST,'cat')) ? htmlspecialchars($_REQUEST['cat'],ENT_COMPAT,'UTF-8') : ''); - $srchurl = (($cards) ? App::$argv[0] . '/' . App::$argv[1] : App::$query_string); - $srchurl = rtrim(preg_replace('/cat\=[^\&].*?(\&|$)/is','',$srchurl),'&'); - $srchurl = str_replace(array('?f=','&f=', '/?'),array('', '', ''),$srchurl); + $cat = ((x($_REQUEST, 'cat')) ? htmlspecialchars($_REQUEST['cat'], ENT_COMPAT, 'UTF-8') : ''); + $srchurl = App::$query_string; + $srchurl = rtrim(preg_replace('/cat\=[^\&].*?(\&|$)/is', '', $srchurl), '&'); + $srchurl = str_replace(['?f=','&f=', '/?'], ['', '', ''], $srchurl); - if($cards) - return cardcategories_widget($srchurl, $cat); - elseif($articles) - return articlecategories_widget($srchurl, $cat); - elseif($files) + if($files) { return filecategories_widget($srchurl, $cat); - else - return categories_widget($srchurl, $cat); + } + + return categories_widget($srchurl, $cat); } } |