@@ -110,7 +110,6 @@ |
||
110 | 110 | * Retrieves the settings error array set by the user in the validation callback. |
111 | 111 | * |
112 | 112 | * @since 3.7.8 |
113 | - * @param boolean $bDelete whether or not the transient should be deleted after retrieving it. |
|
114 | 113 | * @return array |
115 | 114 | */ |
116 | 115 | public function get() { |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | $_sTabSlug = $this->getElement( $_GET, 'tab', '' ); |
59 | 59 | $_sTabSlug = sanitize_text_field( $_sTabSlug ); |
60 | 60 | $_sUserID = get_current_user_id(); |
61 | - return "apf_li_" . md5( |
|
61 | + return "apf_li_".md5( |
|
62 | 62 | $_sPageNow |
63 | 63 | . $_sPageSlug |
64 | 64 | . $_sTabSlug |
@@ -96,13 +96,13 @@ discard block |
||
96 | 96 | * @return void |
97 | 97 | */ |
98 | 98 | public function _replyToSave() { |
99 | - if ( ! isset( self::$_aLastInputs ) ) { |
|
99 | + if ( !isset( self::$_aLastInputs ) ) { |
|
100 | 100 | return; |
101 | 101 | } |
102 | 102 | $this->setTransient( |
103 | 103 | $this->sTransientKey, |
104 | 104 | self::$_aLastInputs, |
105 | - 60*60 // store it for 1 hour |
|
105 | + 60 * 60 // store it for 1 hour |
|
106 | 106 | ); |
107 | 107 | } |
108 | 108 | |
@@ -122,9 +122,9 @@ discard block |
||
122 | 122 | $_aLastInputs = self::$_aCaches[ $this->sTransientKey ]; |
123 | 123 | } else { |
124 | 124 | $_aLastInputs = $this->getTransient( $this->sTransientKey ); |
125 | - self::$_aCaches[ $this->sTransientKey ] = $_aLastInputs; |
|
125 | + self::$_aCaches[ $this->sTransientKey ] = $_aLastInputs; |
|
126 | 126 | if ( false !== $_aLastInputs ) { |
127 | - $this->delete(); // deletes at the end of the script. |
|
127 | + $this->delete(); // deletes at the end of the script. |
|
128 | 128 | } |
129 | 129 | } |
130 | 130 |
@@ -99,6 +99,7 @@ discard block |
||
99 | 99 | * @since 3.1.1 Added a parameter. Changed to return the formatted sections array. |
100 | 100 | * @since 3.7.0 Moved from `AdminPageFramework_FormDefinition`. Changed the name from `formatFields()`. |
101 | 101 | * Added the `$aSectionsets` parameter. |
102 | + * @param string $sCapability |
|
102 | 103 | * @return array |
103 | 104 | */ |
104 | 105 | private function _getFieldsetsFormatted( array $aFieldsets, array $aSectionsets, $sCapability ) { |
@@ -278,6 +279,7 @@ discard block |
||
278 | 279 | * |
279 | 280 | * @since 3.0.0 |
280 | 281 | * @since 3.7.0 Moved from `AdminPageFramework_FormDefinition`. Changed the name from `formatField()`. |
282 | + * @param integer $iCountOfElements |
|
281 | 283 | * @return array|void An array of formatted field definition array. If required keys are not set, nothing will be returned. |
282 | 284 | */ |
283 | 285 | private function _getFieldsetFormatted( $aFieldset, $aSectionsets, $sCapability, $iCountOfElements, $iSubSectionIndex, $bIsSectionRepeatable, $oCallerObject ) { |
@@ -113,10 +113,10 @@ discard block |
||
113 | 113 | ); |
114 | 114 | |
115 | 115 | $_aNewFieldsets = array(); |
116 | - foreach( $aFieldsets as $_sSectionPath => $_aItems ) { |
|
116 | + foreach ( $aFieldsets as $_sSectionPath => $_aItems ) { |
|
117 | 117 | |
118 | 118 | // If the section is not set, skip. |
119 | - if ( ! isset( $aSectionsets[ $_sSectionPath ] ) ) { |
|
119 | + if ( !isset( $aSectionsets[ $_sSectionPath ] ) ) { |
|
120 | 120 | continue; |
121 | 121 | } |
122 | 122 | |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | $_aItems, |
126 | 126 | $this->getElement( // 3.6.0+ Get the section's capability |
127 | 127 | $aSectionsets, |
128 | - array( $_sSectionPath, 'capability', ), |
|
128 | + array( $_sSectionPath, 'capability',), |
|
129 | 129 | $sCapability |
130 | 130 | ), |
131 | 131 | $aSectionsets |
@@ -182,16 +182,16 @@ discard block |
||
182 | 182 | */ |
183 | 183 | private function _getNormalFieldsetsFormatted( $aItems, $sCapability, $aSectionsets, $_abSectionRepeatable ) { |
184 | 184 | |
185 | - $_aNewItems = array(); |
|
186 | - foreach( $aItems as $_sFieldID => $_aFieldset ) { |
|
185 | + $_aNewItems = array(); |
|
186 | + foreach ( $aItems as $_sFieldID => $_aFieldset ) { |
|
187 | 187 | |
188 | 188 | // Insert the formatted field definition array. The fields count is needed to set each order value. |
189 | - $_aFieldset = $this->_getFieldsetFormatted( |
|
189 | + $_aFieldset = $this->_getFieldsetFormatted( |
|
190 | 190 | $_aFieldset, |
191 | 191 | $aSectionsets, |
192 | 192 | $sCapability, |
193 | 193 | count( $_aNewItems ), // index of elements - zero based |
194 | - null, // sub-section index |
|
194 | + null, // sub-section index |
|
195 | 195 | $_abSectionRepeatable, |
196 | 196 | $this->oCallerForm |
197 | 197 | ); |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | * @return boolean |
211 | 211 | */ |
212 | 212 | private function _isSubSections( $aItems, $_abSectionRepeatable ) { |
213 | - if ( ! empty( $_abSectionRepeatable ) ) { |
|
213 | + if ( !empty( $_abSectionRepeatable ) ) { |
|
214 | 214 | return true; |
215 | 215 | } |
216 | 216 | return ( boolean ) count( $this->getIntegerKeyElements( $aItems ) ); |
@@ -221,9 +221,9 @@ discard block |
||
221 | 221 | private function _getSubSectionsFormatted( $aItems, $sCapability, $aSectionsets, $_abSectionRepeatable ) { |
222 | 222 | |
223 | 223 | $_aNewFieldset = array(); |
224 | - foreach( $this->numerizeElements( $aItems ) as $_iSubSectionIndex => $_aFieldsets ) { |
|
224 | + foreach ( $this->numerizeElements( $aItems ) as $_iSubSectionIndex => $_aFieldsets ) { |
|
225 | 225 | |
226 | - foreach( $_aFieldsets as $_aFieldset ) { |
|
226 | + foreach ( $_aFieldsets as $_aFieldset ) { |
|
227 | 227 | $_iCountElement = count( $this->getElementAsArray( $_aNewFieldset, $_iSubSectionIndex ) ); |
228 | 228 | $_aFieldset = $this->_getFieldsetFormatted( |
229 | 229 | $_aFieldset, |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | if ( empty( $_aFieldset ) ) { |
238 | 238 | continue; |
239 | 239 | } |
240 | - $_aNewFieldset[ $_iSubSectionIndex ][ $_aFieldset['field_id'] ] = $_aFieldset; |
|
240 | + $_aNewFieldset[ $_iSubSectionIndex ][ $_aFieldset[ 'field_id' ] ] = $_aFieldset; |
|
241 | 241 | } |
242 | 242 | uasort( $_aNewFieldset[ $_iSubSectionIndex ], array( $this, 'sortArrayByKey' ) ); |
243 | 243 | |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | } |
265 | 265 | |
266 | 266 | $_aSortedFields = array(); |
267 | - foreach( $aSectionsets as $_sSectionPath => $_aSecitonset ) { |
|
267 | + foreach ( $aSectionsets as $_sSectionPath => $_aSecitonset ) { |
|
268 | 268 | if ( isset( $aFieldsets[ $_sSectionPath ] ) ) { |
269 | 269 | $_aSortedFields[ $_sSectionPath ] = $aFieldsets[ $_sSectionPath ]; |
270 | 270 | } |
@@ -283,7 +283,7 @@ discard block |
||
283 | 283 | private function _getFieldsetFormatted( $aFieldset, $aSectionsets, $sCapability, $iCountOfElements, $iSubSectionIndex, $bIsSectionRepeatable, $oCallerObject ) { |
284 | 284 | |
285 | 285 | // 3.8.0+ Dropped the check for $aFieldset[ 'type' ] to allow it to be omitted. |
286 | - if ( ! isset( $aFieldset[ 'field_id' ] ) ) { |
|
286 | + if ( !isset( $aFieldset[ 'field_id' ] ) ) { |
|
287 | 287 | return; |
288 | 288 | } |
289 | 289 |
@@ -30,7 +30,6 @@ |
||
30 | 30 | * Returns the field container attribute array. |
31 | 31 | * |
32 | 32 | * @remark Formatting each sub-field should be performed prior to calling this method. |
33 | - * @param array $aField The (sub-)field definition array. This should have been formatted already. |
|
34 | 33 | * @return array The generated field container attribute array. |
35 | 34 | * @internal |
36 | 35 | * @since 3.5.3 |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | * |
25 | 25 | * @since 3.6.0 |
26 | 26 | */ |
27 | - public $sContext = 'field'; |
|
27 | + public $sContext = 'field'; |
|
28 | 28 | |
29 | 29 | /** |
30 | 30 | * Returns the field container attribute array. |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | protected function _getAttributes() { |
41 | 41 | |
42 | 42 | // 3.8.0+ Supports omitting the `type` argument. |
43 | - $_sFieldTypeSelector = $this->getAOrB( |
|
43 | + $_sFieldTypeSelector = $this->getAOrB( |
|
44 | 44 | $this->aArguments[ 'type' ], |
45 | 45 | " admin-page-framework-field-{$this->aArguments[ 'type' ]}", |
46 | 46 | '' |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | |
66 | 66 | return array( |
67 | 67 | 'id' => $this->aArguments[ '_field_container_id' ], |
68 | - 'data-type' => $this->aArguments[ 'type' ], // referred by the repeatable field JavaScript script. |
|
68 | + 'data-type' => $this->aArguments[ 'type' ], // referred by the repeatable field JavaScript script. |
|
69 | 69 | 'class' => "admin-page-framework-field{$_sFieldTypeSelector}{$_sNestedFieldSelector}{$_sMixedFieldSelector}{$_sChildFieldSelector}" |
70 | 70 | . $this->getAOrB( |
71 | 71 | $this->aArguments[ 'attributes' ][ 'disabled' ], |
@@ -126,6 +126,7 @@ discard block |
||
126 | 126 | * Retrieves a field output. |
127 | 127 | * |
128 | 128 | * @since 3.8.0 |
129 | + * @param boolean $bIsLastElement |
|
129 | 130 | * @return string |
130 | 131 | */ |
131 | 132 | private function _getFieldOutput( $sContent, $aField, $bIsLastElement ) { |
@@ -204,6 +205,7 @@ discard block |
||
204 | 205 | * Returns the final fields output. |
205 | 206 | * |
206 | 207 | * @since 3.1.0 |
208 | + * @param integer $iFieldsCount |
|
207 | 209 | * @return string |
208 | 210 | */ |
209 | 211 | private function _getFinalOutput( $aFieldset, array $aFieldsOutput, $iFieldsCount ) { |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | $this->aFieldset[ '_field_path_array' ], |
38 | 38 | $this->aFieldset[ 'error_message' ] |
39 | 39 | ); |
40 | - $_aOutputs[] = $_oFieldError->get(); |
|
40 | + $_aOutputs[ ] = $_oFieldError->get(); |
|
41 | 41 | |
42 | 42 | // 2. Construct fields array for sub-fields. |
43 | 43 | $_oFieldsFormatter = new AdminPageFramework_Form_Model___Format_Fields( |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | $_aFields = $_oFieldsFormatter->get(); |
48 | 48 | |
49 | 49 | // 3. Get the field and its sub-fields output. |
50 | - $_aOutputs[] = $this->_getFieldsOutput( |
|
50 | + $_aOutputs[ ] = $this->_getFieldsOutput( |
|
51 | 51 | $this->aFieldset, |
52 | 52 | $_aFields, |
53 | 53 | $this->aCallbacks |
@@ -70,11 +70,11 @@ discard block |
||
70 | 70 | * @since 3.8.0 Added the `$aFieldset` parameter |
71 | 71 | * @return string |
72 | 72 | */ |
73 | - private function _getFieldsOutput( $aFieldset, array $aFields, array $aCallbacks=array() ) { |
|
73 | + private function _getFieldsOutput( $aFieldset, array $aFields, array $aCallbacks = array() ) { |
|
74 | 74 | |
75 | 75 | $_aOutput = array(); |
76 | - foreach( $aFields as $_isIndex => $_aField ) { |
|
77 | - $_aOutput[] = $this->_getEachFieldOutput( |
|
76 | + foreach ( $aFields as $_isIndex => $_aField ) { |
|
77 | + $_aOutput[ ] = $this->_getEachFieldOutput( |
|
78 | 78 | $_aField, |
79 | 79 | $_isIndex, |
80 | 80 | $aCallbacks, |
@@ -93,11 +93,11 @@ discard block |
||
93 | 93 | * @since 3.5.3 |
94 | 94 | * @return string the HTML output of the given field. |
95 | 95 | */ |
96 | - private function _getEachFieldOutput( $aField, $isIndex, array $aCallbacks, $bIsLastElement=false ) { |
|
96 | + private function _getEachFieldOutput( $aField, $isIndex, array $aCallbacks, $bIsLastElement = false ) { |
|
97 | 97 | |
98 | 98 | // Field type definition - allows mixed field types in sub-fields |
99 | 99 | $_aFieldTypeDefinition = $this->_getFieldTypeDefinition( $aField[ 'type' ] ); |
100 | - if ( ! is_callable( $_aFieldTypeDefinition[ 'hfRenderField' ] ) ) { |
|
100 | + if ( !is_callable( $_aFieldTypeDefinition[ 'hfRenderField' ] ) ) { |
|
101 | 101 | return ''; |
102 | 102 | } |
103 | 103 | |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | private function _getFieldOutput( $sContent, $aField, $bIsLastElement ) { |
132 | 132 | $_oFieldAttribute = new AdminPageFramework_Form_View___Attribute_Field( $aField ); |
133 | 133 | return $aField[ 'before_field' ] |
134 | - . "<div " . $_oFieldAttribute->get() . ">" |
|
134 | + . "<div ".$_oFieldAttribute->get().">" |
|
135 | 135 | . $sContent |
136 | 136 | . $this->_getUnsetFlagFieldInputTag( $aField ) |
137 | 137 | . $this->_getDelimiter( $aField, $bIsLastElement ) |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | 'input', |
154 | 154 | array( |
155 | 155 | 'type' => 'hidden', |
156 | - 'name' => '__unset_' . $aField[ '_fields_type' ] . '[' . $aField[ '_input_name_flat' ] . ']', |
|
156 | + 'name' => '__unset_'.$aField[ '_fields_type' ].'['.$aField[ '_input_name_flat' ].']', |
|
157 | 157 | 'value' => $aField[ '_input_name_flat' ], |
158 | 158 | 'class' => 'unset-element-names element-address', |
159 | 159 | ) |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | */ |
185 | 185 | private function _getDelimiter( $aField, $bIsLastElement ) { |
186 | 186 | return $aField[ 'delimiter' ] |
187 | - ? "<div " . $this->getAttributes( |
|
187 | + ? "<div ".$this->getAttributes( |
|
188 | 188 | array( |
189 | 189 | 'class' => 'delimiter', |
190 | 190 | 'id' => "delimiter-{$aField[ 'input_id' ]}", |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | "" |
195 | 195 | ), |
196 | 196 | ) |
197 | - ) . ">" |
|
197 | + ).">" |
|
198 | 198 | . $aField[ 'delimiter' ] |
199 | 199 | . "</div>" |
200 | 200 | : ''; |
@@ -208,9 +208,9 @@ discard block |
||
208 | 208 | */ |
209 | 209 | private function _getFinalOutput( $aFieldset, array $aFieldsOutput, $iFieldsCount ) { |
210 | 210 | |
211 | - $_oFieldsetAttributes = new AdminPageFramework_Form_View___Attribute_Fieldset( $aFieldset ); |
|
211 | + $_oFieldsetAttributes = new AdminPageFramework_Form_View___Attribute_Fieldset( $aFieldset ); |
|
212 | 212 | return $aFieldset[ 'before_fieldset' ] |
213 | - . "<fieldset " . $_oFieldsetAttributes->get() . ">" |
|
213 | + . "<fieldset ".$_oFieldsetAttributes->get().">" |
|
214 | 214 | . $this->_getEmbeddedFieldTitle( $aFieldset ) |
215 | 215 | . $this->_getChildFieldTitle( $aFieldset ) |
216 | 216 | . $this->_getFieldsetContent( $aFieldset, $aFieldsOutput, $iFieldsCount ) |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | */ |
228 | 228 | private function _getEmbeddedFieldTitle( $aFieldset ) { |
229 | 229 | |
230 | - if ( ! $aFieldset[ '_is_title_embedded' ] ) { |
|
230 | + if ( !$aFieldset[ '_is_title_embedded' ] ) { |
|
231 | 231 | return ''; |
232 | 232 | } |
233 | 233 | |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | */ |
253 | 253 | private function _getChildFieldTitle( $aFieldset ) { |
254 | 254 | |
255 | - if ( ! $aFieldset[ '_nested_depth' ] ) { |
|
255 | + if ( !$aFieldset[ '_nested_depth' ] ) { |
|
256 | 256 | return ''; |
257 | 257 | } |
258 | 258 | if ( $aFieldset[ '_is_title_embedded' ] ) { |
@@ -281,12 +281,12 @@ discard block |
||
281 | 281 | return $aFieldset[ 'content' ]; |
282 | 282 | } |
283 | 283 | |
284 | - $_oFieldsAttributes = new AdminPageFramework_Form_View___Attribute_Fields( |
|
284 | + $_oFieldsAttributes = new AdminPageFramework_Form_View___Attribute_Fields( |
|
285 | 285 | $aFieldset, |
286 | - array(), // attribute array |
|
286 | + array(), // attribute array |
|
287 | 287 | $iFieldsCount |
288 | 288 | ); |
289 | - return "<div " . $_oFieldsAttributes->get() . ">" |
|
289 | + return "<div ".$_oFieldsAttributes->get().">" |
|
290 | 290 | . $aFieldset[ 'before_fields' ] |
291 | 291 | . implode( PHP_EOL, $aFieldsOutput ) |
292 | 292 | . $aFieldset[ 'after_fields' ] |
@@ -309,13 +309,13 @@ discard block |
||
309 | 309 | $aField[ 'description' ], |
310 | 310 | 'admin-page-framework-fields-description' // class selector |
311 | 311 | ); |
312 | - $_aOutput[] = $_oFieldDescription->get(); |
|
312 | + $_aOutput[ ] = $_oFieldDescription->get(); |
|
313 | 313 | |
314 | 314 | // Dimensional keys of repeatable and sortable fields |
315 | - $_aOutput[] = $this->_getDynamicElementFlagFieldInputTag( $aField ); |
|
315 | + $_aOutput[ ] = $this->_getDynamicElementFlagFieldInputTag( $aField ); |
|
316 | 316 | |
317 | 317 | // Repeatable and sortable scripts |
318 | - $_aOutput[] = $this->_getFieldScripts( $aField, $iFieldsCount ); |
|
318 | + $_aOutput[ ] = $this->_getFieldScripts( $aField, $iFieldsCount ); |
|
319 | 319 | |
320 | 320 | return implode( PHP_EOL, array_filter( $_aOutput ) ); |
321 | 321 | |
@@ -327,10 +327,10 @@ discard block |
||
327 | 327 | */ |
328 | 328 | private function _getDynamicElementFlagFieldInputTag( $aFieldset ) { |
329 | 329 | |
330 | - if ( ! empty( $aFieldset[ 'repeatable' ] ) ) { |
|
330 | + if ( !empty( $aFieldset[ 'repeatable' ] ) ) { |
|
331 | 331 | return $this->_getRepeatableFieldFlagTag( $aFieldset ); |
332 | 332 | } |
333 | - if ( ! empty( $aFieldset[ 'sortable' ] ) ) { |
|
333 | + if ( !empty( $aFieldset[ 'sortable' ] ) ) { |
|
334 | 334 | return $this->_getSortableFieldFlagTag( $aFieldset ); |
335 | 335 | } |
336 | 336 | return ''; |
@@ -345,8 +345,8 @@ discard block |
||
345 | 345 | 'input', |
346 | 346 | array( |
347 | 347 | 'type' => 'hidden', |
348 | - 'name' => '__repeatable_elements_' . $aFieldset[ '_structure_type' ] |
|
349 | - . '[' . $aFieldset[ '_field_address' ] . ']', |
|
348 | + 'name' => '__repeatable_elements_'.$aFieldset[ '_structure_type' ] |
|
349 | + . '['.$aFieldset[ '_field_address' ].']', |
|
350 | 350 | 'class' => 'element-address', |
351 | 351 | 'value' => $aFieldset[ '_field_address' ], |
352 | 352 | 'data-field_address_model' => $aFieldset[ '_field_address_model' ], |
@@ -362,8 +362,8 @@ discard block |
||
362 | 362 | 'input', |
363 | 363 | array( |
364 | 364 | 'type' => 'hidden', |
365 | - 'name' => '__sortable_elements_' . $aFieldset[ '_structure_type' ] |
|
366 | - . '[' . $aFieldset[ '_field_address' ] . ']', |
|
365 | + 'name' => '__sortable_elements_'.$aFieldset[ '_structure_type' ] |
|
366 | + . '['.$aFieldset[ '_field_address' ].']', |
|
367 | 367 | 'class' => 'element-address', |
368 | 368 | 'value' => $aFieldset[ '_field_address' ], |
369 | 369 | 'data-field_address_model' => $aFieldset[ '_field_address_model' ], |
@@ -382,14 +382,14 @@ discard block |
||
382 | 382 | $_aOutput = array(); |
383 | 383 | |
384 | 384 | // Add the repeater script |
385 | - $_aOutput[] = ! empty( $aField[ 'repeatable' ] ) |
|
386 | - ? $this->_getRepeaterFieldEnablerScript( 'fields-' . $aField[ 'tag_id' ], $iFieldsCount, $aField[ 'repeatable' ] ) |
|
385 | + $_aOutput[ ] = !empty( $aField[ 'repeatable' ] ) |
|
386 | + ? $this->_getRepeaterFieldEnablerScript( 'fields-'.$aField[ 'tag_id' ], $iFieldsCount, $aField[ 'repeatable' ] ) |
|
387 | 387 | : ''; |
388 | 388 | |
389 | 389 | // Add the sortable script - if the number of fields is only one, no need to sort the field. |
390 | 390 | // Repeatable fields can make the number increase so here it checks the repeatability. |
391 | - $_aOutput[] = ! empty( $aField[ 'sortable' ] ) && ( $iFieldsCount > 1 || ! empty( $aField[ 'repeatable' ] ) ) |
|
392 | - ? $this->_getSortableFieldEnablerScript( 'fields-' . $aField[ 'tag_id' ] ) |
|
391 | + $_aOutput[ ] = !empty( $aField[ 'sortable' ] ) && ( $iFieldsCount > 1 || !empty( $aField[ 'repeatable' ] ) ) |
|
392 | + ? $this->_getSortableFieldEnablerScript( 'fields-'.$aField[ 'tag_id' ] ) |
|
393 | 393 | : ''; |
394 | 394 | |
395 | 395 | return implode( PHP_EOL, $_aOutput ); |
@@ -80,10 +80,6 @@ discard block |
||
80 | 80 | * ` |
81 | 81 | * @since 3.7.0 |
82 | 82 | * @access public |
83 | - * @param string $sMessage the text message to be displayed. |
|
84 | - * @param string $sType (optional) the type of the message, either "error" or "updated" is used. |
|
85 | - * @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. |
|
86 | - * @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. |
|
87 | 83 | * @return void |
88 | 84 | */ |
89 | 85 | public function set( $aErrors ) { |
@@ -128,7 +124,6 @@ discard block |
||
128 | 124 | * Retrieves the settings error array set by the user in the validation callback. |
129 | 125 | * |
130 | 126 | * @since 3.7.0 |
131 | - * @param boolean $bDelete whether or not the transient should be deleted after retrieving it. |
|
132 | 127 | * @return array |
133 | 128 | */ |
134 | 129 | public function get() { |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | $_sTabSlug = $this->getElement( $_GET, 'tab', '' ); |
49 | 49 | $_sTabSlug = sanitize_text_field( $_sTabSlug ); |
50 | 50 | $_sUserID = get_current_user_id(); |
51 | - return "apf_fe_" . md5( |
|
51 | + return "apf_fe_".md5( |
|
52 | 52 | $_sPageNow |
53 | 53 | . $_sPageSlug |
54 | 54 | . $_sTabSlug |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | public function get() { |
137 | 137 | |
138 | 138 | // Use a cache if exists. |
139 | - self::$_aFieldErrorCaches[ $this->sTransientKey ] = isset( self::$_aFieldErrorCaches[ $this->sTransientKey ] ) |
|
139 | + self::$_aFieldErrorCaches[ $this->sTransientKey ] = isset( self::$_aFieldErrorCaches[ $this->sTransientKey ] ) |
|
140 | 140 | ? self::$_aFieldErrorCaches[ $this->sTransientKey ] |
141 | 141 | : $this->getTransient( $this->sTransientKey ); |
142 | 142 | |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | * @since 3.7.0 |
154 | 154 | */ |
155 | 155 | public function delete() { |
156 | - if ( $this->hasBeenCalled( 'delete_' . $this->sTransientKey ) ) { |
|
156 | + if ( $this->hasBeenCalled( 'delete_'.$this->sTransientKey ) ) { |
|
157 | 157 | return; |
158 | 158 | } |
159 | 159 | add_action( 'shutdown', array( $this, '_replyToDelete' ) ); |
@@ -211,6 +211,7 @@ discard block |
||
211 | 211 | * Returns the HTML output of the number input part. |
212 | 212 | * |
213 | 213 | * @since 3.5.3 |
214 | + * @param boolean $bMultiLabels |
|
214 | 215 | * @return string The number input output. |
215 | 216 | * @internal |
216 | 217 | */ |
@@ -265,6 +266,7 @@ discard block |
||
265 | 266 | * Returns the HTML output of the unit select input part. |
266 | 267 | * |
267 | 268 | * @since 3.5.3 |
269 | + * @param boolean $bMultiLabels |
|
268 | 270 | * @return string The unit select input output. |
269 | 271 | * @internal |
270 | 272 | */ |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | /** |
65 | 65 | * Defines the field type slugs used for this field type. |
66 | 66 | */ |
67 | - public $aFieldTypeSlugs = array( 'size', ); |
|
67 | + public $aFieldTypeSlugs = array( 'size',); |
|
68 | 68 | |
69 | 69 | /** |
70 | 70 | * Defines the default key-values of this field type. |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | */ |
74 | 74 | protected $aDefaultKeys = array( |
75 | 75 | 'is_multiple' => false, // indicates whether the select tag alloes multiple selections. |
76 | - 'units' => null, // do not define units here since this will be merged with the user defined field array. |
|
76 | + 'units' => null, // do not define units here since this will be merged with the user defined field array. |
|
77 | 77 | 'attributes' => array( |
78 | 78 | 'size' => array( |
79 | 79 | 'min' => null, |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | */ |
102 | 102 | protected $aDefaultUnits = array( |
103 | 103 | 'px' => 'px', // pixel |
104 | - '%' => '%', // percentage |
|
104 | + '%' => '%', // percentage |
|
105 | 105 | 'em' => 'em', // font size |
106 | 106 | 'ex' => 'ex', // font height |
107 | 107 | 'in' => 'in', // inch |
@@ -161,8 +161,8 @@ discard block |
||
161 | 161 | ); |
162 | 162 | |
163 | 163 | $_aOutput = array(); |
164 | - foreach( ( array ) $aField[ 'label' ] as $_isKey => $_sLabel ) { |
|
165 | - $_aOutput[] = $this->_getFieldOutputByLabel( |
|
164 | + foreach ( ( array ) $aField[ 'label' ] as $_isKey => $_sLabel ) { |
|
165 | + $_aOutput[ ] = $this->_getFieldOutputByLabel( |
|
166 | 166 | $_isKey, |
167 | 167 | $_sLabel, |
168 | 168 | $aField |
@@ -185,8 +185,8 @@ discard block |
||
185 | 185 | |
186 | 186 | $_aBaseAttributes = $_bMultiLabels |
187 | 187 | ? array( |
188 | - 'name' => $aField[ 'attributes' ][ 'name' ] . "[{$isKey}]", |
|
189 | - 'id' => $aField[ 'attributes' ][ 'id' ] . "_{$isKey}", |
|
188 | + 'name' => $aField[ 'attributes' ][ 'name' ]."[{$isKey}]", |
|
189 | + 'id' => $aField[ 'attributes' ][ 'id' ]."_{$isKey}", |
|
190 | 190 | 'value' => $aField[ 'value' ], |
191 | 191 | ) |
192 | 192 | + $aField[ 'attributes' ] |
@@ -198,9 +198,9 @@ discard block |
||
198 | 198 | |
199 | 199 | $_aOutput = array( |
200 | 200 | $this->getElementByLabel( $aField[ 'before_label' ], $isKey, $aField[ 'label' ] ), |
201 | - "<div " . $this->getLabelContainerAttributes( $aField, 'admin-page-framework-input-label-container admin-page-framework-select-label' ) . ">", |
|
202 | - $this->_getNumberInputPart( $aField, $_aBaseAttributes, $isKey, is_array( $aField[ 'label' ] ) ), // The size (number) part |
|
203 | - $this->_getUnitSelectInput( $aField, $_aBaseAttributes, $isKey, is_array( $aField[ 'label' ] ) ), // The unit (select) part |
|
201 | + "<div ".$this->getLabelContainerAttributes( $aField, 'admin-page-framework-input-label-container admin-page-framework-select-label' ).">", |
|
202 | + $this->_getNumberInputPart( $aField, $_aBaseAttributes, $isKey, is_array( $aField[ 'label' ] ) ), // The size (number) part |
|
203 | + $this->_getUnitSelectInput( $aField, $_aBaseAttributes, $isKey, is_array( $aField[ 'label' ] ) ), // The unit (select) part |
|
204 | 204 | "</div>", |
205 | 205 | $this->getElementByLabel( $aField[ 'after_label' ], $isKey, $aField[ 'label' ] ) |
206 | 206 | ); |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | private function _getNumberInputPart( array $aField, array $aBaseAttributes, $isKey, $bMultiLabels ) { |
218 | 218 | |
219 | 219 | // Size and Size Label |
220 | - $_aSizeAttributes = $this->_getSizeAttributes( |
|
220 | + $_aSizeAttributes = $this->_getSizeAttributes( |
|
221 | 221 | $aField, |
222 | 222 | $aBaseAttributes, |
223 | 223 | $bMultiLabels |
@@ -225,32 +225,32 @@ discard block |
||
225 | 225 | : '' |
226 | 226 | ); |
227 | 227 | |
228 | - $_aSizeLabelAttributes = array( |
|
228 | + $_aSizeLabelAttributes = array( |
|
229 | 229 | 'for' => $_aSizeAttributes[ 'id' ], |
230 | 230 | 'class' => $_aSizeAttributes[ 'disabled' ] |
231 | 231 | ? 'disabled' |
232 | 232 | : null, |
233 | 233 | ); |
234 | 234 | |
235 | - $_sLabel = $this->getElementByLabel( |
|
235 | + $_sLabel = $this->getElementByLabel( |
|
236 | 236 | $aField[ 'label' ], |
237 | 237 | $isKey, |
238 | 238 | $aField[ 'label' ] |
239 | 239 | ); |
240 | - return "<label " . $this->getAttributes( $_aSizeLabelAttributes ) . ">" |
|
240 | + return "<label ".$this->getAttributes( $_aSizeLabelAttributes ).">" |
|
241 | 241 | . $this->getElement( |
242 | 242 | $aField, |
243 | 243 | $bMultiLabels |
244 | 244 | ? array( 'before_label', $isKey, 'size' ) |
245 | 245 | : array( 'before_label', 'size' ) |
246 | 246 | ) |
247 | - . ( $aField[ 'label' ] && ! $aField[ 'repeatable' ] |
|
248 | - ? "<span " . $this->getLabelContainerAttributes( $aField, 'admin-page-framework-input-label-string' ) . ">" |
|
247 | + . ( $aField[ 'label' ] && !$aField[ 'repeatable' ] |
|
248 | + ? "<span ".$this->getLabelContainerAttributes( $aField, 'admin-page-framework-input-label-string' ).">" |
|
249 | 249 | . $_sLabel |
250 | 250 | . "</span>" |
251 | 251 | : "" |
252 | 252 | ) |
253 | - . "<input " . $this->getAttributes( $_aSizeAttributes ) . " />" |
|
253 | + . "<input ".$this->getAttributes( $_aSizeAttributes )." />" |
|
254 | 254 | . $this->getElement( |
255 | 255 | $aField, |
256 | 256 | $bMultiLabels |
@@ -293,7 +293,7 @@ discard block |
||
293 | 293 | ) |
294 | 294 | : $aField[ 'units' ]; |
295 | 295 | |
296 | - return "<label " . $this->getAttributes( |
|
296 | + return "<label ".$this->getAttributes( |
|
297 | 297 | array( |
298 | 298 | 'for' => $_aUnitAttributes[ 'id' ], |
299 | 299 | 'class' => $_aUnitAttributes[ 'disabled' ] |
@@ -325,9 +325,9 @@ discard block |
||
325 | 325 | * @return array an unit attribute array |
326 | 326 | * @internal |
327 | 327 | */ |
328 | - private function _getUnitAttributes( array $aField, array $aBaseAttributes, $isLabelKey='' ) { |
|
328 | + private function _getUnitAttributes( array $aField, array $aBaseAttributes, $isLabelKey = '' ) { |
|
329 | 329 | |
330 | - $_bIsMultiple = $aField[ 'is_multiple' ] |
|
330 | + $_bIsMultiple = $aField[ 'is_multiple' ] |
|
331 | 331 | ? true |
332 | 332 | : $this->getElement( |
333 | 333 | $aField, |
@@ -339,13 +339,13 @@ discard block |
||
339 | 339 | |
340 | 340 | $_aSelectAttributes = array( |
341 | 341 | 'type' => 'select', |
342 | - 'id' => $aField[ 'input_id' ] . ( '' === $isLabelKey ? '' : '_' . $isLabelKey ) . '_' . 'unit', |
|
342 | + 'id' => $aField[ 'input_id' ].( '' === $isLabelKey ? '' : '_'.$isLabelKey ).'_'.'unit', |
|
343 | 343 | 'multiple' => $_bIsMultiple |
344 | 344 | ? 'multiple' |
345 | 345 | : null, |
346 | 346 | 'name' => $_bIsMultiple |
347 | - ? "{$aField['_input_name']}" . ( '' === $isLabelKey ? '' : '[' . $isLabelKey . ']' ) . "[unit][]" |
|
348 | - : "{$aField['_input_name']}" . ( '' === $isLabelKey ? '' : '[' . $isLabelKey . ']' ) . "[unit]", |
|
347 | + ? "{$aField[ '_input_name' ]}".( '' === $isLabelKey ? '' : '['.$isLabelKey.']' )."[unit][]" |
|
348 | + : "{$aField[ '_input_name' ]}".( '' === $isLabelKey ? '' : '['.$isLabelKey.']' )."[unit]", |
|
349 | 349 | 'value' => $this->getElement( |
350 | 350 | $aField, |
351 | 351 | array( 'value', 'unit' ), |
@@ -357,7 +357,7 @@ discard block |
||
357 | 357 | '' === $isLabelKey |
358 | 358 | ? array( 'attributes', 'unit' ) |
359 | 359 | : array( 'attributes', $isLabelKey, 'unit' ), |
360 | - $this->aDefaultKeys['attributes']['unit'] |
|
360 | + $this->aDefaultKeys[ 'attributes' ][ 'unit' ] |
|
361 | 361 | ) |
362 | 362 | + $aBaseAttributes; |
363 | 363 | return $_aSelectAttributes; |
@@ -371,15 +371,15 @@ discard block |
||
371 | 371 | * @return array an size attribute array |
372 | 372 | * @internal |
373 | 373 | */ |
374 | - private function _getSizeAttributes( array $aField, array $aBaseAttributes, $sLabelKey='' ) { |
|
374 | + private function _getSizeAttributes( array $aField, array $aBaseAttributes, $sLabelKey = '' ) { |
|
375 | 375 | |
376 | 376 | return array( |
377 | 377 | 'type' => 'number', |
378 | - 'id' => $aField['input_id'] . '_' . ( '' !== $sLabelKey ? $sLabelKey . '_' : '' ) . 'size', |
|
379 | - 'name' => $aField[ '_input_name' ] . ( '' !== $sLabelKey ? "[{$sLabelKey}]" : '' ) . '[size]', |
|
378 | + 'id' => $aField[ 'input_id' ].'_'.( '' !== $sLabelKey ? $sLabelKey.'_' : '' ).'size', |
|
379 | + 'name' => $aField[ '_input_name' ].( '' !== $sLabelKey ? "[{$sLabelKey}]" : '' ).'[size]', |
|
380 | 380 | 'value' => $this->getElement( |
381 | - $aField, // subject |
|
382 | - array( 'value', 'size' ), // dimensional keys |
|
381 | + $aField, // subject |
|
382 | + array( 'value', 'size' ), // dimensional keys |
|
383 | 383 | '' // default |
384 | 384 | ), |
385 | 385 | ) |
@@ -27,8 +27,6 @@ |
||
27 | 27 | * Returns the output of the input element. |
28 | 28 | * |
29 | 29 | * @since 3.4.0 |
30 | - * @param string $sLabel The label text. |
|
31 | - * @param array $aAttributes (optional) The attribute array. If set, it will be merged with the attribute set in the constructor. |
|
32 | 30 | */ |
33 | 31 | public function get( /* $sLabel, $aAttributes=array() */ ) { |
34 | 32 |
@@ -47,7 +47,7 @@ |
||
47 | 47 | |
48 | 48 | // Output |
49 | 49 | return |
50 | - "<{$this->aOptions[ 'input_container_tag' ]} " . $this->getAttributes( $this->aOptions[ 'input_container_attributes' ] ) . ">" |
|
50 | + "<{$this->aOptions[ 'input_container_tag' ]} " . $this->getAttributes( $this->aOptions[ 'input_container_attributes' ] ) . ">" |
|
51 | 51 | . $this->_getInputElements( $_aAttributes, $this->aOptions ) |
52 | 52 | . "</{$this->aOptions[ 'input_container_tag' ]}>" |
53 | 53 | . "<{$this->aOptions[ 'label_container_tag' ]} " . $this->getAttributes( $this->aOptions[ 'label_container_attributes' ] ) . ">" |
@@ -33,11 +33,11 @@ discard block |
||
33 | 33 | public function get( /* $sLabel, $aAttributes=array() */ ) { |
34 | 34 | |
35 | 35 | // Parameters |
36 | - $_aParams = func_get_args() + array( |
|
37 | - 0 => '', // 1st parameter |
|
36 | + $_aParams = func_get_args() + array( |
|
37 | + 0 => '', // 1st parameter |
|
38 | 38 | 1 => array() // 2nd parameter |
39 | 39 | ); |
40 | - $_sLabel = $_aParams[ 0 ]; // first parameter |
|
40 | + $_sLabel = $_aParams[ 0 ]; // first parameter |
|
41 | 41 | |
42 | 42 | // Attributes |
43 | 43 | $_aAttributes = $this->uniteArrays( // second parameter |
@@ -47,10 +47,10 @@ discard block |
||
47 | 47 | |
48 | 48 | // Output |
49 | 49 | return |
50 | - "<{$this->aOptions[ 'input_container_tag' ]} " . $this->getAttributes( $this->aOptions[ 'input_container_attributes' ] ) . ">" |
|
50 | + "<{$this->aOptions[ 'input_container_tag' ]} ".$this->getAttributes( $this->aOptions[ 'input_container_attributes' ] ).">" |
|
51 | 51 | . $this->_getInputElements( $_aAttributes, $this->aOptions ) |
52 | 52 | . "</{$this->aOptions[ 'input_container_tag' ]}>" |
53 | - . "<{$this->aOptions[ 'label_container_tag' ]} " . $this->getAttributes( $this->aOptions[ 'label_container_attributes' ] ) . ">" |
|
53 | + . "<{$this->aOptions[ 'label_container_tag' ]} ".$this->getAttributes( $this->aOptions[ 'label_container_attributes' ] ).">" |
|
54 | 54 | . $_sLabel |
55 | 55 | . "</{$this->aOptions[ 'label_container_tag' ]}>" |
56 | 56 | ; |
@@ -64,16 +64,16 @@ discard block |
||
64 | 64 | private function _getInputElements( $aAttributes, $aOptions ) { |
65 | 65 | $_sOutput = $this->aOptions[ 'save_unchecked' ] |
66 | 66 | // the unchecked value must be set prior to the checkbox input field. |
67 | - ? "<input " . $this->getAttributes( |
|
67 | + ? "<input ".$this->getAttributes( |
|
68 | 68 | array( |
69 | 69 | 'type' => 'hidden', |
70 | 70 | 'class' => $aAttributes[ 'class' ], |
71 | 71 | 'name' => $aAttributes[ 'name' ], |
72 | 72 | 'value' => '0', |
73 | 73 | ) |
74 | - ) . " />" |
|
74 | + )." />" |
|
75 | 75 | : ''; |
76 | - $_sOutput .= "<input " . $this->getAttributes( $aAttributes ) . " />"; |
|
76 | + $_sOutput .= "<input ".$this->getAttributes( $aAttributes )." />"; |
|
77 | 77 | return $_sOutput; |
78 | 78 | } |
79 | 79 | |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | public function getAttributesByKey( /* $sKey */ ) { |
87 | 87 | |
88 | 88 | // Parameters |
89 | - $_aParams = func_get_args() + array( 0 => '', ); |
|
89 | + $_aParams = func_get_args() + array( 0 => '',); |
|
90 | 90 | $_sKey = $_aParams[ 0 ]; |
91 | 91 | $_bIsMultiple = '' !== $_sKey; |
92 | 92 | |
@@ -98,13 +98,13 @@ discard block |
||
98 | 98 | // The type needs to be specified since the postytpe field type extends this class. If not set, the 'posttype' will be passed to the type attribute. |
99 | 99 | + array( |
100 | 100 | 'type' => 'checkbox', |
101 | - 'id' => $this->aAttributes[ 'id' ] . '_' . $_sKey, |
|
101 | + 'id' => $this->aAttributes[ 'id' ].'_'.$_sKey, |
|
102 | 102 | 'checked' => $this->_getCheckedAttributeValue( $_sKey ), |
103 | - 'value' => 1, // this must be always 1 because the key value can be zero. In that case, the value always will be false and unchecked. |
|
103 | + 'value' => 1, // this must be always 1 because the key value can be zero. In that case, the value always will be false and unchecked. |
|
104 | 104 | 'name' => $_bIsMultiple |
105 | 105 | ? "{$this->aAttributes[ 'name' ]}[{$_sKey}]" |
106 | 106 | : $this->aAttributes[ 'name' ], |
107 | - 'data-id' => $this->aAttributes[ 'id' ], // referenced by the JavaScript scripts such as the revealer script. |
|
107 | + 'data-id' => $this->aAttributes[ 'id' ], // referenced by the JavaScript scripts such as the revealer script. |
|
108 | 108 | ) |
109 | 109 | + $this->aAttributes |
110 | 110 | ; |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | : array( 'value', $_sKey ); |
122 | 122 | return $this->getElement( $this->aAttributes, $_aValueDimension ) |
123 | 123 | ? 'checked' |
124 | - : null; // to not to set, pass null. An empty value '' will still set the attribute. |
|
124 | + : null; // to not to set, pass null. An empty value '' will still set the attribute. |
|
125 | 125 | |
126 | 126 | } |
127 | 127 |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | * @internal |
122 | 122 | * @param string $sInputID The input ID that will be the base of each generated option tag ID. |
123 | 123 | * @param array $aLabels The array holding labels. |
124 | - * @param array $aAttributes The attribute arrays. Accepts the following arguments. |
|
124 | + * @param array $aBaseAttributes The attribute arrays. Accepts the following arguments. |
|
125 | 125 | * - optgroup |
126 | 126 | * - option |
127 | 127 | */ |
@@ -159,6 +159,7 @@ discard block |
||
159 | 159 | /** |
160 | 160 | * Returns an HTML output of optgroup tag. |
161 | 161 | * @since 3.5.3 |
162 | + * @param string $sInputID |
|
162 | 163 | * @return string an HTML output of optgroup tag. |
163 | 164 | */ |
164 | 165 | private function _getOptGroup( array $aBaseAttributes, $sInputID, $sKey, $asLabel ) { |
@@ -178,6 +179,7 @@ discard block |
||
178 | 179 | /** |
179 | 180 | * |
180 | 181 | * @since 3.5.3 |
182 | + * @param string $sInputID |
|
181 | 183 | */ |
182 | 184 | private function _getOptionTagAttributes( array $aBaseAttributes, $sInputID, $sKey, $aValues ) { |
183 | 185 |
@@ -68,14 +68,14 @@ discard block |
||
68 | 68 | ); |
69 | 69 | |
70 | 70 | return |
71 | - "<{$this->aOptions[ 'input_container_tag' ]} " . $this->getAttributes( $this->aOptions[ 'input_container_attributes' ] ) . ">" |
|
72 | - . "<select " . $this->getAttributes( $this->_getSelectAttributes( $_aAttributes ) ) . " >" |
|
71 | + "<{$this->aOptions[ 'input_container_tag' ]} ".$this->getAttributes( $this->aOptions[ 'input_container_attributes' ] ).">" |
|
72 | + . "<select ".$this->getAttributes( $this->_getSelectAttributes( $_aAttributes ) )." >" |
|
73 | 73 | . $this->_getDropDownList( |
74 | 74 | $this->getAttribute( 'id' ), |
75 | 75 | $this->getAsArray( |
76 | 76 | isset( $_aLabels ) |
77 | 77 | ? $_aLabels |
78 | - : $this->aField[ 'label' ], // backward compatibility |
|
78 | + : $this->aField[ 'label' ], // backward compatibility |
|
79 | 79 | true |
80 | 80 | ), |
81 | 81 | $_aAttributes |
@@ -103,9 +103,9 @@ discard block |
||
103 | 103 | ? 'multiple' |
104 | 104 | : null, |
105 | 105 | 'name' => $_bIsMultiple |
106 | - ? $this->getAttribute( 'name' ) . '[]' |
|
106 | + ? $this->getAttribute( 'name' ).'[]' |
|
107 | 107 | : $this->getAttribute( 'name' ), |
108 | - 'data-id' => $this->getAttribute( 'id' ), // referenced by the JavaScript scripts such as the revealer script. |
|
108 | + 'data-id' => $this->getAttribute( 'id' ), // referenced by the JavaScript scripts such as the revealer script. |
|
109 | 109 | ) |
110 | 110 | ); |
111 | 111 | |
@@ -127,12 +127,12 @@ discard block |
||
127 | 127 | */ |
128 | 128 | private function _getDropDownList( $sInputID, array $aLabels, array $aBaseAttributes ) { |
129 | 129 | |
130 | - $_aOutput = array(); |
|
131 | - foreach( $aLabels as $__sKey => $__asLabel ) { |
|
130 | + $_aOutput = array(); |
|
131 | + foreach ( $aLabels as $__sKey => $__asLabel ) { |
|
132 | 132 | |
133 | 133 | // For an optgroup tag, |
134 | 134 | if ( is_array( $__asLabel ) ) { |
135 | - $_aOutput[] = $this->_getOptGroup( |
|
135 | + $_aOutput[ ] = $this->_getOptGroup( |
|
136 | 136 | $aBaseAttributes, |
137 | 137 | $sInputID, |
138 | 138 | $__sKey, |
@@ -142,8 +142,8 @@ discard block |
||
142 | 142 | } |
143 | 143 | |
144 | 144 | // A normal option tag, |
145 | - $_aOutput[] = $this->_getOptionTag( |
|
146 | - $__asLabel, // the text label the user sees to be selected |
|
145 | + $_aOutput[ ] = $this->_getOptionTag( |
|
146 | + $__asLabel, // the text label the user sees to be selected |
|
147 | 147 | $this->_getOptionTagAttributes( |
148 | 148 | $aBaseAttributes, |
149 | 149 | $sInputID, |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | $_aOptGroupAttributes = array( |
170 | 170 | 'label' => $sKey, |
171 | 171 | ) + $_aOptGroupAttributes; |
172 | - return "<optgroup " . $this->getAttributes( $_aOptGroupAttributes ) . ">" |
|
172 | + return "<optgroup ".$this->getAttributes( $_aOptGroupAttributes ).">" |
|
173 | 173 | . $this->_getDropDownList( $sInputID, $asLabel, $aBaseAttributes ) |
174 | 174 | . "</optgroup>"; |
175 | 175 | |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | $aValues |
188 | 188 | ); |
189 | 189 | return array( |
190 | - 'id' => $sInputID . '_' . $sKey, |
|
190 | + 'id' => $sInputID.'_'.$sKey, |
|
191 | 191 | 'value' => $sKey, |
192 | 192 | 'selected' => in_array( ( string ) $sKey, $aValues ) |
193 | 193 | ? 'selected' |
@@ -203,8 +203,8 @@ discard block |
||
203 | 203 | * @sicne 3.4.0 |
204 | 204 | * @return string The generated option tag HTML output. |
205 | 205 | */ |
206 | - private function _getOptionTag( $sLabel, array $aOptionTagAttributes=array() ) { |
|
207 | - return "<option " . $this->getAttributes( $aOptionTagAttributes ) . " >" |
|
206 | + private function _getOptionTag( $sLabel, array $aOptionTagAttributes = array() ) { |
|
207 | + return "<option ".$this->getAttributes( $aOptionTagAttributes )." >" |
|
208 | 208 | . $sLabel |
209 | 209 | . "</option>"; |
210 | 210 | } |
@@ -83,12 +83,6 @@ discard block |
||
83 | 83 | * Returns the specified option value. |
84 | 84 | * |
85 | 85 | * @since 3.6.0 |
86 | - * @param string|array $sKey1|$aKeys The dimensional key or keys of an array of the element to extract its value. |
|
87 | - * If a string is set to the first parameter, the second parameter is also expected to be a string serving as a second dimensional key. |
|
88 | - * For example, there is a multi-dimensional array, `array( 'a' => array( 'b' => 'bbb' ) )` to extract the value of the 'b' element in the second depth, |
|
89 | - * set the parameter as follows. `get( 'a', 'b' )` or `get( array( 'a', 'b' ) );` |
|
90 | - * @param string|variant $sKey2|$vDefault The second dimensional key or the default value in case the value is not set. |
|
91 | - * @param string $sKey3 The third dimensional key and so on. |
|
92 | 86 | */ |
93 | 87 | public function get( /* $sKey1, $sKey2, $sKey3, ... OR $aKeys, $vDefault */ ) { |
94 | 88 | |
@@ -138,10 +132,6 @@ discard block |
||
138 | 132 | * |
139 | 133 | * @since 3.6.0 |
140 | 134 | * @return void |
141 | - * @param string|array $asKeys The key or keys of an array of the element to set its value. |
|
142 | - * If a string is passed, it specifies the element with the set key. If an array is passed, it specifies the element with the dimensional keys. |
|
143 | - * For example, `set( 'a', 'aaa' )` will set a value, `array( 'a' => 'aaa' )` and `set( array( 'a', 'b' ), 'bbb' )` will set `array( 'a' => array( 'b' => 'bbb' ) )`. |
|
144 | - * @param variant $mValue The value to be set. |
|
145 | 135 | */ |
146 | 136 | public function set( /* $asKeys, $mValue */ ) { |
147 | 137 | |
@@ -167,10 +157,6 @@ discard block |
||
167 | 157 | * Removes an element by dimensional keys. |
168 | 158 | * @since 3.6.0 |
169 | 159 | * @return void |
170 | - * @param string|array $asKeys The key or keys of an array of the element to set its value. |
|
171 | - * If a string is passed, it specifies the element with the set key. If an array is passed, it specifies the element with the dimensional keys. |
|
172 | - * For example, `delete( 'a' )` will unset an element of `a` in `array( 'a' => 'some value' )` so it becomes `array()`. |
|
173 | - * `delete( array( 'a', 'b' ) )` will unset the element of `b` in `array( 'a' => array( 'b' => 'bbb' ) )`. |
|
174 | 160 | */ |
175 | 161 | public function delete( /* $sKey1, $sKey2, $sKey3 ... OR $aKeys */ ) { |
176 | 162 |
@@ -51,14 +51,14 @@ discard block |
||
51 | 51 | * @since 3.6.0 |
52 | 52 | * @var array |
53 | 53 | */ |
54 | - public $aData = array(); |
|
54 | + public $aData = array(); |
|
55 | 55 | |
56 | 56 | /** |
57 | 57 | * Stores the default values. |
58 | 58 | * @since 3.6.0 |
59 | 59 | * @var array |
60 | 60 | */ |
61 | - public $aDefault = array(); |
|
61 | + public $aDefault = array(); |
|
62 | 62 | /**#@-*/ |
63 | 63 | |
64 | 64 | /** |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | $_aKeys = func_get_args() + array( null ); |
97 | 97 | |
98 | 98 | // If no key is specified, return the whole array. |
99 | - if ( ! isset( $_aKeys[ 0 ] ) ) { |
|
99 | + if ( !isset( $_aKeys[ 0 ] ) ) { |
|
100 | 100 | return $this->uniteArrays( |
101 | 101 | $this->aData, |
102 | 102 | $this->aDefault |
@@ -111,8 +111,8 @@ discard block |
||
111 | 111 | |
112 | 112 | // Now either the section ID or field ID is given. |
113 | 113 | return $this->getArrayValueByArrayKeys( |
114 | - $this->aData, // subject array |
|
115 | - $_aKeys, // dimensional keys |
|
114 | + $this->aData, // subject array |
|
115 | + $_aKeys, // dimensional keys |
|
116 | 116 | $this->_getDefaultValue( // default value |
117 | 117 | $_mDefault, |
118 | 118 | $_aKeys |
@@ -145,8 +145,8 @@ discard block |
||
145 | 145 | */ |
146 | 146 | public function set( /* $asKeys, $mValue */ ) { |
147 | 147 | |
148 | - $_aParameters = func_get_args(); |
|
149 | - if ( ! isset( $_aParameters[ 0 ], $_aParameters[ 1 ] ) ) { |
|
148 | + $_aParameters = func_get_args(); |
|
149 | + if ( !isset( $_aParameters[ 0 ], $_aParameters[ 1 ] ) ) { |
|
150 | 150 | return; |
151 | 151 | } |
152 | 152 | $_asKeys = $_aParameters[ 0 ]; |
@@ -174,8 +174,8 @@ discard block |
||
174 | 174 | */ |
175 | 175 | public function delete( /* $sKey1, $sKey2, $sKey3 ... OR $aKeys */ ) { |
176 | 176 | |
177 | - $_aParameters = func_get_args(); |
|
178 | - if ( ! isset( $_aParameters[ 0 ], $_aParameters[ 1 ] ) ) { |
|
177 | + $_aParameters = func_get_args(); |
|
178 | + if ( !isset( $_aParameters[ 0 ], $_aParameters[ 1 ] ) ) { |
|
179 | 179 | return; |
180 | 180 | } |
181 | 181 | $_asKeys = $_aParameters[ 0 ]; |