@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | self::$_bIsLoadedJSScripts_Widget = true; |
158 | 158 | } |
159 | 159 | |
160 | - if ( self::$_bIsLoadedJSScripts ) { |
|
160 | + if ( self::$_bIsLoadedJSScripts ) { |
|
161 | 161 | return; |
162 | 162 | } |
163 | 163 | self::$_bIsLoadedJSScripts = true; |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | * |
256 | 256 | * @since 3.0.0 |
257 | 257 | */ |
258 | - protected function _getSortableFieldEnablerScript( $sFieldsContainerID ) { |
|
258 | + protected function _getSortableFieldEnablerScript( $sFieldsContainerID ) { |
|
259 | 259 | |
260 | 260 | $_sScript = <<<JAVASCRIPTS |
261 | 261 | jQuery( document ).ready( function() { |
@@ -174,6 +174,7 @@ discard block |
||
174 | 174 | * Returns the repeatable fields script. |
175 | 175 | * |
176 | 176 | * @since 2.1.3 |
177 | + * @param string $sFieldsContainerID |
|
177 | 178 | */ |
178 | 179 | protected function _getRepeaterFieldEnablerScript( $sFieldsContainerID, $iFieldCount, $aSettings ) { |
179 | 180 | |
@@ -244,6 +245,7 @@ discard block |
||
244 | 245 | /** |
245 | 246 | * @since 3.8.13 |
246 | 247 | * @param array $aArguments |
248 | + * @param string $sSmallButtonSelector |
|
247 | 249 | * @return string |
248 | 250 | */ |
249 | 251 | private function ___getAddButtonAttribtes( $aArguments, $sFieldsContainerID, $sSmallButtonSelector ) { |
@@ -262,7 +264,7 @@ discard block |
||
262 | 264 | } |
263 | 265 | /** |
264 | 266 | * @since 3.8.13 |
265 | - * @param array $aArguments |
|
267 | + * @param string $sSmallButtonSelector |
|
266 | 268 | * @return string |
267 | 269 | */ |
268 | 270 | private function ___getRemvoeButtonAttribtes( $sFieldsContainerID, $sSmallButtonSelector, $iFieldCount ) { |
@@ -306,6 +308,7 @@ discard block |
||
306 | 308 | * Returns the sortable fields script. |
307 | 309 | * |
308 | 310 | * @since 3.0.0 |
311 | + * @param string $sFieldsContainerID |
|
309 | 312 | */ |
310 | 313 | protected function _getSortableFieldEnablerScript( $sFieldsContainerID ) { |
311 | 314 |
@@ -255,8 +255,8 @@ discard block |
||
255 | 255 | 'href' => empty( $aArguments[ 'disabled' ] ) |
256 | 256 | ? null |
257 | 257 | : '#TB_inline?width=' . $aArguments[ 'disabled' ][ 'box_width' ] |
258 | - . '&height=' . $aArguments[ 'disabled' ][ 'box_height' ] |
|
259 | - . '&inlineId=' . 'repeatable_field_disabled_' . $sFieldsContainerID, |
|
258 | + . '&height=' . $aArguments[ 'disabled' ][ 'box_height' ] |
|
259 | + . '&inlineId=' . 'repeatable_field_disabled_' . $sFieldsContainerID, |
|
260 | 260 | ); |
261 | 261 | return $this->getAttributes( $_sPlusButtonAttributes ); |
262 | 262 | } |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | private function ___getRemvoeButtonAttribtes( $sFieldsContainerID, $sSmallButtonSelector, $iFieldCount ) { |
269 | 269 | $_aMinusButtonAttributes = array( |
270 | 270 | 'class' => 'repeatable-field-remove-button button-secondary repeatable-field-button button' |
271 | - . $sSmallButtonSelector, |
|
271 | + . $sSmallButtonSelector, |
|
272 | 272 | 'title' => $this->oMsg->get( 'remove' ), |
273 | 273 | 'style' => $iFieldCount <= 1 |
274 | 274 | ? 'visibility: hidden' |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | * @param object $oMsg An object storing the system messages. |
69 | 69 | * @param array $aCallbacks An array storing the form-field specific callbacks. |
70 | 70 | */ |
71 | - public function __construct( $aFieldset, $aOptions, $aErrors, &$aFieldTypeDefinitions, &$oMsg, array $aCallbacks=array() ) { |
|
71 | + public function __construct( $aFieldset, $aOptions, $aErrors, &$aFieldTypeDefinitions, &$oMsg, array $aCallbacks = array() ) { |
|
72 | 72 | |
73 | 73 | // Set up the properties that will be accessed later in the methods. |
74 | 74 | $this->aFieldset = $this->_getFormatted( $aFieldset, $aFieldTypeDefinitions ); |
@@ -77,13 +77,13 @@ discard block |
||
77 | 77 | $this->aErrors = $this->getAsArray( $aErrors ); |
78 | 78 | $this->oMsg = $oMsg; |
79 | 79 | $this->aCallbacks = $aCallbacks + array( |
80 | - 'hfID' => null, // the input id attribute |
|
81 | - 'hfTagID' => null, // the fieldset/field row container id attribute |
|
82 | - 'hfName' => null, // the input name attribute |
|
83 | - 'hfNameFlat' => null, // the flat input name attribute |
|
80 | + 'hfID' => null, // the input id attribute |
|
81 | + 'hfTagID' => null, // the fieldset/field row container id attribute |
|
82 | + 'hfName' => null, // the input name attribute |
|
83 | + 'hfNameFlat' => null, // the flat input name attribute |
|
84 | 84 | 'hfInputName' => null, |
85 | 85 | 'hfInputNameFlat' => null, |
86 | - 'hfClass' => null, // the class attribute |
|
86 | + 'hfClass' => null, // the class attribute |
|
87 | 87 | ); |
88 | 88 | |
89 | 89 | // 2. Load necessary JavaScript scripts. |
@@ -150,9 +150,9 @@ discard block |
||
150 | 150 | * @since 3.2.0 Added the `$sFieldsType` parameter. |
151 | 151 | * @internal |
152 | 152 | */ |
153 | - private function _loadScripts( $sStructureType='' ) { |
|
153 | + private function _loadScripts( $sStructureType = '' ) { |
|
154 | 154 | |
155 | - if ( 'widget' === $sStructureType && ! self::$_bIsLoadedJSScripts_Widget ) { |
|
155 | + if ( 'widget' === $sStructureType && !self::$_bIsLoadedJSScripts_Widget ) { |
|
156 | 156 | new AdminPageFramework_Form_View___Script_Widget; |
157 | 157 | self::$_bIsLoadedJSScripts_Widget = true; |
158 | 158 | } |
@@ -177,8 +177,8 @@ discard block |
||
177 | 177 | */ |
178 | 178 | protected function _getRepeaterFieldEnablerScript( $sFieldsContainerID, $iFieldCount, $aSettings ) { |
179 | 179 | |
180 | - $_sSmallButtons = '"' . $this->___getRepeatableButtonHTML( $sFieldsContainerID, ( array ) $aSettings, $iFieldCount, true ) . '"'; |
|
181 | - $_sNestedFieldsButtons = '"' . $this->___getRepeatableButtonHTML( $sFieldsContainerID, ( array ) $aSettings, $iFieldCount, false ) . '"'; |
|
180 | + $_sSmallButtons = '"'.$this->___getRepeatableButtonHTML( $sFieldsContainerID, ( array ) $aSettings, $iFieldCount, true ).'"'; |
|
181 | + $_sNestedFieldsButtons = '"'.$this->___getRepeatableButtonHTML( $sFieldsContainerID, ( array ) $aSettings, $iFieldCount, false ).'"'; |
|
182 | 182 | $_aJSArray = json_encode( $aSettings ); |
183 | 183 | $_sScript = <<<JAVASCRIPTS |
184 | 184 | jQuery( document ).ready( function() { |
@@ -224,18 +224,18 @@ discard block |
||
224 | 224 | * @since 3.8.0 |
225 | 225 | * @return string |
226 | 226 | */ |
227 | - private function ___getRepeatableButtonHTML( $sFieldsContainerID, array $aArguments, $iFieldCount, $bSmall=true ) { |
|
227 | + private function ___getRepeatableButtonHTML( $sFieldsContainerID, array $aArguments, $iFieldCount, $bSmall = true ) { |
|
228 | 228 | |
229 | 229 | // @todo Move this formatting routine to the field-set formatter class. |
230 | 230 | $_oFormatter = new AdminPageFramework_Form_Model___Format_RepeatableField( $aArguments, $this->oMsg ); |
231 | 231 | $_aArguments = $_oFormatter->get(); |
232 | 232 | $_sSmallButtonSelector = $bSmall ? ' button-small' : ''; |
233 | - return "<div " . $this->___getContainerAttributes( $_aArguments ) . " >" |
|
234 | - . "<a " . $this->___getRemvoeButtonAttribtes( $sFieldsContainerID, $_sSmallButtonSelector, $iFieldCount ) . ">-</a>" |
|
235 | - . "<a " . $this->___getAddButtonAttribtes( $_aArguments, $sFieldsContainerID, $_sSmallButtonSelector ) . ">+</a>" |
|
233 | + return "<div ".$this->___getContainerAttributes( $_aArguments )." >" |
|
234 | + . "<a ".$this->___getRemvoeButtonAttribtes( $sFieldsContainerID, $_sSmallButtonSelector, $iFieldCount ).">-</a>" |
|
235 | + . "<a ".$this->___getAddButtonAttribtes( $_aArguments, $sFieldsContainerID, $_sSmallButtonSelector ).">+</a>" |
|
236 | 236 | . "</div>" |
237 | 237 | . $this->getModalForDisabledRepeatableElement( |
238 | - 'repeatable_field_disabled_' . $sFieldsContainerID, |
|
238 | + 'repeatable_field_disabled_'.$sFieldsContainerID, |
|
239 | 239 | $_aArguments[ 'disabled' ] |
240 | 240 | ); |
241 | 241 | |
@@ -254,9 +254,9 @@ discard block |
||
254 | 254 | 'data-id' => $sFieldsContainerID, |
255 | 255 | 'href' => empty( $aArguments[ 'disabled' ] ) |
256 | 256 | ? null |
257 | - : '#TB_inline?width=' . $aArguments[ 'disabled' ][ 'box_width' ] |
|
258 | - . '&height=' . $aArguments[ 'disabled' ][ 'box_height' ] |
|
259 | - . '&inlineId=' . 'repeatable_field_disabled_' . $sFieldsContainerID, |
|
257 | + : '#TB_inline?width='.$aArguments[ 'disabled' ][ 'box_width' ] |
|
258 | + . '&height='.$aArguments[ 'disabled' ][ 'box_height' ] |
|
259 | + . '&inlineId='.'repeatable_field_disabled_'.$sFieldsContainerID, |
|
260 | 260 | ); |
261 | 261 | return $this->getAttributes( $_sPlusButtonAttributes ); |
262 | 262 | } |
@@ -283,10 +283,10 @@ discard block |
||
283 | 283 | * @return string |
284 | 284 | */ |
285 | 285 | private function ___getContainerAttributes( $aArguments ) { |
286 | - $_aContainerAttributes = array( |
|
286 | + $_aContainerAttributes = array( |
|
287 | 287 | 'class' => $this->getClassAttribute( |
288 | 288 | 'admin-page-framework-repeatable-field-buttons', |
289 | - ! empty( $aArguments[ 'disabled' ] ) |
|
289 | + !empty( $aArguments[ 'disabled' ] ) |
|
290 | 290 | ? 'disabled' |
291 | 291 | : '' |
292 | 292 | ), |
@@ -299,7 +299,7 @@ discard block |
||
299 | 299 | unset( $aArguments[ 'disabled' ] ); |
300 | 300 | } |
301 | 301 | return $this->getAttributes( $_aContainerAttributes ) |
302 | - . ' ' . $this->getDataAttributes( $aArguments ); |
|
302 | + . ' '.$this->getDataAttributes( $aArguments ); |
|
303 | 303 | } |
304 | 304 | |
305 | 305 | /** |
@@ -26,8 +26,8 @@ discard block |
||
26 | 26 | return $_sResult; |
27 | 27 | } |
28 | 28 | |
29 | - public function getModel() { |
|
30 | - return $this->get() . '[' . $this->sIndexMark . ']'; |
|
29 | + public function getModel() { |
|
30 | + return $this->get().'['.$this->sIndexMark.']'; |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | /** |
@@ -35,14 +35,14 @@ discard block |
||
35 | 35 | */ |
36 | 36 | protected function _getFieldName() { |
37 | 37 | |
38 | - $_aFieldPath = $this->aArguments[ '_field_path_array' ]; |
|
39 | - if ( ! $this->_isSectionSet() ) { |
|
38 | + $_aFieldPath = $this->aArguments[ '_field_path_array' ]; |
|
39 | + if ( !$this->_isSectionSet() ) { |
|
40 | 40 | return $this->_getInputNameConstructed( $_aFieldPath ); |
41 | 41 | } |
42 | 42 | |
43 | 43 | $_aSectionPath = $this->aArguments[ '_section_path_array' ]; |
44 | 44 | if ( $this->_isSectionSet() && isset( $this->aArguments[ '_section_index' ] ) ) { |
45 | - $_aSectionPath[] = $this->aArguments[ '_section_index' ]; |
|
45 | + $_aSectionPath[ ] = $this->aArguments[ '_section_index' ]; |
|
46 | 46 | } |
47 | 47 | $_sFieldName = $this->_getInputNameConstructed( |
48 | 48 | array_merge( $_aSectionPath, $_aFieldPath ) |
@@ -26,7 +26,7 @@ |
||
26 | 26 | return $_sResult; |
27 | 27 | } |
28 | 28 | |
29 | - public function getModel() { |
|
29 | + public function getModel() { |
|
30 | 30 | return $this->get() . '[' . $this->sIndexMark . ']'; |
31 | 31 | } |
32 | 32 |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | * |
26 | 26 | * @since 3.6.0 |
27 | 27 | */ |
28 | - public $sContext = 'field'; |
|
28 | + public $sContext = 'field'; |
|
29 | 29 | |
30 | 30 | /** |
31 | 31 | * Returns the field container attribute array. |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | protected function _getAttributes() { |
42 | 42 | |
43 | 43 | // 3.8.0+ Supports omitting the `type` argument. |
44 | - $_sFieldTypeSelector = $this->getAOrB( |
|
44 | + $_sFieldTypeSelector = $this->getAOrB( |
|
45 | 45 | $this->aArguments[ 'type' ], |
46 | 46 | " admin-page-framework-field-{$this->aArguments[ 'type' ]}", |
47 | 47 | '' |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | |
67 | 67 | return array( |
68 | 68 | 'id' => $this->aArguments[ '_field_container_id' ], |
69 | - 'data-type' => $this->aArguments[ 'type' ], // referred by the repeatable field JavaScript script. |
|
69 | + 'data-type' => $this->aArguments[ 'type' ], // referred by the repeatable field JavaScript script. |
|
70 | 70 | 'class' => "admin-page-framework-field{$_sFieldTypeSelector}{$_sNestedFieldSelector}{$_sMixedFieldSelector}{$_sChildFieldSelector}" |
71 | 71 | . $this->getAOrB( |
72 | 72 | $this->aArguments[ 'attributes' ][ 'disabled' ], |
@@ -30,7 +30,6 @@ |
||
30 | 30 | * Returns the field container attribute array. |
31 | 31 | * |
32 | 32 | * @remark Formatting each sub-field should be performed prior to calling this method. |
33 | - * @param array $aField The (sub-)field definition array. This should have been formatted already. |
|
34 | 33 | * @return array The generated field container attribute array. |
35 | 34 | * @internal |
36 | 35 | * @since 3.5.3 |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | * |
26 | 26 | * @since 3.6.0 |
27 | 27 | */ |
28 | - public $sContext = 'fieldset'; |
|
28 | + public $sContext = 'fieldset'; |
|
29 | 29 | |
30 | 30 | /** |
31 | 31 | * Returns an attribute array. |
@@ -33,11 +33,11 @@ discard block |
||
33 | 33 | */ |
34 | 34 | protected function _getAttributes() { |
35 | 35 | return array( |
36 | - 'id' => $this->sContext . '-' . $this->aArguments[ 'tag_id' ], |
|
36 | + 'id' => $this->sContext.'-'.$this->aArguments[ 'tag_id' ], |
|
37 | 37 | 'class' => implode( |
38 | 38 | ' ', |
39 | 39 | array( |
40 | - 'admin-page-framework-' . $this->sContext, |
|
40 | + 'admin-page-framework-'.$this->sContext, |
|
41 | 41 | $this->_getSelectorForChildFieldset() |
42 | 42 | ) |
43 | 43 | ), |
@@ -56,9 +56,9 @@ discard block |
||
56 | 56 | return ''; |
57 | 57 | } |
58 | 58 | if ( $this->aArguments[ '_nested_depth' ] == 1 ) { |
59 | - return 'child-fieldset nested-depth-' . $this->aArguments[ '_nested_depth' ]; |
|
59 | + return 'child-fieldset nested-depth-'.$this->aArguments[ '_nested_depth' ]; |
|
60 | 60 | } |
61 | - return 'child-fieldset multiple-nesting nested-depth-' . $this->aArguments[ '_nested_depth' ]; |
|
61 | + return 'child-fieldset multiple-nesting nested-depth-'.$this->aArguments[ '_nested_depth' ]; |
|
62 | 62 | |
63 | 63 | } |
64 | 64 |
@@ -70,7 +70,7 @@ |
||
70 | 70 | } |
71 | 71 | |
72 | 72 | // If the first element is a string, it is a inline mixed field definition. |
73 | - return is_array( self::getElement( $aFieldset[ 'content' ], 0 ) ); |
|
73 | + return is_array( self::getElement( $aFieldset[ 'content' ], 0 ) ); |
|
74 | 74 | |
75 | 75 | } |
76 | 76 |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | */ |
59 | 59 | static public function hasNestedFields( $aFieldset ) { |
60 | 60 | |
61 | - if ( ! self::hasFieldDefinitionsInContent( $aFieldset ) ) { |
|
61 | + if ( !self::hasFieldDefinitionsInContent( $aFieldset ) ) { |
|
62 | 62 | return false; |
63 | 63 | } |
64 | 64 | // At this point, the `content` argument contains either the definition of nested fields or inline-mixed fields. |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | */ |
81 | 81 | static public function hasFieldDefinitionsInContent( $aFieldset ) { |
82 | 82 | |
83 | - if ( ! isset( $aFieldset[ 'content' ] ) ) { |
|
83 | + if ( !isset( $aFieldset[ 'content' ] ) ) { |
|
84 | 84 | return false; |
85 | 85 | } |
86 | 86 | if ( empty( $aFieldset[ 'content' ] ) ) { |
@@ -115,10 +115,10 @@ discard block |
||
115 | 115 | * @since 3.8.13 |
116 | 116 | */ |
117 | 117 | static public function isDynamicField( $aField ) { |
118 | - if ( ! empty( $aField[ 'repeatable' ] ) ) { |
|
118 | + if ( !empty( $aField[ 'repeatable' ] ) ) { |
|
119 | 119 | return true; |
120 | 120 | } |
121 | - if ( ! empty( $aField[ 'sortable' ] ) ) { |
|
121 | + if ( !empty( $aField[ 'sortable' ] ) ) { |
|
122 | 122 | return true; |
123 | 123 | } |
124 | 124 | return false; |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | if ( empty( $sString ) ) { |
148 | 148 | return $sString; |
149 | 149 | } |
150 | - return $sString . '|'; |
|
150 | + return $sString.'|'; |
|
151 | 151 | } |
152 | 152 | |
153 | 153 | /** |
@@ -163,17 +163,17 @@ discard block |
||
163 | 163 | */ |
164 | 164 | static public function getFieldsetReformattedBySubFieldIndex( $aFieldset, $iSubFieldIndex, $bHasSubFields, $aParentFieldset ) { |
165 | 165 | |
166 | - $_oCallerForm = $aFieldset[ '_caller_object' ]; |
|
166 | + $_oCallerForm = $aFieldset[ '_caller_object' ]; |
|
167 | 167 | |
168 | 168 | // Add sub-field index to the parent field path for repeated nested items. |
169 | - $aFieldset[ '_parent_field_path' ] = self::getAOrB( |
|
169 | + $aFieldset[ '_parent_field_path' ] = self::getAOrB( |
|
170 | 170 | $bHasSubFields, |
171 | - $aFieldset[ '_parent_field_path' ] . '|' . $iSubFieldIndex, |
|
171 | + $aFieldset[ '_parent_field_path' ].'|'.$iSubFieldIndex, |
|
172 | 172 | $aFieldset[ '_parent_field_path' ] |
173 | 173 | ); |
174 | - $aFieldset[ '_parent_tag_id' ] = self::getAOrB( |
|
174 | + $aFieldset[ '_parent_tag_id' ] = self::getAOrB( |
|
175 | 175 | $bHasSubFields, |
176 | - $aParentFieldset[ 'tag_id' ] . '__' . $iSubFieldIndex, |
|
176 | + $aParentFieldset[ 'tag_id' ].'__'.$iSubFieldIndex, |
|
177 | 177 | $aParentFieldset[ 'tag_id' ] |
178 | 178 | ); |
179 | 179 | |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | $aFieldset, |
183 | 183 | $aFieldset[ '_structure_type' ], |
184 | 184 | $aFieldset[ 'capability' ], |
185 | - ( integer ) $iSubFieldIndex + 1, // 1-based count (not index) |
|
185 | + ( integer ) $iSubFieldIndex + 1, // 1-based count (not index) |
|
186 | 186 | $aFieldset[ '_subsection_index' ], |
187 | 187 | $aFieldset[ '_is_section_repeatable' ], |
188 | 188 | $aFieldset[ '_caller_object' ] |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | |
192 | 192 | $_oFieldsetOutputFormatter = new AdminPageFramework_Form_Model___Format_FieldsetOutput( |
193 | 193 | $aFieldset, |
194 | - $aFieldset[ '_section_index' ], // `_section_index` is defined in the ...FieldsetOutput class. Since this is a nested item, it should be already set. |
|
194 | + $aFieldset[ '_section_index' ], // `_section_index` is defined in the ...FieldsetOutput class. Since this is a nested item, it should be already set. |
|
195 | 195 | $_oCallerForm->aFieldTypeDefinitions |
196 | 196 | ); |
197 | 197 | return $_oFieldsetOutputFormatter->get(); |
@@ -228,12 +228,12 @@ discard block |
||
228 | 228 | if ( empty( $aArguments ) ) { |
229 | 229 | return ''; |
230 | 230 | } |
231 | - if ( self::hasBeenCalled( 'disabled_repeatable_elements_modal_' . $sBoxElementID ) ) { |
|
231 | + if ( self::hasBeenCalled( 'disabled_repeatable_elements_modal_'.$sBoxElementID ) ) { |
|
232 | 232 | return ''; |
233 | 233 | } |
234 | 234 | add_thickbox(); // to display a message to the user. |
235 | 235 | return "<div id='{$sBoxElementID}' style='display:none'>" |
236 | - . "<p>" . $aArguments[ 'message' ] . "</p>" |
|
236 | + . "<p>".$aArguments[ 'message' ]."</p>" |
|
237 | 237 | . "</div>"; |
238 | 238 | |
239 | 239 | } |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | $_sPageSlug = $this->getElement( $_GET, 'page', '' ); |
47 | 47 | $_sTabSlug = $this->getElement( $_GET, 'tab', '' ); |
48 | 48 | $_sUserID = get_current_user_id(); |
49 | - return "apf_fe_" . md5( |
|
49 | + return "apf_fe_".md5( |
|
50 | 50 | $_sPageNow |
51 | 51 | . $_sPageSlug |
52 | 52 | . $_sTabSlug |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | public function get() { |
135 | 135 | |
136 | 136 | // Use a cache if exists. |
137 | - self::$_aFieldErrorCaches[ $this->sTransientKey ] = isset( self::$_aFieldErrorCaches[ $this->sTransientKey ] ) |
|
137 | + self::$_aFieldErrorCaches[ $this->sTransientKey ] = isset( self::$_aFieldErrorCaches[ $this->sTransientKey ] ) |
|
138 | 138 | ? self::$_aFieldErrorCaches[ $this->sTransientKey ] |
139 | 139 | : $this->getTransient( $this->sTransientKey ); |
140 | 140 | |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | * @since 3.7.0 |
152 | 152 | */ |
153 | 153 | public function delete() { |
154 | - if ( $this->hasBeenCalled( 'delete_' . $this->sTransientKey ) ) { |
|
154 | + if ( $this->hasBeenCalled( 'delete_'.$this->sTransientKey ) ) { |
|
155 | 155 | return; |
156 | 156 | } |
157 | 157 | add_action( 'shutdown', array( $this, '_replyToDelete' ) ); |
@@ -112,7 +112,7 @@ |
||
112 | 112 | * @return void |
113 | 113 | */ |
114 | 114 | public function _replyToSave() { |
115 | - if ( empty( self::$_aErrors ) ) { |
|
115 | + if ( empty( self::$_aErrors ) ) { |
|
116 | 116 | return; |
117 | 117 | } |
118 | 118 | $this->setTransient( |
@@ -80,10 +80,6 @@ discard block |
||
80 | 80 | * ` |
81 | 81 | * @since 3.7.0 |
82 | 82 | * @access public |
83 | - * @param string $sMessage the text message to be displayed. |
|
84 | - * @param string $sType (optional) the type of the message, either "error" or "updated" is used. |
|
85 | - * @param array $asAttributes (optional) the tag attribute array applied to the message container HTML element. If a string is given, it is used as the ID attribute value. |
|
86 | - * @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. |
|
87 | 83 | * @return void |
88 | 84 | */ |
89 | 85 | public function set( $aErrors ) { |
@@ -128,7 +124,6 @@ discard block |
||
128 | 124 | * Retrieves the settings error array set by the user in the validation callback. |
129 | 125 | * |
130 | 126 | * @since 3.7.0 |
131 | - * @param boolean $bDelete whether or not the transient should be deleted after retrieving it. |
|
132 | 127 | * @return array |
133 | 128 | */ |
134 | 129 | public function get() { |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | * @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. |
46 | 46 | * @return boolean True if a setting notice is set; otherwise, false. |
47 | 47 | */ |
48 | - public function hasSubmitNotice( $sType='' ) { |
|
48 | + public function hasSubmitNotice( $sType = '' ) { |
|
49 | 49 | return $this->oSubmitNotice->hasNotice( $sType ); |
50 | 50 | } |
51 | 51 | |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | * @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. |
72 | 72 | * @return void |
73 | 73 | */ |
74 | - public function setSubmitNotice( $sMessage, $sType='error', $asAttributes=array(), $bOverride=true ) { |
|
74 | + public function setSubmitNotice( $sMessage, $sType = 'error', $asAttributes = array(), $bOverride = true ) { |
|
75 | 75 | $this->oSubmitNotice->set( |
76 | 76 | $sMessage, |
77 | 77 | $sType, |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | |
99 | 99 | $this->aSectionsets[ $aSectionset[ 'section_id' ] ] = $aSectionset; |
100 | 100 | $this->aFieldsets[ $aSectionset[ 'section_id' ] ] = $this->getElement( |
101 | - $this->aFieldsets, // subject array |
|
101 | + $this->aFieldsets, // subject array |
|
102 | 102 | $aSectionset[ 'section_id' ], // key |
103 | 103 | array() // default |
104 | 104 | ); |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | */ |
114 | 114 | public function removeSection( $sSectionID ) { |
115 | 115 | |
116 | - if ( '_default' === $sSectionID ){ |
|
116 | + if ( '_default' === $sSectionID ) { |
|
117 | 117 | return; |
118 | 118 | } |
119 | 119 | unset( |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | * @return void |
144 | 144 | */ |
145 | 145 | public function addResource( $sKey, $sValue ) { |
146 | - self::$_aResources[ $sKey ][] = $sValue; |
|
146 | + self::$_aResources[ $sKey ][ ] = $sValue; |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | /** |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | public function addField( $asFieldset ) { |
167 | 167 | |
168 | 168 | // If it is a target section, update the property and return. |
169 | - if ( ! $this->_isFieldsetDefinition( $asFieldset ) ) { |
|
169 | + if ( !$this->_isFieldsetDefinition( $asFieldset ) ) { |
|
170 | 170 | $this->_asTargetSectionID = $this->_getTargetSectionID( $asFieldset ); |
171 | 171 | return $this->_asTargetSectionID; |
172 | 172 | } |
@@ -175,13 +175,13 @@ discard block |
||
175 | 175 | |
176 | 176 | // Set the target section ID |
177 | 177 | $this->_asTargetSectionID = $this->getElement( |
178 | - $_aFieldset, // subject array |
|
178 | + $_aFieldset, // subject array |
|
179 | 179 | 'section_id', // key |
180 | 180 | $this->_asTargetSectionID // default |
181 | 181 | ); |
182 | 182 | |
183 | 183 | // Required Keys - 3.8.0+ Now 'type' can be omitted. |
184 | - if ( ! isset( $_aFieldset[ 'field_id' ] ) ) { |
|
184 | + if ( !isset( $_aFieldset[ 'field_id' ] ) ) { |
|
185 | 185 | return null; |
186 | 186 | } |
187 | 187 | |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | */ |
285 | 285 | public function removeField( $sFieldID ) { |
286 | 286 | |
287 | - foreach( $this->aFieldsets as $_sSectionID => $_aSubSectionsOrFields ) { |
|
287 | + foreach ( $this->aFieldsets as $_sSectionID => $_aSubSectionsOrFields ) { |
|
288 | 288 | |
289 | 289 | if ( array_key_exists( $sFieldID, $_aSubSectionsOrFields ) ) { |
290 | 290 | unset( $this->aFieldsets[ $_sSectionID ][ $sFieldID ] ); |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | */ |
114 | 114 | public function removeSection( $sSectionID ) { |
115 | 115 | |
116 | - if ( '_default' === $sSectionID ){ |
|
116 | + if ( '_default' === $sSectionID ) { |
|
117 | 117 | return; |
118 | 118 | } |
119 | 119 | unset( |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | ); |
182 | 182 | |
183 | 183 | // Required Keys - 3.8.0+ Now 'type' can be omitted. |
184 | - if ( ! isset( $_aFieldset[ 'field_id' ] ) ) { |
|
184 | + if ( ! isset( $_aFieldset[ 'field_id' ] ) ) { |
|
185 | 185 | return null; |
186 | 186 | } |
187 | 187 |
@@ -148,6 +148,8 @@ |
||
148 | 148 | } |
149 | 149 | /** |
150 | 150 | * @since 3.7.0 |
151 | + * @param string $sKey |
|
152 | + * @param string $sValue |
|
151 | 153 | * @return void |
152 | 154 | */ |
153 | 155 | public function addResource( $sKey, $sValue ) { |
@@ -44,7 +44,7 @@ |
||
44 | 44 | call_user_func_array( |
45 | 45 | $aFieldTypeDefinition[ 'hfFieldSetTypeSetter' ], |
46 | 46 | array( $sStructureType ) |
47 | - ); |
|
47 | + ); |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | if ( is_callable( $aFieldTypeDefinition[ 'hfFieldLoader' ] ) ) { |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | foreach( $aFieldsets as $_sSectionPath => $_aItems ) { |
108 | 108 | |
109 | 109 | // If the section is not set, skip. |
110 | - if ( ! isset( $aSectionsets[ $_sSectionPath ] ) ) { |
|
110 | + if ( ! isset( $aSectionsets[ $_sSectionPath ] ) ) { |
|
111 | 111 | continue; |
112 | 112 | } |
113 | 113 | |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | } |
259 | 259 | |
260 | 260 | $_aSortedFields = array(); |
261 | - foreach( $aSectionsets as $_sSectionPath => $_aSecitonset ) { |
|
261 | + foreach( $aSectionsets as $_sSectionPath => $_aSecitonset ) { |
|
262 | 262 | if ( isset( $aFieldsets[ $_sSectionPath ] ) ) { |
263 | 263 | $_aSortedFields[ $_sSectionPath ] = $aFieldsets[ $_sSectionPath ]; |
264 | 264 | } |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | private function _getFieldsetFormatted( $aFieldset, $aSectionsets, $sCapability, $iCountOfElements, $iSubSectionIndex, $bIsSectionRepeatable, $oCallerObject ) { |
278 | 278 | |
279 | 279 | // 3.8.0+ Dropped the check for $aFieldset[ 'type' ] to allow it to be omitted. |
280 | - if ( ! isset( $aFieldset[ 'field_id' ] ) ) { |
|
280 | + if ( ! isset( $aFieldset[ 'field_id' ] ) ) { |
|
281 | 281 | return; |
282 | 282 | } |
283 | 283 |
@@ -99,6 +99,7 @@ discard block |
||
99 | 99 | * @since 3.1.1 Added a parameter. Changed to return the formatted sections array. |
100 | 100 | * @since 3.7.0 Moved from `AdminPageFramework_FormDefinition`. Changed the name from `formatFields()`. |
101 | 101 | * Added the `$aSectionsets` parameter. |
102 | + * @param string $sCapability |
|
102 | 103 | * @return array |
103 | 104 | */ |
104 | 105 | private function _getFieldsetsFormatted( array $aFieldsets, array $aSectionsets, $sCapability ) { |
@@ -278,6 +279,7 @@ discard block |
||
278 | 279 | * |
279 | 280 | * @since 3.0.0 |
280 | 281 | * @since 3.7.0 Moved from `AdminPageFramework_FormDefinition`. Changed the name from `formatField()`. |
282 | + * @param integer $iCountOfElements |
|
281 | 283 | * @return array|void An array of formatted field definition array. If required keys are not set, nothing will be returned. |
282 | 284 | */ |
283 | 285 | private function _getFieldsetFormatted( $aFieldset, $aSectionsets, $sCapability, $iCountOfElements, $iSubSectionIndex, $bIsSectionRepeatable, $oCallerObject ) { |
@@ -113,10 +113,10 @@ discard block |
||
113 | 113 | ); |
114 | 114 | |
115 | 115 | $_aNewFieldsets = array(); |
116 | - foreach( $aFieldsets as $_sSectionPath => $_aItems ) { |
|
116 | + foreach ( $aFieldsets as $_sSectionPath => $_aItems ) { |
|
117 | 117 | |
118 | 118 | // If the section is not set, skip. |
119 | - if ( ! isset( $aSectionsets[ $_sSectionPath ] ) ) { |
|
119 | + if ( !isset( $aSectionsets[ $_sSectionPath ] ) ) { |
|
120 | 120 | continue; |
121 | 121 | } |
122 | 122 | |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | $_aItems, |
126 | 126 | $this->getElement( // 3.6.0+ Get the section's capability |
127 | 127 | $aSectionsets, |
128 | - array( $_sSectionPath, 'capability', ), |
|
128 | + array( $_sSectionPath, 'capability',), |
|
129 | 129 | $sCapability |
130 | 130 | ), |
131 | 131 | $aSectionsets |
@@ -182,16 +182,16 @@ discard block |
||
182 | 182 | */ |
183 | 183 | private function _getNormalFieldsetsFormatted( $aItems, $sCapability, $aSectionsets, $_abSectionRepeatable ) { |
184 | 184 | |
185 | - $_aNewItems = array(); |
|
186 | - foreach( $aItems as $_sFieldID => $_aFieldset ) { |
|
185 | + $_aNewItems = array(); |
|
186 | + foreach ( $aItems as $_sFieldID => $_aFieldset ) { |
|
187 | 187 | |
188 | 188 | // Insert the formatted field definition array. The fields count is needed to set each order value. |
189 | - $_aFieldset = $this->_getFieldsetFormatted( |
|
189 | + $_aFieldset = $this->_getFieldsetFormatted( |
|
190 | 190 | $_aFieldset, |
191 | 191 | $aSectionsets, |
192 | 192 | $sCapability, |
193 | 193 | count( $_aNewItems ), // index of elements - zero based |
194 | - null, // sub-section index |
|
194 | + null, // sub-section index |
|
195 | 195 | $_abSectionRepeatable, |
196 | 196 | $this->oCallerForm |
197 | 197 | ); |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | * @return boolean |
211 | 211 | */ |
212 | 212 | private function _isSubSections( $aItems, $_abSectionRepeatable ) { |
213 | - if ( ! empty( $_abSectionRepeatable ) ) { |
|
213 | + if ( !empty( $_abSectionRepeatable ) ) { |
|
214 | 214 | return true; |
215 | 215 | } |
216 | 216 | return ( boolean ) count( $this->getIntegerKeyElements( $aItems ) ); |
@@ -221,9 +221,9 @@ discard block |
||
221 | 221 | private function _getSubSectionsFormatted( $aItems, $sCapability, $aSectionsets, $_abSectionRepeatable ) { |
222 | 222 | |
223 | 223 | $_aNewFieldset = array(); |
224 | - foreach( $this->numerizeElements( $aItems ) as $_iSubSectionIndex => $_aFieldsets ) { |
|
224 | + foreach ( $this->numerizeElements( $aItems ) as $_iSubSectionIndex => $_aFieldsets ) { |
|
225 | 225 | |
226 | - foreach( $_aFieldsets as $_aFieldset ) { |
|
226 | + foreach ( $_aFieldsets as $_aFieldset ) { |
|
227 | 227 | $_iCountElement = count( $this->getElementAsArray( $_aNewFieldset, $_iSubSectionIndex ) ); |
228 | 228 | $_aFieldset = $this->_getFieldsetFormatted( |
229 | 229 | $_aFieldset, |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | if ( empty( $_aFieldset ) ) { |
238 | 238 | continue; |
239 | 239 | } |
240 | - $_aNewFieldset[ $_iSubSectionIndex ][ $_aFieldset['field_id'] ] = $_aFieldset; |
|
240 | + $_aNewFieldset[ $_iSubSectionIndex ][ $_aFieldset[ 'field_id' ] ] = $_aFieldset; |
|
241 | 241 | } |
242 | 242 | uasort( $_aNewFieldset[ $_iSubSectionIndex ], array( $this, 'sortArrayByKey' ) ); |
243 | 243 | |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | } |
265 | 265 | |
266 | 266 | $_aSortedFields = array(); |
267 | - foreach( $aSectionsets as $_sSectionPath => $_aSecitonset ) { |
|
267 | + foreach ( $aSectionsets as $_sSectionPath => $_aSecitonset ) { |
|
268 | 268 | if ( isset( $aFieldsets[ $_sSectionPath ] ) ) { |
269 | 269 | $_aSortedFields[ $_sSectionPath ] = $aFieldsets[ $_sSectionPath ]; |
270 | 270 | } |
@@ -283,7 +283,7 @@ discard block |
||
283 | 283 | private function _getFieldsetFormatted( $aFieldset, $aSectionsets, $sCapability, $iCountOfElements, $iSubSectionIndex, $bIsSectionRepeatable, $oCallerObject ) { |
284 | 284 | |
285 | 285 | // 3.8.0+ Dropped the check for $aFieldset[ 'type' ] to allow it to be omitted. |
286 | - if ( ! isset( $aFieldset[ 'field_id' ] ) ) { |
|
286 | + if ( !isset( $aFieldset[ 'field_id' ] ) ) { |
|
287 | 287 | return; |
288 | 288 | } |
289 | 289 |