Completed
Branch master (3086fe)
by
unknown
36s
created
factory/_common/form/error/AdminPageFramework_Form___FieldError.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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' ) );
Please login to merge, or discard this patch.
factory/_common/form/field_type/AdminPageFramework_FieldType_submit.php 1 patch
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
     /**
192 192
      * Defines the field type slugs used for this field type.
193 193
      */
194
-    public $aFieldTypeSlugs = array( 'submit', );
194
+    public $aFieldTypeSlugs = array( 'submit',);
195 195
     
196 196
     /**
197 197
      * Defines the default key-values of this field type. 
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
         'redirect_url'  => null,
203 203
         'href'          => null,
204 204
         'reset'         => null, 
205
-        'email'         => null,    // [3.3.0+] string of an email address to send to or it can be an array with the following keys.
205
+        'email'         => null, // [3.3.0+] string of an email address to send to or it can be an array with the following keys.
206 206
         'confirm'       => '',
207 207
         /* 
208 208
             array(
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
                 'attachments'   => null,    // string|array     The file path(s) or an array representing the key structure of the submitted form data holding the value. The first key should be the section ID and the second key is the the field ID.
214 214
             )
215 215
         */
216
-        'skip_confirmation' => false,   // 3.7.6+ For emails.
216
+        'skip_confirmation' => false, // 3.7.6+ For emails.
217 217
         'attributes'    => array(
218 218
             'class' => 'button button-primary',
219 219
         ),    
@@ -294,17 +294,17 @@  discard block
 block discarded – undo
294 294
 
295 295
         return 
296 296
             $aField[ 'before_label' ]
297
-            . "<div " . $this->getAttributes( $_aLabelContainerAttributes ) . ">"
297
+            . "<div ".$this->getAttributes( $_aLabelContainerAttributes ).">"
298 298
                 . $this->_getExtraFieldsBeforeLabel( $aField ) // this is for the import field type that cannot place file input tag inside the label tag.
299
-                . "<label " . $this->getAttributes( $_aLabelAttributes ) . ">"
299
+                . "<label ".$this->getAttributes( $_aLabelAttributes ).">"
300 300
                     . $aField[ 'before_input' ]
301 301
                     . $this->_getExtraInputFields( $aField )
302
-                    . "<input " . $this->getAttributes( $_aInputAttributes ) . " />" // this method is defined in the base class
302
+                    . "<input ".$this->getAttributes( $_aInputAttributes )." />" // this method is defined in the base class
303 303
                     . $aField[ 'after_input' ]
304 304
                 . "</label>"
305 305
                 . $this->___getConfirmationCheckbox( $aField )
306 306
             . "</div>"
307
-            . $aField['after_label'];
307
+            . $aField[ 'after_label' ];
308 308
         
309 309
     }
