@@ -26,9 +26,9 @@ discard block |
||
26 | 26 | */ |
27 | 27 | static public function getReadableListOfArray( array $aArray ) { |
28 | 28 | |
29 | - $_aOutput = array(); |
|
30 | - foreach( $aArray as $_sKey => $_vValue ) { |
|
31 | - $_aOutput[] = self::getReadableArrayContents( $_sKey, $_vValue, 32 ) . PHP_EOL; |
|
29 | + $_aOutput = array(); |
|
30 | + foreach ( $aArray as $_sKey => $_vValue ) { |
|
31 | + $_aOutput[ ] = self::getReadableArrayContents( $_sKey, $_vValue, 32 ).PHP_EOL; |
|
32 | 32 | } |
33 | 33 | return implode( PHP_EOL, $_aOutput ); |
34 | 34 | |
@@ -40,37 +40,37 @@ discard block |
||
40 | 40 | * @since 3.9.0 Moved from `AdminPageFramework_Utility_Array.php`. |
41 | 41 | * @return string The generated human-readable array contents. |
42 | 42 | */ |
43 | - static public function getReadableArrayContents( $sKey, $vValue, $sLabelCharLengths=16, $iOffset=0 ) { |
|
43 | + static public function getReadableArrayContents( $sKey, $vValue, $sLabelCharLengths = 16, $iOffset = 0 ) { |
|
44 | 44 | |
45 | 45 | $_aOutput = array(); |
46 | - $_aOutput[] = ( $iOffset |
|
47 | - ? str_pad( ' ', $iOffset ) |
|
46 | + $_aOutput[ ] = ( $iOffset |
|
47 | + ? str_pad( ' ', $iOffset ) |
|
48 | 48 | : '' |
49 | 49 | ) |
50 | 50 | . ( $sKey |
51 | - ? '[' . $sKey . ']' |
|
51 | + ? '['.$sKey.']' |
|
52 | 52 | : '' |
53 | 53 | ); |
54 | 54 | |
55 | - if ( ! in_array( gettype( $vValue ), array( 'array', 'object' ) ) ) { |
|
56 | - $_aOutput[] = $vValue; |
|
55 | + if ( !in_array( gettype( $vValue ), array( 'array', 'object' ) ) ) { |
|
56 | + $_aOutput[ ] = $vValue; |
|
57 | 57 | return implode( PHP_EOL, $_aOutput ); |
58 | 58 | } |
59 | 59 | |
60 | 60 | foreach ( $vValue as $_sTitle => $_asDescription ) { |
61 | - if ( ! in_array( gettype( $_asDescription ), array( 'array', 'object' ) ) ) { |
|
62 | - $_aOutput[] = str_pad( ' ', $iOffset ) |
|
61 | + if ( !in_array( gettype( $_asDescription ), array( 'array', 'object' ) ) ) { |
|
62 | + $_aOutput[ ] = str_pad( ' ', $iOffset ) |
|
63 | 63 | . $_sTitle |
64 | 64 | . str_pad( ':', $sLabelCharLengths - self::getStringLength( $_sTitle ) ) |
65 | 65 | . $_asDescription; |
66 | 66 | continue; |
67 | 67 | } |
68 | - $_aOutput[] = str_pad( ' ', $iOffset ) |
|
68 | + $_aOutput[ ] = str_pad( ' ', $iOffset ) |
|
69 | 69 | . $_sTitle |
70 | 70 | . ": {" |
71 | 71 | . self::getReadableArrayContents( '', $_asDescription, 16, $iOffset + 4 ) |
72 | 72 | . PHP_EOL |
73 | - . str_pad( ' ', $iOffset ) . "}"; |
|
73 | + . str_pad( ' ', $iOffset )."}"; |
|
74 | 74 | } |
75 | 75 | return implode( PHP_EOL, $_aOutput ); |
76 | 76 | |
@@ -83,11 +83,11 @@ discard block |
||
83 | 83 | * @return string The HTML list generated from the given array. |
84 | 84 | */ |
85 | 85 | static public function getReadableListOfArrayAsHTML( array $aArray ) { |
86 | - $_aOutput = array(); |
|
87 | - foreach( $aArray as $_sKey => $_vValue ) { |
|
88 | - $_aOutput[] = "<ul class='array-contents'>" |
|
86 | + $_aOutput = array(); |
|
87 | + foreach ( $aArray as $_sKey => $_vValue ) { |
|
88 | + $_aOutput[ ] = "<ul class='array-contents'>" |
|
89 | 89 | . self::getReadableArrayContentsHTML( $_sKey, $_vValue ) |
90 | - . "</ul>" . PHP_EOL; |
|
90 | + . "</ul>".PHP_EOL; |
|
91 | 91 | } |
92 | 92 | return implode( PHP_EOL, $_aOutput ); |
93 | 93 | } |
@@ -105,25 +105,25 @@ discard block |
||
105 | 105 | $_aOutput = array(); |
106 | 106 | |
107 | 107 | // Title - array key |
108 | - $_aOutput[] = $sKey |
|
109 | - ? "<h3 class='array-key'>" . $sKey . "</h3>" |
|
108 | + $_aOutput[ ] = $sKey |
|
109 | + ? "<h3 class='array-key'>".$sKey."</h3>" |
|
110 | 110 | : ""; |
111 | 111 | |
112 | 112 | // If it does not have a nested array or object, |
113 | - if ( ! in_array( gettype( $vValue ), array( 'array', 'object' ), true ) ) { |
|
114 | - $_aOutput[] = "<div class='array-value'>" |
|
113 | + if ( !in_array( gettype( $vValue ), array( 'array', 'object' ), true ) ) { |
|
114 | + $_aOutput[ ] = "<div class='array-value'>" |
|
115 | 115 | . html_entity_decode( nl2br( $vValue ), ENT_QUOTES ) |
116 | 116 | . "</div>"; |
117 | - return "<li>" . implode( PHP_EOL, $_aOutput ) . "</li>"; |
|
117 | + return "<li>".implode( PHP_EOL, $_aOutput )."</li>"; |
|
118 | 118 | } |
119 | 119 | |
120 | 120 | // Now it is a nested item. |
121 | 121 | foreach ( $vValue as $_sKey => $_vValue ) { |
122 | - $_aOutput[] = "<ul class='array-contents'>" |
|
122 | + $_aOutput[ ] = "<ul class='array-contents'>" |
|
123 | 123 | . self::getReadableArrayContentsHTML( $_sKey, $_vValue ) |
124 | 124 | . "</ul>"; |
125 | 125 | } |
126 | - return implode( PHP_EOL, $_aOutput ) ; |
|
126 | + return implode( PHP_EOL, $_aOutput ); |
|
127 | 127 | |
128 | 128 | } |
129 | 129 |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | * @return string |
32 | 32 | * @since 3.9.0 |
33 | 33 | */ |
34 | - static public function getTableOfKeyValues( array $aArray, array $aAllAttributes=array(), array $aHeader=array(), array $aFooter=array(), $bEscape=true, $sCaption='' ) { |
|
34 | + static public function getTableOfKeyValues( array $aArray, array $aAllAttributes = array(), array $aHeader = array(), array $aFooter = array(), $bEscape = true, $sCaption = '' ) { |
|
35 | 35 | $_aAllAttributes = $aAllAttributes + array( |
36 | 36 | 'table' => array(), |
37 | 37 | 'caption' => array(), |
@@ -46,10 +46,10 @@ discard block |
||
46 | 46 | 'li' => array(), |
47 | 47 | 'p' => array(), |
48 | 48 | ); |
49 | - return "<table " . self::getAttributes( self::getElementAsArray( $_aAllAttributes, 'table' ) ) . ">" |
|
49 | + return "<table ".self::getAttributes( self::getElementAsArray( $_aAllAttributes, 'table' ) ).">" |
|
50 | 50 | . self::___getTableCaption( $sCaption, $_aAllAttributes, $bEscape ) |
51 | 51 | . self::___getTableHeaderOfKeyValuePair( $aHeader, $aAllAttributes, $bEscape ) |
52 | - . "<tbody " . self::getAttributes( self::getElementAsArray( $_aAllAttributes, 'tbody' ) ) . ">" |
|
52 | + . "<tbody ".self::getAttributes( self::getElementAsArray( $_aAllAttributes, 'tbody' ) ).">" |
|
53 | 53 | . self::___getRowsOfKeyValuePair( $aArray, $aAllAttributes, $bEscape ) |
54 | 54 | . "</tbody>" |
55 | 55 | . self::___getTableFooterOfKeyValuePair( $aFooter, $aAllAttributes, $bEscape ) |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | * @return string |
70 | 70 | * @since 3.9.0 |
71 | 71 | */ |
72 | - static public function getTableOfArray( array $aArray, array $aAllAttributes=array(), array $aHeader=array(), array $aFooter=array(), $bEscape=true, $sCaption='' ) { |
|
72 | + static public function getTableOfArray( array $aArray, array $aAllAttributes = array(), array $aHeader = array(), array $aFooter = array(), $bEscape = true, $sCaption = '' ) { |
|
73 | 73 | |
74 | 74 | $_aAllAttributes = $aAllAttributes + array( |
75 | 75 | 'table' => array(), |
@@ -85,10 +85,10 @@ discard block |
||
85 | 85 | 'li' => array(), |
86 | 86 | 'p' => array(), |
87 | 87 | ); |
88 | - return "<table " . self::getAttributes( self::getElementAsArray( $_aAllAttributes, 'table' ) ) . ">" |
|
88 | + return "<table ".self::getAttributes( self::getElementAsArray( $_aAllAttributes, 'table' ) ).">" |
|
89 | 89 | . self::___getTableCaption( $sCaption, $_aAllAttributes, $bEscape ) |
90 | 90 | . self::___getTableHeader( $aHeader, $_aAllAttributes, $bEscape ) |
91 | - . "<tbody " . self::getAttributes( self::getElementAsArray( $_aAllAttributes, 'tbody' ) ) . ">" |
|
91 | + . "<tbody ".self::getAttributes( self::getElementAsArray( $_aAllAttributes, 'tbody' ) ).">" |
|
92 | 92 | . self::___getTableRows( $aArray, $_aAllAttributes, $bEscape ) |
93 | 93 | . "</tbody>" |
94 | 94 | . self::___getTableFooter( $aFooter, $_aAllAttributes, $bEscape ) |
@@ -96,14 +96,14 @@ discard block |
||
96 | 96 | } |
97 | 97 | static private function ___getTableCaption( $sCaption, $aAllAttributes, $bEscape ) { |
98 | 98 | $sCaption = ( string ) $sCaption; |
99 | - if ( ! strlen( $sCaption ) ) { |
|
99 | + if ( !strlen( $sCaption ) ) { |
|
100 | 100 | return ''; |
101 | 101 | } |
102 | 102 | $_aCapAttr = self::getElementAsArray( $aAllAttributes, 'caption' ); |
103 | 103 | $_sCaption = $bEscape |
104 | 104 | ? htmlspecialchars( $sCaption ) |
105 | 105 | : $sCaption; |
106 | - return "<caption " . self::getAttributes( $_aCapAttr ) . ">" |
|
106 | + return "<caption ".self::getAttributes( $_aCapAttr ).">" |
|
107 | 107 | . $_sCaption |
108 | 108 | . "</caption>"; |
109 | 109 | } |
@@ -126,24 +126,24 @@ discard block |
||
126 | 126 | $_aTHAttr1 = self::getElementAsArray( $aAllAttributes, array( 'th', 0 ) ) + $_aTHAttr; |
127 | 127 | $_aTHAttr2 = self::getElementAsArray( $aAllAttributes, array( 'th', 1 ) ) + $_aTHAttr; |
128 | 128 | $_sOutput = ''; |
129 | - foreach( $aHeader as $_sKey => $_sValue ) { |
|
130 | - $_sOutput .= "<tr " . self::getAttributes( $_aTRAttr ) . ">" |
|
131 | - . "<th " . self::getAttributes( $_aTHAttr1 ) . ">" . self::___getHTMLEscaped( $_sKey, $bEscape ) . "</th>" |
|
132 | - . "<th " . self::getAttributes( $_aTHAttr2 ) . ">" . self::___getHTMLEscaped( $_sValue, $bEscape ) . "</th>" |
|
129 | + foreach ( $aHeader as $_sKey => $_sValue ) { |
|
130 | + $_sOutput .= "<tr ".self::getAttributes( $_aTRAttr ).">" |
|
131 | + . "<th ".self::getAttributes( $_aTHAttr1 ).">".self::___getHTMLEscaped( $_sKey, $bEscape )."</th>" |
|
132 | + . "<th ".self::getAttributes( $_aTHAttr2 ).">".self::___getHTMLEscaped( $_sValue, $bEscape )."</th>" |
|
133 | 133 | . "</tr>"; |
134 | 134 | } |
135 | - return "<thead>" . $_sOutput . "</thead>"; |
|
135 | + return "<thead>".$_sOutput."</thead>"; |
|
136 | 136 | } |
137 | 137 | static private function ___getTableHeaderOfMultiColumns( array $aHeader, array $aAllAttributes, $bEscape ) { |
138 | 138 | $_aTRAttr = self::getElementAsArray( $aAllAttributes, 'tr' ); |
139 | 139 | $_aTHAttr = self::getElementAsArray( $aAllAttributes, 'th' ); |
140 | - $_sOutput = "<tr " . self::getAttributes( $_aTRAttr ) . ">"; |
|
141 | - foreach( array_values( $aHeader ) as $_iIndex => $_sColumnName ) { |
|
140 | + $_sOutput = "<tr ".self::getAttributes( $_aTRAttr ).">"; |
|
141 | + foreach ( array_values( $aHeader ) as $_iIndex => $_sColumnName ) { |
|
142 | 142 | $_aTHAttrNth = self::getElementAsArray( $aAllAttributes, array( 'th', $_iIndex ) ) + $_aTHAttr; |
143 | - $_sOutput .= "<th " . self::getAttributes( $_aTHAttrNth ) . ">" . self::___getHTMLEscaped( ( string ) $_sColumnName, $bEscape ) . "</th>"; |
|
143 | + $_sOutput .= "<th ".self::getAttributes( $_aTHAttrNth ).">".self::___getHTMLEscaped( ( string ) $_sColumnName, $bEscape )."</th>"; |
|
144 | 144 | } |
145 | 145 | $_sOutput .= "</tr>"; |
146 | - return "<thead>" . $_sOutput . "</thead>"; |
|
146 | + return "<thead>".$_sOutput."</thead>"; |
|
147 | 147 | } |
148 | 148 | static private function ___getTableFooter( array $aFooter, array $aAllAttributes, $bEscape ) { |
149 | 149 | if ( empty( $aFooter ) ) { |
@@ -160,24 +160,24 @@ discard block |
||
160 | 160 | $_aTDAttr1 = self::getElementAsArray( $aAllAttributes, array( 'td', 0 ) ) + $_aTDAttr; |
161 | 161 | $_aTDAttr2 = self::getElementAsArray( $aAllAttributes, array( 'td', 1 ) ) + $_aTDAttr; |
162 | 162 | $_sOutput = ''; |
163 | - foreach( $aFooter as $_sKey => $_sValue ) { |
|
164 | - $_sOutput = "<tr " . self::getAttributes( $_aTRAttr ) . ">" |
|
165 | - . "<td " . self::getAttributes( $_aTDAttr1 ) . ">" . self::___getHTMLEscaped( $_sKey, $bEscape ) . "</td>" |
|
166 | - . "<td " . self::getAttributes( $_aTDAttr2 ) . ">" . self::___getHTMLEscaped( $_sValue, $bEscape ) . "</td>" |
|
163 | + foreach ( $aFooter as $_sKey => $_sValue ) { |
|
164 | + $_sOutput = "<tr ".self::getAttributes( $_aTRAttr ).">" |
|
165 | + . "<td ".self::getAttributes( $_aTDAttr1 ).">".self::___getHTMLEscaped( $_sKey, $bEscape )."</td>" |
|
166 | + . "<td ".self::getAttributes( $_aTDAttr2 ).">".self::___getHTMLEscaped( $_sValue, $bEscape )."</td>" |
|
167 | 167 | . "</tr>"; |
168 | 168 | } |
169 | - return "<tfoot>" . $_sOutput . "</tfoot>"; |
|
169 | + return "<tfoot>".$_sOutput."</tfoot>"; |
|
170 | 170 | } |
171 | 171 | static private function ___getTableFooterOfMultiColumns( array $aFooter, array $aAllAttributes, $bEscape ) { |
172 | 172 | $_aTRAttr = self::getElementAsArray( $aAllAttributes, 'tr' ); |
173 | 173 | $_aTDAttr = self::getElementAsArray( $aAllAttributes, 'td' ); |
174 | - $_sOutput = "<tr " . self::getAttributes( $_aTRAttr ) . ">"; |
|
175 | - foreach( array_values( $aFooter ) as $_iIndex => $_sColumnName ) { |
|
174 | + $_sOutput = "<tr ".self::getAttributes( $_aTRAttr ).">"; |
|
175 | + foreach ( array_values( $aFooter ) as $_iIndex => $_sColumnName ) { |
|
176 | 176 | $_aTDAttrNth = self::getElementAsArray( $aAllAttributes, array( 'td', $_iIndex ) ) + $_aTDAttr; |
177 | - $_sOutput .= "<td " . self::getAttributes( $_aTDAttrNth ) . ">" . self::___getHTMLEscaped( ( string ) $_sColumnName, $bEscape ) . "</td>"; |
|
177 | + $_sOutput .= "<td ".self::getAttributes( $_aTDAttrNth ).">".self::___getHTMLEscaped( ( string ) $_sColumnName, $bEscape )."</td>"; |
|
178 | 178 | } |
179 | 179 | $_sOutput .= "</tr>"; |
180 | - return "<tfoot>" . $_sOutput . "</tfoot>"; |
|
180 | + return "<tfoot>".$_sOutput."</tfoot>"; |
|
181 | 181 | } |
182 | 182 | static private function ___getTableRows( array $aArray, array $aAllAttributes, $bEscape ) { |
183 | 183 | if ( empty( $aArray ) ) { |
@@ -214,10 +214,10 @@ discard block |
||
214 | 214 | $_aTDAttrFirst = self::getElementAsArray( $aAllAttributes, array( 'td', 0 ) ) + $_aTDAttr; |
215 | 215 | $_aTDAttrFirst[ 'class' ] = self::getClassAttribute( 'column-key', self::getElement( $_aTDAttrFirst, array( 'class' ), '' ) ); |
216 | 216 | $_sOutput = ''; |
217 | - foreach( $aItem as $_sColumnName => $_asValue ) { |
|
218 | - $_sOutput .= "<tr " . self::getAttributes( $_aTRAttr ) . ">"; |
|
219 | - $_sOutput .= "<td " . self::getAttributes( $_aTDAttrFirst ) . ">" |
|
220 | - . "<p " . self::getAttributes( $_aPAttr ) . ">" . self::___getHTMLEscaped( $_sColumnName, $bEscape ) . "</p>" |
|
217 | + foreach ( $aItem as $_sColumnName => $_asValue ) { |
|
218 | + $_sOutput .= "<tr ".self::getAttributes( $_aTRAttr ).">"; |
|
219 | + $_sOutput .= "<td ".self::getAttributes( $_aTDAttrFirst ).">" |
|
220 | + . "<p ".self::getAttributes( $_aPAttr ).">".self::___getHTMLEscaped( $_sColumnName, $bEscape )."</p>" |
|
221 | 221 | . "</td>"; |
222 | 222 | $_sOutput .= self::___getColumnValue( $_asValue, $aAllAttributes, $bEscape, 1 ); |
223 | 223 | $_sOutput .= "</tr>"; |
@@ -231,15 +231,15 @@ discard block |
||
231 | 231 | static private function ___getRowsOfMultiColumns( array $aArray, array $aAllAttributes, $bEscape ) { |
232 | 232 | $_aTRAttr = self::getElementAsArray( $aAllAttributes, 'tr' ); |
233 | 233 | $_sOutput = ''; |
234 | - foreach( $aArray as $_iRowIndex => $_asValue ) { |
|
234 | + foreach ( $aArray as $_iRowIndex => $_asValue ) { |
|
235 | 235 | if ( is_scalar( $_asValue ) ) { |
236 | - $_sOutput .= "<tr " . self::getAttributes( $_aTRAttr ) . ">" |
|
236 | + $_sOutput .= "<tr ".self::getAttributes( $_aTRAttr ).">" |
|
237 | 237 | . self::___getColumnValue( $_asValue, $aAllAttributes, $bEscape, 0 ) |
238 | 238 | . "</tr>"; |
239 | 239 | continue; |
240 | 240 | } |
241 | 241 | $_aColumns = self::getAsArray( $_asValue ); |
242 | - $_sOutput .= "<tr " . self::getAttributes( $_aTRAttr ) . ">" |
|
242 | + $_sOutput .= "<tr ".self::getAttributes( $_aTRAttr ).">" |
|
243 | 243 | . self::___getColumns( $_aColumns, $aAllAttributes, $bEscape ) |
244 | 244 | . "</tr>"; |
245 | 245 | } |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | } |
248 | 248 | static private function ___getColumns( array $aColumns, $aAllAttributes, $bEscape ) { |
249 | 249 | $_sOutput = ''; |
250 | - foreach( array_values( $aColumns ) as $_iIndex => $_asValue ) { |
|
250 | + foreach ( array_values( $aColumns ) as $_iIndex => $_asValue ) { |
|
251 | 251 | $_sOutput .= self::___getColumnValue( $_asValue, $aAllAttributes, $bEscape, $_iIndex ); |
252 | 252 | } |
253 | 253 | return $_sOutput; |
@@ -269,24 +269,24 @@ discard block |
||
269 | 269 | if ( is_null( $mValue ) ) { |
270 | 270 | $mValue = '(null)'; |
271 | 271 | } |
272 | - $_aPAttr = self::getElementAsArray( $aAllAttributes, 'p' ); |
|
272 | + $_aPAttr = self::getElementAsArray( $aAllAttributes, 'p' ); |
|
273 | 273 | if ( is_scalar( $mValue ) ) { |
274 | - return "<td " . self::getAttributes( $_aTDAttrNth ) . ">" |
|
275 | - . "<p " . self::getAttributes( $_aPAttr ) . ">" . self::___getHTMLEscaped( $mValue, $bEscape ) . "</p>" |
|
274 | + return "<td ".self::getAttributes( $_aTDAttrNth ).">" |
|
275 | + . "<p ".self::getAttributes( $_aPAttr ).">".self::___getHTMLEscaped( $mValue, $bEscape )."</p>" |
|
276 | 276 | . "</td>"; |
277 | 277 | } |
278 | 278 | if ( is_array( $mValue ) ) { |
279 | 279 | return self::isAssociativeArray( $mValue ) || self::isMultiDimensional( $mValue ) |
280 | - ? "<td " . self::getAttributes( $_aTDAttrNth ) . ">" |
|
280 | + ? "<td ".self::getAttributes( $_aTDAttrNth ).">" |
|
281 | 281 | . self::getTableOfKeyValues( $mValue, $aAllAttributes ) |
282 | 282 | . "</td>" |
283 | - : "<td " . self::getAttributes( $_aTDAttrNth ) . ">" |
|
283 | + : "<td ".self::getAttributes( $_aTDAttrNth ).">" |
|
284 | 284 | // @todo may ought to be numeric-rows table |
285 | 285 | . self::___getList( $mValue, $aAllAttributes, $bEscape ) |
286 | 286 | . "</td>"; |
287 | 287 | } |
288 | - return "<td " . self::getAttributes( $_aTDAttrNth ) . ">" |
|
289 | - . '(' . gettype( $mValue ) . ')' . ( is_object( $mValue ) ? get_class( $mValue ) : '' ) |
|
288 | + return "<td ".self::getAttributes( $_aTDAttrNth ).">" |
|
289 | + . '('.gettype( $mValue ).')'.( is_object( $mValue ) ? get_class( $mValue ) : '' ) |
|
290 | 290 | . "</td>"; |
291 | 291 | } |
292 | 292 | /** |
@@ -303,16 +303,16 @@ discard block |
||
303 | 303 | if ( empty( $aArray ) ) { |
304 | 304 | return ''; |
305 | 305 | } |
306 | - $_sList = "<ul " . self::getAttributes( $_aULAttr ) . ">"; |
|
307 | - foreach( $aArray as $_asValue ) { |
|
306 | + $_sList = "<ul ".self::getAttributes( $_aULAttr ).">"; |
|
307 | + foreach ( $aArray as $_asValue ) { |
|
308 | 308 | $_sItem = is_array( $_asValue ) |
309 | 309 | ? self::___getList( $_asValue, $aAllAttributes, $bEscape ) |
310 | 310 | : self::___getHTMLEscaped( $_asValue, $bEscape ); |
311 | - $_sList .= "<li " . self::getAttributes( $_aLIAttr ) . ">" |
|
311 | + $_sList .= "<li ".self::getAttributes( $_aLIAttr ).">" |
|
312 | 312 | . $_sItem |
313 | 313 | . "</li>"; |
314 | 314 | } |
315 | - $_sList .= "</ul>"; |
|
315 | + $_sList .= "</ul>"; |
|
316 | 316 | return $_sList; |
317 | 317 | } |
318 | 318 |
@@ -27,9 +27,9 @@ discard block |
||
27 | 27 | * @since 3.8.9 |
28 | 28 | * @since 3.8.32 Moved from `AdminPageFramework_Debug_Base` and renamed from `___getArrayMappedRecursive()` and made public as a part of the utility class. |
29 | 29 | */ |
30 | - static public function getArrayMappedRecursive( $cCallback, $aArray, array $aArguments=array() ) { |
|
30 | + static public function getArrayMappedRecursive( $cCallback, $aArray, array $aArguments = array() ) { |
|
31 | 31 | $_aOutput = array(); |
32 | - foreach( $aArray as $_isKey => $_vValue ) { |
|
32 | + foreach ( $aArray as $_isKey => $_vValue ) { |
|
33 | 33 | if ( is_array( $_vValue ) ) { |
34 | 34 | $_aOutput[ $_isKey ] = self::getArrayMappedRecursive( $cCallback, $_vValue, $aArguments ); |
35 | 35 | continue; |
@@ -46,10 +46,10 @@ discard block |
||
46 | 46 | * @return numeric |
47 | 47 | * @since 3.7.4 |
48 | 48 | */ |
49 | - static public function getUnusedNumericIndex( $aArray, $nIndex, $iOffset=1 ) { |
|
49 | + static public function getUnusedNumericIndex( $aArray, $nIndex, $iOffset = 1 ) { |
|
50 | 50 | |
51 | 51 | // Check if the order value is not used. |
52 | - if ( ! isset( $aArray[ $nIndex ] ) ) { |
|
52 | + if ( !isset( $aArray[ $nIndex ] ) ) { |
|
53 | 53 | return $nIndex; |
54 | 54 | } |
55 | 55 | |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | * @return boolean |
65 | 65 | */ |
66 | 66 | static public function isAssociative( array $aArray ) { |
67 | - return array_keys ( $aArray ) !== range( 0, count( $aArray ) - 1 ); |
|
67 | + return array_keys( $aArray ) !== range( 0, count( $aArray ) - 1 ); |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | /** |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | * </ul> |
74 | 74 | * @param string (optional) the position number that is passed to the <var>$position</var> parameter of the <a href="http://codex.wordpress.org/Function_Reference/add_menu_page">add_menu_page()</a> function. |
75 | 75 | */ |
76 | - public function setRootMenuPage( $sRootMenuLabel, $sIcon16x16=null, $iMenuPosition=null ) { |
|
76 | + public function setRootMenuPage( $sRootMenuLabel, $sIcon16x16 = null, $iMenuPosition = null ) { |
|
77 | 77 | $sRootMenuLabel = trim( $sRootMenuLabel ); |
78 | 78 | $_sSlug = $this->___getBuiltInMenuSlugByLabel( $sRootMenuLabel ); // if true, this method returns the slug |
79 | 79 | $this->oProp->aRootMenu = array( |
@@ -255,16 +255,16 @@ discard block |
||
255 | 255 | public function addSubMenuLink( array $aSubMenuLink ) { |
256 | 256 | |
257 | 257 | // If required keys are not set, return. |
258 | - if ( ! isset( $aSubMenuLink[ 'href' ], $aSubMenuLink[ 'title' ] ) ) { |
|
258 | + if ( !isset( $aSubMenuLink[ 'href' ], $aSubMenuLink[ 'title' ] ) ) { |
|
259 | 259 | return; |
260 | 260 | } |
261 | 261 | |
262 | 262 | // If the set URL is not valid, return. |
263 | - if ( ! filter_var( $aSubMenuLink[ 'href' ], FILTER_VALIDATE_URL ) ) { |
|
263 | + if ( !filter_var( $aSubMenuLink[ 'href' ], FILTER_VALIDATE_URL ) ) { |
|
264 | 264 | return; |
265 | 265 | } |
266 | 266 | |
267 | - $_oFormatter = new AdminPageFramework_Format_SubMenuLink( |
|
267 | + $_oFormatter = new AdminPageFramework_Format_SubMenuLink( |
|
268 | 268 | $aSubMenuLink, |
269 | 269 | $this, |
270 | 270 | count( $this->oProp->aPages ) + 1 |
@@ -322,11 +322,11 @@ discard block |
||
322 | 322 | */ |
323 | 323 | public function addSubMenuPage( array $aSubMenuPage ) { |
324 | 324 | |
325 | - if ( ! isset( $aSubMenuPage[ 'page_slug' ] ) ) { |
|
325 | + if ( !isset( $aSubMenuPage[ 'page_slug' ] ) ) { |
|
326 | 326 | return; |
327 | 327 | } |
328 | 328 | |
329 | - $_oFormatter = new AdminPageFramework_Format_SubMenuPage( |
|
329 | + $_oFormatter = new AdminPageFramework_Format_SubMenuPage( |
|
330 | 330 | $aSubMenuPage, |
331 | 331 | $this, |
332 | 332 | count( $this->oProp->aPages ) + 1 |
@@ -34,11 +34,11 @@ discard block |
||
34 | 34 | * |
35 | 35 | * @since 3.3.0 |
36 | 36 | */ |
37 | - public function __construct( $sOptionKey=null, $sCallerPath=null, $sCapability='manage_options', $sTextDomain='admin-page-framework' ) { |
|
37 | + public function __construct( $sOptionKey = null, $sCallerPath = null, $sCapability = 'manage_options', $sTextDomain = 'admin-page-framework' ) { |
|
38 | 38 | |
39 | 39 | $_sPropertyClassName = isset( $this->aSubClassNames[ 'oProp' ] ) |
40 | 40 | ? $this->aSubClassNames[ 'oProp' ] |
41 | - : 'AdminPageFramework_Property_' . $this->_sStructureType; |
|
41 | + : 'AdminPageFramework_Property_'.$this->_sStructureType; |
|
42 | 42 | |
43 | 43 | $this->oProp = new $_sPropertyClassName( |
44 | 44 | $this, |
@@ -55,12 +55,12 @@ discard block |
||
55 | 55 | // if ( $this->oProp->bIsAdminAjax ) { |
56 | 56 | // return; |
57 | 57 | // } |
58 | - if ( ! $this->oProp->bIsAdmin ) { |
|
58 | + if ( !$this->oProp->bIsAdmin ) { |
|
59 | 59 | return; |
60 | 60 | } |
61 | 61 | |
62 | 62 | add_action( 'wp_loaded', array( $this, '_replyToDetermineToLoad' ) ); |
63 | - add_action( 'set_up_' . $this->oProp->sClassName, array( $this, '_replyToLoadComponentsForAjax' ), 100 ); |
|
63 | + add_action( 'set_up_'.$this->oProp->sClassName, array( $this, '_replyToLoadComponentsForAjax' ), 100 ); |
|
64 | 64 | |
65 | 65 | } |
66 | 66 | |
@@ -73,13 +73,13 @@ discard block |
||
73 | 73 | */ |
74 | 74 | public function _replyToLoadComponentsForAjax() { |
75 | 75 | |
76 | - if ( ! $this->oProp->bIsAdminAjax ) { |
|
76 | + if ( !$this->oProp->bIsAdminAjax ) { |
|
77 | 77 | return; |
78 | 78 | } |
79 | 79 | |
80 | 80 | new AdminPageFramework_Model_Menu__RegisterMenu( $this, 'pseudo_admin_menu' ); |
81 | 81 | do_action( 'pseudo_admin_menu', '' ); |
82 | - do_action( 'pseudo_current_screen' ); // @deprecated 3.8.22 Kept for backward-compatibility |
|
82 | + do_action( 'pseudo_current_screen' ); // @deprecated 3.8.22 Kept for backward-compatibility |
|
83 | 83 | |
84 | 84 | $_sPageSlug = $this->oProp->getCurrentPageSlug(); |
85 | 85 | if ( $this->oProp->isPageAdded( $_sPageSlug ) ) { |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | * @param array the argument array. The first element holds the parameters passed to the called method. |
126 | 126 | * @return mixed depends on the called method. If the method name matches one of the hook prefixes, the redirected methods return value will be returned. Otherwise, none. |
127 | 127 | */ |
128 | - public function __call( $sMethodName, $aArgs=null ) { |
|
128 | + public function __call( $sMethodName, $aArgs = null ) { |
|
129 | 129 | |
130 | 130 | $_sPageSlug = $this->oProp->getCurrentPageSlug(); |
131 | 131 | $_sTabSlug = $this->oProp->getCurrentTabSlug( $_sPageSlug ); |
@@ -136,15 +136,15 @@ discard block |
||
136 | 136 | 'load_pre_', |
137 | 137 | ); |
138 | 138 | |
139 | - switch( $this->_getCallbackName( $sMethodName, $_sPageSlug, $_aKnownMethodPrefixes ) ) { |
|
139 | + switch ( $this->_getCallbackName( $sMethodName, $_sPageSlug, $_aKnownMethodPrefixes ) ) { |
|
140 | 140 | |
141 | 141 | // add_settings_section() callback |
142 | 142 | case 'section_pre_': |
143 | - return $this->_renderSectionDescription( $sMethodName ); // defined in AdminPageFramework_Setting |
|
143 | + return $this->_renderSectionDescription( $sMethodName ); // defined in AdminPageFramework_Setting |
|
144 | 144 | |
145 | 145 | // add_settings_field() callback |
146 | 146 | case 'field_pre_': |
147 | - return $this->_renderSettingField( $_mFirstArg, $_sPageSlug ); // defined in AdminPageFramework_Setting |
|
147 | + return $this->_renderSettingField( $_mFirstArg, $_sPageSlug ); // defined in AdminPageFramework_Setting |
|
148 | 148 | |
149 | 149 | // load-{page} callback |
150 | 150 | case 'load_pre_': |
@@ -162,8 +162,8 @@ discard block |
||
162 | 162 | * @since 3.5.3 |
163 | 163 | * @return string The found callback method name or the prefix of a known callback method name. An empty string if not found. |
164 | 164 | */ |
165 | - private function _getCallbackName( $sMethodName, $sPageSlug, array $aKnownMethodPrefixes=array() ) { |
|
166 | - foreach( $aKnownMethodPrefixes as $_sMethodPrefix ) { |
|
165 | + private function _getCallbackName( $sMethodName, $sPageSlug, array $aKnownMethodPrefixes = array() ) { |
|
166 | + foreach ( $aKnownMethodPrefixes as $_sMethodPrefix ) { |
|
167 | 167 | if ( $this->oUtil->hasPrefix( $_sMethodPrefix, $sMethodName ) ) { |
168 | 168 | return $_sMethodPrefix; |
169 | 169 | } |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | */ |
183 | 183 | protected function _doPageLoadCall( $sMethodName, $sPageSlug, $sTabSlug, $oScreen ) { |
184 | 184 | |
185 | - if ( ! $this->_isPageLoadCall( $sMethodName, $sPageSlug, $oScreen ) ) { |
|
185 | + if ( !$this->_isPageLoadCall( $sMethodName, $sPageSlug, $oScreen ) ) { |
|
186 | 186 | return; |
187 | 187 | } |
188 | 188 | |
@@ -207,10 +207,10 @@ discard block |
||
207 | 207 | // the tab slug will be empty unless an in-page tab is added. |
208 | 208 | $sTabSlug = $this->oProp->getCurrentTabSlug( $sPageSlug ); |
209 | 209 | if ( strlen( $sTabSlug ) ) { |
210 | - $this->_setShowDebugInfoProperty( $sPageSlug, $sTabSlug ); // 3.8.8+ |
|
210 | + $this->_setShowDebugInfoProperty( $sPageSlug, $sTabSlug ); // 3.8.8+ |
|
211 | 211 | $this->oUtil->addAndDoActions( |
212 | 212 | $this, // the caller object |
213 | - array( "load_{$sPageSlug}_" . $sTabSlug ), |
|
213 | + array( "load_{$sPageSlug}_".$sTabSlug ), |
|
214 | 214 | $this // the admin page object - this lets third-party scripts use the framework methods. |
215 | 215 | ); |
216 | 216 | add_filter( 'admin_title', array( $this, '_replyToSetAdminPageTitleForTab' ), 1, 2 ); |
@@ -235,10 +235,10 @@ discard block |
||
235 | 235 | * And if the user wants to modify the property value manually, they can do so in the `load()` method. |
236 | 236 | * @since 3.8.8 |
237 | 237 | */ |
238 | - private function _setShowDebugInfoProperty( $sPageSlug, $sTabSlug='' ) { |
|
238 | + private function _setShowDebugInfoProperty( $sPageSlug, $sTabSlug = '' ) { |
|
239 | 239 | |
240 | 240 | // For the page, |
241 | - if ( ! strlen( $sTabSlug ) ) { |
|
241 | + if ( !strlen( $sTabSlug ) ) { |
|
242 | 242 | $this->oProp->bShowDebugInfo = $this->oUtil->getElement( |
243 | 243 | $this->oProp->aPages, |
244 | 244 | array( $sPageSlug, 'show_debug_info' ), |
@@ -283,7 +283,7 @@ discard block |
||
283 | 283 | if ( substr( $sMethodName, strlen( 'load_pre_' ) ) !== $sPageSlug ) { |
284 | 284 | return false; |
285 | 285 | } |
286 | - if ( ! isset( $this->oProp->aPageHooks[ $sPageSlug ] ) ) { |
|
286 | + if ( !isset( $this->oProp->aPageHooks[ $sPageSlug ] ) ) { |
|
287 | 287 | return false; |
288 | 288 | } |
289 | 289 | $_sPageHook = is_object( $osScreenORPageHook ) |
@@ -305,7 +305,7 @@ discard block |
||
305 | 305 | if ( $this->_isWordPressCoreAjaxRequest() ) { |
306 | 306 | return false; |
307 | 307 | } |
308 | - return ! is_network_admin(); // Nothing to do in the network admin area. |
|
308 | + return !is_network_admin(); // Nothing to do in the network admin area. |
|
309 | 309 | } |
310 | 310 | |
311 | 311 | /** |
@@ -319,13 +319,13 @@ discard block |
||
319 | 319 | */ |
320 | 320 | protected function _isInThePage() { |
321 | 321 | |
322 | - if ( ! $this->oProp->bIsAdmin ) { |
|
322 | + if ( !$this->oProp->bIsAdmin ) { |
|
323 | 323 | return false; |
324 | 324 | } |
325 | 325 | |
326 | 326 | // If the `setUp()` method is not loaded yet, nothing can be checked |
327 | 327 | // as there is no page is added. |
328 | - if ( ! did_action( 'set_up_' . $this->oProp->sClassName ) ) { |
|
328 | + if ( !did_action( 'set_up_'.$this->oProp->sClassName ) ) { |
|
329 | 329 | return true; |
330 | 330 | } |
331 | 331 |
@@ -29,8 +29,8 @@ discard block |
||
29 | 29 | 'page_slug' => null, // (required) |
30 | 30 | 'type' => 'page', // this is used to compare with the link type. |
31 | 31 | 'title' => null, |
32 | - 'page_title' => null, // (optional) 3.3.0+ When the page title is different from the above 'title' argument, set this. |
|
33 | - 'menu_title' => null, // (optional) 3.3.0+ When the menu title is different from the above 'title' argument, set this. |
|
32 | + 'page_title' => null, // (optional) 3.3.0+ When the page title is different from the above 'title' argument, set this. |
|
33 | + 'menu_title' => null, // (optional) 3.3.0+ When the menu title is different from the above 'title' argument, set this. |
|
34 | 34 | 'screen_icon' => null, // this will become either href_icon_32x32 or screen_icon_id |
35 | 35 | 'capability' => null, |
36 | 36 | 'order' => null, |
@@ -118,12 +118,12 @@ discard block |
||
118 | 118 | |
119 | 119 | $aSubMenuPage = $aSubMenuPage |
120 | 120 | + array( |
121 | - 'show_page_title' => $this->oFactory->oProp->bShowPageTitle, // boolean |
|
121 | + 'show_page_title' => $this->oFactory->oProp->bShowPageTitle, // boolean |
|
122 | 122 | 'show_page_heading_tabs' => $this->oFactory->oProp->bShowPageHeadingTabs, // boolean |
123 | - 'show_in_page_tabs' => $this->oFactory->oProp->bShowInPageTabs, // boolean |
|
124 | - 'in_page_tab_tag' => $this->oFactory->oProp->sInPageTabTag, // string |
|
125 | - 'page_heading_tab_tag' => $this->oFactory->oProp->sPageHeadingTabTag, // string |
|
126 | - 'capability' => $this->oFactory->oProp->sCapability, // 3.6.0+ |
|
123 | + 'show_in_page_tabs' => $this->oFactory->oProp->bShowInPageTabs, // boolean |
|
124 | + 'in_page_tab_tag' => $this->oFactory->oProp->sInPageTabTag, // string |
|
125 | + 'page_heading_tab_tag' => $this->oFactory->oProp->sPageHeadingTabTag, // string |
|
126 | + 'capability' => $this->oFactory->oProp->sCapability, // 3.6.0+ |
|
127 | 127 | ) |
128 | 128 | + self::$aStructure; |
129 | 129 |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | $this->oFactory |
89 | 89 | ), |
90 | 90 | 'aStoredTabDataWODynamicElements' => array(), |
91 | - 'aEmbeddedDataWODynamicElements' => array(), // stores page meta box field options. This will be updated inside the validation methods. |
|
91 | + 'aEmbeddedDataWODynamicElements' => array(), // stores page meta box field options. This will be updated inside the validation methods. |
|
92 | 92 | 'aSubmitInformation' => $aSubmitInformation, // 3.5.0+ |
93 | 93 | ); |
94 | 94 | |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | call_user_func_array( |
104 | 104 | array( $this->oFactory, 'validate' ), // triggers __call() |
105 | 105 | array( $_aData[ 'aInput' ], $_aData[ 'aStoredData' ], $this->oFactory, $_aData[ 'aSubmitInformation' ] ) |
106 | - ), // 3.5.3+ |
|
106 | + ), // 3.5.3+ |
|
107 | 107 | $_aData[ 'aStoredData' ], |
108 | 108 | $_aData[ 'aSubmitInformation' ] // 3.5.0+ |
109 | 109 | ); |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | |
116 | 116 | // If everything fine, return the filtered input data. |
117 | 117 | $this->_bHasFieldErrors = $this->oFactory->hasFieldError(); |
118 | - if ( ! $this->_bHasFieldErrors ) { |
|
118 | + if ( !$this->_bHasFieldErrors ) { |
|
119 | 119 | return $_aInput; |
120 | 120 | } |
121 | 121 | |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | ); |
130 | 130 | |
131 | 131 | // Go to the catch clause. |
132 | - $_oException = new Exception( 'aReturn' ); // the property name to return from the catch clause. |
|
132 | + $_oException = new Exception( 'aReturn' ); // the property name to return from the catch clause. |
|
133 | 133 | $_oException->aReturn = $_aInput; |
134 | 134 | throw $_oException; |
135 | 135 | |
@@ -153,22 +153,22 @@ discard block |
||
153 | 153 | */ |
154 | 154 | private function ___validateEachField( array $aData, array $aInputsToParse ) { |
155 | 155 | |
156 | - foreach( $aInputsToParse as $_sID => $_aSectionOrFields ) { // $_sID is either a section id or a field id |
|
156 | + foreach ( $aInputsToParse as $_sID => $_aSectionOrFields ) { // $_sID is either a section id or a field id |
|
157 | 157 | |
158 | 158 | // For each section |
159 | 159 | if ( $this->oFactory->oForm->isSection( $_sID ) ) { |
160 | 160 | |
161 | 161 | // If the parsing item does not belong to the current page, do not call the validation callback method. |
162 | - if ( ! $this->___isValidSection( $_sID, $aData[ 'sPageSlug' ], $aData[ 'sTabSlug' ] ) ) { |
|
162 | + if ( !$this->___isValidSection( $_sID, $aData[ 'sPageSlug' ], $aData[ 'sTabSlug' ] ) ) { |
|
163 | 163 | continue; |
164 | 164 | } |
165 | 165 | |
166 | 166 | // Call the validation callback method. |
167 | - foreach( $_aSectionOrFields as $_sFieldID => $_aFields ) { // For fields |
|
167 | + foreach ( $_aSectionOrFields as $_sFieldID => $_aFields ) { // For fields |
|
168 | 168 | $aData[ 'aInput' ][ $_sID ][ $_sFieldID ] = $this->___getValidatedData( |
169 | 169 | "validation_{$this->oFactory->oProp->sClassName}_{$_sID}_{$_sFieldID}", |
170 | 170 | $aData[ 'aInput' ][ $_sID ][ $_sFieldID ], |
171 | - $this->getElement( $aData, array( 'aStoredData', $_sID, $_sFieldID ), null ), // isset( $aData[ 'aStoredData' ][ $_sID ][ $_sFieldID ] ) ? $aData[ 'aStoredData' ][ $_sID ][ $_sFieldID ] : null, |
|
171 | + $this->getElement( $aData, array( 'aStoredData', $_sID, $_sFieldID ), null ), // isset( $aData[ 'aStoredData' ][ $_sID ][ $_sFieldID ] ) ? $aData[ 'aStoredData' ][ $_sID ][ $_sFieldID ] : null, |
|
172 | 172 | $aData[ 'aSubmitInformation' ] // 3.5.0+ |
173 | 173 | ); |
174 | 174 | } |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | $aData[ 'aInput' ][ $_sID ] = $this->___getValidatedData( |
190 | 190 | "validation_{$this->oFactory->oProp->sClassName}_{$_sID}", |
191 | 191 | $_aSectionInput, |
192 | - $this->getElement( $aData, array( 'aStoredData', $_sID ), null ), // isset( $aData[ 'aStoredData' ][ $_sID ] ) ? $aData[ 'aStoredData' ][ $_sID ] : null, |
|
192 | + $this->getElement( $aData, array( 'aStoredData', $_sID ), null ), // isset( $aData[ 'aStoredData' ][ $_sID ] ) ? $aData[ 'aStoredData' ][ $_sID ] : null, |
|
193 | 193 | $aData[ 'aSubmitInformation' ] |
194 | 194 | ); |
195 | 195 | |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | } |
199 | 199 | |
200 | 200 | // Check if the parsing item (the default section) belongs to the current page; if not, do not call the validation callback method. |
201 | - if ( ! $this->___isValidSection( '_default', $aData[ 'sPageSlug' ], $aData[ 'sTabSlug' ] ) ) { |
|
201 | + if ( !$this->___isValidSection( '_default', $aData[ 'sPageSlug' ], $aData[ 'sTabSlug' ] ) ) { |
|
202 | 202 | continue; |
203 | 203 | } |
204 | 204 | |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | $aData[ 'aInput' ][ $_sID ] = $this->___getValidatedData( |
207 | 207 | "validation_{$this->oFactory->oProp->sClassName}_{$_sID}", |
208 | 208 | $aData[ 'aInput' ][ $_sID ], |
209 | - $this->getElement( $aData, array( 'aStoredData', $_sID ), null ), // isset( $aData[ 'aStoredData' ][ $_sID ] ) ? $aData[ 'aStoredData' ][ $_sID ] : null, |
|
209 | + $this->getElement( $aData, array( 'aStoredData', $_sID ), null ), // isset( $aData[ 'aStoredData' ][ $_sID ] ) ? $aData[ 'aStoredData' ][ $_sID ] : null, |
|
210 | 210 | $aData[ 'aSubmitInformation' ] |
211 | 211 | ); |
212 | 212 | |
@@ -248,22 +248,22 @@ discard block |
||
248 | 248 | */ |
249 | 249 | private function ___validateTabFields( array $aData ) { |
250 | 250 | |
251 | - if ( ! $aData[ 'sTabSlug' ] || ! $aData[ 'sPageSlug' ] ) { |
|
251 | + if ( !$aData[ 'sTabSlug' ] || !$aData[ 'sPageSlug' ] ) { |
|
252 | 252 | return $aData; |
253 | 253 | } |
254 | 254 | |
255 | - $aData[ 'aStoredTabData' ] = $this->oFactory->oForm->getTabOptions( |
|
255 | + $aData[ 'aStoredTabData' ] = $this->oFactory->oForm->getTabOptions( |
|
256 | 256 | $aData[ 'aStoredData' ], |
257 | 257 | $aData[ 'sPageSlug' ], |
258 | 258 | $aData[ 'sTabSlug' ] |
259 | 259 | ); // respects page meta box fields |
260 | - $aData[ 'aStoredTabData' ] = $this->addAndApplyFilter( |
|
260 | + $aData[ 'aStoredTabData' ] = $this->addAndApplyFilter( |
|
261 | 261 | $this->oFactory, |
262 | 262 | "validation_saved_options_{$aData[ 'sPageSlug' ]}_{$aData[ 'sTabSlug' ]}", |
263 | 263 | $aData[ 'aStoredTabData' ], |
264 | 264 | $this->oFactory |
265 | 265 | ); |
266 | - $_aOtherTabOptions = $this->oFactory->oForm->getOtherTabOptions( |
|
266 | + $_aOtherTabOptions = $this->oFactory->oForm->getOtherTabOptions( |
|
267 | 267 | $aData[ 'aStoredData' ], |
268 | 268 | $aData[ 'sPageSlug' ], |
269 | 269 | $aData[ 'sTabSlug' ] |
@@ -317,7 +317,7 @@ discard block |
||
317 | 317 | */ |
318 | 318 | private function ___validatePageFields( array $aData ) { |
319 | 319 | |
320 | - if ( ! $aData[ 'sPageSlug' ] ) { |
|
320 | + if ( !$aData[ 'sPageSlug' ] ) { |
|
321 | 321 | return $aData[ 'aInput' ]; |
322 | 322 | } |
323 | 323 | |
@@ -329,7 +329,7 @@ discard block |
||
329 | 329 | $_aPageOptionsWODynamicElements = $this->addAndApplyFilter( |
330 | 330 | $this->oFactory, |
331 | 331 | "validation_saved_options_without_dynamic_elements_{$aData[ 'sPageSlug' ]}", |
332 | - $this->oFactory->oForm->getPageOptions( $aData[ 'aStoredDataWODynamicElements' ], $aData[ 'sPageSlug' ] ), // united with the in-page tab specific data in order to override the page-specific dynamic elements. |
|
332 | + $this->oFactory->oForm->getPageOptions( $aData[ 'aStoredDataWODynamicElements' ], $aData[ 'sPageSlug' ] ), // united with the in-page tab specific data in order to override the page-specific dynamic elements. |
|
333 | 333 | $this->oFactory |
334 | 334 | ); |
335 | 335 | |
@@ -342,15 +342,15 @@ discard block |
||
342 | 342 | // Validate the input data. |
343 | 343 | $aData[ 'aInput' ] = $this->___getValidatedData( |
344 | 344 | "validation_{$aData[ 'sPageSlug' ]}", |
345 | - $aData[ 'aInput' ], // new values |
|
346 | - $_aPageOptions, // stored page options |
|
345 | + $aData[ 'aInput' ], // new values |
|
346 | + $_aPageOptions, // stored page options |
|
347 | 347 | $aData[ 'aSubmitInformation' ] // submit information 3.5.0+ |
348 | 348 | ); |
349 | 349 | |
350 | 350 | // If it's in a tab-page, drop the elements which belong to the tab so that arrayed-options will not be merged such as multiple select options. |
351 | - $_aPageOptions = $aData[ 'sTabSlug' ] && ! empty( $aData[ 'aStoredTabData' ] ) |
|
351 | + $_aPageOptions = $aData[ 'sTabSlug' ] && !empty( $aData[ 'aStoredTabData' ] ) |
|
352 | 352 | ? $this->invertCastArrayContents( $_aPageOptions, $aData[ 'aStoredTabData' ] ) |
353 | - : ( ! $aData[ 'sTabSlug' ] // if the tab is not specified, do not merge the input array with the page options as the input array already includes the page options. This is for dynamic elements(repeatable sections). |
|
353 | + : ( !$aData[ 'sTabSlug' ] // if the tab is not specified, do not merge the input array with the page options as the input array already includes the page options. This is for dynamic elements(repeatable sections). |
|
354 | 354 | ? array() |
355 | 355 | : $_aPageOptions |
356 | 356 | ); |
@@ -397,13 +397,13 @@ discard block |
||
397 | 397 | * @param array $aStoredData The stored option. |
398 | 398 | * @param array $aSubmitInfo [3.5.0+] The form submit information such as the field ID of the pressed submit field. |
399 | 399 | */ |
400 | - private function ___getValidatedData( $sFilterName, $aInputs, $aStoredData, $aSubmitInfo=array() ) { |
|
400 | + private function ___getValidatedData( $sFilterName, $aInputs, $aStoredData, $aSubmitInfo = array() ) { |
|
401 | 401 | return $this->addAndApplyFilter( |
402 | - $this->oFactory, // caller |
|
403 | - $sFilterName, // hook name |
|
404 | - $aInputs, // 1st argument |
|
405 | - $aStoredData, // 2nd argument |
|
406 | - $this->oFactory, // 3rd argument |
|
402 | + $this->oFactory, // caller |
|
403 | + $sFilterName, // hook name |
|
404 | + $aInputs, // 1st argument |
|
405 | + $aStoredData, // 2nd argument |
|
406 | + $this->oFactory, // 3rd argument |
|
407 | 407 | $aSubmitInfo // 4th argument 3.5.0+ |
408 | 408 | ); |
409 | 409 | } |
@@ -153,7 +153,8 @@ discard block |
||
153 | 153 | */ |
154 | 154 | private function ___validateEachField( array $aData, array $aInputsToParse ) { |
155 | 155 | |
156 | - foreach( $aInputsToParse as $_sID => $_aSectionOrFields ) { // $_sID is either a section id or a field id |
|
156 | + foreach( $aInputsToParse as $_sID => $_aSectionOrFields ) { |
|
157 | +// $_sID is either a section id or a field id |
|
157 | 158 | |
158 | 159 | // For each section |
159 | 160 | if ( $this->oFactory->oForm->isSection( $_sID ) ) { |
@@ -164,7 +165,8 @@ discard block |
||
164 | 165 | } |
165 | 166 | |
166 | 167 | // Call the validation callback method. |
167 | - foreach( $_aSectionOrFields as $_sFieldID => $_aFields ) { // For fields |
|
168 | + foreach( $_aSectionOrFields as $_sFieldID => $_aFields ) { |
|
169 | +// For fields |
|
168 | 170 | $aData[ 'aInput' ][ $_sID ][ $_sFieldID ] = $this->___getValidatedData( |
169 | 171 | "validation_{$this->oFactory->oProp->sClassName}_{$_sID}_{$_sFieldID}", |
170 | 172 | $aData[ 'aInput' ][ $_sID ][ $_sFieldID ], |
@@ -248,7 +250,7 @@ discard block |
||
248 | 250 | */ |
249 | 251 | private function ___validateTabFields( array $aData ) { |
250 | 252 | |
251 | - if ( ! $aData[ 'sTabSlug' ] || ! $aData[ 'sPageSlug' ] ) { |
|
253 | + if ( ! $aData[ 'sTabSlug' ] || ! $aData[ 'sPageSlug' ] ) { |
|
252 | 254 | return $aData; |
253 | 255 | } |
254 | 256 | |
@@ -317,7 +319,7 @@ discard block |
||
317 | 319 | */ |
318 | 320 | private function ___validatePageFields( array $aData ) { |
319 | 321 | |
320 | - if ( ! $aData[ 'sPageSlug' ] ) { |
|
322 | + if ( ! $aData[ 'sPageSlug' ] ) { |
|
321 | 323 | return $aData[ 'aInput' ]; |
322 | 324 | } |
323 | 325 |