4 * @file include/features.php
5 * @brief Features management
9 * @brief check if feature is enabled
13 function feature_enabled($uid,$feature) {
15 $x = get_config('feature_lock',$feature);
17 $x = get_pconfig($uid,'feature',$feature);
19 $x = get_config('feature',$feature);
21 $x = get_feature_default($feature);
24 $arr = array('uid' => $uid, 'feature' => $feature, 'enabled' => $x);
25 call_hooks('feature_enabled',$arr);
26 return($arr['enabled']);
30 * @brief check if feature is enabled or disabled by default
32 * @param string $feature
35 function get_feature_default($feature) {
38 foreach($cat as $feat) {
39 if(is_array($feat) && $feat[0] === $feature)
47 * @brief Get a list of all available features
49 * The array includes the setting group, the setting name,
50 * explainations for the setting and if it's enabled or disabled
53 * @param bool $filtered True removes any locked features
57 function get_features($filtered = true) {
63 t('General Features'),
64 //array('expire', t('Content Expiration'), t('Remove old posts/comments after a period of time')),
65 array('multi_profiles', t('Multiple Profiles'), t('Ability to create multiple profiles'), false, get_config('feature_lock','multi_profiles')),
66 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, get_config('feature_lock','photo_location')),
67 array('export_calendar', t('Export Public Calendar'), t('Ability for visitors to download the public calendar'), false, get_config('feature_lock','export_calendar')),
71 'composition' => array(
72 t('Post Composition Features'),
73 array('richtext', t('Richtext Editor'), t('Enable richtext editor'), false, get_config('feature_lock','richtext')),
74 array('preview', t('Post Preview'), t('Allow previewing posts and comments before publishing them'), false, get_config('feature_lock','preview')),
75 array('aclautomention', t('Auto-mention Forums'), t('Add/remove mention when a fourm page is selected/deselected in ACL window.'), false, get_config('feature_lock','aclautomention')),
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, get_config('feature_lock','archives')),
82 array('forumlist_widget', t('List Forums'), t('Enable widget to display the forums your are connected with'), true, get_config('feature_lock','forumlist_widget')),
83 array('groups', t('Group Filter'), t('Enable widget to display Network posts only from selected group'), false, get_config('feature_lock','groups')),
84 array('networks', t('Network Filter'), t('Enable widget to display Network posts only from selected network'), false, get_config('feature_lock','networks')),
85 array('savedsearch', t('Saved Searches'), t('Save search terms for re-use'), false, get_config('feature_lock','savedsearch')),
91 array('personal_tab', t('Network Personal Tab'), t('Enable tab to display only Network posts that you\'ve interacted on'), false, get_config('feature_lock','personal_tab')),
92 array('new_tab', t('Network New Tab'), t('Enable tab to display only new Network posts (from the last 12 hours)'), false, get_config('feature_lock','new_tab')),
93 array('link_tab', t('Network Shared Links Tab'), t('Enable tab to display only Network posts with links in them'), false, get_config('feature_lock','link_tab')),
98 t('Post/Comment Tools'),
99 array('multi_delete', t('Multiple Deletion'), t('Select and delete multiple posts/comments at once'), false, get_config('feature_lock','multi_delete')),
100 array('edit_posts', t('Edit Sent Posts'), t('Edit and correct posts and comments after sending'), false, get_config('feature_lock','edit_posts')),
101 array('commtag', t('Tagging'), t('Ability to tag existing posts'), false, get_config('feature_lock','commtag')),
102 array('categories', t('Post Categories'), t('Add categories to your posts'), false, get_config('feature_lock','categories')),
103 array('filing', t('Saved Folders'), t('Ability to file posts under folders'), false, get_config('feature_lock','filing')),
104 array('dislike', t('Dislike Posts'), t('Ability to dislike posts/comments'), false, get_config('feature_lock','dislike')),
105 array('star_posts', t('Star Posts'), t('Ability to mark special posts with a star indicator'), false, get_config('feature_lock','star_posts')),
106 array('ignore_posts', t('Mute Post Notifications'), t('Ability to mute notifications for a thread'), false, get_config('feature_lock','ignore_posts')),
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, get_config('feature_lock','forumlist_profile')),
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) {
138 call_hooks('get_features',$arr);