]> git.mxchange.org Git - friendica.git/blob - include/features.php
Merge pull request #2099 from rabuzarus/2611_new_user_addr
[friendica.git] / include / features.php
1 <?php
2
3 /**
4  * @file include/features.php * 
5  * @brief Features management
6  */
7
8 /**
9  * @brief check if feature is enabled
10  * 
11  * return boolean
12  */
13 function feature_enabled($uid,$feature) {
14         //return true;
15
16         $x = get_pconfig($uid,'feature',$feature);
17         if($x === false) {
18                 $x = get_config('feature',$feature);
19                 if($x === false)
20                         $x = get_feature_default($feature);
21         }
22         $arr = array('uid' => $uid, 'feature' => $feature, 'enabled' => $x);
23         call_hooks('feature_enabled',$arr);
24         return($arr['enabled']);
25 }
26
27 /**
28  * @brief check if feature is enabled or disabled by default
29  * 
30  * @param string $feature
31  * @return boolean
32  */
33 function get_feature_default($feature) {
34         $f = get_features();
35         foreach($f as $cat) {
36                 foreach($cat as $feat) {
37                         if(is_array($feat) && $feat[0] === $feature)
38                                 return $feat[3];
39                 }
40         }
41         return false;
42 }
43
44 /**
45  * @ brief get a list of all available features
46  * The array includes the setting group, the setting name,
47  * explainations for the setting and if it's enabled or disabled
48  * by default
49  * 
50  * @return array
51  */
52 function get_features() {
53
54         $arr = array(
55
56                 // General
57                 'general' => array(
58                         t('General Features'),
59                         //array('expire',         t('Content Expiration'),              t('Remove old posts/comments after a period of time')),
60                         array('multi_profiles', t('Multiple Profiles'),                 t('Ability to create multiple profiles'),false),
61                         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),
62                 ),
63
64                 // Post composition
65                 'composition' => array(
66                         t('Post Composition Features'),
67                         array('richtext',       t('Richtext Editor'),                   t('Enable richtext editor'),false),
68                         array('preview',        t('Post Preview'),                      t('Allow previewing posts and comments before publishing them'),false),
69                         array('aclautomention', t('Auto-mention Forums'),               t('Add/remove mention when a fourm page is selected/deselected in ACL window.'),false),
70                 ),
71
72                 // Network sidebar widgets
73                 'widgets' => array(
74                         t('Network Sidebar Widgets'),
75                         array('archives',       t('Search by Date'),                    t('Ability to select posts by date ranges'),false),
76                         array('forumlist_widget', t('List Forums'),                     t('Enable widget to display the forums your are connected with'),true),
77                         array('groups',         t('Group Filter'),                      t('Enable widget to display Network posts only from selected group'),false),
78                         array('networks',       t('Network Filter'),                    t('Enable widget to display Network posts only from selected network'),false),
79                         array('savedsearch',    t('Saved Searches'),                    t('Save search terms for re-use'),false),
80                 ),
81
82                 // Network tabs
83                 'net_tabs' => array(
84                         t('Network Tabs'),
85                         array('personal_tab',   t('Network Personal Tab'),              t('Enable tab to display only Network posts that you\'ve interacted on'),false),
86                         array('new_tab',        t('Network New Tab'),                   t('Enable tab to display only new Network posts (from the last 12 hours)'),false),
87                         array('link_tab',       t('Network Shared Links Tab'),          t('Enable tab to display only Network posts with links in them'),false),
88                 ),
89
90                 // Item tools
91                 'tools' => array(
92                         t('Post/Comment Tools'),
93                         array('multi_delete',   t('Multiple Deletion'),                 t('Select and delete multiple posts/comments at once'),false),
94                         array('edit_posts',     t('Edit Sent Posts'),                   t('Edit and correct posts and comments after sending'),false),
95                         array('commtag',        t('Tagging'),                           t('Ability to tag existing posts'),false),
96                         array('categories',     t('Post Categories'),                   t('Add categories to your posts'),false),
97                         array('filing',         t('Saved Folders'),                     t('Ability to file posts under folders'),false),
98                         array('dislike',        t('Dislike Posts'),                     t('Ability to dislike posts/comments')),
99                         array('star_posts',     t('Star Posts'),                        t('Ability to mark special posts with a star indicator'),false),
100                         array('ignore_posts',   t('Mute Post Notifications'),           t('Ability to mute notifications for a thread'),false),
101                 ),
102
103                 // Advanced Profile Settings
104                 'advanced_profile' => array(
105                         t('Advanced Profile Settings'),
106                         array('forumlist_profile', t('List Forums'),                    t('Show visitors public community forums at the Advanced Profile Page'),false),
107                 ),
108         );
109
110         call_hooks('get_features',$arr);
111         return $arr;
112 }