aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Widget/Categories.php
blob: 84deb03d6291ac848dce930411bbccb66fba3320 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?php

namespace Zotlabs\Widget;

require_once('include/contact_widgets.php');

class Categories {

	function widget($arr) {

		$cards = ((array_key_exists('cards',$arr) && $arr['cards']) ? true : false);

		if(($cards) && (! feature_enabled(\App::$profile['profile_uid'],'cards')))
			return '';

		if((! \App::$profile['profile_uid']) 
			|| (! perm_is_allowed(\App::$profile['profile_uid'],get_observer_hash(),(($cards) ? 'view_pages' : 'view_stream')))) {
			return '';
		}

		$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(array('?f=','&f='),array('',''),$srchurl);

		if($cards)
			return cardcategories_widget($srchurl, $cat);
		else
			return categories_widget($srchurl, $cat);

	}
}