@@ -11,7 +11,7 @@ |
||
11 | 11 | * If accessed from a console, include the registry class to laod 'AdminPageFramework_Registry_Base'. |
12 | 12 | */ |
13 | 13 | if ( php_sapi_name() === 'cli' ) { |
14 | - $_sFrameworkFilePath = dirname( dirname( __FILE__ ) ) . '/admin-page-framework.php'; |
|
14 | + $_sFrameworkFilePath = dirname( dirname( __FILE__ ) ).'/admin-page-framework.php'; |
|
15 | 15 | if ( file_exists( $_sFrameworkFilePath ) ) { |
16 | 16 | include_once( $_sFrameworkFilePath ); |
17 | 17 | } |
@@ -36,7 +36,7 @@ |
||
36 | 36 | $_aParameters = func_get_args() + array( |
37 | 37 | $this->aSubject, |
38 | 38 | ); |
39 | - $this->aSubject = $_aParameters[ 0 ]; |
|
39 | + $this->aSubject = $_aParameters[ 0 ]; |
|
40 | 40 | |
41 | 41 | } |
42 | 42 |
@@ -112,7 +112,7 @@ |
||
112 | 112 | */ |
113 | 113 | public function removeSection( $sSectionID ) { |
114 | 114 | |
115 | - if ( '_default' === $sSectionID ){ |
|
115 | + if ( '_default' === $sSectionID ) { |
|
116 | 116 | return; |
117 | 117 | } |
118 | 118 | unset( |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | * @param string $sType If empty, the method will check if a message exists in all types. Otherwise, it checks the existence of a message of the specified type. |
45 | 45 | * @return boolean True if a setting notice is set; otherwise, false. |
46 | 46 | */ |
47 | - public function hasSubmitNotice( $sType='' ) { |
|
47 | + public function hasSubmitNotice( $sType = '' ) { |
|
48 | 48 | return $this->oSubmitNotice->hasNotice( $sType ); |
49 | 49 | } |
50 | 50 | |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | * @param boolean $bOverride (optional) If true, only one message will be shown in the next page load. false: do not override when there is a message of the same id. true: override the previous one. |
71 | 71 | * @return void |
72 | 72 | */ |
73 | - public function setSubmitNotice( $sMessage, $sType='error', $asAttributes=array(), $bOverride=true ) { |
|
73 | + public function setSubmitNotice( $sMessage, $sType = 'error', $asAttributes = array(), $bOverride = true ) { |
|
74 | 74 | $this->oSubmitNotice->set( |
75 | 75 | $sMessage, |
76 | 76 | $sType, |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | |
98 | 98 | $this->aSectionsets[ $aSectionset[ 'section_id' ] ] = $aSectionset; |
99 | 99 | $this->aFieldsets[ $aSectionset[ 'section_id' ] ] = $this->getElement( |
100 | - $this->aFieldsets, // subject array |
|
100 | + $this->aFieldsets, // subject array |
|
101 | 101 | $aSectionset[ 'section_id' ], // key |
102 | 102 | array() // default |
103 | 103 | ); |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | */ |
113 | 113 | public function removeSection( $sSectionID ) { |
114 | 114 | |
115 | - if ( '_default' === $sSectionID ){ |
|
115 | + if ( '_default' === $sSectionID ) { |
|
116 | 116 | return; |
117 | 117 | } |
118 | 118 | unset( |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | * @return void |
152 | 152 | */ |
153 | 153 | public function addResource( $sKey, $sValue ) { |
154 | - self::$_aResources[ $sKey ][] = $sValue; |
|
154 | + self::$_aResources[ $sKey ][ ] = $sValue; |
|
155 | 155 | } |
156 | 156 | |
157 | 157 | /** |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | public function addField( $asFieldset ) { |
175 | 175 | |
176 | 176 | // If it is a target section, update the property and return. |
177 | - if ( ! $this->_isFieldsetDefinition( $asFieldset ) ) { |
|
177 | + if ( !$this->_isFieldsetDefinition( $asFieldset ) ) { |
|
178 | 178 | $this->_asTargetSectionID = $this->_getTargetSectionID( $asFieldset ); |
179 | 179 | return $this->_asTargetSectionID; |
180 | 180 | } |
@@ -183,13 +183,13 @@ discard block |
||
183 | 183 | |
184 | 184 | // Set the target section ID |
185 | 185 | $this->_asTargetSectionID = $this->getElement( |
186 | - $_aFieldset, // subject array |
|
186 | + $_aFieldset, // subject array |
|
187 | 187 | 'section_id', // key |
188 | 188 | $this->_asTargetSectionID // default |
189 | 189 | ); |
190 | 190 | |
191 | 191 | // Required Keys - 3.8.0+ Now 'type' can be omitted. |
192 | - if ( ! isset( $_aFieldset[ 'field_id' ] ) ) { |
|
192 | + if ( !isset( $_aFieldset[ 'field_id' ] ) ) { |
|
193 | 193 | return null; |
194 | 194 | } |
195 | 195 | |
@@ -292,7 +292,7 @@ discard block |
||
292 | 292 | */ |
293 | 293 | public function removeField( $sFieldID ) { |
294 | 294 | |
295 | - foreach( $this->aFieldsets as $_sSectionID => $_aSubSectionsOrFields ) { |
|
295 | + foreach ( $this->aFieldsets as $_sSectionID => $_aSubSectionsOrFields ) { |
|
296 | 296 | |
297 | 297 | if ( array_key_exists( $sFieldID, $_aSubSectionsOrFields ) ) { |
298 | 298 | unset( $this->aFieldsets[ $_sSectionID ][ $sFieldID ] ); |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | $aOptions // data source |
71 | 71 | ); |
72 | 72 | |
73 | - foreach( $aOptions as $_sSectionID => $_aSubSectionOrFields ) { |
|
73 | + foreach ( $aOptions as $_sSectionID => $_aSubSectionOrFields ) { |
|
74 | 74 | |
75 | 75 | $_aSubSection = $this->_getSubSectionFromOptions( |
76 | 76 | $_sSectionID, |
@@ -107,10 +107,10 @@ discard block |
||
107 | 107 | |
108 | 108 | $_aSubSection = array(); |
109 | 109 | $_iPrevIndex = null; |
110 | - foreach( $_aSubSectionOrFields as $_isIndexOrFieldID => $_aSubSectionOrFieldOptions ) { |
|
110 | + foreach ( $_aSubSectionOrFields as $_isIndexOrFieldID => $_aSubSectionOrFieldOptions ) { |
|
111 | 111 | |
112 | 112 | // If it is not a sub-section array, skip. |
113 | - if ( ! $this->isNumericInteger( $_isIndexOrFieldID ) ) { |
|
113 | + if ( !$this->isNumericInteger( $_isIndexOrFieldID ) ) { |
|
114 | 114 | continue; |
115 | 115 | } |
116 | 116 | |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | ); |
125 | 125 | |
126 | 126 | // Update the internal section index key |
127 | - foreach( $_aSubSection[ $_iIndex ] as &$_aField ) { |
|
127 | + foreach ( $_aSubSection[ $_iIndex ] as &$_aField ) { |
|
128 | 128 | $_aField[ '_section_index' ] = $_iIndex; |
129 | 129 | } |
130 | 130 | unset( $_aField ); // to be safe in PHP |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | */ |
151 | 151 | private function _getSubSectionItemsFromOptions( array $_aSubSection, $_sSectionID, $_iIndex, $_iPrevIndex ) { |
152 | 152 | |
153 | - if ( ! isset( $this->aFieldsets[ $_sSectionID ] ) ) { |
|
153 | + if ( !isset( $this->aFieldsets[ $_sSectionID ] ) ) { |
|
154 | 154 | return array(); |
155 | 155 | } |
156 | 156 | |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | : $this->getNonIntegerKeyElements( $this->aFieldsets[ $_sSectionID ] ); |
160 | 160 | |
161 | 161 | // if empty, merge with the previous element. |
162 | - return ! empty( $_aFields ) |
|
162 | + return !empty( $_aFields ) |
|
163 | 163 | ? $_aFields |
164 | 164 | : $this->getElementAsArray( |
165 | 165 | $_aSubSection, |
@@ -24,12 +24,12 @@ discard block |
||
24 | 24 | * @since 3.6.0 Moved from `AdminPageFramework_FormDefinition`. |
25 | 25 | */ |
26 | 26 | static public $aStructure = array( |
27 | - 'title' => null, // (string) the section title will be assigned by default in the section formatting method. |
|
28 | - 'is_collapsed' => true, // (boolean) whether it is already collapsed or expanded |
|
29 | - 'toggle_all_button' => null, // (boolean|string|array) the position of where to display the toggle-all button that toggles the folding state of all collapsible sections. Accepts the following values. 'top-right', 'top-left', 'bottom-right', 'bottom-left'. If true is passed, the default 'top-right' will be used. To not to display, do not set any or pass `false` or `null`. |
|
30 | - 'collapse_others_on_expand' => true, // (boolean) whether the other collapsible sections should be folded when the section is unfolded. |
|
31 | - 'container' => 'sections', // (string) the container element that collapsible styling gets applied to. Either 'sections' or 'section' is accepted. |
|
32 | - 'type' => 'box', // 3.7.0+ (string) supported types 'box', 'button' Default: `box`. The `button` type is only supported when the `container` argument is `section`. |
|
27 | + 'title' => null, // (string) the section title will be assigned by default in the section formatting method. |
|
28 | + 'is_collapsed' => true, // (boolean) whether it is already collapsed or expanded |
|
29 | + 'toggle_all_button' => null, // (boolean|string|array) the position of where to display the toggle-all button that toggles the folding state of all collapsible sections. Accepts the following values. 'top-right', 'top-left', 'bottom-right', 'bottom-left'. If true is passed, the default 'top-right' will be used. To not to display, do not set any or pass `false` or `null`. |
|
30 | + 'collapse_others_on_expand' => true, // (boolean) whether the other collapsible sections should be folded when the section is unfolded. |
|
31 | + 'container' => 'sections', // (string) the container element that collapsible styling gets applied to. Either 'sections' or 'section' is accepted. |
|
32 | + 'type' => 'box', // 3.7.0+ (string) supported types 'box', 'button' Default: `box`. The `button` type is only supported when the `container` argument is `section`. |
|
33 | 33 | ); |
34 | 34 | |
35 | 35 | public $abCollapsible = false; |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | * @remark The framework will not pass this parameter when formatting a section definition array. |
43 | 43 | * It will be passed when the framework is rendering a form table to generate collapsible elements. |
44 | 44 | */ |
45 | - public $aSection = array(); |
|
45 | + public $aSection = array(); |
|
46 | 46 | |
47 | 47 | /** |
48 | 48 | * Sets up properties. |
@@ -85,14 +85,14 @@ discard block |
||
85 | 85 | |
86 | 86 | $_aCollapsible = $this->getAsArray( $this->abCollapsible ) + array( |
87 | 87 | 'title' => $sTitle, |
88 | - ) + self::$aStructure; |
|
88 | + ) + self::$aStructure; |
|
89 | 89 | |
90 | 90 | $_aCollapsible[ 'toggle_all_button' ] = implode( |
91 | 91 | ',', |
92 | 92 | $this->getAsArray( $_aCollapsible[ 'toggle_all_button' ] ) |
93 | 93 | ); |
94 | 94 | |
95 | - if ( ! empty( $aSection ) ) { |
|
95 | + if ( !empty( $aSection ) ) { |
|
96 | 96 | $_aCollapsible[ 'toggle_all_button' ] = $this->_getToggleAllButtonArgument( |
97 | 97 | $_aCollapsible[ 'toggle_all_button' ], |
98 | 98 | $aSection |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | */ |
117 | 117 | private function _getToggleAllButtonArgument( $sToggleAll, array $aSection ) { |
118 | 118 | |
119 | - if ( ! $aSection[ 'repeatable' ] ) { |
|
119 | + if ( !$aSection[ 'repeatable' ] ) { |
|
120 | 120 | return $sToggleAll; |
121 | 121 | } |
122 | 122 | |
@@ -126,13 +126,13 @@ discard block |
||
126 | 126 | } |
127 | 127 | |
128 | 128 | // Disable the toggle all button for middle sub-sections in repeatable sections. |
129 | - if ( ! $aSection[ '_is_first_index' ] && ! $aSection[ '_is_last_index' ] ) { |
|
129 | + if ( !$aSection[ '_is_first_index' ] && !$aSection[ '_is_last_index' ] ) { |
|
130 | 130 | return 0; |
131 | 131 | } |
132 | 132 | |
133 | 133 | $_aToggleAll = $this->getAOrB( |
134 | - true === $sToggleAll || 1 === $sToggleAll, // evaluate |
|
135 | - array( 'top-right', 'bottom-right' ), // if true |
|
134 | + true === $sToggleAll || 1 === $sToggleAll, // evaluate |
|
135 | + array( 'top-right', 'bottom-right' ), // if true |
|
136 | 136 | explode( ',', $sToggleAll ) // if false |
137 | 137 | ); |
138 | 138 | $_aToggleAll = $this->getAOrB( |
@@ -32,7 +32,7 @@ |
||
32 | 32 | $this->aAttributes + $this->_getAttributes() |
33 | 33 | ); |
34 | 34 | |
35 | - $_aAttributes[ 'class' ] = $this->getClassAttribute( |
|
35 | + $_aAttributes[ 'class' ] = $this->getClassAttribute( |
|
36 | 36 | $this->getElement( $_aAttributes, 'class', array() ), |
37 | 37 | $this->getElement( $this->aArguments, array( 'class', $this->sContext ), array() ) |
38 | 38 | ); |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | |
44 | 44 | $_aParams = func_get_args() + array( null ); |
45 | 45 | $_oMsg = $_aParams[ 0 ]; |
46 | - $_sToggleAllButtonHTML = '"' . self::_getToggleAllButtonHTML( $_oMsg ) . '"'; |
|
46 | + $_sToggleAllButtonHTML = '"'.self::_getToggleAllButtonHTML( $_oMsg ).'"'; |
|
47 | 47 | |
48 | 48 | return <<<JAVASCRIPTS |
49 | 49 | ( function( $ ) { |
@@ -212,19 +212,19 @@ discard block |
||
212 | 212 | $_sLabelToggleAll = $oMsg->get( 'toggle_all' ); |
213 | 213 | $_sLabelToggleAllSections = $oMsg->get( 'toggle_all_collapsible_sections' ); |
214 | 214 | $_sDashIconSort = self::getAOrB( |
215 | - version_compare( $GLOBALS['wp_version'], '3.8', '<' ), // evaluate |
|
215 | + version_compare( $GLOBALS[ 'wp_version' ], '3.8', '<' ), // evaluate |
|
216 | 216 | '', // true |
217 | 217 | 'dashicons dashicons-sort' // false |
218 | 218 | ); |
219 | - $_sText = self::getAOrB( |
|
219 | + $_sText = self::getAOrB( |
|
220 | 220 | $_sDashIconSort, // evaluate |
221 | 221 | '', // true |
222 | 222 | $_sLabelToggleAll // false |
223 | 223 | ); |
224 | 224 | |
225 | 225 | return "<div class='admin-page-framework-collapsible-toggle-all-button-container'>" |
226 | - . "<span class='admin-page-framework-collapsible-toggle-all-button button " . $_sDashIconSort . "'" |
|
227 | - . " title='" . esc_attr( $_sLabelToggleAllSections ) |
|
226 | + . "<span class='admin-page-framework-collapsible-toggle-all-button button ".$_sDashIconSort."'" |
|
227 | + . " title='".esc_attr( $_sLabelToggleAllSections ) |
|
228 | 228 | . "'>" |
229 | 229 | . $_sText |
230 | 230 | . "</span>" |
@@ -18,17 +18,17 @@ discard block |
||
18 | 18 | */ |
19 | 19 | class AdminPageFramework_Form_View___CollapsibleSectionTitle extends AdminPageFramework_Form_View___SectionTitle { |
20 | 20 | |
21 | - public $aArguments = array( |
|
21 | + public $aArguments = array( |
|
22 | 22 | 'title' => null, |
23 | 23 | 'tag' => null, |
24 | 24 | 'section_index' => null, |
25 | 25 | 'collapsible' => array(), |
26 | 26 | 'container_type' => 'section', // section or sections |
27 | 27 | |
28 | - 'sectionset' => array(), // 3.7.0+ sectionset definition array |
|
28 | + 'sectionset' => array(), // 3.7.0+ sectionset definition array |
|
29 | 29 | |
30 | 30 | ); |
31 | - public $aFieldsets = array(); |
|
31 | + public $aFieldsets = array(); |
|
32 | 32 | public $aSavedData = array(); |
33 | 33 | public $aFieldErrors = array(); |
34 | 34 | public $aFieldTypeDefinitions = array(); |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | * @param array|boolean $aCollapsible The collapsible argument. |
64 | 64 | * @param string $sContainer The position context. Accepts either 'sections' or 'section'. If the set position in the argument array does not match this value, the method will return an empty string. |
65 | 65 | */ |
66 | - private function _getCollapsibleSectionTitleBlock( array $aCollapsible, $sContainer='sections', $iSectionIndex=null ) { |
|
66 | + private function _getCollapsibleSectionTitleBlock( array $aCollapsible, $sContainer = 'sections', $iSectionIndex = null ) { |
|
67 | 67 | |
68 | 68 | if ( $sContainer !== $aCollapsible[ 'container' ] ) { |
69 | 69 | return ''; |
@@ -79,10 +79,10 @@ discard block |
||
79 | 79 | ); |
80 | 80 | |
81 | 81 | $_aSectionset = $this->aArguments[ 'sectionset' ]; |
82 | - $_sSectionTitleTagID = str_replace( '|', '_', $_aSectionset[ '_section_path' ] ) . '_' . $iSectionIndex; |
|
82 | + $_sSectionTitleTagID = str_replace( '|', '_', $_aSectionset[ '_section_path' ] ).'_'.$iSectionIndex; |
|
83 | 83 | |
84 | 84 | return $this->_getCollapsibleSectionsEnablerScript() |
85 | - . "<div " . $this->getAttributes( |
|
85 | + . "<div ".$this->getAttributes( |
|
86 | 86 | array( |
87 | 87 | 'id' => $_sSectionTitleTagID, |
88 | 88 | 'class' => $this->getClassAttribute( |
@@ -103,11 +103,11 @@ discard block |
||
103 | 103 | 'collapsed', |
104 | 104 | '' |
105 | 105 | ), |
106 | - 'admin-page-framework-collapsible-type-' . $aCollapsible[ 'type' ] |
|
106 | + 'admin-page-framework-collapsible-type-'.$aCollapsible[ 'type' ] |
|
107 | 107 | ), |
108 | 108 | ) |
109 | 109 | + $this->getDataAttributeArray( $aCollapsible ) |
110 | - ) . ">" |
|
110 | + ).">" |
|
111 | 111 | . $_sSectionTitle |
112 | 112 | . "</div>"; |
113 | 113 |
@@ -56,13 +56,13 @@ |
||
56 | 56 | public function getFieldsetOutput( $aFieldset ) { |
57 | 57 | |
58 | 58 | // Check if the field is visible |
59 | - if ( ! $this->isFieldsetVisible( $aFieldset ) ) { |
|
59 | + if ( !$this->isFieldsetVisible( $aFieldset ) ) { |
|
60 | 60 | return ''; |
61 | 61 | } |
62 | 62 | |
63 | 63 | $_oFieldset = new AdminPageFramework_Form_View___Fieldset( |
64 | 64 | $aFieldset, |
65 | - $this->aSavedData, // passed by reference. @todo: examine why it needs to be passed by reference. |
|
65 | + $this->aSavedData, // passed by reference. @todo: examine why it needs to be passed by reference. |
|
66 | 66 | $this->aFieldErrors, |
67 | 67 | $this->aFieldTypeDefinitions, |
68 | 68 | $this->oMsg, |