@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | $_sPageSlug = $this->getHTTPQueryGET( 'page', '' ); |
46 | 46 | $_sTabSlug = $this->getHTTPQueryGET( 'tab', '' ); |
47 | 47 | $_sUserID = get_current_user_id(); |
48 | - return "apf_fe_" . md5( |
|
48 | + return "apf_fe_".md5( |
|
49 | 49 | $this->getPageNow() |
50 | 50 | . $_sPageSlug |
51 | 51 | . $_sTabSlug |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | public function get() { |
134 | 134 | |
135 | 135 | // Use a cache if exists. |
136 | - self::$_aFieldErrorCaches[ $this->sTransientKey ] = isset( self::$_aFieldErrorCaches[ $this->sTransientKey ] ) |
|
136 | + self::$_aFieldErrorCaches[ $this->sTransientKey ] = isset( self::$_aFieldErrorCaches[ $this->sTransientKey ] ) |
|
137 | 137 | ? self::$_aFieldErrorCaches[ $this->sTransientKey ] |
138 | 138 | : $this->getTransient( $this->sTransientKey ); |
139 | 139 | |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | * @since 3.7.0 |
151 | 151 | */ |
152 | 152 | public function delete() { |
153 | - if ( $this->hasBeenCalled( 'delete_' . $this->sTransientKey ) ) { |
|
153 | + if ( $this->hasBeenCalled( 'delete_'.$this->sTransientKey ) ) { |
|
154 | 154 | return; |
155 | 155 | } |
156 | 156 | add_action( 'shutdown', array( $this, '_replyToDelete' ) ); |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | 'after_label' => null, |
60 | 60 | 'before_field' => null, |
61 | 61 | 'after_field' => null, |
62 | - 'label_min_width' => '', // (string|integer) min-width applied to the input label in pixels. 3.8.0+ Changed the default value from 140 to 0 as it is now applied via embedded CSS. When this value is set by the user, it is set inline and the value will be overridden. [3.8.4+] Changed the value from `0` to `''`. |
|
62 | + 'label_min_width' => '', // (string|integer) min-width applied to the input label in pixels. 3.8.0+ Changed the default value from 140 to 0 as it is now applied via embedded CSS. When this value is set by the user, it is set inline and the value will be overridden. [3.8.4+] Changed the value from `0` to `''`. |
|
63 | 63 | 'before_fieldset' => null, // 3.1.1+ |
64 | 64 | 'after_fieldset' => null, // 3.1.1+ |
65 | 65 | |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | * @param object $oMsg The framework message object. |
100 | 100 | * @param boolean $bAutoRegister Whether or not to register the field type(s). |
101 | 101 | */ |
102 | - public function __construct( $asClassName='admin_page_framework', $asFieldTypeSlug=null, $oMsg=null, $bAutoRegister=true ) { |
|
102 | + public function __construct( $asClassName = 'admin_page_framework', $asFieldTypeSlug = null, $oMsg = null, $bAutoRegister = true ) { |
|
103 | 103 | |
104 | 104 | $this->aFieldTypeSlugs = empty( $asFieldTypeSlug ) |
105 | 105 | ? $this->aFieldTypeSlugs |
@@ -110,9 +110,9 @@ discard block |
||
110 | 110 | |
111 | 111 | // This automatically registers the field type. The build-in ones will be registered manually so it will be skipped. |
112 | 112 | if ( $bAutoRegister ) { |
113 | - foreach( ( array ) $asClassName as $_sClassName ) { |
|
113 | + foreach ( ( array ) $asClassName as $_sClassName ) { |
|
114 | 114 | add_filter( |
115 | - 'field_types_' . $_sClassName, |
|
115 | + 'field_types_'.$_sClassName, |
|
116 | 116 | array( $this, '_replyToRegisterInputFieldType' ) |
117 | 117 | ); |
118 | 118 | } |
@@ -161,8 +161,8 @@ discard block |
||
161 | 161 | } |
162 | 162 | return is_array( $asLabel ) // if the user sets multiple items |
163 | 163 | ? $this->getElement( |
164 | - $asElement, // subject |
|
165 | - $this->getAsArray( $asKey, true /* preserve empty */ ), // dimensional path |
|
164 | + $asElement, // subject |
|
165 | + $this->getAsArray( $asKey, true /* preserve empty */ ), // dimensional path |
|
166 | 166 | '' // default - if the element is not found, return an empty |
167 | 167 | ) |
168 | 168 | : $asElement; |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | */ |
179 | 179 | protected function getFieldOutput( array $aFieldset ) { |
180 | 180 | |
181 | - if ( ! is_object( $aFieldset[ '_caller_object' ] ) ) { |
|
181 | + if ( !is_object( $aFieldset[ '_caller_object' ] ) ) { |
|
182 | 182 | return ''; |
183 | 183 | } |
184 | 184 | |
@@ -186,14 +186,14 @@ discard block |
||
186 | 186 | $aFieldset[ '_parent_field_object' ] = $aFieldset[ '_field_object' ]; // 3.6.0+ |
187 | 187 | |
188 | 188 | // 3.7.0+ The caller object is no longer a factory object but a form object. |
189 | - $_oCallerForm = $aFieldset[ '_caller_object' ]; |
|
189 | + $_oCallerForm = $aFieldset[ '_caller_object' ]; |
|
190 | 190 | |
191 | 191 | $_oFieldset = new AdminPageFramework_Form_View___Fieldset( |
192 | - $aFieldset, // the field definition array |
|
193 | - $_oCallerForm->aSavedData, // the stored form data |
|
194 | - $_oCallerForm->getFieldErrors(), // the field error array. |
|
195 | - $_oCallerForm->aFieldTypeDefinitions, // the field type definition array. |
|
196 | - $_oCallerForm->oMsg, // the system message object |
|
192 | + $aFieldset, // the field definition array |
|
193 | + $_oCallerForm->aSavedData, // the stored form data |
|
194 | + $_oCallerForm->getFieldErrors(), // the field error array. |
|
195 | + $_oCallerForm->aFieldTypeDefinitions, // the field type definition array. |
|
196 | + $_oCallerForm->oMsg, // the system message object |
|
197 | 197 | $_oCallerForm->aCallbacks // field output element callables. |
198 | 198 | ); |
199 | 199 | return $_oFieldset->get(); |
@@ -237,13 +237,13 @@ discard block |
||
237 | 237 | * @return array |
238 | 238 | * @internal |
239 | 239 | */ |
240 | - public function getDefinitionArray( $sFieldTypeSlug='' ) { |
|
240 | + public function getDefinitionArray( $sFieldTypeSlug = '' ) { |
|
241 | 241 | |
242 | 242 | // The uniteArrays() method resulted in somewhat being slow due to overhead on checking array keys for recursive array merges. |
243 | 243 | $_aDefaultKeys = $this->aDefaultKeys + self::$_aDefaultKeys; |
244 | - $_aDefaultKeys['attributes'] = isset( $this->aDefaultKeys['attributes'] ) && is_array( $this->aDefaultKeys['attributes'] ) |
|
245 | - ? $this->aDefaultKeys['attributes'] + self::$_aDefaultKeys['attributes'] |
|
246 | - : self::$_aDefaultKeys['attributes']; |
|
244 | + $_aDefaultKeys[ 'attributes' ] = isset( $this->aDefaultKeys[ 'attributes' ] ) && is_array( $this->aDefaultKeys[ 'attributes' ] ) |
|
245 | + ? $this->aDefaultKeys[ 'attributes' ] + self::$_aDefaultKeys[ 'attributes' ] |
|
246 | + : self::$_aDefaultKeys[ 'attributes' ]; |
|
247 | 247 | |
248 | 248 | return array( |
249 | 249 | 'sFieldTypeSlug' => $sFieldTypeSlug, |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | * @param string $sFieldSetType |
290 | 290 | * @internal |
291 | 291 | */ |
292 | - public function _replyToFieldTypeSetter( $sFieldSetType='' ) { |
|
292 | + public function _replyToFieldTypeSetter( $sFieldSetType = '' ) { |
|
293 | 293 | $this->_sFieldSetType = $sFieldSetType; |
294 | 294 | } |
295 | 295 | |
@@ -344,8 +344,8 @@ discard block |
||
344 | 344 | wp_enqueue_script( 'media-upload' ); |
345 | 345 | } |
346 | 346 | |
347 | - if ( in_array( $this->getPageNow(), array( 'media-upload.php', 'async-upload.php', ) ) ) { |
|
348 | - add_filter( 'gettext', array( $this, '_replyToReplaceThickBoxText' ) , 1, 2 ); |
|
347 | + if ( in_array( $this->getPageNow(), array( 'media-upload.php', 'async-upload.php',) ) ) { |
|
348 | + add_filter( 'gettext', array( $this, '_replyToReplaceThickBoxText' ), 1, 2 ); |
|
349 | 349 | } |
350 | 350 | |
351 | 351 | } |
@@ -363,7 +363,7 @@ discard block |
||
363 | 363 | public function _replyToReplaceThickBoxText( $sTranslated, $sText ) { |
364 | 364 | |
365 | 365 | // Replace the button label in the media thick box. |
366 | - if ( ! in_array( $this->getPageNow(), array( 'media-upload.php', 'async-upload.php' ) ) ) { |
|
366 | + if ( !in_array( $this->getPageNow(), array( 'media-upload.php', 'async-upload.php' ) ) ) { |
|
367 | 367 | return $sTranslated; |
368 | 368 | } |
369 | 369 | if ( $sText !== 'Insert into Post' ) { |
@@ -396,10 +396,10 @@ discard block |
||
396 | 396 | */ |
397 | 397 | public function _replyToRemovingMediaLibraryTab( $aTabs ) { |
398 | 398 | |
399 | - if ( ! isset( $_REQUEST[ 'enable_external_source' ] ) ) { // sanitization unnecessary |
|
399 | + if ( !isset( $_REQUEST[ 'enable_external_source' ] ) ) { // sanitization unnecessary |
|
400 | 400 | return $aTabs; |
401 | 401 | } |
402 | - if ( ! ( boolean ) $_REQUEST[ 'enable_external_source' ] ) { // sanitization unnecessary |
|
402 | + if ( !( boolean ) $_REQUEST[ 'enable_external_source' ] ) { // sanitization unnecessary |
|
403 | 403 | unset( $aTabs[ 'type_url' ] ); // removes the 'From URL' tab in the thick box. |
404 | 404 | } |
405 | 405 | return $aTabs; |
@@ -417,7 +417,7 @@ discard block |
||
417 | 417 | * @return string |
418 | 418 | * @since 3.8.0 |
419 | 419 | */ |
420 | - protected function getLabelContainerAttributes( $aField, $asClassAttributes, array $aAttributes=array() ) { |
|
420 | + protected function getLabelContainerAttributes( $aField, $asClassAttributes, array $aAttributes = array() ) { |
|
421 | 421 | |
422 | 422 | $aAttributes[ 'class' ] = $this->getClassAttribute( $asClassAttributes, $this->getElement( $aAttributes, 'class' ) ); |
423 | 423 | $aAttributes[ 'style' ] = $this->getStyleAttribute( |
@@ -337,14 +337,14 @@ discard block |
||
337 | 337 | wp_enqueue_script( 'thickbox' ); |
338 | 338 | wp_enqueue_style( 'thickbox' ); |
339 | 339 | |
340 | - if ( function_exists( 'wp_enqueue_media' ) ) { |
|
340 | + if ( function_exists( 'wp_enqueue_media' ) ) { |
|
341 | 341 | // If the WordPress version is 3.5 or above, |
342 | 342 | new AdminPageFramework_Form_View___Script_MediaUploader( $this->oMsg ); |
343 | 343 | } else { |
344 | 344 | wp_enqueue_script( 'media-upload' ); |
345 | 345 | } |
346 | 346 | |
347 | - if ( in_array( $this->getPageNow(), array( 'media-upload.php', 'async-upload.php', ) ) ) { |
|
347 | + if ( in_array( $this->getPageNow(), array( 'media-upload.php', 'async-upload.php', ) ) ) { |
|
348 | 348 | add_filter( 'gettext', array( $this, '_replyToReplaceThickBoxText' ) , 1, 2 ); |
349 | 349 | } |
350 | 350 | |
@@ -363,17 +363,18 @@ discard block |
||
363 | 363 | public function _replyToReplaceThickBoxText( $sTranslated, $sText ) { |
364 | 364 | |
365 | 365 | // Replace the button label in the media thick box. |
366 | - if ( ! in_array( $this->getPageNow(), array( 'media-upload.php', 'async-upload.php' ) ) ) { |
|
366 | + if ( ! in_array( $this->getPageNow(), array( 'media-upload.php', 'async-upload.php' ) ) ) { |
|
367 | 367 | return $sTranslated; |
368 | 368 | } |
369 | - if ( $sText !== 'Insert into Post' ) { |
|
369 | + if ( $sText !== 'Insert into Post' ) { |
|
370 | 370 | return $sTranslated; |
371 | 371 | } |
372 | - if ( $this->getQueryValueInURLByKey( wp_get_referer(), 'referrer' ) !== 'admin_page_framework' ) { |
|
372 | + if ( $this->getQueryValueInURLByKey( wp_get_referer(), 'referrer' ) !== 'admin_page_framework' ) { |
|
373 | 373 | return $sTranslated; |
374 | 374 | } |
375 | 375 | |
376 | - if ( isset( $_GET[ 'button_label' ] ) ) { // sanitization unnecessary |
|
376 | + if ( isset( $_GET[ 'button_label' ] ) ) { |
|
377 | +// sanitization unnecessary |
|
377 | 378 | return $this->getHTTPQueryGET( 'button_label', '' ); |
378 | 379 | } |
379 | 380 | |
@@ -396,10 +397,12 @@ discard block |
||
396 | 397 | */ |
397 | 398 | public function _replyToRemovingMediaLibraryTab( $aTabs ) { |
398 | 399 | |
399 | - if ( ! isset( $_REQUEST[ 'enable_external_source' ] ) ) { // sanitization unnecessary |
|
400 | + if ( ! isset( $_REQUEST[ 'enable_external_source' ] ) ) { |
|
401 | +// sanitization unnecessary |
|
400 | 402 | return $aTabs; |
401 | 403 | } |
402 | - if ( ! ( boolean ) $_REQUEST[ 'enable_external_source' ] ) { // sanitization unnecessary |
|
404 | + if ( ! ( boolean ) $_REQUEST[ 'enable_external_source' ] ) { |
|
405 | +// sanitization unnecessary |
|
403 | 406 | unset( $aTabs[ 'type_url' ] ); // removes the 'From URL' tab in the thick box. |
404 | 407 | } |
405 | 408 | return $aTabs; |
@@ -64,10 +64,10 @@ discard block |
||
64 | 64 | * @return array |
65 | 65 | * @since 3.7.0 |
66 | 66 | */ |
67 | - public function getSubmittedData( array $aDataToParse, $bExtractFromFieldStructure=true, $bStripSlashes=true ) { |
|
67 | + public function getSubmittedData( array $aDataToParse, $bExtractFromFieldStructure = true, $bStripSlashes = true ) { |
|
68 | 68 | |
69 | 69 | // Extracts the form data from the subject data for parsing |
70 | - $_aSubmittedFormData = $bExtractFromFieldStructure |
|
70 | + $_aSubmittedFormData = $bExtractFromFieldStructure |
|
71 | 71 | ? $this->castArrayContents( |
72 | 72 | $this->getDataStructureFromAddedFieldsets(), // form data (options) structure |
73 | 73 | $aDataToParse // the subject data array, usually `$_POST`. |
@@ -95,12 +95,12 @@ discard block |
||
95 | 95 | array_merge( |
96 | 96 | $this->getElementAsArray( |
97 | 97 | $_POST, // sanitization done |
98 | - '__repeatable_elements_' . $this->aArguments[ 'structure_type' ], |
|
98 | + '__repeatable_elements_'.$this->aArguments[ 'structure_type' ], |
|
99 | 99 | array() |
100 | 100 | ), |
101 | 101 | $this->getElementAsArray( |
102 | 102 | $_POST, // sanitization done |
103 | - '__sortable_elements_' . $this->aArguments[ 'structure_type' ], |
|
103 | + '__sortable_elements_'.$this->aArguments[ 'structure_type' ], |
|
104 | 104 | array() |
105 | 105 | ) |
106 | 106 | ) |
@@ -160,9 +160,9 @@ discard block |
||
160 | 160 | * Changed the name from `getFieldsModel()`. |
161 | 161 | * @return array |
162 | 162 | */ |
163 | - public function getDataStructureFromAddedFieldsets() { |
|
163 | + public function getDataStructureFromAddedFieldsets() { |
|
164 | 164 | |
165 | - $_aFormDataStructure = array(); |
|
165 | + $_aFormDataStructure = array(); |
|
166 | 166 | foreach ( $this->getAsArray( $this->aFieldsets ) as $_sSectionID => $_aFieldsets ) { |
167 | 167 | |
168 | 168 | if ( $_sSectionID !== '_default' ) { |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | } |
172 | 172 | |
173 | 173 | // For default field items. |
174 | - foreach( $_aFieldsets as $_sFieldID => $_aFieldset ) { |
|
174 | + foreach ( $_aFieldsets as $_sFieldID => $_aFieldset ) { |
|
175 | 175 | $_aFormDataStructure[ $_aFieldset[ 'field_id' ] ] = $_aFieldset; |
176 | 176 | } |
177 | 177 | |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | $aSubject, |
204 | 204 | $this->getHTTPRequestSanitized( $this->getElementAsArray( |
205 | 205 | $_POST, // sanitization done |
206 | - '__repeatable_elements_' . $this->aArguments[ 'structure_type' ] |
|
206 | + '__repeatable_elements_'.$this->aArguments[ 'structure_type' ] |
|
207 | 207 | ) ) |
208 | 208 | ); |
209 | 209 | return $_oFilterRepeatableElements->get(); |
@@ -216,13 +216,13 @@ discard block |
||
216 | 216 | public function _replyToRegisterFormItems() { |
217 | 217 | |
218 | 218 | // Check if the form should be created or not. |
219 | - if ( ! $this->isInThePage() ) { |
|
219 | + if ( !$this->isInThePage() ) { |
|
220 | 220 | return; |
221 | 221 | } |
222 | 222 | |
223 | 223 | // Load field type definitions. |
224 | - $this->_setFieldTypeDefinitions( 'admin_page_framework' ); // site-wide |
|
225 | - $this->_setFieldTypeDefinitions( $this->aArguments[ 'caller_id' ] ); // per class |
|
224 | + $this->_setFieldTypeDefinitions( 'admin_page_framework' ); // site-wide |
|
225 | + $this->_setFieldTypeDefinitions( $this->aArguments[ 'caller_id' ] ); // per class |
|
226 | 226 | |
227 | 227 | // Set the options array |
228 | 228 | $this->aSavedData = $this->_getSavedData( |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | $this->aArguments, |
251 | 251 | $this->aFieldsets, |
252 | 252 | self::$_aResources, |
253 | - $this->aFieldTypeDefinitions, // must be called after performing `_setFieldTypeDefinitions()`. |
|
253 | + $this->aFieldTypeDefinitions, // must be called after performing `_setFieldTypeDefinitions()`. |
|
254 | 254 | $this->aCallbacks |
255 | 255 | ); |
256 | 256 | self::$_aResources = $_oFieldResources->get(); // updates the property |
@@ -267,10 +267,10 @@ discard block |
||
267 | 267 | $this->callBack( |
268 | 268 | $this->aCallbacks[ 'handle_form_data' ], |
269 | 269 | array( |
270 | - $this->aSavedData, // 1st parameter |
|
271 | - $this->aArguments, // 2nd parameter |
|
272 | - $this->aSectionsets, // 3rd parameter |
|
273 | - $this->aFieldsets, // 4th parameter |
|
270 | + $this->aSavedData, // 1st parameter |
|
271 | + $this->aArguments, // 2nd parameter |
|
272 | + $this->aSectionsets, // 3rd parameter |
|
273 | + $this->aFieldsets, // 4th parameter |
|
274 | 274 | ) |
275 | 275 | ); |
276 | 276 | |
@@ -284,15 +284,15 @@ discard block |
||
284 | 284 | $this->aSectionsets = $this->callBack( |
285 | 285 | $this->aCallbacks[ 'sectionsets_before_registration' ], |
286 | 286 | array( |
287 | - $this->aSectionsets, // 1st parameter |
|
287 | + $this->aSectionsets, // 1st parameter |
|
288 | 288 | ) |
289 | 289 | ); |
290 | 290 | // Let the main routine modify the fieldsets definition array. |
291 | 291 | $this->aFieldsets = $this->callBack( |
292 | 292 | $this->aCallbacks[ 'fieldsets_before_registration' ], |
293 | 293 | array( |
294 | - $this->aFieldsets, // 1st parameter |
|
295 | - $this->aSectionsets, // 2nd parameter |
|
294 | + $this->aFieldsets, // 1st parameter |
|
295 | + $this->aSectionsets, // 2nd parameter |
|
296 | 296 | ) |
297 | 297 | ); |
298 | 298 |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | array( $this, '_replyToRegisterFormItems' ), |
47 | 47 | 100 // priority - low value is set as meta boxes use the `current_screen` action hook for `setUp()`. |
48 | 48 | ); |
49 | - } else { |
|
49 | + } else { |
|
50 | 50 | add_action( |
51 | 51 | $this->aArguments[ 'action_hook_form_registration' ], |
52 | 52 | array( $this, '_replyToRegisterFormItems' ) |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | * Changed the name from `getFieldsModel()`. |
161 | 161 | * @return array |
162 | 162 | */ |
163 | - public function getDataStructureFromAddedFieldsets() { |
|
163 | + public function getDataStructureFromAddedFieldsets() { |
|
164 | 164 | |
165 | 165 | $_aFormDataStructure = array(); |
166 | 166 | foreach ( $this->getAsArray( $this->aFieldsets ) as $_sSectionID => $_aFieldsets ) { |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | * @param array $aSubject The subject array to modify. Usually the saved option data. |
199 | 199 | * @return array The modified options array. |
200 | 200 | */ |
201 | - public function dropRepeatableElements( array $aSubject ) { |
|
201 | + public function dropRepeatableElements( array $aSubject ) { |
|
202 | 202 | $_oFilterRepeatableElements = new AdminPageFramework_Form_Model___Modifier_FilterRepeatableElements( |
203 | 203 | $aSubject, |
204 | 204 | $this->getHTTPRequestSanitized( $this->getElementAsArray( |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | 'getPostTypeByTypeNow', |
57 | 57 | 'getPostTypeByScreenObject', |
58 | 58 | 'getPostTypeByREQUEST', |
59 | - 'getPostTypeByPostObject', // 3.6.0+ Moved to the last as it is not reliable. |
|
59 | + 'getPostTypeByPostObject', // 3.6.0+ Moved to the last as it is not reliable. |
|
60 | 60 | ); |
61 | 61 | foreach ( $_aMethodsToTry as $_sMethodName ) { |
62 | 62 | $_sPostType = call_user_func( array( __CLASS__, $_sMethodName ) ); |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | } |
97 | 97 | if ( isset( $_GET[ 'post' ] ) && $_GET[ 'post' ] ) { // sanitization unnecessary |
98 | 98 | // It will perform a database query. |
99 | - return get_post_type( absint( self::getHTTPQueryGET( 'post', 0 ) ) ); // sanitization done |
|
99 | + return get_post_type( absint( self::getHTTPQueryGET( 'post', 0 ) ) ); // sanitization done |
|
100 | 100 | } |
101 | 101 | } |
102 | 102 | |
@@ -120,9 +120,9 @@ discard block |
||
120 | 120 | * @param array|string The post type slug(s) to check. If this is empty, the method just checks the current page is a taxonomy page. |
121 | 121 | * @return boolean |
122 | 122 | */ |
123 | - static public function isCustomTaxonomyPage( $asPostTypes=array() ) { |
|
123 | + static public function isCustomTaxonomyPage( $asPostTypes = array() ) { |
|
124 | 124 | |
125 | - if ( ! in_array( self::getPageNow(), array( 'tags.php', 'edit-tags.php', 'term.php' ) ) ) { |
|
125 | + if ( !in_array( self::getPageNow(), array( 'tags.php', 'edit-tags.php', 'term.php' ) ) ) { |
|
126 | 126 | return false; |
127 | 127 | } |
128 | 128 | return self::isCurrentPostTypeIn( $asPostTypes ); |
@@ -137,10 +137,10 @@ discard block |
||
137 | 137 | * Otherwise, it will check if the page belongs to the given post type(s). |
138 | 138 | * @return boolean |
139 | 139 | */ |
140 | - static public function isPostDefinitionPage( $asPostTypes=array() ) { |
|
140 | + static public function isPostDefinitionPage( $asPostTypes = array() ) { |
|
141 | 141 | |
142 | 142 | // If it's not the post definition page, |
143 | - if ( ! in_array( self::getPageNow(), array( 'post.php', 'post-new.php', ) ) ) { |
|
143 | + if ( !in_array( self::getPageNow(), array( 'post.php', 'post-new.php',) ) ) { |
|
144 | 144 | return false; |
145 | 145 | } |
146 | 146 | return self::isCurrentPostTypeIn( $asPostTypes ); |
@@ -173,17 +173,17 @@ discard block |
||
173 | 173 | * |
174 | 174 | * @since 3.0.0 |
175 | 175 | */ |
176 | - static public function isPostListingPage( $asPostTypes=array() ) { |
|
176 | + static public function isPostListingPage( $asPostTypes = array() ) { |
|
177 | 177 | |
178 | 178 | if ( 'edit.php' != self::getPageNow() ) { |
179 | 179 | return false; |
180 | 180 | } |
181 | 181 | |
182 | 182 | $_aPostTypes = self::getAsArray( $asPostTypes ); |
183 | - if ( ! isset( $_GET[ 'post_type' ] ) ) { // sanitization unnecessary |
|
183 | + if ( !isset( $_GET[ 'post_type' ] ) ) { // sanitization unnecessary |
|
184 | 184 | return in_array( 'post', $_aPostTypes, true ); |
185 | 185 | } |
186 | - return in_array( $_GET[ 'post_type' ], $_aPostTypes, true ); // sanitization unnecessary |
|
186 | + return in_array( $_GET[ 'post_type' ], $_aPostTypes, true ); // sanitization unnecessary |
|
187 | 187 | |
188 | 188 | } |
189 | 189 | |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | 0 => '_getPageNow_FrontEnd', |
218 | 218 | 1 => '_getPageNow_BackEnd', |
219 | 219 | ); |
220 | - $_sMethodName = $_aMethodNames[ ( integer ) is_admin() ]; |
|
220 | + $_sMethodName = $_aMethodNames[ ( integer ) is_admin() ]; |
|
221 | 221 | self::$_sPageNow = self::$_sMethodName(); |
222 | 222 | return self::$_sPageNow; |
223 | 223 | |
@@ -312,7 +312,7 @@ discard block |
||
312 | 312 | |
313 | 313 | if ( isset( $GLBOALS[ 'page_hook' ] ) ) { |
314 | 314 | return is_network_admin() |
315 | - ? $GLBOALS[ 'page_hook' ] . '-network' |
|
315 | + ? $GLBOALS[ 'page_hook' ].'-network' |
|
316 | 316 | : $GLBOALS[ 'page_hook' ]; |
317 | 317 | } |
318 | 318 | |
@@ -326,11 +326,11 @@ discard block |
||
326 | 326 | * @since 3.7.0 |
327 | 327 | * @return boolean |
328 | 328 | */ |
329 | - static public function doesMetaBoxExist( $sContext='' ) { |
|
329 | + static public function doesMetaBoxExist( $sContext = '' ) { |
|
330 | 330 | |
331 | 331 | $_aDimensions = array( 'wp_meta_boxes', $GLOBALS[ 'page_hook' ] ); |
332 | 332 | if ( $sContext ) { |
333 | - $_aDimensions[] = $sContext; |
|
333 | + $_aDimensions[ ] = $sContext; |
|
334 | 334 | } |
335 | 335 | $_aSideMetaBoxes = self::getElementAsArray( |
336 | 336 | $GLOBALS, |
@@ -91,10 +91,12 @@ discard block |
||
91 | 91 | * Tries to find the post type from the URL query for type. |
92 | 92 | */ |
93 | 93 | static public function getPostTypeByREQUEST() { |
94 | - if ( isset( $_REQUEST[ 'post_type' ] ) ) { // sanitization unnecessary |
|
94 | + if ( isset( $_REQUEST[ 'post_type' ] ) ) { |
|
95 | +// sanitization unnecessary |
|
95 | 96 | return sanitize_key( sanitize_text_field( $_REQUEST[ 'post_type' ] ) ); // sanitization done |
96 | 97 | } |
97 | - if ( isset( $_GET[ 'post' ] ) && $_GET[ 'post' ] ) { // sanitization unnecessary |
|
98 | + if ( isset( $_GET[ 'post' ] ) && $_GET[ 'post' ] ) { |
|
99 | +// sanitization unnecessary |
|
98 | 100 | // It will perform a database query. |
99 | 101 | return get_post_type( absint( self::getHTTPQueryGET( 'post', 0 ) ) ); // sanitization done |
100 | 102 | } |
@@ -180,7 +182,8 @@ discard block |
||
180 | 182 | } |
181 | 183 | |
182 | 184 | $_aPostTypes = self::getAsArray( $asPostTypes ); |
183 | - if ( ! isset( $_GET[ 'post_type' ] ) ) { // sanitization unnecessary |
|
185 | + if ( ! isset( $_GET[ 'post_type' ] ) ) { |
|
186 | +// sanitization unnecessary |
|
184 | 187 | return in_array( 'post', $_aPostTypes, true ); |
185 | 188 | } |
186 | 189 | return in_array( $_GET[ 'post_type' ], $_aPostTypes, true ); // sanitization unnecessary |
@@ -270,11 +273,9 @@ discard block |
||
270 | 273 | |
271 | 274 | if ( is_network_admin() ) { |
272 | 275 | $_sNeedle = '#/wp-admin/network/?(.*?)$#i'; |
273 | - } |
|
274 | - else if ( is_user_admin() ) { |
|
276 | + } else if ( is_user_admin() ) { |
|
275 | 277 | $_sNeedle = '#/wp-admin/user/?(.*?)$#i'; |
276 | - } |
|
277 | - else { |
|
278 | + } else { |
|
278 | 279 | $_sNeedle = '#/wp-admin/?(.*?)$#i'; |
279 | 280 | } |
280 | 281 | preg_match( $_sNeedle, $_SERVER[ 'PHP_SELF' ], $_aMatches ); |
@@ -29,10 +29,10 @@ discard block |
||
29 | 29 | * @return string|array |
30 | 30 | * @since 3.8.32 |
31 | 31 | */ |
32 | - static public function getHTTPQueryGET( $asKeys=array(), $mDefault=null ) { |
|
32 | + static public function getHTTPQueryGET( $asKeys = array(), $mDefault = null ) { |
|
33 | 33 | self::$___aGET = isset( self::$___aGET ) |
34 | 34 | ? self::$___aGET |
35 | - : self::getArrayMappedRecursive( 'sanitize_text_field', $_GET ); // sanitization done |
|
35 | + : self::getArrayMappedRecursive( 'sanitize_text_field', $_GET ); // sanitization done |
|
36 | 36 | if ( empty( $asKeys ) ) { |
37 | 37 | return self::$___aGET; |
38 | 38 | } |
@@ -51,9 +51,9 @@ discard block |
||
51 | 51 | $sPageURL = 'on' == @$_SERVER[ "HTTPS" ] ? "https://" : "http://"; |
52 | 52 | |
53 | 53 | if ( "80" != $_SERVER[ "SERVER_PORT" ] ) { |
54 | - $sPageURL .= $_SERVER[ "SERVER_NAME" ] . ":" . $_SERVER[ "SERVER_PORT" ] . $sRequestURI; |
|
54 | + $sPageURL .= $_SERVER[ "SERVER_NAME" ].":".$_SERVER[ "SERVER_PORT" ].$sRequestURI; |
|
55 | 55 | } else { |
56 | - $sPageURL .= $_SERVER[ "SERVER_NAME" ] . $sRequestURI; |
|
56 | + $sPageURL .= $_SERVER[ "SERVER_NAME" ].$sRequestURI; |
|
57 | 57 | } |
58 | 58 | return $sPageURL; |
59 | 59 | |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | * @param string $sSubjectURL ( optional ) The subject url to modify |
71 | 71 | * @return string The modified url. |
72 | 72 | */ |
73 | - static public function getQueryAdminURL( $aAddingQueries=array(), $aRemovingQueryKeys=array(), $sSubjectURL='' ) { |
|
73 | + static public function getQueryAdminURL( $aAddingQueries = array(), $aRemovingQueryKeys = array(), $sSubjectURL = '' ) { |
|
74 | 74 | |
75 | 75 | $_sAdminURL = is_network_admin() |
76 | 76 | ? network_admin_url( AdminPageFramework_WPUtility_Page::getPageNow() ) |
@@ -116,16 +116,16 @@ discard block |
||
116 | 116 | * @remark The parsable path is limited to under the WP_CONTENT_DIR directory. |
117 | 117 | */ |
118 | 118 | static public function getSRCFromPath( $sFilePath ) { |
119 | - $sFilePath = str_replace('\\', '/', $sFilePath ); |
|
120 | - $_sContentDirPath = str_replace('\\', '/', WP_CONTENT_DIR ); |
|
119 | + $sFilePath = str_replace( '\\', '/', $sFilePath ); |
|
120 | + $_sContentDirPath = str_replace( '\\', '/', WP_CONTENT_DIR ); |
|
121 | 121 | if ( false !== strpos( $sFilePath, $_sContentDirPath ) ) { |
122 | - $_sRelativePath = AdminPageFramework_Utility::getRelativePath( WP_CONTENT_DIR , $sFilePath ); |
|
123 | - $_sRelativePath = preg_replace("/^\.[\/\\\]/", '', $_sRelativePath, 1 ); |
|
122 | + $_sRelativePath = AdminPageFramework_Utility::getRelativePath( WP_CONTENT_DIR, $sFilePath ); |
|
123 | + $_sRelativePath = preg_replace( "/^\.[\/\\\]/", '', $_sRelativePath, 1 ); |
|
124 | 124 | return content_url( $_sRelativePath ); |
125 | 125 | } |
126 | - $_sRelativePath = AdminPageFramework_Utility::getRelativePath( ABSPATH , $sFilePath ); |
|
127 | - $_sRelativePath = preg_replace("/^\.[\/\\\]/", '', $_sRelativePath, 1 ); |
|
128 | - return trailingslashit( get_bloginfo( 'url' ) ) . $_sRelativePath; |
|
126 | + $_sRelativePath = AdminPageFramework_Utility::getRelativePath( ABSPATH, $sFilePath ); |
|
127 | + $_sRelativePath = preg_replace( "/^\.[\/\\\]/", '', $_sRelativePath, 1 ); |
|
128 | + return trailingslashit( get_bloginfo( 'url' ) ).$_sRelativePath; |
|
129 | 129 | } |
130 | 130 | |
131 | 131 | /** |
@@ -141,9 +141,9 @@ discard block |
||
141 | 141 | * @param string $sSRC |
142 | 142 | * @param boolean $bReturnNullIfNotExist |
143 | 143 | */ |
144 | - static public function getResolvedSRC( $sSRC, $bReturnNullIfNotExist=false ) { |
|
144 | + static public function getResolvedSRC( $sSRC, $bReturnNullIfNotExist = false ) { |
|
145 | 145 | |
146 | - if ( ! self::isResourcePath( $sSRC ) ) { |
|
146 | + if ( !self::isResourcePath( $sSRC ) ) { |
|
147 | 147 | return $bReturnNullIfNotExist |
148 | 148 | ? null |
149 | 149 | : $sSRC; |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | |
157 | 157 | // If the file exists, it means it is an absolute path. If so, calculate the URL from the path. |
158 | 158 | if ( file_exists( realpath( $sSRC ) ) ) { |
159 | - return self::getSRCFromPath( $sSRC ); // url escaping is done in the method |
|
159 | + return self::getSRCFromPath( $sSRC ); // url escaping is done in the method |
|
160 | 160 | } |
161 | 161 | |
162 | 162 | if ( $bReturnNullIfNotExist ) { |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | * @param boolean $bReturnNullIfNotExist |
174 | 174 | * @return string |
175 | 175 | */ |
176 | - static public function resolveSRC( $sSRC, $bReturnNullIfNotExist=false ) { |
|
176 | + static public function resolveSRC( $sSRC, $bReturnNullIfNotExist = false ) { |
|
177 | 177 | return self::getResolvedSRC( $sSRC, $bReturnNullIfNotExist ); |
178 | 178 | } |
179 | 179 |
@@ -30,13 +30,13 @@ discard block |
||
30 | 30 | * @see wp_create_nonce() |
31 | 31 | * @since 3.8.32 |
32 | 32 | */ |
33 | - static public function getNonceCreated( $sAction=-1, $iLifespan=86400 ) { |
|
33 | + static public function getNonceCreated( $sAction = -1, $iLifespan = 86400 ) { |
|
34 | 34 | self::$___iCustomNonceLifeSpan = $iLifespan; |
35 | 35 | add_filter( 'nonce_life', array( __CLASS__, '_replyToSetNonceLifeSpan' ) ); |
36 | - $_sNonce = ( string ) wp_create_nonce($sAction ); |
|
36 | + $_sNonce = ( string ) wp_create_nonce( $sAction ); |
|
37 | 37 | remove_filter( 'nonce_life', array( __CLASS__, '_replyToSetNonceLifeSpan' ) ); |
38 | 38 | self::$___iCustomNonceLifeSpan = null; |
39 | - return $_sNonce ; |
|
39 | + return $_sNonce; |
|
40 | 40 | } |
41 | 41 | /** |
42 | 42 | * @param integer $iLifespanInSeconds |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | if ( is_string( $_sCustomMenuSlug ) ) { |
63 | 63 | return $_sCustomMenuSlug; |
64 | 64 | } |
65 | - return 'edit.php?post_type=' . $sPostTypeSlug; |
|
65 | + return 'edit.php?post_type='.$sPostTypeSlug; |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | /** |
@@ -96,8 +96,8 @@ discard block |
||
96 | 96 | static public function getWPAdminDirPath() { |
97 | 97 | |
98 | 98 | $_sWPAdminPath = str_replace( |
99 | - get_bloginfo( 'url' ) . '/', // search |
|
100 | - ABSPATH, // replace |
|
99 | + get_bloginfo( 'url' ).'/', // search |
|
100 | + ABSPATH, // replace |
|
101 | 101 | get_admin_url() // subject - works even in the network admin |
102 | 102 | ); |
103 | 103 | return rtrim( $_sWPAdminPath, '/' ); |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | * @since 3.7.0 |
116 | 116 | * @return void |
117 | 117 | */ |
118 | - static public function goToLocalURL( $sURL, $oCallbackOnError=null ) { |
|
118 | + static public function goToLocalURL( $sURL, $oCallbackOnError = null ) { |
|
119 | 119 | self::redirectByType( $sURL, 1, $oCallbackOnError ); |
120 | 120 | } |
121 | 121 | |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | * @since 3.6.3 |
129 | 129 | * @since 3.7.0 Added the second callback parameter. |
130 | 130 | */ |
131 | - static public function goToURL( $sURL, $oCallbackOnError=null ) { |
|
131 | + static public function goToURL( $sURL, $oCallbackOnError = null ) { |
|
132 | 132 | self::redirectByType( $sURL, 0, $oCallbackOnError ); |
133 | 133 | } |
134 | 134 | |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | * @param integer $iType 0: external site, 1: local site (within the same domain). |
139 | 139 | * @param callable $oCallbackOnError |
140 | 140 | */ |
141 | - static public function redirectByType( $sURL, $iType=0, $oCallbackOnError=null ) { |
|
141 | + static public function redirectByType( $sURL, $iType = 0, $oCallbackOnError = null ) { |
|
142 | 142 | |
143 | 143 | $_iRedirectError = self::getRedirectPreError( $sURL, $iType ); |
144 | 144 | if ( $_iRedirectError && is_callable( $oCallbackOnError ) ) { |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | static public function getRedirectPreError( $sURL, $iType ) { |
170 | 170 | |
171 | 171 | // check only external urls as local ones can be a relative url and always fails the below check. |
172 | - if ( ! $iType && filter_var( $sURL, FILTER_VALIDATE_URL) === false ) { |
|
172 | + if ( !$iType && filter_var( $sURL, FILTER_VALIDATE_URL ) === false ) { |
|
173 | 173 | return 1; |
174 | 174 | } |
175 | 175 | // If HTTP headers are already sent, redirect cannot be done. |
@@ -25,8 +25,8 @@ discard block |
||
25 | 25 | * @since 3.8.24 |
26 | 26 | * @since 3.8.32 Added a default value for the `$bStripSlashes` parameter. |
27 | 27 | */ |
28 | - static public function getHTTPRequestSanitized( array $aRequest, $bStripSlashes=true ) { |
|
29 | - foreach( $aRequest as $_isIndex => $_mValue ) { |
|
28 | + static public function getHTTPRequestSanitized( array $aRequest, $bStripSlashes = true ) { |
|
29 | + foreach ( $aRequest as $_isIndex => $_mValue ) { |
|
30 | 30 | if ( is_array( $_mValue ) ) { |
31 | 31 | $aRequest[ $_isIndex ] = self::getHTTPRequestSanitized( $_mValue, $bStripSlashes ); |
32 | 32 | continue; |
@@ -50,12 +50,12 @@ discard block |
||
50 | 50 | * @sicne 3.8.32 Added the `$bStripSlashes` parameter. |
51 | 51 | * @see _sanitize_text_fields() |
52 | 52 | */ |
53 | - static private function ___getHTTPRequestTextValueSanitized( $sString, $bStripSlashes, $bKeepLineFeeds=true ) { |
|
53 | + static private function ___getHTTPRequestTextValueSanitized( $sString, $bStripSlashes, $bKeepLineFeeds = true ) { |
|
54 | 54 | |
55 | 55 | $sString = $bStripSlashes ? stripslashes( $sString ) : $sString; |
56 | 56 | |
57 | 57 | $_sFiltered = wp_check_invalid_utf8( $sString ); |
58 | - if ( ! $bKeepLineFeeds ) { |
|
58 | + if ( !$bKeepLineFeeds ) { |
|
59 | 59 | $_sFiltered = preg_replace( '/[\r\n\t ]+/', ' ', $_sFiltered ); |
60 | 60 | } |
61 | 61 | $_sFiltered = trim( $_sFiltered ); |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | . '/i'; |
87 | 87 | $_iPos = 0; |
88 | 88 | while ( preg_match( $_sPattern, $sString, $_aMatches, PREG_OFFSET_CAPTURE, $_iPos ) ) { |
89 | - if ( ! isset( $_aMatches[ 0 ][ 0 ], $_aMatches[ 0 ][ 1 ] ) ) { |
|
89 | + if ( !isset( $_aMatches[ 0 ][ 0 ], $_aMatches[ 0 ][ 1 ] ) ) { |
|
90 | 90 | break; |
91 | 91 | } |
92 | 92 | $_iPos = $_aMatches[ 0 ][ 1 ]; |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | * @return mixed |
129 | 129 | * @since 3.8.24 |
130 | 130 | */ |
131 | - static public function getObjectCache( $asName, $mDefault=null ) { |
|
131 | + static public function getObjectCache( $asName, $mDefault = null ) { |
|
132 | 132 | return self::getArrayValueByArrayKeys( self::$___aObjectCache, self::getAsArray( $asName ), $mDefault ); |
133 | 133 | } |
134 | 134 | |
@@ -143,9 +143,9 @@ discard block |
||
143 | 143 | * @param string $sProgramName |
144 | 144 | * @since 3.8.8 |
145 | 145 | */ |
146 | - static public function showDeprecationNotice( $sDeprecated, $sAlternative='', $sProgramName='Admin Page Framework' ) { |
|
146 | + static public function showDeprecationNotice( $sDeprecated, $sAlternative = '', $sProgramName = 'Admin Page Framework' ) { |
|
147 | 147 | trigger_error( |
148 | - $sProgramName . ': ' . sprintf( |
|
148 | + $sProgramName.': '.sprintf( |
|
149 | 149 | $sAlternative |
150 | 150 | ? '<code>%1$s</code> has been deprecated. Use <code>%2$s</code> instead.' |
151 | 151 | : '<code>%1$s</code> has been deprecated.', |
@@ -168,8 +168,8 @@ discard block |
||
168 | 168 | * @param string|array $asParameters Parameters to pass to the callback function. |
169 | 169 | * @return mixed |
170 | 170 | */ |
171 | - public function callBack( $oCallable, $asParameters=array() ) { |
|
172 | - $_aParameters = self::getAsArray( |
|
171 | + public function callBack( $oCallable, $asParameters = array() ) { |
|
172 | + $_aParameters = self::getAsArray( |
|
173 | 173 | $asParameters, |
174 | 174 | true // preserve empty |
175 | 175 | ); |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | * @param array $aParameters |
209 | 209 | * @return string The captured output buffer. |
210 | 210 | */ |
211 | - static public function getOutputBuffer( $cCallable, array $aParameters=array() ) { |
|
211 | + static public function getOutputBuffer( $cCallable, array $aParameters = array() ) { |
|
212 | 212 | |
213 | 213 | ob_start(); |
214 | 214 | echo call_user_func_array( $cCallable, $aParameters ); |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | |
231 | 231 | $_iCount = count( get_object_vars( $oInstance ) ); |
232 | 232 | $_sClassName = get_class( $oInstance ); |
233 | - return '(object) ' . $_sClassName . ': ' . $_iCount . ' properties.'; |
|
233 | + return '(object) '.$_sClassName.': '.$_iCount.' properties.'; |
|
234 | 234 | |
235 | 235 | } |
236 | 236 | |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | * @param boolean|integer|double|string|array|object|resource|NULL $mFalse The value to return when the first parameter value yields false. |
248 | 248 | * @return mixed |
249 | 249 | */ |
250 | - static public function getAOrB( $mValue, $mTrue=null, $mFalse=null ) { |
|
250 | + static public function getAOrB( $mValue, $mTrue = null, $mFalse = null ) { |
|
251 | 251 | return $mValue ? $mTrue : $mFalse; |
252 | 252 | } |
253 | 253 |
@@ -28,9 +28,9 @@ discard block |
||
28 | 28 | * @since 3.8.9 |
29 | 29 | * @since 3.8.32 Moved from `AdminPageFramework_Debug_Base` and renamed from `___getArrayMappedRecursive()` and made public as a part of the utility class. |
30 | 30 | */ |
31 | - static public function getArrayMappedRecursive( $cCallback, $aArray, array $aArguments=array() ) { |
|
31 | + static public function getArrayMappedRecursive( $cCallback, $aArray, array $aArguments = array() ) { |
|
32 | 32 | $_aOutput = array(); |
33 | - foreach( $aArray as $_isKey => $_vValue ) { |
|
33 | + foreach ( $aArray as $_isKey => $_vValue ) { |
|
34 | 34 | if ( is_array( $_vValue ) ) { |
35 | 35 | $_aOutput[ $_isKey ] = self::getArrayMappedRecursive( $cCallback, $_vValue, $aArguments ); |
36 | 36 | continue; |
@@ -47,10 +47,10 @@ discard block |
||
47 | 47 | * @return numeric |
48 | 48 | * @since 3.7.4 |
49 | 49 | */ |
50 | - static public function getUnusedNumericIndex( $aArray, $nIndex, $iOffset=1 ) { |
|
50 | + static public function getUnusedNumericIndex( $aArray, $nIndex, $iOffset = 1 ) { |
|
51 | 51 | |
52 | 52 | // Check if the order value is not used. |
53 | - if ( ! isset( $aArray[ $nIndex ] ) ) { |
|
53 | + if ( !isset( $aArray[ $nIndex ] ) ) { |
|
54 | 54 | return $nIndex; |
55 | 55 | } |
56 | 56 | |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | * @return boolean |
66 | 66 | */ |
67 | 67 | static public function isAssociative( array $aArray ) { |
68 | - return array_keys ( $aArray ) !== range( 0, count( $aArray ) - 1 ); |
|
68 | + return array_keys( $aArray ) !== range( 0, count( $aArray ) - 1 ); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | /** |
@@ -98,9 +98,9 @@ discard block |
||
98 | 98 | */ |
99 | 99 | static public function getReadableListOfArray( array $aArray ) { |
100 | 100 | |
101 | - $_aOutput = array(); |
|
102 | - foreach( $aArray as $_sKey => $_vValue ) { |
|
103 | - $_aOutput[] = self::getReadableArrayContents( $_sKey, $_vValue, 32 ) . PHP_EOL; |
|
101 | + $_aOutput = array(); |
|
102 | + foreach ( $aArray as $_sKey => $_vValue ) { |
|
103 | + $_aOutput[ ] = self::getReadableArrayContents( $_sKey, $_vValue, 32 ).PHP_EOL; |
|
104 | 104 | } |
105 | 105 | return implode( PHP_EOL, $_aOutput ); |
106 | 106 | |
@@ -111,37 +111,37 @@ discard block |
||
111 | 111 | * @since 3.3.0 |
112 | 112 | * @return string The generated human readable array contents. |
113 | 113 | */ |
114 | - static public function getReadableArrayContents( $sKey, $vValue, $sLabelCharLengths=16, $iOffset=0 ) { |
|
114 | + static public function getReadableArrayContents( $sKey, $vValue, $sLabelCharLengths = 16, $iOffset = 0 ) { |
|
115 | 115 | |
116 | 116 | $_aOutput = array(); |
117 | - $_aOutput[] = ( $iOffset |
|
118 | - ? str_pad( ' ', $iOffset ) |
|
117 | + $_aOutput[ ] = ( $iOffset |
|
118 | + ? str_pad( ' ', $iOffset ) |
|
119 | 119 | : '' |
120 | 120 | ) |
121 | 121 | . ( $sKey |
122 | - ? '[' . $sKey . ']' |
|
122 | + ? '['.$sKey.']' |
|
123 | 123 | : '' |
124 | 124 | ); |
125 | 125 | |
126 | - if ( ! in_array( gettype( $vValue ), array( 'array', 'object' ) ) ) { |
|
127 | - $_aOutput[] = $vValue; |
|
126 | + if ( !in_array( gettype( $vValue ), array( 'array', 'object' ) ) ) { |
|
127 | + $_aOutput[ ] = $vValue; |
|
128 | 128 | return implode( PHP_EOL, $_aOutput ); |
129 | 129 | } |
130 | 130 | |
131 | 131 | foreach ( $vValue as $_sTitle => $_asDescription ) { |
132 | - if ( ! in_array( gettype( $_asDescription ), array( 'array', 'object' ) ) ) { |
|
133 | - $_aOutput[] = str_pad( ' ', $iOffset ) |
|
132 | + if ( !in_array( gettype( $_asDescription ), array( 'array', 'object' ) ) ) { |
|
133 | + $_aOutput[ ] = str_pad( ' ', $iOffset ) |
|
134 | 134 | . $_sTitle |
135 | 135 | . str_pad( ':', $sLabelCharLengths - self::getStringLength( $_sTitle ) ) |
136 | 136 | . $_asDescription; |
137 | 137 | continue; |
138 | 138 | } |
139 | - $_aOutput[] = str_pad( ' ', $iOffset ) |
|
139 | + $_aOutput[ ] = str_pad( ' ', $iOffset ) |
|
140 | 140 | . $_sTitle |
141 | 141 | . ": {" |
142 | 142 | . self::getReadableArrayContents( '', $_asDescription, 16, $iOffset + 4 ) |
143 | 143 | . PHP_EOL |
144 | - . str_pad( ' ', $iOffset ) . "}"; |
|
144 | + . str_pad( ' ', $iOffset )."}"; |
|
145 | 145 | } |
146 | 146 | return implode( PHP_EOL, $_aOutput ); |
147 | 147 | |
@@ -154,11 +154,11 @@ discard block |
||
154 | 154 | */ |
155 | 155 | static public function getReadableListOfArrayAsHTML( array $aArray ) { |
156 | 156 | |
157 | - $_aOutput = array(); |
|
158 | - foreach( $aArray as $_sKey => $_vValue ) { |
|
159 | - $_aOutput[] = "<ul class='array-contents'>" |
|
157 | + $_aOutput = array(); |
|
158 | + foreach ( $aArray as $_sKey => $_vValue ) { |
|
159 | + $_aOutput[ ] = "<ul class='array-contents'>" |
|
160 | 160 | . self::getReadableArrayContentsHTML( $_sKey, $_vValue ) |
161 | - . "</ul>" . PHP_EOL; |
|
161 | + . "</ul>".PHP_EOL; |
|
162 | 162 | } |
163 | 163 | return implode( PHP_EOL, $_aOutput ); |
164 | 164 | |
@@ -175,25 +175,25 @@ discard block |
||
175 | 175 | $_aOutput = array(); |
176 | 176 | |
177 | 177 | // Title - array key |
178 | - $_aOutput[] = $sKey |
|
179 | - ? "<h3 class='array-key'>" . $sKey . "</h3>" |
|
178 | + $_aOutput[ ] = $sKey |
|
179 | + ? "<h3 class='array-key'>".$sKey."</h3>" |
|
180 | 180 | : ""; |
181 | 181 | |
182 | 182 | // If it does not have a nested array or object, |
183 | - if ( ! in_array( gettype( $vValue ), array( 'array', 'object' ) ) ) { |
|
184 | - $_aOutput[] = "<div class='array-value'>" |
|
183 | + if ( !in_array( gettype( $vValue ), array( 'array', 'object' ) ) ) { |
|
184 | + $_aOutput[ ] = "<div class='array-value'>" |
|
185 | 185 | . html_entity_decode( nl2br( str_replace( ' ', ' ', $vValue ) ), ENT_QUOTES ) |
186 | 186 | . "</div>"; |
187 | - return "<li>" . implode( PHP_EOL, $_aOutput ) . "</li>"; |
|
187 | + return "<li>".implode( PHP_EOL, $_aOutput )."</li>"; |
|
188 | 188 | } |
189 | 189 | |
190 | 190 | // Now it is a nested item. |
191 | 191 | foreach ( $vValue as $_sKey => $_vValue ) { |
192 | - $_aOutput[] = "<ul class='array-contents'>" |
|
192 | + $_aOutput[ ] = "<ul class='array-contents'>" |
|
193 | 193 | . self::getReadableArrayContentsHTML( $_sKey, $_vValue ) |
194 | 194 | . "</ul>"; |
195 | 195 | } |
196 | - return implode( PHP_EOL, $_aOutput ) ; |
|
196 | + return implode( PHP_EOL, $_aOutput ); |
|
197 | 197 | |
198 | 198 | } |
199 | 199 |
@@ -55,10 +55,10 @@ discard block |
||
55 | 55 | * @since 3.8.0 |
56 | 56 | * @internal |
57 | 57 | */ |
58 | - protected function _setOptionArray( $iTermID=null, $_deprecated=null ) { |
|
58 | + protected function _setOptionArray( $iTermID = null, $_deprecated = null ) { |
|
59 | 59 | $this->oForm->aSavedData = $this->oUtil->addAndApplyFilter( |
60 | 60 | $this, // the caller factory object |
61 | - 'options_' . $this->oProp->sClassName, |
|
61 | + 'options_'.$this->oProp->sClassName, |
|
62 | 62 | $this->_getSavedTermMetas( $iTermID, $this->oForm->aFieldsets ) |
63 | 63 | // @todo maybe pass the term id because the user will not know whihch form data is |
64 | 64 | ); |
@@ -90,27 +90,27 @@ discard block |
||
90 | 90 | */ |
91 | 91 | public function _replyToValidateOptions( $iTermID ) { |
92 | 92 | |
93 | - if ( ! $this->_shouldProceedValidation() ) { |
|
93 | + if ( !$this->_shouldProceedValidation() ) { |
|
94 | 94 | return; |
95 | 95 | } |
96 | 96 | |
97 | 97 | $_aSavedFormData = $this->_getSavedTermMetas( $iTermID, $this->oForm->aFieldsets ); |
98 | - $_aSubmittedFormData = $this->oForm->getSubmittedData( $this->oForm->getHTTPRequestSanitized( $_POST ) ); // sanitization done |
|
98 | + $_aSubmittedFormData = $this->oForm->getSubmittedData( $this->oForm->getHTTPRequestSanitized( $_POST ) ); // sanitization done |
|
99 | 99 | $_aSubmittedFormData = $this->oUtil->addAndApplyFilters( |
100 | 100 | $this, |
101 | - 'validation_' . $this->oProp->sClassName, |
|
101 | + 'validation_'.$this->oProp->sClassName, |
|
102 | 102 | call_user_func_array( // 1st param |
103 | 103 | array( $this, 'validate' ), // triggers __call() |
104 | 104 | array( $_aSubmittedFormData, $_aSavedFormData, $this ) |
105 | 105 | ), // 3.5.10+ |
106 | - $_aSavedFormData, // 2nd param |
|
106 | + $_aSavedFormData, // 2nd param |
|
107 | 107 | $this // 3rd param |
108 | 108 | ); |
109 | 109 | |
110 | 110 | // @todo Update term metas |
111 | 111 | $this->oForm->updateMetaDataByType( |
112 | - $iTermID, // object id |
|
113 | - $_aSubmittedFormData, // user submit form data |
|
112 | + $iTermID, // object id |
|
113 | + $_aSubmittedFormData, // user submit form data |
|
114 | 114 | $this->oForm->dropRepeatableElements( $_aSavedFormData ), // Drop repeatable section elements from the saved meta array. |
115 | 115 | $this->oForm->sStructureType // fields type |
116 | 116 | ); |