2018-04-10 04:44:04 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Zotlabs\Widget;
|
|
|
|
|
2021-12-02 22:33:36 +00:00
|
|
|
use App;
|
|
|
|
|
2021-12-02 23:02:31 +00:00
|
|
|
class Catcloud
|
|
|
|
{
|
2018-04-10 04:44:04 +00:00
|
|
|
|
2021-12-02 23:02:31 +00:00
|
|
|
public function widget($arr)
|
|
|
|
{
|
2018-04-10 04:44:04 +00:00
|
|
|
|
2021-12-02 23:02:31 +00:00
|
|
|
if ((!App::$profile['profile_uid']) || (!App::$profile['channel_hash']))
|
|
|
|
return '';
|
2018-04-10 04:44:04 +00:00
|
|
|
|
2021-12-02 23:02:31 +00:00
|
|
|
$limit = ((array_key_exists('limit', $arr)) ? intval($arr['limit']) : 50);
|
2018-04-10 04:44:04 +00:00
|
|
|
|
2021-12-02 23:02:31 +00:00
|
|
|
if (array_key_exists('type', $arr)) {
|
|
|
|
switch ($arr['type']) {
|
2018-04-10 04:44:04 +00:00
|
|
|
|
2021-12-02 23:02:31 +00:00
|
|
|
case 'cards':
|
2018-04-10 04:44:04 +00:00
|
|
|
|
2021-12-02 23:02:31 +00:00
|
|
|
if (!perm_is_allowed(App::$profile['profile_uid'], get_observer_hash(), 'view_pages'))
|
|
|
|
return '';
|
2018-04-10 04:44:04 +00:00
|
|
|
|
2021-12-02 23:02:31 +00:00
|
|
|
return card_catblock(App::$profile['profile_uid'], $limit, '', App::$profile['channel_hash']);
|
2018-04-10 04:44:04 +00:00
|
|
|
|
2021-12-02 23:02:31 +00:00
|
|
|
case 'articles':
|
2018-04-10 04:44:04 +00:00
|
|
|
|
2021-12-02 23:02:31 +00:00
|
|
|
if (!perm_is_allowed(App::$profile['profile_uid'], get_observer_hash(), 'view_articles'))
|
|
|
|
return '';
|
2018-04-10 04:44:04 +00:00
|
|
|
|
2021-12-02 23:02:31 +00:00
|
|
|
return article_catblock(App::$profile['profile_uid'], $limit, '', App::$profile['channel_hash']);
|
2018-04-10 04:44:04 +00:00
|
|
|
|
|
|
|
|
2021-12-02 23:02:31 +00:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2018-04-10 04:44:04 +00:00
|
|
|
|
|
|
|
|
2021-12-02 23:02:31 +00:00
|
|
|
if (!perm_is_allowed(App::$profile['profile_uid'], get_observer_hash(), 'view_stream'))
|
|
|
|
return '';
|
2018-04-10 04:44:04 +00:00
|
|
|
|
2021-12-02 23:02:31 +00:00
|
|
|
return catblock(App::$profile['profile_uid'], $limit, '', App::$profile['channel_hash']);
|
2018-04-10 04:44:04 +00:00
|
|
|
|
2021-12-02 23:02:31 +00:00
|
|
|
|
|
|
|
}
|
2018-04-10 04:44:04 +00:00
|
|
|
|
|
|
|
}
|