@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | */ |
170 | 170 | public function addSettingSections( /* $aSection1, $aSection2=null, $_and_more=null */ ) { |
171 | 171 | |
172 | - foreach( func_get_args() as $_asSectionset ) { |
|
172 | + foreach( func_get_args() as $_asSectionset ) { |
|
173 | 173 | $this->addSettingSection( $_asSectionset ); |
174 | 174 | } |
175 | 175 | |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | */ |
239 | 239 | public function addSettingSection( $aSectionset ) { |
240 | 240 | |
241 | - if ( ! is_array( $aSectionset ) ) { |
|
241 | + if ( ! is_array( $aSectionset ) ) { |
|
242 | 242 | return; |
243 | 243 | } |
244 | 244 | |
@@ -271,7 +271,7 @@ discard block |
||
271 | 271 | * @return void |
272 | 272 | */ |
273 | 273 | public function addSettingFields( /* $aField1, $aField2=null, $_and_more=null */ ) { |
274 | - foreach( func_get_args() as $_aFieldset ) { |
|
274 | + foreach( func_get_args() as $_aFieldset ) { |
|
275 | 275 | $this->addSettingField( $_aFieldset ); |
276 | 276 | } |
277 | 277 | } |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | * @access public |
219 | 219 | * @remark The actual registration will be performed in the `_replyToRegisterSettings()` method with the `admin_menu` hook. |
220 | 220 | * @remark The `$oForm` property should be created in each extended class. |
221 | - * @param array|string $aSection the section array. If a string is passed, it is considered as a target page slug that will be used as a page slug element from the next call so that the element can be omitted. |
|
221 | + * @param array|string $aSectionset the section array. If a string is passed, it is considered as a target page slug that will be used as a page slug element from the next call so that the element can be omitted. |
|
222 | 222 | * <h4>Section Definition Array</h4> |
223 | 223 | * <ul> |
224 | 224 | * <li>**section_id** - (string) the section ID. Avoid using non-alphabetic characters except underscore and numbers.</li> |
@@ -347,7 +347,7 @@ discard block |
||
347 | 347 | * @since 3.0.0 The scope changed to public to indicate the users will use. |
348 | 348 | * @return void |
349 | 349 | * @remark The $oForm property should be created in each extended class. |
350 | - * @param array|string $asField A field definition array or a string of the target section id. |
|
350 | + * @param array|string $asFieldset A field definition array or a string of the target section id. |
|
351 | 351 | * <h4>Built-in Field Types</h4> |
352 | 352 | * <ul> |
353 | 353 | * <li>[text](./class-AdminPageFramework_FieldType_text.html) - a normal field to enter short text input.</li> |
@@ -306,18 +306,18 @@ discard block |
||
306 | 306 | } |
307 | 307 | |
308 | 308 | /** |
309 | - * Adds form fields. |
|
310 | - * |
|
311 | - * It inserts the given field definition arrays into the class property and later they are parsed when fields are registered. The field definition array requires specific keys. Refer to the parameter section of this method. |
|
312 | - * |
|
313 | - * @since 2.0.0 |
|
314 | - * @since 3.5.3 Removed the parameter declarations as they are caught with the func_get_args(). |
|
315 | - * @remark Accepts variadic parameters; the number of accepted parameters are not limited to three. |
|
316 | - * @param array the field definition array. |
|
317 | - * @param array (optional) another field array. |
|
318 | - * @param array (optional) add more field arrays to the next parameters as many as necessary. |
|
319 | - * @return void |
|
320 | - */ |
|
309 | + * Adds form fields. |
|
310 | + * |
|
311 | + * It inserts the given field definition arrays into the class property and later they are parsed when fields are registered. The field definition array requires specific keys. Refer to the parameter section of this method. |
|
312 | + * |
|
313 | + * @since 2.0.0 |
|
314 | + * @since 3.5.3 Removed the parameter declarations as they are caught with the func_get_args(). |
|
315 | + * @remark Accepts variadic parameters; the number of accepted parameters are not limited to three. |
|
316 | + * @param array the field definition array. |
|
317 | + * @param array (optional) another field array. |
|
318 | + * @param array (optional) add more field arrays to the next parameters as many as necessary. |
|
319 | + * @return void |
|
320 | + */ |
|
321 | 321 | public function addSettingFields( /* $aField1, $aField2=null, $_and_more=null */ ) { |
322 | 322 | foreach( func_get_args() as $_aFieldset ) { |
323 | 323 | $this->addSettingField( $_aFieldset ); |
@@ -348,57 +348,57 @@ discard block |
||
348 | 348 | * @return void |
349 | 349 | * @remark The $oForm property should be created in each extended class. |
350 | 350 | * @param array|string $asField A field definition array or a string of the target section id. |
351 | - * <h4>Built-in Field Types</h4> |
|
352 | - * <ul> |
|
353 | - * <li>[text](./class-AdminPageFramework_FieldType_text.html) - a normal field to enter short text input.</li> |
|
354 | - * <li>[password](./class-AdminPageFramework_FieldType_text.html) - a masked text input field.</li> |
|
355 | - * <li>[textarea](./class-AdminPageFramework_FieldType_textarea.html) - a text input field with multiple lines. It supports rich text editors.</li> |
|
356 | - * <li>[radio](./class-AdminPageFramework_FieldType_radio.html) - a set of radio buttons that lets the user pick an option.</li> |
|
357 | - * <li>[checkbox](./class-AdminPageFramework_FieldType_checkbox.html) - a check box that lets the user enable/disable an item.</li> |
|
358 | - * <li>[select](./class-AdminPageFramework_FieldType_select.html) - a drop-down list that lest the user pick one or more item(s) from a list.</li> |
|
359 | - * <li>[hidden](./class-AdminPageFramework_FieldType_hidden.html) - a field with invisible input values.</li> |
|
360 | - * <li>[file](./class-AdminPageFramework_FieldType_file.html) - a file uploader that lets the user upload files.</li> |
|
361 | - * <li>[image](./class-AdminPageFramework_FieldType_image.html) - a text field with an image uploader that lets the user set the image URL.</li> |
|
362 | - * <li>[media](./class-AdminPageFramework_FieldType_media.html) - a text field with a media uploader that lets the user set the file URL.</li> |
|
363 | - * <li>[color](./class-AdminPageFramework_FieldType_color.html) - a text field with a color picker.</li> |
|
364 | - * <li>[submit](./class-AdminPageFramework_FieldType_submit.html) - a submit button that lets the user send the form.</li> |
|
365 | - * <li>[export](./class-AdminPageFramework_FieldType_export.html) - a custom submit field that lets the user export stored data.</li> |
|
366 | - * <li>[import](./class-AdminPageFramework_FieldType_import.html) - a custom combination field of file and submit fields that let the user import data.</li> |
|
367 | - * <li>[posttype](./class-AdminPageFramework_FieldType_posttype.html) - a check-list of post types enabled on the site.</li> |
|
368 | - * <li>[taxonomy](./class-AdminPageFramework_FieldType_taxonomy.html) - a set of check-lists of taxonomies enabled on the site in a tabbed box.</li> |
|
369 | - * <li>[size](./class-AdminPageFramework_FieldType_size.html) - a combination field of the text and the select fields that let the user set sizes with a selectable unit.</li> |
|
370 | - * <li>[section_title](./class-AdminPageFramework_FieldType_section_title.html) - [3.0.0+] a text field type that will be placed in the section title so that it lets the user set the section title. Note that only one field with this field type is allowed per a section.</li> |
|
371 | - * <li>[system](./class-AdminPageFramework_FieldType_system.html) - [3.3.0+] a custom text area field that displays the system information including the PHP settings, the framework version, MySQL version etc.</li> |
|
372 | - * <li>[inline_mixed](./class-AdminPageFramework_FieldType_inline_mixed.html) - [3.8.0+] a field that include inner fields with different field types. </li> |
|
373 | - * </ul> |
|
374 | - * <h4>Field Definition Arguments</h4> |
|
375 | - * <ul> |
|
376 | - * <li>**field_id** - (required, string) the field ID. Avoid using non-alphabetic characters except underscore and numbers.</li> |
|
377 | - * <li>**type** - (optional, string) the type of the field. The supported types are listed below. When creating nested fields, this argument can be omitted.</li> |
|
378 | - * <li>**section_id** - (optional, string) the section ID that the field belongs to. If not set, the internal `_default` section ID will be assigned.</li> |
|
379 | - * <li>**title** - (optional, string) the title of the section.</li> |
|
380 | - * <li>**description** - (optional, string) the description of the field which is inserted into the after the input field tag.</li> |
|
381 | - * <li>**tip** - (optional, string) the tip for the field which is displayed when the mouse is hovered over the field title.</li> |
|
382 | - * <li>**capability** - (optional, string) the <a href="http://codex.wordpress.org/Roles_and_Capabilities">access level</a> of the section. If the page visitor does not have sufficient capability, the section will be invisible to them.</li> |
|
383 | - * <li>**error_message** - (optional, string) the error message to display above the input field.</li> |
|
384 | - * <li>**before_field** - (optional, string) the HTML string to insert before the input field output.</li> |
|
385 | - * <li>**after_field** - (optional, string) the HTML string to insert after the input field output.</li> |
|
386 | - * <li>**if** - (optional, boolean) if the passed value is false, the section will not be registered.</li> |
|
387 | - * <li>**order** - (optional, integer) the order number of the section. The higher the number is, the lower the position it gets.</li> |
|
388 | - * <li>**label** - (optional, string) the text label(s) associated with and displayed along with the input field. Some input types can ignore this key.</li> |
|
389 | - * <li>**default** - (optional, string|array) the default value(s) assigned to the input tag's value attribute.</li> |
|
390 | - * <li>**value** - (optional, string|array) the value(s) assigned to the input tag's `value` attribute to override the default and the stored value.</li> |
|
391 | - * <li>**delimiter** - (optional, string) the HTML string that delimits multiple elements. This is available if the <var>label</var> key is passed as array. It will be enclosed in inline-block elements so the passed HTML string should not contain block elements.</li> |
|
392 | - * <li>**before_input** - (optional, string) the HTML string inserted right before the input tag. It will be enclosed in the <code>label</code> tag so the passed HTML string should not contain block elements.</li> |
|
393 | - * <li>**after_input** - (optional, string) the HTML string inserted right after the input tag. It will be enclosed in the <code>label</code> tag so the passed HTML string should not contain block elements.</li> |
|
394 | - * <li>**label_min_width** - (optional, string) the inline style property of the `min-width` of the label tag for the field. If the unit is not specified, 'px' is applied. Default: `120`. e.g. `100%`</li> |
|
395 | - * <li>**help** - (optional, string) the help description added to the contextual help tab.</li> |
|
396 | - * <li>**help_aside** - (optional, string) the additional help description for the side bar of the contextual help tab.</li> |
|
397 | - * <li>**repeatable** - [3.0.0+] (optional, array|boolean) whether the fields should be repeatable. If it yields true, the plus and the minus buttons appear next to each field that lets the user add/remove the fields. Optionally an setting array can be passed. |
|
398 | - * <h5>Repeatable Fields Setting Array</h5> |
|
399 | - * <ul> |
|
400 | - * <li>**max** - the allowed maximum number of fields to be repeated.</li> |
|
401 | - * <li>**min** - the allowed minimum number of fields to be repeated.</li> |
|
351 | + * <h4>Built-in Field Types</h4> |
|
352 | + * <ul> |
|
353 | + * <li>[text](./class-AdminPageFramework_FieldType_text.html) - a normal field to enter short text input.</li> |
|
354 | + * <li>[password](./class-AdminPageFramework_FieldType_text.html) - a masked text input field.</li> |
|
355 | + * <li>[textarea](./class-AdminPageFramework_FieldType_textarea.html) - a text input field with multiple lines. It supports rich text editors.</li> |
|
356 | + * <li>[radio](./class-AdminPageFramework_FieldType_radio.html) - a set of radio buttons that lets the user pick an option.</li> |
|
357 | + * <li>[checkbox](./class-AdminPageFramework_FieldType_checkbox.html) - a check box that lets the user enable/disable an item.</li> |
|
358 | + * <li>[select](./class-AdminPageFramework_FieldType_select.html) - a drop-down list that lest the user pick one or more item(s) from a list.</li> |
|
359 | + * <li>[hidden](./class-AdminPageFramework_FieldType_hidden.html) - a field with invisible input values.</li> |
|
360 | + * <li>[file](./class-AdminPageFramework_FieldType_file.html) - a file uploader that lets the user upload files.</li> |
|
361 | + * <li>[image](./class-AdminPageFramework_FieldType_image.html) - a text field with an image uploader that lets the user set the image URL.</li> |
|
362 | + * <li>[media](./class-AdminPageFramework_FieldType_media.html) - a text field with a media uploader that lets the user set the file URL.</li> |
|
363 | + * <li>[color](./class-AdminPageFramework_FieldType_color.html) - a text field with a color picker.</li> |
|
364 | + * <li>[submit](./class-AdminPageFramework_FieldType_submit.html) - a submit button that lets the user send the form.</li> |
|
365 | + * <li>[export](./class-AdminPageFramework_FieldType_export.html) - a custom submit field that lets the user export stored data.</li> |
|
366 | + * <li>[import](./class-AdminPageFramework_FieldType_import.html) - a custom combination field of file and submit fields that let the user import data.</li> |
|
367 | + * <li>[posttype](./class-AdminPageFramework_FieldType_posttype.html) - a check-list of post types enabled on the site.</li> |
|
368 | + * <li>[taxonomy](./class-AdminPageFramework_FieldType_taxonomy.html) - a set of check-lists of taxonomies enabled on the site in a tabbed box.</li> |
|
369 | + * <li>[size](./class-AdminPageFramework_FieldType_size.html) - a combination field of the text and the select fields that let the user set sizes with a selectable unit.</li> |
|
370 | + * <li>[section_title](./class-AdminPageFramework_FieldType_section_title.html) - [3.0.0+] a text field type that will be placed in the section title so that it lets the user set the section title. Note that only one field with this field type is allowed per a section.</li> |
|
371 | + * <li>[system](./class-AdminPageFramework_FieldType_system.html) - [3.3.0+] a custom text area field that displays the system information including the PHP settings, the framework version, MySQL version etc.</li> |
|
372 | + * <li>[inline_mixed](./class-AdminPageFramework_FieldType_inline_mixed.html) - [3.8.0+] a field that include inner fields with different field types. </li> |
|
373 | + * </ul> |
|
374 | + * <h4>Field Definition Arguments</h4> |
|
375 | + * <ul> |
|
376 | + * <li>**field_id** - (required, string) the field ID. Avoid using non-alphabetic characters except underscore and numbers.</li> |
|
377 | + * <li>**type** - (optional, string) the type of the field. The supported types are listed below. When creating nested fields, this argument can be omitted.</li> |
|
378 | + * <li>**section_id** - (optional, string) the section ID that the field belongs to. If not set, the internal `_default` section ID will be assigned.</li> |
|
379 | + * <li>**title** - (optional, string) the title of the section.</li> |
|
380 | + * <li>**description** - (optional, string) the description of the field which is inserted into the after the input field tag.</li> |
|
381 | + * <li>**tip** - (optional, string) the tip for the field which is displayed when the mouse is hovered over the field title.</li> |
|
382 | + * <li>**capability** - (optional, string) the <a href="http://codex.wordpress.org/Roles_and_Capabilities">access level</a> of the section. If the page visitor does not have sufficient capability, the section will be invisible to them.</li> |
|
383 | + * <li>**error_message** - (optional, string) the error message to display above the input field.</li> |
|
384 | + * <li>**before_field** - (optional, string) the HTML string to insert before the input field output.</li> |
|
385 | + * <li>**after_field** - (optional, string) the HTML string to insert after the input field output.</li> |
|
386 | + * <li>**if** - (optional, boolean) if the passed value is false, the section will not be registered.</li> |
|
387 | + * <li>**order** - (optional, integer) the order number of the section. The higher the number is, the lower the position it gets.</li> |
|
388 | + * <li>**label** - (optional, string) the text label(s) associated with and displayed along with the input field. Some input types can ignore this key.</li> |
|
389 | + * <li>**default** - (optional, string|array) the default value(s) assigned to the input tag's value attribute.</li> |
|
390 | + * <li>**value** - (optional, string|array) the value(s) assigned to the input tag's `value` attribute to override the default and the stored value.</li> |
|
391 | + * <li>**delimiter** - (optional, string) the HTML string that delimits multiple elements. This is available if the <var>label</var> key is passed as array. It will be enclosed in inline-block elements so the passed HTML string should not contain block elements.</li> |
|
392 | + * <li>**before_input** - (optional, string) the HTML string inserted right before the input tag. It will be enclosed in the <code>label</code> tag so the passed HTML string should not contain block elements.</li> |
|
393 | + * <li>**after_input** - (optional, string) the HTML string inserted right after the input tag. It will be enclosed in the <code>label</code> tag so the passed HTML string should not contain block elements.</li> |
|
394 | + * <li>**label_min_width** - (optional, string) the inline style property of the `min-width` of the label tag for the field. If the unit is not specified, 'px' is applied. Default: `120`. e.g. `100%`</li> |
|
395 | + * <li>**help** - (optional, string) the help description added to the contextual help tab.</li> |
|
396 | + * <li>**help_aside** - (optional, string) the additional help description for the side bar of the contextual help tab.</li> |
|
397 | + * <li>**repeatable** - [3.0.0+] (optional, array|boolean) whether the fields should be repeatable. If it yields true, the plus and the minus buttons appear next to each field that lets the user add/remove the fields. Optionally an setting array can be passed. |
|
398 | + * <h5>Repeatable Fields Setting Array</h5> |
|
399 | + * <ul> |
|
400 | + * <li>**max** - the allowed maximum number of fields to be repeated.</li> |
|
401 | + * <li>**min** - the allowed minimum number of fields to be repeated.</li> |
|
402 | 402 | * <li>**disabled** - (optional, boolean|array) [3.8.13+] |
403 | 403 | * <ul> |
404 | 404 | * <li>**message** - (optional, string) the message to show when the user clicks on the `Add` repeatable button.</li> |
@@ -407,108 +407,108 @@ discard block |
||
407 | 407 | * <li>**box_width** - (optional, integer) the height of the modal window that displays the message. Default: 100.</li> |
408 | 408 | * <ul> |
409 | 409 | * </li> |
410 | - * </ul> |
|
411 | - * </li> |
|
412 | - * <li>**sortable** - [3.0.0+] (optional, boolean) whether the fields should be sortable. If it yields true, the fields will be enclosed in a draggable box. |
|
413 | - * <li>**attributes** - [3.0.0+] (optional, array) holds key-value pairs representing the attribute and its property. Note that some field types have specific keys in the first dimensions. e.g. `array( 'class' => 'my_custom_class_selector', 'style' => 'background-color:#777', 'size' => 20, )` Every field holds the following nested attribute definition arrays. |
|
414 | - * <ul> |
|
415 | - * <li>**fieldrow** - the `td` tag element containing the field output.</li> |
|
416 | - * <li>**fieldset** - the `fieldset` tag element containing the field output.</li> |
|
417 | - * <li>**fields** - the `div` tag element containing the sub-fields and the main field.</li> |
|
418 | - * <li>**field** - the `div` tag element containing each field.</li> |
|
419 | - * </ul> |
|
420 | - * </li> |
|
421 | - * <li>**show_title_column** - [3.0.0+] (optional, boolean) If true, the field title column will be omitted from the output.</li> |
|
422 | - * <li>**hidden** - [3.0.0+] (optional, boolean) If true, the entire field row output will be invisible with the inline style attribute of `style="display:none"`.</li> |
|
423 | - * <li>**save** - [3.6.0+] (optional, boolean) If `false`, the field value will not be saved. Default: `true`</li> |
|
424 | - * <li>**content** - (optional, string|array) [3.6.1+] a custom section output. [3.8.0+] Supports an array to be passed for nested and inline-mixed fields. If an array holding field definitions is set, those fields will be nested. |
|
425 | - * <h4>Example</h4> |
|
426 | - * <pre><code> |
|
427 | - * $this->addSettingFields( |
|
428 | - * 'my_section_id', // the target section ID - pass dimensional keys of the section |
|
429 | - * array( |
|
430 | - * 'field_id' => 'Y', |
|
431 | - * 'title' => __( 'Y', 'admin-page-framework-loader' ), |
|
432 | - * 'description' => __( 'By passing an array of field definition to the <code>content</code> argument, you can nest fields.', 'admin-page-framework-loader' ) |
|
433 | - * . ' ' . __( 'Also the <code>type</code> argument can be omitted.', 'admin-page-framework-loader' ), |
|
434 | - * 'content' => array( |
|
435 | - * array( |
|
436 | - * 'field_id' => 'i', |
|
437 | - * 'title' => __( 'i', 'admin-page-framework-loader' ), |
|
438 | - * 'type' => 'textarea', |
|
439 | - * ), |
|
440 | - * array( |
|
441 | - * 'field_id' => 'ii', |
|
442 | - * 'title' => __( 'ii', 'admin-page-framework-loader' ), |
|
443 | - * 'type' => 'color', |
|
444 | - * ), |
|
445 | - * array( |
|
446 | - * 'field_id' => 'iii', |
|
447 | - * 'title' => __( 'iii', 'admin-page-framework-loader' ), |
|
448 | - * 'repeatable' => true, |
|
449 | - * 'sortable' => true, |
|
450 | - * 'content' => array( |
|
451 | - * array( |
|
452 | - * 'field_id' => 'a', |
|
453 | - * 'title' => __( 'a', 'admin-page-framework-loader' ), |
|
454 | - * 'type' => 'image', |
|
455 | - * 'attributes' => array( |
|
456 | - * 'preview' => array( |
|
457 | - * 'style' => 'max-width: 200px;', |
|
458 | - * ), |
|
459 | - * ), |
|
460 | - * ), |
|
461 | - * array( |
|
462 | - * 'field_id' => 'b', |
|
463 | - * 'title' => __( 'b', 'admin-page-framework-loader' ), |
|
464 | - * 'content' => array( |
|
465 | - * array( |
|
466 | - * 'field_id' => 'first', |
|
467 | - * 'title' => __( '1st', 'admin-page-framework-loader' ), |
|
468 | - * 'type' => 'color', |
|
469 | - * 'repeatable' => true, |
|
470 | - * 'sortable' => true, |
|
471 | - * ), |
|
472 | - * array( |
|
473 | - * 'field_id' => 'second', |
|
474 | - * 'title' => __( '2nd', 'admin-page-framework-loader' ), |
|
475 | - * 'type' => 'size', |
|
476 | - * ), |
|
477 | - * array( |
|
478 | - * 'field_id' => 'third', |
|
479 | - * 'title' => __( '3rd', 'admin-page-framework-loader' ), |
|
480 | - * 'type' => 'select', |
|
481 | - * 'label' => array( |
|
482 | - * 'x' => 'X', |
|
483 | - * 'y' => 'Y', |
|
484 | - * 'z' => 'Z', |
|
485 | - * ), |
|
486 | - * ), |
|
487 | - * ), |
|
488 | - * // 'description' => '', |
|
489 | - * ), |
|
490 | - * array( |
|
491 | - * 'field_id' => 'c', |
|
492 | - * 'title' => __( 'c', 'admin-page-framework-loader' ), |
|
493 | - * 'type' => 'radio', |
|
494 | - * 'label' => array( |
|
495 | - * 'a' => __( 'Apple', 'admin-page-framework-loader' ), |
|
496 | - * 'b' => __( 'Banana', 'admin-page-framework-loader' ), |
|
497 | - * 'c' => __( 'Cherry', 'admin-page-framework-loader' ), |
|
498 | - * ), |
|
499 | - * 'default' => 'b', |
|
500 | - * ), |
|
501 | - * ) |
|
502 | - * ), |
|
503 | - * ), |
|
504 | - * ) |
|
505 | - * ); |
|
506 | - * </code></pre> |
|
507 | - * </li> |
|
508 | - * <li>**placement** - [3.8.0+] (optional, string) Specifies where the field is rendered. Either `normal` `section_title` or `field_title` is accepted. `field_title` can only be used by nested fields defined in the `content` argument. Default: `normal`</li> |
|
509 | - * <li>**show_debug_info** - (optional, boolean) [3.8.8+] Whether to show debug information such as field definition tool-tips. Default: `true`.</li> |
|
510 | - * </ul> |
|
511 | - */ |
|
410 | + * </ul> |
|
411 | + * </li> |
|
412 | + * <li>**sortable** - [3.0.0+] (optional, boolean) whether the fields should be sortable. If it yields true, the fields will be enclosed in a draggable box. |
|
413 | + * <li>**attributes** - [3.0.0+] (optional, array) holds key-value pairs representing the attribute and its property. Note that some field types have specific keys in the first dimensions. e.g. `array( 'class' => 'my_custom_class_selector', 'style' => 'background-color:#777', 'size' => 20, )` Every field holds the following nested attribute definition arrays. |
|
414 | + * <ul> |
|
415 | + * <li>**fieldrow** - the `td` tag element containing the field output.</li> |
|
416 | + * <li>**fieldset** - the `fieldset` tag element containing the field output.</li> |
|
417 | + * <li>**fields** - the `div` tag element containing the sub-fields and the main field.</li> |
|
418 | + * <li>**field** - the `div` tag element containing each field.</li> |
|
419 | + * </ul> |
|
420 | + * </li> |
|
421 | + * <li>**show_title_column** - [3.0.0+] (optional, boolean) If true, the field title column will be omitted from the output.</li> |
|
422 | + * <li>**hidden** - [3.0.0+] (optional, boolean) If true, the entire field row output will be invisible with the inline style attribute of `style="display:none"`.</li> |
|
423 | + * <li>**save** - [3.6.0+] (optional, boolean) If `false`, the field value will not be saved. Default: `true`</li> |
|
424 | + * <li>**content** - (optional, string|array) [3.6.1+] a custom section output. [3.8.0+] Supports an array to be passed for nested and inline-mixed fields. If an array holding field definitions is set, those fields will be nested. |
|
425 | + * <h4>Example</h4> |
|
426 | + * <pre><code> |
|
427 | + * $this->addSettingFields( |
|
428 | + * 'my_section_id', // the target section ID - pass dimensional keys of the section |
|
429 | + * array( |
|
430 | + * 'field_id' => 'Y', |
|
431 | + * 'title' => __( 'Y', 'admin-page-framework-loader' ), |
|
432 | + * 'description' => __( 'By passing an array of field definition to the <code>content</code> argument, you can nest fields.', 'admin-page-framework-loader' ) |
|
433 | + * . ' ' . __( 'Also the <code>type</code> argument can be omitted.', 'admin-page-framework-loader' ), |
|
434 | + * 'content' => array( |
|
435 | + * array( |
|
436 | + * 'field_id' => 'i', |
|
437 | + * 'title' => __( 'i', 'admin-page-framework-loader' ), |
|
438 | + * 'type' => 'textarea', |
|
439 | + * ), |
|
440 | + * array( |
|
441 | + * 'field_id' => 'ii', |
|
442 | + * 'title' => __( 'ii', 'admin-page-framework-loader' ), |
|
443 | + * 'type' => 'color', |
|
444 | + * ), |
|
445 | + * array( |
|
446 | + * 'field_id' => 'iii', |
|
447 | + * 'title' => __( 'iii', 'admin-page-framework-loader' ), |
|
448 | + * 'repeatable' => true, |
|
449 | + * 'sortable' => true, |
|
450 | + * 'content' => array( |
|
451 | + * array( |
|
452 | + * 'field_id' => 'a', |
|
453 | + * 'title' => __( 'a', 'admin-page-framework-loader' ), |
|
454 | + * 'type' => 'image', |
|
455 | + * 'attributes' => array( |
|
456 | + * 'preview' => array( |
|
457 | + * 'style' => 'max-width: 200px;', |
|
458 | + * ), |
|
459 | + * ), |
|
460 | + * ), |
|
461 | + * array( |
|
462 | + * 'field_id' => 'b', |
|
463 | + * 'title' => __( 'b', 'admin-page-framework-loader' ), |
|
464 | + * 'content' => array( |
|
465 | + * array( |
|
466 | + * 'field_id' => 'first', |
|
467 | + * 'title' => __( '1st', 'admin-page-framework-loader' ), |
|
468 | + * 'type' => 'color', |
|
469 | + * 'repeatable' => true, |
|
470 | + * 'sortable' => true, |
|
471 | + * ), |
|
472 | + * array( |
|
473 | + * 'field_id' => 'second', |
|
474 | + * 'title' => __( '2nd', 'admin-page-framework-loader' ), |
|
475 | + * 'type' => 'size', |
|
476 | + * ), |
|
477 | + * array( |
|
478 | + * 'field_id' => 'third', |
|
479 | + * 'title' => __( '3rd', 'admin-page-framework-loader' ), |
|
480 | + * 'type' => 'select', |
|
481 | + * 'label' => array( |
|
482 | + * 'x' => 'X', |
|
483 | + * 'y' => 'Y', |
|
484 | + * 'z' => 'Z', |
|
485 | + * ), |
|
486 | + * ), |
|
487 | + * ), |
|
488 | + * // 'description' => '', |
|
489 | + * ), |
|
490 | + * array( |
|
491 | + * 'field_id' => 'c', |
|
492 | + * 'title' => __( 'c', 'admin-page-framework-loader' ), |
|
493 | + * 'type' => 'radio', |
|
494 | + * 'label' => array( |
|
495 | + * 'a' => __( 'Apple', 'admin-page-framework-loader' ), |
|
496 | + * 'b' => __( 'Banana', 'admin-page-framework-loader' ), |
|
497 | + * 'c' => __( 'Cherry', 'admin-page-framework-loader' ), |
|
498 | + * ), |
|
499 | + * 'default' => 'b', |
|
500 | + * ), |
|
501 | + * ) |
|
502 | + * ), |
|
503 | + * ), |
|
504 | + * ) |
|
505 | + * ); |
|
506 | + * </code></pre> |
|
507 | + * </li> |
|
508 | + * <li>**placement** - [3.8.0+] (optional, string) Specifies where the field is rendered. Either `normal` `section_title` or `field_title` is accepted. `field_title` can only be used by nested fields defined in the `content` argument. Default: `normal`</li> |
|
509 | + * <li>**show_debug_info** - (optional, boolean) [3.8.8+] Whether to show debug information such as field definition tool-tips. Default: `true`.</li> |
|
510 | + * </ul> |
|
511 | + */ |
|
512 | 512 | public function addSettingField( $asFieldset ) { |
513 | 513 | if ( method_exists( $this->oForm, 'addField' ) ) { |
514 | 514 | $this->oForm->addField( $asFieldset ); |
@@ -572,28 +572,28 @@ discard block |
||
572 | 572 | } |
573 | 573 | |
574 | 574 | /** |
575 | - * Sets the given message to be displayed in the next page load. |
|
576 | - * |
|
577 | - * This is used to inform users about the submitted input data, such as "Updated successfully." or "Problem occurred." etc. |
|
578 | - * and normally used in validation callback methods. |
|
579 | - * |
|
580 | - * <h4>Example</h4> |
|
581 | - * ` |
|
582 | - * if ( ! $bVerified ) { |
|
583 | - * $this->setFieldErrors( $aErrors ); |
|
584 | - * $this->setSettingNotice( 'There was an error in your input.' ); |
|
585 | - * return $aOldPageOptions; |
|
586 | - * } |
|
587 | - * ` |
|
588 | - * |
|
589 | - * @since 3.0.4 |
|
590 | - * @access public |
|
591 | - * @param string $sMessage the text message to be displayed. |
|
592 | - * @param string $sType (optional) the type of the message, either "error" or "updated" is used. |
|
593 | - * @param array $asAttributes (optional) the tag attribute array applied to the message container HTML element. If a string is given, it is used as the ID attribute value. |
|
594 | - * @param boolean $bOverride (optional) If true, only one message will be shown in the next page load. false: do not override when there is a message of the same id. true: override the previous one. |
|
595 | - * @return void |
|
596 | - */ |
|
575 | + * Sets the given message to be displayed in the next page load. |
|
576 | + * |
|
577 | + * This is used to inform users about the submitted input data, such as "Updated successfully." or "Problem occurred." etc. |
|
578 | + * and normally used in validation callback methods. |
|
579 | + * |
|
580 | + * <h4>Example</h4> |
|
581 | + * ` |
|
582 | + * if ( ! $bVerified ) { |
|
583 | + * $this->setFieldErrors( $aErrors ); |
|
584 | + * $this->setSettingNotice( 'There was an error in your input.' ); |
|
585 | + * return $aOldPageOptions; |
|
586 | + * } |
|
587 | + * ` |
|
588 | + * |
|
589 | + * @since 3.0.4 |
|
590 | + * @access public |
|
591 | + * @param string $sMessage the text message to be displayed. |
|
592 | + * @param string $sType (optional) the type of the message, either "error" or "updated" is used. |
|
593 | + * @param array $asAttributes (optional) the tag attribute array applied to the message container HTML element. If a string is given, it is used as the ID attribute value. |
|
594 | + * @param boolean $bOverride (optional) If true, only one message will be shown in the next page load. false: do not override when there is a message of the same id. true: override the previous one. |
|
595 | + * @return void |
|
596 | + */ |
|
597 | 597 | public function setSettingNotice( $sMessage, $sType='error', $asAttributes=array(), $bOverride=true ) { |
598 | 598 | $this->oForm->setSubmitNotice( |
599 | 599 | $sMessage, |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | * @return array|string |
54 | 54 | * @since 3.7.0 |
55 | 55 | */ |
56 | - public function getMessage( $sKey='' ) { |
|
56 | + public function getMessage( $sKey = '' ) { |
|
57 | 57 | return $this->oMsg->get( $sKey ); |
58 | 58 | } |
59 | 59 | |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | * @return array The array holing the queued items. |
74 | 74 | * @internal |
75 | 75 | */ |
76 | - public function enqueueStyles( $aSRCs, $_vArg2=null ) {} |
|
76 | + public function enqueueStyles( $aSRCs, $_vArg2 = null ) {} |
|
77 | 77 | |
78 | 78 | /** |
79 | 79 | * Enqueues a style of the given source. |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | * @return string The style handle ID. If the passed url is not a valid url string, an empty string will be returned. |
94 | 94 | * @internal |
95 | 95 | */ |
96 | - public function enqueueStyle( $sSRC, $_vArg2=null ) {} |
|
96 | + public function enqueueStyle( $sSRC, $_vArg2 = null ) {} |
|
97 | 97 | |
98 | 98 | /** |
99 | 99 | * Enqueues scripts by the given sources. |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | * @return array The array holding the queued items. |
115 | 115 | * @internal |
116 | 116 | */ |
117 | - public function enqueueScripts( $aSRCs, $_vArg2=null ) {} |
|
117 | + public function enqueueScripts( $aSRCs, $_vArg2 = null ) {} |
|
118 | 118 | /** |
119 | 119 | * Enqueues a script by the given source. |
120 | 120 | * |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | * @return string The script handle ID. If the passed url is not a valid url string, an empty string will be returned. |
147 | 147 | * @internal |
148 | 148 | */ |
149 | - public function enqueueScript( $sSRC, $_vArg2=null ) {} |
|
149 | + public function enqueueScript( $sSRC, $_vArg2 = null ) {} |
|
150 | 150 | |
151 | 151 | /* |
152 | 152 | * Help Pane |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | * @since 2.1.0 |
165 | 165 | * @remark This method just adds the given text into the class property. The actual registration will be performed with the `replyToRegisterHelpTabTextForMetaBox()` method. |
166 | 166 | */ |
167 | - public function addHelpText( $sHTMLContent, $sHTMLSidebarContent="" ) { |
|
167 | + public function addHelpText( $sHTMLContent, $sHTMLSidebarContent = "" ) { |
|
168 | 168 | if ( method_exists( $this->oHelpPane, '_addHelpText' ) ) { |
169 | 169 | $this->oHelpPane->_addHelpText( $sHTMLContent, $sHTMLSidebarContent ); |
170 | 170 | } |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | */ |
201 | 201 | public function addSettingSections( /* $aSection1, $aSection2=null, $_and_more=null */ ) { |
202 | 202 | |
203 | - foreach( func_get_args() as $_asSectionset ) { |
|
203 | + foreach ( func_get_args() as $_asSectionset ) { |
|
204 | 204 | $this->addSettingSection( $_asSectionset ); |
205 | 205 | } |
206 | 206 | |
@@ -286,7 +286,7 @@ discard block |
||
286 | 286 | */ |
287 | 287 | public function addSettingSection( $aSectionset ) { |
288 | 288 | |
289 | - if ( ! is_array( $aSectionset ) ) { |
|
289 | + if ( !is_array( $aSectionset ) ) { |
|
290 | 290 | return; |
291 | 291 | } |
292 | 292 | |
@@ -319,7 +319,7 @@ discard block |
||
319 | 319 | * @return void |
320 | 320 | */ |
321 | 321 | public function addSettingFields( /* $aField1, $aField2=null, $_and_more=null */ ) { |
322 | - foreach( func_get_args() as $_aFieldset ) { |
|
322 | + foreach ( func_get_args() as $_aFieldset ) { |
|
323 | 323 | $this->addSettingField( $_aFieldset ); |
324 | 324 | } |
325 | 325 | } |
@@ -594,7 +594,7 @@ discard block |
||
594 | 594 | * @param boolean $bOverride (optional) If true, only one message will be shown in the next page load. false: do not override when there is a message of the same id. true: override the previous one. |
595 | 595 | * @return void |
596 | 596 | */ |
597 | - public function setSettingNotice( $sMessage, $sType='error', $asAttributes=array(), $bOverride=true ) { |
|
597 | + public function setSettingNotice( $sMessage, $sType = 'error', $asAttributes = array(), $bOverride = true ) { |
|
598 | 598 | $this->oForm->setSubmitNotice( |
599 | 599 | $sMessage, |
600 | 600 | $sType, |
@@ -613,7 +613,7 @@ discard block |
||
613 | 613 | * @param string $sType If empty, the method will check if a message exists in all types. Otherwise, it checks the existence of a message of the specified type. |
614 | 614 | * @return boolean True if a setting notice is set; otherwise, false. |
615 | 615 | */ |
616 | - public function hasSettingNotice( $sType='' ) { |
|
616 | + public function hasSettingNotice( $sType = '' ) { |
|
617 | 617 | return $this->oForm->hasSubmitNotice( $sType ); |
618 | 618 | } |
619 | 619 |
@@ -35,7 +35,7 @@ |
||
35 | 35 | $_aParameters = func_get_args() + array( |
36 | 36 | $this->aSubject, |
37 | 37 | ); |
38 | - $this->aSubject = $_aParameters[ 0 ]; |
|
38 | + $this->aSubject = $_aParameters[ 0 ]; |
|
39 | 39 | |
40 | 40 | } |
41 | 41 |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | /** |
27 | 27 | * Stores the tab items. |
28 | 28 | */ |
29 | - public $aTabs = array(); |
|
29 | + public $aTabs = array(); |
|
30 | 30 | |
31 | 31 | /** |
32 | 32 | * Stores container attributes. |
@@ -36,11 +36,11 @@ discard block |
||
36 | 36 | ); |
37 | 37 | |
38 | 38 | public $aTab = array( |
39 | - 'slug' => null, // (string) tab slug (id) |
|
40 | - 'title' => null, // (string) tab title |
|
41 | - 'href' => null, // (string) link url |
|
42 | - 'disabled' => null, // (boolean) |
|
43 | - 'class' => null, // (string) class selector to append to the class attribute |
|
39 | + 'slug' => null, // (string) tab slug (id) |
|
40 | + 'title' => null, // (string) tab title |
|
41 | + 'href' => null, // (string) link url |
|
42 | + 'disabled' => null, // (boolean) |
|
43 | + 'class' => null, // (string) class selector to append to the class attribute |
|
44 | 44 | 'attributes' => array(), |
45 | 45 | ); |
46 | 46 | |
@@ -59,11 +59,11 @@ discard block |
||
59 | 59 | * @param array $aTabs An array holding each tab definitions |
60 | 60 | * @param array|string $asActiveTabSlugs The default tab slug. |
61 | 61 | */ |
62 | - public function __construct( array $aTabs, $asActiveTabSlugs, $sTabTag='h2', $aAttributes=array( 'class' => 'nav-tab-wrapper', ), $aCallbacks=array() ) { |
|
62 | + public function __construct( array $aTabs, $asActiveTabSlugs, $sTabTag = 'h2', $aAttributes = array( 'class' => 'nav-tab-wrapper',), $aCallbacks = array() ) { |
|
63 | 63 | |
64 | - $this->aCallbacks = $aCallbacks + array( |
|
64 | + $this->aCallbacks = $aCallbacks + array( |
|
65 | 65 | 'format' => null, |
66 | - 'arguments' => null, // custom arguments to pass to the callback functions. |
|
66 | + 'arguments' => null, // custom arguments to pass to the callback functions. |
|
67 | 67 | ); |
68 | 68 | $this->aTabs = $this->_getFormattedTabs( $aTabs ); |
69 | 69 | $this->aActiveSlugs = $this->getAsArray( $asActiveTabSlugs ); |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | * @return array |
78 | 78 | */ |
79 | 79 | private function _getFormattedTabs( array $aTabs ) { |
80 | - foreach( $aTabs as $_isKey => &$_aTab ) { |
|
80 | + foreach ( $aTabs as $_isKey => &$_aTab ) { |
|
81 | 81 | $_aFormattedTab = $this->_getFormattedTab( $_aTab, $aTabs ); |
82 | 82 | if ( isset( $_aFormattedTab[ 'slug' ] ) ) { |
83 | 83 | $_aTab = $_aFormattedTab; |
@@ -128,12 +128,12 @@ discard block |
||
128 | 128 | private function _getTabs() { |
129 | 129 | |
130 | 130 | $_aOutput = array(); |
131 | - foreach( $this->aTabs as $_aTab ) { |
|
131 | + foreach ( $this->aTabs as $_aTab ) { |
|
132 | 132 | $_sTab = $this->_getTab( $_aTab ); |
133 | - if ( ! $_sTab ) { |
|
133 | + if ( !$_sTab ) { |
|
134 | 134 | continue; |
135 | 135 | } |
136 | - $_aOutput[] = $_sTab; |
|
136 | + $_aOutput[ ] = $_sTab; |
|
137 | 137 | } |
138 | 138 | |
139 | 139 | $_aContainerAttributes = $this->aAttributes + array( 'class' => null ); |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | |
145 | 145 | return empty( $_aOutput ) |
146 | 146 | ? '' |
147 | - : "<{$this->sTabTag} " . $this->getAttributes( $_aContainerAttributes ) . ">" |
|
147 | + : "<{$this->sTabTag} ".$this->getAttributes( $_aContainerAttributes ).">" |
|
148 | 148 | . implode( '', $_aOutput ) |
149 | 149 | . "</{$this->sTabTag}>"; |
150 | 150 |
@@ -15,7 +15,7 @@ |
||
15 | 15 | * @package AdminPageFramework/Common/Factory/Tab |
16 | 16 | * @internal |
17 | 17 | */ |
18 | -class AdminPageFramework_TabNavigationBar extends AdminPageFramework_FrameworkUtility { |
|
18 | +class AdminPageFramework_TabNavigationBar extends AdminPageFramework_FrameworkUtility { |
|
19 | 19 | |
20 | 20 | /** |
21 | 21 | * The HTML tag used for the tag. |
@@ -107,8 +107,8 @@ |
||
107 | 107 | } |
108 | 108 | CSSRULES; |
109 | 109 | |
110 | - return $_sCSS . PHP_EOL |
|
111 | - . self::_getPageLoadStatsRules() . PHP_EOL |
|
110 | + return $_sCSS.PHP_EOL |
|
111 | + . self::_getPageLoadStatsRules().PHP_EOL |
|
112 | 112 | . self::_getVersionSpecificRules(); |
113 | 113 | |
114 | 114 | } |
@@ -84,7 +84,7 @@ |
||
84 | 84 | |
85 | 85 | // The first element is the option key; the section or field dimensional keys follow. |
86 | 86 | if ( '__dummy_option_key' === $_aDimensionalKeys[ 0 ] ) { |
87 | - array_shift( $_aDimensionalKeys ); |
|
87 | + array_shift( $_aDimensionalKeys ); |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | $this->unsetDimensionalArrayElement( |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | */ |
108 | 108 | private function _updateMetaDatumByFuncitonName( $iObjectID, $_vValue, array $aSavedMeta, $_sSectionOrFieldID, $_sFunctionName ) { |
109 | 109 | |
110 | - if ( is_null( $_vValue ) ) { |
|
110 | + if ( is_null( $_vValue ) ) { |
|
111 | 111 | return; |
112 | 112 | } |
113 | 113 | |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | |
120 | 120 | // PHP can compare even array contents with the == operator. See http://www.php.net/manual/en/language.operators.array.php |
121 | 121 | // if the input value and the saved meta value are the same, no need to update it. |
122 | - if ( $_vValue == $_vSavedValue ) { |
|
122 | + if ( $_vValue == $_vSavedValue ) { |
|
123 | 123 | return; |
124 | 124 | } |
125 | 125 |
@@ -30,9 +30,9 @@ discard block |
||
30 | 30 | * @param string $sStructureType The type of object. Currently 'post_meta_box' or 'user_meta' is accepted. |
31 | 31 | * @return void |
32 | 32 | */ |
33 | - public function updateMetaDataByType( $iObjectID, array $aInput, array $aSavedMeta, $sStructureType='post_meta_box' ) { |
|
33 | + public function updateMetaDataByType( $iObjectID, array $aInput, array $aSavedMeta, $sStructureType = 'post_meta_box' ) { |
|
34 | 34 | |
35 | - if ( ! $iObjectID ) { |
|
35 | + if ( !$iObjectID ) { |
|
36 | 36 | return; |
37 | 37 | } |
38 | 38 | |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | 'user_meta' => 'update_user_meta', |
42 | 42 | 'term_meta' => 'update_term_meta', |
43 | 43 | ); |
44 | - if ( ! in_array( $sStructureType, array_keys( $_aFunctionNameMapByFieldsType ) ) ) { |
|
44 | + if ( !in_array( $sStructureType, array_keys( $_aFunctionNameMapByFieldsType ) ) ) { |
|
45 | 45 | return; |
46 | 46 | } |
47 | 47 | $_sFunctionName = $this->getElement( $_aFunctionNameMapByFieldsType, $sStructureType ); |
@@ -69,16 +69,16 @@ discard block |
||
69 | 69 | */ |
70 | 70 | private function _getInputByUnset( array $aInput ) { |
71 | 71 | |
72 | - $_sUnsetKey = '__unset_' . $this->sStructureType; |
|
73 | - if ( ! isset( $_POST[ $_sUnsetKey ] ) ) { |
|
72 | + $_sUnsetKey = '__unset_'.$this->sStructureType; |
|
73 | + if ( !isset( $_POST[ $_sUnsetKey ] ) ) { |
|
74 | 74 | return $aInput; |
75 | 75 | } |
76 | 76 | |
77 | 77 | $_aUnsetElements = array_unique( $_POST[ $_sUnsetKey ] ); |
78 | - foreach( $_aUnsetElements as $_sFlatInputName ) { |
|
78 | + foreach ( $_aUnsetElements as $_sFlatInputName ) { |
|
79 | 79 | |
80 | 80 | $_aDimensionalKeys = explode( '|', $_sFlatInputName ); |
81 | - if ( ! isset( $_aDimensionalKeys[ 0 ] ) ) { |
|
81 | + if ( !isset( $_aDimensionalKeys[ 0 ] ) ) { |
|
82 | 82 | continue; |
83 | 83 | } |
84 | 84 | |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | |
114 | 114 | $_vSavedValue = $this->getElement( |
115 | 115 | $aSavedMeta, // subject |
116 | - $_sSectionOrFieldID, // dimensional keys |
|
116 | + $_sSectionOrFieldID, // dimensional keys |
|
117 | 117 | null // default value |
118 | 118 | ); |
119 | 119 |
@@ -57,25 +57,25 @@ |
||
57 | 57 | } |
58 | 58 | |
59 | 59 | // If the section ID is not registered, return false. |
60 | - if ( ! array_key_exists( $sID, $this->aSectionsets ) ) { |
|
60 | + if ( ! array_key_exists( $sID, $this->aSectionsets ) ) { |
|
61 | 61 | return false; |
62 | 62 | } |
63 | 63 | |
64 | 64 | // the fields array's first dimension is also filled with the keys of section ids. |
65 | - if ( ! array_key_exists( $sID, $this->aFieldsets ) ) { |
|
65 | + if ( ! array_key_exists( $sID, $this->aFieldsets ) ) { |
|
66 | 66 | return false; |
67 | 67 | } |
68 | 68 | |
69 | 69 | // Since numeric IDs are denied at the beginning of the method, the elements will not be sub-sections. |
70 | 70 | $_bIsSeciton = false; |
71 | - foreach( $this->aFieldsets as $_sSectionID => $_aFields ) { |
|
71 | + foreach( $this->aFieldsets as $_sSectionID => $_aFields ) { |
|
72 | 72 | |
73 | - if ( $_sSectionID == $sID ) { |
|
73 | + if ( $_sSectionID == $sID ) { |
|
74 | 74 | $_bIsSeciton = true; |
75 | 75 | } |
76 | 76 | |
77 | 77 | // a field using the ID is found, and it precedes a section match. |
78 | - if ( array_key_exists( $sID, $_aFields ) ) { |
|
78 | + if ( array_key_exists( $sID, $_aFields ) ) { |
|
79 | 79 | return false; |
80 | 80 | } |
81 | 81 |
@@ -60,18 +60,18 @@ discard block |
||
60 | 60 | } |
61 | 61 | |
62 | 62 | // If the section ID is not registered, return false. |
63 | - if ( ! array_key_exists( $sID, $this->aSectionsets ) ) { |
|
63 | + if ( !array_key_exists( $sID, $this->aSectionsets ) ) { |
|
64 | 64 | return false; |
65 | 65 | } |
66 | 66 | |
67 | 67 | // the fields array's first dimension is also filled with the keys of section ids. |
68 | - if ( ! array_key_exists( $sID, $this->aFieldsets ) ) { |
|
68 | + if ( !array_key_exists( $sID, $this->aFieldsets ) ) { |
|
69 | 69 | return false; |
70 | 70 | } |
71 | 71 | |
72 | 72 | // Since numeric IDs are denied at the beginning of the method, the elements will not be sub-sections. |
73 | 73 | $_bIsSeciton = false; |
74 | - foreach( $this->aFieldsets as $_sSectionID => $_aFields ) { |
|
74 | + foreach ( $this->aFieldsets as $_sSectionID => $_aFields ) { |
|
75 | 75 | |
76 | 76 | if ( $_sSectionID == $sID ) { |
77 | 77 | $_bIsSeciton = true; |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | */ |
99 | 99 | public function canUserView( $sCapability ) { |
100 | 100 | |
101 | - if ( ! $sCapability ) { |
|
101 | + if ( !$sCapability ) { |
|
102 | 102 | return true; |
103 | 103 | } |
104 | 104 |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | array( $this, '_replyToRegisterFormItems' ), |
30 | 30 | 100 // priority - low value is set as meta boxes use the `current_screen` action hook for `setUp()`. |
31 | 31 | ); |
32 | - } else { |
|
32 | + } else { |
|
33 | 33 | add_action( |
34 | 34 | $this->aArguments[ 'action_hook_form_registration' ], |
35 | 35 | array( $this, '_replyToRegisterFormItems' ) |
@@ -147,12 +147,12 @@ discard block |
||
147 | 147 | * Changed the name from `getFieldsModel()`. |
148 | 148 | * @return array |
149 | 149 | */ |
150 | - public function getDataStructureFromAddedFieldsets() { |
|
150 | + public function getDataStructureFromAddedFieldsets() { |
|
151 | 151 | |
152 | 152 | $_aFormDataStructure = array(); |
153 | 153 | foreach ( $this->getAsArray( $this->aFieldsets ) as $_sSectionID => $_aFieldsets ) { |
154 | 154 | |
155 | - if ( $_sSectionID != '_default' ) { |
|
155 | + if ( $_sSectionID != '_default' ) { |
|
156 | 156 | $_aFormDataStructure[ $_sSectionID ] = $_aFieldsets; |
157 | 157 | continue; |
158 | 158 | } |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | * @param array $aSubject The subject array to modify. Usually the saved option data. |
186 | 186 | * @return array The modified options array. |
187 | 187 | */ |
188 | - public function dropRepeatableElements( array $aSubject ) { |
|
188 | + public function dropRepeatableElements( array $aSubject ) { |
|
189 | 189 | $_oFilterRepeatableElements = new AdminPageFramework_Form_Model___Modifier_FilterRepeatableElements( |
190 | 190 | $aSubject, |
191 | 191 | $this->getElementAsArray( |
@@ -402,7 +402,6 @@ discard block |
||
402 | 402 | * |
403 | 403 | * @since 3.7.0 |
404 | 404 | * @param array $aSavedData |
405 | - * @param boolean $bOnlyFieldsets Whether to format only the fieldsets. The taxonomy field factory uses this parameter. |
|
406 | 405 | */ |
407 | 406 | protected function _formatElementDefinitions( array $aSavedData ) { |
408 | 407 | |
@@ -438,7 +437,6 @@ discard block |
||
438 | 437 | * Changed the name from `_getFieldErrors()`. |
439 | 438 | * @access public The field type class accesses this method to render nested fields. |
440 | 439 | * @internal |
441 | - * @param boolean $bDelete whether or not the transient should be deleted after retrieving it. |
|
442 | 440 | * @return array |
443 | 441 | */ |
444 | 442 | public function getFieldErrors() { |
@@ -43,10 +43,10 @@ discard block |
||
43 | 43 | * @since 3.7.0 |
44 | 44 | * @return array |
45 | 45 | */ |
46 | - public function getSubmittedData( array $aDataToParse, $bExtractFromFieldStructure=true, $bStripSlashes=true ) { |
|
46 | + public function getSubmittedData( array $aDataToParse, $bExtractFromFieldStructure = true, $bStripSlashes = true ) { |
|
47 | 47 | |
48 | 48 | // Extracts the form data from the subject data for parsing |
49 | - $_aSubmittedFormData = $bExtractFromFieldStructure |
|
49 | + $_aSubmittedFormData = $bExtractFromFieldStructure |
|
50 | 50 | ? $this->castArrayContents( |
51 | 51 | $this->getDataStructureFromAddedFieldsets(), // form data (options) structure |
52 | 52 | $aDataToParse // the subject data array, usually $_POST. |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | : $aDataToParse; |
55 | 55 | |
56 | 56 | // 3.6.0 - sorts dynamic elements. |
57 | - $_aSubmittedFormData = $this->getSortedInputs( $_aSubmittedFormData ); |
|
57 | + $_aSubmittedFormData = $this->getSortedInputs( $_aSubmittedFormData ); |
|
58 | 58 | |
59 | 59 | return $bStripSlashes |
60 | 60 | ? stripslashes_deep( $_aSubmittedFormData ) // fixes magic quotes |
@@ -79,12 +79,12 @@ discard block |
||
79 | 79 | array_merge( |
80 | 80 | $this->getElementAsArray( |
81 | 81 | $_POST, |
82 | - '__repeatable_elements_' . $this->aArguments[ 'structure_type' ], |
|
82 | + '__repeatable_elements_'.$this->aArguments[ 'structure_type' ], |
|
83 | 83 | array() |
84 | 84 | ), |
85 | 85 | $this->getElementAsArray( |
86 | 86 | $_POST, |
87 | - '__sortable_elements_' . $this->aArguments[ 'structure_type' ], |
|
87 | + '__sortable_elements_'.$this->aArguments[ 'structure_type' ], |
|
88 | 88 | array() |
89 | 89 | ) |
90 | 90 | ) |
@@ -147,9 +147,9 @@ discard block |
||
147 | 147 | * Changed the name from `getFieldsModel()`. |
148 | 148 | * @return array |
149 | 149 | */ |
150 | - public function getDataStructureFromAddedFieldsets() { |
|
150 | + public function getDataStructureFromAddedFieldsets() { |
|
151 | 151 | |
152 | - $_aFormDataStructure = array(); |
|
152 | + $_aFormDataStructure = array(); |
|
153 | 153 | foreach ( $this->getAsArray( $this->aFieldsets ) as $_sSectionID => $_aFieldsets ) { |
154 | 154 | |
155 | 155 | if ( $_sSectionID != '_default' ) { |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | } |
159 | 159 | |
160 | 160 | // For default field items. |
161 | - foreach( $_aFieldsets as $_sFieldID => $_aFieldset ) { |
|
161 | + foreach ( $_aFieldsets as $_sFieldID => $_aFieldset ) { |
|
162 | 162 | $_aFormDataStructure[ $_aFieldset[ 'field_id' ] ] = $_aFieldset; |
163 | 163 | } |
164 | 164 | |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | $aSubject, |
191 | 191 | $this->getElementAsArray( |
192 | 192 | $_POST, |
193 | - '__repeatable_elements_' . $this->aArguments[ 'structure_type' ] |
|
193 | + '__repeatable_elements_'.$this->aArguments[ 'structure_type' ] |
|
194 | 194 | ) |
195 | 195 | ); |
196 | 196 | return $_oFilterRepeatableElements->get(); |
@@ -203,13 +203,13 @@ discard block |
||
203 | 203 | public function _replyToRegisterFormItems() { |
204 | 204 | |
205 | 205 | // Check if the form should be created or not. |
206 | - if ( ! $this->isInThePage() ) { |
|
206 | + if ( !$this->isInThePage() ) { |
|
207 | 207 | return; |
208 | 208 | } |
209 | 209 | |
210 | 210 | // Load field type definitions. |
211 | - $this->_setFieldTypeDefinitions( 'admin_page_framework' ); // site-wide |
|
212 | - $this->_setFieldTypeDefinitions( $this->aArguments[ 'caller_id' ] ); // per class |
|
211 | + $this->_setFieldTypeDefinitions( 'admin_page_framework' ); // site-wide |
|
212 | + $this->_setFieldTypeDefinitions( $this->aArguments[ 'caller_id' ] ); // per class |
|
213 | 213 | |
214 | 214 | // Set the options array |
215 | 215 | $this->aSavedData = $this->_getSavedData( |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | $this->aArguments, |
238 | 238 | $this->aFieldsets, |
239 | 239 | self::$_aResources, |
240 | - $this->aFieldTypeDefinitions, // must be called after performing `_setFieldTypeDefinitions()`. |
|
240 | + $this->aFieldTypeDefinitions, // must be called after performing `_setFieldTypeDefinitions()`. |
|
241 | 241 | $this->aCallbacks |
242 | 242 | ); |
243 | 243 | self::$_aResources = $_oFieldResources->get(); // updates the property |
@@ -254,10 +254,10 @@ discard block |
||
254 | 254 | $this->callBack( |
255 | 255 | $this->aCallbacks[ 'handle_form_data' ], |
256 | 256 | array( |
257 | - $this->aSavedData, // 1st parameter |
|
258 | - $this->aArguments, // 2nd parameter |
|
259 | - $this->aSectionsets, // 3rd parameter |
|
260 | - $this->aFieldsets, // 4th parameter |
|
257 | + $this->aSavedData, // 1st parameter |
|
258 | + $this->aArguments, // 2nd parameter |
|
259 | + $this->aSectionsets, // 3rd parameter |
|
260 | + $this->aFieldsets, // 4th parameter |
|
261 | 261 | ) |
262 | 262 | ); |
263 | 263 | |
@@ -271,15 +271,15 @@ discard block |
||
271 | 271 | $this->aSectionsets = $this->callBack( |
272 | 272 | $this->aCallbacks[ 'secitonsets_before_registration' ], |
273 | 273 | array( |
274 | - $this->aSectionsets, // 1st parameter |
|
274 | + $this->aSectionsets, // 1st parameter |
|
275 | 275 | ) |
276 | 276 | ); |
277 | 277 | // Let the main routine modify the fieldsets definition array. |
278 | 278 | $this->aFieldsets = $this->callBack( |
279 | 279 | $this->aCallbacks[ 'fieldsets_before_registration' ], |
280 | 280 | array( |
281 | - $this->aFieldsets, // 1st parameter |
|
282 | - $this->aSectionsets, // 2nd parameter |
|
281 | + $this->aFieldsets, // 1st parameter |
|
282 | + $this->aSectionsets, // 2nd parameter |
|
283 | 283 | ) |
284 | 284 | ); |
285 | 285 |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | $aOptions // data source |
69 | 69 | ); |
70 | 70 | |
71 | - foreach( $aOptions as $_sSectionID => $_aSubSectionOrFields ) { |
|
71 | + foreach ( $aOptions as $_sSectionID => $_aSubSectionOrFields ) { |
|
72 | 72 | |
73 | 73 | $_aSubSection = $this->_getSubSectionFromOptions( |
74 | 74 | $_sSectionID, |
@@ -105,10 +105,10 @@ discard block |
||
105 | 105 | |
106 | 106 | $_aSubSection = array(); |
107 | 107 | $_iPrevIndex = null; |
108 | - foreach( $_aSubSectionOrFields as $_isIndexOrFieldID => $_aSubSectionOrFieldOptions ) { |
|
108 | + foreach ( $_aSubSectionOrFields as $_isIndexOrFieldID => $_aSubSectionOrFieldOptions ) { |
|
109 | 109 | |
110 | 110 | // If it is not a sub-section array, skip. |
111 | - if ( ! $this->isNumericInteger( $_isIndexOrFieldID ) ) { |
|
111 | + if ( !$this->isNumericInteger( $_isIndexOrFieldID ) ) { |
|
112 | 112 | continue; |
113 | 113 | } |
114 | 114 | |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | ); |
123 | 123 | |
124 | 124 | // Update the internal section index key |
125 | - foreach( $_aSubSection[ $_iIndex ] as &$_aField ) { |
|
125 | + foreach ( $_aSubSection[ $_iIndex ] as &$_aField ) { |
|
126 | 126 | $_aField[ '_section_index' ] = $_iIndex; |
127 | 127 | } |
128 | 128 | unset( $_aField ); // to be safe in PHP |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | */ |
148 | 148 | private function _getSubSectionItemsFromOptions( array $_aSubSection, $_sSectionID, $_iIndex, $_iPrevIndex ) { |
149 | 149 | |
150 | - if ( ! isset( $this->aFieldsets[ $_sSectionID ] ) ) { |
|
150 | + if ( !isset( $this->aFieldsets[ $_sSectionID ] ) ) { |
|
151 | 151 | return array(); |
152 | 152 | } |
153 | 153 | |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | : $this->getNonIntegerKeyElements( $this->aFieldsets[ $_sSectionID ] ); |
157 | 157 | |
158 | 158 | // if empty, merge with the previous element. |
159 | - return ! empty( $_aFields ) |
|
159 | + return !empty( $_aFields ) |
|
160 | 160 | ? $_aFields |
161 | 161 | : $this->getElementAsArray( |
162 | 162 | $_aSubSection, |
@@ -108,7 +108,7 @@ |
||
108 | 108 | foreach( $_aSubSectionOrFields as $_isIndexOrFieldID => $_aSubSectionOrFieldOptions ) { |
109 | 109 | |
110 | 110 | // If it is not a sub-section array, skip. |
111 | - if ( ! $this->isNumericInteger( $_isIndexOrFieldID ) ) { |
|
111 | + if ( ! $this->isNumericInteger( $_isIndexOrFieldID ) ) { |
|
112 | 112 | continue; |
113 | 113 | } |
114 | 114 |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | /** |
44 | 44 | * Stores the section definition. |
45 | 45 | */ |
46 | - public $aSection = array(); |
|
46 | + public $aSection = array(); |
|
47 | 47 | |
48 | 48 | /** |
49 | 49 | * Indicates the sub section index. |
@@ -91,8 +91,8 @@ discard block |
||
91 | 91 | |
92 | 92 | $_aSection[ '_is_collapsible' ] = $_aSection[ 'collapsible' ] && 'section' === $_aSection[ 'collapsible' ][ 'container' ]; |
93 | 93 | |
94 | - $_aSection[ '_tag_id' ] = 'section-' . $_aSection[ 'section_id' ] . '__' . $this->iIndex; |
|
95 | - $_aSection[ '_tag_id_model' ] = 'section-' . $_aSection[ 'section_id' ] . '__' . '___i___'; |
|
94 | + $_aSection[ '_tag_id' ] = 'section-'.$_aSection[ 'section_id' ].'__'.$this->iIndex; |
|
95 | + $_aSection[ '_tag_id_model' ] = 'section-'.$_aSection[ 'section_id' ].'__'.'___i___'; |
|
96 | 96 | |
97 | 97 | return $_aSection; |
98 | 98 |