@@ -112,7 +112,7 @@ |
||
112 | 112 | */ |
113 | 113 | public function removeSection( $sSectionID ) { |
114 | 114 | |
115 | - if ( '_default' === $sSectionID ){ |
|
115 | + if ( '_default' === $sSectionID ) { |
|
116 | 116 | return; |
117 | 117 | } |
118 | 118 | unset( |
@@ -148,6 +148,8 @@ |
||
148 | 148 | } |
149 | 149 | /** |
150 | 150 | * @since 3.7.0 |
151 | + * @param string $sKey |
|
152 | + * @param string $sValue |
|
151 | 153 | * @return void |
152 | 154 | */ |
153 | 155 | public function addResource( $sKey, $sValue ) { |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | * @param string $sType If empty, the method will check if a message exists in all types. Otherwise, it checks the existence of a message of the specified type. |
45 | 45 | * @return boolean True if a setting notice is set; otherwise, false. |
46 | 46 | */ |
47 | - public function hasSubmitNotice( $sType='' ) { |
|
47 | + public function hasSubmitNotice( $sType = '' ) { |
|
48 | 48 | return $this->oSubmitNotice->hasNotice( $sType ); |
49 | 49 | } |
50 | 50 | |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | * @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. |
71 | 71 | * @return void |
72 | 72 | */ |
73 | - public function setSubmitNotice( $sMessage, $sType='error', $asAttributes=array(), $bOverride=true ) { |
|
73 | + public function setSubmitNotice( $sMessage, $sType = 'error', $asAttributes = array(), $bOverride = true ) { |
|
74 | 74 | $this->oSubmitNotice->set( |
75 | 75 | $sMessage, |
76 | 76 | $sType, |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | |
98 | 98 | $this->aSectionsets[ $aSectionset[ 'section_id' ] ] = $aSectionset; |
99 | 99 | $this->aFieldsets[ $aSectionset[ 'section_id' ] ] = $this->getElement( |
100 | - $this->aFieldsets, // subject array |
|
100 | + $this->aFieldsets, // subject array |
|
101 | 101 | $aSectionset[ 'section_id' ], // key |
102 | 102 | array() // default |
103 | 103 | ); |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | */ |
113 | 113 | public function removeSection( $sSectionID ) { |
114 | 114 | |
115 | - if ( '_default' === $sSectionID ){ |
|
115 | + if ( '_default' === $sSectionID ) { |
|
116 | 116 | return; |
117 | 117 | } |
118 | 118 | unset( |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | * @return void |
152 | 152 | */ |
153 | 153 | public function addResource( $sKey, $sValue ) { |
154 | - self::$_aResources[ $sKey ][] = $sValue; |
|
154 | + self::$_aResources[ $sKey ][ ] = $sValue; |
|
155 | 155 | } |
156 | 156 | |
157 | 157 | /** |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | public function addField( $asFieldset ) { |
175 | 175 | |
176 | 176 | // If it is a target section, update the property and return. |
177 | - if ( ! $this->_isFieldsetDefinition( $asFieldset ) ) { |
|
177 | + if ( !$this->_isFieldsetDefinition( $asFieldset ) ) { |
|
178 | 178 | $this->_asTargetSectionID = $this->_getTargetSectionID( $asFieldset ); |
179 | 179 | return $this->_asTargetSectionID; |
180 | 180 | } |
@@ -183,13 +183,13 @@ discard block |
||
183 | 183 | |
184 | 184 | // Set the target section ID |
185 | 185 | $this->_asTargetSectionID = $this->getElement( |
186 | - $_aFieldset, // subject array |
|
186 | + $_aFieldset, // subject array |
|
187 | 187 | 'section_id', // key |
188 | 188 | $this->_asTargetSectionID // default |
189 | 189 | ); |
190 | 190 | |
191 | 191 | // Required Keys - 3.8.0+ Now 'type' can be omitted. |
192 | - if ( ! isset( $_aFieldset[ 'field_id' ] ) ) { |
|
192 | + if ( !isset( $_aFieldset[ 'field_id' ] ) ) { |
|
193 | 193 | return null; |
194 | 194 | } |
195 | 195 | |
@@ -292,7 +292,7 @@ discard block |
||
292 | 292 | */ |
293 | 293 | public function removeField( $sFieldID ) { |
294 | 294 | |
295 | - foreach( $this->aFieldsets as $_sSectionID => $_aSubSectionsOrFields ) { |
|
295 | + foreach ( $this->aFieldsets as $_sSectionID => $_aSubSectionsOrFields ) { |
|
296 | 296 | |
297 | 297 | if ( array_key_exists( $sFieldID, $_aSubSectionsOrFields ) ) { |
298 | 298 | unset( $this->aFieldsets[ $_sSectionID ][ $sFieldID ] ); |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | $aOptions // data source |
71 | 71 | ); |
72 | 72 | |
73 | - foreach( $aOptions as $_sSectionID => $_aSubSectionOrFields ) { |
|
73 | + foreach ( $aOptions as $_sSectionID => $_aSubSectionOrFields ) { |
|
74 | 74 | |
75 | 75 | $_aSubSection = $this->_getSubSectionFromOptions( |
76 | 76 | $_sSectionID, |
@@ -107,10 +107,10 @@ discard block |
||
107 | 107 | |
108 | 108 | $_aSubSection = array(); |
109 | 109 | $_iPrevIndex = null; |
110 | - foreach( $_aSubSectionOrFields as $_isIndexOrFieldID => $_aSubSectionOrFieldOptions ) { |
|
110 | + foreach ( $_aSubSectionOrFields as $_isIndexOrFieldID => $_aSubSectionOrFieldOptions ) { |
|
111 | 111 | |
112 | 112 | // If it is not a sub-section array, skip. |
113 | - if ( ! $this->isNumericInteger( $_isIndexOrFieldID ) ) { |
|
113 | + if ( !$this->isNumericInteger( $_isIndexOrFieldID ) ) { |
|
114 | 114 | continue; |
115 | 115 | } |
116 | 116 | |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | ); |
125 | 125 | |
126 | 126 | // Update the internal section index key |
127 | - foreach( $_aSubSection[ $_iIndex ] as &$_aField ) { |
|
127 | + foreach ( $_aSubSection[ $_iIndex ] as &$_aField ) { |
|
128 | 128 | $_aField[ '_section_index' ] = $_iIndex; |
129 | 129 | } |
130 | 130 | unset( $_aField ); // to be safe in PHP |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | */ |
151 | 151 | private function _getSubSectionItemsFromOptions( array $_aSubSection, $_sSectionID, $_iIndex, $_iPrevIndex ) { |
152 | 152 | |
153 | - if ( ! isset( $this->aFieldsets[ $_sSectionID ] ) ) { |
|
153 | + if ( !isset( $this->aFieldsets[ $_sSectionID ] ) ) { |
|
154 | 154 | return array(); |
155 | 155 | } |
156 | 156 | |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | : $this->getNonIntegerKeyElements( $this->aFieldsets[ $_sSectionID ] ); |
160 | 160 | |
161 | 161 | // if empty, merge with the previous element. |
162 | - return ! empty( $_aFields ) |
|
162 | + return !empty( $_aFields ) |
|
163 | 163 | ? $_aFields |
164 | 164 | : $this->getElementAsArray( |
165 | 165 | $_aSubSection, |
@@ -32,7 +32,7 @@ |
||
32 | 32 | $this->aAttributes + $this->_getAttributes() |
33 | 33 | ); |
34 | 34 | |
35 | - $_aAttributes[ 'class' ] = $this->getClassAttribute( |
|
35 | + $_aAttributes[ 'class' ] = $this->getClassAttribute( |
|
36 | 36 | $this->getElement( $_aAttributes, 'class', array() ), |
37 | 37 | $this->getElement( $this->aArguments, array( 'class', $this->sContext ), array() ) |
38 | 38 | ); |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | |
44 | 44 | $_aParams = func_get_args() + array( null ); |
45 | 45 | $_oMsg = $_aParams[ 0 ]; |
46 | - $_sToggleAllButtonHTML = '"' . self::_getToggleAllButtonHTML( $_oMsg ) . '"'; |
|
46 | + $_sToggleAllButtonHTML = '"'.self::_getToggleAllButtonHTML( $_oMsg ).'"'; |
|
47 | 47 | |
48 | 48 | return <<<JAVASCRIPTS |
49 | 49 | ( function( $ ) { |
@@ -212,19 +212,19 @@ discard block |
||
212 | 212 | $_sLabelToggleAll = $oMsg->get( 'toggle_all' ); |
213 | 213 | $_sLabelToggleAllSections = $oMsg->get( 'toggle_all_collapsible_sections' ); |
214 | 214 | $_sDashIconSort = self::getAOrB( |
215 | - version_compare( $GLOBALS['wp_version'], '3.8', '<' ), // evaluate |
|
215 | + version_compare( $GLOBALS[ 'wp_version' ], '3.8', '<' ), // evaluate |
|
216 | 216 | '', // true |
217 | 217 | 'dashicons dashicons-sort' // false |
218 | 218 | ); |
219 | - $_sText = self::getAOrB( |
|
219 | + $_sText = self::getAOrB( |
|
220 | 220 | $_sDashIconSort, // evaluate |
221 | 221 | '', // true |
222 | 222 | $_sLabelToggleAll // false |
223 | 223 | ); |
224 | 224 | |
225 | 225 | return "<div class='admin-page-framework-collapsible-toggle-all-button-container'>" |
226 | - . "<span class='admin-page-framework-collapsible-toggle-all-button button " . $_sDashIconSort . "'" |
|
227 | - . " title='" . esc_attr( $_sLabelToggleAllSections ) |
|
226 | + . "<span class='admin-page-framework-collapsible-toggle-all-button button ".$_sDashIconSort."'" |
|
227 | + . " title='".esc_attr( $_sLabelToggleAllSections ) |
|
228 | 228 | . "'>" |
229 | 229 | . $_sText |
230 | 230 | . "</span>" |
@@ -18,17 +18,17 @@ discard block |
||
18 | 18 | */ |
19 | 19 | class AdminPageFramework_Form_View___CollapsibleSectionTitle extends AdminPageFramework_Form_View___SectionTitle { |
20 | 20 | |
21 | - public $aArguments = array( |
|
21 | + public $aArguments = array( |
|
22 | 22 | 'title' => null, |
23 | 23 | 'tag' => null, |
24 | 24 | 'section_index' => null, |
25 | 25 | 'collapsible' => array(), |
26 | 26 | 'container_type' => 'section', // section or sections |
27 | 27 | |
28 | - 'sectionset' => array(), // 3.7.0+ sectionset definition array |
|
28 | + 'sectionset' => array(), // 3.7.0+ sectionset definition array |
|
29 | 29 | |
30 | 30 | ); |
31 | - public $aFieldsets = array(); |
|
31 | + public $aFieldsets = array(); |
|
32 | 32 | public $aSavedData = array(); |
33 | 33 | public $aFieldErrors = array(); |
34 | 34 | public $aFieldTypeDefinitions = array(); |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | * @param array|boolean $aCollapsible The collapsible argument. |
64 | 64 | * @param string $sContainer The position context. Accepts either 'sections' or 'section'. If the set position in the argument array does not match this value, the method will return an empty string. |
65 | 65 | */ |
66 | - private function _getCollapsibleSectionTitleBlock( array $aCollapsible, $sContainer='sections', $iSectionIndex=null ) { |
|
66 | + private function _getCollapsibleSectionTitleBlock( array $aCollapsible, $sContainer = 'sections', $iSectionIndex = null ) { |
|
67 | 67 | |
68 | 68 | if ( $sContainer !== $aCollapsible[ 'container' ] ) { |
69 | 69 | return ''; |
@@ -79,10 +79,10 @@ discard block |
||
79 | 79 | ); |
80 | 80 | |
81 | 81 | $_aSectionset = $this->aArguments[ 'sectionset' ]; |
82 | - $_sSectionTitleTagID = str_replace( '|', '_', $_aSectionset[ '_section_path' ] ) . '_' . $iSectionIndex; |
|
82 | + $_sSectionTitleTagID = str_replace( '|', '_', $_aSectionset[ '_section_path' ] ).'_'.$iSectionIndex; |
|
83 | 83 | |
84 | 84 | return $this->_getCollapsibleSectionsEnablerScript() |
85 | - . "<div " . $this->getAttributes( |
|
85 | + . "<div ".$this->getAttributes( |
|
86 | 86 | array( |
87 | 87 | 'id' => $_sSectionTitleTagID, |
88 | 88 | 'class' => $this->getClassAttribute( |
@@ -103,11 +103,11 @@ discard block |
||
103 | 103 | 'collapsed', |
104 | 104 | '' |
105 | 105 | ), |
106 | - 'admin-page-framework-collapsible-type-' . $aCollapsible[ 'type' ] |
|
106 | + 'admin-page-framework-collapsible-type-'.$aCollapsible[ 'type' ] |
|
107 | 107 | ), |
108 | 108 | ) |
109 | 109 | + $this->getDataAttributeArray( $aCollapsible ) |
110 | - ) . ">" |
|
110 | + ).">" |
|
111 | 111 | . $_sSectionTitle |
112 | 112 | . "</div>"; |
113 | 113 |
@@ -56,13 +56,13 @@ |
||
56 | 56 | public function getFieldsetOutput( $aFieldset ) { |
57 | 57 | |
58 | 58 | // Check if the field is visible |
59 | - if ( ! $this->isFieldsetVisible( $aFieldset ) ) { |
|
59 | + if ( !$this->isFieldsetVisible( $aFieldset ) ) { |
|
60 | 60 | return ''; |
61 | 61 | } |
62 | 62 | |
63 | 63 | $_oFieldset = new AdminPageFramework_Form_View___Fieldset( |
64 | 64 | $aFieldset, |
65 | - $this->aSavedData, // passed by reference. @todo: examine why it needs to be passed by reference. |
|
65 | + $this->aSavedData, // passed by reference. @todo: examine why it needs to be passed by reference. |
|
66 | 66 | $this->aFieldErrors, |
67 | 67 | $this->aFieldTypeDefinitions, |
68 | 68 | $this->oMsg, |
@@ -556,7 +556,7 @@ |
||
556 | 556 | * @return string The generated section tab list as HTML. |
557 | 557 | */ |
558 | 558 | private function _getSectionTabList( $sSectionTabSlug, array $aSectionTabList ) { |
559 | - return $sSectionTabSlug |
|
559 | + return $sSectionTabSlug |
|
560 | 560 | ? "<ul class='admin-page-framework-section-tabs nav-tab-wrapper'>" |
561 | 561 | . implode( PHP_EOL, $aSectionTabList ) |
562 | 562 | . "</ul>" |
@@ -164,6 +164,7 @@ discard block |
||
164 | 164 | } |
165 | 165 | /** |
166 | 166 | * @since 3.7.0 |
167 | + * @param string $_sOutput |
|
167 | 168 | * @return string |
168 | 169 | */ |
169 | 170 | private function _getSpinnerOutput( $_sOutput ) { |
@@ -298,7 +299,7 @@ discard block |
||
298 | 299 | * @param array $_aOutputs Holds output elements - contents, section tab list, count of subsections. |
299 | 300 | * @param string $_sSectionsID The container id of sections. |
300 | 301 | * @param array $_aSection |
301 | - * @param array $_aFieldsInSections A field-sets array already divided by section tab. |
|
302 | + * @param array $aFieldsInSections A field-sets array already divided by section tab. |
|
302 | 303 | * @return array The updated sections table output array. |
303 | 304 | */ |
304 | 305 | private function _getSectionsetTable( $_aOutputs, $_sSectionsID, array $_aSection, array $aFieldsInSections ) { |
@@ -353,6 +354,7 @@ discard block |
||
353 | 354 | * Returns the output of sub-sections for repeatable and sortable sections. |
354 | 355 | * |
355 | 356 | * @since 3.7.0 |
357 | + * @param string $_sSectionsID |
|
356 | 358 | * @return array |
357 | 359 | */ |
358 | 360 | private function _getSubSections( $_aOutputs, $_sSectionsID, $_aSection, $_aSubSections ) { |
@@ -499,6 +501,7 @@ discard block |
||
499 | 501 | * @since 3.5.3 |
500 | 502 | * @since 3.6.0 Removed the `$sSectionID` parameter. Added the `$aSectionset` parameter. |
501 | 503 | * @since 3.7.0 Moved from `AdminPageFramework_FormPart_Table`. |
504 | + * @param string $sSectionsID |
|
502 | 505 | * @return string The formatted sections table HTML output. |
503 | 506 | */ |
504 | 507 | private function _getFormattedSectionsTablesOutput( array $aOutputs, $aSectionset, $sSectionsID, array $aCollapsible, $sSectionTabSlug ) { |
@@ -126,16 +126,16 @@ discard block |
||
126 | 126 | */ |
127 | 127 | public function get() { |
128 | 128 | |
129 | - $_oFormatSectionsetsByTab = new AdminPageFramework_Form_View___Format_SectionsetsByTab( |
|
129 | + $_oFormatSectionsetsByTab = new AdminPageFramework_Form_View___Format_SectionsetsByTab( |
|
130 | 130 | $this->aStructure[ 'sectionsets' ], |
131 | 131 | $this->aStructure[ 'fieldsets' ], |
132 | 132 | $this->aArguments[ 'nested_depth' ] |
133 | 133 | ); |
134 | 134 | |
135 | - $_aOutput = array(); |
|
136 | - foreach( $_oFormatSectionsetsByTab->getTabs() as $_sSectionTabSlug ) { |
|
135 | + $_aOutput = array(); |
|
136 | + foreach ( $_oFormatSectionsetsByTab->getTabs() as $_sSectionTabSlug ) { |
|
137 | 137 | |
138 | - $_aOutput[] = $this->_getFormOutput( |
|
138 | + $_aOutput[ ] = $this->_getFormOutput( |
|
139 | 139 | $_oFormatSectionsetsByTab->getSectionsets( $_sSectionTabSlug ), |
140 | 140 | $_oFormatSectionsetsByTab->getFieldsets( $_sSectionTabSlug ), |
141 | 141 | $_sSectionTabSlug, |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | |
153 | 153 | // Generate id for this output |
154 | 154 | $_sOutput = implode( PHP_EOL, $_aOutput ); |
155 | - $_sElementID = "admin-page-framework-sectionsets-" . uniqid(); |
|
155 | + $_sElementID = "admin-page-framework-sectionsets-".uniqid(); |
|
156 | 156 | return $this->_getSpinnerOutput( $_sOutput ) |
157 | 157 | . "<div id='{$_sElementID}' class='admin-page-framework-sctionsets admin-page-framework-form-js-on'>" |
158 | 158 | . $_sOutput |
@@ -187,17 +187,17 @@ discard block |
||
187 | 187 | |
188 | 188 | // A sectionset is a set of sections. |
189 | 189 | $_sSectionSet = $this->_getSectionsetsTables( |
190 | - $aSectionsets, // section-set definition (already divided by section tab) |
|
191 | - $aFieldsets, // field-set definitions (already divided by section tab) |
|
190 | + $aSectionsets, // section-set definition (already divided by section tab) |
|
191 | + $aFieldsets, // field-set definitions (already divided by section tab) |
|
192 | 192 | $aCallbacks |
193 | 193 | ); |
194 | 194 | return $_sSectionSet |
195 | - ? "<div " . $this->getAttributes( |
|
195 | + ? "<div ".$this->getAttributes( |
|
196 | 196 | array( |
197 | 197 | 'class' => 'admin-page-framework-sectionset', |
198 | - 'id' => "sectionset-{$sSectionTabSlug}_" . md5( serialize( $aSectionsets ) ), |
|
198 | + 'id' => "sectionset-{$sSectionTabSlug}_".md5( serialize( $aSectionsets ) ), |
|
199 | 199 | ) |
200 | - ) . ">" |
|
200 | + ).">" |
|
201 | 201 | . $_sSectionSet |
202 | 202 | . "</div>" |
203 | 203 | : ''; |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | * If there is no field overall to the section and its section tab, return an empty string. |
230 | 230 | * Otherwise, the section-sets container gets rendered and its CSS rules such as margins give unwanted results. |
231 | 231 | */ |
232 | - if ( ! count( $aFieldsets ) ) { |
|
232 | + if ( !count( $aFieldsets ) ) { |
|
233 | 233 | return ''; |
234 | 234 | } |
235 | 235 | |
@@ -241,13 +241,13 @@ discard block |
||
241 | 241 | ); |
242 | 242 | $_sSectionTabSlug = $_aFirstSectionset[ 'section_tab_slug' ]; |
243 | 243 | $_sThisSectionID = $_aFirstSectionset[ 'section_id' ]; |
244 | - $_sSectionsID = 'sections-' . $_sThisSectionID; |
|
244 | + $_sSectionsID = 'sections-'.$_sThisSectionID; |
|
245 | 245 | $_aCollapsible = $this->_getCollapsibleArgumentForSections( |
246 | 246 | $_aFirstSectionset |
247 | 247 | ); |
248 | 248 | |
249 | - foreach( $aSectionsets as $_aSectionset ) { |
|
250 | - $_aOutputs = $this->_getSectionsetTable( |
|
249 | + foreach ( $aSectionsets as $_aSectionset ) { |
|
250 | + $_aOutputs = $this->_getSectionsetTable( |
|
251 | 251 | $_aOutputs, |
252 | 252 | $_sSectionsID, |
253 | 253 | $_aSectionset, |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | * Changed the visibility scope to private. Changed the 1st parameter from `$aSection`. |
276 | 276 | * @return array |
277 | 277 | */ |
278 | - private function _getCollapsibleArgumentForSections( array $aSectionset=array() ) { |
|
278 | + private function _getCollapsibleArgumentForSections( array $aSectionset = array() ) { |
|
279 | 279 | |
280 | 280 | $_oArgumentFormater = new AdminPageFramework_Form_Model___Format_CollapsibleSection( |
281 | 281 | $aSectionset[ 'collapsible' ], |
@@ -303,19 +303,19 @@ discard block |
||
303 | 303 | */ |
304 | 304 | private function _getSectionsetTable( $_aOutputs, $_sSectionsID, array $_aSection, array $aFieldsInSections ) { |
305 | 305 | |
306 | - if ( ! $this->isSectionsetVisible( $_aSection ) ) { |
|
306 | + if ( !$this->isSectionsetVisible( $_aSection ) ) { |
|
307 | 307 | return $_aOutputs; |
308 | 308 | } |
309 | 309 | |
310 | 310 | // If the 'save' argument is false, insert a flag that disables saving the section inputs. |
311 | - $_aOutputs[ 'section_contents' ][] = $this->_getUnsetFlagSectionInputTag( $_aSection ); |
|
311 | + $_aOutputs[ 'section_contents' ][ ] = $this->_getUnsetFlagSectionInputTag( $_aSection ); |
|
312 | 312 | |
313 | 313 | // For repeatable sections - sub-sections are divided field definition arrays by sub-section index, |
314 | 314 | // not section definition arrays. |
315 | - $_aSubSections = $this->getIntegerKeyElements( |
|
315 | + $_aSubSections = $this->getIntegerKeyElements( |
|
316 | 316 | $this->getElementAsArray( |
317 | 317 | $aFieldsInSections, // subject array |
318 | - $_aSection[ '_section_path' ], // dimensional path |
|
318 | + $_aSection[ '_section_path' ], // dimensional path |
|
319 | 319 | array() // default |
320 | 320 | ) |
321 | 321 | ); |
@@ -358,28 +358,28 @@ discard block |
||
358 | 358 | private function _getSubSections( $_aOutputs, $_sSectionsID, $_aSection, $_aSubSections ) { |
359 | 359 | |
360 | 360 | // Add the repeatable sections enabler script. |
361 | - if ( ! empty( $_aSection[ 'repeatable' ] ) ) { |
|
362 | - $_aOutputs[ 'section_contents' ][] = AdminPageFramework_Form_View___Script_RepeatableSection::getEnabler( |
|
361 | + if ( !empty( $_aSection[ 'repeatable' ] ) ) { |
|
362 | + $_aOutputs[ 'section_contents' ][ ] = AdminPageFramework_Form_View___Script_RepeatableSection::getEnabler( |
|
363 | 363 | $_sSectionsID, |
364 | 364 | $_aOutputs[ 'count_subsections' ], |
365 | 365 | $_aSection[ 'repeatable' ], |
366 | 366 | $this->oMsg |
367 | 367 | ); |
368 | - $_aOutputs[ 'section_contents' ][] = $this->_getRepeatableSectionFlagTag( $_aSection ); |
|
368 | + $_aOutputs[ 'section_contents' ][ ] = $this->_getRepeatableSectionFlagTag( $_aSection ); |
|
369 | 369 | } |
370 | 370 | // Add the sortable sections enabler script. 3.6.0+ |
371 | - if ( ! empty( $_aSection[ 'sortable' ] ) ) { |
|
372 | - $_aOutputs[ 'section_contents' ][] = AdminPageFramework_Form_View___Script_SortableSection::getEnabler( |
|
371 | + if ( !empty( $_aSection[ 'sortable' ] ) ) { |
|
372 | + $_aOutputs[ 'section_contents' ][ ] = AdminPageFramework_Form_View___Script_SortableSection::getEnabler( |
|
373 | 373 | $_sSectionsID, |
374 | 374 | $_aSection[ 'sortable' ], |
375 | 375 | $this->oMsg |
376 | 376 | ); |
377 | - $_aOutputs[ 'section_contents' ][] = $this->_getSortableSectionFlagTag( $_aSection ); |
|
377 | + $_aOutputs[ 'section_contents' ][ ] = $this->_getSortableSectionFlagTag( $_aSection ); |
|
378 | 378 | } |
379 | 379 | |
380 | 380 | // Get the section tables. |
381 | 381 | $_aSubSections = $this->numerizeElements( $_aSubSections ); // will include the main section as well. |
382 | - foreach( $_aSubSections as $_iIndex => $_aFields ) { |
|
382 | + foreach ( $_aSubSections as $_iIndex => $_aFields ) { |
|
383 | 383 | |
384 | 384 | $_oEachSectionArguments = new AdminPageFramework_Form_Model___Format_EachSection( |
385 | 385 | $_aSection, |
@@ -409,8 +409,8 @@ discard block |
||
409 | 409 | array( |
410 | 410 | 'class' => 'element-address', |
411 | 411 | 'type' => 'hidden', |
412 | - 'name' => '__repeatable_elements_' . $aSection[ '_structure_type' ] |
|
413 | - . '[' . $aSection[ 'section_id' ] . ']', |
|
412 | + 'name' => '__repeatable_elements_'.$aSection[ '_structure_type' ] |
|
413 | + . '['.$aSection[ 'section_id' ].']', |
|
414 | 414 | // @todo examine whether this value should include a section index. |
415 | 415 | 'value' => $aSection[ 'section_id' ], |
416 | 416 | ) |
@@ -428,8 +428,8 @@ discard block |
||
428 | 428 | array( |
429 | 429 | 'class' => 'element-address', |
430 | 430 | 'type' => 'hidden', |
431 | - 'name' => '__sortable_elements_' . $aSection[ '_structure_type' ] |
|
432 | - . '[' . $aSection[ 'section_id' ] . ']', |
|
431 | + 'name' => '__sortable_elements_'.$aSection[ '_structure_type' ] |
|
432 | + . '['.$aSection[ 'section_id' ].']', |
|
433 | 433 | // @todo examine whether this value should include a section index. |
434 | 434 | 'value' => $aSection[ 'section_id' ], |
435 | 435 | ) |
@@ -451,8 +451,8 @@ discard block |
||
451 | 451 | 'input', |
452 | 452 | array( |
453 | 453 | 'type' => 'hidden', |
454 | - 'name' => '__unset_' . $aSection[ '_structure_type' ] . '[' . $aSection[ 'section_id' ] . ']', |
|
455 | - 'value' => "__dummy_option_key|" . $aSection[ 'section_id' ], |
|
454 | + 'name' => '__unset_'.$aSection[ '_structure_type' ].'['.$aSection[ 'section_id' ].']', |
|
455 | + 'value' => "__dummy_option_key|".$aSection[ 'section_id' ], |
|
456 | 456 | 'class' => 'unset-element-names element-address', |
457 | 457 | ) |
458 | 458 | ); |
@@ -468,7 +468,7 @@ discard block |
||
468 | 468 | private function _getSectionTableWithTabList( array $_aOutputs, array $aSectionset, $aFieldsetsPerSection ) { |
469 | 469 | |
470 | 470 | // Tab list |
471 | - $_aOutputs[ 'section_tab_list' ][] = $this->_getTabList( |
|
471 | + $_aOutputs[ 'section_tab_list' ][ ] = $this->_getTabList( |
|
472 | 472 | $aSectionset, |
473 | 473 | $aFieldsetsPerSection, |
474 | 474 | $this->aCallbacks[ 'fieldset_output' ] |
@@ -476,7 +476,7 @@ discard block |
||
476 | 476 | |
477 | 477 | // Section container |
478 | 478 | $_oSectionTable = new AdminPageFramework_Form_View___Section( |
479 | - $this->aArguments, // for nested sections |
|
479 | + $this->aArguments, // for nested sections |
|
480 | 480 | $aSectionset, |
481 | 481 | $this->aStructure, |
482 | 482 | $aFieldsetsPerSection, |
@@ -486,7 +486,7 @@ discard block |
||
486 | 486 | $this->aCallbacks, |
487 | 487 | $this->oMsg |
488 | 488 | ); |
489 | - $_aOutputs[ 'section_contents' ][] = $_oSectionTable->get(); |
|
489 | + $_aOutputs[ 'section_contents' ][ ] = $_oSectionTable->get(); |
|
490 | 490 | |
491 | 491 | return $_aOutputs; |
492 | 492 | |
@@ -514,9 +514,9 @@ discard block |
||
514 | 514 | 'section_index' => null, |
515 | 515 | 'collapsible' => $aCollapsible, |
516 | 516 | 'container_type' => 'sections', // section or sections |
517 | - 'sectionset' => $aSectionset, // 3.7.0+ for tooltip |
|
517 | + 'sectionset' => $aSectionset, // 3.7.0+ for tooltip |
|
518 | 518 | ), |
519 | - array(), // fieldsets |
|
519 | + array(), // fieldsets |
|
520 | 520 | $this->aSavedData, |
521 | 521 | $this->aFieldErrors, |
522 | 522 | $this->aStructure[ 'field_type_definitions' ], |
@@ -533,7 +533,7 @@ discard block |
||
533 | 533 | $aOutputs[ 'count_subsections' ] |
534 | 534 | ); |
535 | 535 | return $_oCollapsibleSectionTitle->get() |
536 | - . "<div " . $_oSectionsTablesContainerAttributes->get() . ">" |
|
536 | + . "<div ".$_oSectionsTablesContainerAttributes->get().">" |
|
537 | 537 | . $this->_getSectionTabList( $sSectionTabSlug, $aOutputs[ 'section_tab_list' ] ) |
538 | 538 | . implode( PHP_EOL, $aOutputs[ 'section_contents' ] ) |
539 | 539 | . "</div>"; |
@@ -564,21 +564,21 @@ discard block |
||
564 | 564 | */ |
565 | 565 | private function _getTabList( array $aSection, array $aFields, $hfFieldCallback ) { |
566 | 566 | |
567 | - if ( ! $aSection[ 'section_tab_slug' ] ) { |
|
567 | + if ( !$aSection[ 'section_tab_slug' ] ) { |
|
568 | 568 | return ''; |
569 | 569 | } |
570 | 570 | |
571 | 571 | $iSectionIndex = $aSection[ '_index' ]; |
572 | 572 | |
573 | - $_sSectionTagID = 'section-' . $aSection[ 'section_id' ] . '__' . $iSectionIndex; |
|
573 | + $_sSectionTagID = 'section-'.$aSection[ 'section_id' ].'__'.$iSectionIndex; |
|
574 | 574 | $_aTabAttributes = $aSection[ 'attributes' ][ 'tab' ] |
575 | 575 | + array( |
576 | 576 | 'class' => 'admin-page-framework-section-tab nav-tab', |
577 | 577 | 'id' => "section_tab-{$_sSectionTagID}", |
578 | 578 | 'style' => null |
579 | 579 | ); |
580 | - $_aTabAttributes[ 'class' ] = $this->getClassAttribute( $_aTabAttributes[ 'class' ], $aSection[ 'class' ][ 'tab' ] ); // 3.3.1+ |
|
581 | - $_aTabAttributes[ 'style' ] = $this->getStyleAttribute( $_aTabAttributes[ 'style' ], $aSection[ 'hidden' ] ? 'display:none' : null ); // 3.3.1+ |
|
580 | + $_aTabAttributes[ 'class' ] = $this->getClassAttribute( $_aTabAttributes[ 'class' ], $aSection[ 'class' ][ 'tab' ] ); // 3.3.1+ |
|
581 | + $_aTabAttributes[ 'style' ] = $this->getStyleAttribute( $_aTabAttributes[ 'style' ], $aSection[ 'hidden' ] ? 'display:none' : null ); // 3.3.1+ |
|
582 | 582 | |
583 | 583 | $_oSectionTitle = new AdminPageFramework_Form_View___SectionTitle( |
584 | 584 | array( |
@@ -586,7 +586,7 @@ discard block |
||
586 | 586 | 'tag' => 'h4', |
587 | 587 | 'section_index' => $iSectionIndex, |
588 | 588 | |
589 | - 'sectionset' => $aSection, // 3.7.0+ for tooltip |
|
589 | + 'sectionset' => $aSection, // 3.7.0+ for tooltip |
|
590 | 590 | ), |
591 | 591 | $aFields, |
592 | 592 | $this->aSavedData, |
@@ -596,7 +596,7 @@ discard block |
||
596 | 596 | $this->aCallbacks // field output element callables. |
597 | 597 | ); |
598 | 598 | |
599 | - return "<li " . $this->getAttributes( $_aTabAttributes ) . ">" |
|
599 | + return "<li ".$this->getAttributes( $_aTabAttributes ).">" |
|
600 | 600 | . "<a href='#{$_sSectionTagID}'>" |
601 | 601 | . $_oSectionTitle->get() |
602 | 602 | ."</a>" |
@@ -36,12 +36,12 @@ discard block |
||
36 | 36 | |
37 | 37 | // Output |
38 | 38 | return |
39 | - "<{$this->aOptions['input_container_tag']} " . $this->getAttributes( $this->aOptions['input_container_attributes'] ) . ">" |
|
40 | - . "<input " . $this->getAttributes( $_aAttributes ) . " />" |
|
41 | - . "</{$this->aOptions['input_container_tag']}>" |
|
42 | - . "<{$this->aOptions['label_container_tag']} " . $this->getAttributes( $this->aOptions['label_container_attributes'] ) . ">" |
|
39 | + "<{$this->aOptions[ 'input_container_tag' ]} ".$this->getAttributes( $this->aOptions[ 'input_container_attributes' ] ).">" |
|
40 | + . "<input ".$this->getAttributes( $_aAttributes )." />" |
|
41 | + . "</{$this->aOptions[ 'input_container_tag' ]}>" |
|
42 | + . "<{$this->aOptions[ 'label_container_tag' ]} ".$this->getAttributes( $this->aOptions[ 'label_container_attributes' ] ).">" |
|
43 | 43 | . $_sLabel |
44 | - . "</{$this->aOptions['label_container_tag']}>" |
|
44 | + . "</{$this->aOptions[ 'label_container_tag' ]}>" |
|
45 | 45 | ; |
46 | 46 | |
47 | 47 | } |
@@ -58,22 +58,22 @@ discard block |
||
58 | 58 | public function getAttributesByKey( /* $sKey */ ) { |
59 | 59 | |
60 | 60 | // Parameters |
61 | - $_aParams = func_get_args() + array( 0 => '', ); |
|
62 | - $_sKey = $_aParams[ 0 ]; |
|
61 | + $_aParams = func_get_args() + array( 0 => '',); |
|
62 | + $_sKey = $_aParams[ 0 ]; |
|
63 | 63 | |
64 | 64 | // Result |
65 | 65 | return $this->getElementAsArray( $this->aAttributes, $_sKey, array() ) |
66 | 66 | + array( |
67 | 67 | 'type' => 'radio', |
68 | - 'checked' => isset( $this->aAttributes['value'] ) && $this->aAttributes['value'] == $_sKey |
|
68 | + 'checked' => isset( $this->aAttributes[ 'value' ] ) && $this->aAttributes[ 'value' ] == $_sKey |
|
69 | 69 | ? 'checked' |
70 | 70 | : null, |
71 | 71 | 'value' => $_sKey, |
72 | 72 | // 'id' => $this->aField['input_id'] . '_' . $_sKey, |
73 | - 'id' => $this->getAttribute( 'id' ) . '_' . $_sKey, |
|
73 | + 'id' => $this->getAttribute( 'id' ).'_'.$_sKey, |
|
74 | 74 | // 'data-default' => $this->aField['default'], // refered by the repeater script |
75 | 75 | // 'data-id' => $this->aField['input_id'], // refered by the JavaScript scripts such as the revealer script. |
76 | - 'data-id' => $this->getAttribute( 'id' ), // refered by the JavaScript scripts such as the revealer script. |
|
76 | + 'data-id' => $this->getAttribute( 'id' ), // refered by the JavaScript scripts such as the revealer script. |
|
77 | 77 | ) |
78 | 78 | + $this->aAttributes; |
79 | 79 |
@@ -20,8 +20,6 @@ discard block |
||
20 | 20 | * Returns the output of the input element. |
21 | 21 | * |
22 | 22 | * @since 3.4.0 |
23 | - * @param string $sLabel The label text. |
|
24 | - * @param array $aAttributes (optional) The attribute array. If set, it will be merged with the attribute set in the constructor. |
|
25 | 23 | */ |
26 | 24 | public function get( /* $sLabel, $aAttributes=array() */ ) { |
27 | 25 | |
@@ -51,8 +49,6 @@ discard block |
||
51 | 49 | * |
52 | 50 | * @return array The updated attribute array. |
53 | 51 | * @since 3.5.3 |
54 | - * @param string $sKey The array element key of the radio button. |
|
55 | - * It is assumed that there is an array that holds multiple radio buttons and each of them has an array key. |
|
56 | 52 | */ |
57 | 53 | public function getAttributesByKey( /* $sKey */ ) { |
58 | 54 |
@@ -37,13 +37,13 @@ discard block |
||
37 | 37 | */ |
38 | 38 | public function _replyToFinalizeInPageTabs() { |
39 | 39 | |
40 | - if ( ! $this->oProp->isPageAdded() ) { |
|
40 | + if ( !$this->oProp->isPageAdded() ) { |
|
41 | 41 | return; |
42 | 42 | } |
43 | 43 | |
44 | - foreach( $this->oProp->aPages as $_sPageSlug => $_aPage ) { |
|
44 | + foreach ( $this->oProp->aPages as $_sPageSlug => $_aPage ) { |
|
45 | 45 | |
46 | - if ( ! isset( $this->oProp->aInPageTabs[ $_sPageSlug ] ) ) { |
|
46 | + if ( !isset( $this->oProp->aInPageTabs[ $_sPageSlug ] ) ) { |
|
47 | 47 | continue; |
48 | 48 | } |
49 | 49 | |
@@ -80,8 +80,8 @@ discard block |
||
80 | 80 | * @since 3.6.0 |
81 | 81 | */ |
82 | 82 | private function _getDefaultInPageTab( $sPageSlug, $aInPageTabs ) { |
83 | - foreach( $aInPageTabs as $_aInPageTab ) { |
|
84 | - if ( ! isset( $_aInPageTab[ 'tab_slug' ] ) ) { |
|
83 | + foreach ( $aInPageTabs as $_aInPageTab ) { |
|
84 | + if ( !isset( $_aInPageTab[ 'tab_slug' ] ) ) { |
|
85 | 85 | continue; |
86 | 86 | } |
87 | 87 | // Regardless of whether it's a hidden tab, it is stored as the default in-page tab. |