@@ -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 | } |
@@ -158,8 +158,8 @@ discard block |
||
158 | 158 | } |
159 | 159 | return is_array( $asLabel ) // if the user stes multiple items |
160 | 160 | ? $this->getElement( |
161 | - $asElement, // subject |
|
162 | - $this->getAsArray( $asKey, true /* preserve empty */ ), // dimensional path |
|
161 | + $asElement, // subject |
|
162 | + $this->getAsArray( $asKey, true /* preserve empty */ ), // dimensional path |
|
163 | 163 | '' // default - if the element is not found, return an empty |
164 | 164 | ) |
165 | 165 | : $asElement; |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | */ |
175 | 175 | protected function geFieldOutput( array $aFieldset ) { |
176 | 176 | |
177 | - if ( ! is_object( $aFieldset[ '_caller_object' ] ) ) { |
|
177 | + if ( !is_object( $aFieldset[ '_caller_object' ] ) ) { |
|
178 | 178 | return ''; |
179 | 179 | } |
180 | 180 | |
@@ -182,14 +182,14 @@ discard block |
||
182 | 182 | $aFieldset[ '_parent_field_object' ] = $aFieldset[ '_field_object' ]; // 3.6.0+ |
183 | 183 | |
184 | 184 | // 3.7.0+ The caller object is no longer a factory object but a form object. |
185 | - $_oCallerForm = $aFieldset[ '_caller_object' ]; |
|
185 | + $_oCallerForm = $aFieldset[ '_caller_object' ]; |
|
186 | 186 | |
187 | 187 | $_oFieldset = new AdminPageFramework_Form_View___Fieldset( |
188 | - $aFieldset, // the field definition array |
|
189 | - $_oCallerForm->aSavedData, // the stored form data |
|
190 | - $_oCallerForm->getFieldErrors(), // the field error array. |
|
191 | - $_oCallerForm->aFieldTypeDefinitions, // the field type definition array. |
|
192 | - $_oCallerForm->oMsg, // the system message object |
|
188 | + $aFieldset, // the field definition array |
|
189 | + $_oCallerForm->aSavedData, // the stored form data |
|
190 | + $_oCallerForm->getFieldErrors(), // the field error array. |
|
191 | + $_oCallerForm->aFieldTypeDefinitions, // the field type definition array. |
|
192 | + $_oCallerForm->oMsg, // the system message object |
|
193 | 193 | $_oCallerForm->aCallbacks // field output element callables. |
194 | 194 | ); |
195 | 195 | return $_oFieldset->get(); |
@@ -223,13 +223,13 @@ discard block |
||
223 | 223 | * @since 3.0.3 Tweaked it to have better execution speed. |
224 | 224 | * @internal |
225 | 225 | */ |
226 | - public function getDefinitionArray( $sFieldTypeSlug='' ) { |
|
226 | + public function getDefinitionArray( $sFieldTypeSlug = '' ) { |
|
227 | 227 | |
228 | 228 | // The uniteArrays() method resulted in somewhat being slow due to overhead on checking array keys for recursive array merges. |
229 | 229 | $_aDefaultKeys = $this->aDefaultKeys + self::$_aDefaultKeys; |
230 | - $_aDefaultKeys['attributes'] = isset( $this->aDefaultKeys['attributes'] ) && is_array( $this->aDefaultKeys['attributes'] ) |
|
231 | - ? $this->aDefaultKeys['attributes'] + self::$_aDefaultKeys['attributes'] |
|
232 | - : self::$_aDefaultKeys['attributes']; |
|
230 | + $_aDefaultKeys[ 'attributes' ] = isset( $this->aDefaultKeys[ 'attributes' ] ) && is_array( $this->aDefaultKeys[ 'attributes' ] ) |
|
231 | + ? $this->aDefaultKeys[ 'attributes' ] + self::$_aDefaultKeys[ 'attributes' ] |
|
232 | + : self::$_aDefaultKeys[ 'attributes' ]; |
|
233 | 233 | |
234 | 234 | return array( |
235 | 235 | 'sFieldTypeSlug' => $sFieldTypeSlug, |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | * @since 3.0.0 |
268 | 268 | * @internal |
269 | 269 | */ |
270 | - public function _replyToFieldTypeSetter( $sFieldSetType='' ) { |
|
270 | + public function _replyToFieldTypeSetter( $sFieldSetType = '' ) { |
|
271 | 271 | $this->_sFieldSetType = $sFieldSetType; |
272 | 272 | } |
273 | 273 | |
@@ -321,8 +321,8 @@ discard block |
||
321 | 321 | wp_enqueue_script( 'media-upload' ); |
322 | 322 | } |
323 | 323 | |
324 | - if ( in_array( $this->getPageNow(), array( 'media-upload.php', 'async-upload.php', ) ) ) { |
|
325 | - add_filter( 'gettext', array( $this, '_replyToReplaceThickBoxText' ) , 1, 2 ); |
|
324 | + if ( in_array( $this->getPageNow(), array( 'media-upload.php', 'async-upload.php',) ) ) { |
|
325 | + add_filter( 'gettext', array( $this, '_replyToReplaceThickBoxText' ), 1, 2 ); |
|
326 | 326 | } |
327 | 327 | |
328 | 328 | } |
@@ -337,7 +337,7 @@ discard block |
||
337 | 337 | public function _replyToReplaceThickBoxText( $sTranslated, $sText ) { |
338 | 338 | |
339 | 339 | // Replace the button label in the media thick box. |
340 | - if ( ! in_array( $this->getPageNow(), array( 'media-upload.php', 'async-upload.php' ) ) ) { |
|
340 | + if ( !in_array( $this->getPageNow(), array( 'media-upload.php', 'async-upload.php' ) ) ) { |
|
341 | 341 | return $sTranslated; |
342 | 342 | } |
343 | 343 | if ( $sText !== 'Insert into Post' ) { |
@@ -347,8 +347,8 @@ discard block |
||
347 | 347 | return $sTranslated; |
348 | 348 | } |
349 | 349 | |
350 | - if ( isset( $_GET['button_label'] ) ) { |
|
351 | - return $_GET['button_label']; |
|
350 | + if ( isset( $_GET[ 'button_label' ] ) ) { |
|
351 | + return $_GET[ 'button_label' ]; |
|
352 | 352 | } |
353 | 353 | |
354 | 354 | return $this->oProp->sThickBoxButtonUseThis |
@@ -367,12 +367,12 @@ discard block |
||
367 | 367 | */ |
368 | 368 | public function _replyToRemovingMediaLibraryTab( $aTabs ) { |
369 | 369 | |
370 | - if ( ! isset( $_REQUEST['enable_external_source'] ) ) { |
|
370 | + if ( !isset( $_REQUEST[ 'enable_external_source' ] ) ) { |
|
371 | 371 | return $aTabs; |
372 | 372 | } |
373 | 373 | |
374 | - if ( ! $_REQUEST['enable_external_source'] ) { |
|
375 | - unset( $aTabs['type_url'] ); // removes the 'From URL' tab in the thick box. |
|
374 | + if ( !$_REQUEST[ 'enable_external_source' ] ) { |
|
375 | + unset( $aTabs[ 'type_url' ] ); // removes the 'From URL' tab in the thick box. |
|
376 | 376 | } |
377 | 377 | return $aTabs; |
378 | 378 |
@@ -315,14 +315,14 @@ discard block |
||
315 | 315 | wp_enqueue_script( 'thickbox' ); |
316 | 316 | wp_enqueue_style( 'thickbox' ); |
317 | 317 | |
318 | - if ( function_exists( 'wp_enqueue_media' ) ) { |
|
318 | + if ( function_exists( 'wp_enqueue_media' ) ) { |
|
319 | 319 | // If the WordPress version is 3.5 or above, |
320 | 320 | new AdminPageFramework_Form_View___Script_MediaUploader( $this->oMsg ); |
321 | 321 | } else { |
322 | 322 | wp_enqueue_script( 'media-upload' ); |
323 | 323 | } |
324 | 324 | |
325 | - if ( in_array( $this->getPageNow(), array( 'media-upload.php', 'async-upload.php', ) ) ) { |
|
325 | + if ( in_array( $this->getPageNow(), array( 'media-upload.php', 'async-upload.php', ) ) ) { |
|
326 | 326 | add_filter( 'gettext', array( $this, '_replyToReplaceThickBoxText' ) , 1, 2 ); |
327 | 327 | } |
328 | 328 | |
@@ -338,17 +338,17 @@ discard block |
||
338 | 338 | public function _replyToReplaceThickBoxText( $sTranslated, $sText ) { |
339 | 339 | |
340 | 340 | // Replace the button label in the media thick box. |
341 | - if ( ! in_array( $this->getPageNow(), array( 'media-upload.php', 'async-upload.php' ) ) ) { |
|
341 | + if ( ! in_array( $this->getPageNow(), array( 'media-upload.php', 'async-upload.php' ) ) ) { |
|
342 | 342 | return $sTranslated; |
343 | 343 | } |
344 | - if ( $sText !== 'Insert into Post' ) { |
|
344 | + if ( $sText !== 'Insert into Post' ) { |
|
345 | 345 | return $sTranslated; |
346 | 346 | } |
347 | - if ( $this->getQueryValueInURLByKey( wp_get_referer(), 'referrer' ) !== 'admin_page_framework' ) { |
|
347 | + if ( $this->getQueryValueInURLByKey( wp_get_referer(), 'referrer' ) !== 'admin_page_framework' ) { |
|
348 | 348 | return $sTranslated; |
349 | 349 | } |
350 | 350 | |
351 | - if ( isset( $_GET['button_label'] ) ) { |
|
351 | + if ( isset( $_GET['button_label'] ) ) { |
|
352 | 352 | return $_GET['button_label']; |
353 | 353 | } |
354 | 354 | |
@@ -368,7 +368,7 @@ discard block |
||
368 | 368 | */ |
369 | 369 | public function _replyToRemovingMediaLibraryTab( $aTabs ) { |
370 | 370 | |
371 | - if ( ! isset( $_REQUEST['enable_external_source'] ) ) { |
|
371 | + if ( ! isset( $_REQUEST['enable_external_source'] ) ) { |
|
372 | 372 | return $aTabs; |
373 | 373 | } |
374 | 374 |
@@ -1,11 +1,11 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Admin Page Framework |
|
4 | - * |
|
5 | - * http://en.michaeluno.jp/admin-page-framework/ |
|
6 | - * Copyright (c) 2013-2016 Michael Uno; Licensed MIT |
|
7 | - * |
|
8 | - */ |
|
3 | + * Admin Page Framework |
|
4 | + * |
|
5 | + * http://en.michaeluno.jp/admin-page-framework/ |
|
6 | + * Copyright (c) 2013-2016 Michael Uno; Licensed MIT |
|
7 | + * |
|
8 | + */ |
|
9 | 9 | |
10 | 10 | /** |
11 | 11 | * Provides utility methods which can be accessed among different components of the framework. |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | /** |
22 | 22 | * Defines the field type slugs used for this field type. |
23 | 23 | */ |
24 | - public $aFieldTypeSlugs = array( 'submit', ); |
|
24 | + public $aFieldTypeSlugs = array( 'submit',); |
|
25 | 25 | |
26 | 26 | /** |
27 | 27 | * Defines the default key-values of this field type. |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | 'redirect_url' => null, |
33 | 33 | 'href' => null, |
34 | 34 | 'reset' => null, |
35 | - 'email' => null, // [3.3.0+] string of an email address to send to or it can be an array with the following keys. |
|
35 | + 'email' => null, // [3.3.0+] string of an email address to send to or it can be an array with the following keys. |
|
36 | 36 | /* |
37 | 37 | array( |
38 | 38 | '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 the field ID. |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | 'attachments' => null, // string|array The file path(s) 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 the field ID. |
43 | 43 | ) |
44 | 44 | */ |
45 | - 'skip_confirmation' => false, // 3.7.6+ For emails. |
|
45 | + 'skip_confirmation' => false, // 3.7.6+ For emails. |
|
46 | 46 | 'attributes' => array( |
47 | 47 | 'class' => 'button button-primary', |
48 | 48 | ), |
@@ -78,16 +78,16 @@ discard block |
||
78 | 78 | |
79 | 79 | return |
80 | 80 | $aField[ 'before_label' ] |
81 | - . "<div " . $this->getAttributes( $_aLabelContainerAttributes ) . ">" |
|
81 | + . "<div ".$this->getAttributes( $_aLabelContainerAttributes ).">" |
|
82 | 82 | . $this->_getExtraFieldsBeforeLabel( $aField ) // this is for the import field type that cannot place file input tag inside the label tag. |
83 | - . "<label " . $this->getAttributes( $_aLabelAttributes ) . ">" |
|
83 | + . "<label ".$this->getAttributes( $_aLabelAttributes ).">" |
|
84 | 84 | . $aField[ 'before_input' ] |
85 | 85 | . $this->_getExtraInputFields( $aField ) |
86 | - . "<input " . $this->getAttributes( $_aInputAttributes ) . " />" // this method is defined in the base class |
|
86 | + . "<input ".$this->getAttributes( $_aInputAttributes )." />" // this method is defined in the base class |
|
87 | 87 | . $aField[ 'after_input' ] |
88 | 88 | . "</label>" |
89 | 89 | . "</div>" |
90 | - . $aField['after_label']; |
|
90 | + . $aField[ 'after_label' ]; |
|
91 | 91 | |
92 | 92 | } |
93 | 93 | /** |
@@ -114,11 +114,11 @@ discard block |
||
114 | 114 | */ |
115 | 115 | private function _getLabelAttributes( array $aField, array $aInputAttributes ) { |
116 | 116 | return array( |
117 | - 'style' => $aField['label_min_width'] |
|
118 | - ? "min-width:" . $this->sanitizeLength( $aField['label_min_width'] ) . ";" |
|
117 | + 'style' => $aField[ 'label_min_width' ] |
|
118 | + ? "min-width:".$this->sanitizeLength( $aField[ 'label_min_width' ] ).";" |
|
119 | 119 | : null, |
120 | - 'for' => $aInputAttributes['id'], |
|
121 | - 'class' => $aInputAttributes['disabled'] |
|
120 | + 'for' => $aInputAttributes[ 'id' ], |
|
121 | + 'class' => $aInputAttributes[ 'disabled' ] |
|
122 | 122 | ? 'disabled' |
123 | 123 | : null, |
124 | 124 | ); |
@@ -130,8 +130,8 @@ discard block |
||
130 | 130 | */ |
131 | 131 | private function _getLabelContainerAttributes( array $aField ) { |
132 | 132 | return array( |
133 | - 'style' => $aField['label_min_width'] |
|
134 | - ? "min-width:" . $this->sanitizeLength( $aField['label_min_width'] ) . ";" |
|
133 | + 'style' => $aField[ 'label_min_width' ] |
|
134 | + ? "min-width:".$this->sanitizeLength( $aField[ 'label_min_width' ] ).";" |
|
135 | 135 | : null, |
136 | 136 | 'class' => 'admin-page-framework-input-label-container' |
137 | 137 | . ' admin-page-framework-input-button-container' |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | protected function _getExtraInputFields( &$aField ) { |
177 | 177 | |
178 | 178 | $_aOutput = array(); |
179 | - $_aOutput[] = $this->getHTMLTag( |
|
179 | + $_aOutput[ ] = $this->getHTMLTag( |
|
180 | 180 | 'input', |
181 | 181 | array( |
182 | 182 | 'type' => 'hidden', |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | 'value' => $aField[ 'input_id' ], |
185 | 185 | ) |
186 | 186 | ); |
187 | - $_aOutput[] = $this->getHTMLTag( |
|
187 | + $_aOutput[ ] = $this->getHTMLTag( |
|
188 | 188 | 'input', |
189 | 189 | array( |
190 | 190 | 'type' => 'hidden', |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | 'value' => $aField[ 'field_id' ], |
193 | 193 | ) |
194 | 194 | ); |
195 | - $_aOutput[] = $this->getHTMLTag( |
|
195 | + $_aOutput[ ] = $this->getHTMLTag( |
|
196 | 196 | 'input', |
197 | 197 | array( |
198 | 198 | 'type' => 'hidden', |
@@ -200,11 +200,11 @@ discard block |
||
200 | 200 | 'value' => $aField[ '_input_name_flat' ], |
201 | 201 | ) |
202 | 202 | ); |
203 | - $_aOutput[] = $this->_getHiddenInput_SectionID( $aField ); |
|
204 | - $_aOutput[] = $this->_getHiddenInputByKey( $aField, 'redirect_url' ); |
|
205 | - $_aOutput[] = $this->_getHiddenInputByKey( $aField, 'href' ); |
|
206 | - $_aOutput[] = $this->_getHiddenInput_Reset( $aField ); |
|
207 | - $_aOutput[] = $this->_getHiddenInput_Email( $aField ); |
|
203 | + $_aOutput[ ] = $this->_getHiddenInput_SectionID( $aField ); |
|
204 | + $_aOutput[ ] = $this->_getHiddenInputByKey( $aField, 'redirect_url' ); |
|
205 | + $_aOutput[ ] = $this->_getHiddenInputByKey( $aField, 'href' ); |
|
206 | + $_aOutput[ ] = $this->_getHiddenInput_Reset( $aField ); |
|
207 | + $_aOutput[ ] = $this->_getHiddenInput_Email( $aField ); |
|
208 | 208 | return implode( PHP_EOL, array_filter( $_aOutput ) ); |
209 | 209 | |
210 | 210 | } |
@@ -220,9 +220,9 @@ discard block |
||
220 | 220 | 'input', |
221 | 221 | array( |
222 | 222 | 'type' => 'hidden', |
223 | - 'name' => "__submit[{$aField['input_id']}][section_id]", |
|
224 | - 'value' => isset( $aField['section_id'] ) && '_default' !== $aField['section_id'] |
|
225 | - ? $aField['section_id'] |
|
223 | + 'name' => "__submit[{$aField[ 'input_id' ]}][section_id]", |
|
224 | + 'value' => isset( $aField[ 'section_id' ] ) && '_default' !== $aField[ 'section_id' ] |
|
225 | + ? $aField[ 'section_id' ] |
|
226 | 226 | : '', |
227 | 227 | ) |
228 | 228 | ); |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | 'input', |
241 | 241 | array( |
242 | 242 | 'type' => 'hidden', |
243 | - 'name' => "__submit[{$aField['input_id']}][{$sKey}]", |
|
243 | + 'name' => "__submit[{$aField[ 'input_id' ]}][{$sKey}]", |
|
244 | 244 | 'value' => $aField[ $sKey ], |
245 | 245 | ) |
246 | 246 | ) |
@@ -254,15 +254,15 @@ discard block |
||
254 | 254 | * @return string the HTML input tag output for the 'reset' argument. |
255 | 255 | */ |
256 | 256 | private function _getHiddenInput_Reset( array $aField ) { |
257 | - if ( ! $aField['reset'] ) { |
|
257 | + if ( !$aField[ 'reset' ] ) { |
|
258 | 258 | return ''; |
259 | 259 | } |
260 | - return ! $this->_checkConfirmationDisplayed( $aField, $aField[ '_input_name_flat' ], 'reset' ) |
|
260 | + return !$this->_checkConfirmationDisplayed( $aField, $aField[ '_input_name_flat' ], 'reset' ) |
|
261 | 261 | ? $this->getHTMLTag( |
262 | 262 | 'input', |
263 | 263 | array( |
264 | 264 | 'type' => 'hidden', |
265 | - 'name' => "__submit[{$aField['input_id']}][is_reset]", |
|
265 | + 'name' => "__submit[{$aField[ 'input_id' ]}][is_reset]", |
|
266 | 266 | 'value' => '1', |
267 | 267 | ) |
268 | 268 | ) |
@@ -270,10 +270,10 @@ discard block |
||
270 | 270 | 'input', |
271 | 271 | array( |
272 | 272 | 'type' => 'hidden', |
273 | - 'name' => "__submit[{$aField['input_id']}][reset_key]", |
|
274 | - 'value' => is_array( $aField['reset'] ) // set the option array key to delete. |
|
275 | - ? implode( '|', $aField['reset'] ) |
|
276 | - : $aField['reset'], |
|
273 | + 'name' => "__submit[{$aField[ 'input_id' ]}][reset_key]", |
|
274 | + 'value' => is_array( $aField[ 'reset' ] ) // set the option array key to delete. |
|
275 | + ? implode( '|', $aField[ 'reset' ] ) |
|
276 | + : $aField[ 'reset' ], |
|
277 | 277 | ) |
278 | 278 | ); |
279 | 279 | } |
@@ -290,10 +290,10 @@ discard block |
||
290 | 290 | return ''; |
291 | 291 | } |
292 | 292 | $this->setTransient( |
293 | - 'apf_em_' . md5( $aField[ '_input_name_flat' ] . get_current_user_id() ), |
|
293 | + 'apf_em_'.md5( $aField[ '_input_name_flat' ].get_current_user_id() ), |
|
294 | 294 | $aField[ 'email' ] |
295 | 295 | ); |
296 | - return ! $this->_checkConfirmationDisplayed( $aField, $aField[ '_input_name_flat' ], 'email' ) |
|
296 | + return !$this->_checkConfirmationDisplayed( $aField, $aField[ '_input_name_flat' ], 'email' ) |
|
297 | 297 | ? $this->getHTMLTag( |
298 | 298 | 'input', |
299 | 299 | array( |
@@ -316,19 +316,19 @@ discard block |
||
316 | 316 | * A helper function for the above getSubmitField() that checks if a reset confirmation message has been displayed or not when the 'reset' key is set. |
317 | 317 | * |
318 | 318 | */ |
319 | - private function _checkConfirmationDisplayed( $aField, $sFlatFieldName, $sType='reset' ) { |
|
319 | + private function _checkConfirmationDisplayed( $aField, $sFlatFieldName, $sType = 'reset' ) { |
|
320 | 320 | |
321 | - switch( $sType ) { |
|
321 | + switch ( $sType ) { |
|
322 | 322 | default: |
323 | 323 | case 'reset': // admin page framework _ reset confirmation |
324 | - $_sTransientKey = 'apf_rc_' . md5( $sFlatFieldName . get_current_user_id() ); |
|
324 | + $_sTransientKey = 'apf_rc_'.md5( $sFlatFieldName.get_current_user_id() ); |
|
325 | 325 | break; |
326 | 326 | case 'email': // admin page framework _ email confirmation |
327 | - $_sTransientKey = 'apf_ec_' . md5( $sFlatFieldName . get_current_user_id() ); |
|
327 | + $_sTransientKey = 'apf_ec_'.md5( $sFlatFieldName.get_current_user_id() ); |
|
328 | 328 | break; |
329 | 329 | } |
330 | 330 | |
331 | - $_bConfirmed = false === $this->getTransient( $_sTransientKey ) && ! $aField[ 'skip_confirmation' ] |
|
331 | + $_bConfirmed = false === $this->getTransient( $_sTransientKey ) && !$aField[ 'skip_confirmation' ] |
|
332 | 332 | ? false |
333 | 333 | : true; |
334 | 334 | |
@@ -358,12 +358,12 @@ discard block |
||
358 | 358 | protected function _getInputFieldValueFromLabel( $aField ) { |
359 | 359 | |
360 | 360 | // If the value key is explicitly set, use it. But the empty string will be ignored. |
361 | - if ( isset( $aField['value'] ) && $aField['value'] != '' ) { return $aField['value']; } |
|
361 | + if ( isset( $aField[ 'value' ] ) && $aField[ 'value' ] != '' ) { return $aField[ 'value' ]; } |
|
362 | 362 | |
363 | - if ( isset( $aField['label'] ) ) { return $aField['label']; } |
|
363 | + if ( isset( $aField[ 'label' ] ) ) { return $aField[ 'label' ]; } |
|
364 | 364 | |
365 | 365 | // If the default value is set, |
366 | - if ( isset( $aField['default'] ) ) { return $aField['default']; } |
|
366 | + if ( isset( $aField[ 'default' ] ) ) { return $aField[ 'default' ]; } |
|
367 | 367 | |
368 | 368 | } |
369 | 369 |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | * @since 3.5.3 |
128 | 128 | * @return array The label container attribute array. |
129 | 129 | */ |
130 | - private function _getLabelContainerAttributes( array $aField ) { |
|
130 | + private function _getLabelContainerAttributes( array $aField ) { |
|
131 | 131 | return array( |
132 | 132 | 'style' => $aField['label_min_width'] |
133 | 133 | ? "min-width:" . $this->sanitizeLength( $aField['label_min_width'] ) . ";" |
@@ -354,7 +354,7 @@ discard block |
||
354 | 354 | * @since 2.0.0 |
355 | 355 | * @since 2.1.5 Moved from AdminPageFramwrork_InputField. Changed the scope to protected from private. Removed the second parameter. |
356 | 356 | */ |
357 | - protected function _getInputFieldValueFromLabel( $aField ) { |
|
357 | + protected function _getInputFieldValueFromLabel( $aField ) { |
|
358 | 358 | |
359 | 359 | // If the value key is explicitly set, use it. But the empty string will be ignored. |
360 | 360 | if ( isset( $aField['value'] ) && $aField['value'] != '' ) { return $aField['value']; } |
@@ -1,11 +1,11 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Admin Page Framework |
|
4 | - * |
|
5 | - * http://en.michaeluno.jp/admin-page-framework/ |
|
6 | - * Copyright (c) 2013-2016 Michael Uno; Licensed MIT |
|
7 | - * |
|
8 | - */ |
|
3 | + * Admin Page Framework |
|
4 | + * |
|
5 | + * http://en.michaeluno.jp/admin-page-framework/ |
|
6 | + * Copyright (c) 2013-2016 Michael Uno; Licensed MIT |
|
7 | + * |
|
8 | + */ |
|
9 | 9 | |
10 | 10 | /** |
11 | 11 | * Provides an abstract base class to create meta boxes in generic admin pages created by the framework. |
@@ -277,7 +277,7 @@ |
||
277 | 277 | ); |
278 | 278 | } |
279 | 279 | |
280 | - /** |
|
280 | + /** |
|
281 | 281 | * Extracts meta box form fields options array from the given options array of an admin page. |
282 | 282 | * |
283 | 283 | * @since 3.5.6 |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | /** |
23 | 23 | * Defines the field type slugs used for this field type. |
24 | 24 | */ |
25 | - public $aFieldTypeSlugs = array( 'image', ); |
|
25 | + public $aFieldTypeSlugs = array( 'image',); |
|
26 | 26 | |
27 | 27 | /** |
28 | 28 | * Defines the default key-values of this field type. |
@@ -31,8 +31,8 @@ discard block |
||
31 | 31 | */ |
32 | 32 | protected $aDefaultKeys = array( |
33 | 33 | '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' ). |
34 | - 'show_preview' => true, // ( boolean ) Indicates whether the image preview should be displayed or not. |
|
35 | - 'allow_external_source' => true, // ( boolean ) Indicates whether the media library box has the From URL tab. |
|
34 | + 'show_preview' => true, // ( boolean ) Indicates whether the image preview should be displayed or not. |
|
35 | + 'allow_external_source' => true, // ( boolean ) Indicates whether the media library box has the From URL tab. |
|
36 | 36 | 'attributes' => array( |
37 | 37 | 'input' => array( |
38 | 38 | 'size' => 40, |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | return // $this->_getScript_CustomMediaUploaderObject() . PHP_EOL |
61 | 61 | $this->_getScript_ImageSelector( |
62 | 62 | "admin_page_framework" |
63 | - ) . PHP_EOL |
|
63 | + ).PHP_EOL |
|
64 | 64 | . $this->_getScript_RegisterCallbacks(); |
65 | 65 | } |
66 | 66 | /** |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | $_sInsertFromURL = esc_js( $this->oMsg->get( 'insert_from_url' ) ); |
184 | 184 | |
185 | 185 | // if the WordPress version is 3.4.x or below |
186 | - if ( ! function_exists( 'wp_enqueue_media' ) ) { |
|
186 | + if ( !function_exists( 'wp_enqueue_media' ) ) { |
|
187 | 187 | |
188 | 188 | return <<<JAVASCRIPTS |
189 | 189 | /** |
@@ -569,11 +569,11 @@ discard block |
||
569 | 569 | . "<label for='{$aField[ 'input_id' ]}'>" |
570 | 570 | . $aField[ 'before_input' ] |
571 | 571 | . $this->getAOrB( |
572 | - $aField[ 'label' ] && ! $aField[ 'repeatable' ], |
|
573 | - "<span class='admin-page-framework-input-label-string' style='min-width:" . $this->sanitizeLength( $aField[ 'label_min_width' ] ) . ";'>" . $aField[ 'label' ] . "</span>", |
|
572 | + $aField[ 'label' ] && !$aField[ 'repeatable' ], |
|
573 | + "<span class='admin-page-framework-input-label-string' style='min-width:".$this->sanitizeLength( $aField[ 'label_min_width' ] ).";'>".$aField[ 'label' ]."</span>", |
|
574 | 574 | '' |
575 | 575 | ) |
576 | - . "<input " . $this->getAttributes( $this->_getImageInputAttributes( $aField, $_iCountAttributes, $_sImageURL, $_aBaseAttributes ) ) . " />" |
|
576 | + . "<input ".$this->getAttributes( $this->_getImageInputAttributes( $aField, $_iCountAttributes, $_sImageURL, $_aBaseAttributes ) )." />" |
|
577 | 577 | . $aField[ 'after_input' ] |
578 | 578 | . "<div class='repeatable-field-buttons'></div>" // the repeatable field buttons will be replaced with this element. |
579 | 579 | . $this->getExtraInputFields( $aField ) |
@@ -612,7 +612,7 @@ discard block |
||
612 | 612 | */ |
613 | 613 | private function _getBaseAttributes( array $aField ) { |
614 | 614 | |
615 | - $_aBaseAttributes = $aField[ 'attributes' ] + array( 'class' => null ); |
|
615 | + $_aBaseAttributes = $aField[ 'attributes' ] + array( 'class' => null ); |
|
616 | 616 | unset( |
617 | 617 | $_aBaseAttributes[ 'input' ], |
618 | 618 | $_aBaseAttributes[ 'button' ], |
@@ -678,8 +678,8 @@ discard block |
||
678 | 678 | protected function getExtraInputFields( array $aField ) { |
679 | 679 | |
680 | 680 | $_aOutputs = array(); |
681 | - foreach( $this->getElementAsArray( $aField, 'attributes_to_store' ) as $sAttribute ) { |
|
682 | - $_aOutputs[] = "<input " . $this->getAttributes( |
|
681 | + foreach ( $this->getElementAsArray( $aField, 'attributes_to_store' ) as $sAttribute ) { |
|
682 | + $_aOutputs[ ] = "<input ".$this->getAttributes( |
|
683 | 683 | array( |
684 | 684 | 'id' => "{$aField[ 'input_id' ]}_{$sAttribute}", |
685 | 685 | 'type' => 'hidden', |
@@ -695,7 +695,7 @@ discard block |
||
695 | 695 | '' |
696 | 696 | ), |
697 | 697 | ) |
698 | - ) . "/>"; |
|
698 | + )."/>"; |
|
699 | 699 | } |
700 | 700 | return implode( PHP_EOL, $_aOutputs ); |
701 | 701 | |
@@ -707,17 +707,17 @@ discard block |
||
707 | 707 | */ |
708 | 708 | protected function _getPreviewContainer( $aField, $sImageURL, $aPreviewAtrributes ) { |
709 | 709 | |
710 | - if ( ! $aField[ 'show_preview' ] ) { |
|
710 | + if ( !$aField[ 'show_preview' ] ) { |
|
711 | 711 | return ''; |
712 | 712 | } |
713 | 713 | |
714 | 714 | $sImageURL = esc_url( $this->getResolvedSRC( $sImageURL, true ) ); |
715 | 715 | return |
716 | - "<div " . $this->getAttributes( |
|
716 | + "<div ".$this->getAttributes( |
|
717 | 717 | array( |
718 | 718 | 'id' => "image_preview_container_{$aField[ 'input_id' ]}", |
719 | - 'class' => 'image_preview ' . $this->getElement( $aPreviewAtrributes, 'class', '' ), |
|
720 | - 'style' => $this->getAOrB( $sImageURL, '', "display: none; " ) |
|
719 | + 'class' => 'image_preview '.$this->getElement( $aPreviewAtrributes, 'class', '' ), |
|
720 | + 'style' => $this->getAOrB( $sImageURL, '', "display: none; " ) |
|
721 | 721 | . $this->getElement( $aPreviewAtrributes, 'style', '' ), |
722 | 722 | ) + $aPreviewAtrributes |
723 | 723 | ) |
@@ -742,7 +742,7 @@ discard block |
||
742 | 742 | // Do not include the escaping character (backslash) in the heredoc variable declaration |
743 | 743 | // because the minifier script will parse it and the <<<JAVASCRIPTS and JAVASCRIPTS; parts are converted to double quotes (") |
744 | 744 | // which causes the PHP syntax error. |
745 | - $_sButtonHTML = '"' . $this->_getUploaderButtonHTML( $sInputID, $aButtonAttributes, $bRpeatable, $bExternalSource ) . '"'; |
|
745 | + $_sButtonHTML = '"'.$this->_getUploaderButtonHTML( $sInputID, $aButtonAttributes, $bRpeatable, $bExternalSource ).'"'; |
|
746 | 746 | $_sScript = <<<JAVASCRIPTS |
747 | 747 | if ( 0 === jQuery( 'a#select_image_{$sInputID}' ).length ) { |
748 | 748 | jQuery( 'input#{$sInputID}' ).after( $_sButtonHTML ); |
@@ -756,7 +756,7 @@ discard block |
||
756 | 756 | . '/* <![CDATA[ */' |
757 | 757 | . $_sScript |
758 | 758 | . '/* ]]> */' |
759 | - . "</script>". PHP_EOL; |
|
759 | + . "</script>".PHP_EOL; |
|
760 | 760 | |
761 | 761 | } |
762 | 762 | /** |
@@ -774,7 +774,7 @@ discard block |
||
774 | 774 | $bRpeatable, |
775 | 775 | $bExternalSource |
776 | 776 | ); |
777 | - return "<a " . $this->getAttributes( $_aAttributes ) . ">" |
|
777 | + return "<a ".$this->getAttributes( $_aAttributes ).">" |
|
778 | 778 | . ( $_bIsLabelSet |
779 | 779 | ? $_aAttributes[ 'data-label' ] |
780 | 780 | : ( strrpos( $_aAttributes[ 'class' ], 'dashicons' ) |
@@ -792,7 +792,7 @@ discard block |
||
792 | 792 | */ |
793 | 793 | private function _getFormattedUploadButtonAttributes( $sInputID, array $aButtonAttributes, $_bIsLabelSet, $bRpeatable, $bExternalSource ) { |
794 | 794 | |
795 | - $_aAttributes = array( |
|
795 | + $_aAttributes = array( |
|
796 | 796 | 'id' => "select_image_{$sInputID}", |
797 | 797 | 'href' => '#', |
798 | 798 | 'data-uploader_type' => ( string ) function_exists( 'wp_enqueue_media' ), |
@@ -805,7 +805,7 @@ discard block |
||
805 | 805 | : $this->oMsg->get( 'select_image' ), |
806 | 806 | 'data-label' => null, |
807 | 807 | ); |
808 | - $_aAttributes[ 'class' ] = $this->getClassAttribute( |
|
808 | + $_aAttributes[ 'class' ] = $this->getClassAttribute( |
|
809 | 809 | 'select_image button button-small ', |
810 | 810 | $this->getAOrB( |
811 | 811 | trim( $aButtonAttributes[ 'class' ] ), |
@@ -832,16 +832,16 @@ discard block |
||
832 | 832 | * @since 3.5.3 Aded the `$sType` parameter. |
833 | 833 | * @return string |
834 | 834 | */ |
835 | - protected function _getRemoveButtonScript( $sInputID, array $aButtonAttributes, $sType='image' ) { |
|
835 | + protected function _getRemoveButtonScript( $sInputID, array $aButtonAttributes, $sType = 'image' ) { |
|
836 | 836 | |
837 | - if ( ! function_exists( 'wp_enqueue_media' ) ) { |
|
837 | + if ( !function_exists( 'wp_enqueue_media' ) ) { |
|
838 | 838 | return ''; |
839 | 839 | } |
840 | 840 | |
841 | 841 | // Do not include the escaping character (backslash) in the heredoc variable declaration |
842 | 842 | // because the minifier script will parse it and the <<<JAVASCRIPTS and JAVASCRIPTS; parts are converted to double quotes (") |
843 | 843 | // which causes the PHP syntax error. |
844 | - $_sButtonHTML = '"' . $this->_getRemoveButtonHTMLByType( $sInputID, $aButtonAttributes, $sType ) . '"'; |
|
844 | + $_sButtonHTML = '"'.$this->_getRemoveButtonHTMLByType( $sInputID, $aButtonAttributes, $sType ).'"'; |
|
845 | 845 | $_sScript = <<<JAVASCRIPTS |
846 | 846 | if ( 0 === jQuery( 'a#remove_{$sType}_{$sInputID}' ).length ) { |
847 | 847 | jQuery( 'input#{$sInputID}' ).after( $_sButtonHTML ); |
@@ -852,7 +852,7 @@ discard block |
||
852 | 852 | . '/* <![CDATA[ */' |
853 | 853 | . $_sScript |
854 | 854 | . '/* ]]> */' |
855 | - . "</script>". PHP_EOL; |
|
855 | + . "</script>".PHP_EOL; |
|
856 | 856 | |
857 | 857 | } |
858 | 858 | |
@@ -861,11 +861,11 @@ discard block |
||
861 | 861 | * @since 3.5.3 |
862 | 862 | * @return string The generated HTML remove button output. |
863 | 863 | */ |
864 | - protected function _getRemoveButtonHTMLByType( $sInputID, array $aButtonAttributes, $sType='image' ) { |
|
864 | + protected function _getRemoveButtonHTMLByType( $sInputID, array $aButtonAttributes, $sType = 'image' ) { |
|
865 | 865 | |
866 | 866 | $_bIsLabelSet = isset( $aButtonAttributes[ 'data-label' ] ) && $aButtonAttributes[ 'data-label' ]; |
867 | 867 | $_aAttributes = $this->_getFormattedRemoveButtonAttributesByType( $sInputID, $aButtonAttributes, $_bIsLabelSet, $sType ); |
868 | - return "<a " . $this->getAttributes( $_aAttributes ) . ">" |
|
868 | + return "<a ".$this->getAttributes( $_aAttributes ).">" |
|
869 | 869 | . ( $_bIsLabelSet |
870 | 870 | ? $_aAttributes[ 'data-label' ] |
871 | 871 | : $this->getAOrB( |
@@ -883,9 +883,9 @@ discard block |
||
883 | 883 | * @since 3.5.3 |
884 | 884 | * @return array The formatted remove button attributes array. |
885 | 885 | */ |
886 | - protected function _getFormattedRemoveButtonAttributesByType( $sInputID, array $aButtonAttributes, $_bIsLabelSet, $sType='image' ) { |
|
886 | + protected function _getFormattedRemoveButtonAttributesByType( $sInputID, array $aButtonAttributes, $_bIsLabelSet, $sType = 'image' ) { |
|
887 | 887 | |
888 | - $_sOnClickFunctionName = 'removeInputValuesFor' . ucfirst( $sType ); |
|
888 | + $_sOnClickFunctionName = 'removeInputValuesFor'.ucfirst( $sType ); |
|
889 | 889 | $_aAttributes = array( |
890 | 890 | 'id' => "remove_{$sType}_{$sInputID}", |
891 | 891 | 'href' => '#', |
@@ -897,7 +897,7 @@ discard block |
||
897 | 897 | ? $aButtonAttributes[ 'data-label' ] |
898 | 898 | : $this->oMsg->get( 'remove_value' ), |
899 | 899 | ); |
900 | - $_aAttributes[ 'class' ] = $this->getClassAttribute( |
|
900 | + $_aAttributes[ 'class' ] = $this->getClassAttribute( |
|
901 | 901 | "remove_value remove_{$sType} button button-small", |
902 | 902 | $this->getAOrB( |
903 | 903 | trim( $aButtonAttributes[ 'class' ] ), |
@@ -478,7 +478,7 @@ discard block |
||
478 | 478 | /** |
479 | 479 | * Returns the field type specific CSS rules. |
480 | 480 | */ |
481 | - protected function getStyles() { |
|
481 | + protected function getStyles() { |
|
482 | 482 | return <<<CSSRULES |
483 | 483 | /* Image Field Preview Container */ |
484 | 484 | .admin-page-framework-field .image_preview { |
@@ -707,7 +707,7 @@ discard block |
||
707 | 707 | */ |
708 | 708 | protected function _getPreviewContainer( $aField, $sImageURL, $aPreviewAtrributes ) { |
709 | 709 | |
710 | - if ( ! $aField[ 'show_preview' ] ) { |
|
710 | + if ( ! $aField[ 'show_preview' ] ) { |
|
711 | 711 | return ''; |
712 | 712 | } |
713 | 713 |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | /** |
22 | 22 | * Defines the field type slugs used for this field type. |
23 | 23 | */ |
24 | - public $aFieldTypeSlugs = array( 'size', ); |
|
24 | + public $aFieldTypeSlugs = array( 'size',); |
|
25 | 25 | |
26 | 26 | /** |
27 | 27 | * Defines the default key-values of this field type. |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | */ |
31 | 31 | protected $aDefaultKeys = array( |
32 | 32 | 'is_multiple' => false, // indicates whether the select tag alloes multiple selections. |
33 | - 'units' => null, // do not define units here since this will be merged with the user defined field array. |
|
33 | + 'units' => null, // do not define units here since this will be merged with the user defined field array. |
|
34 | 34 | 'attributes' => array( |
35 | 35 | 'size' => array( |
36 | 36 | 'size' => 10, |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | */ |
60 | 60 | protected $aDefaultUnits = array( |
61 | 61 | 'px' => 'px', // pixel |
62 | - '%' => '%', // percentage |
|
62 | + '%' => '%', // percentage |
|
63 | 63 | 'em' => 'em', // font size |
64 | 64 | 'ex' => 'ex', // font height |
65 | 65 | 'in' => 'in', // inch |
@@ -116,8 +116,8 @@ discard block |
||
116 | 116 | ); |
117 | 117 | |
118 | 118 | $_aOutput = array(); |
119 | - foreach( ( array ) $aField[ 'label' ] as $_isKey => $_sLabel ) { |
|
120 | - $_aOutput[] = $this->_getFieldOutputByLabel( |
|
119 | + foreach ( ( array ) $aField[ 'label' ] as $_isKey => $_sLabel ) { |
|
120 | + $_aOutput[ ] = $this->_getFieldOutputByLabel( |
|
121 | 121 | $_isKey, |
122 | 122 | $_sLabel, |
123 | 123 | $aField |
@@ -139,22 +139,22 @@ discard block |
||
139 | 139 | |
140 | 140 | $_aBaseAttributes = $_bMultiLabels |
141 | 141 | ? array( |
142 | - 'name' => $aField[ 'attributes' ][ 'name' ] . "[{$isKey}]", |
|
143 | - 'id' => $aField[ 'attributes' ][ 'id' ] . "_{$isKey}", |
|
142 | + 'name' => $aField[ 'attributes' ][ 'name' ]."[{$isKey}]", |
|
143 | + 'id' => $aField[ 'attributes' ][ 'id' ]."_{$isKey}", |
|
144 | 144 | 'value' => $aField[ 'value' ], |
145 | 145 | ) |
146 | 146 | + $aField[ 'attributes' ] |
147 | 147 | : $aField[ 'attributes' ]; |
148 | 148 | unset( |
149 | - $_aBaseAttributes['unit'], |
|
150 | - $_aBaseAttributes['size'] |
|
149 | + $_aBaseAttributes[ 'unit' ], |
|
150 | + $_aBaseAttributes[ 'size' ] |
|
151 | 151 | ); |
152 | 152 | |
153 | 153 | $_aOutput = array( |
154 | 154 | $this->getElementByLabel( $aField[ 'before_label' ], $isKey, $aField[ 'label' ] ), |
155 | - "<div class='admin-page-framework-input-label-container admin-page-framework-select-label' style='min-width: " . $this->sanitizeLength( $aField[ 'label_min_width' ] ) . ";'>", |
|
156 | - $this->_getNumberInputPart( $aField, $_aBaseAttributes, $isKey, $aField[ 'label' ] ), // The size (number) part |
|
157 | - $this->_getUnitSelectInput( $aField, $_aBaseAttributes, $isKey, $aField[ 'label' ] ), // The unit (select) part |
|
155 | + "<div class='admin-page-framework-input-label-container admin-page-framework-select-label' style='min-width: ".$this->sanitizeLength( $aField[ 'label_min_width' ] ).";'>", |
|
156 | + $this->_getNumberInputPart( $aField, $_aBaseAttributes, $isKey, $aField[ 'label' ] ), // The size (number) part |
|
157 | + $this->_getUnitSelectInput( $aField, $_aBaseAttributes, $isKey, $aField[ 'label' ] ), // The unit (select) part |
|
158 | 158 | "</div>", |
159 | 159 | $this->getElementByLabel( $aField[ 'after_label' ], $isKey, $aField[ 'label' ] ) |
160 | 160 | ); |
@@ -170,39 +170,39 @@ discard block |
||
170 | 170 | private function _getNumberInputPart( array $aField, array $aBaseAttributes, $isKey, $bMultiLabels ) { |
171 | 171 | |
172 | 172 | // Size and Size Label |
173 | - $_aSizeAttributes = $this->_getSizeAttributes( |
|
173 | + $_aSizeAttributes = $this->_getSizeAttributes( |
|
174 | 174 | $aField, |
175 | 175 | $aBaseAttributes, |
176 | 176 | $bMultiLabels |
177 | 177 | ? $isKey |
178 | 178 | : '' |
179 | 179 | ); |
180 | - $_aSizeLabelAttributes = array( |
|
180 | + $_aSizeLabelAttributes = array( |
|
181 | 181 | 'for' => $_aSizeAttributes[ 'id' ], |
182 | 182 | 'class' => $_aSizeAttributes[ 'disabled' ] |
183 | 183 | ? 'disabled' |
184 | 184 | : null, |
185 | 185 | ); |
186 | 186 | |
187 | - $_sLabel = $this->getElementByLabel( |
|
187 | + $_sLabel = $this->getElementByLabel( |
|
188 | 188 | $aField[ 'label' ], |
189 | 189 | $isKey, |
190 | 190 | $aField[ 'label' ] |
191 | 191 | ); |
192 | - return "<label " . $this->getAttributes( $_aSizeLabelAttributes ) . ">" |
|
192 | + return "<label ".$this->getAttributes( $_aSizeLabelAttributes ).">" |
|
193 | 193 | . $this->getElement( |
194 | 194 | $aField, |
195 | 195 | $bMultiLabels |
196 | 196 | ? array( 'before_label', $isKey, 'size' ) |
197 | 197 | : array( 'before_label', 'size' ) |
198 | 198 | ) |
199 | - . ( $aField['label'] && ! $aField[ 'repeatable' ] |
|
200 | - ? "<span class='admin-page-framework-input-label-string' style='min-width:" . $this->sanitizeLength( $aField[ 'label_min_width' ] ) . ";'>" |
|
199 | + . ( $aField[ 'label' ] && !$aField[ 'repeatable' ] |
|
200 | + ? "<span class='admin-page-framework-input-label-string' style='min-width:".$this->sanitizeLength( $aField[ 'label_min_width' ] ).";'>" |
|
201 | 201 | . $_sLabel |
202 | 202 | . "</span>" |
203 | 203 | : "" |
204 | 204 | ) |
205 | - . "<input " . $this->getAttributes( $_aSizeAttributes ) . " />" |
|
205 | + . "<input ".$this->getAttributes( $_aSizeAttributes )." />" |
|
206 | 206 | . $this->getElement( |
207 | 207 | $aField, |
208 | 208 | $bMultiLabels |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | ) |
245 | 245 | : $aField[ 'units' ]; |
246 | 246 | |
247 | - return "<label " . $this->getAttributes( |
|
247 | + return "<label ".$this->getAttributes( |
|
248 | 248 | array( |
249 | 249 | 'for' => $_aUnitAttributes[ 'id' ], |
250 | 250 | 'class' => $_aUnitAttributes[ 'disabled' ] |
@@ -275,9 +275,9 @@ discard block |
||
275 | 275 | * @since 3.5.3 |
276 | 276 | * @return array an unit attribute array |
277 | 277 | */ |
278 | - private function _getUnitAttributes( array $aField, array $aBaseAttributes, $isLabelKey='' ) { |
|
278 | + private function _getUnitAttributes( array $aField, array $aBaseAttributes, $isLabelKey = '' ) { |
|
279 | 279 | |
280 | - $_bIsMultiple = $aField[ 'is_multiple' ] |
|
280 | + $_bIsMultiple = $aField[ 'is_multiple' ] |
|
281 | 281 | ? true |
282 | 282 | : $this->getElement( |
283 | 283 | $aField, |
@@ -289,13 +289,13 @@ discard block |
||
289 | 289 | |
290 | 290 | $_aSelectAttributes = array( |
291 | 291 | 'type' => 'select', |
292 | - 'id' => $aField[ 'input_id' ] . ( '' === $isLabelKey ? '' : '_' . $isLabelKey ) . '_' . 'unit', |
|
292 | + 'id' => $aField[ 'input_id' ].( '' === $isLabelKey ? '' : '_'.$isLabelKey ).'_'.'unit', |
|
293 | 293 | 'multiple' => $_bIsMultiple |
294 | 294 | ? 'multiple' |
295 | 295 | : null, |
296 | 296 | 'name' => $_bIsMultiple |
297 | - ? "{$aField['_input_name']}" . ( '' === $isLabelKey ? '' : '[' . $isLabelKey . ']' ) . "[unit][]" |
|
298 | - : "{$aField['_input_name']}" . ( '' === $isLabelKey ? '' : '[' . $isLabelKey . ']' ) . "[unit]", |
|
297 | + ? "{$aField[ '_input_name' ]}".( '' === $isLabelKey ? '' : '['.$isLabelKey.']' )."[unit][]" |
|
298 | + : "{$aField[ '_input_name' ]}".( '' === $isLabelKey ? '' : '['.$isLabelKey.']' )."[unit]", |
|
299 | 299 | 'value' => $this->getElement( |
300 | 300 | $aField, |
301 | 301 | array( 'value', 'unit' ), |
@@ -307,7 +307,7 @@ discard block |
||
307 | 307 | '' === $isLabelKey |
308 | 308 | ? array( 'attributes', 'unit' ) |
309 | 309 | : array( 'attributes', $isLabelKey, 'unit' ), |
310 | - $this->aDefaultKeys['attributes']['unit'] |
|
310 | + $this->aDefaultKeys[ 'attributes' ][ 'unit' ] |
|
311 | 311 | ) |
312 | 312 | + $aBaseAttributes; |
313 | 313 | return $_aSelectAttributes; |
@@ -320,15 +320,15 @@ discard block |
||
320 | 320 | * @since 3.5.3 |
321 | 321 | * @return array an size attribute array |
322 | 322 | */ |
323 | - private function _getSizeAttributes( array $aField, array $aBaseAttributes, $sLabelKey='' ) { |
|
323 | + private function _getSizeAttributes( array $aField, array $aBaseAttributes, $sLabelKey = '' ) { |
|
324 | 324 | |
325 | 325 | return array( |
326 | 326 | 'type' => 'number', |
327 | - 'id' => $aField['input_id'] . '_' . ( '' !== $sLabelKey ? $sLabelKey . '_' : '' ) . 'size', |
|
328 | - 'name' => $aField[ '_input_name' ] . ( '' !== $sLabelKey ? "[{$sLabelKey}]" : '' ) . '[size]', |
|
327 | + 'id' => $aField[ 'input_id' ].'_'.( '' !== $sLabelKey ? $sLabelKey.'_' : '' ).'size', |
|
328 | + 'name' => $aField[ '_input_name' ].( '' !== $sLabelKey ? "[{$sLabelKey}]" : '' ).'[size]', |
|
329 | 329 | 'value' => $this->getElement( |
330 | - $aField, // subject |
|
331 | - array( 'value', 'size' ), // dimensional keys |
|
330 | + $aField, // subject |
|
331 | + array( 'value', 'size' ), // dimensional keys |
|
332 | 332 | '' // default |
333 | 333 | ), |
334 | 334 | ) |
@@ -25,7 +25,7 @@ |
||
25 | 25 | /** |
26 | 26 | * Defines the field type slugs used for this field type. |
27 | 27 | */ |
28 | - public $aFieldTypeSlugs = array( 'section_title', ); |
|
28 | + public $aFieldTypeSlugs = array( 'section_title',); |
|
29 | 29 | |
30 | 30 | /** |
31 | 31 | * Defines the default key-values of this field type. |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | /** |
22 | 22 | * Defines the field type slugs used for this field type. |
23 | 23 | */ |
24 | - public $aFieldTypeSlugs = array( 'media', ); |
|
24 | + public $aFieldTypeSlugs = array( 'media',); |
|
25 | 25 | |
26 | 26 | /** |
27 | 27 | * Defines the default key-values of this field type. |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | return |
54 | 54 | $this->_getScript_MediaUploader( |
55 | 55 | "admin_page_framework" |
56 | - ) . PHP_EOL |
|
56 | + ).PHP_EOL |
|
57 | 57 | . $this->_getScript_RegisterCallbacks(); |
58 | 58 | } |
59 | 59 | |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | $_sInsertFromURL = esc_js( $this->oMsg->get( 'insert_from_url' ) ); |
149 | 149 | |
150 | 150 | // If the WordPress version is 3.4.x or below |
151 | - if ( ! function_exists( 'wp_enqueue_media' ) ) { |
|
151 | + if ( !function_exists( 'wp_enqueue_media' ) ) { |
|
152 | 152 | return <<<JAVASCRIPTS |
153 | 153 | /** |
154 | 154 | * Bind/rebinds the thickbox script the given selector element. |
@@ -388,8 +388,8 @@ discard block |
||
388 | 388 | // Do not include the escaping character (backslash) in the heredoc variable declaration |
389 | 389 | // because the minifier script will parse it and the <<<JAVASCRIPTS and JAVASCRIPTS; parts are converted to double quotes (") |
390 | 390 | // which causes the PHP syntax error. |
391 | - $_sButtonHTML = '"' . $this->_getUploaderButtonHTML_Media( $sInputID, $aButtonAttributes, $bExternalSource ) . '"'; |
|
392 | - $_sScript = <<<JAVASCRIPTS |
|
391 | + $_sButtonHTML = '"'.$this->_getUploaderButtonHTML_Media( $sInputID, $aButtonAttributes, $bExternalSource ).'"'; |
|
392 | + $_sScript = <<<JAVASCRIPTS |
|
393 | 393 | if ( jQuery( 'a#select_media_{$sInputID}' ).length == 0 ) { |
394 | 394 | jQuery( 'input#{$sInputID}' ).after( $_sButtonHTML ); |
395 | 395 | } |
@@ -400,7 +400,7 @@ discard block |
||
400 | 400 | |
401 | 401 | return "<script type='text/javascript' class='admin-page-framework-media-uploader-button'>" |
402 | 402 | . $_sScript |
403 | - . "</script>". PHP_EOL; |
|
403 | + . "</script>".PHP_EOL; |
|
404 | 404 | |
405 | 405 | } |
406 | 406 | /** |
@@ -410,19 +410,19 @@ discard block |
||
410 | 410 | */ |
411 | 411 | private function _getUploaderButtonHTML_Media( $sInputID, array $aButtonAttributes, $bExternalSource ) { |
412 | 412 | |
413 | - $_bIsLabelSet = isset( $aButtonAttributes['data-label'] ) && $aButtonAttributes['data-label']; |
|
413 | + $_bIsLabelSet = isset( $aButtonAttributes[ 'data-label' ] ) && $aButtonAttributes[ 'data-label' ]; |
|
414 | 414 | $_aAttributes = $this->_getFormattedUploadButtonAttributes_Media( |
415 | 415 | $sInputID, |
416 | 416 | $aButtonAttributes, |
417 | 417 | $_bIsLabelSet, |
418 | 418 | $bExternalSource |
419 | 419 | ); |
420 | - return "<a " . $this->getAttributes( $_aAttributes ) . ">" |
|
420 | + return "<a ".$this->getAttributes( $_aAttributes ).">" |
|
421 | 421 | . $this->getAOrB( |
422 | 422 | $_bIsLabelSet, |
423 | - $_aAttributes['data-label'], |
|
423 | + $_aAttributes[ 'data-label' ], |
|
424 | 424 | $this->getAOrB( |
425 | - strrpos( $_aAttributes['class'], 'dashicons' ), |
|
425 | + strrpos( $_aAttributes[ 'class' ], 'dashicons' ), |
|
426 | 426 | '', |
427 | 427 | $this->oMsg->get( 'select_file' ) |
428 | 428 | ) |
@@ -437,26 +437,26 @@ discard block |
||
437 | 437 | */ |
438 | 438 | private function _getFormattedUploadButtonAttributes_Media( $sInputID, array $aButtonAttributes, $_bIsLabelSet, $bExternalSource ) { |
439 | 439 | |
440 | - $_aAttributes = array( |
|
440 | + $_aAttributes = array( |
|
441 | 441 | 'id' => "select_media_{$sInputID}", |
442 | 442 | 'href' => '#', |
443 | - 'data-uploader_type' => ( string ) function_exists( 'wp_enqueue_media' ), // ? 1 : 0, |
|
444 | - 'data-enable_external_source' => ( string ) ( bool ) $bExternalSource, // ? 1 : 0, |
|
443 | + 'data-uploader_type' => ( string ) function_exists( 'wp_enqueue_media' ), // ? 1 : 0, |
|
444 | + 'data-enable_external_source' => ( string ) ( bool ) $bExternalSource, // ? 1 : 0, |
|
445 | 445 | ) |
446 | 446 | + $aButtonAttributes |
447 | 447 | + array( |
448 | 448 | 'title' => $_bIsLabelSet |
449 | - ? $aButtonAttributes['data-label'] |
|
449 | + ? $aButtonAttributes[ 'data-label' ] |
|
450 | 450 | : $this->oMsg->get( 'select_file' ), |
451 | 451 | 'data-label' => null, |
452 | 452 | ); |
453 | - $_aAttributes['class'] = $this->getClassAttribute( |
|
453 | + $_aAttributes[ 'class' ] = $this->getClassAttribute( |
|
454 | 454 | 'select_media button button-small ', |
455 | 455 | $this->getAOrB( |
456 | - trim( $aButtonAttributes['class'] ), |
|
457 | - $aButtonAttributes['class'], |
|
456 | + trim( $aButtonAttributes[ 'class' ] ), |
|
457 | + $aButtonAttributes[ 'class' ], |
|
458 | 458 | $this->getAOrB( |
459 | - ! $_bIsLabelSet && version_compare( $GLOBALS['wp_version'], '3.8', '>=' ), |
|
459 | + !$_bIsLabelSet && version_compare( $GLOBALS[ 'wp_version' ], '3.8', '>=' ), |
|
460 | 460 | 'dashicons dashicons-portfolio', |
461 | 461 | '' |
462 | 462 | ) |
@@ -75,11 +75,11 @@ discard block |
||
75 | 75 | */ |
76 | 76 | protected function getField( $aField ) { |
77 | 77 | |
78 | - $_aOutput = array(); |
|
79 | - foreach( $this->getAsArray( $aField['label'] ) as $_sKey => $_sLabel ) { |
|
80 | - $_aOutput[] = $this->_getEachRadioButtonOutput( $aField, $_sKey, $_sLabel ); |
|
78 | + $_aOutput = array(); |
|
79 | + foreach ( $this->getAsArray( $aField[ 'label' ] ) as $_sKey => $_sLabel ) { |
|
80 | + $_aOutput[ ] = $this->_getEachRadioButtonOutput( $aField, $_sKey, $_sLabel ); |
|
81 | 81 | } |
82 | - $_aOutput[] = $this->_getUpdateCheckedScript( $aField['input_id'] ); |
|
82 | + $_aOutput[ ] = $this->_getUpdateCheckedScript( $aField[ 'input_id' ] ); |
|
83 | 83 | return implode( PHP_EOL, $_aOutput ); |
84 | 84 | |
85 | 85 | } |
@@ -93,12 +93,12 @@ discard block |
||
93 | 93 | $_aAttributes = $aField[ 'attributes' ] + $this->getElementAsArray( $aField, array( 'attributes', $sKey ) ); |
94 | 94 | $_oRadio = new AdminPageFramework_Input_radio( $_aAttributes ); |
95 | 95 | $_oRadio->setAttributesByKey( $sKey ); |
96 | - $_oRadio->setAttribute( 'data-default', $aField['default'] ); // refered by the repeater script |
|
96 | + $_oRadio->setAttribute( 'data-default', $aField[ 'default' ] ); // refered by the repeater script |
|
97 | 97 | |
98 | 98 | // Output |
99 | 99 | return $this->getElementByLabel( $aField[ 'before_label' ], $sKey, $aField[ 'label' ] ) |
100 | - . "<div class='admin-page-framework-input-label-container admin-page-framework-radio-label' style='min-width: " . $this->sanitizeLength( $aField['label_min_width'] ) . ";'>" |
|
101 | - . "<label " . $this->getAttributes( |
|
100 | + . "<div class='admin-page-framework-input-label-container admin-page-framework-radio-label' style='min-width: ".$this->sanitizeLength( $aField[ 'label_min_width' ] ).";'>" |
|
101 | + . "<label ".$this->getAttributes( |
|
102 | 102 | array( |
103 | 103 | 'for' => $_oRadio->getAttribute( 'id' ), |
104 | 104 | 'class' => $_oRadio->getAttribute( 'disabled' ) |
@@ -76,7 +76,7 @@ |
||
76 | 76 | protected function getField( $aField ) { |
77 | 77 | |
78 | 78 | $_aOutput = array(); |
79 | - foreach( $this->getAsArray( $aField['label'] ) as $_sKey => $_sLabel ) { |
|
79 | + foreach( $this->getAsArray( $aField['label'] ) as $_sKey => $_sLabel ) { |
|
80 | 80 | $_aOutput[] = $this->_getEachRadioButtonOutput( $aField, $_sKey, $_sLabel ); |
81 | 81 | } |
82 | 82 | $_aOutput[] = $this->_getUpdateCheckedScript( $aField['input_id'] ); |
@@ -71,7 +71,7 @@ |
||
71 | 71 | * </code> |
72 | 72 | * @access public This must be public as accessed from outside. |
73 | 73 | */ |
74 | - public $aFieldTypeSlugs = array( 'default', ); |
|
74 | + public $aFieldTypeSlugs = array( 'default',); |
|
75 | 75 | |
76 | 76 | /** |
77 | 77 | * Defines the default key-values of this field type. |
@@ -38,7 +38,7 @@ |
||
38 | 38 | * @since 3.5.0 |
39 | 39 | * @callback fieldtype hfDoOnRegistration |
40 | 40 | */ |
41 | - public function _replyToDoOnFieldRegistration( array $aField ) { |
|
41 | + public function _replyToDoOnFieldRegistration( array $aField ) { |
|
42 | 42 | return $this->doOnFieldRegistration( $aField ); |
43 | 43 | } |
44 | 44 |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | /** |
22 | 22 | * Defines the field type slugs used for this field type. |
23 | 23 | */ |
24 | - public $aFieldTypeSlugs = array( 'select', ); |
|
24 | + public $aFieldTypeSlugs = array( 'select',); |
|
25 | 25 | |
26 | 26 | /** |
27 | 27 | * Defines the default key-values of this field type. |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | 'select' => array( |
34 | 34 | 'size' => 1, |
35 | 35 | 'autofocusNew' => null, |
36 | - 'multiple' => null, // set 'multiple' for multiple selections. If 'is_multiple' is set, it takes the precedence. |
|
36 | + 'multiple' => null, // set 'multiple' for multiple selections. If 'is_multiple' is set, it takes the precedence. |
|
37 | 37 | 'required' => null, |
38 | 38 | ), |
39 | 39 | 'optgroup' => array(), |
@@ -72,12 +72,12 @@ discard block |
||
72 | 72 | protected function getField( $aField ) { |
73 | 73 | |
74 | 74 | $_oSelectInput = new AdminPageFramework_Input_select( $aField[ 'attributes' ] ); |
75 | - if ( $aField[ 'is_multiple' ] ) { |
|
75 | + if ( $aField[ 'is_multiple' ] ) { |
|
76 | 76 | $_oSelectInput->setAttribute( array( 'select', 'multiple' ), 'multiple' ); |
77 | 77 | } |
78 | 78 | return |
79 | 79 | $aField[ 'before_label' ] |
80 | - . "<div class='admin-page-framework-input-label-container admin-page-framework-select-label' style='min-width: " . $this->sanitizeLength( $aField[ 'label_min_width' ] ) . ";'>" |
|
80 | + . "<div class='admin-page-framework-input-label-container admin-page-framework-select-label' style='min-width: ".$this->sanitizeLength( $aField[ 'label_min_width' ] ).";'>" |
|
81 | 81 | . "<label for='{$aField[ 'input_id' ]}'>" |
82 | 82 | . $aField[ 'before_input' ] |
83 | 83 | . $_oSelectInput->get( $aField[ 'label' ] ) |
@@ -72,7 +72,7 @@ |
||
72 | 72 | protected function getField( $aField ) { |
73 | 73 | |
74 | 74 | $_oSelectInput = new AdminPageFramework_Input_select( $aField[ 'attributes' ] ); |
75 | - if ( $aField[ 'is_multiple' ] ) { |
|
75 | + if ( $aField[ 'is_multiple' ] ) { |
|
76 | 76 | $_oSelectInput->setAttribute( array( 'select', 'multiple' ), 'multiple' ); |
77 | 77 | } |
78 | 78 | return |