310 310
         /**
@@ -316,12 +316,12 @@  discard block
 block discarded – undo
316 316
             if ( empty( $aField[ 'confirm' ] ) ) {
317 317
                 return '';
318 318
             }
319
-            $_aConfirm    = is_string( $aField[ 'confirm' ] )
319
+            $_aConfirm = is_string( $aField[ 'confirm' ] )
320 320
                 ? array(
321 321
                     'label' => $aField[ 'confirm' ]
322 322
                 )
323 323
                 : $this->getAsArray( $aField[ 'confirm' ] );
324
-            $_aConfirm    = $_aConfirm + array(
324
+            $_aConfirm = $_aConfirm + array(
325 325
                 'label' => $this->oMsg->get( 'submit_confirmation_label' ),
326 326
                 'error' => $this->oMsg->get( 'submit_confirmation_error' ),
327 327
             );
@@ -372,7 +372,7 @@  discard block
 block discarded – undo
372 372
         private function _getLabelAttributes( array $aField, array $aInputAttributes ) {
373 373
             return array(
374 374
                 'style' => $aField[ 'label_min_width' ] 
375
-                    ? "min-width:" . $this->getLengthSanitized( $aField[ 'label_min_width' ] ) . ";" 
375
+                    ? "min-width:".$this->getLengthSanitized( $aField[ 'label_min_width' ] ).";" 
376 376
                     : null,
377 377
                 'for'   => $aInputAttributes[ 'id' ],
378 378
                 'class' => $aInputAttributes[ 'disabled' ] 
@@ -391,7 +391,7 @@  discard block
 block discarded – undo
391 391
         private function _getLabelContainerAttributes( array $aField ) {           
392 392
             return array(
393 393
                 'style' => $aField[ 'label_min_width' ] || '0' === ( string ) $aField[ 'label_min_width' ]
394
-                    ? "min-width:" . $this->getLengthSanitized( $aField[ 'label_min_width' ] ) . ";" 
394
+                    ? "min-width:".$this->getLengthSanitized( $aField[ 'label_min_width' ] ).";" 
395 395
                     : null,
396 396
                 'class' => 'admin-page-framework-input-label-container'
397 397
                     . ' admin-page-framework-input-button-container'
@@ -445,7 +445,7 @@  discard block
 block discarded – undo
445 445
     protected function _getExtraInputFields( &$aField ) {
446 446
         
447 447
         $_aOutput   = array();
448
-        $_aOutput[] = $this->getHTMLTag( 
448
+        $_aOutput[ ] = $this->getHTMLTag( 
449 449
             'input',
450 450
             array(
451 451
                 'type'  => 'hidden',
@@ -453,7 +453,7 @@  discard block
 block discarded – undo
453 453
                 'value' => $aField[ 'input_id' ],
454 454
             )
455 455
         );
456
-        $_aOutput[] = $this->getHTMLTag( 
456
+        $_aOutput[ ] = $this->getHTMLTag( 
457 457
             'input',
458 458
             array(
459 459
                 'type'  => 'hidden',
@@ -461,7 +461,7 @@  discard block
 block discarded – undo
461 461
                 'value' => $aField[ 'field_id' ],
462 462
             ) 
463 463
         );            
464
-        $_aOutput[] = $this->getHTMLTag( 
464
+        $_aOutput[ ] = $this->getHTMLTag( 
465 465
             'input',
466 466
             array(
467 467
                 'type'  => 'hidden',
@@ -469,11 +469,11 @@  discard block
 block discarded – undo
469 469
                 'value' => $aField[ '_input_name_flat' ],
470 470
             ) 
471 471
         );         
472
-        $_aOutput[] = $this->_getHiddenInput_SectionID( $aField );
473
-        $_aOutput[] = $this->_getHiddenInputByKey( $aField, 'redirect_url' );       
474
-        $_aOutput[] = $this->_getHiddenInputByKey( $aField, 'href' );       
475
-        $_aOutput[] = $this->_getHiddenInput_Reset( $aField );
476
-        $_aOutput[] = $this->_getHiddenInput_Email( $aField );
472
+        $_aOutput[ ] = $this->_getHiddenInput_SectionID( $aField );
473
+        $_aOutput[ ] = $this->_getHiddenInputByKey( $aField, 'redirect_url' );       
474
+        $_aOutput[ ] = $this->_getHiddenInputByKey( $aField, 'href' );       
475
+        $_aOutput[ ] = $this->_getHiddenInput_Reset( $aField );
476
+        $_aOutput[ ] = $this->_getHiddenInput_Email( $aField );
477 477
         return implode( PHP_EOL, array_filter( $_aOutput ) );  
478 478
         
479 479
     }
@@ -490,9 +490,9 @@  discard block
 block discarded – undo
490 490
                 'input',
491 491
                 array(
492 492
                     'type'  => 'hidden',
493
-                    'name'  => "__submit[{$aField['input_id']}][section_id]",
494
-                    'value' => isset( $aField['section_id'] ) && '_default' !== $aField['section_id'] 
495
-                        ? $aField['section_id'] 
493
+                    'name'  => "__submit[{$aField[ 'input_id' ]}][section_id]",
494
+                    'value' => isset( $aField[ 'section_id' ] ) && '_default' !== $aField[ 'section_id' ] 
495
+                        ? $aField[ 'section_id' ] 
496 496
                         : '',
497 497
                 ) 
498 498
             );                  
@@ -512,7 +512,7 @@  discard block
 block discarded – undo
512 512
                     'input',
513 513
                     array(
514 514
                         'type'  => 'hidden',
515
-                        'name'  => "__submit[{$aField['input_id']}][{$sKey}]",
515
+                        'name'  => "__submit[{$aField[ 'input_id' ]}][{$sKey}]",
516 516
                         'value' => $aField[ $sKey ],
517 517
                     ) 
518 518
                 )
@@ -527,15 +527,15 @@  discard block
 block discarded – undo
527 527
          * @return      string      the HTML input tag output for the 'reset' argument.
528 528
          */        
