@@ -84,7 +84,7 @@ |
||
| 84 | 84 | |
| 85 | 85 | // The first element is the option key; the section or field dimensional keys follow. |
| 86 | 86 | if ( '__dummy_option_key' === $_aDimensionalKeys[ 0 ] ) { |
| 87 | - array_shift( $_aDimensionalKeys ); |
|
| 87 | + array_shift( $_aDimensionalKeys ); |
|
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | $this->unsetDimensionalArrayElement( |
@@ -31,9 +31,9 @@ discard block |
||
| 31 | 31 | * @param string $sStructureType The type of object. Currently 'post_meta_box' or 'user_meta' is accepted. |
| 32 | 32 | * @return void |
| 33 | 33 | */ |
| 34 | - public function updateMetaDataByType( $iObjectID, array $aInput, array $aSavedMeta, $sStructureType='post_meta_box' ) { |
|
| 34 | + public function updateMetaDataByType( $iObjectID, array $aInput, array $aSavedMeta, $sStructureType = 'post_meta_box' ) { |
|
| 35 | 35 | |
| 36 | - if ( ! $iObjectID ) { |
|
| 36 | + if ( !$iObjectID ) { |
|
| 37 | 37 | return; |
| 38 | 38 | } |
| 39 | 39 | |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | 'post_meta_box' => 'update_post_meta', |
| 42 | 42 | 'user_meta' => 'update_user_meta', |
| 43 | 43 | ); |
| 44 | - if ( ! in_array( $sStructureType, array_keys( $_aFunctionNameMapByFieldsType ) ) ) { |
|
| 44 | + if ( !in_array( $sStructureType, array_keys( $_aFunctionNameMapByFieldsType ) ) ) { |
|
| 45 | 45 | return; |
| 46 | 46 | } |
| 47 | 47 | $_sFunctionName = $this->getElement( $_aFunctionNameMapByFieldsType, $sStructureType ); |
@@ -69,16 +69,16 @@ discard block |
||
| 69 | 69 | */ |
| 70 | 70 | private function _getInputByUnset( array $aInput ) { |
| 71 | 71 | |
| 72 | - $_sUnsetKey = '__unset_' . $this->sStructureType; |
|
| 73 | - if ( ! isset( $_POST[ $_sUnsetKey ] ) ) { |
|
| 72 | + $_sUnsetKey = '__unset_'.$this->sStructureType; |
|
| 73 | + if ( !isset( $_POST[ $_sUnsetKey ] ) ) { |
|
| 74 | 74 | return $aInput; |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | $_aUnsetElements = array_unique( $_POST[ $_sUnsetKey ] ); |
| 78 | - foreach( $_aUnsetElements as $_sFlatInputName ) { |
|
| 78 | + foreach ( $_aUnsetElements as $_sFlatInputName ) { |
|
| 79 | 79 | |
| 80 | 80 | $_aDimensionalKeys = explode( '|', $_sFlatInputName ); |
| 81 | - if ( ! isset( $_aDimensionalKeys[ 0 ] ) ) { |
|
| 81 | + if ( !isset( $_aDimensionalKeys[ 0 ] ) ) { |
|
| 82 | 82 | continue; |
| 83 | 83 | } |
| 84 | 84 | |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | |
| 114 | 114 | $_vSavedValue = $this->getElement( |
| 115 | 115 | $aSavedMeta, // subject |
| 116 | - $_sSectionOrFieldID, // dimensional keys |
|
| 116 | + $_sSectionOrFieldID, // dimensional keys |
|
| 117 | 117 | null // default value |
| 118 | 118 | ); |
| 119 | 119 | |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | */ |
| 108 | 108 | private function _updateMetaDatumByFuncitonName( $iObjectID, $_vValue, array $aSavedMeta, $_sSectionOrFieldID, $_sFunctionName ) { |
| 109 | 109 | |
| 110 | - if ( is_null( $_vValue ) ) { |
|
| 110 | + if ( is_null( $_vValue ) ) { |
|
| 111 | 111 | return; |
| 112 | 112 | } |
| 113 | 113 | |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | |
| 120 | 120 | // PHP can compare even array contents with the == operator. See http://www.php.net/manual/en/language.operators.array.php |
| 121 | 121 | // if the input value and the saved meta value are the same, no need to update it. |
| 122 | - if ( $_vValue == $_vSavedValue ) { |
|
| 122 | + if ( $_vValue == $_vSavedValue ) { |
|
| 123 | 123 | return; |
| 124 | 124 | } |
| 125 | 125 | |
@@ -57,18 +57,18 @@ discard block |
||
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | // If the section ID is not registered, return false. |
| 60 | - if ( ! array_key_exists( $sID, $this->aSectionsets ) ) { |
|
| 60 | + if ( !array_key_exists( $sID, $this->aSectionsets ) ) { |
|
| 61 | 61 | return false; |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | // the fields array's first dimension is also filled with the keys of section ids. |
| 65 | - if ( ! array_key_exists( $sID, $this->aFieldsets ) ) { |
|
| 65 | + if ( !array_key_exists( $sID, $this->aFieldsets ) ) { |
|
| 66 | 66 | return false; |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | // Since numeric IDs are denied at the beginning of the method, the elements will not be sub-sections. |
| 70 | 70 | $_bIsSeciton = false; |
| 71 | - foreach( $this->aFieldsets as $_sSectionID => $_aFields ) { |
|
| 71 | + foreach ( $this->aFieldsets as $_sSectionID => $_aFields ) { |
|
| 72 | 72 | |
| 73 | 73 | if ( $_sSectionID == $sID ) { |
| 74 | 74 | $_bIsSeciton = true; |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | * @return boolean |
| 95 | 95 | */ |
| 96 | 96 | public function canUserView( $sCapability ) { |
| 97 | - if ( ! $sCapability ) { |
|
| 97 | + if ( !$sCapability ) { |
|
| 98 | 98 | return true; |
| 99 | 99 | } |
| 100 | 100 | return ( boolean ) current_user_can( $sCapability ); |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | * @since DEVVER |
| 140 | 140 | */ |
| 141 | 141 | public function callBack( $oCallable, $asParameters ) { |
| 142 | - $_aParameters = self::getAsArray( |
|
| 142 | + $_aParameters = self::getAsArray( |
|
| 143 | 143 | $asParameters, |
| 144 | 144 | true // preserve empty |
| 145 | 145 | ); |
@@ -57,25 +57,25 @@ |
||
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | // If the section ID is not registered, return false. |
| 60 | - if ( ! array_key_exists( $sID, $this->aSectionsets ) ) { |
|
| 60 | + if ( ! array_key_exists( $sID, $this->aSectionsets ) ) { |
|
| 61 | 61 | return false; |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | // the fields array's first dimension is also filled with the keys of section ids. |
| 65 | - if ( ! array_key_exists( $sID, $this->aFieldsets ) ) { |
|
| 65 | + if ( ! array_key_exists( $sID, $this->aFieldsets ) ) { |
|
| 66 | 66 | return false; |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | // Since numeric IDs are denied at the beginning of the method, the elements will not be sub-sections. |
| 70 | 70 | $_bIsSeciton = false; |
| 71 | - foreach( $this->aFieldsets as $_sSectionID => $_aFields ) { |
|
| 71 | + foreach( $this->aFieldsets as $_sSectionID => $_aFields ) { |
|
| 72 | 72 | |
| 73 | - if ( $_sSectionID == $sID ) { |
|
| 73 | + if ( $_sSectionID == $sID ) { |
|
| 74 | 74 | $_bIsSeciton = true; |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | // a field using the ID is found, and it precedes a section match. |
| 78 | - if ( array_key_exists( $sID, $_aFields ) ) { |
|
| 78 | + if ( array_key_exists( $sID, $_aFields ) ) { |
|
| 79 | 79 | return false; |
| 80 | 80 | } |
| 81 | 81 | |
@@ -35,41 +35,41 @@ discard block |
||
| 35 | 35 | // Optional |
| 36 | 36 | 'page_slug' => null, |
| 37 | 37 | 'tab_slug' => null, |
| 38 | - 'section_tab_slug' => null, // 3.0.0+ |
|
| 38 | + 'section_tab_slug' => null, // 3.0.0+ |
|
| 39 | 39 | 'title' => null, |
| 40 | 40 | 'description' => null, |
| 41 | 41 | 'capability' => null, |
| 42 | 42 | 'if' => true, |
| 43 | - 'order' => null, // do not set the default number here because incremented numbers will be added when registering the sections. |
|
| 43 | + 'order' => null, // do not set the default number here because incremented numbers will be added when registering the sections. |
|
| 44 | 44 | 'help' => null, |
| 45 | 45 | 'help_aside' => null, |
| 46 | - 'repeatable' => false, // (boolean|array) 3.0.0+ |
|
| 47 | - 'sortable' => false, // (boolean|array) 3.6.0+ |
|
| 46 | + 'repeatable' => false, // (boolean|array) 3.0.0+ |
|
| 47 | + 'sortable' => false, // (boolean|array) 3.6.0+ |
|
| 48 | 48 | 'attributes' => array( // 3.3.1+ |
| 49 | - 'class' => null, // set null to avoid undefined index warnings. |
|
| 50 | - 'style' => null, // set null to avoid undefined index warnings. |
|
| 49 | + 'class' => null, // set null to avoid undefined index warnings. |
|
| 50 | + 'style' => null, // set null to avoid undefined index warnings. |
|
| 51 | 51 | 'tab' => array(), |
| 52 | 52 | ), |
| 53 | 53 | 'class' => array( // 3.3.1+ |
| 54 | 54 | 'tab' => array(), |
| 55 | 55 | ), |
| 56 | - 'hidden' => false, // 3.3.1+ |
|
| 57 | - 'collapsible' => false, // 3.4.0+ (boolean|array) For the array structure see the $aStructure_CollapsibleArguments property. |
|
| 58 | - 'save' => true, // 3.6.0+ |
|
| 56 | + 'hidden' => false, // 3.3.1+ |
|
| 57 | + 'collapsible' => false, // 3.4.0+ (boolean|array) For the array structure see the $aStructure_CollapsibleArguments property. |
|
| 58 | + 'save' => true, // 3.6.0+ |
|
| 59 | 59 | |
| 60 | - 'content' => null, // 3.6.1+ (string) An overriding section-set output. |
|
| 60 | + 'content' => null, // 3.6.1+ (string) An overriding section-set output. |
|
| 61 | 61 | |
| 62 | - 'tip' => null, // 3.7.0 (string) Tool tip HTML strings. |
|
| 62 | + 'tip' => null, // 3.7.0 (string) Tool tip HTML strings. |
|
| 63 | 63 | |
| 64 | 64 | // Internal |
| 65 | - '_fields_type' => null, // @deprecated 3.7.0+ Use the `_structure_type` instead. 3.0.0+ - same as the one of the field definition array. Used to insert debug info at the bottom of sections. |
|
| 66 | - '_structure_type' => null, // 3.7.0+ |
|
| 67 | - '_is_first_index' => false, // 3.4.0+ (boolean) indicates whether it is the first item of the sub-sections (for repeatable sections). |
|
| 68 | - '_is_last_index' => false, // 3.4.0+ (boolean) indicates whether it is the last item of the sub-sections (for repeatable sections). |
|
| 65 | + '_fields_type' => null, // @deprecated 3.7.0+ Use the `_structure_type` instead. 3.0.0+ - same as the one of the field definition array. Used to insert debug info at the bottom of sections. |
|
| 66 | + '_structure_type' => null, // 3.7.0+ |
|
| 67 | + '_is_first_index' => false, // 3.4.0+ (boolean) indicates whether it is the first item of the sub-sections (for repeatable sections). |
|
| 68 | + '_is_last_index' => false, // 3.4.0+ (boolean) indicates whether it is the last item of the sub-sections (for repeatable sections). |
|
| 69 | 69 | |
| 70 | - '_section_path' => '', // 3.7.0+ (string) e.g. my_section|nested_section |
|
| 71 | - '_section_path_array' => '', // 3.7.0+ (array) an array version of the above section_path argument. Numerically indexed. |
|
| 72 | - '_nested_depth' => 0, // 3.7.0+ (integer) the nested level of the section |
|
| 70 | + '_section_path' => '', // 3.7.0+ (string) e.g. my_section|nested_section |
|
| 71 | + '_section_path_array' => '', // 3.7.0+ (array) an array version of the above section_path argument. Numerically indexed. |
|
| 72 | + '_nested_depth' => 0, // 3.7.0+ (integer) the nested level of the section |
|
| 73 | 73 | |
| 74 | 74 | // 3.6.0+ - (object) the caller framework factory object. This allows the framework to access the factory property when rendering the section. |
| 75 | 75 | // 3.7.0+ It no longer stores a factory object but a form object. |
@@ -124,11 +124,11 @@ discard block |
||
| 124 | 124 | $_aSectionPath = explode( '|', $this->sSectionPath ); |
| 125 | 125 | $_aSectionset = $this->uniteArrays( |
| 126 | 126 | array( |
| 127 | - '_fields_type' => $this->sStructureType, // @deprecated 3.7.0+ |
|
| 128 | - '_structure_type' => $this->sStructureType, // 3.7.0+ |
|
| 129 | - '_section_path' => $this->sSectionPath, // 3.7.0+ |
|
| 127 | + '_fields_type' => $this->sStructureType, // @deprecated 3.7.0+ |
|
| 128 | + '_structure_type' => $this->sStructureType, // 3.7.0+ |
|
| 129 | + '_section_path' => $this->sSectionPath, // 3.7.0+ |
|
| 130 | 130 | '_section_path_array' => $_aSectionPath, |
| 131 | - '_nested_depth' => count( $_aSectionPath ) - 1, // 3.7.0+ - zero base |
|
| 131 | + '_nested_depth' => count( $_aSectionPath ) - 1, // 3.7.0+ - zero base |
|
| 132 | 132 | ) |
| 133 | 133 | + $this->aSectionset |
| 134 | 134 | + array( |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | $aOptions // data source |
| 69 | 69 | ); |
| 70 | 70 | |
| 71 | - foreach( $aOptions as $_sSectionID => $_aSubSectionOrFields ) { |
|
| 71 | + foreach ( $aOptions as $_sSectionID => $_aSubSectionOrFields ) { |
|
| 72 | 72 | |
| 73 | 73 | $_aSubSection = $this->_getSubSectionFromOptions( |
| 74 | 74 | $_sSectionID, |
@@ -105,10 +105,10 @@ discard block |
||
| 105 | 105 | |
| 106 | 106 | $_aSubSection = array(); |
| 107 | 107 | $_iPrevIndex = null; |
| 108 | - foreach( $_aSubSectionOrFields as $_isIndexOrFieldID => $_aSubSectionOrFieldOptions ) { |
|
| 108 | + foreach ( $_aSubSectionOrFields as $_isIndexOrFieldID => $_aSubSectionOrFieldOptions ) { |
|
| 109 | 109 | |
| 110 | 110 | // If it is not a sub-section array, skip. |
| 111 | - if ( ! $this->isNumericInteger( $_isIndexOrFieldID ) ) { |
|
| 111 | + if ( !$this->isNumericInteger( $_isIndexOrFieldID ) ) { |
|
| 112 | 112 | continue; |
| 113 | 113 | } |
| 114 | 114 | |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | ); |
| 123 | 123 | |
| 124 | 124 | // Update the internal section index key |
| 125 | - foreach( $_aSubSection[ $_iIndex ] as &$_aField ) { |
|
| 125 | + foreach ( $_aSubSection[ $_iIndex ] as &$_aField ) { |
|
| 126 | 126 | $_aField[ '_section_index' ] = $_iIndex; |
| 127 | 127 | } |
| 128 | 128 | unset( $_aField ); // to be safe in PHP |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | */ |
| 148 | 148 | private function _getSubSectionItemsFromOptions( array $_aSubSection, $_sSectionID, $_iIndex, $_iPrevIndex ) { |
| 149 | 149 | |
| 150 | - if ( ! isset( $this->aFieldsets[ $_sSectionID ] ) ) { |
|
| 150 | + if ( !isset( $this->aFieldsets[ $_sSectionID ] ) ) { |
|
| 151 | 151 | return array(); |
| 152 | 152 | } |
| 153 | 153 | |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | : $this->getNonIntegerKeyElements( $this->aFieldsets[ $_sSectionID ] ); |
| 157 | 157 | |
| 158 | 158 | // if empty, merge with the previous element. |
| 159 | - return ! empty( $_aFields ) |
|
| 159 | + return !empty( $_aFields ) |
|
| 160 | 160 | ? $_aFields |
| 161 | 161 | : $this->getElementAsArray( |
| 162 | 162 | $_aSubSection, |
@@ -108,7 +108,7 @@ |
||
| 108 | 108 | foreach( $_aSubSectionOrFields as $_isIndexOrFieldID => $_aSubSectionOrFieldOptions ) { |
| 109 | 109 | |
| 110 | 110 | // If it is not a sub-section array, skip. |
| 111 | - if ( ! $this->isNumericInteger( $_isIndexOrFieldID ) ) { |
|
| 111 | + if ( ! $this->isNumericInteger( $_isIndexOrFieldID ) ) { |
|
| 112 | 112 | continue; |
| 113 | 113 | } |
| 114 | 114 | |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | /** |
| 44 | 44 | * Stores the section definition. |
| 45 | 45 | */ |
| 46 | - public $aSection = array(); |
|
| 46 | + public $aSection = array(); |
|
| 47 | 47 | |
| 48 | 48 | /** |
| 49 | 49 | * Indicates the sub section index. |
@@ -91,8 +91,8 @@ discard block |
||
| 91 | 91 | |
| 92 | 92 | $_aSection[ '_is_collapsible' ] = $_aSection[ 'collapsible' ] && 'section' === $_aSection[ 'collapsible' ][ 'container' ]; |
| 93 | 93 | |
| 94 | - $_aSection[ '_tag_id' ] = 'section-' . $_aSection[ 'section_id' ] . '__' . $this->iIndex; |
|
| 95 | - $_aSection[ '_tag_id_model' ] = 'section-' . $_aSection[ 'section_id' ] . '__' . '___i___'; |
|
| 94 | + $_aSection[ '_tag_id' ] = 'section-'.$_aSection[ 'section_id' ].'__'.$this->iIndex; |
|
| 95 | + $_aSection[ '_tag_id_model' ] = 'section-'.$_aSection[ 'section_id' ].'__'.'___i___'; |
|
| 96 | 96 | |
| 97 | 97 | return $_aSection; |
| 98 | 98 | |
@@ -239,7 +239,7 @@ |
||
| 239 | 239 | * @since 3.6.0 Moved from `AdminPageFramework_FieldDefinition`. |
| 240 | 240 | * @since DEVVER Changed the `_field_type` element to `_structure_type`. |
| 241 | 241 | */ |
| 242 | - private function _getStoredInputFieldValue( $aField, $aOptions ) { |
|
| 242 | + private function _getStoredInputFieldValue( $aField, $aOptions ) { |
|
| 243 | 243 | |
| 244 | 244 | // If a section is not set, check the first dimension element. |
| 245 | 245 | if ( ! isset( $aField[ 'section_id' ] ) || '_default' === $aField[ 'section_id' ] ) { |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | public function get() { |
| 57 | 57 | |
| 58 | 58 | // Get the set value(s) |
| 59 | - $_mSavedValue = $this->_getStoredInputFieldValue( |
|
| 59 | + $_mSavedValue = $this->_getStoredInputFieldValue( |
|
| 60 | 60 | $this->aField, |
| 61 | 61 | $this->aOptions |
| 62 | 62 | ); |
@@ -116,9 +116,9 @@ discard block |
||
| 116 | 116 | * @return void |
| 117 | 117 | */ |
| 118 | 118 | private function _divideMainAndSubFields( array $aField, array &$aFirstField, array &$aSubFields ) { |
| 119 | - foreach( $aField as $_nsIndex => $_mFieldElement ) { |
|
| 119 | + foreach ( $aField as $_nsIndex => $_mFieldElement ) { |
|
| 120 | 120 | if ( is_numeric( $_nsIndex ) ) { |
| 121 | - $aSubFields[] = $_mFieldElement; |
|
| 121 | + $aSubFields[ ] = $_mFieldElement; |
|
| 122 | 122 | } else { |
| 123 | 123 | $aFirstField[ $_nsIndex ] = $_mFieldElement; |
| 124 | 124 | } |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | * @return void |
| 137 | 137 | */ |
| 138 | 138 | private function _fillRepeatableElements( array $aField, array &$aSubFields, $mSavedValue ) { |
| 139 | - if ( ! $aField[ 'repeatable' ] ) { |
|
| 139 | + if ( !$aField[ 'repeatable' ] ) { |
|
| 140 | 140 | return; |
| 141 | 141 | } |
| 142 | 142 | $_aSavedValues = ( array ) $mSavedValue; |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | // We are collecting elements from the second sub-field. |
| 145 | 145 | unset( $_aSavedValues[ 0 ] ); |
| 146 | 146 | |
| 147 | - foreach( $_aSavedValues as $_iIndex => $vValue ) { |
|
| 147 | + foreach ( $_aSavedValues as $_iIndex => $vValue ) { |
|
| 148 | 148 | $aSubFields[ $_iIndex - 1 ] = isset( $aSubFields[ $_iIndex - 1 ] ) && is_array( $aSubFields[ $_iIndex - 1 ] ) |
| 149 | 149 | ? $aSubFields[ $_iIndex - 1 ] |
| 150 | 150 | : array(); |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | */ |
| 160 | 160 | private function _fillSubFields( array &$aSubFields, array $aFirstField ) { |
| 161 | 161 | |
| 162 | - foreach( $aSubFields as &$_aSubField ) { |
|
| 162 | + foreach ( $aSubFields as &$_aSubField ) { |
|
| 163 | 163 | |
| 164 | 164 | // Evacuate the label element which should not be merged. |
| 165 | 165 | $_aLabel = $this->getElement( |
@@ -190,15 +190,15 @@ discard block |
||
| 190 | 190 | |
| 191 | 191 | // Determine whether the elements are saved in an array. |
| 192 | 192 | // $_bHasSubFields = count( $aFields ) > 1 || $aField[ 'repeatable' ] || $aField[ 'sortable' ]; |
| 193 | - if ( ! $this->hasSubFields( $aFields, $aField ) ) { |
|
| 193 | + if ( !$this->hasSubFields( $aFields, $aField ) ) { |
|
| 194 | 194 | $aFields[ 0 ][ '_saved_value' ] = $mSavedValue; |
| 195 | 195 | $aFields[ 0 ][ '_is_multiple_fields' ] = false; |
| 196 | 196 | return; |
| 197 | 197 | } |
| 198 | 198 | |
| 199 | - foreach( $aFields as $_iIndex => &$_aThisField ) { |
|
| 199 | + foreach ( $aFields as $_iIndex => &$_aThisField ) { |
|
| 200 | 200 | $_aThisField[ '_saved_value' ] = $this->getElement( $mSavedValue, $_iIndex, null ); |
| 201 | - $_aThisField[ '_subfield_index' ] = $_iIndex; // 3.8.0+ |
|
| 201 | + $_aThisField[ '_subfield_index' ] = $_iIndex; // 3.8.0+ |
|
| 202 | 202 | $_aThisField[ '_is_multiple_fields' ] = true; |
| 203 | 203 | } |
| 204 | 204 | |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | * @since 3.6.0 Moved from `AdminPageFramework_FieldDefinition`. |
| 213 | 213 | */ |
| 214 | 214 | private function _setFieldsValue( array &$aFields ) { |
| 215 | - foreach( $aFields as &$_aField ) { |
|
| 215 | + foreach ( $aFields as &$_aField ) { |
|
| 216 | 216 | $_aField[ '_is_value_set_by_user' ] = isset( $_aField[ 'value' ] ); |
| 217 | 217 | $_aField[ 'value' ] = $this->_getSetFieldValue( $_aField ); |
| 218 | 218 | } |
@@ -257,10 +257,10 @@ discard block |
||
| 257 | 257 | */ |
| 258 | 258 | private function _getStoredInputFieldValue( $aField, $aOptions ) { |
| 259 | 259 | |
| 260 | - $_aFieldPath = $aField[ '_field_path_array' ]; |
|
| 260 | + $_aFieldPath = $aField[ '_field_path_array' ]; |
|
| 261 | 261 | |
| 262 | 262 | // If a section is not set, check the first dimension element. |
| 263 | - if ( ! isset( $aField[ 'section_id' ] ) || '_default' === $aField[ 'section_id' ] ) { |
|
| 263 | + if ( !isset( $aField[ 'section_id' ] ) || '_default' === $aField[ 'section_id' ] ) { |
|
| 264 | 264 | return $this->getElement( |
| 265 | 265 | $aOptions, |
| 266 | 266 | $_aFieldPath, // $aField[ 'field_id' ], // @todo this may have to be a field path instead of field id. |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | class AdminPageFramework_Form_Model___FormatSectionsets extends AdminPageFramework_Form_Base { |
| 18 | 18 | |
| 19 | 19 | public $sStructureType = ''; |
| 20 | - public $aSectionsets = array(); |
|
| 20 | + public $aSectionsets = array(); |
|
| 21 | 21 | public $sCapability = ''; |
| 22 | 22 | public $aCallbacks = array( |
| 23 | 23 | 'sectionset_before_output' => null |
@@ -62,9 +62,9 @@ discard block |
||
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | $_aSectionsets = $this->_getSectionsetsFormatted( |
| 65 | - array(), // sectionsets array to modify - new formatted items will be stored here |
|
| 66 | - $this->aSectionsets, // parsing sectionsets |
|
| 67 | - array(), // section path - empty for root |
|
| 65 | + array(), // sectionsets array to modify - new formatted items will be stored here |
|
| 66 | + $this->aSectionsets, // parsing sectionsets |
|
| 67 | + array(), // section path - empty for root |
|
| 68 | 68 | $this->sCapability // capability |
| 69 | 69 | ); |
| 70 | 70 | |
@@ -81,10 +81,10 @@ discard block |
||
| 81 | 81 | */ |
| 82 | 82 | private function _getSectionsetsFormatted( $_aNewSectionsets, $aSectionsetsToParse, $aSectionPath, $sCapability ) { |
| 83 | 83 | |
| 84 | - foreach( $aSectionsetsToParse as $_sSectionPath => $_aSectionset ) { |
|
| 84 | + foreach ( $aSectionsetsToParse as $_sSectionPath => $_aSectionset ) { |
|
| 85 | 85 | |
| 86 | 86 | // The '_default' section can be empty so do not check `if ( empty( $_aSectionset ) )` here. |
| 87 | - if ( ! is_array( $_aSectionset ) ) { |
|
| 87 | + if ( !is_array( $_aSectionset ) ) { |
|
| 88 | 88 | continue; |
| 89 | 89 | } |
| 90 | 90 | |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | |
| 112 | 112 | // DEVVER+ For nested sections |
| 113 | 113 | $_aNewSectionsets = $this->_getNestedSections( |
| 114 | - $_aNewSectionsets, // sectionset array to modify |
|
| 114 | + $_aNewSectionsets, // sectionset array to modify |
|
| 115 | 115 | $_aSectionset, |
| 116 | 116 | $_aSectionPath, // section path |
| 117 | 117 | $_aSectionset[ 'capability' ] |
@@ -128,15 +128,15 @@ discard block |
||
| 128 | 128 | */ |
| 129 | 129 | private function _getNestedSections( $aSectionsetsToEdit, $aSectionset, $aSectionPath, $sCapability ) { |
| 130 | 130 | |
| 131 | - if ( ! $this->_hasNestedSections( $aSectionset ) ) { |
|
| 131 | + if ( !$this->_hasNestedSections( $aSectionset ) ) { |
|
| 132 | 132 | return $aSectionsetsToEdit; |
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | // Reccursive call |
| 136 | 136 | return $this->_getSectionsetsFormatted( |
| 137 | - $aSectionsetsToEdit, // sectionsets array to modify - new formatted items will be stored here |
|
| 138 | - $aSectionset[ 'content' ], // parsing sectionsets |
|
| 139 | - $aSectionPath, // section path - empty for root |
|
| 137 | + $aSectionsetsToEdit, // sectionsets array to modify - new formatted items will be stored here |
|
| 138 | + $aSectionset[ 'content' ], // parsing sectionsets |
|
| 139 | + $aSectionPath, // section path - empty for root |
|
| 140 | 140 | $sCapability // capability |
| 141 | 141 | ); |
| 142 | 142 | |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | private function _hasNestedSections( $aSectionset ) { |
| 150 | 150 | |
| 151 | 151 | $aSectionset = $aSectionset + array( 'content' => null ); |
| 152 | - if ( ! is_array( $aSectionset[ 'content' ] ) ) { |
|
| 152 | + if ( !is_array( $aSectionset[ 'content' ] ) ) { |
|
| 153 | 153 | return false; |
| 154 | 154 | } |
| 155 | 155 | $_aContents = $aSectionset[ 'content' ]; |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | foreach( $aSectionsetsToParse as $_sSectionPath => $_aSectionset ) { |
| 85 | 85 | |
| 86 | 86 | // The '_default' section can be empty so do not check `if ( empty( $_aSectionset ) )` here. |
| 87 | - if ( ! is_array( $_aSectionset ) ) { |
|
| 87 | + if ( ! is_array( $_aSectionset ) ) { |
|
| 88 | 88 | continue; |
| 89 | 89 | } |
| 90 | 90 | |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | $this->aCallbacks[ 'sectionset_before_output' ], |
| 104 | 104 | array( $_aSectionsetFormatter->get() ) |
| 105 | 105 | ); |
| 106 | - if ( empty( $_aSectionset ) ) { |
|
| 106 | + if ( empty( $_aSectionset ) ) { |
|
| 107 | 107 | continue; |
| 108 | 108 | } |
| 109 | 109 | |
@@ -121,14 +121,14 @@ |
||
| 121 | 121 | foreach( $this->aFieldsets as $_sSecitonID => $_aFieldsets ) { |
| 122 | 122 | |
| 123 | 123 | $_bIsSubSectionLoaded = false; |
| 124 | - foreach( $_aFieldsets as $_iSubSectionIndexOrFieldID => $_aSubSectionOrField ) { |
|
| 124 | + foreach( $_aFieldsets as $_iSubSectionIndexOrFieldID => $_aSubSectionOrField ) { |
|
| 125 | 125 | // @todo Examine if this structure is correct or not. |
| 126 | 126 | // It may not be necessary to check the sub-section dimensions as this is not the saved options array. |
| 127 | 127 | // if it's a sub-section |
| 128 | 128 | if ( $this->isNumericInteger( $_iSubSectionIndexOrFieldID ) ) { |
| 129 | 129 | |
| 130 | 130 | // no need to repeat the same set of fields |
| 131 | - if ( $_bIsSubSectionLoaded ) { |
|
| 131 | + if ( $_bIsSubSectionLoaded ) { |
|
| 132 | 132 | continue; |
| 133 | 133 | } |
| 134 | 134 | $_bIsSubSectionLoaded = true; |
@@ -92,16 +92,16 @@ discard block |
||
| 92 | 92 | 'AdminPageFramework_Form_View___CSS_FieldError', |
| 93 | 93 | 'AdminPageFramework_Form_View___CSS_ToolTip', |
| 94 | 94 | ); |
| 95 | - foreach( $_aClassNames as $_sClassName ) { |
|
| 95 | + foreach ( $_aClassNames as $_sClassName ) { |
|
| 96 | 96 | $_oCSS = new $_sClassName; |
| 97 | - $this->aResources[ 'internal_styles' ][] = $_oCSS->get(); |
|
| 97 | + $this->aResources[ 'internal_styles' ][ ] = $_oCSS->get(); |
|
| 98 | 98 | } |
| 99 | 99 | $_aClassNamesForIE = array( |
| 100 | 100 | 'AdminPageFramework_Form_View___CSS_CollapsibleSectionIE', |
| 101 | 101 | ); |
| 102 | - foreach( $_aClassNames as $_sClassName ) { |
|
| 102 | + foreach ( $_aClassNames as $_sClassName ) { |
|
| 103 | 103 | $_oCSS = new $_sClassName; |
| 104 | - $this->aResources[ 'internal_styles_ie' ][] = $_oCSS->get(); |
|
| 104 | + $this->aResources[ 'internal_styles_ie' ][ ] = $_oCSS->get(); |
|
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | } |
@@ -120,10 +120,10 @@ discard block |
||
| 120 | 120 | protected function _set( ) { |
| 121 | 121 | |
| 122 | 122 | // Parse all added fieldsets and check associated resources. |
| 123 | - foreach( $this->aFieldsets as $_sSecitonID => $_aFieldsets ) { |
|
| 123 | + foreach ( $this->aFieldsets as $_sSecitonID => $_aFieldsets ) { |
|
| 124 | 124 | |
| 125 | 125 | $_bIsSubSectionLoaded = false; |
| 126 | - foreach( $_aFieldsets as $_iSubSectionIndexOrFieldID => $_aSubSectionOrField ) { |
|
| 126 | + foreach ( $_aFieldsets as $_iSubSectionIndexOrFieldID => $_aSubSectionOrField ) { |
|
| 127 | 127 | // @todo Examine if this structure is correct or not. |
| 128 | 128 | // It may not be necessary to check the sub-section dimensions as this is not the saved options array. |
| 129 | 129 | // if it's a sub-section |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | continue; |
| 135 | 135 | } |
| 136 | 136 | $_bIsSubSectionLoaded = true; |
| 137 | - foreach( $_aSubSectionOrField as $_aField ) { |
|
| 137 | + foreach ( $_aSubSectionOrField as $_aField ) { |
|
| 138 | 138 | $this->_setFieldResources( $_aField ); |
| 139 | 139 | } |
| 140 | 140 | continue; |
@@ -159,13 +159,13 @@ discard block |
||
| 159 | 159 | private function _setFieldResources( array $aFieldset ) { |
| 160 | 160 | |
| 161 | 161 | // Check the field conditions here. |
| 162 | - if ( ! $this->_isFieldsetAllowed( $aFieldset ) ) { |
|
| 162 | + if ( !$this->_isFieldsetAllowed( $aFieldset ) ) { |
|
| 163 | 163 | return; |
| 164 | 164 | } |
| 165 | 165 | |
| 166 | 166 | // 3.8.0+ Support nested fields. |
| 167 | 167 | if ( $this->hasFieldDefinitionsInContent( $aFieldset ) ) { |
| 168 | - foreach( $aFieldset[ 'content' ] as $_asNestedFieldset ) { |
|
| 168 | + foreach ( $aFieldset[ 'content' ] as $_asNestedFieldset ) { |
|
| 169 | 169 | if ( is_scalar( $_asNestedFieldset ) ) { |
| 170 | 170 | continue; |
| 171 | 171 | } |
@@ -202,7 +202,7 @@ discard block |
||
| 202 | 202 | $this->callBack( |
| 203 | 203 | $this->aCallbacks[ 'load_fieldset_resource' ], |
| 204 | 204 | array( |
| 205 | - $aFieldset, // 1st parameter |
|
| 205 | + $aFieldset, // 1st parameter |
|
| 206 | 206 | ) |
| 207 | 207 | ); |
| 208 | 208 | |
@@ -235,10 +235,10 @@ discard block |
||
| 235 | 235 | * @return boolean |
| 236 | 236 | */ |
| 237 | 237 | private function _isAlreadyRegistered( $sFieldtype, $sStructureType ) { |
| 238 | - if ( isset( self::$_aRegisteredFieldTypes[ $sFieldtype . '_' .$sStructureType ] ) ) { |
|
| 238 | + if ( isset( self::$_aRegisteredFieldTypes[ $sFieldtype.'_'.$sStructureType ] ) ) { |
|
| 239 | 239 | return true; |
| 240 | 240 | } |
| 241 | - self::$_aRegisteredFieldTypes[ $sFieldtype . '_' .$sStructureType ] = true; |
|
| 241 | + self::$_aRegisteredFieldTypes[ $sFieldtype.'_'.$sStructureType ] = true; |
|
| 242 | 242 | return false; |
| 243 | 243 | } |
| 244 | 244 | /** |
@@ -257,7 +257,7 @@ discard block |
||
| 257 | 257 | return $this->callBack( |
| 258 | 258 | $this->aCallbacks[ 'is_fieldset_registration_allowed' ], |
| 259 | 259 | array( |
| 260 | - true, // 1st parameter |
|
| 260 | + true, // 1st parameter |
|
| 261 | 261 | $aFieldset, // 2nd parameter |
| 262 | 262 | ) |
| 263 | 263 | ); |
@@ -33,7 +33,7 @@ |
||
| 33 | 33 | array( $this, '_replyToAddPostTypeQueryInEditPostLink' ), |
| 34 | 34 | 10, |
| 35 | 35 | 3 |
| 36 | - ); |
|
| 36 | + ); |
|
| 37 | 37 | } |
| 38 | 38 | } |
| 39 | 39 | |
@@ -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 ) |