4 * @file include/features.php
5 * @brief Features management
8 use Friendica\Core\Config;
9 use Friendica\Core\PConfig;
12 * @brief check if feature is enabled
16 function feature_enabled($uid, $feature) {
17 $x = Config::get('feature_lock', $feature, false);
20 $x = get_feature_default($feature);
21 $x = Config::get('feature', $feature, $x);
22 $x = PConfig::get($uid, 'feature', $feature, $x);
25 $arr = array('uid' => $uid, 'feature' => $feature, 'enabled' => $x);
26 call_hooks('feature_enabled',$arr);
27 return($arr['enabled']);
31 * @brief check if feature is enabled or disabled by default
33 * @param string $feature
36 function get_feature_default($feature) {
38 foreach ($f as $cat) {
39 foreach ($cat as $feat) {
40 if (is_array($feat) && $feat[0] === $feature)
48 * @brief Get a list of all available features
50 * The array includes the setting group, the setting name,
51 * explainations for the setting and if it's enabled or disabled
54 * @param bool $filtered True removes any locked features
58 function get_features($filtered = true) {
64 t('General Features'),
65 //array('expire', t('Content Expiration'), t('Remove old posts/comments after a period of time')),
66 array('multi_profiles', t('Multiple Profiles'), t('Ability to create multiple profiles'), false, Config::get('feature_lock','multi_profiles', false)),
67 array('photo_location', t('Photo Location'), t('Photo metadata is normally stripped. This extracts the location (if present) prior to stripping metadata and links it to a map.'), false, Config::get('feature_lock','photo_location', false)),
68 array('export_calendar', t('Export Public Calendar'), t('Ability for visitors to download the public calendar'), false, Config::get('feature_lock','export_calendar', false)),
72 'composition' => array(
73 t('Post Composition Features'),
74 array('preview', t('Post Preview'), t('Allow previewing posts and comments before publishing them'), false, Config::get('feature_lock','preview', false)),
75 array('aclautomention', t('Auto-mention Forums'), t('Add/remove mention when a forum page is selected/deselected in ACL window.'), false, Config::get('feature_lock','aclautomention', false)),
78 // Network sidebar widgets
80 t('Network Sidebar Widgets'),
81 array('archives', t('Search by Date'), t('Ability to select posts by date ranges'), false, Config::get('feature_lock','archives', false)),
82 array('forumlist_widget', t('List Forums'), t('Enable widget to display the forums your are connected with'), true, Config::get('feature_lock','forumlist_widget', false)),
83 array('groups', t('Group Filter'), t('Enable widget to display Network posts only from selected group'), false, Config::get('feature_lock','groups', false)),
84 array('networks', t('Network Filter'), t('Enable widget to display Network posts only from selected network'), false, Config::get('feature_lock','networks', false)),
85 array('savedsearch', t('Saved Searches'), t('Save search terms for re-use'), false, Config::get('feature_lock','savedsearch', false)),
91 array('personal_tab', t('Network Personal Tab'), t('Enable tab to display only Network posts that you\'ve interacted on'), false, Config::get('feature_lock','personal_tab', false)),
92 array('new_tab', t('Network New Tab'), t('Enable tab to display only new Network posts (from the last 12 hours)'), false, Config::get('feature_lock','new_tab', false)),
93 array('link_tab', t('Network Shared Links Tab'), t('Enable tab to display only Network posts with links in them'), false, Config::get('feature_lock','link_tab', false)),
98 t('Post/Comment Tools'),
99 array('multi_delete', t('Multiple Deletion'), t('Select and delete multiple posts/comments at once'), false, Config::get('feature_lock','multi_delete', false)),
100 array('edit_posts', t('Edit Sent Posts'), t('Edit and correct posts and comments after sending'), false, Config::get('feature_lock','edit_posts', false)),
101 array('commtag', t('Tagging'), t('Ability to tag existing posts'), false, Config::get('feature_lock','commtag', false)),
102 array('categories', t('Post Categories'), t('Add categories to your posts'), false, Config::get('feature_lock','categories', false)),
103 array('filing', t('Saved Folders'), t('Ability to file posts under folders'), false, Config::get('feature_lock','filing', false)),
104 array('dislike', t('Dislike Posts'), t('Ability to dislike posts/comments'), false, Config::get('feature_lock','dislike', false)),
105 array('star_posts', t('Star Posts'), t('Ability to mark special posts with a star indicator'), false, Config::get('feature_lock','star_posts', false)),
106 array('ignore_posts', t('Mute Post Notifications'), t('Ability to mute notifications for a thread'), false, Config::get('feature_lock','ignore_posts', false)),
109 // Advanced Profile Settings
110 'advanced_profile' => array(
111 t('Advanced Profile Settings'),
112 array('forumlist_profile', t('List Forums'), t('Show visitors public community forums at the Advanced Profile Page'), false, Config::get('feature_lock','forumlist_profile', false)),
116 // removed any locked features and remove the entire category if this makes it empty
119 foreach ($arr as $k => $x) {
121 $kquantity = count($arr[$k]);
122 for ($y = 0; $y < $kquantity; $y ++) {
123 if (is_array($arr[$k][$y])) {
124 if ($arr[$k][$y][4] === false) {
137 call_hooks('get_features',$arr);