529 529
         private function _getHiddenInput_Reset( array $aField ) {
530
-            if ( ! $aField[ 'reset' ] ) {
530
+            if ( !$aField[ 'reset' ] ) {
531 531
                 return '';
532 532
             }
533
-            return ! $this->_checkConfirmationDisplayed( $aField, $aField[ '_input_name_flat' ], 'reset' )
533
+            return !$this->_checkConfirmationDisplayed( $aField, $aField[ '_input_name_flat' ], 'reset' )
534 534
                 ? $this->getHTMLTag( 
535 535
                     'input',
536 536
                     array(
537 537
                         'type'  => 'hidden',
538
-                        'name'  => "__submit[{$aField['input_id']}][is_reset]",
538
+                        'name'  => "__submit[{$aField[ 'input_id' ]}][is_reset]",
539 539
                         'value' => '1',
540 540
                     ) 
541 541
                 )
@@ -564,12 +564,12 @@  discard block
 block discarded – undo
564 564
                 return '';
565 565
             }
566 566
             $this->setTransient( 
567
-                'apf_em_' . md5( $aField[ '_input_name_flat' ] . get_current_user_id() ), 
567
+                'apf_em_'.md5( $aField[ '_input_name_flat' ].get_current_user_id() ), 
568 568
                 array(
569
-                    'nonce' => $this->getNonceCreated( 'apf_email_nonce_' . md5( ( string ) site_url() ), 86400 ),  // @todo the nonce is crated when the page is rendered so change this to when the form is submitted so that a shorter nonce lifespan can be set.
569
+                    'nonce' => $this->getNonceCreated( 'apf_email_nonce_'.md5( ( string ) site_url() ), 86400 ), // @todo the nonce is crated when the page is rendered so change this to when the form is submitted so that a shorter nonce lifespan can be set.
570 570
                 ) + $this->getAsArray( $aField[ 'email' ] )
571 571
             );
572
-            return ! $this->_checkConfirmationDisplayed( $aField, $aField[ '_input_name_flat' ], 'email' )
572
+            return !$this->_checkConfirmationDisplayed( $aField, $aField[ '_input_name_flat' ], 'email' )
573 573
                 ? $this->getHTMLTag( 
574 574
                     'input',
575 575
                     array(
@@ -597,19 +597,19 @@  discard block
 block discarded – undo
597 597
          * @return      boolean
598 598
          * @internal
599 599
          */
600
-        private function _checkConfirmationDisplayed( $aField, $sFlatFieldName, $sType='reset' ) {
600
+        private function _checkConfirmationDisplayed( $aField, $sFlatFieldName, $sType = 'reset' ) {
601 601
                             
602
-            switch( $sType ) {
602
+            switch ( $sType ) {
603 603
                 default:
604 604
                 case 'reset':       // admin page framework _ reset confirmation
605
-                    $_sTransientKey = 'apf_rc_' . md5( $sFlatFieldName . get_current_user_id() );
605
+                    $_sTransientKey = 'apf_rc_'.md5( $sFlatFieldName.get_current_user_id() );
606 606
                     break;
607 607
                 case 'email':       // admin page framework _ email confirmation
608
-                    $_sTransientKey = 'apf_ec_' . md5( $sFlatFieldName . get_current_user_id() );   
608
+                    $_sTransientKey = 'apf_ec_'.md5( $sFlatFieldName.get_current_user_id() );   
609 609
                     break;
610 610
             }
611 611
             
612
-            $_bConfirmed = false === $this->getTransient( $_sTransientKey ) && ! $aField[ 'skip_confirmation' ]
612
+            $_bConfirmed = false === $this->getTransient( $_sTransientKey ) && !$aField[ 'skip_confirmation' ]
613 613
                 ? false
614 614
                 : true;
615 615
             
Please login to merge, or discard this patch.
factory/_common/form/field_type/AdminPageFramework_FieldType_Base.php 2 patches
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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(
Please login to merge, or discard this patch.
Braces   +11 added lines, -8 removed lines patch added patch discarded remove patch
@@ -337,14 +337,14 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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;
Please login to merge, or discard this patch.
development/factory/_common/form/AdminPageFramework_Form_Model.php 2 patches
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -64,10 +64,10 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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(
Please login to merge, or discard this patch.
development/factory/_common/utility/debug/AdminPageFramework_Debug_Base.php 1 patch
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -37,10 +37,10 @@  discard block
 block discarded – undo
37 37
      * @return  string
38 38
      * @since   3.8.9
39 39
      */
40
-    static protected function _getLegibleDetails( $mValue, $iStringLengthLimit=0, $iArrayDepthLimit=0 ) {
40
+    static protected function _getLegibleDetails( $mValue, $iStringLengthLimit = 0, $iArrayDepthLimit = 0 ) {
41 41
         if ( is_array( $mValue ) ) {
42
-            return '(array, length: ' . count( $mValue ).') '
43
-                . print_r( self::___getLegibleDetailedArray( $mValue, $iStringLengthLimit, $iArrayDepthLimit ) , true );
42
+            return '(array, length: '.count( $mValue ).') '
43
+                . print_r( self::___getLegibleDetailedArray( $mValue, $iStringLengthLimit, $iArrayDepthLimit ), true );
44 44
         }
45 45
         return print_r( self::getLegibleDetailedValue( $mValue, $iStringLengthLimit ), true );
46 46
     }
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
      */
58 58
     static public function getObjectName( $mItem ) {
59 59
         if ( is_object( $mItem ) ) {
60
-            return '(object) ' . get_class( $mItem );
60
+            return '(object) '.get_class( $mItem );
61 61
         }
62 62
         return $mItem;
63 63
     }
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
      * @since  3.8.9
73 73
      * @since  3.8.22  Added the `$sStringLengthLimit` and `$iArrayDepthLimit` parameters.
74 74
      */
75
-    static protected function _getLegible( $mValue, $iStringLengthLimit=0, $iArrayDepthLimit=0 ) {
75
+    static protected function _getLegible( $mValue, $iStringLengthLimit = 0, $iArrayDepthLimit = 0 ) {
76 76
 
77 77
         $iArrayDepthLimit = $iArrayDepthLimit ? $iArrayDepthLimit : self::$iLegibleArrayDepthLimit;
78 78
         $mValue           = is_object( $mValue )
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
             )
90 90
             : $mValue;
91 91
         $mValue = is_string( $mValue )
92
-            ? self::___getLegibleString( $mValue,  $iStringLengthLimit, false )
92
+            ? self::___getLegibleString( $mValue, $iStringLengthLimit, false )
93 93
             : $mValue;
94 94
         return self::_getArrayRepresentationSanitized( print_r( $mValue, true ) );
95 95
 
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
          * @return      string
102 102
          */
103 103
         static private function ___getLegibleDetailedCallable( $asoCallable ) {
104
-            return '(callable) ' . self::___getCallableName( $asoCallable );
104
+            return '(callable) '.self::___getCallableName( $asoCallable );
105 105
         }
106 106
             /**
107 107
              * @since       3.8.9
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
                 $_sSubject = is_object( $asoCallable[ 0 ] )
120 120
                     ? get_class( $asoCallable[ 0 ] )
121 121
                     : ( string ) $asoCallable[ 0 ];
122
-                return $_sSubject . '::' . ( string ) $asoCallable[ 1 ];
122
+                return $_sSubject.'::'.( string ) $asoCallable[ 1 ];
123 123
 
124 124
             }
125 125
 
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
             if ( method_exists( $oObject, '__toString' ) ) {
134 134
                 return ( string ) $oObject;
135 135
             }
136
-            return '(object) ' . get_class( $oObject ) . ' ' . count( get_object_vars( $oObject ) ) . ' properties.';
136
+            return '(object) '.get_class( $oObject ).' '.count( get_object_vars( $oObject ) ).' properties.';
137 137
 
138 138
         }
139 139
 
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
          * @since  3.8.22  Changed the scope to private from public.
150 150
          * @since  3.8.22  Renamed from `_getLegibleArray()`.
151 151
          */
152
-        static private function ___getLegibleDetailedArray( array $aArray, $iStringLengthLimit=0, $iDepthLimit=0 ) {
152
+        static private function ___getLegibleDetailedArray( array $aArray, $iStringLengthLimit = 0, $iDepthLimit = 0 ) {
153 153
             $_iDepthLimit = $iDepthLimit ? $iDepthLimit : self::$iLegibleArrayDepthLimit;
154 154
             return self::getArrayMappedRecursive(
155 155
                 array( __CLASS__, 'getLegibleDetailedValue' ),
@@ -191,9 +191,9 @@  discard block
 block discarded – undo
191 191
                 return self::___getLegibleDetailedObject( $mNonScalar );
192 192
             }
193 193
             if ( is_array( $mNonScalar ) ) {
194
-                return '(' . $_sType . ') ' . count( $mNonScalar ) . ' elements';
194
+                return '('.$_sType.') '.count( $mNonScalar ).' elements';
195 195
             }
196
-            return '(' . $_sType . ') ' . ( string ) $mNonScalar;
196
+            return '('.$_sType.') '.( string ) $mNonScalar;
197 197
 
198 198
         }
199 199
         /**
@@ -205,11 +205,11 @@  discard block
 block discarded – undo
205 205
          */
206 206
         static private function ___getLegibleDetailedScalar( $sScalar, $iStringLengthLimit ) {
207 207
             if ( is_bool( $sScalar ) ) {
208
-                return '(boolean) ' . ( $sScalar ? 'true' : 'false' );
208
+                return '(boolean) '.( $sScalar ? 'true' : 'false' );
209 209
             }
210 210
             return is_string( $sScalar )
211 211
                 ? self::___getLegibleString( $sScalar, $iStringLengthLimit, true )
212
-                : '(' . gettype( $sScalar ) . ', length: ' . self::___getValueLength( $sScalar ) .  ') ' . $sScalar;
212
+                : '('.gettype( $sScalar ).', length: '.self::___getValueLength( $sScalar ).') '.$sScalar;
213 213
         }
214 214
             /**
215 215
              * Returns a length of a value.
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
              * @param       boolean     $bShowDetails
235 235
              * @return      string
236 236
              */
237
-            static private function ___getLegibleString( $sString, $iLengthLimit, $bShowDetails=true ) {
237
+            static private function ___getLegibleString( $sString, $iLengthLimit, $bShowDetails = true ) {
238 238
 
239 239
                 static $_iMBSupport;
240 240
                 $_iMBSupport    = isset( $_iMBSupport ) ? $_iMBSupport : ( integer ) function_exists( 'mb_strlen' );
@@ -245,8 +245,8 @@  discard block
 block discarded – undo
245 245
 
246 246
                 if ( $bShowDetails ) {
247 247
                     return $_iCharLength <= $iCharLimit
248
-                        ? '(string, length: ' . $_iCharLength . ') ' . $sString
249
-                        : '(string, length: ' . $_iCharLength . ') ' . call_user_func_array( $_aSubstrMethod[ $_iMBSupport ], array( $sString, 0, $iCharLimit ) )
248
+                        ? '(string, length: '.$_iCharLength.') '.$sString
249
+                        : '(string, length: '.$_iCharLength.') '.call_user_func_array( $_aSubstrMethod[ $_iMBSupport ], array( $sString, 0, $iCharLimit ) )
250 250
                             . '...';
251 251
                 }
252 252
                 return $_iCharLength <= $iCharLimit
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
      * @return array
288 288
      * @since  3.8.22
289 289
      */
290
-    static public function getSlicedByDepth( array $aSubject, $iDepth=0, $sMore='(array truncated) ...' ) {
290
+    static public function getSlicedByDepth( array $aSubject, $iDepth = 0, $sMore = '(array truncated) ...' ) {
291 291
        return self::_getSlicedByDepth( $aSubject, $iDepth, $sMore );
292 292
     }
293 293
 
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
      * @since       3.8.22      Added the `$sMore` parameter.
308 308
      * @internal
309 309
      */
310
-    static private function _getSlicedByDepth( array $aSubject, $iDepth=0, $sMore='(array truncated) ...' ) {
310
+    static private function _getSlicedByDepth( array $aSubject, $iDepth = 0, $sMore = '(array truncated) ...' ) {
311 311
 
312 312
         foreach ( $aSubject as $_sKey => $_vValue ) {
313 313
 
@@ -340,9 +340,9 @@  discard block
 block discarded – undo
340 340
      * @since   3.8.22
341 341
      * @since   3.8.23 Deprecated the `$oException` parameter.
342 342
      */
343
-    static public function getStackTrace( $iSkip=0, $_deprecated=null ) {
343
+    static public function getStackTrace( $iSkip = 0, $_deprecated = null ) {
344 344
 
345
-        $_iSkip      = 1;   // need to skip this method trace itself
345
+        $_iSkip      = 1; // need to skip this method trace itself
346 346
         $_oException = new Exception();
347 347
 
348 348
         // Backward compatibility.
@@ -358,22 +358,22 @@  discard block
 block discarded – undo
358 358
         $_aFrames    = array_slice( $_aFrames, $_iSkip );
359 359
         foreach ( array_reverse( $_aFrames ) as $_iIndex => $_aFrame ) {
360 360
 
361
-            $_aFrame     = $_aFrame + array(
361
+            $_aFrame = $_aFrame + array(
362 362
                 'file'  => null, 'line' => null, 'function' => null,
363 363
                 'class' => null, 'args' => array(),
364 364
             );
365 365
             $_sArguments = self::___getArgumentsOfEachStackTrace( $_aFrame[ 'args' ] );
366
-            $_aTraces[]  = sprintf(
366
+            $_aTraces[ ]  = sprintf(
367 367
                 "#%s %s(%s): %s(%s)",
368 368
                 $_iIndex + 1,
369 369
                 $_aFrame[ 'file' ],
370 370
                 $_aFrame[ 'line' ],
371
-                isset( $_aFrame[ 'class' ] ) ? $_aFrame[ 'class' ] . '->' . $_aFrame[ 'function' ] : $_aFrame[ 'function' ],
371
+                isset( $_aFrame[ 'class' ] ) ? $_aFrame[ 'class' ].'->'.$_aFrame[ 'function' ] : $_aFrame[ 'function' ],
372 372
                 $_sArguments
373 373
             );
374 374
 
375 375
         }
376
-        return implode( PHP_EOL, $_aTraces ) . PHP_EOL;
376
+        return implode( PHP_EOL, $_aTraces ).PHP_EOL;
377 377
 
378 378
     }
379 379
         /**
@@ -388,16 +388,16 @@  discard block
 block discarded – undo
388 388
             foreach ( $aTraceArguments as $_mArgument ) {
389 389
                 $_sType        = gettype( $_mArgument );
390 390
                 $_sType        = str_replace(
391
-                    array( 'resource (closed)', 'unknown type', 'integer', 'double', ),
392
-                    array( 'resource', 'unknown', 'scalar', 'scalar', ),
391
+                    array( 'resource (closed)', 'unknown type', 'integer', 'double',),
392
+                    array( 'resource', 'unknown', 'scalar', 'scalar',),
393 393
                     $_sType
394 394
                 );
395 395
                 $_sMethodName  = "___getStackTraceArgument_{$_sType}";
396
-                $_aArguments[] = method_exists( __CLASS__, $_sMethodName )
396
+                $_aArguments[ ] = method_exists( __CLASS__, $_sMethodName )
397 397
                     ? self::{$_sMethodName}( $_mArgument )
398 398
                     : $_sType;
399 399
             }
400
-            return join(", ",  $_aArguments );
400
+            return join( ", ", $_aArguments );
401 401
         }
402 402
             /**
403 403
              * @since 3.8.22
@@ -407,7 +407,7 @@  discard block
 block discarded – undo
407 407
              */
408 408
             static private function ___getStackTraceArgument_string( $mArgument ) {
409 409
                 $_sString = self::___getLegibleString( $mArgument, 200, true );
410
-                return "'" . $_sString . "'";
410
+                return "'".$_sString."'";
411 411
             }
412 412
             static private function ___getStackTraceArgument_scalar( $mArgument ) {
413 413
                 return $mArgument;
@@ -419,7 +419,7 @@  discard block
 block discarded – undo
419 419
                 return 'NULL';
420 420
             }
421 421
             static private function ___getStackTraceArgument_object( $mArgument ) {
422
-                return 'Object(' . get_class( $mArgument ) . ')';
422
+                return 'Object('.get_class( $mArgument ).')';
423 423
             }
424 424
             static private function ___getStackTraceArgument_resource( $mArgument ) {
425 425
                 return get_resource_type( $mArgument );
@@ -432,18 +432,18 @@  discard block
 block discarded – undo
432 432
                 $_iMax    = 10;
433 433
                 $_iTotal  = count( $mArgument );
434 434
                 $_iIndex  = 0;
435
-                foreach( $mArgument as $_sKey => $_mValue ) {
435
+                foreach ( $mArgument as $_sKey => $_mValue ) {
436 436
                     $_iIndex++;
437
-                    $_mValue   = is_scalar( $_mValue )
437
+                    $_mValue = is_scalar( $_mValue )
438 438
                         ? self::___getLegibleDetailedScalar( $_mValue, 100 )
439
-                        : ucfirst( gettype( $_mValue ) ) . (
439
+                        : ucfirst( gettype( $_mValue ) ).(
440 440
                             is_object( $_mValue )
441
-                                ? ' (' . get_class( $_mValue ) . ')'
441
+                                ? ' ('.get_class( $_mValue ).')'
442 442
                                 : ''
443 443
                         );
444
-                    $_sOutput .= $_sKey . ': ' . $_mValue . ', ';
444
+                    $_sOutput .= $_sKey.': '.$_mValue.', ';
445 445
                     if ( $_iIndex > $_iMax && $_iTotal > $_iMax ) {
446
-                        $_sOutput  = rtrim( $_sOutput, ','  ) . '...';
446
+                        $_sOutput = rtrim( $_sOutput, ',' ).'...';
447 447
                         break;
448 448
                     }
449 449
                 }
Please login to merge, or discard this patch.
factory/_common/utility/wp_utility/AdminPageFramework_WPUtility_Page.php 2 patches
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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,
Please login to merge, or discard this patch.
Braces   +8 added lines, -7 removed lines patch added patch discarded remove patch
@@ -91,10 +91,12 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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 );
Please login to merge, or discard this patch.
factory/_common/utility/wp_utility/AdminPageFramework_WPUtility_URL.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -29,10 +29,10 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
factory/_common/utility/wp_utility/AdminPageFramework_WPUtility.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -30,13 +30,13 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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.
Please login to merge, or discard this patch.
factory/_common/utility/base_utility/AdminPageFramework_Utility.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -25,8 +25,8 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.