-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathoptions.php
375 lines (317 loc) · 14 KB
/
options.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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
<?php
/**
* A unique identifier is defined to store the options in the database and reference them from the theme.
* By default it uses the theme name, in lowercase and without spaces, but this can be changed if needed.
* If the identifier changes, it'll appear as if the options have been reset.
*/
function optionsframework_option_name() {
// This gets the theme name from the stylesheet (lowercase and without spaces)
$themename = wp_get_theme();
$themename = $themename['Name'];
$themename = preg_replace("/\W/", "", strtolower($themename) );
$optionsframework_settings = get_option('optionsframework');
$optionsframework_settings['id'] = $themename;
update_option('optionsframework', $optionsframework_settings);
}
/**
* Defines an array of options that will be used to generate the settings page and be saved in the database.
* When creating the "id" fields, make sure to use all lowercase and no spaces.
*
*/
function optionsframework_options() {
$parent_colleges_institutes = array(
"University of Florida" => "University of Florida",
"Information Technology" => "Information Technology",
"UF Academic Health Center" => "UF Academic Health Center",
"Shands HealthCare" => "Shands HealthCare",
"None" => "None"
);
// Pull all the categories into an array
$options_categories = array("Choose a Category" => "Choose a Category");
$options_categories_obj = get_categories(array('hide_empty' => 0));
foreach ($options_categories_obj as $category) {
$options_categories[$category->cat_ID] = $category->cat_name;
}
// Pull all the pages into an array
$options_pages = array();
$options_pages_obj = get_pages('sort_column=post_parent,menu_order');
$options_pages[''] = 'Select a page:';
foreach ($options_pages_obj as $page) {
$options_pages[$page->ID] = $page->post_title;
}
// If using image radio buttons, define a directory path
$imagepath = get_bloginfo('stylesheet_directory') . '/library/images/';
$options = array();
$options[] = array( "name" => "General",
"type" => "heading");
$options[] = array( "name" => "Parent College / Institute",
"desc" => "Select your parent organization.",
"id" => "opt_parent_colleges_institutes",
"std" => "one",
"type" => "select",
"options" => $parent_colleges_institutes);
$options[] = array( "name" => "Google Analytics Account Number",
"desc" => "Enter your account number for Google Analytics (e.g., 'UA-xxxxxxx-x' or 'UA-xxxxxxx-xx' )",
"id" => "opt_analytics_acct",
"std" => "",
"type" => "text");
$options[] = array( "name" => "Enable Mega Drop Down Menu",
"desc" => "Enable mega drop down menus for your main menu",
"id" => "opt_mega_menu",
"std" => "0",
"type" => "checkbox");
$options[] = array( "name" => "Collapse Sidebar Navigation",
"desc" => "Useful for larger sites - keeps the sidebar navigation a manageable height",
"id" => "opt_collapse_sidebar_nav",
"std" => "0",
"type" => "checkbox");
$options[] = array( "name" => "Shibboleth Protocol",
"desc" => "Select the protocol you have Shibboleth enabled on.",
"id" => "opt_shibboleth_protocol",
"std" => "http",
"type" => "select",
"options" => array(
"http" => "http",
"https" => "https")
);
$options[] = array( "name" => "Responsive Theme",
"desc" => "Enables a responsive theme for your site. *NOTE* this requires configuration. Please read our <a href='#'> documentation</a> for more information.",
"id" => "opt_responsive",
"std" => "0",
"type" => "checkbox");
// Site Title
$options[] = array( "name" => "Header",
"desc" => "Options for modifying the header. The below options modify the social media icons.",
"type" => "heading");
$options[] = array( "name" => "Facebook",
"super-admin-only" => "0",
"desc" => "Enter the url of your organization's Facebook page (e.g. http://facebook.com/uflorida)",
"id" => "opt_facebook_url",
"std" => "",
"type" => "text");
$options[] = array( "name" => "Twitter",
"super-admin-only" => "0",
"desc" => "Enter the url of your organization's Twitter page (e.g. http://www.twitter.com/uflorida)",
"id" => "opt_twitter_url",
"std" => "",
"type" => "text");
$options[] = array( "name" => "Youtube",
"super-admin-only" => "0",
"desc" => "Enter the url of your organization's Youtube page (e.g. http://www.youtube.com/universityofflorida)",
"id" => "opt_youtube_url",
"std" => "",
"type" => "text");
$options[] = array( "name" => "Blog",
"super-admin-only" => "0",
"desc" => "Enter the url of your organization's Blog page (e.g. http://...)",
"id" => "opt_siteblog_url",
"std" => "",
"type" => "text");
$options[] = array( "name" => "Facebook Insights ID",
"super-admin-only" => "0",
"desc" => "Enter the unique number ID for fb:admins, e.g., <meta property=\"fb:admins\" content=\"1138099648\", would be \"1138099648\" />",
"id" => "opt_facebook_insights",
"std" => "",
"type" => "text");
$options[] = array( "name" => "Search Options",
"desc" => "These options modify the behavior of the search box in the header.",
"type" => "info");
$options[] = array( "name" => "Site Specific Search",
"desc" => "Only search this site with UF Search (this option sets the site:example.ufl.edu search option)",
"id" => "opt_site_specific_search",
"std" => "0",
"type" => "checkbox");
$options[] = array( "name" => "Use WordPress Search",
"desc" => "Use WordPress Search instead of the default UF Search site. This option ignores the Site Specific Search option as WordPress search can only search this site",
"id" => "opt_use_wp_search",
"std" => "0",
"type" => "checkbox");
$options[] = array( "name" => "Search Box Text",
"desc" => "Change the default text of the search box.",
"id" => "opt_search_box_text",
"std" => "",
"type" => "text");
$options[] = array( "name" => "Site Title",
"desc" => "These options adjust the sizing of the site title.",
"type" => "info");
$options[] = array( "name" => "Title Font Size",
"desc" => "Enter a number that corresponds to the size of the font you would like for the title of your site (Default 2.6).",
"id" => "opt_title_size",
"class" => "mini",
"std" => "",
"type" => "text");
$options[] = array( "name" => "Title Padding",
"desc" => "Enter the amount of padding the title should have (Default 6).",
"id" => "opt_title_pad",
"class" => "mini",
"std" => "",
"type" => "text");
$options[] = array( "name" => "Tagline Font Size",
"desc" => "Enter a number that corresponds to the size of the font you would like for the tagline of your site (Default values 1.4).",
"id" => "opt_tagline_size",
"class" => "mini",
"std" => "",
"type" => "text");
// Call to Action Button
$options[] = array( "name" => "Call to Action",
"type" => "heading");
$options[] = array( "name" => "Call to Action Text",
"desc" => "The Call to Action text is the orange box above your main menu. Enter what you would like it to say here. Leave it blank to remove it.",
"id" => "opt_actionitem_text",
"std" => "",
"type" => "text");
$options[] = array( "name" => "Call to Action URL",
"desc" => "Where visitors are taken when they click on your Header Action Item",
"id" => "opt_actionitem_url",
"std" => "",
"type" => "text");
$options[] = array( "name" => "Call to Action Alternate Color",
"desc" => "This is an alternate color (red) used for warnings and emergency alerts.",
"id" => "opt_actionitem_altcolor",
"std" => "0",
"type" => "checkbox");
// Homepage Layout
$options[] = array( "name" => "Homepage",
"desc" => "Options for modifying the homepage. The below options edit the featured slider.",
"type" => "heading");
$options[] = array( "name" => "Select a Category",
"desc" => "Choose a category from which featured posts are drawn. To remove the featured content area, simply set this dropdown to 'Choose a Category'",
"id" => "opt_featured_category",
"type" => "select",
"std" => array("Choose a Category" => "Choose a Category"),
"options" => $options_categories);
$options[] = array( "name" => "Number of Posts to Display in Slider",
"desc" => "How many posts do you want to display in your slider (Story Stacker is fixed at 3)",
"id" => "opt_number_of_posts_to_show",
"std" => "3",
"type" => "select",
"class" => "mini",
"options" => array("1" => "1", "2" => "2", "3" => "3", "4" => "4", "5" => "5", "6" => "6", "7" => "7", "8" => "8", "9" => "9", "10" => "10", "11" => "11", "12" => "12", "13" => "13", "14" => "14", "15" => "15"));
$options[] = array( "name" => "Slider Speed",
"desc" => "Time in milliseconds to display each slide (e.g. 5000 means five seconds)",
"id" => "opt_featured_speed",
"std" => "7000",
"type" => "text");
$options[] = array( "name" => "Disable Timeline Scrubber",
"desc" => "Disable the long bar with dots underneath the images",
"id" => "opt_featured_content_disable_timeline",
"std" => "0",
"type" => "checkbox");
$options[] = array( "name" => "Disable Slider Links",
"desc" => "Disable links from being created on the homepage slider.",
"id" => "opt_featured_disable_link",
"std" => "0",
"type" => "checkbox");
$options[] = array( "name" => "Story Stacker",
"desc" => "Check to enable the Featured Content Story Stacker for your home page.",
"id" => "opt_story_stacker",
"std" => "0",
"type" => "checkbox");
$options[] = array( "name" => "Story Stacker - Disable Dates",
"desc" => "Disable dates from appearing underneath your post titles",
"id" => "opt_story_stacker_disable_dates",
"std" => "0",
"type" => "checkbox");
// Adding option to use a widget in the featured area on the homepage
$options[] = array( "name" => "Widgets in Feature Area",
"desc" => "Enables a 'Home Featured Right' widget to appear in the feature area. This disables the story stacker and full width image options.",
"id" => "opt_home_featured_widgets",
"std" => "0",
"type" => "checkbox");
$options[] = array( "name" => "Homepage Layout",
"desc" => "These options modify the layout of the homepage widget areas.",
"type" => "info");
$options[] = array( "name" => "Homepage Layout for Widgets",
"desc" => "Select which layout you want to use for your widgets on the homepage",
"id" => "opt_homepage_layout",
"std" => "3c-default",
"type" => "images",
"options" => array(
'3c-default' => $imagepath . '3c-default.png',
'3c-thirds' => $imagepath . '3c-thirds.png',
'2c-bias' => $imagepath . '2c-bias.png',
'2c-half' => $imagepath . '2c-half.png',
'1c-100' => $imagepath . '1c-100.png',
'1c-100-2c-half' => $imagepath . '1c-100-2c-half.png')
);
$options[] = array( "name" => "Color Scheme (white background)",
"desc" => "Use a white background for the homepage widget zone",
"id" => "opt_homepage_layout_color",
"std" => "0",
"type" => "checkbox");
// Footer Options
$options[] = array( "name" => "Footer",
"type" => "heading");
$options[] = array( "name" => "Webmaster Email",
"desc" => "Enter the email address or contact page URL for webmaster contact requests (e.g. [email protected] OR http://yourdomain.edu/contact) ",
"id" => "opt_webmaster_email",
"std" => "",
"type" => "text");
$options[] = array( "name" => "Intranet URL",
"desc" => "Enter the URL to your unit's intranet. This will place a link at the bottom of the footer titled 'Intranet'",
"id" => "opt_intranet_url",
"std" => "",
"type" => "text");
$options[] = array( "name" => "Make a Gift URL",
"desc" => "Enter the URL to your unit's specific fund/giving page at the UF Foundation. Find available online funds at the <a href='https://www.uff.ufl.edu/OnlineGiving/Advanced.asp'>UF Foundation</a>",
"id" => "opt_makeagift_url",
"std" => "",
"type" => "text");
$options[] = array( "name" => "Footer Widget Visibility",
"desc" => "Select where to show the Footer Widgets",
"id" => "opt_footer_widgets_visibility",
"std" => "all_pages",
"type" => "radio",
"options" => array(
'all_pages' => 'All Pages (including Homepage)',
'homepage_only' => 'Homepage Only',
'subpages_only' => 'Subpages Only')
);
// Custom Attributes
$options[] = array( "name" => "Custom Attributes",
"type" => "heading");
$options[] = array( "name" => "Custom CSS",
"desc" => "Enter custom CSS to be inserted in the header.",
"id" => "opt_custom_css",
"std" => "",
"type" => "textarea");
$options[] = array( "name" => "Custom JS",
"desc" => "Enter custom JS to be inserted in the footer.",
"id" => "opt_custom_js",
"std" => "",
"type" => "textarea");
$options[] = array( "name" => "Custom Mobile CSS",
"desc" => "Enter custom CSS to be inserted in the header that will be used only if the Responsive template is viewed on a mobile device.",
"id" => "opt_responsive_css",
"std" => "",
"type" => "textarea");
$options[] = array( "name" => "Custom Logo",
"desc" => "These options replace the logo in the header with an image.",
"type" => "info");
$options[] = array( "name" => "Custom Logo File",
"super-admin-only" => "1",
"desc" => "For advanced use only.",
"id" => "opt_alternative_site_logo",
"type" => "upload");
$options[] = array( "name" => "Custom Logo Height",
"super-admin-only" => "1",
"desc" => "For advanced use only. Enter height in pixels (i.e. 70)",
"id" => "opt_alternative_site_logo_height",
"class" => "mini",
"std" => "",
"type" => "text");
$options[] = array( "name" => "Custom Logo Width",
"super-admin-only" => "1",
"desc" => "For advanced use only. Enter width in pixels (i.e. 70)",
"id" => "opt_alternative_site_logo_width",
"class" => "mini",
"std" => "",
"type" => "text");
$options[] = array( "name" => "Disable Global Elements",
"super-admin-only" => "1",
"desc" => "Disable the global header, footer, and social media icons from appearing",
"id" => "opt_disable_global_elements",
"std" => "0",
"type" => "checkbox");
return $options;
}