@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | */ |
17 | 17 | class AdminPageFramework_Form_Model___DefaultValues extends AdminPageFramework_Form_Base { |
18 | 18 | |
19 | - public $aFieldsets = array(); |
|
19 | + public $aFieldsets = array(); |
|
20 | 20 | |
21 | 21 | /** |
22 | 22 | * Sets up hooks. |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | $_aParameters = func_get_args() + array( |
28 | 28 | $this->aFieldsets, |
29 | 29 | ); |
30 | - $this->aFieldsets = $_aParameters[ 0 ]; |
|
30 | + $this->aFieldsets = $_aParameters[ 0 ]; |
|
31 | 31 | |
32 | 32 | } |
33 | 33 | |
@@ -85,13 +85,13 @@ discard block |
||
85 | 85 | */ |
86 | 86 | private function _getDefaultValues( $aFieldsets, $aDefaultOptions ) { |
87 | 87 | |
88 | - foreach( $aFieldsets as $_sSectionPath => $_aItems ) { |
|
88 | + foreach ( $aFieldsets as $_sSectionPath => $_aItems ) { |
|
89 | 89 | |
90 | 90 | $_aSectionPath = explode( '|', $_sSectionPath ); |
91 | - foreach( $_aItems as $_sFieldPath => $_aFieldset ) { |
|
91 | + foreach ( $_aItems as $_sFieldPath => $_aFieldset ) { |
|
92 | 92 | $_aFieldPath = explode( '|', $_sFieldPath ); |
93 | 93 | $this->setMultiDimensionalArray( |
94 | - $aDefaultOptions, // by reference |
|
94 | + $aDefaultOptions, // by reference |
|
95 | 95 | '_default' === $_sSectionPath |
96 | 96 | ? array( $_sFieldPath ) |
97 | 97 | : array_merge( $_aSectionPath, $_aFieldPath ), // key address |
@@ -121,11 +121,11 @@ discard block |
||
121 | 121 | // If there are no sub-fields |
122 | 122 | if ( count( $_aSubFields ) == 0 ) { |
123 | 123 | return $this->getElement( |
124 | - $aFieldset, // subject |
|
125 | - 'value', // key |
|
124 | + $aFieldset, // subject |
|
125 | + 'value', // key |
|
126 | 126 | $this->getElement( // default value |
127 | - $aFieldset, // subject |
|
128 | - 'default', // key |
|
127 | + $aFieldset, // subject |
|
128 | + 'default', // key |
|
129 | 129 | null // default value |
130 | 130 | ) |
131 | 131 | ); |
@@ -134,13 +134,13 @@ discard block |
||
134 | 134 | // Otherwise, there are sub-fields |
135 | 135 | $_aDefault = array(); |
136 | 136 | array_unshift( $_aSubFields, $aFieldset ); // insert the main field into the very first index. |
137 | - foreach( $_aSubFields as $_iIndex => $_aField ) { |
|
137 | + foreach ( $_aSubFields as $_iIndex => $_aField ) { |
|
138 | 138 | $_aDefault[ $_iIndex ] = $this->getElement( |
139 | - $_aField, // subject |
|
140 | - 'value', // key |
|
139 | + $_aField, // subject |
|
140 | + 'value', // key |
|
141 | 141 | $this->getElement( // default value |
142 | - $_aField, // subject |
|
143 | - 'default', // key |
|
142 | + $_aField, // subject |
|
143 | + 'default', // key |
|
144 | 144 | null // default value |
145 | 145 | ) |
146 | 146 | ); |
@@ -63,9 +63,9 @@ discard block |
||
63 | 63 | } |
64 | 64 | |
65 | 65 | $_aSectionsets = $this->_getSectionsetsFormatted( |
66 | - array(), // section-sets array to modify - new formatted items will be stored here |
|
67 | - $this->aSectionsets, // parsing section-sets |
|
68 | - array(), // section path - empty for root |
|
66 | + array(), // section-sets array to modify - new formatted items will be stored here |
|
67 | + $this->aSectionsets, // parsing section-sets |
|
68 | + array(), // section path - empty for root |
|
69 | 69 | $this->sCapability // capability |
70 | 70 | ); |
71 | 71 | |
@@ -82,10 +82,10 @@ discard block |
||
82 | 82 | */ |
83 | 83 | private function _getSectionsetsFormatted( $_aNewSectionsets, $aSectionsetsToParse, $aSectionPath, $sCapability ) { |
84 | 84 | |
85 | - foreach( $aSectionsetsToParse as $_sSectionPath => $_aSectionset ) { |
|
85 | + foreach ( $aSectionsetsToParse as $_sSectionPath => $_aSectionset ) { |
|
86 | 86 | |
87 | 87 | // The '_default' section can be empty so do not check `if ( empty( $_aSectionset ) )` here. |
88 | - if ( ! is_array( $_aSectionset ) ) { |
|
88 | + if ( !is_array( $_aSectionset ) ) { |
|
89 | 89 | continue; |
90 | 90 | } |
91 | 91 | |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | |
117 | 117 | // 3.7.0+ For nested sections |
118 | 118 | $_aNewSectionsets = $this->_getNestedSections( |
119 | - $_aNewSectionsets, // sectionset array to modify |
|
119 | + $_aNewSectionsets, // sectionset array to modify |
|
120 | 120 | $_aSectionset, |
121 | 121 | $_aSectionPath, // section path |
122 | 122 | $_aSectionset[ 'capability' ] |
@@ -133,15 +133,15 @@ discard block |
||
133 | 133 | */ |
134 | 134 | private function _getNestedSections( $aSectionsetsToEdit, $aSectionset, $aSectionPath, $sCapability ) { |
135 | 135 | |
136 | - if ( ! $this->_hasNestedSections( $aSectionset ) ) { |
|
136 | + if ( !$this->_hasNestedSections( $aSectionset ) ) { |
|
137 | 137 | return $aSectionsetsToEdit; |
138 | 138 | } |
139 | 139 | |
140 | 140 | // Recursive call |
141 | 141 | return $this->_getSectionsetsFormatted( |
142 | - $aSectionsetsToEdit, // section-sets array to modify - new formatted items will be stored here |
|
143 | - $aSectionset[ 'content' ], // parsing section-sets |
|
144 | - $aSectionPath, // section path - empty for root |
|
142 | + $aSectionsetsToEdit, // section-sets array to modify - new formatted items will be stored here |
|
143 | + $aSectionset[ 'content' ], // parsing section-sets |
|
144 | + $aSectionPath, // section path - empty for root |
|
145 | 145 | $sCapability // capability |
146 | 146 | ); |
147 | 147 | |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | private function _hasNestedSections( $aSectionset ) { |
155 | 155 | |
156 | 156 | $aSectionset = $aSectionset + array( 'content' => null ); |
157 | - if ( ! is_array( $aSectionset[ 'content' ] ) ) { |
|
157 | + if ( !is_array( $aSectionset[ 'content' ] ) ) { |
|
158 | 158 | return false; |
159 | 159 | } |
160 | 160 | $_aContents = $aSectionset[ 'content' ]; |
@@ -28,38 +28,38 @@ discard block |
||
28 | 28 | static public $aStructure = array( |
29 | 29 | |
30 | 30 | // Required Keys |
31 | - 'field_id' => null, // (string) |
|
32 | - 'section_id' => null, // (string) |
|
31 | + 'field_id' => null, // (string) |
|
32 | + 'section_id' => null, // (string) |
|
33 | 33 | |
34 | 34 | // Optional Keys |
35 | - 'type' => null, // (string) (3.8.0+ Became okay to omit.) |
|
36 | - 'section_title' => null, // This will be assigned automatically in the formatting method. |
|
37 | - 'page_slug' => null, // This will be assigned automatically in the formatting method. |
|
38 | - 'tab_slug' => null, // This will be assigned automatically in the formatting method. |
|
39 | - 'option_key' => null, // This will be assigned automatically in the formatting method. |
|
40 | - 'class_name' => null, // Stores the instantiated class name. Used by the export field type. Also a third party custom field type uses it. |
|
35 | + 'type' => null, // (string) (3.8.0+ Became okay to omit.) |
|
36 | + 'section_title' => null, // This will be assigned automatically in the formatting method. |
|
37 | + 'page_slug' => null, // This will be assigned automatically in the formatting method. |
|
38 | + 'tab_slug' => null, // This will be assigned automatically in the formatting method. |
|
39 | + 'option_key' => null, // This will be assigned automatically in the formatting method. |
|
40 | + 'class_name' => null, // Stores the instantiated class name. Used by the export field type. Also a third party custom field type uses it. |
|
41 | 41 | 'capability' => null, |
42 | 42 | 'title' => null, |
43 | 43 | 'tip' => null, |
44 | 44 | 'description' => null, |
45 | - 'error_message' => null, // error message for the field |
|
45 | + 'error_message' => null, // error message for the field |
|
46 | 46 | 'before_label' => null, |
47 | 47 | 'after_label' => null, |
48 | 48 | 'if' => true, |
49 | - 'order' => null, // do not set the default number here for this key. |
|
49 | + 'order' => null, // do not set the default number here for this key. |
|
50 | 50 | 'default' => null, |
51 | 51 | 'value' => null, |
52 | - 'help' => null, // 2.1.0 |
|
53 | - 'help_aside' => null, // 2.1.0 |
|
54 | - 'repeatable' => null, // 2.1.3 |
|
55 | - 'sortable' => null, // 2.1.3 |
|
56 | - 'show_title_column' => true, // 3.0.0 |
|
57 | - 'hidden' => null, // 3.0.0 |
|
52 | + 'help' => null, // 2.1.0 |
|
53 | + 'help_aside' => null, // 2.1.0 |
|
54 | + 'repeatable' => null, // 2.1.3 |
|
55 | + 'sortable' => null, // 2.1.3 |
|
56 | + 'show_title_column' => true, // 3.0.0 |
|
57 | + 'hidden' => null, // 3.0.0 |
|
58 | 58 | |
59 | - 'placement' => 'normal', // 3.8.0 (string) accepts either 'section_title', 'field_title', or 'normal' |
|
59 | + 'placement' => 'normal', // 3.8.0 (string) accepts either 'section_title', 'field_title', or 'normal' |
|
60 | 60 | |
61 | 61 | // @todo Examine why an array is not set but null here for the attributes argument. |
62 | - 'attributes' => null, // 3.0.0 - the array represents the attributes of input tag |
|
62 | + 'attributes' => null, // 3.0.0 - the array represents the attributes of input tag |
|
63 | 63 | 'class' => array( // 3.3.1 |
64 | 64 | 'fieldrow' => array(), |
65 | 65 | 'fieldset' => array(), |
@@ -67,29 +67,29 @@ discard block |
||
67 | 67 | 'field' => array(), |
68 | 68 | ), |
69 | 69 | |
70 | - 'save' => true, // 3.6.0 |
|
71 | - 'content' => null, // 3.6.1 - (string) An overriding field-set output. |
|
70 | + 'save' => true, // 3.6.0 |
|
71 | + 'content' => null, // 3.6.1 - (string) An overriding field-set output. |
|
72 | 72 | |
73 | - 'show_debug_info' => null, // 3.8.8+ (boolean) whether to show debug information such as field definition tool-tips. This value is inherited from the section definition argument of the same name. Not setting a value here as it is determined with another calculated value. |
|
73 | + 'show_debug_info' => null, // 3.8.8+ (boolean) whether to show debug information such as field definition tool-tips. This value is inherited from the section definition argument of the same name. Not setting a value here as it is determined with another calculated value. |
|
74 | 74 | |
75 | 75 | // Internal Keys |
76 | - '_fields_type' => null, // @deprecated 3.7.0, 3.0.0 - an internal key that indicates the fields type such as page, meta box for pages, meta box for posts, or taxonomy. |
|
77 | - '_structure_type' => null, // 3.7.0 |
|
78 | - '_caller_object' => null, // 3.4.0 (object) stores the object of the caller class. The object is referenced when creating nested fields. |
|
79 | - |
|
80 | - '_section_path' => '', // 3.7.0 (string) Stores the section path that indicates the structural address of the nested section. e.g. my_section|nested_one |
|
81 | - '_section_path_array' => '', // 3.7.0 (array) An array version of the above section path. |
|
82 | - '_nested_depth' => 0, // 3.4.0 (integer) stores the level of the nesting depth. This is mostly used for debugging by checking if the field is a nested field or not. |
|
83 | - '_subsection_index' => null, // 3.7.0 Passed to the `field_definition_{...}` filter hook callbacks. |
|
84 | - '_section_repeatable' => false, // @deprecated |
|
85 | - '_is_section_repeatable' => false, // 3.8.0 (boolean) Whether the belonging section is repeatable or not. |
|
86 | - |
|
87 | - '_field_path' => '', // 3.7.0 (string) Stores the field path that indicates the structural location of the field. This is relative to the belonging section. |
|
76 | + '_fields_type' => null, // @deprecated 3.7.0, 3.0.0 - an internal key that indicates the fields type such as page, meta box for pages, meta box for posts, or taxonomy. |
|
77 | + '_structure_type' => null, // 3.7.0 |
|
78 | + '_caller_object' => null, // 3.4.0 (object) stores the object of the caller class. The object is referenced when creating nested fields. |
|
79 | + |
|
80 | + '_section_path' => '', // 3.7.0 (string) Stores the section path that indicates the structural address of the nested section. e.g. my_section|nested_one |
|
81 | + '_section_path_array' => '', // 3.7.0 (array) An array version of the above section path. |
|
82 | + '_nested_depth' => 0, // 3.4.0 (integer) stores the level of the nesting depth. This is mostly used for debugging by checking if the field is a nested field or not. |
|
83 | + '_subsection_index' => null, // 3.7.0 Passed to the `field_definition_{...}` filter hook callbacks. |
|
84 | + '_section_repeatable' => false, // @deprecated |
|
85 | + '_is_section_repeatable' => false, // 3.8.0 (boolean) Whether the belonging section is repeatable or not. |
|
86 | + |
|
87 | + '_field_path' => '', // 3.7.0 (string) Stores the field path that indicates the structural location of the field. This is relative to the belonging section. |
|
88 | 88 | '_field_path_array' => array(), // 3.7.0 (array) An array version of the above field path. |
89 | - '_parent_field_path' => '', // 3.8.0 (string) |
|
89 | + '_parent_field_path' => '', // 3.8.0 (string) |
|
90 | 90 | '_parent_field_path_array' => array(), // 3.8.0 (array) |
91 | 91 | |
92 | - '_is_title_embedded' => false, // 3.8.0 (boolean) whether the field title is in the fieldset element, not in the table th element. This becomes `true` for `section_title` fields and fields with the `placement` argument with the value of `section_title` or `field_title`. |
|
92 | + '_is_title_embedded' => false, // 3.8.0 (boolean) whether the field title is in the fieldset element, not in the table th element. This becomes `true` for `section_title` fields and fields with the `placement` argument with the value of `section_title` or `field_title`. |
|
93 | 93 | |
94 | 94 | ); |
95 | 95 | |
@@ -166,14 +166,14 @@ discard block |
||
166 | 166 | array( |
167 | 167 | '_fields_type' => $this->sStructureType, // @deprecated 3.7.0 backward-compatibility |
168 | 168 | '_structure_type' => $this->sStructureType, |
169 | - '_caller_object' => $this->oCallerObject, // 3.4.1+ Stores the caller form object. |
|
170 | - '_subsection_index' => $this->iSubSectionIndex, // 3.7.0+ |
|
169 | + '_caller_object' => $this->oCallerObject, // 3.4.1+ Stores the caller form object. |
|
170 | + '_subsection_index' => $this->iSubSectionIndex, // 3.7.0+ |
|
171 | 171 | ) |
172 | 172 | + $this->aFieldset, |
173 | 173 | array( |
174 | 174 | 'capability' => $this->sCapability, |
175 | 175 | 'section_id' => '_default', |
176 | - '_section_repeatable' => $this->bIsSectionRepeatable, // @deprecated 3.8.0 This was not used. |
|
176 | + '_section_repeatable' => $this->bIsSectionRepeatable, // @deprecated 3.8.0 This was not used. |
|
177 | 177 | '_is_section_repeatable' => $this->bIsSectionRepeatable, |
178 | 178 | ) |
179 | 179 | + self::$aStructure |
@@ -294,12 +294,12 @@ discard block |
||
294 | 294 | |
295 | 295 | ); |
296 | 296 | |
297 | - foreach( $aNestedFieldsets as $_isIndex => &$_aNestedFieldset ) { |
|
297 | + foreach ( $aNestedFieldsets as $_isIndex => &$_aNestedFieldset ) { |
|
298 | 298 | |
299 | 299 | // The inline-mixed type has a string element. |
300 | 300 | if ( is_scalar( $_aNestedFieldset ) ) { |
301 | 301 | $_aNestedFieldset = array( |
302 | - 'field_id' => $aParentFieldset[ 'field_id' ] . '_' . uniqid(), |
|
302 | + 'field_id' => $aParentFieldset[ 'field_id' ].'_'.uniqid(), |
|
303 | 303 | 'content' => $_aNestedFieldset, |
304 | 304 | ); |
305 | 305 | } |
@@ -34,47 +34,47 @@ discard block |
||
34 | 34 | // Optional |
35 | 35 | 'page_slug' => null, |
36 | 36 | 'tab_slug' => null, |
37 | - 'section_tab_slug' => null, // 3.0.0+ |
|
37 | + 'section_tab_slug' => null, // 3.0.0+ |
|
38 | 38 | 'title' => null, |
39 | 39 | 'description' => null, |
40 | 40 | 'capability' => null, |
41 | 41 | 'if' => true, |
42 | - 'order' => null, // do not set the default number here because incremented numbers will be added when registering the sections. |
|
42 | + 'order' => null, // do not set the default number here because incremented numbers will be added when registering the sections. |
|
43 | 43 | 'help' => null, |
44 | 44 | 'help_aside' => null, |
45 | - 'repeatable' => false, // (boolean|array) 3.0.0+ |
|
46 | - 'sortable' => false, // (boolean|array) 3.6.0+ |
|
45 | + 'repeatable' => false, // (boolean|array) 3.0.0+ |
|
46 | + 'sortable' => false, // (boolean|array) 3.6.0+ |
|
47 | 47 | 'attributes' => array( // 3.3.1+ |
48 | - 'class' => null, // set null to avoid undefined index warnings. |
|
49 | - 'style' => null, // set null to avoid undefined index warnings. |
|
48 | + 'class' => null, // set null to avoid undefined index warnings. |
|
49 | + 'style' => null, // set null to avoid undefined index warnings. |
|
50 | 50 | 'tab' => array(), |
51 | 51 | ), |
52 | 52 | 'class' => array( // 3.3.1+ |
53 | 53 | 'tab' => array(), |
54 | 54 | ), |
55 | - 'hidden' => false, // 3.3.1+ |
|
56 | - 'collapsible' => false, // 3.4.0+ (boolean|array) For the array structure see the $aStructure_CollapsibleArguments property. |
|
57 | - 'save' => true, // 3.6.0+ |
|
55 | + 'hidden' => false, // 3.3.1+ |
|
56 | + 'collapsible' => false, // 3.4.0+ (boolean|array) For the array structure see the $aStructure_CollapsibleArguments property. |
|
57 | + 'save' => true, // 3.6.0+ |
|
58 | 58 | |
59 | - 'content' => null, // 3.6.1+ (string) An overriding section-set output. |
|
59 | + 'content' => null, // 3.6.1+ (string) An overriding section-set output. |
|
60 | 60 | |
61 | - 'tip' => null, // 3.7.0 (string) Tool tip HTML strings. |
|
61 | + 'tip' => null, // 3.7.0 (string) Tool tip HTML strings. |
|
62 | 62 | |
63 | 63 | // Internal |
64 | - '_fields_type' => null, // @deprecated 3.7.0+ Use the `_structure_type` instead. 3.0.0+ - same as the one of the field definition array. Used to insert debug info at the bottom of sections. |
|
65 | - '_structure_type' => null, // 3.7.0+ |
|
66 | - '_is_first_index' => false, // 3.4.0+ (boolean) indicates whether it is the first item of the sub-sections (for repeatable sections). |
|
67 | - '_is_last_index' => false, // 3.4.0+ (boolean) indicates whether it is the last item of the sub-sections (for repeatable sections). |
|
64 | + '_fields_type' => null, // @deprecated 3.7.0+ Use the `_structure_type` instead. 3.0.0+ - same as the one of the field definition array. Used to insert debug info at the bottom of sections. |
|
65 | + '_structure_type' => null, // 3.7.0+ |
|
66 | + '_is_first_index' => false, // 3.4.0+ (boolean) indicates whether it is the first item of the sub-sections (for repeatable sections). |
|
67 | + '_is_last_index' => false, // 3.4.0+ (boolean) indicates whether it is the last item of the sub-sections (for repeatable sections). |
|
68 | 68 | |
69 | - '_section_path' => '', // 3.7.0+ (string) e.g. my_section|nested_section |
|
70 | - '_section_path_array' => '', // 3.7.0+ (array) an array version of the above section_path argument. Numerically indexed. |
|
71 | - '_nested_depth' => 0, // 3.7.0+ (integer) the nested level of the section |
|
69 | + '_section_path' => '', // 3.7.0+ (string) e.g. my_section|nested_section |
|
70 | + '_section_path_array' => '', // 3.7.0+ (array) an array version of the above section_path argument. Numerically indexed. |
|
71 | + '_nested_depth' => 0, // 3.7.0+ (integer) the nested level of the section |
|
72 | 72 | |
73 | 73 | // 3.6.0+ - (object) the caller framework factory object. This allows the framework to access the factory property when rendering the section. |
74 | 74 | // 3.7.0+ It no longer stores a factory object but a form object. |
75 | 75 | '_caller_object' => null, |
76 | 76 | |
77 | - 'show_debug_info' => null, // 3.8.8+ (boolean) Whether to display debug information. Inherits the page/in-page-tab setting (actually the factory property value of `$bShowDebugInfo` which gets updated by the page/tab setting). |
|
77 | + 'show_debug_info' => null, // 3.8.8+ (boolean) Whether to display debug information. Inherits the page/in-page-tab setting (actually the factory property value of `$bShowDebugInfo` which gets updated by the page/tab setting). |
|
78 | 78 | |
79 | 79 | ); |
80 | 80 | |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | |
94 | 94 | public $oCaller = null; |
95 | 95 | |
96 | - public $bShowDebugInfo = true; // 3.8.8+ |
|
96 | + public $bShowDebugInfo = true; // 3.8.8+ |
|
97 | 97 | |
98 | 98 | /** |
99 | 99 | * Sets up properties. |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | $this->sCapability, |
108 | 108 | $this->iCountOfElements, |
109 | 109 | $this->oCaller, |
110 | - $this->bShowDebugInfo, // 3.8.8+ |
|
110 | + $this->bShowDebugInfo, // 3.8.8+ |
|
111 | 111 | ); |
112 | 112 | $this->aSectionset = $_aParameters[ 0 ]; |
113 | 113 | $this->sSectionPath = $_aParameters[ 1 ]; |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | $this->sCapability = $_aParameters[ 3 ]; |
116 | 116 | $this->iCountOfElements = $_aParameters[ 4 ]; |
117 | 117 | $this->oCaller = $_aParameters[ 5 ]; |
118 | - $this->bShowDebugInfo = $_aParameters[ 6 ]; // 3.8.8+ |
|
118 | + $this->bShowDebugInfo = $_aParameters[ 6 ]; // 3.8.8+ |
|
119 | 119 | |
120 | 120 | } |
121 | 121 | |
@@ -130,16 +130,16 @@ discard block |
||
130 | 130 | $_aSectionPath = explode( '|', $this->sSectionPath ); |
131 | 131 | $_aSectionset = $this->uniteArrays( |
132 | 132 | array( |
133 | - '_fields_type' => $this->sStructureType, // @deprecated 3.7.0+ |
|
134 | - '_structure_type' => $this->sStructureType, // 3.7.0+ |
|
135 | - '_section_path' => $this->sSectionPath, // 3.7.0+ |
|
133 | + '_fields_type' => $this->sStructureType, // @deprecated 3.7.0+ |
|
134 | + '_structure_type' => $this->sStructureType, // 3.7.0+ |
|
135 | + '_section_path' => $this->sSectionPath, // 3.7.0+ |
|
136 | 136 | '_section_path_array' => $_aSectionPath, |
137 | - '_nested_depth' => count( $_aSectionPath ) - 1, // 3.7.0+ - zero base |
|
137 | + '_nested_depth' => count( $_aSectionPath ) - 1, // 3.7.0+ - zero base |
|
138 | 138 | ) |
139 | 139 | + $this->aSectionset |
140 | 140 | + array( |
141 | 141 | 'capability' => $this->sCapability, |
142 | - 'show_debug_info' => $this->bShowDebugInfo, // 3.8.8+ |
|
142 | + 'show_debug_info' => $this->bShowDebugInfo, // 3.8.8+ |
|
143 | 143 | ), |
144 | 144 | self::$aStructure |
145 | 145 | ); |
@@ -44,7 +44,7 @@ |
||
44 | 44 | $this->unsetDimensionalArrayElement( |
45 | 45 | $this->aSubject, |
46 | 46 | explode( '|', $_sFlatFieldAddress ) |
47 | - ); |
|
47 | + ); |
|
48 | 48 | } |
49 | 49 | return $this->aSubject; |
50 | 50 | } |
@@ -40,7 +40,7 @@ |
||
40 | 40 | * @return array The formatted definition array. |
41 | 41 | */ |
42 | 42 | public function get() { |
43 | - foreach( $this->aDimensionalKeys as $_sFlatFieldAddress ) { |
|
43 | + foreach ( $this->aDimensionalKeys as $_sFlatFieldAddress ) { |
|
44 | 44 | $this->unsetDimensionalArrayElement( |
45 | 45 | $this->aSubject, |
46 | 46 | explode( '|', $_sFlatFieldAddress ) |
@@ -60,18 +60,18 @@ discard block |
||
60 | 60 | |
61 | 61 | // Drop keys of fields-array which do not exist in the sections-array. |
62 | 62 | // For this reasons, the sections-array should be conditioned first before applying this method. |
63 | - $aFields = $this->castArrayContents( $aSections, $aFields ); |
|
63 | + $aFields = $this->castArrayContents( $aSections, $aFields ); |
|
64 | 64 | |
65 | 65 | $_aNewFields = array(); |
66 | - foreach( $aFields as $_sSectionID => $_aSubSectionOrFields ) { |
|
66 | + foreach ( $aFields as $_sSectionID => $_aSubSectionOrFields ) { |
|
67 | 67 | |
68 | 68 | // This type check is important as the parsing field array is content-cast, which can set null value to elements. |
69 | - if ( ! is_array( $_aSubSectionOrFields ) ) { |
|
69 | + if ( !is_array( $_aSubSectionOrFields ) ) { |
|
70 | 70 | continue; |
71 | 71 | } |
72 | 72 | |
73 | 73 | $this->_setConditionedFields( |
74 | - $_aNewFields, // by reference - gets updated in the method. |
|
74 | + $_aNewFields, // by reference - gets updated in the method. |
|
75 | 75 | $_aSubSectionOrFields, |
76 | 76 | $_sSectionID |
77 | 77 | ); |
@@ -91,14 +91,14 @@ discard block |
||
91 | 91 | */ |
92 | 92 | private function _setConditionedFields( array &$_aNewFields, $_aSubSectionOrFields, $_sSectionID ) { |
93 | 93 | |
94 | - foreach( $_aSubSectionOrFields as $_sIndexOrFieldID => $_aSubSectionOrField ) { |
|
94 | + foreach ( $_aSubSectionOrFields as $_sIndexOrFieldID => $_aSubSectionOrField ) { |
|
95 | 95 | |
96 | 96 | // If it is a sub-section array. |
97 | 97 | if ( $this->isNumericInteger( $_sIndexOrFieldID ) ) { |
98 | 98 | $_sSubSectionIndex = $_sIndexOrFieldID; |
99 | 99 | $_aFields = $_aSubSectionOrField; |
100 | - foreach( $_aFields as $_aField ) { |
|
101 | - if ( ! $this->_isAllowed( $_aField ) ) { |
|
100 | + foreach ( $_aFields as $_aField ) { |
|
101 | + if ( !$this->_isAllowed( $_aField ) ) { |
|
102 | 102 | continue; |
103 | 103 | } |
104 | 104 | $_aNewFields[ $_sSectionID ][ $_sSubSectionIndex ][ $_aField[ 'field_id' ] ] = $_aField; |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | |
110 | 110 | // Otherwise, insert the formatted field definition array. |
111 | 111 | $_aField = $_aSubSectionOrField; |
112 | - if ( ! $this->_isAllowed( $_aField ) ) { |
|
112 | + if ( !$this->_isAllowed( $_aField ) ) { |
|
113 | 113 | continue; |
114 | 114 | } |
115 | 115 | $_aNewFields[ $_sSectionID ][ $_aField[ 'field_id' ] ] = $_aField; |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | */ |
19 | 19 | class AdminPageFramework_Form_Model___SectionConditioner extends AdminPageFramework_FrameworkUtility { |
20 | 20 | |
21 | - public $aSectionsets = array(); |
|
21 | + public $aSectionsets = array(); |
|
22 | 22 | |
23 | 23 | /** |
24 | 24 | * Sets up hooks. |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | $_aParameters = func_get_args() + array( |
30 | 30 | $this->aSectionsets, |
31 | 31 | ); |
32 | - $this->aSectionsets = $_aParameters[ 0 ]; |
|
32 | + $this->aSectionsets = $_aParameters[ 0 ]; |
|
33 | 33 | |
34 | 34 | } |
35 | 35 | |
@@ -51,11 +51,11 @@ discard block |
||
51 | 51 | * @since 3.7.0 Moved from `AdminPageFramework_FormDefinition`. Changed the name from `getConditionedSections()`. |
52 | 52 | * @return array The conditioned sectionsets array. |
53 | 53 | */ |
54 | - private function _getSectionsConditioned( array $aSections=array() ) { |
|
54 | + private function _getSectionsConditioned( array $aSections = array() ) { |
|
55 | 55 | |
56 | - $_aNewSections = array(); |
|
57 | - foreach( $aSections as $_sSectionID => $_aSection ) { |
|
58 | - if ( ! $this->_isAllowed( $_aSection ) ) { |
|
56 | + $_aNewSections = array(); |
|
57 | + foreach ( $aSections as $_sSectionID => $_aSection ) { |
|
58 | + if ( !$this->_isAllowed( $_aSection ) ) { |
|
59 | 59 | continue; |
60 | 60 | } |
61 | 61 | $_aNewSections[ $_sSectionID ] = $_aSection; |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | protected function _isAllowed( array $aDefinition ) { |
75 | 75 | |
76 | 76 | // Check capability. If the access level is not sufficient, skip. |
77 | - if ( ! current_user_can( $aDefinition[ 'capability' ] ) ) { |
|
77 | + if ( !current_user_can( $aDefinition[ 'capability' ] ) ) { |
|
78 | 78 | return false; |
79 | 79 | } |
80 | 80 | return ( boolean ) $aDefinition[ 'if' ]; |
@@ -42,9 +42,9 @@ discard block |
||
42 | 42 | 'posttype', |
43 | 43 | 'size', |
44 | 44 | 'section_title', // 3.0.0+ |
45 | - 'system', // 3.3.0+ |
|
46 | - 'inline_mixed', // 3.8.0+ |
|
47 | - '_nested', // 3.8.0+ |
|
45 | + 'system', // 3.3.0+ |
|
46 | + 'inline_mixed', // 3.8.0+ |
|
47 | + '_nested', // 3.8.0+ |
|
48 | 48 | ); |
49 | 49 | |
50 | 50 | public $sCallerID = ''; |
@@ -74,16 +74,16 @@ discard block |
||
74 | 74 | public function get() { |
75 | 75 | |
76 | 76 | $_aFieldTypeDefinitions = array(); |
77 | - foreach( self::$_aDefaultFieldTypeSlugs as $_sFieldTypeSlug ) { |
|
77 | + foreach ( self::$_aDefaultFieldTypeSlugs as $_sFieldTypeSlug ) { |
|
78 | 78 | |
79 | 79 | $_sFieldTypeClassName = "AdminPageFramework_FieldType_{$_sFieldTypeSlug}"; |
80 | 80 | $_oFieldType = new $_sFieldTypeClassName( |
81 | - $this->sCallerID, // usually an instantiated class name |
|
82 | - null, // field type slugs - if it is different from the one defined in the class property |
|
81 | + $this->sCallerID, // usually an instantiated class name |
|
82 | + null, // field type slugs - if it is different from the one defined in the class property |
|
83 | 83 | $this->oMsg, |
84 | 84 | false // `false` to disable auto-registering. |
85 | 85 | ); |
86 | - foreach( $_oFieldType->aFieldTypeSlugs as $_sSlug ) { |
|
86 | + foreach ( $_oFieldType->aFieldTypeSlugs as $_sSlug ) { |
|
87 | 87 | $_aFieldTypeDefinitions[ $_sSlug ] = $_oFieldType->getDefinitionArray(); |
88 | 88 | } |
89 | 89 | } |
@@ -58,23 +58,23 @@ discard block |
||
58 | 58 | */ |
59 | 59 | public function get() { |
60 | 60 | |
61 | - $this->aResources[ 'internal_scripts' ] = $this->_getUpdatedInternalItemsByCallback( |
|
61 | + $this->aResources[ 'internal_scripts' ] = $this->_getUpdatedInternalItemsByCallback( |
|
62 | 62 | $this->aResources[ 'internal_scripts' ], |
63 | 63 | 'hfGetScripts' |
64 | 64 | ); |
65 | - $this->aResources[ 'internal_styles' ] = $this->_getUpdatedInternalItemsByCallback( |
|
65 | + $this->aResources[ 'internal_styles' ] = $this->_getUpdatedInternalItemsByCallback( |
|
66 | 66 | $this->aResources[ 'internal_styles' ], |
67 | 67 | 'hfGetStyles' |
68 | 68 | ); |
69 | - $this->aResources[ 'internal_styles_ie' ] = $this->_getUpdatedInternalItemsByCallback( |
|
69 | + $this->aResources[ 'internal_styles_ie' ] = $this->_getUpdatedInternalItemsByCallback( |
|
70 | 70 | $this->aResources[ 'internal_styles_ie' ], |
71 | 71 | 'hfGetIEStyles' |
72 | 72 | ); |
73 | - $this->aResources[ 'src_styles' ] = $this->_getUpdatedEnqueuingItemsByCallback( |
|
73 | + $this->aResources[ 'src_styles' ] = $this->_getUpdatedEnqueuingItemsByCallback( |
|
74 | 74 | $this->aResources[ 'src_styles' ], |
75 | 75 | 'aEnqueueStyles' |
76 | 76 | ); |
77 | - $this->aResources[ 'src_scripts' ] = $this->_getUpdatedEnqueuingItemsByCallback( |
|
77 | + $this->aResources[ 'src_scripts' ] = $this->_getUpdatedEnqueuingItemsByCallback( |
|
78 | 78 | $this->aResources[ 'src_scripts' ], |
79 | 79 | 'aEnqueueScripts' |
80 | 80 | ); |
@@ -88,10 +88,10 @@ discard block |
||
88 | 88 | */ |
89 | 89 | private function _getUpdatedInternalItemsByCallback( array $aSubject, $sKey ) { |
90 | 90 | $_oCallable = $this->getElement( $this->aFieldTypeDefinition, $sKey ); |
91 | - if ( ! is_callable( $_oCallable ) ) { |
|
91 | + if ( !is_callable( $_oCallable ) ) { |
|
92 | 92 | return $aSubject; |
93 | 93 | } |
94 | - $aSubject[] = call_user_func_array( |
|
94 | + $aSubject[ ] = call_user_func_array( |
|
95 | 95 | $_oCallable, |
96 | 96 | array() |
97 | 97 | ); |