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')),
70 'composition' => array(
71 t('Post Composition Features'),
72 array('richtext', t('Richtext Editor'), t('Enable richtext editor'), false, get_config('feature_lock','richtext')),
73 array('preview', t('Post Preview'), t('Allow previewing posts and comments before publishing them'), false, get_config('feature_lock','preview')),
74 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')),
77 // Network sidebar widgets
79 t('Network Sidebar Widgets'),
80 array('archives', t('Search by Date'), t('Ability to select posts by date ranges'), false, get_config('feature_lock','archives')),
81 array('forumlist_widget', t('List Forums'), t('Enable widget to display the forums your are connected with'), true, get_config('feature_lock','forumlist_widget')),
82 array('groups', t('Group Filter'), t('Enable widget to display Network posts only from selected group'), false, get_config('feature_lock','groups')),
83 array('networks', t('Network Filter'), t('Enable widget to display Network posts only from selected network'), false, get_config('feature_lock','networks')),
84 array('savedsearch', t('Saved Searches'), t('Save search terms for re-use'), false, get_config('feature_lock','savedsearch')),
90 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')),
91 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')),
92 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')),
97 t('Post/Comment Tools'),
98 array('multi_delete', t('Multiple Deletion'), t('Select and delete multiple posts/comments at once'), false, get_config('feature_lock','multi_delete')),
99 array('edit_posts', t('Edit Sent Posts'), t('Edit and correct posts and comments after sending'), false, get_config('feature_lock','edit_posts')),
100 array('commtag', t('Tagging'), t('Ability to tag existing posts'), false, get_config('feature_lock','commtag')),
101 array('categories', t('Post Categories'), t('Add categories to your posts'), false, get_config('feature_lock','categories')),
102 array('filing', t('Saved Folders'), t('Ability to file posts under folders'), false, get_config('feature_lock','filing')),
103 array('dislike', t('Dislike Posts'), t('Ability to dislike posts/comments'), false, get_config('feature_lock','dislike')),
104 array('star_posts', t('Star Posts'), t('Ability to mark special posts with a star indicator'), false, get_config('feature_lock','star_posts')),
105 array('ignore_posts', t('Mute Post Notifications'), t('Ability to mute notifications for a thread'), false, get_config('feature_lock','ignore_posts')),
108 // Advanced Profile Settings
109 'advanced_profile' => array(
110 t('Advanced Profile Settings'),
111 array('forumlist_profile', t('List Forums'), t('Show visitors public community forums at the Advanced Profile Page'), false, get_config('feature_lock','forumlist_profile')),
115 // removed any locked features and remove the entire category if this makes it empty
118 foreach($arr as $k => $x) {
120 $kquantity = count($arr[$k]);
121 for($y = 0; $y < $kquantity; $y ++) {
122 if(is_array($arr[$k][$y])) {
123 if($arr[$k][$y][4] === false) {
137 call_hooks('get_features',$arr);