-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathqa-random-admin.php
60 lines (53 loc) · 1.43 KB
/
qa-random-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
<?php
class qa_random_question_admin {
function option_default($option) {
switch($option) {
case 'random_widget_title':
return 'Random Question';
case 'random_question_number':
return '10';
default:
return null;
}
}
function allow_template($template)
{
return ($template!='admin');
}
function admin_form(&$qa_content)
{
$ok = null;
if (qa_clicked('random_question_save')) {
qa_opt('random_question_number',qa_post_text('random_question_number'));
qa_opt('random_widget_title',qa_post_text('random_widget_title'));
$ok = qa_lang_html('admin/options_saved');
}elseif (qa_clicked('random_question_donate')) {
qa_redirect_raw('https://paypal.me/guangyuezhao');
}
return array(
'ok' => ($ok && !isset($error)) ? $ok : null,
'fields' => array(
array(
'label' => 'Number of questions to show:',
'tags' => 'NAME="random_question_number"',
'value' => qa_opt('random_question_number'),
'type' => 'number',
),array(
'label' => 'Widget title:',
'tags' => 'NAME="random_widget_title"',
'value' => qa_opt('random_widget_title'),
'type' => 'text',
)
),
'buttons' => array(
array(
'label' => 'Save',
'tags' => 'NAME="random_question_save"',
),array(
'label' => 'Donate',
'tags' => 'NAME="random_question_donate"',
)
)
);
}
}