Completed
Branch dev (fb3707)
by Michael
07:57
created
element_definition/AdminPageFramework_Form_Model___FieldConditioner.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -60,18 +60,18 @@  discard block
 block discarded – undo
60 60
 
61 61
             // Drop keys of fields-array which do not exist in the sections-array. 
62 62
             // For this reasons, the sections-array should be conditioned first before applying this method.
63
-            $aFields    = $this->castArrayContents( $aSections, $aFields );
63
+            $aFields = $this->castArrayContents( $aSections, $aFields );
64 64
 
65 65
             $_aNewFields = array();
66
-            foreach( $aFields as $_sSectionID => $_aSubSectionOrFields ) {
66
+            foreach ( $aFields as $_sSectionID => $_aSubSectionOrFields ) {
67 67
                 
68 68
                 // This type check is important as the parsing field array is content-cast, which can set null value to elements.
69
-                if ( ! is_array( $_aSubSectionOrFields ) ) { 
69
+                if ( !is_array( $_aSubSectionOrFields ) ) { 
70 70
                     continue; 
71 71
                 }
72 72
                             
73 73
                 $this->_setConditionedFields( 
74
-                    $_aNewFields,   // by reference - gets updated in the method.
74
+                    $_aNewFields, // by reference - gets updated in the method.
75 75
                     $_aSubSectionOrFields, 
76 76
                     $_sSectionID
77 77
                 );
@@ -91,14 +91,14 @@  discard block
 block discarded – undo
91 91
              */
92 92
             private function _setConditionedFields( array &$_aNewFields, $_aSubSectionOrFields, $_sSectionID ) {
93 93
                 
94
-                foreach( $_aSubSectionOrFields as $_sIndexOrFieldID => $_aSubSectionOrField ) {
94
+                foreach ( $_aSubSectionOrFields as $_sIndexOrFieldID => $_aSubSectionOrField ) {
95 95
                     
96 96
                     // If it is a sub-section array.
97 97
                     if ( $this->isNumericInteger( $_sIndexOrFieldID ) ) {
98 98
                         $_sSubSectionIndex  = $_sIndexOrFieldID;
99 99
                         $_aFields           = $_aSubSectionOrField;
100
-                        foreach( $_aFields as $_aField ) {
101
-                            if ( ! $this->_isAllowed( $_aField ) ) {
100
+                        foreach ( $_aFields as $_aField ) {
101
+                            if ( !$this->_isAllowed( $_aField ) ) {
102 102
                                 continue;
103 103
                             }
104 104
                             $_aNewFields[ $_sSectionID ][ $_sSubSectionIndex ][ $_aField[ 'field_id' ] ] = $_aField;
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
                     
110 110
                     // Otherwise, insert the formatted field definition array.
111 111
                     $_aField = $_aSubSectionOrField;
112
-                    if ( ! $this->_isAllowed( $_aField ) ) {
112
+                    if ( !$this->_isAllowed( $_aField ) ) {
113 113
                         continue;
114 114
                     }
115 115
                     $_aNewFields[ $_sSectionID ][ $_aField[ 'field_id' ] ] = $_aField;
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -66,7 +66,7 @@
 block discarded – undo
66 66
             foreach( $aFields as $_sSectionID => $_aSubSectionOrFields ) {
67 67
                 
68 68
                 // This type check is important as the parsing field array is content-cast, which can set null value to elements.
69
-                if ( ! is_array( $_aSubSectionOrFields ) ) { 
69
+                if ( ! is_array( $_aSubSectionOrFields ) ) {
70 70
                     continue; 
71 71
                 }
72 72
                             
Please login to merge, or discard this patch.
element_definition/AdminPageFramework_Form_Model___SectionConditioner.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
  */
18 18
 class AdminPageFramework_Form_Model___SectionConditioner extends AdminPageFramework_WPUtility {
19 19
     
20
-    public $aSectionsets  = array();
20
+    public $aSectionsets = array();
21 21
 
22 22
     /**
23 23
      * Sets up hooks.
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
         $_aParameters = func_get_args() + array( 
29 29
             $this->aSectionsets, 
30 30
         );
31
-        $this->aSectionsets  = $_aParameters[ 0 ];                    
31
+        $this->aSectionsets = $_aParameters[ 0 ];                    
32 32
         
33 33
     }
34 34
 
@@ -50,11 +50,11 @@  discard block
 block discarded – undo
50 50
      * @since       DEVVER      Moved from `AdminPageFramework_FormDefinition`. Changed the name from `getConditionedSections()`.
51 51
      * @return      array       The conditioned sectionsets array.
52 52
      */
53
-    private function _getSectionsConditioned( array $aSections=array() ) {
53
+    private function _getSectionsConditioned( array $aSections = array() ) {
54 54
         
55
-        $_aNewSections  = array();
56
-        foreach( $aSections as $_sSectionID => $_aSection ) {
57
-            if ( ! $this->_isAllowed( $_aSection ) ) {
55
+        $_aNewSections = array();
56
+        foreach ( $aSections as $_sSectionID => $_aSection ) {
57
+            if ( !$this->_isAllowed( $_aSection ) ) {
58 58
                 continue;                
59 59
             }
60 60
             $_aNewSections[ $_sSectionID ] = $_aSection;
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
     protected function _isAllowed( array $aDefinition ) {
74 74
         
75 75
         // Check capability. If the access level is not sufficient, skip.
76
-        if ( ! current_user_can( $aDefinition[ 'capability' ] ) ) { 
76
+        if ( !current_user_can( $aDefinition[ 'capability' ] ) ) { 
77 77
             return false;
78 78
         }
79 79
         return ( boolean ) $aDefinition[ 'if' ];
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -73,7 +73,7 @@
 block discarded – undo
73 73
     protected function _isAllowed( array $aDefinition ) {
74 74
         
75 75
         // Check capability. If the access level is not sufficient, skip.
76
-        if ( ! current_user_can( $aDefinition[ 'capability' ] ) ) { 
76
+        if ( ! current_user_can( $aDefinition[ 'capability' ] ) ) {
77 77
             return false;
78 78
         }
79 79
         return ( boolean ) $aDefinition[ 'if' ];
Please login to merge, or discard this patch.
form/_model/AdminPageFramework_Form_Model___BuiltInFieldTypeDefinitions.php 2 patches
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -81,7 +81,7 @@
 block discarded – undo
81 81
                 $this->oMsg, 
82 82
                 false               // `false` to disable auto-registering.     
83 83
             );    
84
-            foreach( $_oFieldType->aFieldTypeSlugs as $_sSlug ) {     
84
+            foreach( $_oFieldType->aFieldTypeSlugs as $_sSlug ) {
85 85
                 $_aFieldTypeDefinitions[ $_sSlug ] = $_oFieldType->getDefinitionArray();
86 86
             }
87 87
         }
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -43,9 +43,9 @@  discard block
 block discarded – undo
43 43
         'posttype',
44 44
         'size',
45 45
         'section_title', // 3.0.0+
46
-        'system',        // 3.3.0+
47
-        'inline_mixed',  // 3.8.0+
48
-        '_nested',       // 3.8.0+
46
+        'system', // 3.3.0+
47
+        'inline_mixed', // 3.8.0+
48
+        '_nested', // 3.8.0+
49 49
     );    
50 50
     
51 51
     public $sCallerID = '';
@@ -75,16 +75,16 @@  discard block
 block discarded – undo
75 75
     public function get() {
76 76
         
77 77
         $_aFieldTypeDefinitions = array();
78
-        foreach( self::$_aDefaultFieldTypeSlugs as $_sFieldTypeSlug ) {
78
+        foreach ( self::$_aDefaultFieldTypeSlugs as $_sFieldTypeSlug ) {
79 79
             
80 80
             $_sFieldTypeClassName = "AdminPageFramework_FieldType_{$_sFieldTypeSlug}";
81 81
             $_oFieldType = new $_sFieldTypeClassName( 
82
-                $this->sCallerID,   // usually an instantiated class name
83
-                null,               // field type slugs - if it is different from the one defined in the class property
82
+                $this->sCallerID, // usually an instantiated class name
83
+                null, // field type slugs - if it is different from the one defined in the class property
84 84
                 $this->oMsg, 
85 85
                 false               // `false` to disable auto-registering.     
86 86
             );    
87
-            foreach( $_oFieldType->aFieldTypeSlugs as $_sSlug ) {     
87
+            foreach ( $_oFieldType->aFieldTypeSlugs as $_sSlug ) {     
88 88
                 $_aFieldTypeDefinitions[ $_sSlug ] = $_oFieldType->getDefinitionArray();
89 89
             }
90 90
         }
Please login to merge, or discard this patch.
factory/_common/form/field_type/AdminPageFramework_FieldType_text.php 2 patches
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@
 block discarded – undo
43 43
      * @since       2.1.5
44 44
      * @since       3.3.1       Changed from `_replyToGetStyles()`.
45 45
      */        
46
-    protected function getStyles() { 
46
+    protected function getStyles() {
47 47
         return <<<CSSRULES
48 48
 /* Text Field Type */
49 49
 .admin-page-framework-field.admin-page-framework-field-text > .admin-page-framework-input-label-container {
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
     /**
40 40
      * Defines the field type slugs used for this field type.
41 41
      */
42
-    public $aFieldTypeSlugs = array( 'text', 'password', 'date', 'datetime', 'datetime-local', 'email', 'month', 'search', 'tel', 'url', 'week', );
42
+    public $aFieldTypeSlugs = array( 'text', 'password', 'date', 'datetime', 'datetime-local', 'email', 'month', 'search', 'tel', 'url', 'week',);
43 43
     
44 44
     /**
45 45
      * Defines the default key-values of this field type. 
@@ -83,8 +83,8 @@  discard block
 block discarded – undo
83 83
     protected function getField( $aField ) {
84 84
 
85 85
         $_aOutput = array();
86
-        foreach( ( array ) $aField[ 'label' ] as $_sKey => $_sLabel ) {
87
-            $_aOutput[] = $this->_getFieldOutputByLabel( 
86
+        foreach ( ( array ) $aField[ 'label' ] as $_sKey => $_sLabel ) {
87
+            $_aOutput[ ] = $this->_getFieldOutputByLabel( 
88 88
                 $_sKey, 
89 89
                 $_sLabel, 
90 90
                 $aField
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
         }
93 93
         
94 94
         // the repeatable field buttons will be replaced with this element.
95
-        $_aOutput[] = "<div class='repeatable-field-buttons'></div>";
95
+        $_aOutput[ ] = "<div class='repeatable-field-buttons'></div>";
96 96
         return implode( '', $_aOutput );
97 97
         
98 98
     }
@@ -112,23 +112,23 @@  discard block
 block discarded – undo
112 112
             $aField[ 'value' ]  = $this->getElementByLabel( $aField[ 'value' ], $sKey, $aField[ 'label' ] );
113 113
             $_aInputAttributes  = $_bIsArray
114 114
                 ? array(
115
-                        'name'  => $aField[ 'attributes' ][ 'name' ] . "[{$sKey}]",
116
-                        'id'    => $aField[ 'attributes' ][ 'id' ] . "_{$sKey}",
115
+                        'name'  => $aField[ 'attributes' ][ 'name' ]."[{$sKey}]",
116
+                        'id'    => $aField[ 'attributes' ][ 'id' ]."_{$sKey}",
117 117
                         'value' => $aField[ 'value' ],
118 118
                     ) 
119 119
                     + $aField[ 'attributes' ]
120 120
                 : $aField[ 'attributes' ];          
121
-            $_aOutput           = array(
121
+            $_aOutput = array(
122 122
                 $this->getElementByLabel( $aField[ 'before_label' ], $sKey, $aField[ 'label' ] ),
123 123
                 "<div class='admin-page-framework-input-label-container {$_sClassSelector}'>",
124
-                    "<label for='" . $_aInputAttributes[ 'id' ] . "'>",
124
+                    "<label for='".$_aInputAttributes[ 'id' ]."'>",
125 125
                         $this->getElementByLabel( $aField[ 'before_input' ], $sKey, $aField[ 'label' ] ),
126 126
                         $_sLabel 
127
-                            ? "<span " . $this->getLabelContainerAttributes( $aField, 'admin-page-framework-input-label-string' ) . ">" 
127
+                            ? "<span ".$this->getLabelContainerAttributes( $aField, 'admin-page-framework-input-label-string' ).">" 
128 128
                                     . $_sLabel
129 129
                                 . "</span>"
130 130
                             : '',
131
-                        "<input " . $this->getAttributes( $_aInputAttributes ) . " />",
131
+                        "<input ".$this->getAttributes( $_aInputAttributes )." />",
132 132
                         $this->getElementByLabel( $aField[ 'after_input' ], $sKey, $aField[ 'label' ] ),
133 133
                     "</label>",
134 134
                 "</div>",
Please login to merge, or discard this patch.
_common/form/field_type/AdminPageFramework_WalkerTaxonomyChecklist.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -63,15 +63,15 @@  discard block
 block discarded – undo
63 63
      *  - use_desc_for_title    (boolean|int) default is 1 - Whether to use the category description as the title attribute. side note: the framework enables this by default.
64 64
      * @param       integer     $iCurrentObjectID
65 65
      */
66
-    function start_el( &$sOutput, $oTerm, $iDepth=0, $aArgs=array(), $iCurrentObjectID=0 ) {
66
+    function start_el( &$sOutput, $oTerm, $iDepth = 0, $aArgs = array(), $iCurrentObjectID = 0 ) {
67 67
        
68 68
         $aArgs = $aArgs + array(
69 69
             '_name_prefix'      => null,
70 70
             '_input_id_prefix'  => null,
71 71
             '_attributes'       => array(),
72 72
             '_selected_items'   => array(),
73
-            'taxonomy'          => null,    // parsed by the core function to perform the database query.
74
-            'disabled'          => null,    // not sure what this was for
73
+            'taxonomy'          => null, // parsed by the core function to perform the database query.
74
+            'disabled'          => null, // not sure what this was for
75 75
         );
76 76
         
77 77
         // Local variables
@@ -79,22 +79,22 @@  discard block
 block discarded – undo
79 79
         $_sTaxonomySlug  = empty( $aArgs[ 'taxonomy' ] ) 
80 80
             ? 'category' 
81 81
             : $aArgs[ 'taxonomy' ];
82
-        $_sID            = "{$aArgs['_input_id_prefix']}_{$_sTaxonomySlug}_{$_iID}";
82
+        $_sID            = "{$aArgs[ '_input_id_prefix' ]}_{$_sTaxonomySlug}_{$_iID}";
83 83
 
84 84
         // Post count
85
-        $_sPostCount     = $aArgs['show_post_count'] 
86
-            ? " <span class='font-lighter'>(" . $oTerm->count . ")</span>" 
85
+        $_sPostCount     = $aArgs[ 'show_post_count' ] 
86
+            ? " <span class='font-lighter'>(".$oTerm->count.")</span>" 
87 87
             : '';
88 88
         
89 89
         // Attributes
90 90
         $_aInputAttributes = isset( $_aInputAttributes[ $_iID ] ) 
91
-            ? $_aInputAttributes[ $_iID ] + $aArgs['_attributes']
92
-            : $aArgs['_attributes'];
91
+            ? $_aInputAttributes[ $_iID ] + $aArgs[ '_attributes' ]
92
+            : $aArgs[ '_attributes' ];
93 93
         $_aInputAttributes = array(
94 94
             'id'        => $_sID,
95 95
             'value'     => 1, // must be 1 because the index of zero exists so the index value cannot be assigned here.
96 96
             'type'      => 'checkbox',
97
-            'name'      => "{$aArgs['_name_prefix']}[{$_iID}]",
97
+            'name'      => "{$aArgs[ '_name_prefix' ]}[{$_iID}]",
98 98
             'checked'   => in_array( $_iID, ( array ) $aArgs[ '_selected_items' ] )
99 99
                 ? 'checked' 
100 100
                 : null,
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
           + array(
103 103
             'class'     => null,
104 104
         );
105
-        $_aInputAttributes['class'] .= ' apf_checkbox';
105
+        $_aInputAttributes[ 'class' ] .= ' apf_checkbox';
106 106
         
107 107
         $_aLiTagAttributes = array(
108 108
             'id'        => "list-{$_sID}",
@@ -112,10 +112,10 @@  discard block
 block discarded – undo
112 112
         
113 113
         // Output - the variable is by reference so the modification takes effect
114 114
         $sOutput .= "\n"
115
-            . "<li " . AdminPageFramework_WPUtility::getAttributes( $_aLiTagAttributes ) . ">" 
115
+            . "<li ".AdminPageFramework_WPUtility::getAttributes( $_aLiTagAttributes ).">" 
116 116
                 . "<label for='{$_sID}' class='taxonomy-checklist-label'>"
117
-                    . "<input value='0' type='hidden' name='" . $_aInputAttributes[ 'name' ] . "' class='apf_checkbox' />"
118
-                    . "<input " . AdminPageFramework_WPUtility::getAttributes( $_aInputAttributes ) . " />"
117
+                    . "<input value='0' type='hidden' name='".$_aInputAttributes[ 'name' ]."' class='apf_checkbox' />"
118
+                    . "<input ".AdminPageFramework_WPUtility::getAttributes( $_aInputAttributes )." />"
119 119
                     . esc_html( apply_filters( 'the_category', $oTerm->name ) ) 
120 120
                     . $_sPostCount
121 121
                 . "</label>";    
Please login to merge, or discard this patch.
factory/_common/form/field_type/AdminPageFramework_FieldType_file.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
     /**
21 21
      * Defines the field type slugs used for this field type.
22 22
      */
23
-    public $aFieldTypeSlugs = array( 'file', );
23
+    public $aFieldTypeSlugs = array( 'file',);
24 24
     
25 25
     /**
26 26
      * Defines the default key-values of this field type. 
@@ -76,15 +76,15 @@  discard block
 block discarded – undo
76 76
                 array(
77 77
                     'type'  => 'hidden',
78 78
                     'value' => '',
79
-                    'name'  => $aField[ 'attributes' ][ 'name' ] . '[_dummy_value]',
79
+                    'name'  => $aField[ 'attributes' ][ 'name' ].'[_dummy_value]',
80 80
                 )
81 81
             )            
82 82
             . $this->getHTMLTag( 
83 83
                 'input',
84 84
                 array(
85 85
                     'type'  => 'hidden',
86
-                    'name'  => '__unset_' . $aField[ '_structure_type' ] . '[' . $aField[ '_input_name_flat' ] . '|_dummy_value' . ']',
87
-                    'value' => $aField[ '_input_name_flat' ] . '|_dummy_value',
86
+                    'name'  => '__unset_'.$aField[ '_structure_type' ].'['.$aField[ '_input_name_flat' ].'|_dummy_value'.']',
87
+                    'value' => $aField[ '_input_name_flat' ].'|_dummy_value',
88 88
                     'class' => 'unset-element-names element-address',
89 89
                 )
90 90
             );
Please login to merge, or discard this patch.
factory/_common/form/field_type/AdminPageFramework_FieldType_Base.php 3 patches
Braces   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -315,14 +315,14 @@  discard block
 block discarded – undo
315 315
         wp_enqueue_script( 'thickbox' );
316 316
         wp_enqueue_style( 'thickbox' );
317 317
     
318
-        if ( function_exists( 'wp_enqueue_media' ) ) {     
318
+        if ( function_exists( 'wp_enqueue_media' ) ) {
319 319
             // If the WordPress version is 3.5 or above,
320 320
             new AdminPageFramework_Form_View___Script_MediaUploader( $this->oMsg );
321 321
         } else {
322 322
             wp_enqueue_script( 'media-upload' );    
323 323
         }
324 324
 
325
-        if ( in_array( $this->getPageNow(), array( 'media-upload.php', 'async-upload.php', ) ) ) {     
325
+        if ( in_array( $this->getPageNow(), array( 'media-upload.php', 'async-upload.php', ) ) ) {
326 326
             add_filter( 'gettext', array( $this, '_replyToReplaceThickBoxText' ) , 1, 2 );     
327 327
         }
328 328
         
@@ -338,17 +338,17 @@  discard block
 block discarded – undo
338 338
         public function _replyToReplaceThickBoxText( $sTranslated, $sText ) {
339 339
 
340 340
             // Replace the button label in the media thick box.
341
-            if ( ! in_array( $this->getPageNow(), array( 'media-upload.php', 'async-upload.php' ) ) ) { 
341
+            if ( ! in_array( $this->getPageNow(), array( 'media-upload.php', 'async-upload.php' ) ) ) {
342 342
                 return $sTranslated; 
343 343
             }
344
-            if ( $sText !== 'Insert into Post' ) { 
344
+            if ( $sText !== 'Insert into Post' ) {
345 345
                 return $sTranslated; 
346 346
             }
347
-            if ( $this->getQueryValueInURLByKey( wp_get_referer(), 'referrer' ) !== 'admin_page_framework' ) { 
347
+            if ( $this->getQueryValueInURLByKey( wp_get_referer(), 'referrer' ) !== 'admin_page_framework' ) {
348 348
                 return $sTranslated; 
349 349
             }
350 350
             
351
-            if ( isset( $_GET['button_label'] ) ) { 
351
+            if ( isset( $_GET['button_label'] ) ) {
352 352
                 return $_GET['button_label']; 
353 353
             }
354 354
 
@@ -368,7 +368,7 @@  discard block
 block discarded – undo
368 368
          */
369 369
         public function _replyToRemovingMediaLibraryTab( $aTabs ) {
370 370
             
371
-            if ( ! isset( $_REQUEST['enable_external_source'] ) ) { 
371
+            if ( ! isset( $_REQUEST['enable_external_source'] ) ) {
372 372
                 return $aTabs; 
373 373
             }
374 374
             
Please login to merge, or discard this patch.
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -391,6 +391,7 @@
 block discarded – undo
391 391
      * This is used for element that `label_min_width` is applied.
392 392
      * 
393 393
      * @since       3.8.0
394
+     * @param string $asClassAttributes
394 395
      * @return      string
395 396
      */
396 397
     protected function getLabelContainerAttributes( array $aField, $asClassAttributes, array $aAttributes=array() ) {
Please login to merge, or discard this patch.
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
         'after_label'       => null,    
61 61
         'before_field'      => null,
62 62
         'after_field'       => null,
63
-        '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
+        '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 `''`.
64 64
         'before_fieldset'   => null, // 3.1.1+
65 65
         'after_fieldset'    => null, // 3.1.1+
66 66
         
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
      * @param       object              $oMsg                   The framework message object.
101 101
      * @param       boolean             $bAutoRegister          Whether or not to register the field type(s).
102 102
      */
103
-    public function __construct( $asClassName='admin_page_framework', $asFieldTypeSlug=null, $oMsg=null, $bAutoRegister=true ) {
103
+    public function __construct( $asClassName = 'admin_page_framework', $asFieldTypeSlug = null, $oMsg = null, $bAutoRegister = true ) {
104 104
             
105 105
         $this->aFieldTypeSlugs  = empty( $asFieldTypeSlug ) 
106 106
             ? $this->aFieldTypeSlugs 
@@ -111,9 +111,9 @@  discard block
 block discarded – undo
111 111
         
112 112
         // This automatically registers the field type. The build-in ones will be registered manually so it will be skipped.
113 113
         if ( $bAutoRegister ) {
114
-            foreach( ( array ) $asClassName as $_sClassName ) {
114
+            foreach ( ( array ) $asClassName as $_sClassName ) {
115 115
                 add_filter( 
116
-                    'field_types_' . $_sClassName, 
116
+                    'field_types_'.$_sClassName, 
117 117
                     array( $this, '_replyToRegisterInputFieldType' )
118 118
                 );
119 119
             }
@@ -159,8 +159,8 @@  discard block
 block discarded – undo
159 159
         }
160 160
         return is_array( $asLabel ) // if the user stes multiple items
161 161
             ? $this->getElement( 
162
-                $asElement,         // subject
163
-                $this->getAsArray( $asKey, true /* preserve empty */ ),     // dimensional path 
162
+                $asElement, // subject
163
+                $this->getAsArray( $asKey, true /* preserve empty */ ), // dimensional path 
164 164
                 ''                  // default - if the element is not found, return an empty
165 165
             )
166 166
             : $asElement;
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
      */
176 176
     protected function getFieldOutput( array $aFieldset ) {
177 177
         
178
-        if ( ! is_object( $aFieldset[ '_caller_object' ] ) ) {
178
+        if ( !is_object( $aFieldset[ '_caller_object' ] ) ) {
179 179
             return '';
180 180
         }
181 181
 
@@ -183,14 +183,14 @@  discard block
 block discarded – undo
183 183
         $aFieldset[ '_parent_field_object' ] = $aFieldset[ '_field_object' ]; // 3.6.0+
184 184
         
185 185
         // 3.7.0+ The caller object is no longer a factory object but a form object.
186
-        $_oCallerForm   = $aFieldset[ '_caller_object' ];
186
+        $_oCallerForm = $aFieldset[ '_caller_object' ];
187 187
 
188 188
         $_oFieldset = new AdminPageFramework_Form_View___Fieldset( 
189
-            $aFieldset,                          // the field definition array
190
-            $_oCallerForm->aSavedData,               // the stored form data
191
-            $_oCallerForm->getFieldErrors(),         // the field error array.
192
-            $_oCallerForm->aFieldTypeDefinitions,    // the field type definition array.
193
-            $_oCallerForm->oMsg,                     // the system message object
189
+            $aFieldset, // the field definition array
190
+            $_oCallerForm->aSavedData, // the stored form data
191
+            $_oCallerForm->getFieldErrors(), // the field error array.
192
+            $_oCallerForm->aFieldTypeDefinitions, // the field type definition array.
193
+            $_oCallerForm->oMsg, // the system message object
194 194
             $_oCallerForm->aCallbacks                // field output element callables.
195 195
         );           
196 196
         return $_oFieldset->get();
@@ -230,13 +230,13 @@  discard block
 block discarded – undo
230 230
      * @since       3.0.3       Tweaked it to have better execution speed.
231 231
      * @internal
232 232
      */
233
-    public function getDefinitionArray( $sFieldTypeSlug='' ) {
233
+    public function getDefinitionArray( $sFieldTypeSlug = '' ) {
234 234
         
235 235
         // The uniteArrays() method resulted in somewhat being slow due to overhead on checking array keys for recursive array merges.
236 236
         $_aDefaultKeys = $this->aDefaultKeys + self::$_aDefaultKeys;
237
-        $_aDefaultKeys['attributes'] = isset( $this->aDefaultKeys['attributes'] ) && is_array( $this->aDefaultKeys['attributes'] )
238
-            ? $this->aDefaultKeys['attributes'] + self::$_aDefaultKeys['attributes'] 
239
-            : self::$_aDefaultKeys['attributes'];
237
+        $_aDefaultKeys[ 'attributes' ] = isset( $this->aDefaultKeys[ 'attributes' ] ) && is_array( $this->aDefaultKeys[ 'attributes' ] )
238
+            ? $this->aDefaultKeys[ 'attributes' ] + self::$_aDefaultKeys[ 'attributes' ] 
239
+            : self::$_aDefaultKeys[ 'attributes' ];
240 240
         
241 241
         return array(
242 242
             'sFieldTypeSlug'        => $sFieldTypeSlug,
@@ -274,7 +274,7 @@  discard block
 block discarded – undo
274 274
      * @since       3.0.0
275 275
      * @internal
276 276
      */
277
-    public function _replyToFieldTypeSetter( $sFieldSetType='' ) {
277
+    public function _replyToFieldTypeSetter( $sFieldSetType = '' ) {
278 278
         $this->_sFieldSetType = $sFieldSetType;
279 279
     }
280 280
     
@@ -328,8 +328,8 @@  discard block
 block discarded – undo
328 328
             wp_enqueue_script( 'media-upload' );    
329 329
         }
330 330
 
331
-        if ( in_array( $this->getPageNow(), array( 'media-upload.php', 'async-upload.php', ) ) ) {     
332
-            add_filter( 'gettext', array( $this, '_replyToReplaceThickBoxText' ) , 1, 2 );     
331
+        if ( in_array( $this->getPageNow(), array( 'media-upload.php', 'async-upload.php',) ) ) {     
332
+            add_filter( 'gettext', array( $this, '_replyToReplaceThickBoxText' ), 1, 2 );     
333 333
         }
334 334
         
335 335
     }
@@ -344,7 +344,7 @@  discard block
 block discarded – undo
344 344
         public function _replyToReplaceThickBoxText( $sTranslated, $sText ) {
345 345
 
346 346
             // Replace the button label in the media thick box.
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
                 return $sTranslated; 
349 349
             }
350 350
             if ( $sText !== 'Insert into Post' ) { 
@@ -354,8 +354,8 @@  discard block
 block discarded – undo
354 354
                 return $sTranslated; 
355 355
             }
356 356
             
357
-            if ( isset( $_GET['button_label'] ) ) { 
358
-                return $_GET['button_label']; 
357
+            if ( isset( $_GET[ 'button_label' ] ) ) { 
358
+                return $_GET[ 'button_label' ]; 
359 359
             }
360 360
 
361 361
             return $this->oProp->sThickBoxButtonUseThis 
@@ -374,12 +374,12 @@  discard block
 block discarded – undo
374 374
          */
375 375
         public function _replyToRemovingMediaLibraryTab( $aTabs ) {
376 376
             
377
-            if ( ! isset( $_REQUEST['enable_external_source'] ) ) { 
377
+            if ( !isset( $_REQUEST[ 'enable_external_source' ] ) ) { 
378 378
                 return $aTabs; 
379 379
             }
380 380
             
381
-            if ( ! $_REQUEST['enable_external_source'] ) {
382
-                unset( $aTabs['type_url'] ); // removes the 'From URL' tab in the thick box.
381
+            if ( !$_REQUEST[ 'enable_external_source' ] ) {
382
+                unset( $aTabs[ 'type_url' ] ); // removes the 'From URL' tab in the thick box.
383 383
             }
384 384
             return $aTabs;
385 385
             
@@ -393,7 +393,7 @@  discard block
 block discarded – undo
393 393
      * @since       3.8.0
394 394
      * @return      string
395 395
      */
396
-    protected function getLabelContainerAttributes( array $aField, $asClassAttributes, array $aAttributes=array() ) {
396
+    protected function getLabelContainerAttributes( array $aField, $asClassAttributes, array $aAttributes = array() ) {
397 397
 
398 398
         $aAttributes[ 'class' ] = $this->getClassAttribute( $asClassAttributes, $this->getElement( $aAttributes, 'class' ) );
399 399
         $aAttributes[ 'style' ] = $this->getStyleAttribute(
Please login to merge, or discard this patch.
factory/_common/form/field_type/AdminPageFramework_FieldType_image.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -277,7 +277,7 @@
 block discarded – undo
277 277
         );        
278 278
     }    
279 279
     
280
-       /**
280
+        /**
281 281
          * Extracts meta box form fields options array from the given options array of an admin page.
282 282
          * 
283 283
          * @since       3.5.6
Please login to merge, or discard this patch.
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -478,7 +478,7 @@  discard block
 block discarded – undo
478 478
     /**
479 479
      * Returns the field type specific CSS rules.
480 480
      */ 
481
-    protected function getStyles() { 
481
+    protected function getStyles() {
482 482
         return <<<CSSRULES
483 483
 /* Image Field Preview Container */
484 484
 .admin-page-framework-field .image_preview {
@@ -707,7 +707,7 @@  discard block
 block discarded – undo
707 707
          */
708 708
         protected function _getPreviewContainer( $aField, $sImageURL, $aPreviewAtrributes ) {
709 709
 
710
-            if ( ! $aField[ 'show_preview' ] ) { 
710
+            if ( ! $aField[ 'show_preview' ] ) {
711 711
                 return ''; 
712 712
             }
713 713
             
Please login to merge, or discard this patch.
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
     /**
60 60
      * Defines the field type slugs used for this field type.
61 61
      */
62
-    public $aFieldTypeSlugs = array( 'image', );
62
+    public $aFieldTypeSlugs = array( 'image',);
63 63
     
64 64
     /**
65 65
      * Defines the default key-values of this field type. 
@@ -68,8 +68,8 @@  discard block
 block discarded – undo
68 68
      */
69 69
     protected $aDefaultKeys = array(
70 70
         'attributes_to_store'       => array(), // ( array ) This is for the image and media field type. The attributes to save besides URL. e.g. ( for the image field type ) array( 'title', 'alt', 'width', 'height', 'caption', 'id', 'align', 'link' ).
71
-        'show_preview'              => true,    // ( boolean ) Indicates whether the image preview should be displayed or not.
72
-        'allow_external_source'     => true,    // ( boolean ) Indicates whether the media library box has the From URL tab.
71
+        'show_preview'              => true, // ( boolean ) Indicates whether the image preview should be displayed or not.
72
+        'allow_external_source'     => true, // ( boolean ) Indicates whether the media library box has the From URL tab.
73 73
         'attributes'                => array(
74 74
             'input'     => array(
75 75
                 'size'      => 40,
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
         return // $this->_getScript_CustomMediaUploaderObject() . PHP_EOL    
100 100
             $this->_getScript_ImageSelector( 
101 101
                 "admin_page_framework"
102
-            )  . PHP_EOL
102
+            ).PHP_EOL
103 103
             . $this->_getScript_RegisterCallbacks();
104 104
     }
105 105
         /**
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
             $_sInsertFromURL         = esc_js( $this->oMsg->get( 'insert_from_url' ) );
218 218
 
219 219
             // if the WordPress version is 3.4.x or below
220
-            if ( ! function_exists( 'wp_enqueue_media' ) ) {
220
+            if ( !function_exists( 'wp_enqueue_media' ) ) {
221 221
             
222 222
                 return <<<JAVASCRIPTS
223 223
 /**
@@ -605,13 +605,13 @@  discard block
 block discarded – undo
605 605
                 . "<label for='{$aField[ 'input_id' ]}'>"
606 606
                     . $aField[ 'before_input' ]
607 607
                     . $this->getAOrB(
608
-                        $aField[ 'label' ] && ! $aField[ 'repeatable' ],
609
-                        "<span " . $this->getLabelContainerAttributes( $aField, 'admin-page-framework-input-label-string' ) . ">" 
608
+                        $aField[ 'label' ] && !$aField[ 'repeatable' ],
609
+                        "<span ".$this->getLabelContainerAttributes( $aField, 'admin-page-framework-input-label-string' ).">" 
610 610
                             . $aField[ 'label' ] 
611 611
                         . "</span>",                        
612 612
                         ''                        
613 613
                     )
614
-                    . "<input " . $this->getAttributes( $this->_getImageInputAttributes( $aField, $_iCountAttributes, $_sImageURL, $_aBaseAttributes ) ) . " />" 
614
+                    . "<input ".$this->getAttributes( $this->_getImageInputAttributes( $aField, $_iCountAttributes, $_sImageURL, $_aBaseAttributes ) )." />" 
615 615
                     . $aField[ 'after_input' ]
616 616
                     . "<div class='repeatable-field-buttons'></div>" // the repeatable field buttons will be replaced with this element.
617 617
                     . $this->getExtraInputFields( $aField )
@@ -651,7 +651,7 @@  discard block
 block discarded – undo
651 651
          */
652 652
         private function _getBaseAttributes( array $aField ) {
653 653
             
654
-            $_aBaseAttributes   = $aField[ 'attributes' ] + array( 'class' => null );
654
+            $_aBaseAttributes = $aField[ 'attributes' ] + array( 'class' => null );
655 655
             unset( 
656 656
                 $_aBaseAttributes[ 'input' ], 
657 657
                 $_aBaseAttributes[ 'button' ], 
@@ -720,8 +720,8 @@  discard block
 block discarded – undo
720 720
         protected function getExtraInputFields( array $aField ) {
721 721
             
722 722
             $_aOutputs = array();
723
-            foreach( $this->getElementAsArray( $aField, 'attributes_to_store' ) as $sAttribute ) {
724
-                $_aOutputs[] = "<input " . $this->getAttributes( 
723
+            foreach ( $this->getElementAsArray( $aField, 'attributes_to_store' ) as $sAttribute ) {
724
+                $_aOutputs[ ] = "<input ".$this->getAttributes( 
725 725
                     array(
726 726
                         'id'        => "{$aField[ 'input_id' ]}_{$sAttribute}",
727 727
                         'type'      => 'hidden',
@@ -737,7 +737,7 @@  discard block
 block discarded – undo
737 737
                             ''
738 738
                         ),
739 739
                     )
740
-                ) . "/>";
740
+                )."/>";
741 741
             }
742 742
             return implode( PHP_EOL, $_aOutputs );
743 743
             
@@ -750,17 +750,17 @@  discard block
 block discarded – undo
750 750
          */
751 751
         protected function _getPreviewContainer( $aField, $sImageURL, $aPreviewAtrributes ) {
752 752
 
753
-            if ( ! $aField[ 'show_preview' ] ) { 
753
+            if ( !$aField[ 'show_preview' ] ) { 
754 754
                 return ''; 
755 755
             }
756 756
             
757 757
             $sImageURL = esc_url( $this->getResolvedSRC( $sImageURL, true ) );
758 758
             return 
759
-                "<div " . $this->getAttributes( 
759
+                "<div ".$this->getAttributes( 
760 760
                         array(
761 761
                             'id'    => "image_preview_container_{$aField[ 'input_id' ]}",     
762
-                            'class' => 'image_preview ' . $this->getElement( $aPreviewAtrributes, 'class', '' ),
763
-                            'style' => $this->getAOrB( $sImageURL, '', "display: none; "  ) 
762
+                            'class' => 'image_preview '.$this->getElement( $aPreviewAtrributes, 'class', '' ),
763
+                            'style' => $this->getAOrB( $sImageURL, '', "display: none; " ) 
764 764
                                 . $this->getElement( $aPreviewAtrributes, 'style', '' ),
765 765
                         ) + $aPreviewAtrributes
766 766
                     )
@@ -783,12 +783,12 @@  discard block
 block discarded – undo
783 783
          */
784 784
         protected function _getUploaderButtonScript( $sInputID, $abRepeatable, $bExternalSource, array $aButtonAttributes ) {
785 785
             
786
-            $_bRepeatable     = ! empty( $abRepeatable );
786
+            $_bRepeatable = !empty( $abRepeatable );
787 787
             
788 788
             // Do not include the escaping character (backslash) in the heredoc variable declaration 
789 789
             // because the minifier script will parse it and the <<<JAVASCRIPTS and JAVASCRIPTS; parts are converted to double quotes (")
790 790
             // which causes the PHP syntax error.                
791
-            $_sButtonHTML     = '"' . $this->_getUploaderButtonHTML( $sInputID, $aButtonAttributes, $_bRepeatable, $bExternalSource ) . '"';
791
+            $_sButtonHTML     = '"'.$this->_getUploaderButtonHTML( $sInputID, $aButtonAttributes, $_bRepeatable, $bExternalSource ).'"';
792 792
             $_sRepeatable     = $this->getAOrB( $_bRepeatable, 'true', 'false' );
793 793
             $_bExternalSource = $this->getAOrB( $bExternalSource, 'true', 'false' );
794 794
             $_sScript = <<<JAVASCRIPTS
@@ -804,7 +804,7 @@  discard block
 block discarded – undo
804 804
                     . '/* <![CDATA[ */'
805 805
                     . $_sScript 
806 806
                     . '/* ]]> */'
807
-                . "</script>". PHP_EOL;
807
+                . "</script>".PHP_EOL;
808 808
 
809 809
         }
810 810
             /**
@@ -823,7 +823,7 @@  discard block
 block discarded – undo
823 823
                     $bRepeatable, 
824 824
                     $bExternalSource 
825 825
                 );
826
-                return "<a " . $this->getAttributes( $_aAttributes ) . ">"
826
+                return "<a ".$this->getAttributes( $_aAttributes ).">"
827 827
                         . ( $_bIsLabelSet
828 828
                             ? $_aAttributes[ 'data-label' ] 
829 829
                             : ( strrpos( $_aAttributes[ 'class' ], 'dashicons' )
@@ -842,7 +842,7 @@  discard block
 block discarded – undo
842 842
                  */
843 843
                 private function _getFormattedUploadButtonAttributes( $sInputID, array $aButtonAttributes, $_bIsLabelSet, $bRepeatable, $bExternalSource ) {
844 844
                         
845
-                    $_aAttributes           = array(
845
+                    $_aAttributes = array(
846 846
                             'id'        => "select_image_{$sInputID}",
847 847
                             'href'      => '#',            
848 848
                             'data-uploader_type'            => ( string ) function_exists( 'wp_enqueue_media' ),
@@ -855,7 +855,7 @@  discard block
 block discarded – undo
855 855
                                 : $this->oMsg->get( 'select_image' ),
856 856
                             'data-label' => null,
857 857
                         );
858
-                    $_aAttributes[ 'class' ]  = $this->getClassAttribute( 
858
+                    $_aAttributes[ 'class' ] = $this->getClassAttribute( 
859 859
                         'select_image button button-small ',
860 860
                         $this->getAOrB(
861 861
                             trim( $aButtonAttributes[ 'class' ] ),
@@ -883,16 +883,16 @@  discard block
 block discarded – undo
883 883
          * @return      string
884 884
          * @internal
885 885
          */
886
-        protected function _getRemoveButtonScript( $sInputID, array $aButtonAttributes, $sType='image' ) {
886
+        protected function _getRemoveButtonScript( $sInputID, array $aButtonAttributes, $sType = 'image' ) {
887 887
            
888
-            if ( ! function_exists( 'wp_enqueue_media' ) ) {
888
+            if ( !function_exists( 'wp_enqueue_media' ) ) {
889 889
                 return '';
890 890
             }
891 891
     
892 892
             // Do not include the escaping character (backslash) in the heredoc variable declaration 
893 893
             // because the minifier script will parse it and the <<<JAVASCRIPTS and JAVASCRIPTS; parts are converted to double quotes (")
894 894
             // which causes the PHP syntax error.                
895
-            $_sButtonHTML  = '"' . $this->_getRemoveButtonHTMLByType( $sInputID, $aButtonAttributes, $sType ) . '"';
895
+            $_sButtonHTML = '"'.$this->_getRemoveButtonHTMLByType( $sInputID, $aButtonAttributes, $sType ).'"';
896 896
             $_sScript = <<<JAVASCRIPTS
897 897
                 if ( 0 === jQuery( 'a#remove_{$sType}_{$sInputID}' ).length ) {
898 898
                     jQuery( 'input#{$sInputID}' ).after( $_sButtonHTML );
@@ -903,7 +903,7 @@  discard block
 block discarded – undo
903 903
                     . '/* <![CDATA[ */'
904 904
                     . $_sScript 
905 905
                     . '/* ]]> */'
906
-                . "</script>". PHP_EOL;
906
+                . "</script>".PHP_EOL;
907 907
            
908 908
         }
909 909
         
@@ -913,11 +913,11 @@  discard block
 block discarded – undo
913 913
          * @return      string      The generated HTML remove button output.
914 914
          * @internal
915 915
          */
916
-        protected function _getRemoveButtonHTMLByType( $sInputID, array $aButtonAttributes, $sType='image' ) {
916
+        protected function _getRemoveButtonHTMLByType( $sInputID, array $aButtonAttributes, $sType = 'image' ) {
917 917
         
918 918
             $_bIsLabelSet   = isset( $aButtonAttributes[ 'data-label' ] ) && $aButtonAttributes[ 'data-label' ];
919 919
             $_aAttributes   = $this->_getFormattedRemoveButtonAttributesByType( $sInputID, $aButtonAttributes, $_bIsLabelSet, $sType );
920
-            return "<a " . $this->getAttributes( $_aAttributes ) . ">"
920
+            return "<a ".$this->getAttributes( $_aAttributes ).">"
921 921
                     . ( $_bIsLabelSet
922 922
                         ? $_aAttributes[ 'data-label' ] 
923 923
                         : $this->getAOrB(
@@ -936,9 +936,9 @@  discard block
 block discarded – undo
936 936
              * @return      array       The formatted remove button attributes array.
937 937
              * @internal
938 938
              */
939
-            protected function _getFormattedRemoveButtonAttributesByType( $sInputID, array $aButtonAttributes, $_bIsLabelSet, $sType='image' ) {
939
+            protected function _getFormattedRemoveButtonAttributesByType( $sInputID, array $aButtonAttributes, $_bIsLabelSet, $sType = 'image' ) {
940 940
 
941
-                $_sOnClickFunctionName  = 'removeInputValuesFor' . ucfirst( $sType );
941
+                $_sOnClickFunctionName  = 'removeInputValuesFor'.ucfirst( $sType );
942 942
                 $_aAttributes           = array(
943 943
                         'id'        => "remove_{$sType}_{$sInputID}",
944 944
                         'href'      => '#',            
@@ -950,7 +950,7 @@  discard block
 block discarded – undo
950 950
                             ? $aButtonAttributes[ 'data-label' ] 
951 951
                             : $this->oMsg->get( 'remove_value' ),
952 952
                     );
953
-                $_aAttributes[ 'class' ]  = $this->getClassAttribute( 
953
+                $_aAttributes[ 'class' ] = $this->getClassAttribute( 
954 954
                     "remove_value remove_{$sType} button button-small", 
955 955
                     $this->getAOrB(
956 956
                         trim( $aButtonAttributes[ 'class' ] ),
Please login to merge, or discard this patch.
_common/form/field_type/AdminPageFramework_FieldType_section_title.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@
 block discarded – undo
25 25
     /**
26 26
      * Defines the field type slugs used for this field type.
27 27
      */
28
-    public $aFieldTypeSlugs = array( 'section_title', );
28
+    public $aFieldTypeSlugs = array( 'section_title',);
29 29
     
30 30
     /**
31 31
      * Defines the default key-values of this field type. 
Please login to merge, or discard this patch.