@@ -60,18 +60,18 @@ discard block |
||
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 |
||
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 |
||
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; |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | */ |
19 | 19 | class AdminPageFramework_Form_Model___SectionConditioner extends AdminPageFramework_FrameworkUtility { |
20 | 20 | |
21 | - public $aSectionsets = array(); |
|
21 | + public $aSectionsets = array(); |
|
22 | 22 | |
23 | 23 | /** |
24 | 24 | * Sets up hooks. |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | $_aParameters = func_get_args() + array( |
30 | 30 | $this->aSectionsets, |
31 | 31 | ); |
32 | - $this->aSectionsets = $_aParameters[ 0 ]; |
|
32 | + $this->aSectionsets = $_aParameters[ 0 ]; |
|
33 | 33 | |
34 | 34 | } |
35 | 35 | |
@@ -51,11 +51,11 @@ discard block |
||
51 | 51 | * @since 3.7.0 Moved from `AdminPageFramework_FormDefinition`. Changed the name from `getConditionedSections()`. |
52 | 52 | * @return array The conditioned sectionsets array. |
53 | 53 | */ |
54 | - private function _getSectionsConditioned( array $aSections=array() ) { |
|
54 | + private function _getSectionsConditioned( array $aSections = array() ) { |
|
55 | 55 | |
56 | - $_aNewSections = array(); |
|
57 | - foreach( $aSections as $_sSectionID => $_aSection ) { |
|
58 | - if ( ! $this->_isAllowed( $_aSection ) ) { |
|
56 | + $_aNewSections = array(); |
|
57 | + foreach ( $aSections as $_sSectionID => $_aSection ) { |
|
58 | + if ( !$this->_isAllowed( $_aSection ) ) { |
|
59 | 59 | continue; |
60 | 60 | } |
61 | 61 | $_aNewSections[ $_sSectionID ] = $_aSection; |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | protected function _isAllowed( array $aDefinition ) { |
75 | 75 | |
76 | 76 | // Check capability. If the access level is not sufficient, skip. |
77 | - if ( ! current_user_can( $aDefinition[ 'capability' ] ) ) { |
|
77 | + if ( !current_user_can( $aDefinition[ 'capability' ] ) ) { |
|
78 | 78 | return false; |
79 | 79 | } |
80 | 80 | return ( boolean ) $aDefinition[ 'if' ]; |
@@ -42,9 +42,9 @@ discard block |
||
42 | 42 | 'posttype', |
43 | 43 | 'size', |
44 | 44 | 'section_title', // 3.0.0+ |
45 | - 'system', // 3.3.0+ |
|
46 | - 'inline_mixed', // 3.8.0+ |
|
47 | - '_nested', // 3.8.0+ |
|
45 | + 'system', // 3.3.0+ |
|
46 | + 'inline_mixed', // 3.8.0+ |
|
47 | + '_nested', // 3.8.0+ |
|
48 | 48 | ); |
49 | 49 | |
50 | 50 | public $sCallerID = ''; |
@@ -74,16 +74,16 @@ discard block |
||
74 | 74 | public function get() { |
75 | 75 | |
76 | 76 | $_aFieldTypeDefinitions = array(); |
77 | - foreach( self::$_aDefaultFieldTypeSlugs as $_sFieldTypeSlug ) { |
|
77 | + foreach ( self::$_aDefaultFieldTypeSlugs as $_sFieldTypeSlug ) { |
|
78 | 78 | |
79 | 79 | $_sFieldTypeClassName = "AdminPageFramework_FieldType_{$_sFieldTypeSlug}"; |
80 | 80 | $_oFieldType = new $_sFieldTypeClassName( |
81 | - $this->sCallerID, // usually an instantiated class name |
|
82 | - null, // field type slugs - if it is different from the one defined in the class property |
|
81 | + $this->sCallerID, // usually an instantiated class name |
|
82 | + null, // field type slugs - if it is different from the one defined in the class property |
|
83 | 83 | $this->oMsg, |
84 | 84 | false // `false` to disable auto-registering. |
85 | 85 | ); |
86 | - foreach( $_oFieldType->aFieldTypeSlugs as $_sSlug ) { |
|
86 | + foreach ( $_oFieldType->aFieldTypeSlugs as $_sSlug ) { |
|
87 | 87 | $_aFieldTypeDefinitions[ $_sSlug ] = $_oFieldType->getDefinitionArray(); |
88 | 88 | } |
89 | 89 | } |
@@ -58,23 +58,23 @@ discard block |
||
58 | 58 | */ |
59 | 59 | public function get() { |
60 | 60 | |
61 | - $this->aResources[ 'internal_scripts' ] = $this->_getUpdatedInternalItemsByCallback( |
|
61 | + $this->aResources[ 'internal_scripts' ] = $this->_getUpdatedInternalItemsByCallback( |
|
62 | 62 | $this->aResources[ 'internal_scripts' ], |
63 | 63 | 'hfGetScripts' |
64 | 64 | ); |
65 | - $this->aResources[ 'internal_styles' ] = $this->_getUpdatedInternalItemsByCallback( |
|
65 | + $this->aResources[ 'internal_styles' ] = $this->_getUpdatedInternalItemsByCallback( |
|
66 | 66 | $this->aResources[ 'internal_styles' ], |
67 | 67 | 'hfGetStyles' |
68 | 68 | ); |
69 | - $this->aResources[ 'internal_styles_ie' ] = $this->_getUpdatedInternalItemsByCallback( |
|
69 | + $this->aResources[ 'internal_styles_ie' ] = $this->_getUpdatedInternalItemsByCallback( |
|
70 | 70 | $this->aResources[ 'internal_styles_ie' ], |
71 | 71 | 'hfGetIEStyles' |
72 | 72 | ); |
73 | - $this->aResources[ 'src_styles' ] = $this->_getUpdatedEnqueuingItemsByCallback( |
|
73 | + $this->aResources[ 'src_styles' ] = $this->_getUpdatedEnqueuingItemsByCallback( |
|
74 | 74 | $this->aResources[ 'src_styles' ], |
75 | 75 | 'aEnqueueStyles' |
76 | 76 | ); |
77 | - $this->aResources[ 'src_scripts' ] = $this->_getUpdatedEnqueuingItemsByCallback( |
|
77 | + $this->aResources[ 'src_scripts' ] = $this->_getUpdatedEnqueuingItemsByCallback( |
|
78 | 78 | $this->aResources[ 'src_scripts' ], |
79 | 79 | 'aEnqueueScripts' |
80 | 80 | ); |
@@ -88,10 +88,10 @@ discard block |
||
88 | 88 | */ |
89 | 89 | private function _getUpdatedInternalItemsByCallback( array $aSubject, $sKey ) { |
90 | 90 | $_oCallable = $this->getElement( $this->aFieldTypeDefinition, $sKey ); |
91 | - if ( ! is_callable( $_oCallable ) ) { |
|
91 | + if ( !is_callable( $_oCallable ) ) { |
|
92 | 92 | return $aSubject; |
93 | 93 | } |
94 | - $aSubject[] = call_user_func_array( |
|
94 | + $aSubject[ ] = call_user_func_array( |
|
95 | 95 | $_oCallable, |
96 | 96 | array() |
97 | 97 | ); |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | /** |
39 | 39 | * Stores section set definitions. |
40 | 40 | */ |
41 | - public $aSectionsets = array( |
|
41 | + public $aSectionsets = array( |
|
42 | 42 | '_default' => array( |
43 | 43 | 'section_id' => '_default', |
44 | 44 | ), |
@@ -47,12 +47,12 @@ discard block |
||
47 | 47 | /** |
48 | 48 | * Stores field set definitions. |
49 | 49 | */ |
50 | - public $aFieldsets = array(); |
|
50 | + public $aFieldsets = array(); |
|
51 | 51 | |
52 | 52 | /** |
53 | 53 | * Multi-dimensional array holding the saved form data. |
54 | 54 | */ |
55 | - public $aSavedData = array(); |
|
55 | + public $aSavedData = array(); |
|
56 | 56 | |
57 | 57 | /** |
58 | 58 | * The capability level of the form. |
@@ -62,13 +62,13 @@ discard block |
||
62 | 62 | * Each secitonset and fieldset has individual capability. If they are not set, |
63 | 63 | * This value will be applied. |
64 | 64 | */ |
65 | - public $sCapability = ''; // default - an empty string |
|
65 | + public $sCapability = ''; // default - an empty string |
|
66 | 66 | |
67 | 67 | /** |
68 | 68 | * Stores callback functions. |
69 | 69 | * Each value will have a callback. |
70 | 70 | */ |
71 | - public $aCallbacks = array( |
|
71 | + public $aCallbacks = array( |
|
72 | 72 | |
73 | 73 | /** |
74 | 74 | * @return string The form default capability level. |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | + $this->aArguments; |
290 | 290 | $aArguments[ 'caller_id' ] = $aArguments[ 'caller_id' ] |
291 | 291 | ? $aArguments[ 'caller_id' ] |
292 | - : get_class( $this ); // if a caller id is empty, this class name will be used. |
|
292 | + : get_class( $this ); // if a caller id is empty, this class name will be used. |
|
293 | 293 | |
294 | 294 | if ( $this->sStructureType ) { |
295 | 295 | $aArguments[ 'structure_type' ] = $this->sStructureType; |
@@ -59,18 +59,18 @@ discard block |
||
59 | 59 | } |
60 | 60 | |
61 | 61 | // If the section ID is not registered, return false. |
62 | - if ( ! array_key_exists( $sID, $this->aSectionsets ) ) { |
|
62 | + if ( !array_key_exists( $sID, $this->aSectionsets ) ) { |
|
63 | 63 | return false; |
64 | 64 | } |
65 | 65 | |
66 | 66 | // the fields array's first dimension is also filled with the keys of section ids. |
67 | - if ( ! array_key_exists( $sID, $this->aFieldsets ) ) { |
|
67 | + if ( !array_key_exists( $sID, $this->aFieldsets ) ) { |
|
68 | 68 | return false; |
69 | 69 | } |
70 | 70 | |
71 | 71 | // Since numeric IDs are denied at the beginning of the method, the elements will not be sub-sections. |
72 | 72 | $_bIsSeciton = false; |
73 | - foreach( $this->aFieldsets as $_sSectionID => $_aFields ) { |
|
73 | + foreach ( $this->aFieldsets as $_sSectionID => $_aFields ) { |
|
74 | 74 | |
75 | 75 | if ( $_sSectionID == $sID ) { |
76 | 76 | $_bIsSeciton = true; |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | */ |
98 | 98 | public function canUserView( $sCapability ) { |
99 | 99 | |
100 | - if ( ! $sCapability ) { |
|
100 | + if ( !$sCapability ) { |
|
101 | 101 | return true; |
102 | 102 | } |
103 | 103 |
@@ -32,9 +32,9 @@ discard block |
||
32 | 32 | * @param string $sStructureType The type of object. Currently 'post_meta_box' or 'user_meta' is accepted. |
33 | 33 | * @return void |
34 | 34 | */ |
35 | - public function updateMetaDataByType( $iObjectID, array $aInput, array $aSavedMeta, $sStructureType='post_meta_box' ) { |
|
35 | + public function updateMetaDataByType( $iObjectID, array $aInput, array $aSavedMeta, $sStructureType = 'post_meta_box' ) { |
|
36 | 36 | |
37 | - if ( ! $iObjectID ) { |
|
37 | + if ( !$iObjectID ) { |
|
38 | 38 | return; |
39 | 39 | } |
40 | 40 | |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | 'user_meta' => 'update_user_meta', |
44 | 44 | 'term_meta' => 'update_term_meta', |
45 | 45 | ); |
46 | - if ( ! in_array( $sStructureType, array_keys( $_aFunctionNameMapByFieldsType ) ) ) { |
|
46 | + if ( !in_array( $sStructureType, array_keys( $_aFunctionNameMapByFieldsType ) ) ) { |
|
47 | 47 | return; |
48 | 48 | } |
49 | 49 | $_sFunctionName = $this->getElement( $_aFunctionNameMapByFieldsType, $sStructureType ); |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | |
81 | 81 | $_vSavedValue = $this->getElement( |
82 | 82 | $aSavedMeta, // subject |
83 | - $_sSectionOrFieldID, // dimensional keys |
|
83 | + $_sSectionOrFieldID, // dimensional keys |
|
84 | 84 | null // default value |
85 | 85 | ); |
86 | 86 |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | */ |
27 | 27 | public function construct() { |
28 | 28 | |
29 | - if ( ! function_exists( 'wp_enqueue_media' ) ) { |
|
29 | + if ( !function_exists( 'wp_enqueue_media' ) ) { |
|
30 | 30 | return; |
31 | 31 | } |
32 | 32 | wp_enqueue_script( 'jquery' ); |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | $_oMsg = $_aParams[ 0 ]; |
65 | 65 | |
66 | 66 | // means the WordPress version is 3.4.x or below |
67 | - if ( ! function_exists( 'wp_enqueue_media' ) ) { |
|
67 | + if ( !function_exists( 'wp_enqueue_media' ) ) { |
|
68 | 68 | return ""; |
69 | 69 | } |
70 | 70 |
@@ -115,7 +115,7 @@ |
||
115 | 115 | new self( $oMsg ); |
116 | 116 | |
117 | 117 | // $aSettings = $this->getAsArray( $aSettings ); |
118 | - $_sScript = <<<JAVASCRIPTS |
|
118 | + $_sScript = <<<JAVASCRIPTS |
|
119 | 119 | jQuery( document ).ready( function() { |
120 | 120 | jQuery( '#{$sContainerTagID}' ).enableAdminPageFrameworkSortableSections( '{$sContainerTagID}' ); |
121 | 121 | }); |