1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* Admin Page Framework |
4
|
|
|
* |
5
|
|
|
* http://en.michaeluno.jp/admin-page-framework/ |
6
|
|
|
* Copyright (c) 2013-2015 Michael Uno; Licensed MIT |
7
|
|
|
* |
8
|
|
|
*/ |
9
|
|
|
|
10
|
|
|
/** |
11
|
|
|
* Provides methods to build forms. |
12
|
|
|
* |
13
|
|
|
* @package AdminPageFramework |
14
|
|
|
* @subpackage Form |
15
|
|
|
* @since DEVVER |
16
|
|
|
*/ |
17
|
|
|
class AdminPageFramework_Form_Model extends AdminPageFramework_Form_Base { |
|
|
|
|
18
|
|
|
|
19
|
|
|
/** |
20
|
|
|
* Sets up hooks. |
21
|
|
|
* @since DEVVER |
22
|
|
|
*/ |
23
|
|
|
public function __construct() { |
24
|
|
|
|
25
|
|
|
// If the passed action hook is already triggerd, it will trigger the callback right away. |
26
|
|
|
if ( $this->aArguments[ 'register_if_action_already_done' ] ) { |
27
|
|
|
$this->registerAction( |
28
|
|
|
$this->aArguments[ 'action_hook_form_registration' ], |
|
|
|
|
29
|
|
|
array( $this, '_replyToRegisterFormItems' ), |
30
|
|
|
100 // priority - low value is set as meta boxes use the `current_screen` action hook for `setUp()`. |
31
|
|
|
); |
32
|
|
|
} else { |
33
|
|
|
add_action( |
34
|
|
|
$this->aArguments[ 'action_hook_form_registration' ], |
35
|
|
|
array( $this, '_replyToRegisterFormItems' ) |
36
|
|
|
); |
37
|
|
|
} |
38
|
|
|
|
39
|
|
|
} |
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* Retrieves the submitted form data from $_POST. |
43
|
|
|
* @since DEVVER |
44
|
|
|
* @return array |
45
|
|
|
*/ |
46
|
|
|
public function getSubmittedData( array $aDataToParse, $bExtractFromFieldStructure=true, $bStripSlashes=true ) { |
47
|
|
|
|
48
|
|
|
// Extracts the form data from the subject data for parsing |
49
|
|
|
$_aSubmittedFormData = $bExtractFromFieldStructure |
50
|
|
|
? $this->castArrayContents( |
51
|
|
|
$this->getDataStructureFromAddedFieldsets(), // form data (options) structure |
52
|
|
|
$aDataToParse // the subject data array, usually $_POST. |
53
|
|
|
) |
54
|
|
|
: $aDataToParse; |
55
|
|
|
|
56
|
|
|
// 3.6.0 - sorts dynamic eleemnts. |
57
|
|
|
$_aSubmittedFormData = $this->getSortedInputs( $_aSubmittedFormData ); |
58
|
|
|
|
59
|
|
|
return $bStripSlashes |
60
|
|
|
? stripslashes_deep( $_aSubmittedFormData ) // fixes magic quotes |
61
|
|
|
: $_aSubmittedFormData; |
62
|
|
|
|
63
|
|
|
} |
64
|
|
|
|
65
|
|
|
/** |
66
|
|
|
* Sorts dynamic elements. |
67
|
|
|
* |
68
|
|
|
* The main routine which instantiates the this form calass object will call this method when they retrieve |
69
|
|
|
* the submitted form data. |
70
|
|
|
* |
71
|
|
|
* @since 3.6.0 |
72
|
|
|
* @since DEVVER Moved from `AdminPageFramework_Factory_Model`. |
73
|
|
|
* Renamed from `_getSortedInputs()`. |
74
|
|
|
* @return array The sorted input array. |
75
|
|
|
*/ |
76
|
|
|
public function getSortedInputs( array $aFormInputs ) { |
|
|
|
|
77
|
|
|
|
78
|
|
|
$_aDynamicFieldAddressKeys = array_unique( |
79
|
|
|
array_merge( |
80
|
|
|
$this->getElementAsArray( |
81
|
|
|
$_POST, |
82
|
|
|
'__repeatable_elements_' . $this->aArguments[ 'structure_type' ], |
83
|
|
|
array() |
84
|
|
|
), |
85
|
|
|
$this->getElementAsArray( |
86
|
|
|
$_POST, |
87
|
|
|
'__sortable_elements_' . $this->aArguments[ 'structure_type' ], |
88
|
|
|
array() |
89
|
|
|
) |
90
|
|
|
) |
91
|
|
|
); |
92
|
|
|
|
93
|
|
|
if ( empty( $_aDynamicFieldAddressKeys ) ) { |
94
|
|
|
return $aFormInputs; |
95
|
|
|
} |
96
|
|
|
|
97
|
|
|
$_oInputSorter = new AdminPageFramework_Form_Model___Modifier_SortInput( |
98
|
|
|
$aFormInputs, |
99
|
|
|
$_aDynamicFieldAddressKeys |
100
|
|
|
); |
101
|
|
|
return $_oInputSorter->get(); |
102
|
|
|
|
103
|
|
|
} |
104
|
|
|
|
105
|
|
|
/** |
106
|
|
|
* Returns a fields model array that represents the structure of the array of saving data from the given fields definition array. |
107
|
|
|
* |
108
|
|
|
* The passed fields array should be structured like the following. This is used for page meta boxes. |
109
|
|
|
* <code> |
110
|
|
|
* array( |
111
|
|
|
* '_default' => array( // _default is reserved for the system. |
112
|
|
|
* 'my_field_id' => array( .... ), |
113
|
|
|
* 'my_field_id2' => array( .... ), |
114
|
|
|
* ), |
115
|
|
|
* 'my_secion_id' => array( |
116
|
|
|
* 'my_field_id' => array( ... ), |
117
|
|
|
* 'my_field_id2' => array( ... ), |
118
|
|
|
* 'my_field_id3' => array( ... ), |
119
|
|
|
* |
120
|
|
|
* ), |
121
|
|
|
* 'my_section_id2' => array( |
122
|
|
|
* 'my_field_id' => array( ... ), |
123
|
|
|
* ), |
124
|
|
|
* ... |
125
|
|
|
* ) |
126
|
|
|
* </code> |
127
|
|
|
* It will be converted to |
128
|
|
|
* <code> |
129
|
|
|
* array( |
130
|
|
|
* 'my_field_id' => array( .... ), |
131
|
|
|
* 'my_field_id2' => array( .... ), |
132
|
|
|
* 'my_secion_id' => array( |
133
|
|
|
* 'my_field_id' => array( ... ), |
134
|
|
|
* 'my_field_id2' => array( ... ), |
135
|
|
|
* 'my_field_id3' => array( ... ), |
136
|
|
|
* |
137
|
|
|
* ), |
138
|
|
|
* 'my_section_id2' => array( |
139
|
|
|
* 'my_field_id' => array( ... ), |
140
|
|
|
* ), |
141
|
|
|
* ... |
142
|
|
|
* ) |
143
|
|
|
* </code> |
144
|
|
|
* @remark Just the `_default` section elements get extracted to the upper dimension. |
145
|
|
|
* @since 3.0.0 |
146
|
|
|
* @since DEVVER Moved from `AdminPageFramework_FormDefinition_Base`. |
147
|
|
|
* Changed the name from `getFieldsModel()`. |
148
|
|
|
* @return array |
149
|
|
|
*/ |
150
|
|
|
public function getDataStructureFromAddedFieldsets() { |
151
|
|
|
|
152
|
|
|
$_aFormDataStructure = array(); |
153
|
|
|
foreach ( $this->getAsArray( $this->aFieldsets ) as $_sSectionID => $_aFieldsets ) { |
|
|
|
|
154
|
|
|
|
155
|
|
|
if ( $_sSectionID != '_default' ) { |
156
|
|
|
$_aFormDataStructure[ $_sSectionID ] = $_aFieldsets; |
157
|
|
|
continue; |
158
|
|
|
} |
159
|
|
|
|
160
|
|
|
// For default field items. |
161
|
|
|
foreach( $_aFieldsets as $_sFieldID => $_aFieldset ) { |
162
|
|
|
$_aFormDataStructure[ $_aFieldset[ 'field_id' ] ] = $_aFieldset; |
163
|
|
|
} |
164
|
|
|
|
165
|
|
|
} |
166
|
|
|
return $_aFormDataStructure; |
167
|
|
|
|
168
|
|
|
} |
169
|
|
|
|
170
|
|
|
/** |
171
|
|
|
* Drops repeatable section and field elements from the given array. |
172
|
|
|
* |
173
|
|
|
* This is used in the filtering method that merges user input data with the saved options. If the user input data includes repeatable sections |
174
|
|
|
* and the user removed some elements, then the corresponding elements also need to be removed from the options array. Otherwise, the user's removing element |
175
|
|
|
* remains in the saved option array as the framework performs recursive array merge. |
176
|
|
|
* |
177
|
|
|
* @remark The options array structure is slightly different from the fields array. An options array does not have '_default' section keys. |
178
|
|
|
* @remark If the user capability is insufficient to display the element, it should not be removed because the element(field/section) itself is not submitted and |
179
|
|
|
* if the merging saved options array misses the element(which this method is going to deal with), the element will be gone forever. |
180
|
|
|
* @remark This method MUST be called after formatting the form elements because this checks the set user capability. |
181
|
|
|
* @since 3.0.0 |
182
|
|
|
* @since 3.1.1 Made it not remove the repeatable elements if the user capability is insufficient. |
183
|
|
|
* @since 3.6.2 Changed the mechanism to detect repeatable elements. |
184
|
|
|
* @since DEVVER Moved from `AdminPageFramework_FormDefinition_Base`. |
185
|
|
|
* @param array $aSubject The subject array to modify. Usually the saved option data. |
186
|
|
|
* @return array The modified options array. |
187
|
|
|
*/ |
188
|
|
|
public function dropRepeatableElements( array $aSubject ) { |
|
|
|
|
189
|
|
|
$_oFilterRepeatableElements = new AdminPageFramework_Form_Model___Modifier_FilterRepeatableElements( |
190
|
|
|
$aSubject, |
191
|
|
|
$this->getElementAsArray( |
192
|
|
|
$_POST, |
193
|
|
|
'__repeatable_elements_' . $this->aArguments[ 'structure_type' ] |
194
|
|
|
) |
195
|
|
|
); |
196
|
|
|
return $_oFilterRepeatableElements->get(); |
197
|
|
|
} |
198
|
|
|
|
199
|
|
|
/** |
200
|
|
|
* @callback action 'current_screen' by default but it depends on the factory class. |
201
|
|
|
* @since DEVVERs |
202
|
|
|
*/ |
203
|
|
|
public function _replyToRegisterFormItems( /* $oScreen */ ) { |
204
|
|
|
|
205
|
|
|
// Check if the form should be created or not. |
206
|
|
|
if ( ! $this->isInThePage() ) { |
207
|
|
|
return; |
208
|
|
|
} |
209
|
|
|
|
210
|
|
|
// Load field type definitions. |
211
|
|
|
$this->_setFieldTypeDefinitions(); |
212
|
|
|
|
213
|
|
|
// Set the options array |
214
|
|
|
$this->aSavedData = $this->_getSavedData( |
|
|
|
|
215
|
|
|
// Merge with the set property and the generated default valus. |
216
|
|
|
// This allows external routines to set custom default values prior to the field registration. |
217
|
|
|
$this->aSavedData + $this->getDefaultFormValues() |
218
|
|
|
); |
219
|
|
|
|
220
|
|
|
/** |
221
|
|
|
* Call backs registered functions before loading field resources. |
222
|
|
|
* The `$this->aSavedData` property should be set because it is passed to the validation callback. |
223
|
|
|
* Note that in each main routine, it may not be necessary to set this value as they have own validation callback and not necessarily |
224
|
|
|
* need saved data at this point, such as the taxonomy factory. |
225
|
|
|
*/ |
226
|
|
|
$this->_handleCallbacks(); |
227
|
|
|
|
228
|
|
|
// Do not bail even if there is no added field because there can be any externally added fields including page meta boxes. |
229
|
|
|
// And the validation callback below needs to be triggered. |
230
|
|
|
// if ( empty( $this->aFieldsets ) ) { |
|
|
|
|
231
|
|
|
// return; |
232
|
|
|
// } |
233
|
|
|
|
234
|
|
|
// Set field resources (assets) such as javascripts and stylesheets. |
235
|
|
|
$_oFieldResources = new AdminPageFramework_Form_Model___SetFieldResources( |
236
|
|
|
$this->aArguments, |
237
|
|
|
$this->aFieldsets, |
238
|
|
|
self::$_aResources, |
239
|
|
|
$this->aFieldTypeDefinitions, // must be called after performing `_setFieldTypeDefinitions()`. |
|
|
|
|
240
|
|
|
$this->aCallbacks |
|
|
|
|
241
|
|
|
); |
242
|
|
|
self::$_aResources = $_oFieldResources->get(); // updates the property |
243
|
|
|
|
244
|
|
|
/** |
245
|
|
|
* Call back a validation routine. |
246
|
|
|
* |
247
|
|
|
* The routines of validation and saving data is not the scope this form class |
248
|
|
|
* as each main routine has own timing and predetermined callbacks for validation. |
249
|
|
|
* |
250
|
|
|
* Also this must be done after the resources are set because there is a callback for |
251
|
|
|
* field registration and custom field types uses that hook to set up custom validation routines. |
252
|
|
|
*/ |
253
|
|
|
$this->callBack( |
254
|
|
|
$this->aCallbacks[ 'handle_form_data' ], |
255
|
|
|
array( |
256
|
|
|
$this->aSavedData, // 1st parameter |
257
|
|
|
$this->aArguments, // 2nd parameter |
258
|
|
|
$this->aSectionsets, // 3rd parameter |
|
|
|
|
259
|
|
|
$this->aFieldsets, // 4th parameter |
260
|
|
|
) |
261
|
|
|
); |
262
|
|
|
|
263
|
|
|
} |
264
|
|
|
/** |
265
|
|
|
* Triggers callbacks before setting resources. |
266
|
|
|
*/ |
267
|
|
|
private function _handleCallbacks() { |
268
|
|
|
|
269
|
|
|
// Let the main routine modify the sectionsets definition array. |
270
|
|
|
$this->aSectionsets = $this->callBack( |
271
|
|
|
$this->aCallbacks[ 'secitonsets_before_registration' ], |
272
|
|
|
array( |
273
|
|
|
$this->aSectionsets, // 1st parameter |
274
|
|
|
) |
275
|
|
|
); |
276
|
|
|
// Let the main routine modify the fieldsets definition array. |
277
|
|
|
$this->aFieldsets = $this->callBack( |
278
|
|
|
$this->aCallbacks[ 'fieldsets_before_registration' ], |
279
|
|
|
array( |
280
|
|
|
$this->aFieldsets, // 1st parameter |
281
|
|
|
$this->aSectionsets, // 2nd parameter |
282
|
|
|
) |
283
|
|
|
); |
284
|
|
|
|
285
|
|
|
} |
286
|
|
|
|
287
|
|
|
/** |
288
|
|
|
* Stores the default field definitions. |
289
|
|
|
* |
290
|
|
|
* Once they are set, it no longer needs to be done. For this reason, the scope must be static. |
291
|
|
|
* |
292
|
|
|
* @since 3.1.3 |
293
|
|
|
* @since DEVVER Moved from `AdminPageFramework_Factory_Model`. |
294
|
|
|
* @internal |
295
|
|
|
*/ |
296
|
|
|
static private $_aFieldTypeDefinitions = array(); |
297
|
|
|
|
298
|
|
|
/** |
299
|
|
|
* Loads the default field type definition. |
300
|
|
|
* |
301
|
|
|
* @since 2.1.5 |
302
|
|
|
* @since 3.5.0 Changed the visibility scope to protected as it is internal. |
303
|
|
|
* Changed the name from `_loadDefaultFieldTypeDefinitions()` as it applies filters so custom field types also get registered here. |
304
|
|
|
* @since DEVVER Moved from `AdminPageFramework_Factory_Model`. Changed the visibility scope to private. |
305
|
|
|
* @internal |
306
|
|
|
*/ |
307
|
|
|
private function _setFieldTypeDefinitions() { |
308
|
|
|
|
309
|
|
|
$_sCallerID = $this->aArguments[ 'caller_id' ]; // usually a class name |
310
|
|
|
|
311
|
|
|
// This class adds filters for the field type definitions so that framework's default field types will be added. |
312
|
|
|
$_aCache = $this->getElement( self::$_aFieldTypeDefinitions, $_sCallerID ); |
313
|
|
|
|
314
|
|
|
if ( empty( $_aCache ) ) { |
315
|
|
|
$_oBuiltInFieldTypeDefinitions = new AdminPageFramework_Form_Model___BuiltInFieldTypeDefinitions( |
316
|
|
|
$_sCallerID, |
317
|
|
|
$this->oMsg |
|
|
|
|
318
|
|
|
); |
319
|
|
|
self::$_aFieldTypeDefinitions[ $_sCallerID ] = $_oBuiltInFieldTypeDefinitions->get(); |
320
|
|
|
} |
321
|
|
|
// @todo Invesitigate whether it is appropriate to apply filters per object instance basis. |
322
|
|
|
$this->aFieldTypeDefinitions = apply_filters( |
|
|
|
|
323
|
|
|
'field_types_admin_page_framework', |
324
|
|
|
self::$_aFieldTypeDefinitions[ $_sCallerID ] |
325
|
|
|
); |
326
|
|
|
|
327
|
|
|
} |
328
|
|
|
|
329
|
|
|
/** |
330
|
|
|
* @return array |
331
|
|
|
*/ |
332
|
|
|
private function _getSavedData( $aDefaultValues ) { |
|
|
|
|
333
|
|
|
|
334
|
|
|
// Retrieve the saved form data and merge with the default values. |
335
|
|
|
// Do not merge recursively here because there are field values that get messed |
336
|
|
|
// such as `select` field type with multiple options. |
337
|
|
|
$_aSavedData = $this->getAsArray( |
338
|
|
|
$this->callBack( |
339
|
|
|
$this->aCallbacks[ 'saved_data' ], |
340
|
|
|
array( |
341
|
|
|
$aDefaultValues, // default value |
342
|
|
|
) |
343
|
|
|
) |
344
|
|
|
) |
345
|
|
|
+ $aDefaultValues; |
346
|
|
|
|
347
|
|
|
$_aLastInputs = $this->getAOrB( |
348
|
|
|
$this->getElement( $_GET, 'field_errors' ) || isset( $_GET[ 'confirmation' ] ), |
349
|
|
|
$this->_getLastInputs(), |
350
|
|
|
array() |
351
|
|
|
); |
352
|
|
|
|
353
|
|
|
return $_aLastInputs + $_aSavedData; |
354
|
|
|
|
355
|
|
|
} |
356
|
|
|
/** |
357
|
|
|
* Returns the last user form input array. |
358
|
|
|
* |
359
|
|
|
* @remark This temporary data is not always set. This is only set when the form needs to show a confirmation message to the user such as for sending an email. |
360
|
|
|
* @since 3.3.0 |
361
|
|
|
* @since 3.4.1 Moved from `AdminPageFramework_Property_Page`. |
362
|
|
|
* @since DEVVER Moved from `AdminPageFramework_Property_Base`. |
363
|
|
|
* @internal |
364
|
|
|
* @return array The last user form inputs. |
365
|
|
|
*/ |
366
|
|
|
private function _getLastInputs() { |
367
|
|
|
|
368
|
|
|
$_sKey = 'apf_tfd' . md5( 'temporary_form_data_' . $this->aArguments[ 'caller_id' ] . get_current_user_id() ); |
369
|
|
|
$_vValue = $this->getTransient( $_sKey ); |
370
|
|
|
$this->deleteTransient( $_sKey ); |
371
|
|
|
if ( is_array( $_vValue ) ) { |
372
|
|
|
return $_vValue; |
373
|
|
|
} |
374
|
|
|
return array(); |
375
|
|
|
|
376
|
|
|
} |
377
|
|
|
|
378
|
|
|
/** |
379
|
|
|
* Returns the default values of all the added fields. |
380
|
|
|
* |
381
|
|
|
* Analyses the registered form elements and retrieve the default values. |
382
|
|
|
* |
383
|
|
|
* @since 3.0.0 |
384
|
|
|
* @since DEVVER Changed the name from `getDefaultOptions()`. |
385
|
|
|
* Moved from `AdminPageFramework_Property_Page`. |
386
|
|
|
* @return array An array holding default values of form data. |
387
|
|
|
*/ |
388
|
|
|
public function getDefaultFormValues() { |
389
|
|
|
$_oDefaultValues = new AdminPageFramework_Form_Model___DefaultValues( |
|
|
|
|
390
|
|
|
$this->aFieldsets |
391
|
|
|
); |
392
|
|
|
return $_oDefaultValues->get(); |
393
|
|
|
} |
394
|
|
|
|
395
|
|
|
/** |
396
|
|
|
* Formates the added section-sets and field-sets definition arrays. |
397
|
|
|
* |
398
|
|
|
* This method is called right before the form gets rendered. |
399
|
|
|
* |
400
|
|
|
* @since DEVVER |
401
|
|
|
* @param array $aSavedData |
402
|
|
|
* @param boolean $bOnlyFieldsets Whether to format only the fieldsets. The taxonomy field factory uses this parameter. |
|
|
|
|
403
|
|
|
*/ |
404
|
|
|
protected function _formatElementDefinitions( array $aSavedData ) { |
|
|
|
|
405
|
|
|
|
406
|
|
|
$_oSectionsetsFormatter = new AdminPageFramework_Form_Model___FormatSectionsets( |
407
|
|
|
$this->aSectionsets, |
408
|
|
|
$this->aArguments[ 'structure_type' ], |
409
|
|
|
$this->sCapability, |
|
|
|
|
410
|
|
|
$this->aCallbacks, |
411
|
|
|
$this // caller form object - set to the element definition array |
412
|
|
|
); |
413
|
|
|
$this->aSectionsets = $_oSectionsetsFormatter->get(); |
414
|
|
|
|
415
|
|
|
// This must be done after the section-sets are formatted. |
416
|
|
|
$_oFieldsetsFormatter = new AdminPageFramework_Form_Model___FormatFieldsets( |
417
|
|
|
$this->aFieldsets, |
418
|
|
|
$this->aSectionsets, |
419
|
|
|
$this->aArguments[ 'structure_type' ], |
420
|
|
|
$this->aSavedData, |
421
|
|
|
$this->sCapability, |
422
|
|
|
$this->aCallbacks, |
423
|
|
|
$this // caller form object - set to the element definition array |
424
|
|
|
); |
425
|
|
|
$this->aFieldsets = $_oFieldsetsFormatter->get(); |
426
|
|
|
|
427
|
|
|
} |
428
|
|
|
|
429
|
|
|
/** |
430
|
|
|
* Retrieves the settings error array set by the user in the validation callback. |
431
|
|
|
* |
432
|
|
|
* @since 3.0.4 |
433
|
|
|
* @since 3.6.3 Changed the visibility scope to public as a delegation class needs to access this method. |
434
|
|
|
* @since DEVVER Moved from `AdminPageFramework_Factory_Model`. |
435
|
|
|
* Changed the name from `_getFieldErrors()`. |
436
|
|
|
* @access public The field type class accesses this method to render nested fields. |
437
|
|
|
* @internal |
438
|
|
|
* @param boolean $bDelete whether or not the transient should be deleted after retrieving it. |
|
|
|
|
439
|
|
|
* @return array |
440
|
|
|
*/ |
441
|
|
|
public function getFieldErrors() { |
442
|
|
|
$_aErrors = $this->oFieldError->get(); |
|
|
|
|
443
|
|
|
$this->oFieldError->delete(); |
444
|
|
|
return $_aErrors; |
445
|
|
|
} |
446
|
|
|
|
447
|
|
|
/** |
448
|
|
|
* Saves user last input in the database as a transient. |
449
|
|
|
* |
450
|
|
|
* To get the set input, call `$this->oProp->aLastInput`. |
451
|
|
|
* |
452
|
|
|
* @since 3.4.1 |
453
|
|
|
* @since DEVVER Changed the name from `_setLastInput()`. |
454
|
|
|
* @since DEVVER Moved from `AdminPageFramework_Factory_Model`. |
455
|
|
|
* @return boolean True if set; otherwise, false. |
456
|
|
|
* @internal |
457
|
|
|
*/ |
458
|
|
|
public function setLastInputs( array $aLastInputs ) { |
459
|
|
|
return $this->setTransient( |
460
|
|
|
'apf_tfd' . md5( 'temporary_form_data_' . $this->aArguments[ 'caller_id' ] . get_current_user_id() ), |
461
|
|
|
$aLastInputs, |
462
|
|
|
60*60 |
463
|
|
|
); |
464
|
|
|
} |
465
|
|
|
|
466
|
|
|
} |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.