/
options.php
executable file
·469 lines (371 loc) · 14.6 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
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
<?php
/**
* A unique identifier is defined to store the options in the database and reference them from the theme.
*/
function optionsframework_option_name() {
// Change this to use your theme slug
return 'yanse';
/**
* 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.
*
*/
}
/**
* 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() {
// Background Defaults
$body_background_defaults = array(
"color" => "#f5f5f5",
"repeat" => "repeat",
"image" => get_stylesheet_directory_uri() . "/images/branding/login-back.png",
"position" => "top center",
"attachment"=>"scroll");
// Dashboard Widget amount selector
$widget_amount = array( "1" => "1", "2" => "2", "3" => "3", "4" => "4", "5" => "5", "6" => "6", "7" => "7", "8" => "8", "9" => "9", "10" => "10" );
// Dashboard Widget Yes or No selector
$widget_yes_no = array("1" => "Yes","0" => "No");
// Dashboard Widget Yes or No selector
$widget_feed_url = array( "http://www.colorale.com/feed/" => "Colorale", home_url('/feed') => get_bloginfo('site_name'));
// If using image radio buttons, define a directory path
$imagepath = get_stylesheet_directory_uri() . '/images/';
$options = array();
/* Dashboard Widgets */
$options[] = array( "name" => "Dashboard" ,
"type" => "heading");
$options[] = array( "name" => "General information",
"desc" => "This feature will work as a very simple Feed Reader for your favourite Website.",
"type" => "info");
$options[] = array( "name" => "Widget Title Feed",
"id" => "widget_title",
"std" => "News from colorale",
"class" => "normal", //mini, tiny, small, normal
"type" => "text");
$options[] = array( "name" => "Widget URL Feed",
"id" => "widget_feed",
"std" => "http://www.colorale.com/feed",
"options" => $widget_feed_url,
"type" => "select");
$options[] = array( "name" => "Widget Items",
"id" => "widget_items",
"desc" => "How many items do you want to show on the dashboard?",
"std" => "5",
"type" => "select",
"class" => "mini grouped",
"options" => $widget_amount);
$options[] = array( "name" => "Summary",
"desc" => "Show summary?",
"id" => "widget_summary",
"std" => "1",
"type" => "select",
"class" => "mini grouped",
"options" => $widget_yes_no);
$options[] = array( "name" => "Author",
"desc" => "Show author?",
"id" => "widget_author",
"std" => "0",
"type" => "select",
"class" => "mini grouped",
"options" => $widget_yes_no);
$options[] = array( "name" => "Date",
"desc" => "Show date?",
"id" => "widget_date",
"std" => "1",
"type" => "select",
"class" => "mini grouped",
"options" => $widget_yes_no);
/* Social */
$options[] = array( "name" => "Social",
"type" => "heading");
$options[] = array( "name" => "General information",
"desc" => "Add your Social service profile URL (E.g.: <a href=\"https://twitter.com/#!/alectro\">https://twitter.com/alectro</a>).",
"type" => "info");
$options[] = array( "name" => "RSS Feed",
"id" => "rss_url",
"std" => home_url( '/feed/' ),
"class" => "small grouped",
"type" => "text");
$options[] = array( "name" => "Twitter",
"id" => "twitter_url",
"class" => "small grouped",
"type" => "text");
$options[] = array( "name" => "Facebook",
"id" => "facebook_url",
"class" => "small grouped",
"type" => "text");
$options[] = array( "name" => "Google+",
"id" => "googleplus_url",
"class" => "small grouped",
"type" => "text");
$options[] = array( "name" => "LinkedIn",
"id" => "linkedin_url",
"class" => "small grouped",
"type" => "text");
$options[] = array( "name" => "Behance",
"id" => "behance_url",
"class" => "small grouped",
"type" => "text");
$options[] = array( "name" => "Dribbble",
"id" => "dribbble_url",
"class" => "small grouped",
"type" => "text");
$options[] = array( "name" => "Designer News",
"id" => "designernews_url",
"class" => "small grouped",
"type" => "text");
$options[] = array( "name" => "Instagram",
"id" => "instagram_url",
"class" => "small grouped",
"type" => "text");
$options[] = array( "name" => "Pinterest",
"id" => "pinterest_url",
"class" => "small grouped",
"type" => "text");
$options[] = array( "name" => "MailChimp",
"id" => "mailchimp_url",
"class" => "small grouped",
"type" => "text");
$options[] = array( "name" => "Flickr",
"id" => "flickr_url",
"class" => "small grouped",
"type" => "text");
$options[] = array( "name" => "500px",
"id" => "500px_url",
"class" => "small grouped",
"type" => "text");
$options[] = array( "name" => "Spotify",
"id" => "spotify_url",
"class" => "small grouped",
"type" => "text");
$options[] = array( "name" => "Last.fm",
"id" => "lastfm_url",
"class" => "small grouped",
"type" => "text");
$options[] = array( "name" => "SoundCloud",
"id" => "soundcloud_url",
"class" => "small grouped",
"type" => "text");
$options[] = array( "name" => "Medium",
"id" => "medium_url",
"class" => "small grouped",
"type" => "text");
$options[] = array( "name" => "WordPress",
"id" => "wordpress_url",
"class" => "small grouped",
"type" => "text");
$options[] = array( "name" => "Github",
"id" => "github_url",
"class" => "small grouped",
"type" => "text");
$options[] = array( "name" => "Bitbucket",
"id" => "bitbucket_url",
"class" => "small grouped",
"type" => "text");
$options[] = array( "name" => "Stack Overflow",
"id" => "stackoverflow_url",
"class" => "small grouped",
"type" => "text");
$options[] = array( "name" => "Youtube",
"id" => "youtube_url",
"class" => "small grouped",
"type" => "text");
$options[] = array( "name" => "Vimeo",
"id" => "vimeo_url",
"class" => "small grouped",
"type" => "text");
$options[] = array( "name" => "Weibo",
"id" => "weibo_url",
"class" => "small grouped",
"type" => "text");
$options[] = array( "name" => "WeChat",
"id" => "wechat_url",
"desc" => "Upload your QR code here.",
"class" => "small grouped",
"type" => "upload");
$options[] = array( "name" => "Douban Station",
"class" => "normal",
"id" => "douban_url",
"class" => "small grouped",
"type" => "text");
$options[] = array( "name" => "Youku",
"id" => "youku_url",
"class" => "small grouped",
"type" => "text");
/* Logo */
$options[] = array( "name" => "Logo",
"type" => "heading");
$options[] = array( "name" => "Website's main logo",
"desc" => "Upload a logo for Tablet and Desktop.",
"id" => "main_logo",
"std" => $imagepath . 'branding/logo.png',
"type" => "upload");
$options[] = array( "name" => "Website's mobile logo",
"desc" => "Upload a logo for mobile.",
"id" => "main_logo_mobile",
"std" => $imagepath . 'branding/logo-mobile.png',
"type" => "upload");
$options[] = array( "name" => "Logo width",
"id" => "main_logo_width",
"std" => "90",
"class" => "mini grouped",
"type" => "text");
$options[] = array( "name" => "Logo height",
"id" => "main_logo_heigth",
"std" => "34",
"class" => "mini grouped",
"type" => "text");
/* Branding */
$options[] = array( "name" => "Branding",
"type" => "heading");
$options[] = array( "name" => "General information",
"desc" => "Change the look and feel for your Website's back-end. Default values provided.",
"type" => "info");
$options[] = array( "name" => "Dashboard logo",
"desc" => "Replace the default Dashboard logo, placed in the footer. 105 x 45 pixels image (.jpg, .png or .gif). Consider the margins on the image itself.",
"id" => "dashboard_logo",
"std" => $imagepath . 'branding/dashboard-logo.png',
"type" => "upload");
/* Login */
$options[] = array( "name" => "Login Screen style",
"desc" => "Change the login screen style.",
"type" => "info");
$options[] = array( "name" => "Login Logo",
"desc" => "310 x 100 pixels image (.jpg, .png or .gif). Consider the margins on the image itself and transparency if you are using the \"Login box background color\" option. Alternatively you can upload a bigger image to fill all the background.",
"id" => "login_logo",
"std" => $imagepath . 'branding/login-logo.png',
"type" => "upload");
$options[] = array( "name" => "Login Body Background",
"desc" => "Change the background CSS.",
"id" => "login_back",
"std" => $body_background_defaults,
"type" => "background");
$options[] = array( "name" => "Border Radius",
"id" => "loginboxes_radius",
"desc" => "Set roundness for the Login Box and Submit Button.",
"std" => "3",
"class" => "small grouped",
"type" => "text");
$options[] = array( "name" => "Login box background color",
"id" => "loginbox_back",
"std" => "#ffffff",
"class" => "small grouped",
"type" => "color");
$options[] = array( "name" => "Labels",
"id" => "login_labels",
"std" => "#333333",
"class" => "small grouped",
"type" => "color");
$options[] = array( "name" => "User & Password background color",
"id" => "input_back",
"std" => "#ededed",
"class" => "small grouped",
"type" => "color");
$options[] = array( "name" => "Submit background color",
"id" => "submit_back",
"std" => "#333333",
"class" => "small grouped",
"type" => "color");
$options[] = array( "name" => "Submit:hover background color",
"id" => "submit_hover_back",
"std" => "#797979",
"class" => "small grouped",
"type" => "color");
$options[] = array( "name" => "Login page link's color",
"id" => "login_links_color",
"std" => "#797979",
"class" => "small grouped",
"type" => "color");
$options[] = array( "name" => "Login page link's :hover color",
"id" => "login_links_hover_color",
"std" => "#333333",
"class" => "small grouped",
"type" => "color");
/* SEO */
$options[] = array( "name" => "SEO",
"type" => "heading");
$options[] = array( "name" => "General information",
"desc" => "Add some basic SEO functionalities to your Website.",
"type" => "info");
$options[] = array( "name" => "Google Analytics",
"desc" => "Place your <a href=\"http://www.google.com/analytics/\">Google Analytics</a> tracking code (E.g.: UA-2577708-1) here.",
"id" => "google_analytics_code",
"class" => "normal",
"type" => "text");
$options[] = array( "name" => "Google Webmaster Tools",
"desc" => "Place your <a href=\"https://www.google.com/webmasters/tools/\">Google Site Verification</a> code (E.g.: NU0E79CDsrcLt3u7iQWVBGCqqfNgzPjg-vVmLr7OIKs) here.",
"id" => "google_verification_code",
"class" => "normal",
"type" => "text");
$options[] = array( "name" => "Bing Webmaster Tools",
"desc" => "Place your <a href=\"http://www.bing.com/webmaster/\">Bing Webmaster Tools</a> meta tag value (E.g.: CE134D71FC17544A13939C48D03C3D0C) here.",
"id" => "bing_webmaster_code",
"class" => "normal",
"type" => "text");
$options[] = array( "name" => "Baidu",
"desc" => "Place your <a href=\"http://union.baidu.com\">Baidu</a> verifying code (E.g.: jwqfyxAYVhlYBpAW) here.",
"id" => "baidu-site-verification",
"type" => "text");
$options[] = array( "name" => "Alexa Page Rank",
"desc" => "Place your <a href=\"http://www.alexa.com/\">Alexa Page Rank</a> ID value (E.g.: ObTjYmNfBPZVs6Ebtncj7CenHUZ) here.",
"id" => "alexa_code",
"type" => "text");
$options[] = array( "name" => "Sitemap",
"desc" => "Create sitemap.xml file on your installation root folder? Remember to add it manually to your <a href=\"https://www.google.com/webmasters/tools/\">Google</a> and <a href=\"http://www.bing.com/webmaster/\">Bing</a> Webmaster Tools accounts.",
"id" => "sitemap_xml",
"std" => "0",
"type" => "select",
"options" => $widget_yes_no);
/* Maintenance Mode Enabler */
/*$options[] = array( "name" => "Maintenance" ,
"type" => "heading");
$options[] = array(
"name" => "Warning! Checking the checkbox below will enable 'Maintenance Mode', remember to uncheck after Maintenance is done.",
"id" => "maintenance_enabler",
"desc" => "Enable/Disable",
"type" => "checkbox");
$options[] = array( "name" => "Maintenance logo",
"desc" => "Upload a logo for Maintenance screen.",
"id" => "maintenance_logo",
"std" => $imagepath . 'branding/dashboard-logo.jpg',
"type" => "upload",
"class" => "hidden");
$wp_editor_config = array(
"wpautop" => true, // Default
"textarea_rows" => 15,
"tinymce" => array( "plugins" => "wordpress" )
);
$options[] = array( "name" => "Maintenance mode Editor",
"desc" => "Add your customized maintenance message.",
"std" => "<h1>" . get_bloginfo(site_name) . " Website Under Maintenance</h1><p>Our Website is currently undergoing scheduled maintenance. Please check back very soon.</p><p><strong>Sorry for the inconvenience!</strong>
You can contact us by writing an <a href='mailto:" . antispambot('nihao@colorale.com', 1) . "'>email</a>.</p>",
"id" => "mntnceditor",
"type" => "editor",
"class" => "hidden",
"settings" => $wp_editor_config );
*/
return $options;
}
/*
* This is an example of how to add custom scripts to the options panel.
* This example shows/hides an option when a checkbox is clicked.
*/
add_action('optionsframework_custom_scripts', 'optionsframework_custom_scripts');
function optionsframework_custom_scripts() { ?>
<script type="text/javascript">
jQuery(document).ready(function($) {
$('#maintenance_enabler').click(function() {
$('#section-mntnceditor').fadeToggle(400);
$('#section-maintenance_logo').fadeToggle(400);
});
if ($('#maintenance_enabler:checked').val() !== undefined) {
$('#section-mntnceditor').show();
$('#section-maintenance_logo').show();
}
});
</script>
<?php
}