-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsettings.php
executable file
·100 lines (91 loc) · 5.36 KB
/
settings.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
<?php defined( 'ABSPATH' ) or die( 'Plugin file cannot be accessed directly.' );
if(!class_exists('Alloy_Essentials_Settings'))
{
class Alloy_Essentials_Settings
{
public function __construct()
{
add_action('admin_init', array(&$this, 'admin_init'));
add_action('admin_menu', array(&$this, 'add_menu'));
}
public function activate()
{
update_option('time_format', 'H:i');
update_option('date_format', 'd/m/Y');
update_option('timezone_string', 'Europe/Amsterdam');
//set default settings
if( get_option('sae_upload_size_limit') === false ) update_option('sae_upload_size_limit', 300);
if( get_option('alloy_analytics_id') === false ) update_option('alloy_analytics_id', '');
if( get_option('alloy_analytics_page_one') === false ) update_option('alloy_analytics_page_one', '');
if( get_option('alloy_analytics_page_two') === false ) update_option('alloy_analytics_page_two', '');
if( get_option('alloy_analytics_page_three') === false ) update_option('alloy_analytics_page_three', '');
if( get_option('alloy_analytics_page_four') === false ) update_option('alloy_analytics_page_four', '');
if( get_option('sae_clean_admin') === false ) update_option('sae_clean_admin', 1);
if( get_option('sae_clean_admin_header_comments') === false ) update_option('sae_clean_admin_header_comments', 1);
if( get_option('sae_clean_admin_header_new_content') === false ) update_option('sae_clean_admin_header_new_content', 1);
if( get_option('sae_hide_all_comment_stuff') === false ) update_option('sae_hide_all_comment_stuff', 1);
if( get_option('sae_clean_up_dashboard') === false ) update_option('sae_clean_up_dashboard', 1);
// if( get_option('sae_hide_posts') === false ) update_option('sae_hide_posts', 1);
if( get_option('sae_hide_links') === false ) update_option('sae_hide_links', 1);
if( get_option('sae_hide_tools') === false ) update_option('sae_hide_tools', 1);
// if( get_option('sae_hide_post_format') === false ) update_option('sae_hide_post_format', 1);
// if( get_option('sae_hide_post_categories') === false ) update_option('sae_hide_post_categories', 0);
// if( get_option('sae_hide_post_tags') === false ) update_option('sae_hide_post_tags', 1);
// if( get_option('sae_hide_post_featured_image') === false ) update_option('sae_hide_post_featured_image', 0);
// if( get_option('sae_jaap_fix_need_jquery') === false ) update_option('sae_jaap_fix_need_jquery', 0);
// if( get_option('sae_jaap_fix_javascript_test') === false ) update_option('sae_jaap_fix_javascript_test', '');
// if( get_option('sae_jaap_fix_javascript') === false ) update_option('sae_jaap_fix_javascript', '');
}
public function admin_init()
{
// register your plugin's settings
// upload size limit
register_setting( 'sae-plugin-settings-group', 'sae_upload_size_limit' );
// Analtyics ID
register_setting( 'sae-plugin-settings-group', 'alloy_analytics_id' );
register_setting( 'sae-plugin-settings-group', 'alloy_analytics_page_one' );
register_setting( 'sae-plugin-settings-group', 'alloy_analytics_page_two' );
register_setting( 'sae-plugin-settings-group', 'alloy_analytics_page_three' );
register_setting( 'sae-plugin-settings-group', 'alloy_analytics_page_four' );
// admin
register_setting( 'sae-plugin-settings-group', 'sae_clean_admin' );
// admin header
register_setting( 'sae-plugin-settings-group', 'sae_clean_admin_header_comments' );
register_setting( 'sae-plugin-settings-group', 'sae_clean_admin_header_new_content' );
// comments
register_setting( 'sae-plugin-settings-group', 'sae_hide_all_comment_stuff' );
// admin dashboard
register_setting( 'sae-plugin-settings-group', 'sae_clean_up_dashboard' );
// admin menu
register_setting( 'sae-plugin-settings-group', 'sae_hide_posts' );
register_setting( 'sae-plugin-settings-group', 'sae_hide_links' );
register_setting( 'sae-plugin-settings-group', 'sae_hide_tools' );
// post options
register_setting( 'sae-plugin-settings-group', 'sae_hide_post_format' );
register_setting( 'sae-plugin-settings-group', 'sae_hide_post_categories' );
register_setting( 'sae-plugin-settings-group', 'sae_hide_post_tags' );
register_setting( 'sae-plugin-settings-group', 'sae_hide_post_featured_image' );
// Jaap Fixes
// register_setting( 'sae-plugin-jaap-settings-group', 'sae_jaap_fix_need_jquery' );
// register_setting( 'sae-plugin-jaap-settings-group', 'sae_jaap_fix_javascript_test' );
// register_setting( 'sae-plugin-jaap-settings-group', 'sae_jaap_fix_javascript' );
}
public function add_menu()
{
// $alert = get_option('sae_jaap_fix_javascript_test') != '' && get_option('sae_jaap_fix_javascript_test') != NULL ? '<span class="settings_alert small"></span>' : '';
add_options_page(
'Studio Alloy essentials Settings',
'Alloy Essentials ',
'manage_options',
'Alloy_Essentials',
array(&$this, 'plugin_settings_page')
);
}
public function plugin_settings_page() {
if(!current_user_can('manage_options')) {
wp_die(__('You do not have sufficient permissions to access this page.'));
}
include(sprintf("%s/templates/settings.php", dirname(__FILE__)));
}
}
}