diff options
-rw-r--r-- | Zotlabs/Module/Settings/Connections.php | 23 | ||||
-rw-r--r-- | Zotlabs/Module/Settings/Editor.php | 81 | ||||
-rw-r--r-- | Zotlabs/Module/Settings/Manage.php | 25 | ||||
-rw-r--r-- | Zotlabs/Module/Settings/Network.php | 81 | ||||
-rw-r--r-- | Zotlabs/Module/Settings/Profiles.php | 42 | ||||
-rw-r--r-- | include/features.php | 284 |
6 files changed, 160 insertions, 376 deletions
diff --git a/Zotlabs/Module/Settings/Connections.php b/Zotlabs/Module/Settings/Connections.php index 425409502..f3638862b 100644 --- a/Zotlabs/Module/Settings/Connections.php +++ b/Zotlabs/Module/Settings/Connections.php @@ -8,9 +8,9 @@ class Connections { function post() { check_form_security_token_redirectOnErr('/settings/connections', 'settings_connections'); - $features = self::get_features(); + $features = get_module_features('connections'); - process_features_post(local_channel(), $features, $_POST); + process_module_features_post(local_channel(), $features, $_POST); build_sync_packet(); return; @@ -18,7 +18,7 @@ class Connections { function get() { - $features = self::get_features(); + $features = get_module_features('connections'); $rpath = (($_GET['rpath']) ? $_GET['rpath'] : ''); $tpl = get_markup_template("settings_module.tpl"); @@ -28,26 +28,11 @@ class Connections { '$action_url' => 'settings/connections', '$form_security_token' => get_form_security_token("settings_connections"), '$title' => t('Connections Settings'), - '$features' => process_features_get(local_channel(), $features), + '$features' => process_module_features_get(local_channel(), $features), '$submit' => t('Submit') )); return $o; } - function get_features() { - $arr = [ - [ - 'connfilter', - t('Connection Filtering'), - t('Filter incoming posts from connections based on keywords/content'), - false, - get_config('feature_lock','connfilter') - ] - ]; - - return $arr; - - } - } diff --git a/Zotlabs/Module/Settings/Editor.php b/Zotlabs/Module/Settings/Editor.php index 92775f154..514417e49 100644 --- a/Zotlabs/Module/Settings/Editor.php +++ b/Zotlabs/Module/Settings/Editor.php @@ -8,9 +8,9 @@ class Editor { function post() { check_form_security_token_redirectOnErr('/settings/editor', 'settings_editor'); - $features = self::get_features(); + $features = get_module_features('editor'); - process_features_post(local_channel(), $features, $_POST); + process_module_features_post(local_channel(), $features, $_POST); build_sync_packet(); return; @@ -18,7 +18,7 @@ class Editor { function get() { - $features = self::get_features(); + $features = get_module_features('editor'); $rpath = (($_GET['rpath']) ? $_GET['rpath'] : ''); $tpl = get_markup_template("settings_module.tpl"); @@ -28,84 +28,11 @@ class Editor { '$action_url' => 'settings/editor', '$form_security_token' => get_form_security_token("settings_editor"), '$title' => t('Editor Settings'), - '$features' => process_features_get(local_channel(), $features), + '$features' => process_module_features_get(local_channel(), $features), '$submit' => t('Submit') )); return $o; } - function get_features() { - $arr = [ - - [ - 'large_photos', - t('Large Photos'), - t('Include large (1024px) photo thumbnails in posts. If not enabled, use small (640px) photo thumbnails'), - false, - get_config('feature_lock','large_photos'), - ], - - [ - 'content_encrypt', - t('Even More Encryption'), - t('Allow optional encryption of content end-to-end with a shared secret key'), - false, - get_config('feature_lock','content_encrypt'), - ], - - [ - 'consensus_tools', - t('Enable Voting Tools'), - t('Provide a class of post which others can vote on'), - false, - get_config('feature_lock','consensus_tools'), - ], - - [ - 'disable_comments', - t('Disable Comments'), - t('Provide the option to disable comments for a post'), - false, - get_config('feature_lock','disable_comments'), - ], - - [ - 'delayed_posting', - t('Delayed Posting'), - t('Allow posts to be published at a later date'), - false, - get_config('feature_lock','delayed_posting'), - ], - - [ - 'content_expire', - t('Content Expiration'), - t('Remove posts/comments and/or private messages at a future time'), - false, - get_config('feature_lock','content_expire'), - ], - - [ - 'suppress_duplicates', - t('Suppress Duplicate Posts/Comments'), - t('Prevent posts with identical content to be published with less than two minutes in between submissions.'), - true, - get_config('feature_lock','suppress_duplicates'), - ], - - [ - 'auto_save_draft', - t('Auto-save drafts of posts and comments'), - t('Automatically saves post and comment drafts in local browser storage to help prevent accidental loss of compositions'), - true, - get_config('feature_lock','auto_save_draft'), - ] - - ]; - - return $arr; - - } - } diff --git a/Zotlabs/Module/Settings/Manage.php b/Zotlabs/Module/Settings/Manage.php index e13017d6b..841e58be3 100644 --- a/Zotlabs/Module/Settings/Manage.php +++ b/Zotlabs/Module/Settings/Manage.php @@ -8,9 +8,9 @@ class Manage { function post() { check_form_security_token_redirectOnErr('/settings/manage', 'settings_manage'); - $features = self::get_features(); + $features = get_module_features('manage'); - process_features_post(local_channel(), $features, $_POST); + process_module_features_post(local_channel(), $features, $_POST); build_sync_packet(); return; @@ -18,7 +18,7 @@ class Manage { function get() { - $features = self::get_features(); + $features = get_module_features('manage'); $rpath = (($_GET['rpath']) ? $_GET['rpath'] : ''); $tpl = get_markup_template("settings_module.tpl"); @@ -28,28 +28,11 @@ class Manage { '$action_url' => 'settings/manage', '$form_security_token' => get_form_security_token("settings_manage"), '$title' => t('Channel Manager Settings'), - '$features' => process_features_get(local_channel(), $features), + '$features' => process__module_features_get(local_channel(), $features), '$submit' => t('Submit') )); return $o; } - function get_features() { - $arr = [ - - [ - 'nav_channel_select', - t('Navigation Channel Select'), - t('Change channels directly from within the navigation dropdown menu'), - false, - get_config('feature_lock','nav_channel_select'), - ] - - ]; - - return $arr; - - } - } diff --git a/Zotlabs/Module/Settings/Network.php b/Zotlabs/Module/Settings/Network.php index a2e606565..bc0ba7143 100644 --- a/Zotlabs/Module/Settings/Network.php +++ b/Zotlabs/Module/Settings/Network.php @@ -8,9 +8,9 @@ class Network { function post() { check_form_security_token_redirectOnErr('/settings/network', 'settings_network'); - $features = self::get_features(); + $features = get_module_features('network'); - process_features_post(local_channel(), $features, $_POST); + process_module_features_post(local_channel(), $features, $_POST); build_sync_packet(); return; @@ -18,7 +18,7 @@ class Network { function get() { - $features = self::get_features(); + $features = get_module_features('network'); $rpath = (($_GET['rpath']) ? $_GET['rpath'] : ''); $tpl = get_markup_template("settings_module.tpl"); @@ -28,84 +28,11 @@ class Network { '$action_url' => 'settings/network', '$form_security_token' => get_form_security_token("settings_network"), '$title' => t('Activity Settings'), - '$features' => process_features_get(local_channel(), $features), + '$features' => process_module_features_get(local_channel(), $features), '$submit' => t('Submit') )); return $o; } - function get_features() { - $arr = [ - - [ - 'archives', - t('Search by Date'), - t('Ability to select posts by date ranges'), - false, - get_config('feature_lock','archives') - ], - - [ - 'savedsearch', - t('Saved Searches'), - t('Save search terms for re-use'), - false, - get_config('feature_lock','savedsearch') - ], - - [ - 'order_tab', - t('Alternate Stream Order'), - t('Ability to order the stream by last post date, last comment date or unthreaded activities'), - false, - get_config('feature_lock','order_tab') - ], - - [ - 'name_tab', - t('Contact Filter'), - t('Ability to display only posts of a selected contact'), - false, - get_config('feature_lock','name_tab') - ], - - [ - 'forums_tab', - t('Forum Filter'), - t('Ability to display only posts of a specific forum'), - false, - get_config('feature_lock','forums_tab') - ], - - [ - 'personal_tab', - t('Personal Posts Filter'), - t('Ability to display only posts that you\'ve interacted on'), - false, - get_config('feature_lock','personal_tab') - ], - - [ - 'affinity', - t('Affinity Tool'), - t('Filter stream activity by depth of relationships'), - false, - get_config('feature_lock','affinity') - ], - - [ - 'suggest', - t('Suggest Channels'), - t('Show friend and connection suggestions'), - false, - get_config('feature_lock','suggest') - ] - - ]; - - return $arr; - - } - } diff --git a/Zotlabs/Module/Settings/Profiles.php b/Zotlabs/Module/Settings/Profiles.php index 801bb7b10..a22a540da 100644 --- a/Zotlabs/Module/Settings/Profiles.php +++ b/Zotlabs/Module/Settings/Profiles.php @@ -8,9 +8,9 @@ class Profiles { function post() { check_form_security_token_redirectOnErr('/settings/profiles', 'settings_profiles'); - $features = self::get_features(); + $features = get_module_features('profiles'); - process_features_post(local_channel(), $features, $_POST); + process_module_features_post(local_channel(), $features, $_POST); build_sync_packet(); return; @@ -18,7 +18,7 @@ class Profiles { function get() { - $features = self::get_features(); + $features = get_module_features('profiles'); $rpath = (($_GET['rpath']) ? $_GET['rpath'] : ''); $tpl = get_markup_template("settings_module.tpl"); @@ -28,45 +28,11 @@ class Profiles { '$action_url' => 'settings/profiles', '$form_security_token' => get_form_security_token("settings_profiles"), '$title' => t('Profile Settings'), - '$features' => process_features_get(local_channel(), $features), + '$features' => process_module_features_get(local_channel(), $features), '$submit' => t('Submit') )); return $o; } - function get_features() { - $arr = [ - - [ - 'advanced_profiles', - t('Advanced Profiles'), - t('Additional profile sections and selections'), - false, - get_config('feature_lock','advanced_profiles'), - ], - - [ - 'profile_export', - t('Profile Import/Export'), - t('Save and load profile details across sites/channels'), - false, - get_config('feature_lock','profile_export'), - ], - - [ - 'multi_profiles', - t('Multiple Profiles'), - t('Ability to create multiple profiles'), - false, - get_config('feature_lock','multi_profiles'), - ] - - - ]; - - return $arr; - - } - } diff --git a/include/features.php b/include/features.php index 460d2cb38..6f6aa88dc 100644 --- a/include/features.php +++ b/include/features.php @@ -44,14 +44,16 @@ function feature_level($feature,$def) { return $def; } -function process_features_get($uid, $features) { +function process_module_features_get($uid, $features) { + unset($features[0]); foreach($features as $f) { $arr[] = array('feature_' . $f[0],$f[1],((intval(feature_enabled($uid, $f[0]))) ? "1" : ''),$f[2],array(t('Off'),t('On'))); } return $arr; } -function process_features_post($uid, $features, $post_arr) { +function process_module_features_post($uid, $features, $post_arr) { + unset($features[0]); foreach($features as $f) { $k = $f[0]; if(array_key_exists("feature_$k",$post_arr)) @@ -83,23 +85,6 @@ function get_features($filtered = true, $level = (-1)) { feature_level('start_menu',1), ], - [ - 'advanced_profiles', - t('Advanced Profiles'), - t('Additional profile sections and selections'), - false, - get_config('feature_lock','advanced_profiles'), - feature_level('advanced_profiles',1), - ], - - [ - 'profile_export', - t('Profile Import/Export'), - t('Save and load profile details across sites/channels'), - false, - get_config('feature_lock','profile_export'), - feature_level('profile_export',3), - ], /* [ 'hide_rating', @@ -120,15 +105,6 @@ function get_features($filtered = true, $level = (-1)) { ], [ - 'nav_channel_select', - t('Navigation Channel Select'), - t('Change channels directly from within the navigation dropdown menu'), - false, - get_config('feature_lock','nav_channel_select'), - feature_level('nav_channel_select',3), - ], - - [ 'photo_location', t('Photo Location'), t('If location data is available on uploaded photos, link this to a map.'), @@ -198,16 +174,6 @@ function get_features($filtered = true, $level = (-1)) { ], [ - 'multi_profiles', - t('Multiple Profiles'), - t('Ability to create multiple profiles'), - false, - get_config('feature_lock','multi_profiles'), - feature_level('multi_profiles',3), - ], - - - [ 'permcats', t('Permission Categories'), t('Create custom connection permission limits'), @@ -245,10 +211,95 @@ function get_features($filtered = true, $level = (-1)) { ], - // Post composition - 'composition' => [ - t('Post Composition Features'), + // Item tools + 'tools' => [ + + t('Post/Comment Tools'), + + [ + 'commtag', + t('Community Tagging'), + t('Ability to tag existing posts'), + false, + get_config('feature_lock','commtag'), + feature_level('commtag',1), + ], + + [ + 'categories', + t('Post Categories'), + t('Add categories to your posts'), + false, + get_config('feature_lock','categories'), + feature_level('categories',1), + ], + + [ + 'emojis', + t('Emoji Reactions'), + t('Add emoji reaction ability to posts'), + true, + get_config('feature_lock','emojis'), + feature_level('emojis',1), + ], + + [ + 'filing', + t('Saved Folders'), + t('Ability to file posts under folders'), + false, + get_config('feature_lock','filing'), + feature_level('filing',2), + ], + + [ + 'dislike', + t('Dislike Posts'), + t('Ability to dislike posts/comments'), + false, + get_config('feature_lock','dislike'), + feature_level('dislike',1), + ], + + [ + 'star_posts', + t('Star Posts'), + t('Ability to mark special posts with a star indicator'), + false, + get_config('feature_lock','star_posts'), + feature_level('star_posts',1), + ], + + [ + 'tagadelic', + t('Tag Cloud'), + t('Provide a personal tag cloud on your channel page'), + false, + get_config('feature_lock','tagadelic'), + feature_level('tagadelic',2), + ], + ], + +############################################ +############################################ + + 'connections' => [ + + t('Connections'), + + [ + 'connfilter', + t('Connection Filtering'), + t('Filter incoming posts from connections based on keywords/content'), + false, + get_config('feature_lock','connfilter') + ] + ], + + 'editor' => [ + + t('Editor'), [ 'large_photos', @@ -256,25 +307,14 @@ function get_features($filtered = true, $level = (-1)) { t('Include large (1024px) photo thumbnails in posts. If not enabled, use small (640px) photo thumbnails'), false, get_config('feature_lock','large_photos'), - feature_level('large_photos',1), ], [ - 'channel_sources', - t('Channel Sources'), - t('Automatically import channel content from other channels or feeds'), - false, - get_config('feature_lock','channel_sources'), - feature_level('channel_sources',3), - ], - - [ 'content_encrypt', t('Even More Encryption'), t('Allow optional encryption of content end-to-end with a shared secret key'), false, get_config('feature_lock','content_encrypt'), - feature_level('content_encrypt',3), ], [ @@ -283,7 +323,6 @@ function get_features($filtered = true, $level = (-1)) { t('Provide a class of post which others can vote on'), false, get_config('feature_lock','consensus_tools'), - feature_level('consensus_tools',3), ], [ @@ -292,7 +331,6 @@ function get_features($filtered = true, $level = (-1)) { t('Provide the option to disable comments for a post'), false, get_config('feature_lock','disable_comments'), - feature_level('disable_comments',2), ], [ @@ -301,7 +339,6 @@ function get_features($filtered = true, $level = (-1)) { t('Allow posts to be published at a later date'), false, get_config('feature_lock','delayed_posting'), - feature_level('delayed_posting',2), ], [ @@ -310,7 +347,6 @@ function get_features($filtered = true, $level = (-1)) { t('Remove posts/comments and/or private messages at a future time'), false, get_config('feature_lock','content_expire'), - feature_level('content_expire',1), ], [ @@ -319,7 +355,6 @@ function get_features($filtered = true, $level = (-1)) { t('Prevent posts with identical content to be published with less than two minutes in between submissions.'), true, get_config('feature_lock','suppress_duplicates'), - feature_level('suppress_duplicates',1), ], [ @@ -328,33 +363,42 @@ function get_features($filtered = true, $level = (-1)) { t('Automatically saves post and comment drafts in local browser storage to help prevent accidental loss of compositions'), true, get_config('feature_lock','auto_save_draft'), - feature_level('auto_save_draft',1), - ], + ] ], - // Network Tools - 'net_module' => [ + 'manage' => [ - t('Network and Stream Filtering'), + t('Channel Manager'), + + [ + 'nav_channel_select', + t('Navigation Channel Select'), + t('Change channels directly from within the navigation dropdown menu'), + true, + get_config('feature_lock','nav_channel_select'), + ] + + ], + + 'network' => [ + + t('Activity'), [ 'archives', t('Search by Date'), t('Ability to select posts by date ranges'), false, - get_config('feature_lock','archives'), - feature_level('archives',1), + get_config('feature_lock','archives') ], - [ 'savedsearch', t('Saved Searches'), t('Save search terms for re-use'), false, - get_config('feature_lock','savedsearch'), - feature_level('savedsearch',2), + get_config('feature_lock','savedsearch') ], [ @@ -362,8 +406,7 @@ function get_features($filtered = true, $level = (-1)) { t('Alternate Stream Order'), t('Ability to order the stream by last post date, last comment date or unthreaded activities'), false, - get_config('feature_lock','order_tab'), - feature_level('order_tab',2), + get_config('feature_lock','order_tab') ], [ @@ -371,8 +414,7 @@ function get_features($filtered = true, $level = (-1)) { t('Contact Filter'), t('Ability to display only posts of a selected contact'), false, - get_config('feature_lock','name_tab'), - feature_level('name_tab',1), + get_config('feature_lock','name_tab') ], [ @@ -380,8 +422,7 @@ function get_features($filtered = true, $level = (-1)) { t('Forum Filter'), t('Ability to display only posts of a specific forum'), false, - get_config('feature_lock','forums_tab'), - feature_level('forums_tab',1), + get_config('feature_lock','forums_tab') ], [ @@ -389,8 +430,7 @@ function get_features($filtered = true, $level = (-1)) { t('Personal Posts Filter'), t('Ability to display only posts that you\'ve interacted on'), false, - get_config('feature_lock','personal_tab'), - feature_level('personal_tab',1), + get_config('feature_lock','personal_tab') ], [ @@ -398,8 +438,7 @@ function get_features($filtered = true, $level = (-1)) { t('Affinity Tool'), t('Filter stream activity by depth of relationships'), false, - get_config('feature_lock','affinity'), - feature_level('affinity',1), + get_config('feature_lock','affinity') ], [ @@ -407,90 +446,42 @@ function get_features($filtered = true, $level = (-1)) { t('Suggest Channels'), t('Show friend and connection suggestions'), false, - get_config('feature_lock','suggest'), - feature_level('suggest',1), - ], - - [ - 'connfilter', - t('Connection Filtering'), - t('Filter incoming posts from connections based on keywords/content'), - false, - get_config('feature_lock','connfilter'), - feature_level('connfilter',3), - ], - + get_config('feature_lock','suggest') + ] ], - // Item tools - 'tools' => [ + 'profiles' => [ - t('Post/Comment Tools'), + t('Profiles'), [ - 'commtag', - t('Community Tagging'), - t('Ability to tag existing posts'), + 'advanced_profiles', + t('Advanced Profiles'), + t('Additional profile sections and selections'), false, - get_config('feature_lock','commtag'), - feature_level('commtag',1), + get_config('feature_lock','advanced_profiles') ], [ - 'categories', - t('Post Categories'), - t('Add categories to your posts'), + 'profile_export', + t('Profile Import/Export'), + t('Save and load profile details across sites/channels'), false, - get_config('feature_lock','categories'), - feature_level('categories',1), + get_config('feature_lock','profile_export') ], [ - 'emojis', - t('Emoji Reactions'), - t('Add emoji reaction ability to posts'), - true, - get_config('feature_lock','emojis'), - feature_level('emojis',1), - ], + 'multi_profiles', + t('Multiple Profiles'), + t('Ability to create multiple profiles'), + false, + get_config('feature_lock','multi_profiles') + ] - [ - 'filing', - t('Saved Folders'), - t('Ability to file posts under folders'), - false, - get_config('feature_lock','filing'), - feature_level('filing',2), - ], + ] - [ - 'dislike', - t('Dislike Posts'), - t('Ability to dislike posts/comments'), - false, - get_config('feature_lock','dislike'), - feature_level('dislike',1), - ], - [ - 'star_posts', - t('Star Posts'), - t('Ability to mark special posts with a star indicator'), - false, - get_config('feature_lock','star_posts'), - feature_level('star_posts',1), - ], - - [ - 'tagadelic', - t('Tag Cloud'), - t('Provide a personal tag cloud on your channel page'), - false, - get_config('feature_lock','tagadelic'), - feature_level('tagadelic',2), - ], - ], ]; $x = [ 'features' => $arr, ]; @@ -533,3 +524,8 @@ function get_features($filtered = true, $level = (-1)) { return $narr; } + +function get_module_features($module) { + $features = get_features(false); + return $features[$module]; +} |