@@ -173,6 +173,7 @@ discard block |
||
173 | 173 | * Returns the repeatable fields script. |
174 | 174 | * |
175 | 175 | * @since 2.1.3 |
176 | + * @param string $sFieldsContainerID |
|
176 | 177 | */ |
177 | 178 | protected function _getRepeaterFieldEnablerScript( $sFieldsContainerID, $iFieldCount, $aSettings ) { |
178 | 179 | |
@@ -261,6 +262,7 @@ discard block |
||
261 | 262 | /** |
262 | 263 | * @since 3.8.13 |
263 | 264 | * @param array $aArguments |
265 | + * @param string $sSmallButtonSelector |
|
264 | 266 | * @return string |
265 | 267 | */ |
266 | 268 | private function ___getAddButtonAttribtes( $aArguments, $sFieldsContainerID, $sSmallButtonSelector ) { |
@@ -279,7 +281,7 @@ discard block |
||
279 | 281 | } |
280 | 282 | /** |
281 | 283 | * @since 3.8.13 |
282 | - * @param array $aArguments |
|
284 | + * @param string $sSmallButtonSelector |
|
283 | 285 | * @return string |
284 | 286 | */ |
285 | 287 | private function ___getRemoveButtonAttributes( $sFieldsContainerID, $sSmallButtonSelector, $iFieldCount ) { |
@@ -323,6 +325,7 @@ discard block |
||
323 | 325 | * Returns the sortable fields script. |
324 | 326 | * |
325 | 327 | * @since 3.0.0 |
328 | + * @param string $sFieldsContainerID |
|
326 | 329 | */ |
327 | 330 | protected function _getSortableFieldEnablerScript( $sFieldsContainerID ) { |
328 | 331 |
@@ -272,8 +272,8 @@ discard block |
||
272 | 272 | 'href' => empty( $aArguments[ 'disabled' ] ) |
273 | 273 | ? null |
274 | 274 | : '#TB_inline?width=' . $aArguments[ 'disabled' ][ 'box_width' ] |
275 | - . '&height=' . $aArguments[ 'disabled' ][ 'box_height' ] |
|
276 | - . '&inlineId=' . 'repeatable_field_disabled_' . $sFieldsContainerID, |
|
275 | + . '&height=' . $aArguments[ 'disabled' ][ 'box_height' ] |
|
276 | + . '&inlineId=' . 'repeatable_field_disabled_' . $sFieldsContainerID, |
|
277 | 277 | ); |
278 | 278 | return $this->getAttributes( $_sPlusButtonAttributes ); |
279 | 279 | } |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | private function ___getRemoveButtonAttributes( $sFieldsContainerID, $sSmallButtonSelector, $iFieldCount ) { |
286 | 286 | $_aMinusButtonAttributes = array( |
287 | 287 | 'class' => 'repeatable-field-remove-button button-secondary repeatable-field-button button' |
288 | - . $sSmallButtonSelector, |
|
288 | + . $sSmallButtonSelector, |
|
289 | 289 | 'title' => $this->oMsg->get( 'remove' ), |
290 | 290 | 'style' => $iFieldCount <= 1 |
291 | 291 | ? 'visibility: hidden' |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | * @param object $oMsg An object storing the system messages. |
68 | 68 | * @param array $aCallbacks An array storing the form-field specific callbacks. |
69 | 69 | */ |
70 | - public function __construct( $aFieldset, $aOptions, $aErrors, &$aFieldTypeDefinitions, &$oMsg, array $aCallbacks=array() ) { |
|
70 | + public function __construct( $aFieldset, $aOptions, $aErrors, &$aFieldTypeDefinitions, &$oMsg, array $aCallbacks = array() ) { |
|
71 | 71 | |
72 | 72 | // Set up the properties that will be accessed later in the methods. |
73 | 73 | $this->aFieldset = $this->_getFormatted( $aFieldset, $aFieldTypeDefinitions ); |
@@ -76,13 +76,13 @@ discard block |
||
76 | 76 | $this->aErrors = $this->getAsArray( $aErrors ); |
77 | 77 | $this->oMsg = $oMsg; |
78 | 78 | $this->aCallbacks = $aCallbacks + array( |
79 | - 'hfID' => null, // the input id attribute |
|
80 | - 'hfTagID' => null, // the fieldset/field row container id attribute |
|
81 | - 'hfName' => null, // the input name attribute |
|
82 | - 'hfNameFlat' => null, // the flat input name attribute |
|
79 | + 'hfID' => null, // the input id attribute |
|
80 | + 'hfTagID' => null, // the fieldset/field row container id attribute |
|
81 | + 'hfName' => null, // the input name attribute |
|
82 | + 'hfNameFlat' => null, // the flat input name attribute |
|
83 | 83 | 'hfInputName' => null, |
84 | 84 | 'hfInputNameFlat' => null, |
85 | - 'hfClass' => null, // the class attribute |
|
85 | + 'hfClass' => null, // the class attribute |
|
86 | 86 | ); |
87 | 87 | |
88 | 88 | // 2. Load necessary JavaScript scripts. |
@@ -149,9 +149,9 @@ discard block |
||
149 | 149 | * @since 3.2.0 Added the `$sFieldsType` parameter. |
150 | 150 | * @internal |
151 | 151 | */ |
152 | - private function _loadScripts( $sStructureType='' ) { |
|
152 | + private function _loadScripts( $sStructureType = '' ) { |
|
153 | 153 | |
154 | - if ( 'widget' === $sStructureType && ! self::$_bIsLoadedJSScripts_Widget ) { |
|
154 | + if ( 'widget' === $sStructureType && !self::$_bIsLoadedJSScripts_Widget ) { |
|
155 | 155 | new AdminPageFramework_Form_View___Script_Widget; |
156 | 156 | self::$_bIsLoadedJSScripts_Widget = true; |
157 | 157 | } |
@@ -176,8 +176,8 @@ discard block |
||
176 | 176 | */ |
177 | 177 | protected function _getRepeaterFieldEnablerScript( $sFieldsContainerID, $iFieldCount, $aSettings ) { |
178 | 178 | |
179 | - $_sSmallButtons = '"' . $this->___getRepeatableButtonHTML( $sFieldsContainerID, ( array ) $aSettings, $iFieldCount, true ) . '"'; |
|
180 | - $_sNestedFieldsButtons = '"' . $this->___getRepeatableButtonHTML( $sFieldsContainerID, ( array ) $aSettings, $iFieldCount, false ) . '"'; |
|
179 | + $_sSmallButtons = '"'.$this->___getRepeatableButtonHTML( $sFieldsContainerID, ( array ) $aSettings, $iFieldCount, true ).'"'; |
|
180 | + $_sNestedFieldsButtons = '"'.$this->___getRepeatableButtonHTML( $sFieldsContainerID, ( array ) $aSettings, $iFieldCount, false ).'"'; |
|
181 | 181 | $_aJSArray = json_encode( $aSettings ); |
182 | 182 | $_sScript = <<<JAVASCRIPTS |
183 | 183 | jQuery( document ).ready( function() { |
@@ -223,36 +223,36 @@ discard block |
||
223 | 223 | * @since 3.8.0 |
224 | 224 | * @return string |
225 | 225 | */ |
226 | - private function ___getRepeatableButtonHTML( $sFieldsContainerID, array $aArguments, $iFieldCount, $bSmall=true ) { |
|
226 | + private function ___getRepeatableButtonHTML( $sFieldsContainerID, array $aArguments, $iFieldCount, $bSmall = true ) { |
|
227 | 227 | |
228 | 228 | // @todo Move this formatting routine to the field-set formatter class. |
229 | 229 | $_oFormatter = new AdminPageFramework_Form_Model___Format_RepeatableField( $aArguments, $this->oMsg ); |
230 | 230 | $_aArguments = $_oFormatter->get(); |
231 | 231 | $_sSmallButtonSelector = $bSmall ? ' button-small' : ''; |
232 | 232 | if ( version_compare( $GLOBALS[ 'wp_version' ], '5.3', '>=' ) ) { |
233 | - return "<div " . $this->___getContainerAttributes( $_aArguments ) . " >" |
|
234 | - . "<a " . $this->___getRemoveButtonAttributes( $sFieldsContainerID, $_sSmallButtonSelector, $iFieldCount ) . ">" |
|
233 | + return "<div ".$this->___getContainerAttributes( $_aArguments )." >" |
|
234 | + . "<a ".$this->___getRemoveButtonAttributes( $sFieldsContainerID, $_sSmallButtonSelector, $iFieldCount ).">" |
|
235 | 235 | . "<span class='dashicons dashicons-minus'></span>" |
236 | 236 | . "</a>" |
237 | - . "<a " . $this->___getAddButtonAttribtes( $_aArguments, $sFieldsContainerID, $_sSmallButtonSelector ) . ">" |
|
237 | + . "<a ".$this->___getAddButtonAttribtes( $_aArguments, $sFieldsContainerID, $_sSmallButtonSelector ).">" |
|
238 | 238 | . "<span class='dashicons dashicons-plus-alt2'></span>" |
239 | 239 | ."</a>" |
240 | 240 | . "</div>" |
241 | 241 | . $this->getModalForDisabledRepeatableElement( |
242 | - 'repeatable_field_disabled_' . $sFieldsContainerID, |
|
242 | + 'repeatable_field_disabled_'.$sFieldsContainerID, |
|
243 | 243 | $_aArguments[ 'disabled' ] |
244 | 244 | ); |
245 | 245 | } |
246 | - return "<div " . $this->___getContainerAttributes( $_aArguments ) . " >" |
|
247 | - . "<a " . $this->___getRemoveButtonAttributes( $sFieldsContainerID, $_sSmallButtonSelector, $iFieldCount ) . ">" |
|
246 | + return "<div ".$this->___getContainerAttributes( $_aArguments )." >" |
|
247 | + . "<a ".$this->___getRemoveButtonAttributes( $sFieldsContainerID, $_sSmallButtonSelector, $iFieldCount ).">" |
|
248 | 248 | . "-" |
249 | 249 | . "</a>" |
250 | - . "<a " . $this->___getAddButtonAttribtes( $_aArguments, $sFieldsContainerID, $_sSmallButtonSelector ) . ">" |
|
250 | + . "<a ".$this->___getAddButtonAttribtes( $_aArguments, $sFieldsContainerID, $_sSmallButtonSelector ).">" |
|
251 | 251 | . "+" |
252 | 252 | ."</a>" |
253 | 253 | . "</div>" |
254 | 254 | . $this->getModalForDisabledRepeatableElement( |
255 | - 'repeatable_field_disabled_' . $sFieldsContainerID, |
|
255 | + 'repeatable_field_disabled_'.$sFieldsContainerID, |
|
256 | 256 | $_aArguments[ 'disabled' ] |
257 | 257 | ); |
258 | 258 | |
@@ -271,9 +271,9 @@ discard block |
||
271 | 271 | 'data-id' => $sFieldsContainerID, |
272 | 272 | 'href' => empty( $aArguments[ 'disabled' ] ) |
273 | 273 | ? null |
274 | - : '#TB_inline?width=' . $aArguments[ 'disabled' ][ 'box_width' ] |
|
275 | - . '&height=' . $aArguments[ 'disabled' ][ 'box_height' ] |
|
276 | - . '&inlineId=' . 'repeatable_field_disabled_' . $sFieldsContainerID, |
|
274 | + : '#TB_inline?width='.$aArguments[ 'disabled' ][ 'box_width' ] |
|
275 | + . '&height='.$aArguments[ 'disabled' ][ 'box_height' ] |
|
276 | + . '&inlineId='.'repeatable_field_disabled_'.$sFieldsContainerID, |
|
277 | 277 | ); |
278 | 278 | return $this->getAttributes( $_sPlusButtonAttributes ); |
279 | 279 | } |
@@ -300,10 +300,10 @@ discard block |
||
300 | 300 | * @return string |
301 | 301 | */ |
302 | 302 | private function ___getContainerAttributes( $aArguments ) { |
303 | - $_aContainerAttributes = array( |
|
303 | + $_aContainerAttributes = array( |
|
304 | 304 | 'class' => $this->getClassAttribute( |
305 | 305 | 'admin-page-framework-repeatable-field-buttons', |
306 | - ! empty( $aArguments[ 'disabled' ] ) |
|
306 | + !empty( $aArguments[ 'disabled' ] ) |
|
307 | 307 | ? 'disabled' |
308 | 308 | : '' |
309 | 309 | ), |
@@ -316,7 +316,7 @@ discard block |
||
316 | 316 | unset( $aArguments[ 'disabled' ] ); |
317 | 317 | } |
318 | 318 | return $this->getAttributes( $_aContainerAttributes ) |
319 | - . ' ' . $this->getDataAttributes( $aArguments ); |
|
319 | + . ' '.$this->getDataAttributes( $aArguments ); |
|
320 | 320 | } |
321 | 321 | |
322 | 322 | /** |
@@ -146,6 +146,7 @@ discard block |
||
146 | 146 | /** |
147 | 147 | * @since 3.8.9 |
148 | 148 | * @since 3.8.22 Renamed from `_getLegibleValue()`. |
149 | + * @param integer $iStringLengthLimit |
|
149 | 150 | * @return string |
150 | 151 | */ |
151 | 152 | static private function ___getLegibleDetailedValue( $mItem, $iStringLengthLimit ) { |
@@ -314,6 +315,7 @@ discard block |
||
314 | 315 | /** |
315 | 316 | * Performs `array_map()` recursively. |
316 | 317 | * @remark Accepts arguments. |
318 | + * @param string[] $oCallable |
|
317 | 319 | * @return array |
318 | 320 | * @since 3.8.9 |
319 | 321 | */ |
@@ -266,7 +266,7 @@ |
||
266 | 266 | * @since 3.8.22 |
267 | 267 | */ |
268 | 268 | static public function getSlicedByDepth( array $aSubject, $iDepth=0, $sMore='(array truncated) ...' ) { |
269 | - return self::_getSlicedByDepth( $aSubject, $iDepth, $sMore ); |
|
269 | + return self::_getSlicedByDepth( $aSubject, $iDepth, $sMore ); |
|
270 | 270 | } |
271 | 271 | |
272 | 272 | /** |
@@ -34,10 +34,10 @@ discard block |
||
34 | 34 | * @since 3.8.9 |
35 | 35 | * @return string |
36 | 36 | */ |
37 | - static protected function _getLegibleDetails( $mValue, $iStringLengthLimit=0, $iArrayDepthLimit=0 ) { |
|
37 | + static protected function _getLegibleDetails( $mValue, $iStringLengthLimit = 0, $iArrayDepthLimit = 0 ) { |
|
38 | 38 | if ( is_array( $mValue ) ) { |
39 | - return '(array, length: ' . count( $mValue ).') ' |
|
40 | - . print_r( self::___getLegibleDetailedArray( $mValue, $iStringLengthLimit, $iArrayDepthLimit ) , true ); |
|
39 | + return '(array, length: '.count( $mValue ).') ' |
|
40 | + . print_r( self::___getLegibleDetailedArray( $mValue, $iStringLengthLimit, $iArrayDepthLimit ), true ); |
|
41 | 41 | } |
42 | 42 | return print_r( self::___getLegibleDetailedValue( $mValue, $iStringLengthLimit ), true ); |
43 | 43 | } |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | * @since 3.8.22 Added the `$sStringLengthLimit` and `$iArrayDepthLimit` parameters. |
50 | 50 | * @return string |
51 | 51 | */ |
52 | - static protected function _getLegible( $mValue, $iStringLengthLimit=0, $iArrayDepthLimit=0 ) { |
|
52 | + static protected function _getLegible( $mValue, $iStringLengthLimit = 0, $iArrayDepthLimit = 0 ) { |
|
53 | 53 | |
54 | 54 | $iArrayDepthLimit = $iArrayDepthLimit ? $iArrayDepthLimit : self::$iLegibleArrayDepthLimit; |
55 | 55 | $mValue = is_object( $mValue ) |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | ) |
67 | 67 | : $mValue; |
68 | 68 | $mValue = is_string( $mValue ) |
69 | - ? self::___getLegibleString( $mValue, $iStringLengthLimit, false ) |
|
69 | + ? self::___getLegibleString( $mValue, $iStringLengthLimit, false ) |
|
70 | 70 | : $mValue; |
71 | 71 | return self::_getArrayRepresentationSanitized( print_r( $mValue, true ) ); |
72 | 72 | |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | */ |
81 | 81 | static private function ___getObjectName( $mItem ) { |
82 | 82 | if ( is_object( $mItem ) ) { |
83 | - return '(object) ' . get_class( $mItem ); |
|
83 | + return '(object) '.get_class( $mItem ); |
|
84 | 84 | } |
85 | 85 | return $mItem; |
86 | 86 | } |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | * @return string |
92 | 92 | */ |
93 | 93 | static private function ___getLegibleDetailedCallable( $asoCallable ) { |
94 | - return '(callable) ' . self::___getCallableName( $asoCallable ); |
|
94 | + return '(callable) '.self::___getCallableName( $asoCallable ); |
|
95 | 95 | } |
96 | 96 | /** |
97 | 97 | * @since 3.8.9 |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | $_sSubject = is_object( $asoCallable[ 0 ] ) |
110 | 110 | ? get_class( $asoCallable[ 0 ] ) |
111 | 111 | : ( string ) $asoCallable[ 0 ]; |
112 | - return $_sSubject . '::' . ( string ) $asoCallable[ 1 ]; |
|
112 | + return $_sSubject.'::'.( string ) $asoCallable[ 1 ]; |
|
113 | 113 | |
114 | 114 | } |
115 | 115 | |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | if ( method_exists( $oObject, '__toString' ) ) { |
124 | 124 | return ( string ) $oObject; |
125 | 125 | } |
126 | - return '(object) ' . get_class( $oObject ) . ' ' . count( get_object_vars( $oObject ) ) . ' properties.'; |
|
126 | + return '(object) '.get_class( $oObject ).' '.count( get_object_vars( $oObject ) ).' properties.'; |
|
127 | 127 | |
128 | 128 | } |
129 | 129 | /** |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | * @since 3.8.22 Renamed from `_getLegibleArray()`. |
136 | 136 | * @return array |
137 | 137 | */ |
138 | - static private function ___getLegibleDetailedArray( array $aArray, $iStringLengthLimit=0, $iDepthLimit=0 ) { |
|
138 | + static private function ___getLegibleDetailedArray( array $aArray, $iStringLengthLimit = 0, $iDepthLimit = 0 ) { |
|
139 | 139 | $_iDepthLimit = $iDepthLimit ? $iDepthLimit : self::$iLegibleArrayDepthLimit; |
140 | 140 | return self::___getArrayMappedRecursive( |
141 | 141 | self::_getSlicedByDepth( $aArray, $_iDepthLimit ), |
@@ -171,9 +171,9 @@ discard block |
||
171 | 171 | return self::___getLegibleDetailedObject( $mNonScalar ); |
172 | 172 | } |
173 | 173 | if ( is_array( $mNonScalar ) ) { |
174 | - return '(' . $_sType . ') ' . count( $mNonScalar ) . ' elements'; |
|
174 | + return '('.$_sType.') '.count( $mNonScalar ).' elements'; |
|
175 | 175 | } |
176 | - return '(' . $_sType . ') ' . ( string ) $mNonScalar; |
|
176 | + return '('.$_sType.') '.( string ) $mNonScalar; |
|
177 | 177 | |
178 | 178 | } |
179 | 179 | /** |
@@ -185,11 +185,11 @@ discard block |
||
185 | 185 | */ |
186 | 186 | static private function ___getLegibleDetailedScalar( $sScalar, $iStringLengthLimit ) { |
187 | 187 | if ( is_bool( $sScalar ) ) { |
188 | - return '(boolean) ' . ( $sScalar ? 'true' : 'false' ); |
|
188 | + return '(boolean) '.( $sScalar ? 'true' : 'false' ); |
|
189 | 189 | } |
190 | 190 | return is_string( $sScalar ) |
191 | 191 | ? self::___getLegibleString( $sScalar, $iStringLengthLimit, true ) |
192 | - : '(' . gettype( $sScalar ) . ', length: ' . self::___getValueLength( $sScalar ) . ') ' . $sScalar; |
|
192 | + : '('.gettype( $sScalar ).', length: '.self::___getValueLength( $sScalar ).') '.$sScalar; |
|
193 | 193 | } |
194 | 194 | /** |
195 | 195 | * Returns a length of a value. |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | * @param boolean $bShowDetails |
214 | 214 | * @return string |
215 | 215 | */ |
216 | - static private function ___getLegibleString( $sString, $iLengthLimit, $bShowDetails=true ) { |
|
216 | + static private function ___getLegibleString( $sString, $iLengthLimit, $bShowDetails = true ) { |
|
217 | 217 | |
218 | 218 | static $_iMBSupport; |
219 | 219 | $_iMBSupport = isset( $_iMBSupport ) ? $_iMBSupport : ( integer ) function_exists( 'mb_strlen' ); |
@@ -224,8 +224,8 @@ discard block |
||
224 | 224 | |
225 | 225 | if ( $bShowDetails ) { |
226 | 226 | return $_iCharLength <= $iCharLimit |
227 | - ? '(string, length: ' . $_iCharLength . ') ' . $sString |
|
228 | - : '(string, length: ' . $_iCharLength . ') ' . call_user_func_array( $_aSubstrMethod[ $_iMBSupport ], array( $sString, 0, $iCharLimit ) ) |
|
227 | + ? '(string, length: '.$_iCharLength.') '.$sString |
|
228 | + : '(string, length: '.$_iCharLength.') '.call_user_func_array( $_aSubstrMethod[ $_iMBSupport ], array( $sString, 0, $iCharLimit ) ) |
|
229 | 229 | . '...'; |
230 | 230 | } |
231 | 231 | return $_iCharLength <= $iCharLimit |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | * @return array |
266 | 266 | * @since 3.8.22 |
267 | 267 | */ |
268 | - static public function getSlicedByDepth( array $aSubject, $iDepth=0, $sMore='(array truncated) ...' ) { |
|
268 | + static public function getSlicedByDepth( array $aSubject, $iDepth = 0, $sMore = '(array truncated) ...' ) { |
|
269 | 269 | return self::_getSlicedByDepth( $aSubject, $iDepth, $sMore ); |
270 | 270 | } |
271 | 271 | |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | * @since 3.8.22 Added the `$sMore` parameter. |
286 | 286 | * @internal |
287 | 287 | */ |
288 | - static private function _getSlicedByDepth( array $aSubject, $iDepth=0, $sMore='(array truncated) ...' ) { |
|
288 | + static private function _getSlicedByDepth( array $aSubject, $iDepth = 0, $sMore = '(array truncated) ...' ) { |
|
289 | 289 | |
290 | 290 | foreach ( $aSubject as $_sKey => $_vValue ) { |
291 | 291 | |
@@ -317,7 +317,7 @@ discard block |
||
317 | 317 | * @return array |
318 | 318 | * @since 3.8.9 |
319 | 319 | */ |
320 | - static private function ___getArrayMappedRecursive( array $aArray, $oCallable, array $aArguments=array() ) { |
|
320 | + static private function ___getArrayMappedRecursive( array $aArray, $oCallable, array $aArguments = array() ) { |
|
321 | 321 | |
322 | 322 | self::$___oCurrentCallableForArrayMapRecursive = $oCallable; |
323 | 323 | self::$___aArgumentsForArrayMapRecursive = $aArguments; |
@@ -350,29 +350,29 @@ discard block |
||
350 | 350 | * @return string |
351 | 351 | * @since 3.8.22 |
352 | 352 | */ |
353 | - static public function getStackTrace( Exception $oException, $iSkip=0 ) { |
|
353 | + static public function getStackTrace( Exception $oException, $iSkip = 0 ) { |
|
354 | 354 | |
355 | 355 | $_aTraces = array(); |
356 | 356 | $_aFrames = $oException->getTrace(); |
357 | 357 | $_aFrames = array_slice( $_aFrames, $iSkip ); |
358 | 358 | foreach ( array_reverse( $_aFrames ) as $_iIndex => $_aFrame ) { |
359 | 359 | |
360 | - $_aFrame = $_aFrame + array( |
|
360 | + $_aFrame = $_aFrame + array( |
|
361 | 361 | 'file' => null, 'line' => null, 'function' => null, |
362 | 362 | 'class' => null, 'args' => array(), |
363 | 363 | ); |
364 | 364 | $_sArguments = self::___getArgumentsOfEachStackTrace( $_aFrame[ 'args' ] ); |
365 | - $_aTraces[] = sprintf( |
|
365 | + $_aTraces[ ] = sprintf( |
|
366 | 366 | "#%s %s(%s): %s(%s)", |
367 | 367 | $_iIndex + 1, |
368 | 368 | $_aFrame[ 'file' ], |
369 | 369 | $_aFrame[ 'line' ], |
370 | - isset( $_aFrame[ 'class' ] ) ? $_aFrame[ 'class' ] . '->' . $_aFrame[ 'function' ] : $_aFrame[ 'function' ], |
|
370 | + isset( $_aFrame[ 'class' ] ) ? $_aFrame[ 'class' ].'->'.$_aFrame[ 'function' ] : $_aFrame[ 'function' ], |
|
371 | 371 | $_sArguments |
372 | 372 | ); |
373 | 373 | |
374 | 374 | } |
375 | - return implode( PHP_EOL, $_aTraces ) . PHP_EOL; |
|
375 | + return implode( PHP_EOL, $_aTraces ).PHP_EOL; |
|
376 | 376 | |
377 | 377 | } |
378 | 378 | /** |
@@ -387,16 +387,16 @@ discard block |
||
387 | 387 | foreach ( $aTraceArguments as $_mArgument ) { |
388 | 388 | $_sType = gettype( $_mArgument ); |
389 | 389 | $_sType = str_replace( |
390 | - array( 'resource (closed)', 'unknown type', 'integer', 'double', ), |
|
391 | - array( 'resource', 'unknown', 'scalar', 'scalar', ), |
|
390 | + array( 'resource (closed)', 'unknown type', 'integer', 'double',), |
|
391 | + array( 'resource', 'unknown', 'scalar', 'scalar',), |
|
392 | 392 | $_sType |
393 | 393 | ); |
394 | 394 | $_sMethodName = "___getStackTraceArgument_{$_sType}"; |
395 | - $_aArguments[] = method_exists( __CLASS__, $_sMethodName ) |
|
395 | + $_aArguments[ ] = method_exists( __CLASS__, $_sMethodName ) |
|
396 | 396 | ? self::{$_sMethodName}( $_mArgument ) |
397 | 397 | : $_sType; |
398 | 398 | } |
399 | - return join(", ", $_aArguments ); |
|
399 | + return join( ", ", $_aArguments ); |
|
400 | 400 | } |
401 | 401 | /** |
402 | 402 | * @since 3.8.22 |
@@ -405,7 +405,7 @@ discard block |
||
405 | 405 | * @return string |
406 | 406 | */ |
407 | 407 | static private function ___getStackTraceArgument_string( $mArgument ) { |
408 | - return "'" . $mArgument . "'"; |
|
408 | + return "'".$mArgument."'"; |
|
409 | 409 | } |
410 | 410 | static private function ___getStackTraceArgument_scalar( $mArgument ) { |
411 | 411 | return $mArgument; |
@@ -417,7 +417,7 @@ discard block |
||
417 | 417 | return 'NULL'; |
418 | 418 | } |
419 | 419 | static private function ___getStackTraceArgument_object( $mArgument ) { |
420 | - return 'Object(' . get_class( $mArgument ) . ')'; |
|
420 | + return 'Object('.get_class( $mArgument ).')'; |
|
421 | 421 | } |
422 | 422 | static private function ___getStackTraceArgument_resource( $mArgument ) { |
423 | 423 | return get_resource_type( $mArgument ); |
@@ -430,18 +430,18 @@ discard block |
||
430 | 430 | $_iMax = 10; |
431 | 431 | $_iTotal = count( $mArgument ); |
432 | 432 | $_iIndex = 0; |
433 | - foreach( $mArgument as $_sKey => $_mValue ) { |
|
433 | + foreach ( $mArgument as $_sKey => $_mValue ) { |
|
434 | 434 | $_iIndex++; |
435 | - $_mValue = is_scalar( $_mValue ) |
|
435 | + $_mValue = is_scalar( $_mValue ) |
|
436 | 436 | ? $_mValue |
437 | - : ucfirst( gettype( $_mValue ) ) . ( |
|
437 | + : ucfirst( gettype( $_mValue ) ).( |
|
438 | 438 | is_object( $_mValue ) |
439 | - ? ' (' . get_class( $_mValue ) . ')' |
|
439 | + ? ' ('.get_class( $_mValue ).')' |
|
440 | 440 | : '' |
441 | 441 | ); |
442 | - $_sOutput .= $_sKey . ': ' . $_mValue . ','; |
|
442 | + $_sOutput .= $_sKey.': '.$_mValue.','; |
|
443 | 443 | if ( $_iIndex > $_iMax && $_iTotal > $_iMax ) { |
444 | - $_sOutput = rtrim( $_sOutput, ',' ) . '...'; |
|
444 | + $_sOutput = rtrim( $_sOutput, ',' ).'...'; |
|
445 | 445 | break; |
446 | 446 | } |
447 | 447 | } |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | */ |
29 | 29 | public function __construct( $oFactory, $aSavedData, $aArguments, $aSectionsets, $aFieldsets ) { |
30 | 30 | |
31 | - $this->oFactory = $oFactory; |
|
31 | + $this->oFactory = $oFactory; |
|
32 | 32 | |
33 | 33 | // add_action |
34 | 34 | // @deprecated 3.7.0 |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | */ |
72 | 72 | public function _handleFormData() { |
73 | 73 | |
74 | - if ( ! $this->_shouldProceed() ) { |
|
74 | + if ( !$this->_shouldProceed() ) { |
|
75 | 75 | return; |
76 | 76 | } |
77 | 77 | |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | new AdminPageFramework_Model__FormSubmission__Validator( $this->oFactory ); |
127 | 127 | |
128 | 128 | // [3.6.3+] Apply filters. All the sub-routines of handling form submit data use this filter hook. |
129 | - $_aInputs = $this->addAndApplyFilters( |
|
129 | + $_aInputs = $this->addAndApplyFilters( |
|
130 | 130 | $this->oFactory, |
131 | 131 | "validation_pre_{$this->oFactory->oProp->sClassName}", |
132 | 132 | $_aInputs, |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | |
138 | 138 | // Save the data. |
139 | 139 | $_bUpdated = false; |
140 | - if ( ! $this->oFactory->oProp->_bDisableSavingOptions ) { |
|
140 | + if ( !$this->oFactory->oProp->_bDisableSavingOptions ) { |
|
141 | 141 | $_bUpdated = $this->oFactory->oProp->updateOption( $_aInputs ); |
142 | 142 | } |
143 | 143 | |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | private function _shouldProceed() { |
177 | 177 | |
178 | 178 | if ( |
179 | - ! isset( |
|
179 | + !isset( |
|
180 | 180 | $_POST[ 'admin_page_framework_start' ], // indicates the framework form is started |
181 | 181 | $_POST[ '_wp_http_referer' ] |
182 | 182 | ) |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | |
194 | 194 | // Check if all the form fields are sent. |
195 | 195 | if ( |
196 | - ! isset( |
|
196 | + !isset( |
|
197 | 197 | // these keys are supposed to be embedded at the end of the form. |
198 | 198 | // if the server truncates the form input values for `max_input_vars`, these will be lost in PHP 5.3.9 or above. |
199 | 199 | $_POST[ '_is_admin_page_framework' ], // holds the form nonce |
@@ -213,11 +213,11 @@ discard block |
||
213 | 213 | return false; |
214 | 214 | } |
215 | 215 | |
216 | - $_bVerifyNonce = wp_verify_nonce( |
|
216 | + $_bVerifyNonce = wp_verify_nonce( |
|
217 | 217 | $_POST[ '_is_admin_page_framework' ], |
218 | - 'form_' . md5( $this->oFactory->oProp->sClassName . get_current_user_id() ) |
|
218 | + 'form_'.md5( $this->oFactory->oProp->sClassName.get_current_user_id() ) |
|
219 | 219 | ); |
220 | - if ( ! $_bVerifyNonce ) { |
|
220 | + if ( !$_bVerifyNonce ) { |
|
221 | 221 | $this->oFactory->setAdminNotice( $this->oFactory->oMsg->get( 'nonce_verification_failed' ) ); |
222 | 222 | return false; |
223 | 223 | } |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | */ |
232 | 232 | private function _getUserInputsFromPOST() { |
233 | 233 | |
234 | - $_aInputs = $this->getElementAsArray( |
|
234 | + $_aInputs = $this->getElementAsArray( |
|
235 | 235 | $_POST, |
236 | 236 | $this->oFactory->oProp->sOptionKey, |
237 | 237 | array() |
@@ -266,7 +266,7 @@ discard block |
||
266 | 266 | $this->oFactory, |
267 | 267 | array( |
268 | 268 | // @todo deprecate the hook with the input ID |
269 | - "submit_{$this->oFactory->oProp->sClassName}_{$_sPressedInputID}", // will be deprecated in near future release |
|
269 | + "submit_{$this->oFactory->oProp->sClassName}_{$_sPressedInputID}", // will be deprecated in near future release |
|
270 | 270 | $_sSubmitSectionID |
271 | 271 | ? "submit_{$this->oFactory->oProp->sClassName}_{$_sSubmitSectionID}_{$_sPressedFieldID}" |
272 | 272 | : "submit_{$this->oFactory->oProp->sClassName}_{$_sPressedFieldID}", |
@@ -349,9 +349,9 @@ discard block |
||
349 | 349 | |
350 | 350 | // Drop the 'field_errors' key. |
351 | 351 | $_aRemoveQueries = array(); |
352 | - if ( ! isset( $aStatus[ 'field_errors' ] ) || ! $aStatus[ 'field_errors' ] ) { |
|
352 | + if ( !isset( $aStatus[ 'field_errors' ] ) || !$aStatus[ 'field_errors' ] ) { |
|
353 | 353 | unset( $aStatus[ 'field_errors' ] ); |
354 | - $_aRemoveQueries[] = 'field_errors'; |
|
354 | + $_aRemoveQueries[ ] = 'field_errors'; |
|
355 | 355 | } |
356 | 356 | |
357 | 357 | return $this->addAndApplyFilters( // 3.4.4+ |
@@ -376,7 +376,7 @@ discard block |
||
376 | 376 | */ |
377 | 377 | private function _removePageElements( $aOptions, $sPageSlug, $sTabSlug ) { |
378 | 378 | |
379 | - if ( ! $sPageSlug && ! $sTabSlug ) { |
|
379 | + if ( !$sPageSlug && !$sTabSlug ) { |
|
380 | 380 | return $aOptions; |
381 | 381 | } |
382 | 382 |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | |
138 | 138 | // Save the data. |
139 | 139 | $_bUpdated = false; |
140 | - if ( ! $this->oFactory->oProp->_bDisableSavingOptions ) { |
|
140 | + if ( ! $this->oFactory->oProp->_bDisableSavingOptions ) { |
|
141 | 141 | $_bUpdated = $this->oFactory->oProp->updateOption( $_aInputs ); |
142 | 142 | } |
143 | 143 | |
@@ -180,14 +180,15 @@ discard block |
||
180 | 180 | $_POST[ 'admin_page_framework_start' ], // indicates the framework form is started |
181 | 181 | $_POST[ '_wp_http_referer' ] |
182 | 182 | ) |
183 | - ) { |
|
183 | + ) { |
|
184 | 184 | return false; |
185 | 185 | } |
186 | 186 | |
187 | 187 | // Referrer |
188 | 188 | $_sRequestURI = remove_query_arg( array( 'settings-updated', 'confirmation', 'field_errors' ), wp_unslash( $_SERVER[ 'REQUEST_URI' ] ) ); |
189 | 189 | $_sRefererURI = remove_query_arg( array( 'settings-updated', 'confirmation', 'field_errors' ), $_POST[ '_wp_http_referer' ] ); |
190 | - if ( $_sRequestURI != $_sRefererURI ) { // see the function definition of wp_referer_field() in functions.php. |
|
190 | + if ( $_sRequestURI != $_sRefererURI ) { |
|
191 | +// see the function definition of wp_referer_field() in functions.php. |
|
191 | 192 | return false; |
192 | 193 | } |
193 | 194 |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | * |
28 | 28 | * @internal |
29 | 29 | */ |
30 | - public function __construct( $oFactory, $sActionHook='admin_menu' ) { |
|
30 | + public function __construct( $oFactory, $sActionHook = 'admin_menu' ) { |
|
31 | 31 | |
32 | 32 | $this->oFactory = $oFactory; |
33 | 33 | add_action( |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | public function _replyToRegisterRootMenu() { |
75 | 75 | |
76 | 76 | // If the root menu label is not set but the slug is set, |
77 | - if ( ! $this->oFactory->oProp->aRootMenu[ 'fCreateRoot' ] ) { |
|
77 | + if ( !$this->oFactory->oProp->aRootMenu[ 'fCreateRoot' ] ) { |
|
78 | 78 | return; |
79 | 79 | } |
80 | 80 | $this->_registerRootMenuPage(); |
@@ -96,12 +96,12 @@ discard block |
||
96 | 96 | } |
97 | 97 | |
98 | 98 | $this->oFactory->oProp->aRootMenu[ '_page_hook' ] = add_menu_page( |
99 | - $this->oFactory->oProp->sClassName, // Page title - will be invisible anyway |
|
100 | - $this->oFactory->oProp->aRootMenu[ 'sTitle' ], // Menu title - should be the root page title. |
|
101 | - $this->oFactory->oProp->sCapability, // Capability - access right |
|
102 | - $this->oFactory->oProp->aRootMenu[ 'sPageSlug' ], // Menu ID |
|
103 | - '', // Callback function for the page content output - the root page will be removed so no need to register a function. |
|
104 | - $this->oFactory->oProp->aRootMenu[ 'sIcon16x16' ], // icon path |
|
99 | + $this->oFactory->oProp->sClassName, // Page title - will be invisible anyway |
|
100 | + $this->oFactory->oProp->aRootMenu[ 'sTitle' ], // Menu title - should be the root page title. |
|
101 | + $this->oFactory->oProp->sCapability, // Capability - access right |
|
102 | + $this->oFactory->oProp->aRootMenu[ 'sPageSlug' ], // Menu ID |
|
103 | + '', // Callback function for the page content output - the root page will be removed so no need to register a function. |
|
104 | + $this->oFactory->oProp->aRootMenu[ 'sIcon16x16' ], // icon path |
|
105 | 105 | $this->getElement( |
106 | 106 | $this->oFactory->oProp->aRootMenu, |
107 | 107 | 'iPosition', |
@@ -123,8 +123,8 @@ discard block |
||
123 | 123 | |
124 | 124 | // Let external scripts add sub-menu pages. |
125 | 125 | $_aPages = $this->addAndApplyFilter( |
126 | - $this->oFactory, // caller object |
|
127 | - "pages_{$this->oFactory->oProp->sClassName}", // filter |
|
126 | + $this->oFactory, // caller object |
|
127 | + "pages_{$this->oFactory->oProp->sClassName}", // filter |
|
128 | 128 | $this->oFactory->oProp->aPages // arguments |
129 | 129 | ); |
130 | 130 | |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | // Format the `$aPages` property and register the pages. |
135 | 135 | $_iParsedIndex = 0; |
136 | 136 | $_aFormattedPages = array(); |
137 | - foreach( $_aPages as $_aSubMenuItem ) { |
|
137 | + foreach ( $_aPages as $_aSubMenuItem ) { |
|
138 | 138 | |
139 | 139 | // needs to be sanitized because there are hook filters applied to this array. |
140 | 140 | $_oFormatter = new AdminPageFramework_Format_SubMenuItem( |
@@ -169,8 +169,8 @@ discard block |
||
169 | 169 | */ |
170 | 170 | private function _getDefaultPageSlug( array $aPages ) { |
171 | 171 | |
172 | - foreach( $aPages as $_aPage ) { |
|
173 | - if ( ! isset( $_aPage[ 'page_slug' ] ) ) { |
|
172 | + foreach ( $aPages as $_aPage ) { |
|
173 | + if ( !isset( $_aPage[ 'page_slug' ] ) ) { |
|
174 | 174 | continue; |
175 | 175 | } |
176 | 176 | return $_aPage[ 'page_slug' ]; |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | */ |
193 | 193 | private function _registerSubMenuItem( array $aArgs ) { |
194 | 194 | |
195 | - if ( ! current_user_can( $aArgs[ 'capability' ] ) ) { |
|
195 | + if ( !current_user_can( $aArgs[ 'capability' ] ) ) { |
|
196 | 196 | return ''; |
197 | 197 | } |
198 | 198 | |
@@ -256,14 +256,14 @@ discard block |
||
256 | 256 | */ |
257 | 257 | private function _addPageSubmenuItem( $sRootPageSlug, $sMenuSlug, $sPageSlug, $sPageTitle, $sMenuTitle, $sCapability, $bShowInMenu, $nOrder ) { |
258 | 258 | |
259 | - if ( ! $sPageSlug ) { |
|
259 | + if ( !$sPageSlug ) { |
|
260 | 260 | return ''; |
261 | 261 | } |
262 | 262 | $_sPageHook = $this->___addSubMenuPage( |
263 | - $sRootPageSlug, // the root (parent) page slug |
|
264 | - $sPageTitle, // page title |
|
265 | - $sMenuTitle, // menu title |
|
266 | - $sCapability, // capability |
|
263 | + $sRootPageSlug, // the root (parent) page slug |
|
264 | + $sPageTitle, // page title |
|
265 | + $sMenuTitle, // menu title |
|
266 | + $sCapability, // capability |
|
267 | 267 | $sPageSlug // menu slug |
268 | 268 | ); |
269 | 269 | |
@@ -291,14 +291,14 @@ discard block |
||
291 | 291 | $_aRemovedMenuItem = $this->_removePageSubmenuItem( $_nSubMenuPageIndex, $sMenuSlug, $sPageSlug, $sMenuTitle ); |
292 | 292 | |
293 | 293 | // If the visibility option is `false`, remove the one just added from the sub-menu global array |
294 | - if ( ! $bShowInMenu && ! $this->_isCurrentPage( $sPageSlug ) ) { |
|
294 | + if ( !$bShowInMenu && !$this->_isCurrentPage( $sPageSlug ) ) { |
|
295 | 295 | return $_sPageHook; |
296 | 296 | } |
297 | 297 | |
298 | 298 | // Set the order index in the element of the `submenu` global array. |
299 | 299 | $this->_setSubMenuPageByIndex( |
300 | - $nOrder, // user-set order |
|
301 | - $_aRemovedMenuItem, // will be reassign with a new index |
|
300 | + $nOrder, // user-set order |
|
301 | + $_aRemovedMenuItem, // will be reassign with a new index |
|
302 | 302 | $sMenuSlug |
303 | 303 | ); |
304 | 304 | |
@@ -319,21 +319,21 @@ discard block |
||
319 | 319 | * @uses add_submenu_page |
320 | 320 | */ |
321 | 321 | private function ___addSubMenuPage( |
322 | - $sRootPageSlug, // the root (parent) page slug |
|
323 | - $sPageTitle, // page title |
|
324 | - $sMenuTitle, // menu title |
|
325 | - $sCapability, // capability |
|
322 | + $sRootPageSlug, // the root (parent) page slug |
|
323 | + $sPageTitle, // page title |
|
324 | + $sMenuTitle, // menu title |
|
325 | + $sCapability, // capability |
|
326 | 326 | $sPageSlug // menu slug |
327 | 327 | ) { |
328 | 328 | if ( $this->oFactory->oProp->bIsAdminAjax ) { |
329 | 329 | return $sPageSlug; |
330 | 330 | } |
331 | 331 | return add_submenu_page( |
332 | - $sRootPageSlug, // the root (parent) page slug |
|
333 | - $sPageTitle, // page title |
|
334 | - $sMenuTitle, // menu title |
|
335 | - $sCapability, // capability |
|
336 | - $sPageSlug, // menu slug |
|
332 | + $sRootPageSlug, // the root (parent) page slug |
|
333 | + $sPageTitle, // page title |
|
334 | + $sMenuTitle, // menu title |
|
335 | + $sCapability, // capability |
|
336 | + $sPageSlug, // menu slug |
|
337 | 337 | array( $this->oFactory, '_replyToRenderPage' ) // callback 3.7.10+ |
338 | 338 | ); |
339 | 339 | } |
@@ -367,7 +367,7 @@ discard block |
||
367 | 367 | */ |
368 | 368 | add_action( |
369 | 369 | 'current_screen', |
370 | - array( $this->oFactory, "load_pre_" . $sPageSlug ), |
|
370 | + array( $this->oFactory, "load_pre_".$sPageSlug ), |
|
371 | 371 | 20 |
372 | 372 | ); |
373 | 373 | /** |
@@ -382,15 +382,15 @@ discard block |
||
382 | 382 | * Set a low priority because the user may add in-page tabs in their callback method of this action hook. |
383 | 383 | * @since 3.6.3 |
384 | 384 | */ |
385 | - add_action( "load_" . $sPageSlug, array( $this->oFactory, '_replyToFinalizeInPageTabs' ), 9999 ); |
|
385 | + add_action( "load_".$sPageSlug, array( $this->oFactory, '_replyToFinalizeInPageTabs' ), 9999 ); |
|
386 | 386 | |
387 | 387 | // 3.6.3+ |
388 | - add_action( "load_after_" . $sPageSlug, array( $this->oFactory, '_replyToEnqueuePageAssets' ) ); |
|
389 | - add_action( "load_after_" . $sPageSlug, array( $this->oFactory, '_replyToEnablePageMetaBoxes' ) ); // 3.7.10+ |
|
388 | + add_action( "load_after_".$sPageSlug, array( $this->oFactory, '_replyToEnqueuePageAssets' ) ); |
|
389 | + add_action( "load_after_".$sPageSlug, array( $this->oFactory, '_replyToEnablePageMetaBoxes' ) ); // 3.7.10+ |
|
390 | 390 | |
391 | 391 | $this->oFactory->oProp->aPageHooks[ $sPageSlug ] = $this->getAOrB( |
392 | 392 | is_network_admin(), |
393 | - $sPageHook . '-network', |
|
393 | + $sPageHook.'-network', |
|
394 | 394 | $sPageHook |
395 | 395 | ); |
396 | 396 | |
@@ -407,7 +407,7 @@ discard block |
||
407 | 407 | |
408 | 408 | $_nNewIndex = $this->getUnusedNumericIndex( |
409 | 409 | $this->getElementAsArray( $GLOBALS, array( 'submenu', $sMenuSlug ) ), // subject array to parser |
410 | - $nOrder, // a desired menu position |
|
410 | + $nOrder, // a desired menu position |
|
411 | 411 | 5 // offset |
412 | 412 | ); |
413 | 413 | |
@@ -421,9 +421,9 @@ discard block |
||
421 | 421 | */ |
422 | 422 | private function _getSubMenuPageIndex( $sMenuSlug, $sMenuTitle, $sPageTitle, $sPageSlug ) { |
423 | 423 | |
424 | - foreach( $this->getElementAsArray( $GLOBALS, array( 'submenu', $sMenuSlug ) ) as $_iIndex => $_aSubMenu ) { |
|
424 | + foreach ( $this->getElementAsArray( $GLOBALS, array( 'submenu', $sMenuSlug ) ) as $_iIndex => $_aSubMenu ) { |
|
425 | 425 | |
426 | - if ( ! isset( $_aSubMenu[ 3 ] ) ) { |
|
426 | + if ( !isset( $_aSubMenu[ 3 ] ) ) { |
|
427 | 427 | continue; |
428 | 428 | } |
429 | 429 | |
@@ -455,7 +455,7 @@ discard block |
||
455 | 455 | * @since 3.1.1 Moved from `AdminPageFramework_Menu`. Chagned the return type. |
456 | 456 | * @return array removed menu item. |
457 | 457 | */ |
458 | - private function _removePageSubmenuItem( $nSubMenuPageIndex, $sMenuSlug, $sPageSlug, $sMenuTitle ){ |
|
458 | + private function _removePageSubmenuItem( $nSubMenuPageIndex, $sMenuSlug, $sPageSlug, $sMenuTitle ) { |
|
459 | 459 | |
460 | 460 | $_aRemovedMenuItem = $this->_removePageSubMenuItemByIndex( |
461 | 461 | $nSubMenuPageIndex, |
@@ -528,7 +528,7 @@ discard block |
||
528 | 528 | */ |
529 | 529 | private function _addLinkSubmenuItem( $sMenuSlug, $sTitle, $sCapability, $sHref, $bShowInMenu, $nOrder ) { |
530 | 530 | |
531 | - if ( ! $bShowInMenu ) { |
|
531 | + if ( !$bShowInMenu ) { |
|
532 | 532 | return; |
533 | 533 | } |
534 | 534 | |
@@ -543,9 +543,9 @@ discard block |
||
543 | 543 | 5 // offset |
544 | 544 | ); |
545 | 545 | $_aSubMenuItems[ $_nIndex ] = array( |
546 | - $sTitle, // 0 |
|
547 | - $sCapability, // 1 |
|
548 | - $sHref, // 2 |
|
546 | + $sTitle, // 0 |
|
547 | + $sCapability, // 1 |
|
548 | + $sHref, // 2 |
|
549 | 549 | ); |
550 | 550 | $GLOBALS[ 'submenu' ][ $sMenuSlug ] = $_aSubMenuItems; |
551 | 551 | |
@@ -562,17 +562,17 @@ discard block |
||
562 | 562 | */ |
563 | 563 | public function _replyToLoadPageForAjax() { |
564 | 564 | $_sCurrentPageSlug = $this->oFactory->oProp->getCurrentPageSlugIfAdded(); |
565 | - if ( ! $_sCurrentPageSlug ) { |
|
565 | + if ( !$_sCurrentPageSlug ) { |
|
566 | 566 | return; |
567 | 567 | } |
568 | - $_sCurrentTabSlug = $this->oFactory->oProp->getCurrentInPageTabSlugIfAdded( $_sCurrentPageSlug ); |
|
568 | + $_sCurrentTabSlug = $this->oFactory->oProp->getCurrentInPageTabSlugIfAdded( $_sCurrentPageSlug ); |
|
569 | 569 | if ( |
570 | - ! empty( $this->oFactory->oProp->aInPageTabs ) // it means at least one in-page tab is added |
|
571 | - && ! $_sCurrentTabSlug // the current tab could not be retrieved |
|
570 | + !empty( $this->oFactory->oProp->aInPageTabs ) // it means at least one in-page tab is added |
|
571 | + && !$_sCurrentTabSlug // the current tab could not be retrieved |
|
572 | 572 | ) { |
573 | 573 | return; |
574 | 574 | } |
575 | - call_user_func_array( array( $this->oFactory, "load_pre_" . $_sCurrentPageSlug ), array() ); |
|
575 | + call_user_func_array( array( $this->oFactory, "load_pre_".$_sCurrentPageSlug ), array() ); |
|
576 | 576 | } |
577 | 577 | |
578 | 578 | /** |
@@ -585,7 +585,7 @@ discard block |
||
585 | 585 | public function _replyToRemoveRootMenuPage() { |
586 | 586 | |
587 | 587 | // After adding the sub menus, if the root menu is created, remove the page that is automatically created when registering the root menu. |
588 | - if ( ! $this->oFactory->oProp->aRootMenu[ 'fCreateRoot' ] ) { |
|
588 | + if ( !$this->oFactory->oProp->aRootMenu[ 'fCreateRoot' ] ) { |
|
589 | 589 | return; |
590 | 590 | } |
591 | 591 | if ( $this->oFactory->oProp->bIsAdminAjax ) { |
@@ -596,7 +596,7 @@ discard block |
||
596 | 596 | * Namespace slugs have backslashes but the registered slugs backslashes are all converted to forward-slashes. |
597 | 597 | * @since 3.5.16 |
598 | 598 | */ |
599 | - $_sMenuSlug = str_replace( |
|
599 | + $_sMenuSlug = str_replace( |
|
600 | 600 | '\\', |
601 | 601 | '/', |
602 | 602 | $this->oFactory->oProp->aRootMenu[ 'sPageSlug' ] |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | |
48 | 48 | // Do actions before rendering the page. In this order, global -> page -> in-page tab |
49 | 49 | $this->addAndDoActions( |
50 | - $this->oFactory, // the caller object |
|
50 | + $this->oFactory, // the caller object |
|
51 | 51 | $this->getFilterArrayByPrefix( 'do_before_', $this->oFactory->oProp->sClassName, $_sPageSlug, $_sTabSlug, true ), // the action hooks |
52 | 52 | $this->oFactory // the argument 1 |
53 | 53 | ); |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | </div><!-- #post-body --> |
73 | 73 | </div><!-- #poststuff --> |
74 | 74 | |
75 | - <?php echo $this->_printFormClosingTag( $_sPageSlug, $_sTabSlug, $this->oFactory->oProp->bEnableForm ); // </form> ?> |
|
75 | + <?php echo $this->_printFormClosingTag( $_sPageSlug, $_sTabSlug, $this->oFactory->oProp->bEnableForm ); // </form> ?> |
|
76 | 76 | </div><!-- .admin-page-framework-container --> |
77 | 77 | |
78 | 78 | <?php |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | <?php |
84 | 84 | // Do actions after rendering the page. |
85 | 85 | $this->addAndDoActions( |
86 | - $this->oFactory, // the caller object |
|
86 | + $this->oFactory, // the caller object |
|
87 | 87 | $this->getFilterArrayByPrefix( 'do_after_', $this->oFactory->oProp->sClassName, $_sPageSlug, $_sTabSlug, true ), // the action hooks |
88 | 88 | $this->oFactory // the argument 1 |
89 | 89 | ); |
@@ -100,14 +100,14 @@ discard block |
||
100 | 100 | */ |
101 | 101 | private function _getNumberOfColumns() { |
102 | 102 | |
103 | - if ( ! $this->doesMetaBoxExist( 'side' ) ) { |
|
103 | + if ( !$this->doesMetaBoxExist( 'side' ) ) { |
|
104 | 104 | return 1; |
105 | 105 | } |
106 | 106 | |
107 | 107 | $_iColumns = $this->getNumberOfScreenColumns(); |
108 | 108 | return $_iColumns |
109 | 109 | ? $_iColumns |
110 | - : 1; // default - this is because generic pages do not have meta boxes. |
|
110 | + : 1; // default - this is because generic pages do not have meta boxes. |
|
111 | 111 | } |
112 | 112 | // @deprecated |
113 | 113 | // Make sure if no side meta box exists, set it 1. |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | private function _getContentTop() { |
127 | 127 | |
128 | 128 | // Screen icon, page heading tabs(page title), and in-page tabs. |
129 | - $_oScreenIcon = new AdminPageFramework_View__PageRenderer__ScreenIcon( |
|
129 | + $_oScreenIcon = new AdminPageFramework_View__PageRenderer__ScreenIcon( |
|
130 | 130 | $this->oFactory, |
131 | 131 | $this->sPageSlug, |
132 | 132 | $this->sTabSlug |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | $this->oFactory, |
143 | 143 | $this->sPageSlug |
144 | 144 | ); |
145 | - $_sContentTop .= $_oInPageTabs->get(); |
|
145 | + $_sContentTop .= $_oInPageTabs->get(); |
|
146 | 146 | |
147 | 147 | // Apply filters in this order, in-page tab -> page -> global. |
148 | 148 | return $this->addAndApplyFilters( |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | */ |
215 | 215 | private function _getFormOutput( $sPageSlug ) { |
216 | 216 | |
217 | - if ( ! $this->oFactory->oProp->bEnableForm ) { |
|
217 | + if ( !$this->oFactory->oProp->bEnableForm ) { |
|
218 | 218 | return ''; |
219 | 219 | } |
220 | 220 | return $this->oFactory->oForm->get(); |
@@ -244,9 +244,9 @@ discard block |
||
244 | 244 | * @internal |
245 | 245 | * @return void |
246 | 246 | */ |
247 | - private function _printFormOpeningTag( $fEnableForm=true ) { |
|
247 | + private function _printFormOpeningTag( $fEnableForm = true ) { |
|
248 | 248 | |
249 | - if ( ! $fEnableForm ) { |
|
249 | + if ( !$fEnableForm ) { |
|
250 | 250 | return; |
251 | 251 | } |
252 | 252 | |
@@ -259,12 +259,12 @@ discard block |
||
259 | 259 | 'action' => wp_unslash( remove_query_arg( 'settings-updated', $this->oFactory->oProp->sTargetFormPage ) ), |
260 | 260 | ) |
261 | 261 | ) |
262 | - . " >" . PHP_EOL; |
|
262 | + . " >".PHP_EOL; |
|
263 | 263 | |
264 | 264 | // [3.5.11+] Insert a mark that indicates the framework form has started. |
265 | 265 | // This will be checked in the validation method with the `is_admin_page_framework` input value which gets inserted at the end of the form |
266 | 266 | // in order to determine all the fields are sent for the PHP max_input_vars limitation set in the server configuration. |
267 | - echo "<input type='hidden' name='admin_page_framework_start' value='1' />" . PHP_EOL; |
|
267 | + echo "<input type='hidden' name='admin_page_framework_start' value='1' />".PHP_EOL; |
|
268 | 268 | |
269 | 269 | // Embed the '_wp_http_referer' hidden field that is checked in the submit data processing method. |
270 | 270 | settings_fields( $this->oFactory->oProp->sOptionKey ); |
@@ -280,16 +280,16 @@ discard block |
||
280 | 280 | * @internal |
281 | 281 | * @return void |
282 | 282 | */ |
283 | - private function _printFormClosingTag( $sPageSlug, $sTabSlug, $fEnableForm=true ) { |
|
283 | + private function _printFormClosingTag( $sPageSlug, $sTabSlug, $fEnableForm = true ) { |
|
284 | 284 | |
285 | - if ( ! $fEnableForm ) { |
|
285 | + if ( !$fEnableForm ) { |
|
286 | 286 | return; |
287 | 287 | } |
288 | - $_sNonce = wp_create_nonce( 'form_' . md5( $this->oFactory->oProp->sClassName . get_current_user_id() ) ); |
|
289 | - echo "<input type='hidden' name='page_slug' value='{$sPageSlug}' />" . PHP_EOL |
|
290 | - . "<input type='hidden' name='tab_slug' value='{$sTabSlug}' />" . PHP_EOL |
|
291 | - . "<input type='hidden' name='_is_admin_page_framework' value='{$_sNonce}' />" . PHP_EOL |
|
292 | - . "</form><!-- End Form -->" . PHP_EOL; |
|
288 | + $_sNonce = wp_create_nonce( 'form_'.md5( $this->oFactory->oProp->sClassName.get_current_user_id() ) ); |
|
289 | + echo "<input type='hidden' name='page_slug' value='{$sPageSlug}' />".PHP_EOL |
|
290 | + . "<input type='hidden' name='tab_slug' value='{$sTabSlug}' />".PHP_EOL |
|
291 | + . "<input type='hidden' name='_is_admin_page_framework' value='{$_sNonce}' />".PHP_EOL |
|
292 | + . "</form><!-- End Form -->".PHP_EOL; |
|
293 | 293 | |
294 | 294 | } |
295 | 295 |
@@ -67,9 +67,9 @@ discard block |
||
67 | 67 | */ |
68 | 68 | public function _appendInternalAssets( $sInternal, &$aContainer ) { |
69 | 69 | $_aInternals = array_unique( $aContainer ); |
70 | - $sInternal = PHP_EOL . $sInternal; |
|
71 | - foreach( $_aInternals as $_iIndex => $_sInternal ) { |
|
72 | - $sInternal .= $_sInternal . PHP_EOL; |
|
70 | + $sInternal = PHP_EOL.$sInternal; |
|
71 | + foreach ( $_aInternals as $_iIndex => $_sInternal ) { |
|
72 | + $sInternal .= $_sInternal.PHP_EOL; |
|
73 | 73 | unset( $_aInternals[ $_iIndex ] ); |
74 | 74 | } |
75 | 75 | $aContainer = $_aInternals; // update the container array. |
@@ -83,23 +83,23 @@ discard block |
||
83 | 83 | private function _parseAssets( $oFactory ) { |
84 | 84 | |
85 | 85 | // page |
86 | - $_aPageStyles = $this->getElementAsArray( |
|
86 | + $_aPageStyles = $this->getElementAsArray( |
|
87 | 87 | $oFactory->oProp->aPages, |
88 | 88 | array( $this->sCurrentPageSlug, 'style' ) |
89 | 89 | ); |
90 | 90 | $this->_enqueuePageAssets( $_aPageStyles, 'style' ); |
91 | 91 | |
92 | - $_aPageScripts = $this->getElementAsArray( |
|
92 | + $_aPageScripts = $this->getElementAsArray( |
|
93 | 93 | $oFactory->oProp->aPages, |
94 | 94 | array( $this->sCurrentPageSlug, 'script' ) |
95 | 95 | ); |
96 | 96 | $this->_enqueuePageAssets( $_aPageScripts, 'script' ); |
97 | 97 | |
98 | 98 | // In-page tabs |
99 | - if ( ! $this->sCurrentTabSlug ) { |
|
99 | + if ( !$this->sCurrentTabSlug ) { |
|
100 | 100 | return; |
101 | 101 | } |
102 | - $_aInPageTabStyles = $this->getElementAsArray( |
|
102 | + $_aInPageTabStyles = $this->getElementAsArray( |
|
103 | 103 | $oFactory->oProp->aInPageTabs, |
104 | 104 | array( $this->sCurrentPageSlug, $this->sCurrentTabSlug, 'style' ) |
105 | 105 | ); |
@@ -116,10 +116,10 @@ discard block |
||
116 | 116 | * @since 3.6.3 |
117 | 117 | * @return void |
118 | 118 | */ |
119 | - private function _enqueuePageAssets( array $aPageAssets, $sType='style' ) { |
|
120 | - $_sMethodName = "_enqueueAsset_" . $sType; |
|
121 | - foreach( $aPageAssets as $_asPageAsset ) { |
|
122 | - $this->{$_sMethodName}( $_asPageAsset); |
|
119 | + private function _enqueuePageAssets( array $aPageAssets, $sType = 'style' ) { |
|
120 | + $_sMethodName = "_enqueueAsset_".$sType; |
|
121 | + foreach ( $aPageAssets as $_asPageAsset ) { |
|
122 | + $this->{$_sMethodName}( $_asPageAsset ); |
|
123 | 123 | } |
124 | 124 | } |
125 | 125 | |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | } |
145 | 145 | |
146 | 146 | // Insert the CSS rule in the head tag. |
147 | - $this->aCSSRules[] = $_sSRC; |
|
147 | + $this->aCSSRules[ ] = $_sSRC; |
|
148 | 148 | |
149 | 149 | } |
150 | 150 | |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | } |
170 | 170 | |
171 | 171 | // Insert the scripts in the head tag. |
172 | - $this->aScripts[] = $_sSRC; |
|
172 | + $this->aScripts[ ] = $_sSRC; |
|
173 | 173 | |
174 | 174 | } |
175 | 175 |
@@ -26,11 +26,11 @@ discard block |
||
26 | 26 | * |
27 | 27 | * @since 3.3.0 |
28 | 28 | */ |
29 | - public function __construct( $sOptionKey=null, $sCallerPath=null, $sCapability='manage_options', $sTextDomain='admin-page-framework' ) { |
|
29 | + public function __construct( $sOptionKey = null, $sCallerPath = null, $sCapability = 'manage_options', $sTextDomain = 'admin-page-framework' ) { |
|
30 | 30 | |
31 | 31 | $_sPropertyClassName = isset( $this->aSubClassNames[ 'oProp' ] ) |
32 | 32 | ? $this->aSubClassNames[ 'oProp' ] |
33 | - : 'AdminPageFramework_Property_' . $this->_sStructureType; |
|
33 | + : 'AdminPageFramework_Property_'.$this->_sStructureType; |
|
34 | 34 | |
35 | 35 | $this->oProp = new $_sPropertyClassName( |
36 | 36 | $this, |
@@ -47,12 +47,12 @@ discard block |
||
47 | 47 | // if ( $this->oProp->bIsAdminAjax ) { |
48 | 48 | // return; |
49 | 49 | // } |
50 | - if ( ! $this->oProp->bIsAdmin ) { |
|
50 | + if ( !$this->oProp->bIsAdmin ) { |
|
51 | 51 | return; |
52 | 52 | } |
53 | 53 | |
54 | 54 | add_action( 'wp_loaded', array( $this, '_replyToDetermineToLoad' ) ); |
55 | - add_action( 'set_up_' . $this->oProp->sClassName, array( $this, '_replyToLoadComponentsForAjax' ), 100 ); |
|
55 | + add_action( 'set_up_'.$this->oProp->sClassName, array( $this, '_replyToLoadComponentsForAjax' ), 100 ); |
|
56 | 56 | |
57 | 57 | } |
58 | 58 | |
@@ -64,13 +64,13 @@ discard block |
||
64 | 64 | * @callback add_action set_up_{extended class name} |
65 | 65 | */ |
66 | 66 | public function _replyToLoadComponentsForAjax() { |
67 | - if ( ! $this->oProp->bIsAdminAjax ) { |
|
67 | + if ( !$this->oProp->bIsAdminAjax ) { |
|
68 | 68 | return; |
69 | 69 | } |
70 | 70 | |
71 | 71 | new AdminPageFramework_Model_Menu__RegisterMenu( $this, 'pseudo_admin_menu' ); |
72 | 72 | do_action( 'pseudo_admin_menu', '' ); |
73 | - do_action( 'pseudo_current_screen' ); // @deprecated 3.8.22 Kept for backward-compatibility |
|
73 | + do_action( 'pseudo_current_screen' ); // @deprecated 3.8.22 Kept for backward-compatibility |
|
74 | 74 | |
75 | 75 | $_sPageSlug = $this->oProp->getCurrentPageSlug(); |
76 | 76 | if ( $this->oProp->isPageAdded( $_sPageSlug ) ) { |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | * @since 3.3.1 Moved from `AdminPageFramework_Base`. |
118 | 118 | * @internal |
119 | 119 | */ |
120 | - public function __call( $sMethodName, $aArgs=null ) { |
|
120 | + public function __call( $sMethodName, $aArgs = null ) { |
|
121 | 121 | |
122 | 122 | $_sPageSlug = $this->oProp->getCurrentPageSlug(); |
123 | 123 | $_sTabSlug = $this->oProp->getCurrentTabSlug( $_sPageSlug ); |
@@ -128,15 +128,15 @@ discard block |
||
128 | 128 | 'load_pre_', |
129 | 129 | ); |
130 | 130 | |
131 | - switch( $this->_getCallbackName( $sMethodName, $_sPageSlug, $_aKnownMethodPrefixes ) ) { |
|
131 | + switch ( $this->_getCallbackName( $sMethodName, $_sPageSlug, $_aKnownMethodPrefixes ) ) { |
|
132 | 132 | |
133 | 133 | // add_settings_section() callback |
134 | 134 | case 'section_pre_': |
135 | - return $this->_renderSectionDescription( $sMethodName ); // defined in AdminPageFramework_Setting |
|
135 | + return $this->_renderSectionDescription( $sMethodName ); // defined in AdminPageFramework_Setting |
|
136 | 136 | |
137 | 137 | // add_settings_field() callback |
138 | 138 | case 'field_pre_': |
139 | - return $this->_renderSettingField( $_mFirstArg, $_sPageSlug ); // defined in AdminPageFramework_Setting |
|
139 | + return $this->_renderSettingField( $_mFirstArg, $_sPageSlug ); // defined in AdminPageFramework_Setting |
|
140 | 140 | |
141 | 141 | // load-{page} callback |
142 | 142 | case 'load_pre_': |
@@ -154,9 +154,9 @@ discard block |
||
154 | 154 | * @return string The found callback method name or the prefix of a known callback method name. An empty string if not found. |
155 | 155 | * @internal |
156 | 156 | */ |
157 | - private function _getCallbackName( $sMethodName, $sPageSlug, array $aKnownMethodPrefixes=array() ) { |
|
157 | + private function _getCallbackName( $sMethodName, $sPageSlug, array $aKnownMethodPrefixes = array() ) { |
|
158 | 158 | |
159 | - foreach( $aKnownMethodPrefixes as $_sMethodPrefix ) { |
|
159 | + foreach ( $aKnownMethodPrefixes as $_sMethodPrefix ) { |
|
160 | 160 | if ( $this->oUtil->hasPrefix( $_sMethodPrefix, $sMethodName ) ) { |
161 | 161 | return $_sMethodPrefix; |
162 | 162 | } |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | */ |
181 | 181 | protected function _doPageLoadCall( $sMethodName, $sPageSlug, $sTabSlug, $oScreen ) { |
182 | 182 | |
183 | - if ( ! $this->_isPageLoadCall( $sMethodName, $sPageSlug, $oScreen ) ) { |
|
183 | + if ( !$this->_isPageLoadCall( $sMethodName, $sPageSlug, $oScreen ) ) { |
|
184 | 184 | return; |
185 | 185 | } |
186 | 186 | |
@@ -204,10 +204,10 @@ discard block |
||
204 | 204 | // the tab slug will be empty unless an in-page tab is added. |
205 | 205 | $sTabSlug = $this->oProp->getCurrentTabSlug( $sPageSlug ); |
206 | 206 | if ( strlen( $sTabSlug ) ) { |
207 | - $this->_setShowDebugInfoProperty( $sPageSlug, $sTabSlug ); // 3.8.8+ |
|
207 | + $this->_setShowDebugInfoProperty( $sPageSlug, $sTabSlug ); // 3.8.8+ |
|
208 | 208 | $this->oUtil->addAndDoActions( |
209 | 209 | $this, // the caller object |
210 | - array( "load_{$sPageSlug}_" . $sTabSlug ), |
|
210 | + array( "load_{$sPageSlug}_".$sTabSlug ), |
|
211 | 211 | $this // the admin page object - this lets third-party scripts use the framework methods. |
212 | 212 | ); |
213 | 213 | } |
@@ -232,10 +232,10 @@ discard block |
||
232 | 232 | * @since 3.8.8 |
233 | 233 | * @return void |
234 | 234 | */ |
235 | - private function _setShowDebugInfoProperty( $sPageSlug, $sTabSlug='' ) { |
|
235 | + private function _setShowDebugInfoProperty( $sPageSlug, $sTabSlug = '' ) { |
|
236 | 236 | |
237 | 237 | // For the page, |
238 | - if ( ! strlen( $sTabSlug ) ) { |
|
238 | + if ( !strlen( $sTabSlug ) ) { |
|
239 | 239 | $this->oProp->bShowDebugInfo = $this->oUtil->getElement( |
240 | 240 | $this->oProp->aPages, |
241 | 241 | array( $sPageSlug, 'show_debug_info' ), |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | if ( substr( $sMethodName, strlen( 'load_pre_' ) ) !== $sPageSlug ) { |
281 | 281 | return false; |
282 | 282 | } |
283 | - if ( ! isset( $this->oProp->aPageHooks[ $sPageSlug ] ) ) { |
|
283 | + if ( !isset( $this->oProp->aPageHooks[ $sPageSlug ] ) ) { |
|
284 | 284 | return false; |
285 | 285 | } |
286 | 286 | $_sPageHook = is_object( $osScreenORPageHook ) |
@@ -306,7 +306,7 @@ discard block |
||
306 | 306 | } |
307 | 307 | |
308 | 308 | // Nothing to do in the network admin area. |
309 | - return ! is_network_admin(); |
|
309 | + return !is_network_admin(); |
|
310 | 310 | |
311 | 311 | } |
312 | 312 | |
@@ -321,13 +321,13 @@ discard block |
||
321 | 321 | */ |
322 | 322 | protected function _isInThePage() { |
323 | 323 | |
324 | - if ( ! $this->oProp->bIsAdmin ) { |
|
324 | + if ( !$this->oProp->bIsAdmin ) { |
|
325 | 325 | return false; |
326 | 326 | } |
327 | 327 | |
328 | 328 | // If the `setUp()` method is not loaded yet, nothing can be checked |
329 | 329 | // as there is not page is added. |
330 | - if ( ! did_action( 'set_up_' . $this->oProp->sClassName ) ) { |
|
330 | + if ( !did_action( 'set_up_'.$this->oProp->sClassName ) ) { |
|
331 | 331 | return true; |
332 | 332 | } |
333 | 333 |
@@ -162,7 +162,7 @@ |
||
162 | 162 | /* |
163 | 163 | * Shared methods |
164 | 164 | */ |
165 | - /** |
|
165 | + /** |
|
166 | 166 | * Checks the src url of the enqueued script/style to determine whether or not to set up a attribute modification callback. |
167 | 167 | * |
168 | 168 | * If it is one of the framework added item, the method sets up a hook to modify the url to add custom attributes. |
@@ -36,19 +36,19 @@ discard block |
||
36 | 36 | |
37 | 37 | /* The system internal keys. */ |
38 | 38 | 'sSRC' => null, |
39 | - 'aPostTypes' => array(), // for meta box class |
|
39 | + 'aPostTypes' => array(), // for meta box class |
|
40 | 40 | 'sPageSlug' => null, |
41 | 41 | 'sTabSlug' => null, |
42 | - 'sType' => null, // script or style |
|
42 | + 'sType' => null, // script or style |
|
43 | 43 | |
44 | 44 | /* The below keys are for users. */ |
45 | 45 | 'handle_id' => null, |
46 | 46 | 'dependencies' => array(), |
47 | - 'version' => false, // although the type should be string, the wp_enqueue_...() functions want false as the default value. |
|
48 | - 'translation' => array(), // only for scripts |
|
49 | - 'in_footer' => false, // only for scripts |
|
50 | - 'media' => 'all', // only for styles |
|
51 | - 'attributes' => array(), // 3.3.0+ - the attribute array |
|
47 | + 'version' => false, // although the type should be string, the wp_enqueue_...() functions want false as the default value. |
|
48 | + 'translation' => array(), // only for scripts |
|
49 | + 'in_footer' => false, // only for scripts |
|
50 | + 'media' => 'all', // only for styles |
|
51 | + 'attributes' => array(), // 3.3.0+ - the attribute array |
|
52 | 52 | |
53 | 53 | ); |
54 | 54 | |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | * @remark This value should be overridden in an extended class. |
60 | 60 | * @internal |
61 | 61 | */ |
62 | - protected $_sClassSelector_Style = 'admin-page-framework-style'; |
|
62 | + protected $_sClassSelector_Style = 'admin-page-framework-style'; |
|
63 | 63 | |
64 | 64 | /** |
65 | 65 | * Stores the class selector used to the class-specific script. |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | * @remark This value should be overridden in an extended class. |
69 | 69 | * @internal |
70 | 70 | */ |
71 | - protected $_sClassSelector_Script = 'admin-page-framework-script'; |
|
71 | + protected $_sClassSelector_Script = 'admin-page-framework-script'; |
|
72 | 72 | |
73 | 73 | /** |
74 | 74 | * Stores hand IDs by resource url to look up handle id and add custom arguments. |
@@ -143,8 +143,8 @@ discard block |
||
143 | 143 | * @internal |
144 | 144 | */ |
145 | 145 | |
146 | - public function _forceToEnqueueStyle( $sSRC, $aCustomArgs=array() ) {} |
|
147 | - public function _forceToEnqueueScript( $sSRC, $aCustomArgs=array() ) {} |
|
146 | + public function _forceToEnqueueStyle( $sSRC, $aCustomArgs = array() ) {} |
|
147 | + public function _forceToEnqueueScript( $sSRC, $aCustomArgs = array() ) {} |
|
148 | 148 | |
149 | 149 | /** |
150 | 150 | * A helper function for the _replyToEnqueueScripts() and the `_replyToEnqueueStyle()` methods. |
@@ -204,8 +204,8 @@ discard block |
||
204 | 204 | return $sSanitizedURL; |
205 | 205 | } |
206 | 206 | |
207 | - $_sAttributes = $this->getAttributes( $_aAttributes ); |
|
208 | - return $sSanitizedURL . "' " . rtrim( $_sAttributes, "'\"" ); |
|
207 | + $_sAttributes = $this->getAttributes( $_aAttributes ); |
|
208 | + return $sSanitizedURL."' ".rtrim( $_sAttributes, "'\"" ); |
|
209 | 209 | |
210 | 210 | } |
211 | 211 | |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | */ |
226 | 226 | protected function _printCommonStyles( $sIDPrefix, $sClassName ) { |
227 | 227 | |
228 | - if ( $this->hasBeenCalled( 'COMMON_STYLES: ' . get_class( $this ) . '::' . __METHOD__ ) ) { |
|
228 | + if ( $this->hasBeenCalled( 'COMMON_STYLES: '.get_class( $this ).'::'.__METHOD__ ) ) { |
|
229 | 229 | return; |
230 | 230 | } |
231 | 231 | $_oCaller = $this->oProp->oCaller; |
@@ -241,10 +241,10 @@ discard block |
||
241 | 241 | */ |
242 | 242 | private function ___getCommonStyleTag( $oCaller, $sIDPrefix ) { |
243 | 243 | |
244 | - $_sStyle = $this->addAndApplyFilters( |
|
244 | + $_sStyle = $this->addAndApplyFilters( |
|
245 | 245 | $oCaller, |
246 | 246 | array( |
247 | - "style_common_admin_page_framework", // 3.2.1+ |
|
247 | + "style_common_admin_page_framework", // 3.2.1+ |
|
248 | 248 | "style_common_{$this->oProp->sClassName}", |
249 | 249 | ), |
250 | 250 | AdminPageFramework_CSS::getDefaultCSS() |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | $_sStyle = $this->isDebugMode() ? $_sStyle : $this->getCSSMinified( $_sStyle ); |
253 | 253 | $_sStyle = trim( $_sStyle ); |
254 | 254 | if ( $_sStyle ) { |
255 | - echo "<style type='text/css' id='" . esc_attr( strtolower( $sIDPrefix ) ) . "'>" |
|
255 | + echo "<style type='text/css' id='".esc_attr( strtolower( $sIDPrefix ) )."'>" |
|
256 | 256 | . $_sStyle |
257 | 257 | . "</style>"; |
258 | 258 | } |
@@ -267,10 +267,10 @@ discard block |
||
267 | 267 | */ |
268 | 268 | private function ___getCommonIEStyleTag( $oCaller, $sIDPrefix ) { |
269 | 269 | |
270 | - $_sStyleIE = $this->addAndApplyFilters( |
|
270 | + $_sStyleIE = $this->addAndApplyFilters( |
|
271 | 271 | $oCaller, |
272 | 272 | array( |
273 | - "style_ie_common_admin_page_framework", // 3.2.1+ |
|
273 | + "style_ie_common_admin_page_framework", // 3.2.1+ |
|
274 | 274 | "style_ie_common_{$this->oProp->sClassName}", |
275 | 275 | ), |
276 | 276 | AdminPageFramework_CSS::getDefaultCSSIE() |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | $_sStyleIE = $this->isDebugMode() ? $_sStyleIE : $this->getCSSMinified( $_sStyleIE ); |
279 | 279 | $_sStyleIE = trim( $_sStyleIE ); |
280 | 280 | return $_sStyleIE |
281 | - ? "<!--[if IE]><style type='text/css' id='" . esc_attr( strtolower( $sIDPrefix . "-ie" ) ) . "'>" |
|
281 | + ? "<!--[if IE]><style type='text/css' id='".esc_attr( strtolower( $sIDPrefix."-ie" ) )."'>" |
|
282 | 282 | . $_sStyleIE |
283 | 283 | . "</style><![endif]-->" |
284 | 284 | : ''; |
@@ -297,23 +297,23 @@ discard block |
||
297 | 297 | */ |
298 | 298 | protected function _printCommonScripts( $sIDPrefix, $sClassName ) { |
299 | 299 | |
300 | - if ( $this->hasBeenCalled( 'COMMON_SCRIPT: ' . get_class( $this ) . '::' . __METHOD__ ) ) { |
|
300 | + if ( $this->hasBeenCalled( 'COMMON_SCRIPT: '.get_class( $this ).'::'.__METHOD__ ) ) { |
|
301 | 301 | return; |
302 | 302 | } |
303 | 303 | |
304 | 304 | $_sScript = $this->addAndApplyFilters( |
305 | 305 | $this->oProp->oCaller, |
306 | 306 | array( |
307 | - "script_common_admin_page_framework", // 3.2.1+ |
|
307 | + "script_common_admin_page_framework", // 3.2.1+ |
|
308 | 308 | "script_common_{$this->oProp->sClassName}", |
309 | 309 | ), |
310 | 310 | AdminPageFramework_Property_Base::$_sDefaultScript |
311 | 311 | ); |
312 | 312 | $_sScript = trim( $_sScript ); |
313 | - if ( ! $_sScript ) { |
|
313 | + if ( !$_sScript ) { |
|
314 | 314 | return; |
315 | 315 | } |
316 | - echo "<script type='text/javascript' id='" . esc_attr( strtolower( $sIDPrefix ) ) . "'>" |
|
316 | + echo "<script type='text/javascript' id='".esc_attr( strtolower( $sIDPrefix ) )."'>" |
|
317 | 317 | . '/* <![CDATA[ */' |
318 | 318 | . $_sScript |
319 | 319 | . '/* ]]> */' |
@@ -331,7 +331,7 @@ discard block |
||
331 | 331 | */ |
332 | 332 | protected function _printClassSpecificStyles( $sIDPrefix ) { |
333 | 333 | |
334 | - $_oCaller = $this->oProp->oCaller; |
|
334 | + $_oCaller = $this->oProp->oCaller; |
|
335 | 335 | echo $this->_getClassSpecificStyleTag( $_oCaller, $sIDPrefix ); |
336 | 336 | echo $this->_getClassSpecificIEStyleTag( $_oCaller, $sIDPrefix ); |
337 | 337 | |
@@ -352,18 +352,18 @@ discard block |
||
352 | 352 | static $_iCallCount = 0; |
353 | 353 | |
354 | 354 | $_sFilterName = "style_{$this->oProp->sClassName}"; |
355 | - if ( $this->hasBeenCalled( 'FILTER: ' . $_sFilterName ) ) { // 3.8.22 |
|
355 | + if ( $this->hasBeenCalled( 'FILTER: '.$_sFilterName ) ) { // 3.8.22 |
|
356 | 356 | return ''; |
357 | 357 | } |
358 | 358 | $_sStyle = $this->addAndApplyFilters( $_oCaller, $_sFilterName, $this->oProp->sStyle ); |
359 | 359 | $_sStyle = $this->isDebugMode() ? $_sStyle : $this->getCSSMinified( $_sStyle ); |
360 | 360 | $_sStyle = trim( $_sStyle ); |
361 | - if ( ! $_sStyle ) { |
|
361 | + if ( !$_sStyle ) { |
|
362 | 362 | return ''; |
363 | 363 | } |
364 | 364 | $_iCallCount++; |
365 | - $_sID = strtolower( "{$sIDPrefix}-" . $this->oProp->sClassName . "_{$_iCallCount}" ); |
|
366 | - return "<style type='text/css' id='" . esc_attr( $_sID ) . "'>" |
|
365 | + $_sID = strtolower( "{$sIDPrefix}-".$this->oProp->sClassName."_{$_iCallCount}" ); |
|
366 | + return "<style type='text/css' id='".esc_attr( $_sID )."'>" |
|
367 | 367 | . $_sStyle |
368 | 368 | . "</style>"; |
369 | 369 | |
@@ -379,18 +379,18 @@ discard block |
||
379 | 379 | static $_iCallCountIE = 1; |
380 | 380 | |
381 | 381 | $_sFilterName = "style_ie_{$this->oProp->sClassName}"; |
382 | - if ( $this->hasBeenCalled( 'FILTER: ' . $_sFilterName ) ) { // 3.8.22 |
|
382 | + if ( $this->hasBeenCalled( 'FILTER: '.$_sFilterName ) ) { // 3.8.22 |
|
383 | 383 | return ''; |
384 | 384 | } |
385 | 385 | $_sStyleIE = $this->addAndApplyFilters( $_oCaller, $_sFilterName, $this->oProp->sStyleIE ); |
386 | 386 | $_sStyleIE = $this->isDebugMode() ? $_sStyleIE : $this->getCSSMinified( $_sStyleIE ); |
387 | 387 | $_sStyleIE = trim( $_sStyleIE ); |
388 | - if ( ! $_sStyleIE ) { |
|
388 | + if ( !$_sStyleIE ) { |
|
389 | 389 | return ''; |
390 | 390 | } |
391 | 391 | $_iCallCountIE++; |
392 | - $_sID = strtolower( "{$sIDPrefix}-ie-{$this->oProp->sClassName}_{$_iCallCountIE}" ); |
|
393 | - return "<!--[if IE]><style type='text/css' id='" . esc_attr( $_sID ) . "'>" |
|
392 | + $_sID = strtolower( "{$sIDPrefix}-ie-{$this->oProp->sClassName}_{$_iCallCountIE}" ); |
|
393 | + return "<!--[if IE]><style type='text/css' id='".esc_attr( $_sID )."'>" |
|
394 | 394 | . $_sStyleIE |
395 | 395 | . "</style><![endif]-->"; |
396 | 396 | |
@@ -407,18 +407,18 @@ discard block |
||
407 | 407 | |
408 | 408 | static $_iCallCount = 1; |
409 | 409 | $_sFilterName = "script_{$this->oProp->sClassName}"; |
410 | - if ( $this->hasBeenCalled( 'FILTER: ' . $_sFilterName ) ) { // 3.8.22 |
|
410 | + if ( $this->hasBeenCalled( 'FILTER: '.$_sFilterName ) ) { // 3.8.22 |
|
411 | 411 | return ''; |
412 | 412 | } |
413 | 413 | $_sScript = $this->addAndApplyFilters( $this->oProp->oCaller, $_sFilterName, $this->oProp->sScript ); |
414 | 414 | $_sScript = trim( $_sScript ); |
415 | - if ( ! $_sScript ) { |
|
415 | + if ( !$_sScript ) { |
|
416 | 416 | return ''; |
417 | 417 | } |
418 | 418 | |
419 | 419 | $_iCallCount++; |
420 | 420 | $_sID = strtolower( "{$sIDPrefix}-{$this->oProp->sClassName}_{$_iCallCount}" ); |
421 | - echo "<script type='text/javascript' id='" . esc_attr( $_sID ) . "'>" |
|
421 | + echo "<script type='text/javascript' id='".esc_attr( $_sID )."'>" |
|
422 | 422 | . '/* <![CDATA[ */' |
423 | 423 | . $_sScript |
424 | 424 | . '/* ]]> */' |
@@ -442,12 +442,12 @@ discard block |
||
442 | 442 | public function _replyToAddStyle() { |
443 | 443 | |
444 | 444 | $_oCaller = $this->oProp->oCaller; |
445 | - if ( ! $_oCaller->isInThePage() ) { |
|
445 | + if ( !$_oCaller->isInThePage() ) { |
|
446 | 446 | return; |
447 | 447 | } |
448 | 448 | |
449 | 449 | $this->_printCommonStyles( 'admin-page-framework-style-common', get_class() ); |
450 | - $this->_printClassSpecificStyles( $this->_sClassSelector_Style . '-' . $this->oProp->sStructureType ); |
|
450 | + $this->_printClassSpecificStyles( $this->_sClassSelector_Style.'-'.$this->oProp->sStructureType ); |
|
451 | 451 | |
452 | 452 | } |
453 | 453 | /** |
@@ -462,12 +462,12 @@ discard block |
||
462 | 462 | public function _replyToAddScript() { |
463 | 463 | |
464 | 464 | $_oCaller = $this->oProp->oCaller; |
465 | - if ( ! $_oCaller->isInThePage() ) { |
|
465 | + if ( !$_oCaller->isInThePage() ) { |
|
466 | 466 | return; |
467 | 467 | } |
468 | 468 | |
469 | 469 | $this->_printCommonScripts( 'admin-page-framework-script-common', get_class() ); |
470 | - $this->_printClassSpecificScripts( $this->_sClassSelector_Script . '-' . $this->oProp->sStructureType ); |
|
470 | + $this->_printClassSpecificScripts( $this->_sClassSelector_Script.'-'.$this->oProp->sStructureType ); |
|
471 | 471 | |
472 | 472 | } |
473 | 473 | |
@@ -519,7 +519,7 @@ discard block |
||
519 | 519 | * @internal |
520 | 520 | */ |
521 | 521 | public function _replyToEnqueueStyles() { |
522 | - foreach( $this->oProp->aEnqueuingStyles as $_sKey => $_aEnqueuingStyle ) { |
|
522 | + foreach ( $this->oProp->aEnqueuingStyles as $_sKey => $_aEnqueuingStyle ) { |
|
523 | 523 | $this->_enqueueSRCByCondition( $_aEnqueuingStyle ); |
524 | 524 | unset( $this->oProp->aEnqueuingStyles[ $_sKey ] ); |
525 | 525 | } |
@@ -536,7 +536,7 @@ discard block |
||
536 | 536 | * @internal |
537 | 537 | */ |
538 | 538 | public function _replyToEnqueueScripts() { |
539 | - foreach( $this->oProp->aEnqueuingScripts as $_sKey => $_aEnqueuingScript ) { |
|
539 | + foreach ( $this->oProp->aEnqueuingScripts as $_sKey => $_aEnqueuingScript ) { |
|
540 | 540 | $this->_enqueueSRCByCondition( $_aEnqueuingScript ); |
541 | 541 | unset( $this->oProp->aEnqueuingScripts[ $_sKey ] ); |
542 | 542 | } |
@@ -352,7 +352,8 @@ discard block |
||
352 | 352 | static $_iCallCount = 0; |
353 | 353 | |
354 | 354 | $_sFilterName = "style_{$this->oProp->sClassName}"; |
355 | - if ( $this->hasBeenCalled( 'FILTER: ' . $_sFilterName ) ) { // 3.8.22 |
|
355 | + if ( $this->hasBeenCalled( 'FILTER: ' . $_sFilterName ) ) { |
|
356 | +// 3.8.22 |
|
356 | 357 | return ''; |
357 | 358 | } |
358 | 359 | $_sStyle = $this->addAndApplyFilters( $_oCaller, $_sFilterName, $this->oProp->sStyle ); |
@@ -379,7 +380,8 @@ discard block |
||
379 | 380 | static $_iCallCountIE = 1; |
380 | 381 | |
381 | 382 | $_sFilterName = "style_ie_{$this->oProp->sClassName}"; |
382 | - if ( $this->hasBeenCalled( 'FILTER: ' . $_sFilterName ) ) { // 3.8.22 |
|
383 | + if ( $this->hasBeenCalled( 'FILTER: ' . $_sFilterName ) ) { |
|
384 | +// 3.8.22 |
|
383 | 385 | return ''; |
384 | 386 | } |
385 | 387 | $_sStyleIE = $this->addAndApplyFilters( $_oCaller, $_sFilterName, $this->oProp->sStyleIE ); |
@@ -407,7 +409,8 @@ discard block |
||
407 | 409 | |
408 | 410 | static $_iCallCount = 1; |
409 | 411 | $_sFilterName = "script_{$this->oProp->sClassName}"; |
410 | - if ( $this->hasBeenCalled( 'FILTER: ' . $_sFilterName ) ) { // 3.8.22 |
|
412 | + if ( $this->hasBeenCalled( 'FILTER: ' . $_sFilterName ) ) { |
|
413 | +// 3.8.22 |
|
411 | 414 | return ''; |
412 | 415 | } |
413 | 416 | $_sScript = $this->addAndApplyFilters( $this->oProp->oCaller, $_sFilterName, $this->oProp->sScript ); |
@@ -27,9 +27,9 @@ discard block |
||
27 | 27 | * @return void |
28 | 28 | * @since 3.8.8 |
29 | 29 | */ |
30 | - static public function showDeprecationNotice( $sDeprecated, $sAlternative='', $sProgramName='Admin Page Framework' ) { |
|
30 | + static public function showDeprecationNotice( $sDeprecated, $sAlternative = '', $sProgramName = 'Admin Page Framework' ) { |
|
31 | 31 | trigger_error( |
32 | - $sProgramName . ': ' . sprintf( |
|
32 | + $sProgramName.': '.sprintf( |
|
33 | 33 | $sAlternative |
34 | 34 | ? '<code>%1$s</code> has been deprecated. Use <code>%2$s</code> instead.' |
35 | 35 | : '<code>%1$s</code> has been deprecated.', |
@@ -52,8 +52,8 @@ discard block |
||
52 | 52 | * @param string|array $asParameters Parameters to pass to the callback function. |
53 | 53 | * @return mixed |
54 | 54 | */ |
55 | - public function callBack( $oCallable, $asParameters=array() ) { |
|
56 | - $_aParameters = self::getAsArray( |
|
55 | + public function callBack( $oCallable, $asParameters = array() ) { |
|
56 | + $_aParameters = self::getAsArray( |
|
57 | 57 | $asParameters, |
58 | 58 | true // preserve empty |
59 | 59 | ); |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | * @since 3.6.3 |
91 | 91 | * @return string The captured output buffer. |
92 | 92 | */ |
93 | - static public function getOutputBuffer( $oCallable, array $aParameters=array() ) { |
|
93 | + static public function getOutputBuffer( $oCallable, array $aParameters = array() ) { |
|
94 | 94 | |
95 | 95 | ob_start(); |
96 | 96 | echo call_user_func_array( $oCallable, $aParameters ); |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | |
112 | 112 | $_iCount = count( get_object_vars( $oInstance ) ); |
113 | 113 | $_sClassName = get_class( $oInstance ); |
114 | - return '(object) ' . $_sClassName . ': ' . $_iCount . ' properties.'; |
|
114 | + return '(object) '.$_sClassName.': '.$_iCount.' properties.'; |
|
115 | 115 | |
116 | 116 | } |
117 | 117 | |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | * @param boolean|integer|double|string|array|object|resource|NULL $mTrue The value to return when the first parameter value yields false. |
129 | 129 | * @return mixed |
130 | 130 | */ |
131 | - static public function getAOrB( $mValue, $mTrue=null, $mFalse=null ) { |
|
131 | + static public function getAOrB( $mValue, $mTrue = null, $mFalse = null ) { |
|
132 | 132 | return $mValue ? $mTrue : $mFalse; |
133 | 133 | } |
134 | 134 |