-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathqa-featured-admin.php
82 lines (66 loc) · 2.09 KB
/
qa-featured-admin.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
<?php
class qa_featured_admin {
function option_default($option) {
switch($option) {
case 'featured_question_css':
return '
.qa-q-list-item-featured {
background-color:#FFC;
}
';
default:
return null;
}
}
function allow_template($template)
{
return ($template!='admin');
}
function admin_form(&$qa_content)
{
// Process form input
$ok = null;
if (qa_clicked('featured_questions_save')) {
qa_opt('featured_questions_list',qa_post_text('featured_questions_list'));
qa_opt('featured_question_css',qa_post_text('featured_question_css'));
$ok = qa_lang('admin/options_saved');
}
elseif (qa_clicked('donate_zhao_guangyue')) {
qa_redirect_raw('https://paypal.me/guangyuezhao');
}
// Create the form for display
$fields = array();
$fields[] = array(
'label' => 'Featured question ids( separate question id numbers with commas (e.g. 123,456) )',
'tags' => 'NAME="featured_questions_list"',
'value' => qa_opt('featured_questions_list'),
'type' => 'text',
);
$fields[] = array(
'label' => 'Custom css:',
'tags' => 'NAME="featured_question_css"',
'value' => qa_opt('featured_question_css'),
'rows' => 10,
'type' => 'textarea',
);
$fields[] = array(
'label' => '<span style="color:#f90; font-size:16px; text-align:center;">Hope you can donate <strong>$1</strong> for my work!</br> Thanks very much!</span>',
'type' => 'custom',
'tags' => 'NAME="hope_donate"',
);
return array(
'ok' => ($ok && !isset($error)) ? $ok : null,
'fields' => $fields,
'buttons' => array(
array(
'label' => qa_lang_html('main/save_button'),
'tags' => 'NAME="featured_questions_save"',
),
array(
'label' => 'Donate',
'tags' => 'NAME="donate_zhao_guangyue"',
)
),
);
}
}