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