-
Notifications
You must be signed in to change notification settings - Fork 0
/
forms.php
131 lines (104 loc) · 2.65 KB
/
forms.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
<?php
/*
Plugin Name: Contact Forms by MB Création
Author: MB Création
Description: Formulaires de contact
Version: 1.0
*/
if( !class_exists( 'MbcContactForms' ) )
{
include dirname(__FILE__).'/includes/mbc-contact-form.php';
class MbcContactForms
{
protected $plugin_path;
function __construct()
{
$this->plugin_path = dirname(__FILE__);
$this->create_forms();
add_action('plugins_loaded', array($this, 'hooks' ), 6 );
}
public function create_forms()
{
//ici déclarer tous les formulaires
// ex : $contact_form = new MbcContactForm('contact-form');
$contact_form = new MbcContactForm('contact-form');
}
public function hooks()
{
// ici déclarer tous les filters & actions. cf readme.md
//ex : add_filter('mbccf_contact-form_fields', array($this, 'contact_form_fields' ));
}
/* ci-dessous : écrires les fonctions appelées via les filters */
/* exemple
public function contact_form_fields($array)
{
$array = array(
'text' => array(
'type'=> 'text',
'val' => 'text',
'label'=> 'text',
'mandatory' => false,
),
'password' => array(
'type'=> 'password',
'val' => 'password',
'label'=> 'password',
'mandatory' => false,
),
'password_confirm' => array(
'type'=> 'password_confirm',
'val' => 'password',
'label'=> 'password_confirm',
'mandatory' => false,
),
'email' => array(
'type'=> 'email',
'val' => 'email',
'label'=> 'email',
'mandatory' => false,
),
'textarea' => array(
'type'=> 'textarea',
'val' => 'textarea',
'label'=> 'textarea',
'mandatory' => false,
),
'radio' => array(
'type'=> 'radio',
'val' => 'radio1',
'label'=> 'radio',
'data' => array('radio1'=>'Radio 1' ,'radio2'=>'Radio 2'),
'mandatory' => false,
),
'checkbox' => array(
'type'=> 'checkbox',
'val' => 'checkbox2',
'label'=> 'checkbox',
'data' => array('checkbox1'=>'Checkbox 1' ,'checkbox2'=>'Checkbox 2'),
'mandatory' => false,
),
'checkbox_unique' => array(
'type'=> 'checkbox_unique',
'val' => '1',
'label'=> 'checkbox_unique',
'mandatory' => false,
),
'select' => array(
'type'=> 'select',
'val' => 'select2',
'label'=> 'select',
'data' => array('select1'=>'Select 1' ,'select2'=>'Select 2'),
'mandatory' => false,
),
'file' => array(
'type'=> 'file',
'val' => '',
'label'=> 'file',
'mandatory' => false,
),
);
return $array;
}*/
}
$mbcContactForms = new MbcContactForms();
}