PluginProbe
Code Snippets / 2.12.0
Code Snippets v2.12.0
3.10.2 3.10.1 3.10.0 3.10.0-beta.2 3.10.0-beta.1 4.0.0-beta.1 3.9.6 trunk 2.10.0 2.10.1 2.12.0 2.12.1 2.13.0 2.13.1 2.13.2 2.13.3 2.14.0 2.14.1 2.14.2 2.14.3 2.14.4 2.14.5 2.14.6 3.0.0 3.0.1 All 64 releases
code-snippets / php / settings / settings-fields.php

settings-fields.php in Code Snippets 2.12.0, at php/settings/settings-fields.php

189 lines 5.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * Retrieve the default setting values
5 * @return array
6 */
7 function code_snippets_get_default_settings() {
8 static $defaults;
9
10 if ( isset( $defaults ) ) {
11 return $defaults;
12 }
13
14 $defaults = array();
15
16 foreach ( code_snippets_get_settings_fields() as $section_id => $fields ) {
17 $defaults[ $section_id ] = array();
18
19 foreach ( $fields as $field_id => $field_atts ) {
20 $defaults[ $section_id ][ $field_id ] = $field_atts['default'];
21 }
22 }
23
24 return $defaults;
25 }
26
27 /**
28 * Retrieve the settings fields
29 * @return array
30 */
31 function code_snippets_get_settings_fields() {
32 static $fields;
33
34 if ( isset( $fields ) ) {
35 return $fields;
36 }
37
38 $fields = array();
39
40 $fields['general'] = array(
41 'activate_by_default' => array(
42 'name' => __( 'Activate by Default', 'code-snippets' ),
43 'type' => 'checkbox',
44 'label' => __( "Make the 'Save and Activate' button the default action when saving a snippet.", 'code-snippets' ),
45 'default' => true,
46 ),
47
48 'snippet_scope_enabled' => array(
49 'name' => __( 'Enable Scope Selector', 'code-snippets' ),
50 'type' => 'checkbox',
51 'label' => __( 'Enable the scope selector when editing a snippet', 'code-snippets' ),
52 'default' => true,
53 ),
54
55 'enable_tags' => array(
56 'name' => __( 'Enable Snippet Tags', 'code-snippets' ),
57 'type' => 'checkbox',
58 'label' => __( 'Show snippet tags on admin pages', 'code-snippets' ),
59 'default' => true,
60 ),
61
62 'enable_description' => array(
63 'name' => __( 'Enable Snippet Descriptions', 'code-snippets' ),
64 'type' => 'checkbox',
65 'label' => __( 'Show snippet descriptions on admin pages', 'code-snippets' ),
66 'default' => true,
67 ),
68
69 'disable_prism' => array(
70 'name' => __( 'Disable Shortcode Syntax Highlighter', 'code-snippets' ),
71 'type' => 'checkbox',
72 'label' => __( 'Disable the syntax highlighting for the [code_snippet] shortcode on the front-end', 'code-snippets' ),
73 'default' => false,
74 ),
75
76 'complete_uninstall' => array(
77 'name' => __( 'Complete Uninstall', 'code-snippets' ),
78 'type' => 'checkbox',
79 'label' => sprintf(
80 __( 'When the plugin is deleted from the <a href="%s">Plugins</a> menu, also delete all snippets and plugin settings.', 'code-snippets' ),
81 self_admin_url( 'plugins.php' )
82 ),
83 'default' => false,
84 ),
85 );
86
87 if ( is_multisite() && ! is_main_site() ) {
88 unset( $fields['general']['complete_uninstall'] );
89 }
90
91 /* Description Editor settings section */
92 $fields['description_editor'] = array(
93
94 'rows' => array(
95 'name' => __( 'Row Height', 'code-snippets' ),
96 'type' => 'number',
97 'label' => __( 'rows', 'code-snippets' ),
98 'default' => 5,
99 'min' => 0,
100 ),
101
102 'use_full_mce' => array(
103 'name' => __( 'Use Full Editor', 'code-snippets' ),
104 'type' => 'checkbox',
105 'label' => __( 'Enable all features of the visual editor', 'code-snippets' ),
106 'default' => false,
107 ),
108
109 'media_buttons' => array(
110 'name' => __( 'Media Buttons', 'code-snippets' ),
111 'type' => 'checkbox',
112 'label' => __( 'Enable the add media buttons', 'code-snippets' ),
113 'default' => false,
114 ),
115 );
116
117 /* Code Editor settings section */
118
119 $fields['editor'] = array(
120 'theme' => array(
121 'name' => __( 'Theme', 'code-snippets' ),
122 'type' => 'codemirror_theme_select',
123 'default' => 'default',
124 'codemirror' => 'theme',
125 ),
126
127 'indent_with_tabs' => array(
128 'name' => __( 'Indent With Tabs', 'code-snippets' ),
129 'type' => 'checkbox',
130 'label' => __( 'Use hard tabs (not spaces) for indentation.', 'code-snippets' ),
131 'default' => true,
132 'codemirror' => 'indentWithTabs',
133 ),
134
135 'tab_size' => array(
136 'name' => __( 'Tab Size', 'code-snippets' ),
137 'type' => 'number',
138 'desc' => __( 'The width of a tab character.', 'code-snippets' ),
139 'default' => 4,
140 'codemirror' => 'tabSize',
141 'min' => 0,
142 ),
143
144 'indent_unit' => array(
145 'name' => __( 'Indent Unit', 'code-snippets' ),
146 'type' => 'number',
147 'desc' => __( 'How many spaces a block should be indented.', 'code-snippets' ),
148 'default' => 2,
149 'codemirror' => 'indentUnit',
150 'min' => 0,
151 ),
152
153 'wrap_lines' => array(
154 'name' => __( 'Wrap Lines', 'code-snippets' ),
155 'type' => 'checkbox',
156 'label' => __( 'Whether the editor should scroll or wrap for long lines.', 'code-snippets' ),
157 'default' => true,
158 'codemirror' => 'lineWrapping',
159 ),
160
161 'line_numbers' => array(
162 'name' => __( 'Line Numbers', 'code-snippets' ),
163 'type' => 'checkbox',
164 'label' => __( 'Show line numbers to the left of the editor.', 'code-snippets' ),
165 'default' => true,
166 'codemirror' => 'lineNumbers',
167 ),
168
169 'auto_close_brackets' => array(
170 'name' => __( 'Auto Close Brackets', 'code-snippets' ),
171 'type' => 'checkbox',
172 'label' => __( 'Auto-close brackets and quotes when typed.', 'code-snippets' ),
173 'default' => true,
174 'codemirror' => 'autoCloseBrackets',
175 ),
176
177 'highlight_selection_matches' => array(
178 'name' => __( 'Highlight Selection Matches', 'code-snippets' ),
179 'label' => __( 'Highlight all instances of a currently selected word.', 'code-snippets' ),
180 'type' => 'checkbox',
181 'default' => true,
182 'codemirror' => 'highlightSelectionMatches',
183 ),
184 );
185
186 $fields = apply_filters( 'code_snippets_settings_fields', $fields );
187 return $fields;
188 }
189