@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | // loop through incoming options |
53 | 53 | foreach ($template_options as $key => $value) { |
54 | 54 | // add underscore to $key to match property names |
55 | - $_key = '_' . $key; |
|
55 | + $_key = '_'.$key; |
|
56 | 56 | if (property_exists($this, $_key)) { |
57 | 57 | $this->{$_key} = $value; |
58 | 58 | } |
@@ -182,9 +182,9 @@ discard block |
||
182 | 182 | $subsection_name = self::prep_form_subsection_key_name($subsection_name); |
183 | 183 | if (strpos($subsection_name, '[') !== false) { |
184 | 184 | $sub_name = explode('[', $subsection_name); |
185 | - $this->_template_args[ $sub_name[0] ][ rtrim($sub_name[1], ']') ] = $this->layout_subsection($subsection); |
|
185 | + $this->_template_args[$sub_name[0]][rtrim($sub_name[1], ']')] = $this->layout_subsection($subsection); |
|
186 | 186 | } else { |
187 | - $this->_template_args[ $subsection_name ] = $this->layout_subsection($subsection); |
|
187 | + $this->_template_args[$subsection_name] = $this->layout_subsection($subsection); |
|
188 | 188 | } |
189 | 189 | } |
190 | 190 | // d( $this->_template_args ); |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | public static function prep_form_subsection_key_name($subsection_name = '') |
204 | 204 | { |
205 | 205 | $subsection_name = str_replace(array('-', ' '), array('', '_'), $subsection_name); |
206 | - return is_numeric(substr($subsection_name, 0, 1)) ? 'form_' . $subsection_name : $subsection_name; |
|
206 | + return is_numeric(substr($subsection_name, 0, 1)) ? 'form_'.$subsection_name : $subsection_name; |
|
207 | 207 | } |
208 | 208 | |
209 | 209 |
@@ -22,200 +22,200 @@ |
||
22 | 22 | */ |
23 | 23 | class EE_Template_Layout extends EE_Div_Per_Section_Layout |
24 | 24 | { |
25 | - protected $_layout_template_file = null; |
|
26 | - |
|
27 | - protected $_layout_begin_template_file = null; |
|
28 | - |
|
29 | - protected $_input_template_file = null; |
|
30 | - |
|
31 | - protected $_subsection_template_file = null; |
|
32 | - |
|
33 | - protected $_layout_end_template_file = null; |
|
34 | - |
|
35 | - protected $_template_args = array(); |
|
36 | - |
|
37 | - |
|
38 | - |
|
39 | - /** |
|
40 | - * @param array $template_options { |
|
41 | - * @type string $_layout_template_file |
|
42 | - * @type string $_begin_template_file |
|
43 | - * @type string $_input_template_file |
|
44 | - * @type string $_subsection_template_file |
|
45 | - * @type string $_end_template_file |
|
46 | - * @type array $_template_args |
|
47 | - * } |
|
48 | - */ |
|
49 | - public function __construct($template_options = array()) |
|
50 | - { |
|
51 | - // loop through incoming options |
|
52 | - foreach ($template_options as $key => $value) { |
|
53 | - // add underscore to $key to match property names |
|
54 | - $_key = '_' . $key; |
|
55 | - if (property_exists($this, $_key)) { |
|
56 | - $this->{$_key} = $value; |
|
57 | - } |
|
58 | - } |
|
59 | - parent::__construct(); |
|
60 | - } |
|
61 | - |
|
62 | - |
|
63 | - |
|
64 | - /** |
|
65 | - * Also has the side effect of enqueuing any needed JS and CSS for |
|
66 | - * this form. |
|
67 | - * Creates all the HTML necessary for displaying this form, its inputs, and |
|
68 | - * proper subsections. |
|
69 | - * Returns the HTML |
|
70 | - * |
|
71 | - * @return string |
|
72 | - */ |
|
73 | - public function layout_form() |
|
74 | - { |
|
75 | - if ($this->_layout_template_file) { |
|
76 | - return EEH_Template::locate_template($this->_layout_template_file, $this->template_args(), true, true); |
|
77 | - } else { |
|
78 | - return parent::layout_form(); |
|
79 | - } |
|
80 | - } |
|
81 | - |
|
82 | - |
|
83 | - |
|
84 | - /** |
|
85 | - * opening div tag for a form |
|
86 | - * |
|
87 | - * @return string |
|
88 | - */ |
|
89 | - public function layout_form_begin() |
|
90 | - { |
|
91 | - if ($this->_layout_begin_template_file) { |
|
92 | - return EEH_Template::locate_template( |
|
93 | - $this->_layout_begin_template_file, |
|
94 | - $this->template_args(), |
|
95 | - true, |
|
96 | - true |
|
97 | - ); |
|
98 | - } else { |
|
99 | - return parent::layout_form_begin(); |
|
100 | - } |
|
101 | - } |
|
102 | - |
|
103 | - |
|
104 | - |
|
105 | - /** |
|
106 | - * If an input_template_file was provided upon construction, uses that to layout the input. Otherwise uses parent. |
|
107 | - * |
|
108 | - * @see EE_DIv_Per_Section_Layout::layout_input() for documentation |
|
109 | - * @param EE_Form_Input_Base $input |
|
110 | - * @return string |
|
111 | - */ |
|
112 | - public function layout_input($input) |
|
113 | - { |
|
114 | - if ($this->_input_template_file) { |
|
115 | - return EEH_Template::locate_template($this->_input_template_file, array('input' => $input), true, true); |
|
116 | - } |
|
117 | - return parent::layout_input($input); |
|
118 | - } |
|
119 | - |
|
120 | - |
|
121 | - |
|
122 | - /** |
|
123 | - * If a subsection_template_file was provided upon construction, uses that to layout the subsection. Otherwise uses parent. |
|
124 | - * |
|
125 | - * @see EE_Div_Per_Section_Layout::layout_subsection() for documentation |
|
126 | - * @param EE_Form_Section_Proper $form_section |
|
127 | - * @return string |
|
128 | - */ |
|
129 | - public function layout_subsection($form_section) |
|
130 | - { |
|
131 | - if ($this->_subsection_template_file) { |
|
132 | - return EEH_Template::locate_template($this->_subsection_template_file, $this->template_args(), true, true); |
|
133 | - } |
|
134 | - return parent::layout_subsection($form_section); |
|
135 | - } |
|
136 | - |
|
137 | - |
|
138 | - |
|
139 | - /** |
|
140 | - * closing div tag for a form |
|
141 | - * |
|
142 | - * @return string |
|
143 | - */ |
|
144 | - public function layout_form_end() |
|
145 | - { |
|
146 | - if ($this->_layout_end_template_file) { |
|
147 | - return EEH_Template::locate_template($this->_layout_end_template_file, $this->template_args(), true, true); |
|
148 | - } else { |
|
149 | - return parent::layout_form_end(); |
|
150 | - } |
|
151 | - } |
|
152 | - |
|
153 | - |
|
154 | - |
|
155 | - /** |
|
156 | - * @param array $template_args |
|
157 | - */ |
|
158 | - public function set_template_args($template_args = array()) |
|
159 | - { |
|
160 | - $this->_template_args = $template_args; |
|
161 | - } |
|
162 | - |
|
163 | - |
|
164 | - |
|
165 | - /** |
|
166 | - * @param array $template_args |
|
167 | - */ |
|
168 | - public function add_template_args($template_args = array()) |
|
169 | - { |
|
170 | - $this->_template_args = array_merge_recursive($this->_template_args, $template_args); |
|
171 | - } |
|
172 | - |
|
173 | - |
|
174 | - |
|
175 | - /** |
|
176 | - * @return array |
|
177 | - */ |
|
178 | - public function template_args() |
|
179 | - { |
|
180 | - foreach ($this->form_section()->subsections() as $subsection_name => $subsection) { |
|
181 | - $subsection_name = self::prep_form_subsection_key_name($subsection_name); |
|
182 | - if (strpos($subsection_name, '[') !== false) { |
|
183 | - $sub_name = explode('[', $subsection_name); |
|
184 | - $this->_template_args[ $sub_name[0] ][ rtrim($sub_name[1], ']') ] = $this->layout_subsection($subsection); |
|
185 | - } else { |
|
186 | - $this->_template_args[ $subsection_name ] = $this->layout_subsection($subsection); |
|
187 | - } |
|
188 | - } |
|
189 | - // d( $this->_template_args ); |
|
190 | - return $this->_template_args; |
|
191 | - } |
|
192 | - |
|
193 | - |
|
194 | - |
|
195 | - /** |
|
196 | - * prep_form_section_key_name |
|
197 | - * |
|
198 | - * @access public |
|
199 | - * @param string $subsection_name |
|
200 | - * @return string |
|
201 | - */ |
|
202 | - public static function prep_form_subsection_key_name($subsection_name = '') |
|
203 | - { |
|
204 | - $subsection_name = str_replace(array('-', ' '), array('', '_'), $subsection_name); |
|
205 | - return is_numeric(substr($subsection_name, 0, 1)) ? 'form_' . $subsection_name : $subsection_name; |
|
206 | - } |
|
207 | - |
|
208 | - |
|
209 | - |
|
210 | - /** |
|
211 | - * get_subform - just a wrapper for the above method |
|
212 | - * |
|
213 | - * @access public |
|
214 | - * @param string $subsection_name |
|
215 | - * @return string |
|
216 | - */ |
|
217 | - public static function get_subform_name($subsection_name = '') |
|
218 | - { |
|
219 | - return EE_Template_Layout::prep_form_subsection_key_name($subsection_name); |
|
220 | - } |
|
25 | + protected $_layout_template_file = null; |
|
26 | + |
|
27 | + protected $_layout_begin_template_file = null; |
|
28 | + |
|
29 | + protected $_input_template_file = null; |
|
30 | + |
|
31 | + protected $_subsection_template_file = null; |
|
32 | + |
|
33 | + protected $_layout_end_template_file = null; |
|
34 | + |
|
35 | + protected $_template_args = array(); |
|
36 | + |
|
37 | + |
|
38 | + |
|
39 | + /** |
|
40 | + * @param array $template_options { |
|
41 | + * @type string $_layout_template_file |
|
42 | + * @type string $_begin_template_file |
|
43 | + * @type string $_input_template_file |
|
44 | + * @type string $_subsection_template_file |
|
45 | + * @type string $_end_template_file |
|
46 | + * @type array $_template_args |
|
47 | + * } |
|
48 | + */ |
|
49 | + public function __construct($template_options = array()) |
|
50 | + { |
|
51 | + // loop through incoming options |
|
52 | + foreach ($template_options as $key => $value) { |
|
53 | + // add underscore to $key to match property names |
|
54 | + $_key = '_' . $key; |
|
55 | + if (property_exists($this, $_key)) { |
|
56 | + $this->{$_key} = $value; |
|
57 | + } |
|
58 | + } |
|
59 | + parent::__construct(); |
|
60 | + } |
|
61 | + |
|
62 | + |
|
63 | + |
|
64 | + /** |
|
65 | + * Also has the side effect of enqueuing any needed JS and CSS for |
|
66 | + * this form. |
|
67 | + * Creates all the HTML necessary for displaying this form, its inputs, and |
|
68 | + * proper subsections. |
|
69 | + * Returns the HTML |
|
70 | + * |
|
71 | + * @return string |
|
72 | + */ |
|
73 | + public function layout_form() |
|
74 | + { |
|
75 | + if ($this->_layout_template_file) { |
|
76 | + return EEH_Template::locate_template($this->_layout_template_file, $this->template_args(), true, true); |
|
77 | + } else { |
|
78 | + return parent::layout_form(); |
|
79 | + } |
|
80 | + } |
|
81 | + |
|
82 | + |
|
83 | + |
|
84 | + /** |
|
85 | + * opening div tag for a form |
|
86 | + * |
|
87 | + * @return string |
|
88 | + */ |
|
89 | + public function layout_form_begin() |
|
90 | + { |
|
91 | + if ($this->_layout_begin_template_file) { |
|
92 | + return EEH_Template::locate_template( |
|
93 | + $this->_layout_begin_template_file, |
|
94 | + $this->template_args(), |
|
95 | + true, |
|
96 | + true |
|
97 | + ); |
|
98 | + } else { |
|
99 | + return parent::layout_form_begin(); |
|
100 | + } |
|
101 | + } |
|
102 | + |
|
103 | + |
|
104 | + |
|
105 | + /** |
|
106 | + * If an input_template_file was provided upon construction, uses that to layout the input. Otherwise uses parent. |
|
107 | + * |
|
108 | + * @see EE_DIv_Per_Section_Layout::layout_input() for documentation |
|
109 | + * @param EE_Form_Input_Base $input |
|
110 | + * @return string |
|
111 | + */ |
|
112 | + public function layout_input($input) |
|
113 | + { |
|
114 | + if ($this->_input_template_file) { |
|
115 | + return EEH_Template::locate_template($this->_input_template_file, array('input' => $input), true, true); |
|
116 | + } |
|
117 | + return parent::layout_input($input); |
|
118 | + } |
|
119 | + |
|
120 | + |
|
121 | + |
|
122 | + /** |
|
123 | + * If a subsection_template_file was provided upon construction, uses that to layout the subsection. Otherwise uses parent. |
|
124 | + * |
|
125 | + * @see EE_Div_Per_Section_Layout::layout_subsection() for documentation |
|
126 | + * @param EE_Form_Section_Proper $form_section |
|
127 | + * @return string |
|
128 | + */ |
|
129 | + public function layout_subsection($form_section) |
|
130 | + { |
|
131 | + if ($this->_subsection_template_file) { |
|
132 | + return EEH_Template::locate_template($this->_subsection_template_file, $this->template_args(), true, true); |
|
133 | + } |
|
134 | + return parent::layout_subsection($form_section); |
|
135 | + } |
|
136 | + |
|
137 | + |
|
138 | + |
|
139 | + /** |
|
140 | + * closing div tag for a form |
|
141 | + * |
|
142 | + * @return string |
|
143 | + */ |
|
144 | + public function layout_form_end() |
|
145 | + { |
|
146 | + if ($this->_layout_end_template_file) { |
|
147 | + return EEH_Template::locate_template($this->_layout_end_template_file, $this->template_args(), true, true); |
|
148 | + } else { |
|
149 | + return parent::layout_form_end(); |
|
150 | + } |
|
151 | + } |
|
152 | + |
|
153 | + |
|
154 | + |
|
155 | + /** |
|
156 | + * @param array $template_args |
|
157 | + */ |
|
158 | + public function set_template_args($template_args = array()) |
|
159 | + { |
|
160 | + $this->_template_args = $template_args; |
|
161 | + } |
|
162 | + |
|
163 | + |
|
164 | + |
|
165 | + /** |
|
166 | + * @param array $template_args |
|
167 | + */ |
|
168 | + public function add_template_args($template_args = array()) |
|
169 | + { |
|
170 | + $this->_template_args = array_merge_recursive($this->_template_args, $template_args); |
|
171 | + } |
|
172 | + |
|
173 | + |
|
174 | + |
|
175 | + /** |
|
176 | + * @return array |
|
177 | + */ |
|
178 | + public function template_args() |
|
179 | + { |
|
180 | + foreach ($this->form_section()->subsections() as $subsection_name => $subsection) { |
|
181 | + $subsection_name = self::prep_form_subsection_key_name($subsection_name); |
|
182 | + if (strpos($subsection_name, '[') !== false) { |
|
183 | + $sub_name = explode('[', $subsection_name); |
|
184 | + $this->_template_args[ $sub_name[0] ][ rtrim($sub_name[1], ']') ] = $this->layout_subsection($subsection); |
|
185 | + } else { |
|
186 | + $this->_template_args[ $subsection_name ] = $this->layout_subsection($subsection); |
|
187 | + } |
|
188 | + } |
|
189 | + // d( $this->_template_args ); |
|
190 | + return $this->_template_args; |
|
191 | + } |
|
192 | + |
|
193 | + |
|
194 | + |
|
195 | + /** |
|
196 | + * prep_form_section_key_name |
|
197 | + * |
|
198 | + * @access public |
|
199 | + * @param string $subsection_name |
|
200 | + * @return string |
|
201 | + */ |
|
202 | + public static function prep_form_subsection_key_name($subsection_name = '') |
|
203 | + { |
|
204 | + $subsection_name = str_replace(array('-', ' '), array('', '_'), $subsection_name); |
|
205 | + return is_numeric(substr($subsection_name, 0, 1)) ? 'form_' . $subsection_name : $subsection_name; |
|
206 | + } |
|
207 | + |
|
208 | + |
|
209 | + |
|
210 | + /** |
|
211 | + * get_subform - just a wrapper for the above method |
|
212 | + * |
|
213 | + * @access public |
|
214 | + * @param string $subsection_name |
|
215 | + * @return string |
|
216 | + */ |
|
217 | + public static function get_subform_name($subsection_name = '') |
|
218 | + { |
|
219 | + return EE_Template_Layout::prep_form_subsection_key_name($subsection_name); |
|
220 | + } |
|
221 | 221 | } |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | public function __construct($options = array()) |
37 | 37 | { |
38 | 38 | foreach ($options as $key => $value) { |
39 | - $key = '_' . $key; |
|
39 | + $key = '_'.$key; |
|
40 | 40 | if (property_exists($this, $key)) { |
41 | 41 | $this->{$key} = $value; |
42 | 42 | } |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | . '" style="' |
61 | 61 | . $this->_form_section->html_style() |
62 | 62 | . '">'; |
63 | - $html .= '<legend class="' . $this->legend_class() . '">' . $this->legend_text() . '</legend>'; |
|
63 | + $html .= '<legend class="'.$this->legend_class().'">'.$this->legend_text().'</legend>'; |
|
64 | 64 | return $html; |
65 | 65 | } |
66 | 66 | |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | */ |
74 | 74 | public function layout_form_end() |
75 | 75 | { |
76 | - return EEH_HTML::nl(-1) . '</fieldset>'; |
|
76 | + return EEH_HTML::nl(-1).'</fieldset>'; |
|
77 | 77 | } |
78 | 78 | |
79 | 79 |
@@ -11,107 +11,107 @@ |
||
11 | 11 | */ |
12 | 12 | class EE_Fieldset_Section_Layout extends EE_Div_Per_Section_Layout |
13 | 13 | { |
14 | - /** |
|
15 | - * legend_class |
|
16 | - * |
|
17 | - * @var string |
|
18 | - */ |
|
19 | - protected $_legend_class; |
|
20 | - |
|
21 | - /** |
|
22 | - * legend_text |
|
23 | - * |
|
24 | - * @var string |
|
25 | - */ |
|
26 | - protected $_legend_text; |
|
27 | - |
|
28 | - |
|
29 | - |
|
30 | - /** |
|
31 | - * construct |
|
32 | - * |
|
33 | - * @param array $options |
|
34 | - */ |
|
35 | - public function __construct($options = array()) |
|
36 | - { |
|
37 | - foreach ($options as $key => $value) { |
|
38 | - $key = '_' . $key; |
|
39 | - if (property_exists($this, $key)) { |
|
40 | - $this->{$key} = $value; |
|
41 | - } |
|
42 | - } |
|
43 | - } |
|
44 | - |
|
45 | - |
|
46 | - |
|
47 | - /** |
|
48 | - * opening div tag for a form |
|
49 | - * |
|
50 | - * @return string |
|
51 | - */ |
|
52 | - public function layout_form_begin() |
|
53 | - { |
|
54 | - $html = EEH_HTML::nl(1) |
|
55 | - . '<fieldset id="' |
|
56 | - . $this->_form_section->html_id() |
|
57 | - . '" class="' |
|
58 | - . $this->_form_section->html_class() |
|
59 | - . '" style="' |
|
60 | - . $this->_form_section->html_style() |
|
61 | - . '">'; |
|
62 | - $html .= '<legend class="' . $this->legend_class() . '">' . $this->legend_text() . '</legend>'; |
|
63 | - return $html; |
|
64 | - } |
|
65 | - |
|
66 | - |
|
67 | - |
|
68 | - /** |
|
69 | - * closing div tag for a form |
|
70 | - * |
|
71 | - * @return string |
|
72 | - */ |
|
73 | - public function layout_form_end() |
|
74 | - { |
|
75 | - return EEH_HTML::nl(-1) . '</fieldset>'; |
|
76 | - } |
|
77 | - |
|
78 | - |
|
79 | - |
|
80 | - /** |
|
81 | - * @param string $legend_class |
|
82 | - */ |
|
83 | - public function set_legend_class($legend_class) |
|
84 | - { |
|
85 | - $this->_legend_class = $legend_class; |
|
86 | - } |
|
87 | - |
|
88 | - |
|
89 | - |
|
90 | - /** |
|
91 | - * @return string |
|
92 | - */ |
|
93 | - public function legend_class() |
|
94 | - { |
|
95 | - return $this->_legend_class; |
|
96 | - } |
|
97 | - |
|
98 | - |
|
99 | - |
|
100 | - /** |
|
101 | - * @param string $legend_text |
|
102 | - */ |
|
103 | - public function set_legend_text($legend_text) |
|
104 | - { |
|
105 | - $this->_legend_text = $legend_text; |
|
106 | - } |
|
107 | - |
|
108 | - |
|
109 | - |
|
110 | - /** |
|
111 | - * @return string |
|
112 | - */ |
|
113 | - public function legend_text() |
|
114 | - { |
|
115 | - return $this->_legend_text; |
|
116 | - } |
|
14 | + /** |
|
15 | + * legend_class |
|
16 | + * |
|
17 | + * @var string |
|
18 | + */ |
|
19 | + protected $_legend_class; |
|
20 | + |
|
21 | + /** |
|
22 | + * legend_text |
|
23 | + * |
|
24 | + * @var string |
|
25 | + */ |
|
26 | + protected $_legend_text; |
|
27 | + |
|
28 | + |
|
29 | + |
|
30 | + /** |
|
31 | + * construct |
|
32 | + * |
|
33 | + * @param array $options |
|
34 | + */ |
|
35 | + public function __construct($options = array()) |
|
36 | + { |
|
37 | + foreach ($options as $key => $value) { |
|
38 | + $key = '_' . $key; |
|
39 | + if (property_exists($this, $key)) { |
|
40 | + $this->{$key} = $value; |
|
41 | + } |
|
42 | + } |
|
43 | + } |
|
44 | + |
|
45 | + |
|
46 | + |
|
47 | + /** |
|
48 | + * opening div tag for a form |
|
49 | + * |
|
50 | + * @return string |
|
51 | + */ |
|
52 | + public function layout_form_begin() |
|
53 | + { |
|
54 | + $html = EEH_HTML::nl(1) |
|
55 | + . '<fieldset id="' |
|
56 | + . $this->_form_section->html_id() |
|
57 | + . '" class="' |
|
58 | + . $this->_form_section->html_class() |
|
59 | + . '" style="' |
|
60 | + . $this->_form_section->html_style() |
|
61 | + . '">'; |
|
62 | + $html .= '<legend class="' . $this->legend_class() . '">' . $this->legend_text() . '</legend>'; |
|
63 | + return $html; |
|
64 | + } |
|
65 | + |
|
66 | + |
|
67 | + |
|
68 | + /** |
|
69 | + * closing div tag for a form |
|
70 | + * |
|
71 | + * @return string |
|
72 | + */ |
|
73 | + public function layout_form_end() |
|
74 | + { |
|
75 | + return EEH_HTML::nl(-1) . '</fieldset>'; |
|
76 | + } |
|
77 | + |
|
78 | + |
|
79 | + |
|
80 | + /** |
|
81 | + * @param string $legend_class |
|
82 | + */ |
|
83 | + public function set_legend_class($legend_class) |
|
84 | + { |
|
85 | + $this->_legend_class = $legend_class; |
|
86 | + } |
|
87 | + |
|
88 | + |
|
89 | + |
|
90 | + /** |
|
91 | + * @return string |
|
92 | + */ |
|
93 | + public function legend_class() |
|
94 | + { |
|
95 | + return $this->_legend_class; |
|
96 | + } |
|
97 | + |
|
98 | + |
|
99 | + |
|
100 | + /** |
|
101 | + * @param string $legend_text |
|
102 | + */ |
|
103 | + public function set_legend_text($legend_text) |
|
104 | + { |
|
105 | + $this->_legend_text = $legend_text; |
|
106 | + } |
|
107 | + |
|
108 | + |
|
109 | + |
|
110 | + /** |
|
111 | + * @return string |
|
112 | + */ |
|
113 | + public function legend_text() |
|
114 | + { |
|
115 | + return $this->_legend_text; |
|
116 | + } |
|
117 | 117 | } |
@@ -14,9 +14,9 @@ discard block |
||
14 | 14 | return EEH_HTML::table( |
15 | 15 | '', |
16 | 16 | $this->_form_section->html_id(), |
17 | - $this->_form_section->html_class() . ' form-table', |
|
17 | + $this->_form_section->html_class().' form-table', |
|
18 | 18 | $this->_form_section->html_style() |
19 | - ) . EEH_HTML::tbody(); |
|
19 | + ).EEH_HTML::tbody(); |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | */ |
29 | 29 | public function layout_form_end($additional_args = array()) |
30 | 30 | { |
31 | - return EEH_HTML::tbodyx() . EEH_HTML::tablex($this->_form_section->html_id()); |
|
31 | + return EEH_HTML::tbodyx().EEH_HTML::tablex($this->_form_section->html_id()); |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | |
@@ -45,15 +45,15 @@ discard block |
||
45 | 45 | || $input->get_display_strategy() instanceof EE_Text_Input_Display_Strategy |
46 | 46 | || $input->get_display_strategy() instanceof EE_Admin_File_Uploader_Display_Strategy |
47 | 47 | ) { |
48 | - $input->set_html_class($input->html_class() . ' large-text'); |
|
48 | + $input->set_html_class($input->html_class().' large-text'); |
|
49 | 49 | } |
50 | 50 | $input_html = $input->get_html_for_input(); |
51 | 51 | // maybe add errors and help text ? |
52 | 52 | $input_html .= $input->get_html_for_errors() !== '' |
53 | - ? EEH_HTML::nl() . $input->get_html_for_errors() |
|
53 | + ? EEH_HTML::nl().$input->get_html_for_errors() |
|
54 | 54 | : ''; |
55 | 55 | $input_html .= $input->get_html_for_help() !== '' |
56 | - ? EEH_HTML::nl() . $input->get_html_for_help() |
|
56 | + ? EEH_HTML::nl().$input->get_html_for_help() |
|
57 | 57 | : ''; |
58 | 58 | // overriding parent to add wp admin specific things. |
59 | 59 | $html = ''; |
@@ -3,90 +3,90 @@ |
||
3 | 3 | class EE_Admin_One_Column_Layout extends EE_Form_Section_Layout_Base |
4 | 4 | { |
5 | 5 | |
6 | - /** |
|
7 | - * Starts the form section |
|
8 | - * |
|
9 | - * @param array $additional_args |
|
10 | - * @return string |
|
11 | - */ |
|
12 | - public function layout_form_begin($additional_args = array()) |
|
13 | - { |
|
14 | - return EEH_HTML::table( |
|
15 | - '', |
|
16 | - $this->_form_section->html_id(), |
|
17 | - $this->_form_section->html_class() . ' form-table', |
|
18 | - $this->_form_section->html_style() |
|
19 | - ) . EEH_HTML::tbody(); |
|
20 | - } |
|
6 | + /** |
|
7 | + * Starts the form section |
|
8 | + * |
|
9 | + * @param array $additional_args |
|
10 | + * @return string |
|
11 | + */ |
|
12 | + public function layout_form_begin($additional_args = array()) |
|
13 | + { |
|
14 | + return EEH_HTML::table( |
|
15 | + '', |
|
16 | + $this->_form_section->html_id(), |
|
17 | + $this->_form_section->html_class() . ' form-table', |
|
18 | + $this->_form_section->html_style() |
|
19 | + ) . EEH_HTML::tbody(); |
|
20 | + } |
|
21 | 21 | |
22 | 22 | |
23 | - /** |
|
24 | - * Ends the form section |
|
25 | - * |
|
26 | - * @param array $additional_args |
|
27 | - * @return string |
|
28 | - */ |
|
29 | - public function layout_form_end($additional_args = array()) |
|
30 | - { |
|
31 | - return EEH_HTML::tbodyx() . EEH_HTML::tablex($this->_form_section->html_id()); |
|
32 | - } |
|
23 | + /** |
|
24 | + * Ends the form section |
|
25 | + * |
|
26 | + * @param array $additional_args |
|
27 | + * @return string |
|
28 | + */ |
|
29 | + public function layout_form_end($additional_args = array()) |
|
30 | + { |
|
31 | + return EEH_HTML::tbodyx() . EEH_HTML::tablex($this->_form_section->html_id()); |
|
32 | + } |
|
33 | 33 | |
34 | 34 | |
35 | - /** |
|
36 | - * Lays out the row for the input, including label and errors |
|
37 | - * |
|
38 | - * @param EE_Form_Input_Base $input |
|
39 | - * @return string |
|
40 | - * @throws EE_Error |
|
41 | - */ |
|
42 | - public function layout_input($input) |
|
43 | - { |
|
44 | - if ( |
|
45 | - $input->get_display_strategy() instanceof EE_Text_Area_Display_Strategy |
|
46 | - || $input->get_display_strategy() instanceof EE_Text_Input_Display_Strategy |
|
47 | - || $input->get_display_strategy() instanceof EE_Admin_File_Uploader_Display_Strategy |
|
48 | - ) { |
|
49 | - $input->set_html_class($input->html_class() . ' large-text'); |
|
50 | - } |
|
51 | - $input_html = $input->get_html_for_input(); |
|
52 | - // maybe add errors and help text ? |
|
53 | - $input_html .= $input->get_html_for_errors() !== '' |
|
54 | - ? EEH_HTML::nl() . $input->get_html_for_errors() |
|
55 | - : ''; |
|
56 | - $input_html .= $input->get_html_for_help() !== '' |
|
57 | - ? EEH_HTML::nl() . $input->get_html_for_help() |
|
58 | - : ''; |
|
59 | - // overriding parent to add wp admin specific things. |
|
60 | - $html = ''; |
|
61 | - if ($input instanceof EE_Hidden_Input) { |
|
62 | - $html .= EEH_HTML::no_row($input->get_html_for_input()); |
|
63 | - } else { |
|
64 | - $html .= EEH_HTML::tr( |
|
65 | - EEH_HTML::td( |
|
66 | - $input->get_html_for_label() |
|
67 | - . EEH_HTML::nl() |
|
68 | - . $input_html |
|
69 | - ) |
|
70 | - ); |
|
71 | - } |
|
72 | - return $html; |
|
73 | - } |
|
35 | + /** |
|
36 | + * Lays out the row for the input, including label and errors |
|
37 | + * |
|
38 | + * @param EE_Form_Input_Base $input |
|
39 | + * @return string |
|
40 | + * @throws EE_Error |
|
41 | + */ |
|
42 | + public function layout_input($input) |
|
43 | + { |
|
44 | + if ( |
|
45 | + $input->get_display_strategy() instanceof EE_Text_Area_Display_Strategy |
|
46 | + || $input->get_display_strategy() instanceof EE_Text_Input_Display_Strategy |
|
47 | + || $input->get_display_strategy() instanceof EE_Admin_File_Uploader_Display_Strategy |
|
48 | + ) { |
|
49 | + $input->set_html_class($input->html_class() . ' large-text'); |
|
50 | + } |
|
51 | + $input_html = $input->get_html_for_input(); |
|
52 | + // maybe add errors and help text ? |
|
53 | + $input_html .= $input->get_html_for_errors() !== '' |
|
54 | + ? EEH_HTML::nl() . $input->get_html_for_errors() |
|
55 | + : ''; |
|
56 | + $input_html .= $input->get_html_for_help() !== '' |
|
57 | + ? EEH_HTML::nl() . $input->get_html_for_help() |
|
58 | + : ''; |
|
59 | + // overriding parent to add wp admin specific things. |
|
60 | + $html = ''; |
|
61 | + if ($input instanceof EE_Hidden_Input) { |
|
62 | + $html .= EEH_HTML::no_row($input->get_html_for_input()); |
|
63 | + } else { |
|
64 | + $html .= EEH_HTML::tr( |
|
65 | + EEH_HTML::td( |
|
66 | + $input->get_html_for_label() |
|
67 | + . EEH_HTML::nl() |
|
68 | + . $input_html |
|
69 | + ) |
|
70 | + ); |
|
71 | + } |
|
72 | + return $html; |
|
73 | + } |
|
74 | 74 | |
75 | 75 | |
76 | - /** |
|
77 | - * Lays out a row for the subsection |
|
78 | - * |
|
79 | - * @param EE_Form_Section_Proper $form_section |
|
80 | - * @return string |
|
81 | - */ |
|
82 | - public function layout_subsection($form_section) |
|
83 | - { |
|
84 | - if ( |
|
85 | - $form_section instanceof EE_Form_Section_Proper |
|
86 | - || $form_section instanceof EE_Form_Section_HTML |
|
87 | - ) { |
|
88 | - return EEH_HTML::no_row($form_section->get_html()); |
|
89 | - } |
|
90 | - return ''; |
|
91 | - } |
|
76 | + /** |
|
77 | + * Lays out a row for the subsection |
|
78 | + * |
|
79 | + * @param EE_Form_Section_Proper $form_section |
|
80 | + * @return string |
|
81 | + */ |
|
82 | + public function layout_subsection($form_section) |
|
83 | + { |
|
84 | + if ( |
|
85 | + $form_section instanceof EE_Form_Section_Proper |
|
86 | + || $form_section instanceof EE_Form_Section_HTML |
|
87 | + ) { |
|
88 | + return EEH_HTML::no_row($form_section->get_html()); |
|
89 | + } |
|
90 | + return ''; |
|
91 | + } |
|
92 | 92 | } |
@@ -13,58 +13,58 @@ |
||
13 | 13 | */ |
14 | 14 | class EE_Many_Valued_Validation_Strategy extends EE_Validation_Strategy_Base |
15 | 15 | { |
16 | - protected $_individual_item_validation_strategies = array(); |
|
17 | - /** |
|
18 | - * |
|
19 | - * @param EE_Validation_Strategy_Base[] $individual_item_validation_strategies (or a single EE_Validation_Strategy_Base) |
|
20 | - */ |
|
21 | - public function __construct($individual_item_validation_strategies) |
|
22 | - { |
|
23 | - if (! is_array($individual_item_validation_strategies)) { |
|
24 | - $individual_item_validation_strategies = array($individual_item_validation_strategies); |
|
25 | - } |
|
26 | - $this->_individual_item_validation_strategies = $individual_item_validation_strategies; |
|
27 | - parent::__construct(); |
|
28 | - } |
|
16 | + protected $_individual_item_validation_strategies = array(); |
|
17 | + /** |
|
18 | + * |
|
19 | + * @param EE_Validation_Strategy_Base[] $individual_item_validation_strategies (or a single EE_Validation_Strategy_Base) |
|
20 | + */ |
|
21 | + public function __construct($individual_item_validation_strategies) |
|
22 | + { |
|
23 | + if (! is_array($individual_item_validation_strategies)) { |
|
24 | + $individual_item_validation_strategies = array($individual_item_validation_strategies); |
|
25 | + } |
|
26 | + $this->_individual_item_validation_strategies = $individual_item_validation_strategies; |
|
27 | + parent::__construct(); |
|
28 | + } |
|
29 | 29 | |
30 | 30 | |
31 | 31 | |
32 | - /** |
|
33 | - * Applies all teh individual item validation strategies on each item in the array |
|
34 | - * @param array $normalized_value |
|
35 | - * @return boolean |
|
36 | - */ |
|
37 | - public function validate($normalized_value) |
|
38 | - { |
|
39 | - if (is_array($normalized_value)) { |
|
40 | - $items_to_validate = $normalized_value; |
|
41 | - } else { |
|
42 | - $items_to_validate = array($normalized_value); |
|
43 | - } |
|
44 | - foreach ($items_to_validate as $individual_item) { |
|
45 | - foreach ($this->_individual_item_validation_strategies as $validation_strategy) { |
|
46 | - if ($validation_strategy instanceof EE_Validation_Strategy_Base) { |
|
47 | - $validation_strategy->validate($individual_item); |
|
48 | - } |
|
49 | - } |
|
50 | - } |
|
51 | - return true; |
|
52 | - } |
|
32 | + /** |
|
33 | + * Applies all teh individual item validation strategies on each item in the array |
|
34 | + * @param array $normalized_value |
|
35 | + * @return boolean |
|
36 | + */ |
|
37 | + public function validate($normalized_value) |
|
38 | + { |
|
39 | + if (is_array($normalized_value)) { |
|
40 | + $items_to_validate = $normalized_value; |
|
41 | + } else { |
|
42 | + $items_to_validate = array($normalized_value); |
|
43 | + } |
|
44 | + foreach ($items_to_validate as $individual_item) { |
|
45 | + foreach ($this->_individual_item_validation_strategies as $validation_strategy) { |
|
46 | + if ($validation_strategy instanceof EE_Validation_Strategy_Base) { |
|
47 | + $validation_strategy->validate($individual_item); |
|
48 | + } |
|
49 | + } |
|
50 | + } |
|
51 | + return true; |
|
52 | + } |
|
53 | 53 | |
54 | 54 | |
55 | 55 | |
56 | - /** |
|
57 | - * Extends parent's _construct_finalize so we ALSO set the input |
|
58 | - * on each sub-validation-strategy |
|
59 | - * @param \EE_Form_Input_Base $form_input |
|
60 | - */ |
|
61 | - public function _construct_finalize(\EE_Form_Input_Base $form_input) |
|
62 | - { |
|
63 | - parent::_construct_finalize($form_input); |
|
64 | - foreach ($this->_individual_item_validation_strategies as $item_validation_strategy) { |
|
65 | - if ($item_validation_strategy instanceof EE_Validation_Strategy_Base) { |
|
66 | - $item_validation_strategy->_construct_finalize($form_input); |
|
67 | - } |
|
68 | - } |
|
69 | - } |
|
56 | + /** |
|
57 | + * Extends parent's _construct_finalize so we ALSO set the input |
|
58 | + * on each sub-validation-strategy |
|
59 | + * @param \EE_Form_Input_Base $form_input |
|
60 | + */ |
|
61 | + public function _construct_finalize(\EE_Form_Input_Base $form_input) |
|
62 | + { |
|
63 | + parent::_construct_finalize($form_input); |
|
64 | + foreach ($this->_individual_item_validation_strategies as $item_validation_strategy) { |
|
65 | + if ($item_validation_strategy instanceof EE_Validation_Strategy_Base) { |
|
66 | + $item_validation_strategy->_construct_finalize($form_input); |
|
67 | + } |
|
68 | + } |
|
69 | + } |
|
70 | 70 | } |
@@ -20,7 +20,7 @@ |
||
20 | 20 | */ |
21 | 21 | public function __construct($individual_item_validation_strategies) |
22 | 22 | { |
23 | - if (! is_array($individual_item_validation_strategies)) { |
|
23 | + if ( ! is_array($individual_item_validation_strategies)) { |
|
24 | 24 | $individual_item_validation_strategies = array($individual_item_validation_strategies); |
25 | 25 | } |
26 | 26 | $this->_individual_item_validation_strategies = $individual_item_validation_strategies; |
@@ -11,16 +11,16 @@ |
||
11 | 11 | */ |
12 | 12 | abstract class EE_Sensitive_Data_Removal_Base extends EE_Form_Input_Strategy_Base |
13 | 13 | { |
14 | - /** |
|
15 | - * Removes all the sensitive data from this normalized value. |
|
16 | - * For example, should could 'mask' a credit card from |
|
17 | - * '1234 1234 1234 1234' TO '**** **** **** 1234'. |
|
18 | - * Or turn a ccv number from |
|
19 | - * '123' to '***', |
|
20 | - * or turn a password from |
|
21 | - * 'CantHac7Th15' to '*************', |
|
22 | - * or just leave htevalue as-is |
|
23 | - * @return mixed |
|
24 | - */ |
|
25 | - abstract public function remove_sensitive_data($normalized_value); |
|
14 | + /** |
|
15 | + * Removes all the sensitive data from this normalized value. |
|
16 | + * For example, should could 'mask' a credit card from |
|
17 | + * '1234 1234 1234 1234' TO '**** **** **** 1234'. |
|
18 | + * Or turn a ccv number from |
|
19 | + * '123' to '***', |
|
20 | + * or turn a password from |
|
21 | + * 'CantHac7Th15' to '*************', |
|
22 | + * or just leave htevalue as-is |
|
23 | + * @return mixed |
|
24 | + */ |
|
25 | + abstract public function remove_sensitive_data($normalized_value); |
|
26 | 26 | } |
@@ -11,23 +11,23 @@ |
||
11 | 11 | */ |
12 | 12 | class EE_All_Sensitive_Data_Removal extends EE_Sensitive_Data_Removal_Base |
13 | 13 | { |
14 | - public function remove_sensitive_data($normalized_value) |
|
15 | - { |
|
16 | - switch (gettype($normalized_value)) { |
|
17 | - case "boolean": |
|
18 | - return false; |
|
19 | - case "integer": |
|
20 | - case "double": |
|
21 | - return 0; |
|
22 | - case "string": |
|
23 | - return ''; |
|
24 | - case "array": |
|
25 | - return array(); |
|
26 | - case "object": |
|
27 | - case "resource": |
|
28 | - case "NULL": |
|
29 | - default: |
|
30 | - return null; |
|
31 | - } |
|
32 | - } |
|
14 | + public function remove_sensitive_data($normalized_value) |
|
15 | + { |
|
16 | + switch (gettype($normalized_value)) { |
|
17 | + case "boolean": |
|
18 | + return false; |
|
19 | + case "integer": |
|
20 | + case "double": |
|
21 | + return 0; |
|
22 | + case "string": |
|
23 | + return ''; |
|
24 | + case "array": |
|
25 | + return array(); |
|
26 | + case "object": |
|
27 | + case "resource": |
|
28 | + case "NULL": |
|
29 | + default: |
|
30 | + return null; |
|
31 | + } |
|
32 | + } |
|
33 | 33 | } |
@@ -11,8 +11,8 @@ |
||
11 | 11 | */ |
12 | 12 | class EE_No_Sensitive_Data_Removal extends EE_Sensitive_Data_Removal_Base |
13 | 13 | { |
14 | - public function remove_sensitive_data($normalized_value) |
|
15 | - { |
|
16 | - return $normalized_value; |
|
17 | - } |
|
14 | + public function remove_sensitive_data($normalized_value) |
|
15 | + { |
|
16 | + return $normalized_value; |
|
17 | + } |
|
18 | 18 | } |
@@ -11,11 +11,11 @@ |
||
11 | 11 | */ |
12 | 12 | class EE_Form_Section_HTML_From_Template extends EE_Form_Section_HTML |
13 | 13 | { |
14 | - public function __construct($template_file, $args = array(), $options_array = array()) |
|
15 | - { |
|
16 | - $html = EEH_Template::locate_template($template_file, $args); |
|
14 | + public function __construct($template_file, $args = array(), $options_array = array()) |
|
15 | + { |
|
16 | + $html = EEH_Template::locate_template($template_file, $args); |
|
17 | 17 | |
18 | 18 | // echo " filepath:$template_file html $html"; |
19 | - parent::__construct($html, $options_array); |
|
20 | - } |
|
19 | + parent::__construct($html, $options_array); |
|
20 | + } |
|
21 | 21 | } |
@@ -2,47 +2,47 @@ |
||
2 | 2 | |
3 | 3 | class EE_Validation_Error extends Exception |
4 | 4 | { |
5 | - /** |
|
6 | - * Form Section from which this error originated. |
|
7 | - * @var EE_Form_Section |
|
8 | - */ |
|
9 | - protected $_form_section; |
|
10 | - /** |
|
11 | - * a short string for uniquely identifying the error, which isn't internationalized and |
|
12 | - * machines can use to identify the error |
|
13 | - * @var string |
|
14 | - */ |
|
15 | - protected $_string_code; |
|
5 | + /** |
|
6 | + * Form Section from which this error originated. |
|
7 | + * @var EE_Form_Section |
|
8 | + */ |
|
9 | + protected $_form_section; |
|
10 | + /** |
|
11 | + * a short string for uniquely identifying the error, which isn't internationalized and |
|
12 | + * machines can use to identify the error |
|
13 | + * @var string |
|
14 | + */ |
|
15 | + protected $_string_code; |
|
16 | 16 | |
17 | - /** |
|
18 | - * When creating a validation error, we need to know which field the error relates to. |
|
19 | - * @param string $message message you want to display about this error |
|
20 | - * @param string $string_code a code for uniquely identifying the exception |
|
21 | - * @param EE_Form_Section_Validatable $form_section |
|
22 | - * @param Exception $previous if there was an exception that caused this exception |
|
23 | - */ |
|
24 | - public function __construct($message = null, $string_code = null, $form_section = null, $previous = null) |
|
25 | - { |
|
26 | - $this->_form_section = $form_section; |
|
27 | - $this->_string_code = $string_code; |
|
28 | - parent::__construct($message, 500, $previous); |
|
29 | - } |
|
17 | + /** |
|
18 | + * When creating a validation error, we need to know which field the error relates to. |
|
19 | + * @param string $message message you want to display about this error |
|
20 | + * @param string $string_code a code for uniquely identifying the exception |
|
21 | + * @param EE_Form_Section_Validatable $form_section |
|
22 | + * @param Exception $previous if there was an exception that caused this exception |
|
23 | + */ |
|
24 | + public function __construct($message = null, $string_code = null, $form_section = null, $previous = null) |
|
25 | + { |
|
26 | + $this->_form_section = $form_section; |
|
27 | + $this->_string_code = $string_code; |
|
28 | + parent::__construct($message, 500, $previous); |
|
29 | + } |
|
30 | 30 | |
31 | - /** |
|
32 | - * returns teh form section which caused the error. |
|
33 | - * @return EE_Form_Section_Validatable |
|
34 | - */ |
|
35 | - public function get_form_section() |
|
36 | - { |
|
37 | - return $this->_form_section; |
|
38 | - } |
|
39 | - /** |
|
40 | - * Sets teh form seciton of the error, in case it wasnt set previously |
|
41 | - * @param EE_Form_Section_Validatable $form_section |
|
42 | - * @return void |
|
43 | - */ |
|
44 | - public function set_form_section($form_section) |
|
45 | - { |
|
46 | - $this->_form_section = $form_section; |
|
47 | - } |
|
31 | + /** |
|
32 | + * returns teh form section which caused the error. |
|
33 | + * @return EE_Form_Section_Validatable |
|
34 | + */ |
|
35 | + public function get_form_section() |
|
36 | + { |
|
37 | + return $this->_form_section; |
|
38 | + } |
|
39 | + /** |
|
40 | + * Sets teh form seciton of the error, in case it wasnt set previously |
|
41 | + * @param EE_Form_Section_Validatable $form_section |
|
42 | + * @return void |
|
43 | + */ |
|
44 | + public function set_form_section($form_section) |
|
45 | + { |
|
46 | + $this->_form_section = $form_section; |
|
47 | + } |
|
48 | 48 | } |