streams/Zotlabs/Widget/Catcloud.php

49 lines
1 KiB
PHP
Raw Normal View History

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