@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | /** |
65 | 65 | * Defines the field type slugs used for this field type. |
66 | 66 | */ |
67 | - public $aFieldTypeSlugs = array( 'size', ); |
|
67 | + public $aFieldTypeSlugs = array( 'size',); |
|
68 | 68 | |
69 | 69 | /** |
70 | 70 | * Defines the default key-values of this field type. |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | */ |
74 | 74 | protected $aDefaultKeys = array( |
75 | 75 | 'is_multiple' => false, // indicates whether the select tag alloes multiple selections. |
76 | - 'units' => null, // do not define units here since this will be merged with the user defined field array. |
|
76 | + 'units' => null, // do not define units here since this will be merged with the user defined field array. |
|
77 | 77 | 'attributes' => array( |
78 | 78 | 'size' => array( |
79 | 79 | 'min' => null, |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | */ |
102 | 102 | protected $aDefaultUnits = array( |
103 | 103 | 'px' => 'px', // pixel |
104 | - '%' => '%', // percentage |
|
104 | + '%' => '%', // percentage |
|
105 | 105 | 'em' => 'em', // font size |
106 | 106 | 'ex' => 'ex', // font height |
107 | 107 | 'in' => 'in', // inch |
@@ -161,8 +161,8 @@ discard block |
||
161 | 161 | ); |
162 | 162 | |
163 | 163 | $_aOutput = array(); |
164 | - foreach( ( array ) $aField[ 'label' ] as $_isKey => $_sLabel ) { |
|
165 | - $_aOutput[] = $this->_getFieldOutputByLabel( |
|
164 | + foreach ( ( array ) $aField[ 'label' ] as $_isKey => $_sLabel ) { |
|
165 | + $_aOutput[ ] = $this->_getFieldOutputByLabel( |
|
166 | 166 | $_isKey, |
167 | 167 | $_sLabel, |
168 | 168 | $aField |
@@ -185,8 +185,8 @@ discard block |
||
185 | 185 | |
186 | 186 | $_aBaseAttributes = $_bMultiLabels |
187 | 187 | ? array( |
188 | - 'name' => $aField[ 'attributes' ][ 'name' ] . "[{$isKey}]", |
|
189 | - 'id' => $aField[ 'attributes' ][ 'id' ] . "_{$isKey}", |
|
188 | + 'name' => $aField[ 'attributes' ][ 'name' ]."[{$isKey}]", |
|
189 | + 'id' => $aField[ 'attributes' ][ 'id' ]."_{$isKey}", |
|
190 | 190 | 'value' => $aField[ 'value' ], |
191 | 191 | ) |
192 | 192 | + $aField[ 'attributes' ] |
@@ -198,9 +198,9 @@ discard block |
||
198 | 198 | |
199 | 199 | $_aOutput = array( |
200 | 200 | $this->getElementByLabel( $aField[ 'before_label' ], $isKey, $aField[ 'label' ] ), |
201 | - "<div " . $this->getLabelContainerAttributes( $aField, 'admin-page-framework-input-label-container admin-page-framework-select-label' ) . ">", |
|
202 | - $this->_getNumberInputPart( $aField, $_aBaseAttributes, $isKey, is_array( $aField[ 'label' ] ) ), // The size (number) part |
|
203 | - $this->_getUnitSelectInput( $aField, $_aBaseAttributes, $isKey, is_array( $aField[ 'label' ] ) ), // The unit (select) part |
|
201 | + "<div ".$this->getLabelContainerAttributes( $aField, 'admin-page-framework-input-label-container admin-page-framework-select-label' ).">", |
|
202 | + $this->_getNumberInputPart( $aField, $_aBaseAttributes, $isKey, is_array( $aField[ 'label' ] ) ), // The size (number) part |
|
203 | + $this->_getUnitSelectInput( $aField, $_aBaseAttributes, $isKey, is_array( $aField[ 'label' ] ) ), // The unit (select) part |
|
204 | 204 | "</div>", |
205 | 205 | $this->getElementByLabel( $aField[ 'after_label' ], $isKey, $aField[ 'label' ] ) |
206 | 206 | ); |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | private function _getNumberInputPart( array $aField, array $aBaseAttributes, $isKey, $bMultiLabels ) { |
218 | 218 | |
219 | 219 | // Size and Size Label |
220 | - $_aSizeAttributes = $this->_getSizeAttributes( |
|
220 | + $_aSizeAttributes = $this->_getSizeAttributes( |
|
221 | 221 | $aField, |
222 | 222 | $aBaseAttributes, |
223 | 223 | $bMultiLabels |
@@ -225,32 +225,32 @@ discard block |
||
225 | 225 | : '' |
226 | 226 | ); |
227 | 227 | |
228 | - $_aSizeLabelAttributes = array( |
|
228 | + $_aSizeLabelAttributes = array( |
|
229 | 229 | 'for' => $_aSizeAttributes[ 'id' ], |
230 | 230 | 'class' => $_aSizeAttributes[ 'disabled' ] |
231 | 231 | ? 'disabled' |
232 | 232 | : null, |
233 | 233 | ); |
234 | 234 | |
235 | - $_sLabel = $this->getElementByLabel( |
|
235 | + $_sLabel = $this->getElementByLabel( |
|
236 | 236 | $aField[ 'label' ], |
237 | 237 | $isKey, |
238 | 238 | $aField[ 'label' ] |
239 | 239 | ); |
240 | - return "<label " . $this->getAttributes( $_aSizeLabelAttributes ) . ">" |
|
240 | + return "<label ".$this->getAttributes( $_aSizeLabelAttributes ).">" |
|
241 | 241 | . $this->getElement( |
242 | 242 | $aField, |
243 | 243 | $bMultiLabels |
244 | 244 | ? array( 'before_label', $isKey, 'size' ) |
245 | 245 | : array( 'before_label', 'size' ) |
246 | 246 | ) |
247 | - . ( $aField[ 'label' ] && ! $aField[ 'repeatable' ] |
|
248 | - ? "<span " . $this->getLabelContainerAttributes( $aField, 'admin-page-framework-input-label-string' ) . ">" |
|
247 | + . ( $aField[ 'label' ] && !$aField[ 'repeatable' ] |
|
248 | + ? "<span ".$this->getLabelContainerAttributes( $aField, 'admin-page-framework-input-label-string' ).">" |
|
249 | 249 | . $_sLabel |
250 | 250 | . "</span>" |
251 | 251 | : "" |
252 | 252 | ) |
253 | - . "<input " . $this->getAttributes( $_aSizeAttributes ) . " />" |
|
253 | + . "<input ".$this->getAttributes( $_aSizeAttributes )." />" |
|
254 | 254 | . $this->getElement( |
255 | 255 | $aField, |
256 | 256 | $bMultiLabels |
@@ -293,7 +293,7 @@ discard block |
||
293 | 293 | ) |
294 | 294 | : $aField[ 'units' ]; |
295 | 295 | |
296 | - return "<label " . $this->getAttributes( |
|
296 | + return "<label ".$this->getAttributes( |
|
297 | 297 | array( |
298 | 298 | 'for' => $_aUnitAttributes[ 'id' ], |
299 | 299 | 'class' => $_aUnitAttributes[ 'disabled' ] |
@@ -325,9 +325,9 @@ discard block |
||
325 | 325 | * @return array an unit attribute array |
326 | 326 | * @internal |
327 | 327 | */ |
328 | - private function _getUnitAttributes( array $aField, array $aBaseAttributes, $isLabelKey='' ) { |
|
328 | + private function _getUnitAttributes( array $aField, array $aBaseAttributes, $isLabelKey = '' ) { |
|
329 | 329 | |
330 | - $_bIsMultiple = $aField[ 'is_multiple' ] |
|
330 | + $_bIsMultiple = $aField[ 'is_multiple' ] |
|
331 | 331 | ? true |
332 | 332 | : $this->getElement( |
333 | 333 | $aField, |
@@ -339,13 +339,13 @@ discard block |
||
339 | 339 | |
340 | 340 | $_aSelectAttributes = array( |
341 | 341 | 'type' => 'select', |
342 | - 'id' => $aField[ 'input_id' ] . ( '' === $isLabelKey ? '' : '_' . $isLabelKey ) . '_' . 'unit', |
|
342 | + 'id' => $aField[ 'input_id' ].( '' === $isLabelKey ? '' : '_'.$isLabelKey ).'_'.'unit', |
|
343 | 343 | 'multiple' => $_bIsMultiple |
344 | 344 | ? 'multiple' |
345 | 345 | : null, |
346 | 346 | 'name' => $_bIsMultiple |
347 | - ? "{$aField['_input_name']}" . ( '' === $isLabelKey ? '' : '[' . $isLabelKey . ']' ) . "[unit][]" |
|
348 | - : "{$aField['_input_name']}" . ( '' === $isLabelKey ? '' : '[' . $isLabelKey . ']' ) . "[unit]", |
|
347 | + ? "{$aField[ '_input_name' ]}".( '' === $isLabelKey ? '' : '['.$isLabelKey.']' )."[unit][]" |
|
348 | + : "{$aField[ '_input_name' ]}".( '' === $isLabelKey ? '' : '['.$isLabelKey.']' )."[unit]", |
|
349 | 349 | 'value' => $this->getElement( |
350 | 350 | $aField, |
351 | 351 | array( 'value', 'unit' ), |
@@ -357,7 +357,7 @@ discard block |
||
357 | 357 | '' === $isLabelKey |
358 | 358 | ? array( 'attributes', 'unit' ) |
359 | 359 | : array( 'attributes', $isLabelKey, 'unit' ), |
360 | - $this->aDefaultKeys['attributes']['unit'] |
|
360 | + $this->aDefaultKeys[ 'attributes' ][ 'unit' ] |
|
361 | 361 | ) |
362 | 362 | + $aBaseAttributes; |
363 | 363 | return $_aSelectAttributes; |
@@ -371,15 +371,15 @@ discard block |
||
371 | 371 | * @return array an size attribute array |
372 | 372 | * @internal |
373 | 373 | */ |
374 | - private function _getSizeAttributes( array $aField, array $aBaseAttributes, $sLabelKey='' ) { |
|
374 | + private function _getSizeAttributes( array $aField, array $aBaseAttributes, $sLabelKey = '' ) { |
|
375 | 375 | |
376 | 376 | return array( |
377 | 377 | 'type' => 'number', |
378 | - 'id' => $aField['input_id'] . '_' . ( '' !== $sLabelKey ? $sLabelKey . '_' : '' ) . 'size', |
|
379 | - 'name' => $aField[ '_input_name' ] . ( '' !== $sLabelKey ? "[{$sLabelKey}]" : '' ) . '[size]', |
|
378 | + 'id' => $aField[ 'input_id' ].'_'.( '' !== $sLabelKey ? $sLabelKey.'_' : '' ).'size', |
|
379 | + 'name' => $aField[ '_input_name' ].( '' !== $sLabelKey ? "[{$sLabelKey}]" : '' ).'[size]', |
|
380 | 380 | 'value' => $this->getElement( |
381 | - $aField, // subject |
|
382 | - array( 'value', 'size' ), // dimensional keys |
|
381 | + $aField, // subject |
|
382 | + array( 'value', 'size' ), // dimensional keys |
|
383 | 383 | '' // default |
384 | 384 | ), |
385 | 385 | ) |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | /** |
58 | 58 | * Defines the field type slugs used for this field type. |
59 | 59 | */ |
60 | - public $aFieldTypeSlugs = array( 'media', ); |
|
60 | + public $aFieldTypeSlugs = array( 'media',); |
|
61 | 61 | |
62 | 62 | /** |
63 | 63 | * Defines the default key-values of this field type. |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | return array( |
91 | 91 | array( |
92 | 92 | 'handle_id' => 'admin-page-framework-field-type-media', |
93 | - 'src' => dirname( __FILE__ ) . '/js/media.bundle.js', |
|
93 | + 'src' => dirname( __FILE__ ).'/js/media.bundle.js', |
|
94 | 94 | 'in_footer' => true, |
95 | 95 | 'dependencies' => array( 'jquery', 'admin-page-framework-script-form-main' ), |
96 | 96 | 'translation_var' => 'AdminPageFrameworkMediaFieldType', |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | $bExternalSource, |
124 | 124 | $bRepeatable |
125 | 125 | ); |
126 | - return "<a " . $this->getAttributes( $_aAttributes ) . ">" |
|
126 | + return "<a ".$this->getAttributes( $_aAttributes ).">" |
|
127 | 127 | . $this->getAOrB( |
128 | 128 | $_bIsLabelSet, |
129 | 129 | $_aAttributes[ 'data-label' ], |
@@ -144,28 +144,28 @@ discard block |
||
144 | 144 | */ |
145 | 145 | private function ___getFormattedUploadButtonAttributes_Media( $sInputID, array $aButtonAttributes, $_bIsLabelSet, $bExternalSource, $bRepeatable ) { |
146 | 146 | |
147 | - $_aAttributes = array( |
|
147 | + $_aAttributes = array( |
|
148 | 148 | 'id' => "select_media_{$sInputID}", |
149 | 149 | 'href' => '#', |
150 | 150 | 'data-input_id' => $sInputID, |
151 | 151 | 'data-repeatable' => ( string ) ( boolean ) $bRepeatable, |
152 | - 'data-uploader_type' => ( string ) function_exists( 'wp_enqueue_media' ), // ? 1 : 0, |
|
153 | - 'data-enable_external_source' => ( string ) ( boolean ) $bExternalSource, // ? 1 : 0, |
|
152 | + 'data-uploader_type' => ( string ) function_exists( 'wp_enqueue_media' ), // ? 1 : 0, |
|
153 | + 'data-enable_external_source' => ( string ) ( boolean ) $bExternalSource, // ? 1 : 0, |
|
154 | 154 | ) |
155 | 155 | + $aButtonAttributes |
156 | 156 | + array( |
157 | 157 | 'title' => $_bIsLabelSet |
158 | - ? $aButtonAttributes['data-label'] |
|
158 | + ? $aButtonAttributes[ 'data-label' ] |
|
159 | 159 | : $this->oMsg->get( 'select_file' ), |
160 | 160 | 'data-label' => null, |
161 | 161 | ); |
162 | - $_aAttributes[ 'class' ] = $this->getClassAttribute( |
|
162 | + $_aAttributes[ 'class' ] = $this->getClassAttribute( |
|
163 | 163 | 'select_media button button-small ', |
164 | 164 | $this->getAOrB( |
165 | 165 | trim( $aButtonAttributes[ 'class' ] ), |
166 | 166 | $aButtonAttributes[ 'class' ], |
167 | 167 | $this->getAOrB( |
168 | - ! $_bIsLabelSet && version_compare( $GLOBALS['wp_version'], '3.8', '>=' ), |
|
168 | + !$_bIsLabelSet && version_compare( $GLOBALS[ 'wp_version' ], '3.8', '>=' ), |
|
169 | 169 | 'dashicons dashicons-portfolio', |
170 | 170 | '' |
171 | 171 | ) |
@@ -337,8 +337,8 @@ |
||
337 | 337 | ) + $_aAttributes |
338 | 338 | ); |
339 | 339 | return "<p class='submit-confirm-container'><label>" |
340 | - . $_sInput |
|
341 | - . "<span>{$_aConfirm[ 'label' ]}</span>" |
|
340 | + . $_sInput |
|
341 | + . "<span>{$_aConfirm[ 'label' ]}</span>" |
|
342 | 342 | . "</label></p>"; |
343 | 343 | } |
344 | 344 |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | /** |
126 | 126 | * Defines the field type slugs used for this field type. |
127 | 127 | */ |
128 | - public $aFieldTypeSlugs = array( 'submit', ); |
|
128 | + public $aFieldTypeSlugs = array( 'submit',); |
|
129 | 129 | |
130 | 130 | /** |
131 | 131 | * Defines the default key-values of this field type. |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | 'redirect_url' => null, |
137 | 137 | 'href' => null, |
138 | 138 | 'reset' => null, |
139 | - 'email' => null, // [3.3.0+] string of an email address to send to or it can be an array with the following keys. |
|
139 | + 'email' => null, // [3.3.0+] string of an email address to send to or it can be an array with the following keys. |
|
140 | 140 | /* |
141 | 141 | array( |
142 | 142 | 'to' => null, // string|array The email address to send to or an array representing the key structure of the submitted form data holding the value. The first key should be the section ID and the second key is the field ID. |
@@ -150,11 +150,11 @@ discard block |
||
150 | 150 | ) |
151 | 151 | */ |
152 | 152 | 'confirm' => '', |
153 | - 'skip_confirmation' => false, // 3.7.6+ For emails. |
|
153 | + 'skip_confirmation' => false, // 3.7.6+ For emails. |
|
154 | 154 | 'attributes' => array( |
155 | 155 | 'class' => 'button button-primary', |
156 | 156 | ), |
157 | - 'save' => false, // 3.9.0+ |
|
157 | + 'save' => false, // 3.9.0+ |
|
158 | 158 | ); |
159 | 159 | |
160 | 160 | /** |
@@ -165,9 +165,9 @@ discard block |
||
165 | 165 | return array( |
166 | 166 | array( |
167 | 167 | 'handle_id' => 'admin-page-framework-submit-field-type', |
168 | - 'src' => dirname( __FILE__ ) . '/js/submit.bundle.js', |
|
168 | + 'src' => dirname( __FILE__ ).'/js/submit.bundle.js', |
|
169 | 169 | 'in_footer' => true, |
170 | - 'dependencies' => array( 'jquery', ), |
|
170 | + 'dependencies' => array( 'jquery',), |
|
171 | 171 | ), |
172 | 172 | ); |
173 | 173 | } |
@@ -190,17 +190,17 @@ discard block |
||
190 | 190 | |
191 | 191 | return |
192 | 192 | $aField[ 'before_label' ] |
193 | - . "<div " . $this->getAttributes( $_aLabelContainerAttributes ) . ">" |
|
193 | + . "<div ".$this->getAttributes( $_aLabelContainerAttributes ).">" |
|
194 | 194 | . $this->_getExtraFieldsBeforeLabel( $aField ) // this is for the import field type that cannot place file input tag inside the label tag. |
195 | - . "<label " . $this->getAttributes( $_aLabelAttributes ) . ">" |
|
195 | + . "<label ".$this->getAttributes( $_aLabelAttributes ).">" |
|
196 | 196 | . $aField[ 'before_input' ] |
197 | 197 | . $this->_getExtraInputFields( $aField ) |
198 | - . "<input " . $this->getAttributes( $_aInputAttributes ) . " />" // this method is defined in the base class |
|
198 | + . "<input ".$this->getAttributes( $_aInputAttributes )." />" // this method is defined in the base class |
|
199 | 199 | . $aField[ 'after_input' ] |
200 | 200 | . "</label>" |
201 | 201 | . $this->___getConfirmationCheckbox( $aField ) |
202 | 202 | . "</div>" |
203 | - . $aField['after_label']; |
|
203 | + . $aField[ 'after_label' ]; |
|
204 | 204 | |
205 | 205 | } |
206 | 206 | /** |
@@ -212,12 +212,12 @@ discard block |
||
212 | 212 | if ( empty( $aField[ 'confirm' ] ) ) { |
213 | 213 | return ''; |
214 | 214 | } |
215 | - $_aConfirm = is_string( $aField[ 'confirm' ] ) |
|
215 | + $_aConfirm = is_string( $aField[ 'confirm' ] ) |
|
216 | 216 | ? array( |
217 | 217 | 'label' => $aField[ 'confirm' ] |
218 | 218 | ) |
219 | 219 | : $this->getAsArray( $aField[ 'confirm' ] ); |
220 | - $_aConfirm = $_aConfirm + array( |
|
220 | + $_aConfirm = $_aConfirm + array( |
|
221 | 221 | 'label' => $this->oMsg->get( 'submit_confirmation_label' ), |
222 | 222 | 'error' => $this->oMsg->get( 'submit_confirmation_error' ), |
223 | 223 | ); |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | private function ___getLabelAttributes( array $aField, array $aInputAttributes ) { |
269 | 269 | return array( |
270 | 270 | 'style' => $aField[ 'label_min_width' ] |
271 | - ? "min-width:" . $this->getLengthSanitized( $aField[ 'label_min_width' ] ) . ";" |
|
271 | + ? "min-width:".$this->getLengthSanitized( $aField[ 'label_min_width' ] ).";" |
|
272 | 272 | : null, |
273 | 273 | 'for' => $aInputAttributes[ 'id' ], |
274 | 274 | 'class' => $aInputAttributes[ 'disabled' ] |
@@ -287,7 +287,7 @@ discard block |
||
287 | 287 | private function ___getLabelContainerAttributes( array $aField ) { |
288 | 288 | return array( |
289 | 289 | 'style' => $aField[ 'label_min_width' ] || '0' === ( string ) $aField[ 'label_min_width' ] |
290 | - ? "min-width:" . $this->getLengthSanitized( $aField[ 'label_min_width' ] ) . ";" |
|
290 | + ? "min-width:".$this->getLengthSanitized( $aField[ 'label_min_width' ] ).";" |
|
291 | 291 | : null, |
292 | 292 | 'class' => 'admin-page-framework-input-label-container' |
293 | 293 | . ' admin-page-framework-input-button-container' |
@@ -342,7 +342,7 @@ discard block |
||
342 | 342 | protected function _getExtraInputFields( &$aField ) { |
343 | 343 | |
344 | 344 | $_aOutput = array(); |
345 | - $_aOutput[] = $this->getHTMLTag( |
|
345 | + $_aOutput[ ] = $this->getHTMLTag( |
|
346 | 346 | 'input', |
347 | 347 | array( |
348 | 348 | 'type' => 'hidden', |
@@ -350,7 +350,7 @@ discard block |
||
350 | 350 | 'value' => $aField[ 'input_id' ], |
351 | 351 | ) |
352 | 352 | ); |
353 | - $_aOutput[] = $this->getHTMLTag( |
|
353 | + $_aOutput[ ] = $this->getHTMLTag( |
|
354 | 354 | 'input', |
355 | 355 | array( |
356 | 356 | 'type' => 'hidden', |
@@ -358,7 +358,7 @@ discard block |
||
358 | 358 | 'value' => $aField[ 'field_id' ], |
359 | 359 | ) |
360 | 360 | ); |
361 | - $_aOutput[] = $this->getHTMLTag( |
|
361 | + $_aOutput[ ] = $this->getHTMLTag( |
|
362 | 362 | 'input', |
363 | 363 | array( |
364 | 364 | 'type' => 'hidden', |
@@ -366,11 +366,11 @@ discard block |
||
366 | 366 | 'value' => $aField[ '_input_name_flat' ], |
367 | 367 | ) |
368 | 368 | ); |
369 | - $_aOutput[] = $this->___getHiddenInput_SectionID( $aField ); |
|
370 | - $_aOutput[] = $this->___getHiddenInputByKey( $aField, 'redirect_url' ); |
|
371 | - $_aOutput[] = $this->___getHiddenInputByKey( $aField, 'href' ); |
|
372 | - $_aOutput[] = $this->___getHiddenInput_Reset( $aField ); |
|
373 | - $_aOutput[] = $this->_getHiddenInput_Email( $aField ); |
|
369 | + $_aOutput[ ] = $this->___getHiddenInput_SectionID( $aField ); |
|
370 | + $_aOutput[ ] = $this->___getHiddenInputByKey( $aField, 'redirect_url' ); |
|
371 | + $_aOutput[ ] = $this->___getHiddenInputByKey( $aField, 'href' ); |
|
372 | + $_aOutput[ ] = $this->___getHiddenInput_Reset( $aField ); |
|
373 | + $_aOutput[ ] = $this->_getHiddenInput_Email( $aField ); |
|
374 | 374 | return implode( PHP_EOL, array_filter( $_aOutput ) ); |
375 | 375 | |
376 | 376 | } |
@@ -387,9 +387,9 @@ discard block |
||
387 | 387 | 'input', |
388 | 388 | array( |
389 | 389 | 'type' => 'hidden', |
390 | - 'name' => "__submit[{$aField['input_id']}][section_id]", |
|
391 | - 'value' => isset( $aField['section_id'] ) && '_default' !== $aField['section_id'] |
|
392 | - ? $aField['section_id'] |
|
390 | + 'name' => "__submit[{$aField[ 'input_id' ]}][section_id]", |
|
391 | + 'value' => isset( $aField[ 'section_id' ] ) && '_default' !== $aField[ 'section_id' ] |
|
392 | + ? $aField[ 'section_id' ] |
|
393 | 393 | : '', |
394 | 394 | ) |
395 | 395 | ); |
@@ -409,7 +409,7 @@ discard block |
||
409 | 409 | 'input', |
410 | 410 | array( |
411 | 411 | 'type' => 'hidden', |
412 | - 'name' => "__submit[{$aField['input_id']}][{$sKey}]", |
|
412 | + 'name' => "__submit[{$aField[ 'input_id' ]}][{$sKey}]", |
|
413 | 413 | 'value' => $aField[ $sKey ], |
414 | 414 | ) |
415 | 415 | ) |
@@ -424,15 +424,15 @@ discard block |
||
424 | 424 | * @return string the HTML input tag output for the 'reset' argument. |
425 | 425 | */ |
426 | 426 | private function ___getHiddenInput_Reset( array $aField ) { |
427 | - if ( ! $aField[ 'reset' ] ) { |
|
427 | + if ( !$aField[ 'reset' ] ) { |
|
428 | 428 | return ''; |
429 | 429 | } |
430 | - return ! $this->_checkConfirmationDisplayed( $aField, $aField[ '_input_name_flat' ], 'reset' ) |
|
430 | + return !$this->_checkConfirmationDisplayed( $aField, $aField[ '_input_name_flat' ], 'reset' ) |
|
431 | 431 | ? $this->getHTMLTag( |
432 | 432 | 'input', |
433 | 433 | array( |
434 | 434 | 'type' => 'hidden', |
435 | - 'name' => "__submit[{$aField['input_id']}][is_reset]", |
|
435 | + 'name' => "__submit[{$aField[ 'input_id' ]}][is_reset]", |
|
436 | 436 | 'value' => '1', |
437 | 437 | ) |
438 | 438 | ) |
@@ -466,14 +466,14 @@ discard block |
||
466 | 466 | $this->showDeprecationNotice( 'The <code>email</code> argument has been deprecated.', 'the <code>contact</code> field type' ); |
467 | 467 | } |
468 | 468 | |
469 | - $_sTransientKey = 'apf_em_' . md5( $aField[ '_input_name_flat' ] . get_current_user_id() ); |
|
469 | + $_sTransientKey = 'apf_em_'.md5( $aField[ '_input_name_flat' ].get_current_user_id() ); |
|
470 | 470 | $this->setTransient( |
471 | 471 | $_sTransientKey, |
472 | 472 | array( |
473 | - 'nonce' => $this->getNonceCreated( 'apf_email_nonce_' . md5( ( string ) site_url() ), 86400 ), // @todo the nonce is crated when the page is rendered so change this to when the form is submitted so that a shorter nonce lifespan can be set. |
|
473 | + 'nonce' => $this->getNonceCreated( 'apf_email_nonce_'.md5( ( string ) site_url() ), 86400 ), // @todo the nonce is crated when the page is rendered so change this to when the form is submitted so that a shorter nonce lifespan can be set. |
|
474 | 474 | ) + $this->getAsArray( $aField[ 'email' ] ) |
475 | 475 | ); |
476 | - return ! $this->_checkConfirmationDisplayed( $aField, $aField[ '_input_name_flat' ], 'email' ) |
|
476 | + return !$this->_checkConfirmationDisplayed( $aField, $aField[ '_input_name_flat' ], 'email' ) |
|
477 | 477 | ? $this->getHTMLTag( |
478 | 478 | 'input', |
479 | 479 | array( |
@@ -501,18 +501,18 @@ discard block |
||
501 | 501 | * @return boolean |
502 | 502 | * @internal |
503 | 503 | */ |
504 | - protected function _checkConfirmationDisplayed( $aField, $sFlatFieldName, $sType='reset' ) { |
|
504 | + protected function _checkConfirmationDisplayed( $aField, $sFlatFieldName, $sType = 'reset' ) { |
|
505 | 505 | |
506 | - switch( $sType ) { |
|
506 | + switch ( $sType ) { |
|
507 | 507 | default: |
508 | 508 | case 'reset': // admin page framework _ reset confirmation |
509 | - $_sTransientKey = 'apf_rc_' . md5( $sFlatFieldName . get_current_user_id() ); |
|
509 | + $_sTransientKey = 'apf_rc_'.md5( $sFlatFieldName.get_current_user_id() ); |
|
510 | 510 | break; |
511 | 511 | case 'email': // admin page framework _ email confirmation |
512 | - $_sTransientKey = 'apf_ec_' . md5( $sFlatFieldName . get_current_user_id() ); |
|
512 | + $_sTransientKey = 'apf_ec_'.md5( $sFlatFieldName.get_current_user_id() ); |
|
513 | 513 | break; |
514 | 514 | } |
515 | - $_bConfirmed = ! ( false === $this->getTransient( $_sTransientKey ) && ! $aField['skip_confirmation'] ); |
|
515 | + $_bConfirmed = !( false === $this->getTransient( $_sTransientKey ) && !$aField[ 'skip_confirmation' ] ); |
|
516 | 516 | if ( $_bConfirmed ) { |
517 | 517 | $this->deleteTransient( $_sTransientKey ); |
518 | 518 | } |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | * @return array The label container attribute array. |
285 | 285 | * @internal |
286 | 286 | */ |
287 | - private function ___getLabelContainerAttributes( array $aField ) { |
|
287 | + private function ___getLabelContainerAttributes( array $aField ) { |
|
288 | 288 | return array( |
289 | 289 | 'style' => $aField[ 'label_min_width' ] || '0' === ( string ) $aField[ 'label_min_width' ] |
290 | 290 | ? "min-width:" . $this->getLengthSanitized( $aField[ 'label_min_width' ] ) . ";" |
@@ -537,19 +537,19 @@ discard block |
||
537 | 537 | * @internal |
538 | 538 | * @param array $aField |
539 | 539 | */ |
540 | - protected function _getInputFieldValueFromLabel( $aField ) { |
|
540 | + protected function _getInputFieldValueFromLabel( $aField ) { |
|
541 | 541 | |
542 | 542 | // If the value key is explicitly set, use it. But the empty string will be ignored. |
543 | - if ( isset( $aField[ 'value' ] ) && $aField[ 'value' ] != '' ) { |
|
543 | + if ( isset( $aField[ 'value' ] ) && $aField[ 'value' ] != '' ) { |
|
544 | 544 | return $aField[ 'value' ]; |
545 | 545 | } |
546 | 546 | |
547 | - if ( isset( $aField[ 'label' ] ) ) { |
|
547 | + if ( isset( $aField[ 'label' ] ) ) { |
|
548 | 548 | return $aField[ 'label' ]; |
549 | 549 | } |
550 | 550 | |
551 | 551 | // If the default value is set, |
552 | - if ( isset( $aField[ 'default' ] ) ) { |
|
552 | + if ( isset( $aField[ 'default' ] ) ) { |
|
553 | 553 | return $aField[ 'default' ]; |
554 | 554 | } |
555 | 555 |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | /** |
39 | 39 | * Defines the field type slugs used for this field type. |
40 | 40 | */ |
41 | - public $aFieldTypeSlugs = array( 'text', 'password', 'date', 'datetime', 'datetime-local', 'email', 'month', 'search', 'tel', 'url', 'week', ); |
|
41 | + public $aFieldTypeSlugs = array( 'text', 'password', 'date', 'datetime', 'datetime-local', 'email', 'month', 'search', 'tel', 'url', 'week',); |
|
42 | 42 | |
43 | 43 | /** |
44 | 44 | * Defines the default key-values of this field type. |
@@ -57,15 +57,15 @@ discard block |
||
57 | 57 | */ |
58 | 58 | protected function getField( $aField ) { |
59 | 59 | $_aOutput = array(); |
60 | - foreach( ( array ) $aField[ 'label' ] as $_sKey => $_sLabel ) { |
|
61 | - $_aOutput[] = $this->___getFieldOutputByLabel( |
|
60 | + foreach ( ( array ) $aField[ 'label' ] as $_sKey => $_sLabel ) { |
|
61 | + $_aOutput[ ] = $this->___getFieldOutputByLabel( |
|
62 | 62 | $_sKey, |
63 | 63 | $_sLabel, |
64 | 64 | $aField |
65 | 65 | ); |
66 | 66 | } |
67 | 67 | // the repeatable field buttons will be replaced with this element. |
68 | - $_aOutput[] = "<div class='repeatable-field-buttons'></div>"; |
|
68 | + $_aOutput[ ] = "<div class='repeatable-field-buttons'></div>"; |
|
69 | 69 | return implode( '', $_aOutput ); |
70 | 70 | } |
71 | 71 | /** |
@@ -81,8 +81,8 @@ discard block |
||
81 | 81 | $aField[ 'value' ] = $this->getElementByLabel( $aField[ 'value' ], $sKey, $aField[ 'label' ] ); |
82 | 82 | $_aInputAttributes = $_bIsArray |
83 | 83 | ? array( |
84 | - 'name' => $aField[ 'attributes' ][ 'name' ] . "[{$sKey}]", |
|
85 | - 'id' => $aField[ 'attributes' ][ 'id' ] . "_{$sKey}", |
|
84 | + 'name' => $aField[ 'attributes' ][ 'name' ]."[{$sKey}]", |
|
85 | + 'id' => $aField[ 'attributes' ][ 'id' ]."_{$sKey}", |
|
86 | 86 | 'value' => $aField[ 'value' ], |
87 | 87 | ) |
88 | 88 | + $this->getAsArray( |
@@ -90,17 +90,17 @@ discard block |
||
90 | 90 | ) // 3.8.6+ Allows the user to set individual attributes by label. |
91 | 91 | + $aField[ 'attributes' ] |
92 | 92 | : $aField[ 'attributes' ]; |
93 | - $_aOutput = array( |
|
93 | + $_aOutput = array( |
|
94 | 94 | $this->getElementByLabel( $aField[ 'before_label' ], $sKey, $aField[ 'label' ] ), |
95 | 95 | "<div class='admin-page-framework-input-label-container {$_sClassSelector}'>", |
96 | - "<label for='" . $_aInputAttributes[ 'id' ] . "'>", |
|
96 | + "<label for='".$_aInputAttributes[ 'id' ]."'>", |
|
97 | 97 | $this->getElementByLabel( $aField[ 'before_input' ], $sKey, $aField[ 'label' ] ), |
98 | 98 | $_sLabel |
99 | - ? "<span " . $this->getLabelContainerAttributes( $aField, 'admin-page-framework-input-label-string' ) . ">" |
|
99 | + ? "<span ".$this->getLabelContainerAttributes( $aField, 'admin-page-framework-input-label-string' ).">" |
|
100 | 100 | . $_sLabel |
101 | 101 | . "</span>" |
102 | 102 | : '', |
103 | - "<input " . $this->getAttributes( $_aInputAttributes ) . " />", |
|
103 | + "<input ".$this->getAttributes( $_aInputAttributes )." />", |
|
104 | 104 | $this->getElementByLabel( $aField[ 'after_input' ], $sKey, $aField[ 'label' ] ), |
105 | 105 | "</label>", |
106 | 106 | "</div>", |
@@ -219,7 +219,7 @@ |
||
219 | 219 | * </code> |
220 | 220 | * @access public This must be public as accessed from outside. |
221 | 221 | */ |
222 | - public $aFieldTypeSlugs = array( 'default', ); |
|
222 | + public $aFieldTypeSlugs = array( 'default',); |
|
223 | 223 | |
224 | 224 | /** |
225 | 225 | * Defines the default key-values of this field type. |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | 'after_label' => null, |
60 | 60 | 'before_field' => null, |
61 | 61 | 'after_field' => null, |
62 | - 'label_min_width' => '', // (string|integer) min-width applied to the input label in pixels. 3.8.0+ Changed the default value from 140 to 0 as it is now applied via embedded CSS. When this value is set by the user, it is set inline and the value will be overridden. [3.8.4+] Changed the value from `0` to `''`. |
|
62 | + 'label_min_width' => '', // (string|integer) min-width applied to the input label in pixels. 3.8.0+ Changed the default value from 140 to 0 as it is now applied via embedded CSS. When this value is set by the user, it is set inline and the value will be overridden. [3.8.4+] Changed the value from `0` to `''`. |
|
63 | 63 | 'before_fieldset' => null, // 3.1.1+ |
64 | 64 | 'after_fieldset' => null, // 3.1.1+ |
65 | 65 | |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | * @param object $oMsg The framework message object. |
100 | 100 | * @param boolean $bAutoRegister Whether or not to register the field type(s). |
101 | 101 | */ |
102 | - public function __construct( $asClassName='admin_page_framework', $asFieldTypeSlug=null, $oMsg=null, $bAutoRegister=true ) { |
|
102 | + public function __construct( $asClassName = 'admin_page_framework', $asFieldTypeSlug = null, $oMsg = null, $bAutoRegister = true ) { |
|
103 | 103 | |
104 | 104 | $this->aFieldTypeSlugs = empty( $asFieldTypeSlug ) |
105 | 105 | ? $this->aFieldTypeSlugs |
@@ -110,9 +110,9 @@ discard block |
||
110 | 110 | |
111 | 111 | // This automatically registers the field type. The build-in ones will be registered manually so it will be skipped. |
112 | 112 | if ( $bAutoRegister ) { |
113 | - foreach( ( array ) $asClassName as $_sClassName ) { |
|
113 | + foreach ( ( array ) $asClassName as $_sClassName ) { |
|
114 | 114 | add_filter( |
115 | - 'field_types_' . $_sClassName, |
|
115 | + 'field_types_'.$_sClassName, |
|
116 | 116 | array( $this, '_replyToRegisterInputFieldType' ) |
117 | 117 | ); |
118 | 118 | } |
@@ -161,8 +161,8 @@ discard block |
||
161 | 161 | } |
162 | 162 | return is_array( $asLabel ) // if the user sets multiple items |
163 | 163 | ? $this->getElement( |
164 | - $asElement, // subject |
|
165 | - $this->getAsArray( $asKey, true /* preserve empty */ ), // dimensional path |
|
164 | + $asElement, // subject |
|
165 | + $this->getAsArray( $asKey, true /* preserve empty */ ), // dimensional path |
|
166 | 166 | '' // default - if the element is not found, return an empty |
167 | 167 | ) |
168 | 168 | : $asElement; |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | */ |
179 | 179 | protected function getFieldOutput( array $aFieldset ) { |
180 | 180 | |
181 | - if ( ! is_object( $aFieldset[ '_caller_object' ] ) ) { |
|
181 | + if ( !is_object( $aFieldset[ '_caller_object' ] ) ) { |
|
182 | 182 | return ''; |
183 | 183 | } |
184 | 184 | |
@@ -186,14 +186,14 @@ discard block |
||
186 | 186 | $aFieldset[ '_parent_field_object' ] = $aFieldset[ '_field_object' ]; // 3.6.0+ |
187 | 187 | |
188 | 188 | // 3.7.0+ The caller object is no longer a factory object but a form object. |
189 | - $_oCallerForm = $aFieldset[ '_caller_object' ]; |
|
189 | + $_oCallerForm = $aFieldset[ '_caller_object' ]; |
|
190 | 190 | |
191 | 191 | $_oFieldset = new AdminPageFramework_Form_View___Fieldset( |
192 | - $aFieldset, // the field definition array |
|
193 | - $_oCallerForm->aSavedData, // the stored form data |
|
194 | - $_oCallerForm->getFieldErrors(), // the field error array. |
|
195 | - $_oCallerForm->aFieldTypeDefinitions, // the field type definition array. |
|
196 | - $_oCallerForm->oMsg, // the system message object |
|
192 | + $aFieldset, // the field definition array |
|
193 | + $_oCallerForm->aSavedData, // the stored form data |
|
194 | + $_oCallerForm->getFieldErrors(), // the field error array. |
|
195 | + $_oCallerForm->aFieldTypeDefinitions, // the field type definition array. |
|
196 | + $_oCallerForm->oMsg, // the system message object |
|
197 | 197 | $_oCallerForm->aCallbacks // field output element callables. |
198 | 198 | ); |
199 | 199 | return $_oFieldset->get(); |
@@ -237,13 +237,13 @@ discard block |
||
237 | 237 | * @return array |
238 | 238 | * @internal |
239 | 239 | */ |
240 | - public function getDefinitionArray( $sFieldTypeSlug='' ) { |
|
240 | + public function getDefinitionArray( $sFieldTypeSlug = '' ) { |
|
241 | 241 | |
242 | 242 | // The uniteArrays() method resulted in somewhat being slow due to overhead on checking array keys for recursive array merges. |
243 | 243 | $_aDefaultKeys = $this->aDefaultKeys + self::$_aDefaultKeys; |
244 | - $_aDefaultKeys['attributes'] = isset( $this->aDefaultKeys['attributes'] ) && is_array( $this->aDefaultKeys['attributes'] ) |
|
245 | - ? $this->aDefaultKeys['attributes'] + self::$_aDefaultKeys['attributes'] |
|
246 | - : self::$_aDefaultKeys['attributes']; |
|
244 | + $_aDefaultKeys[ 'attributes' ] = isset( $this->aDefaultKeys[ 'attributes' ] ) && is_array( $this->aDefaultKeys[ 'attributes' ] ) |
|
245 | + ? $this->aDefaultKeys[ 'attributes' ] + self::$_aDefaultKeys[ 'attributes' ] |
|
246 | + : self::$_aDefaultKeys[ 'attributes' ]; |
|
247 | 247 | |
248 | 248 | return array( |
249 | 249 | 'sFieldTypeSlug' => $sFieldTypeSlug, |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | * @param string $sFieldSetType |
290 | 290 | * @internal |
291 | 291 | */ |
292 | - public function _replyToFieldTypeSetter( $sFieldSetType='' ) { |
|
292 | + public function _replyToFieldTypeSetter( $sFieldSetType = '' ) { |
|
293 | 293 | $this->_sFieldSetType = $sFieldSetType; |
294 | 294 | } |
295 | 295 | |
@@ -344,8 +344,8 @@ discard block |
||
344 | 344 | wp_enqueue_script( 'media-upload' ); |
345 | 345 | } |
346 | 346 | |
347 | - if ( in_array( $this->getPageNow(), array( 'media-upload.php', 'async-upload.php', ) ) ) { |
|
348 | - add_filter( 'gettext', array( $this, '_replyToReplaceThickBoxText' ) , 1, 2 ); |
|
347 | + if ( in_array( $this->getPageNow(), array( 'media-upload.php', 'async-upload.php',) ) ) { |
|
348 | + add_filter( 'gettext', array( $this, '_replyToReplaceThickBoxText' ), 1, 2 ); |
|
349 | 349 | } |
350 | 350 | |
351 | 351 | } |
@@ -363,7 +363,7 @@ discard block |
||
363 | 363 | public function _replyToReplaceThickBoxText( $sTranslated, $sText ) { |
364 | 364 | |
365 | 365 | // Replace the button label in the media thick box. |
366 | - if ( ! in_array( $this->getPageNow(), array( 'media-upload.php', 'async-upload.php' ) ) ) { |
|
366 | + if ( !in_array( $this->getPageNow(), array( 'media-upload.php', 'async-upload.php' ) ) ) { |
|
367 | 367 | return $sTranslated; |
368 | 368 | } |
369 | 369 | if ( $sText !== 'Insert into Post' ) { |
@@ -396,10 +396,10 @@ discard block |
||
396 | 396 | */ |
397 | 397 | public function _replyToRemovingMediaLibraryTab( $aTabs ) { |
398 | 398 | |
399 | - if ( ! isset( $_REQUEST[ 'enable_external_source' ] ) ) { // sanitization unnecessary |
|
399 | + if ( !isset( $_REQUEST[ 'enable_external_source' ] ) ) { // sanitization unnecessary |
|
400 | 400 | return $aTabs; |
401 | 401 | } |
402 | - if ( ! ( boolean ) $_REQUEST[ 'enable_external_source' ] ) { // sanitization unnecessary |
|
402 | + if ( !( boolean ) $_REQUEST[ 'enable_external_source' ] ) { // sanitization unnecessary |
|
403 | 403 | unset( $aTabs[ 'type_url' ] ); // removes the 'From URL' tab in the thick box. |
404 | 404 | } |
405 | 405 | return $aTabs; |
@@ -417,7 +417,7 @@ discard block |
||
417 | 417 | * @return string |
418 | 418 | * @since 3.8.0 |
419 | 419 | */ |
420 | - protected function getLabelContainerAttributes( $aField, $asClassAttributes, array $aAttributes=array() ) { |
|
420 | + protected function getLabelContainerAttributes( $aField, $asClassAttributes, array $aAttributes = array() ) { |
|
421 | 421 | |
422 | 422 | $aAttributes[ 'class' ] = $this->getClassAttribute( $asClassAttributes, $this->getElement( $aAttributes, 'class' ) ); |
423 | 423 | $aAttributes[ 'style' ] = $this->getStyleAttribute( |
@@ -344,7 +344,7 @@ discard block |
||
344 | 344 | wp_enqueue_script( 'media-upload' ); |
345 | 345 | } |
346 | 346 | |
347 | - if ( in_array( $this->getPageNow(), array( 'media-upload.php', 'async-upload.php', ) ) ) { |
|
347 | + if ( in_array( $this->getPageNow(), array( 'media-upload.php', 'async-upload.php', ) ) ) { |
|
348 | 348 | add_filter( 'gettext', array( $this, '_replyToReplaceThickBoxText' ) , 1, 2 ); |
349 | 349 | } |
350 | 350 | |
@@ -374,17 +374,18 @@ discard block |
||
374 | 374 | public function _replyToReplaceThickBoxText( $sTranslated, $sText ) { |
375 | 375 | |
376 | 376 | // Replace the button label in the media thick box. |
377 | - if ( ! in_array( $this->getPageNow(), array( 'media-upload.php', 'async-upload.php' ) ) ) { |
|
377 | + if ( ! in_array( $this->getPageNow(), array( 'media-upload.php', 'async-upload.php' ) ) ) { |
|
378 | 378 | return $sTranslated; |
379 | 379 | } |
380 | - if ( $sText !== 'Insert into Post' ) { |
|
380 | + if ( $sText !== 'Insert into Post' ) { |
|
381 | 381 | return $sTranslated; |
382 | 382 | } |
383 | - if ( $this->getQueryValueInURLByKey( wp_get_referer(), 'referrer' ) !== 'admin_page_framework' ) { |
|
383 | + if ( $this->getQueryValueInURLByKey( wp_get_referer(), 'referrer' ) !== 'admin_page_framework' ) { |
|
384 | 384 | return $sTranslated; |
385 | 385 | } |
386 | 386 | |
387 | - if ( isset( $_GET[ 'button_label' ] ) ) { // sanitization unnecessary |
|
387 | + if ( isset( $_GET[ 'button_label' ] ) ) { |
|
388 | +// sanitization unnecessary |
|
388 | 389 | return $this->getHTTPQueryGET( 'button_label', '' ); |
389 | 390 | } |
390 | 391 | |
@@ -407,10 +408,12 @@ discard block |
||
407 | 408 | */ |
408 | 409 | public function _replyToRemovingMediaLibraryTab( $aTabs ) { |
409 | 410 | |
410 | - if ( ! isset( $_REQUEST[ 'enable_external_source' ] ) ) { // sanitization unnecessary |
|
411 | + if ( ! isset( $_REQUEST[ 'enable_external_source' ] ) ) { |
|
412 | +// sanitization unnecessary |
|
411 | 413 | return $aTabs; |
412 | 414 | } |
413 | - if ( ! ( boolean ) $_REQUEST[ 'enable_external_source' ] ) { // sanitization unnecessary |
|
415 | + if ( ! ( boolean ) $_REQUEST[ 'enable_external_source' ] ) { |
|
416 | +// sanitization unnecessary |
|
414 | 417 | unset( $aTabs[ 'type_url' ] ); // removes the 'From URL' tab in the thick box. |
415 | 418 | } |
416 | 419 | return $aTabs; |
@@ -62,16 +62,16 @@ discard block |
||
62 | 62 | * - 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. |
63 | 63 | * @param integer $iCurrentObjectID |
64 | 64 | */ |
65 | - function start_el( &$sOutput, $oTerm, $iDepth=0, $aArgs=array(), $iCurrentObjectID=0 ) { |
|
65 | + function start_el( &$sOutput, $oTerm, $iDepth = 0, $aArgs = array(), $iCurrentObjectID = 0 ) { |
|
66 | 66 | |
67 | 67 | $aArgs = $aArgs + array( |
68 | 68 | '_name_prefix' => null, |
69 | 69 | '_input_id_prefix' => null, |
70 | 70 | '_attributes' => array(), |
71 | 71 | '_selected_items' => array(), |
72 | - 'taxonomy' => null, // parsed by the core function to perform the database query. |
|
73 | - 'disabled' => null, // not sure what this was for |
|
74 | - '_save_unchecked' => true, // 3.8.8+ |
|
72 | + 'taxonomy' => null, // parsed by the core function to perform the database query. |
|
73 | + 'disabled' => null, // not sure what this was for |
|
74 | + '_save_unchecked' => true, // 3.8.8+ |
|
75 | 75 | ); |
76 | 76 | |
77 | 77 | // Local variables |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | |
84 | 84 | // Post count |
85 | 85 | $_sPostCount = $aArgs[ 'show_post_count' ] |
86 | - ? " <span class='font-lighter'>(" . $oTerm->count . ")</span>" |
|
86 | + ? " <span class='font-lighter'>(".$oTerm->count.")</span>" |
|
87 | 87 | : ''; |
88 | 88 | |
89 | 89 | // Attributes |
@@ -102,7 +102,7 @@ discard block |
||
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}", |
@@ -111,15 +111,15 @@ discard block |
||
111 | 111 | ); |
112 | 112 | |
113 | 113 | $_sHiddenInputForUnchecked = $aArgs[ '_save_unchecked' ] |
114 | - ? "<input value='0' type='hidden' name='" . $_aInputAttributes[ 'name' ] . "' class='apf_checkbox' />" |
|
114 | + ? "<input value='0' type='hidden' name='".$_aInputAttributes[ 'name' ]."' class='apf_checkbox' />" |
|
115 | 115 | : ''; |
116 | 116 | |
117 | 117 | // Output - the variable is by reference so the modification takes effect |
118 | 118 | $sOutput .= "\n" |
119 | - . "<li " . AdminPageFramework_WPUtility::getAttributes( $_aLiTagAttributes ) . ">" |
|
119 | + . "<li ".AdminPageFramework_WPUtility::getAttributes( $_aLiTagAttributes ).">" |
|
120 | 120 | . "<label for='{$_sID}' class='taxonomy-checklist-label'>" |
121 | 121 | . $_sHiddenInputForUnchecked // 3.8.8+ |
122 | - . "<input " . AdminPageFramework_WPUtility::getAttributes( $_aInputAttributes ) . " />" |
|
122 | + . "<input ".AdminPageFramework_WPUtility::getAttributes( $_aInputAttributes )." />" |
|
123 | 123 | . esc_html( apply_filters( 'the_category', $oTerm->name ) ) |
124 | 124 | . $_sPostCount |
125 | 125 | . "</label>"; |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | /** |
59 | 59 | * Defines the field type slugs used for this field type. |
60 | 60 | */ |
61 | - public $aFieldTypeSlugs = array( 'image', ); |
|
61 | + public $aFieldTypeSlugs = array( 'image',); |
|
62 | 62 | |
63 | 63 | /** |
64 | 64 | * Defines the default key-values of this field type. |
@@ -67,8 +67,8 @@ discard block |
||
67 | 67 | */ |
68 | 68 | protected $aDefaultKeys = array( |
69 | 69 | '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' ). |
70 | - 'show_preview' => true, // ( boolean ) Indicates whether the image preview should be displayed or not. |
|
71 | - 'allow_external_source' => true, // ( boolean ) Indicates whether the media library box has the From URL tab. |
|
70 | + 'show_preview' => true, // ( boolean ) Indicates whether the image preview should be displayed or not. |
|
71 | + 'allow_external_source' => true, // ( boolean ) Indicates whether the media library box has the From URL tab. |
|
72 | 72 | 'attributes' => array( |
73 | 73 | 'input' => array( |
74 | 74 | 'size' => 40, |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | return array( |
99 | 99 | array( |
100 | 100 | 'handle_id' => 'admin-page-framework-field-type-image', |
101 | - 'src' => dirname( __FILE__ ) . '/js/image.bundle.js', |
|
101 | + 'src' => dirname( __FILE__ ).'/js/image.bundle.js', |
|
102 | 102 | 'in_footer' => true, |
103 | 103 | 'dependencies' => array( 'jquery', 'admin-page-framework-script-form-main' ), |
104 | 104 | 'translation_var' => 'AdminPageFrameworkImageFieldType', |
@@ -144,14 +144,14 @@ discard block |
||
144 | 144 | . "<label for='{$aField[ 'input_id' ]}'>" |
145 | 145 | . $aField[ 'before_input' ] |
146 | 146 | . $this->getAOrB( |
147 | - $aField[ 'label' ] && ! $aField[ 'repeatable' ], |
|
148 | - "<span " . $this->getLabelContainerAttributes( $aField, 'admin-page-framework-input-label-string' ) . ">" |
|
147 | + $aField[ 'label' ] && !$aField[ 'repeatable' ], |
|
148 | + "<span ".$this->getLabelContainerAttributes( $aField, 'admin-page-framework-input-label-string' ).">" |
|
149 | 149 | . $aField[ 'label' ] |
150 | 150 | . "</span>", |
151 | 151 | '' |
152 | 152 | ) |
153 | - . "<input " . $this->getAttributes( $this->___getImageInputAttributes( $aField, $_iCountAttributes, $_sImageURL, $_aBaseAttributes ) ) . " />" |
|
154 | - . $this->_getUploaderButtonHTML( $aField[ 'input_id' ], $_aUploadButtonAttributes, ! empty( $aField[ 'repeatable' ] ), $aField[ 'allow_external_source' ] ) |
|
153 | + . "<input ".$this->getAttributes( $this->___getImageInputAttributes( $aField, $_iCountAttributes, $_sImageURL, $_aBaseAttributes ) )." />" |
|
154 | + . $this->_getUploaderButtonHTML( $aField[ 'input_id' ], $_aUploadButtonAttributes, !empty( $aField[ 'repeatable' ] ), $aField[ 'allow_external_source' ] ) |
|
155 | 155 | . $this->_getRemoveButtonHTMLByType( $aField[ 'input_id' ], $_aRemoveButtonAttributes, strtolower( $this->getFirstElement( $this->aFieldTypeSlugs ) ) ) |
156 | 156 | . $aField[ 'after_input' ] |
157 | 157 | . "<div class='repeatable-field-buttons'></div>" // the repeatable field buttons will be replaced with this element. |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | */ |
177 | 177 | private function ___getBaseAttributes( array $aField ) { |
178 | 178 | |
179 | - $_aBaseAttributes = $aField[ 'attributes' ] + array( 'class' => null ); |
|
179 | + $_aBaseAttributes = $aField[ 'attributes' ] + array( 'class' => null ); |
|
180 | 180 | unset( |
181 | 181 | $_aBaseAttributes[ 'input' ], |
182 | 182 | $_aBaseAttributes[ 'button' ], |
@@ -245,8 +245,8 @@ discard block |
||
245 | 245 | protected function getExtraInputFields( array $aField ) { |
246 | 246 | |
247 | 247 | $_aOutputs = array(); |
248 | - foreach( $this->getElementAsArray( $aField, 'attributes_to_store' ) as $sAttribute ) { |
|
249 | - $_aOutputs[] = "<input " . $this->getAttributes( |
|
248 | + foreach ( $this->getElementAsArray( $aField, 'attributes_to_store' ) as $sAttribute ) { |
|
249 | + $_aOutputs[ ] = "<input ".$this->getAttributes( |
|
250 | 250 | array( |
251 | 251 | 'id' => "{$aField[ 'input_id' ]}_{$sAttribute}", |
252 | 252 | 'type' => 'hidden', |
@@ -262,7 +262,7 @@ discard block |
||
262 | 262 | '' |
263 | 263 | ), |
264 | 264 | ) |
265 | - ) . "/>"; |
|
265 | + )."/>"; |
|
266 | 266 | } |
267 | 267 | return implode( PHP_EOL, $_aOutputs ); |
268 | 268 | |
@@ -275,17 +275,17 @@ discard block |
||
275 | 275 | */ |
276 | 276 | protected function _getPreviewContainer( $aField, $sImageURL, $aPreviewAtrributes ) { |
277 | 277 | |
278 | - if ( ! $aField[ 'show_preview' ] ) { |
|
278 | + if ( !$aField[ 'show_preview' ] ) { |
|
279 | 279 | return ''; |
280 | 280 | } |
281 | 281 | |
282 | 282 | $sImageURL = esc_url( $this->getResolvedSRC( $sImageURL, true ) ); |
283 | 283 | return |
284 | - "<div " . $this->getAttributes( |
|
284 | + "<div ".$this->getAttributes( |
|
285 | 285 | array( |
286 | 286 | 'id' => "image_preview_container_{$aField[ 'input_id' ]}", |
287 | - 'class' => 'image_preview ' . $this->getElement( $aPreviewAtrributes, 'class', '' ), |
|
288 | - 'style' => $this->getAOrB( $sImageURL, '', "display: none; " ) |
|
287 | + 'class' => 'image_preview '.$this->getElement( $aPreviewAtrributes, 'class', '' ), |
|
288 | + 'style' => $this->getAOrB( $sImageURL, '', "display: none; " ) |
|
289 | 289 | . $this->getElement( $aPreviewAtrributes, 'style', '' ), |
290 | 290 | ) + $aPreviewAtrributes |
291 | 291 | ) |
@@ -309,12 +309,12 @@ discard block |
||
309 | 309 | */ |
310 | 310 | protected function _getUploaderButtonScript( $sInputID, $abRepeatable, $bExternalSource, array $aButtonAttributes ) { |
311 | 311 | |
312 | - $_bRepeatable = ! empty( $abRepeatable ); |
|
312 | + $_bRepeatable = !empty( $abRepeatable ); |
|
313 | 313 | |
314 | 314 | // Do not include the escaping character (backslash) in the heredoc variable declaration |
315 | 315 | // because the minifier script will parse it and the <<<JAVASCRIPTS and JAVASCRIPTS; parts are converted to double quotes (") |
316 | 316 | // which causes the PHP syntax error. |
317 | - $_sButtonHTML = '"' . $this->_getUploaderButtonHTML( $sInputID, $aButtonAttributes, $_bRepeatable, $bExternalSource ) . '"'; |
|
317 | + $_sButtonHTML = '"'.$this->_getUploaderButtonHTML( $sInputID, $aButtonAttributes, $_bRepeatable, $bExternalSource ).'"'; |
|
318 | 318 | $_sRepeatable = $this->getAOrB( $_bRepeatable, 'true', 'false' ); |
319 | 319 | $_bExternalSource = $this->getAOrB( $bExternalSource, 'true', 'false' ); |
320 | 320 | $_sScript = <<<JAVASCRIPTS |
@@ -330,7 +330,7 @@ discard block |
||
330 | 330 | . '/* <![CDATA[ */' |
331 | 331 | . $_sScript |
332 | 332 | . '/* ]]> */' |
333 | - . "</script>". PHP_EOL; |
|
333 | + . "</script>".PHP_EOL; |
|
334 | 334 | |
335 | 335 | } |
336 | 336 | /** |
@@ -349,7 +349,7 @@ discard block |
||
349 | 349 | $bRepeatable, |
350 | 350 | $bExternalSource |
351 | 351 | ); |
352 | - return "<a " . $this->getAttributes( $_aAttributes ) . ">" |
|
352 | + return "<a ".$this->getAttributes( $_aAttributes ).">" |
|
353 | 353 | . ( $_bIsLabelSet |
354 | 354 | ? $_aAttributes[ 'data-label' ] |
355 | 355 | : ( strrpos( $_aAttributes[ 'class' ], 'dashicons' ) |
@@ -367,7 +367,7 @@ discard block |
||
367 | 367 | * @return array The formatted upload button attributes array. |
368 | 368 | */ |
369 | 369 | protected function _getFormattedUploadButtonAttributes( $sInputID, array $aButtonAttributes, $_bIsLabelSet, $bRepeatable, $bExternalSource ) { |
370 | - $_aAttributes = array( |
|
370 | + $_aAttributes = array( |
|
371 | 371 | 'id' => "select_image_{$sInputID}", |
372 | 372 | 'href' => '#', |
373 | 373 | 'data-input_id' => $sInputID, |
@@ -382,7 +382,7 @@ discard block |
||
382 | 382 | : $this->oMsg->get( 'select_image' ), |
383 | 383 | 'data-label' => null, |
384 | 384 | ); |
385 | - $_aAttributes[ 'class' ] = $this->getClassAttribute( |
|
385 | + $_aAttributes[ 'class' ] = $this->getClassAttribute( |
|
386 | 386 | 'select_image button button-small ', |
387 | 387 | $this->getAOrB( |
388 | 388 | trim( $aButtonAttributes[ 'class' ] ), |
@@ -410,16 +410,16 @@ discard block |
||
410 | 410 | * @internal |
411 | 411 | * @deprecatead 3.9.0 Currently, not used but Kept for backward compatibility. |
412 | 412 | */ |
413 | - protected function _getRemoveButtonScript( $sInputID, array $aButtonAttributes, $sType='image' ) { |
|
413 | + protected function _getRemoveButtonScript( $sInputID, array $aButtonAttributes, $sType = 'image' ) { |
|
414 | 414 | |
415 | - if ( ! function_exists( 'wp_enqueue_media' ) ) { |
|
415 | + if ( !function_exists( 'wp_enqueue_media' ) ) { |
|
416 | 416 | return ''; |
417 | 417 | } |
418 | 418 | |
419 | 419 | // Do not include the escaping character (backslash) in the heredoc variable declaration |
420 | 420 | // because the minifier script will parse it and the <<<JAVASCRIPTS and JAVASCRIPTS; parts are converted to double quotes (") |
421 | 421 | // which causes the PHP syntax error. |
422 | - $_sButtonHTML = '"' . $this->_getRemoveButtonHTMLByType( $sInputID, $aButtonAttributes, $sType ) . '"'; |
|
422 | + $_sButtonHTML = '"'.$this->_getRemoveButtonHTMLByType( $sInputID, $aButtonAttributes, $sType ).'"'; |
|
423 | 423 | $_sScript = <<<JAVASCRIPTS |
424 | 424 | if ( 0 === jQuery( 'a#remove_{$sType}_{$sInputID}' ).length ) { |
425 | 425 | jQuery( 'input#{$sInputID}' ).after( $_sButtonHTML ); |
@@ -430,7 +430,7 @@ discard block |
||
430 | 430 | . '/* <![CDATA[ */' |
431 | 431 | . $_sScript |
432 | 432 | . '/* ]]> */' |
433 | - . "</script>". PHP_EOL; |
|
433 | + . "</script>".PHP_EOL; |
|
434 | 434 | |
435 | 435 | } |
436 | 436 | |
@@ -440,11 +440,11 @@ discard block |
||
440 | 440 | * @return string The generated HTML remove button output. |
441 | 441 | * @internal |
442 | 442 | */ |
443 | - protected function _getRemoveButtonHTMLByType( $sInputID, array $aButtonAttributes, $sType='image' ) { |
|
443 | + protected function _getRemoveButtonHTMLByType( $sInputID, array $aButtonAttributes, $sType = 'image' ) { |
|
444 | 444 | |
445 | 445 | $_bIsLabelSet = isset( $aButtonAttributes[ 'data-label' ] ) && $aButtonAttributes[ 'data-label' ]; |
446 | 446 | $_aAttributes = $this->_getFormattedRemoveButtonAttributesByType( $sInputID, $aButtonAttributes, $_bIsLabelSet, $sType ); |
447 | - return "<a " . $this->getAttributes( $_aAttributes ) . ">" |
|
447 | + return "<a ".$this->getAttributes( $_aAttributes ).">" |
|
448 | 448 | . ( $_bIsLabelSet |
449 | 449 | ? $_aAttributes[ 'data-label' ] |
450 | 450 | : $this->getAOrB( |
@@ -463,10 +463,10 @@ discard block |
||
463 | 463 | * @return array The formatted remove button attributes array. |
464 | 464 | * @internal |
465 | 465 | */ |
466 | - protected function _getFormattedRemoveButtonAttributesByType( $sInputID, array $aButtonAttributes, $_bIsLabelSet, $sType='image' ) { |
|
466 | + protected function _getFormattedRemoveButtonAttributesByType( $sInputID, array $aButtonAttributes, $_bIsLabelSet, $sType = 'image' ) { |
|
467 | 467 | |
468 | 468 | // $_sOnClickFunctionName = 'removeInputValuesFor' . ucfirst( $sType ); |
469 | - $_aAttributes = array( |
|
469 | + $_aAttributes = array( |
|
470 | 470 | 'id' => "remove_{$sType}_{$sInputID}", |
471 | 471 | 'href' => '#', |
472 | 472 | 'data-input_id' => $sInputID, |
@@ -480,7 +480,7 @@ discard block |
||
480 | 480 | ? $aButtonAttributes[ 'data-label' ] |
481 | 481 | : $this->oMsg->get( 'remove_value' ), |
482 | 482 | ); |
483 | - $_aAttributes[ 'class' ] = $this->getClassAttribute( |
|
483 | + $_aAttributes[ 'class' ] = $this->getClassAttribute( |
|
484 | 484 | "remove_value remove_{$sType} button button-small", |
485 | 485 | $this->getAOrB( |
486 | 486 | trim( $aButtonAttributes[ 'class' ] ), |
@@ -66,7 +66,7 @@ |
||
66 | 66 | . ( $aField[ 'label' ] |
67 | 67 | ? "<span " . $this->getLabelContainerAttributes( $aField, 'admin-page-framework-input-label-string' ) . ">" |
68 | 68 | . $aField[ 'label' ] |
69 | - . "</span>" |
|
69 | + . "</span>" |
|
70 | 70 | : "" |
71 | 71 | ) |
72 | 72 | . "<input " . $this->getAttributes( $aField[ 'attributes' ] ) . " />" |
@@ -65,12 +65,12 @@ |
||
65 | 65 | . "<label for='{$aField[ 'input_id' ]}'>" |
66 | 66 | . $aField[ 'before_input' ] |
67 | 67 | . ( $aField[ 'label' ] |
68 | - ? "<span " . $this->getLabelContainerAttributes( $aField, 'admin-page-framework-input-label-string' ) . ">" |
|
68 | + ? "<span ".$this->getLabelContainerAttributes( $aField, 'admin-page-framework-input-label-string' ).">" |
|
69 | 69 | . $aField[ 'label' ] |
70 | 70 | . "</span>" |
71 | 71 | : "" |
72 | 72 | ) |
73 | - . "<input " . $this->getAttributes( $aField[ 'attributes' ] ) . " />" |
|
73 | + . "<input ".$this->getAttributes( $aField[ 'attributes' ] )." />" |
|
74 | 74 | . $aField[ 'after_input' ] |
75 | 75 | . "</label>" |
76 | 76 | . "</div>" |