@@ -40,7 +40,7 @@ |
||
| 40 | 40 | * @return array The formatted definition array. |
| 41 | 41 | */ |
| 42 | 42 | public function get() { |
| 43 | - foreach( $this->aDimensionalKeys as $_sFlatFieldAddress ) { |
|
| 43 | + foreach ( $this->aDimensionalKeys as $_sFlatFieldAddress ) { |
|
| 44 | 44 | $this->unsetDimensionalArrayElement( |
| 45 | 45 | $this->aSubject, |
| 46 | 46 | explode( '|', $_sFlatFieldAddress ) |
@@ -44,7 +44,7 @@ |
||
| 44 | 44 | $this->unsetDimensionalArrayElement( |
| 45 | 45 | $this->aSubject, |
| 46 | 46 | explode( '|', $_sFlatFieldAddress ) |
| 47 | - ); |
|
| 47 | + ); |
|
| 48 | 48 | } |
| 49 | 49 | return $this->aSubject; |
| 50 | 50 | } |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | $this->aInput, |
| 30 | 30 | $this->aFieldAddresses, |
| 31 | 31 | ); |
| 32 | - $this->aInput = $_aParameters[ 0 ]; |
|
| 32 | + $this->aInput = $_aParameters[ 0 ]; |
|
| 33 | 33 | $this->aFieldAddresses = $_aParameters[ 1 ]; |
| 34 | 34 | |
| 35 | 35 | |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | */ |
| 43 | 43 | public function get() { |
| 44 | 44 | |
| 45 | - foreach( $this->_getFormattedDimensionalKeys( $this->aFieldAddresses ) as $_sFlatFieldAddress ) { |
|
| 45 | + foreach ( $this->_getFormattedDimensionalKeys( $this->aFieldAddresses ) as $_sFlatFieldAddress ) { |
|
| 46 | 46 | |
| 47 | 47 | $_aDimensionalKeys = explode( '|', $_sFlatFieldAddress ); |
| 48 | 48 | |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | |
| 54 | 54 | // If the retrieved value does not exist, null will be given. |
| 55 | 55 | // This occurs with page meta boxes. |
| 56 | - if ( ! is_array( $_aDynamicElements ) ) { |
|
| 56 | + if ( !is_array( $_aDynamicElements ) ) { |
|
| 57 | 57 | continue; |
| 58 | 58 | } |
| 59 | 59 | |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | */ |
| 18 | 18 | class AdminPageFramework_Form_Model___DefaultValues extends AdminPageFramework_Form_Base { |
| 19 | 19 | |
| 20 | - public $aFieldsets = array(); |
|
| 20 | + public $aFieldsets = array(); |
|
| 21 | 21 | |
| 22 | 22 | /** |
| 23 | 23 | * Sets up hooks. |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | $_aParameters = func_get_args() + array( |
| 29 | 29 | $this->aFieldsets, |
| 30 | 30 | ); |
| 31 | - $this->aFieldsets = $_aParameters[ 0 ]; |
|
| 31 | + $this->aFieldsets = $_aParameters[ 0 ]; |
|
| 32 | 32 | |
| 33 | 33 | } |
| 34 | 34 | |
@@ -86,13 +86,13 @@ discard block |
||
| 86 | 86 | */ |
| 87 | 87 | private function _getDefaultValues( $aFieldsets, $aDefaultOptions ) { |
| 88 | 88 | |
| 89 | - foreach( $aFieldsets as $_sSectionPath => $_aItems ) { |
|
| 89 | + foreach ( $aFieldsets as $_sSectionPath => $_aItems ) { |
|
| 90 | 90 | |
| 91 | 91 | $_aSectionPath = explode( '|', $_sSectionPath ); |
| 92 | - foreach( $_aItems as $_sFieldPath => $_aFieldset ) { |
|
| 92 | + foreach ( $_aItems as $_sFieldPath => $_aFieldset ) { |
|
| 93 | 93 | $_aFieldPath = explode( '|', $_sFieldPath ); |
| 94 | 94 | $this->setMultiDimensionalArray( |
| 95 | - $aDefaultOptions, // by reference |
|
| 95 | + $aDefaultOptions, // by reference |
|
| 96 | 96 | '_default' === $_sSectionPath |
| 97 | 97 | ? array( $_sFieldPath ) |
| 98 | 98 | : array_merge( $_aSectionPath, $_aFieldPath ), // key address |
@@ -148,11 +148,11 @@ discard block |
||
| 148 | 148 | // If there are no sub-fields |
| 149 | 149 | if ( count( $_aSubFields ) == 0 ) { |
| 150 | 150 | return $this->getElement( |
| 151 | - $aFieldset, // subject |
|
| 152 | - 'value', // key |
|
| 151 | + $aFieldset, // subject |
|
| 152 | + 'value', // key |
|
| 153 | 153 | $this->getElement( // default value |
| 154 | - $aFieldset, // subject |
|
| 155 | - 'default', // key |
|
| 154 | + $aFieldset, // subject |
|
| 155 | + 'default', // key |
|
| 156 | 156 | null // default value |
| 157 | 157 | ) |
| 158 | 158 | ); |
@@ -161,13 +161,13 @@ discard block |
||
| 161 | 161 | // Otherwise, there are sub-fields |
| 162 | 162 | $_aDefault = array(); |
| 163 | 163 | array_unshift( $_aSubFields, $aFieldset ); // insert the main field into the very first index. |
| 164 | - foreach( $_aSubFields as $_iIndex => $_aField ) { |
|
| 164 | + foreach ( $_aSubFields as $_iIndex => $_aField ) { |
|
| 165 | 165 | $_aDefault[ $_iIndex ] = $this->getElement( |
| 166 | - $_aField, // subject |
|
| 167 | - 'value', // key |
|
| 166 | + $_aField, // subject |
|
| 167 | + 'value', // key |
|
| 168 | 168 | $this->getElement( // default value |
| 169 | - $_aField, // subject |
|
| 170 | - 'default', // key |
|
| 169 | + $_aField, // subject |
|
| 170 | + 'default', // key |
|
| 171 | 171 | null // default value |
| 172 | 172 | ) |
| 173 | 173 | ); |
@@ -60,18 +60,18 @@ discard block |
||
| 60 | 60 | |
| 61 | 61 | // Drop keys of fields-array which do not exist in the sections-array. |
| 62 | 62 | // For this reasons, the sections-array should be conditioned first before applying this method. |
| 63 | - $aFields = $this->castArrayContents( $aSections, $aFields ); |
|
| 63 | + $aFields = $this->castArrayContents( $aSections, $aFields ); |
|
| 64 | 64 | |
| 65 | 65 | $_aNewFields = array(); |
| 66 | - foreach( $aFields as $_sSectionID => $_aSubSectionOrFields ) { |
|
| 66 | + foreach ( $aFields as $_sSectionID => $_aSubSectionOrFields ) { |
|
| 67 | 67 | |
| 68 | 68 | // This type check is important as the parsing field array is content-cast, which can set null value to elements. |
| 69 | - if ( ! is_array( $_aSubSectionOrFields ) ) { |
|
| 69 | + if ( !is_array( $_aSubSectionOrFields ) ) { |
|
| 70 | 70 | continue; |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | $this->_setConditionedFields( |
| 74 | - $_aNewFields, // by reference - gets updated in the method. |
|
| 74 | + $_aNewFields, // by reference - gets updated in the method. |
|
| 75 | 75 | $_aSubSectionOrFields, |
| 76 | 76 | $_sSectionID |
| 77 | 77 | ); |
@@ -91,14 +91,14 @@ discard block |
||
| 91 | 91 | */ |
| 92 | 92 | private function _setConditionedFields( array &$_aNewFields, $_aSubSectionOrFields, $_sSectionID ) { |
| 93 | 93 | |
| 94 | - foreach( $_aSubSectionOrFields as $_sIndexOrFieldID => $_aSubSectionOrField ) { |
|
| 94 | + foreach ( $_aSubSectionOrFields as $_sIndexOrFieldID => $_aSubSectionOrField ) { |
|
| 95 | 95 | |
| 96 | 96 | // If it is a sub-section array. |
| 97 | 97 | if ( $this->isNumericInteger( $_sIndexOrFieldID ) ) { |
| 98 | 98 | $_sSubSectionIndex = $_sIndexOrFieldID; |
| 99 | 99 | $_aFields = $_aSubSectionOrField; |
| 100 | - foreach( $_aFields as $_aField ) { |
|
| 101 | - if ( ! $this->_isAllowed( $_aField ) ) { |
|
| 100 | + foreach ( $_aFields as $_aField ) { |
|
| 101 | + if ( !$this->_isAllowed( $_aField ) ) { |
|
| 102 | 102 | continue; |
| 103 | 103 | } |
| 104 | 104 | $_aNewFields[ $_sSectionID ][ $_sSubSectionIndex ][ $_aField[ 'field_id' ] ] = $_aField; |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | |
| 110 | 110 | // Otherwise, insert the formatted field definition array. |
| 111 | 111 | $_aField = $_aSubSectionOrField; |
| 112 | - if ( ! $this->_isAllowed( $_aField ) ) { |
|
| 112 | + if ( !$this->_isAllowed( $_aField ) ) { |
|
| 113 | 113 | continue; |
| 114 | 114 | } |
| 115 | 115 | $_aNewFields[ $_sSectionID ][ $_aField[ 'field_id' ] ] = $_aField; |
@@ -66,7 +66,7 @@ |
||
| 66 | 66 | foreach( $aFields as $_sSectionID => $_aSubSectionOrFields ) { |
| 67 | 67 | |
| 68 | 68 | // This type check is important as the parsing field array is content-cast, which can set null value to elements. |
| 69 | - if ( ! is_array( $_aSubSectionOrFields ) ) { |
|
| 69 | + if ( ! is_array( $_aSubSectionOrFields ) ) { |
|
| 70 | 70 | continue; |
| 71 | 71 | } |
| 72 | 72 | |
@@ -73,7 +73,7 @@ |
||
| 73 | 73 | protected function _isAllowed( array $aDefinition ) { |
| 74 | 74 | |
| 75 | 75 | // Check capability. If the access level is not sufficient, skip. |
| 76 | - if ( ! current_user_can( $aDefinition[ 'capability' ] ) ) { |
|
| 76 | + if ( ! current_user_can( $aDefinition[ 'capability' ] ) ) { |
|
| 77 | 77 | return false; |
| 78 | 78 | } |
| 79 | 79 | return ( boolean ) $aDefinition[ 'if' ]; |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | */ |
| 19 | 19 | class AdminPageFramework_Form_Model___SectionConditioner extends AdminPageFramework_FrameworkUtility { |
| 20 | 20 | |
| 21 | - public $aSectionsets = array(); |
|
| 21 | + public $aSectionsets = array(); |
|
| 22 | 22 | |
| 23 | 23 | /** |
| 24 | 24 | * Sets up hooks. |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | $_aParameters = func_get_args() + array( |
| 30 | 30 | $this->aSectionsets, |
| 31 | 31 | ); |
| 32 | - $this->aSectionsets = $_aParameters[ 0 ]; |
|
| 32 | + $this->aSectionsets = $_aParameters[ 0 ]; |
|
| 33 | 33 | |
| 34 | 34 | } |
| 35 | 35 | |
@@ -51,11 +51,11 @@ discard block |
||
| 51 | 51 | * @since 3.7.0 Moved from `AdminPageFramework_FormDefinition`. Changed the name from `getConditionedSections()`. |
| 52 | 52 | * @return array The conditioned sectionsets array. |
| 53 | 53 | */ |
| 54 | - private function _getSectionsConditioned( array $aSections=array() ) { |
|
| 54 | + private function _getSectionsConditioned( array $aSections = array() ) { |
|
| 55 | 55 | |
| 56 | - $_aNewSections = array(); |
|
| 57 | - foreach( $aSections as $_sSectionID => $_aSection ) { |
|
| 58 | - if ( ! $this->_isAllowed( $_aSection ) ) { |
|
| 56 | + $_aNewSections = array(); |
|
| 57 | + foreach ( $aSections as $_sSectionID => $_aSection ) { |
|
| 58 | + if ( !$this->_isAllowed( $_aSection ) ) { |
|
| 59 | 59 | continue; |
| 60 | 60 | } |
| 61 | 61 | $_aNewSections[ $_sSectionID ] = $_aSection; |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | protected function _isAllowed( array $aDefinition ) { |
| 75 | 75 | |
| 76 | 76 | // Check capability. If the access level is not sufficient, skip. |
| 77 | - if ( ! current_user_can( $aDefinition[ 'capability' ] ) ) { |
|
| 77 | + if ( !current_user_can( $aDefinition[ 'capability' ] ) ) { |
|
| 78 | 78 | return false; |
| 79 | 79 | } |
| 80 | 80 | return ( boolean ) $aDefinition[ 'if' ]; |
@@ -81,7 +81,7 @@ |
||
| 81 | 81 | $this->oMsg, |
| 82 | 82 | false // `false` to disable auto-registering. |
| 83 | 83 | ); |
| 84 | - foreach( $_oFieldType->aFieldTypeSlugs as $_sSlug ) { |
|
| 84 | + foreach( $_oFieldType->aFieldTypeSlugs as $_sSlug ) { |
|
| 85 | 85 | $_aFieldTypeDefinitions[ $_sSlug ] = $_oFieldType->getDefinitionArray(); |
| 86 | 86 | } |
| 87 | 87 | } |
@@ -43,9 +43,9 @@ discard block |
||
| 43 | 43 | 'posttype', |
| 44 | 44 | 'size', |
| 45 | 45 | 'section_title', // 3.0.0+ |
| 46 | - 'system', // 3.3.0+ |
|
| 47 | - 'inline_mixed', // 3.8.0+ |
|
| 48 | - '_nested', // 3.8.0+ |
|
| 46 | + 'system', // 3.3.0+ |
|
| 47 | + 'inline_mixed', // 3.8.0+ |
|
| 48 | + '_nested', // 3.8.0+ |
|
| 49 | 49 | ); |
| 50 | 50 | |
| 51 | 51 | public $sCallerID = ''; |
@@ -75,16 +75,16 @@ discard block |
||
| 75 | 75 | public function get() { |
| 76 | 76 | |
| 77 | 77 | $_aFieldTypeDefinitions = array(); |
| 78 | - foreach( self::$_aDefaultFieldTypeSlugs as $_sFieldTypeSlug ) { |
|
| 78 | + foreach ( self::$_aDefaultFieldTypeSlugs as $_sFieldTypeSlug ) { |
|
| 79 | 79 | |
| 80 | 80 | $_sFieldTypeClassName = "AdminPageFramework_FieldType_{$_sFieldTypeSlug}"; |
| 81 | 81 | $_oFieldType = new $_sFieldTypeClassName( |
| 82 | - $this->sCallerID, // usually an instantiated class name |
|
| 83 | - null, // field type slugs - if it is different from the one defined in the class property |
|
| 82 | + $this->sCallerID, // usually an instantiated class name |
|
| 83 | + null, // field type slugs - if it is different from the one defined in the class property |
|
| 84 | 84 | $this->oMsg, |
| 85 | 85 | false // `false` to disable auto-registering. |
| 86 | 86 | ); |
| 87 | - foreach( $_oFieldType->aFieldTypeSlugs as $_sSlug ) { |
|
| 87 | + foreach ( $_oFieldType->aFieldTypeSlugs as $_sSlug ) { |
|
| 88 | 88 | $_aFieldTypeDefinitions[ $_sSlug ] = $_oFieldType->getDefinitionArray(); |
| 89 | 89 | } |
| 90 | 90 | } |
@@ -43,7 +43,7 @@ |
||
| 43 | 43 | * @since 2.1.5 |
| 44 | 44 | * @since 3.3.1 Changed from `_replyToGetStyles()`. |
| 45 | 45 | */ |
| 46 | - protected function getStyles() { |
|
| 46 | + protected function getStyles() { |
|
| 47 | 47 | return <<<CSSRULES |
| 48 | 48 | /* Text Field Type */ |
| 49 | 49 | .admin-page-framework-field.admin-page-framework-field-text > .admin-page-framework-input-label-container { |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | /** |
| 39 | 39 | * Defines the field type slugs used for this field type. |
| 40 | 40 | */ |
| 41 | - public $aFieldTypeSlugs = array( 'text', 'password', 'date', 'datetime', 'datetime-local', 'email', 'month', 'search', 'tel', 'url', 'week', ); |
|
| 41 | + public $aFieldTypeSlugs = array( 'text', 'password', 'date', 'datetime', 'datetime-local', 'email', 'month', 'search', 'tel', 'url', 'week',); |
|
| 42 | 42 | |
| 43 | 43 | /** |
| 44 | 44 | * Defines the default key-values of this field type. |
@@ -82,8 +82,8 @@ discard block |
||
| 82 | 82 | protected function getField( $aField ) { |
| 83 | 83 | |
| 84 | 84 | $_aOutput = array(); |
| 85 | - foreach( ( array ) $aField[ 'label' ] as $_sKey => $_sLabel ) { |
|
| 86 | - $_aOutput[] = $this->_getFieldOutputByLabel( |
|
| 85 | + foreach ( ( array ) $aField[ 'label' ] as $_sKey => $_sLabel ) { |
|
| 86 | + $_aOutput[ ] = $this->_getFieldOutputByLabel( |
|
| 87 | 87 | $_sKey, |
| 88 | 88 | $_sLabel, |
| 89 | 89 | $aField |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | // the repeatable field buttons will be replaced with this element. |
| 94 | - $_aOutput[] = "<div class='repeatable-field-buttons'></div>"; |
|
| 94 | + $_aOutput[ ] = "<div class='repeatable-field-buttons'></div>"; |
|
| 95 | 95 | return implode( '', $_aOutput ); |
| 96 | 96 | |
| 97 | 97 | } |
@@ -111,8 +111,8 @@ discard block |
||
| 111 | 111 | $aField[ 'value' ] = $this->getElementByLabel( $aField[ 'value' ], $sKey, $aField[ 'label' ] ); |
| 112 | 112 | $_aInputAttributes = $_bIsArray |
| 113 | 113 | ? array( |
| 114 | - 'name' => $aField[ 'attributes' ][ 'name' ] . "[{$sKey}]", |
|
| 115 | - 'id' => $aField[ 'attributes' ][ 'id' ] . "_{$sKey}", |
|
| 114 | + 'name' => $aField[ 'attributes' ][ 'name' ]."[{$sKey}]", |
|
| 115 | + 'id' => $aField[ 'attributes' ][ 'id' ]."_{$sKey}", |
|
| 116 | 116 | 'value' => $aField[ 'value' ], |
| 117 | 117 | ) |
| 118 | 118 | + $this->getAsArray( |
@@ -120,17 +120,17 @@ discard block |
||
| 120 | 120 | ) // 3.8.6+ Allows the user to set individual attributes by label. |
| 121 | 121 | + $aField[ 'attributes' ] |
| 122 | 122 | : $aField[ 'attributes' ]; |
| 123 | - $_aOutput = array( |
|
| 123 | + $_aOutput = array( |
|
| 124 | 124 | $this->getElementByLabel( $aField[ 'before_label' ], $sKey, $aField[ 'label' ] ), |
| 125 | 125 | "<div class='admin-page-framework-input-label-container {$_sClassSelector}'>", |
| 126 | - "<label for='" . $_aInputAttributes[ 'id' ] . "'>", |
|
| 126 | + "<label for='".$_aInputAttributes[ 'id' ]."'>", |
|
| 127 | 127 | $this->getElementByLabel( $aField[ 'before_input' ], $sKey, $aField[ 'label' ] ), |
| 128 | 128 | $_sLabel |
| 129 | - ? "<span " . $this->getLabelContainerAttributes( $aField, 'admin-page-framework-input-label-string' ) . ">" |
|
| 129 | + ? "<span ".$this->getLabelContainerAttributes( $aField, 'admin-page-framework-input-label-string' ).">" |
|
| 130 | 130 | . $_sLabel |
| 131 | 131 | . "</span>" |
| 132 | 132 | : '', |
| 133 | - "<input " . $this->getAttributes( $_aInputAttributes ) . " />", |
|
| 133 | + "<input ".$this->getAttributes( $_aInputAttributes )." />", |
|
| 134 | 134 | $this->getElementByLabel( $aField[ 'after_input' ], $sKey, $aField[ 'label' ] ), |
| 135 | 135 | "</label>", |
| 136 | 136 | "</div>", |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | /** |
| 21 | 21 | * Defines the field type slugs used for this field type. |
| 22 | 22 | */ |
| 23 | - public $aFieldTypeSlugs = array( 'file', ); |
|
| 23 | + public $aFieldTypeSlugs = array( 'file',); |
|
| 24 | 24 | |
| 25 | 25 | /** |
| 26 | 26 | * Defines the default key-values of this field type. |
@@ -76,15 +76,15 @@ discard block |
||
| 76 | 76 | array( |
| 77 | 77 | 'type' => 'hidden', |
| 78 | 78 | 'value' => '', |
| 79 | - 'name' => $aField[ 'attributes' ][ 'name' ] . '[_dummy_value]', |
|
| 79 | + 'name' => $aField[ 'attributes' ][ 'name' ].'[_dummy_value]', |
|
| 80 | 80 | ) |
| 81 | 81 | ) |
| 82 | 82 | . $this->getHTMLTag( |
| 83 | 83 | 'input', |
| 84 | 84 | array( |
| 85 | 85 | 'type' => 'hidden', |
| 86 | - 'name' => '__unset_' . $aField[ '_structure_type' ] . '[' . $aField[ '_input_name_flat' ] . '|_dummy_value' . ']', |
|
| 87 | - 'value' => $aField[ '_input_name_flat' ] . '|_dummy_value', |
|
| 86 | + 'name' => '__unset_'.$aField[ '_structure_type' ].'['.$aField[ '_input_name_flat' ].'|_dummy_value'.']', |
|
| 87 | + 'value' => $aField[ '_input_name_flat' ].'|_dummy_value', |
|
| 88 | 88 | 'class' => 'unset-element-names element-address', |
| 89 | 89 | ) |
| 90 | 90 | ); |
@@ -25,7 +25,7 @@ |
||
| 25 | 25 | /** |
| 26 | 26 | * Defines the field type slugs used for this field type. |
| 27 | 27 | */ |
| 28 | - public $aFieldTypeSlugs = array( 'section_title', ); |
|
| 28 | + public $aFieldTypeSlugs = array( 'section_title',); |
|
| 29 | 29 | |
| 30 | 30 | /** |
| 31 | 31 | * Defines the default key-values of this field type. |