@@ -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 ]; |
@@ -88,11 +88,6 @@ discard block |
||
| 88 | 88 | * @access public |
| 89 | 89 | * @since 2.0.0 |
| 90 | 90 | * @remark Accepts variadic parameters. |
| 91 | - * @param object $oCallerObject the object that holds the callback method that matches the action hook name. |
|
| 92 | - * @param array $aActionHooks a numerically index array consisting of action hook names that serve as the callback method names. |
|
| 93 | - * @param mixed $vArgs1 the argument to pass to the hook callback functions. |
|
| 94 | - * @param mixed $vArgs2 another argument to pass to the hook callback functions. |
|
| 95 | - * @param mixed $_and_more add as many arguments as necessary to the next parameters. |
|
| 96 | 91 | * @return void |
| 97 | 92 | */ |
| 98 | 93 | static public function addAndDoActions( /* $oCallerObject, $aActionHooks, $vArgs1=null, $vArgs2=null, $_and_more=null */ ) { |
@@ -191,10 +186,6 @@ discard block |
||
| 191 | 186 | * ` |
| 192 | 187 | * |
| 193 | 188 | * @since 2.0.0 |
| 194 | - * @param object $oCallerObject |
|
| 195 | - * @param string $sFilter The filter hook name. |
|
| 196 | - * @param mixed $vData The filtering data |
|
| 197 | - * @param mixed $vArgs The arguments. |
|
| 198 | 189 | */ |
| 199 | 190 | static public function addAndApplyFilter( /* $oCallerObject, $sFilter, $vData, $vArgs... */ ) { |
| 200 | 191 | |
@@ -232,6 +223,7 @@ discard block |
||
| 232 | 223 | * |
| 233 | 224 | * @since 2.0.0 |
| 234 | 225 | * @access public |
| 226 | + * @param string $sPrefix |
|
| 235 | 227 | * @return array Returns an array consisting of the filters. |
| 236 | 228 | */ |
| 237 | 229 | static public function getFilterArrayByPrefix( $sPrefix, $sClassName, $sPageSlug, $sTabSlug, $bReverse=false ) { |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | * @since 3.4.2 |
| 26 | 26 | * @todo Create a similar function for filters. |
| 27 | 27 | */ |
| 28 | - static public function registerAction( $sActionHook, $oCallable, $iPriority=10 ) { |
|
| 28 | + static public function registerAction( $sActionHook, $oCallable, $iPriority = 10 ) { |
|
| 29 | 29 | |
| 30 | 30 | if ( did_action( $sActionHook ) ) { |
| 31 | 31 | return call_user_func_array( $oCallable, array() ); |
@@ -62,13 +62,13 @@ discard block |
||
| 62 | 62 | * @param mixed $_and_more add as many arguments as necessary to the next parameters. |
| 63 | 63 | * @return void does not return a value. |
| 64 | 64 | */ |
| 65 | - static public function doActions( $aActionHooks, $vArgs1=null, $vArgs2=null, $_and_more=null ) { |
|
| 65 | + static public function doActions( $aActionHooks, $vArgs1 = null, $vArgs2 = null, $_and_more = null ) { |
|
| 66 | 66 | |
| 67 | 67 | $aArgs = func_get_args(); |
| 68 | 68 | $aActionHooks = $aArgs[ 0 ]; |
| 69 | - foreach( ( array ) $aActionHooks as $sActionHook ) { |
|
| 69 | + foreach ( ( array ) $aActionHooks as $sActionHook ) { |
|
| 70 | 70 | $aArgs[ 0 ] = $sActionHook; |
| 71 | - call_user_func_array( 'do_action' , $aArgs ); |
|
| 71 | + call_user_func_array( 'do_action', $aArgs ); |
|
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | } |
@@ -100,12 +100,12 @@ discard block |
||
| 100 | 100 | $aArgs = func_get_args(); |
| 101 | 101 | $oCallerObject = $aArgs[ 0 ]; |
| 102 | 102 | $aActionHooks = $aArgs[ 1 ]; |
| 103 | - foreach( ( array ) $aActionHooks as $sActionHook ) { |
|
| 104 | - if ( ! $sActionHook ) { |
|
| 103 | + foreach ( ( array ) $aActionHooks as $sActionHook ) { |
|
| 104 | + if ( !$sActionHook ) { |
|
| 105 | 105 | continue; |
| 106 | 106 | } |
| 107 | 107 | $aArgs[ 1 ] = $sActionHook; |
| 108 | - call_user_func_array( array( get_class(), 'addAndDoAction' ) , $aArgs ); |
|
| 108 | + call_user_func_array( array( get_class(), 'addAndDoAction' ), $aArgs ); |
|
| 109 | 109 | } |
| 110 | 110 | |
| 111 | 111 | } |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | $_aArgs = func_get_args(); |
| 125 | 125 | $_oCallerObject = $_aArgs[ 0 ]; |
| 126 | 126 | $_sActionHook = $_aArgs[ 1 ]; |
| 127 | - if ( ! $_sActionHook ) { |
|
| 127 | + if ( !$_sActionHook ) { |
|
| 128 | 128 | return; |
| 129 | 129 | } |
| 130 | 130 | |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | |
| 137 | 137 | // Remove the first element, the caller object. |
| 138 | 138 | array_shift( $_aArgs ); |
| 139 | - call_user_func_array( 'do_action' , $_aArgs ); |
|
| 139 | + call_user_func_array( 'do_action', $_aArgs ); |
|
| 140 | 140 | |
| 141 | 141 | } |
| 142 | 142 | |
@@ -164,12 +164,12 @@ discard block |
||
| 164 | 164 | $_aFilters = $_aArgs[ 1 ]; |
| 165 | 165 | $_vInput = $_aArgs[ 2 ]; |
| 166 | 166 | |
| 167 | - foreach( ( array ) $_aFilters as $_sFilter ) { |
|
| 168 | - if ( ! $_sFilter ) { |
|
| 167 | + foreach ( ( array ) $_aFilters as $_sFilter ) { |
|
| 168 | + if ( !$_sFilter ) { |
|
| 169 | 169 | continue; |
| 170 | 170 | } |
| 171 | 171 | $_aArgs[ 1 ] = $_sFilter; |
| 172 | - $_aArgs[ 2 ] = $_vInput; // assigns the updated value as it is filtered in previous iterations |
|
| 172 | + $_aArgs[ 2 ] = $_vInput; // assigns the updated value as it is filtered in previous iterations |
|
| 173 | 173 | $_vInput = call_user_func_array( |
| 174 | 174 | array( get_class(), 'addAndApplyFilter' ), |
| 175 | 175 | $_aArgs |
@@ -203,7 +203,7 @@ discard block |
||
| 203 | 203 | $_aArgs = func_get_args(); |
| 204 | 204 | $_oCallerObject = $_aArgs[ 0 ]; |
| 205 | 205 | $_sFilter = $_aArgs[ 1 ]; |
| 206 | - if ( ! $_sFilter ) { |
|
| 206 | + if ( !$_sFilter ) { |
|
| 207 | 207 | return $_aArgs[ 2 ]; |
| 208 | 208 | } |
| 209 | 209 | |
@@ -234,17 +234,17 @@ discard block |
||
| 234 | 234 | * @access public |
| 235 | 235 | * @return array Returns an array consisting of the filters. |
| 236 | 236 | */ |
| 237 | - static public function getFilterArrayByPrefix( $sPrefix, $sClassName, $sPageSlug, $sTabSlug, $bReverse=false ) { |
|
| 237 | + static public function getFilterArrayByPrefix( $sPrefix, $sClassName, $sPageSlug, $sTabSlug, $bReverse = false ) { |
|
| 238 | 238 | |
| 239 | 239 | $_aFilters = array(); |
| 240 | 240 | if ( $sTabSlug && $sPageSlug ) { |
| 241 | - $_aFilters[] = "{$sPrefix}{$sPageSlug}_{$sTabSlug}"; |
|
| 241 | + $_aFilters[ ] = "{$sPrefix}{$sPageSlug}_{$sTabSlug}"; |
|
| 242 | 242 | } |
| 243 | 243 | if ( $sPageSlug ) { |
| 244 | - $_aFilters[] = "{$sPrefix}{$sPageSlug}"; |
|
| 244 | + $_aFilters[ ] = "{$sPrefix}{$sPageSlug}"; |
|
| 245 | 245 | } |
| 246 | 246 | if ( $sClassName ) { |
| 247 | - $_aFilters[] = "{$sPrefix}{$sClassName}"; |
|
| 247 | + $_aFilters[ ] = "{$sPrefix}{$sClassName}"; |
|
| 248 | 248 | } |
| 249 | 249 | return $bReverse |
| 250 | 250 | ? array_reverse( $_aFilters ) |
@@ -91,6 +91,7 @@ discard block |
||
| 91 | 91 | * |
| 92 | 92 | * @since 3.5.4 |
| 93 | 93 | * @since 3.6.3 Moved from `AdminPageFramework_Form_Model_Export`. |
| 94 | + * @param string $sFileName |
|
| 94 | 95 | * @return array |
| 95 | 96 | */ |
| 96 | 97 | private function _getExportHeaderArray( array $aArguments, $sFileName, $mData ) { |
@@ -131,6 +132,7 @@ discard block |
||
| 131 | 132 | * @since 3.5.3 |
| 132 | 133 | * @since 3.6.3 Moved from `AdminPageFramework_Form_Model_Export`. |
| 133 | 134 | * @internal |
| 135 | + * @param string $mData |
|
| 134 | 136 | * @return string The export file name. |
| 135 | 137 | */ |
| 136 | 138 | private function _getExportFileName( array $aArguments, $sExportFileName, $mData ) { |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | */ |
| 33 | 33 | public function _replyToCallback( $aInputs, $aRawInputs, array $aSubmits, $aSubmitInformation, $oFactory ) { |
| 34 | 34 | |
| 35 | - if ( ! $this->_shouldProceed() ) { |
|
| 35 | + if ( !$this->_shouldProceed() ) { |
|
| 36 | 36 | return; |
| 37 | 37 | } |
| 38 | 38 | $this->_exportOptions( |
@@ -67,11 +67,11 @@ discard block |
||
| 67 | 67 | */ |
| 68 | 68 | protected function _exportOptions( $mData, $sPageSlug, $sTabSlug ) { |
| 69 | 69 | |
| 70 | - $_oExport = new AdminPageFramework_ExportOptions( |
|
| 70 | + $_oExport = new AdminPageFramework_ExportOptions( |
|
| 71 | 71 | $this->getHTTPRequestSanitized( $this->getElementAsArray( $_POST, array( '__export' ) ), true ), |
| 72 | 72 | $this->oFactory->oProp->sClassName |
| 73 | 73 | ); |
| 74 | - $_aArguments = array( |
|
| 74 | + $_aArguments = array( |
|
| 75 | 75 | 'class_name' => $this->oFactory->oProp->sClassName, |
| 76 | 76 | 'page_slug' => $sPageSlug, |
| 77 | 77 | 'tab_slug' => $sTabSlug, |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | $sExportFileName, |
| 144 | 144 | $aArguments[ 'pressed_field_id' ], |
| 145 | 145 | $aArguments[ 'pressed_input_id' ], |
| 146 | - $mData, // 3.4.6+ |
|
| 146 | + $mData, // 3.4.6+ |
|
| 147 | 147 | $this->oFactory // 3.4.6+ |
| 148 | 148 | ); |
| 149 | 149 | } |
@@ -142,6 +142,7 @@ discard block |
||
| 142 | 142 | /** |
| 143 | 143 | * Sets update admin notice. |
| 144 | 144 | * @since 3.5.3 |
| 145 | + * @param boolean $bEmpty |
|
| 145 | 146 | * @return void |
| 146 | 147 | */ |
| 147 | 148 | private function _setImportAdminNotice( $bEmpty ) { |
@@ -209,6 +210,8 @@ discard block |
||
| 209 | 210 | * @since 3.5.3 |
| 210 | 211 | * @since 3.6.3 Moved from `AdminPageFramework_Form_Model_Import`. |
| 211 | 212 | * @internal |
| 213 | + * @param string $sFormatType |
|
| 214 | + * @param string $sImportOptionKey |
|
| 212 | 215 | * @return string The filtered import data. |
| 213 | 216 | */ |
| 214 | 217 | private function _getFilteredImportData( array $aArguments, $mData, $aStoredOptions, $sFormatType, $sImportOptionKey ) { |
@@ -237,6 +240,7 @@ discard block |
||
| 237 | 240 | * @param string The filter prefix. |
| 238 | 241 | * @param mixed The subject filtering value. |
| 239 | 242 | * @param array An argument array holding submit information. Part of this will be passed to the filter callbacks but this itself does not mean is for the filter callbacks. |
| 243 | + * @param string $sPrefix |
|
| 240 | 244 | */ |
| 241 | 245 | protected function _getFilteredItemForPortByPrefix( $sPrefix, $mFilteringValue, array $aArguments ) { |
| 242 | 246 | return $this->addAndApplyFilters( |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | * @since 3.6.3 |
| 36 | 36 | */ |
| 37 | 37 | public function _replyToCallback( $aInputs, $aRawInputs, array $aSubmits, $aSubmitInformation, $oFactory ) { |
| 38 | - if ( ! $this->_shouldProceed() ) { |
|
| 38 | + if ( !$this->_shouldProceed() ) { |
|
| 39 | 39 | return; |
| 40 | 40 | } |
| 41 | 41 | $this->_doImportOptions( |
@@ -93,11 +93,11 @@ discard block |
||
| 93 | 93 | */ |
| 94 | 94 | private function _importOptions( $aStoredOptions, $sPageSlug, $sTabSlug ) { |
| 95 | 95 | |
| 96 | - $_oImport = new AdminPageFramework_ImportOptions( |
|
| 96 | + $_oImport = new AdminPageFramework_ImportOptions( |
|
| 97 | 97 | $this->getHTTPRequestSanitized( $_FILES[ '__import' ], false ), |
| 98 | 98 | $this->getHTTPRequestSanitized( $_POST[ '__import' ], true ) |
| 99 | 99 | ); |
| 100 | - $_aArguments = array( |
|
| 100 | + $_aArguments = array( |
|
| 101 | 101 | 'class_name' => $this->oFactory->oProp->sClassName, |
| 102 | 102 | 'page_slug' => $sPageSlug, |
| 103 | 103 | 'tab_slug' => $sTabSlug, |
@@ -116,9 +116,9 @@ discard block |
||
| 116 | 116 | // Check the uploaded file MIME type. |
| 117 | 117 | $_aMIMEType = $this->_getImportMIMEType( $_aArguments ); |
| 118 | 118 | $_sType = $_oImport->getType(); |
| 119 | - if ( ! in_array( $_sType, $_aMIMEType ) ) { |
|
| 119 | + if ( !in_array( $_sType, $_aMIMEType ) ) { |
|
| 120 | 120 | $this->oFactory->setSettingNotice( sprintf( $this->oFactory->oMsg->get( 'uploaded_file_type_not_supported' ), $_sType ) ); |
| 121 | - return $aStoredOptions; // do not change the framework's options. |
|
| 121 | + return $aStoredOptions; // do not change the framework's options. |
|
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | // Retrieve the importing data. |
@@ -183,9 +183,9 @@ discard block |
||
| 183 | 183 | array( |
| 184 | 184 | 'text/plain', |
| 185 | 185 | 'application/octet-stream', // .json file is dealt as a binary file. |
| 186 | - 'application/json', // 3.7.0+ some servers cannot upload json files without this |
|
| 187 | - 'text/html', // 3.7.2+ |
|
| 188 | - 'application/txt', // 3.7.2+ |
|
| 186 | + 'application/json', // 3.7.0+ some servers cannot upload json files without this |
|
| 187 | + 'text/html', // 3.7.2+ |
|
| 188 | + 'application/txt', // 3.7.2+ |
|
| 189 | 189 | ), |
| 190 | 190 | $aArguments |
| 191 | 191 | ); |
@@ -274,18 +274,18 @@ discard block |
||
| 274 | 274 | protected function _getPortFilterHookNames( $sPrefix, array $aArguments ) { |
| 275 | 275 | |
| 276 | 276 | return array( |
| 277 | - $sPrefix . $aArguments[ 'class_name' ] . '_' . $aArguments[ 'pressed_input_id' ], |
|
| 277 | + $sPrefix.$aArguments[ 'class_name' ].'_'.$aArguments[ 'pressed_input_id' ], |
|
| 278 | 278 | $aArguments[ 'section_id' ] |
| 279 | - ? $sPrefix . $aArguments[ 'class_name' ] . '_' . $aArguments[ 'section_id' ] .'_' . $aArguments[ 'pressed_field_id' ] |
|
| 280 | - : $sPrefix . $aArguments[ 'class_name' ] . '_' . $aArguments[ 'pressed_field_id' ], |
|
| 279 | + ? $sPrefix.$aArguments[ 'class_name' ].'_'.$aArguments[ 'section_id' ].'_'.$aArguments[ 'pressed_field_id' ] |
|
| 280 | + : $sPrefix.$aArguments[ 'class_name' ].'_'.$aArguments[ 'pressed_field_id' ], |
|
| 281 | 281 | $aArguments[ 'section_id' ] |
| 282 | - ? $sPrefix . $aArguments[ 'class_name' ] . '_' . $aArguments[ 'section_id' ] |
|
| 282 | + ? $sPrefix.$aArguments[ 'class_name' ].'_'.$aArguments[ 'section_id' ] |
|
| 283 | 283 | : null, |
| 284 | 284 | $aArguments[ 'tab_slug' ] |
| 285 | - ? $sPrefix . $aArguments[ 'page_slug' ] . '_' . $aArguments[ 'tab_slug' ] |
|
| 285 | + ? $sPrefix.$aArguments[ 'page_slug' ].'_'.$aArguments[ 'tab_slug' ] |
|
| 286 | 286 | : null, |
| 287 | - $sPrefix . $aArguments[ 'page_slug' ], |
|
| 288 | - $sPrefix . $aArguments[ 'class_name' ] |
|
| 287 | + $sPrefix.$aArguments[ 'page_slug' ], |
|
| 288 | + $sPrefix.$aArguments[ 'class_name' ] |
|
| 289 | 289 | ); |
| 290 | 290 | |
| 291 | 291 | } |